Do not use current_folder global.
Showing
1 changed file
with
9 additions
and
3 deletions
... | @@ -21,7 +21,7 @@ | ... | @@ -21,7 +21,7 @@ |
21 | 21 | ||
22 | const char *argp_program_version = "inc (" PACKAGE_STRING ")"; | 22 | const char *argp_program_version = "inc (" PACKAGE_STRING ")"; |
23 | static char doc[] = "GNU MH inc"; | 23 | static char doc[] = "GNU MH inc"; |
24 | static char args_doc[] = ""; | 24 | static char args_doc[] = "[+folder]"; |
25 | 25 | ||
26 | /* GNU options */ | 26 | /* GNU options */ |
27 | static struct argp_option options[] = { | 27 | static struct argp_option options[] = { |
... | @@ -66,12 +66,18 @@ static FILE *audit_fp; | ... | @@ -66,12 +66,18 @@ static FILE *audit_fp; |
66 | static int changecur = -1; | 66 | static int changecur = -1; |
67 | static int truncate_source = -1; | 67 | static int truncate_source = -1; |
68 | static int quiet = 0; | 68 | static int quiet = 0; |
69 | static char *append_folder; | ||
69 | 70 | ||
70 | static int | 71 | static int |
71 | opt_handler (int key, char *arg, void *unused) | 72 | opt_handler (int key, char *arg, void *unused) |
72 | { | 73 | { |
73 | switch (key) | 74 | switch (key) |
74 | { | 75 | { |
76 | case ARGP_KEY_FINI: | ||
77 | if (!append_folder) | ||
78 | append_folder = mh_global_profile_get ("Inbox", "inbox"); | ||
79 | break; | ||
80 | |||
75 | case 'a': | 81 | case 'a': |
76 | audit_file = arg; | 82 | audit_file = arg; |
77 | break; | 83 | break; |
... | @@ -86,7 +92,7 @@ opt_handler (int key, char *arg, void *unused) | ... | @@ -86,7 +92,7 @@ opt_handler (int key, char *arg, void *unused) |
86 | 92 | ||
87 | case '+': | 93 | case '+': |
88 | case 'f': | 94 | case 'f': |
89 | current_folder = arg; | 95 | append_folder = arg; |
90 | break; | 96 | break; |
91 | 97 | ||
92 | case 'F': | 98 | case 'F': |
... | @@ -187,7 +193,7 @@ main (int argc, char **argv) | ... | @@ -187,7 +193,7 @@ main (int argc, char **argv) |
187 | exit (1); | 193 | exit (1); |
188 | } | 194 | } |
189 | 195 | ||
190 | output = mh_open_folder (current_folder, 1); | 196 | output = mh_open_folder (append_folder, 1); |
191 | if (mailbox_messages_count (output, &lastmsg) != 0) | 197 | if (mailbox_messages_count (output, &lastmsg) != 0) |
192 | { | 198 | { |
193 | mh_error ("Can not read output mailbox"); | 199 | mh_error ("Can not read output mailbox"); | ... | ... |
-
Please register or sign in to post a comment