X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=uip%2Finc.c;h=fce9cec2beee5f972afd86199736ecab8cd510ae;hp=4903e21856486e4410dcd7069be33fd1c5bc986c;hb=d8916ff5d389de5ab225cd6f40aeda1b285d0f28;hpb=99e5043db7ee6cf80f93708610a6e584a8068c6a diff --git a/uip/inc.c b/uip/inc.c index 4903e21..fce9cec 100644 --- a/uip/inc.c +++ b/uip/inc.c @@ -29,6 +29,7 @@ #endif #include +#include #include #ifdef POP @@ -222,8 +223,8 @@ static FILE *in; */ char *map_name(char *); +static void inc_done(int) NORETURN; #ifdef POP -int done(int); static int pop_action(char *); static int pop_pack(char *); static int map_count(void); @@ -262,6 +263,8 @@ main (int argc, char **argv) struct hes_postoffice *po; #endif + done=inc_done; + /* absolutely the first thing we do is save our privileges, * and drop them if we can. */ @@ -456,7 +459,7 @@ main (int argc, char **argv) if (folder) adios (NULL, "only one folder at a time!"); else - folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF); + folder = pluspath (cp); } else { adios (NULL, "usage: %s [+folder] [switches]", invo_name); } @@ -542,7 +545,7 @@ main (int argc, char **argv) adios (NULL, "no mail to incorporate"); if ((cp = strdup(newmail)) == (char *)0) - adios (maildir, "error allocating memory to copy newmail"); + adios (NULL, "error allocating memory to copy newmail"); newmail = cp; } @@ -562,15 +565,14 @@ main (int argc, char **argv) if ((maildir_copy = strdup(maildir)) == (char *)0) adios (maildir, "error allocating memory to copy maildir"); - if (stat (maildir, &st) == NOTOK) { - if (errno != ENOENT) - adios (maildir, "error on folder"); - cp = concat ("Create folder \"", maildir, "\"? ", NULL); - if (noisy && !getanswer (cp)) - done (1); - free (cp); - if (!makedir (maildir)) - adios (NULL, "unable to create folder %s", 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); } if (chdir (maildir) == NOTOK) @@ -950,7 +952,8 @@ go_to_it: seq_setunseen (mp, 0); /* set the Unseen-Sequence */ seq_save (mp); /* synchronize sequences */ context_save (); /* save the context file */ - return done (0); + done (0); + return 1; } @@ -987,8 +990,8 @@ cpymsg (FILE *in, FILE *out) #endif /* if 0 */ -int -done (int status) +static void +inc_done (int status) { #ifdef POP if (packfile && pd != NOTOK) @@ -1001,7 +1004,6 @@ done (int status) DROPGROUPPRIVS(); } exit (status); - return 1; /* dead code to satisfy the compiler */ } #ifdef POP