Check for errors while setting an SRTP profile.
[gnutls.git] / src / cli-args.c
blobc21f254a3bc25279965f4e39bef822589c2ccee4
1 /* -*- buffer-read-only: t -*- vi: set ro:
2 *
3 * DO NOT EDIT THIS FILE (cli-args.c)
4 *
5 * It has been AutoGen-ed October 13, 2012 at 08:48:21 PM by AutoGen 5.16
6 * From the definitions cli-args.def
7 * and the template file options
9 * Generated from AutoOpts 36:4:11 templates.
11 * AutoOpts is a copyrighted work. This source file is not encumbered
12 * by AutoOpts licensing, but is provided under the licensing terms chosen
13 * by the gnutls-cli author or copyright holder. AutoOpts is
14 * licensed under the terms of the LGPL. The redistributable library
15 * (``libopts'') is licensed under the terms of either the LGPL or, at the
16 * users discretion, the BSD license. See the AutoOpts and/or libopts sources
17 * for details.
19 * The gnutls-cli program is copyrighted and licensed
20 * under the following terms:
22 * Copyright (C) 2000-2012 Free Software Foundation, all rights reserved.
23 * This is free software. It is licensed for use, modification and
24 * redistribution under the terms of the
25 * GNU General Public License, version 3 or later
26 * <http://gnu.org/licenses/gpl.html>
28 * gnutls-cli is free software: you can redistribute it and/or modify it
29 * under the terms of the GNU General Public License as published by the
30 * Free Software Foundation, either version 3 of the License, or
31 * (at your option) any later version.
33 * gnutls-cli is distributed in the hope that it will be useful, but
34 * WITHOUT ANY WARRANTY; without even the implied warranty of
35 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
36 * See the GNU General Public License for more details.
38 * You should have received a copy of the GNU General Public License along
39 * with this program. If not, see <http://www.gnu.org/licenses/>.
42 #ifndef __doxygen__
43 #define OPTION_CODE_COMPILE 1
44 #include "cli-args.h"
45 #include <sys/types.h>
47 #include <limits.h>
48 #include <stdio.h>
49 #include <stdlib.h>
50 #include <errno.h>
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55 extern FILE * option_usage_fp;
57 /* TRANSLATORS: choose the translation for option names wisely because you
58 cannot ever change your mind. */
59 #define zCopyright (gnutls_cli_opt_strs+0)
60 #define zLicenseDescrip (gnutls_cli_opt_strs+281)
63 #ifndef NULL
64 # define NULL 0
65 #endif
68 * gnutls-cli option static const strings
70 static char const gnutls_cli_opt_strs[3808] =
71 /* 0 */ "gnutls-cli @VERSION@\n"
72 "Copyright (C) 2000-2012 Free Software Foundation, all rights reserved.\n"
73 "This is free software. It is licensed for use, modification and\n"
74 "redistribution under the terms of the\n"
75 "GNU General Public License, version 3 or later\n"
76 " <http://gnu.org/licenses/gpl.html>\n\0"
77 /* 281 */ "gnutls-cli is free software: you can redistribute it and/or modify it under\n"
78 "the terms of the GNU General Public License as published by the Free\n"
79 "Software Foundation, either version 3 of the License, or (at your option)\n"
80 "any later version.\n\n"
81 "gnutls-cli is distributed in the hope that it will be useful, but WITHOUT\n"
82 "ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n"
83 "FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for\n"
84 "more details.\n\n"
85 "You should have received a copy of the GNU General Public License along\n"
86 "with this program. If not, see <http://www.gnu.org/licenses/>.\n\0"
87 /* 890 */ "Enable debugging.\0"
88 /* 908 */ "DEBUG\0"
89 /* 914 */ "debug\0"
90 /* 920 */ "More verbose output\0"
91 /* 940 */ "VERBOSE\0"
92 /* 948 */ "verbose\0"
93 /* 956 */ "Enable trust on first use authentication\0"
94 /* 997 */ "TOFU\0"
95 /* 1002 */ "no-tofu\0"
96 /* 1010 */ "no\0"
97 /* 1013 */ "Enable DANE certificate verification (DNSSEC)\0"
98 /* 1059 */ "DANE\0"
99 /* 1064 */ "no-dane\0"
100 /* 1072 */ "Use the local DNS server for DNSSEC resolving.\0"
101 /* 1119 */ "LOCAL_DNS\0"
102 /* 1129 */ "no-local-dns\0"
103 /* 1142 */ "Disable CA certificate verification\0"
104 /* 1178 */ "CA_VERIFICATION\0"
105 /* 1194 */ "no-ca-verification\0"
106 /* 1213 */ "Enable OCSP certificate verification\0"
107 /* 1250 */ "OCSP\0"
108 /* 1255 */ "no-ocsp\0"
109 /* 1263 */ "Establish a session and resume\0"
110 /* 1294 */ "RESUME\0"
111 /* 1301 */ "resume\0"
112 /* 1308 */ "Activate heartbeat support\0"
113 /* 1335 */ "HEARTBEAT\0"
114 /* 1345 */ "heartbeat\0"
115 /* 1355 */ "Establish a session and rehandshake\0"
116 /* 1391 */ "REHANDSHAKE\0"
117 /* 1403 */ "rehandshake\0"
118 /* 1415 */ "Don't accept session tickets\0"
119 /* 1444 */ "NOTICKET\0"
120 /* 1453 */ "noticket\0"
121 /* 1462 */ "Enable OCSP status request\0"
122 /* 1489 */ "OCSP_STATUS_REQUEST\0"
123 /* 1509 */ "no-ocsp-status-request\0"
124 /* 1532 */ "Connect, establish a plain session and start TLS.\0"
125 /* 1582 */ "STARTTLS\0"
126 /* 1591 */ "starttls\0"
127 /* 1600 */ "Use DTLS (datagram TLS) over UDP\0"
128 /* 1633 */ "UDP\0"
129 /* 1637 */ "udp\0"
130 /* 1641 */ "Set MTU for datagram TLS\0"
131 /* 1666 */ "MTU\0"
132 /* 1670 */ "mtu\0"
133 /* 1674 */ "Send CR LF instead of LF\0"
134 /* 1699 */ "CRLF\0"
135 /* 1704 */ "crlf\0"
136 /* 1709 */ "Use DER format for certificates to read from\0"
137 /* 1754 */ "X509FMTDER\0"
138 /* 1765 */ "x509fmtder\0"
139 /* 1776 */ "Send the openpgp fingerprint, instead of the key\0"
140 /* 1825 */ "FINGERPRINT\0"
141 /* 1837 */ "fingerprint\0"
142 /* 1849 */ "Disable all the TLS extensions\0"
143 /* 1880 */ "DISABLE_EXTENSIONS\0"
144 /* 1899 */ "disable-extensions\0"
145 /* 1918 */ "Print peer's certificate in PEM format\0"
146 /* 1957 */ "PRINT_CERT\0"
147 /* 1968 */ "print-cert\0"
148 /* 1979 */ "The maximum record size to advertize\0"
149 /* 2016 */ "RECORDSIZE\0"
150 /* 2027 */ "recordsize\0"
151 /* 2038 */ "The minimum number of bits allowed for DH\0"
152 /* 2080 */ "DH_BITS\0"
153 /* 2088 */ "dh-bits\0"
154 /* 2096 */ "Priorities string\0"
155 /* 2114 */ "PRIORITY\0"
156 /* 2123 */ "priority\0"
157 /* 2132 */ "Certificate file or PKCS #11 URL to use\0"
158 /* 2172 */ "X509CAFILE\0"
159 /* 2183 */ "x509cafile\0"
160 /* 2194 */ "CRL file to use\0"
161 /* 2210 */ "X509CRLFILE\0"
162 /* 2222 */ "x509crlfile\0"
163 /* 2234 */ "PGP Key file to use\0"
164 /* 2254 */ "PGPKEYFILE\0"
165 /* 2265 */ "pgpkeyfile\0"
166 /* 2276 */ "PGP Key ring file to use\0"
167 /* 2301 */ "PGPKEYRING\0"
168 /* 2312 */ "pgpkeyring\0"
169 /* 2323 */ "PGP Public Key (certificate) file to use\0"
170 /* 2364 */ "PGPCERTFILE\0"
171 /* 2376 */ "pgpcertfile\0"
172 /* 2388 */ "X.509 key file or PKCS #11 URL to use\0"
173 /* 2426 */ "X509KEYFILE\0"
174 /* 2438 */ "x509keyfile\0"
175 /* 2450 */ "X.509 Certificate file or PKCS #11 URL to use\0"
176 /* 2496 */ "X509CERTFILE\0"
177 /* 2509 */ "x509certfile\0"
178 /* 2522 */ "PGP subkey to use (hex or auto)\0"
179 /* 2554 */ "PGPSUBKEY\0"
180 /* 2564 */ "pgpsubkey\0"
181 /* 2574 */ "SRP username to use\0"
182 /* 2594 */ "SRPUSERNAME\0"
183 /* 2606 */ "srpusername\0"
184 /* 2618 */ "SRP password to use\0"
185 /* 2638 */ "SRPPASSWD\0"
186 /* 2648 */ "srppasswd\0"
187 /* 2658 */ "PSK username to use\0"
188 /* 2678 */ "PSKUSERNAME\0"
189 /* 2690 */ "pskusername\0"
190 /* 2702 */ "PSK key (in hex) to use\0"
191 /* 2726 */ "PSKKEY\0"
192 /* 2733 */ "pskkey\0"
193 /* 2740 */ "The port or service to connect to\0"
194 /* 2774 */ "PORT\0"
195 /* 2779 */ "port\0"
196 /* 2784 */ "Don't abort program if server certificate can't be validated\0"
197 /* 2845 */ "INSECURE\0"
198 /* 2854 */ "insecure\0"
199 /* 2863 */ "Benchmark individual ciphers\0"
200 /* 2892 */ "BENCHMARK_CIPHERS\0"
201 /* 2910 */ "benchmark-ciphers\0"
202 /* 2928 */ "Benchmark individual software ciphers (no hw acceleration)\0"
203 /* 2987 */ "BENCHMARK_SOFT_CIPHERS\0"
204 /* 3010 */ "benchmark-soft-ciphers\0"
205 /* 3033 */ "Benchmark TLS key exchange methods\0"
206 /* 3068 */ "BENCHMARK_TLS_KX\0"
207 /* 3085 */ "benchmark-tls-kx\0"
208 /* 3102 */ "Benchmark TLS ciphers\0"
209 /* 3124 */ "BENCHMARK_TLS_CIPHERS\0"
210 /* 3146 */ "benchmark-tls-ciphers\0"
211 /* 3168 */ "Print a list of the supported algorithms and modes\0"
212 /* 3219 */ "LIST\0"
213 /* 3224 */ "list\0"
214 /* 3229 */ "Display extended usage information and exit\0"
215 /* 3273 */ "help\0"
216 /* 3278 */ "Extended usage information passed thru pager\0"
217 /* 3323 */ "more-help\0"
218 /* 3333 */ "Output version information and exit\0"
219 /* 3369 */ "version\0"
220 /* 3377 */ "GNUTLS_CLI\0"
221 /* 3388 */ "gnutls-cli - GnuTLS client - Ver. @VERSION@\n"
222 "USAGE: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [hostname]\n\0"
223 /* 3501 */ "bug-gnutls@gnu.org\0"
224 /* 3520 */ "\n\n\0"
225 /* 3523 */ "\n"
226 "Simple client program to set up a TLS connection to some other computer. It\n"
227 "sets up a TLS connection and forwards data from the standard input to the\n"
228 "secured socket and vice versa.\n\0"
229 /* 3707 */ "gnutls-cli @VERSION@\0"
230 /* 3728 */ "Usage: gnutls-cli [options] hostname\n"
231 "gnutls-cli --help for usage instructions.\n";
234 * debug option description:
236 #define DEBUG_DESC (gnutls_cli_opt_strs+890)
237 #define DEBUG_NAME (gnutls_cli_opt_strs+908)
238 #define DEBUG_name (gnutls_cli_opt_strs+914)
239 #define DEBUG_FLAGS (OPTST_DISABLED \
240 | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
243 * verbose option description:
245 #define VERBOSE_DESC (gnutls_cli_opt_strs+920)
246 #define VERBOSE_NAME (gnutls_cli_opt_strs+940)
247 #define VERBOSE_name (gnutls_cli_opt_strs+948)
248 #define VERBOSE_FLAGS (OPTST_DISABLED)
251 * tofu option description:
253 #define TOFU_DESC (gnutls_cli_opt_strs+956)
254 #define TOFU_NAME (gnutls_cli_opt_strs+997)
255 #define NOT_TOFU_name (gnutls_cli_opt_strs+1002)
256 #define NOT_TOFU_PFX (gnutls_cli_opt_strs+1010)
257 #define TOFU_name (NOT_TOFU_name + 3)
258 #define TOFU_FLAGS (OPTST_DISABLED)
261 * dane option description:
263 #define DANE_DESC (gnutls_cli_opt_strs+1013)
264 #define DANE_NAME (gnutls_cli_opt_strs+1059)
265 #define NOT_DANE_name (gnutls_cli_opt_strs+1064)
266 #define NOT_DANE_PFX (gnutls_cli_opt_strs+1010)
267 #define DANE_name (NOT_DANE_name + 3)
268 #define DANE_FLAGS (OPTST_DISABLED)
271 * local-dns option description:
273 #define LOCAL_DNS_DESC (gnutls_cli_opt_strs+1072)
274 #define LOCAL_DNS_NAME (gnutls_cli_opt_strs+1119)
275 #define NOT_LOCAL_DNS_name (gnutls_cli_opt_strs+1129)
276 #define NOT_LOCAL_DNS_PFX (gnutls_cli_opt_strs+1010)
277 #define LOCAL_DNS_name (NOT_LOCAL_DNS_name + 3)
278 #define LOCAL_DNS_FLAGS (OPTST_DISABLED)
281 * ca-verification option description:
283 #define CA_VERIFICATION_DESC (gnutls_cli_opt_strs+1142)
284 #define CA_VERIFICATION_NAME (gnutls_cli_opt_strs+1178)
285 #define NOT_CA_VERIFICATION_name (gnutls_cli_opt_strs+1194)
286 #define NOT_CA_VERIFICATION_PFX (gnutls_cli_opt_strs+1010)
287 #define CA_VERIFICATION_name (NOT_CA_VERIFICATION_name + 3)
288 #define CA_VERIFICATION_FLAGS (OPTST_INITENABLED)
291 * ocsp option description:
293 #define OCSP_DESC (gnutls_cli_opt_strs+1213)
294 #define OCSP_NAME (gnutls_cli_opt_strs+1250)
295 #define NOT_OCSP_name (gnutls_cli_opt_strs+1255)
296 #define NOT_OCSP_PFX (gnutls_cli_opt_strs+1010)
297 #define OCSP_name (NOT_OCSP_name + 3)
298 #define OCSP_FLAGS (OPTST_DISABLED)
301 * resume option description:
303 #define RESUME_DESC (gnutls_cli_opt_strs+1263)
304 #define RESUME_NAME (gnutls_cli_opt_strs+1294)
305 #define RESUME_name (gnutls_cli_opt_strs+1301)
306 #define RESUME_FLAGS (OPTST_DISABLED)
309 * heartbeat option description:
311 #define HEARTBEAT_DESC (gnutls_cli_opt_strs+1308)
312 #define HEARTBEAT_NAME (gnutls_cli_opt_strs+1335)
313 #define HEARTBEAT_name (gnutls_cli_opt_strs+1345)
314 #define HEARTBEAT_FLAGS (OPTST_DISABLED)
317 * rehandshake option description:
319 #define REHANDSHAKE_DESC (gnutls_cli_opt_strs+1355)
320 #define REHANDSHAKE_NAME (gnutls_cli_opt_strs+1391)
321 #define REHANDSHAKE_name (gnutls_cli_opt_strs+1403)
322 #define REHANDSHAKE_FLAGS (OPTST_DISABLED)
325 * noticket option description:
327 #define NOTICKET_DESC (gnutls_cli_opt_strs+1415)
328 #define NOTICKET_NAME (gnutls_cli_opt_strs+1444)
329 #define NOTICKET_name (gnutls_cli_opt_strs+1453)
330 #define NOTICKET_FLAGS (OPTST_DISABLED)
333 * ocsp-status-request option description:
335 #define OCSP_STATUS_REQUEST_DESC (gnutls_cli_opt_strs+1462)
336 #define OCSP_STATUS_REQUEST_NAME (gnutls_cli_opt_strs+1489)
337 #define NOT_OCSP_STATUS_REQUEST_name (gnutls_cli_opt_strs+1509)
338 #define NOT_OCSP_STATUS_REQUEST_PFX (gnutls_cli_opt_strs+1010)
339 #define OCSP_STATUS_REQUEST_name (NOT_OCSP_STATUS_REQUEST_name + 3)
340 #define OCSP_STATUS_REQUEST_FLAGS (OPTST_INITENABLED)
343 * starttls option description:
345 #define STARTTLS_DESC (gnutls_cli_opt_strs+1532)
346 #define STARTTLS_NAME (gnutls_cli_opt_strs+1582)
347 #define STARTTLS_name (gnutls_cli_opt_strs+1591)
348 #define STARTTLS_FLAGS (OPTST_DISABLED)
351 * udp option description:
353 #define UDP_DESC (gnutls_cli_opt_strs+1600)
354 #define UDP_NAME (gnutls_cli_opt_strs+1633)
355 #define UDP_name (gnutls_cli_opt_strs+1637)
356 #define UDP_FLAGS (OPTST_DISABLED)
359 * mtu option description:
361 #define MTU_DESC (gnutls_cli_opt_strs+1641)
362 #define MTU_NAME (gnutls_cli_opt_strs+1666)
363 #define MTU_name (gnutls_cli_opt_strs+1670)
364 #define MTU_FLAGS (OPTST_DISABLED \
365 | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
368 * crlf option description:
370 #define CRLF_DESC (gnutls_cli_opt_strs+1674)
371 #define CRLF_NAME (gnutls_cli_opt_strs+1699)
372 #define CRLF_name (gnutls_cli_opt_strs+1704)
373 #define CRLF_FLAGS (OPTST_DISABLED)
376 * x509fmtder option description:
378 #define X509FMTDER_DESC (gnutls_cli_opt_strs+1709)
379 #define X509FMTDER_NAME (gnutls_cli_opt_strs+1754)
380 #define X509FMTDER_name (gnutls_cli_opt_strs+1765)
381 #define X509FMTDER_FLAGS (OPTST_DISABLED)
384 * fingerprint option description:
386 #define FINGERPRINT_DESC (gnutls_cli_opt_strs+1776)
387 #define FINGERPRINT_NAME (gnutls_cli_opt_strs+1825)
388 #define FINGERPRINT_name (gnutls_cli_opt_strs+1837)
389 #define FINGERPRINT_FLAGS (OPTST_DISABLED)
392 * disable-extensions option description:
394 #define DISABLE_EXTENSIONS_DESC (gnutls_cli_opt_strs+1849)
395 #define DISABLE_EXTENSIONS_NAME (gnutls_cli_opt_strs+1880)
396 #define DISABLE_EXTENSIONS_name (gnutls_cli_opt_strs+1899)
397 #define DISABLE_EXTENSIONS_FLAGS (OPTST_DISABLED)
400 * print-cert option description:
402 #define PRINT_CERT_DESC (gnutls_cli_opt_strs+1918)
403 #define PRINT_CERT_NAME (gnutls_cli_opt_strs+1957)
404 #define PRINT_CERT_name (gnutls_cli_opt_strs+1968)
405 #define PRINT_CERT_FLAGS (OPTST_DISABLED)
408 * recordsize option description:
410 #define RECORDSIZE_DESC (gnutls_cli_opt_strs+1979)
411 #define RECORDSIZE_NAME (gnutls_cli_opt_strs+2016)
412 #define RECORDSIZE_name (gnutls_cli_opt_strs+2027)
413 #define RECORDSIZE_FLAGS (OPTST_DISABLED \
414 | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
417 * dh-bits option description:
419 #define DH_BITS_DESC (gnutls_cli_opt_strs+2038)
420 #define DH_BITS_NAME (gnutls_cli_opt_strs+2080)
421 #define DH_BITS_name (gnutls_cli_opt_strs+2088)
422 #define DH_BITS_FLAGS (OPTST_DISABLED \
423 | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
426 * priority option description:
428 #define PRIORITY_DESC (gnutls_cli_opt_strs+2096)
429 #define PRIORITY_NAME (gnutls_cli_opt_strs+2114)
430 #define PRIORITY_name (gnutls_cli_opt_strs+2123)
431 #define PRIORITY_FLAGS (OPTST_DISABLED \
432 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
435 * x509cafile option description:
437 #define X509CAFILE_DESC (gnutls_cli_opt_strs+2132)
438 #define X509CAFILE_NAME (gnutls_cli_opt_strs+2172)
439 #define X509CAFILE_name (gnutls_cli_opt_strs+2183)
440 #define X509CAFILE_FLAGS (OPTST_DISABLED \
441 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
444 * x509crlfile option description:
446 #define X509CRLFILE_DESC (gnutls_cli_opt_strs+2194)
447 #define X509CRLFILE_NAME (gnutls_cli_opt_strs+2210)
448 #define X509CRLFILE_name (gnutls_cli_opt_strs+2222)
449 #define X509CRLFILE_FLAGS (OPTST_DISABLED \
450 | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
453 * pgpkeyfile option description:
455 #define PGPKEYFILE_DESC (gnutls_cli_opt_strs+2234)
456 #define PGPKEYFILE_NAME (gnutls_cli_opt_strs+2254)
457 #define PGPKEYFILE_name (gnutls_cli_opt_strs+2265)
458 #define PGPKEYFILE_FLAGS (OPTST_DISABLED \
459 | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
462 * pgpkeyring option description:
464 #define PGPKEYRING_DESC (gnutls_cli_opt_strs+2276)
465 #define PGPKEYRING_NAME (gnutls_cli_opt_strs+2301)
466 #define PGPKEYRING_name (gnutls_cli_opt_strs+2312)
467 #define PGPKEYRING_FLAGS (OPTST_DISABLED \
468 | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
471 * pgpcertfile option description:
473 #define PGPCERTFILE_DESC (gnutls_cli_opt_strs+2323)
474 #define PGPCERTFILE_NAME (gnutls_cli_opt_strs+2364)
475 #define PGPCERTFILE_name (gnutls_cli_opt_strs+2376)
476 #define PGPCERTFILE_FLAGS (OPTST_DISABLED \
477 | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
480 * x509keyfile option description:
482 #define X509KEYFILE_DESC (gnutls_cli_opt_strs+2388)
483 #define X509KEYFILE_NAME (gnutls_cli_opt_strs+2426)
484 #define X509KEYFILE_name (gnutls_cli_opt_strs+2438)
485 #define X509KEYFILE_FLAGS (OPTST_DISABLED \
486 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
489 * x509certfile option description:
491 #define X509CERTFILE_DESC (gnutls_cli_opt_strs+2450)
492 #define X509CERTFILE_NAME (gnutls_cli_opt_strs+2496)
493 #define X509CERTFILE_name (gnutls_cli_opt_strs+2509)
494 #define X509CERTFILE_FLAGS (OPTST_DISABLED \
495 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
498 * pgpsubkey option description:
500 #define PGPSUBKEY_DESC (gnutls_cli_opt_strs+2522)
501 #define PGPSUBKEY_NAME (gnutls_cli_opt_strs+2554)
502 #define PGPSUBKEY_name (gnutls_cli_opt_strs+2564)
503 #define PGPSUBKEY_FLAGS (OPTST_DISABLED \
504 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
507 * srpusername option description:
509 #define SRPUSERNAME_DESC (gnutls_cli_opt_strs+2574)
510 #define SRPUSERNAME_NAME (gnutls_cli_opt_strs+2594)
511 #define SRPUSERNAME_name (gnutls_cli_opt_strs+2606)
512 #define SRPUSERNAME_FLAGS (OPTST_DISABLED \
513 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
516 * srppasswd option description:
518 #define SRPPASSWD_DESC (gnutls_cli_opt_strs+2618)
519 #define SRPPASSWD_NAME (gnutls_cli_opt_strs+2638)
520 #define SRPPASSWD_name (gnutls_cli_opt_strs+2648)
521 #define SRPPASSWD_FLAGS (OPTST_DISABLED \
522 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
525 * pskusername option description:
527 #define PSKUSERNAME_DESC (gnutls_cli_opt_strs+2658)
528 #define PSKUSERNAME_NAME (gnutls_cli_opt_strs+2678)
529 #define PSKUSERNAME_name (gnutls_cli_opt_strs+2690)
530 #define PSKUSERNAME_FLAGS (OPTST_DISABLED \
531 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
534 * pskkey option description:
536 #define PSKKEY_DESC (gnutls_cli_opt_strs+2702)
537 #define PSKKEY_NAME (gnutls_cli_opt_strs+2726)
538 #define PSKKEY_name (gnutls_cli_opt_strs+2733)
539 #define PSKKEY_FLAGS (OPTST_DISABLED \
540 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
543 * port option description:
545 #define PORT_DESC (gnutls_cli_opt_strs+2740)
546 #define PORT_NAME (gnutls_cli_opt_strs+2774)
547 #define PORT_name (gnutls_cli_opt_strs+2779)
548 #define PORT_FLAGS (OPTST_DISABLED \
549 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
552 * insecure option description:
554 #define INSECURE_DESC (gnutls_cli_opt_strs+2784)
555 #define INSECURE_NAME (gnutls_cli_opt_strs+2845)
556 #define INSECURE_name (gnutls_cli_opt_strs+2854)
557 #define INSECURE_FLAGS (OPTST_DISABLED)
560 * benchmark-ciphers option description:
562 #define BENCHMARK_CIPHERS_DESC (gnutls_cli_opt_strs+2863)
563 #define BENCHMARK_CIPHERS_NAME (gnutls_cli_opt_strs+2892)
564 #define BENCHMARK_CIPHERS_name (gnutls_cli_opt_strs+2910)
565 #define BENCHMARK_CIPHERS_FLAGS (OPTST_DISABLED)
568 * benchmark-soft-ciphers option description:
570 #define BENCHMARK_SOFT_CIPHERS_DESC (gnutls_cli_opt_strs+2928)
571 #define BENCHMARK_SOFT_CIPHERS_NAME (gnutls_cli_opt_strs+2987)
572 #define BENCHMARK_SOFT_CIPHERS_name (gnutls_cli_opt_strs+3010)
573 #define BENCHMARK_SOFT_CIPHERS_FLAGS (OPTST_DISABLED)
576 * benchmark-tls-kx option description:
578 #define BENCHMARK_TLS_KX_DESC (gnutls_cli_opt_strs+3033)
579 #define BENCHMARK_TLS_KX_NAME (gnutls_cli_opt_strs+3068)
580 #define BENCHMARK_TLS_KX_name (gnutls_cli_opt_strs+3085)
581 #define BENCHMARK_TLS_KX_FLAGS (OPTST_DISABLED)
584 * benchmark-tls-ciphers option description:
586 #define BENCHMARK_TLS_CIPHERS_DESC (gnutls_cli_opt_strs+3102)
587 #define BENCHMARK_TLS_CIPHERS_NAME (gnutls_cli_opt_strs+3124)
588 #define BENCHMARK_TLS_CIPHERS_name (gnutls_cli_opt_strs+3146)
589 #define BENCHMARK_TLS_CIPHERS_FLAGS (OPTST_DISABLED)
592 * list option description:
594 #define LIST_DESC (gnutls_cli_opt_strs+3168)
595 #define LIST_NAME (gnutls_cli_opt_strs+3219)
596 #define LIST_name (gnutls_cli_opt_strs+3224)
597 #define LIST_FLAGS (OPTST_DISABLED)
600 * Help/More_Help/Version option descriptions:
602 #define HELP_DESC (gnutls_cli_opt_strs+3229)
603 #define HELP_name (gnutls_cli_opt_strs+3273)
604 #ifdef HAVE_WORKING_FORK
605 #define MORE_HELP_DESC (gnutls_cli_opt_strs+3278)
606 #define MORE_HELP_name (gnutls_cli_opt_strs+3323)
607 #define MORE_HELP_FLAGS (OPTST_IMM | OPTST_NO_INIT)
608 #else
609 #define MORE_HELP_DESC NULL
610 #define MORE_HELP_name NULL
611 #define MORE_HELP_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
612 #endif
613 #ifdef NO_OPTIONAL_OPT_ARGS
614 # define VER_FLAGS (OPTST_IMM | OPTST_NO_INIT)
615 #else
616 # define VER_FLAGS (OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \
617 OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT)
618 #endif
619 #define VER_DESC (gnutls_cli_opt_strs+3333)
620 #define VER_name (gnutls_cli_opt_strs+3369)
622 * Declare option callback procedures
624 extern tOptProc
625 optionBooleanVal, optionNestedVal, optionNumericVal,
626 optionPagedUsage, optionPrintVersion, optionResetOpt,
627 optionStackArg, optionTimeDate, optionTimeVal,
628 optionUnstackArg, optionVendorOption;
629 static tOptProc
630 doOptDebug, doOptMtu, doOptPgpcertfile, doOptPgpkeyfile,
631 doOptPgpkeyring, doOptRecordsize, doOptX509crlfile, doUsageOpt;
632 #define VER_PROC optionPrintVersion
634 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
636 * Define the gnutls-cli Option Descriptions.
637 * This is an array of OPTION_CT entries, one for each
638 * option that the gnutls-cli program responds to.
640 static tOptDesc optDesc[OPTION_CT] = {
641 { /* entry idx, value */ 0, VALUE_OPT_DEBUG,
642 /* equiv idx, value */ 0, VALUE_OPT_DEBUG,
643 /* equivalenced to */ NO_EQUIVALENT,
644 /* min, max, act ct */ 0, 1, 0,
645 /* opt state flags */ DEBUG_FLAGS, 0,
646 /* last opt argumnt */ { NULL }, /* --debug */
647 /* arg list/cookie */ NULL,
648 /* must/cannot opts */ NULL, NULL,
649 /* option proc */ doOptDebug,
650 /* desc, NAME, name */ DEBUG_DESC, DEBUG_NAME, DEBUG_name,
651 /* disablement strs */ NULL, NULL },
653 { /* entry idx, value */ 1, VALUE_OPT_VERBOSE,
654 /* equiv idx, value */ 1, VALUE_OPT_VERBOSE,
655 /* equivalenced to */ NO_EQUIVALENT,
656 /* min, max, act ct */ 0, NOLIMIT, 0,
657 /* opt state flags */ VERBOSE_FLAGS, 0,
658 /* last opt argumnt */ { NULL }, /* --verbose */
659 /* arg list/cookie */ NULL,
660 /* must/cannot opts */ NULL, NULL,
661 /* option proc */ NULL,
662 /* desc, NAME, name */ VERBOSE_DESC, VERBOSE_NAME, VERBOSE_name,
663 /* disablement strs */ NULL, NULL },
665 { /* entry idx, value */ 2, VALUE_OPT_TOFU,
666 /* equiv idx, value */ 2, VALUE_OPT_TOFU,
667 /* equivalenced to */ NO_EQUIVALENT,
668 /* min, max, act ct */ 0, 1, 0,
669 /* opt state flags */ TOFU_FLAGS, 0,
670 /* last opt argumnt */ { NULL }, /* --tofu */
671 /* arg list/cookie */ NULL,
672 /* must/cannot opts */ NULL, NULL,
673 /* option proc */ NULL,
674 /* desc, NAME, name */ TOFU_DESC, TOFU_NAME, TOFU_name,
675 /* disablement strs */ NOT_TOFU_name, NOT_TOFU_PFX },
677 { /* entry idx, value */ 3, VALUE_OPT_DANE,
678 /* equiv idx, value */ 3, VALUE_OPT_DANE,
679 /* equivalenced to */ NO_EQUIVALENT,
680 /* min, max, act ct */ 0, 1, 0,
681 /* opt state flags */ DANE_FLAGS, 0,
682 /* last opt argumnt */ { NULL }, /* --dane */
683 /* arg list/cookie */ NULL,
684 /* must/cannot opts */ NULL, NULL,
685 /* option proc */ NULL,
686 /* desc, NAME, name */ DANE_DESC, DANE_NAME, DANE_name,
687 /* disablement strs */ NOT_DANE_name, NOT_DANE_PFX },
689 { /* entry idx, value */ 4, VALUE_OPT_LOCAL_DNS,
690 /* equiv idx, value */ 4, VALUE_OPT_LOCAL_DNS,
691 /* equivalenced to */ NO_EQUIVALENT,
692 /* min, max, act ct */ 0, 1, 0,
693 /* opt state flags */ LOCAL_DNS_FLAGS, 0,
694 /* last opt argumnt */ { NULL }, /* --local-dns */
695 /* arg list/cookie */ NULL,
696 /* must/cannot opts */ NULL, NULL,
697 /* option proc */ NULL,
698 /* desc, NAME, name */ LOCAL_DNS_DESC, LOCAL_DNS_NAME, LOCAL_DNS_name,
699 /* disablement strs */ NOT_LOCAL_DNS_name, NOT_LOCAL_DNS_PFX },
701 { /* entry idx, value */ 5, VALUE_OPT_CA_VERIFICATION,
702 /* equiv idx, value */ 5, VALUE_OPT_CA_VERIFICATION,
703 /* equivalenced to */ NO_EQUIVALENT,
704 /* min, max, act ct */ 0, 1, 0,
705 /* opt state flags */ CA_VERIFICATION_FLAGS, 0,
706 /* last opt argumnt */ { NULL }, /* --ca-verification */
707 /* arg list/cookie */ NULL,
708 /* must/cannot opts */ NULL, NULL,
709 /* option proc */ NULL,
710 /* desc, NAME, name */ CA_VERIFICATION_DESC, CA_VERIFICATION_NAME, CA_VERIFICATION_name,
711 /* disablement strs */ NOT_CA_VERIFICATION_name, NOT_CA_VERIFICATION_PFX },
713 { /* entry idx, value */ 6, VALUE_OPT_OCSP,
714 /* equiv idx, value */ 6, VALUE_OPT_OCSP,
715 /* equivalenced to */ NO_EQUIVALENT,
716 /* min, max, act ct */ 0, 1, 0,
717 /* opt state flags */ OCSP_FLAGS, 0,
718 /* last opt argumnt */ { NULL }, /* --ocsp */
719 /* arg list/cookie */ NULL,
720 /* must/cannot opts */ NULL, NULL,
721 /* option proc */ NULL,
722 /* desc, NAME, name */ OCSP_DESC, OCSP_NAME, OCSP_name,
723 /* disablement strs */ NOT_OCSP_name, NOT_OCSP_PFX },
725 { /* entry idx, value */ 7, VALUE_OPT_RESUME,
726 /* equiv idx, value */ 7, VALUE_OPT_RESUME,
727 /* equivalenced to */ NO_EQUIVALENT,
728 /* min, max, act ct */ 0, 1, 0,
729 /* opt state flags */ RESUME_FLAGS, 0,
730 /* last opt argumnt */ { NULL }, /* --resume */
731 /* arg list/cookie */ NULL,
732 /* must/cannot opts */ NULL, NULL,
733 /* option proc */ NULL,
734 /* desc, NAME, name */ RESUME_DESC, RESUME_NAME, RESUME_name,
735 /* disablement strs */ NULL, NULL },
737 { /* entry idx, value */ 8, VALUE_OPT_HEARTBEAT,
738 /* equiv idx, value */ 8, VALUE_OPT_HEARTBEAT,
739 /* equivalenced to */ NO_EQUIVALENT,
740 /* min, max, act ct */ 0, 1, 0,
741 /* opt state flags */ HEARTBEAT_FLAGS, 0,
742 /* last opt argumnt */ { NULL }, /* --heartbeat */
743 /* arg list/cookie */ NULL,
744 /* must/cannot opts */ NULL, NULL,
745 /* option proc */ NULL,
746 /* desc, NAME, name */ HEARTBEAT_DESC, HEARTBEAT_NAME, HEARTBEAT_name,
747 /* disablement strs */ NULL, NULL },
749 { /* entry idx, value */ 9, VALUE_OPT_REHANDSHAKE,
750 /* equiv idx, value */ 9, VALUE_OPT_REHANDSHAKE,
751 /* equivalenced to */ NO_EQUIVALENT,
752 /* min, max, act ct */ 0, 1, 0,
753 /* opt state flags */ REHANDSHAKE_FLAGS, 0,
754 /* last opt argumnt */ { NULL }, /* --rehandshake */
755 /* arg list/cookie */ NULL,
756 /* must/cannot opts */ NULL, NULL,
757 /* option proc */ NULL,
758 /* desc, NAME, name */ REHANDSHAKE_DESC, REHANDSHAKE_NAME, REHANDSHAKE_name,
759 /* disablement strs */ NULL, NULL },
761 { /* entry idx, value */ 10, VALUE_OPT_NOTICKET,
762 /* equiv idx, value */ 10, VALUE_OPT_NOTICKET,
763 /* equivalenced to */ NO_EQUIVALENT,
764 /* min, max, act ct */ 0, 1, 0,
765 /* opt state flags */ NOTICKET_FLAGS, 0,
766 /* last opt argumnt */ { NULL }, /* --noticket */
767 /* arg list/cookie */ NULL,
768 /* must/cannot opts */ NULL, NULL,
769 /* option proc */ NULL,
770 /* desc, NAME, name */ NOTICKET_DESC, NOTICKET_NAME, NOTICKET_name,
771 /* disablement strs */ NULL, NULL },
773 { /* entry idx, value */ 11, VALUE_OPT_OCSP_STATUS_REQUEST,
774 /* equiv idx, value */ 11, VALUE_OPT_OCSP_STATUS_REQUEST,
775 /* equivalenced to */ NO_EQUIVALENT,
776 /* min, max, act ct */ 0, 1, 0,
777 /* opt state flags */ OCSP_STATUS_REQUEST_FLAGS, 0,
778 /* last opt argumnt */ { NULL }, /* --ocsp-status-request */
779 /* arg list/cookie */ NULL,
780 /* must/cannot opts */ NULL, NULL,
781 /* option proc */ NULL,
782 /* desc, NAME, name */ OCSP_STATUS_REQUEST_DESC, OCSP_STATUS_REQUEST_NAME, OCSP_STATUS_REQUEST_name,
783 /* disablement strs */ NOT_OCSP_STATUS_REQUEST_name, NOT_OCSP_STATUS_REQUEST_PFX },
785 { /* entry idx, value */ 12, VALUE_OPT_STARTTLS,
786 /* equiv idx, value */ 12, VALUE_OPT_STARTTLS,
787 /* equivalenced to */ NO_EQUIVALENT,
788 /* min, max, act ct */ 0, 1, 0,
789 /* opt state flags */ STARTTLS_FLAGS, 0,
790 /* last opt argumnt */ { NULL }, /* --starttls */
791 /* arg list/cookie */ NULL,
792 /* must/cannot opts */ NULL, NULL,
793 /* option proc */ NULL,
794 /* desc, NAME, name */ STARTTLS_DESC, STARTTLS_NAME, STARTTLS_name,
795 /* disablement strs */ NULL, NULL },
797 { /* entry idx, value */ 13, VALUE_OPT_UDP,
798 /* equiv idx, value */ 13, VALUE_OPT_UDP,
799 /* equivalenced to */ NO_EQUIVALENT,
800 /* min, max, act ct */ 0, 1, 0,
801 /* opt state flags */ UDP_FLAGS, 0,
802 /* last opt argumnt */ { NULL }, /* --udp */
803 /* arg list/cookie */ NULL,
804 /* must/cannot opts */ NULL, NULL,
805 /* option proc */ NULL,
806 /* desc, NAME, name */ UDP_DESC, UDP_NAME, UDP_name,
807 /* disablement strs */ NULL, NULL },
809 { /* entry idx, value */ 14, VALUE_OPT_MTU,
810 /* equiv idx, value */ 14, VALUE_OPT_MTU,
811 /* equivalenced to */ NO_EQUIVALENT,
812 /* min, max, act ct */ 0, 1, 0,
813 /* opt state flags */ MTU_FLAGS, 0,
814 /* last opt argumnt */ { NULL }, /* --mtu */
815 /* arg list/cookie */ NULL,
816 /* must/cannot opts */ NULL, NULL,
817 /* option proc */ doOptMtu,
818 /* desc, NAME, name */ MTU_DESC, MTU_NAME, MTU_name,
819 /* disablement strs */ NULL, NULL },
821 { /* entry idx, value */ 15, VALUE_OPT_CRLF,
822 /* equiv idx, value */ 15, VALUE_OPT_CRLF,
823 /* equivalenced to */ NO_EQUIVALENT,
824 /* min, max, act ct */ 0, 1, 0,
825 /* opt state flags */ CRLF_FLAGS, 0,
826 /* last opt argumnt */ { NULL }, /* --crlf */
827 /* arg list/cookie */ NULL,
828 /* must/cannot opts */ NULL, NULL,
829 /* option proc */ NULL,
830 /* desc, NAME, name */ CRLF_DESC, CRLF_NAME, CRLF_name,
831 /* disablement strs */ NULL, NULL },
833 { /* entry idx, value */ 16, VALUE_OPT_X509FMTDER,
834 /* equiv idx, value */ 16, VALUE_OPT_X509FMTDER,
835 /* equivalenced to */ NO_EQUIVALENT,
836 /* min, max, act ct */ 0, 1, 0,
837 /* opt state flags */ X509FMTDER_FLAGS, 0,
838 /* last opt argumnt */ { NULL }, /* --x509fmtder */
839 /* arg list/cookie */ NULL,
840 /* must/cannot opts */ NULL, NULL,
841 /* option proc */ NULL,
842 /* desc, NAME, name */ X509FMTDER_DESC, X509FMTDER_NAME, X509FMTDER_name,
843 /* disablement strs */ NULL, NULL },
845 { /* entry idx, value */ 17, VALUE_OPT_FINGERPRINT,
846 /* equiv idx, value */ 17, VALUE_OPT_FINGERPRINT,
847 /* equivalenced to */ NO_EQUIVALENT,
848 /* min, max, act ct */ 0, 1, 0,
849 /* opt state flags */ FINGERPRINT_FLAGS, 0,
850 /* last opt argumnt */ { NULL }, /* --fingerprint */
851 /* arg list/cookie */ NULL,
852 /* must/cannot opts */ NULL, NULL,
853 /* option proc */ NULL,
854 /* desc, NAME, name */ FINGERPRINT_DESC, FINGERPRINT_NAME, FINGERPRINT_name,
855 /* disablement strs */ NULL, NULL },
857 { /* entry idx, value */ 18, VALUE_OPT_DISABLE_EXTENSIONS,
858 /* equiv idx, value */ 18, VALUE_OPT_DISABLE_EXTENSIONS,
859 /* equivalenced to */ NO_EQUIVALENT,
860 /* min, max, act ct */ 0, 1, 0,
861 /* opt state flags */ DISABLE_EXTENSIONS_FLAGS, 0,
862 /* last opt argumnt */ { NULL }, /* --disable-extensions */
863 /* arg list/cookie */ NULL,
864 /* must/cannot opts */ NULL, NULL,
865 /* option proc */ NULL,
866 /* desc, NAME, name */ DISABLE_EXTENSIONS_DESC, DISABLE_EXTENSIONS_NAME, DISABLE_EXTENSIONS_name,
867 /* disablement strs */ NULL, NULL },
869 { /* entry idx, value */ 19, VALUE_OPT_PRINT_CERT,
870 /* equiv idx, value */ 19, VALUE_OPT_PRINT_CERT,
871 /* equivalenced to */ NO_EQUIVALENT,
872 /* min, max, act ct */ 0, 1, 0,
873 /* opt state flags */ PRINT_CERT_FLAGS, 0,
874 /* last opt argumnt */ { NULL }, /* --print-cert */
875 /* arg list/cookie */ NULL,
876 /* must/cannot opts */ NULL, NULL,
877 /* option proc */ NULL,
878 /* desc, NAME, name */ PRINT_CERT_DESC, PRINT_CERT_NAME, PRINT_CERT_name,
879 /* disablement strs */ NULL, NULL },
881 { /* entry idx, value */ 20, VALUE_OPT_RECORDSIZE,
882 /* equiv idx, value */ 20, VALUE_OPT_RECORDSIZE,
883 /* equivalenced to */ NO_EQUIVALENT,
884 /* min, max, act ct */ 0, 1, 0,
885 /* opt state flags */ RECORDSIZE_FLAGS, 0,
886 /* last opt argumnt */ { NULL }, /* --recordsize */
887 /* arg list/cookie */ NULL,
888 /* must/cannot opts */ NULL, NULL,
889 /* option proc */ doOptRecordsize,
890 /* desc, NAME, name */ RECORDSIZE_DESC, RECORDSIZE_NAME, RECORDSIZE_name,
891 /* disablement strs */ NULL, NULL },
893 { /* entry idx, value */ 21, VALUE_OPT_DH_BITS,
894 /* equiv idx, value */ 21, VALUE_OPT_DH_BITS,
895 /* equivalenced to */ NO_EQUIVALENT,
896 /* min, max, act ct */ 0, 1, 0,
897 /* opt state flags */ DH_BITS_FLAGS, 0,
898 /* last opt argumnt */ { NULL }, /* --dh-bits */
899 /* arg list/cookie */ NULL,
900 /* must/cannot opts */ NULL, NULL,
901 /* option proc */ optionNumericVal,
902 /* desc, NAME, name */ DH_BITS_DESC, DH_BITS_NAME, DH_BITS_name,
903 /* disablement strs */ NULL, NULL },
905 { /* entry idx, value */ 22, VALUE_OPT_PRIORITY,
906 /* equiv idx, value */ 22, VALUE_OPT_PRIORITY,
907 /* equivalenced to */ NO_EQUIVALENT,
908 /* min, max, act ct */ 0, 1, 0,
909 /* opt state flags */ PRIORITY_FLAGS, 0,
910 /* last opt argumnt */ { NULL }, /* --priority */
911 /* arg list/cookie */ NULL,
912 /* must/cannot opts */ NULL, NULL,
913 /* option proc */ NULL,
914 /* desc, NAME, name */ PRIORITY_DESC, PRIORITY_NAME, PRIORITY_name,
915 /* disablement strs */ NULL, NULL },
917 { /* entry idx, value */ 23, VALUE_OPT_X509CAFILE,
918 /* equiv idx, value */ 23, VALUE_OPT_X509CAFILE,
919 /* equivalenced to */ NO_EQUIVALENT,
920 /* min, max, act ct */ 0, 1, 0,
921 /* opt state flags */ X509CAFILE_FLAGS, 0,
922 /* last opt argumnt */ { NULL }, /* --x509cafile */
923 /* arg list/cookie */ NULL,
924 /* must/cannot opts */ NULL, NULL,
925 /* option proc */ NULL,
926 /* desc, NAME, name */ X509CAFILE_DESC, X509CAFILE_NAME, X509CAFILE_name,
927 /* disablement strs */ NULL, NULL },
929 { /* entry idx, value */ 24, VALUE_OPT_X509CRLFILE,
930 /* equiv idx, value */ 24, VALUE_OPT_X509CRLFILE,
931 /* equivalenced to */ NO_EQUIVALENT,
932 /* min, max, act ct */ 0, 1, 0,
933 /* opt state flags */ X509CRLFILE_FLAGS, 0,
934 /* last opt argumnt */ { NULL }, /* --x509crlfile */
935 /* arg list/cookie */ NULL,
936 /* must/cannot opts */ NULL, NULL,
937 /* option proc */ doOptX509crlfile,
938 /* desc, NAME, name */ X509CRLFILE_DESC, X509CRLFILE_NAME, X509CRLFILE_name,
939 /* disablement strs */ NULL, NULL },
941 { /* entry idx, value */ 25, VALUE_OPT_PGPKEYFILE,
942 /* equiv idx, value */ 25, VALUE_OPT_PGPKEYFILE,
943 /* equivalenced to */ NO_EQUIVALENT,
944 /* min, max, act ct */ 0, 1, 0,
945 /* opt state flags */ PGPKEYFILE_FLAGS, 0,
946 /* last opt argumnt */ { NULL }, /* --pgpkeyfile */
947 /* arg list/cookie */ NULL,
948 /* must/cannot opts */ NULL, NULL,
949 /* option proc */ doOptPgpkeyfile,
950 /* desc, NAME, name */ PGPKEYFILE_DESC, PGPKEYFILE_NAME, PGPKEYFILE_name,
951 /* disablement strs */ NULL, NULL },
953 { /* entry idx, value */ 26, VALUE_OPT_PGPKEYRING,
954 /* equiv idx, value */ 26, VALUE_OPT_PGPKEYRING,
955 /* equivalenced to */ NO_EQUIVALENT,
956 /* min, max, act ct */ 0, 1, 0,
957 /* opt state flags */ PGPKEYRING_FLAGS, 0,
958 /* last opt argumnt */ { NULL }, /* --pgpkeyring */
959 /* arg list/cookie */ NULL,
960 /* must/cannot opts */ NULL, NULL,
961 /* option proc */ doOptPgpkeyring,
962 /* desc, NAME, name */ PGPKEYRING_DESC, PGPKEYRING_NAME, PGPKEYRING_name,
963 /* disablement strs */ NULL, NULL },
965 { /* entry idx, value */ 27, VALUE_OPT_PGPCERTFILE,
966 /* equiv idx, value */ 27, VALUE_OPT_PGPCERTFILE,
967 /* equivalenced to */ NO_EQUIVALENT,
968 /* min, max, act ct */ 0, 1, 0,
969 /* opt state flags */ PGPCERTFILE_FLAGS, 0,
970 /* last opt argumnt */ { NULL }, /* --pgpcertfile */
971 /* arg list/cookie */ NULL,
972 /* must/cannot opts */ NULL, NULL,
973 /* option proc */ doOptPgpcertfile,
974 /* desc, NAME, name */ PGPCERTFILE_DESC, PGPCERTFILE_NAME, PGPCERTFILE_name,
975 /* disablement strs */ NULL, NULL },
977 { /* entry idx, value */ 28, VALUE_OPT_X509KEYFILE,
978 /* equiv idx, value */ 28, VALUE_OPT_X509KEYFILE,
979 /* equivalenced to */ NO_EQUIVALENT,
980 /* min, max, act ct */ 0, 1, 0,
981 /* opt state flags */ X509KEYFILE_FLAGS, 0,
982 /* last opt argumnt */ { NULL }, /* --x509keyfile */
983 /* arg list/cookie */ NULL,
984 /* must/cannot opts */ NULL, NULL,
985 /* option proc */ NULL,
986 /* desc, NAME, name */ X509KEYFILE_DESC, X509KEYFILE_NAME, X509KEYFILE_name,
987 /* disablement strs */ NULL, NULL },
989 { /* entry idx, value */ 29, VALUE_OPT_X509CERTFILE,
990 /* equiv idx, value */ 29, VALUE_OPT_X509CERTFILE,
991 /* equivalenced to */ NO_EQUIVALENT,
992 /* min, max, act ct */ 0, 1, 0,
993 /* opt state flags */ X509CERTFILE_FLAGS, 0,
994 /* last opt argumnt */ { NULL }, /* --x509certfile */
995 /* arg list/cookie */ NULL,
996 /* must/cannot opts */ NULL, NULL,
997 /* option proc */ NULL,
998 /* desc, NAME, name */ X509CERTFILE_DESC, X509CERTFILE_NAME, X509CERTFILE_name,
999 /* disablement strs */ NULL, NULL },
1001 { /* entry idx, value */ 30, VALUE_OPT_PGPSUBKEY,
1002 /* equiv idx, value */ 30, VALUE_OPT_PGPSUBKEY,
1003 /* equivalenced to */ NO_EQUIVALENT,
1004 /* min, max, act ct */ 0, 1, 0,
1005 /* opt state flags */ PGPSUBKEY_FLAGS, 0,
1006 /* last opt argumnt */ { NULL }, /* --pgpsubkey */
1007 /* arg list/cookie */ NULL,
1008 /* must/cannot opts */ NULL, NULL,
1009 /* option proc */ NULL,
1010 /* desc, NAME, name */ PGPSUBKEY_DESC, PGPSUBKEY_NAME, PGPSUBKEY_name,
1011 /* disablement strs */ NULL, NULL },
1013 { /* entry idx, value */ 31, VALUE_OPT_SRPUSERNAME,
1014 /* equiv idx, value */ 31, VALUE_OPT_SRPUSERNAME,
1015 /* equivalenced to */ NO_EQUIVALENT,
1016 /* min, max, act ct */ 0, 1, 0,
1017 /* opt state flags */ SRPUSERNAME_FLAGS, 0,
1018 /* last opt argumnt */ { NULL }, /* --srpusername */
1019 /* arg list/cookie */ NULL,
1020 /* must/cannot opts */ NULL, NULL,
1021 /* option proc */ NULL,
1022 /* desc, NAME, name */ SRPUSERNAME_DESC, SRPUSERNAME_NAME, SRPUSERNAME_name,
1023 /* disablement strs */ NULL, NULL },
1025 { /* entry idx, value */ 32, VALUE_OPT_SRPPASSWD,
1026 /* equiv idx, value */ 32, VALUE_OPT_SRPPASSWD,
1027 /* equivalenced to */ NO_EQUIVALENT,
1028 /* min, max, act ct */ 0, 1, 0,
1029 /* opt state flags */ SRPPASSWD_FLAGS, 0,
1030 /* last opt argumnt */ { NULL }, /* --srppasswd */
1031 /* arg list/cookie */ NULL,
1032 /* must/cannot opts */ NULL, NULL,
1033 /* option proc */ NULL,
1034 /* desc, NAME, name */ SRPPASSWD_DESC, SRPPASSWD_NAME, SRPPASSWD_name,
1035 /* disablement strs */ NULL, NULL },
1037 { /* entry idx, value */ 33, VALUE_OPT_PSKUSERNAME,
1038 /* equiv idx, value */ 33, VALUE_OPT_PSKUSERNAME,
1039 /* equivalenced to */ NO_EQUIVALENT,
1040 /* min, max, act ct */ 0, 1, 0,
1041 /* opt state flags */ PSKUSERNAME_FLAGS, 0,
1042 /* last opt argumnt */ { NULL }, /* --pskusername */
1043 /* arg list/cookie */ NULL,
1044 /* must/cannot opts */ NULL, NULL,
1045 /* option proc */ NULL,
1046 /* desc, NAME, name */ PSKUSERNAME_DESC, PSKUSERNAME_NAME, PSKUSERNAME_name,
1047 /* disablement strs */ NULL, NULL },
1049 { /* entry idx, value */ 34, VALUE_OPT_PSKKEY,
1050 /* equiv idx, value */ 34, VALUE_OPT_PSKKEY,
1051 /* equivalenced to */ NO_EQUIVALENT,
1052 /* min, max, act ct */ 0, 1, 0,
1053 /* opt state flags */ PSKKEY_FLAGS, 0,
1054 /* last opt argumnt */ { NULL }, /* --pskkey */
1055 /* arg list/cookie */ NULL,
1056 /* must/cannot opts */ NULL, NULL,
1057 /* option proc */ NULL,
1058 /* desc, NAME, name */ PSKKEY_DESC, PSKKEY_NAME, PSKKEY_name,
1059 /* disablement strs */ NULL, NULL },
1061 { /* entry idx, value */ 35, VALUE_OPT_PORT,
1062 /* equiv idx, value */ 35, VALUE_OPT_PORT,
1063 /* equivalenced to */ NO_EQUIVALENT,
1064 /* min, max, act ct */ 0, 1, 0,
1065 /* opt state flags */ PORT_FLAGS, 0,
1066 /* last opt argumnt */ { NULL }, /* --port */
1067 /* arg list/cookie */ NULL,
1068 /* must/cannot opts */ NULL, NULL,
1069 /* option proc */ NULL,
1070 /* desc, NAME, name */ PORT_DESC, PORT_NAME, PORT_name,
1071 /* disablement strs */ NULL, NULL },
1073 { /* entry idx, value */ 36, VALUE_OPT_INSECURE,
1074 /* equiv idx, value */ 36, VALUE_OPT_INSECURE,
1075 /* equivalenced to */ NO_EQUIVALENT,
1076 /* min, max, act ct */ 0, 1, 0,
1077 /* opt state flags */ INSECURE_FLAGS, 0,
1078 /* last opt argumnt */ { NULL }, /* --insecure */
1079 /* arg list/cookie */ NULL,
1080 /* must/cannot opts */ NULL, NULL,
1081 /* option proc */ NULL,
1082 /* desc, NAME, name */ INSECURE_DESC, INSECURE_NAME, INSECURE_name,
1083 /* disablement strs */ NULL, NULL },
1085 { /* entry idx, value */ 37, VALUE_OPT_BENCHMARK_CIPHERS,
1086 /* equiv idx, value */ 37, VALUE_OPT_BENCHMARK_CIPHERS,
1087 /* equivalenced to */ NO_EQUIVALENT,
1088 /* min, max, act ct */ 0, 1, 0,
1089 /* opt state flags */ BENCHMARK_CIPHERS_FLAGS, 0,
1090 /* last opt argumnt */ { NULL }, /* --benchmark-ciphers */
1091 /* arg list/cookie */ NULL,
1092 /* must/cannot opts */ NULL, NULL,
1093 /* option proc */ NULL,
1094 /* desc, NAME, name */ BENCHMARK_CIPHERS_DESC, BENCHMARK_CIPHERS_NAME, BENCHMARK_CIPHERS_name,
1095 /* disablement strs */ NULL, NULL },
1097 { /* entry idx, value */ 38, VALUE_OPT_BENCHMARK_SOFT_CIPHERS,
1098 /* equiv idx, value */ 38, VALUE_OPT_BENCHMARK_SOFT_CIPHERS,
1099 /* equivalenced to */ NO_EQUIVALENT,
1100 /* min, max, act ct */ 0, 1, 0,
1101 /* opt state flags */ BENCHMARK_SOFT_CIPHERS_FLAGS, 0,
1102 /* last opt argumnt */ { NULL }, /* --benchmark-soft-ciphers */
1103 /* arg list/cookie */ NULL,
1104 /* must/cannot opts */ NULL, NULL,
1105 /* option proc */ NULL,
1106 /* desc, NAME, name */ BENCHMARK_SOFT_CIPHERS_DESC, BENCHMARK_SOFT_CIPHERS_NAME, BENCHMARK_SOFT_CIPHERS_name,
1107 /* disablement strs */ NULL, NULL },
1109 { /* entry idx, value */ 39, VALUE_OPT_BENCHMARK_TLS_KX,
1110 /* equiv idx, value */ 39, VALUE_OPT_BENCHMARK_TLS_KX,
1111 /* equivalenced to */ NO_EQUIVALENT,
1112 /* min, max, act ct */ 0, 1, 0,
1113 /* opt state flags */ BENCHMARK_TLS_KX_FLAGS, 0,
1114 /* last opt argumnt */ { NULL }, /* --benchmark-tls-kx */
1115 /* arg list/cookie */ NULL,
1116 /* must/cannot opts */ NULL, NULL,
1117 /* option proc */ NULL,
1118 /* desc, NAME, name */ BENCHMARK_TLS_KX_DESC, BENCHMARK_TLS_KX_NAME, BENCHMARK_TLS_KX_name,
1119 /* disablement strs */ NULL, NULL },
1121 { /* entry idx, value */ 40, VALUE_OPT_BENCHMARK_TLS_CIPHERS,
1122 /* equiv idx, value */ 40, VALUE_OPT_BENCHMARK_TLS_CIPHERS,
1123 /* equivalenced to */ NO_EQUIVALENT,
1124 /* min, max, act ct */ 0, 1, 0,
1125 /* opt state flags */ BENCHMARK_TLS_CIPHERS_FLAGS, 0,
1126 /* last opt argumnt */ { NULL }, /* --benchmark-tls-ciphers */
1127 /* arg list/cookie */ NULL,
1128 /* must/cannot opts */ NULL, NULL,
1129 /* option proc */ NULL,
1130 /* desc, NAME, name */ BENCHMARK_TLS_CIPHERS_DESC, BENCHMARK_TLS_CIPHERS_NAME, BENCHMARK_TLS_CIPHERS_name,
1131 /* disablement strs */ NULL, NULL },
1133 { /* entry idx, value */ 41, VALUE_OPT_LIST,
1134 /* equiv idx, value */ 41, VALUE_OPT_LIST,
1135 /* equivalenced to */ NO_EQUIVALENT,
1136 /* min, max, act ct */ 0, 1, 0,
1137 /* opt state flags */ LIST_FLAGS, 0,
1138 /* last opt argumnt */ { NULL }, /* --list */
1139 /* arg list/cookie */ NULL,
1140 /* must/cannot opts */ NULL, NULL,
1141 /* option proc */ NULL,
1142 /* desc, NAME, name */ LIST_DESC, LIST_NAME, LIST_name,
1143 /* disablement strs */ NULL, NULL },
1145 { /* entry idx, value */ INDEX_OPT_VERSION, VALUE_OPT_VERSION,
1146 /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_VERSION,
1147 /* equivalenced to */ NO_EQUIVALENT,
1148 /* min, max, act ct */ 0, 1, 0,
1149 /* opt state flags */ VER_FLAGS, 0,
1150 /* last opt argumnt */ { NULL },
1151 /* arg list/cookie */ NULL,
1152 /* must/cannot opts */ NULL, NULL,
1153 /* option proc */ VER_PROC,
1154 /* desc, NAME, name */ VER_DESC, NULL, VER_name,
1155 /* disablement strs */ NULL, NULL },
1159 { /* entry idx, value */ INDEX_OPT_HELP, VALUE_OPT_HELP,
1160 /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_HELP,
1161 /* equivalenced to */ NO_EQUIVALENT,
1162 /* min, max, act ct */ 0, 1, 0,
1163 /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, 0,
1164 /* last opt argumnt */ { NULL },
1165 /* arg list/cookie */ NULL,
1166 /* must/cannot opts */ NULL, NULL,
1167 /* option proc */ doUsageOpt,
1168 /* desc, NAME, name */ HELP_DESC, NULL, HELP_name,
1169 /* disablement strs */ NULL, NULL },
1171 { /* entry idx, value */ INDEX_OPT_MORE_HELP, VALUE_OPT_MORE_HELP,
1172 /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_MORE_HELP,
1173 /* equivalenced to */ NO_EQUIVALENT,
1174 /* min, max, act ct */ 0, 1, 0,
1175 /* opt state flags */ MORE_HELP_FLAGS, 0,
1176 /* last opt argumnt */ { NULL },
1177 /* arg list/cookie */ NULL,
1178 /* must/cannot opts */ NULL, NULL,
1179 /* option proc */ optionPagedUsage,
1180 /* desc, NAME, name */ MORE_HELP_DESC, NULL, MORE_HELP_name,
1181 /* disablement strs */ NULL, NULL }
1185 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1187 * Define the gnutls-cli Option Environment
1189 #define zPROGNAME (gnutls_cli_opt_strs+3377)
1190 #define zUsageTitle (gnutls_cli_opt_strs+3388)
1191 #define zRcName NULL
1192 #define apzHomeList NULL
1193 #define zBugsAddr (gnutls_cli_opt_strs+3501)
1194 #define zExplain (gnutls_cli_opt_strs+3520)
1195 #define zDetail (gnutls_cli_opt_strs+3523)
1196 #define zFullVersion (gnutls_cli_opt_strs+3707)
1197 /* extracted from optcode.tlib near line 350 */
1199 #if defined(ENABLE_NLS)
1200 # define OPTPROC_BASE OPTPROC_TRANSLATE | OPTPROC_NXLAT_OPT
1201 static tOptionXlateProc translate_option_strings;
1202 #else
1203 # define OPTPROC_BASE OPTPROC_NONE
1204 # define translate_option_strings NULL
1205 #endif /* ENABLE_NLS */
1208 #define gnutls_cli_full_usage (NULL)
1210 #define gnutls_cli_short_usage (gnutls_cli_opt_strs+3728)
1212 #endif /* not defined __doxygen__ */
1215 * Create the static procedure(s) declared above.
1218 * The callout function that invokes the optionUsage function.
1220 * @param pOptions the AutoOpts option description structure
1221 * @param pOptDesc the descriptor for the "help" (usage) option.
1222 * @noreturn
1224 static void
1225 doUsageOpt(tOptions * pOptions, tOptDesc * pOptDesc)
1227 optionUsage(&gnutls_cliOptions, GNUTLS_CLI_EXIT_SUCCESS);
1228 /* NOTREACHED */
1229 (void)pOptDesc;
1230 (void)pOptions;
1233 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1235 * Code to handle the debug option.
1237 * @param pOptions the gnutls-cli options data structure
1238 * @param pOptDesc the option descriptor for this option.
1240 static void
1241 doOptDebug(tOptions* pOptions, tOptDesc* pOptDesc)
1243 static struct {long rmin, rmax;} const rng[1] = {
1244 { 0 , 9999 } };
1245 int ix;
1247 if (pOptions <= OPTPROC_EMIT_LIMIT)
1248 goto emit_ranges;
1249 optionNumericVal(pOptions, pOptDesc);
1251 for (ix = 0; ix < 1; ix++) {
1252 if (pOptDesc->optArg.argInt < rng[ix].rmin)
1253 continue; /* ranges need not be ordered. */
1254 if (pOptDesc->optArg.argInt == rng[ix].rmin)
1255 return;
1256 if (rng[ix].rmax == LONG_MIN)
1257 continue;
1258 if (pOptDesc->optArg.argInt <= rng[ix].rmax)
1259 return;
1262 option_usage_fp = stderr;
1264 emit_ranges:
1266 optionShowRange(pOptions, pOptDesc, (void *)rng, 1);
1269 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1271 * Code to handle the mtu option.
1273 * @param pOptions the gnutls-cli options data structure
1274 * @param pOptDesc the option descriptor for this option.
1276 static void
1277 doOptMtu(tOptions* pOptions, tOptDesc* pOptDesc)
1279 static struct {long rmin, rmax;} const rng[1] = {
1280 { 0, 17000 } };
1281 int ix;
1283 if (pOptions <= OPTPROC_EMIT_LIMIT)
1284 goto emit_ranges;
1285 optionNumericVal(pOptions, pOptDesc);
1287 for (ix = 0; ix < 1; ix++) {
1288 if (pOptDesc->optArg.argInt < rng[ix].rmin)
1289 continue; /* ranges need not be ordered. */
1290 if (pOptDesc->optArg.argInt == rng[ix].rmin)
1291 return;
1292 if (rng[ix].rmax == LONG_MIN)
1293 continue;
1294 if (pOptDesc->optArg.argInt <= rng[ix].rmax)
1295 return;
1298 option_usage_fp = stderr;
1300 emit_ranges:
1302 optionShowRange(pOptions, pOptDesc, (void *)rng, 1);
1305 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1307 * Code to handle the recordsize option.
1309 * @param pOptions the gnutls-cli options data structure
1310 * @param pOptDesc the option descriptor for this option.
1312 static void
1313 doOptRecordsize(tOptions* pOptions, tOptDesc* pOptDesc)
1315 static struct {long rmin, rmax;} const rng[1] = {
1316 { 0, 4096 } };
1317 int ix;
1319 if (pOptions <= OPTPROC_EMIT_LIMIT)
1320 goto emit_ranges;
1321 optionNumericVal(pOptions, pOptDesc);
1323 for (ix = 0; ix < 1; ix++) {
1324 if (pOptDesc->optArg.argInt < rng[ix].rmin)
1325 continue; /* ranges need not be ordered. */
1326 if (pOptDesc->optArg.argInt == rng[ix].rmin)
1327 return;
1328 if (rng[ix].rmax == LONG_MIN)
1329 continue;
1330 if (pOptDesc->optArg.argInt <= rng[ix].rmax)
1331 return;
1334 option_usage_fp = stderr;
1336 emit_ranges:
1338 optionShowRange(pOptions, pOptDesc, (void *)rng, 1);
1341 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1343 * Code to handle the x509crlfile option.
1345 * @param pOptions the gnutls-cli options data structure
1346 * @param pOptDesc the option descriptor for this option.
1348 static void
1349 doOptX509crlfile(tOptions* pOptions, tOptDesc* pOptDesc)
1351 static teOptFileType const type =
1352 FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN;
1353 static tuFileMode mode;
1354 #ifndef O_CLOEXEC
1355 # define O_CLOEXEC 0
1356 #endif
1357 mode.file_flags = O_CLOEXEC;
1359 optionFileCheck(pOptions, pOptDesc, type, mode);
1362 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1364 * Code to handle the pgpkeyfile option.
1366 * @param pOptions the gnutls-cli options data structure
1367 * @param pOptDesc the option descriptor for this option.
1369 static void
1370 doOptPgpkeyfile(tOptions* pOptions, tOptDesc* pOptDesc)
1372 static teOptFileType const type =
1373 FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN;
1374 static tuFileMode mode;
1375 #ifndef O_CLOEXEC
1376 # define O_CLOEXEC 0
1377 #endif
1378 mode.file_flags = O_CLOEXEC;
1380 optionFileCheck(pOptions, pOptDesc, type, mode);
1383 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1385 * Code to handle the pgpkeyring option.
1387 * @param pOptions the gnutls-cli options data structure
1388 * @param pOptDesc the option descriptor for this option.
1390 static void
1391 doOptPgpkeyring(tOptions* pOptions, tOptDesc* pOptDesc)
1393 static teOptFileType const type =
1394 FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN;
1395 static tuFileMode mode;
1396 #ifndef O_CLOEXEC
1397 # define O_CLOEXEC 0
1398 #endif
1399 mode.file_flags = O_CLOEXEC;
1401 optionFileCheck(pOptions, pOptDesc, type, mode);
1404 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1406 * Code to handle the pgpcertfile option.
1408 * @param pOptions the gnutls-cli options data structure
1409 * @param pOptDesc the option descriptor for this option.
1411 static void
1412 doOptPgpcertfile(tOptions* pOptions, tOptDesc* pOptDesc)
1414 static teOptFileType const type =
1415 FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN;
1416 static tuFileMode mode;
1417 #ifndef O_CLOEXEC
1418 # define O_CLOEXEC 0
1419 #endif
1420 mode.file_flags = O_CLOEXEC;
1422 optionFileCheck(pOptions, pOptDesc, type, mode);
1424 /* extracted from optmain.tlib near line 1113 */
1427 * The directory containing the data associated with gnutls-cli.
1429 #ifndef PKGDATADIR
1430 # define PKGDATADIR ""
1431 #endif
1434 * Information about the person or institution that packaged gnutls-cli
1435 * for the current distribution.
1437 #ifndef WITH_PACKAGER
1438 # define gnutls_cli_packager_info NULL
1439 #else
1440 static char const gnutls_cli_packager_info[] =
1441 "Packaged by " WITH_PACKAGER
1443 # ifdef WITH_PACKAGER_VERSION
1444 " ("WITH_PACKAGER_VERSION")"
1445 # endif
1447 # ifdef WITH_PACKAGER_BUG_REPORTS
1448 "\nReport gnutls_cli bugs to " WITH_PACKAGER_BUG_REPORTS
1449 # endif
1450 "\n";
1451 #endif
1452 #ifndef __doxygen__
1454 #endif /* __doxygen__ */
1456 * The option definitions for gnutls-cli. The one structure that
1457 * binds them all.
1459 tOptions gnutls_cliOptions = {
1460 OPTIONS_STRUCT_VERSION,
1461 0, NULL, /* original argc + argv */
1462 ( OPTPROC_BASE
1463 + OPTPROC_ERRSTOP
1464 + OPTPROC_SHORTOPT
1465 + OPTPROC_LONGOPT
1466 + OPTPROC_NO_REQ_OPT
1467 + OPTPROC_NEGATIONS
1468 + OPTPROC_REORDER
1469 + OPTPROC_GNUUSAGE
1470 + OPTPROC_MISUSE ),
1471 0, NULL, /* current option index, current option */
1472 NULL, NULL, zPROGNAME,
1473 zRcName, zCopyright, zLicenseDescrip,
1474 zFullVersion, apzHomeList, zUsageTitle,
1475 zExplain, zDetail, optDesc,
1476 zBugsAddr, /* address to send bugs to */
1477 NULL, NULL, /* extensions/saved state */
1478 optionUsage, /* usage procedure */
1479 translate_option_strings, /* translation procedure */
1481 * Indexes to special options
1483 { INDEX_OPT_MORE_HELP, /* more-help option index */
1484 NO_EQUIVALENT, /* save option index */
1485 NO_EQUIVALENT, /* '-#' option index */
1486 NO_EQUIVALENT /* index of default opt */
1488 45 /* full option count */, 42 /* user option count */,
1489 gnutls_cli_full_usage, gnutls_cli_short_usage,
1490 NULL, NULL,
1491 PKGDATADIR, gnutls_cli_packager_info
1494 #if ENABLE_NLS
1495 #include <stdio.h>
1496 #include <stdlib.h>
1497 #include <string.h>
1498 #include <unistd.h>
1499 #include <autoopts/usage-txt.h>
1501 static char* AO_gettext(char const* pz);
1502 static void coerce_it(void** s);
1505 * AutoGen specific wrapper function for gettext.
1506 * It relies on the macro _() to convert from English to the target
1507 * language, then strdup-duplicates the result string.
1509 * @param[in] pz the input text used as a lookup key.
1510 * @returns the translated text (if there is one),
1511 * or the original text (if not).
1513 static char *
1514 AO_gettext(char const* pz)
1516 char* pzRes;
1517 if (pz == NULL)
1518 return NULL;
1519 pzRes = _(pz);
1520 if (pzRes == pz)
1521 return pzRes;
1522 pzRes = strdup(pzRes);
1523 if (pzRes == NULL) {
1524 fputs(_("No memory for duping translated strings\n"), stderr);
1525 exit(GNUTLS_CLI_EXIT_FAILURE);
1527 return pzRes;
1530 static void coerce_it(void** s) { *s = AO_gettext(*s);
1534 * Translate all the translatable strings in the gnutls_cliOptions
1535 * structure defined above. This is done only once.
1537 static void
1538 translate_option_strings(void)
1540 tOptions * const pOpt = &gnutls_cliOptions;
1543 * Guard against re-translation. It won't work. The strings will have
1544 * been changed by the first pass through this code. One shot only.
1546 if (option_usage_text.field_ct != 0) {
1548 * Do the translations. The first pointer follows the field count
1549 * field. The field count field is the size of a pointer.
1551 tOptDesc * pOD = pOpt->pOptDesc;
1552 char ** ppz = (char**)(void*)&(option_usage_text);
1553 int ix = option_usage_text.field_ct;
1555 do {
1556 ppz++;
1557 *ppz = AO_gettext(*ppz);
1558 } while (--ix > 0);
1560 coerce_it((void*)&(pOpt->pzCopyright));
1561 coerce_it((void*)&(pOpt->pzCopyNotice));
1562 coerce_it((void*)&(pOpt->pzFullVersion));
1563 coerce_it((void*)&(pOpt->pzUsageTitle));
1564 coerce_it((void*)&(pOpt->pzExplain));
1565 coerce_it((void*)&(pOpt->pzDetail));
1566 coerce_it((void*)&(pOpt->pzPackager));
1567 coerce_it((void*)&(pOpt->pzShortUsage));
1568 option_usage_text.field_ct = 0;
1570 for (ix = pOpt->optCt; ix > 0; ix--, pOD++)
1571 coerce_it((void*)&(pOD->pzText));
1574 if ((pOpt->fOptSet & OPTPROC_NXLAT_OPT_CFG) == 0) {
1575 tOptDesc * pOD = pOpt->pOptDesc;
1576 int ix;
1578 for (ix = pOpt->optCt; ix > 0; ix--, pOD++) {
1579 coerce_it((void*)&(pOD->pz_Name));
1580 coerce_it((void*)&(pOD->pz_DisableName));
1581 coerce_it((void*)&(pOD->pz_DisablePfx));
1583 /* prevent re-translation */
1584 gnutls_cliOptions.fOptSet |= OPTPROC_NXLAT_OPT_CFG | OPTPROC_NXLAT_OPT;
1588 #endif /* ENABLE_NLS */
1590 #ifdef __cplusplus
1592 #endif
1593 /* cli-args.c ends here */