about summary refs log tree commit diff
path: root/mthread.c
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2020-05-04 14:58:58 +0200
committerLeah Neukirchen <leah@vuxu.org>2020-05-04 14:58:58 +0200
commit4927d44d5518412c41322721a07ec8c56bdb45f7 (patch)
treee0fccf7cb7f0ab533e8edee8c5ed7a043335adc7 /mthread.c
parent62da7c59eabcd8c6c8957a414a02efd6bf11d386 (diff)
downloadmblaze-4927d44d5518412c41322721a07ec8c56bdb45f7.tar.gz
mblaze-4927d44d5518412c41322721a07ec8c56bdb45f7.tar.xz
mblaze-4927d44d5518412c41322721a07ec8c56bdb45f7.zip
mthread: add -p to only add parent messages via -S
Diffstat (limited to 'mthread.c')
-rw-r--r--mthread.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/mthread.c b/mthread.c
index 300fcae..a29d7b2 100644
--- a/mthread.c
+++ b/mthread.c
@@ -21,6 +21,7 @@
 #include "blaze822.h"
 
 static int vflag;
+static int pflag;
 static int rflag;
 static int optional;
 
@@ -390,7 +391,8 @@ print_tree(struct container *c, int depth)
 {
 	do {
 		// skip toplevel threads when they are unresolved or all optional
-		if (depth <= 1 &&
+		// (or when -p is given, skip those subthreads)
+		if ((depth <= 1 || pflag) &&
 		    (c->optional || !c->file) &&
 		    (!c->child || alloptional(c->child)))
 			continue;
@@ -418,13 +420,14 @@ main(int argc, char *argv[])
 
 	optional = 1;
 
-	while ((c = getopt(argc, argv, "S:rv")) != -1)
+	while ((c = getopt(argc, argv, "S:prv")) != -1)
 		switch (c) {
 		case 'S': blaze822_loop1(optarg, thread); break;
 		case 'v': vflag = 1; break;
+		case 'p': pflag = 1; break;
 		case 'r': rflag = 1; break;
 		default:
-			fprintf(stderr, "Usage: mthread [-v] [-r] [-S dir] [msgs...]\n");
+			fprintf(stderr, "Usage: mthread [-vpr] [-S dir] [msgs...]\n");
 			exit(1);
 		}