no need to check for DTLS
[gnutls.git] / src / ocsptool-args.c
blob99860e37027c30c84c24d8d07fbd6a71cc08849e
1 /* -*- buffer-read-only: t -*- vi: set ro:
2 *
3 * DO NOT EDIT THIS FILE (ocsptool-args.c)
4 *
5 * It has been AutoGen-ed May 9, 2012 at 08:04:44 PM by AutoGen 5.16
6 * From the definitions ocsptool-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 ocsptool 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 ocsptool 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 * ocsptool 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 * ocsptool 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 "ocsptool-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 (ocsptool_opt_strs+0)
60 #define zLicenseDescrip (ocsptool_opt_strs+279)
63 #ifndef NULL
64 # define NULL 0
65 #endif
68 * ocsptool option static const strings
70 static char const ocsptool_opt_strs[2273] =
71 /* 0 */ "ocsptool @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 */ "ocsptool 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 "ocsptool 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 */ "Ask an OCSP/HTTP server on a certificate validity\0"
100 /* 1053 */ "ASK\0"
101 /* 1057 */ "ask\0"
102 /* 1061 */ "Verify response\0"
103 /* 1077 */ "VERIFY_RESPONSE\0"
104 /* 1093 */ "verify-response\0"
105 /* 1109 */ "Print information on a OCSP request\0"
106 /* 1145 */ "REQUEST_INFO\0"
107 /* 1158 */ "request-info\0"
108 /* 1171 */ "Print information on a OCSP response\0"
109 /* 1208 */ "RESPONSE_INFO\0"
110 /* 1222 */ "response-info\0"
111 /* 1236 */ "Generate an OCSP request\0"
112 /* 1261 */ "GENERATE_REQUEST\0"
113 /* 1278 */ "generate-request\0"
114 /* 1295 */ "Don't add nonce to OCSP request\0"
115 /* 1327 */ "NONCE\0"
116 /* 1333 */ "no-nonce\0"
117 /* 1342 */ "no\0"
118 /* 1345 */ "Read issuer certificate from file\0"
119 /* 1379 */ "LOAD_ISSUER\0"
120 /* 1391 */ "load-issuer\0"
121 /* 1403 */ "Read certificate to check from file\0"
122 /* 1439 */ "LOAD_CERT\0"
123 /* 1449 */ "load-cert\0"
124 /* 1459 */ "Read OCSP trust anchors from file\0"
125 /* 1493 */ "LOAD_TRUST\0"
126 /* 1504 */ "load-trust\0"
127 /* 1515 */ "Read OCSP response signer from file\0"
128 /* 1551 */ "LOAD_SIGNER\0"
129 /* 1563 */ "load-signer\0"
130 /* 1575 */ "Use DER format for input certificates and private keys\0"
131 /* 1630 */ "INDER\0"
132 /* 1636 */ "no-inder\0"
133 /* 1645 */ "Read DER encoded OCSP request from file\0"
134 /* 1685 */ "LOAD_REQUEST\0"
135 /* 1698 */ "load-request\0"
136 /* 1711 */ "Read DER encoded OCSP response from file\0"
137 /* 1752 */ "LOAD_RESPONSE\0"
138 /* 1766 */ "load-response\0"
139 /* 1780 */ "Display extended usage information and exit\0"
140 /* 1824 */ "help\0"
141 /* 1829 */ "Extended usage information passed thru pager\0"
142 /* 1874 */ "more-help\0"
143 /* 1884 */ "Output version information and exit\0"
144 /* 1920 */ "version\0"
145 /* 1928 */ "OCSPTOOL\0"
146 /* 1937 */ "ocsptool - GnuTLS OCSP tool - Ver. @VERSION@\n"
147 "USAGE: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n\0"
148 /* 2040 */ "bug-gnutls@gnu.org\0"
149 /* 2059 */ "\n\n\0"
150 /* 2062 */ "\n"
151 "Ocsptool is a program that can parse and print information about OCSP\n"
152 "requests/responses, generate requests and verify responses.\n\0"
153 /* 2194 */ "ocsptool @VERSION@\0"
154 /* 2213 */ "ocsptool [options]\n"
155 "ocsptool --help for usage instructions.\n";
158 * debug option description:
160 #define DEBUG_DESC (ocsptool_opt_strs+884)
161 #define DEBUG_NAME (ocsptool_opt_strs+902)
162 #define DEBUG_name (ocsptool_opt_strs+908)
163 #define DEBUG_FLAGS (OPTST_DISABLED \
164 | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
167 * verbose option description:
169 #define VERBOSE_DESC (ocsptool_opt_strs+914)
170 #define VERBOSE_NAME (ocsptool_opt_strs+934)
171 #define VERBOSE_name (ocsptool_opt_strs+942)
172 #define VERBOSE_FLAGS (OPTST_DISABLED)
175 * infile option description:
177 #define INFILE_DESC (ocsptool_opt_strs+950)
178 #define INFILE_NAME (ocsptool_opt_strs+961)
179 #define INFILE_name (ocsptool_opt_strs+968)
180 #define INFILE_FLAGS (OPTST_DISABLED \
181 | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
184 * outfile option description:
186 #define OUTFILE_DESC (ocsptool_opt_strs+975)
187 #define OUTFILE_NAME (ocsptool_opt_strs+987)
188 #define OUTFILE_name (ocsptool_opt_strs+995)
189 #define OUTFILE_FLAGS (OPTST_DISABLED \
190 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
193 * ask option description with
194 * "Must also have options" and "Incompatible options":
196 #define ASK_DESC (ocsptool_opt_strs+1003)
197 #define ASK_NAME (ocsptool_opt_strs+1053)
198 #define ASK_name (ocsptool_opt_strs+1057)
199 static int const aAskMustList[] = {
200 INDEX_OPT_LOAD_CERT,
201 INDEX_OPT_LOAD_ISSUER, NO_EQUIVALENT };
202 #define ASK_FLAGS (OPTST_DISABLED \
203 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | OPTST_ARG_OPTIONAL)
206 * verify-response option description:
208 #define VERIFY_RESPONSE_DESC (ocsptool_opt_strs+1061)
209 #define VERIFY_RESPONSE_NAME (ocsptool_opt_strs+1077)
210 #define VERIFY_RESPONSE_name (ocsptool_opt_strs+1093)
211 #define VERIFY_RESPONSE_FLAGS (OPTST_DISABLED)
214 * request-info option description:
216 #define REQUEST_INFO_DESC (ocsptool_opt_strs+1109)
217 #define REQUEST_INFO_NAME (ocsptool_opt_strs+1145)
218 #define REQUEST_INFO_name (ocsptool_opt_strs+1158)
219 #define REQUEST_INFO_FLAGS (OPTST_DISABLED)
222 * response-info option description:
224 #define RESPONSE_INFO_DESC (ocsptool_opt_strs+1171)
225 #define RESPONSE_INFO_NAME (ocsptool_opt_strs+1208)
226 #define RESPONSE_INFO_name (ocsptool_opt_strs+1222)
227 #define RESPONSE_INFO_FLAGS (OPTST_DISABLED)
230 * generate-request option description:
232 #define GENERATE_REQUEST_DESC (ocsptool_opt_strs+1236)
233 #define GENERATE_REQUEST_NAME (ocsptool_opt_strs+1261)
234 #define GENERATE_REQUEST_name (ocsptool_opt_strs+1278)
235 #define GENERATE_REQUEST_FLAGS (OPTST_DISABLED)
238 * nonce option description:
240 #define NONCE_DESC (ocsptool_opt_strs+1295)
241 #define NONCE_NAME (ocsptool_opt_strs+1327)
242 #define NOT_NONCE_name (ocsptool_opt_strs+1333)
243 #define NOT_NONCE_PFX (ocsptool_opt_strs+1342)
244 #define NONCE_name (NOT_NONCE_name + 3)
245 #define NONCE_FLAGS (OPTST_DISABLED)
248 * load-issuer option description:
250 #define LOAD_ISSUER_DESC (ocsptool_opt_strs+1345)
251 #define LOAD_ISSUER_NAME (ocsptool_opt_strs+1379)
252 #define LOAD_ISSUER_name (ocsptool_opt_strs+1391)
253 #define LOAD_ISSUER_FLAGS (OPTST_DISABLED \
254 | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
257 * load-cert option description:
259 #define LOAD_CERT_DESC (ocsptool_opt_strs+1403)
260 #define LOAD_CERT_NAME (ocsptool_opt_strs+1439)
261 #define LOAD_CERT_name (ocsptool_opt_strs+1449)
262 #define LOAD_CERT_FLAGS (OPTST_DISABLED \
263 | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
266 * load-trust option description with
267 * "Must also have options" and "Incompatible options":
269 #define LOAD_TRUST_DESC (ocsptool_opt_strs+1459)
270 #define LOAD_TRUST_NAME (ocsptool_opt_strs+1493)
271 #define LOAD_TRUST_name (ocsptool_opt_strs+1504)
272 static int const aLoad_TrustCantList[] = {
273 INDEX_OPT_LOAD_SIGNER, NO_EQUIVALENT };
274 #define LOAD_TRUST_FLAGS (OPTST_DISABLED \
275 | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
278 * load-signer option description with
279 * "Must also have options" and "Incompatible options":
281 #define LOAD_SIGNER_DESC (ocsptool_opt_strs+1515)
282 #define LOAD_SIGNER_NAME (ocsptool_opt_strs+1551)
283 #define LOAD_SIGNER_name (ocsptool_opt_strs+1563)
284 static int const aLoad_SignerCantList[] = {
285 INDEX_OPT_LOAD_TRUST, NO_EQUIVALENT };
286 #define LOAD_SIGNER_FLAGS (OPTST_DISABLED \
287 | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
290 * inder option description:
292 #define INDER_DESC (ocsptool_opt_strs+1575)
293 #define INDER_NAME (ocsptool_opt_strs+1630)
294 #define NOT_INDER_name (ocsptool_opt_strs+1636)
295 #define NOT_INDER_PFX (ocsptool_opt_strs+1342)
296 #define INDER_name (NOT_INDER_name + 3)
297 #define INDER_FLAGS (OPTST_DISABLED)
300 * load-request option description:
302 #define LOAD_REQUEST_DESC (ocsptool_opt_strs+1645)
303 #define LOAD_REQUEST_NAME (ocsptool_opt_strs+1685)
304 #define LOAD_REQUEST_name (ocsptool_opt_strs+1698)
305 #define LOAD_REQUEST_FLAGS (OPTST_DISABLED \
306 | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
309 * load-response option description:
311 #define LOAD_RESPONSE_DESC (ocsptool_opt_strs+1711)
312 #define LOAD_RESPONSE_NAME (ocsptool_opt_strs+1752)
313 #define LOAD_RESPONSE_name (ocsptool_opt_strs+1766)
314 #define LOAD_RESPONSE_FLAGS (OPTST_DISABLED \
315 | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
318 * Help/More_Help/Version option descriptions:
320 #define HELP_DESC (ocsptool_opt_strs+1780)
321 #define HELP_name (ocsptool_opt_strs+1824)
322 #ifdef HAVE_WORKING_FORK
323 #define MORE_HELP_DESC (ocsptool_opt_strs+1829)
324 #define MORE_HELP_name (ocsptool_opt_strs+1874)
325 #define MORE_HELP_FLAGS (OPTST_IMM | OPTST_NO_INIT)
326 #else
327 #define MORE_HELP_DESC NULL
328 #define MORE_HELP_name NULL
329 #define MORE_HELP_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
330 #endif
331 #ifdef NO_OPTIONAL_OPT_ARGS
332 # define VER_FLAGS (OPTST_IMM | OPTST_NO_INIT)
333 #else
334 # define VER_FLAGS (OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \
335 OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT)
336 #endif
337 #define VER_DESC (ocsptool_opt_strs+1884)
338 #define VER_name (ocsptool_opt_strs+1920)
340 * Declare option callback procedures
342 extern tOptProc
343 optionBooleanVal, optionNestedVal, optionNumericVal,
344 optionPagedUsage, optionPrintVersion, optionResetOpt,
345 optionStackArg, optionTimeDate, optionTimeVal,
346 optionUnstackArg, optionVendorOption;
347 static tOptProc
348 doOptDebug, doOptInfile, doOptLoad_Cert,
349 doOptLoad_Issuer, doOptLoad_Request, doOptLoad_Response,
350 doOptLoad_Signer, doOptLoad_Trust, doUsageOpt;
351 #define VER_PROC optionPrintVersion
353 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
355 * Define the ocsptool Option Descriptions.
356 * This is an array of OPTION_CT entries, one for each
357 * option that the ocsptool program responds to.
359 static tOptDesc optDesc[OPTION_CT] = {
360 { /* entry idx, value */ 0, VALUE_OPT_DEBUG,
361 /* equiv idx, value */ 0, VALUE_OPT_DEBUG,
362 /* equivalenced to */ NO_EQUIVALENT,
363 /* min, max, act ct */ 0, 1, 0,
364 /* opt state flags */ DEBUG_FLAGS, 0,
365 /* last opt argumnt */ { NULL }, /* --debug */
366 /* arg list/cookie */ NULL,
367 /* must/cannot opts */ NULL, NULL,
368 /* option proc */ doOptDebug,
369 /* desc, NAME, name */ DEBUG_DESC, DEBUG_NAME, DEBUG_name,
370 /* disablement strs */ NULL, NULL },
372 { /* entry idx, value */ 1, VALUE_OPT_VERBOSE,
373 /* equiv idx, value */ 1, VALUE_OPT_VERBOSE,
374 /* equivalenced to */ NO_EQUIVALENT,
375 /* min, max, act ct */ 0, NOLIMIT, 0,
376 /* opt state flags */ VERBOSE_FLAGS, 0,
377 /* last opt argumnt */ { NULL }, /* --verbose */
378 /* arg list/cookie */ NULL,
379 /* must/cannot opts */ NULL, NULL,
380 /* option proc */ NULL,
381 /* desc, NAME, name */ VERBOSE_DESC, VERBOSE_NAME, VERBOSE_name,
382 /* disablement strs */ NULL, NULL },
384 { /* entry idx, value */ 2, VALUE_OPT_INFILE,
385 /* equiv idx, value */ 2, VALUE_OPT_INFILE,
386 /* equivalenced to */ NO_EQUIVALENT,
387 /* min, max, act ct */ 0, 1, 0,
388 /* opt state flags */ INFILE_FLAGS, 0,
389 /* last opt argumnt */ { NULL }, /* --infile */
390 /* arg list/cookie */ NULL,
391 /* must/cannot opts */ NULL, NULL,
392 /* option proc */ doOptInfile,
393 /* desc, NAME, name */ INFILE_DESC, INFILE_NAME, INFILE_name,
394 /* disablement strs */ NULL, NULL },
396 { /* entry idx, value */ 3, VALUE_OPT_OUTFILE,
397 /* equiv idx, value */ 3, VALUE_OPT_OUTFILE,
398 /* equivalenced to */ NO_EQUIVALENT,
399 /* min, max, act ct */ 0, 1, 0,
400 /* opt state flags */ OUTFILE_FLAGS, 0,
401 /* last opt argumnt */ { NULL }, /* --outfile */
402 /* arg list/cookie */ NULL,
403 /* must/cannot opts */ NULL, NULL,
404 /* option proc */ NULL,
405 /* desc, NAME, name */ OUTFILE_DESC, OUTFILE_NAME, OUTFILE_name,
406 /* disablement strs */ NULL, NULL },
408 { /* entry idx, value */ 4, VALUE_OPT_ASK,
409 /* equiv idx, value */ 4, VALUE_OPT_ASK,
410 /* equivalenced to */ NO_EQUIVALENT,
411 /* min, max, act ct */ 0, 1, 0,
412 /* opt state flags */ ASK_FLAGS, 0,
413 /* last opt argumnt */ { NULL }, /* --ask */
414 /* arg list/cookie */ NULL,
415 /* must/cannot opts */ aAskMustList, NULL,
416 /* option proc */ NULL,
417 /* desc, NAME, name */ ASK_DESC, ASK_NAME, ASK_name,
418 /* disablement strs */ NULL, NULL },
420 { /* entry idx, value */ 5, VALUE_OPT_VERIFY_RESPONSE,
421 /* equiv idx, value */ 5, VALUE_OPT_VERIFY_RESPONSE,
422 /* equivalenced to */ NO_EQUIVALENT,
423 /* min, max, act ct */ 0, 1, 0,
424 /* opt state flags */ VERIFY_RESPONSE_FLAGS, 0,
425 /* last opt argumnt */ { NULL }, /* --verify-response */
426 /* arg list/cookie */ NULL,
427 /* must/cannot opts */ NULL, NULL,
428 /* option proc */ NULL,
429 /* desc, NAME, name */ VERIFY_RESPONSE_DESC, VERIFY_RESPONSE_NAME, VERIFY_RESPONSE_name,
430 /* disablement strs */ NULL, NULL },
432 { /* entry idx, value */ 6, VALUE_OPT_REQUEST_INFO,
433 /* equiv idx, value */ 6, VALUE_OPT_REQUEST_INFO,
434 /* equivalenced to */ NO_EQUIVALENT,
435 /* min, max, act ct */ 0, 1, 0,
436 /* opt state flags */ REQUEST_INFO_FLAGS, 0,
437 /* last opt argumnt */ { NULL }, /* --request-info */
438 /* arg list/cookie */ NULL,
439 /* must/cannot opts */ NULL, NULL,
440 /* option proc */ NULL,
441 /* desc, NAME, name */ REQUEST_INFO_DESC, REQUEST_INFO_NAME, REQUEST_INFO_name,
442 /* disablement strs */ NULL, NULL },
444 { /* entry idx, value */ 7, VALUE_OPT_RESPONSE_INFO,
445 /* equiv idx, value */ 7, VALUE_OPT_RESPONSE_INFO,
446 /* equivalenced to */ NO_EQUIVALENT,
447 /* min, max, act ct */ 0, 1, 0,
448 /* opt state flags */ RESPONSE_INFO_FLAGS, 0,
449 /* last opt argumnt */ { NULL }, /* --response-info */
450 /* arg list/cookie */ NULL,
451 /* must/cannot opts */ NULL, NULL,
452 /* option proc */ NULL,
453 /* desc, NAME, name */ RESPONSE_INFO_DESC, RESPONSE_INFO_NAME, RESPONSE_INFO_name,
454 /* disablement strs */ NULL, NULL },
456 { /* entry idx, value */ 8, VALUE_OPT_GENERATE_REQUEST,
457 /* equiv idx, value */ 8, VALUE_OPT_GENERATE_REQUEST,
458 /* equivalenced to */ NO_EQUIVALENT,
459 /* min, max, act ct */ 0, 1, 0,
460 /* opt state flags */ GENERATE_REQUEST_FLAGS, 0,
461 /* last opt argumnt */ { NULL }, /* --generate-request */
462 /* arg list/cookie */ NULL,
463 /* must/cannot opts */ NULL, NULL,
464 /* option proc */ NULL,
465 /* desc, NAME, name */ GENERATE_REQUEST_DESC, GENERATE_REQUEST_NAME, GENERATE_REQUEST_name,
466 /* disablement strs */ NULL, NULL },
468 { /* entry idx, value */ 9, VALUE_OPT_NONCE,
469 /* equiv idx, value */ 9, VALUE_OPT_NONCE,
470 /* equivalenced to */ NO_EQUIVALENT,
471 /* min, max, act ct */ 0, 1, 0,
472 /* opt state flags */ NONCE_FLAGS, 0,
473 /* last opt argumnt */ { NULL }, /* --nonce */
474 /* arg list/cookie */ NULL,
475 /* must/cannot opts */ NULL, NULL,
476 /* option proc */ NULL,
477 /* desc, NAME, name */ NONCE_DESC, NONCE_NAME, NONCE_name,
478 /* disablement strs */ NOT_NONCE_name, NOT_NONCE_PFX },
480 { /* entry idx, value */ 10, VALUE_OPT_LOAD_ISSUER,
481 /* equiv idx, value */ 10, VALUE_OPT_LOAD_ISSUER,
482 /* equivalenced to */ NO_EQUIVALENT,
483 /* min, max, act ct */ 0, 1, 0,
484 /* opt state flags */ LOAD_ISSUER_FLAGS, 0,
485 /* last opt argumnt */ { NULL }, /* --load-issuer */
486 /* arg list/cookie */ NULL,
487 /* must/cannot opts */ NULL, NULL,
488 /* option proc */ doOptLoad_Issuer,
489 /* desc, NAME, name */ LOAD_ISSUER_DESC, LOAD_ISSUER_NAME, LOAD_ISSUER_name,
490 /* disablement strs */ NULL, NULL },
492 { /* entry idx, value */ 11, VALUE_OPT_LOAD_CERT,
493 /* equiv idx, value */ 11, VALUE_OPT_LOAD_CERT,
494 /* equivalenced to */ NO_EQUIVALENT,
495 /* min, max, act ct */ 0, 1, 0,
496 /* opt state flags */ LOAD_CERT_FLAGS, 0,
497 /* last opt argumnt */ { NULL }, /* --load-cert */
498 /* arg list/cookie */ NULL,
499 /* must/cannot opts */ NULL, NULL,
500 /* option proc */ doOptLoad_Cert,
501 /* desc, NAME, name */ LOAD_CERT_DESC, LOAD_CERT_NAME, LOAD_CERT_name,
502 /* disablement strs */ NULL, NULL },
504 { /* entry idx, value */ 12, VALUE_OPT_LOAD_TRUST,
505 /* equiv idx, value */ 12, VALUE_OPT_LOAD_TRUST,
506 /* equivalenced to */ NO_EQUIVALENT,
507 /* min, max, act ct */ 0, 1, 0,
508 /* opt state flags */ LOAD_TRUST_FLAGS, 0,
509 /* last opt argumnt */ { NULL }, /* --load-trust */
510 /* arg list/cookie */ NULL,
511 /* must/cannot opts */ NULL, aLoad_TrustCantList,
512 /* option proc */ doOptLoad_Trust,
513 /* desc, NAME, name */ LOAD_TRUST_DESC, LOAD_TRUST_NAME, LOAD_TRUST_name,
514 /* disablement strs */ NULL, NULL },
516 { /* entry idx, value */ 13, VALUE_OPT_LOAD_SIGNER,
517 /* equiv idx, value */ 13, VALUE_OPT_LOAD_SIGNER,
518 /* equivalenced to */ NO_EQUIVALENT,
519 /* min, max, act ct */ 0, 1, 0,
520 /* opt state flags */ LOAD_SIGNER_FLAGS, 0,
521 /* last opt argumnt */ { NULL }, /* --load-signer */
522 /* arg list/cookie */ NULL,
523 /* must/cannot opts */ NULL, aLoad_SignerCantList,
524 /* option proc */ doOptLoad_Signer,
525 /* desc, NAME, name */ LOAD_SIGNER_DESC, LOAD_SIGNER_NAME, LOAD_SIGNER_name,
526 /* disablement strs */ NULL, NULL },
528 { /* entry idx, value */ 14, VALUE_OPT_INDER,
529 /* equiv idx, value */ 14, VALUE_OPT_INDER,
530 /* equivalenced to */ NO_EQUIVALENT,
531 /* min, max, act ct */ 0, 1, 0,
532 /* opt state flags */ INDER_FLAGS, 0,
533 /* last opt argumnt */ { NULL }, /* --inder */
534 /* arg list/cookie */ NULL,
535 /* must/cannot opts */ NULL, NULL,
536 /* option proc */ NULL,
537 /* desc, NAME, name */ INDER_DESC, INDER_NAME, INDER_name,
538 /* disablement strs */ NOT_INDER_name, NOT_INDER_PFX },
540 { /* entry idx, value */ 15, VALUE_OPT_LOAD_REQUEST,
541 /* equiv idx, value */ 15, VALUE_OPT_LOAD_REQUEST,
542 /* equivalenced to */ NO_EQUIVALENT,
543 /* min, max, act ct */ 0, 1, 0,
544 /* opt state flags */ LOAD_REQUEST_FLAGS, 0,
545 /* last opt argumnt */ { NULL }, /* --load-request */
546 /* arg list/cookie */ NULL,
547 /* must/cannot opts */ NULL, NULL,
548 /* option proc */ doOptLoad_Request,
549 /* desc, NAME, name */ LOAD_REQUEST_DESC, LOAD_REQUEST_NAME, LOAD_REQUEST_name,
550 /* disablement strs */ NULL, NULL },
552 { /* entry idx, value */ 16, VALUE_OPT_LOAD_RESPONSE,
553 /* equiv idx, value */ 16, VALUE_OPT_LOAD_RESPONSE,
554 /* equivalenced to */ NO_EQUIVALENT,
555 /* min, max, act ct */ 0, 1, 0,
556 /* opt state flags */ LOAD_RESPONSE_FLAGS, 0,
557 /* last opt argumnt */ { NULL }, /* --load-response */
558 /* arg list/cookie */ NULL,
559 /* must/cannot opts */ NULL, NULL,
560 /* option proc */ doOptLoad_Response,
561 /* desc, NAME, name */ LOAD_RESPONSE_DESC, LOAD_RESPONSE_NAME, LOAD_RESPONSE_name,
562 /* disablement strs */ NULL, NULL },
564 { /* entry idx, value */ INDEX_OPT_VERSION, VALUE_OPT_VERSION,
565 /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_VERSION,
566 /* equivalenced to */ NO_EQUIVALENT,
567 /* min, max, act ct */ 0, 1, 0,
568 /* opt state flags */ VER_FLAGS, 0,
569 /* last opt argumnt */ { NULL },
570 /* arg list/cookie */ NULL,
571 /* must/cannot opts */ NULL, NULL,
572 /* option proc */ VER_PROC,
573 /* desc, NAME, name */ VER_DESC, NULL, VER_name,
574 /* disablement strs */ NULL, NULL },
578 { /* entry idx, value */ INDEX_OPT_HELP, VALUE_OPT_HELP,
579 /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_HELP,
580 /* equivalenced to */ NO_EQUIVALENT,
581 /* min, max, act ct */ 0, 1, 0,
582 /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, 0,
583 /* last opt argumnt */ { NULL },
584 /* arg list/cookie */ NULL,
585 /* must/cannot opts */ NULL, NULL,
586 /* option proc */ doUsageOpt,
587 /* desc, NAME, name */ HELP_DESC, NULL, HELP_name,
588 /* disablement strs */ NULL, NULL },
590 { /* entry idx, value */ INDEX_OPT_MORE_HELP, VALUE_OPT_MORE_HELP,
591 /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_MORE_HELP,
592 /* equivalenced to */ NO_EQUIVALENT,
593 /* min, max, act ct */ 0, 1, 0,
594 /* opt state flags */ MORE_HELP_FLAGS, 0,
595 /* last opt argumnt */ { NULL },
596 /* arg list/cookie */ NULL,
597 /* must/cannot opts */ NULL, NULL,
598 /* option proc */ optionPagedUsage,
599 /* desc, NAME, name */ MORE_HELP_DESC, NULL, MORE_HELP_name,
600 /* disablement strs */ NULL, NULL }
604 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
606 * Define the ocsptool Option Environment
608 #define zPROGNAME (ocsptool_opt_strs+1928)
609 #define zUsageTitle (ocsptool_opt_strs+1937)
610 #define zRcName NULL
611 #define apzHomeList NULL
612 #define zBugsAddr (ocsptool_opt_strs+2040)
613 #define zExplain (ocsptool_opt_strs+2059)
614 #define zDetail (ocsptool_opt_strs+2062)
615 #define zFullVersion (ocsptool_opt_strs+2194)
616 /* extracted from optcode.tlib near line 350 */
618 #if defined(ENABLE_NLS)
619 # define OPTPROC_BASE OPTPROC_TRANSLATE | OPTPROC_NXLAT_OPT
620 static tOptionXlateProc translate_option_strings;
621 #else
622 # define OPTPROC_BASE OPTPROC_NONE
623 # define translate_option_strings NULL
624 #endif /* ENABLE_NLS */
627 #define ocsptool_full_usage (NULL)
629 #define ocsptool_short_usage (ocsptool_opt_strs+2213)
631 #endif /* not defined __doxygen__ */
634 * Create the static procedure(s) declared above.
637 * The callout function that invokes the optionUsage function.
639 * @param pOptions the AutoOpts option description structure
640 * @param pOptDesc the descriptor for the "help" (usage) option.
641 * @noreturn
643 static void
644 doUsageOpt(tOptions * pOptions, tOptDesc * pOptDesc)
646 optionUsage(&ocsptoolOptions, OCSPTOOL_EXIT_SUCCESS);
647 /* NOTREACHED */
648 (void)pOptDesc;
649 (void)pOptions;
652 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
654 * Code to handle the debug option.
656 * @param pOptions the ocsptool options data structure
657 * @param pOptDesc the option descriptor for this option.
659 static void
660 doOptDebug(tOptions* pOptions, tOptDesc* pOptDesc)
662 static struct {long rmin, rmax;} const rng[1] = {
663 { 0 , 9999 } };
664 int ix;
666 if (pOptions <= OPTPROC_EMIT_LIMIT)
667 goto emit_ranges;
668 optionNumericVal(pOptions, pOptDesc);
670 for (ix = 0; ix < 1; ix++) {
671 if (pOptDesc->optArg.argInt < rng[ix].rmin)
672 continue; /* ranges need not be ordered. */
673 if (pOptDesc->optArg.argInt == rng[ix].rmin)
674 return;
675 if (rng[ix].rmax == LONG_MIN)
676 continue;
677 if (pOptDesc->optArg.argInt <= rng[ix].rmax)
678 return;
681 option_usage_fp = stderr;
683 emit_ranges:
685 optionShowRange(pOptions, pOptDesc, (void *)rng, 1);
688 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
690 * Code to handle the infile option.
692 * @param pOptions the ocsptool options data structure
693 * @param pOptDesc the option descriptor for this option.
695 static void
696 doOptInfile(tOptions* pOptions, tOptDesc* pOptDesc)
698 static teOptFileType const type =
699 FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN;
700 static tuFileMode mode;
701 #ifndef O_CLOEXEC
702 # define O_CLOEXEC 0
703 #endif
704 mode.file_flags = O_CLOEXEC;
706 optionFileCheck(pOptions, pOptDesc, type, mode);
709 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
711 * Code to handle the load-issuer option.
713 * @param pOptions the ocsptool options data structure
714 * @param pOptDesc the option descriptor for this option.
716 static void
717 doOptLoad_Issuer(tOptions* pOptions, tOptDesc* pOptDesc)
719 static teOptFileType const type =
720 FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN;
721 static tuFileMode mode;
722 #ifndef O_CLOEXEC
723 # define O_CLOEXEC 0
724 #endif
725 mode.file_flags = O_CLOEXEC;
727 optionFileCheck(pOptions, pOptDesc, type, mode);
730 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
732 * Code to handle the load-cert option.
734 * @param pOptions the ocsptool options data structure
735 * @param pOptDesc the option descriptor for this option.
737 static void
738 doOptLoad_Cert(tOptions* pOptions, tOptDesc* pOptDesc)
740 static teOptFileType const type =
741 FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN;
742 static tuFileMode mode;
743 #ifndef O_CLOEXEC
744 # define O_CLOEXEC 0
745 #endif
746 mode.file_flags = O_CLOEXEC;
748 optionFileCheck(pOptions, pOptDesc, type, mode);
751 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
753 * Code to handle the load-trust option.
755 * @param pOptions the ocsptool options data structure
756 * @param pOptDesc the option descriptor for this option.
758 static void
759 doOptLoad_Trust(tOptions* pOptions, tOptDesc* pOptDesc)
761 static teOptFileType const type =
762 FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN;
763 static tuFileMode mode;
764 #ifndef O_CLOEXEC
765 # define O_CLOEXEC 0
766 #endif
767 mode.file_flags = O_CLOEXEC;
769 optionFileCheck(pOptions, pOptDesc, type, mode);
772 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
774 * Code to handle the load-signer option.
776 * @param pOptions the ocsptool options data structure
777 * @param pOptDesc the option descriptor for this option.
779 static void
780 doOptLoad_Signer(tOptions* pOptions, tOptDesc* pOptDesc)
782 static teOptFileType const type =
783 FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN;
784 static tuFileMode mode;
785 #ifndef O_CLOEXEC
786 # define O_CLOEXEC 0
787 #endif
788 mode.file_flags = O_CLOEXEC;
790 optionFileCheck(pOptions, pOptDesc, type, mode);
793 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
795 * Code to handle the load-request option.
797 * @param pOptions the ocsptool options data structure
798 * @param pOptDesc the option descriptor for this option.
800 static void
801 doOptLoad_Request(tOptions* pOptions, tOptDesc* pOptDesc)
803 static teOptFileType const type =
804 FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN;
805 static tuFileMode mode;
806 #ifndef O_CLOEXEC
807 # define O_CLOEXEC 0
808 #endif
809 mode.file_flags = O_CLOEXEC;
811 optionFileCheck(pOptions, pOptDesc, type, mode);
814 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
816 * Code to handle the load-response option.
818 * @param pOptions the ocsptool options data structure
819 * @param pOptDesc the option descriptor for this option.
821 static void
822 doOptLoad_Response(tOptions* pOptions, tOptDesc* pOptDesc)
824 static teOptFileType const type =
825 FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN;
826 static tuFileMode mode;
827 #ifndef O_CLOEXEC
828 # define O_CLOEXEC 0
829 #endif
830 mode.file_flags = O_CLOEXEC;
832 optionFileCheck(pOptions, pOptDesc, type, mode);
834 /* extracted from optmain.tlib near line 1113 */
837 * The directory containing the data associated with ocsptool.
839 #ifndef PKGDATADIR
840 # define PKGDATADIR ""
841 #endif
844 * Information about the person or institution that packaged ocsptool
845 * for the current distribution.
847 #ifndef WITH_PACKAGER
848 # define ocsptool_packager_info NULL
849 #else
850 static char const ocsptool_packager_info[] =
851 "Packaged by " WITH_PACKAGER
853 # ifdef WITH_PACKAGER_VERSION
854 " ("WITH_PACKAGER_VERSION")"
855 # endif
857 # ifdef WITH_PACKAGER_BUG_REPORTS
858 "\nReport ocsptool bugs to " WITH_PACKAGER_BUG_REPORTS
859 # endif
860 "\n";
861 #endif
862 #ifndef __doxygen__
864 #endif /* __doxygen__ */
866 * The option definitions for ocsptool. The one structure that
867 * binds them all.
869 tOptions ocsptoolOptions = {
870 OPTIONS_STRUCT_VERSION,
871 0, NULL, /* original argc + argv */
872 ( OPTPROC_BASE
873 + OPTPROC_ERRSTOP
874 + OPTPROC_SHORTOPT
875 + OPTPROC_LONGOPT
876 + OPTPROC_NO_REQ_OPT
877 + OPTPROC_NEGATIONS
878 + OPTPROC_NO_ARGS
879 + OPTPROC_GNUUSAGE
880 + OPTPROC_MISUSE ),
881 0, NULL, /* current option index, current option */
882 NULL, NULL, zPROGNAME,
883 zRcName, zCopyright, zLicenseDescrip,
884 zFullVersion, apzHomeList, zUsageTitle,
885 zExplain, zDetail, optDesc,
886 zBugsAddr, /* address to send bugs to */
887 NULL, NULL, /* extensions/saved state */
888 optionUsage, /* usage procedure */
889 translate_option_strings, /* translation procedure */
891 * Indexes to special options
893 { INDEX_OPT_MORE_HELP, /* more-help option index */
894 NO_EQUIVALENT, /* save option index */
895 NO_EQUIVALENT, /* '-#' option index */
896 NO_EQUIVALENT /* index of default opt */
898 20 /* full option count */, 17 /* user option count */,
899 ocsptool_full_usage, ocsptool_short_usage,
900 NULL, NULL,
901 PKGDATADIR, ocsptool_packager_info
904 #if ENABLE_NLS
905 #include <stdio.h>
906 #include <stdlib.h>
907 #include <string.h>
908 #include <unistd.h>
909 #include <autoopts/usage-txt.h>
911 static char* AO_gettext(char const* pz);
912 static void coerce_it(void** s);
915 * AutoGen specific wrapper function for gettext.
916 * It relies on the macro _() to convert from English to the target
917 * language, then strdup-duplicates the result string.
919 * @param[in] pz the input text used as a lookup key.
920 * @returns the translated text (if there is one),
921 * or the original text (if not).
923 static char *
924 AO_gettext(char const* pz)
926 char* pzRes;
927 if (pz == NULL)
928 return NULL;
929 pzRes = _(pz);
930 if (pzRes == pz)
931 return pzRes;
932 pzRes = strdup(pzRes);
933 if (pzRes == NULL) {
934 fputs(_("No memory for duping translated strings\n"), stderr);
935 exit(OCSPTOOL_EXIT_FAILURE);
937 return pzRes;
940 static void coerce_it(void** s) { *s = AO_gettext(*s);
944 * Translate all the translatable strings in the ocsptoolOptions
945 * structure defined above. This is done only once.
947 static void
948 translate_option_strings(void)
950 tOptions * const pOpt = &ocsptoolOptions;
953 * Guard against re-translation. It won't work. The strings will have
954 * been changed by the first pass through this code. One shot only.
956 if (option_usage_text.field_ct != 0) {
958 * Do the translations. The first pointer follows the field count
959 * field. The field count field is the size of a pointer.
961 tOptDesc * pOD = pOpt->pOptDesc;
962 char ** ppz = (char**)(void*)&(option_usage_text);
963 int ix = option_usage_text.field_ct;
965 do {
966 ppz++;
967 *ppz = AO_gettext(*ppz);
968 } while (--ix > 0);
970 coerce_it((void*)&(pOpt->pzCopyright));
971 coerce_it((void*)&(pOpt->pzCopyNotice));
972 coerce_it((void*)&(pOpt->pzFullVersion));
973 coerce_it((void*)&(pOpt->pzUsageTitle));
974 coerce_it((void*)&(pOpt->pzExplain));
975 coerce_it((void*)&(pOpt->pzDetail));
976 coerce_it((void*)&(pOpt->pzPackager));
977 coerce_it((void*)&(pOpt->pzShortUsage));
978 option_usage_text.field_ct = 0;
980 for (ix = pOpt->optCt; ix > 0; ix--, pOD++)
981 coerce_it((void*)&(pOD->pzText));
984 if ((pOpt->fOptSet & OPTPROC_NXLAT_OPT_CFG) == 0) {
985 tOptDesc * pOD = pOpt->pOptDesc;
986 int ix;
988 for (ix = pOpt->optCt; ix > 0; ix--, pOD++) {
989 coerce_it((void*)&(pOD->pz_Name));
990 coerce_it((void*)&(pOD->pz_DisableName));
991 coerce_it((void*)&(pOD->pz_DisablePfx));
993 /* prevent re-translation */
994 ocsptoolOptions.fOptSet |= OPTPROC_NXLAT_OPT_CFG | OPTPROC_NXLAT_OPT;
998 #endif /* ENABLE_NLS */
1000 #ifdef __cplusplus
1002 #endif
1003 /* ocsptool-args.c ends here */