(create_flag): A three-state flag.
(_scan): Fixed behavior on non-existing folders.
Showing
1 changed file
with
18 additions
and
4 deletions
... | @@ -104,7 +104,10 @@ static int action_pop (); | ... | @@ -104,7 +104,10 @@ static int action_pop (); |
104 | static folder_action action = action_print; | 104 | static folder_action action = action_print; |
105 | 105 | ||
106 | int show_all = 0; /* List all folders. Raised by --all switch */ | 106 | int show_all = 0; /* List all folders. Raised by --all switch */ |
107 | int create_flag = 0; /* Create non-existent folders (--create) */ | 107 | int create_flag = -1; /* Create non-existent folders (--create). |
108 | -1: Prompt before creating | ||
109 | 0: Do not create | ||
110 | 1: Always create without prompting */ | ||
108 | int fast_mode = 0; /* Fast operation mode. (--fast) */ | 111 | int fast_mode = 0; /* Fast operation mode. (--fast) */ |
109 | int print_header = 0; /* Display the header line (--header) */ | 112 | int print_header = 0; /* Display the header line (--header) */ |
110 | int recurse = 0; /* Recurse sub-folders */ | 113 | int recurse = 0; /* Recurse sub-folders */ |
... | @@ -282,9 +285,20 @@ _scan (const char *name, int depth) | ... | @@ -282,9 +285,20 @@ _scan (const char *name, int depth) |
282 | 285 | ||
283 | if (!dir && errno == ENOENT) | 286 | if (!dir && errno == ENOENT) |
284 | { | 287 | { |
285 | if (mh_check_folder (name, !create_flag)) | 288 | if (create_flag) |
286 | return; | 289 | { |
287 | dir = opendir (name); | 290 | if (mh_check_folder (name, create_flag == -1)) |
291 | { | ||
292 | push_folder = 0; | ||
293 | return; | ||
294 | } | ||
295 | dir = opendir (name); | ||
296 | } | ||
297 | else | ||
298 | { | ||
299 | push_folder = 0; | ||
300 | return; | ||
301 | } | ||
288 | } | 302 | } |
289 | 303 | ||
290 | if (!dir) | 304 | if (!dir) | ... | ... |
-
Please register or sign in to post a comment