summaryrefslogtreecommitdiff
path: root/usr.bin/ftp
diff options
context:
space:
mode:
authorIan Dowse <iedowse@FreeBSD.org>2001-11-18 17:49:09 +0000
committerIan Dowse <iedowse@FreeBSD.org>2001-11-18 17:49:09 +0000
commitffad02bd6bce112942c9694dbb26899f8a953a21 (patch)
treec3c8f46bc460dda45702e42e9281161684c4b162 /usr.bin/ftp
parent00a2029a0e3a03150ec602c46cb88bb45e7ba892 (diff)
downloadsrc-test2-ffad02bd6bce112942c9694dbb26899f8a953a21.tar.gz
src-test2-ffad02bd6bce112942c9694dbb26899f8a953a21.zip
Notes
Diffstat (limited to 'usr.bin/ftp')
-rw-r--r--usr.bin/ftp/complete.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/usr.bin/ftp/complete.c b/usr.bin/ftp/complete.c
index 732e94b9d049..3125a5657455 100644
--- a/usr.bin/ftp/complete.c
+++ b/usr.bin/ftp/complete.c
@@ -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