summaryrefslogtreecommitdiffstats
path: root/usr.bin/fetch
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>1998-05-09 08:41:23 +0000
committerdes <des@FreeBSD.org>1998-05-09 08:41:23 +0000
commitbc55335b0dba9a83e80e7ee9523f00e1f911b013 (patch)
treec925be9083926e8dec46c3db5cdb60ae21c1dbda /usr.bin/fetch
parent6061aa32dc338d28a9703d2fe84f0342e98d5667 (diff)
downloadFreeBSD-src-bc55335b0dba9a83e80e7ee9523f00e1f911b013.zip
FreeBSD-src-bc55335b0dba9a83e80e7ee9523f00e1f911b013.tar.gz
Map a leading / in -c argument to %2f instead of dropping it silently.
PR: bin/6558
Diffstat (limited to 'usr.bin/fetch')
-rw-r--r--usr.bin/fetch/main.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/usr.bin/fetch/main.c b/usr.bin/fetch/main.c
index 76fc64d..571bd1e 100644
--- a/usr.bin/fetch/main.c
+++ b/usr.bin/fetch/main.c
@@ -24,7 +24,7 @@
* SUCH DAMAGE.
*/
-/* $Id: main.c,v 1.43 1997/08/19 01:57:53 asami Exp $ */
+/* $Id: main.c,v 1.44 1998/02/20 05:11:42 jb Exp $ */
#include <sys/types.h>
@@ -177,16 +177,11 @@ main(int argc, char *const *argv)
}
uri = alloca(sizeof("ftp://") + strlen(hostname) +
- strlen(change_to_dir) + 2 + strlen(file_to_get));
+ strlen(change_to_dir) + 5 + strlen(file_to_get));
strcpy(uri, "ftp://");
strcat(uri, hostname);
- /*
- * XXX - we should %-map a leading `/' into `%2f', but for
- * anonymous FTP it is unlikely to matter. Still, it would
- * be better to follow the spec.
- */
- if (change_to_dir[0] != '/')
- strcat(uri, "/");
+ strcat(uri, "/");
+ if (change_to_dir[0] == '/') strcat(uri, "%2f");
strcat(uri, change_to_dir);
if (file_to_get[0] != '/' && uri[strlen(uri) - 1] != '/')
strcat(uri, "/");
OpenPOWER on IntegriCloud