maildirmake.c (725B)
1 #include <sys/stat.h> 2 #include <unistd.h> 3 #include "strerr.h" 4 5 #define FATAL "maildirmake: fatal: " 6 7 int main(int argc, char **argv) 8 { 9 umask(077); 10 if (!argv[1]) 11 strerr_die1x(100,"maildirmake: usage: maildirmake name"); 12 if (mkdir(argv[1],0700) == -1) 13 strerr_die4sys(111,FATAL,"unable to mkdir ",argv[1],": "); 14 if (chdir(argv[1]) == -1) 15 strerr_die4sys(111,FATAL,"unable to chdir to ",argv[1],": "); 16 if (mkdir("tmp",0700) == -1) 17 strerr_die4sys(111,FATAL,"unable to mkdir ",argv[1],"/tmp: "); 18 if (mkdir("new",0700) == -1) 19 strerr_die4sys(111,FATAL,"unable to mkdir ",argv[1],"/new: "); 20 if (mkdir("cur",0700) == -1) 21 strerr_die4sys(111,FATAL,"unable to mkdir ",argv[1],"/cur: "); 22 return 0; 23 }