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);
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",