222 |
struct stat st; |
struct stat st; |
223 |
size_t uid; |
size_t uid; |
224 |
|
|
225 |
if (fast_mode && !recurse && depth > 0) |
if (!recurse) |
226 |
{ |
{ |
227 |
memset (&info, 0, sizeof (info)); |
if (fast_mode && depth > 0) |
228 |
info.name = strdup (name); |
{ |
229 |
install_folder_info (name, &info); |
memset (&info, 0, sizeof (info)); |
230 |
return; |
info.name = strdup (name); |
231 |
|
install_folder_info (name, &info); |
232 |
|
return; |
233 |
|
} |
234 |
|
|
235 |
|
if (depth > 1) |
236 |
|
return; |
237 |
} |
} |
|
|
|
|
if (depth > 1 && !recurse) |
|
|
return; |
|
238 |
|
|
239 |
dir = opendir (name); |
dir = opendir (name); |
240 |
|
|
241 |
if (!dir && errno == ENOENT) |
if (!dir && errno == ENOENT && create_flag) |
242 |
{ |
{ |
243 |
mh_check_folder (name, 0); |
mh_check_folder (name, 0); |
244 |
dir = opendir (name); |
dir = opendir (name); |
274 |
info.message_count++; |
info.message_count++; |
275 |
if (info.min == 0 || uid < info.min) |
if (info.min == 0 || uid < info.min) |
276 |
info.min = uid; |
info.min = uid; |
277 |
else if (uid > info.max) |
if (uid > info.max) |
278 |
info.max = uid; |
info.max = uid; |
279 |
} |
} |
280 |
break; |
break; |
308 |
|
|
309 |
for (info = folder_info; info < end; info++) |
for (info = folder_info; info < end; info++) |
310 |
{ |
{ |
311 |
printf ("%19.19s%c", info->name, |
int len = strlen (info->name); |
312 |
(strcmp (info->name, current_folder) == 0) ? '+' : ' '); |
printf ("%s", info->name); |
313 |
|
if (strcmp (info->name, current_folder) == 0) |
314 |
|
{ |
315 |
|
printf ("+"); |
316 |
|
len++; |
317 |
|
} |
318 |
|
|
319 |
|
for (; len < 20; len++) |
320 |
|
putchar (' '); |
321 |
|
|
322 |
if (info->message_count) |
if (info->message_count) |
323 |
{ |
{ |
324 |
printf (" has %4lu messages (%4lu-%4lu)", |
printf (" has %4lu messages (%4lu-%4lu)", |
331 |
if (info->others) |
if (info->others) |
332 |
{ |
{ |
333 |
if (!info->cur) |
if (!info->cur) |
334 |
printf ("; "); |
printf ("; "); |
335 |
else |
else |
336 |
printf ("; "); |
printf ("; "); |
337 |
printf ("(others)"); |
printf ("(others)"); |
391 |
if (fast_mode) |
if (fast_mode) |
392 |
print_fast (); |
print_fast (); |
393 |
else |
else |
394 |
print_all (); |
{ |
395 |
|
if (print_header) |
396 |
if (print_total) |
printf ("Folder # of messages ( range ) cur msg (other files)\n"); |
397 |
printf ("%24.24s=%4lu messages in %4lu folders\n", |
|
398 |
"TOTAL", |
print_all (); |
399 |
(unsigned long) message_count, |
|
400 |
(unsigned long) folder_info_count); |
if (print_total) |
401 |
|
printf ("%24.24s=%4lu messages in %4lu folders\n", |
402 |
|
"TOTAL", |
403 |
|
(unsigned long) message_count, |
404 |
|
(unsigned long) folder_info_count); |
405 |
|
} |
406 |
if (push_folder) |
if (push_folder) |
407 |
mh_global_save_state (); |
mh_global_save_state (); |
408 |
|
|
416 |
|
|
417 |
printf ("%s", current_folder); |
printf ("%s", current_folder); |
418 |
if (stack) |
if (stack) |
419 |
printf (" %s\n", stack); |
printf (" %s", stack); |
420 |
|
printf ("\n"); |
421 |
return 0; |
return 0; |
422 |
} |
} |
423 |
|
|
457 |
action_pop () |
action_pop () |
458 |
{ |
{ |
459 |
char *stack = mh_global_context_get ("Folder-Stack", NULL); |
char *stack = mh_global_context_get ("Folder-Stack", NULL); |
460 |
char *s, *p = strtok_r (stack, " ", &s); |
char *s, *p; |
461 |
|
|
462 |
|
if (stack) |
463 |
|
{ |
464 |
|
p = strtok_r (stack, " ", &s); |
465 |
|
if (s[0] == 0) |
466 |
|
s = NULL; |
467 |
|
} |
468 |
|
else |
469 |
|
{ |
470 |
|
p = current_folder; |
471 |
|
s = NULL; |
472 |
|
} |
473 |
mh_global_context_set ("Folder-Stack", s); |
mh_global_context_set ("Folder-Stack", s); |
474 |
current_folder = p; |
current_folder = p; |
475 |
action_list (); |
action_list (); |
481 |
main (int argc, char **argv) |
main (int argc, char **argv) |
482 |
{ |
{ |
483 |
int index = 0; |
int index = 0; |
484 |
|
mh_msgset_t msgset; |
485 |
|
|
486 |
mh_argp_parse (argc, argv, options, mh_option, args_doc, doc, |
mh_argp_parse (argc, argv, options, mh_option, args_doc, doc, |
487 |
opt_handler, NULL, &index); |
opt_handler, NULL, &index); |
488 |
|
|
491 |
if (program_invocation_short_name[strlen (program_invocation_short_name) - 1] == 's') |
if (program_invocation_short_name[strlen (program_invocation_short_name) - 1] == 's') |
492 |
show_all++; |
show_all++; |
493 |
|
|
494 |
|
if (argc - index == 1) |
495 |
|
{ |
496 |
|
mailbox_t mbox = mh_open_folder (current_folder, 0); |
497 |
|
mh_msgset_parse (mbox, &msgset, argc - index, argv + index); |
498 |
|
current_message = msgset.list[0]; |
499 |
|
mh_global_save_state (); |
500 |
|
mailbox_close (mbox); |
501 |
|
mailbox_destroy (&mbox); |
502 |
|
} |
503 |
|
else if (argc - index > 1) |
504 |
|
{ |
505 |
|
mh_error ("too many arguments"); |
506 |
|
exit (1); |
507 |
|
} |
508 |
|
|
509 |
if (show_all) |
if (show_all) |
510 |
print_header = print_total = 1; |
print_header = print_total = 1; |
511 |
|
|