From: markus schnalke Date: Thu, 9 Feb 2012 14:06:49 +0000 (+0100) Subject: forw(1) does always MIMEify now. X-Git-Tag: mmh-thesis-end~343 X-Git-Url: http://git.marmaro.de/?a=commitdiff_plain;h=6e271608b7b9c23771523f88d23a4d3593010cf1;p=mmh forw(1) does always MIMEify now. Removed the -(no)mime, -(no)format, -filter switches. If you like to forward messages in non-MIME format, then manually read in the output of: mhl -forwall -form mhl.forward `mhpath MSGS...` Digest do get MIMEified too. To send non-MIME digests use: mhl -forwall -from mhl.digest -digest X -volume Y -issue Z `mhpath ...` --- diff --git a/etc/digestcomps b/etc/digestcomps index 29d732d..49c8881 100644 --- a/etc/digestcomps +++ b/etc/digestcomps @@ -1,9 +1,10 @@ -From: %{digest}-Request +From: %{digest}-request To: %{digest} Distribution: dist-%{digest}; Subject: %{digest} Digest V%(cur) #%(msg) Reply-To: %{digest} -------- -%{digest} Digest %(weekday{date}), %2(mday{date}) %(month{date}) %(year{date}) - Volume %(cur) : Issue %(msg) +%{digest} Digest +Volume %(cur) : Issue %(msg) +%(weekday{date}), %02(mday{date}) %(month{date}) %(year{date}) -Today's Topics: +Today's Topics are attached. diff --git a/man/forw.man1 b/man/forw.man1 index dcbed35..026b2cf 100644 --- a/man/forw.man1 +++ b/man/forw.man1 @@ -13,10 +13,6 @@ forw \- forward messages .RB [ \-annotate " | " \-noannotate ] .RB [ \-form .IR formfile ] -.RB [ \-format " | " \-noformat ] -.RB [ \-filter -.IR filterfile ] -.RB [ \-mime " | " \-nomime ] .RB [ \-editor .IR editor ] .RB [ \-noedit ] @@ -98,83 +94,20 @@ and .B \-noedit switches. .PP -Although -.B forw -uses a forms (components) file to direct it how to -construct the beginning of the draft, it uses a message filter file to -direct it as to how each forwarded message should be formatted in the -body of the draft. The filter file for \fIforw\fR should be a standard -form file for -.BR mhl , -as -.B forw -will invoke -.B mhl -to filter (re\-format) the forwarded messages prior to being output to -the body of the draft. -.PP -The switches -.BR \-noformat , -.BR \-format , -and -.B \-filter -.I filterfile -specify which message filter file to use. -.PP -If -.B \-noformat -is specified (this is the default), then each forwarded -message is output into the draft exactly as it appears with no -.B mhl -filtering. +.B Forw +generates an attachment header field for the messages to be forwarded. +.B Send +will care to encapsulate them using MIME rules. .PP -If -.B \-format -is specified, then a default message filter file is used. -This default message filter should be adequate for most users. -This default filter -.RI \*(lq mhl.forward \*(rq -is: +To send non-MIME forwarded messages, compose a new message (e.g. with +.B comp ) +and read in the output of: .PP .RS 5 -.nf -%mhl_forward% -.fi +mhl \-forwall \-form mhl.forward `mhpath +.I MSGS... ` .RE .PP -If a file named -.RI \*(lq mhl.forward \*(rq -exists in the user's mmh -directory, it will be used instead of this form. You may specify an -alternate message filter file with the switch -.B \-filter -.IR filterfile . -.PP -Each forwarded message is separated with an encapsulation delimiter. -By default, any dashes in the first column of the forwarded messages -will be prepended with `\-\ ' so that when received, the message is -suitable for bursting by -.BR burst . -This follows the Internet RFC\-934 guidelines. -.PP -For users of -.BR prompter , -by specifying -.BR prompter 's -.B \-prepend -switch in the -.I .mmh/profile -file, any commentary text is entered -before the forwarded messages. (A major win!) -.PP -To use the MIME rules for encapsulation, specify the -.B \-mime -switch. This directs -.B forw -to generate an attachment header field. -.B send -will care for everything else. -.PP The .B \-editor .I editor @@ -248,8 +181,6 @@ User's Manual for more information on making digests. ^or $HOME/.mmh/forwcomps~^Rather than the standard skeleton ^%etcdir%/digestcomps~^The message skeleton if `\-digest' is given ^or $HOME/.mmh/digestcomps~^Rather than the standard skeleton -^%etcdir%/mhl.forward~^The standard message filter -^or $HOME/.mmh/mhl.forward~^Rather than the standard filter ^$HOME/.mmh/profile~^The user profile ^+drafts~^The draft folder .fi @@ -279,8 +210,6 @@ mhbuild(1), comp(1), repl(1), send(1), whatnow(1), mh\-format(5), .RB ` +folder "' defaults to the current folder" .RB ` msgs "' defaults to cur" .RB ` \-noannotate ' -.RB ` \-noformat ' -.RB ` \-nomime ' .fi .SH CONTEXT diff --git a/man/mh-chart.man1 b/man/mh-chart.man1 index e9c6a1a..305e99e 100644 --- a/man/mh-chart.man1 +++ b/man/mh-chart.man1 @@ -173,10 +173,6 @@ is equivalent to .RB [ \-annotate " | " \-noannotate ] .RB [ \-form .IR formfile ] -.RB [ \-format " | " \-noformat ] -.RB [ \-filter -.IR filterfile ] -.RB [ \-mime " | " \-nomime ] .RB [ \-editor .IR editor ] .RB [ \-noedit ] diff --git a/uip/forw.c b/uip/forw.c index c3474c5..b84632b 100644 --- a/uip/forw.c +++ b/uip/forw.c @@ -25,35 +25,25 @@ static struct swit switches[] = { { "editor editor", 0 }, #define NEDITSW 3 { "noedit", 0 }, -#define FILTSW 4 - { "filter filterfile", 0 }, -#define FORMSW 5 +#define FORMSW 4 { "form formfile", 0 }, -#define FRMTSW 6 - { "format", 5 }, -#define NFRMTSW 7 - { "noformat", 7 }, -#define MIMESW 8 - { "mime", 0 }, -#define NMIMESW 9 - { "nomime", 0 }, -#define DGSTSW 10 +#define DGSTSW 5 { "digest list", 0 }, -#define ISSUESW 11 +#define ISSUESW 6 { "issue number", 0 }, -#define VOLUMSW 12 +#define VOLUMSW 7 { "volume number", 0 }, -#define WHATSW 13 +#define WHATSW 8 { "whatnowproc program", 0 }, -#define NWHATSW 14 +#define NWHATSW 9 { "nowhatnowproc", 0 }, -#define VERSIONSW 15 +#define VERSIONSW 10 { "version", 0 }, -#define HELPSW 16 +#define HELPSW 11 { "help", 0 }, #ifdef MHE -#define BILDSW 17 +#define BILDSW 12 { "build", 5 }, /* interface from mhe */ #endif /* MHE */ @@ -61,20 +51,12 @@ static struct swit switches[] = { }; static char drft[BUFSIZ]; - -static char delim3[] = - "\n------------------------------------------------------------\n\n"; -static char delim4[] = "\n------------------------------\n\n"; - - -static struct msgs *mp = NULL; /* used a lot */ +static struct msgs *mp = NULL; /* ** static prototypes */ -static void mhl_draft(int, char *, int, int, char *, char *); -static void copy_draft(int, char *, char *, int, int); static void add_forw_hdr(char *); static int build_form(char *, char *, int, int); @@ -82,13 +64,13 @@ static int build_form(char *, char *, int, int); int main(int argc, char **argv) { - int msgp = 0, anot = 0, mime = 0; + int msgp = 0, anot = 0; int issue = 0, volume = 0; int nedit = 0, nwhat = 0, in; int out, msgnum; char *cp, *cwd, *maildir; char *digest = NULL, *ed = NULL; - char *filter = NULL, *folder = NULL; + char *folder = NULL; char *form = NULL, buf[BUFSIZ], value[10]; char **argp, **arguments, *msgs[MAXARGS]; @@ -156,39 +138,17 @@ main(int argc, char **argv) nwhat++; continue; - case FILTSW: - if (!(cp = *argp++) || *cp == '-') - adios(NULL, "missing argument to %s", - argp[-2]); - filter = getcpy(etcpath(cp)); - mime = 0; - continue; case FORMSW: if (!(form = *argp++) || *form == '-') adios(NULL, "missing argument to %s", argp[-2]); continue; - case FRMTSW: - filter = getcpy(etcpath(mhlforward)); - continue; - case NFRMTSW: - filter = NULL; - continue; - - case MIMESW: - mime++; - filter = NULL; - continue; - case NMIMESW: - mime = 0; - continue; - case DGSTSW: if (!(digest = *argp++) || *digest == '-') adios(NULL, "missing argument to %s", argp[-2]); - mime = 0; + //mime = 0; continue; case ISSUESW: if (!(cp = *argp++) || *cp == '-') @@ -253,9 +213,6 @@ main(int argc, char **argv) done(1); seq_setprev(mp); /* set the previous sequence */ - if (filter && access(filter, R_OK) == NOTOK) - adios(filter, "unable to read"); - /* Open form (component) file. */ if (digest) { if (issue == 0) { @@ -284,21 +241,8 @@ main(int argc, char **argv) */ cpydata(in, out, form, drft); close(in); - - /* - ** If filter file is defined, then format the - ** messages into the draft using mhlproc. - */ - if (filter) { - mhl_draft(out, digest, volume, issue, drft, filter); - close(out); - } else if (mime) { - close(out); - add_forw_hdr(drft); - } else { - copy_draft(out, digest, drft, volume, issue); - close(out); - } + close(out); + add_forw_hdr(drft); if (digest) { snprintf(buf, sizeof(buf), IFORMAT, digest); @@ -324,164 +268,6 @@ main(int argc, char **argv) /* -** Filter the messages you are forwarding, into the -** draft calling the mhlproc, and reading its output -** from a pipe. -*/ -static void -mhl_draft(int out, char *digest, int volume, int issue, - char *file, char *filter) -{ - pid_t child_id; - int i, msgnum, pd[2]; - char *vec[MAXARGS]; - char buf1[BUFSIZ]; - char buf2[BUFSIZ]; - - if (pipe(pd) == NOTOK) - adios("pipe", "unable to create"); - - vec[0] = mhbasename(mhlproc); - - for (i = 0; (child_id = fork()) == NOTOK && i < 5; i++) - sleep(5); - switch (child_id) { - case NOTOK: - adios("fork", "unable to"); - - case OK: - close(pd[0]); - dup2(pd[1], 1); - close(pd[1]); - - i = 1; - vec[i++] = "-forwall"; - vec[i++] = "-form"; - vec[i++] = filter; - - if (digest) { - vec[i++] = "-digest"; - vec[i++] = digest; - vec[i++] = "-issue"; - snprintf(buf1, sizeof(buf1), "%d", issue); - vec[i++] = buf1; - vec[i++] = "-volume"; - snprintf(buf2, sizeof(buf2), "%d", volume); - vec[i++] = buf2; - } - - if (mp->numsel >= MAXARGS - i) - adios(NULL, "more than %d messages for %s exec", - MAXARGS - i, vec[0]); - - /* - ** Now add the message names to filter. We can only - ** handle about 995 messages (because vec is fixed - ** size), but that should be plenty. - */ - for (msgnum = mp->lowsel; - msgnum <= mp->hghsel && i < sizeof(vec) - 1; - msgnum++) - if (is_selected(mp, msgnum)) - vec[i++] = getcpy(m_name(msgnum)); - vec[i] = NULL; - - execvp(mhlproc, vec); - fprintf(stderr, "unable to exec "); - perror(mhlproc); - _exit(-1); - - default: - close(pd[1]); - cpydata(pd[0], out, vec[0], file); - close(pd[0]); - pidXwait(child_id, mhlproc); - break; - } -} - - -/* -** Copy the messages into the draft. The messages are -** not filtered through the mhlproc. Do dashstuffing. -*/ -static void -copy_draft(int out, char *digest, char *file, int volume, int issue) -{ - int fd,i, msgcnt, msgnum; - int len, buflen; - register char *bp, *msgnam; - char buffer[BUFSIZ]; - - msgcnt = 1; - for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) { - if (is_selected(mp, msgnum)) { - if (digest) { - strncpy(buffer, msgnum == mp->lowsel ? - delim3 : delim4, sizeof(buffer)); - } else { - /* Get buffer ready to go */ - bp = buffer; - buflen = sizeof(buffer); - - strncpy(bp, "\n-------", buflen); - len = strlen(bp); - bp += len; - buflen -= len; - - if (msgnum == mp->lowsel) { - snprintf(bp, buflen, " Forwarded Message%s", mp->numsel > 1 ? "s" : ""); - } else { - snprintf(bp, buflen, " Message %d", msgcnt); - } - len = strlen(bp); - bp += len; - buflen -= len; - - strncpy(bp, "\n\n", buflen); - } - write(out, buffer, strlen(buffer)); - - if ((fd = open(msgnam = m_name (msgnum), O_RDONLY)) - == NOTOK) { - admonish(msgnam, "unable to read message"); - continue; - } - - /* - ** Copy the message. Add RFC934 quoting (dashstuffing) - */ - cpydgst(fd, out, msgnam, file); - - close(fd); - msgcnt++; - } - } - - if (digest) { - strncpy(buffer, delim4, sizeof(buffer)); - } else { - snprintf(buffer, sizeof(buffer), - "\n------- End of Forwarded Message%s\n\n", - mp->numsel > 1 ? "s" : ""); - } - write(out, buffer, strlen(buffer)); - - if (digest) { - snprintf(buffer, sizeof(buffer), - "End of %s Digest [Volume %d Issue %d]\n", - digest, volume, issue); - i = strlen(buffer); - for (bp = buffer + i; i > 1; i--) - *bp++ = '*'; - *bp++ = '\n'; - *bp = 0; - write(out, buffer, strlen(buffer)); - } -} - - -/* ** Create an attachment header for the to be forward messages. */ static void