version 1.114, 2016/12/22 16:30:03 |
version 1.115, 2016/12/28 17:48:04 |
|
|
#include "cmds.h" |
#include "cmds.h" |
#include "ftp_var.h" |
#include "ftp_var.h" |
|
|
#ifndef SMALL |
#ifndef NOSSL |
char * const ssl_verify_opts[] = { |
char * const ssl_verify_opts[] = { |
#define SSL_CAFILE 0 |
#define SSL_CAFILE 0 |
"cafile", |
"cafile", |
|
|
} |
} |
} |
} |
} |
} |
#endif /* !SMALL */ |
#endif /* !NOSSL */ |
|
|
int family = PF_UNSPEC; |
int family = PF_UNSPEC; |
int pipeout; |
int pipeout; |
|
|
|
|
ftpport = "ftp"; |
ftpport = "ftp"; |
httpport = "http"; |
httpport = "http"; |
#ifndef SMALL |
#ifndef NOSSL |
httpsport = "https"; |
httpsport = "https"; |
#endif /* !SMALL */ |
#endif /* !NOSSL */ |
gateport = getenv("FTPSERVERPORT"); |
gateport = getenv("FTPSERVERPORT"); |
if (gateport == NULL || *gateport == '\0') |
if (gateport == NULL || *gateport == '\0') |
gateport = "ftpgate"; |
gateport = "ftpgate"; |
|
|
verbose = 0; |
verbose = 0; |
progress = 0; |
progress = 0; |
gatemode = 0; |
gatemode = 0; |
|
#ifndef NOSSL |
|
cookiefile = NULL; |
|
#endif /* NOSSL */ |
#ifndef SMALL |
#ifndef SMALL |
editing = 0; |
editing = 0; |
el = NULL; |
el = NULL; |
hist = NULL; |
hist = NULL; |
cookiefile = NULL; |
|
resume = 0; |
resume = 0; |
srcaddr = NULL; |
srcaddr = NULL; |
marg_sl = sl_init(); |
marg_sl = sl_init(); |
|
|
if (isatty(fileno(ttyout)) && !dumb_terminal && foregroundproc()) |
if (isatty(fileno(ttyout)) && !dumb_terminal && foregroundproc()) |
progress = 1; /* progress bar on if tty is usable */ |
progress = 1; /* progress bar on if tty is usable */ |
|
|
#ifndef SMALL |
#ifndef NOSSL |
cookiefile = getenv("http_cookies"); |
cookiefile = getenv("http_cookies"); |
if (tls_init() != 0) |
if (tls_init() != 0) |
errx(1, "tls init failed"); |
errx(1, "tls init failed"); |
|
|
break; |
break; |
|
|
case 'S': |
case 'S': |
#ifndef SMALL |
#ifndef NOSSL |
process_ssl_options(optarg); |
process_ssl_options(optarg); |
#endif /* !SMALL */ |
#endif /* !NOSSL */ |
break; |
break; |
|
|
case 's': |
case 's': |
|
|
argc -= optind; |
argc -= optind; |
argv += optind; |
argv += optind; |
|
|
#ifndef SMALL |
#ifndef NOSSL |
cookie_load(); |
cookie_load(); |
#endif /* !SMALL */ |
#endif /* !NOSSL */ |
if (httpuseragent == NULL) |
if (httpuseragent == NULL) |
httpuseragent = HTTP_USER_AGENT; |
httpuseragent = HTTP_USER_AGENT; |
|
|
|
|
{ |
{ |
fprintf(stderr, "usage: " |
fprintf(stderr, "usage: " |
#ifndef SMALL |
#ifndef SMALL |
"%1$s [-46AadEegiMmnptVv] [-D title] [-k seconds] [-P port] " |
"ftp [-46AadEegiMmnptVv] [-D title] [-k seconds] [-P port] " |
"[-r seconds]\n" |
"[-r seconds]\n" |
" [-s srcaddr] [host [port]]\n" |
" [-s srcaddr] [host [port]]\n" |
" %1$s [-C] [-o output] [-s srcaddr]\n" |
" ftp [-C] [-o output] [-s srcaddr]\n" |
" ftp://[user:password@]host[:port]/file[/] ...\n" |
" ftp://[user:password@]host[:port]/file[/] ...\n" |
" %1$s [-C] [-c cookie] [-o output] [-S ssl_options] " |
" ftp [-C] [-c cookie] [-o output] [-S ssl_options] " |
"[-s srcaddr]\n" |
"[-s srcaddr]\n" |
" [-U useragent] " |
" [-U useragent] " |
"http[s]://[user:password@]host[:port]/file ...\n" |
"http[s]://[user:password@]host[:port]/file ...\n" |
" %1$s [-C] [-o output] [-s srcaddr] file:file ...\n" |
" ftp [-C] [-o output] [-s srcaddr] file:file ...\n" |
" %1$s [-C] [-o output] [-s srcaddr] host:/file[/] ...\n", |
" ftp [-C] [-o output] [-s srcaddr] host:/file[/] ...\n" |
#else /* !SMALL */ |
#else /* !SMALL */ |
"%1$s [-o output] ftp://[user:password@]host[:port]/file[/] ...\n" |
"ftp [-o output] ftp://[user:password@]host[:port]/file[/] ...\n" |
" %1$s [-o output] http://host[:port]/file ...\n" |
#ifndef NOSSL |
" %1$s [-o output] file:file ...\n" |
" ftp [-o output] [-S ssl_options] " |
" %1$s [-o output] host:/file[/] ...\n", |
"http[s]://[user:password@]host[:port]/file ...\n" |
|
#else |
|
" ftp [-o output] http://host[:port]/file ...\n" |
|
#endif /* NOSSL */ |
|
" ftp [-o output] file:file ...\n" |
|
" ftp [-o output] host:/file[/] ...\n" |
#endif /* !SMALL */ |
#endif /* !SMALL */ |
__progname); |
); |
exit(1); |
exit(1); |
} |
} |