version 1.23, 2002/10/27 20:24:28 |
version 1.24, 2002/10/27 21:41:50 |
|
|
_rl_compat_sub(const char *str, const char *what, const char *with, |
_rl_compat_sub(const char *str, const char *what, const char *with, |
int globally) |
int globally) |
{ |
{ |
char *result; |
char *result, *r; |
const char *temp, *new; |
const char *temp, *new; |
int len, with_len, what_len, add; |
int len, with_len, what_len, add; |
size_t size, i; |
size_t size, i; |
Line 624 _history_expand_command(const char *comm |
|
Line 624 _history_expand_command(const char *comm |
|
|
|
tempcmd = _rl_compat_sub(line, from, to, |
tempcmd = _rl_compat_sub(line, from, to, |
(g_on) ? 1 : 0); |
(g_on) ? 1 : 0); |
free(line); |
if (tempcmd) { |
line = tempcmd; |
free(line); |
|
line = tempcmd; |
|
} |
g_on = 0; |
g_on = 0; |
} |
} |
} |
} |
Line 1433 completion_matches(const char *text, CPF |
|
Line 1435 completion_matches(const char *text, CPF |
|
matches = 0; |
matches = 0; |
match_list_len = 1; |
match_list_len = 1; |
while ((retstr = (*genfunc) (text, matches)) != NULL) { |
while ((retstr = (*genfunc) (text, matches)) != NULL) { |
if (matches + 1 >= match_list_len) { |
/* allow for list terminator here */ |
|
if (matches + 2 >= match_list_len) { |
char **nmatch_list; |
char **nmatch_list; |
match_list_len <<= 1; |
match_list_len <<= 1; |
nmatch_list = realloc(match_list, |
nmatch_list = realloc(match_list, |
Line 1463 completion_matches(const char *text, CPF |
|
Line 1466 completion_matches(const char *text, CPF |
|
} |
} |
|
|
retstr = malloc(max_equal + 1); |
retstr = malloc(max_equal + 1); |
if (retstr == NULL) |
if (retstr == NULL) { |
|
free(match_list); |
return NULL; |
return NULL; |
|
} |
(void) strncpy(retstr, match_list[1], max_equal); |
(void) strncpy(retstr, match_list[1], max_equal); |
retstr[max_equal] = '\0'; |
retstr[max_equal] = '\0'; |
match_list[0] = retstr; |
match_list[0] = retstr; |
|
|
/* add NULL as last pointer to the array */ |
/* add NULL as last pointer to the array */ |
if (matches + 1 >= match_list_len) { |
|
char **nmatch_list; |
|
nmatch_list = realloc(match_list, |
|
(match_list_len + 1) * sizeof(char *)); |
|
if (nmatch_list == NULL) { |
|
free(match_list); |
|
return NULL; |
|
} |
|
match_list = nmatch_list; |
|
} |
|
|
|
match_list[matches + 1] = (char *) NULL; |
match_list[matches + 1] = (char *) NULL; |
|
|
return (match_list); |
return (match_list); |