Make completion work with filenames containing spaces.

PR:		bin/23526
Submitted by:	root@yoda.fwe.pi.musin.de
MFC after:	1 week
This commit is contained in:
Ian Dowse 2001-11-18 17:49:09 +00:00
parent 00a2029a0e
commit ffad02bd6b
1 changed files with 7 additions and 2 deletions

View File

@ -81,7 +81,7 @@ complete_ambiguous(word, list, words)
int list;
StringList *words;
{
char insertstr[MAXPATHLEN];
char insertstr[2 * MAXPATHLEN];
char *lastmatch;
int i, j;
size_t matchlen, wordlen;
@ -91,7 +91,12 @@ complete_ambiguous(word, list, words)
return (CC_ERROR); /* no choices available */
if (words->sl_cur == 1) { /* only once choice available */
(void)strcpy(insertstr, words->sl_str[0]);
for (i = 0, j = 0; words->sl_str[0][i] != '\0'; i++) {
if (isspace((u_char)words->sl_str[0][i]))
insertstr[j++] = '\\';
insertstr[j++] = words->sl_str[0][i];
}
insertstr[j] = '\0';
if (el_insertstr(el, insertstr + wordlen) == -1)
return (CC_ERROR);
else