From 8d102acadc29635b951f7e113c49d9ea686c7b2d Mon Sep 17 00:00:00 2001 From: markus schnalke Date: Thu, 9 Feb 2012 14:00:37 +0100 Subject: [PATCH] Removed the -file switch from forw(1). --- man/forw.man1 | 28 ----------- man/mh-chart.man1 | 4 +- uip/forw.c | 135 +++++++++++++++++++++-------------------------------- 3 files changed, 53 insertions(+), 114 deletions(-) diff --git a/man/forw.man1 b/man/forw.man1 index aa9e5ff..dcbed35 100644 --- a/man/forw.man1 +++ b/man/forw.man1 @@ -24,8 +24,6 @@ forw \- forward messages .IR program ] .RB [ \-nowhatnowproc ] .RB [ \-build ] -.RB [ \-file -.IR msgfile ] .RB [ \-version ] .RB [ \-help ] .PP @@ -215,32 +213,6 @@ be present or to have the same effects in future versions of it is documented here only for completeness. .PP The -.B \-file -.I msgfile -switch specifies the message to be forwarded as an -exact filename rather than as an -.B nmh -folder and message number. It is -intended to be used by the -.B msh -interface to -.BR nmh . -This switch implies -.BR \-noannotate . -The forwarded message is simply -copied verbatim into the draft; the processing implied by -the -.BR \-filter , -.BR \-mime , -and -.B \-digest -switches is bypassed, and the usual leading and -trailing 'Forwarded Message' delimiters are not added. -The same caveats apply to this option as to the -.B \-build -switch. -.PP -The .B \-digest .IR list , .B \-issue diff --git a/man/mh-chart.man1 b/man/mh-chart.man1 index a66523b..e9c6a1a 100644 --- a/man/mh-chart.man1 +++ b/man/mh-chart.man1 @@ -184,8 +184,6 @@ is equivalent to .IR program ] .RB [ \-nowhatnowproc ] .RB [ \-build ] -.RB [ \-file -.IR msgfile ] .RB [ \-version ] .RB [ \-help ] .PP @@ -199,7 +197,7 @@ is equivalent to .IR number ] .RB [ \-volume .IR number ] -[other\ switches\ for\ +[other\ switches\ for .BR forw ] .RB [ \-version ] .RB [ \-help ] diff --git a/uip/forw.c b/uip/forw.c index 44c32a0..c3474c5 100644 --- a/uip/forw.c +++ b/uip/forw.c @@ -51,11 +51,9 @@ static struct swit switches[] = { { "version", 0 }, #define HELPSW 16 { "help", 0 }, -#define FILESW 17 - { "file file", 4 }, /* interface from msh */ #ifdef MHE -#define BILDSW 18 +#define BILDSW 17 { "build", 5 }, /* interface from mhe */ #endif /* MHE */ @@ -90,7 +88,7 @@ main(int argc, char **argv) int out, msgnum; char *cp, *cwd, *maildir; char *digest = NULL, *ed = NULL; - char *file = NULL, *filter = NULL, *folder = NULL; + char *filter = NULL, *folder = NULL; char *form = NULL, buf[BUFSIZ], value[10]; char **argp, **arguments, *msgs[MAXARGS]; @@ -158,14 +156,6 @@ main(int argc, char **argv) nwhat++; continue; - case FILESW: - if (file) - adios(NULL, "only one file at a time!"); - if (!(cp = *argp++) || *cp == '-') - adios(NULL, "missing argument to %s", - argp[-2]); - file = getcpy(expanddir(cp)); - continue; case FILTSW: if (!(cp = *argp++) || *cp == '-') adios(NULL, "missing argument to %s", @@ -230,9 +220,6 @@ main(int argc, char **argv) cwd = getcpy(pwd()); - if (file && (msgp || folder)) - adios(NULL, "can't mix files and folders/msgs"); - #ifdef MHE strncpy(drft, buildsw ? toabsdir("draft") : m_draft(seq_beyond), sizeof(drft)); @@ -240,45 +227,36 @@ main(int argc, char **argv) strncpy(drft, m_draft(seq_beyond), sizeof(drft)); #endif /* MHE */ - if (file) { - /* - ** Forwarding a file. - */ - anot = 0; /* don't want to annotate a file */ - } else { - /* - ** Forwarding a message. - */ - if (!msgp) - msgs[msgp++] = seq_cur; - if (!folder) - folder = getcurfol(); - maildir = toabsdir(folder); - - if (chdir(maildir) == NOTOK) - adios(maildir, "unable to change directory to"); - - /* read folder and create message structure */ - if (!(mp = folder_read(folder))) - adios(NULL, "unable to read folder %s", folder); - - /* check for empty folder */ - if (mp->nummsg == 0) - adios(NULL, "no messages in %s", folder); - - /* parse all the message ranges/sequences and set SELECTED */ - for (msgnum = 0; msgnum < msgp; msgnum++) - if (!m_convert(mp, msgs[msgnum])) - done(1); - seq_setprev(mp); /* set the previous sequence */ - } + /* + ** Forwarding a message. + */ + if (!msgp) + msgs[msgp++] = seq_cur; + if (!folder) + folder = getcurfol(); + maildir = toabsdir(folder); + + if (chdir(maildir) == NOTOK) + adios(maildir, "unable to change directory to"); + + /* read folder and create message structure */ + if (!(mp = folder_read(folder))) + adios(NULL, "unable to read folder %s", folder); + + /* check for empty folder */ + if (mp->nummsg == 0) + adios(NULL, "no messages in %s", folder); + + /* parse all the message ranges/sequences and set SELECTED */ + for (msgnum = 0; msgnum < msgp; msgnum++) + if (!m_convert(mp, msgs[msgnum])) + 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. - */ + /* Open form (component) file. */ if (digest) { if (issue == 0) { snprintf(buf, sizeof(buf), IFORMAT, digest); @@ -307,44 +285,35 @@ main(int argc, char **argv) cpydata(in, out, form, drft); close(in); - if (file) { - /* just copy the file into the draft */ - if ((in = open(file, O_RDONLY)) == NOTOK) - adios(file, "unable to open"); - cpydata(in, out, file, 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 { - /* - ** 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); - } - - if (digest) { - snprintf(buf, sizeof(buf), IFORMAT, digest); - snprintf(value, sizeof(value), "%d", issue); - context_replace(buf, getcpy(value)); - snprintf(buf, sizeof(buf), VFORMAT, digest); - snprintf(value, sizeof(value), "%d", volume); - context_replace(buf, getcpy(value)); - } + copy_draft(out, digest, drft, volume, issue); + close(out); + } - context_replace(curfolder, folder); /* update current folder */ - seq_setcur(mp, mp->lowsel); /* update current message */ - seq_save(mp); /* synchronize sequences */ - context_save(); /* save the context file */ + if (digest) { + snprintf(buf, sizeof(buf), IFORMAT, digest); + snprintf(value, sizeof(value), "%d", issue); + context_replace(buf, getcpy(value)); + snprintf(buf, sizeof(buf), VFORMAT, digest); + snprintf(value, sizeof(value), "%d", volume); + context_replace(buf, getcpy(value)); } + context_replace(curfolder, folder); /* update current folder */ + seq_setcur(mp, mp->lowsel); /* update current message */ + seq_save(mp); /* synchronize sequences */ + context_save(); /* save the context file */ + if (nwhat) done(0); what_now(ed, nedit, NOUSE, drft, NULL, 0, mp, -- 1.7.10.4