mmime: add -t to override toplevel content-type

pull/37/head
Leah Neukirchen 7 years ago
parent 687b3ddc0d
commit d8976d416c

@ -7,6 +7,7 @@
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm .Nm
.Op Fl c | Fl r .Op Fl c | Fl r
.Op Fl t Ar content-type
< <
.Ar message .Ar message
.Sh DESCRIPTION .Sh DESCRIPTION
@ -37,6 +38,10 @@ or with status 0 else.
Raw mode: don't expand MIME parts in the body, generate a Raw mode: don't expand MIME parts in the body, generate a
.Sq Li text/plain .Sq Li text/plain
message. message.
.It Fl t Ar content-type
Override Content-Type for the toplevel part.
Defaults to
.Sq Li multipart/mixed .
.El .El
.Sh EXIT STATUS .Sh EXIT STATUS
.Ex -std .Ex -std

@ -18,6 +18,7 @@
static int cflag; static int cflag;
static int rflag; static int rflag;
static char *tflag = "multipart/mixed";
int gen_b64(uint8_t *s, off_t size) int gen_b64(uint8_t *s, off_t size)
{ {
@ -320,7 +321,7 @@ gen_build()
printf("Content-Transfer-Encoding: quoted-printable\n\n"); printf("Content-Transfer-Encoding: quoted-printable\n\n");
} else { } else {
printf("Content-Type: multipart/mixed; boundary=\"%s\"\n", sep); printf("Content-Type: %s; boundary=\"%s\"\n", tflag, sep);
printf("\n"); printf("\n");
printf("This is a multipart message in MIME format.\n"); printf("This is a multipart message in MIME format.\n");
} }
@ -423,13 +424,15 @@ main(int argc, char *argv[])
srand48(time(0) ^ getpid()); srand48(time(0) ^ getpid());
int c; int c;
while ((c = getopt(argc, argv, "cr")) != -1) while ((c = getopt(argc, argv, "crt:")) != -1)
switch(c) { switch(c) {
case 'r': rflag = 1; break; case 'r': rflag = 1; break;
case 'c': cflag = 1; break; case 'c': cflag = 1; break;
case 't': tflag = optarg; break;
default: default:
usage: usage:
fprintf(stderr, "Usage: mmime [-c|-r] < message\n"); fprintf(stderr,
"Usage: mmime [-c|-r] [-t CONTENT-TYPE] < message\n");
exit(1); exit(1);
} }

Loading…
Cancel
Save