4 * EDIT THIS FILE WITH CAUTION (ntp-keygen-opts.c)
6 * It has been AutoGen-ed December 10, 2009 at 05:08:21 AM by AutoGen 5.10
7 * From the definitions ntp-keygen-opts.def
8 * and the template file options
10 * Generated from AutoOpts 33:0:8 templates.
14 * This file was produced by an AutoOpts template. AutoOpts is a
15 * copyrighted work. This source file is not encumbered by AutoOpts
16 * licensing, but is provided under the licensing terms chosen by the
17 * ntp-keygen author or copyright holder. AutoOpts is licensed under
18 * the terms of the LGPL. The redistributable library (``libopts'') is
19 * licensed under the terms of either the LGPL or, at the users discretion,
20 * the BSD license. See the AutoOpts and/or libopts sources for details.
22 * This source file is copyrighted and licensed under the following terms:
24 * ntp-keygen copyright (c) 1970-2009 David L. Mills and/or others - all rights reserved
26 * see html/copyright.html
29 #include <sys/types.h>
34 extern FILE * option_usage_fp
;
35 #define OPTION_CODE_COMPILE 1
36 #include "ntp-keygen-opts.h"
42 /* TRANSLATORS: choose the translation for option names wisely because you
43 cannot ever change your mind. */
45 "ntp-keygen copyright (c) 1970-2009 David L. Mills and/or others, all rights reserved"
46 /* extracted from ../include/copyright.def near line 8 */
48 tSCC zCopyrightNotice
[24] =
49 "see html/copyright.html";
51 extern tUsageProc optionUsage
;
54 * global included definitions
58 extern int atoi(const char*);
67 # define EXIT_SUCCESS 0
70 # define EXIT_FAILURE 1
74 * Certificate option description:
77 tSCC zCertificateText
[] =
79 tSCC zCertificate_NAME
[] = "CERTIFICATE";
80 tSCC zCertificate_Name
[] = "certificate";
81 #define CERTIFICATE_FLAGS (OPTST_DISABLED \
82 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
84 #else /* disable Certificate */
85 #define CERTIFICATE_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
86 #define zCertificate_NAME NULL
87 #define zCertificateText NULL
88 #define zCertificate_Name NULL
92 * Debug_Level option description:
94 tSCC zDebug_LevelText
[] =
95 "Increase output debug message level";
96 tSCC zDebug_Level_NAME
[] = "DEBUG_LEVEL";
97 tSCC zDebug_Level_Name
[] = "debug-level";
98 #define DEBUG_LEVEL_FLAGS (OPTST_DISABLED)
101 * Set_Debug_Level option description:
103 tSCC zSet_Debug_LevelText
[] =
104 "Set the output debug message level";
105 tSCC zSet_Debug_Level_NAME
[] = "SET_DEBUG_LEVEL";
106 tSCC zSet_Debug_Level_Name
[] = "set-debug-level";
107 #define SET_DEBUG_LEVEL_FLAGS (OPTST_DISABLED \
108 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
111 * Id_Key option description:
115 "Write IFF or GQ identity keys";
116 tSCC zId_Key_NAME
[] = "ID_KEY";
117 tSCC zId_Key_Name
[] = "id-key";
118 #define ID_KEY_FLAGS (OPTST_DISABLED)
120 #else /* disable Id_Key */
121 #define ID_KEY_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
122 #define zId_Key_NAME NULL
123 #define zId_KeyText NULL
124 #define zId_Key_Name NULL
128 * Gq_Params option description:
131 tSCC zGq_ParamsText
[] =
132 "Generate GQ parameters and keys";
133 tSCC zGq_Params_NAME
[] = "GQ_PARAMS";
134 tSCC zGq_Params_Name
[] = "gq-params";
135 #define GQ_PARAMS_FLAGS (OPTST_DISABLED)
137 #else /* disable Gq_Params */
138 #define GQ_PARAMS_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
139 #define zGq_Params_NAME NULL
140 #define zGq_ParamsText NULL
141 #define zGq_Params_Name NULL
145 * Host_Key option description:
148 tSCC zHost_KeyText
[] =
149 "generate RSA host key";
150 tSCC zHost_Key_NAME
[] = "HOST_KEY";
151 tSCC zHost_Key_Name
[] = "host-key";
152 #define HOST_KEY_FLAGS (OPTST_DISABLED)
154 #else /* disable Host_Key */
155 #define HOST_KEY_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
156 #define zHost_Key_NAME NULL
157 #define zHost_KeyText NULL
158 #define zHost_Key_Name NULL
162 * Iffkey option description:
166 "generate IFF parameters";
167 tSCC zIffkey_NAME
[] = "IFFKEY";
168 tSCC zIffkey_Name
[] = "iffkey";
169 #define IFFKEY_FLAGS (OPTST_DISABLED)
171 #else /* disable Iffkey */
172 #define IFFKEY_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
173 #define zIffkey_NAME NULL
174 #define zIffkeyText NULL
175 #define zIffkey_Name NULL
179 * Issuer_Name option description:
182 tSCC zIssuer_NameText
[] =
184 tSCC zIssuer_Name_NAME
[] = "ISSUER_NAME";
185 tSCC zIssuer_Name_Name
[] = "issuer-name";
186 #define ISSUER_NAME_FLAGS (OPTST_DISABLED \
187 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
189 #else /* disable Issuer_Name */
190 #define ISSUER_NAME_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
191 #define zIssuer_Name_NAME NULL
192 #define zIssuer_NameText NULL
193 #define zIssuer_Name_Name NULL
197 * Md5key option description:
201 tSCC zMd5key_NAME
[] = "MD5KEY";
202 tSCC zMd5key_Name
[] = "md5key";
203 #define MD5KEY_FLAGS (OPTST_DISABLED)
206 * Modulus option description:
209 tSCC zModulusText
[] =
211 tSCC zModulus_NAME
[] = "MODULUS";
212 tSCC zModulus_Name
[] = "modulus";
213 #define MODULUS_FLAGS (OPTST_DISABLED \
214 | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
216 #else /* disable Modulus */
217 #define MODULUS_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
218 #define zModulus_NAME NULL
219 #define zModulusText NULL
220 #define zModulus_Name NULL
224 * Pvt_Cert option description:
227 tSCC zPvt_CertText
[] =
228 "generate PC private certificate";
229 tSCC zPvt_Cert_NAME
[] = "PVT_CERT";
230 tSCC zPvt_Cert_Name
[] = "pvt-cert";
231 #define PVT_CERT_FLAGS (OPTST_DISABLED)
233 #else /* disable Pvt_Cert */
234 #define PVT_CERT_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
235 #define zPvt_Cert_NAME NULL
236 #define zPvt_CertText NULL
237 #define zPvt_Cert_Name NULL
241 * Pvt_Passwd option description:
244 tSCC zPvt_PasswdText
[] =
245 "output private password";
246 tSCC zPvt_Passwd_NAME
[] = "PVT_PASSWD";
247 tSCC zPvt_Passwd_Name
[] = "pvt-passwd";
248 #define PVT_PASSWD_FLAGS (OPTST_DISABLED \
249 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
251 #else /* disable Pvt_Passwd */
252 #define PVT_PASSWD_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
253 #define zPvt_Passwd_NAME NULL
254 #define zPvt_PasswdText NULL
255 #define zPvt_Passwd_Name NULL
259 * Get_Pvt_Passwd option description:
262 tSCC zGet_Pvt_PasswdText
[] =
263 "input private password";
264 tSCC zGet_Pvt_Passwd_NAME
[] = "GET_PVT_PASSWD";
265 tSCC zGet_Pvt_Passwd_Name
[] = "get-pvt-passwd";
266 #define GET_PVT_PASSWD_FLAGS (OPTST_DISABLED \
267 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
269 #else /* disable Get_Pvt_Passwd */
270 #define GET_PVT_PASSWD_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
271 #define zGet_Pvt_Passwd_NAME NULL
272 #define zGet_Pvt_PasswdText NULL
273 #define zGet_Pvt_Passwd_Name NULL
277 * Sign_Key option description:
280 tSCC zSign_KeyText
[] =
281 "generate sign key (RSA or DSA)";
282 tSCC zSign_Key_NAME
[] = "SIGN_KEY";
283 tSCC zSign_Key_Name
[] = "sign-key";
284 #define SIGN_KEY_FLAGS (OPTST_DISABLED \
285 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
287 #else /* disable Sign_Key */
288 #define SIGN_KEY_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
289 #define zSign_Key_NAME NULL
290 #define zSign_KeyText NULL
291 #define zSign_Key_Name NULL
295 * Subject_Name option description:
298 tSCC zSubject_NameText
[] =
300 tSCC zSubject_Name_NAME
[] = "SUBJECT_NAME";
301 tSCC zSubject_Name_Name
[] = "subject-name";
302 #define SUBJECT_NAME_FLAGS (OPTST_DISABLED \
303 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
305 #else /* disable Subject_Name */
306 #define SUBJECT_NAME_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
307 #define zSubject_Name_NAME NULL
308 #define zSubject_NameText NULL
309 #define zSubject_Name_Name NULL
313 * Trusted_Cert option description:
316 tSCC zTrusted_CertText
[] =
317 "trusted certificate (TC scheme)";
318 tSCC zTrusted_Cert_NAME
[] = "TRUSTED_CERT";
319 tSCC zTrusted_Cert_Name
[] = "trusted-cert";
320 #define TRUSTED_CERT_FLAGS (OPTST_DISABLED)
322 #else /* disable Trusted_Cert */
323 #define TRUSTED_CERT_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
324 #define zTrusted_Cert_NAME NULL
325 #define zTrusted_CertText NULL
326 #define zTrusted_Cert_Name NULL
330 * Mv_Params option description:
333 tSCC zMv_ParamsText
[] =
334 "generate <num> MV parameters";
335 tSCC zMv_Params_NAME
[] = "MV_PARAMS";
336 tSCC zMv_Params_Name
[] = "mv-params";
337 #define MV_PARAMS_FLAGS (OPTST_DISABLED \
338 | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
340 #else /* disable Mv_Params */
341 #define MV_PARAMS_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
342 #define zMv_Params_NAME NULL
343 #define zMv_ParamsText NULL
344 #define zMv_Params_Name NULL
348 * Mv_Keys option description:
351 tSCC zMv_KeysText
[] =
352 "update <num> MV keys";
353 tSCC zMv_Keys_NAME
[] = "MV_KEYS";
354 tSCC zMv_Keys_Name
[] = "mv-keys";
355 #define MV_KEYS_FLAGS (OPTST_DISABLED \
356 | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
358 #else /* disable Mv_Keys */
359 #define MV_KEYS_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
360 #define zMv_Keys_NAME NULL
361 #define zMv_KeysText NULL
362 #define zMv_Keys_Name NULL
366 * Help/More_Help/Version option descriptions:
368 tSCC zHelpText
[] = "Display extended usage information and exit";
369 tSCC zHelp_Name
[] = "help";
370 #ifdef HAVE_WORKING_FORK
371 #define OPTST_MORE_HELP_FLAGS (OPTST_IMM | OPTST_NO_INIT)
372 tSCC zMore_Help_Name
[] = "more-help";
373 tSCC zMore_HelpText
[] = "Extended usage information passed thru pager";
375 #define OPTST_MORE_HELP_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
376 #define zMore_Help_Name NULL
377 #define zMore_HelpText NULL
379 #ifdef NO_OPTIONAL_OPT_ARGS
380 # define OPTST_VERSION_FLAGS OPTST_IMM | OPTST_NO_INIT
382 # define OPTST_VERSION_FLAGS OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \
383 OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT
386 tSCC zVersionText
[] = "Output version information and exit";
387 tSCC zVersion_Name
[] = "version";
388 tSCC zSave_OptsText
[] = "Save the option state to a config file";
389 tSCC zSave_Opts_Name
[] = "save-opts";
390 tSCC zLoad_OptsText
[] = "Load options from a config file";
391 tSCC zLoad_Opts_NAME
[] = "LOAD_OPTS";
392 tSCC zNotLoad_Opts_Name
[] = "no-load-opts";
393 tSCC zNotLoad_Opts_Pfx
[] = "no";
394 #define zLoad_Opts_Name (zNotLoad_Opts_Name + 3)
396 * Declare option callback procedures
399 static tOptProc doOptModulus
;
400 #else /* not OPENSSL */
401 # define doOptModulus NULL
402 #endif /* def/not OPENSSL */
404 extern tOptProc optionNumericVal
;
405 #else /* not OPENSSL */
406 # define optionNumericVal NULL
407 #endif /* def/not OPENSSL */
409 extern tOptProc optionNumericVal
;
410 #else /* not OPENSSL */
411 # define optionNumericVal NULL
412 #endif /* def/not OPENSSL */
413 #if defined(TEST_NTP_KEYGEN_OPTS)
415 * Under test, omit argument processing, or call optionStackArg,
416 * if multiple copies are allowed.
419 optionNumericVal
, optionPagedUsage
, optionVersionStderr
;
421 doOptModulus
, doUsageOpt
;
424 * #define map the "normal" callout procs to the test ones...
426 #define SET_DEBUG_LEVEL_OPT_PROC optionStackArg
429 #else /* NOT defined TEST_NTP_KEYGEN_OPTS */
431 * When not under test, there are different procs to use
434 optionPagedUsage
, optionPrintVersion
;
436 doOptSet_Debug_Level
, doUsageOpt
;
439 * #define map the "normal" callout procs
441 #define SET_DEBUG_LEVEL_OPT_PROC doOptSet_Debug_Level
443 #define SET_DEBUG_LEVEL_OPT_PROC doOptSet_Debug_Level
444 #endif /* defined(TEST_NTP_KEYGEN_OPTS) */
445 #ifdef TEST_NTP_KEYGEN_OPTS
446 # define DOVERPROC optionVersionStderr
448 # define DOVERPROC optionPrintVersion
449 #endif /* TEST_NTP_KEYGEN_OPTS */
451 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
453 * Define the Ntp_Keygen Option Descriptions.
455 static tOptDesc optDesc
[ OPTION_CT
] = {
456 { /* entry idx, value */ 0, VALUE_OPT_CERTIFICATE
,
457 /* equiv idx, value */ 0, VALUE_OPT_CERTIFICATE
,
458 /* equivalenced to */ NO_EQUIVALENT
,
459 /* min, max, act ct */ 0, 1, 0,
460 /* opt state flags */ CERTIFICATE_FLAGS
, 0,
461 /* last opt argumnt */ { NULL
},
462 /* arg list/cookie */ NULL
,
463 /* must/cannot opts */ NULL
, NULL
,
464 /* option proc */ NULL
,
465 /* desc, NAME, name */ zCertificateText
, zCertificate_NAME
, zCertificate_Name
,
466 /* disablement strs */ NULL
, NULL
},
468 { /* entry idx, value */ 1, VALUE_OPT_DEBUG_LEVEL
,
469 /* equiv idx, value */ 1, VALUE_OPT_DEBUG_LEVEL
,
470 /* equivalenced to */ NO_EQUIVALENT
,
471 /* min, max, act ct */ 0, NOLIMIT
, 0,
472 /* opt state flags */ DEBUG_LEVEL_FLAGS
, 0,
473 /* last opt argumnt */ { NULL
},
474 /* arg list/cookie */ NULL
,
475 /* must/cannot opts */ NULL
, NULL
,
476 /* option proc */ NULL
,
477 /* desc, NAME, name */ zDebug_LevelText
, zDebug_Level_NAME
, zDebug_Level_Name
,
478 /* disablement strs */ NULL
, NULL
},
480 { /* entry idx, value */ 2, VALUE_OPT_SET_DEBUG_LEVEL
,
481 /* equiv idx, value */ 2, VALUE_OPT_SET_DEBUG_LEVEL
,
482 /* equivalenced to */ NO_EQUIVALENT
,
483 /* min, max, act ct */ 0, NOLIMIT
, 0,
484 /* opt state flags */ SET_DEBUG_LEVEL_FLAGS
, 0,
485 /* last opt argumnt */ { NULL
},
486 /* arg list/cookie */ NULL
,
487 /* must/cannot opts */ NULL
, NULL
,
488 /* option proc */ SET_DEBUG_LEVEL_OPT_PROC
,
489 /* desc, NAME, name */ zSet_Debug_LevelText
, zSet_Debug_Level_NAME
, zSet_Debug_Level_Name
,
490 /* disablement strs */ NULL
, NULL
},
492 { /* entry idx, value */ 3, VALUE_OPT_ID_KEY
,
493 /* equiv idx, value */ 3, VALUE_OPT_ID_KEY
,
494 /* equivalenced to */ NO_EQUIVALENT
,
495 /* min, max, act ct */ 0, 1, 0,
496 /* opt state flags */ ID_KEY_FLAGS
, 0,
497 /* last opt argumnt */ { NULL
},
498 /* arg list/cookie */ NULL
,
499 /* must/cannot opts */ NULL
, NULL
,
500 /* option proc */ NULL
,
501 /* desc, NAME, name */ zId_KeyText
, zId_Key_NAME
, zId_Key_Name
,
502 /* disablement strs */ NULL
, NULL
},
504 { /* entry idx, value */ 4, VALUE_OPT_GQ_PARAMS
,
505 /* equiv idx, value */ 4, VALUE_OPT_GQ_PARAMS
,
506 /* equivalenced to */ NO_EQUIVALENT
,
507 /* min, max, act ct */ 0, 1, 0,
508 /* opt state flags */ GQ_PARAMS_FLAGS
, 0,
509 /* last opt argumnt */ { NULL
},
510 /* arg list/cookie */ NULL
,
511 /* must/cannot opts */ NULL
, NULL
,
512 /* option proc */ NULL
,
513 /* desc, NAME, name */ zGq_ParamsText
, zGq_Params_NAME
, zGq_Params_Name
,
514 /* disablement strs */ NULL
, NULL
},
516 { /* entry idx, value */ 5, VALUE_OPT_HOST_KEY
,
517 /* equiv idx, value */ 5, VALUE_OPT_HOST_KEY
,
518 /* equivalenced to */ NO_EQUIVALENT
,
519 /* min, max, act ct */ 0, 1, 0,
520 /* opt state flags */ HOST_KEY_FLAGS
, 0,
521 /* last opt argumnt */ { NULL
},
522 /* arg list/cookie */ NULL
,
523 /* must/cannot opts */ NULL
, NULL
,
524 /* option proc */ NULL
,
525 /* desc, NAME, name */ zHost_KeyText
, zHost_Key_NAME
, zHost_Key_Name
,
526 /* disablement strs */ NULL
, NULL
},
528 { /* entry idx, value */ 6, VALUE_OPT_IFFKEY
,
529 /* equiv idx, value */ 6, VALUE_OPT_IFFKEY
,
530 /* equivalenced to */ NO_EQUIVALENT
,
531 /* min, max, act ct */ 0, 1, 0,
532 /* opt state flags */ IFFKEY_FLAGS
, 0,
533 /* last opt argumnt */ { NULL
},
534 /* arg list/cookie */ NULL
,
535 /* must/cannot opts */ NULL
, NULL
,
536 /* option proc */ NULL
,
537 /* desc, NAME, name */ zIffkeyText
, zIffkey_NAME
, zIffkey_Name
,
538 /* disablement strs */ NULL
, NULL
},
540 { /* entry idx, value */ 7, VALUE_OPT_ISSUER_NAME
,
541 /* equiv idx, value */ 7, VALUE_OPT_ISSUER_NAME
,
542 /* equivalenced to */ NO_EQUIVALENT
,
543 /* min, max, act ct */ 0, 1, 0,
544 /* opt state flags */ ISSUER_NAME_FLAGS
, 0,
545 /* last opt argumnt */ { NULL
},
546 /* arg list/cookie */ NULL
,
547 /* must/cannot opts */ NULL
, NULL
,
548 /* option proc */ NULL
,
549 /* desc, NAME, name */ zIssuer_NameText
, zIssuer_Name_NAME
, zIssuer_Name_Name
,
550 /* disablement strs */ NULL
, NULL
},
552 { /* entry idx, value */ 8, VALUE_OPT_MD5KEY
,
553 /* equiv idx, value */ 8, VALUE_OPT_MD5KEY
,
554 /* equivalenced to */ NO_EQUIVALENT
,
555 /* min, max, act ct */ 0, 1, 0,
556 /* opt state flags */ MD5KEY_FLAGS
, 0,
557 /* last opt argumnt */ { NULL
},
558 /* arg list/cookie */ NULL
,
559 /* must/cannot opts */ NULL
, NULL
,
560 /* option proc */ NULL
,
561 /* desc, NAME, name */ zMd5keyText
, zMd5key_NAME
, zMd5key_Name
,
562 /* disablement strs */ NULL
, NULL
},
564 { /* entry idx, value */ 9, VALUE_OPT_MODULUS
,
565 /* equiv idx, value */ 9, VALUE_OPT_MODULUS
,
566 /* equivalenced to */ NO_EQUIVALENT
,
567 /* min, max, act ct */ 0, 1, 0,
568 /* opt state flags */ MODULUS_FLAGS
, 0,
569 /* last opt argumnt */ { NULL
},
570 /* arg list/cookie */ NULL
,
571 /* must/cannot opts */ NULL
, NULL
,
572 /* option proc */ doOptModulus
,
573 /* desc, NAME, name */ zModulusText
, zModulus_NAME
, zModulus_Name
,
574 /* disablement strs */ NULL
, NULL
},
576 { /* entry idx, value */ 10, VALUE_OPT_PVT_CERT
,
577 /* equiv idx, value */ 10, VALUE_OPT_PVT_CERT
,
578 /* equivalenced to */ NO_EQUIVALENT
,
579 /* min, max, act ct */ 0, 1, 0,
580 /* opt state flags */ PVT_CERT_FLAGS
, 0,
581 /* last opt argumnt */ { NULL
},
582 /* arg list/cookie */ NULL
,
583 /* must/cannot opts */ NULL
, NULL
,
584 /* option proc */ NULL
,
585 /* desc, NAME, name */ zPvt_CertText
, zPvt_Cert_NAME
, zPvt_Cert_Name
,
586 /* disablement strs */ NULL
, NULL
},
588 { /* entry idx, value */ 11, VALUE_OPT_PVT_PASSWD
,
589 /* equiv idx, value */ 11, VALUE_OPT_PVT_PASSWD
,
590 /* equivalenced to */ NO_EQUIVALENT
,
591 /* min, max, act ct */ 0, 1, 0,
592 /* opt state flags */ PVT_PASSWD_FLAGS
, 0,
593 /* last opt argumnt */ { NULL
},
594 /* arg list/cookie */ NULL
,
595 /* must/cannot opts */ NULL
, NULL
,
596 /* option proc */ NULL
,
597 /* desc, NAME, name */ zPvt_PasswdText
, zPvt_Passwd_NAME
, zPvt_Passwd_Name
,
598 /* disablement strs */ NULL
, NULL
},
600 { /* entry idx, value */ 12, VALUE_OPT_GET_PVT_PASSWD
,
601 /* equiv idx, value */ 12, VALUE_OPT_GET_PVT_PASSWD
,
602 /* equivalenced to */ NO_EQUIVALENT
,
603 /* min, max, act ct */ 0, 1, 0,
604 /* opt state flags */ GET_PVT_PASSWD_FLAGS
, 0,
605 /* last opt argumnt */ { NULL
},
606 /* arg list/cookie */ NULL
,
607 /* must/cannot opts */ NULL
, NULL
,
608 /* option proc */ NULL
,
609 /* desc, NAME, name */ zGet_Pvt_PasswdText
, zGet_Pvt_Passwd_NAME
, zGet_Pvt_Passwd_Name
,
610 /* disablement strs */ NULL
, NULL
},
612 { /* entry idx, value */ 13, VALUE_OPT_SIGN_KEY
,
613 /* equiv idx, value */ 13, VALUE_OPT_SIGN_KEY
,
614 /* equivalenced to */ NO_EQUIVALENT
,
615 /* min, max, act ct */ 0, 1, 0,
616 /* opt state flags */ SIGN_KEY_FLAGS
, 0,
617 /* last opt argumnt */ { NULL
},
618 /* arg list/cookie */ NULL
,
619 /* must/cannot opts */ NULL
, NULL
,
620 /* option proc */ NULL
,
621 /* desc, NAME, name */ zSign_KeyText
, zSign_Key_NAME
, zSign_Key_Name
,
622 /* disablement strs */ NULL
, NULL
},
624 { /* entry idx, value */ 14, VALUE_OPT_SUBJECT_NAME
,
625 /* equiv idx, value */ 14, VALUE_OPT_SUBJECT_NAME
,
626 /* equivalenced to */ NO_EQUIVALENT
,
627 /* min, max, act ct */ 0, 1, 0,
628 /* opt state flags */ SUBJECT_NAME_FLAGS
, 0,
629 /* last opt argumnt */ { NULL
},
630 /* arg list/cookie */ NULL
,
631 /* must/cannot opts */ NULL
, NULL
,
632 /* option proc */ NULL
,
633 /* desc, NAME, name */ zSubject_NameText
, zSubject_Name_NAME
, zSubject_Name_Name
,
634 /* disablement strs */ NULL
, NULL
},
636 { /* entry idx, value */ 15, VALUE_OPT_TRUSTED_CERT
,
637 /* equiv idx, value */ 15, VALUE_OPT_TRUSTED_CERT
,
638 /* equivalenced to */ NO_EQUIVALENT
,
639 /* min, max, act ct */ 0, 1, 0,
640 /* opt state flags */ TRUSTED_CERT_FLAGS
, 0,
641 /* last opt argumnt */ { NULL
},
642 /* arg list/cookie */ NULL
,
643 /* must/cannot opts */ NULL
, NULL
,
644 /* option proc */ NULL
,
645 /* desc, NAME, name */ zTrusted_CertText
, zTrusted_Cert_NAME
, zTrusted_Cert_Name
,
646 /* disablement strs */ NULL
, NULL
},
648 { /* entry idx, value */ 16, VALUE_OPT_MV_PARAMS
,
649 /* equiv idx, value */ 16, VALUE_OPT_MV_PARAMS
,
650 /* equivalenced to */ NO_EQUIVALENT
,
651 /* min, max, act ct */ 0, 1, 0,
652 /* opt state flags */ MV_PARAMS_FLAGS
, 0,
653 /* last opt argumnt */ { NULL
},
654 /* arg list/cookie */ NULL
,
655 /* must/cannot opts */ NULL
, NULL
,
656 /* option proc */ optionNumericVal
,
657 /* desc, NAME, name */ zMv_ParamsText
, zMv_Params_NAME
, zMv_Params_Name
,
658 /* disablement strs */ NULL
, NULL
},
660 { /* entry idx, value */ 17, VALUE_OPT_MV_KEYS
,
661 /* equiv idx, value */ 17, VALUE_OPT_MV_KEYS
,
662 /* equivalenced to */ NO_EQUIVALENT
,
663 /* min, max, act ct */ 0, 1, 0,
664 /* opt state flags */ MV_KEYS_FLAGS
, 0,
665 /* last opt argumnt */ { NULL
},
666 /* arg list/cookie */ NULL
,
667 /* must/cannot opts */ NULL
, NULL
,
668 /* option proc */ optionNumericVal
,
669 /* desc, NAME, name */ zMv_KeysText
, zMv_Keys_NAME
, zMv_Keys_Name
,
670 /* disablement strs */ NULL
, NULL
},
672 { /* entry idx, value */ INDEX_OPT_VERSION
, VALUE_OPT_VERSION
,
673 /* equiv idx value */ NO_EQUIVALENT
, 0,
674 /* equivalenced to */ NO_EQUIVALENT
,
675 /* min, max, act ct */ 0, 1, 0,
676 /* opt state flags */ OPTST_VERSION_FLAGS
, 0,
677 /* last opt argumnt */ { NULL
},
678 /* arg list/cookie */ NULL
,
679 /* must/cannot opts */ NULL
, NULL
,
680 /* option proc */ DOVERPROC
,
681 /* desc, NAME, name */ zVersionText
, NULL
, zVersion_Name
,
682 /* disablement strs */ NULL
, NULL
},
686 { /* entry idx, value */ INDEX_OPT_HELP
, VALUE_OPT_HELP
,
687 /* equiv idx value */ NO_EQUIVALENT
, 0,
688 /* equivalenced to */ NO_EQUIVALENT
,
689 /* min, max, act ct */ 0, 1, 0,
690 /* opt state flags */ OPTST_IMM
| OPTST_NO_INIT
, 0,
691 /* last opt argumnt */ { NULL
},
692 /* arg list/cookie */ NULL
,
693 /* must/cannot opts */ NULL
, NULL
,
694 /* option proc */ doUsageOpt
,
695 /* desc, NAME, name */ zHelpText
, NULL
, zHelp_Name
,
696 /* disablement strs */ NULL
, NULL
},
698 { /* entry idx, value */ INDEX_OPT_MORE_HELP
, VALUE_OPT_MORE_HELP
,
699 /* equiv idx value */ NO_EQUIVALENT
, 0,
700 /* equivalenced to */ NO_EQUIVALENT
,
701 /* min, max, act ct */ 0, 1, 0,
702 /* opt state flags */ OPTST_MORE_HELP_FLAGS
, 0,
703 /* last opt argumnt */ { NULL
},
704 /* arg list/cookie */ NULL
,
705 /* must/cannot opts */ NULL
, NULL
,
706 /* option proc */ optionPagedUsage
,
707 /* desc, NAME, name */ zMore_HelpText
, NULL
, zMore_Help_Name
,
708 /* disablement strs */ NULL
, NULL
},
710 { /* entry idx, value */ INDEX_OPT_SAVE_OPTS
, VALUE_OPT_SAVE_OPTS
,
711 /* equiv idx value */ NO_EQUIVALENT
, 0,
712 /* equivalenced to */ NO_EQUIVALENT
,
713 /* min, max, act ct */ 0, 1, 0,
714 /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING
)
715 | OPTST_ARG_OPTIONAL
| OPTST_NO_INIT
, 0,
716 /* last opt argumnt */ { NULL
},
717 /* arg list/cookie */ NULL
,
718 /* must/cannot opts */ NULL
, NULL
,
719 /* option proc */ NULL
,
720 /* desc, NAME, name */ zSave_OptsText
, NULL
, zSave_Opts_Name
,
721 /* disablement strs */ NULL
, NULL
},
723 { /* entry idx, value */ INDEX_OPT_LOAD_OPTS
, VALUE_OPT_LOAD_OPTS
,
724 /* equiv idx value */ NO_EQUIVALENT
, 0,
725 /* equivalenced to */ NO_EQUIVALENT
,
726 /* min, max, act ct */ 0, NOLIMIT
, 0,
727 /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING
)
728 | OPTST_DISABLE_IMM
, 0,
729 /* last opt argumnt */ { NULL
},
730 /* arg list/cookie */ NULL
,
731 /* must/cannot opts */ NULL
, NULL
,
732 /* option proc */ optionLoadOpt
,
733 /* desc, NAME, name */ zLoad_OptsText
, zLoad_Opts_NAME
, zLoad_Opts_Name
,
734 /* disablement strs */ zNotLoad_Opts_Name
, zNotLoad_Opts_Pfx
}
737 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
739 * Define the Ntp_Keygen Option Environment
741 tSCC zPROGNAME
[] = "NTP_KEYGEN";
743 "ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.6\n\
744 USAGE: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n";
745 tSCC zRcName
[] = ".ntprc";
746 tSCC
* apzHomeList
[] = {
751 tSCC zBugsAddr
[] = "http://bugs.ntp.org, bugs@ntp.org";
752 #define zExplain NULL
753 tSCC zDetail
[] = "\n\
754 If there is no new host key, look for an existing one.\n\
755 If one is not found, create it.\n";
756 tSCC zFullVersion
[] = NTP_KEYGEN_FULL_VERSION
;
757 /* extracted from /usr/local/gnu/share/autogen/optcode.tpl near line 495 */
759 #if defined(ENABLE_NLS)
760 # define OPTPROC_BASE OPTPROC_TRANSLATE
761 static tOptionXlateProc translate_option_strings
;
763 # define OPTPROC_BASE OPTPROC_NONE
764 # define translate_option_strings NULL
765 #endif /* ENABLE_NLS */
768 #define ntp_keygen_full_usage NULL
769 #define ntp_keygen_short_usage NULL
770 tOptions ntp_keygenOptions
= {
771 OPTIONS_STRUCT_VERSION
,
772 0, NULL
, /* original argc + argv */
780 0, NULL
, /* current option index, current option */
781 NULL
, NULL
, zPROGNAME
,
782 zRcName
, zCopyright
, zCopyrightNotice
,
783 zFullVersion
, apzHomeList
, zUsageTitle
,
784 zExplain
, zDetail
, optDesc
,
785 zBugsAddr
, /* address to send bugs to */
786 NULL
, NULL
, /* extensions/saved state */
787 optionUsage
, /* usage procedure */
788 translate_option_strings
, /* translation procedure */
790 * Indexes to special options
792 { INDEX_OPT_MORE_HELP
, /* more-help option index */
793 INDEX_OPT_SAVE_OPTS
, /* save option index */
794 NO_EQUIVALENT
, /* '-#' option index */
795 NO_EQUIVALENT
/* index of default opt */
797 23 /* full option count */, 18 /* user option count */,
798 ntp_keygen_full_usage
, ntp_keygen_short_usage
,
803 * Create the static procedure(s) declared above.
811 USAGE( EXIT_SUCCESS
);
814 #if ! defined(TEST_NTP_KEYGEN_OPTS)
816 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
818 * For the set-debug-level option.
821 doOptSet_Debug_Level(tOptions
* pOptions
, tOptDesc
* pOptDesc
)
823 /* extracted from ../include/debug-opt.def, line 27 */
824 DESC(DEBUG_LEVEL
).optOccCt
= atoi( pOptDesc
->pzLastArg
);
826 #endif /* defined(TEST_NTP_KEYGEN_OPTS) */
828 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
830 * For the modulus option, when OPENSSL is #define-d.
834 doOptModulus(tOptions
* pOptions
, tOptDesc
* pOptDesc
)
836 static const struct {long const rmin
, rmax
;} rng
[1] = {
842 if (pOptions
<= OPTPROC_EMIT_LIMIT
)
846 val
= strtol(pOptDesc
->optArg
.argString
, &pzEnd
, 0);
847 if ((pOptDesc
->optArg
.argString
== pzEnd
) || (errno
!= 0))
852 for (ix
= 0; ix
< 1; ix
++) {
853 if (val
< rng
[ix
].rmin
)
854 continue; /* ranges need not be ordered. */
855 if (val
== rng
[ix
].rmin
)
857 if (rng
[ix
].rmax
== LONG_MIN
)
859 if (val
<= rng
[ix
].rmax
)
865 option_usage_fp
= stderr
;
868 optionShowRange(pOptions
, pOptDesc
, (void *)rng
, 1);
872 if ((pOptDesc
->fOptState
& OPTST_ALLOC_ARG
) != 0) {
873 free((void *)pOptDesc
->optArg
.argString
);
874 pOptDesc
->fOptState
&= ~OPTST_ALLOC_ARG
;
876 pOptDesc
->optArg
.argInt
= val
;
878 #endif /* defined OPENSSL */
879 /* extracted from /usr/local/gnu/share/autogen/optmain.tpl near line 109 */
881 #if defined(TEST_NTP_KEYGEN_OPTS) /* TEST MAIN PROCEDURE: */
883 extern void optionPutShell( tOptions
* );
886 main(int argc
, char** argv
)
888 int res
= EXIT_SUCCESS
;
889 (void)optionProcess( &ntp_keygenOptions
, argc
, argv
);
890 optionPutShell( &ntp_keygenOptions
);
893 #endif /* defined TEST_NTP_KEYGEN_OPTS */
894 /* extracted from /usr/local/gnu/share/autogen/optcode.tpl near line 627 */
901 #include <autoopts/usage-txt.h>
903 static char* AO_gettext( char const* pz
);
904 static void coerce_it(void** s
);
907 AO_gettext( char const* pz
)
915 pzRes
= strdup( pzRes
);
917 fputs( _("No memory for duping translated strings\n"), stderr
);
918 exit( EXIT_FAILURE
);
923 static void coerce_it(void** s
) { *s
= AO_gettext(*s
); }
924 #define COERSION(_f) \
925 coerce_it((void*)&(ntp_keygenOptions._f))
928 * This invokes the translation code (e.g. gettext(3)).
931 translate_option_strings( void )
934 * Guard against re-translation. It won't work. The strings will have
935 * been changed by the first pass through this code. One shot only.
937 if (option_usage_text
.field_ct
!= 0) {
940 * Do the translations. The first pointer follows the field count
941 * field. The field count field is the size of a pointer.
943 tOptDesc
* pOD
= ntp_keygenOptions
.pOptDesc
;
944 char** ppz
= (char**)(void*)&(option_usage_text
);
945 int ix
= option_usage_text
.field_ct
;
949 *ppz
= AO_gettext(*ppz
);
952 COERSION(pzCopyright
);
953 COERSION(pzCopyNotice
);
954 COERSION(pzFullVersion
);
955 COERSION(pzUsageTitle
);
958 option_usage_text
.field_ct
= 0;
960 for (ix
= ntp_keygenOptions
.optCt
; ix
> 0; ix
--, pOD
++)
961 coerce_it((void*)&(pOD
->pzText
));
964 if ((ntp_keygenOptions
.fOptSet
& OPTPROC_NXLAT_OPT_CFG
) == 0) {
965 tOptDesc
* pOD
= ntp_keygenOptions
.pOptDesc
;
968 for (ix
= ntp_keygenOptions
.optCt
; ix
> 0; ix
--, pOD
++) {
969 coerce_it((void*)&(pOD
->pz_Name
));
970 coerce_it((void*)&(pOD
->pz_DisableName
));
971 coerce_it((void*)&(pOD
->pz_DisablePfx
));
973 /* prevent re-translation */
974 ntp_keygenOptions
.fOptSet
|= OPTPROC_NXLAT_OPT_CFG
| OPTPROC_NXLAT_OPT
;
978 #endif /* ENABLE_NLS */
983 /* ntp-keygen-opts.c ends here */