diff options
author | Leah Neukirchen <leah@vuxu.org> | 2017-02-14 15:31:22 +0100 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2017-02-14 15:31:52 +0100 |
commit | 7a2204049e964597fa7bcd4fcb088653e9bdffbb (patch) | |
tree | e3447a1dabd3702c5963933c8b25f7ef41f729ae | |
parent | 2b74b23cea31168c00cd93e7825e096c51d3b4f2 (diff) | |
download | mblaze-7a2204049e964597fa7bcd4fcb088653e9bdffbb.tar.gz mblaze-7a2204049e964597fa7bcd4fcb088653e9bdffbb.tar.xz mblaze-7a2204049e964597fa7bcd4fcb088653e9bdffbb.zip |
mlist: print a total line with -i when useful
-rw-r--r-- | man/mlist.1 | 2 | ||||
-rw-r--r-- | mlist.c | 19 |
2 files changed, 15 insertions, 6 deletions
diff --git a/man/mlist.1 b/man/mlist.1 index 1ec0679..4ce1844 100644 --- a/man/mlist.1 +++ b/man/mlist.1 @@ -74,6 +74,8 @@ Don't list messages in Don't print filenames, instead print a single line summary for each folder with the number of unseen, flagged and total messages, as well as the folder name. +.Pp +When more two or more summaries are printed, also print a total. .El .Pp Multiple options are regarded as a conjunction. diff --git a/mlist.c b/mlist.c index 97fe9c4..79bf286 100644 --- a/mlist.c +++ b/mlist.c @@ -45,6 +45,11 @@ static long iunseen; static long iflagged; static long imatched; +static long tdirs; +static long tunseen; +static long tflagged; +static long tcount; + void list(char *prefix, char *file) { @@ -72,11 +77,11 @@ list(char *prefix, char *file) return; imatched++; if (!flagset) - icount++; + icount++, tcount++; if (!strchr(f, 'S')) - iunseen++; + iunseen++, tunseen++; if (strchr(f, 'F')) - iflagged++; + iflagged++, tflagged++; return; } @@ -197,9 +202,11 @@ listarg(char *arg) if (!maildir) listdir(arg); - if (iflag && imatched) + if (iflag && imatched) { + tdirs++; printf("%6ld unseen %3ld flagged %6ld msg %s\n", iunseen, iflagged, icount, arg); + } icount = gcount; iunseen = gunseen; @@ -264,9 +271,9 @@ main(int argc, char *argv[]) listarg(argv[i]); } - if (iflag && imatched) + if (iflag && tdirs > 1) printf("%6ld unseen %3ld flagged %6ld msg\n", - iunseen, iflagged, icount); + tunseen, tflagged, tcount); return 0; } |