Allow for bit strings that are not a multiple of 8.
[gnutls.git] / src / cli-args.c
blob065894cf26edc4f23b3e22eae1bc29b9a63a5380
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 November 9, 2012 at 05:12:10 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[3786] =
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 */ "Connect, establish a plain session and start TLS.\0"
122 /* 1512 */ "STARTTLS\0"
123 /* 1521 */ "starttls\0"
124 /* 1530 */ "Use DTLS (datagram TLS) over UDP\0"
125 /* 1563 */ "UDP\0"
126 /* 1567 */ "udp\0"
127 /* 1571 */ "Set MTU for datagram TLS\0"
128 /* 1596 */ "MTU\0"
129 /* 1600 */ "mtu\0"
130 /* 1604 */ "Offer SRTP profiles\0"
131 /* 1624 */ "SRTP_PROFILES\0"
132 /* 1638 */ "srtp-profiles\0"
133 /* 1652 */ "Send CR LF instead of LF\0"
134 /* 1677 */ "CRLF\0"
135 /* 1682 */ "crlf\0"
136 /* 1687 */ "Use DER format for certificates to read from\0"
137 /* 1732 */ "X509FMTDER\0"
138 /* 1743 */ "x509fmtder\0"
139 /* 1754 */ "Send the openpgp fingerprint, instead of the key\0"
140 /* 1803 */ "FINGERPRINT\0"
141 /* 1815 */ "fingerprint\0"
142 /* 1827 */ "Disable all the TLS extensions\0"
143 /* 1858 */ "DISABLE_EXTENSIONS\0"
144 /* 1877 */ "disable-extensions\0"
145 /* 1896 */ "Print peer's certificate in PEM format\0"
146 /* 1935 */ "PRINT_CERT\0"
147 /* 1946 */ "print-cert\0"
148 /* 1957 */ "The maximum record size to advertize\0"
149 /* 1994 */ "RECORDSIZE\0"
150 /* 2005 */ "recordsize\0"
151 /* 2016 */ "The minimum number of bits allowed for DH\0"
152 /* 2058 */ "DH_BITS\0"
153 /* 2066 */ "dh-bits\0"
154 /* 2074 */ "Priorities string\0"
155 /* 2092 */ "PRIORITY\0"
156 /* 2101 */ "priority\0"
157 /* 2110 */ "Certificate file or PKCS #11 URL to use\0"
158 /* 2150 */ "X509CAFILE\0"
159 /* 2161 */ "x509cafile\0"
160 /* 2172 */ "CRL file to use\0"
161 /* 2188 */ "X509CRLFILE\0"
162 /* 2200 */ "x509crlfile\0"
163 /* 2212 */ "PGP Key file to use\0"
164 /* 2232 */ "PGPKEYFILE\0"
165 /* 2243 */ "pgpkeyfile\0"
166 /* 2254 */ "PGP Key ring file to use\0"
167 /* 2279 */ "PGPKEYRING\0"
168 /* 2290 */ "pgpkeyring\0"
169 /* 2301 */ "PGP Public Key (certificate) file to use\0"
170 /* 2342 */ "PGPCERTFILE\0"
171 /* 2354 */ "pgpcertfile\0"
172 /* 2366 */ "X.509 key file or PKCS #11 URL to use\0"
173 /* 2404 */ "X509KEYFILE\0"
174 /* 2416 */ "x509keyfile\0"
175 /* 2428 */ "X.509 Certificate file or PKCS #11 URL to use\0"
176 /* 2474 */ "X509CERTFILE\0"
177 /* 2487 */ "x509certfile\0"
178 /* 2500 */ "PGP subkey to use (hex or auto)\0"
179 /* 2532 */ "PGPSUBKEY\0"
180 /* 2542 */ "pgpsubkey\0"
181 /* 2552 */ "SRP username to use\0"
182 /* 2572 */ "SRPUSERNAME\0"
183 /* 2584 */ "srpusername\0"
184 /* 2596 */ "SRP password to use\0"
185 /* 2616 */ "SRPPASSWD\0"
186 /* 2626 */ "srppasswd\0"
187 /* 2636 */ "PSK username to use\0"
188 /* 2656 */ "PSKUSERNAME\0"
189 /* 2668 */ "pskusername\0"
190 /* 2680 */ "PSK key (in hex) to use\0"
191 /* 2704 */ "PSKKEY\0"
192 /* 2711 */ "pskkey\0"
193 /* 2718 */ "The port or service to connect to\0"
194 /* 2752 */ "PORT\0"
195 /* 2757 */ "port\0"
196 /* 2762 */ "Don't abort program if server certificate can't be validated\0"
197 /* 2823 */ "INSECURE\0"
198 /* 2832 */ "insecure\0"
199 /* 2841 */ "Benchmark individual ciphers\0"
200 /* 2870 */ "BENCHMARK_CIPHERS\0"
201 /* 2888 */ "benchmark-ciphers\0"
202 /* 2906 */ "Benchmark individual software ciphers (no hw acceleration)\0"
203 /* 2965 */ "BENCHMARK_SOFT_CIPHERS\0"
204 /* 2988 */ "benchmark-soft-ciphers\0"
205 /* 3011 */ "Benchmark TLS key exchange methods\0"
206 /* 3046 */ "BENCHMARK_TLS_KX\0"
207 /* 3063 */ "benchmark-tls-kx\0"
208 /* 3080 */ "Benchmark TLS ciphers\0"
209 /* 3102 */ "BENCHMARK_TLS_CIPHERS\0"
210 /* 3124 */ "benchmark-tls-ciphers\0"
211 /* 3146 */ "Print a list of the supported algorithms and modes\0"
212 /* 3197 */ "LIST\0"
213 /* 3202 */ "list\0"
214 /* 3207 */ "Display extended usage information and exit\0"
215 /* 3251 */ "help\0"
216 /* 3256 */ "Extended usage information passed thru pager\0"
217 /* 3301 */ "more-help\0"
218 /* 3311 */ "Output version information and exit\0"
219 /* 3347 */ "version\0"
220 /* 3355 */ "GNUTLS_CLI\0"
221 /* 3366 */ "gnutls-cli - GnuTLS client - Ver. @VERSION@\n"
222 "USAGE: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [hostname]\n\0"
223 /* 3479 */ "bug-gnutls@gnu.org\0"
224 /* 3498 */ "\n\n\0"
225 /* 3501 */ "\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 /* 3685 */ "gnutls-cli @VERSION@\0"
230 /* 3706 */ "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 * starttls option description:
335 #define STARTTLS_DESC (gnutls_cli_opt_strs+1462)
336 #define STARTTLS_NAME (gnutls_cli_opt_strs+1512)
337 #define STARTTLS_name (gnutls_cli_opt_strs+1521)
338 #define STARTTLS_FLAGS (OPTST_DISABLED)
341 * udp option description:
343 #define UDP_DESC (gnutls_cli_opt_strs+1530)
344 #define UDP_NAME (gnutls_cli_opt_strs+1563)
345 #define UDP_name (gnutls_cli_opt_strs+1567)
346 #define UDP_FLAGS (OPTST_DISABLED)
349 * mtu option description:
351 #define MTU_DESC (gnutls_cli_opt_strs+1571)
352 #define MTU_NAME (gnutls_cli_opt_strs+1596)
353 #define MTU_name (gnutls_cli_opt_strs+1600)
354 #define MTU_FLAGS (OPTST_DISABLED \
355 | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
358 * srtp_profiles option description:
360 #define SRTP_PROFILES_DESC (gnutls_cli_opt_strs+1604)
361 #define SRTP_PROFILES_NAME (gnutls_cli_opt_strs+1624)
362 #define SRTP_PROFILES_name (gnutls_cli_opt_strs+1638)
363 #define SRTP_PROFILES_FLAGS (OPTST_DISABLED \
364 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
367 * crlf option description:
369 #define CRLF_DESC (gnutls_cli_opt_strs+1652)
370 #define CRLF_NAME (gnutls_cli_opt_strs+1677)
371 #define CRLF_name (gnutls_cli_opt_strs+1682)
372 #define CRLF_FLAGS (OPTST_DISABLED)
375 * x509fmtder option description:
377 #define X509FMTDER_DESC (gnutls_cli_opt_strs+1687)
378 #define X509FMTDER_NAME (gnutls_cli_opt_strs+1732)
379 #define X509FMTDER_name (gnutls_cli_opt_strs+1743)
380 #define X509FMTDER_FLAGS (OPTST_DISABLED)
383 * fingerprint option description:
385 #define FINGERPRINT_DESC (gnutls_cli_opt_strs+1754)
386 #define FINGERPRINT_NAME (gnutls_cli_opt_strs+1803)
387 #define FINGERPRINT_name (gnutls_cli_opt_strs+1815)
388 #define FINGERPRINT_FLAGS (OPTST_DISABLED)
391 * disable-extensions option description:
393 #define DISABLE_EXTENSIONS_DESC (gnutls_cli_opt_strs+1827)
394 #define DISABLE_EXTENSIONS_NAME (gnutls_cli_opt_strs+1858)
395 #define DISABLE_EXTENSIONS_name (gnutls_cli_opt_strs+1877)
396 #define DISABLE_EXTENSIONS_FLAGS (OPTST_DISABLED)
399 * print-cert option description:
401 #define PRINT_CERT_DESC (gnutls_cli_opt_strs+1896)
402 #define PRINT_CERT_NAME (gnutls_cli_opt_strs+1935)
403 #define PRINT_CERT_name (gnutls_cli_opt_strs+1946)
404 #define PRINT_CERT_FLAGS (OPTST_DISABLED)
407 * recordsize option description:
409 #define RECORDSIZE_DESC (gnutls_cli_opt_strs+1957)
410 #define RECORDSIZE_NAME (gnutls_cli_opt_strs+1994)
411 #define RECORDSIZE_name (gnutls_cli_opt_strs+2005)
412 #define RECORDSIZE_FLAGS (OPTST_DISABLED \
413 | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
416 * dh-bits option description:
418 #define DH_BITS_DESC (gnutls_cli_opt_strs+2016)
419 #define DH_BITS_NAME (gnutls_cli_opt_strs+2058)
420 #define DH_BITS_name (gnutls_cli_opt_strs+2066)
421 #define DH_BITS_FLAGS (OPTST_DISABLED \
422 | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
425 * priority option description:
427 #define PRIORITY_DESC (gnutls_cli_opt_strs+2074)
428 #define PRIORITY_NAME (gnutls_cli_opt_strs+2092)
429 #define PRIORITY_name (gnutls_cli_opt_strs+2101)
430 #define PRIORITY_FLAGS (OPTST_DISABLED \
431 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
434 * x509cafile option description:
436 #define X509CAFILE_DESC (gnutls_cli_opt_strs+2110)
437 #define X509CAFILE_NAME (gnutls_cli_opt_strs+2150)
438 #define X509CAFILE_name (gnutls_cli_opt_strs+2161)
439 #define X509CAFILE_FLAGS (OPTST_DISABLED \
440 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
443 * x509crlfile option description:
445 #define X509CRLFILE_DESC (gnutls_cli_opt_strs+2172)
446 #define X509CRLFILE_NAME (gnutls_cli_opt_strs+2188)
447 #define X509CRLFILE_name (gnutls_cli_opt_strs+2200)
448 #define X509CRLFILE_FLAGS (OPTST_DISABLED \
449 | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
452 * pgpkeyfile option description:
454 #define PGPKEYFILE_DESC (gnutls_cli_opt_strs+2212)
455 #define PGPKEYFILE_NAME (gnutls_cli_opt_strs+2232)
456 #define PGPKEYFILE_name (gnutls_cli_opt_strs+2243)
457 #define PGPKEYFILE_FLAGS (OPTST_DISABLED \
458 | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
461 * pgpkeyring option description:
463 #define PGPKEYRING_DESC (gnutls_cli_opt_strs+2254)
464 #define PGPKEYRING_NAME (gnutls_cli_opt_strs+2279)
465 #define PGPKEYRING_name (gnutls_cli_opt_strs+2290)
466 #define PGPKEYRING_FLAGS (OPTST_DISABLED \
467 | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
470 * pgpcertfile option description:
472 #define PGPCERTFILE_DESC (gnutls_cli_opt_strs+2301)
473 #define PGPCERTFILE_NAME (gnutls_cli_opt_strs+2342)
474 #define PGPCERTFILE_name (gnutls_cli_opt_strs+2354)
475 #define PGPCERTFILE_FLAGS (OPTST_DISABLED \
476 | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
479 * x509keyfile option description:
481 #define X509KEYFILE_DESC (gnutls_cli_opt_strs+2366)
482 #define X509KEYFILE_NAME (gnutls_cli_opt_strs+2404)
483 #define X509KEYFILE_name (gnutls_cli_opt_strs+2416)
484 #define X509KEYFILE_FLAGS (OPTST_DISABLED \
485 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
488 * x509certfile option description:
490 #define X509CERTFILE_DESC (gnutls_cli_opt_strs+2428)
491 #define X509CERTFILE_NAME (gnutls_cli_opt_strs+2474)
492 #define X509CERTFILE_name (gnutls_cli_opt_strs+2487)
493 #define X509CERTFILE_FLAGS (OPTST_DISABLED \
494 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
497 * pgpsubkey option description:
499 #define PGPSUBKEY_DESC (gnutls_cli_opt_strs+2500)
500 #define PGPSUBKEY_NAME (gnutls_cli_opt_strs+2532)
501 #define PGPSUBKEY_name (gnutls_cli_opt_strs+2542)
502 #define PGPSUBKEY_FLAGS (OPTST_DISABLED \
503 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
506 * srpusername option description:
508 #define SRPUSERNAME_DESC (gnutls_cli_opt_strs+2552)
509 #define SRPUSERNAME_NAME (gnutls_cli_opt_strs+2572)
510 #define SRPUSERNAME_name (gnutls_cli_opt_strs+2584)
511 #define SRPUSERNAME_FLAGS (OPTST_DISABLED \
512 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
515 * srppasswd option description:
517 #define SRPPASSWD_DESC (gnutls_cli_opt_strs+2596)
518 #define SRPPASSWD_NAME (gnutls_cli_opt_strs+2616)
519 #define SRPPASSWD_name (gnutls_cli_opt_strs+2626)
520 #define SRPPASSWD_FLAGS (OPTST_DISABLED \
521 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
524 * pskusername option description:
526 #define PSKUSERNAME_DESC (gnutls_cli_opt_strs+2636)
527 #define PSKUSERNAME_NAME (gnutls_cli_opt_strs+2656)
528 #define PSKUSERNAME_name (gnutls_cli_opt_strs+2668)
529 #define PSKUSERNAME_FLAGS (OPTST_DISABLED \
530 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
533 * pskkey option description:
535 #define PSKKEY_DESC (gnutls_cli_opt_strs+2680)
536 #define PSKKEY_NAME (gnutls_cli_opt_strs+2704)
537 #define PSKKEY_name (gnutls_cli_opt_strs+2711)
538 #define PSKKEY_FLAGS (OPTST_DISABLED \
539 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
542 * port option description:
544 #define PORT_DESC (gnutls_cli_opt_strs+2718)
545 #define PORT_NAME (gnutls_cli_opt_strs+2752)
546 #define PORT_name (gnutls_cli_opt_strs+2757)
547 #define PORT_FLAGS (OPTST_DISABLED \
548 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
551 * insecure option description:
553 #define INSECURE_DESC (gnutls_cli_opt_strs+2762)
554 #define INSECURE_NAME (gnutls_cli_opt_strs+2823)
555 #define INSECURE_name (gnutls_cli_opt_strs+2832)
556 #define INSECURE_FLAGS (OPTST_DISABLED)
559 * benchmark-ciphers option description:
561 #define BENCHMARK_CIPHERS_DESC (gnutls_cli_opt_strs+2841)
562 #define BENCHMARK_CIPHERS_NAME (gnutls_cli_opt_strs+2870)
563 #define BENCHMARK_CIPHERS_name (gnutls_cli_opt_strs+2888)
564 #define BENCHMARK_CIPHERS_FLAGS (OPTST_DISABLED)
567 * benchmark-soft-ciphers option description:
569 #define BENCHMARK_SOFT_CIPHERS_DESC (gnutls_cli_opt_strs+2906)
570 #define BENCHMARK_SOFT_CIPHERS_NAME (gnutls_cli_opt_strs+2965)
571 #define BENCHMARK_SOFT_CIPHERS_name (gnutls_cli_opt_strs+2988)
572 #define BENCHMARK_SOFT_CIPHERS_FLAGS (OPTST_DISABLED)
575 * benchmark-tls-kx option description:
577 #define BENCHMARK_TLS_KX_DESC (gnutls_cli_opt_strs+3011)
578 #define BENCHMARK_TLS_KX_NAME (gnutls_cli_opt_strs+3046)
579 #define BENCHMARK_TLS_KX_name (gnutls_cli_opt_strs+3063)
580 #define BENCHMARK_TLS_KX_FLAGS (OPTST_DISABLED)
583 * benchmark-tls-ciphers option description:
585 #define BENCHMARK_TLS_CIPHERS_DESC (gnutls_cli_opt_strs+3080)
586 #define BENCHMARK_TLS_CIPHERS_NAME (gnutls_cli_opt_strs+3102)
587 #define BENCHMARK_TLS_CIPHERS_name (gnutls_cli_opt_strs+3124)
588 #define BENCHMARK_TLS_CIPHERS_FLAGS (OPTST_DISABLED)
591 * list option description:
593 #define LIST_DESC (gnutls_cli_opt_strs+3146)
594 #define LIST_NAME (gnutls_cli_opt_strs+3197)
595 #define LIST_name (gnutls_cli_opt_strs+3202)
596 #define LIST_FLAGS (OPTST_DISABLED)
599 * Help/More_Help/Version option descriptions:
601 #define HELP_DESC (gnutls_cli_opt_strs+3207)
602 #define HELP_name (gnutls_cli_opt_strs+3251)
603 #ifdef HAVE_WORKING_FORK
604 #define MORE_HELP_DESC (gnutls_cli_opt_strs+3256)
605 #define MORE_HELP_name (gnutls_cli_opt_strs+3301)
606 #define MORE_HELP_FLAGS (OPTST_IMM | OPTST_NO_INIT)
607 #else
608 #define MORE_HELP_DESC NULL
609 #define MORE_HELP_name NULL
610 #define MORE_HELP_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
611 #endif
612 #ifdef NO_OPTIONAL_OPT_ARGS
613 # define VER_FLAGS (OPTST_IMM | OPTST_NO_INIT)
614 #else
615 # define VER_FLAGS (OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \
616 OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT)
617 #endif
618 #define VER_DESC (gnutls_cli_opt_strs+3311)
619 #define VER_name (gnutls_cli_opt_strs+3347)
621 * Declare option callback procedures
623 extern tOptProc
624 optionBooleanVal, optionNestedVal, optionNumericVal,
625 optionPagedUsage, optionPrintVersion, optionResetOpt,
626 optionStackArg, optionTimeDate, optionTimeVal,
627 optionUnstackArg, optionVendorOption;
628 static tOptProc
629 doOptDebug, doOptMtu, doOptPgpcertfile, doOptPgpkeyfile,
630 doOptPgpkeyring, doOptRecordsize, doOptX509crlfile, doUsageOpt;
631 #define VER_PROC optionPrintVersion
633 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
635 * Define the gnutls-cli Option Descriptions.
636 * This is an array of OPTION_CT entries, one for each
637 * option that the gnutls-cli program responds to.
639 static tOptDesc optDesc[OPTION_CT] = {
640 { /* entry idx, value */ 0, VALUE_OPT_DEBUG,
641 /* equiv idx, value */ 0, VALUE_OPT_DEBUG,
642 /* equivalenced to */ NO_EQUIVALENT,
643 /* min, max, act ct */ 0, 1, 0,
644 /* opt state flags */ DEBUG_FLAGS, 0,
645 /* last opt argumnt */ { NULL }, /* --debug */
646 /* arg list/cookie */ NULL,
647 /* must/cannot opts */ NULL, NULL,
648 /* option proc */ doOptDebug,
649 /* desc, NAME, name */ DEBUG_DESC, DEBUG_NAME, DEBUG_name,
650 /* disablement strs */ NULL, NULL },
652 { /* entry idx, value */ 1, VALUE_OPT_VERBOSE,
653 /* equiv idx, value */ 1, VALUE_OPT_VERBOSE,
654 /* equivalenced to */ NO_EQUIVALENT,
655 /* min, max, act ct */ 0, NOLIMIT, 0,
656 /* opt state flags */ VERBOSE_FLAGS, 0,
657 /* last opt argumnt */ { NULL }, /* --verbose */
658 /* arg list/cookie */ NULL,
659 /* must/cannot opts */ NULL, NULL,
660 /* option proc */ NULL,
661 /* desc, NAME, name */ VERBOSE_DESC, VERBOSE_NAME, VERBOSE_name,
662 /* disablement strs */ NULL, NULL },
664 { /* entry idx, value */ 2, VALUE_OPT_TOFU,
665 /* equiv idx, value */ 2, VALUE_OPT_TOFU,
666 /* equivalenced to */ NO_EQUIVALENT,
667 /* min, max, act ct */ 0, 1, 0,
668 /* opt state flags */ TOFU_FLAGS, 0,
669 /* last opt argumnt */ { NULL }, /* --tofu */
670 /* arg list/cookie */ NULL,
671 /* must/cannot opts */ NULL, NULL,
672 /* option proc */ NULL,
673 /* desc, NAME, name */ TOFU_DESC, TOFU_NAME, TOFU_name,
674 /* disablement strs */ NOT_TOFU_name, NOT_TOFU_PFX },
676 { /* entry idx, value */ 3, VALUE_OPT_DANE,
677 /* equiv idx, value */ 3, VALUE_OPT_DANE,
678 /* equivalenced to */ NO_EQUIVALENT,
679 /* min, max, act ct */ 0, 1, 0,
680 /* opt state flags */ DANE_FLAGS, 0,
681 /* last opt argumnt */ { NULL }, /* --dane */
682 /* arg list/cookie */ NULL,
683 /* must/cannot opts */ NULL, NULL,
684 /* option proc */ NULL,
685 /* desc, NAME, name */ DANE_DESC, DANE_NAME, DANE_name,
686 /* disablement strs */ NOT_DANE_name, NOT_DANE_PFX },
688 { /* entry idx, value */ 4, VALUE_OPT_LOCAL_DNS,
689 /* equiv idx, value */ 4, VALUE_OPT_LOCAL_DNS,
690 /* equivalenced to */ NO_EQUIVALENT,
691 /* min, max, act ct */ 0, 1, 0,
692 /* opt state flags */ LOCAL_DNS_FLAGS, 0,
693 /* last opt argumnt */ { NULL }, /* --local-dns */
694 /* arg list/cookie */ NULL,
695 /* must/cannot opts */ NULL, NULL,
696 /* option proc */ NULL,
697 /* desc, NAME, name */ LOCAL_DNS_DESC, LOCAL_DNS_NAME, LOCAL_DNS_name,
698 /* disablement strs */ NOT_LOCAL_DNS_name, NOT_LOCAL_DNS_PFX },
700 { /* entry idx, value */ 5, VALUE_OPT_CA_VERIFICATION,
701 /* equiv idx, value */ 5, VALUE_OPT_CA_VERIFICATION,
702 /* equivalenced to */ NO_EQUIVALENT,
703 /* min, max, act ct */ 0, 1, 0,
704 /* opt state flags */ CA_VERIFICATION_FLAGS, 0,
705 /* last opt argumnt */ { NULL }, /* --ca-verification */
706 /* arg list/cookie */ NULL,
707 /* must/cannot opts */ NULL, NULL,
708 /* option proc */ NULL,
709 /* desc, NAME, name */ CA_VERIFICATION_DESC, CA_VERIFICATION_NAME, CA_VERIFICATION_name,
710 /* disablement strs */ NOT_CA_VERIFICATION_name, NOT_CA_VERIFICATION_PFX },
712 { /* entry idx, value */ 6, VALUE_OPT_OCSP,
713 /* equiv idx, value */ 6, VALUE_OPT_OCSP,
714 /* equivalenced to */ NO_EQUIVALENT,
715 /* min, max, act ct */ 0, 1, 0,
716 /* opt state flags */ OCSP_FLAGS, 0,
717 /* last opt argumnt */ { NULL }, /* --ocsp */
718 /* arg list/cookie */ NULL,
719 /* must/cannot opts */ NULL, NULL,
720 /* option proc */ NULL,
721 /* desc, NAME, name */ OCSP_DESC, OCSP_NAME, OCSP_name,
722 /* disablement strs */ NOT_OCSP_name, NOT_OCSP_PFX },
724 { /* entry idx, value */ 7, VALUE_OPT_RESUME,
725 /* equiv idx, value */ 7, VALUE_OPT_RESUME,
726 /* equivalenced to */ NO_EQUIVALENT,
727 /* min, max, act ct */ 0, 1, 0,
728 /* opt state flags */ RESUME_FLAGS, 0,
729 /* last opt argumnt */ { NULL }, /* --resume */
730 /* arg list/cookie */ NULL,
731 /* must/cannot opts */ NULL, NULL,
732 /* option proc */ NULL,
733 /* desc, NAME, name */ RESUME_DESC, RESUME_NAME, RESUME_name,
734 /* disablement strs */ NULL, NULL },
736 { /* entry idx, value */ 8, VALUE_OPT_HEARTBEAT,
737 /* equiv idx, value */ 8, VALUE_OPT_HEARTBEAT,
738 /* equivalenced to */ NO_EQUIVALENT,
739 /* min, max, act ct */ 0, 1, 0,
740 /* opt state flags */ HEARTBEAT_FLAGS, 0,
741 /* last opt argumnt */ { NULL }, /* --heartbeat */
742 /* arg list/cookie */ NULL,
743 /* must/cannot opts */ NULL, NULL,
744 /* option proc */ NULL,
745 /* desc, NAME, name */ HEARTBEAT_DESC, HEARTBEAT_NAME, HEARTBEAT_name,
746 /* disablement strs */ NULL, NULL },
748 { /* entry idx, value */ 9, VALUE_OPT_REHANDSHAKE,
749 /* equiv idx, value */ 9, VALUE_OPT_REHANDSHAKE,
750 /* equivalenced to */ NO_EQUIVALENT,
751 /* min, max, act ct */ 0, 1, 0,
752 /* opt state flags */ REHANDSHAKE_FLAGS, 0,
753 /* last opt argumnt */ { NULL }, /* --rehandshake */
754 /* arg list/cookie */ NULL,
755 /* must/cannot opts */ NULL, NULL,
756 /* option proc */ NULL,
757 /* desc, NAME, name */ REHANDSHAKE_DESC, REHANDSHAKE_NAME, REHANDSHAKE_name,
758 /* disablement strs */ NULL, NULL },
760 { /* entry idx, value */ 10, VALUE_OPT_NOTICKET,
761 /* equiv idx, value */ 10, VALUE_OPT_NOTICKET,
762 /* equivalenced to */ NO_EQUIVALENT,
763 /* min, max, act ct */ 0, 1, 0,
764 /* opt state flags */ NOTICKET_FLAGS, 0,
765 /* last opt argumnt */ { NULL }, /* --noticket */
766 /* arg list/cookie */ NULL,
767 /* must/cannot opts */ NULL, NULL,
768 /* option proc */ NULL,
769 /* desc, NAME, name */ NOTICKET_DESC, NOTICKET_NAME, NOTICKET_name,
770 /* disablement strs */ NULL, NULL },
772 { /* entry idx, value */ 11, VALUE_OPT_STARTTLS,
773 /* equiv idx, value */ 11, VALUE_OPT_STARTTLS,
774 /* equivalenced to */ NO_EQUIVALENT,
775 /* min, max, act ct */ 0, 1, 0,
776 /* opt state flags */ STARTTLS_FLAGS, 0,
777 /* last opt argumnt */ { NULL }, /* --starttls */
778 /* arg list/cookie */ NULL,
779 /* must/cannot opts */ NULL, NULL,
780 /* option proc */ NULL,
781 /* desc, NAME, name */ STARTTLS_DESC, STARTTLS_NAME, STARTTLS_name,
782 /* disablement strs */ NULL, NULL },
784 { /* entry idx, value */ 12, VALUE_OPT_UDP,
785 /* equiv idx, value */ 12, VALUE_OPT_UDP,
786 /* equivalenced to */ NO_EQUIVALENT,
787 /* min, max, act ct */ 0, 1, 0,
788 /* opt state flags */ UDP_FLAGS, 0,
789 /* last opt argumnt */ { NULL }, /* --udp */
790 /* arg list/cookie */ NULL,
791 /* must/cannot opts */ NULL, NULL,
792 /* option proc */ NULL,
793 /* desc, NAME, name */ UDP_DESC, UDP_NAME, UDP_name,
794 /* disablement strs */ NULL, NULL },
796 { /* entry idx, value */ 13, VALUE_OPT_MTU,
797 /* equiv idx, value */ 13, VALUE_OPT_MTU,
798 /* equivalenced to */ NO_EQUIVALENT,
799 /* min, max, act ct */ 0, 1, 0,
800 /* opt state flags */ MTU_FLAGS, 0,
801 /* last opt argumnt */ { NULL }, /* --mtu */
802 /* arg list/cookie */ NULL,
803 /* must/cannot opts */ NULL, NULL,
804 /* option proc */ doOptMtu,
805 /* desc, NAME, name */ MTU_DESC, MTU_NAME, MTU_name,
806 /* disablement strs */ NULL, NULL },
808 { /* entry idx, value */ 14, VALUE_OPT_SRTP_PROFILES,
809 /* equiv idx, value */ 14, VALUE_OPT_SRTP_PROFILES,
810 /* equivalenced to */ NO_EQUIVALENT,
811 /* min, max, act ct */ 0, 1, 0,
812 /* opt state flags */ SRTP_PROFILES_FLAGS, 0,
813 /* last opt argumnt */ { NULL }, /* --srtp_profiles */
814 /* arg list/cookie */ NULL,
815 /* must/cannot opts */ NULL, NULL,
816 /* option proc */ NULL,
817 /* desc, NAME, name */ SRTP_PROFILES_DESC, SRTP_PROFILES_NAME, SRTP_PROFILES_name,
818 /* disablement strs */ NULL, NULL },
820 { /* entry idx, value */ 15, VALUE_OPT_CRLF,
821 /* equiv idx, value */ 15, VALUE_OPT_CRLF,
822 /* equivalenced to */ NO_EQUIVALENT,
823 /* min, max, act ct */ 0, 1, 0,
824 /* opt state flags */ CRLF_FLAGS, 0,
825 /* last opt argumnt */ { NULL }, /* --crlf */
826 /* arg list/cookie */ NULL,
827 /* must/cannot opts */ NULL, NULL,
828 /* option proc */ NULL,
829 /* desc, NAME, name */ CRLF_DESC, CRLF_NAME, CRLF_name,
830 /* disablement strs */ NULL, NULL },
832 { /* entry idx, value */ 16, VALUE_OPT_X509FMTDER,
833 /* equiv idx, value */ 16, VALUE_OPT_X509FMTDER,
834 /* equivalenced to */ NO_EQUIVALENT,
835 /* min, max, act ct */ 0, 1, 0,
836 /* opt state flags */ X509FMTDER_FLAGS, 0,
837 /* last opt argumnt */ { NULL }, /* --x509fmtder */
838 /* arg list/cookie */ NULL,
839 /* must/cannot opts */ NULL, NULL,
840 /* option proc */ NULL,
841 /* desc, NAME, name */ X509FMTDER_DESC, X509FMTDER_NAME, X509FMTDER_name,
842 /* disablement strs */ NULL, NULL },
844 { /* entry idx, value */ 17, VALUE_OPT_FINGERPRINT,
845 /* equiv idx, value */ 17, VALUE_OPT_FINGERPRINT,
846 /* equivalenced to */ NO_EQUIVALENT,
847 /* min, max, act ct */ 0, 1, 0,
848 /* opt state flags */ FINGERPRINT_FLAGS, 0,
849 /* last opt argumnt */ { NULL }, /* --fingerprint */
850 /* arg list/cookie */ NULL,
851 /* must/cannot opts */ NULL, NULL,
852 /* option proc */ NULL,
853 /* desc, NAME, name */ FINGERPRINT_DESC, FINGERPRINT_NAME, FINGERPRINT_name,
854 /* disablement strs */ NULL, NULL },
856 { /* entry idx, value */ 18, VALUE_OPT_DISABLE_EXTENSIONS,
857 /* equiv idx, value */ 18, VALUE_OPT_DISABLE_EXTENSIONS,
858 /* equivalenced to */ NO_EQUIVALENT,
859 /* min, max, act ct */ 0, 1, 0,
860 /* opt state flags */ DISABLE_EXTENSIONS_FLAGS, 0,
861 /* last opt argumnt */ { NULL }, /* --disable-extensions */
862 /* arg list/cookie */ NULL,
863 /* must/cannot opts */ NULL, NULL,
864 /* option proc */ NULL,
865 /* desc, NAME, name */ DISABLE_EXTENSIONS_DESC, DISABLE_EXTENSIONS_NAME, DISABLE_EXTENSIONS_name,
866 /* disablement strs */ NULL, NULL },
868 { /* entry idx, value */ 19, VALUE_OPT_PRINT_CERT,
869 /* equiv idx, value */ 19, VALUE_OPT_PRINT_CERT,
870 /* equivalenced to */ NO_EQUIVALENT,
871 /* min, max, act ct */ 0, 1, 0,
872 /* opt state flags */ PRINT_CERT_FLAGS, 0,
873 /* last opt argumnt */ { NULL }, /* --print-cert */
874 /* arg list/cookie */ NULL,
875 /* must/cannot opts */ NULL, NULL,
876 /* option proc */ NULL,
877 /* desc, NAME, name */ PRINT_CERT_DESC, PRINT_CERT_NAME, PRINT_CERT_name,
878 /* disablement strs */ NULL, NULL },
880 { /* entry idx, value */ 20, VALUE_OPT_RECORDSIZE,
881 /* equiv idx, value */ 20, VALUE_OPT_RECORDSIZE,
882 /* equivalenced to */ NO_EQUIVALENT,
883 /* min, max, act ct */ 0, 1, 0,
884 /* opt state flags */ RECORDSIZE_FLAGS, 0,
885 /* last opt argumnt */ { NULL }, /* --recordsize */
886 /* arg list/cookie */ NULL,
887 /* must/cannot opts */ NULL, NULL,
888 /* option proc */ doOptRecordsize,
889 /* desc, NAME, name */ RECORDSIZE_DESC, RECORDSIZE_NAME, RECORDSIZE_name,
890 /* disablement strs */ NULL, NULL },
892 { /* entry idx, value */ 21, VALUE_OPT_DH_BITS,
893 /* equiv idx, value */ 21, VALUE_OPT_DH_BITS,
894 /* equivalenced to */ NO_EQUIVALENT,
895 /* min, max, act ct */ 0, 1, 0,
896 /* opt state flags */ DH_BITS_FLAGS, 0,
897 /* last opt argumnt */ { NULL }, /* --dh-bits */
898 /* arg list/cookie */ NULL,
899 /* must/cannot opts */ NULL, NULL,
900 /* option proc */ optionNumericVal,
901 /* desc, NAME, name */ DH_BITS_DESC, DH_BITS_NAME, DH_BITS_name,
902 /* disablement strs */ NULL, NULL },
904 { /* entry idx, value */ 22, VALUE_OPT_PRIORITY,
905 /* equiv idx, value */ 22, VALUE_OPT_PRIORITY,
906 /* equivalenced to */ NO_EQUIVALENT,
907 /* min, max, act ct */ 0, 1, 0,
908 /* opt state flags */ PRIORITY_FLAGS, 0,
909 /* last opt argumnt */ { NULL }, /* --priority */
910 /* arg list/cookie */ NULL,
911 /* must/cannot opts */ NULL, NULL,
912 /* option proc */ NULL,
913 /* desc, NAME, name */ PRIORITY_DESC, PRIORITY_NAME, PRIORITY_name,
914 /* disablement strs */ NULL, NULL },
916 { /* entry idx, value */ 23, VALUE_OPT_X509CAFILE,
917 /* equiv idx, value */ 23, VALUE_OPT_X509CAFILE,
918 /* equivalenced to */ NO_EQUIVALENT,
919 /* min, max, act ct */ 0, 1, 0,
920 /* opt state flags */ X509CAFILE_FLAGS, 0,
921 /* last opt argumnt */ { NULL }, /* --x509cafile */
922 /* arg list/cookie */ NULL,
923 /* must/cannot opts */ NULL, NULL,
924 /* option proc */ NULL,
925 /* desc, NAME, name */ X509CAFILE_DESC, X509CAFILE_NAME, X509CAFILE_name,
926 /* disablement strs */ NULL, NULL },
928 { /* entry idx, value */ 24, VALUE_OPT_X509CRLFILE,
929 /* equiv idx, value */ 24, VALUE_OPT_X509CRLFILE,
930 /* equivalenced to */ NO_EQUIVALENT,
931 /* min, max, act ct */ 0, 1, 0,
932 /* opt state flags */ X509CRLFILE_FLAGS, 0,
933 /* last opt argumnt */ { NULL }, /* --x509crlfile */
934 /* arg list/cookie */ NULL,
935 /* must/cannot opts */ NULL, NULL,
936 /* option proc */ doOptX509crlfile,
937 /* desc, NAME, name */ X509CRLFILE_DESC, X509CRLFILE_NAME, X509CRLFILE_name,
938 /* disablement strs */ NULL, NULL },
940 { /* entry idx, value */ 25, VALUE_OPT_PGPKEYFILE,
941 /* equiv idx, value */ 25, VALUE_OPT_PGPKEYFILE,
942 /* equivalenced to */ NO_EQUIVALENT,
943 /* min, max, act ct */ 0, 1, 0,
944 /* opt state flags */ PGPKEYFILE_FLAGS, 0,
945 /* last opt argumnt */ { NULL }, /* --pgpkeyfile */
946 /* arg list/cookie */ NULL,
947 /* must/cannot opts */ NULL, NULL,
948 /* option proc */ doOptPgpkeyfile,
949 /* desc, NAME, name */ PGPKEYFILE_DESC, PGPKEYFILE_NAME, PGPKEYFILE_name,
950 /* disablement strs */ NULL, NULL },
952 { /* entry idx, value */ 26, VALUE_OPT_PGPKEYRING,
953 /* equiv idx, value */ 26, VALUE_OPT_PGPKEYRING,
954 /* equivalenced to */ NO_EQUIVALENT,
955 /* min, max, act ct */ 0, 1, 0,
956 /* opt state flags */ PGPKEYRING_FLAGS, 0,
957 /* last opt argumnt */ { NULL }, /* --pgpkeyring */
958 /* arg list/cookie */ NULL,
959 /* must/cannot opts */ NULL, NULL,
960 /* option proc */ doOptPgpkeyring,
961 /* desc, NAME, name */ PGPKEYRING_DESC, PGPKEYRING_NAME, PGPKEYRING_name,
962 /* disablement strs */ NULL, NULL },
964 { /* entry idx, value */ 27, VALUE_OPT_PGPCERTFILE,
965 /* equiv idx, value */ 27, VALUE_OPT_PGPCERTFILE,
966 /* equivalenced to */ NO_EQUIVALENT,
967 /* min, max, act ct */ 0, 1, 0,
968 /* opt state flags */ PGPCERTFILE_FLAGS, 0,
969 /* last opt argumnt */ { NULL }, /* --pgpcertfile */
970 /* arg list/cookie */ NULL,
971 /* must/cannot opts */ NULL, NULL,
972 /* option proc */ doOptPgpcertfile,
973 /* desc, NAME, name */ PGPCERTFILE_DESC, PGPCERTFILE_NAME, PGPCERTFILE_name,
974 /* disablement strs */ NULL, NULL },
976 { /* entry idx, value */ 28, VALUE_OPT_X509KEYFILE,
977 /* equiv idx, value */ 28, VALUE_OPT_X509KEYFILE,
978 /* equivalenced to */ NO_EQUIVALENT,
979 /* min, max, act ct */ 0, 1, 0,
980 /* opt state flags */ X509KEYFILE_FLAGS, 0,
981 /* last opt argumnt */ { NULL }, /* --x509keyfile */
982 /* arg list/cookie */ NULL,
983 /* must/cannot opts */ NULL, NULL,
984 /* option proc */ NULL,
985 /* desc, NAME, name */ X509KEYFILE_DESC, X509KEYFILE_NAME, X509KEYFILE_name,
986 /* disablement strs */ NULL, NULL },
988 { /* entry idx, value */ 29, VALUE_OPT_X509CERTFILE,
989 /* equiv idx, value */ 29, VALUE_OPT_X509CERTFILE,
990 /* equivalenced to */ NO_EQUIVALENT,
991 /* min, max, act ct */ 0, 1, 0,
992 /* opt state flags */ X509CERTFILE_FLAGS, 0,
993 /* last opt argumnt */ { NULL }, /* --x509certfile */
994 /* arg list/cookie */ NULL,
995 /* must/cannot opts */ NULL, NULL,
996 /* option proc */ NULL,
997 /* desc, NAME, name */ X509CERTFILE_DESC, X509CERTFILE_NAME, X509CERTFILE_name,
998 /* disablement strs */ NULL, NULL },
1000 { /* entry idx, value */ 30, VALUE_OPT_PGPSUBKEY,
1001 /* equiv idx, value */ 30, VALUE_OPT_PGPSUBKEY,
1002 /* equivalenced to */ NO_EQUIVALENT,
1003 /* min, max, act ct */ 0, 1, 0,
1004 /* opt state flags */ PGPSUBKEY_FLAGS, 0,
1005 /* last opt argumnt */ { NULL }, /* --pgpsubkey */
1006 /* arg list/cookie */ NULL,
1007 /* must/cannot opts */ NULL, NULL,
1008 /* option proc */ NULL,
1009 /* desc, NAME, name */ PGPSUBKEY_DESC, PGPSUBKEY_NAME, PGPSUBKEY_name,
1010 /* disablement strs */ NULL, NULL },
1012 { /* entry idx, value */ 31, VALUE_OPT_SRPUSERNAME,
1013 /* equiv idx, value */ 31, VALUE_OPT_SRPUSERNAME,
1014 /* equivalenced to */ NO_EQUIVALENT,
1015 /* min, max, act ct */ 0, 1, 0,
1016 /* opt state flags */ SRPUSERNAME_FLAGS, 0,
1017 /* last opt argumnt */ { NULL }, /* --srpusername */
1018 /* arg list/cookie */ NULL,
1019 /* must/cannot opts */ NULL, NULL,
1020 /* option proc */ NULL,
1021 /* desc, NAME, name */ SRPUSERNAME_DESC, SRPUSERNAME_NAME, SRPUSERNAME_name,
1022 /* disablement strs */ NULL, NULL },
1024 { /* entry idx, value */ 32, VALUE_OPT_SRPPASSWD,
1025 /* equiv idx, value */ 32, VALUE_OPT_SRPPASSWD,
1026 /* equivalenced to */ NO_EQUIVALENT,
1027 /* min, max, act ct */ 0, 1, 0,
1028 /* opt state flags */ SRPPASSWD_FLAGS, 0,
1029 /* last opt argumnt */ { NULL }, /* --srppasswd */
1030 /* arg list/cookie */ NULL,
1031 /* must/cannot opts */ NULL, NULL,
1032 /* option proc */ NULL,
1033 /* desc, NAME, name */ SRPPASSWD_DESC, SRPPASSWD_NAME, SRPPASSWD_name,
1034 /* disablement strs */ NULL, NULL },
1036 { /* entry idx, value */ 33, VALUE_OPT_PSKUSERNAME,
1037 /* equiv idx, value */ 33, VALUE_OPT_PSKUSERNAME,
1038 /* equivalenced to */ NO_EQUIVALENT,
1039 /* min, max, act ct */ 0, 1, 0,
1040 /* opt state flags */ PSKUSERNAME_FLAGS, 0,
1041 /* last opt argumnt */ { NULL }, /* --pskusername */
1042 /* arg list/cookie */ NULL,
1043 /* must/cannot opts */ NULL, NULL,
1044 /* option proc */ NULL,
1045 /* desc, NAME, name */ PSKUSERNAME_DESC, PSKUSERNAME_NAME, PSKUSERNAME_name,
1046 /* disablement strs */ NULL, NULL },
1048 { /* entry idx, value */ 34, VALUE_OPT_PSKKEY,
1049 /* equiv idx, value */ 34, VALUE_OPT_PSKKEY,
1050 /* equivalenced to */ NO_EQUIVALENT,
1051 /* min, max, act ct */ 0, 1, 0,
1052 /* opt state flags */ PSKKEY_FLAGS, 0,
1053 /* last opt argumnt */ { NULL }, /* --pskkey */
1054 /* arg list/cookie */ NULL,
1055 /* must/cannot opts */ NULL, NULL,
1056 /* option proc */ NULL,
1057 /* desc, NAME, name */ PSKKEY_DESC, PSKKEY_NAME, PSKKEY_name,
1058 /* disablement strs */ NULL, NULL },
1060 { /* entry idx, value */ 35, VALUE_OPT_PORT,
1061 /* equiv idx, value */ 35, VALUE_OPT_PORT,
1062 /* equivalenced to */ NO_EQUIVALENT,
1063 /* min, max, act ct */ 0, 1, 0,
1064 /* opt state flags */ PORT_FLAGS, 0,
1065 /* last opt argumnt */ { NULL }, /* --port */
1066 /* arg list/cookie */ NULL,
1067 /* must/cannot opts */ NULL, NULL,
1068 /* option proc */ NULL,
1069 /* desc, NAME, name */ PORT_DESC, PORT_NAME, PORT_name,
1070 /* disablement strs */ NULL, NULL },
1072 { /* entry idx, value */ 36, VALUE_OPT_INSECURE,
1073 /* equiv idx, value */ 36, VALUE_OPT_INSECURE,
1074 /* equivalenced to */ NO_EQUIVALENT,
1075 /* min, max, act ct */ 0, 1, 0,
1076 /* opt state flags */ INSECURE_FLAGS, 0,
1077 /* last opt argumnt */ { NULL }, /* --insecure */
1078 /* arg list/cookie */ NULL,
1079 /* must/cannot opts */ NULL, NULL,
1080 /* option proc */ NULL,
1081 /* desc, NAME, name */ INSECURE_DESC, INSECURE_NAME, INSECURE_name,
1082 /* disablement strs */ NULL, NULL },
1084 { /* entry idx, value */ 37, VALUE_OPT_BENCHMARK_CIPHERS,
1085 /* equiv idx, value */ 37, VALUE_OPT_BENCHMARK_CIPHERS,
1086 /* equivalenced to */ NO_EQUIVALENT,
1087 /* min, max, act ct */ 0, 1, 0,
1088 /* opt state flags */ BENCHMARK_CIPHERS_FLAGS, 0,
1089 /* last opt argumnt */ { NULL }, /* --benchmark-ciphers */
1090 /* arg list/cookie */ NULL,
1091 /* must/cannot opts */ NULL, NULL,
1092 /* option proc */ NULL,
1093 /* desc, NAME, name */ BENCHMARK_CIPHERS_DESC, BENCHMARK_CIPHERS_NAME, BENCHMARK_CIPHERS_name,
1094 /* disablement strs */ NULL, NULL },
1096 { /* entry idx, value */ 38, VALUE_OPT_BENCHMARK_SOFT_CIPHERS,
1097 /* equiv idx, value */ 38, VALUE_OPT_BENCHMARK_SOFT_CIPHERS,
1098 /* equivalenced to */ NO_EQUIVALENT,
1099 /* min, max, act ct */ 0, 1, 0,
1100 /* opt state flags */ BENCHMARK_SOFT_CIPHERS_FLAGS, 0,
1101 /* last opt argumnt */ { NULL }, /* --benchmark-soft-ciphers */
1102 /* arg list/cookie */ NULL,
1103 /* must/cannot opts */ NULL, NULL,
1104 /* option proc */ NULL,
1105 /* desc, NAME, name */ BENCHMARK_SOFT_CIPHERS_DESC, BENCHMARK_SOFT_CIPHERS_NAME, BENCHMARK_SOFT_CIPHERS_name,
1106 /* disablement strs */ NULL, NULL },
1108 { /* entry idx, value */ 39, VALUE_OPT_BENCHMARK_TLS_KX,
1109 /* equiv idx, value */ 39, VALUE_OPT_BENCHMARK_TLS_KX,
1110 /* equivalenced to */ NO_EQUIVALENT,
1111 /* min, max, act ct */ 0, 1, 0,
1112 /* opt state flags */ BENCHMARK_TLS_KX_FLAGS, 0,
1113 /* last opt argumnt */ { NULL }, /* --benchmark-tls-kx */
1114 /* arg list/cookie */ NULL,
1115 /* must/cannot opts */ NULL, NULL,
1116 /* option proc */ NULL,
1117 /* desc, NAME, name */ BENCHMARK_TLS_KX_DESC, BENCHMARK_TLS_KX_NAME, BENCHMARK_TLS_KX_name,
1118 /* disablement strs */ NULL, NULL },
1120 { /* entry idx, value */ 40, VALUE_OPT_BENCHMARK_TLS_CIPHERS,
1121 /* equiv idx, value */ 40, VALUE_OPT_BENCHMARK_TLS_CIPHERS,
1122 /* equivalenced to */ NO_EQUIVALENT,
1123 /* min, max, act ct */ 0, 1, 0,
1124 /* opt state flags */ BENCHMARK_TLS_CIPHERS_FLAGS, 0,
1125 /* last opt argumnt */ { NULL }, /* --benchmark-tls-ciphers */
1126 /* arg list/cookie */ NULL,
1127 /* must/cannot opts */ NULL, NULL,
1128 /* option proc */ NULL,
1129 /* desc, NAME, name */ BENCHMARK_TLS_CIPHERS_DESC, BENCHMARK_TLS_CIPHERS_NAME, BENCHMARK_TLS_CIPHERS_name,
1130 /* disablement strs */ NULL, NULL },
1132 { /* entry idx, value */ 41, VALUE_OPT_LIST,
1133 /* equiv idx, value */ 41, VALUE_OPT_LIST,
1134 /* equivalenced to */ NO_EQUIVALENT,
1135 /* min, max, act ct */ 0, 1, 0,
1136 /* opt state flags */ LIST_FLAGS, 0,
1137 /* last opt argumnt */ { NULL }, /* --list */
1138 /* arg list/cookie */ NULL,
1139 /* must/cannot opts */ NULL, NULL,
1140 /* option proc */ NULL,
1141 /* desc, NAME, name */ LIST_DESC, LIST_NAME, LIST_name,
1142 /* disablement strs */ NULL, NULL },
1144 { /* entry idx, value */ INDEX_OPT_VERSION, VALUE_OPT_VERSION,
1145 /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_VERSION,
1146 /* equivalenced to */ NO_EQUIVALENT,
1147 /* min, max, act ct */ 0, 1, 0,
1148 /* opt state flags */ VER_FLAGS, 0,
1149 /* last opt argumnt */ { NULL },
1150 /* arg list/cookie */ NULL,
1151 /* must/cannot opts */ NULL, NULL,
1152 /* option proc */ VER_PROC,
1153 /* desc, NAME, name */ VER_DESC, NULL, VER_name,
1154 /* disablement strs */ NULL, NULL },
1158 { /* entry idx, value */ INDEX_OPT_HELP, VALUE_OPT_HELP,
1159 /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_HELP,
1160 /* equivalenced to */ NO_EQUIVALENT,
1161 /* min, max, act ct */ 0, 1, 0,
1162 /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, 0,
1163 /* last opt argumnt */ { NULL },
1164 /* arg list/cookie */ NULL,
1165 /* must/cannot opts */ NULL, NULL,
1166 /* option proc */ doUsageOpt,
1167 /* desc, NAME, name */ HELP_DESC, NULL, HELP_name,
1168 /* disablement strs */ NULL, NULL },
1170 { /* entry idx, value */ INDEX_OPT_MORE_HELP, VALUE_OPT_MORE_HELP,
1171 /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_MORE_HELP,
1172 /* equivalenced to */ NO_EQUIVALENT,
1173 /* min, max, act ct */ 0, 1, 0,
1174 /* opt state flags */ MORE_HELP_FLAGS, 0,
1175 /* last opt argumnt */ { NULL },
1176 /* arg list/cookie */ NULL,
1177 /* must/cannot opts */ NULL, NULL,
1178 /* option proc */ optionPagedUsage,
1179 /* desc, NAME, name */ MORE_HELP_DESC, NULL, MORE_HELP_name,
1180 /* disablement strs */ NULL, NULL }
1184 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1186 * Define the gnutls-cli Option Environment
1188 #define zPROGNAME (gnutls_cli_opt_strs+3355)
1189 #define zUsageTitle (gnutls_cli_opt_strs+3366)
1190 #define zRcName NULL
1191 #define apzHomeList NULL
1192 #define zBugsAddr (gnutls_cli_opt_strs+3479)
1193 #define zExplain (gnutls_cli_opt_strs+3498)
1194 #define zDetail (gnutls_cli_opt_strs+3501)
1195 #define zFullVersion (gnutls_cli_opt_strs+3685)
1196 /* extracted from optcode.tlib near line 350 */
1198 #if defined(ENABLE_NLS)
1199 # define OPTPROC_BASE OPTPROC_TRANSLATE | OPTPROC_NXLAT_OPT
1200 static tOptionXlateProc translate_option_strings;
1201 #else
1202 # define OPTPROC_BASE OPTPROC_NONE
1203 # define translate_option_strings NULL
1204 #endif /* ENABLE_NLS */
1207 #define gnutls_cli_full_usage (NULL)
1209 #define gnutls_cli_short_usage (gnutls_cli_opt_strs+3706)
1211 #endif /* not defined __doxygen__ */
1214 * Create the static procedure(s) declared above.
1217 * The callout function that invokes the optionUsage function.
1219 * @param pOptions the AutoOpts option description structure
1220 * @param pOptDesc the descriptor for the "help" (usage) option.
1221 * @noreturn
1223 static void
1224 doUsageOpt(tOptions * pOptions, tOptDesc * pOptDesc)
1226 optionUsage(&gnutls_cliOptions, GNUTLS_CLI_EXIT_SUCCESS);
1227 /* NOTREACHED */
1228 (void)pOptDesc;
1229 (void)pOptions;
1232 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1234 * Code to handle the debug option.
1236 * @param pOptions the gnutls-cli options data structure
1237 * @param pOptDesc the option descriptor for this option.
1239 static void
1240 doOptDebug(tOptions* pOptions, tOptDesc* pOptDesc)
1242 static struct {long rmin, rmax;} const rng[1] = {
1243 { 0 , 9999 } };
1244 int ix;
1246 if (pOptions <= OPTPROC_EMIT_LIMIT)
1247 goto emit_ranges;
1248 optionNumericVal(pOptions, pOptDesc);
1250 for (ix = 0; ix < 1; ix++) {
1251 if (pOptDesc->optArg.argInt < rng[ix].rmin)
1252 continue; /* ranges need not be ordered. */
1253 if (pOptDesc->optArg.argInt == rng[ix].rmin)
1254 return;
1255 if (rng[ix].rmax == LONG_MIN)
1256 continue;
1257 if (pOptDesc->optArg.argInt <= rng[ix].rmax)
1258 return;
1261 option_usage_fp = stderr;
1263 emit_ranges:
1265 optionShowRange(pOptions, pOptDesc, (void *)rng, 1);
1268 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1270 * Code to handle the mtu option.
1272 * @param pOptions the gnutls-cli options data structure
1273 * @param pOptDesc the option descriptor for this option.
1275 static void
1276 doOptMtu(tOptions* pOptions, tOptDesc* pOptDesc)
1278 static struct {long rmin, rmax;} const rng[1] = {
1279 { 0, 17000 } };
1280 int ix;
1282 if (pOptions <= OPTPROC_EMIT_LIMIT)
1283 goto emit_ranges;
1284 optionNumericVal(pOptions, pOptDesc);
1286 for (ix = 0; ix < 1; ix++) {
1287 if (pOptDesc->optArg.argInt < rng[ix].rmin)
1288 continue; /* ranges need not be ordered. */
1289 if (pOptDesc->optArg.argInt == rng[ix].rmin)
1290 return;
1291 if (rng[ix].rmax == LONG_MIN)
1292 continue;
1293 if (pOptDesc->optArg.argInt <= rng[ix].rmax)
1294 return;
1297 option_usage_fp = stderr;
1299 emit_ranges:
1301 optionShowRange(pOptions, pOptDesc, (void *)rng, 1);
1304 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1306 * Code to handle the recordsize option.
1308 * @param pOptions the gnutls-cli options data structure
1309 * @param pOptDesc the option descriptor for this option.
1311 static void
1312 doOptRecordsize(tOptions* pOptions, tOptDesc* pOptDesc)
1314 static struct {long rmin, rmax;} const rng[1] = {
1315 { 0, 4096 } };
1316 int ix;
1318 if (pOptions <= OPTPROC_EMIT_LIMIT)
1319 goto emit_ranges;
1320 optionNumericVal(pOptions, pOptDesc);
1322 for (ix = 0; ix < 1; ix++) {
1323 if (pOptDesc->optArg.argInt < rng[ix].rmin)
1324 continue; /* ranges need not be ordered. */
1325 if (pOptDesc->optArg.argInt == rng[ix].rmin)
1326 return;
1327 if (rng[ix].rmax == LONG_MIN)
1328 continue;
1329 if (pOptDesc->optArg.argInt <= rng[ix].rmax)
1330 return;
1333 option_usage_fp = stderr;
1335 emit_ranges:
1337 optionShowRange(pOptions, pOptDesc, (void *)rng, 1);
1340 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1342 * Code to handle the x509crlfile option.
1344 * @param pOptions the gnutls-cli options data structure
1345 * @param pOptDesc the option descriptor for this option.
1347 static void
1348 doOptX509crlfile(tOptions* pOptions, tOptDesc* pOptDesc)
1350 static teOptFileType const type =
1351 FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN;
1352 static tuFileMode mode;
1353 #ifndef O_CLOEXEC
1354 # define O_CLOEXEC 0
1355 #endif
1356 mode.file_flags = O_CLOEXEC;
1358 optionFileCheck(pOptions, pOptDesc, type, mode);
1361 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1363 * Code to handle the pgpkeyfile option.
1365 * @param pOptions the gnutls-cli options data structure
1366 * @param pOptDesc the option descriptor for this option.
1368 static void
1369 doOptPgpkeyfile(tOptions* pOptions, tOptDesc* pOptDesc)
1371 static teOptFileType const type =
1372 FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN;
1373 static tuFileMode mode;
1374 #ifndef O_CLOEXEC
1375 # define O_CLOEXEC 0
1376 #endif
1377 mode.file_flags = O_CLOEXEC;
1379 optionFileCheck(pOptions, pOptDesc, type, mode);
1382 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1384 * Code to handle the pgpkeyring option.
1386 * @param pOptions the gnutls-cli options data structure
1387 * @param pOptDesc the option descriptor for this option.
1389 static void
1390 doOptPgpkeyring(tOptions* pOptions, tOptDesc* pOptDesc)
1392 static teOptFileType const type =
1393 FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN;
1394 static tuFileMode mode;
1395 #ifndef O_CLOEXEC
1396 # define O_CLOEXEC 0
1397 #endif
1398 mode.file_flags = O_CLOEXEC;
1400 optionFileCheck(pOptions, pOptDesc, type, mode);
1403 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1405 * Code to handle the pgpcertfile option.
1407 * @param pOptions the gnutls-cli options data structure
1408 * @param pOptDesc the option descriptor for this option.
1410 static void
1411 doOptPgpcertfile(tOptions* pOptions, tOptDesc* pOptDesc)
1413 static teOptFileType const type =
1414 FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN;
1415 static tuFileMode mode;
1416 #ifndef O_CLOEXEC
1417 # define O_CLOEXEC 0
1418 #endif
1419 mode.file_flags = O_CLOEXEC;
1421 optionFileCheck(pOptions, pOptDesc, type, mode);
1423 /* extracted from optmain.tlib near line 1113 */
1426 * The directory containing the data associated with gnutls-cli.
1428 #ifndef PKGDATADIR
1429 # define PKGDATADIR ""
1430 #endif
1433 * Information about the person or institution that packaged gnutls-cli
1434 * for the current distribution.
1436 #ifndef WITH_PACKAGER
1437 # define gnutls_cli_packager_info NULL
1438 #else
1439 static char const gnutls_cli_packager_info[] =
1440 "Packaged by " WITH_PACKAGER
1442 # ifdef WITH_PACKAGER_VERSION
1443 " ("WITH_PACKAGER_VERSION")"
1444 # endif
1446 # ifdef WITH_PACKAGER_BUG_REPORTS
1447 "\nReport gnutls_cli bugs to " WITH_PACKAGER_BUG_REPORTS
1448 # endif
1449 "\n";
1450 #endif
1451 #ifndef __doxygen__
1453 #endif /* __doxygen__ */
1455 * The option definitions for gnutls-cli. The one structure that
1456 * binds them all.
1458 tOptions gnutls_cliOptions = {
1459 OPTIONS_STRUCT_VERSION,
1460 0, NULL, /* original argc + argv */
1461 ( OPTPROC_BASE
1462 + OPTPROC_ERRSTOP
1463 + OPTPROC_SHORTOPT
1464 + OPTPROC_LONGOPT
1465 + OPTPROC_NO_REQ_OPT
1466 + OPTPROC_NEGATIONS
1467 + OPTPROC_REORDER
1468 + OPTPROC_GNUUSAGE
1469 + OPTPROC_MISUSE ),
1470 0, NULL, /* current option index, current option */
1471 NULL, NULL, zPROGNAME,
1472 zRcName, zCopyright, zLicenseDescrip,
1473 zFullVersion, apzHomeList, zUsageTitle,
1474 zExplain, zDetail, optDesc,
1475 zBugsAddr, /* address to send bugs to */
1476 NULL, NULL, /* extensions/saved state */
1477 optionUsage, /* usage procedure */
1478 translate_option_strings, /* translation procedure */
1480 * Indexes to special options
1482 { INDEX_OPT_MORE_HELP, /* more-help option index */
1483 NO_EQUIVALENT, /* save option index */
1484 NO_EQUIVALENT, /* '-#' option index */
1485 NO_EQUIVALENT /* index of default opt */
1487 45 /* full option count */, 42 /* user option count */,
1488 gnutls_cli_full_usage, gnutls_cli_short_usage,
1489 NULL, NULL,
1490 PKGDATADIR, gnutls_cli_packager_info
1493 #if ENABLE_NLS
1494 #include <stdio.h>
1495 #include <stdlib.h>
1496 #include <string.h>
1497 #include <unistd.h>
1498 #include <autoopts/usage-txt.h>
1500 static char* AO_gettext(char const* pz);
1501 static void coerce_it(void** s);
1504 * AutoGen specific wrapper function for gettext.
1505 * It relies on the macro _() to convert from English to the target
1506 * language, then strdup-duplicates the result string.
1508 * @param[in] pz the input text used as a lookup key.
1509 * @returns the translated text (if there is one),
1510 * or the original text (if not).
1512 static char *
1513 AO_gettext(char const* pz)
1515 char* pzRes;
1516 if (pz == NULL)
1517 return NULL;
1518 pzRes = _(pz);
1519 if (pzRes == pz)
1520 return pzRes;
1521 pzRes = strdup(pzRes);
1522 if (pzRes == NULL) {
1523 fputs(_("No memory for duping translated strings\n"), stderr);
1524 exit(GNUTLS_CLI_EXIT_FAILURE);
1526 return pzRes;
1529 static void coerce_it(void** s) { *s = AO_gettext(*s);
1533 * Translate all the translatable strings in the gnutls_cliOptions
1534 * structure defined above. This is done only once.
1536 static void
1537 translate_option_strings(void)
1539 tOptions * const pOpt = &gnutls_cliOptions;
1542 * Guard against re-translation. It won't work. The strings will have
1543 * been changed by the first pass through this code. One shot only.
1545 if (option_usage_text.field_ct != 0) {
1547 * Do the translations. The first pointer follows the field count
1548 * field. The field count field is the size of a pointer.
1550 tOptDesc * pOD = pOpt->pOptDesc;
1551 char ** ppz = (char**)(void*)&(option_usage_text);
1552 int ix = option_usage_text.field_ct;
1554 do {
1555 ppz++;
1556 *ppz = AO_gettext(*ppz);
1557 } while (--ix > 0);
1559 coerce_it((void*)&(pOpt->pzCopyright));
1560 coerce_it((void*)&(pOpt->pzCopyNotice));
1561 coerce_it((void*)&(pOpt->pzFullVersion));
1562 coerce_it((void*)&(pOpt->pzUsageTitle));
1563 coerce_it((void*)&(pOpt->pzExplain));
1564 coerce_it((void*)&(pOpt->pzDetail));
1565 coerce_it((void*)&(pOpt->pzPackager));
1566 coerce_it((void*)&(pOpt->pzShortUsage));
1567 option_usage_text.field_ct = 0;
1569 for (ix = pOpt->optCt; ix > 0; ix--, pOD++)
1570 coerce_it((void*)&(pOD->pzText));
1573 if ((pOpt->fOptSet & OPTPROC_NXLAT_OPT_CFG) == 0) {
1574 tOptDesc * pOD = pOpt->pOptDesc;
1575 int ix;
1577 for (ix = pOpt->optCt; ix > 0; ix--, pOD++) {
1578 coerce_it((void*)&(pOD->pz_Name));
1579 coerce_it((void*)&(pOD->pz_DisableName));
1580 coerce_it((void*)&(pOD->pz_DisablePfx));
1582 /* prevent re-translation */
1583 gnutls_cliOptions.fOptSet |= OPTPROC_NXLAT_OPT_CFG | OPTPROC_NXLAT_OPT;
1587 #endif /* ENABLE_NLS */
1589 #ifdef __cplusplus
1591 #endif
1592 /* cli-args.c ends here */