Imported from ../bash-3.0.16.tar.gz.

This commit is contained in:
Jari Aalto 2004-11-09 21:37:25 +00:00
commit eb87367179
21 changed files with 181 additions and 67 deletions

View file

@ -23,7 +23,7 @@ $PRODUCES trap.c
$BUILTIN trap
$FUNCTION trap_builtin
$SHORT_DOC trap [-lp] [[arg] signal_spec ...]
$SHORT_DOC trap [-lp] [arg signal_spec ...]
The command ARG is to be read and executed when the shell receives
signal(s) SIGNAL_SPEC. If ARG is absent (and a single SIGNAL_SPEC
is supplied) or `-', each specified signal is reset to its original
@ -87,7 +87,7 @@ int
trap_builtin (list)
WORD_LIST *list;
{
int list_signal_names, display, result, opt;
int list_signal_names, display, result, opt, first_signal;
list_signal_names = display = 0;
result = EXECUTION_SUCCESS;
@ -118,14 +118,19 @@ trap_builtin (list)
else
{
char *first_arg;
int operation, sig;
int operation, sig, first_signal;
operation = SET;
first_arg = list->word->word;
first_signal = first_arg && *first_arg && all_digits (first_arg) && signal_object_p (first_arg, opt);
/* Backwards compatibility */
if (first_signal)
operation = REVERT;
/* When in posix mode, the historical behavior of looking for a
missing first argument is disabled. To revert to the original
signal handling disposition, use `-' as the first argument. */
if (posixly_correct == 0 && first_arg && *first_arg &&
else if (posixly_correct == 0 && first_arg && *first_arg &&
(*first_arg != '-' || first_arg[1]) &&
signal_object_p (first_arg, opt) && list->next == 0)
operation = REVERT;