2 * EDIT THIS FILE WITH CAUTION (ntp-keygen-opts.c)
4 * It has been AutoGen-ed Tuesday December 8, 2009 at 08:14:56 AM EST
5 * From the definitions ntp-keygen-opts.def
6 * and the template file options
8 * Generated from AutoOpts 29:0:4 templates.
12 * This file was produced by an AutoOpts template. AutoOpts is a
13 * copyrighted work. This source file is not encumbered by AutoOpts
14 * licensing, but is provided under the licensing terms chosen by the
15 * ntp-keygen author or copyright holder. AutoOpts is licensed under
16 * the terms of the LGPL. The redistributable library (``libopts'') is
17 * licensed under the terms of either the LGPL or, at the users discretion,
18 * the BSD license. See the AutoOpts and/or libopts sources for details.
20 * This source file is copyrighted and licensed under the following terms:
22 * ntp-keygen copyright 1970-2009 David L. Mills and/or others - all rights reserved
24 * see html/copyright.html
30 #define OPTION_CODE_COMPILE 1
31 #include "ntp-keygen-opts.h"
37 "ntp-keygen copyright (c) 1970-2009 David L. Mills and/or others, all rights reserved";
38 tSCC zCopyrightNotice[] =
40 /* extracted from ../include/copyright.def near line 8 */
41 "see html/copyright.html";
42 extern tUsageProc optionUsage;
45 * global included definitions
49 extern int atoi(const char*);
58 # define EXIT_SUCCESS 0
61 # define EXIT_FAILURE 1
64 * Certificate option description:
67 tSCC zCertificateText[] =
69 tSCC zCertificate_NAME[] = "CERTIFICATE";
70 tSCC zCertificate_Name[] = "certificate";
71 #define CERTIFICATE_FLAGS (OPTST_DISABLED \
72 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
74 #else /* disable Certificate */
75 #define VALUE_OPT_CERTIFICATE NO_EQUIVALENT
76 #define CERTIFICATE_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
77 #define zCertificateText NULL
78 #define zCertificate_NAME NULL
79 #define zCertificate_Name NULL
83 * Debug_Level option description:
86 tSCC zDebug_LevelText[] =
87 "Increase output debug message level";
88 tSCC zDebug_Level_NAME[] = "DEBUG_LEVEL";
89 tSCC zDebug_Level_Name[] = "debug-level";
90 #define DEBUG_LEVEL_FLAGS (OPTST_DISABLED)
92 #else /* disable Debug_Level */
93 #define VALUE_OPT_DEBUG_LEVEL NO_EQUIVALENT
94 #define DEBUG_LEVEL_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
95 #define zDebug_LevelText NULL
96 #define zDebug_Level_NAME NULL
97 #define zDebug_Level_Name NULL
101 * Set_Debug_Level option description:
104 tSCC zSet_Debug_LevelText[] =
105 "Set the output debug message level";
106 tSCC zSet_Debug_Level_NAME[] = "SET_DEBUG_LEVEL";
107 tSCC zSet_Debug_Level_Name[] = "set-debug-level";
108 #define SET_DEBUG_LEVEL_FLAGS (OPTST_DISABLED \
109 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
111 #else /* disable Set_Debug_Level */
112 #define VALUE_OPT_SET_DEBUG_LEVEL NO_EQUIVALENT
113 #define SET_DEBUG_LEVEL_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
114 #define zSet_Debug_LevelText NULL
115 #define zSet_Debug_Level_NAME NULL
116 #define zSet_Debug_Level_Name NULL
120 * Id_Key option description:
124 "Write identity keys";
125 tSCC zId_Key_NAME[] = "ID_KEY";
126 tSCC zId_Key_Name[] = "id-key";
127 #define ID_KEY_FLAGS (OPTST_DISABLED)
129 #else /* disable Id_Key */
130 #define VALUE_OPT_ID_KEY NO_EQUIVALENT
131 #define ID_KEY_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
132 #define zId_KeyText NULL
133 #define zId_Key_NAME NULL
134 #define zId_Key_Name NULL
138 * Gq_Params option description:
141 tSCC zGq_ParamsText[] =
142 "Generate GQ parameters and keys";
143 tSCC zGq_Params_NAME[] = "GQ_PARAMS";
144 tSCC zGq_Params_Name[] = "gq-params";
145 #define GQ_PARAMS_FLAGS (OPTST_DISABLED)
147 #else /* disable Gq_Params */
148 #define VALUE_OPT_GQ_PARAMS NO_EQUIVALENT
149 #define GQ_PARAMS_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
150 #define zGq_ParamsText NULL
151 #define zGq_Params_NAME NULL
152 #define zGq_Params_Name NULL
156 * Gq_Keys option description:
159 tSCC zGq_KeysText[] =
161 tSCC zGq_Keys_NAME[] = "GQ_KEYS";
162 tSCC zGq_Keys_Name[] = "gq-keys";
163 #define GQ_KEYS_FLAGS (OPTST_DISABLED)
165 #else /* disable Gq_Keys */
166 #define VALUE_OPT_GQ_KEYS NO_EQUIVALENT
167 #define GQ_KEYS_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
168 #define zGq_KeysText NULL
169 #define zGq_Keys_NAME NULL
170 #define zGq_Keys_Name NULL
174 * Host_Key option description:
177 tSCC zHost_KeyText[] =
178 "generate RSA host key";
179 tSCC zHost_Key_NAME[] = "HOST_KEY";
180 tSCC zHost_Key_Name[] = "host-key";
181 #define HOST_KEY_FLAGS (OPTST_DISABLED)
183 #else /* disable Host_Key */
184 #define VALUE_OPT_HOST_KEY NO_EQUIVALENT
185 #define HOST_KEY_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
186 #define zHost_KeyText NULL
187 #define zHost_Key_NAME NULL
188 #define zHost_Key_Name NULL
192 * Iffkey option description:
196 "generate IFF parameters";
197 tSCC zIffkey_NAME[] = "IFFKEY";
198 tSCC zIffkey_Name[] = "iffkey";
199 #define IFFKEY_FLAGS (OPTST_DISABLED)
201 #else /* disable Iffkey */
202 #define VALUE_OPT_IFFKEY NO_EQUIVALENT
203 #define IFFKEY_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
204 #define zIffkeyText NULL
205 #define zIffkey_NAME NULL
206 #define zIffkey_Name NULL
210 * Issuer_Name option description:
213 tSCC zIssuer_NameText[] =
215 tSCC zIssuer_Name_NAME[] = "ISSUER_NAME";
216 tSCC zIssuer_Name_Name[] = "issuer-name";
217 #define ISSUER_NAME_FLAGS (OPTST_DISABLED)
219 #else /* disable Issuer_Name */
220 #define VALUE_OPT_ISSUER_NAME NO_EQUIVALENT
221 #define ISSUER_NAME_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
222 #define zIssuer_NameText NULL
223 #define zIssuer_Name_NAME NULL
224 #define zIssuer_Name_Name NULL
228 * Md5key option description:
232 tSCC zMd5key_NAME[] = "MD5KEY";
233 tSCC zMd5key_Name[] = "md5key";
234 #define MD5KEY_FLAGS (OPTST_DISABLED)
237 * Modulus option description:
240 tSCC zModulusText[] =
242 tSCC zModulus_NAME[] = "MODULUS";
243 tSCC zModulus_Name[] = "modulus";
244 #define MODULUS_FLAGS (OPTST_DISABLED \
245 | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
247 #else /* disable Modulus */
248 #define VALUE_OPT_MODULUS NO_EQUIVALENT
249 #define MODULUS_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
250 #define zModulusText NULL
251 #define zModulus_NAME NULL
252 #define zModulus_Name NULL
256 * Pvt_Cert option description:
259 tSCC zPvt_CertText[] =
260 "generate PC private certificate";
261 tSCC zPvt_Cert_NAME[] = "PVT_CERT";
262 tSCC zPvt_Cert_Name[] = "pvt-cert";
263 #define PVT_CERT_FLAGS (OPTST_DISABLED)
265 #else /* disable Pvt_Cert */
266 #define VALUE_OPT_PVT_CERT NO_EQUIVALENT
267 #define PVT_CERT_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
268 #define zPvt_CertText NULL
269 #define zPvt_Cert_NAME NULL
270 #define zPvt_Cert_Name NULL
274 * Pvt_Passwd option description:
277 tSCC zPvt_PasswdText[] =
278 "output private password";
279 tSCC zPvt_Passwd_NAME[] = "PVT_PASSWD";
280 tSCC zPvt_Passwd_Name[] = "pvt-passwd";
281 #define PVT_PASSWD_FLAGS (OPTST_DISABLED \
282 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
284 #else /* disable Pvt_Passwd */
285 #define VALUE_OPT_PVT_PASSWD NO_EQUIVALENT
286 #define PVT_PASSWD_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
287 #define zPvt_PasswdText NULL
288 #define zPvt_Passwd_NAME NULL
289 #define zPvt_Passwd_Name NULL
293 * Get_Pvt_Passwd option description:
296 tSCC zGet_Pvt_PasswdText[] =
297 "input private password";
298 tSCC zGet_Pvt_Passwd_NAME[] = "GET_PVT_PASSWD";
299 tSCC zGet_Pvt_Passwd_Name[] = "get-pvt-passwd";
300 #define GET_PVT_PASSWD_FLAGS (OPTST_DISABLED \
301 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
303 #else /* disable Get_Pvt_Passwd */
304 #define VALUE_OPT_GET_PVT_PASSWD NO_EQUIVALENT
305 #define GET_PVT_PASSWD_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
306 #define zGet_Pvt_PasswdText NULL
307 #define zGet_Pvt_Passwd_NAME NULL
308 #define zGet_Pvt_Passwd_Name NULL
312 * Sign_Key option description:
315 tSCC zSign_KeyText[] =
316 "generate sign key (RSA or DSA)";
317 tSCC zSign_Key_NAME[] = "SIGN_KEY";
318 tSCC zSign_Key_Name[] = "sign-key";
319 #define SIGN_KEY_FLAGS (OPTST_DISABLED \
320 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
322 #else /* disable Sign_Key */
323 #define VALUE_OPT_SIGN_KEY NO_EQUIVALENT
324 #define SIGN_KEY_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
325 #define zSign_KeyText NULL
326 #define zSign_Key_NAME NULL
327 #define zSign_Key_Name NULL
331 * Subject_Name option description:
334 tSCC zSubject_NameText[] =
336 tSCC zSubject_Name_NAME[] = "SUBJECT_NAME";
337 tSCC zSubject_Name_Name[] = "subject-name";
338 #define SUBJECT_NAME_FLAGS (OPTST_DISABLED \
339 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
341 #else /* disable Subject_Name */
342 #define VALUE_OPT_SUBJECT_NAME NO_EQUIVALENT
343 #define SUBJECT_NAME_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
344 #define zSubject_NameText NULL
345 #define zSubject_Name_NAME NULL
346 #define zSubject_Name_Name NULL
350 * Trusted_Cert option description:
353 tSCC zTrusted_CertText[] =
354 "trusted certificate (TC scheme)";
355 tSCC zTrusted_Cert_NAME[] = "TRUSTED_CERT";
356 tSCC zTrusted_Cert_Name[] = "trusted-cert";
357 #define TRUSTED_CERT_FLAGS (OPTST_DISABLED)
359 #else /* disable Trusted_Cert */
360 #define VALUE_OPT_TRUSTED_CERT NO_EQUIVALENT
361 #define TRUSTED_CERT_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
362 #define zTrusted_CertText NULL
363 #define zTrusted_Cert_NAME NULL
364 #define zTrusted_Cert_Name NULL
368 * Mv_Params option description:
371 tSCC zMv_ParamsText[] =
372 "generate <num> MV parameters";
373 tSCC zMv_Params_NAME[] = "MV_PARAMS";
374 tSCC zMv_Params_Name[] = "mv-params";
375 #define MV_PARAMS_FLAGS (OPTST_DISABLED \
376 | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
378 #else /* disable Mv_Params */
379 #define VALUE_OPT_MV_PARAMS NO_EQUIVALENT
380 #define MV_PARAMS_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
381 #define zMv_ParamsText NULL
382 #define zMv_Params_NAME NULL
383 #define zMv_Params_Name NULL
387 * Mv_Keys option description:
390 tSCC zMv_KeysText[] =
391 "update <num> MV keys";
392 tSCC zMv_Keys_NAME[] = "MV_KEYS";
393 tSCC zMv_Keys_Name[] = "mv-keys";
394 #define MV_KEYS_FLAGS (OPTST_DISABLED \
395 | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
397 #else /* disable Mv_Keys */
398 #define VALUE_OPT_MV_KEYS NO_EQUIVALENT
399 #define MV_KEYS_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
400 #define zMv_KeysText NULL
401 #define zMv_Keys_NAME NULL
402 #define zMv_Keys_Name NULL
406 * Help/More_Help/Version option descriptions:
408 tSCC zHelpText[] = "Display usage information and exit";
409 tSCC zHelp_Name[] = "help";
411 tSCC zMore_HelpText[] = "Extended usage information passed thru pager";
412 tSCC zMore_Help_Name[] = "more-help";
414 tSCC zVersionText[] = "Output version information and exit";
415 tSCC zVersion_Name[] = "version";
418 * Save/Load_Opts option description:
420 tSCC zSave_OptsText[] = "Save the option state to a config file";
421 tSCC zSave_Opts_Name[] = "save-opts";
423 tSCC zLoad_OptsText[] = "Load options from a config file";
424 tSCC zLoad_Opts_NAME[] = "LOAD_OPTS";
426 tSCC zNotLoad_Opts_Name[] = "no-load-opts";
427 tSCC zNotLoad_Opts_Pfx[] = "no";
428 #define zLoad_Opts_Name (zNotLoad_Opts_Name + 3)
430 * Declare option callback procedures
433 static tOptProc doOptSet_Debug_Level;
434 #else /* not DEBUG */
435 # define doOptSet_Debug_Level NULL
436 #endif /* def/not DEBUG */
438 static tOptProc doOptModulus;
439 #else /* not OPENSSL */
440 # define doOptModulus NULL
441 #endif /* def/not OPENSSL */
443 extern tOptProc optionNumericVal;
444 #else /* not OPENSSL */
445 # define optionNumericVal NULL
446 #endif /* def/not OPENSSL */
448 extern tOptProc optionNumericVal;
449 #else /* not OPENSSL */
450 # define optionNumericVal NULL
451 #endif /* def/not OPENSSL */
452 #if defined(TEST_NTP_KEYGEN_OPTS)
454 * Under test, omit argument processing, or call optionStackArg,
455 * if multiple copies are allowed.
458 optionNumericVal, optionPagedUsage, optionVersionStderr;
460 doOptModulus, doUsageOpt;
463 * #define map the "normal" callout procs to the test ones...
465 #define SET_DEBUG_LEVEL_OPT_PROC optionStackArg
468 #else /* NOT defined TEST_NTP_KEYGEN_OPTS */
470 * When not under test, there are different procs to use
473 optionPagedUsage, optionPrintVersion;
478 * #define map the "normal" callout procs
480 #define SET_DEBUG_LEVEL_OPT_PROC doOptSet_Debug_Level
482 #define SET_DEBUG_LEVEL_OPT_PROC doOptSet_Debug_Level
483 #endif /* defined(TEST_NTP_KEYGEN_OPTS) */
484 #ifdef TEST_NTP_KEYGEN_OPTS
485 # define DOVERPROC optionVersionStderr
487 # define DOVERPROC optionPrintVersion
488 #endif /* TEST_NTP_KEYGEN_OPTS */
490 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
492 * Define the Ntp_Keygen Option Descriptions.
494 static tOptDesc optDesc[ OPTION_CT ] = {
495 { /* entry idx, value */ 0, VALUE_OPT_CERTIFICATE,
496 /* equiv idx, value */ 0, VALUE_OPT_CERTIFICATE,
497 /* equivalenced to */ NO_EQUIVALENT,
498 /* min, max, act ct */ 0, 1, 0,
499 /* opt state flags */ CERTIFICATE_FLAGS, 0,
500 /* last opt argumnt */ { NULL },
501 /* arg list/cookie */ NULL,
502 /* must/cannot opts */ NULL, NULL,
503 /* option proc */ NULL,
504 /* desc, NAME, name */ zCertificateText, zCertificate_NAME, zCertificate_Name,
505 /* disablement strs */ NULL, NULL },
507 { /* entry idx, value */ 1, VALUE_OPT_DEBUG_LEVEL,
508 /* equiv idx, value */ 1, VALUE_OPT_DEBUG_LEVEL,
509 /* equivalenced to */ NO_EQUIVALENT,
510 /* min, max, act ct */ 0, NOLIMIT, 0,
511 /* opt state flags */ DEBUG_LEVEL_FLAGS, 0,
512 /* last opt argumnt */ { NULL },
513 /* arg list/cookie */ NULL,
514 /* must/cannot opts */ NULL, NULL,
515 /* option proc */ NULL,
516 /* desc, NAME, name */ zDebug_LevelText, zDebug_Level_NAME, zDebug_Level_Name,
517 /* disablement strs */ NULL, NULL },
519 { /* entry idx, value */ 2, VALUE_OPT_SET_DEBUG_LEVEL,
520 /* equiv idx, value */ 2, VALUE_OPT_SET_DEBUG_LEVEL,
521 /* equivalenced to */ NO_EQUIVALENT,
522 /* min, max, act ct */ 0, NOLIMIT, 0,
523 /* opt state flags */ SET_DEBUG_LEVEL_FLAGS, 0,
524 /* last opt argumnt */ { NULL },
525 /* arg list/cookie */ NULL,
526 /* must/cannot opts */ NULL, NULL,
527 /* option proc */ SET_DEBUG_LEVEL_OPT_PROC,
528 /* desc, NAME, name */ zSet_Debug_LevelText, zSet_Debug_Level_NAME, zSet_Debug_Level_Name,
529 /* disablement strs */ NULL, NULL },
531 { /* entry idx, value */ 3, VALUE_OPT_ID_KEY,
532 /* equiv idx, value */ 3, VALUE_OPT_ID_KEY,
533 /* equivalenced to */ NO_EQUIVALENT,
534 /* min, max, act ct */ 0, 1, 0,
535 /* opt state flags */ ID_KEY_FLAGS, 0,
536 /* last opt argumnt */ { NULL },
537 /* arg list/cookie */ NULL,
538 /* must/cannot opts */ NULL, NULL,
539 /* option proc */ NULL,
540 /* desc, NAME, name */ zId_KeyText, zId_Key_NAME, zId_Key_Name,
541 /* disablement strs */ NULL, NULL },
543 { /* entry idx, value */ 4, VALUE_OPT_GQ_PARAMS,
544 /* equiv idx, value */ 4, VALUE_OPT_GQ_PARAMS,
545 /* equivalenced to */ NO_EQUIVALENT,
546 /* min, max, act ct */ 0, 1, 0,
547 /* opt state flags */ GQ_PARAMS_FLAGS, 0,
548 /* last opt argumnt */ { NULL },
549 /* arg list/cookie */ NULL,
550 /* must/cannot opts */ NULL, NULL,
551 /* option proc */ NULL,
552 /* desc, NAME, name */ zGq_ParamsText, zGq_Params_NAME, zGq_Params_Name,
553 /* disablement strs */ NULL, NULL },
555 { /* entry idx, value */ 5, VALUE_OPT_GQ_KEYS,
556 /* equiv idx, value */ 5, VALUE_OPT_GQ_KEYS,
557 /* equivalenced to */ NO_EQUIVALENT,
558 /* min, max, act ct */ 0, 1, 0,
559 /* opt state flags */ GQ_KEYS_FLAGS, 0,
560 /* last opt argumnt */ { NULL },
561 /* arg list/cookie */ NULL,
562 /* must/cannot opts */ NULL, NULL,
563 /* option proc */ NULL,
564 /* desc, NAME, name */ zGq_KeysText, zGq_Keys_NAME, zGq_Keys_Name,
565 /* disablement strs */ NULL, NULL },
567 { /* entry idx, value */ 6, VALUE_OPT_HOST_KEY,
568 /* equiv idx, value */ 6, VALUE_OPT_HOST_KEY,
569 /* equivalenced to */ NO_EQUIVALENT,
570 /* min, max, act ct */ 0, 1, 0,
571 /* opt state flags */ HOST_KEY_FLAGS, 0,
572 /* last opt argumnt */ { NULL },
573 /* arg list/cookie */ NULL,
574 /* must/cannot opts */ NULL, NULL,
575 /* option proc */ NULL,
576 /* desc, NAME, name */ zHost_KeyText, zHost_Key_NAME, zHost_Key_Name,
577 /* disablement strs */ NULL, NULL },
579 { /* entry idx, value */ 7, VALUE_OPT_IFFKEY,
580 /* equiv idx, value */ 7, VALUE_OPT_IFFKEY,
581 /* equivalenced to */ NO_EQUIVALENT,
582 /* min, max, act ct */ 0, 1, 0,
583 /* opt state flags */ IFFKEY_FLAGS, 0,
584 /* last opt argumnt */ { NULL },
585 /* arg list/cookie */ NULL,
586 /* must/cannot opts */ NULL, NULL,
587 /* option proc */ NULL,
588 /* desc, NAME, name */ zIffkeyText, zIffkey_NAME, zIffkey_Name,
589 /* disablement strs */ NULL, NULL },
591 { /* entry idx, value */ 8, VALUE_OPT_ISSUER_NAME,
592 /* equiv idx, value */ 8, VALUE_OPT_ISSUER_NAME,
593 /* equivalenced to */ NO_EQUIVALENT,
594 /* min, max, act ct */ 0, 1, 0,
595 /* opt state flags */ ISSUER_NAME_FLAGS, 0,
596 /* last opt argumnt */ { NULL },
597 /* arg list/cookie */ NULL,
598 /* must/cannot opts */ NULL, NULL,
599 /* option proc */ NULL,
600 /* desc, NAME, name */ zIssuer_NameText, zIssuer_Name_NAME, zIssuer_Name_Name,
601 /* disablement strs */ NULL, NULL },
603 { /* entry idx, value */ 9, VALUE_OPT_MD5KEY,
604 /* equiv idx, value */ 9, VALUE_OPT_MD5KEY,
605 /* equivalenced to */ NO_EQUIVALENT,
606 /* min, max, act ct */ 0, 1, 0,
607 /* opt state flags */ MD5KEY_FLAGS, 0,
608 /* last opt argumnt */ { NULL },
609 /* arg list/cookie */ NULL,
610 /* must/cannot opts */ NULL, NULL,
611 /* option proc */ NULL,
612 /* desc, NAME, name */ zMd5keyText, zMd5key_NAME, zMd5key_Name,
613 /* disablement strs */ NULL, NULL },
615 { /* entry idx, value */ 10, VALUE_OPT_MODULUS,
616 /* equiv idx, value */ 10, VALUE_OPT_MODULUS,
617 /* equivalenced to */ NO_EQUIVALENT,
618 /* min, max, act ct */ 0, 1, 0,
619 /* opt state flags */ MODULUS_FLAGS, 0,
620 /* last opt argumnt */ { NULL },
621 /* arg list/cookie */ NULL,
622 /* must/cannot opts */ NULL, NULL,
623 /* option proc */ doOptModulus,
624 /* desc, NAME, name */ zModulusText, zModulus_NAME, zModulus_Name,
625 /* disablement strs */ NULL, NULL },
627 { /* entry idx, value */ 11, VALUE_OPT_PVT_CERT,
628 /* equiv idx, value */ 11, VALUE_OPT_PVT_CERT,
629 /* equivalenced to */ NO_EQUIVALENT,
630 /* min, max, act ct */ 0, 1, 0,
631 /* opt state flags */ PVT_CERT_FLAGS, 0,
632 /* last opt argumnt */ { NULL },
633 /* arg list/cookie */ NULL,
634 /* must/cannot opts */ NULL, NULL,
635 /* option proc */ NULL,
636 /* desc, NAME, name */ zPvt_CertText, zPvt_Cert_NAME, zPvt_Cert_Name,
637 /* disablement strs */ NULL, NULL },
639 { /* entry idx, value */ 12, VALUE_OPT_PVT_PASSWD,
640 /* equiv idx, value */ 12, VALUE_OPT_PVT_PASSWD,
641 /* equivalenced to */ NO_EQUIVALENT,
642 /* min, max, act ct */ 0, 1, 0,
643 /* opt state flags */ PVT_PASSWD_FLAGS, 0,
644 /* last opt argumnt */ { NULL },
645 /* arg list/cookie */ NULL,
646 /* must/cannot opts */ NULL, NULL,
647 /* option proc */ NULL,
648 /* desc, NAME, name */ zPvt_PasswdText, zPvt_Passwd_NAME, zPvt_Passwd_Name,
649 /* disablement strs */ NULL, NULL },
651 { /* entry idx, value */ 13, VALUE_OPT_GET_PVT_PASSWD,
652 /* equiv idx, value */ 13, VALUE_OPT_GET_PVT_PASSWD,
653 /* equivalenced to */ NO_EQUIVALENT,
654 /* min, max, act ct */ 0, 1, 0,
655 /* opt state flags */ GET_PVT_PASSWD_FLAGS, 0,
656 /* last opt argumnt */ { NULL },
657 /* arg list/cookie */ NULL,
658 /* must/cannot opts */ NULL, NULL,
659 /* option proc */ NULL,
660 /* desc, NAME, name */ zGet_Pvt_PasswdText, zGet_Pvt_Passwd_NAME, zGet_Pvt_Passwd_Name,
661 /* disablement strs */ NULL, NULL },
663 { /* entry idx, value */ 14, VALUE_OPT_SIGN_KEY,
664 /* equiv idx, value */ 14, VALUE_OPT_SIGN_KEY,
665 /* equivalenced to */ NO_EQUIVALENT,
666 /* min, max, act ct */ 0, 1, 0,
667 /* opt state flags */ SIGN_KEY_FLAGS, 0,
668 /* last opt argumnt */ { NULL },
669 /* arg list/cookie */ NULL,
670 /* must/cannot opts */ NULL, NULL,
671 /* option proc */ NULL,
672 /* desc, NAME, name */ zSign_KeyText, zSign_Key_NAME, zSign_Key_Name,
673 /* disablement strs */ NULL, NULL },
675 { /* entry idx, value */ 15, VALUE_OPT_SUBJECT_NAME,
676 /* equiv idx, value */ 15, VALUE_OPT_SUBJECT_NAME,
677 /* equivalenced to */ NO_EQUIVALENT,
678 /* min, max, act ct */ 0, 1, 0,
679 /* opt state flags */ SUBJECT_NAME_FLAGS, 0,
680 /* last opt argumnt */ { NULL },
681 /* arg list/cookie */ NULL,
682 /* must/cannot opts */ NULL, NULL,
683 /* option proc */ NULL,
684 /* desc, NAME, name */ zSubject_NameText, zSubject_Name_NAME, zSubject_Name_Name,
685 /* disablement strs */ NULL, NULL },
687 { /* entry idx, value */ 16, VALUE_OPT_TRUSTED_CERT,
688 /* equiv idx, value */ 16, VALUE_OPT_TRUSTED_CERT,
689 /* equivalenced to */ NO_EQUIVALENT,
690 /* min, max, act ct */ 0, 1, 0,
691 /* opt state flags */ TRUSTED_CERT_FLAGS, 0,
692 /* last opt argumnt */ { NULL },
693 /* arg list/cookie */ NULL,
694 /* must/cannot opts */ NULL, NULL,
695 /* option proc */ NULL,
696 /* desc, NAME, name */ zTrusted_CertText, zTrusted_Cert_NAME, zTrusted_Cert_Name,
697 /* disablement strs */ NULL, NULL },
699 { /* entry idx, value */ 17, VALUE_OPT_MV_PARAMS,
700 /* equiv idx, value */ 17, VALUE_OPT_MV_PARAMS,
701 /* equivalenced to */ NO_EQUIVALENT,
702 /* min, max, act ct */ 0, 1, 0,
703 /* opt state flags */ MV_PARAMS_FLAGS, 0,
704 /* last opt argumnt */ { NULL },
705 /* arg list/cookie */ NULL,
706 /* must/cannot opts */ NULL, NULL,
707 /* option proc */ optionNumericVal,
708 /* desc, NAME, name */ zMv_ParamsText, zMv_Params_NAME, zMv_Params_Name,
709 /* disablement strs */ NULL, NULL },
711 { /* entry idx, value */ 18, VALUE_OPT_MV_KEYS,
712 /* equiv idx, value */ 18, VALUE_OPT_MV_KEYS,
713 /* equivalenced to */ NO_EQUIVALENT,
714 /* min, max, act ct */ 0, 1, 0,
715 /* opt state flags */ MV_KEYS_FLAGS, 0,
716 /* last opt argumnt */ { NULL },
717 /* arg list/cookie */ NULL,
718 /* must/cannot opts */ NULL, NULL,
719 /* option proc */ optionNumericVal,
720 /* desc, NAME, name */ zMv_KeysText, zMv_Keys_NAME, zMv_Keys_Name,
721 /* disablement strs */ NULL, NULL },
723 #ifdef NO_OPTIONAL_OPT_ARGS
724 # define VERSION_OPT_FLAGS OPTST_IMM | OPTST_NO_INIT
726 # define VERSION_OPT_FLAGS OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \
727 OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT
730 { /* entry idx, value */ INDEX_OPT_VERSION, VALUE_OPT_VERSION,
731 /* equiv idx value */ NO_EQUIVALENT, 0,
732 /* equivalenced to */ NO_EQUIVALENT,
733 /* min, max, act ct */ 0, 1, 0,
734 /* opt state flags */ VERSION_OPT_FLAGS, 0,
735 /* last opt argumnt */ { NULL },
736 /* arg list/cookie */ NULL,
737 /* must/cannot opts */ NULL, NULL,
738 /* option proc */ DOVERPROC,
739 /* desc, NAME, name */ zVersionText, NULL, zVersion_Name,
740 /* disablement strs */ NULL, NULL },
742 #undef VERSION_OPT_FLAGS
745 { /* entry idx, value */ INDEX_OPT_HELP, VALUE_OPT_HELP,
746 /* equiv idx value */ NO_EQUIVALENT, 0,
747 /* equivalenced to */ NO_EQUIVALENT,
748 /* min, max, act ct */ 0, 1, 0,
749 /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, 0,
750 /* last opt argumnt */ { NULL },
751 /* arg list/cookie */ NULL,
752 /* must/cannot opts */ NULL, NULL,
753 /* option proc */ doUsageOpt,
754 /* desc, NAME, name */ zHelpText, NULL, zHelp_Name,
755 /* disablement strs */ NULL, NULL },
757 { /* entry idx, value */ INDEX_OPT_MORE_HELP, VALUE_OPT_MORE_HELP,
758 /* equiv idx value */ NO_EQUIVALENT, 0,
759 /* equivalenced to */ NO_EQUIVALENT,
760 /* min, max, act ct */ 0, 1, 0,
761 /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, 0,
762 /* last opt argumnt */ { NULL },
763 /* arg list/cookie */ NULL,
764 /* must/cannot opts */ NULL, NULL,
765 /* option proc */ optionPagedUsage,
766 /* desc, NAME, name */ zMore_HelpText, NULL, zMore_Help_Name,
767 /* disablement strs */ NULL, NULL },
769 { /* entry idx, value */ INDEX_OPT_SAVE_OPTS, VALUE_OPT_SAVE_OPTS,
770 /* equiv idx value */ NO_EQUIVALENT, 0,
771 /* equivalenced to */ NO_EQUIVALENT,
772 /* min, max, act ct */ 0, 1, 0,
773 /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)
774 | OPTST_ARG_OPTIONAL | OPTST_NO_INIT, 0,
775 /* last opt argumnt */ { NULL },
776 /* arg list/cookie */ NULL,
777 /* must/cannot opts */ NULL, NULL,
778 /* option proc */ NULL,
779 /* desc, NAME, name */ zSave_OptsText, NULL, zSave_Opts_Name,
780 /* disablement strs */ NULL, NULL },
782 { /* entry idx, value */ INDEX_OPT_LOAD_OPTS, VALUE_OPT_LOAD_OPTS,
783 /* equiv idx value */ NO_EQUIVALENT, 0,
784 /* equivalenced to */ NO_EQUIVALENT,
785 /* min, max, act ct */ 0, NOLIMIT, 0,
786 /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) \
787 | OPTST_DISABLE_IMM, 0,
788 /* last opt argumnt */ { NULL },
789 /* arg list/cookie */ NULL,
790 /* must/cannot opts */ NULL, NULL,
791 /* option proc */ optionLoadOpt,
792 /* desc, NAME, name */ zLoad_OptsText, zLoad_Opts_NAME, zLoad_Opts_Name,
793 /* disablement strs */ zNotLoad_Opts_Name, zNotLoad_Opts_Pfx }
796 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
798 * Define the Ntp_Keygen Option Environment
800 tSCC zPROGNAME[] = "NTP_KEYGEN";
802 "ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.4p8\n\
803 USAGE: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n";
804 tSCC zRcName[] = ".ntprc";
805 tSCC* apzHomeList[] = {
810 tSCC zBugsAddr[] = "http://bugs.ntp.org, bugs@ntp.org";
811 #define zExplain NULL
812 tSCC zDetail[] = "\n\
813 If there is no new host key, look for an existing one.\n\
814 If one is not found, create it.\n";
815 tSCC zFullVersion[] = NTP_KEYGEN_FULL_VERSION;
816 /* extracted from /usr/local/gnu/autogen-5.9.1/share/autogen/optcode.tpl near line 408 */
818 #if defined(ENABLE_NLS)
819 # define OPTPROC_BASE OPTPROC_TRANSLATE
820 static tOptionXlateProc translate_option_strings;
822 # define OPTPROC_BASE OPTPROC_NONE
823 # define translate_option_strings NULL
824 #endif /* ENABLE_NLS */
826 tOptions ntp_keygenOptions = {
827 OPTIONS_STRUCT_VERSION,
828 0, NULL, /* original argc + argv */
836 + OPTPROC_HAS_IMMED ),
837 0, NULL, /* current option index, current option */
838 NULL, NULL, zPROGNAME,
839 zRcName, zCopyright, zCopyrightNotice,
840 zFullVersion, apzHomeList, zUsageTitle,
841 zExplain, zDetail, optDesc,
842 zBugsAddr, /* address to send bugs to */
843 NULL, NULL, /* extensions/saved state */
844 optionUsage, /* usage procedure */
845 translate_option_strings, /* translation procedure */
847 * Indexes to special options
849 { INDEX_OPT_MORE_HELP,
851 NO_EQUIVALENT /* index of '-#' option */,
852 NO_EQUIVALENT /* index of default opt */
854 24 /* full option count */, 19 /* user option count */
858 * Create the static procedure(s) declared above.
865 USAGE( EXIT_SUCCESS );
868 #if ! defined(TEST_NTP_KEYGEN_OPTS)
872 * For the set-debug-level option, when DEBUG is #define-d.
876 doOptSet_Debug_Level(
880 /* extracted from ../include/debug-opt.def, line 29 */
881 DESC(DEBUG_LEVEL).optOccCt = atoi( pOptDesc->pzLastArg );
883 #endif /* defined DEBUG */
885 #endif /* defined(TEST_NTP_KEYGEN_OPTS) */
889 * For the modulus option, when OPENSSL is #define-d.
897 static const struct {const int rmin, rmax;} rng[ 1 ] = {
901 char const* pzIndent = "\t\t\t\t ";
902 extern FILE* option_usage_fp;
904 if (pOptDesc == NULL) /* usage is requesting range list
905 option_usage_fp has already been set */
908 val = atoi( pOptDesc->optArg.argString );
909 for (ix = 0; ix < 1; ix++) {
910 if (val < rng[ix].rmin)
911 continue; /* ranges need not be ordered. */
912 if (val == rng[ix].rmin)
914 if (rng[ix].rmax == INT_MIN)
916 if (val <= rng[ix].rmax)
920 option_usage_fp = stderr;
921 fprintf(stderr, _("%s error: %s option value ``%s''is out of range.\n"),
922 pOptions->pzProgName, pOptDesc->pz_Name, pOptDesc->optArg.argString);
926 fprintf( option_usage_fp, _("%sit must lie in the range: %d to %d\n"),
927 pzIndent, rng[0].rmin, rng[0].rmax );
928 if (pOptDesc == NULL)
931 USAGE( EXIT_FAILURE );
936 pOptDesc->optArg.argInt = val;
938 #endif /* defined OPENSSL */
940 /* extracted from /usr/local/gnu/autogen-5.9.1/share/autogen/optmain.tpl near line 92 */
942 #if defined(TEST_NTP_KEYGEN_OPTS) /* TEST MAIN PROCEDURE: */
945 main( int argc, char** argv )
947 int res = EXIT_SUCCESS;
948 (void)optionProcess( &ntp_keygenOptions, argc, argv );
950 void optionPutShell( tOptions* );
951 optionPutShell( &ntp_keygenOptions );
955 #endif /* defined TEST_NTP_KEYGEN_OPTS */
956 /* extracted from /usr/local/gnu/autogen-5.9.1/share/autogen/optcode.tpl near line 514 */
963 #include <autoopts/usage-txt.h>
965 static char* AO_gettext( char const* pz );
966 static void coerce_it(void** s);
969 AO_gettext( char const* pz )
977 pzRes = strdup( pzRes );
979 fputs( _("No memory for duping translated strings\n"), stderr );
980 exit( EXIT_FAILURE );
985 static void coerce_it(void** s) { *s = AO_gettext(*s); }
986 #define COERSION(_f) \
987 coerce_it((void*)&(ntp_keygenOptions._f))
990 * This invokes the translation code (e.g. gettext(3)).
993 translate_option_strings( void )
996 * Guard against re-translation. It won't work. The strings will have
997 * been changed by the first pass through this code. One shot only.
999 if (option_usage_text.field_ct == 0)
1002 * Do the translations. The first pointer follows the field count field.
1003 * The field count field is the size of a pointer.
1006 char** ppz = (char**)(void*)&(option_usage_text);
1007 int ix = option_usage_text.field_ct;
1011 *ppz = AO_gettext(*ppz);
1014 option_usage_text.field_ct = 0;
1017 tOptDesc* pOD = ntp_keygenOptions.pOptDesc;
1018 int ix = ntp_keygenOptions.optCt;
1021 pOD->pzText = AO_gettext(pOD->pzText);
1022 pOD->pz_NAME = AO_gettext(pOD->pz_NAME);
1023 pOD->pz_Name = AO_gettext(pOD->pz_Name);
1024 pOD->pz_DisableName = AO_gettext(pOD->pz_DisableName);
1025 pOD->pz_DisablePfx = AO_gettext(pOD->pz_DisablePfx);
1031 COERSION(pzCopyright);
1032 COERSION(pzCopyNotice);
1033 COERSION(pzFullVersion);
1034 COERSION(pzUsageTitle);
1035 COERSION(pzExplain);
1039 #endif /* ENABLE_NLS */
1044 /* ntp-keygen-opts.c ends here */