diff options
author | des <des@FreeBSD.org> | 1998-05-09 08:41:23 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 1998-05-09 08:41:23 +0000 |
commit | bc55335b0dba9a83e80e7ee9523f00e1f911b013 (patch) | |
tree | c925be9083926e8dec46c3db5cdb60ae21c1dbda /usr.bin | |
parent | 6061aa32dc338d28a9703d2fe84f0342e98d5667 (diff) | |
download | FreeBSD-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')
-rw-r--r-- | usr.bin/fetch/main.c | 13 |
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, "/"); |