tool_help.c 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655
  1. /***************************************************************************
  2. * _ _ ____ _
  3. * Project ___| | | | _ \| |
  4. * / __| | | | |_) | |
  5. * | (__| |_| | _ <| |___
  6. * \___|\___/|_| \_\_____|
  7. *
  8. * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
  9. *
  10. * This software is licensed as described in the file COPYING, which
  11. * you should have received as part of this distribution. The terms
  12. * are also available at https://curl.haxx.se/docs/copyright.html.
  13. *
  14. * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. * copies of the Software, and permit persons to whom the Software is
  16. * furnished to do so, under the terms of the COPYING file.
  17. *
  18. * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. * KIND, either express or implied.
  20. *
  21. ***************************************************************************/
  22. #include "tool_setup.h"
  23. #if defined(HAVE_STRCASECMP) && defined(HAVE_STRINGS_H)
  24. #include <strings.h>
  25. #endif
  26. #include "tool_panykey.h"
  27. #include "tool_help.h"
  28. #include "tool_libinfo.h"
  29. #include "tool_version.h"
  30. #include "memdebug.h" /* keep this as LAST include */
  31. #ifdef MSDOS
  32. # define USE_WATT32
  33. #endif
  34. /*
  35. * The help output is generated with the following command
  36. ---------------------------------------------------------
  37. cd $srcroot/docs/cmdline-opts
  38. ./gen.pl listhelp *.d
  39. */
  40. struct helptxt {
  41. const char *opt;
  42. const char *desc;
  43. };
  44. static const struct helptxt helptext[] = {
  45. {" --abstract-unix-socket <path>",
  46. "Connect via abstract Unix domain socket"},
  47. {" --alt-svc <file name>",
  48. "Enable alt-svc with this cache file"},
  49. {" --anyauth",
  50. "Pick any authentication method"},
  51. {"-a, --append",
  52. "Append to target file when uploading"},
  53. {" --basic",
  54. "Use HTTP Basic Authentication"},
  55. {" --cacert <file>",
  56. "CA certificate to verify peer against"},
  57. {" --capath <dir>",
  58. "CA directory to verify peer against"},
  59. {"-E, --cert <certificate[:password]>",
  60. "Client certificate file and password"},
  61. {" --cert-status",
  62. "Verify the status of the server certificate"},
  63. {" --cert-type <type>",
  64. "Certificate type (DER/PEM/ENG)"},
  65. {" --ciphers <list of ciphers>",
  66. "SSL ciphers to use"},
  67. {" --compressed",
  68. "Request compressed response"},
  69. {" --compressed-ssh",
  70. "Enable SSH compression"},
  71. {"-K, --config <file>",
  72. "Read config from a file"},
  73. {" --connect-timeout <seconds>",
  74. "Maximum time allowed for connection"},
  75. {" --connect-to <HOST1:PORT1:HOST2:PORT2>",
  76. "Connect to host"},
  77. {"-C, --continue-at <offset>",
  78. "Resumed transfer offset"},
  79. {"-b, --cookie <data|filename>",
  80. "Send cookies from string/file"},
  81. {"-c, --cookie-jar <filename>",
  82. "Write cookies to <filename> after operation"},
  83. {" --create-dirs",
  84. "Create necessary local directory hierarchy"},
  85. {" --crlf",
  86. "Convert LF to CRLF in upload"},
  87. {" --crlfile <file>",
  88. "Get a CRL list in PEM format from the given file"},
  89. {" --curves <algorithm list>",
  90. "(EC) TLS key exchange algorithm(s) to request "},
  91. {"-d, --data <data>",
  92. "HTTP POST data"},
  93. {" --data-ascii <data>",
  94. "HTTP POST ASCII data"},
  95. {" --data-binary <data>",
  96. "HTTP POST binary data"},
  97. {" --data-raw <data>",
  98. "HTTP POST data, '@' allowed"},
  99. {" --data-urlencode <data>",
  100. "HTTP POST data url encoded"},
  101. {" --delegation <LEVEL>",
  102. "GSS-API delegation permission"},
  103. {" --digest",
  104. "Use HTTP Digest Authentication"},
  105. {"-q, --disable",
  106. "Disable .curlrc"},
  107. {" --disable-eprt",
  108. "Inhibit using EPRT or LPRT"},
  109. {" --disable-epsv",
  110. "Inhibit using EPSV"},
  111. {" --disallow-username-in-url",
  112. "Disallow username in url"},
  113. {" --dns-interface <interface>",
  114. "Interface to use for DNS requests"},
  115. {" --dns-ipv4-addr <address>",
  116. "IPv4 address to use for DNS requests"},
  117. {" --dns-ipv6-addr <address>",
  118. "IPv6 address to use for DNS requests"},
  119. {" --dns-servers <addresses>",
  120. "DNS server addrs to use"},
  121. {" --doh-url <URL>",
  122. "Resolve host names over DOH"},
  123. {"-D, --dump-header <filename>",
  124. "Write the received headers to <filename>"},
  125. {" --egd-file <file>",
  126. "EGD socket path for random data"},
  127. {" --engine <name>",
  128. "Crypto engine to use"},
  129. {" --etag-compare <file>",
  130. "Pass an ETag from a file as a custom header"},
  131. {" --etag-save <file>",
  132. "Parse ETag from a request and save it to a file"},
  133. {" --expect100-timeout <seconds>",
  134. "How long to wait for 100-continue"},
  135. {"-f, --fail",
  136. "Fail silently (no output at all) on HTTP errors"},
  137. {" --fail-early",
  138. "Fail on first transfer error, do not continue"},
  139. {" --false-start",
  140. "Enable TLS False Start"},
  141. {"-F, --form <name=content>",
  142. "Specify multipart MIME data"},
  143. {" --form-string <name=string>",
  144. "Specify multipart MIME data"},
  145. {" --ftp-account <data>",
  146. "Account data string"},
  147. {" --ftp-alternative-to-user <command>",
  148. "String to replace USER [name]"},
  149. {" --ftp-create-dirs",
  150. "Create the remote dirs if not present"},
  151. {" --ftp-method <method>",
  152. "Control CWD usage"},
  153. {" --ftp-pasv",
  154. "Use PASV/EPSV instead of PORT"},
  155. {"-P, --ftp-port <address>",
  156. "Use PORT instead of PASV"},
  157. {" --ftp-pret",
  158. "Send PRET before PASV"},
  159. {" --ftp-skip-pasv-ip",
  160. "Skip the IP address for PASV"},
  161. {" --ftp-ssl-ccc",
  162. "Send CCC after authenticating"},
  163. {" --ftp-ssl-ccc-mode <active/passive>",
  164. "Set CCC mode"},
  165. {" --ftp-ssl-control",
  166. "Require SSL/TLS for FTP login, clear for transfer"},
  167. {"-G, --get",
  168. "Put the post data in the URL and use GET"},
  169. {"-g, --globoff",
  170. "Disable URL sequences and ranges using {} and []"},
  171. {" --happy-eyeballs-timeout-ms <milliseconds>",
  172. "Time for IPv6 before trying IPv4"},
  173. {" --haproxy-protocol",
  174. "Send HAProxy PROXY protocol v1 header"},
  175. {"-I, --head",
  176. "Show document info only"},
  177. {"-H, --header <header/@file>",
  178. "Pass custom header(s) to server"},
  179. {"-h, --help",
  180. "This help text"},
  181. {" --hostpubmd5 <md5>",
  182. "Acceptable MD5 hash of the host public key"},
  183. {" --http0.9",
  184. "Allow HTTP 0.9 responses"},
  185. {"-0, --http1.0",
  186. "Use HTTP 1.0"},
  187. {" --http1.1",
  188. "Use HTTP 1.1"},
  189. {" --http2",
  190. "Use HTTP 2"},
  191. {" --http2-prior-knowledge",
  192. "Use HTTP 2 without HTTP/1.1 Upgrade"},
  193. {" --http3",
  194. "Use HTTP v3"},
  195. {" --ignore-content-length",
  196. "Ignore the size of the remote resource"},
  197. {"-i, --include",
  198. "Include protocol response headers in the output"},
  199. {"-k, --insecure",
  200. "Allow insecure server connections when using SSL"},
  201. {" --interface <name>",
  202. "Use network INTERFACE (or address)"},
  203. {"-4, --ipv4",
  204. "Resolve names to IPv4 addresses"},
  205. {"-6, --ipv6",
  206. "Resolve names to IPv6 addresses"},
  207. {"-j, --junk-session-cookies",
  208. "Ignore session cookies read from file"},
  209. {" --keepalive-time <seconds>",
  210. "Interval time for keepalive probes"},
  211. {" --key <key>",
  212. "Private key file name"},
  213. {" --key-type <type>",
  214. "Private key file type (DER/PEM/ENG)"},
  215. {" --krb <level>",
  216. "Enable Kerberos with security <level>"},
  217. {" --libcurl <file>",
  218. "Dump libcurl equivalent code of this command line"},
  219. {" --limit-rate <speed>",
  220. "Limit transfer speed to RATE"},
  221. {"-l, --list-only",
  222. "List only mode"},
  223. {" --local-port <num/range>",
  224. "Force use of RANGE for local port numbers"},
  225. {"-L, --location",
  226. "Follow redirects"},
  227. {" --location-trusted",
  228. "Like --location, and send auth to other hosts"},
  229. {" --login-options <options>",
  230. "Server login options"},
  231. {" --mail-auth <address>",
  232. "Originator address of the original email"},
  233. {" --mail-from <address>",
  234. "Mail from this address"},
  235. {" --mail-rcpt <address>",
  236. "Mail to this address"},
  237. {" --mail-rcpt-allowfails",
  238. "Allow RCPT TO command to fail for some recipients"},
  239. {"-M, --manual",
  240. "Display the full manual"},
  241. {" --max-filesize <bytes>",
  242. "Maximum file size to download"},
  243. {" --max-redirs <num>",
  244. "Maximum number of redirects allowed"},
  245. {"-m, --max-time <seconds>",
  246. "Maximum time allowed for the transfer"},
  247. {" --metalink",
  248. "Process given URLs as metalink XML file"},
  249. {" --negotiate",
  250. "Use HTTP Negotiate (SPNEGO) authentication"},
  251. {"-n, --netrc",
  252. "Must read .netrc for user name and password"},
  253. {" --netrc-file <filename>",
  254. "Specify FILE for netrc"},
  255. {" --netrc-optional",
  256. "Use either .netrc or URL"},
  257. {"-:, --next",
  258. "Make next URL use its separate set of options"},
  259. {" --no-alpn",
  260. "Disable the ALPN TLS extension"},
  261. {"-N, --no-buffer",
  262. "Disable buffering of the output stream"},
  263. {" --no-keepalive",
  264. "Disable TCP keepalive on the connection"},
  265. {" --no-npn",
  266. "Disable the NPN TLS extension"},
  267. {" --no-progress-meter",
  268. "Do not show the progress meter"},
  269. {" --no-sessionid",
  270. "Disable SSL session-ID reusing"},
  271. {" --noproxy <no-proxy-list>",
  272. "List of hosts which do not use proxy"},
  273. {" --ntlm",
  274. "Use HTTP NTLM authentication"},
  275. {" --ntlm-wb",
  276. "Use HTTP NTLM authentication with winbind"},
  277. {" --oauth2-bearer <token>",
  278. "OAuth 2 Bearer Token"},
  279. {"-o, --output <file>",
  280. "Write to file instead of stdout"},
  281. {" --output-dir <dir>",
  282. "Directory to save files in"},
  283. {"-Z, --parallel",
  284. "Perform transfers in parallel"},
  285. {" --parallel-immediate",
  286. "Do not wait for multiplexing (with --parallel)"},
  287. {" --parallel-max",
  288. "Maximum concurrency for parallel transfers"},
  289. {" --pass <phrase>",
  290. "Pass phrase for the private key"},
  291. {" --path-as-is",
  292. "Do not squash .. sequences in URL path"},
  293. {" --pinnedpubkey <hashes>",
  294. "FILE/HASHES Public key to verify peer against"},
  295. {" --post301",
  296. "Do not switch to GET after following a 301"},
  297. {" --post302",
  298. "Do not switch to GET after following a 302"},
  299. {" --post303",
  300. "Do not switch to GET after following a 303"},
  301. {" --preproxy [protocol://]host[:port]",
  302. "Use this proxy first"},
  303. {"-#, --progress-bar",
  304. "Display transfer progress as a bar"},
  305. {" --proto <protocols>",
  306. "Enable/disable PROTOCOLS"},
  307. {" --proto-default <protocol>",
  308. "Use PROTOCOL for any URL missing a scheme"},
  309. {" --proto-redir <protocols>",
  310. "Enable/disable PROTOCOLS on redirect"},
  311. {"-x, --proxy [protocol://]host[:port]",
  312. "Use this proxy"},
  313. {" --proxy-anyauth",
  314. "Pick any proxy authentication method"},
  315. {" --proxy-basic",
  316. "Use Basic authentication on the proxy"},
  317. {" --proxy-cacert <file>",
  318. "CA certificate to verify peer against for proxy"},
  319. {" --proxy-capath <dir>",
  320. "CA directory to verify peer against for proxy"},
  321. {" --proxy-cert <cert[:passwd]>",
  322. "Set client certificate for proxy"},
  323. {" --proxy-cert-type <type>",
  324. "Client certificate type for HTTPS proxy"},
  325. {" --proxy-ciphers <list>",
  326. "SSL ciphers to use for proxy"},
  327. {" --proxy-crlfile <file>",
  328. "Set a CRL list for proxy"},
  329. {" --proxy-digest",
  330. "Use Digest authentication on the proxy"},
  331. {" --proxy-header <header/@file>",
  332. "Pass custom header(s) to proxy"},
  333. {" --proxy-insecure",
  334. "Do HTTPS proxy connections without verifying the proxy"},
  335. {" --proxy-key <key>",
  336. "Private key for HTTPS proxy"},
  337. {" --proxy-key-type <type>",
  338. "Private key file type for proxy"},
  339. {" --proxy-negotiate",
  340. "Use HTTP Negotiate (SPNEGO) authentication on the proxy"},
  341. {" --proxy-ntlm",
  342. "Use NTLM authentication on the proxy"},
  343. {" --proxy-pass <phrase>",
  344. "Pass phrase for the private key for HTTPS proxy"},
  345. {" --proxy-pinnedpubkey <hashes>",
  346. "FILE/HASHES public key to verify proxy with"},
  347. {" --proxy-service-name <name>",
  348. "SPNEGO proxy service name"},
  349. {" --proxy-ssl-allow-beast",
  350. "Allow security flaw for interop for HTTPS proxy"},
  351. {" --proxy-tls13-ciphers <ciphersuite list>",
  352. "TLS 1.3 proxy cipher suites"},
  353. {" --proxy-tlsauthtype <type>",
  354. "TLS authentication type for HTTPS proxy"},
  355. {" --proxy-tlspassword <string>",
  356. "TLS password for HTTPS proxy"},
  357. {" --proxy-tlsuser <name>",
  358. "TLS username for HTTPS proxy"},
  359. {" --proxy-tlsv1",
  360. "Use TLSv1 for HTTPS proxy"},
  361. {"-U, --proxy-user <user:password>",
  362. "Proxy user and password"},
  363. {" --proxy1.0 <host[:port]>",
  364. "Use HTTP/1.0 proxy on given port"},
  365. {"-p, --proxytunnel",
  366. "Operate through an HTTP proxy tunnel (using CONNECT)"},
  367. {" --pubkey <key>",
  368. "SSH Public key file name"},
  369. {"-Q, --quote",
  370. "Send command(s) to server before transfer"},
  371. {" --random-file <file>",
  372. "File for reading random data from"},
  373. {"-r, --range <range>",
  374. "Retrieve only the bytes within RANGE"},
  375. {" --raw",
  376. "Do HTTP \"raw\"; no transfer decoding"},
  377. {"-e, --referer <URL>",
  378. "Referrer URL"},
  379. {"-J, --remote-header-name",
  380. "Use the header-provided filename"},
  381. {"-O, --remote-name",
  382. "Write output to a file named as the remote file"},
  383. {" --remote-name-all",
  384. "Use the remote file name for all URLs"},
  385. {"-R, --remote-time",
  386. "Set the remote file's time on the local output"},
  387. {"-X, --request <command>",
  388. "Specify request command to use"},
  389. {" --request-target",
  390. "Specify the target for this request"},
  391. {" --resolve <host:port:addr[,addr]...>",
  392. "Resolve the host+port to this address"},
  393. {" --retry <num>",
  394. "Retry request if transient problems occur"},
  395. {" --retry-all-errors",
  396. "Retry all errors (use with --retry)"},
  397. {" --retry-connrefused",
  398. "Retry on connection refused (use with --retry)"},
  399. {" --retry-delay <seconds>",
  400. "Wait time between retries"},
  401. {" --retry-max-time <seconds>",
  402. "Retry only within this period"},
  403. {" --sasl-authzid <identity>",
  404. "Identity for SASL PLAIN authentication"},
  405. {" --sasl-ir",
  406. "Enable initial response in SASL authentication"},
  407. {" --service-name <name>",
  408. "SPNEGO service name"},
  409. {"-S, --show-error",
  410. "Show error even when -s is used"},
  411. {"-s, --silent",
  412. "Silent mode"},
  413. {" --socks4 <host[:port]>",
  414. "SOCKS4 proxy on given host + port"},
  415. {" --socks4a <host[:port]>",
  416. "SOCKS4a proxy on given host + port"},
  417. {" --socks5 <host[:port]>",
  418. "SOCKS5 proxy on given host + port"},
  419. {" --socks5-basic",
  420. "Enable username/password auth for SOCKS5 proxies"},
  421. {" --socks5-gssapi",
  422. "Enable GSS-API auth for SOCKS5 proxies"},
  423. {" --socks5-gssapi-nec",
  424. "Compatibility with NEC SOCKS5 server"},
  425. {" --socks5-gssapi-service <name>",
  426. "SOCKS5 proxy service name for GSS-API"},
  427. {" --socks5-hostname <host[:port]>",
  428. "SOCKS5 proxy, pass host name to proxy"},
  429. {"-Y, --speed-limit <speed>",
  430. "Stop transfers slower than this"},
  431. {"-y, --speed-time <seconds>",
  432. "Trigger 'speed-limit' abort after this time"},
  433. {" --ssl",
  434. "Try SSL/TLS"},
  435. {" --ssl-allow-beast",
  436. "Allow security flaw to improve interop"},
  437. {" --ssl-no-revoke",
  438. "Disable cert revocation checks (Schannel)"},
  439. {" --ssl-reqd",
  440. "Require SSL/TLS"},
  441. {" --ssl-revoke-best-effort",
  442. "Ignore missing/offline cert CRL dist points"},
  443. {"-2, --sslv2",
  444. "Use SSLv2"},
  445. {"-3, --sslv3",
  446. "Use SSLv3"},
  447. {" --stderr",
  448. "Where to redirect stderr"},
  449. {" --styled-output",
  450. "Enable styled output for HTTP headers"},
  451. {" --suppress-connect-headers",
  452. "Suppress proxy CONNECT response headers"},
  453. {" --tcp-fastopen",
  454. "Use TCP Fast Open"},
  455. {" --tcp-nodelay",
  456. "Use the TCP_NODELAY option"},
  457. {"-t, --telnet-option <opt=val>",
  458. "Set telnet option"},
  459. {" --tftp-blksize <value>",
  460. "Set TFTP BLKSIZE option"},
  461. {" --tftp-no-options",
  462. "Do not send any TFTP options"},
  463. {"-z, --time-cond <time>",
  464. "Transfer based on a time condition"},
  465. {" --tls-max <VERSION>",
  466. "Set maximum allowed TLS version"},
  467. {" --tls13-ciphers <ciphersuite list>",
  468. "TLS 1.3 cipher suites to use"},
  469. {" --tlsauthtype <type>",
  470. "TLS authentication type"},
  471. {" --tlspassword",
  472. "TLS password"},
  473. {" --tlsuser <name>",
  474. "TLS user name"},
  475. {"-1, --tlsv1",
  476. "Use TLSv1.0 or greater"},
  477. {" --tlsv1.0",
  478. "Use TLSv1.0 or greater"},
  479. {" --tlsv1.1",
  480. "Use TLSv1.1 or greater"},
  481. {" --tlsv1.2",
  482. "Use TLSv1.2 or greater"},
  483. {" --tlsv1.3",
  484. "Use TLSv1.3 or greater"},
  485. {" --tr-encoding",
  486. "Request compressed transfer encoding"},
  487. {" --trace <file>",
  488. "Write a debug trace to FILE"},
  489. {" --trace-ascii <file>",
  490. "Like --trace, but without hex output"},
  491. {" --trace-time",
  492. "Add time stamps to trace/verbose output"},
  493. {" --unix-socket <path>",
  494. "Connect through this Unix domain socket"},
  495. {"-T, --upload-file <file>",
  496. "Transfer local FILE to destination"},
  497. {" --url <url>",
  498. "URL to work with"},
  499. {"-B, --use-ascii",
  500. "Use ASCII/text transfer"},
  501. {"-u, --user <user:password>",
  502. "Server user and password"},
  503. {"-A, --user-agent <name>",
  504. "Send User-Agent <name> to server"},
  505. {"-v, --verbose",
  506. "Make the operation more talkative"},
  507. {"-V, --version",
  508. "Show version number and quit"},
  509. {"-w, --write-out <format>",
  510. "Use output FORMAT after completion"},
  511. {" --xattr",
  512. "Store metadata in extended file attributes"},
  513. { NULL, NULL }
  514. };
  515. #ifdef NETWARE
  516. # define PRINT_LINES_PAUSE 23
  517. #endif
  518. #ifdef __SYMBIAN32__
  519. # define PRINT_LINES_PAUSE 16
  520. #endif
  521. struct feat {
  522. const char *name;
  523. int bitmask;
  524. };
  525. static const struct feat feats[] = {
  526. {"AsynchDNS", CURL_VERSION_ASYNCHDNS},
  527. {"Debug", CURL_VERSION_DEBUG},
  528. {"TrackMemory", CURL_VERSION_CURLDEBUG},
  529. {"IDN", CURL_VERSION_IDN},
  530. {"IPv6", CURL_VERSION_IPV6},
  531. {"Largefile", CURL_VERSION_LARGEFILE},
  532. {"Unicode", CURL_VERSION_UNICODE},
  533. {"SSPI", CURL_VERSION_SSPI},
  534. {"GSS-API", CURL_VERSION_GSSAPI},
  535. {"Kerberos", CURL_VERSION_KERBEROS5},
  536. {"SPNEGO", CURL_VERSION_SPNEGO},
  537. {"NTLM", CURL_VERSION_NTLM},
  538. {"NTLM_WB", CURL_VERSION_NTLM_WB},
  539. {"SSL", CURL_VERSION_SSL},
  540. {"libz", CURL_VERSION_LIBZ},
  541. {"brotli", CURL_VERSION_BROTLI},
  542. {"zstd", CURL_VERSION_ZSTD},
  543. {"CharConv", CURL_VERSION_CONV},
  544. {"TLS-SRP", CURL_VERSION_TLSAUTH_SRP},
  545. {"HTTP2", CURL_VERSION_HTTP2},
  546. {"HTTP3", CURL_VERSION_HTTP3},
  547. {"UnixSockets", CURL_VERSION_UNIX_SOCKETS},
  548. {"HTTPS-proxy", CURL_VERSION_HTTPS_PROXY},
  549. {"MultiSSL", CURL_VERSION_MULTI_SSL},
  550. {"PSL", CURL_VERSION_PSL},
  551. {"alt-svc", CURL_VERSION_ALTSVC},
  552. };
  553. void tool_help(void)
  554. {
  555. int i;
  556. puts("Usage: curl [options...] <url>");
  557. for(i = 0; helptext[i].opt; i++) {
  558. printf(" %-19s %s\n", helptext[i].opt, helptext[i].desc);
  559. #ifdef PRINT_LINES_PAUSE
  560. if(i && ((i % PRINT_LINES_PAUSE) == 0))
  561. tool_pressanykey();
  562. #endif
  563. }
  564. }
  565. static int
  566. featcomp(const void *p1, const void *p2)
  567. {
  568. /* The arguments to this function are "pointers to pointers to char", but
  569. the comparison arguments are "pointers to char", hence the following cast
  570. plus dereference */
  571. #ifdef HAVE_STRCASECMP
  572. return strcasecmp(* (char * const *) p1, * (char * const *) p2);
  573. #elif defined(HAVE_STRCMPI)
  574. return strcmpi(* (char * const *) p1, * (char * const *) p2);
  575. #else
  576. return strcmp(* (char * const *) p1, * (char * const *) p2);
  577. #endif
  578. }
  579. void tool_version_info(void)
  580. {
  581. const char *const *proto;
  582. printf(CURL_ID "%s\n", curl_version());
  583. #ifdef CURL_PATCHSTAMP
  584. printf("Release-Date: %s, security patched: %s\n",
  585. LIBCURL_TIMESTAMP, CURL_PATCHSTAMP);
  586. #else
  587. printf("Release-Date: %s\n", LIBCURL_TIMESTAMP);
  588. #endif
  589. if(curlinfo->protocols) {
  590. printf("Protocols: ");
  591. for(proto = curlinfo->protocols; *proto; ++proto) {
  592. printf("%s ", *proto);
  593. }
  594. puts(""); /* newline */
  595. }
  596. if(curlinfo->features) {
  597. char *featp[ sizeof(feats) / sizeof(feats[0]) + 1];
  598. size_t numfeat = 0;
  599. unsigned int i;
  600. printf("Features:");
  601. for(i = 0; i < sizeof(feats)/sizeof(feats[0]); i++) {
  602. if(curlinfo->features & feats[i].bitmask)
  603. featp[numfeat++] = (char *)feats[i].name;
  604. }
  605. #ifdef USE_METALINK
  606. featp[numfeat++] = (char *)"Metalink";
  607. #endif
  608. qsort(&featp[0], numfeat, sizeof(char *), featcomp);
  609. for(i = 0; i< numfeat; i++)
  610. printf(" %s", featp[i]);
  611. puts(""); /* newline */
  612. }
  613. if(strcmp(CURL_VERSION, curlinfo->version)) {
  614. printf("WARNING: curl and libcurl versions do not match. "
  615. "Functionality may be affected.\n");
  616. }
  617. }
  618. void tool_list_engines(void)
  619. {
  620. CURL *curl = curl_easy_init();
  621. struct curl_slist *engines = NULL;
  622. /* Get the list of engines */
  623. curl_easy_getinfo(curl, CURLINFO_SSL_ENGINES, &engines);
  624. puts("Build-time engines:");
  625. if(engines) {
  626. for(; engines; engines = engines->next)
  627. printf(" %s\n", engines->data);
  628. }
  629. else {
  630. puts(" <none>");
  631. }
  632. /* Cleanup the list of engines */
  633. curl_slist_free_all(engines);
  634. curl_easy_cleanup(curl);
  635. }