]> diplodocus.org Git - nmh/blobdiff - uip/repl.c
Simplified m_strn() per Ralph's suggestions.
[nmh] / uip / repl.c
index f97210c28759b3914440083b97f3847097dce50a..adfe58d792aee1a0fb1174f82a69249ade745aac 100644 (file)
@@ -1,6 +1,4 @@
-
-/*
- * repl.c -- reply to a message
+/* repl.c -- reply to a message
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -10,6 +8,7 @@
 #include <h/mh.h>
 #include <h/mime.h>
 #include <h/utils.h>
+#include "../sbr/m_maildir.h"
 
 #define REPL_SWITCHES \
     X("group", 0, GROUPSW) \
@@ -40,7 +39,7 @@
     X("width columns", 0, WIDTHSW) \
     X("version", 0, VERSIONSW) \
     X("help", 0, HELPSW) \
-    X("file file", 4, FILESW) /* interface from msh */ \
+    X("file file", 4, FILESW) \
     X("build", 5, BILDSW) /* interface from mhe */ \
     X("atfile", 0, ATFILESW) \
     X("noatfile", 0, NOATFILESW) \
@@ -225,7 +224,8 @@ main (int argc, char **argv)
                    nwhat = 0;
                    continue;
                case BILDSW: 
-                   buildsw++;  /* fall... */
+                   buildsw++;
+                   /* FALLTHRU */
                case NWHATSW: 
                    nwhat++;
                    continue;
@@ -388,7 +388,7 @@ try_it_again:
                        i = YESW;
                    break;
                default: 
-                   advise (NULL, "say what?");
+                   inform("say what?");
                    break;
            }
        }
@@ -452,14 +452,16 @@ try_it_again:
     fclose (in);
 
     {
-       char *filename = concat (mp->foldpath, "/", msg, NULL);
+        char *filename = file ? file : concat (mp->foldpath, "/", msg, NULL);
 
         for (n = 0; n < svector_size (convert_types); ++n) {
             add_convert_header (svector_at (convert_types, n),
                                 svector_at (convert_args, n),
                                 filename, drft);
         }
-       free (filename);
+        if (! file) {
+            free (filename);
+        }
     }
 
     if (nwhat)