diff options
author | Duncaen <mail@duncano.de> | 2018-09-25 15:14:43 +0200 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2018-09-25 16:05:51 +0200 |
commit | d09efa6aa99e24373dc85ef9b026412a6e8cceb5 (patch) | |
tree | 27098d2e9df91f969c41050da0e9bfca7eca24cc | |
parent | d5714df6c9f63d46ee3a3b23880652e4c4cf062f (diff) | |
download | mblaze-d09efa6aa99e24373dc85ef9b026412a6e8cceb5.tar.gz mblaze-d09efa6aa99e24373dc85ef9b026412a6e8cceb5.tar.xz mblaze-d09efa6aa99e24373dc85ef9b026412a6e8cceb5.zip |
mpick: add -v flag
Closes: #137 [via git-merge-pr]
-rw-r--r-- | man/mpick.1 | 3 | ||||
-rw-r--r-- | mpick.c | 8 |
2 files changed, 9 insertions, 2 deletions
diff --git a/man/mpick.1 b/man/mpick.1 index 69a8e41..89bf619 100644 --- a/man/mpick.1 +++ b/man/mpick.1 @@ -7,6 +7,7 @@ .Sh SYNOPSIS .Nm .Op Fl T +.Op Fl v .Op Fl t Ar test .Op Ar msglist\ ... .Sh DESCRIPTION @@ -29,6 +30,8 @@ Only show messages matching the expression .Ar test , see .Sx TESTS . +.It Fl v +Print how many messages were tested and picked to standard error. .El .Sh MSGLISTS .Nm diff --git a/mpick.c b/mpick.c index d15d1d4..ca0fa84 100644 --- a/mpick.c +++ b/mpick.c @@ -1142,15 +1142,18 @@ main(int argc, char *argv[]) { long i; int c; + int vflag; argv0 = argv[0]; now = time(0); num = 1; + vflag = 0; - while ((c = getopt(argc, argv, "Tt:")) != -1) + while ((c = getopt(argc, argv, "Tt:v")) != -1) switch (c) { case 'T': Tflag = need_thr = 1; break; case 't': expr = chain(expr, EXPR_AND, parse_expr(optarg)); break; + case 'v': vflag = 1; break; default: fprintf(stderr, "Usage: %s [-T] [-t test] [msglist ...]\n", argv0); exit(1); @@ -1169,6 +1172,7 @@ main(int argc, char *argv[]) if (Tflag && thr) do_thr(); - fprintf(stderr, "%ld mails tested, %ld picked.\n", i, kept); + if (vflag) + fprintf(stderr, "%ld mails tested, %ld picked.\n", i, kept); return 0; } |