commit bash-20171226 snapshot

This commit is contained in:
Chet Ramey
2018-01-02 10:53:02 -05:00
parent 2e41257453
commit ce0469bfbe
11 changed files with 159 additions and 18 deletions
+10
View File
@@ -862,6 +862,16 @@ fprintf(stderr, "extmatch: flags = %d\n", flags);
if (pnext == prest)
break;
}
#if 0 /* NOTYET */
/* Report from Eric Cook <llua@gmx.com> 12/29/2017 */
/* If nothing matched, but the string starts with a period and we
need to match periods explicitly, don't return this as a match,
even for negation. */
if (m1 == 0 && *s == '.' && (flags & FNM_PERIOD))
return (FNM_NOMATCH);
#endif
/* if srest > s, we are not at start of string */
xflags = (srest > s) ? (flags & ~FNM_PERIOD) : flags;
if (m1 == 0 && GMATCH (srest, se, prest, pe, NULL, xflags) == 0)
+66 -1
View File
@@ -87,6 +87,9 @@ static int glean_key_from_name PARAMS((char *));
static int find_boolean_var PARAMS((const char *));
static int find_string_var PARAMS((const char *));
static const char *boolean_varname PARAMS((int));
static const char *string_varname PARAMS((int));
static char *_rl_get_string_variable_value PARAMS((const char *));
static int substring_member_of_array PARAMS((const char *, const char * const *));
@@ -103,6 +106,7 @@ static int _rl_prefer_visible_bell = 1;
#define OP_LE 6
#define OPSTART(c) ((c) == '=' || (c) == '!' || (c) == '<' || (c) == '>')
#define CMPSTART(c) ((c) == '=' || (c) == '!')
/* **************************************************************** */
/* */
@@ -1100,7 +1104,9 @@ static int if_stack_size;
static int
parser_if (char *args)
{
int i, llen;
int i, llen, boolvar, strvar;
boolvar = strvar = -1;
/* Push parser state. */
if (if_stack_depth + 1 >= if_stack_size)
@@ -1246,6 +1252,53 @@ parser_if (char *args)
value stored in rl_readline_name. */
else if (_rl_stricmp (args, rl_readline_name) == 0)
_rl_parsing_conditionalized_out = 0;
else if ((boolvar = find_boolean_var (args)) >= 0 || (strvar = find_string_var (args)) >= 0)
{
int op, previ;
size_t vlen;
const char *vname;
char *valuearg, *vval, prevc;
_rl_parsing_conditionalized_out = 1;
vname = (boolvar >= 0) ? boolean_varname (boolvar) : string_varname (strvar);
vlen = strlen (vname);
if (i > 0 && i <= llen && args[i-1] == '\0')
args[i-1] = ' ';
args[llen] = '\0'; /* just in case */
for (i = vlen; whitespace (args[i]); i++)
;
if (CMPSTART(args[i]) == 0)
{
_rl_init_file_error ("equality comparison operator expected, found `%s'", args[i] ? args + i : "end-of-line");
return 0;
}
previ = i;
op = parse_comparison_op (args, &i);
if (op != OP_EQ && op != OP_NE)
{
_rl_init_file_error ("equality comparison operator expected, found `%s'", args+previ);
return 0;
}
for ( ; args[i] && whitespace (args[i]); i++)
;
if (args[i] == 0)
{
_rl_init_file_error ("argument expected, found `%s'", args+i);
return 0;
}
previ = i;
valuearg = args + i;
for ( ; args[i] && whitespace (args[i]) == 0; i++)
;
prevc = args[i];
args[i] = '\0'; /* null-terminate valuearg */
vval = rl_variable_value (vname);
if (op == OP_EQ)
_rl_parsing_conditionalized_out = _rl_stricmp (vval, valuearg) != 0;
else if (op == OP_NE)
_rl_parsing_conditionalized_out = _rl_stricmp (vval, valuearg) == 0;
args[i] = prevc;
}
else
_rl_parsing_conditionalized_out = 1;
return 0;
@@ -1722,6 +1775,12 @@ find_boolean_var (const char *name)
return -1;
}
static const char *
boolean_varname (int i)
{
return ((i >= 0) ? boolean_varlist[i].name : (char *)NULL);
}
/* Hooks for handling special boolean variables, where a
function needs to be called or another variable needs
to be changed when they're changed. */
@@ -1805,6 +1864,12 @@ find_string_var (const char *name)
return -1;
}
static const char *
string_varname (int i)
{
return ((i >= 0) ? string_varlist[i].name : (char *)NULL);
}
/* A boolean value that can appear in a `set variable' command is true if
the value is null or empty, `on' (case-insensitive), or "1". Any other
values result in 0 (false). */
+16 -4
View File
@@ -6,9 +6,9 @@
.\" Case Western Reserve University
.\" chet.ramey@case.edu
.\"
.\" Last Change: Thu Dec 14 11:44:43 EST 2017
.\" Last Change: Thu Dec 28 14:49:51 EST 2017
.\"
.TH READLINE 3 "2017 December 14" "GNU Readline 7.0"
.TH READLINE 3 "2017 December 28" "GNU Readline 7.0"
.\"
.\" File Name macro. This used to be `.PN', for Path Name,
.\" but Sun doesn't seem to like that very much.
@@ -643,8 +643,9 @@ The
.B $if
construct allows bindings to be made based on the
editing mode, the terminal being used, or the application using
readline. The text of the test extends to the end of the line;
no characters are required to isolate it.
readline. The text of the test, after any comparison operator,
extends to the end of the line;
unless otherwise noted, no characters are required to isolate it.
.RS
.IP \fBmode\fP
The \fBmode=\fP form of the \fB$if\fP directive is used to test
@@ -684,6 +685,8 @@ The version number supplied on the right side of the operator consists
of a major version number, an optional decimal point, and an optional
minor version (e.g., \fB7.1\fP). If the minor version is omitted, it
is assumed to be \fB0\fP.
The operator may be separated from the string \fBversion\fP
and from the version number argument by whitespace.
.IP \fBapplication\fP
The \fBapplication\fP construct is used to include
application-specific settings. Each program using the readline
@@ -701,6 +704,15 @@ key sequence that quotes the current or previous word in \fBbash\fP:
\fB$endif\fP
.fi
.RE
.IP \fIvariable\fP
The \fIvariable\fP construct provides simple equality tests for readline
variables and values.
The permitted comparison operators are \fI=\fP, \fI==\fP, and \fI!=\fP.
The variable name must be separated from the comparison operator by
whitespace; the operator may be separated from the value on the right hand
side by whitespace.
Both string and boolean variables may be tested. Boolean variables must be
tested against the values \fIon\fP and \fIoff\fP.
.RE
.IP \fB$endif\fP
This command, as seen in the previous example, terminates an
+23 -2
View File
@@ -917,8 +917,9 @@ of tests. There are four parser directives used.
@item $if
The @code{$if} construct allows bindings to be made based on the
editing mode, the terminal being used, or the application using
Readline. The text of the test extends to the end of the line;
no characters are required to isolate it.
Readline. The text of the test, after any comparison operator,
extends to the end of the line;
unless otherwise noted, no characters are required to isolate it.
@table @code
@item mode
@@ -949,6 +950,8 @@ The version number supplied on the right side of the operator consists
of a major version number, an optional decimal point, and an optional
minor version (e.g., @samp{7.1}). If the minor version is omitted, it
is assumed to be @samp{0}.
The operator may be separated from the string @code{version} and
from the version number argument by whitespace.
The following example sets a variable if the Readline version being used
is 7.0 or newer:
@example
@@ -956,6 +959,7 @@ $if version >= 7.0
set show-mode-in-prompt on
$endif
@end example
@item application
The @var{application} construct is used to include
application-specific settings. Each program using the Readline
@@ -970,6 +974,23 @@ $if Bash
"\C-xq": "\eb\"\ef\""
$endif
@end example
@item variable
The @var{variable} construct provides simple equality tests for Readline
variables and values.
The permitted comparison operators are @samp{=}, @samp{==}, and @samp{!=}.
The variable name must be separated from the comparison operator by
whitespace; the operator may be separated from the value on the right hand
side by whitespace.
Both string and boolean variables may be tested. Boolean variables must be
tested against the values @var{on} and @var{off}.
The following example is equivalent to the @code{mode=emacs} test described
above:
@example
$if editing-mode == emacs
set show-mode-in-prompt on
$endif
@end example
@end table
@item $endif
+2 -2
View File
@@ -4,7 +4,7 @@ Copyright (C) 1988-2017 Free Software Foundation, Inc.
@set EDITION 7.0
@set VERSION 7.0
@set UPDATED 14 December 2017
@set UPDATED 28 December 2017
@set UPDATED-MONTH December 2017
@set LASTCHANGE Thu Dec 14 11:43:43 EST 2017
@set LASTCHANGE Thu Dec 28 14:44:16 EST 2017
+1
View File
@@ -538,6 +538,7 @@ extern int _rl_enable_keypad;
extern int _rl_enable_meta;
extern char *_rl_term_clreol;
extern char *_rl_term_clrpag;
extern char *_rl_term_clrscroll;
extern char *_rl_term_im;
extern char *_rl_term_ic;
extern char *_rl_term_ei;
+4 -2
View File
@@ -112,6 +112,7 @@ char PC, *BC, *UP;
/* Some strings to control terminal actions. These are output by tputs (). */
char *_rl_term_clreol;
char *_rl_term_clrpag;
char *_rl_term_clrscroll;
char *_rl_term_cr;
char *_rl_term_backspace;
char *_rl_term_goto;
@@ -385,6 +386,7 @@ static const struct _tc_string tc_strings[] =
{
{ "@7", &_rl_term_at7 },
{ "DC", &_rl_term_DC },
{ "E3", &_rl_term_clrscroll },
{ "IC", &_rl_term_IC },
{ "ce", &_rl_term_clreol },
{ "cl", &_rl_term_clrpag },
@@ -438,7 +440,7 @@ _rl_init_terminal_io (const char *terminal_name)
int tty, tgetent_ret;
term = terminal_name ? terminal_name : sh_get_env_value ("TERM");
_rl_term_clrpag = _rl_term_cr = _rl_term_clreol = (char *)NULL;
_rl_term_clrpag = _rl_term_cr = _rl_term_clreol = _rl_term_clrscroll = (char *)NULL;
tty = rl_instream ? fileno (rl_instream) : 0;
if (term == 0)
@@ -451,7 +453,7 @@ _rl_init_terminal_io (const char *terminal_name)
_rl_term_mm = _rl_term_mo = (char *)NULL;
_rl_terminal_can_insert = term_has_meta = _rl_term_autowrap = 0;
_rl_term_cr = "\r";
_rl_term_clreol = _rl_term_clrpag = _rl_term_backspace = (char *)NULL;
_rl_term_backspace = (char *)NULL;
_rl_term_goto = _rl_term_pc = _rl_term_ip = (char *)NULL;
_rl_term_ks = _rl_term_ke =_rl_term_vs = _rl_term_ve = (char *)NULL;
_rl_term_kh = _rl_term_kH = _rl_term_at7 = _rl_term_kI = (char *)NULL;