update to bash-3.1

This commit is contained in:
Mike Frysinger 2006-03-19 08:52:29 +00:00
parent 229a26a76f
commit d4f0350c6d
18 changed files with 2 additions and 1890 deletions

View File

@ -3,7 +3,7 @@
# bash
#
#############################################################
BASH_VER:=3.0
BASH_VER:=3.1
BASH_SOURCE:=bash-$(BASH_VER).tar.gz
BASH_SITE:=ftp://ftp.gnu.org/gnu/bash
BASH_CAT:=zcat
@ -25,11 +25,11 @@ $(BASH_DIR)/.unpacked: $(DL_DIR)/$(BASH_SOURCE)
touch $(BASH_DIR)/.unpacked
$(BASH_DIR)/.configured: $(BASH_DIR)/.unpacked
# ac_cv_func_setvbuf_reversed=no
# bash_cv_have_mbstate_t=yes
(cd $(BASH_DIR); rm -rf config.cache; \
$(TARGET_CONFIGURE_OPTS) CC_FOR_BUILD="$(HOSTCC)" \
CFLAGS="$(TARGET_CFLAGS)" \
ac_cv_func_setvbuf_reversed=no \
./configure \
--target=$(GNU_TARGET_NAME) \
--host=$(GNU_TARGET_NAME) \

View File

@ -1,139 +0,0 @@
*** bash-3.0/arrayfunc.c Fri Dec 19 00:03:09 2003
--- bash/arrayfunc.c Sun Aug 1 20:43:00 2004
***************
*** 612,616 ****
free (t);
! return var;
}
--- 612,616 ----
free (t);
! return (var == 0 || invisible_p (var)) ? (SHELL_VAR *)0 : var;
}
*** bash-3.0/subst.c Sun Jul 4 13:56:13 2004
--- bash/subst.c Thu Aug 12 13:36:17 2004
***************
*** 4983,4987 ****
return -1;
}
! else if ((v = find_variable (varname)) && array_p (v))
{
vtype = VT_ARRAYMEMBER;
--- 5003,5007 ----
return -1;
}
! else if ((v = find_variable (varname)) && (invisible_p (v) == 0) && array_p (v))
{
vtype = VT_ARRAYMEMBER;
*** bash-3.0/variables.c Sun Jul 4 13:57:26 2004
--- bash/variables.c Wed Aug 4 15:28:04 2004
***************
*** 1420,1428 ****
# if defined (DEBUGGER)
! v = init_dynamic_array_var ("BASH_ARGC", get_self, null_array_assign, (att_invisible|att_noassign));
! v = init_dynamic_array_var ("BASH_ARGV", get_self, null_array_assign, (att_invisible|att_noassign));
# endif /* DEBUGGER */
! v = init_dynamic_array_var ("BASH_SOURCE", get_self, null_array_assign, (att_invisible|att_noassign));
! v = init_dynamic_array_var ("BASH_LINENO", get_self, null_array_assign, (att_invisible|att_noassign));
#endif
--- 1420,1428 ----
# if defined (DEBUGGER)
! v = init_dynamic_array_var ("BASH_ARGC", get_self, null_array_assign, att_noassign);
! v = init_dynamic_array_var ("BASH_ARGV", get_self, null_array_assign, att_noassign);
# endif /* DEBUGGER */
! v = init_dynamic_array_var ("BASH_SOURCE", get_self, null_array_assign, att_noassign);
! v = init_dynamic_array_var ("BASH_LINENO", get_self, null_array_assign, att_noassign);
#endif
***************
*** 1600,1604 ****
old_var = find_variable (name);
if (old_var && local_p (old_var) && old_var->context == variable_context)
! return (old_var);
was_tmpvar = old_var && tempvar_p (old_var);
--- 1600,1607 ----
old_var = find_variable (name);
if (old_var && local_p (old_var) && old_var->context == variable_context)
! {
! VUNSETATTR (old_var, att_invisible);
! return (old_var);
! }
was_tmpvar = old_var && tempvar_p (old_var);
*** bash-3.0/pcomplete.c Thu Jan 8 10:36:17 2004
--- bash/pcomplete.c Tue Aug 3 23:15:41 2004
***************
*** 864,867 ****
--- 864,869 ----
v = convert_var_to_array (v);
v = assign_array_var_from_word_list (v, lwords);
+
+ VUNSETATTR (v, att_invisible);
return v;
}
***************
*** 1022,1025 ****
--- 1024,1029 ----
if (array_p (v) == 0)
v = convert_var_to_array (v);
+
+ VUNSETATTR (v, att_invisible);
a = array_cell (v);
*** bash-3.0/array.c Thu May 6 08:24:13 2004
--- bash/array.c Wed Aug 25 15:50:42 2004
***************
*** 452,456 ****
array_dispose_element(new);
free(element_value(ae));
! ae->value = savestring(v);
return(0);
} else if (element_index(ae) > i) {
--- 454,458 ----
array_dispose_element(new);
free(element_value(ae));
! ae->value = v ? savestring(v) : (char *)NULL;
return(0);
} else if (element_index(ae) > i) {
*** bash-3.0/patchlevel.h Wed Aug 22 08:05:39 2001
--- bash/patchlevel.h Thu Sep 2 15:04:32 2004
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 0
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 1
#endif /* _PATCHLEVEL_H_ */
*** bash-3.0/tests/dbg-support.tests Tue Mar 25 15:33:03 2003
--- bash/tests/dbg-support.tests Tue Aug 3 23:09:29 2004
***************
*** 63,68 ****
trap 'print_return_trap $LINENO' RETURN
! # Funcname is now an array. Vanilla Bash 2.05 doesn't have FUNCNAME array.
! echo "FUNCNAME" ${FUNCNAME[0]}
# We should trace into the below.
--- 63,68 ----
trap 'print_return_trap $LINENO' RETURN
! # Funcname is now an array, but you still can't see it outside a function
! echo "FUNCNAME" ${FUNCNAME[0]:-main}
# We should trace into the below.

View File

@ -1,44 +0,0 @@
*** bash-3.0/lib/readline/display.c Thu May 27 22:57:51 2004
--- bash/lib/readline/display.c Wed Jul 28 13:48:04 2004
***************
*** 352,356 ****
&prompt_last_invisible,
(int *)NULL,
! (int *)NULL);
c = *t; *t = '\0';
/* The portion of the prompt string up to and including the
--- 352,356 ----
&prompt_last_invisible,
(int *)NULL,
! &prompt_physical_chars);
c = *t; *t = '\0';
/* The portion of the prompt string up to and including the
***************
*** 359,363 ****
(int *)NULL,
&prompt_invis_chars_first_line,
! &prompt_physical_chars);
*t = c;
return (prompt_prefix_length);
--- 359,363 ----
(int *)NULL,
&prompt_invis_chars_first_line,
! (int *)NULL);
*t = c;
return (prompt_prefix_length);
*** bash-3.0/patchlevel.h Wed Aug 22 08:05:39 2001
--- bash/patchlevel.h Thu Sep 2 15:04:32 2004
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 1
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 2
#endif /* _PATCHLEVEL_H_ */

View File

@ -1,107 +0,0 @@
*** bash-3.0/builtins/trap.def Thu May 27 22:26:19 2004
--- bash/builtins/trap.def Thu Aug 5 08:55:43 2004
***************
*** 24,28 ****
$BUILTIN trap
$FUNCTION trap_builtin
! $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
--- 24,28 ----
$BUILTIN trap
$FUNCTION trap_builtin
! $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
***************
*** 88,92 ****
WORD_LIST *list;
{
! int list_signal_names, display, result, opt;
list_signal_names = display = 0;
--- 88,92 ----
WORD_LIST *list;
{
! int list_signal_names, display, result, opt, first_signal;
list_signal_names = display = 0;
***************
*** 119,130 ****
{
char *first_arg;
! int operation, sig;
operation = SET;
first_arg = list->word->word;
/* 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 &&
(*first_arg != '-' || first_arg[1]) &&
signal_object_p (first_arg, opt) && list->next == 0)
--- 119,135 ----
{
char *first_arg;
! 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. */
! else if (posixly_correct == 0 && first_arg && *first_arg &&
(*first_arg != '-' || first_arg[1]) &&
signal_object_p (first_arg, opt) && list->next == 0)
*** bash-3.0/doc/bashref.texi Sat Jun 26 14:26:07 2004
--- bash/doc/bashref.texi Fri Aug 27 12:33:46 2004
***************
*** 5954,5958 ****
The @code{trap} builtin doesn't check the first argument for a possible
signal specification and revert the signal handling to the original
! disposition if it is. If users want to reset the handler for a given
signal to the original disposition, they should use @samp{-} as the
first argument.
--- 5967,5972 ----
The @code{trap} builtin doesn't check the first argument for a possible
signal specification and revert the signal handling to the original
! disposition if it is, unless that argument consists solely of digits and
! is a valid signal number. If users want to reset the handler for a given
signal to the original disposition, they should use @samp{-} as the
first argument.
*** bash-3.0/patchlevel.h Wed Aug 22 08:05:39 2001
--- bash/patchlevel.h Thu Sep 2 15:04:32 2004
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 2
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 3
#endif /* _PATCHLEVEL_H_ */
*** bash-3.0/tests/errors.right Thu May 27 22:26:03 2004
--- bash/tests/errors.right Sat Aug 7 22:35:10 2004
***************
*** 86,90 ****
./errors.tests: line 216: trap: NOSIG: invalid signal specification
./errors.tests: line 219: trap: -s: invalid option
! trap: usage: trap [-lp] [[arg] signal_spec ...]
./errors.tests: line 225: return: can only `return' from a function or sourced script
./errors.tests: line 229: break: 0: loop count out of range
--- 86,90 ----
./errors.tests: line 216: trap: NOSIG: invalid signal specification
./errors.tests: line 219: trap: -s: invalid option
! trap: usage: trap [-lp] [arg signal_spec ...]
./errors.tests: line 225: return: can only `return' from a function or sourced script
./errors.tests: line 229: break: 0: loop count out of range

View File

@ -1,128 +0,0 @@
*** bash-3.0/subst.c Sun Jul 4 13:56:13 2004
--- bash/subst.c Thu Aug 12 13:36:17 2004
***************
*** 4692,4695 ****
--- 4692,4715 ----
}
+ #if defined (HANDLE_MULTIBYTE)
+ size_t
+ mbstrlen (s)
+ const char *s;
+ {
+ size_t clen, nc;
+ mbstate_t mbs;
+
+ nc = 0;
+ memset (&mbs, 0, sizeof (mbs));
+ while ((clen = mbrlen(s, MB_CUR_MAX, &mbs)) != 0 && (MB_INVALIDCH(clen) == 0))
+ {
+ s += clen;
+ nc++;
+ }
+ return nc;
+ }
+ #endif
+
+
/* Handle the parameter brace expansion that requires us to return the
length of a parameter. */
***************
*** 4747,4758 ****
{
t = get_dollar_var_value (arg_index);
! number = STRLEN (t);
FREE (t);
}
#if defined (ARRAY_VARS)
! else if ((var = find_variable (name + 1)) && array_p (var))
{
t = array_reference (array_cell (var), 0);
! number = STRLEN (t);
}
#endif
--- 4767,4778 ----
{
t = get_dollar_var_value (arg_index);
! number = MB_STRLEN (t);
FREE (t);
}
#if defined (ARRAY_VARS)
! else if ((var = find_variable (name + 1)) && (invisible_p (var) == 0) && array_p (var))
{
t = array_reference (array_cell (var), 0);
! number = MB_STRLEN (t);
}
#endif
***************
*** 4767,4771 ****
dispose_words (list);
! number = STRLEN (t);
FREE (t);
}
--- 4787,4791 ----
dispose_words (list);
! number = MB_STRLEN (t);
FREE (t);
}
***************
*** 4872,4876 ****
case VT_VARIABLE:
case VT_ARRAYMEMBER:
! len = strlen (value);
break;
case VT_POSPARMS:
--- 4892,4896 ----
case VT_VARIABLE:
case VT_ARRAYMEMBER:
! len = MB_STRLEN (value);
break;
case VT_POSPARMS:
*** bash-3.0/include/shmbutil.h Mon Apr 19 09:59:42 2004
--- bash/include/shmbutil.h Thu Sep 2 15:20:47 2004
***************
*** 32,35 ****
--- 32,37 ----
extern size_t xdupmbstowcs __P((wchar_t **, char ***, const char *));
+ extern size_t mbstrlen __P((const char *));
+
extern char *xstrchr __P((const char *, int));
***************
*** 39,42 ****
--- 41,47 ----
#endif
+ #define MBSLEN(s) (((s) && (s)[0]) ? ((s)[1] ? mbstrlen (s) : 1) : 0)
+ #define MB_STRLEN(s) ((MB_CUR_MAX > 1) ? MBSLEN (s) : STRLEN (s))
+
#else /* !HANDLE_MULTIBYTE */
***************
*** 54,57 ****
--- 59,64 ----
#define MB_NULLWCH(x) (0)
#endif
+
+ #define MB_STRLEN(s) (STRLEN(s))
#endif /* !HANDLE_MULTIBYTE */
*** bash-3.0/patchlevel.h Wed Aug 22 08:05:39 2001
--- bash/patchlevel.h Thu Sep 2 15:04:32 2004
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 3
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 4
#endif /* _PATCHLEVEL_H_ */

View File

@ -1,46 +0,0 @@
*** bash-3.0/lib/readline/misc.c Wed Jul 7 08:56:32 2004
--- bash/lib/readline/misc.c Sat Aug 7 22:38:53 2004
***************
*** 277,286 ****
_rl_saved_line_for_history->data = (char *)rl_undo_list;
}
- else if (STREQ (rl_line_buffer, _rl_saved_line_for_history->line) == 0)
- {
- free (_rl_saved_line_for_history->line);
- _rl_saved_line_for_history->line = savestring (rl_line_buffer);
- _rl_saved_line_for_history->data = (char *)rl_undo_list; /* XXX possible memleak */
- }
return 0;
--- 277,280 ----
*** bash-3.0/lib/readline/vi_mode.c Tue Jul 13 14:08:27 2004
--- bash/lib/readline/vi_mode.c Tue Aug 17 00:12:09 2004
***************
*** 273,280 ****
--- 273,282 ----
{
case '?':
+ _rl_free_saved_history_line ();
rl_noninc_forward_search (count, key);
break;
case '/':
+ _rl_free_saved_history_line ();
rl_noninc_reverse_search (count, key);
break;
*** bash-3.0/patchlevel.h Wed Aug 22 08:05:39 2001
--- bash/patchlevel.h Thu Sep 2 15:04:32 2004
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 4
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 5
#endif /* _PATCHLEVEL_H_ */

View File

@ -1,145 +0,0 @@
*** bash-3.0/lib/readline/display.c Thu May 27 22:57:51 2004
--- bash/lib/readline/display.c Mon Aug 30 11:55:02 2004
***************
*** 202,206 ****
{
char *r, *ret, *p;
! int l, rl, last, ignoring, ninvis, invfl, ind, pind, physchars;
/* Short-circuit if we can. */
--- 202,206 ----
{
char *r, *ret, *p;
! int l, rl, last, ignoring, ninvis, invfl, invflset, ind, pind, physchars;
/* Short-circuit if we can. */
***************
*** 223,226 ****
--- 223,227 ----
invfl = 0; /* invisible chars in first line of prompt */
+ invflset = 0; /* we only want to set invfl once */
for (rl = ignoring = last = ninvis = physchars = 0, p = pmt; p && *p; p++)
***************
*** 250,254 ****
*r++ = *p++;
if (!ignoring)
! rl += ind - pind;
else
ninvis += ind - pind;
--- 251,258 ----
*r++ = *p++;
if (!ignoring)
! {
! rl += ind - pind;
! physchars += _rl_col_width (pmt, pind, ind);
! }
else
ninvis += ind - pind;
***************
*** 260,273 ****
*r++ = *p;
if (!ignoring)
! rl++; /* visible length byte counter */
else
ninvis++; /* invisible chars byte counter */
}
! if (rl >= _rl_screenwidth)
! invfl = ninvis;
!
! if (ignoring == 0)
! physchars++;
}
}
--- 264,280 ----
*r++ = *p;
if (!ignoring)
! {
! rl++; /* visible length byte counter */
! physchars++;
! }
else
ninvis++; /* invisible chars byte counter */
}
! if (invflset == 0 && rl >= _rl_screenwidth)
! {
! invfl = ninvis;
! invflset = 1;
! }
}
}
***************
*** 418,422 ****
register char *line;
int c_pos, inv_botlin, lb_botlin, lb_linenum;
! int newlines, lpos, temp, modmark;
char *prompt_this_line;
#if defined (HANDLE_MULTIBYTE)
--- 425,429 ----
register char *line;
int c_pos, inv_botlin, lb_botlin, lb_linenum;
! int newlines, lpos, temp, modmark, n0, num;
char *prompt_this_line;
#if defined (HANDLE_MULTIBYTE)
***************
*** 574,577 ****
--- 581,585 ----
#if defined (HANDLE_MULTIBYTE)
memset (_rl_wrapped_line, 0, vis_lbsize);
+ num = 0;
#endif
***************
*** 592,596 ****
--- 600,619 ----
prompts that exceed two physical lines?
Additional logic fix from Edward Catmur <ed@catmur.co.uk> */
+ #if defined (HANDLE_MULTIBYTE)
+ n0 = num;
+ temp = local_prompt ? strlen (local_prompt) : 0;
+ while (num < temp)
+ {
+ if (_rl_col_width (local_prompt, n0, num) > _rl_screenwidth)
+ {
+ num = _rl_find_prev_mbchar (local_prompt, num, MB_FIND_ANY);
+ break;
+ }
+ num++;
+ }
+ temp = num +
+ #else
temp = ((newlines + 1) * _rl_screenwidth) +
+ #endif /* !HANDLE_MULTIBYTE */
((local_prompt_prefix == 0) ? ((newlines == 0) ? prompt_invis_chars_first_line
: ((newlines == 1) ? wrap_offset : 0))
***************
*** 598,602 ****
--- 621,629 ----
inv_lbreaks[++newlines] = temp;
+ #if defined (HANDLE_MULTIBYTE)
+ lpos -= _rl_col_width (local_prompt, n0, num);
+ #else
lpos -= _rl_screenwidth;
+ #endif
}
*** bash-3.0/patchlevel.h Wed Aug 22 08:05:39 2001
--- bash/patchlevel.h Thu Sep 2 15:04:32 2004
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 5
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 6
#endif /* _PATCHLEVEL_H_ */

View File

@ -1,41 +0,0 @@
*** bash-3.0/braces.c Thu Dec 4 11:09:52 2003
--- bash/braces.c Wed Aug 4 14:34:33 2004
***************
*** 341,346 ****
if (lhs_t == ST_CHAR)
{
! lhs_v = lhs[0];
! rhs_v = rhs[0];
}
else
--- 341,346 ----
if (lhs_t == ST_CHAR)
{
! lhs_v = (unsigned char)lhs[0];
! rhs_v = (unsigned char)rhs[0];
}
else
***************
*** 403,406 ****
--- 403,407 ----
pass_next = 1;
i++;
+ level++;
continue;
}
*** bash-3.0/patchlevel.h Wed Aug 22 08:05:39 2001
--- bash/patchlevel.h Thu Sep 2 15:04:32 2004
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 6
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 7
#endif /* _PATCHLEVEL_H_ */

View File

@ -1,31 +0,0 @@
*** bash-3.0/subst.c Sun Jul 4 13:56:13 2004
--- bash/subst.c Thu Aug 12 13:36:17 2004
***************
*** 4892,4896 ****
*e1p += len;
! if (*e1p >= len || *e1p < 0)
return (-1);
--- 4912,4916 ----
*e1p += len;
! if (*e1p > len || *e1p < 0)
return (-1);
*** bash-3.0/patchlevel.h Wed Aug 22 08:05:39 2001
--- bash/patchlevel.h Thu Sep 2 15:04:32 2004
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 7
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 8
#endif /* _PATCHLEVEL_H_ */

View File

@ -1,82 +0,0 @@
*** bash-3.0/lib/readline/vi_mode.c Tue Jul 13 14:08:27 2004
--- bash/lib/readline/vi_mode.c Tue Aug 17 00:12:09 2004
***************
*** 691,695 ****
wchar_t wc;
char mb[MB_LEN_MAX+1];
! int mblen;
mbstate_t ps;
--- 693,697 ----
wchar_t wc;
char mb[MB_LEN_MAX+1];
! int mblen, p;
mbstate_t ps;
***************
*** 714,722 ****
if (wc)
{
mblen = wcrtomb (mb, wc, &ps);
if (mblen >= 0)
mb[mblen] = '\0';
rl_begin_undo_group ();
! rl_delete (1, 0);
rl_insert_text (mb);
rl_end_undo_group ();
--- 716,727 ----
if (wc)
{
+ p = rl_point;
mblen = wcrtomb (mb, wc, &ps);
if (mblen >= 0)
mb[mblen] = '\0';
rl_begin_undo_group ();
! rl_vi_delete (1, 0);
! if (rl_point < p) /* Did we retreat at EOL? */
! rl_point++; /* XXX - should we advance more than 1 for mbchar? */
rl_insert_text (mb);
rl_end_undo_group ();
***************
*** 1311,1320 ****
#if defined (HANDLE_MULTIBYTE)
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
! while (_rl_insert_char (1, c))
! {
! RL_SETSTATE (RL_STATE_MOREINPUT);
! c = rl_read_key ();
! RL_UNSETSTATE (RL_STATE_MOREINPUT);
! }
else
#endif
--- 1316,1329 ----
#if defined (HANDLE_MULTIBYTE)
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
! {
! if (rl_point < p) /* Did we retreat at EOL? */
! rl_point++;
! while (_rl_insert_char (1, c))
! {
! RL_SETSTATE (RL_STATE_MOREINPUT);
! c = rl_read_key ();
! RL_UNSETSTATE (RL_STATE_MOREINPUT);
! }
! }
else
#endif
*** bash-3.0/patchlevel.h Wed Aug 22 08:05:39 2001
--- bash/patchlevel.h Thu Sep 2 15:04:32 2004
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 8
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 9
#endif /* _PATCHLEVEL_H_ */

View File

@ -1,95 +0,0 @@
*** bash-3.0/bashline.c Mon Jul 5 23:22:12 2004
--- bash/bashline.c Thu Sep 2 16:00:12 2004
***************
*** 101,104 ****
--- 101,105 ----
/* Helper functions for Readline. */
+ static int bash_directory_expansion __P((char **));
static int bash_directory_completion_hook __P((char **));
static int filename_completion_ignore __P((char **));
***************
*** 293,297 ****
at = strchr (rl_completer_word_break_characters, '@');
if ((at == 0 && on_or_off == 0) || (at != 0 && on_or_off != 0))
! return;
/* We have something to do. Do it. */
--- 294,298 ----
at = strchr (rl_completer_word_break_characters, '@');
if ((at == 0 && on_or_off == 0) || (at != 0 && on_or_off != 0))
! return old_value;
/* We have something to do. Do it. */
***************
*** 1407,1414 ****
if (*hint_text == '~')
{
! int l, tl, vl;
vl = strlen (val);
tl = strlen (hint_text);
l = vl - hint_len; /* # of chars added */
temp = (char *)xmalloc (l + 2 + tl);
strcpy (temp, hint_text);
--- 1408,1424 ----
if (*hint_text == '~')
{
! int l, tl, vl, dl;
! char *rd;
vl = strlen (val);
tl = strlen (hint_text);
+ #if 0
l = vl - hint_len; /* # of chars added */
+ #else
+ rd = savestring (filename_hint);
+ bash_directory_expansion (&rd);
+ dl = strlen (rd);
+ l = vl - dl; /* # of chars added */
+ free (rd);
+ #endif
temp = (char *)xmalloc (l + 2 + tl);
strcpy (temp, hint_text);
***************
*** 2188,2191 ****
--- 2198,2222 ----
}
+ /* Simulate the expansions that will be performed by
+ rl_filename_completion_function. This must be called with the address of
+ a pointer to malloc'd memory. */
+ static int
+ bash_directory_expansion (dirname)
+ char **dirname;
+ {
+ char *d;
+
+ d = savestring (*dirname);
+
+ if (rl_directory_rewrite_hook)
+ (*rl_directory_rewrite_hook) (&d);
+
+ if (rl_directory_completion_hook && (*rl_directory_completion_hook) (&d))
+ {
+ free (*dirname);
+ *dirname = d;
+ }
+ }
+
/* Handle symbolic link references and other directory name
expansions while hacking completion. */
*** bash-3.0/patchlevel.h Wed Aug 22 08:05:39 2001
--- bash/patchlevel.h Thu Sep 2 15:04:32 2004
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 9
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 10
#endif /* _PATCHLEVEL_H_ */

View File

@ -1,39 +0,0 @@
*** bash-3.0/lib/readline/mbutil.c Wed Jan 14 09:44:52 2004
--- bash/lib/readline/mbutil.c Wed Aug 18 22:25:57 2004
***************
*** 127,135 ****
{
tmp = mbrtowc (&wc, string + point, strlen (string + point), &ps);
! while (wcwidth (wc) == 0)
{
point += tmp;
tmp = mbrtowc (&wc, string + point, strlen (string + point), &ps);
! if (tmp == (size_t)(0) || tmp == (size_t)(-1) || tmp == (size_t)(-2))
break;
}
--- 127,135 ----
{
tmp = mbrtowc (&wc, string + point, strlen (string + point), &ps);
! while (tmp > 0 && wcwidth (wc) == 0)
{
point += tmp;
tmp = mbrtowc (&wc, string + point, strlen (string + point), &ps);
! if (MB_NULLWCH (tmp) || MB_INVALIDCH (tmp))
break;
}
*** bash-3.0/patchlevel.h Wed Aug 22 08:05:39 2001
--- bash/patchlevel.h Thu Sep 2 15:04:32 2004
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 10
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 11
#endif /* _PATCHLEVEL_H_ */

View File

@ -1,38 +0,0 @@
*** bash-3.0/jobs.c Fri Apr 23 16:28:25 2004
--- bash/jobs.c Wed Aug 18 11:15:07 2004
***************
*** 1779,1784 ****
{
fail = 0;
! for (p = jobs[job]->pipe; p->next != jobs[job]->pipe; p = p->next)
! if (p->status != EXECUTION_SUCCESS) fail = p->status;
return fail;
}
--- 1779,1789 ----
{
fail = 0;
! p = jobs[job]->pipe;
! do
! {
! if (p->status != EXECUTION_SUCCESS) fail = p->status;
! p = p->next;
! }
! while (p != jobs[job]->pipe);
return fail;
}
*** bash-3.0/patchlevel.h Wed Aug 22 08:05:39 2001
--- bash/patchlevel.h Thu Sep 2 15:04:32 2004
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 11
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 12
#endif /* _PATCHLEVEL_H_ */

View File

@ -1,69 +0,0 @@
*** bash-3.0/bashline.c Mon Jul 5 23:22:12 2004
--- bash/bashline.c Thu Sep 2 16:00:12 2004
***************
*** 2514,2518 ****
static int ind;
int glen;
! char *ret;
if (state == 0)
--- 2545,2549 ----
static int ind;
int glen;
! char *ret, *ttext;
if (state == 0)
***************
*** 2524,2538 ****
FREE (globtext);
if (rl_explicit_arg)
{
! globorig = savestring (text);
! glen = strlen (text);
globtext = (char *)xmalloc (glen + 2);
! strcpy (globtext, text);
globtext[glen] = '*';
globtext[glen+1] = '\0';
}
else
! globtext = globorig = savestring (text);
matches = shell_glob_filename (globtext);
--- 2555,2574 ----
FREE (globtext);
+ ttext = bash_tilde_expand (text, 0);
+
if (rl_explicit_arg)
{
! globorig = savestring (ttext);
! glen = strlen (ttext);
globtext = (char *)xmalloc (glen + 2);
! strcpy (globtext, ttext);
globtext[glen] = '*';
globtext[glen+1] = '\0';
}
else
! globtext = globorig = savestring (ttext);
!
! if (ttext != text)
! free (ttext);
matches = shell_glob_filename (globtext);
*** bash-3.0/patchlevel.h Wed Aug 22 08:05:39 2001
--- bash/patchlevel.h Thu Sep 2 15:04:32 2004
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 12
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 13
#endif /* _PATCHLEVEL_H_ */

View File

@ -1,52 +0,0 @@
BASH PATCH REPORT
=================
Bash-Release: 3.0
Patch-ID: bash30-014
Bug-Reported-by: agriffis@gentoo.org
Bug-Reference-ID: <20040929024759.A437FEB1E0@piment.flatmonk.org>
Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2004-09/msg00250.html
Bug-Description:
#
# BROKEN case: variable with braces inside quotes
#
$ D=W
$ echo "${D}"{illy,onka} => W{illy,onka}
Patch:
*** ../bash-3.0-patched/braces.c Wed Sep 8 11:07:53 2004
--- bash/braces.c Fri Sep 17 18:42:36 2004
***************
*** 403,407 ****
pass_next = 1;
i++;
! level++;
continue;
}
--- 403,408 ----
pass_next = 1;
i++;
! if (quoted == 0)
! level++;
continue;
}
*** ../bash-3.0-patched/patchlevel.h Wed Aug 22 08:05:39 2001
--- bash/patchlevel.h Thu Sep 2 15:04:32 2004
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 13
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 14
#endif /* _PATCHLEVEL_H_ */

View File

@ -1,56 +0,0 @@
BASH PATCH REPORT
=================
Bash-Release: 3.0
Patch-ID: bash30-015
Bug-Reported-by: opengeometry@yahoo.ca
Bug-Reference-ID: <200410202012.i9KKCTEB001860@node1.opengeometry.net>
Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2004-10/msg00297.html
Bug-Description:
Shell variable can start with number and can even be printed with
'declare', as in
1=aaa
1a=bbb
declare -p 1 1a
But, they can't be removed, as in
unset 1 1a --> ...: not a valid identifier
Bash-2.05b correctly gives me error, however.
Patch:
*** ../bash-3.0-patched/general.c Wed Apr 14 23:20:13 2004
--- bash/general.c Wed Oct 20 16:59:59 2004
***************
*** 268,272 ****
#if defined (ARRAY_VARS)
! if ((legal_variable_starter (c) == 0) && (flags && c != '[')) /* ] */
#else
if (legal_variable_starter (c) == 0)
--- 268,272 ----
#if defined (ARRAY_VARS)
! if ((legal_variable_starter (c) == 0) && (flags == 0 || c != '[')) /* ] */
#else
if (legal_variable_starter (c) == 0)
*** ../bash-3.0/patchlevel.h Wed Aug 22 08:05:39 2001
--- bash/patchlevel.h Thu Sep 2 15:04:32 2004
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 14
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 15
#endif /* _PATCHLEVEL_H_ */

View File

@ -1,84 +0,0 @@
BASH PATCH REPORT
=================
Bash-Release: 3.0
Patch-ID: bash30-016
Bug-Reported-by: William Park <opengeometry@yahoo.ca>
Bug-Reference-ID: <200411012217.iA1MHxL7031818@node1.opengeometry.net>
Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2004-11/msg00017.html
Bug-Description:
Offset from the end of array in ${var: -n} is still off by 1. Eg.
x=( {0..9} )
echo ${x[*]: -1} --> 8 9
Patch:
*** ../bash-3.0-patched/subst.c Wed Sep 8 11:07:55 2004
--- bash/subst.c Tue Nov 9 16:26:59 2004
***************
*** 4900,4905 ****
case VT_ARRAYVAR:
a = (ARRAY *)value;
! /* For arrays, the first value deals with array indices. */
! len = array_max_index (a); /* arrays index from 0 to n - 1 */
break;
#endif
--- 4900,4906 ----
case VT_ARRAYVAR:
a = (ARRAY *)value;
! /* For arrays, the first value deals with array indices. Negative
! offsets count from one past the array's maximum index. */
! len = array_max_index (a) + (*e1p < 0); /* arrays index from 0 to n - 1 */
break;
#endif
*** ../bash-3.0-patched/tests/array.tests Sat Oct 4 23:25:00 2003
--- bash/tests/array.tests Tue Nov 9 16:36:29 2004
***************
*** 323,327 ****
echo positive offset - expect five seven
echo ${av[@]:5:2}
! echo negative offset - expect five seven
echo ${av[@]: -2:2}
--- 323,327 ----
echo positive offset - expect five seven
echo ${av[@]:5:2}
! echo negative offset to unset element - expect seven
echo ${av[@]: -2:2}
*** ../bash-3.0-patched/tests/array.right Sat Oct 4 23:25:10 2003
--- bash/tests/array.right Tue Nov 9 16:37:25 2004
***************
*** 171,176 ****
positive offset - expect five seven
five seven
! negative offset - expect five seven
! five seven
positive offset 2 - expect seven
seven
--- 171,176 ----
positive offset - expect five seven
five seven
! negative offset to unset element - expect seven
! seven
positive offset 2 - expect seven
seven
*** ../bash-3.0-patched/patchlevel.h Tue Oct 26 17:13:29 2004
--- bash/patchlevel.h Tue Nov 9 16:31:24 2004
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 15
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 16
#endif /* _PATCHLEVEL_H_ */

View File

@ -1,692 +0,0 @@
--- /dev/null 2005-06-20 00:31:57.000000000 -0600
+++ bash-3.0/signames.h 2005-08-02 16:57:21.000000000 -0600
@@ -0,0 +1,202 @@
+/* A translation list so we can be polite to our users. */
+char *signal_names[NSIG + 4] = {
+ "EXIT",
+#ifdef SIGHUP
+ [SIGHUP] "SIGHUP",
+#endif
+#ifdef SIGINT
+ [SIGINT] "SIGINT",
+#endif
+#ifdef SIGQUIT
+ [SIGQUIT] "SIGQUIT",
+#endif
+#ifdef SIGILL
+ [SIGILL] "SIGILL",
+#endif
+#ifdef SIGTRAP
+ [SIGTRAP] "SIGTRAP",
+#endif
+#ifdef SIGABRT
+ [SIGABRT] "SIGABRT",
+#endif
+#ifdef SIGBUS
+ [SIGBUS] "SIGBUS",
+#endif
+#ifdef SIGFPE
+ [SIGFPE] "SIGFPE",
+#endif
+#ifdef SIGKILL
+ [SIGKILL] "SIGKILL",
+#endif
+#ifdef SIGUSR1
+ [SIGUSR1] "SIGUSR1",
+#endif
+#ifdef SIGSEGV
+ [SIGSEGV] "SIGSEGV",
+#endif
+#ifdef SIGUSR2
+ [SIGUSR2] "SIGUSR2",
+#endif
+#ifdef SIGPIPE
+ [SIGPIPE] "SIGPIPE",
+#endif
+#ifdef SIGALRM
+ [SIGALRM] "SIGALRM",
+#endif
+#ifdef SIGTERM
+ [SIGTERM] "SIGTERM",
+#endif
+#ifdef SIGJUNK
+ [SIGJUNK] "SIGJUNK(16)",
+#endif
+#ifdef SIGCHLD
+ [SIGCHLD] "SIGCHLD",
+#endif
+#ifdef SIGCONT
+ [SIGCONT] "SIGCONT",
+#endif
+#ifdef SIGSTOP
+ [SIGSTOP] "SIGSTOP",
+#endif
+#ifdef SIGTSTP
+ [SIGTSTP] "SIGTSTP",
+#endif
+#ifdef SIGTTIN
+ [SIGTTIN] "SIGTTIN",
+#endif
+#ifdef SIGTTOU
+ [SIGTTOU] "SIGTTOU",
+#endif
+#ifdef SIGURG
+ [SIGURG] "SIGURG",
+#endif
+#ifdef SIGXCPU
+ [SIGXCPU] "SIGXCPU",
+#endif
+#ifdef SIGXFSZ
+ [SIGXFSZ] "SIGXFSZ",
+#endif
+#ifdef SIGVTALRM
+ [SIGVTALRM] "SIGVTALRM",
+#endif
+#ifdef SIGPROF
+ [SIGPROF] "SIGPROF",
+#endif
+#ifdef SIGWINCH
+ [SIGWINCH] "SIGWINCH",
+#endif
+#ifdef SIGIO
+ [SIGIO] "SIGIO",
+#endif
+#ifdef SIGPWR
+ [SIGPWR] "SIGPWR",
+#endif
+#ifdef SIGSYS
+ [SIGSYS] "SIGSYS",
+#endif
+#ifdef SIGJUNK
+ [SIGJUNK] "SIGJUNK(32)",
+#endif
+#ifdef SIGJUNK
+ [SIGJUNK] "SIGJUNK(33)",
+#endif
+#ifdef SIGJUNK
+ [SIGJUNK] "SIGJUNK(34)",
+#endif
+#ifdef SIGJUNK
+ [SIGJUNK] "SIGJUNK(35)",
+#endif
+#ifdef SIGJUNK
+ [SIGJUNK] "SIGJUNK(36)",
+#endif
+#ifdef SIGJUNK
+ [SIGJUNK] "SIGJUNK(37)",
+#endif
+#ifdef SIGJUNK
+ [SIGJUNK] "SIGJUNK(38)",
+#endif
+#ifdef SIGJUNK
+ [SIGJUNK] "SIGJUNK(39)",
+#endif
+#ifdef SIGJUNK
+ [SIGJUNK] "SIGJUNK(40)",
+#endif
+#ifdef SIGJUNK
+ [SIGJUNK] "SIGJUNK(41)",
+#endif
+#ifdef SIGJUNK
+ [SIGJUNK] "SIGJUNK(42)",
+#endif
+#ifdef SIGJUNK
+ [SIGJUNK] "SIGJUNK(43)",
+#endif
+#ifdef SIGJUNK
+ [SIGJUNK] "SIGJUNK(44)",
+#endif
+#ifdef SIGJUNK
+ [SIGJUNK] "SIGJUNK(45)",
+#endif
+#ifdef SIGJUNK
+ [SIGJUNK] "SIGJUNK(46)",
+#endif
+#ifdef SIGJUNK
+ [SIGJUNK] "SIGJUNK(47)",
+#endif
+#ifdef SIGJUNK
+ [SIGJUNK] "SIGJUNK(48)",
+#endif
+#ifdef SIGJUNK
+ [SIGJUNK] "SIGJUNK(49)",
+#endif
+#ifdef SIGJUNK
+ [SIGJUNK] "SIGJUNK(50)",
+#endif
+#ifdef SIGJUNK
+ [SIGJUNK] "SIGJUNK(51)",
+#endif
+#ifdef SIGJUNK
+ [SIGJUNK] "SIGJUNK(52)",
+#endif
+#ifdef SIGJUNK
+ [SIGJUNK] "SIGJUNK(53)",
+#endif
+#ifdef SIGJUNK
+ [SIGJUNK] "SIGJUNK(54)",
+#endif
+#ifdef SIGJUNK
+ [SIGJUNK] "SIGJUNK(55)",
+#endif
+#ifdef SIGJUNK
+ [SIGJUNK] "SIGJUNK(56)",
+#endif
+#ifdef SIGJUNK
+ [SIGJUNK] "SIGJUNK(57)",
+#endif
+#ifdef SIGJUNK
+ [SIGJUNK] "SIGJUNK(58)",
+#endif
+#ifdef SIGJUNK
+ [SIGJUNK] "SIGJUNK(59)",
+#endif
+#ifdef SIGJUNK
+ [SIGJUNK] "SIGJUNK(60)",
+#endif
+#ifdef SIGJUNK
+ [SIGJUNK] "SIGJUNK(61)",
+#endif
+#ifdef SIGJUNK
+ [SIGJUNK] "SIGJUNK(62)",
+#endif
+#ifdef SIGJUNK
+ [SIGJUNK] "SIGJUNK(63)",
+#endif
+#ifdef SIGJUNK
+ [SIGJUNK] "SIGJUNK(64)",
+#endif
+ [NSIG] "DEBUG",
+
+ [NSIG + 1] "ERR",
+
+ [NSIG + 2] (char *)0x0
+};
+
--- bash-3.0.orig/Makefile.in 2004-03-17 06:34:39.000000000 -0700
+++ bash-3.0/Makefile.in 2005-08-02 16:44:29.000000000 -0600
@@ -410,9 +410,6 @@
SOURCES = $(CSOURCES) $(HSOURCES) $(BUILTIN_DEFS)
-# header files chosen based on running of configure
-SIGNAMES_H = @SIGNAMES_H@
-
# object files chosen based on running of configure
JOBS_O = @JOBS_O@
SIGLIST_O = @SIGLIST_O@
@@ -483,15 +480,12 @@
PO_SRC = $(srcdir)/po/
PO_DIR = $(dot)/po/
-SIGNAMES_SUPPORT = $(SUPPORT_SRC)mksignames.c
-
SUPPORT_SRC = $(srcdir)/support/
SDIR = $(dot)/support/
TESTS_SUPPORT = recho$(EXEEXT) zecho$(EXEEXT) printenv$(EXEEXT)
CREATED_SUPPORT = signames.h recho$(EXEEXT) zecho$(EXEEXT) printenv$(EXEEXT) \
- tests/recho$(EXEEXT) tests/zecho$(EXEEXT) \
- tests/printenv$(EXEEXT) mksignames$(EXEEXT) lsignames.h \
+ tests/recho$(EXEEXT) tests/zecho$(EXEEXT) tests/printenv$(EXEEXT) \
mksyntax${EXEEXT} syntax.c $(VERSPROG) $(VERSOBJ) \
buildversion.o
CREATED_CONFIGURE = config.h config.cache config.status config.log \
@@ -607,22 +601,9 @@
${LIBINTL_H}: ${INTL_LIBRARY}
-mksignames$(EXEEXT): $(SUPPORT_SRC)mksignames.c
- $(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) -o $@ $(SUPPORT_SRC)mksignames.c
-
mksyntax$(EXEEXT): ${srcdir}/mksyntax.c config.h syntax.h ${BASHINCDIR}/chartypes.h
${CC_FOR_BUILD} ${CCFLAGS_FOR_BUILD} -o $@ ${srcdir}/mksyntax.c
-# make a list of signals for the local system -- this is done when we're
-# *not* cross-compiling
-lsignames.h: mksignames$(EXEEXT)
- $(RM) $@
- ./mksignames $@
-
-# copy the correct signames header file to signames.h
-signames.h: $(SIGNAMES_H)
- -if cmp -s $(SIGNAMES_H) $@ ; then :; else $(RM) $@ ; $(CP) $(SIGNAMES_H) $@ ; fi
-
syntax.c: mksyntax${EXEEXT} $(srcdir)/syntax.h
$(RM) $@
./mksyntax -o $@
--- bash-3.0.orig/support/mksignames.c 2003-03-24 15:11:38.000000000 -0700
+++ bash-3.0/support/mksignames.c 2005-06-20 00:31:57.000000000 -0600
@@ -1,432 +0,0 @@
-/* signames.c -- Create and write `signames.h', which contains an array of
- signal names. */
-
-/* Copyright (C) 1992-2003 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. */
-
-#include <config.h>
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <signal.h>
-#if defined (HAVE_STDLIB_H)
-# include <stdlib.h>
-#else
-# include "ansi_stdlib.h"
-#endif /* HAVE_STDLIB_H */
-
-#if !defined (NSIG)
-# define NSIG 64
-#endif
-
-/*
- * Special traps:
- * EXIT == 0
- * DEBUG == NSIG
- * ERR == NSIG+1
- * RETURN == NSIG+2
- */
-#define LASTSIG NSIG+2
-
-char *signal_names[2 * (LASTSIG)];
-
-#define signal_names_size (sizeof(signal_names)/sizeof(signal_names[0]))
-
-char *progname;
-
-/* AIX 4.3 defines SIGRTMIN and SIGRTMAX as 888 and 999 respectively.
- I don't want to allocate so much unused space for the intervening signal
- numbers, so we just punt if SIGRTMAX is past the bounds of the
- signal_names array (handled in configure). */
-#if defined (SIGRTMAX) && defined (UNUSABLE_RT_SIGNALS)
-# undef SIGRTMAX
-# undef SIGRTMIN
-#endif
-
-#if defined (SIGRTMAX) || defined (SIGRTMIN)
-# define RTLEN 14
-# define RTLIM 256
-#endif
-
-void
-initialize_signames ()
-{
- register int i;
-#if defined (SIGRTMAX) || defined (SIGRTMIN)
- int rtmin, rtmax, rtcnt;
-#endif
-
- for (i = 1; i < signal_names_size; i++)
- signal_names[i] = (char *)NULL;
-
- /* `signal' 0 is what we do on exit. */
- signal_names[0] = "EXIT";
-
- /* Place signal names which can be aliases for more common signal
- names first. This allows (for example) SIGABRT to overwrite SIGLOST. */
-
- /* POSIX 1003.1b-1993 real time signals, but take care of incomplete
- implementations. Acoording to the standard, both, SIGRTMIN and
- SIGRTMAX must be defined, SIGRTMIN must be stricly less than
- SIGRTMAX, and the difference must be at least 7, that is, there
- must be at least eight distinct real time signals. */
-
- /* The generated signal names are SIGRTMIN, SIGRTMIN+1, ...,
- SIGRTMIN+x, SIGRTMAX-x, ..., SIGRTMAX-1, SIGRTMAX. If the number
- of RT signals is odd, there is an extra SIGRTMIN+(x+1).
- These names are the ones used by ksh and /usr/xpg4/bin/sh on SunOS5. */
-
-#if defined (SIGRTMIN)
- rtmin = SIGRTMIN;
- signal_names[rtmin] = "SIGRTMIN";
-#endif
-
-#if defined (SIGRTMAX)
- rtmax = SIGRTMAX;
- signal_names[rtmax] = "SIGRTMAX";
-#endif
-
-#if defined (SIGRTMAX) && defined (SIGRTMIN)
- if (rtmax > rtmin)
- {
- rtcnt = (rtmax - rtmin - 1) / 2;
- /* croak if there are too many RT signals */
- if (rtcnt >= RTLIM/2)
- {
- rtcnt = RTLIM/2-1;
- fprintf(stderr, "%s: error: more than %i real time signals, fix `%s'\n",
- progname, RTLIM, progname);
- }
-
- for (i = 1; i <= rtcnt; i++)
- {
- signal_names[rtmin+i] = (char *)malloc(RTLEN);
- if (signal_names[rtmin+i])
- sprintf (signal_names[rtmin+i], "SIGRTMIN+%d", i);
- signal_names[rtmax-i] = (char *)malloc(RTLEN);
- if (signal_names[rtmax-i])
- sprintf (signal_names[rtmax-i], "SIGRTMAX-%d", i);
- }
-
- if (rtcnt < RTLIM/2-1 && rtcnt != (rtmax-rtmin)/2)
- {
- /* Need an extra RTMIN signal */
- signal_names[rtmin+rtcnt+1] = (char *)malloc(RTLEN);
- if (signal_names[rtmin+rtcnt+1])
- sprintf (signal_names[rtmin+rtcnt+1], "SIGRTMIN+%d", rtcnt+1);
- }
- }
-#endif /* SIGRTMIN && SIGRTMAX */
-
-/* AIX */
-#if defined (SIGLOST) /* resource lost (eg, record-lock lost) */
- signal_names[SIGLOST] = "SIGLOST";
-#endif
-
-#if defined (SIGMSG) /* HFT input data pending */
- signal_names[SIGMSG] = "SIGMSG";
-#endif
-
-#if defined (SIGDANGER) /* system crash imminent */
- signal_names[SIGDANGER] = "SIGDANGER";
-#endif
-
-#if defined (SIGMIGRATE) /* migrate process to another CPU */
- signal_names[SIGMIGRATE] = "SIGMIGRATE";
-#endif
-
-#if defined (SIGPRE) /* programming error */
- signal_names[SIGPRE] = "SIGPRE";
-#endif
-
-#if defined (SIGVIRT) /* AIX virtual time alarm */
- signal_names[SIGVIRT] = "SIGVIRT";
-#endif
-
-#if defined (SIGALRM1) /* m:n condition variables */
- signal_names[SIGALRM1] = "SIGALRM1";
-#endif
-
-#if defined (SIGWAITING) /* m:n scheduling */
- signal_names[SIGWAITING] = "SIGWAITING";
-#endif
-
-#if defined (SIGGRANT) /* HFT monitor mode granted */
- signal_names[SIGGRANT] = "SIGGRANT";
-#endif
-
-#if defined (SIGKAP) /* keep alive poll from native keyboard */
- signal_names[SIGKAP] = "SIGKAP";
-#endif
-
-#if defined (SIGRETRACT) /* HFT monitor mode retracted */
- signal_names[SIGRETRACT] = "SIGRETRACT";
-#endif
-
-#if defined (SIGSOUND) /* HFT sound sequence has completed */
- signal_names[SIGSOUND] = "SIGSOUND";
-#endif
-
-#if defined (SIGSAK) /* Secure Attention Key */
- signal_names[SIGSAK] = "SIGSAK";
-#endif
-
-/* SunOS5 */
-#if defined (SIGLWP) /* special signal used by thread library */
- signal_names[SIGLWP] = "SIGLWP";
-#endif
-
-#if defined (SIGFREEZE) /* special signal used by CPR */
- signal_names[SIGFREEZE] = "SIGFREEZE";
-#endif
-
-#if defined (SIGTHAW) /* special signal used by CPR */
- signal_names[SIGTHAW] = "SIGTHAW";
-#endif
-
-#if defined (SIGCANCEL) /* thread cancellation signal used by libthread */
- signal_names[SIGCANCEL] = "SIGCANCEL";
-#endif
-
-/* HP-UX */
-#if defined (SIGDIL) /* DIL signal (?) */
- signal_names[SIGDIL] = "SIGDIL";
-#endif
-
-/* System V */
-#if defined (SIGCLD) /* Like SIGCHLD. */
- signal_names[SIGCLD] = "SIGCLD";
-#endif
-
-#if defined (SIGPWR) /* power state indication */
- signal_names[SIGPWR] = "SIGPWR";
-#endif
-
-#if defined (SIGPOLL) /* Pollable event (for streams) */
- signal_names[SIGPOLL] = "SIGPOLL";
-#endif
-
-/* Unknown */
-#if defined (SIGWINDOW)
- signal_names[SIGWINDOW] = "SIGWINDOW";
-#endif
-
-/* Common */
-#if defined (SIGHUP) /* hangup */
- signal_names[SIGHUP] = "SIGHUP";
-#endif
-
-#if defined (SIGINT) /* interrupt */
- signal_names[SIGINT] = "SIGINT";
-#endif
-
-#if defined (SIGQUIT) /* quit */
- signal_names[SIGQUIT] = "SIGQUIT";
-#endif
-
-#if defined (SIGILL) /* illegal instruction (not reset when caught) */
- signal_names[SIGILL] = "SIGILL";
-#endif
-
-#if defined (SIGTRAP) /* trace trap (not reset when caught) */
- signal_names[SIGTRAP] = "SIGTRAP";
-#endif
-
-#if defined (SIGIOT) /* IOT instruction */
- signal_names[SIGIOT] = "SIGIOT";
-#endif
-
-#if defined (SIGABRT) /* Cause current process to dump core. */
- signal_names[SIGABRT] = "SIGABRT";
-#endif
-
-#if defined (SIGEMT) /* EMT instruction */
- signal_names[SIGEMT] = "SIGEMT";
-#endif
-
-#if defined (SIGFPE) /* floating point exception */
- signal_names[SIGFPE] = "SIGFPE";
-#endif
-
-#if defined (SIGKILL) /* kill (cannot be caught or ignored) */
- signal_names[SIGKILL] = "SIGKILL";
-#endif
-
-#if defined (SIGBUS) /* bus error */
- signal_names[SIGBUS] = "SIGBUS";
-#endif
-
-#if defined (SIGSEGV) /* segmentation violation */
- signal_names[SIGSEGV] = "SIGSEGV";
-#endif
-
-#if defined (SIGSYS) /* bad argument to system call */
- signal_names[SIGSYS] = "SIGSYS";
-#endif
-
-#if defined (SIGPIPE) /* write on a pipe with no one to read it */
- signal_names[SIGPIPE] = "SIGPIPE";
-#endif
-
-#if defined (SIGALRM) /* alarm clock */
- signal_names[SIGALRM] = "SIGALRM";
-#endif
-
-#if defined (SIGTERM) /* software termination signal from kill */
- signal_names[SIGTERM] = "SIGTERM";
-#endif
-
-#if defined (SIGURG) /* urgent condition on IO channel */
- signal_names[SIGURG] = "SIGURG";
-#endif
-
-#if defined (SIGSTOP) /* sendable stop signal not from tty */
- signal_names[SIGSTOP] = "SIGSTOP";
-#endif
-
-#if defined (SIGTSTP) /* stop signal from tty */
- signal_names[SIGTSTP] = "SIGTSTP";
-#endif
-
-#if defined (SIGCONT) /* continue a stopped process */
- signal_names[SIGCONT] = "SIGCONT";
-#endif
-
-#if defined (SIGCHLD) /* to parent on child stop or exit */
- signal_names[SIGCHLD] = "SIGCHLD";
-#endif
-
-#if defined (SIGTTIN) /* to readers pgrp upon background tty read */
- signal_names[SIGTTIN] = "SIGTTIN";
-#endif
-
-#if defined (SIGTTOU) /* like TTIN for output if (tp->t_local&LTOSTOP) */
- signal_names[SIGTTOU] = "SIGTTOU";
-#endif
-
-#if defined (SIGIO) /* input/output possible signal */
- signal_names[SIGIO] = "SIGIO";
-#endif
-
-#if defined (SIGXCPU) /* exceeded CPU time limit */
- signal_names[SIGXCPU] = "SIGXCPU";
-#endif
-
-#if defined (SIGXFSZ) /* exceeded file size limit */
- signal_names[SIGXFSZ] = "SIGXFSZ";
-#endif
-
-#if defined (SIGVTALRM) /* virtual time alarm */
- signal_names[SIGVTALRM] = "SIGVTALRM";
-#endif
-
-#if defined (SIGPROF) /* profiling time alarm */
- signal_names[SIGPROF] = "SIGPROF";
-#endif
-
-#if defined (SIGWINCH) /* window changed */
- signal_names[SIGWINCH] = "SIGWINCH";
-#endif
-
-/* 4.4 BSD */
-#if defined (SIGINFO) && !defined (_SEQUENT_) /* information request */
- signal_names[SIGINFO] = "SIGINFO";
-#endif
-
-#if defined (SIGUSR1) /* user defined signal 1 */
- signal_names[SIGUSR1] = "SIGUSR1";
-#endif
-
-#if defined (SIGUSR2) /* user defined signal 2 */
- signal_names[SIGUSR2] = "SIGUSR2";
-#endif
-
-#if defined (SIGKILLTHR) /* BeOS: Kill Thread */
- signal_names[SIGKILLTHR] = "SIGKILLTHR";
-#endif
-
- for (i = 0; i < NSIG; i++)
- if (signal_names[i] == (char *)NULL)
- {
- signal_names[i] = (char *)malloc (18);
- if (signal_names[i])
- sprintf (signal_names[i], "SIGJUNK(%d)", i);
- }
-
- signal_names[NSIG] = "DEBUG";
- signal_names[NSIG+1] = "ERR";
- signal_names[NSIG+2] = "RETURN";
-}
-
-void
-write_signames (stream)
- FILE *stream;
-{
- register int i;
-
- fprintf (stream, "/* This file was automatically created by %s.\n",
- progname);
- fprintf (stream, " Do not edit. Edit support/mksignames.c instead. */\n\n");
- fprintf (stream,
- "/* A translation list so we can be polite to our users. */\n");
- fprintf (stream, "char *signal_names[NSIG + 4] = {\n");
-
- for (i = 0; i <= LASTSIG; i++)
- fprintf (stream, " \"%s\",\n", signal_names[i]);
-
- fprintf (stream, " (char *)0x0\n");
- fprintf (stream, "};\n");
-}
-
-int
-main (argc, argv)
- int argc;
- char **argv;
-{
- char *stream_name;
- FILE *stream;
-
- progname = argv[0];
-
- if (argc == 1)
- {
- stream_name = "stdout";
- stream = stdout;
- }
- else if (argc == 2)
- {
- stream_name = argv[1];
- stream = fopen (stream_name, "w");
- }
- else
- {
- fprintf (stderr, "Usage: %s [output-file]\n", progname);
- exit (1);
- }
-
- if (!stream)
- {
- fprintf (stderr, "%s: %s: cannot open for writing\n",
- progname, stream_name);
- exit (2);
- }
-
- initialize_signames ();
- write_signames (stream);
- exit (0);
-}