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
.Os
.Sh NAME
@ -6,9 +6,10 @@
.Nd generate one-line message summaries
.Sh SYNOPSIS
.Nm
.Op Fl I
.Op Fl n
.Op Fl v
.Op Fl f Ar format
.Op Fl I
.Ar msgs\ ...
.Sh DESCRIPTION
.Nm
@ -55,13 +56,15 @@ format may be specified in the user's
.Pp
The options are as follows:
.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
Force ISO date output,
even for
.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
Format according to the string
.Ar format ,

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

Loading…
Cancel
Save