Fixed explanation of why the unset SHELL test is uselessif /bin/sh is bash.
[mmh] / uip / repl.c
index 97178b1..cc8a86b 100644 (file)
@@ -74,6 +74,10 @@ static struct swit switches[] = {
     { "atfile", 0 },
 #define NOATFILESW            30
     { "noatfile", 0 },
+#define FMTPROCSW             31
+    { "fmtproc program", 0 },
+#define NFMTPROCSW            32
+    { "nofmtproc", 0 },
 
     { NULL, 0 }
 };
@@ -138,7 +142,8 @@ main (int argc, char **argv)
     int        i, isdf = 0;
     int anot = 0, inplace = 1;
     int nedit = 0, nwhat = 0;
-    int atfile = 1;
+    int atfile = 0;
+    int fmtproc = -1;
     char *cp, *cwd, *dp, *maildir, *file = NULL;
     char *folder = NULL, *msg = NULL, *dfolder = NULL;
     char *dmsg = NULL, *ed = NULL, drft[BUFSIZ], buf[BUFSIZ];
@@ -176,7 +181,7 @@ main (int argc, char **argv)
                    done (0);
                case VERSIONSW:
                    print_version(invo_name);
-                   done (1);
+                   done (0);
 
                case GROUPSW:
                    groupreply++;
@@ -316,6 +321,15 @@ main (int argc, char **argv)
                case NOATFILESW:
                    atfile = 0;
                    continue;
+
+               case FMTPROCSW:
+                   if (!(formatproc = *argp++) || *formatproc == '-')
+                       adios (NULL, "missing argument to %s", argp[-2]);
+                   fmtproc = 1;
+                   continue;
+               case NFMTPROCSW:
+                   fmtproc = 0;
+                   continue;
            }
        }
        if (*cp == '+' || *cp == '@') {
@@ -431,13 +445,14 @@ try_it_again:
            form = etcpath (replcomps);
     }
 
-    replout (in, msg, drft, mp, outputlinelen, mime, form, filter, fcc);
+    replout (in, msg, drft, mp, outputlinelen, mime, form, filter,
+            fcc, fmtproc);
     fclose (in);
 
     if (nwhat)
        done (0);
-    what_now (ed, nedit, NOUSE, drft, atfile ? msg : NULL, 0, mp,
-           anot ? "Replied" : NULL, inplace, cwd);
+    what_now (ed, nedit, NOUSE, drft, msg, 0, mp, anot ? "Replied" : NULL,
+           inplace, cwd, atfile);
     done (1);
     return 1;
 }