mblaze

Unix utilities to deal with Maildir - my mirror
git clone https://pi.duncano.de/git/mblaze.git
Log | Files | Refs | README | COPYING

commit a52af29aa96be8d59a6e7806283ca91dcf46c8a7
parent 41474c2e685b3b36c6298b1e7493924afa9cea06
Author: Christian Neukirchen <chneukirchen@gmail.com>
Date:   Tue,  2 Aug 2016 13:50:47 +0200

mmime: simplify

Diffstat:
man/mmime.1 | 12++----------
mmime.c | 26--------------------------
2 files changed, 2 insertions(+), 36 deletions(-)

diff --git a/man/mmime.1 b/man/mmime.1 @@ -6,23 +6,15 @@ .Nd encode MIME mails .Sh SYNOPSIS .Nm -.Ar files\ ... .Sh DESCRIPTION .Nm -encodes the -.Ar files -given as arguments into a MIME message. +encodes the standard input into a MIME message. .Pp -If there is more than one file, a -.Sq Li multipart/mixed -mail is generated. -.Pp -With no arguments, .Nm generates a .Sq Li multipart/mixed mail from standard input, -extending the header as neccessary, +extending, wrapping, and encoding the header as neccessary, and replacing body lines looking like .Pp .D1 Li # Ns Ar type Pa filename diff --git a/mmime.c b/mmime.c @@ -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 print_header(char *line) { char *s, *e; @@ -347,10 +327,4 @@ main(int argc, char *argv[]) if (argc == 1) 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); }