|
|
@ -14,13 +14,14 @@ |
|
|
#ifdef _WIN32 |
|
|
#ifdef _WIN32 |
|
|
#define SHELL "cmd /k" |
|
|
#define SHELL "cmd /k" |
|
|
#else |
|
|
#else |
|
|
#define SHELL "/bin/csh" |
|
|
|
|
|
|
|
|
#define SHELL "/bin/sh" |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
/* Fork a shell. */ |
|
|
/* Fork a shell. */ |
|
|
void |
|
|
void |
|
|
com_shell(wordlist *wl) |
|
|
com_shell(wordlist *wl) |
|
|
{ |
|
|
{ |
|
|
|
|
|
int status; |
|
|
char *shell = NULL; |
|
|
char *shell = NULL; |
|
|
|
|
|
|
|
|
shell = getenv("SHELL"); |
|
|
shell = getenv("SHELL"); |
|
|
@ -61,16 +62,20 @@ com_shell(wordlist *wl) |
|
|
/* Easier to forget about changing the io descriptors. */ |
|
|
/* Easier to forget about changing the io descriptors. */ |
|
|
if (wl) { |
|
|
if (wl) { |
|
|
char * const com = wl_flatten(wl); |
|
|
char * const com = wl_flatten(wl); |
|
|
if (system(com) == -1) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
status = system(com); |
|
|
|
|
|
if (status == -1) { |
|
|
(void) fprintf(cp_err, "Unable to execute \"%s\".\n", com); |
|
|
(void) fprintf(cp_err, "Unable to execute \"%s\".\n", com); |
|
|
} |
|
|
} |
|
|
txfree(com); |
|
|
txfree(com); |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
if (system(shell) == -1) { |
|
|
|
|
|
|
|
|
status = system(shell); |
|
|
|
|
|
if (status == -1) { |
|
|
(void) fprintf(cp_err, "Unable to execute \"%s\".\n", shell); |
|
|
(void) fprintf(cp_err, "Unable to execute \"%s\".\n", shell); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
cp_vset("shellstatus", CP_NUM, &status); |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
} /* end of function com_shell */ |
|
|
} /* end of function com_shell */ |
|
|
|