tool_help.c 20 KB

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