diff options
author | Christian Neukirchen <chneukirchen@gmail.com> | 2016-07-20 15:38:24 +0200 |
---|---|---|
committer | Christian Neukirchen <chneukirchen@gmail.com> | 2016-07-20 15:38:24 +0200 |
commit | 70a3a2ff1dff95cd9ccb4b15e595f166e5e0ee5a (patch) | |
tree | 72d8fe8cf84b42a895c5ba06e93e43b0420a9ed7 | |
parent | bf912ab920eefa5f7f369ee4b239a7ba9f3621d2 (diff) | |
download | mblaze-70a3a2ff1dff95cd9ccb4b15e595f166e5e0ee5a.tar.gz mblaze-70a3a2ff1dff95cd9ccb4b15e595f166e5e0ee5a.tar.xz mblaze-70a3a2ff1dff95cd9ccb4b15e595f166e5e0ee5a.zip |
mseq: default to all messages when interactive w/o args
-rw-r--r-- | mseq.c | 15 |
1 files changed, 12 insertions, 3 deletions
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 |