aboutsummaryrefslogtreecommitdiffstats
path: root/bashline.c
diff options
context:
space:
mode:
authorJari Aalto <jari.aalto@cante.net>1997-09-22 20:22:27 +0000
committerJari Aalto <jari.aalto@cante.net>2009-09-12 16:46:51 +0000
commite8ce775db824de329b81293b4e5d8fbd65624528 (patch)
tree4b20c4dc766f5172b65ca1bc16ae1b6d48920fa1 /bashline.c
parentd166f048818e10cf3799aa24a174fb22835f1acc (diff)
downloadandroid_external_bash-e8ce775db824de329b81293b4e5d8fbd65624528.tar.gz
android_external_bash-e8ce775db824de329b81293b4e5d8fbd65624528.tar.bz2
android_external_bash-e8ce775db824de329b81293b4e5d8fbd65624528.zip
Imported from ../bash-2.01.1.tar.gz.
Diffstat (limited to 'bashline.c')
-rw-r--r--bashline.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/bashline.c b/bashline.c
index fbd196a..4feb7be 100644
--- a/bashline.c
+++ b/bashline.c
@@ -700,8 +700,8 @@ attempt_shell_completion (text, start, end)
/* Check that we haven't incorrectly flagged a closed command substitution
as indicating we're in a command position. */
- if (in_command_position && rl_line_buffer[ti] == '`' && *text != '`' &&
- unclosed_pair (rl_line_buffer, 0, "`") == 0)
+ if (in_command_position && ti >= 0 && rl_line_buffer[ti] == '`' &&
+ *text != '`' && unclosed_pair (rl_line_buffer, 0, "`") == 0)
in_command_position = 0;
/* Special handling for command substitution. If *TEXT is a backquote,
@@ -744,7 +744,16 @@ attempt_shell_completion (text, start, end)
/* This could be a globbing pattern, so try to expand it using pathname
expansion. */
if (!matches && glob_pattern_p (text))
- matches = completion_matches (text, glob_complete_word);
+ {
+ matches = completion_matches (text, glob_complete_word);
+ /* A glob expression that matches more than one filename is problematic.
+ If we match more than one filename, punt. */
+ if (matches && matches[1])
+ {
+ free_array (matches);
+ matches = (char **)0;
+ }
+ }
return (matches);
}
@@ -1801,6 +1810,7 @@ glob_complete_word (text, state)
if (state == 0)
{
+ rl_filename_completion_desired = 1;
if (matches)
free (matches);
matches = shell_glob_filename (text);