GNUTLS_E_ENCRYPTED_STRUCTURE is no more.
[gnutls.git] / src / p11tool-args.c
blob91eed27697f2476f6d9ddb46578cddf62d08dade
1 /* -*- buffer-read-only: t -*- vi: set ro:
2 *
3 * DO NOT EDIT THIS FILE (p11tool-args.c)
4 *
5 * It has been AutoGen-ed May 9, 2012 at 08:04:48 PM by AutoGen 5.16
6 * From the definitions p11tool-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 p11tool 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 p11tool 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 * p11tool 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 * p11tool 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 "p11tool-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 (p11tool_opt_strs+0)
60 #define zLicenseDescrip (p11tool_opt_strs+278)
63 #ifndef NULL
64 # define NULL 0
65 #endif
68 * p11tool option static const strings
70 static char const p11tool_opt_strs[3155] =
71 /* 0 */ "p11tool @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 /* 278 */ "p11tool 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 "p11tool 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 /* 881 */ "Enable debugging.\0"
88 /* 899 */ "DEBUG\0"
89 /* 905 */ "debug\0"
90 /* 911 */ "Output file\0"
91 /* 923 */ "OUTFILE\0"
92 /* 931 */ "outfile\0"
93 /* 939 */ "List all available tokens\0"
94 /* 965 */ "LIST_TOKENS\0"
95 /* 977 */ "list-tokens\0"
96 /* 989 */ "Export the object specified by the URL\0"
97 /* 1028 */ "EXPORT\0"
98 /* 1035 */ "export\0"
99 /* 1042 */ "List all available mechanisms in a token\0"
100 /* 1083 */ "LIST_MECHANISMS\0"
101 /* 1099 */ "list-mechanisms\0"
102 /* 1115 */ "List all available objects in a token\0"
103 /* 1153 */ "LIST_ALL\0"
104 /* 1162 */ "list-all\0"
105 /* 1171 */ "List all available certificates in a token\0"
106 /* 1214 */ "LIST_ALL_CERTS\0"
107 /* 1229 */ "list-all-certs\0"
108 /* 1244 */ "List all certificates that have an associated private key\0"
109 /* 1302 */ "LIST_CERTS\0"
110 /* 1313 */ "list-certs\0"
111 /* 1324 */ "List all available private keys in a token\0"
112 /* 1367 */ "LIST_ALL_PRIVKEYS\0"
113 /* 1385 */ "list-all-privkeys\0"
114 /* 1403 */ "List all available certificates marked as trusted\0"
115 /* 1453 */ "LIST_ALL_TRUSTED\0"
116 /* 1470 */ "list-all-trusted\0"
117 /* 1487 */ "Initializes a PKCS #11 token\0"
118 /* 1516 */ "INITIALIZE\0"
119 /* 1527 */ "initialize\0"
120 /* 1538 */ "Writes the loaded objects to a PKCS #11 token\0"
121 /* 1584 */ "WRITE\0"
122 /* 1590 */ "write\0"
123 /* 1596 */ "Deletes the objects matching the PKCS #11 URL\0"
124 /* 1642 */ "DELETE\0"
125 /* 1649 */ "delete\0"
126 /* 1656 */ "Generate an RSA private-public key pair\0"
127 /* 1696 */ "GENERATE_RSA\0"
128 /* 1709 */ "generate-rsa\0"
129 /* 1722 */ "GENERATE_DSA\0"
130 /* 1735 */ "generate-dsa\0"
131 /* 1748 */ "GENERATE_ECC\0"
132 /* 1761 */ "generate-ecc\0"
133 /* 1774 */ "Sets a label for the write operation\0"
134 /* 1811 */ "LABEL\0"
135 /* 1817 */ "label\0"
136 /* 1823 */ "Marks the object to be written as trusted\0"
137 /* 1865 */ "TRUSTED\0"
138 /* 1873 */ "no-trusted\0"
139 /* 1884 */ "no\0"
140 /* 1887 */ "Marks the object to be written as private\0"
141 /* 1929 */ "PRIVATE\0"
142 /* 1937 */ "no-private\0"
143 /* 1948 */ "Force login to token\0"
144 /* 1969 */ "LOGIN\0"
145 /* 1975 */ "no-login\0"
146 /* 1984 */ "Print detailed URLs\0"
147 /* 2004 */ "DETAILED_URL\0"
148 /* 2017 */ "no-detailed-url\0"
149 /* 2033 */ "Provide a hex encoded secret key\0"
150 /* 2066 */ "SECRET_KEY\0"
151 /* 2077 */ "secret-key\0"
152 /* 2088 */ "Private key file to use\0"
153 /* 2112 */ "LOAD_PRIVKEY\0"
154 /* 2125 */ "load-privkey\0"
155 /* 2138 */ "Public key file to use\0"
156 /* 2161 */ "LOAD_PUBKEY\0"
157 /* 2173 */ "load-pubkey\0"
158 /* 2185 */ "Certificate file to use\0"
159 /* 2209 */ "LOAD_CERTIFICATE\0"
160 /* 2226 */ "load-certificate\0"
161 /* 2243 */ "Use PKCS #8 format for private keys\0"
162 /* 2279 */ "PKCS8\0"
163 /* 2285 */ "pkcs8\0"
164 /* 2291 */ "Specify the number of bits for key generate\0"
165 /* 2335 */ "BITS\0"
166 /* 2340 */ "bits\0"
167 /* 2345 */ "Specify the security level\0"
168 /* 2372 */ "SEC_PARAM\0"
169 /* 2382 */ "sec-param\0"
170 /* 2392 */ "Use DER/RAW format for input\0"
171 /* 2421 */ "INDER\0"
172 /* 2427 */ "no-inder\0"
173 /* 2436 */ "This is an alias for 'inder'\0"
174 /* 2465 */ "inraw\0"
175 /* 2471 */ "Specify the PKCS #11 provider library\0"
176 /* 2509 */ "PROVIDER\0"
177 /* 2518 */ "provider\0"
178 /* 2527 */ "Display extended usage information and exit\0"
179 /* 2571 */ "help\0"
180 /* 2576 */ "Extended usage information passed thru pager\0"
181 /* 2621 */ "more-help\0"
182 /* 2631 */ "Output version information and exit\0"
183 /* 2667 */ "version\0"
184 /* 2675 */ "P11TOOL\0"
185 /* 2683 */ "p11tool - GnuTLS PKCS #11 tool - Ver. @VERSION@\n"
186 "USAGE: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [url]\n\0"
187 /* 2795 */ "bug-gnutls@gnu.org\0"
188 /* 2814 */ "\n\n\0"
189 /* 2817 */ "\n"
190 "Program that allows handling data from PKCS #11 smart cards and security\n"
191 "modules.\n\n"
192 "To use PKCS #11 tokens with gnutls the configuration file\n"
193 "/etc/gnutls/pkcs11.conf has to exist and contain a number of lines of the\n"
194 "form 'load=/usr/lib/opensc-pkcs11.so'.\n\0"
195 /* 3073 */ "p11tool @VERSION@\0"
196 /* 3091 */ "p11tool [options] [url]\n"
197 "p11tool --help for usage instructions.\n";
200 * debug option description:
202 #define DEBUG_DESC (p11tool_opt_strs+881)
203 #define DEBUG_NAME (p11tool_opt_strs+899)
204 #define DEBUG_name (p11tool_opt_strs+905)
205 #define DEBUG_FLAGS (OPTST_DISABLED \
206 | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
209 * outfile option description:
211 #define OUTFILE_DESC (p11tool_opt_strs+911)
212 #define OUTFILE_NAME (p11tool_opt_strs+923)
213 #define OUTFILE_name (p11tool_opt_strs+931)
214 #define OUTFILE_FLAGS (OPTST_DISABLED \
215 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
218 * list-tokens option description:
220 #define LIST_TOKENS_DESC (p11tool_opt_strs+939)
221 #define LIST_TOKENS_NAME (p11tool_opt_strs+965)
222 #define LIST_TOKENS_name (p11tool_opt_strs+977)
223 #define LIST_TOKENS_FLAGS (OPTST_DISABLED)
226 * export option description:
228 #define EXPORT_DESC (p11tool_opt_strs+989)
229 #define EXPORT_NAME (p11tool_opt_strs+1028)
230 #define EXPORT_name (p11tool_opt_strs+1035)
231 #define EXPORT_FLAGS (OPTST_DISABLED)
234 * list-mechanisms option description:
236 #define LIST_MECHANISMS_DESC (p11tool_opt_strs+1042)
237 #define LIST_MECHANISMS_NAME (p11tool_opt_strs+1083)
238 #define LIST_MECHANISMS_name (p11tool_opt_strs+1099)
239 #define LIST_MECHANISMS_FLAGS (OPTST_DISABLED)
242 * list-all option description:
244 #define LIST_ALL_DESC (p11tool_opt_strs+1115)
245 #define LIST_ALL_NAME (p11tool_opt_strs+1153)
246 #define LIST_ALL_name (p11tool_opt_strs+1162)
247 #define LIST_ALL_FLAGS (OPTST_DISABLED)
250 * list-all-certs option description:
252 #define LIST_ALL_CERTS_DESC (p11tool_opt_strs+1171)
253 #define LIST_ALL_CERTS_NAME (p11tool_opt_strs+1214)
254 #define LIST_ALL_CERTS_name (p11tool_opt_strs+1229)
255 #define LIST_ALL_CERTS_FLAGS (OPTST_DISABLED)
258 * list-certs option description:
260 #define LIST_CERTS_DESC (p11tool_opt_strs+1244)
261 #define LIST_CERTS_NAME (p11tool_opt_strs+1302)
262 #define LIST_CERTS_name (p11tool_opt_strs+1313)
263 #define LIST_CERTS_FLAGS (OPTST_DISABLED)
266 * list-all-privkeys option description:
268 #define LIST_ALL_PRIVKEYS_DESC (p11tool_opt_strs+1324)
269 #define LIST_ALL_PRIVKEYS_NAME (p11tool_opt_strs+1367)
270 #define LIST_ALL_PRIVKEYS_name (p11tool_opt_strs+1385)
271 #define LIST_ALL_PRIVKEYS_FLAGS (OPTST_DISABLED)
274 * list-all-trusted option description:
276 #define LIST_ALL_TRUSTED_DESC (p11tool_opt_strs+1403)
277 #define LIST_ALL_TRUSTED_NAME (p11tool_opt_strs+1453)
278 #define LIST_ALL_TRUSTED_name (p11tool_opt_strs+1470)
279 #define LIST_ALL_TRUSTED_FLAGS (OPTST_DISABLED)
282 * initialize option description:
284 #define INITIALIZE_DESC (p11tool_opt_strs+1487)
285 #define INITIALIZE_NAME (p11tool_opt_strs+1516)
286 #define INITIALIZE_name (p11tool_opt_strs+1527)
287 #define INITIALIZE_FLAGS (OPTST_DISABLED)
290 * write option description:
292 #define WRITE_DESC (p11tool_opt_strs+1538)
293 #define WRITE_NAME (p11tool_opt_strs+1584)
294 #define WRITE_name (p11tool_opt_strs+1590)
295 #define WRITE_FLAGS (OPTST_DISABLED)
298 * delete option description:
300 #define DELETE_DESC (p11tool_opt_strs+1596)
301 #define DELETE_NAME (p11tool_opt_strs+1642)
302 #define DELETE_name (p11tool_opt_strs+1649)
303 #define DELETE_FLAGS (OPTST_DISABLED)
306 * generate-rsa option description:
308 #define GENERATE_RSA_DESC (p11tool_opt_strs+1656)
309 #define GENERATE_RSA_NAME (p11tool_opt_strs+1696)
310 #define GENERATE_RSA_name (p11tool_opt_strs+1709)
311 #define GENERATE_RSA_FLAGS (OPTST_DISABLED)
314 * generate-dsa option description:
316 #define GENERATE_DSA_DESC (p11tool_opt_strs+1656)
317 #define GENERATE_DSA_NAME (p11tool_opt_strs+1722)
318 #define GENERATE_DSA_name (p11tool_opt_strs+1735)
319 #define GENERATE_DSA_FLAGS (OPTST_DISABLED)
322 * generate-ecc option description:
324 #define GENERATE_ECC_DESC (p11tool_opt_strs+1656)
325 #define GENERATE_ECC_NAME (p11tool_opt_strs+1748)
326 #define GENERATE_ECC_name (p11tool_opt_strs+1761)
327 #define GENERATE_ECC_FLAGS (OPTST_DISABLED)
330 * label option description:
332 #define LABEL_DESC (p11tool_opt_strs+1774)
333 #define LABEL_NAME (p11tool_opt_strs+1811)
334 #define LABEL_name (p11tool_opt_strs+1817)
335 #define LABEL_FLAGS (OPTST_DISABLED \
336 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
339 * trusted option description:
341 #define TRUSTED_DESC (p11tool_opt_strs+1823)
342 #define TRUSTED_NAME (p11tool_opt_strs+1865)
343 #define NOT_TRUSTED_name (p11tool_opt_strs+1873)
344 #define NOT_TRUSTED_PFX (p11tool_opt_strs+1884)
345 #define TRUSTED_name (NOT_TRUSTED_name + 3)
346 #define TRUSTED_FLAGS (OPTST_DISABLED)
349 * private option description:
351 #define PRIVATE_DESC (p11tool_opt_strs+1887)
352 #define PRIVATE_NAME (p11tool_opt_strs+1929)
353 #define NOT_PRIVATE_name (p11tool_opt_strs+1937)
354 #define NOT_PRIVATE_PFX (p11tool_opt_strs+1884)
355 #define PRIVATE_name (NOT_PRIVATE_name + 3)
356 #define PRIVATE_FLAGS (OPTST_INITENABLED)
359 * login option description:
361 #define LOGIN_DESC (p11tool_opt_strs+1948)
362 #define LOGIN_NAME (p11tool_opt_strs+1969)
363 #define NOT_LOGIN_name (p11tool_opt_strs+1975)
364 #define NOT_LOGIN_PFX (p11tool_opt_strs+1884)
365 #define LOGIN_name (NOT_LOGIN_name + 3)
366 #define LOGIN_FLAGS (OPTST_DISABLED)
369 * detailed-url option description:
371 #define DETAILED_URL_DESC (p11tool_opt_strs+1984)
372 #define DETAILED_URL_NAME (p11tool_opt_strs+2004)
373 #define NOT_DETAILED_URL_name (p11tool_opt_strs+2017)
374 #define NOT_DETAILED_URL_PFX (p11tool_opt_strs+1884)
375 #define DETAILED_URL_name (NOT_DETAILED_URL_name + 3)
376 #define DETAILED_URL_FLAGS (OPTST_DISABLED)
379 * secret-key option description:
381 #define SECRET_KEY_DESC (p11tool_opt_strs+2033)
382 #define SECRET_KEY_NAME (p11tool_opt_strs+2066)
383 #define SECRET_KEY_name (p11tool_opt_strs+2077)
384 #define SECRET_KEY_FLAGS (OPTST_DISABLED \
385 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
388 * load-privkey option description:
390 #define LOAD_PRIVKEY_DESC (p11tool_opt_strs+2088)
391 #define LOAD_PRIVKEY_NAME (p11tool_opt_strs+2112)
392 #define LOAD_PRIVKEY_name (p11tool_opt_strs+2125)
393 #define LOAD_PRIVKEY_FLAGS (OPTST_DISABLED \
394 | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
397 * load-pubkey option description:
399 #define LOAD_PUBKEY_DESC (p11tool_opt_strs+2138)
400 #define LOAD_PUBKEY_NAME (p11tool_opt_strs+2161)
401 #define LOAD_PUBKEY_name (p11tool_opt_strs+2173)
402 #define LOAD_PUBKEY_FLAGS (OPTST_DISABLED \
403 | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
406 * load-certificate option description:
408 #define LOAD_CERTIFICATE_DESC (p11tool_opt_strs+2185)
409 #define LOAD_CERTIFICATE_NAME (p11tool_opt_strs+2209)
410 #define LOAD_CERTIFICATE_name (p11tool_opt_strs+2226)
411 #define LOAD_CERTIFICATE_FLAGS (OPTST_DISABLED \
412 | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
415 * pkcs8 option description:
417 #define PKCS8_DESC (p11tool_opt_strs+2243)
418 #define PKCS8_NAME (p11tool_opt_strs+2279)
419 #define PKCS8_name (p11tool_opt_strs+2285)
420 #define PKCS8_FLAGS (OPTST_DISABLED)
423 * bits option description:
425 #define BITS_DESC (p11tool_opt_strs+2291)
426 #define BITS_NAME (p11tool_opt_strs+2335)
427 #define BITS_name (p11tool_opt_strs+2340)
428 #define BITS_FLAGS (OPTST_DISABLED \
429 | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
432 * sec-param option description:
434 #define SEC_PARAM_DESC (p11tool_opt_strs+2345)
435 #define SEC_PARAM_NAME (p11tool_opt_strs+2372)
436 #define SEC_PARAM_name (p11tool_opt_strs+2382)
437 #define SEC_PARAM_FLAGS (OPTST_DISABLED \
438 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
441 * inder option description:
443 #define INDER_DESC (p11tool_opt_strs+2392)
444 #define INDER_NAME (p11tool_opt_strs+2421)
445 #define NOT_INDER_name (p11tool_opt_strs+2427)
446 #define NOT_INDER_PFX (p11tool_opt_strs+1884)
447 #define INDER_name (NOT_INDER_name + 3)
448 #define INDER_FLAGS (OPTST_DISABLED)
451 * inraw option description:
453 #define INRAW_DESC (p11tool_opt_strs+2436)
454 #define INRAW_NAME NULL
455 #define INRAW_name (p11tool_opt_strs+2465)
456 #define INRAW_FLAGS (INDER_FLAGS | OPTST_ALIAS)
459 * provider option description:
461 #define PROVIDER_DESC (p11tool_opt_strs+2471)
462 #define PROVIDER_NAME (p11tool_opt_strs+2509)
463 #define PROVIDER_name (p11tool_opt_strs+2518)
464 #define PROVIDER_FLAGS (OPTST_DISABLED \
465 | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
468 * Help/More_Help/Version option descriptions:
470 #define HELP_DESC (p11tool_opt_strs+2527)
471 #define HELP_name (p11tool_opt_strs+2571)
472 #ifdef HAVE_WORKING_FORK
473 #define MORE_HELP_DESC (p11tool_opt_strs+2576)
474 #define MORE_HELP_name (p11tool_opt_strs+2621)
475 #define MORE_HELP_FLAGS (OPTST_IMM | OPTST_NO_INIT)
476 #else
477 #define MORE_HELP_DESC NULL
478 #define MORE_HELP_name NULL
479 #define MORE_HELP_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
480 #endif
481 #ifdef NO_OPTIONAL_OPT_ARGS
482 # define VER_FLAGS (OPTST_IMM | OPTST_NO_INIT)
483 #else
484 # define VER_FLAGS (OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \
485 OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT)
486 #endif
487 #define VER_DESC (p11tool_opt_strs+2631)
488 #define VER_name (p11tool_opt_strs+2667)
490 * Declare option callback procedures
492 extern tOptProc
493 optionBooleanVal, optionNestedVal, optionNumericVal,
494 optionPagedUsage, optionPrintVersion, optionResetOpt,
495 optionStackArg, optionTimeDate, optionTimeVal,
496 optionUnstackArg, optionVendorOption;
497 static tOptProc
498 doOptDebug, doOptInraw, doOptLoad_Certificate,
499 doOptLoad_Privkey, doOptLoad_Pubkey, doOptProvider,
500 doUsageOpt;
501 #define VER_PROC optionPrintVersion
503 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
505 * Define the p11tool Option Descriptions.
506 * This is an array of OPTION_CT entries, one for each
507 * option that the p11tool program responds to.
509 static tOptDesc optDesc[OPTION_CT] = {
510 { /* entry idx, value */ 0, VALUE_OPT_DEBUG,
511 /* equiv idx, value */ 0, VALUE_OPT_DEBUG,
512 /* equivalenced to */ NO_EQUIVALENT,
513 /* min, max, act ct */ 0, 1, 0,
514 /* opt state flags */ DEBUG_FLAGS, 0,
515 /* last opt argumnt */ { NULL }, /* --debug */
516 /* arg list/cookie */ NULL,
517 /* must/cannot opts */ NULL, NULL,
518 /* option proc */ doOptDebug,
519 /* desc, NAME, name */ DEBUG_DESC, DEBUG_NAME, DEBUG_name,
520 /* disablement strs */ NULL, NULL },
522 { /* entry idx, value */ 1, VALUE_OPT_OUTFILE,
523 /* equiv idx, value */ 1, VALUE_OPT_OUTFILE,
524 /* equivalenced to */ NO_EQUIVALENT,
525 /* min, max, act ct */ 0, 1, 0,
526 /* opt state flags */ OUTFILE_FLAGS, 0,
527 /* last opt argumnt */ { NULL }, /* --outfile */
528 /* arg list/cookie */ NULL,
529 /* must/cannot opts */ NULL, NULL,
530 /* option proc */ NULL,
531 /* desc, NAME, name */ OUTFILE_DESC, OUTFILE_NAME, OUTFILE_name,
532 /* disablement strs */ NULL, NULL },
534 { /* entry idx, value */ 2, VALUE_OPT_LIST_TOKENS,
535 /* equiv idx, value */ 2, VALUE_OPT_LIST_TOKENS,
536 /* equivalenced to */ NO_EQUIVALENT,
537 /* min, max, act ct */ 0, 1, 0,
538 /* opt state flags */ LIST_TOKENS_FLAGS, 0,
539 /* last opt argumnt */ { NULL }, /* --list-tokens */
540 /* arg list/cookie */ NULL,
541 /* must/cannot opts */ NULL, NULL,
542 /* option proc */ NULL,
543 /* desc, NAME, name */ LIST_TOKENS_DESC, LIST_TOKENS_NAME, LIST_TOKENS_name,
544 /* disablement strs */ NULL, NULL },
546 { /* entry idx, value */ 3, VALUE_OPT_EXPORT,
547 /* equiv idx, value */ 3, VALUE_OPT_EXPORT,
548 /* equivalenced to */ NO_EQUIVALENT,
549 /* min, max, act ct */ 0, 1, 0,
550 /* opt state flags */ EXPORT_FLAGS, 0,
551 /* last opt argumnt */ { NULL }, /* --export */
552 /* arg list/cookie */ NULL,
553 /* must/cannot opts */ NULL, NULL,
554 /* option proc */ NULL,
555 /* desc, NAME, name */ EXPORT_DESC, EXPORT_NAME, EXPORT_name,
556 /* disablement strs */ NULL, NULL },
558 { /* entry idx, value */ 4, VALUE_OPT_LIST_MECHANISMS,
559 /* equiv idx, value */ 4, VALUE_OPT_LIST_MECHANISMS,
560 /* equivalenced to */ NO_EQUIVALENT,
561 /* min, max, act ct */ 0, 1, 0,
562 /* opt state flags */ LIST_MECHANISMS_FLAGS, 0,
563 /* last opt argumnt */ { NULL }, /* --list-mechanisms */
564 /* arg list/cookie */ NULL,
565 /* must/cannot opts */ NULL, NULL,
566 /* option proc */ NULL,
567 /* desc, NAME, name */ LIST_MECHANISMS_DESC, LIST_MECHANISMS_NAME, LIST_MECHANISMS_name,
568 /* disablement strs */ NULL, NULL },
570 { /* entry idx, value */ 5, VALUE_OPT_LIST_ALL,
571 /* equiv idx, value */ 5, VALUE_OPT_LIST_ALL,
572 /* equivalenced to */ NO_EQUIVALENT,
573 /* min, max, act ct */ 0, 1, 0,
574 /* opt state flags */ LIST_ALL_FLAGS, 0,
575 /* last opt argumnt */ { NULL }, /* --list-all */
576 /* arg list/cookie */ NULL,
577 /* must/cannot opts */ NULL, NULL,
578 /* option proc */ NULL,
579 /* desc, NAME, name */ LIST_ALL_DESC, LIST_ALL_NAME, LIST_ALL_name,
580 /* disablement strs */ NULL, NULL },
582 { /* entry idx, value */ 6, VALUE_OPT_LIST_ALL_CERTS,
583 /* equiv idx, value */ 6, VALUE_OPT_LIST_ALL_CERTS,
584 /* equivalenced to */ NO_EQUIVALENT,
585 /* min, max, act ct */ 0, 1, 0,
586 /* opt state flags */ LIST_ALL_CERTS_FLAGS, 0,
587 /* last opt argumnt */ { NULL }, /* --list-all-certs */
588 /* arg list/cookie */ NULL,
589 /* must/cannot opts */ NULL, NULL,
590 /* option proc */ NULL,
591 /* desc, NAME, name */ LIST_ALL_CERTS_DESC, LIST_ALL_CERTS_NAME, LIST_ALL_CERTS_name,
592 /* disablement strs */ NULL, NULL },
594 { /* entry idx, value */ 7, VALUE_OPT_LIST_CERTS,
595 /* equiv idx, value */ 7, VALUE_OPT_LIST_CERTS,
596 /* equivalenced to */ NO_EQUIVALENT,
597 /* min, max, act ct */ 0, 1, 0,
598 /* opt state flags */ LIST_CERTS_FLAGS, 0,
599 /* last opt argumnt */ { NULL }, /* --list-certs */
600 /* arg list/cookie */ NULL,
601 /* must/cannot opts */ NULL, NULL,
602 /* option proc */ NULL,
603 /* desc, NAME, name */ LIST_CERTS_DESC, LIST_CERTS_NAME, LIST_CERTS_name,
604 /* disablement strs */ NULL, NULL },
606 { /* entry idx, value */ 8, VALUE_OPT_LIST_ALL_PRIVKEYS,
607 /* equiv idx, value */ 8, VALUE_OPT_LIST_ALL_PRIVKEYS,
608 /* equivalenced to */ NO_EQUIVALENT,
609 /* min, max, act ct */ 0, 1, 0,
610 /* opt state flags */ LIST_ALL_PRIVKEYS_FLAGS, 0,
611 /* last opt argumnt */ { NULL }, /* --list-all-privkeys */
612 /* arg list/cookie */ NULL,
613 /* must/cannot opts */ NULL, NULL,
614 /* option proc */ NULL,
615 /* desc, NAME, name */ LIST_ALL_PRIVKEYS_DESC, LIST_ALL_PRIVKEYS_NAME, LIST_ALL_PRIVKEYS_name,
616 /* disablement strs */ NULL, NULL },
618 { /* entry idx, value */ 9, VALUE_OPT_LIST_ALL_TRUSTED,
619 /* equiv idx, value */ 9, VALUE_OPT_LIST_ALL_TRUSTED,
620 /* equivalenced to */ NO_EQUIVALENT,
621 /* min, max, act ct */ 0, 1, 0,
622 /* opt state flags */ LIST_ALL_TRUSTED_FLAGS, 0,
623 /* last opt argumnt */ { NULL }, /* --list-all-trusted */
624 /* arg list/cookie */ NULL,
625 /* must/cannot opts */ NULL, NULL,
626 /* option proc */ NULL,
627 /* desc, NAME, name */ LIST_ALL_TRUSTED_DESC, LIST_ALL_TRUSTED_NAME, LIST_ALL_TRUSTED_name,
628 /* disablement strs */ NULL, NULL },
630 { /* entry idx, value */ 10, VALUE_OPT_INITIALIZE,
631 /* equiv idx, value */ 10, VALUE_OPT_INITIALIZE,
632 /* equivalenced to */ NO_EQUIVALENT,
633 /* min, max, act ct */ 0, 1, 0,
634 /* opt state flags */ INITIALIZE_FLAGS, 0,
635 /* last opt argumnt */ { NULL }, /* --initialize */
636 /* arg list/cookie */ NULL,
637 /* must/cannot opts */ NULL, NULL,
638 /* option proc */ NULL,
639 /* desc, NAME, name */ INITIALIZE_DESC, INITIALIZE_NAME, INITIALIZE_name,
640 /* disablement strs */ NULL, NULL },
642 { /* entry idx, value */ 11, VALUE_OPT_WRITE,
643 /* equiv idx, value */ 11, VALUE_OPT_WRITE,
644 /* equivalenced to */ NO_EQUIVALENT,
645 /* min, max, act ct */ 0, 1, 0,
646 /* opt state flags */ WRITE_FLAGS, 0,
647 /* last opt argumnt */ { NULL }, /* --write */
648 /* arg list/cookie */ NULL,
649 /* must/cannot opts */ NULL, NULL,
650 /* option proc */ NULL,
651 /* desc, NAME, name */ WRITE_DESC, WRITE_NAME, WRITE_name,
652 /* disablement strs */ NULL, NULL },
654 { /* entry idx, value */ 12, VALUE_OPT_DELETE,
655 /* equiv idx, value */ 12, VALUE_OPT_DELETE,
656 /* equivalenced to */ NO_EQUIVALENT,
657 /* min, max, act ct */ 0, 1, 0,
658 /* opt state flags */ DELETE_FLAGS, 0,
659 /* last opt argumnt */ { NULL }, /* --delete */
660 /* arg list/cookie */ NULL,
661 /* must/cannot opts */ NULL, NULL,
662 /* option proc */ NULL,
663 /* desc, NAME, name */ DELETE_DESC, DELETE_NAME, DELETE_name,
664 /* disablement strs */ NULL, NULL },
666 { /* entry idx, value */ 13, VALUE_OPT_GENERATE_RSA,
667 /* equiv idx, value */ 13, VALUE_OPT_GENERATE_RSA,
668 /* equivalenced to */ NO_EQUIVALENT,
669 /* min, max, act ct */ 0, 1, 0,
670 /* opt state flags */ GENERATE_RSA_FLAGS, 0,
671 /* last opt argumnt */ { NULL }, /* --generate-rsa */
672 /* arg list/cookie */ NULL,
673 /* must/cannot opts */ NULL, NULL,
674 /* option proc */ NULL,
675 /* desc, NAME, name */ GENERATE_RSA_DESC, GENERATE_RSA_NAME, GENERATE_RSA_name,
676 /* disablement strs */ NULL, NULL },
678 { /* entry idx, value */ 14, VALUE_OPT_GENERATE_DSA,
679 /* equiv idx, value */ 14, VALUE_OPT_GENERATE_DSA,
680 /* equivalenced to */ NO_EQUIVALENT,
681 /* min, max, act ct */ 0, 1, 0,
682 /* opt state flags */ GENERATE_DSA_FLAGS, 0,
683 /* last opt argumnt */ { NULL }, /* --generate-dsa */
684 /* arg list/cookie */ NULL,
685 /* must/cannot opts */ NULL, NULL,
686 /* option proc */ NULL,
687 /* desc, NAME, name */ GENERATE_DSA_DESC, GENERATE_DSA_NAME, GENERATE_DSA_name,
688 /* disablement strs */ NULL, NULL },
690 { /* entry idx, value */ 15, VALUE_OPT_GENERATE_ECC,
691 /* equiv idx, value */ 15, VALUE_OPT_GENERATE_ECC,
692 /* equivalenced to */ NO_EQUIVALENT,
693 /* min, max, act ct */ 0, 1, 0,
694 /* opt state flags */ GENERATE_ECC_FLAGS, 0,
695 /* last opt argumnt */ { NULL }, /* --generate-ecc */
696 /* arg list/cookie */ NULL,
697 /* must/cannot opts */ NULL, NULL,
698 /* option proc */ NULL,
699 /* desc, NAME, name */ GENERATE_ECC_DESC, GENERATE_ECC_NAME, GENERATE_ECC_name,
700 /* disablement strs */ NULL, NULL },
702 { /* entry idx, value */ 16, VALUE_OPT_LABEL,
703 /* equiv idx, value */ 16, VALUE_OPT_LABEL,
704 /* equivalenced to */ NO_EQUIVALENT,
705 /* min, max, act ct */ 0, 1, 0,
706 /* opt state flags */ LABEL_FLAGS, 0,
707 /* last opt argumnt */ { NULL }, /* --label */
708 /* arg list/cookie */ NULL,
709 /* must/cannot opts */ NULL, NULL,
710 /* option proc */ NULL,
711 /* desc, NAME, name */ LABEL_DESC, LABEL_NAME, LABEL_name,
712 /* disablement strs */ NULL, NULL },
714 { /* entry idx, value */ 17, VALUE_OPT_TRUSTED,
715 /* equiv idx, value */ 17, VALUE_OPT_TRUSTED,
716 /* equivalenced to */ NO_EQUIVALENT,
717 /* min, max, act ct */ 0, 1, 0,
718 /* opt state flags */ TRUSTED_FLAGS, 0,
719 /* last opt argumnt */ { NULL }, /* --trusted */
720 /* arg list/cookie */ NULL,
721 /* must/cannot opts */ NULL, NULL,
722 /* option proc */ NULL,
723 /* desc, NAME, name */ TRUSTED_DESC, TRUSTED_NAME, TRUSTED_name,
724 /* disablement strs */ NOT_TRUSTED_name, NOT_TRUSTED_PFX },
726 { /* entry idx, value */ 18, VALUE_OPT_PRIVATE,
727 /* equiv idx, value */ 18, VALUE_OPT_PRIVATE,
728 /* equivalenced to */ NO_EQUIVALENT,
729 /* min, max, act ct */ 0, 1, 0,
730 /* opt state flags */ PRIVATE_FLAGS, 0,
731 /* last opt argumnt */ { NULL }, /* --private */
732 /* arg list/cookie */ NULL,
733 /* must/cannot opts */ NULL, NULL,
734 /* option proc */ NULL,
735 /* desc, NAME, name */ PRIVATE_DESC, PRIVATE_NAME, PRIVATE_name,
736 /* disablement strs */ NOT_PRIVATE_name, NOT_PRIVATE_PFX },
738 { /* entry idx, value */ 19, VALUE_OPT_LOGIN,
739 /* equiv idx, value */ 19, VALUE_OPT_LOGIN,
740 /* equivalenced to */ NO_EQUIVALENT,
741 /* min, max, act ct */ 0, 1, 0,
742 /* opt state flags */ LOGIN_FLAGS, 0,
743 /* last opt argumnt */ { NULL }, /* --login */
744 /* arg list/cookie */ NULL,
745 /* must/cannot opts */ NULL, NULL,
746 /* option proc */ NULL,
747 /* desc, NAME, name */ LOGIN_DESC, LOGIN_NAME, LOGIN_name,
748 /* disablement strs */ NOT_LOGIN_name, NOT_LOGIN_PFX },
750 { /* entry idx, value */ 20, VALUE_OPT_DETAILED_URL,
751 /* equiv idx, value */ 20, VALUE_OPT_DETAILED_URL,
752 /* equivalenced to */ NO_EQUIVALENT,
753 /* min, max, act ct */ 0, 1, 0,
754 /* opt state flags */ DETAILED_URL_FLAGS, 0,
755 /* last opt argumnt */ { NULL }, /* --detailed-url */
756 /* arg list/cookie */ NULL,
757 /* must/cannot opts */ NULL, NULL,
758 /* option proc */ NULL,
759 /* desc, NAME, name */ DETAILED_URL_DESC, DETAILED_URL_NAME, DETAILED_URL_name,
760 /* disablement strs */ NOT_DETAILED_URL_name, NOT_DETAILED_URL_PFX },
762 { /* entry idx, value */ 21, VALUE_OPT_SECRET_KEY,
763 /* equiv idx, value */ 21, VALUE_OPT_SECRET_KEY,
764 /* equivalenced to */ NO_EQUIVALENT,
765 /* min, max, act ct */ 0, 1, 0,
766 /* opt state flags */ SECRET_KEY_FLAGS, 0,
767 /* last opt argumnt */ { NULL }, /* --secret-key */
768 /* arg list/cookie */ NULL,
769 /* must/cannot opts */ NULL, NULL,
770 /* option proc */ NULL,
771 /* desc, NAME, name */ SECRET_KEY_DESC, SECRET_KEY_NAME, SECRET_KEY_name,
772 /* disablement strs */ NULL, NULL },
774 { /* entry idx, value */ 22, VALUE_OPT_LOAD_PRIVKEY,
775 /* equiv idx, value */ 22, VALUE_OPT_LOAD_PRIVKEY,
776 /* equivalenced to */ NO_EQUIVALENT,
777 /* min, max, act ct */ 0, 1, 0,
778 /* opt state flags */ LOAD_PRIVKEY_FLAGS, 0,
779 /* last opt argumnt */ { NULL }, /* --load-privkey */
780 /* arg list/cookie */ NULL,
781 /* must/cannot opts */ NULL, NULL,
782 /* option proc */ doOptLoad_Privkey,
783 /* desc, NAME, name */ LOAD_PRIVKEY_DESC, LOAD_PRIVKEY_NAME, LOAD_PRIVKEY_name,
784 /* disablement strs */ NULL, NULL },
786 { /* entry idx, value */ 23, VALUE_OPT_LOAD_PUBKEY,
787 /* equiv idx, value */ 23, VALUE_OPT_LOAD_PUBKEY,
788 /* equivalenced to */ NO_EQUIVALENT,
789 /* min, max, act ct */ 0, 1, 0,
790 /* opt state flags */ LOAD_PUBKEY_FLAGS, 0,
791 /* last opt argumnt */ { NULL }, /* --load-pubkey */
792 /* arg list/cookie */ NULL,
793 /* must/cannot opts */ NULL, NULL,
794 /* option proc */ doOptLoad_Pubkey,
795 /* desc, NAME, name */ LOAD_PUBKEY_DESC, LOAD_PUBKEY_NAME, LOAD_PUBKEY_name,
796 /* disablement strs */ NULL, NULL },
798 { /* entry idx, value */ 24, VALUE_OPT_LOAD_CERTIFICATE,
799 /* equiv idx, value */ 24, VALUE_OPT_LOAD_CERTIFICATE,
800 /* equivalenced to */ NO_EQUIVALENT,
801 /* min, max, act ct */ 0, 1, 0,
802 /* opt state flags */ LOAD_CERTIFICATE_FLAGS, 0,
803 /* last opt argumnt */ { NULL }, /* --load-certificate */
804 /* arg list/cookie */ NULL,
805 /* must/cannot opts */ NULL, NULL,
806 /* option proc */ doOptLoad_Certificate,
807 /* desc, NAME, name */ LOAD_CERTIFICATE_DESC, LOAD_CERTIFICATE_NAME, LOAD_CERTIFICATE_name,
808 /* disablement strs */ NULL, NULL },
810 { /* entry idx, value */ 25, VALUE_OPT_PKCS8,
811 /* equiv idx, value */ 25, VALUE_OPT_PKCS8,
812 /* equivalenced to */ NO_EQUIVALENT,
813 /* min, max, act ct */ 0, 1, 0,
814 /* opt state flags */ PKCS8_FLAGS, 0,
815 /* last opt argumnt */ { NULL }, /* --pkcs8 */
816 /* arg list/cookie */ NULL,
817 /* must/cannot opts */ NULL, NULL,
818 /* option proc */ NULL,
819 /* desc, NAME, name */ PKCS8_DESC, PKCS8_NAME, PKCS8_name,
820 /* disablement strs */ NULL, NULL },
822 { /* entry idx, value */ 26, VALUE_OPT_BITS,
823 /* equiv idx, value */ 26, VALUE_OPT_BITS,
824 /* equivalenced to */ NO_EQUIVALENT,
825 /* min, max, act ct */ 0, 1, 0,
826 /* opt state flags */ BITS_FLAGS, 0,
827 /* last opt argumnt */ { NULL }, /* --bits */
828 /* arg list/cookie */ NULL,
829 /* must/cannot opts */ NULL, NULL,
830 /* option proc */ optionNumericVal,
831 /* desc, NAME, name */ BITS_DESC, BITS_NAME, BITS_name,
832 /* disablement strs */ NULL, NULL },
834 { /* entry idx, value */ 27, VALUE_OPT_SEC_PARAM,
835 /* equiv idx, value */ 27, VALUE_OPT_SEC_PARAM,
836 /* equivalenced to */ NO_EQUIVALENT,
837 /* min, max, act ct */ 0, 1, 0,
838 /* opt state flags */ SEC_PARAM_FLAGS, 0,
839 /* last opt argumnt */ { NULL }, /* --sec-param */
840 /* arg list/cookie */ NULL,
841 /* must/cannot opts */ NULL, NULL,
842 /* option proc */ NULL,
843 /* desc, NAME, name */ SEC_PARAM_DESC, SEC_PARAM_NAME, SEC_PARAM_name,
844 /* disablement strs */ NULL, NULL },
846 { /* entry idx, value */ 28, VALUE_OPT_INDER,
847 /* equiv idx, value */ 28, VALUE_OPT_INDER,
848 /* equivalenced to */ NO_EQUIVALENT,
849 /* min, max, act ct */ 0, 1, 0,
850 /* opt state flags */ INDER_FLAGS, 0,
851 /* last opt argumnt */ { NULL }, /* --inder */
852 /* arg list/cookie */ NULL,
853 /* must/cannot opts */ NULL, NULL,
854 /* option proc */ NULL,
855 /* desc, NAME, name */ INDER_DESC, INDER_NAME, INDER_name,
856 /* disablement strs */ NOT_INDER_name, NOT_INDER_PFX },
858 { /* entry idx, value */ 29, VALUE_OPT_INRAW,
859 /* equiv idx, value */ 29, VALUE_OPT_INRAW,
860 /* equivalenced to */ NO_EQUIVALENT,
861 /* min, max, act ct */ 0, 1, 0,
862 /* opt state flags */ INRAW_FLAGS, 0,
863 /* last opt argumnt */ { NULL }, /* --inraw */
864 /* arg list/cookie */ NULL,
865 /* must/cannot opts */ NULL, NULL,
866 /* option proc */ doOptInraw,
867 /* desc, NAME, name */ INRAW_DESC, INRAW_NAME, INRAW_name,
868 /* disablement strs */ 0, 0 },
870 { /* entry idx, value */ 30, VALUE_OPT_PROVIDER,
871 /* equiv idx, value */ 30, VALUE_OPT_PROVIDER,
872 /* equivalenced to */ NO_EQUIVALENT,
873 /* min, max, act ct */ 0, 1, 0,
874 /* opt state flags */ PROVIDER_FLAGS, 0,
875 /* last opt argumnt */ { NULL }, /* --provider */
876 /* arg list/cookie */ NULL,
877 /* must/cannot opts */ NULL, NULL,
878 /* option proc */ doOptProvider,
879 /* desc, NAME, name */ PROVIDER_DESC, PROVIDER_NAME, PROVIDER_name,
880 /* disablement strs */ NULL, NULL },
882 { /* entry idx, value */ INDEX_OPT_VERSION, VALUE_OPT_VERSION,
883 /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_VERSION,
884 /* equivalenced to */ NO_EQUIVALENT,
885 /* min, max, act ct */ 0, 1, 0,
886 /* opt state flags */ VER_FLAGS, 0,
887 /* last opt argumnt */ { NULL },
888 /* arg list/cookie */ NULL,
889 /* must/cannot opts */ NULL, NULL,
890 /* option proc */ VER_PROC,
891 /* desc, NAME, name */ VER_DESC, NULL, VER_name,
892 /* disablement strs */ NULL, NULL },
896 { /* entry idx, value */ INDEX_OPT_HELP, VALUE_OPT_HELP,
897 /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_HELP,
898 /* equivalenced to */ NO_EQUIVALENT,
899 /* min, max, act ct */ 0, 1, 0,
900 /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, 0,
901 /* last opt argumnt */ { NULL },
902 /* arg list/cookie */ NULL,
903 /* must/cannot opts */ NULL, NULL,
904 /* option proc */ doUsageOpt,
905 /* desc, NAME, name */ HELP_DESC, NULL, HELP_name,
906 /* disablement strs */ NULL, NULL },
908 { /* entry idx, value */ INDEX_OPT_MORE_HELP, VALUE_OPT_MORE_HELP,
909 /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_MORE_HELP,
910 /* equivalenced to */ NO_EQUIVALENT,
911 /* min, max, act ct */ 0, 1, 0,
912 /* opt state flags */ MORE_HELP_FLAGS, 0,
913 /* last opt argumnt */ { NULL },
914 /* arg list/cookie */ NULL,
915 /* must/cannot opts */ NULL, NULL,
916 /* option proc */ optionPagedUsage,
917 /* desc, NAME, name */ MORE_HELP_DESC, NULL, MORE_HELP_name,
918 /* disablement strs */ NULL, NULL }
922 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
924 * Define the p11tool Option Environment
926 #define zPROGNAME (p11tool_opt_strs+2675)
927 #define zUsageTitle (p11tool_opt_strs+2683)
928 #define zRcName NULL
929 #define apzHomeList NULL
930 #define zBugsAddr (p11tool_opt_strs+2795)
931 #define zExplain (p11tool_opt_strs+2814)
932 #define zDetail (p11tool_opt_strs+2817)
933 #define zFullVersion (p11tool_opt_strs+3073)
934 /* extracted from optcode.tlib near line 350 */
936 #if defined(ENABLE_NLS)
937 # define OPTPROC_BASE OPTPROC_TRANSLATE | OPTPROC_NXLAT_OPT
938 static tOptionXlateProc translate_option_strings;
939 #else
940 # define OPTPROC_BASE OPTPROC_NONE
941 # define translate_option_strings NULL
942 #endif /* ENABLE_NLS */
945 #define p11tool_full_usage (NULL)
947 #define p11tool_short_usage (p11tool_opt_strs+3091)
949 #endif /* not defined __doxygen__ */
952 * Create the static procedure(s) declared above.
955 * The callout function that invokes the optionUsage function.
957 * @param pOptions the AutoOpts option description structure
958 * @param pOptDesc the descriptor for the "help" (usage) option.
959 * @noreturn
961 static void
962 doUsageOpt(tOptions * pOptions, tOptDesc * pOptDesc)
964 optionUsage(&p11toolOptions, P11TOOL_EXIT_SUCCESS);
965 /* NOTREACHED */
966 (void)pOptDesc;
967 (void)pOptions;
970 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
972 * Code to handle the debug option.
974 * @param pOptions the p11tool options data structure
975 * @param pOptDesc the option descriptor for this option.
977 static void
978 doOptDebug(tOptions* pOptions, tOptDesc* pOptDesc)
980 static struct {long rmin, rmax;} const rng[1] = {
981 { 0 , 9999 } };
982 int ix;
984 if (pOptions <= OPTPROC_EMIT_LIMIT)
985 goto emit_ranges;
986 optionNumericVal(pOptions, pOptDesc);
988 for (ix = 0; ix < 1; ix++) {
989 if (pOptDesc->optArg.argInt < rng[ix].rmin)
990 continue; /* ranges need not be ordered. */
991 if (pOptDesc->optArg.argInt == rng[ix].rmin)
992 return;
993 if (rng[ix].rmax == LONG_MIN)
994 continue;
995 if (pOptDesc->optArg.argInt <= rng[ix].rmax)
996 return;
999 option_usage_fp = stderr;
1001 emit_ranges:
1003 optionShowRange(pOptions, pOptDesc, (void *)rng, 1);
1006 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1008 * Code to handle the load-privkey option.
1010 * @param pOptions the p11tool options data structure
1011 * @param pOptDesc the option descriptor for this option.
1013 static void
1014 doOptLoad_Privkey(tOptions* pOptions, tOptDesc* pOptDesc)
1016 static teOptFileType const type =
1017 FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN;
1018 static tuFileMode mode;
1019 #ifndef O_CLOEXEC
1020 # define O_CLOEXEC 0
1021 #endif
1022 mode.file_flags = O_CLOEXEC;
1024 optionFileCheck(pOptions, pOptDesc, type, mode);
1027 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1029 * Code to handle the load-pubkey option.
1031 * @param pOptions the p11tool options data structure
1032 * @param pOptDesc the option descriptor for this option.
1034 static void
1035 doOptLoad_Pubkey(tOptions* pOptions, tOptDesc* pOptDesc)
1037 static teOptFileType const type =
1038 FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN;
1039 static tuFileMode mode;
1040 #ifndef O_CLOEXEC
1041 # define O_CLOEXEC 0
1042 #endif
1043 mode.file_flags = O_CLOEXEC;
1045 optionFileCheck(pOptions, pOptDesc, type, mode);
1048 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1050 * Code to handle the load-certificate option.
1052 * @param pOptions the p11tool options data structure
1053 * @param pOptDesc the option descriptor for this option.
1055 static void
1056 doOptLoad_Certificate(tOptions* pOptions, tOptDesc* pOptDesc)
1058 static teOptFileType const type =
1059 FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN;
1060 static tuFileMode mode;
1061 #ifndef O_CLOEXEC
1062 # define O_CLOEXEC 0
1063 #endif
1064 mode.file_flags = O_CLOEXEC;
1066 optionFileCheck(pOptions, pOptDesc, type, mode);
1069 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1071 * Code to handle the inraw option.
1073 * @param pOptions the p11tool options data structure
1074 * @param pOptDesc the option descriptor for this option.
1076 static void
1077 doOptInraw(tOptions* pOptions, tOptDesc* pOptDesc)
1079 int res = optionAlias(pOptions, pOptDesc, INDEX_OPT_INDER);
1080 if ((res != 0) && ((pOptions->fOptSet & OPTPROC_ERRSTOP) != 0))
1081 USAGE(P11TOOL_EXIT_FAILURE);
1085 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1087 * Code to handle the provider option.
1089 * @param pOptions the p11tool options data structure
1090 * @param pOptDesc the option descriptor for this option.
1092 static void
1093 doOptProvider(tOptions* pOptions, tOptDesc* pOptDesc)
1095 static teOptFileType const type =
1096 FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN;
1097 static tuFileMode mode;
1098 #ifndef O_CLOEXEC
1099 # define O_CLOEXEC 0
1100 #endif
1101 mode.file_flags = O_CLOEXEC;
1103 optionFileCheck(pOptions, pOptDesc, type, mode);
1105 /* extracted from optmain.tlib near line 1113 */
1108 * The directory containing the data associated with p11tool.
1110 #ifndef PKGDATADIR
1111 # define PKGDATADIR ""
1112 #endif
1115 * Information about the person or institution that packaged p11tool
1116 * for the current distribution.
1118 #ifndef WITH_PACKAGER
1119 # define p11tool_packager_info NULL
1120 #else
1121 static char const p11tool_packager_info[] =
1122 "Packaged by " WITH_PACKAGER
1124 # ifdef WITH_PACKAGER_VERSION
1125 " ("WITH_PACKAGER_VERSION")"
1126 # endif
1128 # ifdef WITH_PACKAGER_BUG_REPORTS
1129 "\nReport p11tool bugs to " WITH_PACKAGER_BUG_REPORTS
1130 # endif
1131 "\n";
1132 #endif
1133 #ifndef __doxygen__
1135 #endif /* __doxygen__ */
1137 * The option definitions for p11tool. The one structure that
1138 * binds them all.
1140 tOptions p11toolOptions = {
1141 OPTIONS_STRUCT_VERSION,
1142 0, NULL, /* original argc + argv */
1143 ( OPTPROC_BASE
1144 + OPTPROC_ERRSTOP
1145 + OPTPROC_SHORTOPT
1146 + OPTPROC_LONGOPT
1147 + OPTPROC_NO_REQ_OPT
1148 + OPTPROC_NEGATIONS
1149 + OPTPROC_REORDER
1150 + OPTPROC_GNUUSAGE
1151 + OPTPROC_MISUSE ),
1152 0, NULL, /* current option index, current option */
1153 NULL, NULL, zPROGNAME,
1154 zRcName, zCopyright, zLicenseDescrip,
1155 zFullVersion, apzHomeList, zUsageTitle,
1156 zExplain, zDetail, optDesc,
1157 zBugsAddr, /* address to send bugs to */
1158 NULL, NULL, /* extensions/saved state */
1159 optionUsage, /* usage procedure */
1160 translate_option_strings, /* translation procedure */
1162 * Indexes to special options
1164 { INDEX_OPT_MORE_HELP, /* more-help option index */
1165 NO_EQUIVALENT, /* save option index */
1166 NO_EQUIVALENT, /* '-#' option index */
1167 NO_EQUIVALENT /* index of default opt */
1169 34 /* full option count */, 31 /* user option count */,
1170 p11tool_full_usage, p11tool_short_usage,
1171 NULL, NULL,
1172 PKGDATADIR, p11tool_packager_info
1175 #if ENABLE_NLS
1176 #include <stdio.h>
1177 #include <stdlib.h>
1178 #include <string.h>
1179 #include <unistd.h>
1180 #include <autoopts/usage-txt.h>
1182 static char* AO_gettext(char const* pz);
1183 static void coerce_it(void** s);
1186 * AutoGen specific wrapper function for gettext.
1187 * It relies on the macro _() to convert from English to the target
1188 * language, then strdup-duplicates the result string.
1190 * @param[in] pz the input text used as a lookup key.
1191 * @returns the translated text (if there is one),
1192 * or the original text (if not).
1194 static char *
1195 AO_gettext(char const* pz)
1197 char* pzRes;
1198 if (pz == NULL)
1199 return NULL;
1200 pzRes = _(pz);
1201 if (pzRes == pz)
1202 return pzRes;
1203 pzRes = strdup(pzRes);
1204 if (pzRes == NULL) {
1205 fputs(_("No memory for duping translated strings\n"), stderr);
1206 exit(P11TOOL_EXIT_FAILURE);
1208 return pzRes;
1211 static void coerce_it(void** s) { *s = AO_gettext(*s);
1215 * Translate all the translatable strings in the p11toolOptions
1216 * structure defined above. This is done only once.
1218 static void
1219 translate_option_strings(void)
1221 tOptions * const pOpt = &p11toolOptions;
1224 * Guard against re-translation. It won't work. The strings will have
1225 * been changed by the first pass through this code. One shot only.
1227 if (option_usage_text.field_ct != 0) {
1229 * Do the translations. The first pointer follows the field count
1230 * field. The field count field is the size of a pointer.
1232 tOptDesc * pOD = pOpt->pOptDesc;
1233 char ** ppz = (char**)(void*)&(option_usage_text);
1234 int ix = option_usage_text.field_ct;
1236 do {
1237 ppz++;
1238 *ppz = AO_gettext(*ppz);
1239 } while (--ix > 0);
1241 coerce_it((void*)&(pOpt->pzCopyright));
1242 coerce_it((void*)&(pOpt->pzCopyNotice));
1243 coerce_it((void*)&(pOpt->pzFullVersion));
1244 coerce_it((void*)&(pOpt->pzUsageTitle));
1245 coerce_it((void*)&(pOpt->pzExplain));
1246 coerce_it((void*)&(pOpt->pzDetail));
1247 coerce_it((void*)&(pOpt->pzPackager));
1248 coerce_it((void*)&(pOpt->pzShortUsage));
1249 option_usage_text.field_ct = 0;
1251 for (ix = pOpt->optCt; ix > 0; ix--, pOD++)
1252 coerce_it((void*)&(pOD->pzText));
1255 if ((pOpt->fOptSet & OPTPROC_NXLAT_OPT_CFG) == 0) {
1256 tOptDesc * pOD = pOpt->pOptDesc;
1257 int ix;
1259 for (ix = pOpt->optCt; ix > 0; ix--, pOD++) {
1260 coerce_it((void*)&(pOD->pz_Name));
1261 coerce_it((void*)&(pOD->pz_DisableName));
1262 coerce_it((void*)&(pOD->pz_DisablePfx));
1264 /* prevent re-translation */
1265 p11toolOptions.fOptSet |= OPTPROC_NXLAT_OPT_CFG | OPTPROC_NXLAT_OPT;
1269 #endif /* ENABLE_NLS */
1271 #ifdef __cplusplus
1273 #endif
1274 /* p11tool-args.c ends here */