diff options
author | Leah Neukirchen <leah@vuxu.org> | 2020-04-30 23:45:35 +0200 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2020-04-30 23:45:35 +0200 |
commit | a5c77c71bcb7d90f19887733717d9b27cb444a80 (patch) | |
tree | c986da9d52de460e02ebad565aae17a2f4066508 | |
parent | e4e15bb4f0b818ba8e5d305ecae8258bb23c7030 (diff) | |
download | mblaze-a5c77c71bcb7d90f19887733717d9b27cb444a80.tar.gz mblaze-a5c77c71bcb7d90f19887733717d9b27cb444a80.tar.xz mblaze-a5c77c71bcb7d90f19887733717d9b27cb444a80.zip |
mlist: print number of matches when message selection is in place
-rw-r--r-- | man/mlist.1 | 6 | ||||
-rw-r--r-- | mlist.c | 18 |
2 files changed, 18 insertions, 6 deletions
diff --git a/man/mlist.1 b/man/mlist.1 index e776433..5c7ea64 100644 --- a/man/mlist.1 +++ b/man/mlist.1 @@ -1,4 +1,4 @@ -.Dd December 13, 2016 +.Dd April 30, 2020 .Dt MLIST 1 .Os .Sh NAME @@ -77,8 +77,10 @@ Don't print filenames. Instead, print a one-line summary for each folder, showing the number of unseen, flagged and total messages, along with the folder name. +If any of the message selection flags are used, +the number of matching messages is printed as well. If two or more folders are specified, -a total for all folders will also be printed. +a total for all folders will also be printed at the end. .El .Pp Multiple options are regarded as a conjunction. diff --git a/mlist.c b/mlist.c index e03d7ba..fd4fde1 100644 --- a/mlist.c +++ b/mlist.c @@ -47,6 +47,7 @@ static long tdirs; static long tunseen; static long tflagged; static long tcount; +static long tmatched; void list(char *prefix, char *file) @@ -86,6 +87,7 @@ list(char *prefix, char *file) if (!f) return; imatched++; + tmatched++; if (!flagset) icount++, tcount++; if (!strchr(f, 'S')) @@ -215,8 +217,12 @@ listarg(char *arg) if (iflag && (imatched || (maildir && !flagset))) { tdirs++; - printf("%6ld unseen %3ld flagged %6ld msg %s\n", - iunseen, iflagged, icount, arg); + if (flagset && imatched) + printf("%6ld matched %6ld unseen %3ld flagged %6ld msg %s\n", + imatched, iunseen, iflagged, icount, arg); + else + printf("%6ld unseen %3ld flagged %6ld msg %s\n", + iunseen, iflagged, icount, arg); } icount = gcount; @@ -283,8 +289,12 @@ usage: } if (iflag && tdirs > 1) - printf("%6ld unseen %3ld flagged %6ld msg\n", - tunseen, tflagged, tcount); + if (flagset) + printf("%6ld matched %6ld unseen %3ld flagged %6ld msg\n", + tmatched, tunseen, tflagged, tcount); + else + printf("%6ld unseen %3ld flagged %6ld msg\n", + tunseen, tflagged, tcount); return 0; } |