Support SRTP profile negotiation in the client and server tools
[gnutls.git] / src / danetool-args.c
blob03036ba1ccad805d2c70ef1c2c30764e1fe88c6e
1 /* -*- buffer-read-only: t -*- vi: set ro:
2 *
3 * DO NOT EDIT THIS FILE (danetool-args.c)
4 *
5 * It has been AutoGen-ed October 28, 2012 at 11:58:30 PM by AutoGen 5.16
6 * From the definitions danetool-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 danetool 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 danetool 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 * danetool 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 * danetool 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 "danetool-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 (danetool_opt_strs+0)
60 #define zLicenseDescrip (danetool_opt_strs+279)
63 #ifndef NULL
64 # define NULL 0
65 #endif
68 * danetool option static const strings
70 static char const danetool_opt_strs[2152] =
71 /* 0 */ "danetool @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 /* 279 */ "danetool 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 "danetool is distributed in the hope that it will be useful, but WITHOUT ANY\n"
82 "WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n"
83 "FOR A PARTICULAR PURPOSE. See the GNU General Public License for more\n"
84 "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 /* 884 */ "Enable debugging.\0"
88 /* 902 */ "DEBUG\0"
89 /* 908 */ "debug\0"
90 /* 914 */ "More verbose output\0"
91 /* 934 */ "VERBOSE\0"
92 /* 942 */ "verbose\0"
93 /* 950 */ "Input file\0"
94 /* 961 */ "INFILE\0"
95 /* 968 */ "infile\0"
96 /* 975 */ "Output file\0"
97 /* 987 */ "OUTFILE\0"
98 /* 995 */ "outfile\0"
99 /* 1003 */ "Loads a public key file\0"
100 /* 1027 */ "LOAD_PUBKEY\0"
101 /* 1039 */ "load-pubkey\0"
102 /* 1051 */ "Loads a certificate file\0"
103 /* 1076 */ "LOAD_CERTIFICATE\0"
104 /* 1093 */ "load-certificate\0"
105 /* 1110 */ "Hash algorithm to use for signing.\0"
106 /* 1145 */ "HASH\0"
107 /* 1150 */ "hash\0"
108 /* 1155 */ "Use DER format for input certificates and private keys.\0"
109 /* 1211 */ "INDER\0"
110 /* 1217 */ "no-inder\0"
111 /* 1226 */ "no\0"
112 /* 1229 */ "This is an alias for 'inder'\0"
113 /* 1258 */ "inraw\0"
114 /* 1264 */ "Print the DANE RR data on a certificate or public key\0"
115 /* 1318 */ "TLSA_RR\0"
116 /* 1326 */ "tlsa-rr\0"
117 /* 1334 */ "Specify the hostname to be used in the DANE RR\0"
118 /* 1381 */ "HOST\0"
119 /* 1386 */ "host\0"
120 /* 1391 */ "The protocol set for DANE data (tcp, udp etc.)\0"
121 /* 1438 */ "PROTO\0"
122 /* 1444 */ "proto\0"
123 /* 1450 */ "Specify the port number for the DANE data.\0"
124 /* 1493 */ "PORT\0"
125 /* 1498 */ "port\0"
126 /* 1503 */ "Whether the provided certificate or public key is a Certificate\n"
127 "authority.\0"
128 /* 1578 */ "CA\0"
129 /* 1581 */ "ca\0"
130 /* 1584 */ "Use the hash of the X.509 certificate, rather than the public key.\0"
131 /* 1651 */ "X509\0"
132 /* 1656 */ "x509\0"
133 /* 1661 */ "The provided certificate or public key is a local entity.\0"
134 /* 1719 */ "LOCAL\0"
135 /* 1725 */ "local\0"
136 /* 1731 */ "Display extended usage information and exit\0"
137 /* 1775 */ "help\0"
138 /* 1780 */ "Extended usage information passed thru pager\0"
139 /* 1825 */ "more-help\0"
140 /* 1835 */ "Output version information and exit\0"
141 /* 1871 */ "version\0"
142 /* 1879 */ "DANETOOL\0"
143 /* 1888 */ "danetool - GnuTLS DANE tool - Ver. @VERSION@\n"
144 "USAGE: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n\0"
145 /* 1991 */ "bug-gnutls@gnu.org\0"
146 /* 2010 */ "\n\n\0"
147 /* 2013 */ "\n"
148 "Tool generate DNS resource records for the DANE protocol.\n\0"
149 /* 2073 */ "danetool @VERSION@\0"
150 /* 2092 */ "danetool [options]\n"
151 "danetool --help for usage instructions.\n";
154 * debug option description:
156 #define DEBUG_DESC (danetool_opt_strs+884)
157 #define DEBUG_NAME (danetool_opt_strs+902)
158 #define DEBUG_name (danetool_opt_strs+908)
159 #define DEBUG_FLAGS (OPTST_DISABLED \
160 | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
163 * verbose option description:
165 #define VERBOSE_DESC (danetool_opt_strs+914)
166 #define VERBOSE_NAME (danetool_opt_strs+934)
167 #define VERBOSE_name (danetool_opt_strs+942)
168 #define VERBOSE_FLAGS (OPTST_DISABLED)
171 * infile option description:
173 #define INFILE_DESC (danetool_opt_strs+950)
174 #define INFILE_NAME (danetool_opt_strs+961)
175 #define INFILE_name (danetool_opt_strs+968)
176 #define INFILE_FLAGS (OPTST_DISABLED \
177 | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
180 * outfile option description:
182 #define OUTFILE_DESC (danetool_opt_strs+975)
183 #define OUTFILE_NAME (danetool_opt_strs+987)
184 #define OUTFILE_name (danetool_opt_strs+995)
185 #define OUTFILE_FLAGS (OPTST_DISABLED \
186 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
189 * load-pubkey option description:
191 #define LOAD_PUBKEY_DESC (danetool_opt_strs+1003)
192 #define LOAD_PUBKEY_NAME (danetool_opt_strs+1027)
193 #define LOAD_PUBKEY_name (danetool_opt_strs+1039)
194 #define LOAD_PUBKEY_FLAGS (OPTST_DISABLED \
195 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
198 * load-certificate option description:
200 #define LOAD_CERTIFICATE_DESC (danetool_opt_strs+1051)
201 #define LOAD_CERTIFICATE_NAME (danetool_opt_strs+1076)
202 #define LOAD_CERTIFICATE_name (danetool_opt_strs+1093)
203 #define LOAD_CERTIFICATE_FLAGS (OPTST_DISABLED \
204 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
207 * hash option description:
209 #define HASH_DESC (danetool_opt_strs+1110)
210 #define HASH_NAME (danetool_opt_strs+1145)
211 #define HASH_name (danetool_opt_strs+1150)
212 #define HASH_FLAGS (OPTST_DISABLED \
213 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
216 * inder option description:
218 #define INDER_DESC (danetool_opt_strs+1155)
219 #define INDER_NAME (danetool_opt_strs+1211)
220 #define NOT_INDER_name (danetool_opt_strs+1217)
221 #define NOT_INDER_PFX (danetool_opt_strs+1226)
222 #define INDER_name (NOT_INDER_name + 3)
223 #define INDER_FLAGS (OPTST_DISABLED)
226 * inraw option description:
228 #define INRAW_DESC (danetool_opt_strs+1229)
229 #define INRAW_NAME NULL
230 #define INRAW_name (danetool_opt_strs+1258)
231 #define INRAW_FLAGS (INDER_FLAGS | OPTST_ALIAS)
234 * tlsa-rr option description with
235 * "Must also have options" and "Incompatible options":
237 #define TLSA_RR_DESC (danetool_opt_strs+1264)
238 #define TLSA_RR_NAME (danetool_opt_strs+1318)
239 #define TLSA_RR_name (danetool_opt_strs+1326)
240 static int const aTlsa_RrMustList[] = {
241 INDEX_OPT_HOST, NO_EQUIVALENT };
242 #define TLSA_RR_FLAGS (OPTST_DISABLED)
245 * host option description:
247 #define HOST_DESC (danetool_opt_strs+1334)
248 #define HOST_NAME (danetool_opt_strs+1381)
249 #define HOST_name (danetool_opt_strs+1386)
250 #define HOST_FLAGS (OPTST_DISABLED \
251 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
254 * proto option description:
256 #define PROTO_DESC (danetool_opt_strs+1391)
257 #define PROTO_NAME (danetool_opt_strs+1438)
258 #define PROTO_name (danetool_opt_strs+1444)
259 #define PROTO_FLAGS (OPTST_DISABLED \
260 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
263 * port option description:
265 #define PORT_DESC (danetool_opt_strs+1450)
266 #define PORT_NAME (danetool_opt_strs+1493)
267 #define PORT_name (danetool_opt_strs+1498)
268 #define PORT_FLAGS (OPTST_DISABLED \
269 | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
272 * ca option description:
274 #define CA_DESC (danetool_opt_strs+1503)
275 #define CA_NAME (danetool_opt_strs+1578)
276 #define CA_name (danetool_opt_strs+1581)
277 #define CA_FLAGS (OPTST_DISABLED)
280 * x509 option description:
282 #define X509_DESC (danetool_opt_strs+1584)
283 #define X509_NAME (danetool_opt_strs+1651)
284 #define X509_name (danetool_opt_strs+1656)
285 #define X509_FLAGS (OPTST_DISABLED)
288 * local option description:
290 #define LOCAL_DESC (danetool_opt_strs+1661)
291 #define LOCAL_NAME (danetool_opt_strs+1719)
292 #define LOCAL_name (danetool_opt_strs+1725)
293 #define LOCAL_FLAGS (OPTST_DISABLED)
296 * Help/More_Help/Version option descriptions:
298 #define HELP_DESC (danetool_opt_strs+1731)
299 #define HELP_name (danetool_opt_strs+1775)
300 #ifdef HAVE_WORKING_FORK
301 #define MORE_HELP_DESC (danetool_opt_strs+1780)
302 #define MORE_HELP_name (danetool_opt_strs+1825)
303 #define MORE_HELP_FLAGS (OPTST_IMM | OPTST_NO_INIT)
304 #else
305 #define MORE_HELP_DESC NULL
306 #define MORE_HELP_name NULL
307 #define MORE_HELP_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
308 #endif
309 #ifdef NO_OPTIONAL_OPT_ARGS
310 # define VER_FLAGS (OPTST_IMM | OPTST_NO_INIT)
311 #else
312 # define VER_FLAGS (OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \
313 OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT)
314 #endif
315 #define VER_DESC (danetool_opt_strs+1835)
316 #define VER_name (danetool_opt_strs+1871)
318 * Declare option callback procedures
320 extern tOptProc
321 optionBooleanVal, optionNestedVal, optionNumericVal,
322 optionPagedUsage, optionPrintVersion, optionResetOpt,
323 optionStackArg, optionTimeDate, optionTimeVal,
324 optionUnstackArg, optionVendorOption;
325 static tOptProc
326 doOptDebug, doOptInfile, doOptInraw, doUsageOpt;
327 #define VER_PROC optionPrintVersion
329 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
331 * Define the danetool Option Descriptions.
332 * This is an array of OPTION_CT entries, one for each
333 * option that the danetool program responds to.
335 static tOptDesc optDesc[OPTION_CT] = {
336 { /* entry idx, value */ 0, VALUE_OPT_DEBUG,
337 /* equiv idx, value */ 0, VALUE_OPT_DEBUG,
338 /* equivalenced to */ NO_EQUIVALENT,
339 /* min, max, act ct */ 0, 1, 0,
340 /* opt state flags */ DEBUG_FLAGS, 0,
341 /* last opt argumnt */ { NULL }, /* --debug */
342 /* arg list/cookie */ NULL,
343 /* must/cannot opts */ NULL, NULL,
344 /* option proc */ doOptDebug,
345 /* desc, NAME, name */ DEBUG_DESC, DEBUG_NAME, DEBUG_name,
346 /* disablement strs */ NULL, NULL },
348 { /* entry idx, value */ 1, VALUE_OPT_VERBOSE,
349 /* equiv idx, value */ 1, VALUE_OPT_VERBOSE,
350 /* equivalenced to */ NO_EQUIVALENT,
351 /* min, max, act ct */ 0, NOLIMIT, 0,
352 /* opt state flags */ VERBOSE_FLAGS, 0,
353 /* last opt argumnt */ { NULL }, /* --verbose */
354 /* arg list/cookie */ NULL,
355 /* must/cannot opts */ NULL, NULL,
356 /* option proc */ NULL,
357 /* desc, NAME, name */ VERBOSE_DESC, VERBOSE_NAME, VERBOSE_name,
358 /* disablement strs */ NULL, NULL },
360 { /* entry idx, value */ 2, VALUE_OPT_INFILE,
361 /* equiv idx, value */ 2, VALUE_OPT_INFILE,
362 /* equivalenced to */ NO_EQUIVALENT,
363 /* min, max, act ct */ 0, 1, 0,
364 /* opt state flags */ INFILE_FLAGS, 0,
365 /* last opt argumnt */ { NULL }, /* --infile */
366 /* arg list/cookie */ NULL,
367 /* must/cannot opts */ NULL, NULL,
368 /* option proc */ doOptInfile,
369 /* desc, NAME, name */ INFILE_DESC, INFILE_NAME, INFILE_name,
370 /* disablement strs */ NULL, NULL },
372 { /* entry idx, value */ 3, VALUE_OPT_OUTFILE,
373 /* equiv idx, value */ 3, VALUE_OPT_OUTFILE,
374 /* equivalenced to */ NO_EQUIVALENT,
375 /* min, max, act ct */ 0, 1, 0,
376 /* opt state flags */ OUTFILE_FLAGS, 0,
377 /* last opt argumnt */ { NULL }, /* --outfile */
378 /* arg list/cookie */ NULL,
379 /* must/cannot opts */ NULL, NULL,
380 /* option proc */ NULL,
381 /* desc, NAME, name */ OUTFILE_DESC, OUTFILE_NAME, OUTFILE_name,
382 /* disablement strs */ NULL, NULL },
384 { /* entry idx, value */ 4, VALUE_OPT_LOAD_PUBKEY,
385 /* equiv idx, value */ 4, VALUE_OPT_LOAD_PUBKEY,
386 /* equivalenced to */ NO_EQUIVALENT,
387 /* min, max, act ct */ 0, 1, 0,
388 /* opt state flags */ LOAD_PUBKEY_FLAGS, 0,
389 /* last opt argumnt */ { NULL }, /* --load-pubkey */
390 /* arg list/cookie */ NULL,
391 /* must/cannot opts */ NULL, NULL,
392 /* option proc */ NULL,
393 /* desc, NAME, name */ LOAD_PUBKEY_DESC, LOAD_PUBKEY_NAME, LOAD_PUBKEY_name,
394 /* disablement strs */ NULL, NULL },
396 { /* entry idx, value */ 5, VALUE_OPT_LOAD_CERTIFICATE,
397 /* equiv idx, value */ 5, VALUE_OPT_LOAD_CERTIFICATE,
398 /* equivalenced to */ NO_EQUIVALENT,
399 /* min, max, act ct */ 0, 1, 0,
400 /* opt state flags */ LOAD_CERTIFICATE_FLAGS, 0,
401 /* last opt argumnt */ { NULL }, /* --load-certificate */
402 /* arg list/cookie */ NULL,
403 /* must/cannot opts */ NULL, NULL,
404 /* option proc */ NULL,
405 /* desc, NAME, name */ LOAD_CERTIFICATE_DESC, LOAD_CERTIFICATE_NAME, LOAD_CERTIFICATE_name,
406 /* disablement strs */ NULL, NULL },
408 { /* entry idx, value */ 6, VALUE_OPT_HASH,
409 /* equiv idx, value */ 6, VALUE_OPT_HASH,
410 /* equivalenced to */ NO_EQUIVALENT,
411 /* min, max, act ct */ 0, 1, 0,
412 /* opt state flags */ HASH_FLAGS, 0,
413 /* last opt argumnt */ { NULL }, /* --hash */
414 /* arg list/cookie */ NULL,
415 /* must/cannot opts */ NULL, NULL,
416 /* option proc */ NULL,
417 /* desc, NAME, name */ HASH_DESC, HASH_NAME, HASH_name,
418 /* disablement strs */ NULL, NULL },
420 { /* entry idx, value */ 7, VALUE_OPT_INDER,
421 /* equiv idx, value */ 7, VALUE_OPT_INDER,
422 /* equivalenced to */ NO_EQUIVALENT,
423 /* min, max, act ct */ 0, 1, 0,
424 /* opt state flags */ INDER_FLAGS, 0,
425 /* last opt argumnt */ { NULL }, /* --inder */
426 /* arg list/cookie */ NULL,
427 /* must/cannot opts */ NULL, NULL,
428 /* option proc */ NULL,
429 /* desc, NAME, name */ INDER_DESC, INDER_NAME, INDER_name,
430 /* disablement strs */ NOT_INDER_name, NOT_INDER_PFX },
432 { /* entry idx, value */ 8, VALUE_OPT_INRAW,
433 /* equiv idx, value */ 8, VALUE_OPT_INRAW,
434 /* equivalenced to */ NO_EQUIVALENT,
435 /* min, max, act ct */ 0, 1, 0,
436 /* opt state flags */ INRAW_FLAGS, 0,
437 /* last opt argumnt */ { NULL }, /* --inraw */
438 /* arg list/cookie */ NULL,
439 /* must/cannot opts */ NULL, NULL,
440 /* option proc */ doOptInraw,
441 /* desc, NAME, name */ INRAW_DESC, INRAW_NAME, INRAW_name,
442 /* disablement strs */ 0, 0 },
444 { /* entry idx, value */ 9, VALUE_OPT_TLSA_RR,
445 /* equiv idx, value */ 9, VALUE_OPT_TLSA_RR,
446 /* equivalenced to */ NO_EQUIVALENT,
447 /* min, max, act ct */ 0, 1, 0,
448 /* opt state flags */ TLSA_RR_FLAGS, 0,
449 /* last opt argumnt */ { NULL }, /* --tlsa-rr */
450 /* arg list/cookie */ NULL,
451 /* must/cannot opts */ aTlsa_RrMustList, NULL,
452 /* option proc */ NULL,
453 /* desc, NAME, name */ TLSA_RR_DESC, TLSA_RR_NAME, TLSA_RR_name,
454 /* disablement strs */ NULL, NULL },
456 { /* entry idx, value */ 10, VALUE_OPT_HOST,
457 /* equiv idx, value */ 10, VALUE_OPT_HOST,
458 /* equivalenced to */ NO_EQUIVALENT,
459 /* min, max, act ct */ 0, 1, 0,
460 /* opt state flags */ HOST_FLAGS, 0,
461 /* last opt argumnt */ { NULL }, /* --host */
462 /* arg list/cookie */ NULL,
463 /* must/cannot opts */ NULL, NULL,
464 /* option proc */ NULL,
465 /* desc, NAME, name */ HOST_DESC, HOST_NAME, HOST_name,
466 /* disablement strs */ NULL, NULL },
468 { /* entry idx, value */ 11, VALUE_OPT_PROTO,
469 /* equiv idx, value */ 11, VALUE_OPT_PROTO,
470 /* equivalenced to */ NO_EQUIVALENT,
471 /* min, max, act ct */ 0, 1, 0,
472 /* opt state flags */ PROTO_FLAGS, 0,
473 /* last opt argumnt */ { NULL }, /* --proto */
474 /* arg list/cookie */ NULL,
475 /* must/cannot opts */ NULL, NULL,
476 /* option proc */ NULL,
477 /* desc, NAME, name */ PROTO_DESC, PROTO_NAME, PROTO_name,
478 /* disablement strs */ NULL, NULL },
480 { /* entry idx, value */ 12, VALUE_OPT_PORT,
481 /* equiv idx, value */ 12, VALUE_OPT_PORT,
482 /* equivalenced to */ NO_EQUIVALENT,
483 /* min, max, act ct */ 0, 1, 0,
484 /* opt state flags */ PORT_FLAGS, 0,
485 /* last opt argumnt */ { NULL }, /* --port */
486 /* arg list/cookie */ NULL,
487 /* must/cannot opts */ NULL, NULL,
488 /* option proc */ optionNumericVal,
489 /* desc, NAME, name */ PORT_DESC, PORT_NAME, PORT_name,
490 /* disablement strs */ NULL, NULL },
492 { /* entry idx, value */ 13, VALUE_OPT_CA,
493 /* equiv idx, value */ 13, VALUE_OPT_CA,
494 /* equivalenced to */ NO_EQUIVALENT,
495 /* min, max, act ct */ 0, 1, 0,
496 /* opt state flags */ CA_FLAGS, 0,
497 /* last opt argumnt */ { NULL }, /* --ca */
498 /* arg list/cookie */ NULL,
499 /* must/cannot opts */ NULL, NULL,
500 /* option proc */ NULL,
501 /* desc, NAME, name */ CA_DESC, CA_NAME, CA_name,
502 /* disablement strs */ NULL, NULL },
504 { /* entry idx, value */ 14, VALUE_OPT_X509,
505 /* equiv idx, value */ 14, VALUE_OPT_X509,
506 /* equivalenced to */ NO_EQUIVALENT,
507 /* min, max, act ct */ 0, 1, 0,
508 /* opt state flags */ X509_FLAGS, 0,
509 /* last opt argumnt */ { NULL }, /* --x509 */
510 /* arg list/cookie */ NULL,
511 /* must/cannot opts */ NULL, NULL,
512 /* option proc */ NULL,
513 /* desc, NAME, name */ X509_DESC, X509_NAME, X509_name,
514 /* disablement strs */ NULL, NULL },
516 { /* entry idx, value */ 15, VALUE_OPT_LOCAL,
517 /* equiv idx, value */ 15, VALUE_OPT_LOCAL,
518 /* equivalenced to */ NO_EQUIVALENT,
519 /* min, max, act ct */ 0, 1, 0,
520 /* opt state flags */ LOCAL_FLAGS, 0,
521 /* last opt argumnt */ { NULL }, /* --local */
522 /* arg list/cookie */ NULL,
523 /* must/cannot opts */ NULL, NULL,
524 /* option proc */ NULL,
525 /* desc, NAME, name */ LOCAL_DESC, LOCAL_NAME, LOCAL_name,
526 /* disablement strs */ NULL, NULL },
528 { /* entry idx, value */ INDEX_OPT_VERSION, VALUE_OPT_VERSION,
529 /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_VERSION,
530 /* equivalenced to */ NO_EQUIVALENT,
531 /* min, max, act ct */ 0, 1, 0,
532 /* opt state flags */ VER_FLAGS, 0,
533 /* last opt argumnt */ { NULL },
534 /* arg list/cookie */ NULL,
535 /* must/cannot opts */ NULL, NULL,
536 /* option proc */ VER_PROC,
537 /* desc, NAME, name */ VER_DESC, NULL, VER_name,
538 /* disablement strs */ NULL, NULL },
542 { /* entry idx, value */ INDEX_OPT_HELP, VALUE_OPT_HELP,
543 /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_HELP,
544 /* equivalenced to */ NO_EQUIVALENT,
545 /* min, max, act ct */ 0, 1, 0,
546 /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, 0,
547 /* last opt argumnt */ { NULL },
548 /* arg list/cookie */ NULL,
549 /* must/cannot opts */ NULL, NULL,
550 /* option proc */ doUsageOpt,
551 /* desc, NAME, name */ HELP_DESC, NULL, HELP_name,
552 /* disablement strs */ NULL, NULL },
554 { /* entry idx, value */ INDEX_OPT_MORE_HELP, VALUE_OPT_MORE_HELP,
555 /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_MORE_HELP,
556 /* equivalenced to */ NO_EQUIVALENT,
557 /* min, max, act ct */ 0, 1, 0,
558 /* opt state flags */ MORE_HELP_FLAGS, 0,
559 /* last opt argumnt */ { NULL },
560 /* arg list/cookie */ NULL,
561 /* must/cannot opts */ NULL, NULL,
562 /* option proc */ optionPagedUsage,
563 /* desc, NAME, name */ MORE_HELP_DESC, NULL, MORE_HELP_name,
564 /* disablement strs */ NULL, NULL }
568 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
570 * Define the danetool Option Environment
572 #define zPROGNAME (danetool_opt_strs+1879)
573 #define zUsageTitle (danetool_opt_strs+1888)
574 #define zRcName NULL
575 #define apzHomeList NULL
576 #define zBugsAddr (danetool_opt_strs+1991)
577 #define zExplain (danetool_opt_strs+2010)
578 #define zDetail (danetool_opt_strs+2013)
579 #define zFullVersion (danetool_opt_strs+2073)
580 /* extracted from optcode.tlib near line 350 */
582 #if defined(ENABLE_NLS)
583 # define OPTPROC_BASE OPTPROC_TRANSLATE | OPTPROC_NXLAT_OPT
584 static tOptionXlateProc translate_option_strings;
585 #else
586 # define OPTPROC_BASE OPTPROC_NONE
587 # define translate_option_strings NULL
588 #endif /* ENABLE_NLS */
591 #define danetool_full_usage (NULL)
593 #define danetool_short_usage (danetool_opt_strs+2092)
595 #endif /* not defined __doxygen__ */
598 * Create the static procedure(s) declared above.
601 * The callout function that invokes the optionUsage function.
603 * @param pOptions the AutoOpts option description structure
604 * @param pOptDesc the descriptor for the "help" (usage) option.
605 * @noreturn
607 static void
608 doUsageOpt(tOptions * pOptions, tOptDesc * pOptDesc)
610 optionUsage(&danetoolOptions, DANETOOL_EXIT_SUCCESS);
611 /* NOTREACHED */
612 (void)pOptDesc;
613 (void)pOptions;
616 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
618 * Code to handle the debug option.
620 * @param pOptions the danetool options data structure
621 * @param pOptDesc the option descriptor for this option.
623 static void
624 doOptDebug(tOptions* pOptions, tOptDesc* pOptDesc)
626 static struct {long rmin, rmax;} const rng[1] = {
627 { 0 , 9999 } };
628 int ix;
630 if (pOptions <= OPTPROC_EMIT_LIMIT)
631 goto emit_ranges;
632 optionNumericVal(pOptions, pOptDesc);
634 for (ix = 0; ix < 1; ix++) {
635 if (pOptDesc->optArg.argInt < rng[ix].rmin)
636 continue; /* ranges need not be ordered. */
637 if (pOptDesc->optArg.argInt == rng[ix].rmin)
638 return;
639 if (rng[ix].rmax == LONG_MIN)
640 continue;
641 if (pOptDesc->optArg.argInt <= rng[ix].rmax)
642 return;
645 option_usage_fp = stderr;
647 emit_ranges:
649 optionShowRange(pOptions, pOptDesc, (void *)rng, 1);
652 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
654 * Code to handle the infile option.
656 * @param pOptions the danetool options data structure
657 * @param pOptDesc the option descriptor for this option.
659 static void
660 doOptInfile(tOptions* pOptions, tOptDesc* pOptDesc)
662 static teOptFileType const type =
663 FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN;
664 static tuFileMode mode;
665 #ifndef O_CLOEXEC
666 # define O_CLOEXEC 0
667 #endif
668 mode.file_flags = O_CLOEXEC;
670 optionFileCheck(pOptions, pOptDesc, type, mode);
673 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
675 * Code to handle the inraw option.
677 * @param pOptions the danetool options data structure
678 * @param pOptDesc the option descriptor for this option.
680 static void
681 doOptInraw(tOptions* pOptions, tOptDesc* pOptDesc)
683 int res = optionAlias(pOptions, pOptDesc, INDEX_OPT_INDER);
684 if ((res != 0) && ((pOptions->fOptSet & OPTPROC_ERRSTOP) != 0))
685 USAGE(DANETOOL_EXIT_FAILURE);
688 /* extracted from optmain.tlib near line 1113 */
691 * The directory containing the data associated with danetool.
693 #ifndef PKGDATADIR
694 # define PKGDATADIR ""
695 #endif
698 * Information about the person or institution that packaged danetool
699 * for the current distribution.
701 #ifndef WITH_PACKAGER
702 # define danetool_packager_info NULL
703 #else
704 static char const danetool_packager_info[] =
705 "Packaged by " WITH_PACKAGER
707 # ifdef WITH_PACKAGER_VERSION
708 " ("WITH_PACKAGER_VERSION")"
709 # endif
711 # ifdef WITH_PACKAGER_BUG_REPORTS
712 "\nReport danetool bugs to " WITH_PACKAGER_BUG_REPORTS
713 # endif
714 "\n";
715 #endif
716 #ifndef __doxygen__
718 #endif /* __doxygen__ */
720 * The option definitions for danetool. The one structure that
721 * binds them all.
723 tOptions danetoolOptions = {
724 OPTIONS_STRUCT_VERSION,
725 0, NULL, /* original argc + argv */
726 ( OPTPROC_BASE
727 + OPTPROC_ERRSTOP
728 + OPTPROC_SHORTOPT
729 + OPTPROC_LONGOPT
730 + OPTPROC_NO_REQ_OPT
731 + OPTPROC_NEGATIONS
732 + OPTPROC_NO_ARGS
733 + OPTPROC_GNUUSAGE
734 + OPTPROC_MISUSE ),
735 0, NULL, /* current option index, current option */
736 NULL, NULL, zPROGNAME,
737 zRcName, zCopyright, zLicenseDescrip,
738 zFullVersion, apzHomeList, zUsageTitle,
739 zExplain, zDetail, optDesc,
740 zBugsAddr, /* address to send bugs to */
741 NULL, NULL, /* extensions/saved state */
742 optionUsage, /* usage procedure */
743 translate_option_strings, /* translation procedure */
745 * Indexes to special options
747 { INDEX_OPT_MORE_HELP, /* more-help option index */
748 NO_EQUIVALENT, /* save option index */
749 NO_EQUIVALENT, /* '-#' option index */
750 NO_EQUIVALENT /* index of default opt */
752 19 /* full option count */, 16 /* user option count */,
753 danetool_full_usage, danetool_short_usage,
754 NULL, NULL,
755 PKGDATADIR, danetool_packager_info
758 #if ENABLE_NLS
759 #include <stdio.h>
760 #include <stdlib.h>
761 #include <string.h>
762 #include <unistd.h>
763 #include <autoopts/usage-txt.h>
765 static char* AO_gettext(char const* pz);
766 static void coerce_it(void** s);
769 * AutoGen specific wrapper function for gettext.
770 * It relies on the macro _() to convert from English to the target
771 * language, then strdup-duplicates the result string.
773 * @param[in] pz the input text used as a lookup key.
774 * @returns the translated text (if there is one),
775 * or the original text (if not).
777 static char *
778 AO_gettext(char const* pz)
780 char* pzRes;
781 if (pz == NULL)
782 return NULL;
783 pzRes = _(pz);
784 if (pzRes == pz)
785 return pzRes;
786 pzRes = strdup(pzRes);
787 if (pzRes == NULL) {
788 fputs(_("No memory for duping translated strings\n"), stderr);
789 exit(DANETOOL_EXIT_FAILURE);
791 return pzRes;
794 static void coerce_it(void** s) { *s = AO_gettext(*s);
798 * Translate all the translatable strings in the danetoolOptions
799 * structure defined above. This is done only once.
801 static void
802 translate_option_strings(void)
804 tOptions * const pOpt = &danetoolOptions;
807 * Guard against re-translation. It won't work. The strings will have
808 * been changed by the first pass through this code. One shot only.
810 if (option_usage_text.field_ct != 0) {
812 * Do the translations. The first pointer follows the field count
813 * field. The field count field is the size of a pointer.
815 tOptDesc * pOD = pOpt->pOptDesc;
816 char ** ppz = (char**)(void*)&(option_usage_text);
817 int ix = option_usage_text.field_ct;
819 do {
820 ppz++;
821 *ppz = AO_gettext(*ppz);
822 } while (--ix > 0);
824 coerce_it((void*)&(pOpt->pzCopyright));
825 coerce_it((void*)&(pOpt->pzCopyNotice));
826 coerce_it((void*)&(pOpt->pzFullVersion));
827 coerce_it((void*)&(pOpt->pzUsageTitle));
828 coerce_it((void*)&(pOpt->pzExplain));
829 coerce_it((void*)&(pOpt->pzDetail));
830 coerce_it((void*)&(pOpt->pzPackager));
831 coerce_it((void*)&(pOpt->pzShortUsage));
832 option_usage_text.field_ct = 0;
834 for (ix = pOpt->optCt; ix > 0; ix--, pOD++)
835 coerce_it((void*)&(pOD->pzText));
838 if ((pOpt->fOptSet & OPTPROC_NXLAT_OPT_CFG) == 0) {
839 tOptDesc * pOD = pOpt->pOptDesc;
840 int ix;
842 for (ix = pOpt->optCt; ix > 0; ix--, pOD++) {
843 coerce_it((void*)&(pOD->pz_Name));
844 coerce_it((void*)&(pOD->pz_DisableName));
845 coerce_it((void*)&(pOD->pz_DisablePfx));
847 /* prevent re-translation */
848 danetoolOptions.fOptSet |= OPTPROC_NXLAT_OPT_CFG | OPTPROC_NXLAT_OPT;
852 #endif /* ENABLE_NLS */
854 #ifdef __cplusplus
856 #endif
857 /* danetool-args.c ends here */