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 f602d06..a4eaf3d 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 1cd872e..df0ad40 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 31666a4..121135f 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 9d6358b..7b0a5d7 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 70b90fa..2b3e1b6 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 0000000..70b90fa --- /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 zcmYk6dsGy46vz49-^}dp>=R7z0T_{qZ&?;W&;t4c6<3cUq9y3MyF3JT)de|rAS{*C z4hqhZsZ7P=0Z~E}T5s7?JZbha6wEj-<}o^8DwY^j2WfUEqxolk_w)VUd*}XsGt=G} zzO^a5GE5acW0ol{a+Wbh_^xL1YpFX@i8~dRndtcBMyxkM8=(ef43^A>Kw4H;Q5EK& zoaV^4yIj?=x@g&0#shx}x0t!d!=7bruv@95%t` ztTcC7iwf+HwNo_$g7sQBvxN&C$vGNM&FiQark#XzY5=0cuZp3a$-Wk1HY=t71@WqkjIl@4DW|P zHS`~qscRT|dGZlv@N|@hcu*SPMUMQ2?qFK0hLC8lYYy&@pci>^12dwi28c)S|2#O*B2BCU-C;k*?N|ue}0FLc0nUN8tW+>d?c=(IfWwYxWGbX#@}bGrbZ@oo@2*conuOnKe34Eq#&@f>}XK zxsEjBy@?F3f#(W*euI%2uL9#1oF304Yf0mX{rG%lvYtG`tLcnN8s0YuKFVUo8X!9p z4aLkQ4HQ@U{9cOc?Tj?U_LtFK#Vlt@w`d7uXXArvCh;i{<1ng$F=|MQOy5POK}&wY z`Cl;G_2f$#(hla18am9__Y;$+hFeY<@4L&`)Y6d+3@`y&7%cYE7))Z>A9-Nk#1I3U z#DU=;N*Gyk3&#etuW%6jw(R@n8Ma0V;iJ(pm3>c5?#pyp469c|%mK6}v1L5DEz@yk zwo?OUEB>*H{g8*3HsfgtKj$onOoq;LOD4zN@4`Z=~k z2d#nF^ga8&7TSF0DN52btnXrH>qs}=yvv^9;ochG$w^9w0tSP`9mDK8%K5RrQbP;5 zV0Q?Yu9L`mEY@+Nm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