mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-06 02:02:42 +02:00
commit bash-20131018 snapshot
This commit is contained in:
+18
-3
@@ -120,6 +120,7 @@ static int bash_backward_kill_shellword __P((int, int));
|
||||
|
||||
/* Helper functions for Readline. */
|
||||
static char *restore_tilde __P((char *, char *));
|
||||
static char *maybe_restore_tilde __P((char *, char *));
|
||||
|
||||
static char *bash_filename_rewrite_hook __P((char *, int));
|
||||
|
||||
@@ -822,7 +823,7 @@ clear_hostname_list ()
|
||||
}
|
||||
|
||||
/* Return a NULL terminated list of hostnames which begin with TEXT.
|
||||
Initialize the hostname list the first time if neccessary.
|
||||
Initialize the hostname list the first time if necessary.
|
||||
The array is malloc ()'ed, but not the individual strings. */
|
||||
static char **
|
||||
hostnames_matching (text)
|
||||
@@ -1946,7 +1947,7 @@ globword:
|
||||
{
|
||||
if (*hint_text == '~' && directory_part)
|
||||
{
|
||||
temp = restore_tilde (val, directory_part);
|
||||
temp = maybe_restore_tilde (val, directory_part);
|
||||
free (val);
|
||||
val = temp;
|
||||
}
|
||||
@@ -2042,7 +2043,7 @@ globword:
|
||||
/* If we performed tilde expansion, restore the original
|
||||
filename. */
|
||||
if (*hint_text == '~')
|
||||
temp = restore_tilde (val, directory_part);
|
||||
temp = maybe_restore_tilde (val, directory_part);
|
||||
else
|
||||
temp = savestring (val);
|
||||
freetemp = 1;
|
||||
@@ -2899,6 +2900,20 @@ restore_tilde (val, directory_part)
|
||||
return (ret);
|
||||
}
|
||||
|
||||
static char *
|
||||
maybe_restore_tilde (val, directory_part)
|
||||
char *val, *directory_part;
|
||||
{
|
||||
rl_icppfunc_t *save;
|
||||
char *ret;
|
||||
|
||||
save = (dircomplete_expand == 0) ? save_directory_hook () : (rl_icppfunc_t *)0;
|
||||
ret = restore_tilde (val, directory_part);
|
||||
if (save)
|
||||
restore_directory_hook (save);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Simulate the expansions that will be performed by
|
||||
rl_filename_completion_function. This must be called with the address of
|
||||
a pointer to malloc'd memory. */
|
||||
|
||||
Reference in New Issue
Block a user