]> diplodocus.org Git - nmh/commitdiff
Added -[no]rmmproc switches to rmm and mhfixmsg.
authorDavid Levine <levinedl@acm.org>
Tue, 19 Mar 2013 01:00:10 +0000 (20:00 -0500)
committerDavid Levine <levinedl@acm.org>
Tue, 19 Mar 2013 01:00:10 +0000 (20:00 -0500)
man/mh-profile.man
man/mhfixmsg.man
man/refile.man
man/rmm.man
test/mhfixmsg/test-mhfixmsg
uip/mhfixmsg.c
uip/rmm.c

index d7afe5be2fc72710c8084f4de8078dd54f446f91..25f5714594196866750e58f4f374f1627e727cd7 100644 (file)
@@ -1,4 +1,4 @@
-.TH MH-PROFILE %manext5% "November 6, 2012" "%nmhversion%"
+.TH MH-PROFILE %manext5% "March 18, 2013" "%nmhversion%"
 .\"
 .\" %nmhwarning%
 .\"
 .\"
 .\" %nmhwarning%
 .\"
@@ -535,9 +535,10 @@ to do address verification.
 none
 .RS 5
 This is the program used by
 none
 .RS 5
 This is the program used by
-.B rmm
+.BR rmm ,
+.BR refile ,
 and
 and
-.B refile
+.B mhfixmsg
 to delete a message from a folder.
 .RE
 .PP
 to delete a message from a folder.
 .RE
 .PP
index 14d2bf172cf6e344532edd7d372544ce38857395..bb80a28f3a440a33970cf3803569e466b51c71ad 100644 (file)
@@ -1,4 +1,4 @@
-.TH MHFIXMSG %manext1% "March 17, 2013" "%nmhversion%"
+.TH MHFIXMSG %manext1% "March 18, 2013" "%nmhversion%"
 .\"
 .\" %nmhwarning%
 .\"
 .\"
 .\" %nmhwarning%
 .\"
@@ -23,6 +23,9 @@ mhfixmsg \- rewrite MIME messages with various transformations
 .IR file ]
 .RB [ \-outfile
 .IR outfile ]
 .IR file ]
 .RB [ \-outfile
 .IR outfile ]
+.RB [ \-rmmproc
+.IR program ]
+.RB [ \-normmproc ]
 .RB [ \-verbose " | " \-noverbose ]
 .RB [ \-version ]
 .RB [ \-help ]
 .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.
 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
 .PP
 .SS "Integration with procmail"
 By way of example, here is an excerpt from a procmailrc file
index 484188650515473f0bf0fff41d5599957db5b2d3..213f5747aaa88699f8c53cbf6ad97b4727648822 100644 (file)
@@ -1,4 +1,4 @@
-.TH REFILE %manext1% "January 18, 2001" "%nmhversion%"
+.TH REFILE %manext1% "March 18, 2013" "%nmhversion%"
 .\"
 .\" %nmhwarning%
 .\"
 .\"
 .\" %nmhwarning%
 .\"
@@ -223,7 +223,9 @@ for information concerning the previous sequence.
 .SH BUGS
 Since
 .B refile
 .SH BUGS
 Since
 .B refile
-uses your
+and
+.B rmm
+use your
 .I rmmproc
 to delete the message,
 the
 .I rmmproc
 to delete the message,
 the
@@ -232,6 +234,8 @@ must
 .B NOT
 call
 .B refile
 .B NOT
 call
 .B refile
+or
+.B rmm
 without specifying
 .BR \-normmproc ,
 or you will create an infinite loop.
 without specifying
 .BR \-normmproc ,
 or you will create an infinite loop.
index 52ac7f4d5cee01597e8b5f6124c21115582e0748..d1b12c83a98771b728341e7fcb2b9b6181749fa8 100644 (file)
@@ -1,4 +1,4 @@
-.TH RMM %manext1% "February 13, 2013" "%nmhversion%"
+.TH RMM %manext1% "March 18, 2013" "%nmhversion%"
 .\"
 .\" %nmhwarning%
 .\"
 .\"
 .\" %nmhwarning%
 .\"
@@ -11,6 +11,9 @@ rmm \- remove messages
 .RI [ +folder ]
 .RI [ msgs ]
 .RB [ \-unlink " | " \-nounlink ]
 .RI [ +folder ]
 .RI [ msgs ]
 .RB [ \-unlink " | " \-nounlink ]
+.RB [ \-rmmproc
+.IR program ]
+.RB [ \-normmproc ]
 .RB [ \-version ]
 .RB [ \-help ]
 .ad
 .RB [ \-version ]
 .RB [ \-help ]
 .ad
@@ -44,11 +47,20 @@ add a profile component such as
 rmmproc:       /home/foouser/bin/rmm_msgs
 .RE
 .PP
 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.
 .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
 .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
 If a folder is given, it will become the current folder.
 .SH BUGS
 Since
+.B rmm
+and
 .B refile
 .B refile
-uses your
+use your
 .I rmmproc
 to delete the message,
 the
 .I rmmproc
 to delete the message,
 the
@@ -115,7 +129,9 @@ the
 must
 .B NOT
 call
 must
 .B NOT
 call
+.B rmm
+or
 .B refile
 without specifying
 .BR \-normmproc ,
 .B refile
 without specifying
 .BR \-normmproc ,
-or you will create an infinte loop.
+or you will create an infinite loop.
index 14b9a58ac4e760c7a767883c1721c948a3b3a259..709a4062f2da28d17e3cc8a859242e3cb6a5100d 100755 (executable)
@@ -45,6 +45,8 @@ Usage: mhfixmsg [+folder] [msgs] [switches]
   -[no]fixcte
   -file file
   -outfile file
   -[no]fixcte
   -file file
   -outfile file
+  -rmmproc program
+  -normmproc
   -[no]verbose
   -version
   -help
   -[no]verbose
   -version
   -help
@@ -857,6 +859,22 @@ check "${MH_TEST_DIR}/Mail/inbox/14.backup" \
       "${MH_TEST_DIR}/Mail/inbox/14.original"
 
 
       "${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"
 # make sure there are no tmp files left over
 find "$MH_TEST_DIR/Mail" \( -name 'mhfix*' -o -name ',mhfix*' \) -print \
   >"$actual"
index d69039748d81bcd2705e6ceb0d95103d2b062caf..65e602f1ff24430c2509fd116286a93252551f23 100644 (file)
@@ -31,6 +31,8 @@
     X("nofixcte", 0, NFIXCTESW) \
     X("file file", 0, FILESW) \
     X("outfile file", 0, OUTFILESW) \
     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) \
     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;
 
                 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;
             case VERBSW:
                 verbosw = 1;
                 continue;
index d96622ed835c3492546098874d38a303c462bd26..897c50280428066f0af5f913e06b9d06e3b51430 100644 (file)
--- a/uip/rmm.c
+++ b/uip/rmm.c
@@ -13,6 +13,8 @@
 #define RMM_SWITCHES \
     X("unlink", 0, UNLINKSW) \
     X("nounlink", 0, NUNLINKSW) \
 #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) \
 
     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)) {
     while ((cp = *argp++)) {
        if (*cp == '-') {
            switch (smatch (++cp, switches)) {
-           case AMBIGSW: 
+           case AMBIGSW:
                ambigsw (cp, switches);
                done (1);
                ambigsw (cp, switches);
                done (1);
-           case UNKWNSW: 
+           case UNKWNSW:
                adios (NULL, "-%s unknown\n", cp);
 
                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);
                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 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 == '@') {
            }
        }
        if (*cp == '+' || *cp == '@') {