From 70a3a2ff1dff95cd9ccb4b15e595f166e5e0ee5a Mon Sep 17 00:00:00 2001 From: Christian Neukirchen Date: Wed, 20 Jul 2016 15:38:24 +0200 Subject: mseq: default to all messages when interactive w/o args --- mseq.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'mseq.c') diff --git a/mseq.c b/mseq.c index fdabcc8..3974ec8 100644 --- a/mseq.c +++ b/mseq.c @@ -25,13 +25,22 @@ main(int argc, char *argv[]) int i; char *f; + char *a; struct blaze822_seq_iter iter = { 0 }; + + if (optind == argc && isatty(0)) { + a = ":"; + i = argc; + goto hack; + } for (i = optind; i < argc; i++) { - if (strchr(argv[i], '/')) { - printf("%s\n", argv[i]); + a = argv[i]; +hack: + if (strchr(a, '/')) { + printf("%s\n", a); continue; } - while ((f = blaze822_seq_next(map, argv[i], &iter))) { + while ((f = blaze822_seq_next(map, a, &iter))) { if (nflag) printf("%ld\n", iter.line-1); else -- cgit 1.4.1