summaryrefslogtreecommitdiff
path: root/usr.bin/ftp/main.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-09-03 18:00:07 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-09-03 18:00:07 +0000
commitb144f6e5cfc95f3486ac25047d67372e40adbaed (patch)
tree14410b1ea376d03c802ab50fcbca10a3403205a7 /usr.bin/ftp/main.c
parentd6631cc24a4fcf56093ab90bdf2a08692a471d50 (diff)
http:// support for the command line fetches; useful for the ports subsystem
and other scripts. written by brian@saturn.net (and then i clawed at it for a bit..)
Diffstat (limited to 'usr.bin/ftp/main.c')
-rw-r--r--usr.bin/ftp/main.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/usr.bin/ftp/main.c b/usr.bin/ftp/main.c
index e0c8b51925e..df9eb3c5732 100644
--- a/usr.bin/ftp/main.c
+++ b/usr.bin/ftp/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.5 1996/06/26 05:33:38 deraadt Exp $ */
+/* $OpenBSD: main.c,v 1.6 1996/09/03 18:00:06 deraadt Exp $ */
/*
* Copyright (c) 1985, 1989, 1993, 1994
@@ -43,7 +43,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 10/9/94";
#else
-static char rcsid[] = "$OpenBSD: main.c,v 1.5 1996/06/26 05:33:38 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: main.c,v 1.6 1996/09/03 18:00:06 deraadt Exp $";
#endif
#endif /* not lint */
@@ -52,7 +52,9 @@ static char rcsid[] = "$OpenBSD: main.c,v 1.5 1996/06/26 05:33:38 deraadt Exp $"
*/
/*#include <sys/ioctl.h>*/
#include <sys/types.h>
+#include <sys/file.h>
#include <sys/socket.h>
+#include <netinet/in.h>
#include <arpa/ftp.h>
@@ -168,7 +170,10 @@ main(argc, argv)
ret = 1;
goto bail;
}
-
+ if (!strncmp(host, "http://", strlen("http://"))) {
+ http_fetch(host);
+ goto bail;
+ }
if (strncmp(host, "ftp://", sizeof("ftp://")-1) == 0) {
host += sizeof("ftp://") - 1;
p = strchr(host, '/');
@@ -218,8 +223,10 @@ main(argc, argv)
/* get ready for the next file */
bail:
- if (bufp)
+ if (bufp) {
free(bufp);
+ bufp = NULL;
+ }
if (connected)
disconnect(1, xargv);
--argc;