commit bash-20060223 snapshot

This commit is contained in:
Chet Ramey
2011-12-03 22:45:40 -05:00
parent 0cc62c12d7
commit 27a1808ccd
3 changed files with 24 additions and 7 deletions
+5
View File
@@ -13106,3 +13106,8 @@ lib/readline/readline.c
lib/readline/display.c
- further fixes to _rl_make_prompt_for_search from Eric Blake to deal
with multiple calls to expand_prompt
2/21
----
builtins/hash.def
- don't print `hash table empty' message in posix mode
+4 -2
View File
@@ -1,7 +1,7 @@
This file is hash.def, from which is created hash.c.
It implements the builtin "hash" in Bash.
Copyright (C) 1987-2003 Free Software Foundation, Inc.
Copyright (C) 1987-2006 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -59,6 +59,7 @@ $END
#include "common.h"
#include "bashgetopt.h"
extern int posixly_correct;
extern int dot_found_in_search;
extern char *this_command_name;
@@ -124,7 +125,8 @@ hash_builtin (list)
we test expunge_hash_table. */
if (list == 0 && expunge_hash_table == 0)
{
if (print_hashed_commands (list_portably) == 0)
opt = print_hashed_commands (list_portably);
if (opt == 0 && posixly_correct == 0)
printf (_("%s: hash table empty\n"), this_command_name);
return (EXECUTION_SUCCESS);
+15 -5
View File
@@ -2723,6 +2723,7 @@ read_token (command)
#define P_ALLOWESC 0x02
#define P_DQUOTE 0x04
#define P_COMMAND 0x08 /* parsing a command, so look for comments */
#define P_BACKQUOTE 0x10 /* parsing a backquoted command substitution */
static char matched_pair_error;
static char *
@@ -2732,12 +2733,12 @@ parse_matched_pair (qc, open, close, lenp, flags)
int *lenp, flags;
{
int count, ch, was_dollar, in_comment, check_comment;
int pass_next_character, nestlen, ttranslen, start_lineno;
int pass_next_character, backq_backslash, nestlen, ttranslen, start_lineno;
char *ret, *nestret, *ttrans;
int retind, retsize, rflags;
count = 1;
pass_next_character = was_dollar = in_comment = 0;
pass_next_character = backq_backslash = was_dollar = in_comment = 0;
check_comment = (flags & P_COMMAND) && qc != '\'' && qc != '"' && (flags & P_DQUOTE) == 0;
/* RFLAGS is the set of flags we want to pass to recursive calls. */
@@ -2749,7 +2750,7 @@ parse_matched_pair (qc, open, close, lenp, flags)
start_lineno = line_number;
while (count)
{
ch = shell_getc (qc != '\'' && pass_next_character == 0);
ch = shell_getc (qc != '\'' && pass_next_character == 0 && backq_backslash == 0);
if (ch == EOF)
{
@@ -2778,6 +2779,13 @@ parse_matched_pair (qc, open, close, lenp, flags)
else if MBTEST(check_comment && in_comment == 0 && ch == '#' && (retind == 0 || ret[retind-1] == '\n' || whitespace (ret[retind - 1])))
in_comment = 1;
/* last char was backslash inside backquoted command substitution */
if (backq_backslash)
{
backq_backslash = 0;
/* Placeholder for adding special characters */
}
if (pass_next_character) /* last char was backslash */
{
pass_next_character = 0;
@@ -2816,6 +2824,8 @@ parse_matched_pair (qc, open, close, lenp, flags)
{
if MBTEST((flags & P_ALLOWESC) && ch == '\\')
pass_next_character++;
else if MBTEST((flags & P_BACKQUOTE) && ch == '\\')
backq_backslash++;
continue;
}
@@ -2900,11 +2910,11 @@ add_nestret:
}
else if MBTEST(qc == '`' && (ch == '"' || ch == '\'') && in_comment == 0)
{
/* Add P_ALLOWESC so backslash quotes the next character and
/* Add P_BACKQUOTE so backslash quotes the next character and
shell_getc does the right thing with \<newline>. We do this for
a measure of backwards compatibility -- it's not strictly the
right POSIX thing. */
nestret = parse_matched_pair (0, ch, ch, &nestlen, rflags|P_ALLOWESC);
nestret = parse_matched_pair (0, ch, ch, &nestlen, rflags|P_BACKQUOTE);
goto add_nestret;
}
else if MBTEST(was_dollar && (ch == '(' || ch == '{' || ch == '[')) /* ) } ] */