X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/df6971a59e8d01dcfe605bbac949b7d4b3ab0a92..a34ce71c09fe1d5dda955bbd987f3add2b3c368e:/uip/whatnowproc.c?ds=sidebyside diff --git a/uip/whatnowproc.c b/uip/whatnowproc.c index 293d5ceb..a0186f55 100644 --- a/uip/whatnowproc.c +++ b/uip/whatnowproc.c @@ -1,6 +1,4 @@ - -/* - * whatnowproc.c -- exec the "whatnowproc" +/* whatnowproc.c -- exec the "whatnowproc" * * This code is Copyright (c) 2002, by the authors of nmh. See the * COPYRIGHT file in the root directory of the nmh distribution for @@ -22,11 +20,11 @@ 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; - register char *bp; + char *bp; char buffer[BUFSIZ], *vec[MAXARGS]; vecp = 0; @@ -55,11 +53,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 +97,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",