Here's a revised version of the diff that was done with a lot of
discussion with and help from jmc@.
This is what the diff does:
* In both usage and the man page synopsis, combine the http and https
usage formats into the following so that it is less verbose:
ftp [-C] [-c cookie] [-o output] [-s srcaddr]
http[s]://[user:password@]host[:port]/file ...
* In the AUTO-FETCHING FILES section of the ftp(1) man page, mention
that specifying "user" and "password" with HTTP and HTTPS URLs will
log in using Basic authentication if http_proxy is not defined.
* When compiled with -DSMALL, fix ftp(1) usage so that
"[user:password@]" is not shown for http[s].
Looking for more ok's.
Lawrence
Index: ftp.1
===================================================================
RCS file: /cvs/src/usr.bin/ftp/ftp.1,v
retrieving revision 1.83
diff -u -p -r1.83 ftp.1
--- ftp.1 14 Aug 2012 20:47:08 -0000 1.83
+++ ftp.1 19 Aug 2012 18:22:21 -0000
@@ -61,18 +61,7 @@
.Op Fl o Ar output
.Op Fl s Ar srcaddr
.Sm off
-.No http:// Oo Ar user : password No @
-.Oc Ar host Oo : Ar port
-.Oc No / Ar file
-.Sm on
-.Ar ...
-.Nm ftp
-.Op Fl C
-.Op Fl c Ar cookie
-.Op Fl o Ar output
-.Op Fl s Ar srcaddr
-.Sm off
-.No https:// Oo Ar user : password No @
+.No http[s]:// Oo Ar user : password No @
.Oc Ar host Oo : Ar port
.Oc No / Ar file
.Sm on
@@ -102,7 +91,7 @@ standard File Transfer Protocol (FTP).
The program allows a user to transfer files to and from a
remote network site.
.Pp
-The latter five usage formats will fetch a file using either the
+The latter four usage formats will fetch a file using either the
FTP, HTTP, or HTTPS protocols into the current directory.
This is ideal for scripts.
Refer to
@@ -1272,11 +1261,14 @@ An FTP URL, retrieved using the FTP prot
isn't defined.
Otherwise, transfer using HTTP via the proxy defined in
.Ev ftp_proxy .
-If
-.Ar user : Ns Ar password Ns @
-is given and
+If a
+.Ar user
+and
+.Ar password
+are given and
.Ev ftp_proxy
-isn't defined, log in as
+isn't defined,
+log in as
.Ar user
with a password of
.Ar password .
@@ -1285,12 +1277,36 @@ An HTTP URL, retrieved using the HTTP pr
If
.Ev http_proxy
is defined, it is used as a URL to an HTTP proxy server.
+If a
+.Ar user
+and
+.Ar password
+are given and
+.Ev http_proxy
+isn't defined,
+log in as
+.Ar user
+with a password of
+.Ar password
+using Basic authentication.
.It https://[user:password@]host[:port]/file
An HTTPS URL, retrieved using the HTTPS protocol.
If
.Ev http_proxy
is defined, this HTTPS proxy server will be used to fetch the
file using the CONNECT method.
+If a
+.Ar user
+and
+.Ar password
+are given and
+.Ev http_proxy
+isn't defined,
+log in as
+.Ar user
+with a password of
+.Ar password
+using Basic authentication.
.It file:file
.Ar file
is retrieved from a mounted file system.
Index: main.c
===================================================================
RCS file: /cvs/src/usr.bin/ftp/main.c,v
retrieving revision 1.84
diff -u -p -r1.84 main.c
--- main.c 14 Aug 2012 20:47:08 -0000 1.84
+++ main.c 19 Aug 2012 01:47:56 -0000
@@ -778,13 +778,15 @@ usage(void)
"[-s srcaddr]\n"
" "
#endif /* !SMALL */
- "http://[user:password@]host[:port]/file ...\n"
+ "http"
#ifndef SMALL
- " %s [-C] [-c cookie] [-o output] [-s srcaddr]\n"
- " "
- "https://[user:password@]host[:port]/file\n"
- " ...\n"
-#endif /* !SMALL */
+ "[s]"
+#endif
+ "://"
+#ifndef SMALL
+ "[user:password@]"
+#endif
+ "host[:port]/file ...\n"
" %s "
#ifndef SMALL
"[-C] "
@@ -804,8 +806,7 @@ usage(void)
#endif /* !SMALL */
"host:/file[/] ...\n",
#ifndef SMALL
- __progname, __progname, __progname, __progname, __progname,
- __progname);
+ __progname, __progname, __progname, __progname, __progname);
#else /* !SMALL */
__progname, __progname, __progname, __progname);
#endif /* !SMALL */