diff options
author | ache <ache@FreeBSD.org> | 2006-12-31 09:22:31 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 2006-12-31 09:22:31 +0000 |
commit | 7bc20ca0377a1f9fdc6fd39b7e2edca8d896bd4f (patch) | |
tree | c91b07b71e572bdcd597c50939fee7fdefa1889a /contrib/libreadline/complete.c | |
parent | b27381111678c85b80c37941a6194a4dd507fedb (diff) | |
download | FreeBSD-src-7bc20ca0377a1f9fdc6fd39b7e2edca8d896bd4f.zip FreeBSD-src-7bc20ca0377a1f9fdc6fd39b7e2edca8d896bd4f.tar.gz |
Merge conflicts
Diffstat (limited to 'contrib/libreadline/complete.c')
-rw-r--r-- | contrib/libreadline/complete.c | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/contrib/libreadline/complete.c b/contrib/libreadline/complete.c index 12da0ee..3606d50 100644 --- a/contrib/libreadline/complete.c +++ b/contrib/libreadline/complete.c @@ -951,7 +951,7 @@ gen_completion_matches (text, start, end, our_func, found_quote, quote_char) rl_compentry_func_t *our_func; int found_quote, quote_char; { - char **matches, *temp; + char **matches; rl_completion_found_quote = found_quote; rl_completion_quote_character = quote_char; @@ -970,21 +970,9 @@ gen_completion_matches (text, start, end, our_func, found_quote, quote_char) } } - /* Beware -- we're stripping the quotes here. Do this only if we know - we are doing filename completion and the application has defined a - filename dequoting function. */ - temp = (char *)NULL; - - if (found_quote && our_func == rl_filename_completion_function && - rl_filename_dequoting_function) - { - /* delete single and double quotes */ - temp = (*rl_filename_dequoting_function) (text, quote_char); - text = temp; /* not freeing text is not a memory leak */ - } + /* XXX -- filename dequoting moved into rl_filename_completion_function */ matches = rl_completion_matches (text, our_func); - FREE (temp); return matches; } @@ -1117,7 +1105,8 @@ compute_lcd_of_matches (match_list, matches, text) #if defined (HANDLE_MULTIBYTE) if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) { - mbstate_t ps_back = ps1; + mbstate_t ps_back; + ps_back = ps1; if (!_rl_compare_chars (match_list[i], si, &ps1, match_list[i+1], si, &ps2)) break; else if ((v = _rl_get_char_len (&match_list[i][si], &ps_back)) > 1) @@ -1975,13 +1964,30 @@ rl_filename_completion_function (text, state) if (rl_directory_rewrite_hook) (*rl_directory_rewrite_hook) (&dirname); + /* The directory completion hook should perform any necessary + dequoting. */ if (rl_directory_completion_hook && (*rl_directory_completion_hook) (&dirname)) { free (users_dirname); users_dirname = savestring (dirname); } - + else if (rl_completion_found_quote && rl_filename_dequoting_function) + { + /* delete single and double quotes */ + temp = (*rl_filename_dequoting_function) (users_dirname, rl_completion_quote_character); + free (users_dirname); + users_dirname = temp; + } directory = opendir (dirname); + + /* Now dequote a non-null filename. */ + if (filename && *filename && rl_completion_found_quote && rl_filename_dequoting_function) + { + /* delete single and double quotes */ + temp = (*rl_filename_dequoting_function) (filename, rl_completion_quote_character); + free (filename); + filename = temp; + } filename_len = strlen (filename); rl_filename_completion_desired = 1; |