diff options
Diffstat (limited to 'debian/patches/command-not-found.dpatch')
-rwxr-xr-x | debian/patches/command-not-found.dpatch | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/debian/patches/command-not-found.dpatch b/debian/patches/command-not-found.dpatch new file mode 100755 index 0000000..b1feb22 --- /dev/null +++ b/debian/patches/command-not-found.dpatch @@ -0,0 +1,66 @@ +#! /bin/sh -e + +if [ $# -eq 3 -a "$2" = '-d' ]; then + pdir="-d $3" +elif [ $# -ne 1 ]; then + echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" + exit 1 +fi +case "$1" in + -patch) patch $pdir -f --no-backup-if-mismatch -p1 < $0;; + -unpatch) patch $pdir -f --no-backup-if-mismatch -R -p1 < $0;; + *) + echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" + exit 1 +esac +exit 0 + +# DP: Add command_not_found_handle in interactive non POSIX mode + +--- bash/execute_cmd.c~ 2004-08-28 14:43:04.000000000 +0200 ++++ bash/execute_cmd.c 2004-08-28 14:54:57.000000000 +0200 +@@ -3615,8 +3615,26 @@ + + 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 +--- bash/doc/bash.1~ 2004-08-06 08:01:10.000000000 +0200 ++++ bash/doc/bash.1 2004-08-28 15:03:13.000000000 +0200 +@@ -1972,6 +1972,13 @@ + .B % + job identifier. + .TP ++.B command_not_found_handle ++The name of a shell function to be called if a command cannot be ++found. The return value of this function should be 0, if the command ++is available after execution of the function, otherwise 127 (EX_NOTFOUND). ++Enabled only in interactive, non POSIX mode shells. This is a Debian ++extension. ++.TP + .B histchars + The two or three characters which control history expansion + and tokenization (see |