commit bash-20160226 snapshot

This commit is contained in:
Chet Ramey
2016-03-01 16:44:33 -05:00
parent 9c94505d46
commit ccb4014f23
18 changed files with 2554 additions and 47 deletions
+87
View File
@@ -10457,3 +10457,90 @@ builtins/shopt.def
sure to call any set functions associated with a variable, instead
of just setting the value to 1. Report and fix from
Vehlow, Jörg <Joerg.Vehlow@kratzer-automation.com>
2/22
----
lib/readline/complete.c
- rl_display_match_list: don't bother calling strrchr to check the
return value from printable_part() if rl_filename_completion_desired
is non-zero, since in that case printable_part just returns its
argument. Fixes git completion issue reported by
Dilyan Palauzov <dilyan.palauzov@aegee.org>
- _rl_colored_completion_prefix: default is now 0, testing is complete
2/23
----
variables.c
- assign_hashcmd: if the shell is restricted, reject attempts to add
pathnames containing slashes to the hash table, as the hash builtin
does. Fixes bug reported to savannah by Sylvain Beucler as
https://savannah.gnu.org/support/?108969
2/24
----
subst.c
- NEED_FPURGE_DECL: need it before externs.h included, since fpurge
is now used in this file. Fixes warning reported by Mike
Frysinger <vapier@gentoo.org>
- skip_double_quoted: add missing argument to declaration
parse.y
- shell_getc: in call to internal_warning, use %lu to print an argument
cast explicitly to unsigned long. Fixes warning reported by Mike
Frysinger <vapier@gentoo.org>
2/27
----
parse.y
- decode_prompt_string: quote result of \s expansion in case shell has
been invoked with a pathname like '$(id)'. Inspired by report from
Travis Garrell <travis.garrell@oracle.com>
- decode_prompt_string: quote result of \h and \H expansions in the
(unlikely) case that the hostname has been changed to something
malicious including a command substitution. From report from
Travis Garrell <travis.garrell@oracle.com>
builtins/getopts.def
- getopts_unbind_variable: new static function, just calls unbind_variable
for now. Placeholder for any future work to do something special if
OPTARG is readonly. Based on discussion started by Robert Elz
<kre@munnari.oz.au>
lib/readline/vi_mode.c
- rl_vi_unix_word_rubout: new function, implements ^W as Posix specifies
it for vi mode, using whitespace and punctuation characters as word
boundaries. Prompted by question from Carlos Pita
<carolosjosepita@gmail.com>
lib/readline/vi_keymap.c
- bind rl_vi_unix_word_rubout to ^W by default in both insert and
command mode
lib/readline/rltty.c
- _rl_bind_tty_special_chars: if in vi mode, bind the WERASE character
to rl_vi_unix_word_rubout
lib/readline/funmap.c
- vi-unix-word-rubout is new bindable name for rl_vi_unix_word_rubout
lib/readline/readline.h
- rl_vi_unix_word_rubout: new extern declaration
2/28
----
doc/bash.1
- document readline blink-matching-paren variable
- document readline completion-display-width variable
- document readline completion-map-case variable
- note that the default value of history-size depends on the value of
the HISTSIZE variable. All from a message from Branden Robinson
<g.branden.robinson@gmail.com>
doc/bash.1,lib/readline/doc/{readline.3,rluser.texi}
- convert-meta: modify the description to note that readline will turn
the default to off if the locale contains eight-bit characters
- input-meta: modify the description to note that readline will turn
the default to on if the locale contains eight-bit characters
- output-meta: modify the description to note that readline will turn
the default to on if the locale contains eight-bit characters. From
a message from Branden Robinson <g.branden.robinson@gmail.com>
+22 -3
View File
@@ -74,6 +74,7 @@ $END
#endif
#include "../bashansi.h"
#include "../bashintl.h"
#include "../shell.h"
#include "common.h"
@@ -86,6 +87,7 @@ $END
extern char *this_command_name;
static int getopts_unbind_variable __P((char *));
static int getopts_bind_variable __P((char *, char *));
static int dogetopts __P((int, char **));
@@ -99,6 +101,23 @@ getopts_reset (newind)
sh_badopt = 0;
}
static int
getopts_unbind_variable (name)
char *name;
{
#if 0
SHELL_VAR *v;
v = find_variable (name);
if (v && readonly_p (v))
{
builtin_error (_("%s: cannot unset: readonly %s"), name, "variable");
return -1;
}
#endif
return (unbind_variable (name));
}
static int
getopts_bind_variable (name, value)
char *name, *value;
@@ -253,7 +272,7 @@ dogetopts (argc, argv)
if (ret == G_EOF)
{
unbind_variable ("OPTARG");
getopts_unbind_variable ("OPTARG");
getopts_bind_variable (name, "?");
return (EXECUTION_FAILURE);
}
@@ -270,7 +289,7 @@ dogetopts (argc, argv)
bind_variable ("OPTARG", strval, 0);
}
else
unbind_variable ("OPTARG");
getopts_unbind_variable ("OPTARG");
return (ret);
}
@@ -289,7 +308,7 @@ dogetopts (argc, argv)
else
{
ret = getopts_bind_variable (name, "?");
unbind_variable ("OPTARG");
getopts_unbind_variable ("OPTARG");
}
return (ret);
}
+33 -7
View File
@@ -5451,6 +5451,10 @@ If set to \fBOn\fP, readline attempts to bind the control characters
treated specially by the kernel's terminal driver to their readline
equivalents.
.TP
.B blink\-matching\-paren (Off)
If set to \fBOn\fP, readline attempts to briefly move the cursor to an
opening parenthesis when a closing parenthesis is inserted.
.TP
.B colored\-completion\-prefix (Off)
If set to \fBOn\fP, when listing completions, readline displays the
common prefix of the set of possible completions using a different color.
@@ -5473,10 +5477,23 @@ 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
in a case\-insensitive fashion.
.TP
.B completion\-map\-case (Off)
If set to \fBOn\fP, and \fBcompletion\-ignore\-case\fP is enabled, readline
treats hyphens (\fI\-\fP) and underscores (\fI_\fP) as equivalent when
performing case\-insensitive filename matching and completion.
.TP
.B completion\-prefix\-display\-length (0)
The length in characters of the common prefix of a list of possible
completions that is displayed without modification. When set to a
@@ -5498,12 +5515,19 @@ If set to \fBOn\fP, readline will convert characters with the
eighth bit set to an ASCII key sequence
by stripping the eighth bit and prefixing an
escape character (in effect, using escape as the \fImeta prefix\fP).
The default is \fIOn\fP, but readline will set it to \fIOff\fP if the
locale contains eight-bit characters.
.TP
.B disable\-completion (Off)
If set to \fBOn\fP, readline will inhibit word completion. Completion
characters will be inserted into the line as if they had been
mapped to \fBself-insert\fP.
.TP
.B echo\-control\-characters (On)
When set to \fBOn\fP, on operating systems that indicate they support it,
readline echoes a character corresponding to a signal generated from the
keyboard.
.TP
.B editing\-mode (emacs)
Controls whether readline begins with a set of key bindings similar
to \fIEmacs\fP or \fIvi\fP.
@@ -5513,11 +5537,6 @@ can be set to either
or
.BR vi .
.TP
.B echo\-control\-characters (On)
When set to \fBOn\fP, on operating systems that indicate they support it,
readline echoes a character corresponding to a signal generated from the
keyboard.
.TP
.B enable\-bracketed\-paste (Off)
When set to \fBOn\fP, readline will configure the terminal in a way
that will enable it to insert each paste into the editing buffer as a
@@ -5550,7 +5569,10 @@ If set to zero, any existing history entries are deleted and no new entries
are saved.
If set to a value less than zero, the number of history entries is not
limited.
By default, the number of history entries is not limited.
By default, the number of history entries is set to the value of the
\fBHISTSIZE\fP shell variable.
If an attempt is made to set \fIhistory\-size\fP to a non-numeric value,
the maximum number of history entries will be set to 500.
.TP
.B horizontal\-scroll\-mode (Off)
When set to \fBOn\fP, makes readline use a single line for display,
@@ -5559,10 +5581,12 @@ becomes longer than the screen width rather than wrapping to a new line.
.TP
.B input\-meta (Off)
If set to \fBOn\fP, readline will enable eight-bit input (that is,
it will not strip the high bit from the characters it reads),
it will not strip the eighth bit from the characters it reads),
regardless of what the terminal claims it can support. The name
.B meta\-flag
is a synonym for this variable.
The default is \fIOff\fP, but readline will set it to \fIOn\fP if the
locale contains eight-bit characters.
.TP
.B isearch\-terminators (``C\-[C\-J'')
The string of characters that should terminate an incremental
@@ -5633,6 +5657,8 @@ the list.
If set to \fBOn\fP, readline will display characters with the
eighth bit set directly rather than as a meta-prefixed escape
sequence.
The default is \fIOff\fP, but readline will set it to \fIOn\fP if the
locale contains eight-bit characters.
.TP
.B page\-completions (On)
If set to \fBOn\fP, readline uses an internal \fImore\fP-like pager
+2 -2
View File
@@ -2,10 +2,10 @@
Copyright (C) 1988-2016 Free Software Foundation, Inc.
@end ignore
@set LASTCHANGE Mon Feb 8 10:16:20 EST 2016
@set LASTCHANGE Sun Feb 28 15:32:09 EST 2016
@set EDITION 4.4
@set VERSION 4.4
@set UPDATED 8 February 2016
@set UPDATED 28 February 2016
@set UPDATED-MONTH February 2016
+1
View File
@@ -2118,6 +2118,7 @@ coproc_fdrestore (cp)
void
coproc_pidchk (pid, status)
pid_t pid;
int status;
{
struct coproc *cp;
+4 -3
View File
@@ -214,7 +214,7 @@ int _rl_colored_stats = 0;
/* Non-zero means to use a color (currently magenta) to indicate the common
prefix of a set of possible word completions. */
int _rl_colored_completion_prefix = 1;
int _rl_colored_completion_prefix = 0;
#endif
/* If non-zero, when completing in the middle of a word, don't insert
@@ -1571,7 +1571,8 @@ rl_display_match_list (matches, len, max)
if (_rl_completion_prefix_display_length > 0)
{
t = printable_part (matches[0]);
temp = strrchr (t, '/'); /* check again in case of /usr/src/ */
/* check again in case of /usr/src/ */
temp = rl_filename_completion_desired ? strrchr (t, '/') : 0;
common_length = temp ? fnwidth (temp) : fnwidth (t);
sind = temp ? strlen (temp) : strlen (t);
@@ -1584,7 +1585,7 @@ rl_display_match_list (matches, len, max)
else if (_rl_colored_completion_prefix > 0)
{
t = printable_part (matches[0]);
temp = strrchr (t, '/');
temp = rl_filename_completion_desired ? strrchr (t, '/') : 0;
common_length = temp ? fnwidth (temp) : fnwidth (t);
sind = temp ? RL_STRLEN (temp+1) : RL_STRLEN (t); /* want portion after final slash */
}
+15 -7
View File
@@ -6,9 +6,9 @@
.\" Case Western Reserve University
.\" chet.ramey@case.edu
.\"
.\" Last Change: Wed Nov 19 18:32:58 EST 2014
.\" Last Change: Sun Feb 28 15:42:34 EST 2016
.\"
.TH READLINE 3 "2014 November 19" "GNU Readline 6.3"
.TH READLINE 3 "2016 February 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.
@@ -416,12 +416,19 @@ If set to \fBOn\fP, readline will convert characters with the
eighth bit set to an ASCII key sequence
by stripping the eighth bit and prefixing it with an
escape character (in effect, using escape as the \fImeta prefix\fP).
The default is \fIOn\fP, but readline will set it to \fIOff\fP if the
locale contains eight-bit characters.
.TP
.B disable\-completion (Off)
If set to \fBOn\fP, readline will inhibit word completion. Completion
characters will be inserted into the line as if they had been
mapped to \fBself-insert\fP.
.TP
.B echo\-control\-characters (On)
When set to \fBOn\fP, on operating systems that indicate they support it,
readline echoes a character corresponding to a signal generated from the
keyboard.
.TP
.B editing\-mode (emacs)
Controls whether readline begins with a set of key bindings similar
to \fIEmacs\fP or \fIvi\fP.
@@ -431,11 +438,6 @@ can be set to either
or
.BR vi .
.TP
.B echo\-control\-characters (On)
When set to \fBOn\fP, on operating systems that indicate they support it,
readline echoes a character corresponding to a signal generated from the
keyboard.
.TP
.B enable\-bracketed\-paste (Off)
When set to \fBOn\fP, readline will configure the terminal in a way
that will enable it to insert each paste into the editing buffer as a
@@ -469,6 +471,8 @@ are saved.
If set to a value less than zero, the number of history entries is not
limited.
By default, the number of history entries is not limited.
If an attempt is made to set \fIhistory\-size\fP to a non-numeric value,
the maximum number of history entries will be set to 500.
.TP
.B horizontal\-scroll\-mode (Off)
When set to \fBOn\fP, makes readline use a single line for display,
@@ -481,6 +485,8 @@ it will not clear the eighth bit in the characters it reads),
regardless of what the terminal claims it can support. The name
.B meta\-flag
is a synonym for this variable.
The default is \fIOff\fP, but readline will set it to \fIOn\fP if the
locale contains eight-bit characters.
.TP
.B isearch\-terminators (``C\-[ C\-J'')
The string of characters that should terminate an incremental
@@ -551,6 +557,8 @@ the list.
If set to \fBOn\fP, readline will display characters with the
eighth bit set directly rather than as a meta-prefixed escape
sequence.
The default is \fIOff\fP, but readline will set it to \fIOn\fP if the
locale contains eight-bit characters.
.TP
.B page\-completions (On)
If set to \fBOn\fP, readline uses an internal \fImore\fP-like pager
+17 -10
View File
@@ -499,7 +499,9 @@ The default limit is @code{100}.
If set to @samp{on}, Readline will convert characters with the
eighth bit set to an @sc{ascii} key sequence by stripping the eighth
bit and prefixing an @key{ESC} character, converting them to a
meta-prefixed key sequence. The default value is @samp{on}.
meta-prefixed key sequence. The default value is @samp{on}, but
will be set to @samp{off} if the locale is one that contains
eight-bit characters.
@item disable-completion
@vindex disable-completion
@@ -507,6 +509,12 @@ If set to @samp{On}, Readline will inhibit word completion.
Completion characters will be inserted into the line as if they had
been mapped to @code{self-insert}. The default is @samp{off}.
@item echo-control-characters
@vindex echo-control-characters
When set to @samp{on}, on operating systems that indicate they support it,
readline echoes a character corresponding to a signal generated from the
keyboard. The default is @samp{on}.
@item editing-mode
@vindex editing-mode
The @code{editing-mode} variable controls which default set of
@@ -525,12 +533,6 @@ non-printing characters, which can be used to embed a terminal control
sequence into the mode string.
The default is @samp{@@}.
@item echo-control-characters
@vindex echo-control-characters
When set to @samp{on}, on operating systems that indicate they support it,
readline echoes a character corresponding to a signal generated from the
keyboard. The default is @samp{on}.
@item enable-bracketed-paste
@vindex enable-bracketed-paste
When set to @samp{On}, Readline will configure the terminal in a way
@@ -571,6 +573,8 @@ are saved.
If set to a value less than zero, the number of history entries is not
limited.
By default, the number of history entries is not limited.
If an attempt is made to set @var{history-size} to a non-numeric value,
the maximum number of history entries will be set to 500.
@item horizontal-scroll-mode
@vindex horizontal-scroll-mode
@@ -586,8 +590,9 @@ this variable is set to @samp{off}.
If set to @samp{on}, Readline will enable eight-bit input (it
will not clear the eighth bit in the characters it reads),
regardless of what the terminal claims it can support. The
default value is @samp{off}. The name @code{meta-flag} is a
synonym for this variable.
default value is @samp{off}, but Readline will set it to @samp{on} if the
locale contains eight-bit characters.
The name @code{meta-flag} is a synonym for this variable.
@item isearch-terminators
@vindex isearch-terminators
@@ -666,7 +671,9 @@ the list. The default is @samp{off}.
@vindex output-meta
If set to @samp{on}, Readline will display characters with the
eighth bit set directly rather than as a meta-prefixed escape
sequence. The default is @samp{off}.
sequence.
The default is @samp{off}, but Readline will set it to @samp{on} if the
locale contains eight-bit characters.
@item page-completions
@vindex page-completions
+3 -3
View File
@@ -4,7 +4,7 @@ Copyright (C) 1988-2016 Free Software Foundation, Inc.
@set EDITION 7.0
@set VERSION 7.0
@set UPDATED 25 January 2016
@set UPDATED-MONTH January 2016
@set UPDATED 28 February 2016
@set UPDATED-MONTH February 2016
@set LASTCHANGE Mon Jan 25 10:08:41 EST 2016
@set LASTCHANGE Sun Feb 28 15:31:16 EST 2016
+2 -1
View File
@@ -1,6 +1,6 @@
/* funmap.c -- attach names to functions. */
/* Copyright (C) 1987-2015 Free Software Foundation, Inc.
/* Copyright (C) 1987-2016 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.
@@ -194,6 +194,7 @@ static const FUNMAP default_funmap[] = {
{ "vi-set-mark", rl_vi_set_mark },
{ "vi-subst", rl_vi_subst },
{ "vi-tilde-expand", rl_vi_tilde_expand },
{ "vi-unix-word-rubout", rl_vi_unix_word_rubout },
{ "vi-yank-arg", rl_vi_yank_arg },
{ "vi-yank-pop", rl_vi_yank_pop },
{ "vi-yank-to", rl_vi_yank_to },
+2 -1
View File
@@ -1,6 +1,6 @@
/* Readline.h -- the names of functions callable from within readline. */
/* Copyright (C) 1987-2015 Free Software Foundation, Inc.
/* Copyright (C) 1987-2016 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.
@@ -253,6 +253,7 @@ extern int rl_vi_yank_pop PARAMS((int, int));
extern int rl_vi_rubout PARAMS((int, int));
extern int rl_vi_delete PARAMS((int, int));
extern int rl_vi_back_to_indent PARAMS((int, int));
extern int rl_vi_unix_word_rubout PARAMS((int, int));
extern int rl_vi_first_print PARAMS((int, int));
extern int rl_vi_char_search PARAMS((int, int));
extern int rl_vi_match PARAMS((int, int));
+6 -1
View File
@@ -1,7 +1,7 @@
/* rltty.c -- functions to prepare and restore the terminal for readline's
use. */
/* Copyright (C) 1992-2015 Free Software Foundation, Inc.
/* Copyright (C) 1992-2016 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.
@@ -876,6 +876,11 @@ _rl_bind_tty_special_chars (kmap, ttybuff)
# endif /* VLNEXT && TERMIOS_TTY_DRIVER */
# if defined (VWERASE) && defined (TERMIOS_TTY_DRIVER)
# if defined (VI_MODE)
if (rl_editing_mode == vi_mode)
SET_SPECIAL (VWERASE, rl_vi_unix_word_rubout);
else
# endif
SET_SPECIAL (VWERASE, rl_unix_word_rubout);
# endif /* VWERASE && TERMIOS_TTY_DRIVER */
}
+3 -3
View File
@@ -1,6 +1,6 @@
/* vi_keymap.c -- the keymap for vi_mode in readline (). */
/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
/* Copyright (C) 1987-2016 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.
@@ -55,7 +55,7 @@ KEYMAP_ENTRY_ARRAY vi_movement_keymap = {
{ ISFUNC, rl_transpose_chars }, /* Control-t */
{ ISFUNC, rl_unix_line_discard }, /* Control-u */
{ ISFUNC, rl_quoted_insert }, /* Control-v */
{ ISFUNC, rl_unix_word_rubout }, /* Control-w */
{ ISFUNC, rl_vi_unix_word_rubout }, /* Control-w */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-x */
{ ISFUNC, rl_yank }, /* Control-y */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-z */
@@ -334,7 +334,7 @@ KEYMAP_ENTRY_ARRAY vi_insertion_keymap = {
{ ISFUNC, rl_transpose_chars }, /* Control-t */
{ ISFUNC, rl_unix_line_discard }, /* Control-u */
{ ISFUNC, rl_quoted_insert }, /* Control-v */
{ ISFUNC, rl_unix_word_rubout }, /* Control-w */
{ ISFUNC, rl_vi_unix_word_rubout }, /* Control-w */
{ ISFUNC, rl_insert }, /* Control-x */
{ ISFUNC, rl_yank }, /* Control-y */
{ ISFUNC, rl_insert }, /* Control-z */
+57 -1
View File
@@ -1,7 +1,7 @@
/* vi_mode.c -- A vi emulation mode for Bash.
Derived from code written by Jeff Sparkes (jsparkes@bnr.ca). */
/* Copyright (C) 1987-2015 Free Software Foundation, Inc.
/* Copyright (C) 1987-2016 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.
@@ -1620,6 +1620,62 @@ rl_vi_delete (count, key)
return (0);
}
/* This does what Posix specifies vi-mode C-w to do: using whitespace and
punctuation characters as the word boundaries. */
#define vi_unix_word_boundary(c) (whitespace(c) || ispunct(c))
int
rl_vi_unix_word_rubout (count, key)
int count, key;
{
int orig_point;
if (rl_point == 0)
rl_ding ();
else
{
orig_point = rl_point;
if (count <= 0)
count = 1;
while (count--)
{
/* This isn't quite what ksh93 does but it seems to match what the
Posix description of sh specifies, with a few accommodations
for sequences of whitespace characters between words and at
the end of the line. */
/* Skip over whitespace at the end of the line as a special case */
if (rl_point > 0 && (rl_line_buffer[rl_point] == 0) &&
whitespace (rl_line_buffer[rl_point - 1]))
while (--rl_point > 0 && whitespace (rl_line_buffer[rl_point]))
;
/* If we're at the start of a word, move back to word boundary so we
move back to the `preceding' word */
if (rl_point > 0 && (vi_unix_word_boundary (rl_line_buffer[rl_point]) == 0) &&
vi_unix_word_boundary (rl_line_buffer[rl_point - 1]))
rl_point--;
/* If we are at a word boundary (whitespace/punct), move backward
past a sequence of word boundary characters. If we are at the
end of a word (non-word boundary), move back to a word boundary */
if (rl_point > 0 && vi_unix_word_boundary (rl_line_buffer[rl_point]))
while (rl_point && vi_unix_word_boundary (rl_line_buffer[rl_point - 1]))
rl_point--;
else if (rl_point > 0 && vi_unix_word_boundary (rl_line_buffer[rl_point]) == 0)
while (rl_point && (vi_unix_word_boundary (rl_line_buffer[rl_point - 1]) == 0))
rl_point--;
}
rl_kill_text (orig_point, rl_point);
}
return 0;
}
int
rl_vi_back_to_indent (count, key)
int count, key;
File diff suppressed because it is too large Load Diff
+17 -5
View File
@@ -2314,7 +2314,7 @@ shell_getc (remove_quoted_newline)
if (n <= 2) /* we have to save 1 for the newline added below */
{
if (truncating == 0)
internal_warning("shell_getc: shell_input_line_size (%zu) exceeds SIZE_MAX (%llu): line truncated", shell_input_line_size, (unsigned long)SIZE_MAX);
internal_warning("shell_getc: shell_input_line_size (%zu) exceeds SIZE_MAX (%lu): line truncated", shell_input_line_size, (unsigned long)SIZE_MAX);
shell_input_line[i] = '\0';
truncating = 1;
}
@@ -5333,7 +5333,7 @@ decode_prompt_string (string)
#if defined (PROMPT_STRING_DECODE)
int result_size, result_index;
int c, n, i;
char *temp, octal_string[4];
char *temp, *t_host, octal_string[4];
struct tm *tm;
time_t the_time;
char timebuf[128];
@@ -5481,7 +5481,11 @@ decode_prompt_string (string)
case 's':
temp = base_pathname (shell_name);
temp = savestring (temp);
/* Try to quote anything the user can set in the file system */
if (promptvars || posixly_correct)
temp = sh_backslash_quote_for_double_quotes (temp);
else
temp = savestring (temp);
goto add_string;
case 'v':
@@ -5571,9 +5575,17 @@ decode_prompt_string (string)
case 'h':
case 'H':
temp = savestring (current_host_name);
if (c == 'h' && (t = (char *)strchr (temp, '.')))
t_host = savestring (current_host_name);
if (c == 'h' && (t = (char *)strchr (t_host, '.')))
*t = '\0';
if (promptvars || posixly_correct)
/* Make sure that expand_prompt_string is called with a
second argument of Q_DOUBLE_QUOTES if we use this
function here. */
temp = sh_backslash_quote_for_double_quotes (t_host);
else
temp = savestring (t_host);
free (t_host);
goto add_string;
case '#':
+3
View File
@@ -37,6 +37,8 @@
# include <unistd.h>
#endif
#define NEED_FPURGE_DECL
#include "bashansi.h"
#include "posixstat.h"
#include "bashintl.h"
@@ -976,6 +978,7 @@ skip_double_quoted (string, slen, sind, flags)
char *string;
size_t slen;
int sind;
int flags;
{
int c, i;
char *ret;
+7
View File
@@ -1628,6 +1628,13 @@ assign_hashcmd (self, value, ind, key)
arrayind_t ind;
char *key;
{
#if defined (RESTRICTED_SHELL)
if (restricted && strchr (value, '/'))
{
sh_restricted (value);
return (SHELL_VAR *)NULL;
}
#endif
phash_insert (key, value, 0, 0);
return (build_hashcmd (self));
}