Now that libfetch uses the high port range by default, add a -U option to

make it use the low (default) port range instead.
This commit is contained in:
Dag-Erling Smørgrav 2001-03-24 00:32:11 +00:00
parent d5f175ce90
commit 7c480c6c77
2 changed files with 17 additions and 13 deletions

View File

@ -37,7 +37,7 @@
.Nd retrieve a file by Uniform Resource Locator
.Sh SYNOPSIS
.Nm
.Op Fl 146AFHMPRadlmnpqrsv
.Op Fl 146AFMPRUadlmnpqrsv
.Op Fl B Ar bytes
.Op Fl S Ar bytes
.Op Fl T Ar seconds
@ -101,11 +101,6 @@ The file to retrieve is named
on the remote host.
This option is deprecated and is provided for backward compatibility
only.
.It Fl H
When using passive FTP, allocate a high port for the data connection.
See
.Xr ip 4
for details on how to specify which port range this corresponds to.
.It Fl h Ar host
The file to retrieve is located on the host
.Ar host .
@ -171,6 +166,12 @@ Overrides the environment variables
for FTP transfers or
.Ev HTTP_TIMEOUT
for HTTP transfers if set.
.It Fl U
When using passive FTP, allocate the port for the data connection from
the low (default) port range.
See
.Xr ip 4
for details on how to specify which port range this corresponds to.
.It Fl v
Increase verbosity level.
.It Fl w Ar seconds

View File

@ -55,7 +55,6 @@ char *c_dirname; /* -c: remote directory */
int d_flag; /* -d: direct connection */
int F_flag; /* -F: restart without checking mtime */
char *f_filename; /* -f: file to fetch */
int H_flag; /* -H: use high port */
char *h_hostname; /* -h: host to fetch from */
int l_flag; /* -l: link rather than copy file: URLs */
int m_flag; /* -[Mm]: mirror mode */
@ -68,10 +67,11 @@ int once_flag; /* -1: stop at first successful file */
int p_flag; /* -[Pp]: use passive FTP */
int R_flag; /* -R: don't delete partially transferred files */
int r_flag; /* -r: restart previously interrupted transfer */
u_int T_secs = 0; /* -T: transfer timeout in seconds */
int s_flag; /* -s: show size, don't fetch */
off_t S_size; /* -S: require size to match */
int s_flag; /* -s: show size, don't fetch */
u_int T_secs = 0; /* -T: transfer timeout in seconds */
int t_flag; /*! -t: workaround TCP bug */
int U_flag; /* -U: do not use high ports */
int v_level = 1; /* -v: verbosity level */
int v_tty; /* stdout is a tty */
u_int w_secs; /* -w: retry delay */
@ -234,8 +234,8 @@ fetch(char *URL, char *path)
strcat(flags, "p");
if (d_flag)
strcat(flags, "d");
if (H_flag)
strcat(flags, "h");
if (U_flag)
strcat(flags, "l");
timeout = T_secs ? T_secs : ftp_timeout;
}
@ -537,7 +537,7 @@ main(int argc, char *argv[])
int c, e, r;
while ((c = getopt(argc, argv,
"146AaB:bc:dFf:h:lHMmnPpo:qRrS:sT:tvw:")) != EOF)
"146AaB:bc:dFf:Hh:lMmnPpo:qRrS:sT:tUvw:")) != EOF)
switch (c) {
case '1':
once_flag = 1;
@ -575,7 +575,7 @@ main(int argc, char *argv[])
f_filename = optarg;
break;
case 'H':
H_flag = 1;
warnx("The -H option is now implicit, use -U to disable\n");
break;
case 'h':
h_hostname = optarg;
@ -626,6 +626,9 @@ main(int argc, char *argv[])
t_flag = 1;
warnx("warning: the -t option is deprecated");
break;
case 'U':
U_flag = 1;
break;
case 'v':
v_level++;
break;