]> git.marmaro.de Git - mmh/commitdiff
Replaced folder_exists() by a call to create_folder().
authormarkus schnalke <meillo@marmaro.de>
Sat, 24 Mar 2012 14:47:11 +0000 (15:47 +0100)
committermarkus schnalke <meillo@marmaro.de>
Sat, 24 Mar 2012 14:47:11 +0000 (15:47 +0100)
Changed inc(1) to create non-existing folders with -silent, instead of
silently failing in this case. I consider the new behavior to follow the POLS.

h/utils.h
man/inc.man1
sbr/utils.c
uip/inc.c

index 7ee6046ac2b4681f1d2c6a50391be87d81f173b7..a8059ea2b78f62ff51c20bfba094ea509465b927 100644 (file)
--- a/h/utils.h
+++ b/h/utils.h
@@ -6,7 +6,6 @@ void *mh_xmalloc(size_t);
 void *mh_xrealloc(void *, size_t);
 char *pwd(void);
 char *add(char *, char *);
-int folder_exists(char *);
 void create_folder(char *, int, void (*)(int));
 int num_digits(int);
 
index eb51bc1d2d46f557e7ffd112d084e1fe0341ec63..26ec56e0428cc8324724dd90d8789c9df8ec2305 100644 (file)
@@ -40,7 +40,9 @@ will use either the folder given by a (non\-empty)
 entry in the user's profile, or the folder named
 .RI \*(lq inbox \*(rq.
 If the specified (or default) folder doesn't
-exist, the user will be queried prior to its creation.
+exist, the user will (in
+.B \-nosilent
+mode) be queried prior to its creation.
 .PP
 When the new messages are incorporated into the folder, they are assigned
 numbers starting with the next highest number for the folder.  As the
index 5c5b0f5149a01dfd19cf1044e9b799acbb0b26b9..297ad45c2ac5b3fcfa9367860805e362e1f028ac 100644 (file)
@@ -125,30 +125,6 @@ add(char *s2, char *s1)
        return cp;
 }
 
-/*
-** folder_exists
-**     Check to see if a folder exists.
-*/
-int
-folder_exists(char *folder)
-{
-       struct stat st;
-       int exists = 0;
-
-       if (stat(folder, &st) == -1) {
-               /*
-               ** The folder either doesn't exist, or we hit an error.
-               ** Either way return a failure.
-               */
-               exists = 0;
-       } else {
-               /* We can see a folder with the right name */
-               exists = 1;
-       }
-
-       return exists;
-}
-
 
 /*
 ** create_folder
index 05df0f02d07b0f44df6c93a16e2bbdce786b8ea1..be6be22a0d37a78f2d3e9a4727b5c2903847a2c3 100644 (file)
--- a/uip/inc.c
+++ b/uip/inc.c
@@ -294,16 +294,7 @@ main(int argc, char **argv)
        if ((maildir_copy = strdup(maildir)) == NULL)
                adios(maildir, "error allocating memory to copy maildir");
 
-       if (!folder_exists(maildir)) {
-               /*
-               ** If the folder doesn't exist, and we're given the -silent
-               ** flag, just fail.
-               */
-               if (noisy)
-                       create_folder(maildir, 0, done);
-               else
-                       done(1);
-       }
+       create_folder(maildir, noisy ? 0 : 1, done);
 
        if (chdir(maildir) == NOTOK)
                adios(maildir, "unable to change directory to");