Added -4/--ipv4 and -6/ipv6.

Re-arranged some option code.
This commit is contained in:
Daniel Stenberg 2003-09-22 22:29:11 +00:00
parent 881c38b38a
commit 16643faaa1

View File

@ -468,6 +468,8 @@ static void help(void)
" -1/--tlsv1 Force usage of TLSv1 (H)", " -1/--tlsv1 Force usage of TLSv1 (H)",
" -2/--sslv2 Force usage of SSLv2 (H)", " -2/--sslv2 Force usage of SSLv2 (H)",
" -3/--sslv3 Force usage of SSLv3 (H)", " -3/--sslv3 Force usage of SSLv3 (H)",
" -4/--ipv4 Resolve name to IPv4 address",
" -6/--ipv6 Resolve name to IPv6 address",
" -#/--progress-bar Display transfer progress as a progress bar", " -#/--progress-bar Display transfer progress as a progress bar",
NULL NULL
}; };
@ -562,6 +564,7 @@ struct Configurable {
struct curl_slist *prequote; struct curl_slist *prequote;
long ssl_version; long ssl_version;
long ip_version;
curl_TimeCond timecond; curl_TimeCond timecond;
time_t condtime; time_t condtime;
@ -1070,41 +1073,43 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
boolean whether it takes an additional argument boolean whether it takes an additional argument
*/ */
struct LongShort aliases[]= { struct LongShort aliases[]= {
{"9", "crlf", FALSE}, /* all these ones, starting with "*" as a short-option have *no* short
{"8", "stderr", TRUE},
{"7", "interface", TRUE},
{"6", "krb4", TRUE},
/* all these ones, starting with 5 as a short-option have *no* short
option to mention. */ option to mention. */
{"5", "url", TRUE}, {"*", "url", TRUE},
{"5a", "random-file", TRUE}, {"*a", "random-file", TRUE},
{"5b", "egd-file", TRUE}, {"*b", "egd-file", TRUE},
{"5c", "connect-timeout", TRUE}, {"*c", "connect-timeout", TRUE},
{"5d", "ciphers", TRUE}, {"*d", "ciphers", TRUE},
{"5e", "disable-epsv", FALSE}, {"*e", "disable-epsv", FALSE},
#ifdef USE_ENVIRONMENT #ifdef USE_ENVIRONMENT
{"5f", "environment", FALSE}, {"*f", "environment", FALSE},
#endif #endif
{"5g", "trace", TRUE}, {"*g", "trace", TRUE},
{"5h", "trace-ascii", TRUE}, {"*h", "trace-ascii", TRUE},
{"5i", "limit-rate", TRUE}, {"*i", "limit-rate", TRUE},
{"5j", "compressed", FALSE}, /* might take an arg someday */ {"*j", "compressed", FALSE}, /* might take an arg someday */
{"5k", "digest", FALSE}, {"*k", "digest", FALSE},
{"5l", "negotiate", FALSE}, {"*l", "negotiate", FALSE},
{"5m", "ntlm", FALSE}, {"*m", "ntlm", FALSE},
{"5n", "basic", FALSE}, {"*n", "basic", FALSE},
{"5o", "anyauth", FALSE}, {"*o", "anyauth", FALSE},
#ifdef __DJGPP__ #ifdef __DJGPP__
{"5p", "wdebug", FALSE}, {"*p", "wdebug", FALSE},
#endif #endif
{"5q", "ftp-create-dirs", FALSE}, {"*q", "ftp-create-dirs", FALSE},
{"5r", "create-dirs", FALSE}, {"*r", "create-dirs", FALSE},
{"5s", "max-redirs", TRUE}, {"*s", "max-redirs", TRUE},
{"5t", "proxy-ntlm", FALSE}, {"*t", "proxy-ntlm", FALSE},
{"*u", "crlf", FALSE},
{"*v", "stderr", TRUE},
{"*w", "interface", TRUE},
{"*x", "krb4", TRUE},
{"0", "http1.0", FALSE}, {"0", "http1.0", FALSE},
{"1", "tlsv1", FALSE}, {"1", "tlsv1", FALSE},
{"2", "sslv2", FALSE}, {"2", "sslv2", FALSE},
{"3", "sslv3", FALSE}, {"3", "sslv3", FALSE},
{"4", "ipv4", FALSE},
{"6", "ipv6", FALSE},
{"a", "append", FALSE}, {"a", "append", FALSE},
{"A", "user-agent", TRUE}, {"A", "user-agent", TRUE},
{"b", "cookie", TRUE}, {"b", "cookie", TRUE},
@ -1242,27 +1247,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
*usedarg = TRUE; /* mark it as used */ *usedarg = TRUE; /* mark it as used */
switch(letter) { switch(letter) {
case '9': /* there is no short letter for this */ case '*': /* options without a short option */
/* LF -> CRLF conversinon? */
config->crlf = TRUE;
break;
case '8': /* there is no short letter for this */
if(strcmp(nextarg, "-")) {
config->errors = fopen(nextarg, "wt");
config->errors_fopened = TRUE;
}
else
config->errors = stdout;
break;
case '7': /* there is no short letter for this */
/* interface */
GetStr(&config->iface, nextarg);
break;
case '6': /* there is no short letter for this */
/* krb4 level string */
GetStr(&config->krb4level, nextarg);
break;
case '5':
switch(subletter) { switch(subletter) {
case 'a': /* random-file */ case 'a': /* random-file */
GetStr(&config->random_file, nextarg); GetStr(&config->random_file, nextarg);
@ -1364,6 +1349,28 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
config->proxyntlm ^= TRUE; config->proxyntlm ^= TRUE;
break; break;
case 'u': /* --crlf */
/* LF -> CRLF conversinon? */
config->crlf = TRUE;
break;
case 'v': /* --stderr */
if(strcmp(nextarg, "-")) {
config->errors = fopen(nextarg, "wt");
config->errors_fopened = TRUE;
}
else
config->errors = stdout;
break;
case 'w': /* --interface */
/* interface */
GetStr(&config->iface, nextarg);
break;
case 'x': /* --krb4 */
/* krb4 level string */
GetStr(&config->krb4level, nextarg);
break;
default: /* the URL! */ default: /* the URL! */
{ {
struct getout *url; struct getout *url;
@ -1410,6 +1417,14 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
/* SSL version 3 */ /* SSL version 3 */
config->ssl_version = CURL_SSLVERSION_SSLv3; config->ssl_version = CURL_SSLVERSION_SSLv3;
break; break;
case '4':
/* IPv4 */
config->ip_version = 4;
break;
case '6':
/* IPv6 */
config->ip_version = 6;
break;
case 'a': case 'a':
/* This makes the FTP sessions use APPE instead of STOR */ /* This makes the FTP sessions use APPE instead of STOR */
config->conf ^= CONF_FTPAPPEND; config->conf ^= CONF_FTPAPPEND;
@ -1828,7 +1843,8 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
{"NTLM", CURL_VERSION_NTLM}, {"NTLM", CURL_VERSION_NTLM},
{"GSS-Negotiate", CURL_VERSION_GSSNEGOTIATE}, {"GSS-Negotiate", CURL_VERSION_GSSNEGOTIATE},
{"Debug", CURL_VERSION_DEBUG}, {"Debug", CURL_VERSION_DEBUG},
{"AsynchDNS", CURL_VERSION_ASYNCHDNS} {"AsynchDNS", CURL_VERSION_ASYNCHDNS},
{"SPNEGO", CURL_VERSION_SPNEGO}
}; };
printf("Features: "); printf("Features: ");
for(i=0; i<sizeof(feats)/sizeof(feats[0]); i++) { for(i=0; i<sizeof(feats)/sizeof(feats[0]); i++) {