about summary refs log tree commit diff
path: root/mseq.c
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2016-07-20 15:38:24 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2016-07-20 15:38:24 +0200
commit70a3a2ff1dff95cd9ccb4b15e595f166e5e0ee5a (patch)
tree72d8fe8cf84b42a895c5ba06e93e43b0420a9ed7 /mseq.c
parentbf912ab920eefa5f7f369ee4b239a7ba9f3621d2 (diff)
downloadmblaze-70a3a2ff1dff95cd9ccb4b15e595f166e5e0ee5a.tar.gz
mblaze-70a3a2ff1dff95cd9ccb4b15e595f166e5e0ee5a.tar.xz
mblaze-70a3a2ff1dff95cd9ccb4b15e595f166e5e0ee5a.zip
mseq: default to all messages when interactive w/o args
Diffstat (limited to 'mseq.c')
-rw-r--r--mseq.c15
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