mlist: print number of matches when message selection is in place

pull/150/head
Leah Neukirchen 4 years ago
parent e4e15bb4f0
commit a5c77c71bc

@ -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.

@ -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;
}

Loading…
Cancel
Save