Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Dec 2000 18:23:55 +0100 (CET)
From:      root@yoda.fwe.pi.musin.de
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/23526: Patch for bin/9529 (ftp completion cant handle spaces)
Message-ID:  <200012131723.eBDHNsH20581@yoda.fwe.pi.musin.de>
Resent-Message-ID: <200012131730.eBDHU1653221@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         23526
>Category:       bin
>Synopsis:       Patch for bin/9529 (ftp completion cant handle spaces)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Dec 13 09:30:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     Charlie &
>Release:        FreeBSD 4.2-STABLE i386
>Organization:
>Environment:

	

>Description:

As described in bin/9529 /usr/bin/ftp doesn't handle spaces in
filenames.

This PR is quite old and nobody did anything. So i tried to improve the
situation by submitting a patch to fix this.

	

>How-To-Repeat:

	

>Fix:
cvs diff: Diffing .
Index: complete.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/ftp/complete.c,v
retrieving revision 1.5
diff -b -u -r1.5 complete.c
--- complete.c	1999/08/28 01:01:30	1.5
+++ complete.c	2000/12/13 17:21:11
@@ -82,7 +82,7 @@
 	int list;
 	StringList *words;
 {
-	char insertstr[MAXPATHLEN];
+	char insertstr[2*MAXPATHLEN];
 	char *lastmatch;
 	int i, j;
 	size_t matchlen, wordlen;
@@ -92,7 +92,12 @@
 		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;i<strlen(words->sl_str[0]);i++,j++){
+			if (isspace(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

>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200012131723.eBDHNsH20581>