about summary refs log tree commit diff
path: root/mmime.c
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2017-05-26 22:00:55 +0200
committerLeah Neukirchen <leah@vuxu.org>2017-05-26 22:00:55 +0200
commitd8976d416c017cfecc0f8c7e506e574b2658fb97 (patch)
tree1ee32eb2c31896d415e9207f0601541923af8713 /mmime.c
parent687b3ddc0df89d48af5d20cb37fa2feb19a6c537 (diff)
downloadmblaze-d8976d416c017cfecc0f8c7e506e574b2658fb97.tar.gz
mblaze-d8976d416c017cfecc0f8c7e506e574b2658fb97.tar.xz
mblaze-d8976d416c017cfecc0f8c7e506e574b2658fb97.zip
mmime: add -t to override toplevel content-type
Diffstat (limited to 'mmime.c')
-rw-r--r--mmime.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/mmime.c b/mmime.c
index 2d474cb..b229310 100644
--- a/mmime.c
+++ b/mmime.c
@@ -18,6 +18,7 @@
 
 static int cflag;
 static int rflag;
+static char *tflag = "multipart/mixed";
 
 int gen_b64(uint8_t *s, off_t size)
 {
@@ -320,7 +321,7 @@ gen_build()
 					printf("Content-Transfer-Encoding: quoted-printable\n\n");
 
 				} else {
-					printf("Content-Type: multipart/mixed; boundary=\"%s\"\n", sep);
+					printf("Content-Type: %s; boundary=\"%s\"\n", tflag, sep);
 					printf("\n");
 					printf("This is a multipart message in MIME format.\n");
 				}
@@ -423,13 +424,15 @@ main(int argc, char *argv[])
 	srand48(time(0) ^ getpid());
 
 	int c;
-	while ((c = getopt(argc, argv, "cr")) != -1)
+	while ((c = getopt(argc, argv, "crt:")) != -1)
 		switch(c) {
 		case 'r': rflag = 1; break;
 		case 'c': cflag = 1; break;
+		case 't': tflag = optarg; break;
 		default:
 		usage:
-			fprintf(stderr, "Usage: mmime [-c|-r] < message\n");
+			fprintf(stderr,
+"Usage: mmime [-c|-r] [-t CONTENT-TYPE] < message\n");
 			exit(1);
 		}