]> diplodocus.org Git - nmh/blobdiff - uip/whatnowproc.c
Added context_find_prefix().
[nmh] / uip / whatnowproc.c
index 293d5ceb3c6f8ad0b51e00352b7b8a884615c8e8..8fc6ee727e185d628bfc751a48fa4745836c28bf 100644 (file)
@@ -22,7 +22,7 @@
 
 int
 what_now (char *ed, int nedit, int use, char *file, char *altmsg, int dist,
-          struct msgs *mp, char *text, int inplace, char *cwd)
+          struct msgs *mp, char *text, int inplace, char *cwd, int atfile)
 {
     int found, k, msgnum, vecp;
     int len, buflen;
@@ -55,11 +55,12 @@ what_now (char *ed, int nedit, int use, char *file, char *altmsg, int dist,
     if (nedit) {
        unputenv ("mheditor");
     } else {
-       m_putenv ("mheditor", ed ? ed : (ed = context_find ("editor"))
-           ? ed : defaulteditor);
+       m_putenv ("mheditor", ed ? ed : (ed = get_default_editor()));
     }
     snprintf (buffer, sizeof(buffer), "%d", use);
     m_putenv ("mhuse", buffer);
+    snprintf (buffer, sizeof(buffer), "%d", atfile);
+    m_putenv ("mhatfile", buffer);
 
     unputenv ("mhmessages");
     unputenv ("mhannotate");
@@ -98,8 +99,11 @@ what_now (char *ed, int nedit, int use, char *file, char *altmsg, int dist,
     context_save ();   /* save the context file */
     fflush (stdout);
 
-    if (cwd)
-       chdir (cwd);
+    if (cwd) {
+       if (chdir (cwd) < 0) {
+           advise (cwd, "chdir");
+       }
+    }
 
     /*
      * If the "whatnowproc" is the nmh command "whatnow",