summary refs log tree commit diff
path: root/mthread.c
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2016-07-20 18:47:40 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2016-07-20 18:47:40 +0200
commit4eff264615ea8b311184d5102bc3285b9f91c238 (patch)
tree20f1a17e903432ed7048d2f63f130d18a2fe99f5 /mthread.c
parentf7535f2cec1dd6ce4d4c966510a468a4fea1e140 (diff)
downloadmblaze-4eff264615ea8b311184d5102bc3285b9f91c238.tar.gz
mblaze-4eff264615ea8b311184d5102bc3285b9f91c238.tar.xz
mblaze-4eff264615ea8b311184d5102bc3285b9f91c238.zip
mthread: -v to not prune
Diffstat (limited to 'mthread.c')
-rw-r--r--mthread.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/mthread.c b/mthread.c
index a0758a5..6016199 100644
--- a/mthread.c
+++ b/mthread.c
@@ -20,6 +20,8 @@
 
 #include "blaze822.h"
 
+static int vflag;
+
 struct container {
 	char *mid;
 	char *file;
@@ -362,16 +364,26 @@ print_tree(struct container *c, int depth)
 int
 main(int argc, char *argv[])
 {
-	int i;
-	if (argc == 1 && isatty(0)) {
+	int c, i;
+
+ 	while ((c = getopt(argc, argv, "v")) != -1)
+ 		switch(c) {
+ 		case 'v': vflag = 1; break;
+ 		default:
+ 			// XXX usage
+ 			exit(1);
+ 		}
+
+	if (argc == optind && isatty(0)) {
 		char *all[] = { ":" };
 		i = blaze822_loop(1, all, thread);
 	} else {
-		i = blaze822_loop(argc-1, argv+1, thread);
+		i = blaze822_loop(argc-optind, argv+optind, thread);
 	}
 
 	find_roots();
-	prune_tree(top, -1);
+	if (!vflag)
+		prune_tree(top, -1);
 	sort_tree(top, -1);
 	print_tree(top, -1);