projects
/
mmh
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add some gcc hint defines
[mmh]
/
uip
/
whatnowproc.c
diff --git
a/uip/whatnowproc.c
b/uip/whatnowproc.c
index
8d6830e
..
765ed8a
100644
(file)
--- a/
uip/whatnowproc.c
+++ b/
uip/whatnowproc.c
@@
-7,28
+7,22
@@
*/
#include <h/mh.h>
*/
#include <h/mh.h>
+#include <unistd.h>
/*
** This routine is used by comp, repl, forw, and dist to exec
** the "whatnowproc". It first sets up all the environment
** variables that the "whatnowproc" will need to check, and
/*
** This routine is used by comp, repl, forw, and dist to exec
** the "whatnowproc". It first sets up all the environment
** variables that the "whatnowproc" will need to check, and
-** then execs the command. As an optimization, if the
-** "whatnowproc" is the nmh command "whatnow" (typical case),
-** it will call this routine directly without exec'ing it.
+** then execs the command.
*/
*/
-
-/* from whatnowsbr.c */
-int WhatNow(int, char **);
-
-
int
int
-what_now(char *ed, int nedit, int use, char *file, char *altmsg, int dist,
- struct msgs *mp, char *text, int inplace, char *cwd)
+what_now(char *ed, int use, char *file, char *altmsg, int dist,
+ struct msgs *mp, char *text, char *cwd)
{
int found, k, msgnum, vecp;
int len, buflen;
{
int found, k, msgnum, vecp;
int len, buflen;
- register char *bp;
+ char *bp;
char buffer[BUFSIZ], *vec[MAXARGS];
vecp = 0;
char buffer[BUFSIZ], *vec[MAXARGS];
vecp = 0;
@@
-51,22
+45,20
@@
what_now(char *ed, int nedit, int use, char *file, char *altmsg, int dist,
} else {
unputenv("mhaltmsg");
}
} else {
unputenv("mhaltmsg");
}
- if ((bp = getenv("mhaltmsg")))/* XXX */
- m_putenv("editalt", bp);
snprintf(buffer, sizeof(buffer), "%d", dist);
m_putenv("mhdist", buffer);
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 {
} else {
- m_putenv("mheditor", ed ? ed : (ed = context_find("editor")) ?
- ed : defaulteditor);
+ unputenv("mheditor");
}
snprintf(buffer, sizeof(buffer), "%d", use);
m_putenv("mhuse", buffer);
unputenv("mhmessages");
unputenv("mhannotate");
}
snprintf(buffer, sizeof(buffer), "%d", use);
m_putenv("mhuse", buffer);
unputenv("mhmessages");
unputenv("mhannotate");
- unputenv("mhinplace");
if (text && mp && !is_readonly(mp)) {
found = 0;
if (text && mp && !is_readonly(mp)) {
found = 0;
@@
-94,8
+86,6
@@
what_now(char *ed, int nedit, int use, char *file, char *altmsg, int dist,
if (found) {
m_putenv("mhmessages", buffer);
m_putenv("mhannotate", text);
if (found) {
m_putenv("mhmessages", buffer);
m_putenv("mhannotate", text);
- snprintf(buffer, sizeof(buffer), "%d", inplace);
- m_putenv("mhinplace", buffer);
}
}
}
}
@@
-105,15
+95,6
@@
what_now(char *ed, int nedit, int use, char *file, char *altmsg, int dist,
if (cwd)
chdir(cwd);
if (cwd)
chdir(cwd);
- /*
- ** If the "whatnowproc" is the nmh command "whatnow",
- ** we run it internally, rather than exec'ing it.
- */
- if (strcmp(vec[0], "whatnow") == 0) {
- WhatNow(vecp, vec);
- done(0);
- }
-
execvp(whatnowproc, vec);
fprintf(stderr, "unable to exec ");
perror(whatnowproc);
execvp(whatnowproc, vec);
fprintf(stderr, "unable to exec ");
perror(whatnowproc);