mirror of
https://github.com/curl/curl.git
synced 2025-04-12 16:20:35 +08:00
curl: non-boolean command line args reject --no- prefixes
... and instead properly respond with an error message to the user instead of silently ignoring. Fixes #1453 Closes #1458
This commit is contained in:
parent
f2d5d05893
commit
913c3c8f54
@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
@ -61,246 +61,250 @@
|
||||
struct LongShort {
|
||||
const char *letter; /* short name option */
|
||||
const char *lname; /* long name option */
|
||||
bool extraparam; /* whether it takes an additional argument */
|
||||
enum {
|
||||
ARG_NONE, /* stand-alone but not a boolean */
|
||||
ARG_BOOL, /* accepts a --no-[name] prefix */
|
||||
ARG_STRING, /* requires an argument */
|
||||
} desc;
|
||||
};
|
||||
|
||||
static const struct LongShort aliases[]= {
|
||||
/* 'letter' strings with more than one character have *no* short option to
|
||||
mention. */
|
||||
{"*@", "url", TRUE},
|
||||
{"*4", "dns-ipv4-addr", TRUE},
|
||||
{"*6", "dns-ipv6-addr", TRUE},
|
||||
{"*a", "random-file", TRUE},
|
||||
{"*b", "egd-file", TRUE},
|
||||
{"*B", "oauth2-bearer", TRUE},
|
||||
{"*c", "connect-timeout", TRUE},
|
||||
{"*d", "ciphers", TRUE},
|
||||
{"*D", "dns-interface", TRUE},
|
||||
{"*e", "disable-epsv", FALSE},
|
||||
{"*E", "epsv", FALSE},
|
||||
{"*@", "url", ARG_STRING},
|
||||
{"*4", "dns-ipv4-addr", ARG_STRING},
|
||||
{"*6", "dns-ipv6-addr", ARG_STRING},
|
||||
{"*a", "random-file", ARG_STRING},
|
||||
{"*b", "egd-file", ARG_STRING},
|
||||
{"*B", "oauth2-bearer", ARG_STRING},
|
||||
{"*c", "connect-timeout", ARG_STRING},
|
||||
{"*d", "ciphers", ARG_STRING},
|
||||
{"*D", "dns-interface", ARG_STRING},
|
||||
{"*e", "disable-epsv", ARG_BOOL},
|
||||
{"*E", "epsv", ARG_BOOL},
|
||||
/* 'epsv' made like this to make --no-epsv and --epsv to work
|
||||
although --disable-epsv is the documented option */
|
||||
#ifdef USE_ENVIRONMENT
|
||||
{"*f", "environment", FALSE},
|
||||
{"*f", "environment", ARG_BOOL},
|
||||
#endif
|
||||
{"*F", "dns-servers", TRUE},
|
||||
{"*g", "trace", TRUE},
|
||||
{"*G", "npn", FALSE},
|
||||
{"*h", "trace-ascii", TRUE},
|
||||
{"*H", "alpn", FALSE},
|
||||
{"*i", "limit-rate", TRUE},
|
||||
{"*j", "compressed", FALSE},
|
||||
{"*J", "tr-encoding", FALSE},
|
||||
{"*k", "digest", FALSE},
|
||||
{"*l", "negotiate", FALSE},
|
||||
{"*m", "ntlm", FALSE},
|
||||
{"*M", "ntlm-wb", FALSE},
|
||||
{"*n", "basic", FALSE},
|
||||
{"*o", "anyauth", FALSE},
|
||||
{"*F", "dns-servers", ARG_STRING},
|
||||
{"*g", "trace", ARG_STRING},
|
||||
{"*G", "npn", ARG_BOOL},
|
||||
{"*h", "trace-ascii", ARG_STRING},
|
||||
{"*H", "alpn", ARG_BOOL},
|
||||
{"*i", "limit-rate", ARG_STRING},
|
||||
{"*j", "compressed", ARG_BOOL},
|
||||
{"*J", "tr-encoding", ARG_BOOL},
|
||||
{"*k", "digest", ARG_BOOL},
|
||||
{"*l", "negotiate", ARG_BOOL},
|
||||
{"*m", "ntlm", ARG_BOOL},
|
||||
{"*M", "ntlm-wb", ARG_BOOL},
|
||||
{"*n", "basic", ARG_BOOL},
|
||||
{"*o", "anyauth", ARG_BOOL},
|
||||
#ifdef USE_WATT32
|
||||
{"*p", "wdebug", FALSE},
|
||||
{"*p", "wdebug", ARG_BOOL},
|
||||
#endif
|
||||
{"*q", "ftp-create-dirs", FALSE},
|
||||
{"*r", "create-dirs", FALSE},
|
||||
{"*s", "max-redirs", TRUE},
|
||||
{"*t", "proxy-ntlm", FALSE},
|
||||
{"*u", "crlf", FALSE},
|
||||
{"*v", "stderr", TRUE},
|
||||
{"*w", "interface", TRUE},
|
||||
{"*x", "krb", TRUE},
|
||||
{"*x", "krb4", TRUE},
|
||||
{"*q", "ftp-create-dirs", ARG_BOOL},
|
||||
{"*r", "create-dirs", ARG_BOOL},
|
||||
{"*s", "max-redirs", ARG_STRING},
|
||||
{"*t", "proxy-ntlm", ARG_BOOL},
|
||||
{"*u", "crlf", ARG_BOOL},
|
||||
{"*v", "stderr", ARG_STRING},
|
||||
{"*w", "interface", ARG_STRING},
|
||||
{"*x", "krb", ARG_STRING},
|
||||
{"*x", "krb4", ARG_STRING},
|
||||
/* 'krb4' is the previous name */
|
||||
{"*y", "max-filesize", TRUE},
|
||||
{"*z", "disable-eprt", FALSE},
|
||||
{"*Z", "eprt", FALSE},
|
||||
{"*y", "max-filesize", ARG_STRING},
|
||||
{"*z", "disable-eprt", ARG_BOOL},
|
||||
{"*Z", "eprt", ARG_BOOL},
|
||||
/* 'eprt' made like this to make --no-eprt and --eprt to work
|
||||
although --disable-eprt is the documented option */
|
||||
{"*~", "xattr", FALSE},
|
||||
{"$a", "ftp-ssl", FALSE},
|
||||
{"*~", "xattr", ARG_BOOL},
|
||||
{"$a", "ftp-ssl", ARG_BOOL},
|
||||
/* 'ftp-ssl' deprecated name since 7.20.0 */
|
||||
{"$a", "ssl", FALSE},
|
||||
{"$a", "ssl", ARG_BOOL},
|
||||
/* 'ssl' new option name in 7.20.0, previously this was ftp-ssl */
|
||||
{"$b", "ftp-pasv", FALSE},
|
||||
{"$c", "socks5", TRUE},
|
||||
{"$d", "tcp-nodelay", FALSE},
|
||||
{"$e", "proxy-digest", FALSE},
|
||||
{"$f", "proxy-basic", FALSE},
|
||||
{"$g", "retry", TRUE},
|
||||
{"$V", "retry-connrefused", FALSE},
|
||||
{"$h", "retry-delay", TRUE},
|
||||
{"$i", "retry-max-time", TRUE},
|
||||
{"$k", "proxy-negotiate", FALSE},
|
||||
{"$m", "ftp-account", TRUE},
|
||||
{"$n", "proxy-anyauth", FALSE},
|
||||
{"$o", "trace-time", FALSE},
|
||||
{"$p", "ignore-content-length", FALSE},
|
||||
{"$q", "ftp-skip-pasv-ip", FALSE},
|
||||
{"$r", "ftp-method", TRUE},
|
||||
{"$s", "local-port", TRUE},
|
||||
{"$t", "socks4", TRUE},
|
||||
{"$T", "socks4a", TRUE},
|
||||
{"$u", "ftp-alternative-to-user", TRUE},
|
||||
{"$v", "ftp-ssl-reqd", FALSE},
|
||||
{"$b", "ftp-pasv", ARG_BOOL},
|
||||
{"$c", "socks5", ARG_STRING},
|
||||
{"$d", "tcp-nodelay", ARG_BOOL},
|
||||
{"$e", "proxy-digest", ARG_BOOL},
|
||||
{"$f", "proxy-basic", ARG_BOOL},
|
||||
{"$g", "retry", ARG_STRING},
|
||||
{"$V", "retry-connrefused", ARG_BOOL},
|
||||
{"$h", "retry-delay", ARG_STRING},
|
||||
{"$i", "retry-max-time", ARG_STRING},
|
||||
{"$k", "proxy-negotiate", ARG_BOOL},
|
||||
{"$m", "ftp-account", ARG_STRING},
|
||||
{"$n", "proxy-anyauth", ARG_BOOL},
|
||||
{"$o", "trace-time", ARG_BOOL},
|
||||
{"$p", "ignore-content-length", ARG_BOOL},
|
||||
{"$q", "ftp-skip-pasv-ip", ARG_BOOL},
|
||||
{"$r", "ftp-method", ARG_STRING},
|
||||
{"$s", "local-port", ARG_STRING},
|
||||
{"$t", "socks4", ARG_STRING},
|
||||
{"$T", "socks4a", ARG_STRING},
|
||||
{"$u", "ftp-alternative-to-user", ARG_STRING},
|
||||
{"$v", "ftp-ssl-reqd", ARG_BOOL},
|
||||
/* 'ftp-ssl-reqd' deprecated name since 7.20.0 */
|
||||
{"$v", "ssl-reqd", FALSE},
|
||||
{"$v", "ssl-reqd", ARG_BOOL},
|
||||
/* 'ssl-reqd' new in 7.20.0, previously this was ftp-ssl-reqd */
|
||||
{"$w", "sessionid", FALSE},
|
||||
{"$w", "sessionid", ARG_BOOL},
|
||||
/* 'sessionid' listed as --no-sessionid in the help */
|
||||
{"$x", "ftp-ssl-control", FALSE},
|
||||
{"$y", "ftp-ssl-ccc", FALSE},
|
||||
{"$j", "ftp-ssl-ccc-mode", TRUE},
|
||||
{"$z", "libcurl", TRUE},
|
||||
{"$#", "raw", FALSE},
|
||||
{"$0", "post301", FALSE},
|
||||
{"$1", "keepalive", FALSE},
|
||||
{"$x", "ftp-ssl-control", ARG_BOOL},
|
||||
{"$y", "ftp-ssl-ccc", ARG_BOOL},
|
||||
{"$j", "ftp-ssl-ccc-mode", ARG_STRING},
|
||||
{"$z", "libcurl", ARG_STRING},
|
||||
{"$#", "raw", ARG_BOOL},
|
||||
{"$0", "post301", ARG_BOOL},
|
||||
{"$1", "keepalive", ARG_BOOL},
|
||||
/* 'keepalive' listed as --no-keepalive in the help */
|
||||
{"$2", "socks5-hostname", TRUE},
|
||||
{"$3", "keepalive-time", TRUE},
|
||||
{"$4", "post302", FALSE},
|
||||
{"$5", "noproxy", TRUE},
|
||||
{"$7", "socks5-gssapi-nec", FALSE},
|
||||
{"$8", "proxy1.0", TRUE},
|
||||
{"$9", "tftp-blksize", TRUE},
|
||||
{"$A", "mail-from", TRUE},
|
||||
{"$B", "mail-rcpt", TRUE},
|
||||
{"$C", "ftp-pret", FALSE},
|
||||
{"$D", "proto", TRUE},
|
||||
{"$E", "proto-redir", TRUE},
|
||||
{"$F", "resolve", TRUE},
|
||||
{"$G", "delegation", TRUE},
|
||||
{"$H", "mail-auth", TRUE},
|
||||
{"$I", "post303", FALSE},
|
||||
{"$J", "metalink", FALSE},
|
||||
{"$K", "sasl-ir", FALSE},
|
||||
{"$L", "test-event", FALSE},
|
||||
{"$M", "unix-socket", TRUE},
|
||||
{"$N", "path-as-is", FALSE},
|
||||
{"$O", "socks5-gssapi-service", TRUE},
|
||||
{"$2", "socks5-hostname", ARG_STRING},
|
||||
{"$3", "keepalive-time", ARG_STRING},
|
||||
{"$4", "post302", ARG_BOOL},
|
||||
{"$5", "noproxy", ARG_STRING},
|
||||
{"$7", "socks5-gssapi-nec", ARG_BOOL},
|
||||
{"$8", "proxy1.0", ARG_STRING},
|
||||
{"$9", "tftp-blksize", ARG_STRING},
|
||||
{"$A", "mail-from", ARG_STRING},
|
||||
{"$B", "mail-rcpt", ARG_STRING},
|
||||
{"$C", "ftp-pret", ARG_BOOL},
|
||||
{"$D", "proto", ARG_STRING},
|
||||
{"$E", "proto-redir", ARG_STRING},
|
||||
{"$F", "resolve", ARG_STRING},
|
||||
{"$G", "delegation", ARG_STRING},
|
||||
{"$H", "mail-auth", ARG_STRING},
|
||||
{"$I", "post303", ARG_BOOL},
|
||||
{"$J", "metalink", ARG_BOOL},
|
||||
{"$K", "sasl-ir", ARG_BOOL},
|
||||
{"$L", "test-event", ARG_BOOL},
|
||||
{"$M", "unix-socket", ARG_STRING},
|
||||
{"$N", "path-as-is", ARG_BOOL},
|
||||
{"$O", "socks5-gssapi-service", ARG_STRING},
|
||||
/* 'socks5-gssapi-service' merged with'proxy-service-name' and
|
||||
deprecated since 7.49.0 */
|
||||
{"$O", "proxy-service-name", TRUE},
|
||||
{"$P", "service-name", TRUE},
|
||||
{"$Q", "proto-default", TRUE},
|
||||
{"$R", "expect100-timeout", TRUE},
|
||||
{"$S", "tftp-no-options", FALSE},
|
||||
{"$U", "connect-to", TRUE},
|
||||
{"$W", "abstract-unix-socket", TRUE},
|
||||
{"$X", "tls-max", TRUE},
|
||||
{"$Y", "suppress-connect-headers", FALSE},
|
||||
{"0", "http1.0", FALSE},
|
||||
{"01", "http1.1", FALSE},
|
||||
{"02", "http2", FALSE},
|
||||
{"03", "http2-prior-knowledge", FALSE},
|
||||
{"1", "tlsv1", FALSE},
|
||||
{"10", "tlsv1.0", FALSE},
|
||||
{"11", "tlsv1.1", FALSE},
|
||||
{"12", "tlsv1.2", FALSE},
|
||||
{"13", "tlsv1.3", FALSE},
|
||||
{"2", "sslv2", FALSE},
|
||||
{"3", "sslv3", FALSE},
|
||||
{"4", "ipv4", FALSE},
|
||||
{"6", "ipv6", FALSE},
|
||||
{"a", "append", FALSE},
|
||||
{"A", "user-agent", TRUE},
|
||||
{"b", "cookie", TRUE},
|
||||
{"B", "use-ascii", FALSE},
|
||||
{"c", "cookie-jar", TRUE},
|
||||
{"C", "continue-at", TRUE},
|
||||
{"d", "data", TRUE},
|
||||
{"dr", "data-raw", TRUE},
|
||||
{"da", "data-ascii", TRUE},
|
||||
{"db", "data-binary", TRUE},
|
||||
{"de", "data-urlencode", TRUE},
|
||||
{"D", "dump-header", TRUE},
|
||||
{"e", "referer", TRUE},
|
||||
{"E", "cert", TRUE},
|
||||
{"Ea", "cacert", TRUE},
|
||||
{"Eb", "cert-type", TRUE},
|
||||
{"Ec", "key", TRUE},
|
||||
{"Ed", "key-type", TRUE},
|
||||
{"Ee", "pass", TRUE},
|
||||
{"Ef", "engine", TRUE},
|
||||
{"Eg", "capath", TRUE},
|
||||
{"Eh", "pubkey", TRUE},
|
||||
{"Ei", "hostpubmd5", TRUE},
|
||||
{"Ej", "crlfile", TRUE},
|
||||
{"Ek", "tlsuser", TRUE},
|
||||
{"El", "tlspassword", TRUE},
|
||||
{"Em", "tlsauthtype", TRUE},
|
||||
{"En", "ssl-allow-beast", FALSE},
|
||||
{"Eo", "login-options", TRUE},
|
||||
{"Ep", "pinnedpubkey", TRUE},
|
||||
{"Eq", "cert-status", FALSE},
|
||||
{"Er", "false-start", FALSE},
|
||||
{"Es", "ssl-no-revoke", FALSE},
|
||||
{"Et", "tcp-fastopen", FALSE},
|
||||
{"Eu", "proxy-tlsuser", TRUE},
|
||||
{"Ev", "proxy-tlspassword", TRUE},
|
||||
{"Ew", "proxy-tlsauthtype", TRUE},
|
||||
{"Ex", "proxy-cert", TRUE},
|
||||
{"Ey", "proxy-cert-type", TRUE},
|
||||
{"Ez", "proxy-key", TRUE},
|
||||
{"E0", "proxy-key-type", TRUE},
|
||||
{"E1", "proxy-pass", TRUE},
|
||||
{"E2", "proxy-ciphers", TRUE},
|
||||
{"E3", "proxy-crlfile", TRUE},
|
||||
{"E4", "proxy-ssl-allow-beast", FALSE},
|
||||
{"E5", "login-options", TRUE},
|
||||
{"E6", "proxy-cacert", TRUE},
|
||||
{"E7", "proxy-capath", TRUE},
|
||||
{"E8", "proxy-insecure", FALSE},
|
||||
{"E9", "proxy-tlsv1", FALSE},
|
||||
{"f", "fail", FALSE},
|
||||
{"fa", "fail-early", FALSE},
|
||||
{"F", "form", TRUE},
|
||||
{"Fs", "form-string", TRUE},
|
||||
{"g", "globoff", FALSE},
|
||||
{"G", "get", FALSE},
|
||||
{"h", "help", FALSE},
|
||||
{"H", "header", TRUE},
|
||||
{"Hp", "proxy-header", TRUE},
|
||||
{"i", "include", FALSE},
|
||||
{"I", "head", FALSE},
|
||||
{"j", "junk-session-cookies", FALSE},
|
||||
{"J", "remote-header-name", FALSE},
|
||||
{"k", "insecure", FALSE},
|
||||
{"K", "config", TRUE},
|
||||
{"l", "list-only", FALSE},
|
||||
{"L", "location", FALSE},
|
||||
{"Lt", "location-trusted", FALSE},
|
||||
{"m", "max-time", TRUE},
|
||||
{"M", "manual", FALSE},
|
||||
{"n", "netrc", FALSE},
|
||||
{"no", "netrc-optional", FALSE},
|
||||
{"ne", "netrc-file", TRUE},
|
||||
{"N", "buffer", FALSE},
|
||||
{"$O", "proxy-service-name", ARG_STRING},
|
||||
{"$P", "service-name", ARG_STRING},
|
||||
{"$Q", "proto-default", ARG_STRING},
|
||||
{"$R", "expect100-timeout", ARG_STRING},
|
||||
{"$S", "tftp-no-options", ARG_BOOL},
|
||||
{"$U", "connect-to", ARG_STRING},
|
||||
{"$W", "abstract-unix-socket", ARG_STRING},
|
||||
{"$X", "tls-max", ARG_STRING},
|
||||
{"$Y", "suppress-connect-headers", ARG_BOOL},
|
||||
{"0", "http1.0", ARG_NONE},
|
||||
{"01", "http1.1", ARG_NONE},
|
||||
{"02", "http2", ARG_NONE},
|
||||
{"03", "http2-prior-knowledge", ARG_NONE},
|
||||
{"1", "tlsv1", ARG_NONE},
|
||||
{"10", "tlsv1.0", ARG_NONE},
|
||||
{"11", "tlsv1.1", ARG_NONE},
|
||||
{"12", "tlsv1.2", ARG_NONE},
|
||||
{"13", "tlsv1.3", ARG_NONE},
|
||||
{"2", "sslv2", ARG_NONE},
|
||||
{"3", "sslv3", ARG_NONE},
|
||||
{"4", "ipv4", ARG_NONE},
|
||||
{"6", "ipv6", ARG_NONE},
|
||||
{"a", "append", ARG_BOOL},
|
||||
{"A", "user-agent", ARG_STRING},
|
||||
{"b", "cookie", ARG_STRING},
|
||||
{"B", "use-ascii", ARG_BOOL},
|
||||
{"c", "cookie-jar", ARG_STRING},
|
||||
{"C", "continue-at", ARG_STRING},
|
||||
{"d", "data", ARG_STRING},
|
||||
{"dr", "data-raw", ARG_STRING},
|
||||
{"da", "data-ascii", ARG_STRING},
|
||||
{"db", "data-binary", ARG_STRING},
|
||||
{"de", "data-urlencode", ARG_STRING},
|
||||
{"D", "dump-header", ARG_STRING},
|
||||
{"e", "referer", ARG_STRING},
|
||||
{"E", "cert", ARG_STRING},
|
||||
{"Ea", "cacert", ARG_STRING},
|
||||
{"Eb", "cert-type", ARG_STRING},
|
||||
{"Ec", "key", ARG_STRING},
|
||||
{"Ed", "key-type", ARG_STRING},
|
||||
{"Ee", "pass", ARG_STRING},
|
||||
{"Ef", "engine", ARG_STRING},
|
||||
{"Eg", "capath", ARG_STRING},
|
||||
{"Eh", "pubkey", ARG_STRING},
|
||||
{"Ei", "hostpubmd5", ARG_STRING},
|
||||
{"Ej", "crlfile", ARG_STRING},
|
||||
{"Ek", "tlsuser", ARG_STRING},
|
||||
{"El", "tlspassword", ARG_STRING},
|
||||
{"Em", "tlsauthtype", ARG_STRING},
|
||||
{"En", "ssl-allow-beast", ARG_BOOL},
|
||||
{"Eo", "login-options", ARG_STRING},
|
||||
{"Ep", "pinnedpubkey", ARG_STRING},
|
||||
{"Eq", "cert-status", ARG_BOOL},
|
||||
{"Er", "false-start", ARG_BOOL},
|
||||
{"Es", "ssl-no-revoke", ARG_BOOL},
|
||||
{"Et", "tcp-fastopen", ARG_BOOL},
|
||||
{"Eu", "proxy-tlsuser", ARG_STRING},
|
||||
{"Ev", "proxy-tlspassword", ARG_STRING},
|
||||
{"Ew", "proxy-tlsauthtype", ARG_STRING},
|
||||
{"Ex", "proxy-cert", ARG_STRING},
|
||||
{"Ey", "proxy-cert-type", ARG_STRING},
|
||||
{"Ez", "proxy-key", ARG_STRING},
|
||||
{"E0", "proxy-key-type", ARG_STRING},
|
||||
{"E1", "proxy-pass", ARG_STRING},
|
||||
{"E2", "proxy-ciphers", ARG_STRING},
|
||||
{"E3", "proxy-crlfile", ARG_STRING},
|
||||
{"E4", "proxy-ssl-allow-beast", ARG_BOOL},
|
||||
{"E5", "login-options", ARG_STRING},
|
||||
{"E6", "proxy-cacert", ARG_STRING},
|
||||
{"E7", "proxy-capath", ARG_STRING},
|
||||
{"E8", "proxy-insecure", ARG_BOOL},
|
||||
{"E9", "proxy-tlsv1", ARG_NONE},
|
||||
{"f", "fail", ARG_BOOL},
|
||||
{"fa", "fail-early", ARG_BOOL},
|
||||
{"F", "form", ARG_STRING},
|
||||
{"Fs", "form-string", ARG_STRING},
|
||||
{"g", "globoff", ARG_BOOL},
|
||||
{"G", "get", ARG_NONE},
|
||||
{"h", "help", ARG_BOOL},
|
||||
{"H", "header", ARG_STRING},
|
||||
{"Hp", "proxy-header", ARG_STRING},
|
||||
{"i", "include", ARG_BOOL},
|
||||
{"I", "head", ARG_BOOL},
|
||||
{"j", "junk-session-cookies", ARG_BOOL},
|
||||
{"J", "remote-header-name", ARG_BOOL},
|
||||
{"k", "insecure", ARG_BOOL},
|
||||
{"K", "config", ARG_STRING},
|
||||
{"l", "list-only", ARG_BOOL},
|
||||
{"L", "location", ARG_BOOL},
|
||||
{"Lt", "location-trusted", ARG_BOOL},
|
||||
{"m", "max-time", ARG_STRING},
|
||||
{"M", "manual", ARG_BOOL},
|
||||
{"n", "netrc", ARG_BOOL},
|
||||
{"no", "netrc-optional", ARG_BOOL},
|
||||
{"ne", "netrc-file", ARG_STRING},
|
||||
{"N", "buffer", ARG_BOOL},
|
||||
/* 'buffer' listed as --no-buffer in the help */
|
||||
{"o", "output", TRUE},
|
||||
{"O", "remote-name", FALSE},
|
||||
{"Oa", "remote-name-all", FALSE},
|
||||
{"p", "proxytunnel", FALSE},
|
||||
{"P", "ftp-port", TRUE},
|
||||
{"q", "disable", FALSE},
|
||||
{"Q", "quote", TRUE},
|
||||
{"r", "range", TRUE},
|
||||
{"R", "remote-time", FALSE},
|
||||
{"s", "silent", FALSE},
|
||||
{"S", "show-error", FALSE},
|
||||
{"t", "telnet-option", TRUE},
|
||||
{"T", "upload-file", TRUE},
|
||||
{"u", "user", TRUE},
|
||||
{"U", "proxy-user", TRUE},
|
||||
{"v", "verbose", FALSE},
|
||||
{"V", "version", FALSE},
|
||||
{"w", "write-out", TRUE},
|
||||
{"x", "proxy", TRUE},
|
||||
{"xa", "preproxy", TRUE},
|
||||
{"X", "request", TRUE},
|
||||
{"Y", "speed-limit", TRUE},
|
||||
{"y", "speed-time", TRUE},
|
||||
{"z", "time-cond", TRUE},
|
||||
{"#", "progress-bar", FALSE},
|
||||
{":", "next", FALSE},
|
||||
{"o", "output", ARG_STRING},
|
||||
{"O", "remote-name", ARG_NONE},
|
||||
{"Oa", "remote-name-all", ARG_BOOL},
|
||||
{"p", "proxytunnel", ARG_BOOL},
|
||||
{"P", "ftp-port", ARG_STRING},
|
||||
{"q", "disable", ARG_BOOL},
|
||||
{"Q", "quote", ARG_STRING},
|
||||
{"r", "range", ARG_STRING},
|
||||
{"R", "remote-time", ARG_BOOL},
|
||||
{"s", "silent", ARG_BOOL},
|
||||
{"S", "show-error", ARG_BOOL},
|
||||
{"t", "telnet-option", ARG_STRING},
|
||||
{"T", "upload-file", ARG_STRING},
|
||||
{"u", "user", ARG_STRING},
|
||||
{"U", "proxy-user", ARG_STRING},
|
||||
{"v", "verbose", ARG_BOOL},
|
||||
{"V", "version", ARG_BOOL},
|
||||
{"w", "write-out", ARG_STRING},
|
||||
{"x", "proxy", ARG_STRING},
|
||||
{"xa", "preproxy", ARG_STRING},
|
||||
{"X", "request", ARG_STRING},
|
||||
{"Y", "speed-limit", ARG_STRING},
|
||||
{"y", "speed-time", ARG_STRING},
|
||||
{"z", "time-cond", ARG_STRING},
|
||||
{"#", "progress-bar", ARG_BOOL},
|
||||
{":", "next", ARG_NONE},
|
||||
};
|
||||
|
||||
/* Split the argument of -E to 'certname' and 'passphrase' separated by colon.
|
||||
@ -506,7 +510,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
|
||||
}
|
||||
}
|
||||
|
||||
if(aliases[hit].extraparam) {
|
||||
if(aliases[hit].desc == ARG_STRING) {
|
||||
/* this option requires an extra parameter */
|
||||
if(!longopt && parse[1]) {
|
||||
nextarg = (char *)&parse[1]; /* this is the actual extra parameter */
|
||||
@ -517,6 +521,8 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
|
||||
else
|
||||
*usedarg = TRUE; /* mark it as used */
|
||||
}
|
||||
else if((aliases[hit].desc == ARG_NONE) && !toggle)
|
||||
return PARAM_NO_PREFIX;
|
||||
|
||||
switch(letter) {
|
||||
case '*': /* options without a short option */
|
||||
|
@ -7,7 +7,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
@ -40,6 +40,7 @@ typedef enum {
|
||||
PARAM_LIBCURL_UNSUPPORTED_PROTOCOL,
|
||||
PARAM_NO_MEM,
|
||||
PARAM_NEXT_OPERATION,
|
||||
PARAM_NO_PREFIX,
|
||||
PARAM_LAST
|
||||
} ParameterError;
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
@ -62,6 +62,8 @@ const char *param2text(int res)
|
||||
return "a specified protocol is unsupported by libcurl";
|
||||
case PARAM_NO_MEM:
|
||||
return "out of memory";
|
||||
case PARAM_NO_PREFIX:
|
||||
return "the given option can't be reversed with a --no- prefix";
|
||||
default:
|
||||
return "unknown error";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user