From: David Levine Date: Tue, 19 Mar 2013 01:00:10 +0000 (-0500) Subject: Added -[no]rmmproc switches to rmm and mhfixmsg. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/ebd71fa45bb0538e65e3106de57a04ae6c70abae?ds=inline;hp=--cc Added -[no]rmmproc switches to rmm and mhfixmsg. --- ebd71fa45bb0538e65e3106de57a04ae6c70abae diff --git a/man/mh-profile.man b/man/mh-profile.man index d7afe5be..25f57145 100644 --- a/man/mh-profile.man +++ b/man/mh-profile.man @@ -1,4 +1,4 @@ -.TH MH-PROFILE %manext5% "November 6, 2012" "%nmhversion%" +.TH MH-PROFILE %manext5% "March 18, 2013" "%nmhversion%" .\" .\" %nmhwarning% .\" @@ -535,9 +535,10 @@ to do address verification. none .RS 5 This is the program used by -.B rmm +.BR rmm , +.BR refile , and -.B refile +.B mhfixmsg to delete a message from a folder. .RE .PP diff --git a/man/mhfixmsg.man b/man/mhfixmsg.man index 14d2bf17..bb80a28f 100644 --- a/man/mhfixmsg.man +++ b/man/mhfixmsg.man @@ -1,4 +1,4 @@ -.TH MHFIXMSG %manext1% "March 17, 2013" "%nmhversion%" +.TH MHFIXMSG %manext1% "March 18, 2013" "%nmhversion%" .\" .\" %nmhwarning% .\" @@ -23,6 +23,9 @@ mhfixmsg \- rewrite MIME messages with various transformations .IR file ] .RB [ \-outfile .IR outfile ] +.RB [ \-rmmproc +.IR program ] +.RB [ \-normmproc ] .RB [ \-verbose " | " \-noverbose ] .RB [ \-version ] .RB [ \-help ] @@ -203,6 +206,15 @@ That is, it uses the profile component, if present. If not present, .B mhfixmsg moves the original message to a backup file. +The +.B \-rmmproc +switch may be used to override this profile component. The +.B \-normmproc +switch disables the use of any +.I rmmproc +profile component and negates all prior +.B \-rmmproc +switches. .PP .SS "Integration with procmail" By way of example, here is an excerpt from a procmailrc file diff --git a/man/refile.man b/man/refile.man index 48418865..213f5747 100644 --- a/man/refile.man +++ b/man/refile.man @@ -1,4 +1,4 @@ -.TH REFILE %manext1% "January 18, 2001" "%nmhversion%" +.TH REFILE %manext1% "March 18, 2013" "%nmhversion%" .\" .\" %nmhwarning% .\" @@ -223,7 +223,9 @@ for information concerning the previous sequence. .SH BUGS Since .B refile -uses your +and +.B rmm +use your .I rmmproc to delete the message, the @@ -232,6 +234,8 @@ must .B NOT call .B refile +or +.B rmm without specifying .BR \-normmproc , or you will create an infinite loop. diff --git a/man/rmm.man b/man/rmm.man index 52ac7f4d..d1b12c83 100644 --- a/man/rmm.man +++ b/man/rmm.man @@ -1,4 +1,4 @@ -.TH RMM %manext1% "February 13, 2013" "%nmhversion%" +.TH RMM %manext1% "March 18, 2013" "%nmhversion%" .\" .\" %nmhwarning% .\" @@ -11,6 +11,9 @@ rmm \- remove messages .RI [ +folder ] .RI [ msgs ] .RB [ \-unlink " | " \-nounlink ] +.RB [ \-rmmproc +.IR program ] +.RB [ \-normmproc ] .RB [ \-version ] .RB [ \-help ] .ad @@ -44,11 +47,20 @@ add a profile component such as rmmproc: /home/foouser/bin/rmm_msgs .RE .PP -then instead of simply renaming the message file, +Then instead of simply renaming the message file, .B rmm will call the named program or script to handle the files that represent the messages to be deleted. +The +.B \-rmmproc +switch may be used to override this profile component. The +.B \-normmproc +switch disables the use of any +.I rmmproc +profile component and negates all prior +.B \-rmmproc +switches. .PP An example of a .I rmmproc @@ -106,8 +118,10 @@ advance to the next message in the folder as expected. If a folder is given, it will become the current folder. .SH BUGS Since +.B rmm +and .B refile -uses your +use your .I rmmproc to delete the message, the @@ -115,7 +129,9 @@ the must .B NOT call +.B rmm +or .B refile without specifying .BR \-normmproc , -or you will create an infinte loop. +or you will create an infinite loop. diff --git a/test/mhfixmsg/test-mhfixmsg b/test/mhfixmsg/test-mhfixmsg index 14b9a58a..709a4062 100755 --- a/test/mhfixmsg/test-mhfixmsg +++ b/test/mhfixmsg/test-mhfixmsg @@ -45,6 +45,8 @@ Usage: mhfixmsg [+folder] [msgs] [switches] -[no]fixcte -file file -outfile file + -rmmproc program + -normmproc -[no]verbose -version -help @@ -857,6 +859,22 @@ check "${MH_TEST_DIR}/Mail/inbox/14.backup" \ "${MH_TEST_DIR}/Mail/inbox/14.original" +# check -normmproc +cp "${MH_TEST_DIR}/Mail/inbox/18" "${MH_TEST_DIR}/Mail/inbox/19" + +run_test 'mhfixmsg 18 -normmproc' +check "${MH_TEST_DIR}/Mail/inbox/19" \ + "${MH_TEST_DIR}/Mail/inbox/,18" 'keep first' + + +# check -rmmproc +run_test 'mhfixmsg 19 -rmmproc true' +if test -f '${MH_TEST_DIR}/Mail/inbox/19.backup'; then + echo check of mhfixmsg -rmmproc FAILED, should not have created backup file + failed=`expr ${failed:-0} + 1` +fi + + # make sure there are no tmp files left over find "$MH_TEST_DIR/Mail" \( -name 'mhfix*' -o -name ',mhfix*' \) -print \ >"$actual" diff --git a/uip/mhfixmsg.c b/uip/mhfixmsg.c index d6903974..65e602f1 100644 --- a/uip/mhfixmsg.c +++ b/uip/mhfixmsg.c @@ -31,6 +31,8 @@ X("nofixcte", 0, NFIXCTESW) \ X("file file", 0, FILESW) \ X("outfile file", 0, OUTFILESW) \ + X("rmmproc program", 0, RPROCSW) \ + X("normmproc", 0, NRPRCSW) \ X("verbose", 0, VERBSW) \ X("noverbose", 0, NVERBSW) \ X("version", 0, VERSIONSW) \ @@ -216,6 +218,14 @@ main (int argc, char **argv) { outfile = *cp == '-' ? add (cp, NULL) : path (cp, TFILE); continue; + case RPROCSW: + if (!(rmmproc = *argp++) || *rmmproc == '-') + adios (NULL, "missing argument to %s", argp[-2]); + continue; + case NRPRCSW: + rmmproc = NULL; + continue; + case VERBSW: verbosw = 1; continue; diff --git a/uip/rmm.c b/uip/rmm.c index d96622ed..897c5028 100644 --- a/uip/rmm.c +++ b/uip/rmm.c @@ -13,6 +13,8 @@ #define RMM_SWITCHES \ X("unlink", 0, UNLINKSW) \ X("nounlink", 0, NUNLINKSW) \ + X("rmmproc program", 0, RPROCSW) \ + X("normmproc", 0, NRPRCSW) \ X("version", 0, VERSIONSW) \ X("help", 0, HELPSW) \ @@ -50,13 +52,13 @@ main (int argc, char **argv) while ((cp = *argp++)) { if (*cp == '-') { switch (smatch (++cp, switches)) { - case AMBIGSW: + case AMBIGSW: ambigsw (cp, switches); done (1); - case UNKWNSW: + case UNKWNSW: adios (NULL, "-%s unknown\n", cp); - case HELPSW: + case HELPSW: snprintf (buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name); print_help (buf, switches, 1); @@ -71,6 +73,14 @@ main (int argc, char **argv) case NUNLINKSW: unlink_msgs = 0; continue; + + case RPROCSW: + if (!(rmmproc = *argp++) || *rmmproc == '-') + adios (NULL, "missing argument to %s", argp[-2]); + continue; + case NRPRCSW: + rmmproc = NULL; + continue; } } if (*cp == '+' || *cp == '@') {