64534acf81c591209d67985bc68228a599e40bdb
[platform/upstream/curl.git] / src / tool_help.c
1 /***************************************************************************
2  *                                  _   _ ____  _
3  *  Project                     ___| | | |  _ \| |
4  *                             / __| | | | |_) | |
5  *                            | (__| |_| |  _ <| |___
6  *                             \___|\___/|_| \_\_____|
7  *
8  * Copyright (C) 1998 - 2013, 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 http://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
24 #include "tool_panykey.h"
25 #include "tool_help.h"
26
27 #include "memdebug.h" /* keep this as LAST include */
28
29 #ifdef MSDOS
30 #  define USE_WATT32
31 #endif
32
33 /*
34  * A few of these source lines are >80 columns wide, but that's only because
35  * breaking the strings narrower makes this chunk look even worse!
36  *
37  *  Starting with 7.18.0, this list of command line options is sorted based
38  *  on the long option name. It is not done automatically, although a command
39  *  line like the following can help out:
40  *
41  *  curl --help | cut -c5- | grep "^-" | sort
42  */
43
44 static const char *const helptext[] = {
45   "Usage: curl [options...] <url>",
46   "Options: (H) means HTTP/HTTPS only, (F) means FTP only",
47   "     --anyauth       Pick \"any\" authentication method (H)",
48   " -a, --append        Append to target file when uploading (F/SFTP)",
49   "     --basic         Use HTTP Basic Authentication (H)",
50   "     --cacert FILE   CA certificate to verify peer against (SSL)",
51   "     --capath DIR    CA directory to verify peer against (SSL)",
52   " -E, --cert CERT[:PASSWD] Client certificate file and password (SSL)",
53   "     --cert-type TYPE Certificate file type (DER/PEM/ENG) (SSL)",
54   "     --ciphers LIST  SSL ciphers to use (SSL)",
55   "     --compressed    Request compressed response (using deflate or gzip)",
56   " -K, --config FILE   Specify which config file to read",
57   "     --connect-timeout SECONDS  Maximum time allowed for connection",
58   " -C, --continue-at OFFSET  Resumed transfer offset",
59   " -b, --cookie STRING/FILE  String or file to read cookies from (H)",
60   " -c, --cookie-jar FILE  Write cookies to this file after operation (H)",
61   "     --create-dirs   Create necessary local directory hierarchy",
62   "     --crlf          Convert LF to CRLF in upload",
63   "     --crlfile FILE  Get a CRL list in PEM format from the given file",
64   " -d, --data DATA     HTTP POST data (H)",
65   "     --data-ascii DATA  HTTP POST ASCII data (H)",
66   "     --data-binary DATA  HTTP POST binary data (H)",
67   "     --data-urlencode DATA  HTTP POST data url encoded (H)",
68   "     --delegation STRING GSS-API delegation permission",
69   "     --digest        Use HTTP Digest Authentication (H)",
70   "     --disable-eprt  Inhibit using EPRT or LPRT (F)",
71   "     --disable-epsv  Inhibit using EPSV (F)",
72   " -D, --dump-header FILE  Write the headers to this file",
73   "     --egd-file FILE  EGD socket path for random data (SSL)",
74   "     --engine ENGINE  Crypto engine (SSL). \"--engine list\" for list",
75 #ifdef USE_ENVIRONMENT
76   "     --environment   Write results to environment variables (RISC OS)",
77 #endif
78   " -f, --fail          Fail silently (no output at all) on HTTP errors (H)",
79   " -F, --form CONTENT  Specify HTTP multipart POST data (H)",
80   "     --form-string STRING  Specify HTTP multipart POST data (H)",
81   "     --ftp-account DATA  Account data string (F)",
82   "     --ftp-alternative-to-user COMMAND  "
83   "String to replace \"USER [name]\" (F)",
84   "     --ftp-create-dirs  Create the remote dirs if not present (F)",
85   "     --ftp-method [MULTICWD/NOCWD/SINGLECWD] Control CWD usage (F)",
86   "     --ftp-pasv      Use PASV/EPSV instead of PORT (F)",
87   " -P, --ftp-port ADR  Use PORT with given address instead of PASV (F)",
88   "     --ftp-skip-pasv-ip Skip the IP address for PASV (F)\n"
89   "     --ftp-pret      Send PRET before PASV (for drftpd) (F)",
90   "     --ftp-ssl-ccc   Send CCC after authenticating (F)",
91   "     --ftp-ssl-ccc-mode ACTIVE/PASSIVE  Set CCC mode (F)",
92   "     --ftp-ssl-control Require SSL/TLS for ftp login, "
93   "clear for transfer (F)",
94   " -G, --get           Send the -d data with a HTTP GET (H)",
95   " -g, --globoff       Disable URL sequences and ranges using {} and []",
96   " -H, --header LINE   Custom header to pass to server (H)",
97   " -I, --head          Show document info only",
98   " -h, --help          This help text",
99   "     --hostpubmd5 MD5  "
100   "Hex encoded MD5 string of the host public key. (SSH)",
101   " -0, --http1.0       Use HTTP 1.0 (H)",
102   "     --ignore-content-length  Ignore the HTTP Content-Length header",
103   " -i, --include       Include protocol headers in the output (H/F)",
104   " -k, --insecure      Allow connections to SSL sites without certs (H)",
105   "     --interface INTERFACE  Specify network interface/address to use",
106   " -4, --ipv4          Resolve name to IPv4 address",
107   " -6, --ipv6          Resolve name to IPv6 address",
108   " -j, --junk-session-cookies Ignore session cookies read from file (H)",
109   "     --keepalive-time SECONDS  Interval between keepalive probes",
110   "     --key KEY       Private key file name (SSL/SSH)",
111   "     --key-type TYPE Private key file type (DER/PEM/ENG) (SSL)",
112   "     --krb LEVEL     Enable Kerberos with specified security level (F)",
113 #ifndef CURL_DISABLE_LIBCURL_OPTION
114   "     --libcurl FILE  Dump libcurl equivalent code of this command line",
115 #endif
116   "     --limit-rate RATE  Limit transfer speed to this rate",
117   " -l, --list-only     List only names of an FTP directory (F)",
118   "     --local-port RANGE  Force use of these local port numbers",
119   " -L, --location      Follow redirects (H)",
120   "     --location-trusted like --location and send auth to other hosts (H)",
121   " -M, --manual        Display the full manual",
122   "     --mail-from FROM  Mail from this address",
123   "     --mail-rcpt TO  Mail to this receiver(s)",
124   "     --mail-auth AUTH  Originator address of the original email",
125   "     --max-filesize BYTES  Maximum file size to download (H/F)",
126   "     --max-redirs NUM  Maximum number of redirects allowed (H)",
127   " -m, --max-time SECONDS  Maximum time allowed for the transfer",
128   "     --metalink      Process given URLs as metalink XML file",
129   "     --negotiate     Use HTTP Negotiate Authentication (H)",
130   " -n, --netrc         Must read .netrc for user name and password",
131   "     --netrc-optional Use either .netrc or URL; overrides -n",
132   "     --netrc-file FILE  Set up the netrc filename to use",
133   " -N, --no-buffer     Disable buffering of the output stream",
134   "     --no-keepalive  Disable keepalive use on the connection",
135   "     --no-sessionid  Disable SSL session-ID reusing (SSL)",
136   "     --noproxy       List of hosts which do not use proxy",
137   "     --ntlm          Use HTTP NTLM authentication (H)",
138   " -o, --output FILE   Write output to <file> instead of stdout",
139   "     --pass PASS     Pass phrase for the private key (SSL/SSH)",
140   "     --post301       "
141   "Do not switch to GET after following a 301 redirect (H)",
142   "     --post302       "
143   "Do not switch to GET after following a 302 redirect (H)",
144   "     --post303       "
145   "Do not switch to GET after following a 303 redirect (H)",
146   " -#, --progress-bar  Display transfer progress as a progress bar",
147   "     --proto PROTOCOLS  Enable/disable specified protocols",
148   "     --proto-redir PROTOCOLS  "
149   "Enable/disable specified protocols on redirect",
150   " -x, --proxy [PROTOCOL://]HOST[:PORT] Use proxy on given port",
151   "     --proxy-anyauth Pick \"any\" proxy authentication method (H)",
152   "     --proxy-basic   Use Basic authentication on the proxy (H)",
153   "     --proxy-digest  Use Digest authentication on the proxy (H)",
154   "     --proxy-negotiate Use Negotiate authentication on the proxy (H)",
155   "     --proxy-ntlm    Use NTLM authentication on the proxy (H)",
156   " -U, --proxy-user USER[:PASSWORD]  Proxy user and password",
157   "     --proxy1.0 HOST[:PORT]  Use HTTP/1.0 proxy on given port",
158   " -p, --proxytunnel   Operate through a HTTP proxy tunnel (using CONNECT)",
159   "     --pubkey KEY    Public key file name (SSH)",
160   " -Q, --quote CMD     Send command(s) to server before transfer (F/SFTP)",
161   "     --random-file FILE  File for reading random data from (SSL)",
162   " -r, --range RANGE   Retrieve only the bytes within a range",
163   "     --raw           Do HTTP \"raw\", without any transfer decoding (H)",
164   " -e, --referer       Referer URL (H)",
165   " -J, --remote-header-name Use the header-provided filename (H)",
166   " -O, --remote-name   Write output to a file named as the remote file",
167   "     --remote-name-all Use the remote file name for all URLs",
168   " -R, --remote-time   Set the remote file's time on the local output",
169   " -X, --request COMMAND  Specify request command to use",
170   "     --resolve HOST:PORT:ADDRESS  Force resolve of HOST:PORT to ADDRESS",
171   "     --retry NUM   "
172   "Retry request NUM times if transient problems occur",
173   "     --retry-delay SECONDS "
174   "When retrying, wait this many seconds between each",
175   "     --retry-max-time SECONDS  Retry only within this period",
176   "     --sasl-ir       Enable initial response in SASL authentication"
177   " -S, --show-error    "
178   "Show error. With -s, make curl show errors when they occur",
179   " -s, --silent        Silent mode. Don't output anything",
180   "     --socks4 HOST[:PORT]  SOCKS4 proxy on given host + port",
181   "     --socks4a HOST[:PORT]  SOCKS4a proxy on given host + port",
182   "     --socks5 HOST[:PORT]  SOCKS5 proxy on given host + port",
183   "     --socks5-hostname HOST[:PORT] "
184   "SOCKS5 proxy, pass host name to proxy",
185 #if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)
186   "     --socks5-gssapi-service NAME  SOCKS5 proxy service name for gssapi",
187   "     --socks5-gssapi-nec  Compatibility with NEC SOCKS5 server",
188 #endif
189   " -Y, --speed-limit RATE  "
190   "Stop transfers below speed-limit for 'speed-time' secs",
191   " -y, --speed-time SECONDS  "
192   "Time for trig speed-limit abort. Defaults to 30",
193   "     --ssl           Try SSL/TLS (FTP, IMAP, POP3, SMTP)",
194   "     --ssl-reqd      Require SSL/TLS (FTP, IMAP, POP3, SMTP)",
195   " -2, --sslv2         Use SSLv2 (SSL)",
196   " -3, --sslv3         Use SSLv3 (SSL)",
197   "     --ssl-allow-beast Allow security flaw to improve interop (SSL)",
198   "     --stderr FILE   Where to redirect stderr. - means stdout",
199   "     --tcp-nodelay   Use the TCP_NODELAY option",
200   " -t, --telnet-option OPT=VAL  Set telnet option",
201   "     --tftp-blksize VALUE  Set TFTP BLKSIZE option (must be >512)",
202   " -z, --time-cond TIME  Transfer based on a time condition",
203   " -1, --tlsv1         Use TLSv1 (SSL)",
204   "     --trace FILE    Write a debug trace to the given file",
205   "     --trace-ascii FILE  Like --trace but without the hex output",
206   "     --trace-time    Add time stamps to trace/verbose output",
207   "     --tr-encoding   Request compressed transfer encoding (H)",
208   " -T, --upload-file FILE  Transfer FILE to destination",
209   "     --url URL       URL to work with",
210   " -B, --use-ascii     Use ASCII/text transfer",
211   " -u, --user USER[:PASSWORD]  Server user and password",
212   "     --tlsuser USER  TLS username",
213   "     --tlspassword STRING TLS password",
214   "     --tlsauthtype STRING  TLS authentication type (default SRP)",
215   " -A, --user-agent STRING  User-Agent to send to server (H)",
216   " -v, --verbose       Make the operation more talkative",
217   " -V, --version       Show version number and quit",
218 #ifdef USE_WATT32
219   "     --wdebug        Turn on Watt-32 debugging",
220 #endif
221   " -w, --write-out FORMAT  What to output after completion",
222   "     --xattr        Store metadata in extended file attributes",
223   " -q                 If used as the first parameter disables .curlrc",
224   NULL
225 };
226
227 #ifdef NETWARE
228 #  define PRINT_LINES_PAUSE 23
229 #endif
230
231 #ifdef __SYMBIAN32__
232 #  define PRINT_LINES_PAUSE 16
233 #endif
234
235 void tool_help(void)
236 {
237   int i;
238   for(i = 0; helptext[i]; i++) {
239     puts(helptext[i]);
240 #ifdef PRINT_LINES_PAUSE
241     if(i && ((i % PRINT_LINES_PAUSE) == 0))
242       tool_pressanykey();
243 #endif
244   }
245 }
246