summaryrefslogtreecommitdiff
path: root/src/maildirmake.c
blob: 6828df96efc45aba4d992f73d62fbc230efb9640 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <sys/stat.h>
#include <unistd.h>

#include "exit.h"
#include "logmsg.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);
}