summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--man/mshow.14
-rw-r--r--mshow.c27
2 files changed, 20 insertions, 11 deletions
diff --git a/man/mshow.1 b/man/mshow.1
index 66c839b..d083778 100644
--- a/man/mshow.1
+++ b/man/mshow.1
@@ -8,7 +8,7 @@
 .Nm
 .Op Fl h Ar headers
 .Op Fl A Ar mimetypes
-.Op Fl nqrHL
+.Op Fl nqrHLN
 .Op Ar msgs\ ...
 .Nm
 .Fl x Ar msg
@@ -65,6 +65,8 @@ Don't decode the headers, print all raw headers.
 This may be dangerous to use on a tty.
 .It Fl L
 Don't filter the headers, print all decoded headers.
+.It Fl N
+Don't show MIME structure markers.
 .It Fl x Ar msg
 Switch to extraction mode: extract
 .Ar parts
diff --git a/mshow.c b/mshow.c
index 2811f65..e8773a7 100644
--- a/mshow.c
+++ b/mshow.c
@@ -20,6 +20,7 @@ static int Rflag;
 static int qflag;
 static int Hflag;
 static int Lflag;
+static int Nflag;
 static int tflag;
 static int nflag;
 static char defaulthflags[] = "from:subject:to:cc:date:";
@@ -187,11 +188,13 @@ render_mime(int depth, struct message *msg, char *body, size_t bodylen)
 
 	mimecount++;
 
-	int i;
-	for (i = 0; i < depth+1; i++)
-		printf("--- ");
-	printf("%d: %s size=%zd", mimecount, mt, bodylen);
-	print_filename(filename);
+	if (!Nflag) {
+		int i;
+		for (i = 0; i < depth+1; i++)
+			printf("--- ");
+		printf("%d: %s size=%zd", mimecount, mt, bodylen);
+		print_filename(filename);
+	}
 
 	char *cmd;
 	blaze822_mime_action r = MIME_CONTINUE;
@@ -213,7 +216,8 @@ render_mime(int depth, struct message *msg, char *body, size_t bodylen)
 		int e = filter(body, bodylen, cmd, &output, &outlen);
 
 		if (e == 0) { // replace output
-			printf(" render=\"%s\" ---\n", cmd);
+			if (!Nflag)
+				printf(" render=\"%s\" ---\n", cmd);
 			if (outlen) {
 				print_ascii(output, outlen);
 				if (output[outlen-1] != '\n')
@@ -223,7 +227,8 @@ render_mime(int depth, struct message *msg, char *body, size_t bodylen)
 			free(output);
 			goto nofilter;
 		} else if (e == 64) { // decode output again
-			printf(" filter=\"%s\" ---\n", cmd);
+			if (!Nflag)
+				printf(" filter=\"%s\" ---\n", cmd);
 			struct message *imsg = blaze822_mem(output, outlen);
 			if (imsg)
 				blaze822_walk_mime(imsg, depth+1, render_mime);
@@ -248,7 +253,8 @@ render_mime(int depth, struct message *msg, char *body, size_t bodylen)
 		r = MIME_PRUNE;
 	} else {
 nofilter:
-		printf(" ---\n");
+		if (!Nflag)
+			printf(" ---\n");
 
 		if (strncmp(ct, "text/", 5) == 0) {
 			char *charset = 0, *cs, *cse;
@@ -711,7 +717,7 @@ main(int argc, char *argv[])
 	pid_t pid1 = -1, pid2 = -1;
 
 	int c;
-	while ((c = getopt(argc, argv, "h:A:qrtHLx:O:Rn")) != -1)
+	while ((c = getopt(argc, argv, "h:A:qrtHLNx:O:Rn")) != -1)
 		switch(c) {
 		case 'h': hflag = optarg; break;
 		case 'A': Aflag = optarg; break;
@@ -719,6 +725,7 @@ main(int argc, char *argv[])
 		case 'r': rflag = 1; break;
 		case 'H': Hflag = 1; break;
 		case 'L': Lflag = 1; break;
+		case 'N': Nflag = 1; break;
 		case 't': tflag = 1; break;
 		case 'x': xflag = optarg; break;
 		case 'O': Oflag = optarg; break;
@@ -726,7 +733,7 @@ main(int argc, char *argv[])
 		case 'n': nflag = 1; break;
 		default:
 			fprintf(stderr,
-			    "Usage: mshow [-h headers] [-A mimetypes] [-nqrHL] [msgs...]\n"
+			    "Usage: mshow [-h headers] [-A mimetypes] [-nqrHLN] [msgs...]\n"
 			    "	    mshow -x msg parts...\n"
 			    "	    mshow -O msg parts...\n"
 			    "	    mshow -t msgs...\n"