commit bash-20100218 snapshot

This commit is contained in:
Chet Ramey
2011-12-12 21:54:39 -05:00
parent 8991b5b071
commit 4691dc6b2d
6 changed files with 770 additions and 859 deletions
+7
View File
@@ -9488,3 +9488,10 @@ variables.c
context has no variable hash table), make sure we create a hash
table so we have a place to save the variable to be propagated.
Fixes bug reported by Crestez Dan Leonard <cdleonard@gmail.com>.
2/18
----
builtins/hash.def
- change add_hashed_command to remove the command being looked up from
the hash table before trying to add it. That way, if it's not found,
there won't be anything remaining in the hash table
+1
View File
@@ -202,6 +202,7 @@ add_hashed_command (w, quiet)
rv = 0;
if (find_function (w) == 0 && find_shell_builtin (w) == 0)
{
phash_remove (w);
full_path = find_user_command (w);
if (full_path && executable_file (full_path))
phash_insert (w, full_path, dot_found_in_search, 0);
+5 -4
View File
@@ -7642,12 +7642,13 @@ It returns false if the end of options is encountered or an
error occurs.
.TP
\fBhash\fP [\fB\-lr\fP] [\fB\-p\fP \fIfilename\fP] [\fB\-dt\fP] [\fIname\fP]
For each
.IR name ,
the full file name of the command is determined by searching
Each time \fBhash\fP is invoked,
the full pathname of the command
.I name
is determined by searching
the directories in
.B $PATH
and remembered.
and remembered. Any previously-remembered pathname is discarded.
If the
.B \-p
option is supplied, no path search is performed, and
+3 -1
View File
@@ -2986,10 +2986,12 @@ If @code{getopts} is silent, then a colon (@samp{:}) is placed in
@example
hash [-r] [-p @var{filename}] [-dt] [@var{name}]
@end example
Remember the full pathnames of commands specified as @var{name} arguments,
Each time @code{hash} is invoked, it remembers the full pathnames of the
commands specified as @var{name} arguments,
so they need not be searched for on subsequent invocations.
The commands are found by searching through the directories listed in
@env{$PATH}.
Any previously-remembered pathname is discarded.
The @option{-p} option inhibits the path search, and @var{filename} is
used as the location of @var{name}.
The @option{-r} option causes the shell to forget all remembered locations.
+55 -8
View File
@@ -1417,10 +1417,10 @@ history_tokenize_word (string, ind)
int ind;
{
register int i;
int delimiter;
int delimiter, nestdelim, delimopen;
i = ind;
delimiter = 0;
delimiter = nestdelim = 0;
if (member (string[i], "()\n"))
{
@@ -1442,13 +1442,25 @@ history_tokenize_word (string, ind)
return i;
}
else if ((peek == '&' && (string[i] == '>' || string[i] == '<')) ||
(peek == '>' && string[i] == '&') ||
(peek == '(' && (string[i] == '>' || string[i] == '<')) || /* ) */
(peek == '(' && string[i] == '$')) /* ) */
(peek == '>' && string[i] == '&'))
{
i += 2;
return i;
}
/* XXX - separated out for later -- bash-4.2 */
else if ((peek == '(' && (string[i] == '>' || string[i] == '<')) || /* ) */
(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] == '$')
{
@@ -1464,9 +1476,27 @@ history_tokenize_word (string, ind)
}
}
#if 0
/* XXX - can also use this for $(...) -- bash-4.2 -- rajeevvp@gmail.com */
if (member (string[i], "!@?+*"))
{
int peek = string[i + 1];
if (peek == '(') /*)*/
{
/* Shell extended globbing patterns */
i += 2;
delimopen = '(';
delimiter = ')'; /* XXX - not perfect */
nestdelim = 1;
}
}
#endif
get_word:
/* Get word from string + i; */
if (member (string[i], HISTORY_QUOTE_CHARACTERS))
if (delimiter == 0 && member (string[i], HISTORY_QUOTE_CHARACTERS))
delimiter = string[i++];
for (; string[i]; i++)
@@ -1484,16 +1514,33 @@ history_tokenize_word (string, ind)
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)
{
nestdelim++;
continue;
}
if (nestdelim && string[i] == delimiter)
{
nestdelim--;
if (nestdelim == 0)
delimiter = 0;
continue;
}
#endif
if (delimiter && string[i] == delimiter)
{
delimiter = 0;
continue;
}
if (!delimiter && (member (string[i], history_word_delimiters)))
if (delimiter == 0 && (member (string[i], history_word_delimiters)))
break;
if (!delimiter && member (string[i], HISTORY_QUOTE_CHARACTERS))
if (delimiter == 0 && member (string[i], HISTORY_QUOTE_CHARACTERS))
delimiter = string[i];
}
+699 -846
View File
File diff suppressed because it is too large Load Diff