2 ** Copyright 2000 Double Precision, Inc.
3 ** See COPYING for distribution information.
10 #include <sys/types.h>
19 #include "maildirmisc.h"
22 int maildir_mkdir(const char *dir)
27 if (dir == 0 || dir[0] == 0)
33 if ((buf = malloc(l + sizeof("/tmp"))) == 0)
39 strcpy(buf+l, "/cur");
41 /* We do mkdir -p here */
44 while ((p = strchr(p, '/')) != 0)
47 if (mkdir(buf, 0700) < 0 && errno != EEXIST)
55 if (mkdir(buf, 0700) < 0 && errno != EEXIST) {
59 strcpy(buf+l, "/new");
60 if (mkdir(buf, 0700) < 0 && errno != EEXIST) {
65 * make /tmp last because this is the one we open first -
66 * the existence of this directory implies the whole
67 * Maildir structure is complete
69 strcpy(buf+l, "/tmp");
70 if (mkdir(buf, 0700) < 0 && errno != EEXIST) {