- new variable, rl_menu_completion_entry_function, generator for
rl_menu_complete
- new menu completion `browsing' implementation, with several
- improvements over the old code. Inspired by Sami
+ improvements over the old code. Inspired by Sami Pietila
+ <sami.pietila@gmail.com>
lib/readline/readline.h
- extern declaration for rl_menu_completion_entry_function
8/28
----
lib/readline/rlprivate.h
- - add member to search_cxt to save _rl_keymap
+ - add members to search_cxt to save _rl_keymap
- new flag for isearch context: SF_CHGKMAP, set if we changed the
keymap while reading a character for the search string that
translated to a command
lib/readline/isearch.c
- - save current readline keymap in cxt->keymap in _rl_scxt_alloc
+ - save current readline keymap in cxt->keymap and cxt->okeymap
+ in _rl_scxt_alloc
- in _rl_isearch_dispatch, only check for cxt->lastc as a member of
cxt->search_terminators if it's > 0 (i.e., not an isearch opcode)
+
+ 9/3
+ ---
+support/signames.c
+ - add Solaris SIGJVM1 and SIGJVM2. Update from Stefan Teleman
+ <stefan.teleman@oracle.com>
+
+shell.c
+ - instead of closing all fds 3-20 at shell startup, just set them to
+ be close-on-exec. Report from Rainer Müller<raimue@macports.org>
+
+lib/readline/isearch.c
+ - in _rl_isearch_dispatch, if the current character maps to ISKMAP,
+ move to the indicated keymap (using cxt->keymap) and go on to
+ read another character. Fixes problem reported by Davor
+ Cubranic <cubranic@stat.ubc.ca>
+ - in _rl_isearch_dispatch, after translating key to possible opcode,
+ restore _rl_keymap from cxt->okeymap if necessary
+ - in _rl_isearch_dispatch, use key sequences that map to default
+ functions that ^G, ^W, and ^Y map to as equivalent to those chars
+
+lib/readline/complete.c
+ - new variable, _rl_menu_complete_prefix_first, zero by default
+ - change menu_complete to display common prefix (matches[0]) first
+ before cycling through rest of match list if
+ _rl_menu_complete_prefix_first is non-zero. Suggested by Sami
+ Pietila <sami.pietila@gmail.com>
+
+lib/readline/bind.c
+ - new bindable readline variable, "menu-complete-display-prefix",
+ controls setting of _rl_menu_complete_prefix_first
+
+doc/{bash.1,bashref.texi},lib/readline/doc/{readline.3,rluser.texi}
+ - added description of menu-complete-display-prefix bindable
+ readline variable
- new variable, rl_menu_completion_entry_function, generator for
rl_menu_complete
- new menu completion `browsing' implementation, with several
- improvements over the old code. Inspired by Sami
+ improvements over the old code. Inspired by Sami Pietila
+ <sami.pietila@gmail.com>
lib/readline/readline.h
- extern declaration for rl_menu_completion_entry_function
8/28
----
lib/readline/rlprivate.h
- - add member to search_cxt to save _rl_keymap
+ - add members to search_cxt to save _rl_keymap
+ - new flag for isearch context: SF_CHGKMAP, set if we changed the
+ keymap while reading a character for the search string that
+ translated to a command
lib/readline/isearch.c
- - save current readline keymap in cxt->keymap in _rl_scxt_alloc
+ - save current readline keymap in cxt->keymap and cxt->okeymap
+ in _rl_scxt_alloc
- in _rl_isearch_dispatch, only check for cxt->lastc as a member of
cxt->search_terminators if it's > 0 (i.e., not an isearch opcode)
+
+ 9/3
+ ---
+support/signames.c
+ - add Solaris SIGJVM1 and SIGJVM2. Update from Stefan Teleman
+ <stefan.teleman@oracle.com>
+
+shell.c
+ - instead of closing all fds 3-20 at shell startup, just set them to
+ be close-on-exec. Report from Rainer Müller<raimue@macports.org>
+
+lib/readline/isearch.c
+ - in _rl_isearch_dispatch, if the current character maps to ISKMAP,
+ move to the indicated keymap (using cxt->keymap) and go on to
+ read another character. Fixes problem reported by Davor
+ Cubranic <cubranic@stat.ubc.ca>
+ - in _rl_isearch_dispatch, after translating key to possible opcode,
+ restore _rl_keymap from cxt->okeymap if necessary
+ - in _rl_isearch_dispatch, use key sequences that map to default
+ functions that ^G, ^W, and ^Y map to as equivalent to those chars
+
+lib/readline/complete.c
+ - new variable, _rl_menu_complete_prefix_first, zero by default
+ - change menu_complete to display common prefix (matches[0]) first
+ before cycling through rest of match list if
+ _rl_menu_complete_prefix_first is non-zero. Suggested by Sami
+ Pietila <sami.pietila@gmail.com>
+
+lib/readline/bind.c
+ - new bindable readline variable, "menu-complete-display-prefix",
+ controls setting of _rl_menu_complete_prefix_first
+
+
.\" Case Western Reserve University
.\" chet@po.cwru.edu
.\"
-.\" Last Change: Sat Aug 28 18:55:45 EDT 2010
+.\" Last Change: Mon Sep 6 22:07:38 EDT 2010
.\"
.\" bash_builtins, strip all but Built-Ins section
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
-.TH BASH 1 "2010 August 28" "GNU Bash-4.2"
+.TH BASH 1 "2010 September 6" "GNU Bash-4.2"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
If set to \fBOff\fP, the leading `.' must be
supplied by the user in the filename to be completed.
.TP
+.B menu\-complete\-display\-prefix (Off)
+If set to \fBOn\fP, menu completion displays the common prefix of the
+list of possible completions (which may be empty) before cycling through
+the list.
+.TP
.B output\-meta (Off)
If set to \fBOn\fP, readline will display characters with the
eighth bit set directly rather than as a meta-prefixed escape
.\" Case Western Reserve University
.\" chet@po.cwru.edu
.\"
-.\" Last Change: Tue Aug 3 15:24:33 EDT 2010
+.\" Last Change: Sat Aug 28 18:55:45 EDT 2010
.\"
.\" bash_builtins, strip all but Built-Ins section
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
-.TH BASH 1 "2010 August 3" "GNU Bash-4.2"
+.TH BASH 1 "2010 August 28" "GNU Bash-4.2"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
.PP
.B Bash
attempts to determine when it is being run with its standard input
-connected to a network connection, as if by the remote shell
+connected to a network connection, as when executed by the remote shell
daemon, usually \fIrshd\fP, or the secure shell daemon \fIsshd\fP.
If
.B bash
below).
The file descriptors can be utilized as arguments to shell commands
and redirections using standard word expansions.
-The process id of the shell spawned to execute the coprocess is
+The process ID of the shell spawned to execute the coprocess is
available as the value of the variable \fINAME\fP_PID.
The \fBwait\fP
builtin command may be used to wait for the coprocess to terminate.
In the context where an assignment statement is assigning a value
to a shell variable or array index, the += operator can be used to
append to or add to the variable's previous value.
-When += is applied to a variable for which the integer attribute has been
+When += is applied to a variable for which the \fIinteger\fP attribute has been
set, \fIvalue\fP is evaluated as an arithmetic expression and added to the
variable's current value, which is also evaluated.
When += is applied to an array variable using compound assignment (see
This variable is read-only.
.TP
.B BASHPID
-Expands to the process id of the current \fBbash\fP process.
+Expands to the process ID of the current \fBbash\fP process.
This differs from \fB$$\fP under certain circumstances, such as subshells
that do not require \fBbash\fP to be re-initialized.
.TP
expanded and that value is used in the rest of the substitution, rather
than the value of \fIparameter\fP itself.
This is known as \fIindirect expansion\fP.
-The exceptions to this are the expansions of ${!\fIprefix\fP*} and
+The exceptions to this are the expansions of ${\fB!\\fPfIprefix\fP\fB*\fP} and
${\fB!\fP\fIname\fP[\fI@\fP]} described below.
The exclamation point must immediately follow the left brace in order to
introduce indirection.
.TP
${\fIparameter\fP\fB:\fP\fIoffset\fP\fB:\fP\fIlength\fP}
.PD
-\fBSubstring Expansion.\fP
+\fBSubstring Expansion\fP.
Expands to up to \fIlength\fP characters of \fIparameter\fP
starting at the character specified by \fIoffset\fP.
If \fIlength\fP is omitted, expands to the substring of
.TP
${\fB!\fP\fIprefix\fP\fB@\fP}
.PD
-\fBNames matching prefix.\fP
+\fBNames matching prefix\fP.
Expands to the names of variables whose names begin with \fIprefix\fP,
separated by the first character of the
.SM
.TP
${\fB!\fP\fIname\fP[\fI*\fP]}
.PD
-\fBList of array keys.\fP
+\fBList of array keys\fP.
If \fIname\fP is an array variable, expands to the list of array indices
(keys) assigned in \fIname\fP.
If \fIname\fP is not an array, expands to 0 if \fIname\fP is set and null
key expands to a separate word.
.TP
${\fB#\fP\fIparameter\fP}
-\fBParameter length.\fP
+\fBParameter length\fP.
The length in characters of the value of \fIparameter\fP is substituted.
If
.I parameter
.TP
${\fIparameter\fP\fB##\fP\fIword\fP}
.PD
-\fBRemove matching prefix pattern.\fP
+\fBRemove matching prefix pattern\fP.
The
.I word
is expanded to produce a pattern just as in pathname
.TP
${\fIparameter\fP\fB%%\fP\fIword\fP}
.PD
-\fBRemove matching suffix pattern.\fP
+\fBRemove matching suffix pattern\fP.
The \fIword\fP is expanded to produce a pattern just as in
pathname expansion.
If the pattern matches a trailing portion of the expanded value of
array in turn, and the expansion is the resultant list.
.TP
${\fIparameter\fP\fB/\fP\fIpattern\fP\fB/\fP\fIstring\fP}
-\fBPattern substitution.\fP
+\fBPattern substitution\fP.
The \fIpattern\fP is expanded to produce a pattern just as in
pathname expansion.
\fIParameter\fP is expanded and the longest match of \fIpattern\fP
.TP
${\fIparameter\fP\fB,,\fP\fIpattern\fP}
.PD
-\fBCase modification.\fP
+\fBCase modification\fP.
This expansion modifies the case of alphabetic characters in \fIparameter\fP.
The \fIpattern\fP is expanded to produce a pattern just as in
pathname expansion.
during its execution.
The special parameter
.B #
-is updated to reflect the change. Special parameter 0
+is updated to reflect the change. Special parameter \fB0\fP
is unchanged.
The first element of the
.SM
when it is referenced, or when a variable which has been given the
\fIinteger\fP attribute using \fBdeclare -i\fP is assigned a value.
A null value evaluates to 0.
-A shell variable need not have its integer attribute
+A shell variable need not have its \fIinteger\fP attribute
turned on to be used in an expression.
.PP
Constants with a leading 0 are interpreted as octal numbers.
cannot affect the shell's execution environment.
.PP
Subshells spawned to execute command substitutions inherit the value of
-the \fB\-e\fP option from the parent shell. When not in posix mode,
-Bash clears the \fB\-e\fP option in such subshells.
+the \fB\-e\fP option from the parent shell. When not in \fIposix\fP mode,
+\fBbash\fP clears the \fB\-e\fP option in such subshells.
.PP
If a command is followed by a \fB&\fP and job control is not active, the
default standard input for the command is the empty file \fI/dev/null\fP.
option is given at shell invocation.
Line editing is also used when using the \fB\-e\fP option to the
\fBread\fP builtin.
-By default, the line editing commands are similar to those of emacs.
+By default, the line editing commands are similar to those of Emacs.
A vi-style line editing interface is also available.
Line editing can be enabled at any time using the
.B \-o emacs
builtin.
.SS "Readline Notation"
.PP
-In this section, the emacs-style notation is used to denote
+In this section, the Emacs-style notation is used to denote
keystrokes. Control keys are denoted by C\-\fIkey\fR, e.g., C\-n
means Control\-N. Similarly,
.I meta
.TP
.B editing\-mode (emacs)
Controls whether readline begins with a set of key bindings similar
-to \fIemacs\fP or \fIvi\fP.
+to \fIEmacs\fP or \fIvi\fP.
.B editing\-mode
can be set to either
.B emacs
the meta key is used to send eight-bit characters.
.TP
.B expand\-tilde (Off)
-If set to \fBon\fP, tilde expansion is performed when readline
+If set to \fBOn\fP, tilde expansion is performed when readline
attempts word completion.
.TP
.B history\-preserve\-point (Off)
-If set to \fBon\fP, the history code attempts to place point at the
+If set to \fBOn\fP, the history code attempts to place point at the
same location on each history line retrieved with \fBprevious-history\fP
or \fBnext-history\fP.
.TP
If set to \fBOff\fP, the leading `.' must be
supplied by the user in the filename to be completed.
.TP
+.B menu\-complete\-display\-prefix (Off)
+If set to \fBOn\fP, menu completion displays the common prefix of the
+list of possible completions (which may be empty) before cycling through
+the list.
+.TP
.B output\-meta (Off)
If set to \fBOn\fP, readline will display characters with the
eighth bit set directly rather than as a meta-prefixed escape
sorted horizontally in alphabetical order, rather than down the screen.
.TP
.B revert\-all\-at\-newline (Off)
-If set to \fBon\fP, readline will undo all changes to history lines
+If set to \fBOn\fP, readline will undo all changes to history lines
before returning when \fBaccept\-line\fP is executed. By default,
history lines may be modified and retain individual undo lists across
calls to \fBreadline\fP.
.B show\-all\-if\-ambiguous (Off)
This alters the default behavior of the completion functions. If
set to
-.BR on ,
+.BR On ,
words which have more than one possible completion cause the
matches to be listed immediately instead of ringing the bell.
.TP
This alters the default behavior of the completion functions in
a fashion similar to \fBshow\-all\-if\-ambiguous\fP.
If set to
-.BR on ,
+.BR On ,
words which have more than one possible completion without any
possible partial completion (the possible completions don't share
a common prefix) cause the matches to be listed immediately instead
file can test for a particular value.
This could be used to bind key sequences to functions useful for
a specific program. For instance, the following command adds a
-key sequence that quotes the current or previous word in Bash:
+key sequence that quotes the current or previous word in \fBbash\fP:
.sp 1
.RS
.nf
This command is intended to be bound to \fBTAB\fP, but is unbound
by default.
.TP
-.B menu\-complete-\backward
+.B menu\-complete\-backward
Identical to \fBmenu\-complete\fP, but moves backward through the list
of possible completions, as if \fBmenu\-complete\fP had been given a
negative argument. This command is unbound by default.
A character is read and point is moved to the previous occurrence of that
character. A negative count searches for subsequent occurrences.
.TP
-.B skip\-csi\-sequence ()
+.B skip\-csi\-sequence
Read enough characters to consume a multi-key sequence such as those
defined for keys like Home and End. Such sequences begin with a
Control Sequence Indicator (CSI), usually ESC\-[. If this sequence is
pathname is searched for first.
If no compspec is found for the full pathname, an attempt is made to
find a compspec for the portion following the final slash.
-If those searches to not result in a compspec, any compspec defined with
+If those searches do not result in a compspec, any compspec defined with
the \fB\-D\fP option to \fBcomplete\fP is used as the default.
.PP
Once a compspec has been found, it is used to generate the list of
.SM
.B OPTIND
is set to the index of the first non-option argument,
-and \fBname\fP is set to ?.
+and \fIname\fP is set to ?.
.sp 1
.B getopts
normally parses the positional parameters, but if more arguments are
Any command associated with the \fBRETURN\fP trap is executed
before execution resumes after the function or script.
.TP
-\fBset\fP [\fB\-\-abefhkmnptuvxBCEHPT\fP] [\fB\-o\fP \fIoption\fP] [\fIarg\fP ...]
+\fBset\fP [\fB\-\-abefhkmnptuvxBCEHPT\fP] [\fB\-o\fP \fIoption\-name\fP] [\fIarg\fP ...]
.PD 0
.TP
-\fBset\fP [\fB+abefhkmnptuvxBCEHPT\fP] [\fB+o\fP \fIoption\fP] [\fIarg\fP ...]
+\fBset\fP [\fB+abefhkmnptuvxBCEHPT\fP] [\fB+o\fP \fIoption\-name\fP] [\fIarg\fP ...]
.PD
Without options, the name and value of each shell variable are displayed
in a format that can be reused as input
If set,
.B bash
changes its behavior to that of version 3.1 with respect to quoted
-arguments to the conditional command's =~ operator.
+arguments to the conditional command's \fB=~\fP operator.
.TP 8
.B compat32
If set,
.B bash
changes its behavior to that of version 3.2 with respect to locale-specific
-string comparison when using the conditional command's < and > operators.
+string comparison when using the conditional command's \fB<\fP and \fB>\fP
+operators.
.TP 8
.B compat40
If set,
.B bash
changes its behavior to that of version 4.0 with respect to locale-specific
-string comparison when using the conditional command's < and > operators
-and the effect of interrupting a command list.
+string comparison when using the conditional command's \fB<\fP and \fB>\fP
+operators and the effect of interrupting a command list.
.TP 8
.B compat41
@item compat41
.B .
builtin command
.IP \(bu
-Specifying a filename containing a slash as an argument to the
+specifying a filename containing a slash as an argument to the
.B \-p
option to the
.B hash
.B enable
builtin command
.IP \(bu
-Using the \fBenable\fP builtin command to enable disabled shell builtins
+using the \fBenable\fP builtin command to enable disabled shell builtins
.IP \(bu
specifying the
.B \-p
Copyright (C) 1988-2010 Free Software Foundation, Inc.
@end ignore
-@set LASTCHANGE Sat Aug 28 18:56:04 EDT 2010
+@set LASTCHANGE Mon Sep 6 22:08:10 EDT 2010
@set EDITION 4.2
@set VERSION 4.2
-@set UPDATED 28 August 2010
-@set UPDATED-MONTH August 2010
+@set UPDATED 6 September 2010
+@set UPDATED-MONTH September 2010
Copyright (C) 1988-2010 Free Software Foundation, Inc.
@end ignore
-@set LASTCHANGE Wed Jul 21 08:54:40 EDT 2010
+@set LASTCHANGE Sat Aug 28 18:56:04 EDT 2010
@set EDITION 4.2
@set VERSION 4.2
-@set UPDATED 21 July 2010
-@set UPDATED-MONTH July 2010
+@set UPDATED 28 August 2010
+@set UPDATED-MONTH August 2010
execute_simple_command (command->value.Simple, pipe_in, pipe_out,
asynchronous, fds_to_close);
line_number = save_line_number;
-
+itrace("execute_simple_command (%s) returns %d", command->value.Simple->words->word->word, exec_result);
/* The temporary environment should be used for only the simple
command immediately following its definition. */
dispose_used_env_vars ();
int ret;
struct fd_bitmap *bitmap;
-itrace("execute_shell_function: %s", var->name);
bitmap = new_fd_bitmap (FD_BITMAP_DEFAULT_SIZE);
begin_unwind_frame ("execute-shell-function");
add_unwind_protect (dispose_fd_bitmap, (char *)bitmap);
{ "mark-modified-lines", &_rl_mark_modified_lines, 0 },
{ "mark-symlinked-directories", &_rl_complete_mark_symlink_dirs, 0 },
{ "match-hidden-files", &_rl_match_hidden_files, 0 },
+ { "menu-complete-display-prefix", &_rl_menu_complete_prefix_first, 0 },
{ "meta-flag", &_rl_meta_flag, 0 },
{ "output-meta", &_rl_output_meta_chars, 0 },
{ "page-completions", &_rl_page_completions, 0 },
/* bind.c -- key binding and startup file support for the readline library. */
-/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2010 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
after the `e' in `Makefile' won't result in `Makefilefile'. */
int _rl_skip_completed_text = 0;
+/* If non-zero, menu completion displays the common prefix first in the
+ cycle of possible completions instead of the last. */
+int _rl_menu_complete_prefix_first = 0;
+
/* If non-zero, then this is the address of a function to call when
completing on a directory name. The function is called with
the address of a string (the current directory name) as an arg. */
static int full_completion = 0; /* set to 1 if menu completion should reinitialize on next call */
static int orig_start, orig_end;
static char quote_char;
- static int delimiter;
+ static int delimiter, cstate;
/* The first time through, we generate the list of matches and set things
up to insert them. */
full_completion = 1;
return (0);
}
+ else if (_rl_menu_complete_prefix_first && match_list_size > 1)
+ {
+ rl_ding ();
+ return (0);
+ }
}
/* Now we have the list of matches. Replace the text between
after the `e' in `Makefile' won't result in `Makefilefile'. */
int _rl_skip_completed_text = 0;
+/* If non-zero, menu completion displays the common prefix first in the
+ cycle of possible completions instead of the last. */
+int _rl_menu_complete_prefix_first = 1;
+
/* If non-zero, then this is the address of a function to call when
completing on a directory name. The function is called with
the address of a string (the current directory name) as an arg. */
if (path_isdir (new_full_pathname))
extension_char = '/';
- free (new_full_pathname);
+ xfree (new_full_pathname);
to_print[-1] = c;
}
else
extension_char = '/';
}
- free (s);
+ xfree (s);
if (extension_char)
{
putc (extension_char, rl_outstream);
{
if (strcmp (matches[i], matches[i + 1]) == 0)
{
- free (matches[i]);
+ xfree (matches[i]);
matches[i] = (char *)&dead_slot;
}
else
temp_array[j] = (char *)NULL;
if (matches[0] != (char *)&dead_slot)
- free (matches[0]);
+ xfree (matches[0]);
/* Place the lowest common denominator back in [0]. */
temp_array[0] = lowest_common;
insert. */
if (j == 2 && strcmp (temp_array[0], temp_array[1]) == 0)
{
- free (temp_array[1]);
+ xfree (temp_array[1]);
temp_array[1] = (char *)NULL;
}
return (temp_array);
if (rl_ignore_completion_duplicates)
{
temp_matches = remove_duplicate_matches (matches);
- free (matches);
+ xfree (matches);
matches = temp_matches;
}
else
_rl_replace_text (replacement, start, end);
if (replacement != match)
- free (replacement);
+ xfree (replacement);
}
}
if (rl_point == rl_end && temp_string_index)
rl_insert_text (temp_string);
}
- free (filename);
+ xfree (filename);
}
else
{
rl_insert_text (rp);
rl_insert_text (" ");
if (rp != matches[i])
- free (rp);
+ xfree (rp);
}
}
else
rl_insert_text (rp);
rl_insert_text (" ");
if (rp != matches[0])
- free (rp);
+ xfree (rp);
}
rl_end_undo_group ();
}
return;
for (i = 0; matches[i]; i++)
- free (matches[i]);
- free (matches);
+ xfree (matches[i]);
+ xfree (matches);
}
/* Complete the word at or before point.
if (what_to_do == '!' || what_to_do == '@')
tlen = strlen (text);
#endif
- free (text);
+ xfree (text);
if (matches == 0)
{
if (saved_line_buffer)
{
completion_changed_buffer = strcmp (rl_line_buffer, saved_line_buffer) != 0;
- free (saved_line_buffer);
+ xfree (saved_line_buffer);
}
RL_UNSETSTATE(RL_STATE_COMPLETING);
compute_lcd_of_matches (match_list, matches, text);
else /* There were no matches. */
{
- free (match_list);
+ xfree (match_list);
match_list = (char **)NULL;
}
return (match_list);
return 1;
if (convlen < filename_len)
return 0;
- s1 = convfn;
- s2 = filename;
+ s1 = (char *)convfn;
+ s2 = (char *)filename;
len = filename_len;
do
{
if (*dirname == '~')
{
temp = tilde_expand (dirname);
- free (dirname);
+ xfree (dirname);
dirname = temp;
}
dequoting. */
if (rl_directory_completion_hook && (*rl_directory_completion_hook) (&dirname))
{
- free (users_dirname);
+ xfree (users_dirname);
users_dirname = savestring (dirname);
}
else if (rl_completion_found_quote && rl_filename_dequoting_function)
{
/* delete single and double quotes */
temp = (*rl_filename_dequoting_function) (dirname, rl_completion_quote_character);
- free (dirname);
+ xfree (dirname);
dirname = temp;
}
directory = opendir (dirname);
{
/* delete single and double quotes */
temp = (*rl_filename_dequoting_function) (filename, rl_completion_quote_character);
- free (filename);
+ xfree (filename);
filename = temp;
}
filename_len = strlen (filename);
}
if (dirname)
{
- free (dirname);
+ xfree (dirname);
dirname = (char *)NULL;
}
if (filename)
{
- free (filename);
+ xfree (filename);
filename = (char *)NULL;
}
if (users_dirname)
{
- free (users_dirname);
+ xfree (users_dirname);
users_dirname = (char *)NULL;
}
temp = savestring (convfn);
if (convfn != dentry)
- free (convfn);
+ xfree (convfn);
return (temp);
}
static int full_completion = 0; /* set to 1 if menu completion should reinitialize on next call */
static int orig_start, orig_end;
static char quote_char;
- static int delimiter;
+ static int delimiter, cstate;
/* The first time through, we generate the list of matches and set things
up to insert them. */
full_completion = 1;
return (0);
}
+ else if (_rl_menu_complete_prefix_first && match_list_size > 1)
+ {
+ rl_ding ();
+ return (0);
+ }
}
/* Now we have the list of matches. Replace the text between
If set to \fBOff\fP, the leading `.' must be
supplied by the user in the filename to be completed.
.TP
+.B menu\-complete\-display\-prefix (Off)
+If set to \fBOn\fP, menu completion displays the common prefix of the
+list of possible completions (which may be empty) before cycling through
+the list.
+.TP
.B output\-meta (Off)
If set to \fBOn\fP, readline will display characters with the
eighth bit set directly rather than as a meta-prefixed escape
.\" Case Western Reserve University
.\" chet@ins.CWRU.Edu
.\"
-.\" Last Change: Thu Apr 22 18:59:21 EDT 2010
+.\" Last Change: Sat Aug 28 18:56:32 EDT 2010
.\"
-.TH READLINE 3 "2010 April 22" "GNU Readline 6.2"
+.TH READLINE 3 "2010 August 28" "GNU Readline 6.2"
.\"
.\" File Name macro. This used to be `.PN', for Path Name,
.\" but Sun doesn't seem to like that very much.
treated as a newline.
.SH NOTATION
.LP
-An emacs-style notation is used to denote
+An Emacs-style notation is used to denote
keystrokes. Control keys are denoted by C\-\fIkey\fR, e.g., C\-n
means Control\-N. Similarly,
.I meta
.TP
.B editing\-mode (emacs)
Controls whether readline begins with a set of key bindings similar
-to emacs or vi.
+to \fIEmacs\fP or \fIvi\fP.
.B editing\-mode
can be set to either
.B emacs
the meta key is used to send eight-bit characters.
.TP
.B expand\-tilde (Off)
-If set to \fBon\fP, tilde expansion is performed when readline
+If set to \fBOn\fP, tilde expansion is performed when readline
attempts word completion.
.TP
.B history\-preserve\-point (Off)
-If set to \fBon\fP, the history code attempts to place point at the
+If set to \fBOn\fP, the history code attempts to place point at the
same location on each history line retrieved with \fBprevious-history\fP
or \fBnext-history\fP.
.TP
sorted horizontally in alphabetical order, rather than down the screen.
.TP
.B revert\-all\-at\-newline (Off)
-If set to \fBon\fP, readline will undo all changes to history lines
+If set to \fBOn\fP, readline will undo all changes to history lines
before returning when \fBaccept\-line\fP is executed. By default,
history lines may be modified and retain individual undo lists across
calls to \fBreadline\fP.
.B show\-all\-if\-ambiguous (Off)
This alters the default behavior of the completion functions. If
set to
-.BR on ,
+.BR On ,
words which have more than one possible completion cause the
matches to be listed immediately instead of ringing the bell.
.TP
This alters the default behavior of the completion functions in
a fashion similar to \fBshow\-all\-if\-ambiguous\fP.
If set to
-.BR on ,
+.BR On ,
words which have more than one possible completion without any
possible partial completion (the possible completions don't share
a common prefix) cause the matches to be listed immediately instead
file can test for a particular value.
This could be used to bind key sequences to functions useful for
a specific program. For instance, the following command adds a
-key sequence that quotes the current or previous word in Bash:
+key sequence that quotes the current or previous word in \fBbash\fP:
.sp 1
.RS
.nf
This command is intended to be bound to \fBTAB\fP, but is unbound
by default.
.TP
-.B menu\-complete-\backward
+.B menu\-complete\-backward
Identical to \fBmenu\-complete\fP, but moves backward through the list
of possible completions, as if \fBmenu\-complete\fP had been given a
negative argument. This command is unbound by default.
A character is read and point is moved to the previous occurrence of that
character. A negative count searches for subsequent occurrences.
.TP
-.B skip\-csi\-sequence ()
+.B skip\-csi\-sequence
Read enough characters to consume a multi-key sequence such as those
defined for keys like Home and End. Such sequences begin with a
Control Sequence Indicator (CSI), usually ESC\-[. If this sequence is
supplied by the user in the filename to be completed.
This variable is @samp{on} by default.
+@item menu-complete-display-prefix
+@vindex menu-complete-display-prefix
+If set to @samp{on}, menu completion displays the common prefix of the
+list of possible completions (which may be empty) before cycling through
+the list. The default is @samp{off}.
+
@item output-meta
@vindex output-meta
If set to @samp{on}, Readline will display characters with the
unless the @option{--noediting} option is supplied at shell invocation.
Line editing is also used when using the @option{-e} option to the
@code{read} builtin command (@pxref{Bash Builtins}).
-By default, the line editing commands are similar to those of emacs.
+By default, the line editing commands are similar to those of Emacs.
A vi-style line editing interface is also available.
Line editing can be enabled at any time using the @option{-o emacs} or
@option{-o vi} options to the @code{set} builtin command
@set EDITION 6.2
@set VERSION 6.2
-@set UPDATED August 28 2010
-@set UPDATED-MONTH August 2010
+@set UPDATED September 6 2010
+@set UPDATED-MONTH September 2010
-@set LASTCHANGE Sat Aug 28 18:57:07 EDT 2010
+@set LASTCHANGE Mon Sep 6 22:07:10 EDT 2010
@set EDITION 6.2
@set VERSION 6.2
-@set UPDATED August 12 2010
+@set UPDATED August 28 2010
@set UPDATED-MONTH August 2010
-@set LASTCHANGE Thu Aug 12 22:24:28 EDT 2010
+@set LASTCHANGE Sat Aug 28 18:57:07 EDT 2010
cxt->save_undo_list = 0;
cxt->keymap = _rl_keymap;
+ cxt->okeymap = _rl_keymap;
cxt->history_pos = 0;
cxt->direction = 0;
return -1;
}
-#if 0
/* If we are moving into a new keymap, modify cxt->keymap and go on.
This can be a problem if c == ESC and we want to terminate the
- incremental search */
+ incremental search, so we check */
if (c >= 0 && cxt->keymap[c].type == ISKMAP && strchr (cxt->search_terminators, cxt->lastc) == 0)
{
cxt->keymap = FUNCTION_TO_KEYMAP (cxt->keymap, c);
something useful if this doesn't end up mapping to a command. */
return 1;
}
-#endif
/* Translate the keys we do something with to opcodes. */
if (c >= 0 && cxt->keymap[c].type == ISFUNC)
cxt->lastc = (cxt->sflags & SF_REVERSE) ? -2 : -1;
else if (f == rl_rubout)
cxt->lastc = -3;
- else if (c == CTRL ('G'))
+ else if (c == CTRL ('G') || f == rl_abort)
cxt->lastc = -4;
- else if (c == CTRL ('W')) /* XXX */
+ else if (c == CTRL ('W') || f == rl_unix_word_rubout) /* XXX */
cxt->lastc = -5;
- else if (c == CTRL ('Y')) /* XXX */
+ else if (c == CTRL ('Y') || f == rl_yank) /* XXX */
cxt->lastc = -6;
}
+ /* If we changed the keymap earlier while translating a key sequence into
+ a command, restore it now that we've succeeded. */
+ if (cxt->sflags & SF_CHGKMAP)
+ {
+ cxt->keymap = cxt->okeymap;
+ cxt->sflags &= ~SF_CHGKMAP;
+ }
+
/* The characters in isearch_terminators (set from the user-settable
variable isearch-terminators) are used to terminate the search but
not subsequently execute the character as a command. The default
return (0);
}
-#if 0
- /* If we changed the keymap earlier while translating a key sequence into
- a command, restore it now that we've succeeded. */
- if (cxt->sflags & SF_CHGKMAP)
- {
- cxt->keymap = _rl_keymap;
- cxt->sflags &= ~SF_CHGKMAP;
- }
-#endif
-
/* Now dispatch on the character. `Opcodes' affect the search string or
state. Other characters are added to the string. */
switch (cxt->lastc)
cxt->save_undo_list = 0;
cxt->keymap = _rl_keymap;
+ cxt->okeymap = _rl_keymap;
cxt->history_pos = 0;
cxt->direction = 0;
return -1;
}
-#if 0
- /* If we are moving into a new keymap, modify cxt->keymap and go on */
+ /* If we are moving into a new keymap, modify cxt->keymap and go on.
+ This can be a problem if c == ESC and we want to terminate the
+ incremental search, so we check */
if (c >= 0 && cxt->keymap[c].type == ISKMAP && strchr (cxt->search_terminators, cxt->lastc) == 0)
{
cxt->keymap = FUNCTION_TO_KEYMAP (cxt->keymap, c);
cxt->sflags |= SF_CHGKMAP;
/* XXX - we should probably save this sequence, so we can do
- something useful if this doesn't end up mapping to a command.
- This can be a problem if c == ESC and we want to terminate
- the incremental search */
+ something useful if this doesn't end up mapping to a command. */
return 1;
}
-#endif
/* Translate the keys we do something with to opcodes. */
if (c >= 0 && cxt->keymap[c].type == ISFUNC)
cxt->lastc = -6;
}
+ /* If we changed the keymap earlier while translating a key sequence into
+ a command, restore it now that we've succeeded. */
+ if (cxt->sflags & SF_CHGKMAP)
+ {
+ cxt->keymap = cxt->okeymap;
+ cxt->sflags &= ~SF_CHGKMAP;
+ }
+
/* The characters in isearch_terminators (set from the user-settable
variable isearch-terminators) are used to terminate the search but
not subsequently execute the character as a command. The default
return (0);
}
-#if 0
- /* If we changed the keymap earlier while translating a key sequence into
- a command, restore it now that we've succeeded. */
- if (cxt->sflags & SF_CHGKMAP)
- {
- cxt->keymap = _rl_keymap;
- cxt->sflags &= ~SF_CHGKMAP;
- }
-#endif
-
/* Now dispatch on the character. `Opcodes' affect the search string or
state. Other characters are added to the string. */
switch (cxt->lastc)
UNDO_LIST *save_undo_list;
Keymap keymap; /* used when dispatching commands in search string */
+ Keymap okeymap; /* original keymap */
int history_pos;
int direction;
extern int _rl_match_hidden_files;
extern int _rl_page_completions;
extern int _rl_skip_completed_text;
+extern int _rl_menu_complete_prefix_first;
/* display.c */
extern int _rl_vis_botlin;
#define SF_REVERSE 0x01
#define SF_FOUND 0x02
#define SF_FAILED 0x04
+#define SF_CHGKMAP 0x08
typedef struct __rl_search_context
{
UNDO_LIST *save_undo_list;
Keymap keymap; /* used when dispatching commands in search string */
+ Keymap okeymap; /* original keymap */
int history_pos;
int direction;
else
init_noninteractive ();
-#define CLOSE_FDS_AT_LOGIN
-#if defined (CLOSE_FDS_AT_LOGIN)
/*
* Some systems have the bad habit of starting login shells with lots of open
* file descriptors. For instance, most systems that have picked up the
* pre-4.0 Sun YP code leave a file descriptor open each time you call one
* of the getpw* functions, and it's set to be open across execs. That
- * means one for login, one for xterm, one for shelltool, etc.
+ * means one for login, one for xterm, one for shelltool, etc. There are
+ * also systems that open persistent FDs to other agents or files as part
+ * of process startup; these need to be set to be close-on-exec.
*/
if (login_shell && interactive_shell)
{
for (i = 3; i < 20; i++)
- close (i);
+ SET_CLOSE_ON_EXEC (i);
}
-#endif /* CLOSE_FDS_AT_LOGIN */
/* If we're in a strict Posix.2 mode, turn on interactive comments,
alias expansion in non-interactive shells, and other Posix.2 things. */
/* shell.c -- GNU's idea of the POSIX shell specification. */
-/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2010 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
{
int i, pass_next, backq, si, c, invert, skipquote, skipcmd;
size_t slen;
- char *temp;
+ char *temp, open[3];
DECLARE_MBSTATE;
slen = strlen (string + start) + start;
continue;
}
#endif /* PROCESS_SUBSTITUTION */
+#if defined (EXTENDED_GLOB)
+ else if ((flags & SD_EXTGLOB) && extended_glob && string[i+1] == LPAREN && member (c, "?*+!@"))
+ {
+ si = i + 2;
+ if (string[si] == '\0')
+ CQ_RETURN(si);
+
+ open[0] = c;
+ open[1] = LPAREN;
+ open[2] = '\0';
+ temp = extract_delimited_string (string, &si, open, "(", ")", SX_NOALLOC); /* ) */
+
+ i = si;
+ if (string[i] == '\0') /* don't increment i past EOS in loop */
+ break;
+ i++;
+ continue;
+ }
+#endif
else if ((skipquote || invert) && (member (c, delims) == 0))
break;
else
/* $? -- return value of the last synchronous command. */
case '?':
temp = itos (last_command_exit_value);
+itrace("last_command_exit_value = %d", last_command_exit_value);
break;
/* $- -- flags supplied to the shell on invocation or by `set'. */
#endif
/* SunOS5 */
-#if defined (SIGLWP) /* special signal used by thread library */
+#if defined (SIGLWP) /* Solaris: special signal used by thread library */
signal_names[SIGLWP] = "SIGLWP";
#endif
-#if defined (SIGFREEZE) /* special signal used by CPR */
+#if defined (SIGFREEZE) /* Solaris: special signal used by CPR */
signal_names[SIGFREEZE] = "SIGFREEZE";
#endif
-#if defined (SIGTHAW) /* special signal used by CPR */
+#if defined (SIGTHAW) /* Solaris: special signal used by CPR */
signal_names[SIGTHAW] = "SIGTHAW";
#endif
-#if defined (SIGCANCEL) /* thread cancellation signal used by libthread */
+#if defined (SIGCANCEL) /* Solaris: thread cancellation signal used by libthread */
signal_names[SIGCANCEL] = "SIGCANCEL";
#endif
-#if defined (SIGXRES) /* resource control exceeded */
+#if defined (SIGXRES) /* Solaris: resource control exceeded */
signal_names[SIGXRES] = "SIGXRES";
#endif
+#if defined (SIGJVM1) /* Solaris: Java Virtual Machine 1 */
+ signal_names[SIGJVM1] = "SIGJVM1";
+#endif
+
+#if defined (SIGJVM2) /* Solaris: Java Virtual Machine 2 */
+ signal_names[SIGJVM2] = "SIGJVM2";
+#endif
+
/* HP-UX */
#if defined (SIGDIL) /* DIL signal (?) */
signal_names[SIGDIL] = "SIGDIL";
--- /dev/null
+/* signames.c -- Create an array of signal names. */
+
+/* Copyright (C) 2006 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 3 of the License, 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. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#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]))
+
+/* 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
+
+#if defined (BUILDTOOL)
+extern char *progname;
+#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;
+#ifdef BUILDTOOL
+ fprintf(stderr, "%s: error: more than %d real time signals, fix `%s'\n",
+ progname, RTLIM, progname);
+#endif
+ }
+
+ 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 */
+
+#if defined (SIGLOST) /* resource lost (eg, record-lock lost) */
+ signal_names[SIGLOST] = "SIGLOST";
+#endif
+
+/* AIX */
+#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
+
+#if defined (SIGXRES) /* resource control exceeded */
+ signal_names[SIGXRES] = "SIGXRES";
+#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
+
+/* Linux */
+#if defined (SIGSTKFLT)
+ signal_names[SIGSTKFLT] = "SIGSTKFLT";
+#endif
+
+/* FreeBSD */
+#if defined (SIGTHR) /* thread interrupt */
+ signal_names[SIGTHR] = "SIGTHR";
+#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<OSTOP) */
+ 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";
+}