Renamed -version switch to -Version to remove the conflict with -verbose.
[mmh] / uip / whatnowproc.c
index 1b16e5d..f3c46f8 100644 (file)
@@ -16,7 +16,7 @@
 ** then execs the command.
 */
 int
-what_now(char *ed, int nedit, int use, char *file, char *altmsg, int dist,
+what_now(char *ed, int use, char *file, char *altmsg, int dist,
        struct msgs *mp, char *text, char *cwd)
 {
        int found, k, msgnum, vecp;
@@ -48,11 +48,12 @@ what_now(char *ed, int nedit, int use, char *file, char *altmsg, int dist,
                m_putenv("editalt", bp);
        snprintf(buffer, sizeof(buffer), "%d", dist);
        m_putenv("mhdist", buffer);
-       if (nedit) {
-               unputenv("mheditor");
+       if (!ed) {
+               m_putenv("mheditor", defaulteditor);
+       } else if (*ed) {
+               m_putenv("mheditor", ed);
        } else {
-               m_putenv("mheditor", ed ? ed : (ed = context_find("editor")) ?
-                               ed : defaulteditor);
+               unputenv("mheditor");
        }
        snprintf(buffer, sizeof(buffer), "%d", use);
        m_putenv("mhuse", buffer);