mmime: simplify

pull/2/head
Christian Neukirchen 8 years ago
parent 41474c2e68
commit a52af29aa9

@ -6,23 +6,15 @@
.Nd encode MIME mails .Nd encode MIME mails
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm .Nm
.Ar files\ ...
.Sh DESCRIPTION .Sh DESCRIPTION
.Nm .Nm
encodes the encodes the standard input into a MIME message.
.Ar files
given as arguments into a MIME message.
.Pp .Pp
If there is more than one file, a
.Sq Li multipart/mixed
mail is generated.
.Pp
With no arguments,
.Nm .Nm
generates a generates a
.Sq Li multipart/mixed .Sq Li multipart/mixed
mail from standard input, mail from standard input,
extending the header as neccessary, extending, wrapping, and encoding the header as neccessary,
and replacing body lines looking like and replacing body lines looking like
.Pp .Pp
.D1 Li # Ns Ar type Pa filename .D1 Li # Ns Ar type Pa filename

@ -173,26 +173,6 @@ int gen_file(char *file, char *ct)
} }
} }
int
gen_mixed(int argc, char *argv[])
{
char sep[100];
snprintf(sep, sizeof sep, "----_=_%08lx%08lx%08lx_=_",
lrand48(), lrand48(), lrand48());
int i;
printf("Content-Type: multipart/mixed; boundary=\"%s\"\n", sep);
printf("\n");
printf("This is a multipart message in MIME format.\n\n");
for (i = 0; i < argc; i++) {
printf("--%s\n", sep);
gen_file(argv[i], 0);
}
printf("--%s--\n", sep);
return 0;
}
void void
print_header(char *line) { print_header(char *line) {
char *s, *e; char *s, *e;
@ -347,10 +327,4 @@ main(int argc, char *argv[])
if (argc == 1) if (argc == 1)
return gen_build(); return gen_build();
printf("MIME-Version: 1.0\n");
if (argc >= 2)
return gen_mixed(argc-1, argv+1);
else
return gen_file(argv[1], 0);
} }

Loading…
Cancel
Save