diff options
author | Jari Aalto <jari.aalto@cante.net> | 1999-02-19 17:11:39 +0000 |
---|---|---|
committer | Jari Aalto <jari.aalto@cante.net> | 2009-09-12 16:46:52 +0000 |
commit | b72432fdcc59300c6fe7c9d6c8a31ad3447933f5 (patch) | |
tree | b9899162338c2ff3fd83a8aef8831cb119e85cd7 /builtins/evalstring.c | |
parent | bc4cd23ce958feda898c618215f94d8a4e8f4ffa (diff) | |
download | bash-b72432fdcc59300c6fe7c9d6c8a31ad3447933f5.tar.gz |
Imported from ../bash-2.03.tar.gz.
Diffstat (limited to 'builtins/evalstring.c')
-rw-r--r-- | builtins/evalstring.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/builtins/evalstring.c b/builtins/evalstring.c index 0063b711..56d2e1bc 100644 --- a/builtins/evalstring.c +++ b/builtins/evalstring.c @@ -51,6 +51,8 @@ extern int errno; #endif +#define IS_BUILTIN(s) (builtin_address_internal(s, 0) != (struct builtin *)NULL) + extern void run_trap_cleanup (); extern int interactive, interactive_shell; @@ -181,7 +183,7 @@ parse_and_execute (string, from_file, flags) } default: - programming_error ("parse_and_execute: bad jump: code %d", code); + command_error ("parse_and_execute", CMDERR_BADJUMP, code, 0); break; } } @@ -206,9 +208,20 @@ parse_and_execute (string, from_file, flags) global_command = (COMMAND *)NULL; #if defined (ONESHOT) - if (startup_state == 2 && *bash_input.location.string == '\0' && - command->type == cm_simple && !command->redirects && - !command->value.Simple->redirects && + /* + * IF + * we were invoked as `bash -c' (startup_state == 2) AND + * parse_and_execute has not been called recursively AND + * we have parsed the full command (string == '\0') AND + * we have a simple command without redirections AND + * the command is not being timed + * THEN + * tell the execution code that we don't need to fork + */ + if (startup_state == 2 && parse_and_execute_level == 1 && + *bash_input.location.string == '\0' && + command->type == cm_simple && + !command->redirects && !command->value.Simple->redirects && ((command->flags & CMD_TIME_PIPELINE) == 0)) { command->flags |= CMD_NO_FORK; |