summaryrefslogtreecommitdiff
path: root/src/maildirmake.c
diff options
context:
space:
mode:
authorJannis Hoffmann <jannis@fehcom.de>2024-07-03 15:48:04 +0200
committerJannis Hoffmann <jannis@fehcom.de>2024-07-03 15:48:04 +0200
commit89b7b67a13ebb7965cc7f13ad0595e2194a2d34c (patch)
tree25efd77a90ae87236e6730d8ea3846bbe0fd126f /src/maildirmake.c
add sqmail-4.2.29asqmail-4.2
Diffstat (limited to 'src/maildirmake.c')
-rw-r--r--src/maildirmake.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/maildirmake.c b/src/maildirmake.c
new file mode 100644
index 0000000..47edc44
--- /dev/null
+++ b/src/maildirmake.c
@@ -0,0 +1,24 @@
+#include <sys/stat.h>
+#include <unistd.h>
+#include "logmsg.h"
+#include "exit.h"
+
+#define WHO "maildirmake"
+
+int main(int argc, char **argv)
+{
+ umask(077);
+ if (!argv[1])
+ logmsg(WHO,100,USAGE,"maildirmake name");
+ if (mkdir(argv[1],0700) == -1)
+ logmsg(WHO,111,FATAL,B("unable to mkdir: ",argv[1]));
+ if (chdir(argv[1]) == -1)
+ logmsg(WHO,111,FATAL,B("unable to chdir to: ",argv[1]));
+ if (mkdir("tmp",0700) == -1)
+ logmsg(WHO,111,FATAL,B("unable to mkdir: ",argv[1],"/tmp"));
+ if (mkdir("new",0700) == -1)
+ logmsg(WHO,111,FATAL,B("unable to mkdir: ",argv[1],"/new"));
+ if (mkdir("cur",0700) == -1)
+ logmsg(WHO,111,FATAL,B("unable to mkdir: ",argv[1],"/cur"));
+ _exit(0);
+}