summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 732e94b..3125a56 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
OpenPOWER on IntegriCloud