corrected copyright notices
[gnutls.git] / src / danetool-args.c
blob2303e525204c33b3624d2f6259e57a2e97e1a9ef
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 November 21, 2012 at 10:22:22 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[2269] =
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 */ "Check a host's DANE TLSA entry.\0"
109 /* 1187 */ "CHECK\0"
110 /* 1193 */ "check\0"
111 /* 1199 */ "Use the local DNS server for DNSSEC resolving.\0"
112 /* 1246 */ "LOCAL_DNS\0"
113 /* 1256 */ "no-local-dns\0"
114 /* 1269 */ "no\0"
115 /* 1272 */ "Use DER format for input certificates and private keys.\0"
116 /* 1328 */ "INDER\0"
117 /* 1334 */ "no-inder\0"
118 /* 1343 */ "This is an alias for 'inder'\0"
119 /* 1372 */ "inraw\0"
120 /* 1378 */ "Print the DANE RR data on a certificate or public key\0"
121 /* 1432 */ "TLSA_RR\0"
122 /* 1440 */ "tlsa-rr\0"
123 /* 1448 */ "Specify the hostname to be used in the DANE RR\0"
124 /* 1495 */ "HOST\0"
125 /* 1500 */ "host\0"
126 /* 1505 */ "The protocol set for DANE data (tcp, udp etc.)\0"
127 /* 1552 */ "PROTO\0"
128 /* 1558 */ "proto\0"
129 /* 1564 */ "Specify the port number for the DANE data.\0"
130 /* 1607 */ "PORT\0"
131 /* 1612 */ "port\0"
132 /* 1617 */ "Whether the provided certificate or public key is a Certificate\n"
133 "Authority.\0"
134 /* 1692 */ "CA\0"
135 /* 1695 */ "ca\0"
136 /* 1698 */ "Use the hash of the X.509 certificate, rather than the public key.\0"
137 /* 1765 */ "X509\0"
138 /* 1770 */ "x509\0"
139 /* 1775 */ "The provided certificate or public key is a local entity.\0"
140 /* 1833 */ "LOCAL\0"
141 /* 1839 */ "local\0"
142 /* 1845 */ "Display extended usage information and exit\0"
143 /* 1889 */ "help\0"
144 /* 1894 */ "Extended usage information passed thru pager\0"
145 /* 1939 */ "more-help\0"
146 /* 1949 */ "Output version information and exit\0"
147 /* 1985 */ "version\0"
148 /* 1993 */ "DANETOOL\0"
149 /* 2002 */ "danetool - GnuTLS DANE tool - Ver. @VERSION@\n"
150 "USAGE: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n\0"
151 /* 2105 */ "bug-gnutls@gnu.org\0"
152 /* 2124 */ "\n\n\0"
153 /* 2127 */ "\n"
154 "Tool to generate DNS resource records for the DANE protocol.\n\0"
155 /* 2190 */ "danetool @VERSION@\0"
156 /* 2209 */ "danetool [options]\n"
157 "danetool --help for usage instructions.\n";
160 * debug option description:
162 #define DEBUG_DESC (danetool_opt_strs+884)
163 #define DEBUG_NAME (danetool_opt_strs+902)
164 #define DEBUG_name (danetool_opt_strs+908)
165 #define DEBUG_FLAGS (OPTST_DISABLED \
166 | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
169 * verbose option description:
171 #define VERBOSE_DESC (danetool_opt_strs+914)
172 #define VERBOSE_NAME (danetool_opt_strs+934)
173 #define VERBOSE_name (danetool_opt_strs+942)
174 #define VERBOSE_FLAGS (OPTST_DISABLED)
177 * infile option description:
179 #define INFILE_DESC (danetool_opt_strs+950)
180 #define INFILE_NAME (danetool_opt_strs+961)
181 #define INFILE_name (danetool_opt_strs+968)
182 #define INFILE_FLAGS (OPTST_DISABLED \
183 | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
186 * outfile option description:
188 #define OUTFILE_DESC (danetool_opt_strs+975)
189 #define OUTFILE_NAME (danetool_opt_strs+987)
190 #define OUTFILE_name (danetool_opt_strs+995)
191 #define OUTFILE_FLAGS (OPTST_DISABLED \
192 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
195 * load-pubkey option description:
197 #define LOAD_PUBKEY_DESC (danetool_opt_strs+1003)
198 #define LOAD_PUBKEY_NAME (danetool_opt_strs+1027)
199 #define LOAD_PUBKEY_name (danetool_opt_strs+1039)
200 #define LOAD_PUBKEY_FLAGS (OPTST_DISABLED \
201 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
204 * load-certificate option description:
206 #define LOAD_CERTIFICATE_DESC (danetool_opt_strs+1051)
207 #define LOAD_CERTIFICATE_NAME (danetool_opt_strs+1076)
208 #define LOAD_CERTIFICATE_name (danetool_opt_strs+1093)
209 #define LOAD_CERTIFICATE_FLAGS (OPTST_DISABLED \
210 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
213 * hash option description:
215 #define HASH_DESC (danetool_opt_strs+1110)
216 #define HASH_NAME (danetool_opt_strs+1145)
217 #define HASH_name (danetool_opt_strs+1150)
218 #define HASH_FLAGS (OPTST_DISABLED \
219 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
222 * check option description:
224 #define CHECK_DESC (danetool_opt_strs+1155)
225 #define CHECK_NAME (danetool_opt_strs+1187)
226 #define CHECK_name (danetool_opt_strs+1193)
227 #define CHECK_FLAGS (OPTST_DISABLED \
228 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
231 * local-dns option description:
233 #define LOCAL_DNS_DESC (danetool_opt_strs+1199)
234 #define LOCAL_DNS_NAME (danetool_opt_strs+1246)
235 #define NOT_LOCAL_DNS_name (danetool_opt_strs+1256)
236 #define NOT_LOCAL_DNS_PFX (danetool_opt_strs+1269)
237 #define LOCAL_DNS_name (NOT_LOCAL_DNS_name + 3)
238 #define LOCAL_DNS_FLAGS (OPTST_DISABLED)
241 * inder option description:
243 #define INDER_DESC (danetool_opt_strs+1272)
244 #define INDER_NAME (danetool_opt_strs+1328)
245 #define NOT_INDER_name (danetool_opt_strs+1334)
246 #define NOT_INDER_PFX (danetool_opt_strs+1269)
247 #define INDER_name (NOT_INDER_name + 3)
248 #define INDER_FLAGS (OPTST_DISABLED)
251 * inraw option description:
253 #define INRAW_DESC (danetool_opt_strs+1343)
254 #define INRAW_NAME NULL
255 #define INRAW_name (danetool_opt_strs+1372)
256 #define INRAW_FLAGS (INDER_FLAGS | OPTST_ALIAS)
259 * tlsa-rr option description with
260 * "Must also have options" and "Incompatible options":
262 #define TLSA_RR_DESC (danetool_opt_strs+1378)
263 #define TLSA_RR_NAME (danetool_opt_strs+1432)
264 #define TLSA_RR_name (danetool_opt_strs+1440)
265 static int const aTlsa_RrMustList[] = {
266 INDEX_OPT_HOST, NO_EQUIVALENT };
267 #define TLSA_RR_FLAGS (OPTST_DISABLED)
270 * host option description:
272 #define HOST_DESC (danetool_opt_strs+1448)
273 #define HOST_NAME (danetool_opt_strs+1495)
274 #define HOST_name (danetool_opt_strs+1500)
275 #define HOST_FLAGS (OPTST_DISABLED \
276 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
279 * proto option description:
281 #define PROTO_DESC (danetool_opt_strs+1505)
282 #define PROTO_NAME (danetool_opt_strs+1552)
283 #define PROTO_name (danetool_opt_strs+1558)
284 #define PROTO_FLAGS (OPTST_DISABLED \
285 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
288 * port option description:
290 #define PORT_DESC (danetool_opt_strs+1564)
291 #define PORT_NAME (danetool_opt_strs+1607)
292 #define PORT_name (danetool_opt_strs+1612)
293 #define PORT_FLAGS (OPTST_DISABLED \
294 | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
297 * ca option description:
299 #define CA_DESC (danetool_opt_strs+1617)
300 #define CA_NAME (danetool_opt_strs+1692)
301 #define CA_name (danetool_opt_strs+1695)
302 #define CA_FLAGS (OPTST_DISABLED)
305 * x509 option description:
307 #define X509_DESC (danetool_opt_strs+1698)
308 #define X509_NAME (danetool_opt_strs+1765)
309 #define X509_name (danetool_opt_strs+1770)
310 #define X509_FLAGS (OPTST_DISABLED)
313 * local option description:
315 #define LOCAL_DESC (danetool_opt_strs+1775)
316 #define LOCAL_NAME (danetool_opt_strs+1833)
317 #define LOCAL_name (danetool_opt_strs+1839)
318 #define LOCAL_FLAGS (OPTST_DISABLED)
321 * Help/More_Help/Version option descriptions:
323 #define HELP_DESC (danetool_opt_strs+1845)
324 #define HELP_name (danetool_opt_strs+1889)
325 #ifdef HAVE_WORKING_FORK
326 #define MORE_HELP_DESC (danetool_opt_strs+1894)
327 #define MORE_HELP_name (danetool_opt_strs+1939)
328 #define MORE_HELP_FLAGS (OPTST_IMM | OPTST_NO_INIT)
329 #else
330 #define MORE_HELP_DESC NULL
331 #define MORE_HELP_name NULL
332 #define MORE_HELP_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
333 #endif
334 #ifdef NO_OPTIONAL_OPT_ARGS
335 # define VER_FLAGS (OPTST_IMM | OPTST_NO_INIT)
336 #else
337 # define VER_FLAGS (OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \
338 OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT)
339 #endif
340 #define VER_DESC (danetool_opt_strs+1949)
341 #define VER_name (danetool_opt_strs+1985)
343 * Declare option callback procedures
345 extern tOptProc
346 optionBooleanVal, optionNestedVal, optionNumericVal,
347 optionPagedUsage, optionPrintVersion, optionResetOpt,
348 optionStackArg, optionTimeDate, optionTimeVal,
349 optionUnstackArg, optionVendorOption;
350 static tOptProc
351 doOptDebug, doOptInfile, doOptInraw, doUsageOpt;
352 #define VER_PROC optionPrintVersion
354 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
356 * Define the danetool Option Descriptions.
357 * This is an array of OPTION_CT entries, one for each
358 * option that the danetool program responds to.
360 static tOptDesc optDesc[OPTION_CT] = {
361 { /* entry idx, value */ 0, VALUE_OPT_DEBUG,
362 /* equiv idx, value */ 0, VALUE_OPT_DEBUG,
363 /* equivalenced to */ NO_EQUIVALENT,
364 /* min, max, act ct */ 0, 1, 0,
365 /* opt state flags */ DEBUG_FLAGS, 0,
366 /* last opt argumnt */ { NULL }, /* --debug */
367 /* arg list/cookie */ NULL,
368 /* must/cannot opts */ NULL, NULL,
369 /* option proc */ doOptDebug,
370 /* desc, NAME, name */ DEBUG_DESC, DEBUG_NAME, DEBUG_name,
371 /* disablement strs */ NULL, NULL },
373 { /* entry idx, value */ 1, VALUE_OPT_VERBOSE,
374 /* equiv idx, value */ 1, VALUE_OPT_VERBOSE,
375 /* equivalenced to */ NO_EQUIVALENT,
376 /* min, max, act ct */ 0, NOLIMIT, 0,
377 /* opt state flags */ VERBOSE_FLAGS, 0,
378 /* last opt argumnt */ { NULL }, /* --verbose */
379 /* arg list/cookie */ NULL,
380 /* must/cannot opts */ NULL, NULL,
381 /* option proc */ NULL,
382 /* desc, NAME, name */ VERBOSE_DESC, VERBOSE_NAME, VERBOSE_name,
383 /* disablement strs */ NULL, NULL },
385 { /* entry idx, value */ 2, VALUE_OPT_INFILE,
386 /* equiv idx, value */ 2, VALUE_OPT_INFILE,
387 /* equivalenced to */ NO_EQUIVALENT,
388 /* min, max, act ct */ 0, 1, 0,
389 /* opt state flags */ INFILE_FLAGS, 0,
390 /* last opt argumnt */ { NULL }, /* --infile */
391 /* arg list/cookie */ NULL,
392 /* must/cannot opts */ NULL, NULL,
393 /* option proc */ doOptInfile,
394 /* desc, NAME, name */ INFILE_DESC, INFILE_NAME, INFILE_name,
395 /* disablement strs */ NULL, NULL },
397 { /* entry idx, value */ 3, VALUE_OPT_OUTFILE,
398 /* equiv idx, value */ 3, VALUE_OPT_OUTFILE,
399 /* equivalenced to */ NO_EQUIVALENT,
400 /* min, max, act ct */ 0, 1, 0,
401 /* opt state flags */ OUTFILE_FLAGS, 0,
402 /* last opt argumnt */ { NULL }, /* --outfile */
403 /* arg list/cookie */ NULL,
404 /* must/cannot opts */ NULL, NULL,
405 /* option proc */ NULL,
406 /* desc, NAME, name */ OUTFILE_DESC, OUTFILE_NAME, OUTFILE_name,
407 /* disablement strs */ NULL, NULL },
409 { /* entry idx, value */ 4, VALUE_OPT_LOAD_PUBKEY,
410 /* equiv idx, value */ 4, VALUE_OPT_LOAD_PUBKEY,
411 /* equivalenced to */ NO_EQUIVALENT,
412 /* min, max, act ct */ 0, 1, 0,
413 /* opt state flags */ LOAD_PUBKEY_FLAGS, 0,
414 /* last opt argumnt */ { NULL }, /* --load-pubkey */
415 /* arg list/cookie */ NULL,
416 /* must/cannot opts */ NULL, NULL,
417 /* option proc */ NULL,
418 /* desc, NAME, name */ LOAD_PUBKEY_DESC, LOAD_PUBKEY_NAME, LOAD_PUBKEY_name,
419 /* disablement strs */ NULL, NULL },
421 { /* entry idx, value */ 5, VALUE_OPT_LOAD_CERTIFICATE,
422 /* equiv idx, value */ 5, VALUE_OPT_LOAD_CERTIFICATE,
423 /* equivalenced to */ NO_EQUIVALENT,
424 /* min, max, act ct */ 0, 1, 0,
425 /* opt state flags */ LOAD_CERTIFICATE_FLAGS, 0,
426 /* last opt argumnt */ { NULL }, /* --load-certificate */
427 /* arg list/cookie */ NULL,
428 /* must/cannot opts */ NULL, NULL,
429 /* option proc */ NULL,
430 /* desc, NAME, name */ LOAD_CERTIFICATE_DESC, LOAD_CERTIFICATE_NAME, LOAD_CERTIFICATE_name,
431 /* disablement strs */ NULL, NULL },
433 { /* entry idx, value */ 6, VALUE_OPT_HASH,
434 /* equiv idx, value */ 6, VALUE_OPT_HASH,
435 /* equivalenced to */ NO_EQUIVALENT,
436 /* min, max, act ct */ 0, 1, 0,
437 /* opt state flags */ HASH_FLAGS, 0,
438 /* last opt argumnt */ { NULL }, /* --hash */
439 /* arg list/cookie */ NULL,
440 /* must/cannot opts */ NULL, NULL,
441 /* option proc */ NULL,
442 /* desc, NAME, name */ HASH_DESC, HASH_NAME, HASH_name,
443 /* disablement strs */ NULL, NULL },
445 { /* entry idx, value */ 7, VALUE_OPT_CHECK,
446 /* equiv idx, value */ 7, VALUE_OPT_CHECK,
447 /* equivalenced to */ NO_EQUIVALENT,
448 /* min, max, act ct */ 0, 1, 0,
449 /* opt state flags */ CHECK_FLAGS, 0,
450 /* last opt argumnt */ { NULL }, /* --check */
451 /* arg list/cookie */ NULL,
452 /* must/cannot opts */ NULL, NULL,
453 /* option proc */ NULL,
454 /* desc, NAME, name */ CHECK_DESC, CHECK_NAME, CHECK_name,
455 /* disablement strs */ NULL, NULL },
457 { /* entry idx, value */ 8, VALUE_OPT_LOCAL_DNS,
458 /* equiv idx, value */ 8, VALUE_OPT_LOCAL_DNS,
459 /* equivalenced to */ NO_EQUIVALENT,
460 /* min, max, act ct */ 0, 1, 0,
461 /* opt state flags */ LOCAL_DNS_FLAGS, 0,
462 /* last opt argumnt */ { NULL }, /* --local-dns */
463 /* arg list/cookie */ NULL,
464 /* must/cannot opts */ NULL, NULL,
465 /* option proc */ NULL,
466 /* desc, NAME, name */ LOCAL_DNS_DESC, LOCAL_DNS_NAME, LOCAL_DNS_name,
467 /* disablement strs */ NOT_LOCAL_DNS_name, NOT_LOCAL_DNS_PFX },
469 { /* entry idx, value */ 9, VALUE_OPT_INDER,
470 /* equiv idx, value */ 9, VALUE_OPT_INDER,
471 /* equivalenced to */ NO_EQUIVALENT,
472 /* min, max, act ct */ 0, 1, 0,
473 /* opt state flags */ INDER_FLAGS, 0,
474 /* last opt argumnt */ { NULL }, /* --inder */
475 /* arg list/cookie */ NULL,
476 /* must/cannot opts */ NULL, NULL,
477 /* option proc */ NULL,
478 /* desc, NAME, name */ INDER_DESC, INDER_NAME, INDER_name,
479 /* disablement strs */ NOT_INDER_name, NOT_INDER_PFX },
481 { /* entry idx, value */ 10, VALUE_OPT_INRAW,
482 /* equiv idx, value */ 10, VALUE_OPT_INRAW,
483 /* equivalenced to */ NO_EQUIVALENT,
484 /* min, max, act ct */ 0, 1, 0,
485 /* opt state flags */ INRAW_FLAGS, 0,
486 /* last opt argumnt */ { NULL }, /* --inraw */
487 /* arg list/cookie */ NULL,
488 /* must/cannot opts */ NULL, NULL,
489 /* option proc */ doOptInraw,
490 /* desc, NAME, name */ INRAW_DESC, INRAW_NAME, INRAW_name,
491 /* disablement strs */ 0, 0 },
493 { /* entry idx, value */ 11, VALUE_OPT_TLSA_RR,
494 /* equiv idx, value */ 11, VALUE_OPT_TLSA_RR,
495 /* equivalenced to */ NO_EQUIVALENT,
496 /* min, max, act ct */ 0, 1, 0,
497 /* opt state flags */ TLSA_RR_FLAGS, 0,
498 /* last opt argumnt */ { NULL }, /* --tlsa-rr */
499 /* arg list/cookie */ NULL,
500 /* must/cannot opts */ aTlsa_RrMustList, NULL,
501 /* option proc */ NULL,
502 /* desc, NAME, name */ TLSA_RR_DESC, TLSA_RR_NAME, TLSA_RR_name,
503 /* disablement strs */ NULL, NULL },
505 { /* entry idx, value */ 12, VALUE_OPT_HOST,
506 /* equiv idx, value */ 12, VALUE_OPT_HOST,
507 /* equivalenced to */ NO_EQUIVALENT,
508 /* min, max, act ct */ 0, 1, 0,
509 /* opt state flags */ HOST_FLAGS, 0,
510 /* last opt argumnt */ { NULL }, /* --host */
511 /* arg list/cookie */ NULL,
512 /* must/cannot opts */ NULL, NULL,
513 /* option proc */ NULL,
514 /* desc, NAME, name */ HOST_DESC, HOST_NAME, HOST_name,
515 /* disablement strs */ NULL, NULL },
517 { /* entry idx, value */ 13, VALUE_OPT_PROTO,
518 /* equiv idx, value */ 13, VALUE_OPT_PROTO,
519 /* equivalenced to */ NO_EQUIVALENT,
520 /* min, max, act ct */ 0, 1, 0,
521 /* opt state flags */ PROTO_FLAGS, 0,
522 /* last opt argumnt */ { NULL }, /* --proto */
523 /* arg list/cookie */ NULL,
524 /* must/cannot opts */ NULL, NULL,
525 /* option proc */ NULL,
526 /* desc, NAME, name */ PROTO_DESC, PROTO_NAME, PROTO_name,
527 /* disablement strs */ NULL, NULL },
529 { /* entry idx, value */ 14, VALUE_OPT_PORT,
530 /* equiv idx, value */ 14, VALUE_OPT_PORT,
531 /* equivalenced to */ NO_EQUIVALENT,
532 /* min, max, act ct */ 0, 1, 0,
533 /* opt state flags */ PORT_FLAGS, 0,
534 /* last opt argumnt */ { NULL }, /* --port */
535 /* arg list/cookie */ NULL,
536 /* must/cannot opts */ NULL, NULL,
537 /* option proc */ optionNumericVal,
538 /* desc, NAME, name */ PORT_DESC, PORT_NAME, PORT_name,
539 /* disablement strs */ NULL, NULL },
541 { /* entry idx, value */ 15, VALUE_OPT_CA,
542 /* equiv idx, value */ 15, VALUE_OPT_CA,
543 /* equivalenced to */ NO_EQUIVALENT,
544 /* min, max, act ct */ 0, 1, 0,
545 /* opt state flags */ CA_FLAGS, 0,
546 /* last opt argumnt */ { NULL }, /* --ca */
547 /* arg list/cookie */ NULL,
548 /* must/cannot opts */ NULL, NULL,
549 /* option proc */ NULL,
550 /* desc, NAME, name */ CA_DESC, CA_NAME, CA_name,
551 /* disablement strs */ NULL, NULL },
553 { /* entry idx, value */ 16, VALUE_OPT_X509,
554 /* equiv idx, value */ 16, VALUE_OPT_X509,
555 /* equivalenced to */ NO_EQUIVALENT,
556 /* min, max, act ct */ 0, 1, 0,
557 /* opt state flags */ X509_FLAGS, 0,
558 /* last opt argumnt */ { NULL }, /* --x509 */
559 /* arg list/cookie */ NULL,
560 /* must/cannot opts */ NULL, NULL,
561 /* option proc */ NULL,
562 /* desc, NAME, name */ X509_DESC, X509_NAME, X509_name,
563 /* disablement strs */ NULL, NULL },
565 { /* entry idx, value */ 17, VALUE_OPT_LOCAL,
566 /* equiv idx, value */ 17, VALUE_OPT_LOCAL,
567 /* equivalenced to */ NO_EQUIVALENT,
568 /* min, max, act ct */ 0, 1, 0,
569 /* opt state flags */ LOCAL_FLAGS, 0,
570 /* last opt argumnt */ { NULL }, /* --local */
571 /* arg list/cookie */ NULL,
572 /* must/cannot opts */ NULL, NULL,
573 /* option proc */ NULL,
574 /* desc, NAME, name */ LOCAL_DESC, LOCAL_NAME, LOCAL_name,
575 /* disablement strs */ NULL, NULL },
577 { /* entry idx, value */ INDEX_OPT_VERSION, VALUE_OPT_VERSION,
578 /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_VERSION,
579 /* equivalenced to */ NO_EQUIVALENT,
580 /* min, max, act ct */ 0, 1, 0,
581 /* opt state flags */ VER_FLAGS, 0,
582 /* last opt argumnt */ { NULL },
583 /* arg list/cookie */ NULL,
584 /* must/cannot opts */ NULL, NULL,
585 /* option proc */ VER_PROC,
586 /* desc, NAME, name */ VER_DESC, NULL, VER_name,
587 /* disablement strs */ NULL, NULL },
591 { /* entry idx, value */ INDEX_OPT_HELP, VALUE_OPT_HELP,
592 /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_HELP,
593 /* equivalenced to */ NO_EQUIVALENT,
594 /* min, max, act ct */ 0, 1, 0,
595 /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, 0,
596 /* last opt argumnt */ { NULL },
597 /* arg list/cookie */ NULL,
598 /* must/cannot opts */ NULL, NULL,
599 /* option proc */ doUsageOpt,
600 /* desc, NAME, name */ HELP_DESC, NULL, HELP_name,
601 /* disablement strs */ NULL, NULL },
603 { /* entry idx, value */ INDEX_OPT_MORE_HELP, VALUE_OPT_MORE_HELP,
604 /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_MORE_HELP,
605 /* equivalenced to */ NO_EQUIVALENT,
606 /* min, max, act ct */ 0, 1, 0,
607 /* opt state flags */ MORE_HELP_FLAGS, 0,
608 /* last opt argumnt */ { NULL },
609 /* arg list/cookie */ NULL,
610 /* must/cannot opts */ NULL, NULL,
611 /* option proc */ optionPagedUsage,
612 /* desc, NAME, name */ MORE_HELP_DESC, NULL, MORE_HELP_name,
613 /* disablement strs */ NULL, NULL }
617 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
619 * Define the danetool Option Environment
621 #define zPROGNAME (danetool_opt_strs+1993)
622 #define zUsageTitle (danetool_opt_strs+2002)
623 #define zRcName NULL
624 #define apzHomeList NULL
625 #define zBugsAddr (danetool_opt_strs+2105)
626 #define zExplain (danetool_opt_strs+2124)
627 #define zDetail (danetool_opt_strs+2127)
628 #define zFullVersion (danetool_opt_strs+2190)
629 /* extracted from optcode.tlib near line 350 */
631 #if defined(ENABLE_NLS)
632 # define OPTPROC_BASE OPTPROC_TRANSLATE | OPTPROC_NXLAT_OPT
633 static tOptionXlateProc translate_option_strings;
634 #else
635 # define OPTPROC_BASE OPTPROC_NONE
636 # define translate_option_strings NULL
637 #endif /* ENABLE_NLS */
640 #define danetool_full_usage (NULL)
642 #define danetool_short_usage (danetool_opt_strs+2209)
644 #endif /* not defined __doxygen__ */
647 * Create the static procedure(s) declared above.
650 * The callout function that invokes the optionUsage function.
652 * @param pOptions the AutoOpts option description structure
653 * @param pOptDesc the descriptor for the "help" (usage) option.
654 * @noreturn
656 static void
657 doUsageOpt(tOptions * pOptions, tOptDesc * pOptDesc)
659 optionUsage(&danetoolOptions, DANETOOL_EXIT_SUCCESS);
660 /* NOTREACHED */
661 (void)pOptDesc;
662 (void)pOptions;
665 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
667 * Code to handle the debug option.
669 * @param pOptions the danetool options data structure
670 * @param pOptDesc the option descriptor for this option.
672 static void
673 doOptDebug(tOptions* pOptions, tOptDesc* pOptDesc)
675 static struct {long rmin, rmax;} const rng[1] = {
676 { 0 , 9999 } };
677 int ix;
679 if (pOptions <= OPTPROC_EMIT_LIMIT)
680 goto emit_ranges;
681 optionNumericVal(pOptions, pOptDesc);
683 for (ix = 0; ix < 1; ix++) {
684 if (pOptDesc->optArg.argInt < rng[ix].rmin)
685 continue; /* ranges need not be ordered. */
686 if (pOptDesc->optArg.argInt == rng[ix].rmin)
687 return;
688 if (rng[ix].rmax == LONG_MIN)
689 continue;
690 if (pOptDesc->optArg.argInt <= rng[ix].rmax)
691 return;
694 option_usage_fp = stderr;
696 emit_ranges:
698 optionShowRange(pOptions, pOptDesc, (void *)rng, 1);
701 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
703 * Code to handle the infile option.
705 * @param pOptions the danetool options data structure
706 * @param pOptDesc the option descriptor for this option.
708 static void
709 doOptInfile(tOptions* pOptions, tOptDesc* pOptDesc)
711 static teOptFileType const type =
712 FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN;
713 static tuFileMode mode;
714 #ifndef O_CLOEXEC
715 # define O_CLOEXEC 0
716 #endif
717 mode.file_flags = O_CLOEXEC;
719 optionFileCheck(pOptions, pOptDesc, type, mode);
722 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
724 * Code to handle the inraw option.
726 * @param pOptions the danetool options data structure
727 * @param pOptDesc the option descriptor for this option.
729 static void
730 doOptInraw(tOptions* pOptions, tOptDesc* pOptDesc)
732 int res = optionAlias(pOptions, pOptDesc, INDEX_OPT_INDER);
733 if ((res != 0) && ((pOptions->fOptSet & OPTPROC_ERRSTOP) != 0))
734 USAGE(DANETOOL_EXIT_FAILURE);
737 /* extracted from optmain.tlib near line 1113 */
740 * The directory containing the data associated with danetool.
742 #ifndef PKGDATADIR
743 # define PKGDATADIR ""
744 #endif
747 * Information about the person or institution that packaged danetool
748 * for the current distribution.
750 #ifndef WITH_PACKAGER
751 # define danetool_packager_info NULL
752 #else
753 static char const danetool_packager_info[] =
754 "Packaged by " WITH_PACKAGER
756 # ifdef WITH_PACKAGER_VERSION
757 " ("WITH_PACKAGER_VERSION")"
758 # endif
760 # ifdef WITH_PACKAGER_BUG_REPORTS
761 "\nReport danetool bugs to " WITH_PACKAGER_BUG_REPORTS
762 # endif
763 "\n";
764 #endif
765 #ifndef __doxygen__
767 #endif /* __doxygen__ */
769 * The option definitions for danetool. The one structure that
770 * binds them all.
772 tOptions danetoolOptions = {
773 OPTIONS_STRUCT_VERSION,
774 0, NULL, /* original argc + argv */
775 ( OPTPROC_BASE
776 + OPTPROC_ERRSTOP
777 + OPTPROC_SHORTOPT
778 + OPTPROC_LONGOPT
779 + OPTPROC_NO_REQ_OPT
780 + OPTPROC_NEGATIONS
781 + OPTPROC_NO_ARGS
782 + OPTPROC_GNUUSAGE
783 + OPTPROC_MISUSE ),
784 0, NULL, /* current option index, current option */
785 NULL, NULL, zPROGNAME,
786 zRcName, zCopyright, zLicenseDescrip,
787 zFullVersion, apzHomeList, zUsageTitle,
788 zExplain, zDetail, optDesc,
789 zBugsAddr, /* address to send bugs to */
790 NULL, NULL, /* extensions/saved state */
791 optionUsage, /* usage procedure */
792 translate_option_strings, /* translation procedure */
794 * Indexes to special options
796 { INDEX_OPT_MORE_HELP, /* more-help option index */
797 NO_EQUIVALENT, /* save option index */
798 NO_EQUIVALENT, /* '-#' option index */
799 NO_EQUIVALENT /* index of default opt */
801 21 /* full option count */, 18 /* user option count */,
802 danetool_full_usage, danetool_short_usage,
803 NULL, NULL,
804 PKGDATADIR, danetool_packager_info
807 #if ENABLE_NLS
808 #include <stdio.h>
809 #include <stdlib.h>
810 #include <string.h>
811 #include <unistd.h>
812 #include <autoopts/usage-txt.h>
814 static char* AO_gettext(char const* pz);
815 static void coerce_it(void** s);
818 * AutoGen specific wrapper function for gettext.
819 * It relies on the macro _() to convert from English to the target
820 * language, then strdup-duplicates the result string.
822 * @param[in] pz the input text used as a lookup key.
823 * @returns the translated text (if there is one),
824 * or the original text (if not).
826 static char *
827 AO_gettext(char const* pz)
829 char* pzRes;
830 if (pz == NULL)
831 return NULL;
832 pzRes = _(pz);
833 if (pzRes == pz)
834 return pzRes;
835 pzRes = strdup(pzRes);
836 if (pzRes == NULL) {
837 fputs(_("No memory for duping translated strings\n"), stderr);
838 exit(DANETOOL_EXIT_FAILURE);
840 return pzRes;
843 static void coerce_it(void** s) { *s = AO_gettext(*s);
847 * Translate all the translatable strings in the danetoolOptions
848 * structure defined above. This is done only once.
850 static void
851 translate_option_strings(void)
853 tOptions * const pOpt = &danetoolOptions;
856 * Guard against re-translation. It won't work. The strings will have
857 * been changed by the first pass through this code. One shot only.
859 if (option_usage_text.field_ct != 0) {
861 * Do the translations. The first pointer follows the field count
862 * field. The field count field is the size of a pointer.
864 tOptDesc * pOD = pOpt->pOptDesc;
865 char ** ppz = (char**)(void*)&(option_usage_text);
866 int ix = option_usage_text.field_ct;
868 do {
869 ppz++;
870 *ppz = AO_gettext(*ppz);
871 } while (--ix > 0);
873 coerce_it((void*)&(pOpt->pzCopyright));
874 coerce_it((void*)&(pOpt->pzCopyNotice));
875 coerce_it((void*)&(pOpt->pzFullVersion));
876 coerce_it((void*)&(pOpt->pzUsageTitle));
877 coerce_it((void*)&(pOpt->pzExplain));
878 coerce_it((void*)&(pOpt->pzDetail));
879 coerce_it((void*)&(pOpt->pzPackager));
880 coerce_it((void*)&(pOpt->pzShortUsage));
881 option_usage_text.field_ct = 0;
883 for (ix = pOpt->optCt; ix > 0; ix--, pOD++)
884 coerce_it((void*)&(pOD->pzText));
887 if ((pOpt->fOptSet & OPTPROC_NXLAT_OPT_CFG) == 0) {
888 tOptDesc * pOD = pOpt->pOptDesc;
889 int ix;
891 for (ix = pOpt->optCt; ix > 0; ix--, pOD++) {
892 coerce_it((void*)&(pOD->pz_Name));
893 coerce_it((void*)&(pOD->pz_DisableName));
894 coerce_it((void*)&(pOD->pz_DisablePfx));
896 /* prevent re-translation */
897 danetoolOptions.fOptSet |= OPTPROC_NXLAT_OPT_CFG | OPTPROC_NXLAT_OPT;
901 #endif /* ENABLE_NLS */
903 #ifdef __cplusplus
905 #endif
906 /* danetool-args.c ends here */