From c2258e1c964af4baf6398ecb2357fec015c61401 Mon Sep 17 00:00:00 2001 From: Chet Ramey Date: Sat, 3 Dec 2011 12:57:19 -0500 Subject: [PATCH] commit bash-20040506 snapshot --- CWRU/CWRU.chlog | 29 + CWRU/CWRU.chlog~ | 35 + MANIFEST | 1 + array.c | 2 +- builtins/trap.def | 4 +- builtins/trap.def~ | 255 ++++++ doc/bashref.dvi | Bin 579284 -> 579456 bytes doc/bashref.html | 13 +- doc/bashref.info | 157 ++-- doc/bashref.log | 20 +- doc/bashref.ps | 74 +- lib/readline/rlprivate.h | 5 +- lib/readline/rlprivate.h~ | 288 +++++++ lib/readline/text.c | 5 +- lib/readline/text.c~ | 1547 +++++++++++++++++++++++++++++++++++++ lib/readline/vi_mode.c | 6 +- lib/readline/vi_mode.c~ | 6 +- parse.y | 12 +- po/en@boldquot.gmo | Bin 120061 -> 119955 bytes po/en@boldquot.po | 12 +- po/en@quot.gmo | Bin 118509 -> 118403 bytes po/en@quot.po | 12 +- tests/jobs.right | 38 +- tests/jobs.tests | 4 + tests/jobs4.sub | 22 + variables.c | 3 +- 26 files changed, 2384 insertions(+), 166 deletions(-) create mode 100644 builtins/trap.def~ create mode 100644 lib/readline/rlprivate.h~ create mode 100644 lib/readline/text.c~ create mode 100644 tests/jobs4.sub diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index f602d06cc..a4eaf3d40 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -9420,3 +9420,32 @@ lib/readline/vi_mode.c of `last', since they're equal at call time and rl_vi_domove can change rl_numeric_arg (which vi apparently updates). Fixes redo bug of `c2....' reported by Marion Berryman + + 5/4 + --- +parse.y + - fix decode_prompt_string to properly deal with strftime() returning 0 + + 5/6 + --- +variables.c + - in make_local_array_variable, return an already-existing local array + variable immediately rather than creating a new array (causing a + memory leak) + + 5/8 + --- +lib/readline/vi_mode.c + - change rl_vi_domove to set rl_explicit_arg before calling + rl_digit_loop1 so that multi-digit numeric arguments work right + - _rl_vi_last_command is no longer static + +lib/readline/rlprivate.h + - new extern declaration for _rl_vi_last_command + +lib/readline/text.c + - change rl_newline to only call _rl_vi_reset_last if the last command + (_rl_vi_last_command) is not a text modification command. This lets + the last-command and last-argument work across command lines + + diff --git a/CWRU/CWRU.chlog~ b/CWRU/CWRU.chlog~ index 1cd872e83..df0ad40c0 100644 --- a/CWRU/CWRU.chlog~ +++ b/CWRU/CWRU.chlog~ @@ -9412,3 +9412,38 @@ builtins/cd.def - if get_working_directory fails and returns null (causing resetpwd to return NULL), use set_working_directory to set $PWD to the absolute pathname for which chdir just succeeded + + 5/1 + --- +lib/readline/vi_mode.c + - in rl_vi_change_to, call _rl_vi_set_last with rl_numeric_arg instead + of `last', since they're equal at call time and rl_vi_domove can + change rl_numeric_arg (which vi apparently updates). Fixes redo bug + of `c2....' reported by Marion Berryman + + 5/4 + --- +parse.y + - fix decode_prompt_string to properly deal with strftime() returning 0 + + 5/6 + --- +variables.c + - in make_local_array_variable, return an already-existing local array + variable immediately rather than creating a new array (causing a + memory leak) + + 5/8 + --- +lib/readline/vi_mode.c + - change rl_vi_domove to set rl_explicit_arg before calling + rl_digit_loop1 so that multi-digit numeric arguments work right + - _rl_vi_last_command is no longer static + +lib/readline/rlprivate.h + - new extern declaration for _rl_vi_last_command + +lib/readline/text.c + - change rl_newline to only call _rl_vi_reset_last if the last command + (_rl_vi_last_command) is not a text modification command + diff --git a/MANIFEST b/MANIFEST index 31666a4cc..121135fe5 100644 --- a/MANIFEST +++ b/MANIFEST @@ -771,6 +771,7 @@ tests/jobs.tests f tests/jobs1.sub f tests/jobs2.sub f tests/jobs3.sub f +tests/jobs4.sub f tests/jobs.right f tests/more-exp.tests f tests/more-exp.right f diff --git a/array.c b/array.c index 9d6358b89..7b0a5d7ba 100644 --- a/array.c +++ b/array.c @@ -9,7 +9,7 @@ * chet@ins.cwru.edu */ -/* Copyright (C) 1997-2002 Free Software Foundation, Inc. +/* Copyright (C) 1997-2004 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. diff --git a/builtins/trap.def b/builtins/trap.def index 70b90fa54..2b3e1b68b 100644 --- a/builtins/trap.def +++ b/builtins/trap.def @@ -1,7 +1,7 @@ This file is trap.def, from which is created trap.c. It implements the builtin "trap" in Bash. -Copyright (C) 1987-2002 Free Software Foundation, Inc. +Copyright (C) 1987-2004 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -121,7 +121,7 @@ trap_builtin (list) operation = SET; first_arg = list->word->word; - /* When not in posix mode, the historical behavior of looking for a + /* 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 && diff --git a/builtins/trap.def~ b/builtins/trap.def~ new file mode 100644 index 000000000..70b90fa54 --- /dev/null +++ b/builtins/trap.def~ @@ -0,0 +1,255 @@ +This file is trap.def, from which is created trap.c. +It implements the builtin "trap" in Bash. + +Copyright (C) 1987-2002 Free Software Foundation, Inc. + +This file is part of GNU Bash, the Bourne Again SHell. + +Bash is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 2, or (at your option) any later +version. + +Bash is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License along +with Bash; see the file COPYING. If not, write to the Free Software +Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. + +$PRODUCES trap.c + +$BUILTIN trap +$FUNCTION trap_builtin +$SHORT_DOC trap [arg] [signal_spec ...] or trap -l +The command ARG is to be read and executed when the shell receives +signal(s) SIGNAL_SPEC. If ARG is absent all specified signals are +reset to their original values. If ARG is the null string each +SIGNAL_SPEC is ignored by the shell and by the commands it invokes. +If a SIGNAL_SPEC is EXIT (0) the command ARG is executed on exit from +the shell. If a SIGNAL_SPEC is DEBUG, ARG is executed after every +command. If ARG is `-p' then the trap commands associated with +each SIGNAL_SPEC are displayed. If no arguments are supplied or if +only `-p' is given, trap prints the list of commands associated with +each signal number. Each SIGNAL_SPEC is either a signal name in +or a signal number. `trap -l' prints a list of signal names and their +corresponding numbers. Note that a signal can be sent to the shell +with "kill -signal $$". +$END + +#include + +#if defined (HAVE_UNISTD_H) +# ifdef _MINIX +# include +# endif +# include +#endif + +#include "../bashtypes.h" +#include +#include +#include "../bashansi.h" + +#include "../shell.h" +#include "../trap.h" +#include "common.h" +#include "bashgetopt.h" + +static void showtrap __P((int)); +static int display_traps __P((WORD_LIST *)); + +/* The trap command: + + trap + trap + trap -l + trap -p [sigspec ...] + trap [--] + + Set things up so that ARG is executed when SIGNAL(s) N is recieved. + If ARG is the empty string, then ignore the SIGNAL(s). If there is + no ARG, then set the trap for SIGNAL(s) to its original value. Just + plain "trap" means to print out the list of commands associated with + each signal number. Single arg of "-l" means list the signal names. */ + +/* Possible operations to perform on the list of signals.*/ +#define SET 0 /* Set this signal to first_arg. */ +#define REVERT 1 /* Revert to this signals original value. */ +#define IGNORE 2 /* Ignore this signal. */ + +extern int posixly_correct; + +int +trap_builtin (list) + WORD_LIST *list; +{ + int list_signal_names, display, result, opt; + + list_signal_names = display = 0; + result = EXECUTION_SUCCESS; + reset_internal_getopt (); + while ((opt = internal_getopt (list, "lp")) != -1) + { + switch (opt) + { + case 'l': + list_signal_names++; + break; + case 'p': + display++; + break; + default: + builtin_usage (); + return (EX_USAGE); + } + } + list = loptend; + + opt = DSIG_NOCASE|DSIG_SIGPREFIX; /* flags for decode_signal */ + + if (list_signal_names) + return (display_signal_list ((WORD_LIST *)NULL, 1)); + else if (display || list == 0) + return (display_traps (list)); + else + { + char *first_arg; + int operation, sig; + + operation = SET; + first_arg = list->word->word; + /* When not 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 && + (*first_arg != '-' || first_arg[1]) && + signal_object_p (first_arg, opt)) + operation = REVERT; + else + { + list = list->next; + if (*first_arg == '\0') + operation = IGNORE; + else if (first_arg[0] == '-' && !first_arg[1]) + operation = REVERT; + } + + while (list) + { + sig = decode_signal (list->word->word, opt); + + if (sig == NO_SIG) + { + sh_invalidsig (list->word->word); + result = EXECUTION_FAILURE; + } + else + { + switch (operation) + { + case SET: + set_signal (sig, first_arg); + break; + + case REVERT: + restore_default_signal (sig); + + /* Signals that the shell treats specially need special + handling. */ + switch (sig) + { + case SIGINT: + if (interactive) + set_signal_handler (SIGINT, sigint_sighandler); + else + set_signal_handler (SIGINT, termination_unwind_protect); + break; + + case SIGQUIT: + /* Always ignore SIGQUIT. */ + set_signal_handler (SIGQUIT, SIG_IGN); + break; + case SIGTERM: +#if defined (JOB_CONTROL) + case SIGTTIN: + case SIGTTOU: + case SIGTSTP: +#endif /* JOB_CONTROL */ + if (interactive) + set_signal_handler (sig, SIG_IGN); + break; + } + break; + + case IGNORE: + ignore_signal (sig); + break; + } + } + list = list->next; + } + } + + return (result); +} + +static void +showtrap (i) + int i; +{ + char *t, *p, *sn; + + p = trap_list[i]; + + if (p == (char *)DEFAULT_SIG) + return; + + t = (p == (char *)IGNORE_SIG) ? (char *)NULL : sh_single_quote (p); + sn = signal_name (i); + /* Make sure that signals whose names are unknown (for whatever reason) + are printed as signal numbers. */ + if (STREQN (sn, "SIGJUNK", 7) || STREQN (sn, "unknown", 7)) + printf ("trap -- %s %d\n", t ? t : "''", i); + else if (posixly_correct) + { + if (STREQN (sn, "SIG", 3)) + printf ("trap -- %s %s\n", t ? t : "''", sn+3); + else + printf ("trap -- %s %s\n", t ? t : "''", sn); + } + else + printf ("trap -- %s %s\n", t ? t : "''", sn); + + FREE (t); +} + +static int +display_traps (list) + WORD_LIST *list; +{ + int result, i; + + if (list == 0) + { + for (i = 0; i < BASH_NSIG; i++) + showtrap (i); + return (EXECUTION_SUCCESS); + } + + for (result = EXECUTION_SUCCESS; list; list = list->next) + { + i = decode_signal (list->word->word, DSIG_NOCASE|DSIG_SIGPREFIX); + if (i == NO_SIG) + { + sh_invalidsig (list->word->word); + result = EXECUTION_FAILURE; + } + else + showtrap (i); + } + + return (result); +} diff --git a/doc/bashref.dvi b/doc/bashref.dvi index 32fbaac368b09cbd322c5f979eab5e67f8f982c1..1d5e5ce9ec5c605ac30202f2edccccaa490b78e0 100644 GIT binary patch delta 1651 zc-l>rdsGy46vz49-^}dp>=R7z0T_{qZ&?;W&;t4c6<3cUq9y3MyF3JT)de|rAS{*C z4hqhZsZ7P=0Z~E}T5s7?JZbha6wEj-<}o^8DwY^j2WfUEqxolk_w)VUxxagVGt=G} zzO^a5GE5acW0ol{a+Wbh_^xL1YpFX@i8~dRndtcBMyxkM8=(ef43^A>Kw4H;Q5EK& zoaV^4yIj?=x@g&0#shx}x0t!d!=7bruv@95%t` ztTcC7iwf+Hw+tfV&!UR@@j!V{wuh67*npV(x0N z=t-|kX+A`$AwLCUi@~fXAIS96atP7D8ytG}!CyQG88Y@i1naeMXcd+=z$u;#$u#Q> zJW`XBxVjZ~>&OimPH2NjjlM0r;_&Z&eign^cuZp3a$-Wk1HY=t71@WqkjIl@4DW|P zHS`~qscRT|dGZlv@N|@hcu;~ba^yF32h& zjx^)Fi43oS=L&p&gOM4p0^=5(9?v9eN#lt9_<>5NKh-q#2|%3{VEAUhKc z#mprQ6j%EEUW)4NjMT*Tm(gCuEN4l#XbEIzna1i{q?EB^!wnhozqtP*yeNRp9%XC=`t5-wJ0kkHuWjwhp({X0D zQv+rz{;`VvkcXEx<7pe4$b&r+`yK4C2AqYWL}GDz30q6K6$?_+5*Ok1GWJ;&loa9P zovbkccD*Wl)*oOqwbHaN)w7pXaD0JGuQanB6|{`Q(;u_98Tcg9H@}ku>{Psdj_uGv zYalj#&%UpPwwX_)X;|OI&eoA`ym^;B!^6EbzN3(o4h0Mbi93ebb(HgCeg2_^T(CQY zOV>$cJr?UYQA-B?Q!pu*YfwY*UhJF1&Co!Eb3|HZ;;yN|bQq^3a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