summaryrefslogtreecommitdiff
path: root/execute_cmd.c
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@vyatta.com>2007-11-12 13:57:46 -0800
committerAn-Cheng Huang <ancheng@vyatta.com>2007-11-14 16:17:01 -0800
commitf533861f868afc167aae06968db5bc138729189f (patch)
treeeff8b5e0ce0b88c2ab470a1bfd841668f26a005d /execute_cmd.c
parentfc7695ee76400ee9833301f98a3fe483d64591b5 (diff)
downloadvyatta-bash-f533861f868afc167aae06968db5bc138729189f.tar.gz
vyatta-bash-f533861f868afc167aae06968db5bc138729189f.zip
patched with "debian_patches" in bash_3.1dfsg-8.diff.gz
Diffstat (limited to 'execute_cmd.c')
-rw-r--r--execute_cmd.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/execute_cmd.c b/execute_cmd.c
index ce90d25..9162f3e 100644
--- a/execute_cmd.c
+++ b/execute_cmd.c
@@ -3638,8 +3638,26 @@ execute_disk_command (words, redirects, command_line, pipe_in, pipe_out,
if (command == 0)
{
- internal_error (_("%s: command not found"), pathname);
- exit (EX_NOTFOUND); /* Posix.2 says the exit status is 127 */
+ SHELL_VAR *f, *v;
+ WORD_LIST *cmdlist;
+ WORD_DESC *w;
+ int fval;
+ if( (posixly_correct || interactive_shell == 0) ||
+ (f = find_function ("command_not_found_handle")) == 0)
+ {
+ internal_error (_("%s: command not found"), pathname);
+ exit (EX_NOTFOUND); /* Posix.2 says the exit status is 127 */
+ }
+ w = make_word("command_not_found_handle");
+ cmdlist = make_word_list(w, (WORD_LIST*)NULL);
+
+ w = make_word(pathname);
+ cmdlist->next = make_word_list(w, (WORD_LIST*)NULL);
+
+ fval = execute_shell_function (f, cmdlist);
+ if (fval == EX_NOTFOUND)
+ internal_error (_("%s: command not found"), pathname);
+ exit(fval);
}
/* Execve expects the command name to be in args[0]. So we