commit bash-20100422 snapshot

This commit is contained in:
Chet Ramey
2011-12-12 21:57:36 -05:00
parent 112ff2a603
commit e502b4e024
31 changed files with 11205 additions and 819 deletions
+64
View File
@@ -9736,3 +9736,67 @@ execute_cmd.c
doc/{bash.1,bashref.texi}
- document 'C and "C constants for printf builtin
4/22
----
lib/readline/complete.c
- new function to return screenwidth for use when displaying possible
matches: complete_get_screenwidth; changed uses of _rl_screenwidth
to use complete_get_screenwidth().
- change complete_get_screenwidth to query (readline-private)
_rl_completion_colums, $COLUMNS, then _rl_screenwidth in that order
- change rl_display_match_list to deal with limit < 0 (which implies
that cols == 0) when _rl_screenwidth > 0
lib/readline/bind.c
- new bindable variable: completion-display-width, controls the
number of columns used when displaying completionsm with new
sv_compwidth function to call when value is set or unset
lib/readline/doc/{readline.3,rltech.texi}
- documented completion-display-width variable
4/23
----
execute_cmd.c
- change execute_in_subshell to reset trap handlers without freeing
the trap strings and set SUBSHELL_RESETTRAP. In line with Austin
Group interp #53 (trap in a subshell).
- ditto for execute_simple_command where it can be determined that
the shell is going to run a builtin or function in a subshell
trap.c
- new function, get_all_original_signals, retrieves the original
signal disposition for all signals
trap.h
- extern declaration for get_all_original_signals
builtins/trap.def
- change showtrap to display signals that are "hard ignored" as
trap commands to ignore them, even though that trap command would
be a no-op. Partial fix for feature request from Siddhesh
Poyarekar <siddhesh.poyarekar@gmail.com>
- change trap_builtin to call get_all_original_signals before displaying
traps. This will show inherited ignored signals. Rest of feature
request from Siddhesh Poyarekar <siddhesh.poyarekar@gmail.com>
lib/readline/histexpand.c
- fix history_tokenize_word so that it understands $(...) and the
<(...) and >(...) expansions as a single word
- change history_tokenize_word so that it understands extended shell
globbing patterns as a single word. Code is very similar to
$(...) code above. Bug reported by Rajeev V. Pillai
<rajeevvp@gmail.com>
4/24
----
lib/readline/vi_mode.c
- add checks to rl_vi_char_search to make sure we've already done a
search if the command is `;' or `,', and return immediately if we
have not. Fixes bug reported by Eric Ho <ericmho@shaw.ca>
lib/readline/text.c
- make sure `dir' is in the valid range before searching in
_rl_char_search_internal. Range checks in the code depend on it
being non-zero
+54
View File
@@ -9734,4 +9734,58 @@ execute_cmd.c
substitution FDs or FIFOs created by a shell builtin or shell
function. Fixes bug reported by Charles Duffy <charles@dyfis.net>
doc/{bash.1,bashref.texi}
- document 'C and "C constants for printf builtin
4/22
----
lib/readline/complete.c
- new function to return screenwidth for use when displaying possible
matches: complete_get_screenwidth; changed uses of _rl_screenwidth
to use complete_get_screenwidth().
- change complete_get_screenwidth to query (readline-private)
_rl_completion_colums, $COLUMNS, then _rl_screenwidth in that order
- change rl_display_match_list to deal with limit < 0 (which implies
that cols == 0) when _rl_screenwidth > 0
lib/readline/bind.c
- new bindable variable: completion-display-width, controls the
number of columns used when displaying completionsm with new
sv_compwidth function to call when value is set or unset
lib/readline/doc/{readline.3,rltech.texi}
- documented completion-display-width variable
4/23
----
execute_cmd.c
- change execute_in_subshell to reset trap handlers without freeing
the trap strings and set SUBSHELL_RESETTRAP. In line with Austin
Group interp #53 (trap in a subshell).
- ditto for execute_simple_command where it can be determined that
the shell is going to run a builtin or function in a subshell
trap.c
- new function, get_all_original_signals, retrieves the original
signal disposition for all signals
trap.h
- extern declaration for get_all_original_signals
builtins/trap.def
- change showtrap to display signals that are "hard ignored" as
trap commands to ignore them, even though that trap command would
be a no-op. Partial fix for feature request from Siddhesh
Poyarekar <siddhesh.poyarekar@gmail.com>
- change trap_builtin to call get_all_original_signals before displaying
traps. This will show inherited ignored signals. Rest of feature
request from Siddhesh Poyarekar <siddhesh.poyarekar@gmail.com>
lib/readline/histexpand.c
- fix history_tokenize_word so that it understands $(...) and the
<(...) and >(...) expansions as a single word
- change history_tokenize_word so that it understands extended shell
globbing patterns as a single word. Code is very similar to
$(...) code above. Bug reported by Rajeev V. Pillai
<rajeevvp@gmail.com>
+2 -7
View File
@@ -129,6 +129,7 @@ trap_builtin (list)
else if (display || list == 0)
{
initialize_terminating_signals ();
get_all_original_signals ();
return (sh_chkwrite (display_traps (list)));
}
else
@@ -245,19 +246,13 @@ showtrap (i)
char *t, *p, *sn;
p = trap_list[i];
#if 1
if (p == (char *)DEFAULT_SIG)
return;
t = (p == (char *)IGNORE_SIG) ? (char *)NULL : sh_single_quote (p);
#else
if (p == (char *)DEFAULT_SIG && signal_is_hard_ignored (i) == 0)
return;
else if (signal_is_hard_ignored (i))
t = (char *)NULL;
else
t = (p == (char *)IGNORE_SIG) ? (char *)NULL : sh_single_quote (p);
#endif
sn = signal_name (i);
/* Make sure that signals whose names are unknown (for whatever reason)
are printed as signal numbers. */
+1 -5
View File
@@ -245,17 +245,13 @@ showtrap (i)
char *t, *p, *sn;
p = trap_list[i];
#if 1
if (p == (char *)DEFAULT_SIG)
return;
#else
if (p == (char *)DEFAULT_SIG && signal_is_hard_ignored (i) == 0)
return;
else if (signal_is_hard_ignored (i))
t = (char *)NULL;
else
#endif
t = (p == (char *)IGNORE_SIG) ? (char *)NULL : sh_single_quote (p);
sn = signal_name (i);
/* Make sure that signals whose names are unknown (for whatever reason)
are printed as signal numbers. */
-9
View File
@@ -1390,15 +1390,11 @@ execute_in_subshell (command, asynchronous, pipe_in, pipe_out, fds_to_close)
reset_terminating_signals (); /* in sig.c */
/* Cancel traps, in trap.c. */
#if 0 /* XXX - bash-4.2 */
/* Reset the signal handlers in the child, but don't free the
trap strings. Set a flag noting that we have to free the
trap strings if we run trap to change a signal disposition. */
reset_signal_handlers ();
subshell_environment |= SUBSHELL_RESETTRAP;
#else
restore_original_signals ();
#endif
/* Make sure restore_original_signals doesn't undo the work done by
make_child to ensure that asynchronous children are immune to SIGINT
@@ -3812,16 +3808,11 @@ run_builtin:
if (already_forked)
{
/* reset_terminating_signals (); */ /* XXX */
#if 0 /* XXX - bash-4.2 */
/* Reset the signal handlers in the child, but don't free the
trap strings. Set a flag noting that we have to free the
trap strings if we run trap to change a signal disposition. */
reset_signal_handlers ();
subshell_environment |= SUBSHELL_RESETTRAP;
#else
/* Cancel traps, in trap.c. */
restore_original_signals ();
#endif
if (async)
{
+3
View File
@@ -4397,6 +4397,9 @@ execute_builtin_or_function (words, builtin, var, redirects,
cleanup_redirects (redirection_undo_list);
redirection_undo_list = (REDIRECT *)NULL;
dispose_exec_redirects ();
#if defined (PROCESS_SUBSTITUTION)
free (ofifo_list);
#endif
return (EX_REDIRFAIL); /* was EXECUTION_FAILURE */
}
+20
View File
@@ -1504,6 +1504,7 @@ static int sv_bell_style PARAMS((const char *));
static int sv_combegin PARAMS((const char *));
static int sv_dispprefix PARAMS((const char *));
static int sv_compquery PARAMS((const char *));
static int sv_compwidth PARAMS((const char *));
static int sv_editmode PARAMS((const char *));
static int sv_histsize PARAMS((const char *));
static int sv_isrchterm PARAMS((const char *));
@@ -1516,6 +1517,7 @@ static const struct {
} string_varlist[] = {
{ "bell-style", V_STRING, sv_bell_style },
{ "comment-begin", V_STRING, sv_combegin },
{ "completion-display-width", V_INT, sv_compwidth },
{ "completion-prefix-display-length", V_INT, sv_dispprefix },
{ "completion-query-items", V_INT, sv_compquery },
{ "editing-mode", V_STRING, sv_editmode },
@@ -1662,6 +1664,19 @@ sv_compquery (value)
return 0;
}
static int
sv_compwidth (value)
const char *value;
{
int nval = -1;
if (value && *value)
nval = atoi (value);
_rl_completion_columns = nval;
return 0;
}
static int
sv_histsize (value)
const char *value;
@@ -2268,6 +2283,11 @@ _rl_get_string_variable_value (name)
}
else if (_rl_stricmp (name, "comment-begin") == 0)
return (_rl_comment_begin ? _rl_comment_begin : RL_COMMENT_BEGIN_DEFAULT);
else if (_rl_stricmp (name, "completion-display-width") == 0)
{
sprintf (numbuf, "%d", _rl_completion_columns);
return (numbuf);
}
else if (_rl_stricmp (name, "completion-prefix-display-length") == 0)
{
sprintf (numbuf, "%d", _rl_completion_prefix_display_length);
+2385
View File
File diff suppressed because it is too large Load Diff
+31 -4
View File
@@ -122,6 +122,7 @@ static void insert_all_matches PARAMS((char **, int, char *));
static void display_matches PARAMS((char **));
static int compute_lcd_of_matches PARAMS((char **, int, const char *));
static int postprocess_matches PARAMS((char ***, int));
static int complete_get_screenwidth PARAMS((void));
static char *make_quoted_replacement PARAMS((char *, int, char *));
@@ -170,6 +171,10 @@ int _rl_match_hidden_files = 1;
display prefix replaced with an ellipsis. */
int _rl_completion_prefix_display_length = 0;
/* The readline-private number of screen columns to use when displaying
matches. If < 0 or > _rl_screenwidth, it is ignored. */
int _rl_completion_columns = -1;
/* Global variables available to applications using readline. */
#if defined (VISIBLE_STATS)
@@ -1325,6 +1330,23 @@ postprocess_matches (matchesp, matching_filenames)
return (1);
}
static int
complete_get_screenwidth ()
{
int cols;
char *envcols;
cols = _rl_completion_columns;
if (cols >= 0 && cols <= _rl_screenwidth)
return cols;
envcols = getenv ("COLUMNS");
if (envcols && *envcols)
cols = atoi (envcols);
if (cols >= 0 && cols <= _rl_screenwidth)
return cols;
return _rl_screenwidth;
}
/* A convenience function for displaying a list of strings in
columnar format on readline's output stream. MATCHES is the list
of strings, in argv format, LEN is the number of strings in MATCHES,
@@ -1334,7 +1356,7 @@ rl_display_match_list (matches, len, max)
char **matches;
int len, max;
{
int count, limit, printed_len, lines;
int count, limit, printed_len, lines, cols;
int i, j, k, l, common_length, sind;
char *temp, *t;
@@ -1355,12 +1377,17 @@ rl_display_match_list (matches, len, max)
}
/* How many items of MAX length can we fit in the screen window? */
cols = complete_get_screenwidth ();
max += 2;
limit = _rl_screenwidth / max;
if (limit != 1 && (limit * max == _rl_screenwidth))
limit = cols / max;
if (limit != 1 && (limit * max == cols))
limit--;
/* Avoid a possible floating exception. If max > _rl_screenwidth,
/* If cols == 0, limit will end up -1 */
if (cols < _rl_screenwidth && limit < 0)
limit = 1;
/* Avoid a possible floating exception. If max > cols,
limit will be 0 and a divide-by-zero fault will result. */
if (limit == 0)
limit = 1;
+32 -5
View File
@@ -122,6 +122,7 @@ static void insert_all_matches PARAMS((char **, int, char *));
static void display_matches PARAMS((char **));
static int compute_lcd_of_matches PARAMS((char **, int, const char *));
static int postprocess_matches PARAMS((char ***, int));
static int complete_get_screenwidth PARAMS((void));
static char *make_quoted_replacement PARAMS((char *, int, char *));
@@ -160,7 +161,7 @@ int _rl_completion_case_fold = 1;
int _rl_completion_case_fold;
#endif
/* If non-zero, don't match hidden files (filenames beginning with a `.' on
/* If zero, don't match hidden files (filenames beginning with a `.' on
Unix) when doing filename completion. */
int _rl_match_hidden_files = 1;
@@ -170,6 +171,10 @@ int _rl_match_hidden_files = 1;
display prefix replaced with an ellipsis. */
int _rl_completion_prefix_display_length = 0;
/* The readline-private number of screen columns to use when displaying
matches. If < 0 or > _rl_screenwidth, it is ignored. */
int _rl_completion_columns = 0;
/* Global variables available to applications using readline. */
#if defined (VISIBLE_STATS)
@@ -1325,6 +1330,23 @@ postprocess_matches (matchesp, matching_filenames)
return (1);
}
static int
complete_get_screenwidth ()
{
int cols;
char *envcols;
cols = _rl_completion_columns;
if (cols >= 0 && cols <= _rl_screenwidth)
return cols;
envcols = getenv ("COLUMNS");
if (envcols && *envcols)
cols = atoi (envcols);
if (cols >= 0 && cols <= _rl_screenwidth)
return cols;
return _rl_screenwidth;
}
/* A convenience function for displaying a list of strings in
columnar format on readline's output stream. MATCHES is the list
of strings, in argv format, LEN is the number of strings in MATCHES,
@@ -1334,7 +1356,7 @@ rl_display_match_list (matches, len, max)
char **matches;
int len, max;
{
int count, limit, printed_len, lines;
int count, limit, printed_len, lines, cols;
int i, j, k, l, common_length, sind;
char *temp, *t;
@@ -1355,12 +1377,17 @@ rl_display_match_list (matches, len, max)
}
/* How many items of MAX length can we fit in the screen window? */
cols = complete_get_screenwidth ();
max += 2;
limit = _rl_screenwidth / max;
if (limit != 1 && (limit * max == _rl_screenwidth))
limit = cols / max;
if (limit != 1 && (limit * max == cols))
limit--;
/* Avoid a possible floating exception. If max > _rl_screenwidth,
/* If cols == 0, limit will end up -1 */
if (cols < _rl_screenwidth && limit < 0)
limit = 1;
/* Avoid a possible floating exception. If max > cols,
limit will be 0 and a divide-by-zero fault will result. */
if (limit == 0)
limit = 1;
+16 -2
View File
@@ -6,9 +6,9 @@
.\" Case Western Reserve University
.\" chet@ins.CWRU.Edu
.\"
.\" Last Change: Sat Apr 17 23:46:04 EDT 2010
.\" Last Change: Thu Apr 22 18:59:21 EDT 2010
.\"
.TH READLINE 3 "2009 April 17" "GNU Readline 6.1"
.TH READLINE 3 "2009 April 22" "GNU Readline 6.1"
.\"
.\" File Name macro. This used to be `.PN', for Path Name,
.\" but Sun doesn't seem to like that very much.
@@ -360,6 +360,14 @@ This command is bound to
in emacs mode and to
.B #
in vi command mode.
.TP
.B completion\-display\-width (-1)
The number of screen columns used to display possible matches
when performing completion.
The value is ignored if it is less than 0 or greater than the terminal
screen width.
A value of 0 will cause matches to be displayed one per line.
The default value is -1.
.TP
.B completion\-ignore\-case (Off)
If set to \fBOn\fP, readline performs filename matching and completion
@@ -923,6 +931,12 @@ only attempts filename completion under certain circumstances.
.TP
.B possible\-completions (M\-?)
List the possible completions of the text before point.
When displaying completions, readline sets the number of columns used
for display to the value of \fBcompletion-display-width\fP, the value of
the environment variable
.SM
.BR COLUMNS ,
or the screen width, in that order.
.TP
.B insert\-completions (M\-*)
Insert all completions of the text before point
+12 -4
View File
@@ -6,9 +6,9 @@
.\" Case Western Reserve University
.\" chet@ins.CWRU.Edu
.\"
.\" Last Change: Fri Oct 9 12:57:27 EDT 2009
.\" Last Change: Thu Apr 22 18:59:21 EDT 2010
.\"
.TH READLINE 3 "2009 October 9" "GNU Readline 6.1"
.TH READLINE 3 "2009 April 22" "GNU Readline 6.1"
.\"
.\" File Name macro. This used to be `.PN', for Path Name,
.\" but Sun doesn't seem to like that very much.
@@ -34,8 +34,8 @@ readline \- get a line from a user with editing
\fBreadline\fP (\fIconst char *prompt\fP);
.fi
.SH COPYRIGHT
.if n Readline is Copyright (C) 1989\-2009 Free Software Foundation, Inc.
.if t Readline is Copyright \(co 1989\-2009 Free Software Foundation, Inc.
.if n Readline is Copyright (C) 1989\-2010 Free Software Foundation, Inc.
.if t Readline is Copyright \(co 1989\-2010 Free Software Foundation, Inc.
.SH DESCRIPTION
.LP
.B readline
@@ -360,6 +360,14 @@ This command is bound to
in emacs mode and to
.B #
in vi command mode.
.TP
.B completion\-display\-width (-1)
The number of screen columns used to display possible matches
when performing completion.
The value is ignored if it is less than 0 or greater than the terminal
screen width.
A value of 0 will cause matches to be displayed one per line.
The default value is -1.
.TP
.B completion\-ignore\-case (Off)
If set to \fBOn\fP, readline performs filename matching and completion
+3
View File
@@ -1157,6 +1157,9 @@ of strings, in argv format, such as a list of completion matches.
is the length of the longest string in @code{matches}. This function uses
the setting of @code{print-completions-horizontally} to select how the
matches are displayed (@pxref{Readline Init File Syntax}).
When displaying completions, this function sets the number of columns used
for display to the value of @code{completion-display-width}, the value of
the environment variable @env{COLUMNS}, or the screen width, in that order.
@end deftypefun
The following are implemented as macros, defined in @code{chardefs.h}.
File diff suppressed because it is too large Load Diff
+13
View File
@@ -431,7 +431,17 @@ The string to insert at the beginning of the line when the
@code{insert-comment} command is executed. The default value
is @code{"#"}.
@item completion-display-width
@vindex completion-display-width
The number of screen columns used to display possible matches
when performing completion.
The value is ignored if it is less than 0 or greater than the terminal
screen width.
A value of 0 will cause matches to be displayed one per line.
The default value is -1.
@item completion-ignore-case
@vindex completion-ignore-case
If set to @samp{on}, Readline performs filename matching and completion
in a case-insensitive fashion.
The default value is @samp{off}.
@@ -1299,6 +1309,9 @@ The default is filename completion.
@item possible-completions (M-?)
List the possible completions of the text before point.
When displaying completions, Readline sets the number of columns used
for display to the value of @code{completion-display-width}, the value of
the environment variable @env{COLUMNS}, or the screen width, in that order.
@item insert-completions (M-*)
Insert all completions of the text before point that would have
+14 -1
View File
@@ -431,7 +431,17 @@ The string to insert at the beginning of the line when the
@code{insert-comment} command is executed. The default value
is @code{"#"}.
@item completion-display-width
@vindex completion-display-width
The number of screen columns used to display possible matches
when performing completion.
The value is ignored if it is less than 0 or greater than the terminal
screen width.
A value of 0 will cause matches to be displayed one per line.
The default value is -1.
@item completion-ignore-case
@vindex completion-ignore-case
If set to @samp{on}, Readline performs filename matching and completion
in a case-insensitive fashion.
The default value is @samp{off}.
@@ -1299,6 +1309,9 @@ The default is filename completion.
@item possible-completions (M-?)
List the possible completions of the text before point.
When displaying completions, Readline sets the number of columns used
for display to the value of @code{completion-display-width}, the value of
the environment variable @env{COLUMNS}, or the screen width, in that order.
@item insert-completions (M-*)
Insert all completions of the text before point that would have
@@ -1580,7 +1593,7 @@ editing mode.
While the Readline library does not have a full set of @code{vi}
editing functions, it does contain enough to allow simple editing
of the line. The Readline @code{vi} mode behaves as specified in
the @sc{posix} 1003.2 standard.
the @sc{posix} standard.
@ifset BashFeatures
In order to switch interactively between @code{emacs} and @code{vi}
+2 -2
View File
@@ -4,7 +4,7 @@ Copyright (C) 1988-2010 Free Software Foundation, Inc.
@set EDITION 6.1
@set VERSION 6.1
@set UPDATED April 17 2010
@set UPDATED April 22 2010
@set UPDATED-MONTH April 2010
@set LASTCHANGE Sat Apr 17 23:45:29 EDT 2010
@set LASTCHANGE Thu Apr 22 18:59:44 EDT 2010
+1 -9
View File
@@ -1452,14 +1452,10 @@ history_tokenize_word (string, ind)
(peek == '(' && string[i] == '$')) /*)*/
{
i += 2;
#if 0 /* XXX - bash-4.2 -- rajeevvp@gmail.com */
delimopen = '(';
delimiter = ')';
nestdelim = 1;
goto get_word;
#else
return i;
#endif
}
#if 0
else if (peek == '\'' && string[i] == '$')
@@ -1476,8 +1472,7 @@ history_tokenize_word (string, ind)
}
}
#if 0
/* XXX - can also use this for $(...) -- bash-4.2 -- rajeevvp@gmail.com */
/* same code also used for $(...)/<(...)/>(...) above */
if (member (string[i], "!@?+*"))
{
int peek = string[i + 1];
@@ -1491,7 +1486,6 @@ history_tokenize_word (string, ind)
nestdelim = 1;
}
}
#endif
get_word:
/* Get word from string + i; */
@@ -1514,7 +1508,6 @@ get_word:
continue;
}
#if 0 /* XXX - bash-4.2 -- rajeevvp@gmail.com */
/* delimiter must be set and set to something other than a quote if
nestdelim is set, so these tests are safe. */
if (nestdelim && string[i] == delimopen)
@@ -1529,7 +1522,6 @@ get_word:
delimiter = 0;
continue;
}
#endif
if (delimiter && string[i] == delimiter)
{
File diff suppressed because it is too large Load Diff
+1
View File
@@ -385,6 +385,7 @@ extern int _rl_complete_show_unmodified;
extern int _rl_complete_mark_directories;
extern int _rl_complete_mark_symlink_dirs;
extern int _rl_completion_prefix_display_length;
extern int _rl_completion_columns;
extern int _rl_print_completions_horizontally;
extern int _rl_completion_case_fold;
extern int _rl_match_hidden_files;
+475
View File
@@ -0,0 +1,475 @@
/* rlprivate.h -- functions and variables global to the readline library,
but not intended for use by applications. */
/* Copyright (C) 1999-2009 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.
Readline 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.
Readline 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 Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined (_RL_PRIVATE_H_)
#define _RL_PRIVATE_H_
#include "rlconf.h" /* for VISIBLE_STATS */
#include "rlstdc.h"
#include "posixjmp.h" /* defines procenv_t */
/*************************************************************************
* *
* Convenience definitions *
* *
*************************************************************************/
#define EMACS_MODE() (rl_editing_mode == emacs_mode)
#define VI_COMMAND_MODE() (rl_editing_mode == vi_mode && _rl_keymap == vi_movement_keymap)
#define VI_INSERT_MODE() (rl_editing_mode == vi_mode && _rl_keymap == vi_insertion_keymap)
#define RL_CHECK_SIGNALS() \
do { \
if (_rl_caught_signal) _rl_signal_handler (_rl_caught_signal); \
} while (0)
/*************************************************************************
* *
* Global structs undocumented in texinfo manual and not in readline.h *
* *
*************************************************************************/
/* search types */
#define RL_SEARCH_ISEARCH 0x01 /* incremental search */
#define RL_SEARCH_NSEARCH 0x02 /* non-incremental search */
#define RL_SEARCH_CSEARCH 0x04 /* intra-line char search */
/* search flags */
#define SF_REVERSE 0x01
#define SF_FOUND 0x02
#define SF_FAILED 0x04
typedef struct __rl_search_context
{
int type;
int sflags;
char *search_string;
int search_string_index;
int search_string_size;
char **lines;
char *allocated_line;
int hlen;
int hindex;
int save_point;
int save_mark;
int save_line;
int last_found_line;
char *prev_line_found;
UNDO_LIST *save_undo_list;
int history_pos;
int direction;
int lastc;
#if defined (HANDLE_MULTIBYTE)
char mb[MB_LEN_MAX];
#endif
char *sline;
int sline_len;
int sline_index;
char *search_terminators;
} _rl_search_cxt;
/* Callback data for reading numeric arguments */
#define NUM_SAWMINUS 0x01
#define NUM_SAWDIGITS 0x02
#define NUM_READONE 0x04
typedef int _rl_arg_cxt;
/* A context for reading key sequences longer than a single character when
using the callback interface. */
#define KSEQ_DISPATCHED 0x01
#define KSEQ_SUBSEQ 0x02
#define KSEQ_RECURSIVE 0x04
typedef struct __rl_keyseq_context
{
int flags;
int subseq_arg;
int subseq_retval; /* XXX */
Keymap dmap;
Keymap oldmap;
int okey;
struct __rl_keyseq_context *ocxt;
int childval;
} _rl_keyseq_cxt;
/* fill in more as needed */
/* `Generic' callback data and functions */
typedef struct __rl_callback_generic_arg
{
int count;
int i1, i2;
/* add here as needed */
} _rl_callback_generic_arg;
typedef int _rl_callback_func_t PARAMS((_rl_callback_generic_arg *));
/*************************************************************************
* *
* Global functions undocumented in texinfo manual and not in readline.h *
* *
*************************************************************************/
/*************************************************************************
* *
* Global variables undocumented in texinfo manual and not in readline.h *
* *
*************************************************************************/
/* complete.c */
extern int rl_complete_with_tilde_expansion;
#if defined (VISIBLE_STATS)
extern int rl_visible_stats;
#endif /* VISIBLE_STATS */
/* readline.c */
extern int rl_line_buffer_len;
extern int rl_arg_sign;
extern int rl_visible_prompt_length;
extern int rl_key_sequence_length;
extern int rl_byte_oriented;
/* display.c */
extern int rl_display_fixed;
/* parens.c */
extern int rl_blink_matching_paren;
/*************************************************************************
* *
* Global functions and variables unsed and undocumented *
* *
*************************************************************************/
/* kill.c */
extern int rl_set_retained_kills PARAMS((int));
/* terminal.c */
extern void _rl_set_screen_size PARAMS((int, int));
/* undo.c */
extern int _rl_fix_last_undo_of_type PARAMS((int, int, int));
/* util.c */
extern char *_rl_savestring PARAMS((const char *));
/*************************************************************************
* *
* Functions and variables private to the readline library *
* *
*************************************************************************/
/* NOTE: Functions and variables prefixed with `_rl_' are
pseudo-global: they are global so they can be shared
between files in the readline library, but are not intended
to be visible to readline callers. */
/*************************************************************************
* Undocumented private functions *
*************************************************************************/
#if defined(READLINE_CALLBACKS)
/* readline.c */
extern void readline_internal_setup PARAMS((void));
extern char *readline_internal_teardown PARAMS((int));
extern int readline_internal_char PARAMS((void));
extern _rl_keyseq_cxt *_rl_keyseq_cxt_alloc PARAMS((void));
extern void _rl_keyseq_cxt_dispose PARAMS((_rl_keyseq_cxt *));
extern void _rl_keyseq_chain_dispose PARAMS((void));
extern int _rl_dispatch_callback PARAMS((_rl_keyseq_cxt *));
/* callback.c */
extern _rl_callback_generic_arg *_rl_callback_data_alloc PARAMS((int));
extern void _rl_callback_data_dispose PARAMS((_rl_callback_generic_arg *));
#endif /* READLINE_CALLBACKS */
/* bind.c */
/* complete.c */
extern void _rl_reset_completion_state PARAMS((void));
extern char _rl_find_completion_word PARAMS((int *, int *));
extern void _rl_free_match_list PARAMS((char **));
/* display.c */
extern char *_rl_strip_prompt PARAMS((char *));
extern void _rl_move_cursor_relative PARAMS((int, const char *));
extern void _rl_move_vert PARAMS((int));
extern void _rl_save_prompt PARAMS((void));
extern void _rl_restore_prompt PARAMS((void));
extern char *_rl_make_prompt_for_search PARAMS((int));
extern void _rl_erase_at_end_of_line PARAMS((int));
extern void _rl_clear_to_eol PARAMS((int));
extern void _rl_clear_screen PARAMS((void));
extern void _rl_update_final PARAMS((void));
extern void _rl_redisplay_after_sigwinch PARAMS((void));
extern void _rl_clean_up_for_exit PARAMS((void));
extern void _rl_erase_entire_line PARAMS((void));
extern int _rl_current_display_line PARAMS((void));
/* input.c */
extern int _rl_any_typein PARAMS((void));
extern int _rl_input_available PARAMS((void));
extern int _rl_input_queued PARAMS((int));
extern void _rl_insert_typein PARAMS((int));
extern int _rl_unget_char PARAMS((int));
extern int _rl_pushed_input_available PARAMS((void));
/* isearch.c */
extern _rl_search_cxt *_rl_scxt_alloc PARAMS((int, int));
extern void _rl_scxt_dispose PARAMS((_rl_search_cxt *, int));
extern int _rl_isearch_dispatch PARAMS((_rl_search_cxt *, int));
extern int _rl_isearch_callback PARAMS((_rl_search_cxt *));
extern int _rl_search_getchar PARAMS((_rl_search_cxt *));
/* macro.c */
extern void _rl_with_macro_input PARAMS((char *));
extern int _rl_next_macro_key PARAMS((void));
extern void _rl_push_executing_macro PARAMS((void));
extern void _rl_pop_executing_macro PARAMS((void));
extern void _rl_add_macro_char PARAMS((int));
extern void _rl_kill_kbd_macro PARAMS((void));
/* misc.c */
extern int _rl_arg_overflow PARAMS((void));
extern void _rl_arg_init PARAMS((void));
extern int _rl_arg_getchar PARAMS((void));
extern int _rl_arg_callback PARAMS((_rl_arg_cxt));
extern void _rl_reset_argument PARAMS((void));
extern void _rl_start_using_history PARAMS((void));
extern int _rl_free_saved_history_line PARAMS((void));
extern void _rl_set_insert_mode PARAMS((int, int));
extern void _rl_revert_all_lines PARAMS((void));
/* nls.c */
extern int _rl_init_eightbit PARAMS((void));
/* parens.c */
extern void _rl_enable_paren_matching PARAMS((int));
/* readline.c */
extern void _rl_init_line_state PARAMS((void));
extern void _rl_set_the_line PARAMS((void));
extern int _rl_dispatch PARAMS((int, Keymap));
extern int _rl_dispatch_subseq PARAMS((int, Keymap, int));
extern void _rl_internal_char_cleanup PARAMS((void));
/* rltty.c */
extern int _rl_disable_tty_signals PARAMS((void));
extern int _rl_restore_tty_signals PARAMS((void));
/* search.c */
extern int _rl_nsearch_callback PARAMS((_rl_search_cxt *));
/* signals.c */
extern void _rl_signal_handler PARAMS((int));
extern void _rl_block_sigint PARAMS((void));
extern void _rl_release_sigint PARAMS((void));
extern void _rl_block_sigwinch PARAMS((void));
extern void _rl_release_sigwinch PARAMS((void));
/* terminal.c */
extern void _rl_get_screen_size PARAMS((int, int));
extern int _rl_init_terminal_io PARAMS((const char *));
#ifdef _MINIX
extern void _rl_output_character_function PARAMS((int));
#else
extern int _rl_output_character_function PARAMS((int));
#endif
extern void _rl_output_some_chars PARAMS((const char *, int));
extern int _rl_backspace PARAMS((int));
extern void _rl_enable_meta_key PARAMS((void));
extern void _rl_control_keypad PARAMS((int));
extern void _rl_set_cursor PARAMS((int, int));
/* text.c */
extern void _rl_fix_point PARAMS((int));
extern int _rl_replace_text PARAMS((const char *, int, int));
extern int _rl_insert_char PARAMS((int, int));
extern int _rl_overwrite_char PARAMS((int, int));
extern int _rl_overwrite_rubout PARAMS((int, int));
extern int _rl_rubout_char PARAMS((int, int));
#if defined (HANDLE_MULTIBYTE)
extern int _rl_char_search_internal PARAMS((int, int, char *, int));
#else
extern int _rl_char_search_internal PARAMS((int, int, int));
#endif
extern int _rl_set_mark_at_pos PARAMS((int));
/* undo.c */
extern UNDO_LIST *_rl_copy_undo_entry PARAMS((UNDO_LIST *));
extern UNDO_LIST *_rl_copy_undo_list PARAMS((UNDO_LIST *));
/* util.c */
#if defined (USE_VARARGS) && defined (PREFER_STDARG)
extern void _rl_ttymsg (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
extern void _rl_errmsg (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
extern void _rl_trace (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
#else
extern void _rl_ttymsg ();
extern void _rl_errmsg ();
extern void _rl_trace ();
#endif
extern int _rl_tropen PARAMS((void));
extern int _rl_abort_internal PARAMS((void));
extern int _rl_null_function PARAMS((int, int));
extern char *_rl_strindex PARAMS((const char *, const char *));
extern int _rl_qsort_string_compare PARAMS((char **, char **));
extern int (_rl_uppercase_p) PARAMS((int));
extern int (_rl_lowercase_p) PARAMS((int));
extern int (_rl_pure_alphabetic) PARAMS((int));
extern int (_rl_digit_p) PARAMS((int));
extern int (_rl_to_lower) PARAMS((int));
extern int (_rl_to_upper) PARAMS((int));
extern int (_rl_digit_value) PARAMS((int));
/* vi_mode.c */
extern void _rl_vi_initialize_line PARAMS((void));
extern void _rl_vi_reset_last PARAMS((void));
extern void _rl_vi_set_last PARAMS((int, int, int));
extern int _rl_vi_textmod_command PARAMS((int));
extern void _rl_vi_done_inserting PARAMS((void));
/*************************************************************************
* Undocumented private variables *
*************************************************************************/
/* bind.c */
extern const char * const _rl_possible_control_prefixes[];
extern const char * const _rl_possible_meta_prefixes[];
/* callback.c */
extern _rl_callback_func_t *_rl_callback_func;
extern _rl_callback_generic_arg *_rl_callback_data;
/* complete.c */
extern int _rl_complete_show_all;
extern int _rl_complete_show_unmodified;
extern int _rl_complete_mark_directories;
extern int _rl_complete_mark_symlink_dirs;
extern int _rl_completion_prefix_display_length;
extern int _rl_print_completions_horizontally;
extern int _rl_completion_case_fold;
extern int _rl_match_hidden_files;
extern int _rl_page_completions;
extern int _rl_skip_completed_text;
/* display.c */
extern int _rl_vis_botlin;
extern int _rl_last_c_pos;
extern int _rl_suppress_redisplay;
extern int _rl_want_redisplay;
/* isearch.c */
extern char *_rl_isearch_terminators;
extern _rl_search_cxt *_rl_iscxt;
/* macro.c */
extern char *_rl_executing_macro;
/* misc.c */
extern int _rl_history_preserve_point;
extern int _rl_history_saved_point;
extern _rl_arg_cxt _rl_argcxt;
/* readline.c */
extern int _rl_echoing_p;
extern int _rl_horizontal_scroll_mode;
extern int _rl_mark_modified_lines;
extern int _rl_bell_preference;
extern int _rl_meta_flag;
extern int _rl_convert_meta_chars_to_ascii;
extern int _rl_output_meta_chars;
extern int _rl_bind_stty_chars;
extern int _rl_revert_all_at_newline;
extern int _rl_echo_control_chars;
extern char *_rl_comment_begin;
extern unsigned char _rl_parsing_conditionalized_out;
extern Keymap _rl_keymap;
extern FILE *_rl_in_stream;
extern FILE *_rl_out_stream;
extern int _rl_last_command_was_kill;
extern int _rl_eof_char;
extern procenv_t _rl_top_level;
extern _rl_keyseq_cxt *_rl_kscxt;
/* search.c */
extern _rl_search_cxt *_rl_nscxt;
/* signals.c */
extern int _rl_interrupt_immediately;
extern int volatile _rl_caught_signal;
extern int _rl_echoctl;
extern int _rl_intr_char;
extern int _rl_quit_char;
extern int _rl_susp_char;
/* terminal.c */
extern int _rl_enable_keypad;
extern int _rl_enable_meta;
extern char *_rl_term_clreol;
extern char *_rl_term_clrpag;
extern char *_rl_term_im;
extern char *_rl_term_ic;
extern char *_rl_term_ei;
extern char *_rl_term_DC;
extern char *_rl_term_up;
extern char *_rl_term_dc;
extern char *_rl_term_cr;
extern char *_rl_term_IC;
extern char *_rl_term_forward_char;
extern int _rl_screenheight;
extern int _rl_screenwidth;
extern int _rl_screenchars;
extern int _rl_terminal_can_insert;
extern int _rl_term_autowrap;
/* undo.c */
extern int _rl_doing_an_undo;
extern int _rl_undo_group_level;
/* vi_mode.c */
extern int _rl_vi_last_command;
#endif /* _RL_PRIVATE_H_ */
+3
View File
@@ -1495,6 +1495,9 @@ _rl_char_search_internal (count, dir, schar)
int prepos;
#endif
if (dir == 0)
return -1;
pos = rl_point;
inc = (dir < 0) ? -1 : 1;
while (count)
+1679
View File
File diff suppressed because it is too large Load Diff
+12 -1
View File
@@ -1317,7 +1317,18 @@ rl_vi_char_search (count, key)
#endif
if (key == ';' || key == ',')
_rl_cs_dir = (key == ';') ? _rl_cs_orig_dir : -_rl_cs_orig_dir;
{
if (_rl_cs_orig_dir == 0)
return -1;
#if defined (HANDLE_MULTIBYTE)
if (_rl_vi_last_search_mblen == 0)
return -1;
#else
if (_rl_vi_last_search_char == 0)
return -1;
#endif
_rl_cs_dir = (key == ';') ? _rl_cs_orig_dir : -_rl_cs_orig_dir;
}
else
{
switch (key)
File diff suppressed because it is too large Load Diff
+452 -759
View File
File diff suppressed because it is too large Load Diff
-8
View File
@@ -4677,25 +4677,17 @@ close_new_fifos (list, lsize)
if (list == 0)
{
itrace("close_new_fifos: list == 0, calling unlink_fifo_list");
unlink_fifo_list ();
return;
}
for (i = 0; i < lsize; i++)
if (list[i] == 0 && i < fifo_list_size && fifo_list[i].proc != -1)
{
itrace("close_new_fifos: closing %d", i);
unlink_fifo (i);
}
for (i = lsize; i < fifo_list_size; i++)
{
if (fifo_list[i].proc != -1)
itrace("close_new_fifos: closing %d", i);
unlink_fifo (i);
}
}
int
fifos_pending ()
+9
View File
@@ -607,6 +607,15 @@ get_original_signal (sig)
GETORIGSIG (sig);
}
void
get_all_original_signals ()
{
register int i;
for (i = 1; i < NSIG; i++)
GET_ORIGINAL_SIGNAL (i);
}
void
set_original_signal (sig, handler)
int sig;
+4 -2
View File
@@ -952,7 +952,8 @@ free_trap_string (sig)
sigmodes[sig] &= ~SIG_TRAPPED;
}
/* Reset the handler for SIG to the original value. */
/* Reset the handler for SIG to the original value but leave the trap string
in place. */
static void
reset_signal (sig)
int sig;
@@ -1017,7 +1018,8 @@ reset_or_restore_signal_handlers (reset)
}
/* Reset trapped signals to their original values, but don't free the
trap strings. Called by the command substitution code. */
trap strings. Called by the command substitution code and other places
that create a "subshell environment". */
void
reset_signal_handlers ()
{
+2
View File
@@ -88,6 +88,8 @@ extern void free_trap_strings __P((void));
extern void reset_signal_handlers __P((void));
extern void restore_original_signals __P((void));
extern void get_all_original_signals __P((void));
extern char *signal_name __P((int));
extern int decode_signal __P((char *, int));
+2 -1
View File
@@ -93,9 +93,10 @@ extern char *signal_name __P((int));
extern int decode_signal __P((char *, int));
extern void run_interrupt_trap __P((void));
extern int maybe_call_trap_handler __P((int));
extern int signal_is_special __P((int));
extern int signal_is_trapped __P((int));
extern int signal_is_ignored __P((int));
extern int signal_is_special __P((int));
extern int signal_is_hard_ignored __P((int));
extern void set_signal_ignored __P((int));
extern int signal_in_progress __P((int));