mscan: hide message count behind -v

Also ensure output is flushed before printing it.
pull/137/head
Leah Neukirchen 6 years ago
parent 82faec5cfe
commit ddd7e54fbb

@ -1,4 +1,4 @@
.Dd June 28, 2017 .Dd September 25, 2018
.Dt MSCAN 1 .Dt MSCAN 1
.Os .Os
.Sh NAME .Sh NAME
@ -6,9 +6,10 @@
.Nd generate one-line message summaries .Nd generate one-line message summaries
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm .Nm
.Op Fl I
.Op Fl n .Op Fl n
.Op Fl v
.Op Fl f Ar format .Op Fl f Ar format
.Op Fl I
.Ar msgs\ ... .Ar msgs\ ...
.Sh DESCRIPTION .Sh DESCRIPTION
.Nm .Nm
@ -55,13 +56,15 @@ format may be specified in the user's
.Pp .Pp
The options are as follows: The options are as follows:
.Bl -tag -width Ds .Bl -tag -width Ds
.It Fl n
Only print message numbers
.Pq or filenames, if the message is not in the current sequence .
.It Fl I .It Fl I
Force ISO date output, Force ISO date output,
even for even for
.Sq Cm "%d" . .Sq Cm "%d" .
.It Fl n
Only print message numbers
.Pq or filenames, if the message is not in the current sequence .
.It Fl v
Print how many messages were scanned to standard error.
.It Fl f Ar format .It Fl f Ar format
Format according to the string Format according to the string
.Ar format , .Ar format ,

@ -29,6 +29,7 @@ static int alias_idx;
static int Iflag; static int Iflag;
static int nflag; static int nflag;
static int vflag;
static int curyear; static int curyear;
static time_t now; static time_t now;
static char default_fflag[] = "%c%u%r %-3n %10d %17f %t %2i%s"; static char default_fflag[] = "%c%u%r %-3n %10d %17f %t %2i%s";
@ -493,13 +494,14 @@ main(int argc, char *argv[])
pid_t pid1 = -1; pid_t pid1 = -1;
int c; int c;
while ((c = getopt(argc, argv, "If:n")) != -1) while ((c = getopt(argc, argv, "If:nv")) != -1)
switch (c) { switch (c) {
case 'I': Iflag++; break; case 'I': Iflag++; break;
case 'f': fflag = optarg; break; case 'f': fflag = optarg; break;
case 'n': nflag = 1; break; case 'n': nflag = 1; break;
case 'v': vflag = 1; break;
default: default:
fprintf(stderr, "Usage: mscan [-n] [-f format] [-I] [msgs...]\n"); fprintf(stderr, "Usage: mscan [-Inv] [-f format] [msgs...]\n");
exit(1); exit(1);
} }
@ -568,10 +570,12 @@ main(int argc, char *argv[])
i = blaze822_loop1(":", oneline); i = blaze822_loop1(":", oneline);
else else
i = blaze822_loop(argc-optind, argv+optind, oneline); i = blaze822_loop(argc-optind, argv+optind, oneline);
fprintf(stderr, "%ld mails scanned\n", i);
if (pid1 > 0) if (pid1 > 0)
pipeclose(pid1); pipeclose(pid1);
if (vflag)
fprintf(stderr, "%ld mails scanned\n", i);
return 0; return 0;
} }

Loading…
Cancel
Save