2 ** Copyright 2000 Double Precision, Inc.
3 ** See COPYING for distribution information.
10 #include <sys/types.h>
19 #include "maildirmisc.h"
21 static const char rcsid[]="$Id: maildirmkdir.c,v 1.2 2002/03/15 03:09:21 mrsam Exp $";
23 int maildir_mkdir(const char *dir)
28 if (dir == 0 || dir[0] == 0)
34 if ((buf = malloc(l + sizeof("/tmp"))) == 0)
40 strcpy(buf+l, "/cur");
42 /* We do mkdir -p here */
45 while ((p = strchr(p, '/')) != 0)
48 if (mkdir(buf, 0700) < 0 && errno != EEXIST)
56 if (mkdir(buf, 0700) < 0 && errno != EEXIST) {
60 strcpy(buf+l, "/new");
61 if (mkdir(buf, 0700) < 0 && errno != EEXIST) {
66 * make /tmp last because this is the one we open first -
67 * the existence of this directory implies the whole
68 * Maildir structure is complete
70 strcpy(buf+l, "/tmp");
71 if (mkdir(buf, 0700) < 0 && errno != EEXIST) {