Expand PMF_FN_* macros.
[netbsd-mini2440.git] / dist / ntp / ntpd / ntpd-opts.c
blob7de842217cebb335609d1b495b696c1933bf0147
1 /* $NetBSD$ */
3 /*
4 * EDIT THIS FILE WITH CAUTION (ntpd-opts.c)
5 *
6 * It has been AutoGen-ed Tuesday December 8, 2009 at 08:13:10 AM EST
7 * From the definitions ntpd-opts.def
8 * and the template file options
10 * Generated from AutoOpts 29:0:4 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 * ntpd 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 * ntpd copyright 1970-2009 David L. Mills and/or others - all rights reserved
26 * see html/copyright.html
30 #include <limits.h>
32 #define OPTION_CODE_COMPILE 1
33 #include "ntpd-opts.h"
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 tSCC zCopyright[] =
39 "ntpd copyright (c) 1970-2009 David L. Mills and/or others, all rights reserved";
40 tSCC zCopyrightNotice[] =
42 /* extracted from ../include/copyright.def near line 8 */
43 "see html/copyright.html";
44 extern tUsageProc optionUsage;
47 * global included definitions
49 #ifdef __windows
50 extern int atoi(const char*);
51 #else
52 # include <stdlib.h>
53 #endif
55 #ifndef NULL
56 # define NULL 0
57 #endif
58 #ifndef EXIT_SUCCESS
59 # define EXIT_SUCCESS 0
60 #endif
61 #ifndef EXIT_FAILURE
62 # define EXIT_FAILURE 1
63 #endif
65 * Ipv4 option description:
67 tSCC zIpv4Text[] =
68 "Force IPv4 DNS name resolution";
69 tSCC zIpv4_NAME[] = "IPV4";
70 tSCC zIpv4_Name[] = "ipv4";
71 #define IPV4_FLAGS (OPTST_DISABLED)
74 * Ipv6 option description:
76 tSCC zIpv6Text[] =
77 "Force IPv6 DNS name resolution";
78 tSCC zIpv6_NAME[] = "IPV6";
79 tSCC zIpv6_Name[] = "ipv6";
80 #define IPV6_FLAGS (OPTST_DISABLED)
83 * Authreq option description with
84 * "Must also have options" and "Incompatible options":
86 tSCC zAuthreqText[] =
87 "Require crypto authentication";
88 tSCC zAuthreq_NAME[] = "AUTHREQ";
89 tSCC zAuthreq_Name[] = "authreq";
90 static const int
91 aAuthreqCantList[] = {
92 INDEX_OPT_AUTHNOREQ, NO_EQUIVALENT };
93 #define AUTHREQ_FLAGS (OPTST_DISABLED)
96 * Authnoreq option description with
97 * "Must also have options" and "Incompatible options":
99 tSCC zAuthnoreqText[] =
100 "Do not require crypto authentication";
101 tSCC zAuthnoreq_NAME[] = "AUTHNOREQ";
102 tSCC zAuthnoreq_Name[] = "authnoreq";
103 static const int
104 aAuthnoreqCantList[] = {
105 INDEX_OPT_AUTHREQ, NO_EQUIVALENT };
106 #define AUTHNOREQ_FLAGS (OPTST_DISABLED)
109 * Bcastsync option description:
111 tSCC zBcastsyncText[] =
112 "Allow us to sync to broadcast servers";
113 tSCC zBcastsync_NAME[] = "BCASTSYNC";
114 tSCC zBcastsync_Name[] = "bcastsync";
115 #define BCASTSYNC_FLAGS (OPTST_DISABLED)
118 * Configfile option description:
120 tSCC zConfigfileText[] =
121 "configuration file name";
122 tSCC zConfigfile_NAME[] = "CONFIGFILE";
123 tSCC zConfigfile_Name[] = "configfile";
124 #define CONFIGFILE_FLAGS (OPTST_DISABLED \
125 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
128 * Debug_Level option description:
130 #ifdef DEBUG
131 tSCC zDebug_LevelText[] =
132 "Increase output debug message level";
133 tSCC zDebug_Level_NAME[] = "DEBUG_LEVEL";
134 tSCC zDebug_Level_Name[] = "debug-level";
135 #define DEBUG_LEVEL_FLAGS (OPTST_DISABLED)
137 #else /* disable Debug_Level */
138 #define VALUE_OPT_DEBUG_LEVEL NO_EQUIVALENT
139 #define DEBUG_LEVEL_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
140 #define zDebug_LevelText NULL
141 #define zDebug_Level_NAME NULL
142 #define zDebug_Level_Name NULL
143 #endif /* DEBUG */
146 * Set_Debug_Level option description:
148 #ifdef DEBUG
149 tSCC zSet_Debug_LevelText[] =
150 "Set the output debug message level";
151 tSCC zSet_Debug_Level_NAME[] = "SET_DEBUG_LEVEL";
152 tSCC zSet_Debug_Level_Name[] = "set-debug-level";
153 #define SET_DEBUG_LEVEL_FLAGS (OPTST_DISABLED \
154 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
156 #else /* disable Set_Debug_Level */
157 #define VALUE_OPT_SET_DEBUG_LEVEL NO_EQUIVALENT
158 #define SET_DEBUG_LEVEL_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
159 #define zSet_Debug_LevelText NULL
160 #define zSet_Debug_Level_NAME NULL
161 #define zSet_Debug_Level_Name NULL
162 #endif /* DEBUG */
165 * Driftfile option description:
167 tSCC zDriftfileText[] =
168 "frequency drift file name";
169 tSCC zDriftfile_NAME[] = "DRIFTFILE";
170 tSCC zDriftfile_Name[] = "driftfile";
171 #define DRIFTFILE_FLAGS (OPTST_DISABLED \
172 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
175 * Panicgate option description:
177 tSCC zPanicgateText[] =
178 "Allow the first adjustment to be Big";
179 tSCC zPanicgate_NAME[] = "PANICGATE";
180 tSCC zPanicgate_Name[] = "panicgate";
181 #define PANICGATE_FLAGS (OPTST_DISABLED)
184 * Jaildir option description:
186 tSCC zJaildirText[] =
187 "Jail directory";
188 tSCC zJaildir_NAME[] = "JAILDIR";
189 tSCC zJaildir_Name[] = "jaildir";
190 #define JAILDIR_FLAGS (OPTST_DISABLED \
191 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
194 * Interface option description:
196 tSCC zInterfaceText[] =
197 "Listen on interface";
198 tSCC zInterface_NAME[] = "INTERFACE";
199 tSCC zInterface_Name[] = "interface";
200 #define INTERFACE_FLAGS (OPTST_DISABLED | OPTST_STACKED \
201 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
204 * Keyfile option description:
206 tSCC zKeyfileText[] =
207 "path to symmetric keys";
208 tSCC zKeyfile_NAME[] = "KEYFILE";
209 tSCC zKeyfile_Name[] = "keyfile";
210 #define KEYFILE_FLAGS (OPTST_DISABLED \
211 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
214 * Logfile option description:
216 tSCC zLogfileText[] =
217 "path to the log file";
218 tSCC zLogfile_NAME[] = "LOGFILE";
219 tSCC zLogfile_Name[] = "logfile";
220 #define LOGFILE_FLAGS (OPTST_DISABLED \
221 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
224 * Novirtualips option description:
226 tSCC zNovirtualipsText[] =
227 "Do not listen to virtual IPs";
228 tSCC zNovirtualips_NAME[] = "NOVIRTUALIPS";
229 tSCC zNovirtualips_Name[] = "novirtualips";
230 #define NOVIRTUALIPS_FLAGS (OPTST_DISABLED)
233 * Modifymmtimer option description:
235 #ifdef SYS_WINNT
236 tSCC zModifymmtimerText[] =
237 "Modify Multimedia Timer (Windows only)";
238 tSCC zModifymmtimer_NAME[] = "MODIFYMMTIMER";
239 tSCC zModifymmtimer_Name[] = "modifymmtimer";
240 #define MODIFYMMTIMER_FLAGS (OPTST_DISABLED)
242 #else /* disable Modifymmtimer */
243 #define VALUE_OPT_MODIFYMMTIMER NO_EQUIVALENT
244 #define MODIFYMMTIMER_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
245 #define zModifymmtimerText NULL
246 #define zModifymmtimer_NAME NULL
247 #define zModifymmtimer_Name NULL
248 #endif /* SYS_WINNT */
251 * Nofork option description:
253 tSCC zNoforkText[] =
254 "Do not fork";
255 tSCC zNofork_NAME[] = "NOFORK";
256 tSCC zNofork_Name[] = "nofork";
257 #define NOFORK_FLAGS (OPTST_DISABLED)
260 * Nice option description:
262 tSCC zNiceText[] =
263 "Run at high priority";
264 tSCC zNice_NAME[] = "NICE";
265 tSCC zNice_Name[] = "nice";
266 #define NICE_FLAGS (OPTST_DISABLED)
269 * Pidfile option description:
271 tSCC zPidfileText[] =
272 "path to the PID file";
273 tSCC zPidfile_NAME[] = "PIDFILE";
274 tSCC zPidfile_Name[] = "pidfile";
275 #define PIDFILE_FLAGS (OPTST_DISABLED \
276 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
279 * Priority option description:
281 tSCC zPriorityText[] =
282 "Process priority";
283 tSCC zPriority_NAME[] = "PRIORITY";
284 tSCC zPriority_Name[] = "priority";
285 #define PRIORITY_FLAGS (OPTST_DISABLED \
286 | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
289 * Quit option description:
291 tSCC zQuitText[] =
292 "Set the time and quit";
293 tSCC zQuit_NAME[] = "QUIT";
294 tSCC zQuit_Name[] = "quit";
295 #define QUIT_FLAGS (OPTST_DISABLED)
298 * Propagationdelay option description:
300 tSCC zPropagationdelayText[] =
301 "Broadcast/propagation delay";
302 tSCC zPropagationdelay_NAME[] = "PROPAGATIONDELAY";
303 tSCC zPropagationdelay_Name[] = "propagationdelay";
304 #define PROPAGATIONDELAY_FLAGS (OPTST_DISABLED \
305 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
308 * Updateinterval option description:
310 tSCC zUpdateintervalText[] =
311 "interval in seconds between scans for new or dropped interfaces";
312 tSCC zUpdateinterval_NAME[] = "UPDATEINTERVAL";
313 tSCC zUpdateinterval_Name[] = "updateinterval";
314 #define UPDATEINTERVAL_FLAGS (OPTST_DISABLED \
315 | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
318 * Statsdir option description:
320 tSCC zStatsdirText[] =
321 "Statistics file location";
322 tSCC zStatsdir_NAME[] = "STATSDIR";
323 tSCC zStatsdir_Name[] = "statsdir";
324 #define STATSDIR_FLAGS (OPTST_DISABLED \
325 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
328 * Trustedkey option description:
330 tSCC zTrustedkeyText[] =
331 "Trusted key number";
332 tSCC zTrustedkey_NAME[] = "TRUSTEDKEY";
333 tSCC zTrustedkey_Name[] = "trustedkey";
334 #define TRUSTEDKEY_FLAGS (OPTST_DISABLED | OPTST_STACKED \
335 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
338 * User option description:
340 tSCC zUserText[] =
341 "Run as userid (or userid:groupid)";
342 tSCC zUser_NAME[] = "USER";
343 tSCC zUser_Name[] = "user";
344 #define USER_FLAGS (OPTST_DISABLED \
345 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
348 * Var option description:
350 tSCC zVarText[] =
351 "make ARG an ntp variable (RW)";
352 tSCC zVar_NAME[] = "VAR";
353 tSCC zVar_Name[] = "var";
354 #define VAR_FLAGS (OPTST_DISABLED | OPTST_STACKED \
355 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
358 * Dvar option description:
360 tSCC zDvarText[] =
361 "make ARG an ntp variable (RW|DEF)";
362 tSCC zDvar_NAME[] = "DVAR";
363 tSCC zDvar_Name[] = "dvar";
364 #define DVAR_FLAGS (OPTST_DISABLED | OPTST_STACKED \
365 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
368 * Slew option description:
370 tSCC zSlewText[] =
371 "Slew up to 600 seconds";
372 tSCC zSlew_NAME[] = "SLEW";
373 tSCC zSlew_Name[] = "slew";
374 #define SLEW_FLAGS (OPTST_DISABLED)
377 * Help/More_Help/Version option descriptions:
379 tSCC zHelpText[] = "Display usage information and exit";
380 tSCC zHelp_Name[] = "help";
382 tSCC zMore_HelpText[] = "Extended usage information passed thru pager";
383 tSCC zMore_Help_Name[] = "more-help";
385 tSCC zVersionText[] = "Output version information and exit";
386 tSCC zVersion_Name[] = "version";
388 * Declare option callback procedures
390 #ifdef DEBUG
391 static tOptProc doOptSet_Debug_Level;
392 #else /* not DEBUG */
393 # define doOptSet_Debug_Level NULL
394 #endif /* def/not DEBUG */
395 #if defined(TEST_NTPD_OPTS)
397 * Under test, omit argument processing, or call optionStackArg,
398 * if multiple copies are allowed.
400 extern tOptProc
401 optionNumericVal, optionPagedUsage, optionStackArg,
402 optionVersionStderr;
403 static tOptProc
404 doUsageOpt;
407 * #define map the "normal" callout procs to the test ones...
409 #define SET_DEBUG_LEVEL_OPT_PROC optionStackArg
412 #else /* NOT defined TEST_NTPD_OPTS */
414 * When not under test, there are different procs to use
416 extern tOptProc
417 optionNumericVal, optionPagedUsage, optionPrintVersion, optionStackArg;
418 static tOptProc
419 doUsageOpt;
422 * #define map the "normal" callout procs
424 #define SET_DEBUG_LEVEL_OPT_PROC doOptSet_Debug_Level
426 #define SET_DEBUG_LEVEL_OPT_PROC doOptSet_Debug_Level
427 #endif /* defined(TEST_NTPD_OPTS) */
428 #ifdef TEST_NTPD_OPTS
429 # define DOVERPROC optionVersionStderr
430 #else
431 # define DOVERPROC optionPrintVersion
432 #endif /* TEST_NTPD_OPTS */
434 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
436 * Define the Ntpd Option Descriptions.
438 static tOptDesc optDesc[ OPTION_CT ] = {
439 { /* entry idx, value */ 0, VALUE_OPT_IPV4,
440 /* equiv idx, value */ NO_EQUIVALENT, 0,
441 /* equivalenced to */ NO_EQUIVALENT,
442 /* min, max, act ct */ 0, 1, 0,
443 /* opt state flags */ IPV4_FLAGS, 0,
444 /* last opt argumnt */ { NULL },
445 /* arg list/cookie */ NULL,
446 /* must/cannot opts */ NULL, NULL,
447 /* option proc */ NULL,
448 /* desc, NAME, name */ zIpv4Text, zIpv4_NAME, zIpv4_Name,
449 /* disablement strs */ NULL, NULL },
451 { /* entry idx, value */ 1, VALUE_OPT_IPV6,
452 /* equiv idx, value */ NOLIMIT, NOLIMIT,
453 /* equivalenced to */ INDEX_OPT_IPV4,
454 /* min, max, act ct */ 0, 1, 0,
455 /* opt state flags */ IPV6_FLAGS, 0,
456 /* last opt argumnt */ { NULL },
457 /* arg list/cookie */ NULL,
458 /* must/cannot opts */ NULL, NULL,
459 /* option proc */ NULL,
460 /* desc, NAME, name */ zIpv6Text, zIpv6_NAME, zIpv6_Name,
461 /* disablement strs */ NULL, NULL },
463 { /* entry idx, value */ 2, VALUE_OPT_AUTHREQ,
464 /* equiv idx, value */ 2, VALUE_OPT_AUTHREQ,
465 /* equivalenced to */ NO_EQUIVALENT,
466 /* min, max, act ct */ 0, 1, 0,
467 /* opt state flags */ AUTHREQ_FLAGS, 0,
468 /* last opt argumnt */ { NULL },
469 /* arg list/cookie */ NULL,
470 /* must/cannot opts */ NULL, aAuthreqCantList,
471 /* option proc */ NULL,
472 /* desc, NAME, name */ zAuthreqText, zAuthreq_NAME, zAuthreq_Name,
473 /* disablement strs */ NULL, NULL },
475 { /* entry idx, value */ 3, VALUE_OPT_AUTHNOREQ,
476 /* equiv idx, value */ 3, VALUE_OPT_AUTHNOREQ,
477 /* equivalenced to */ NO_EQUIVALENT,
478 /* min, max, act ct */ 0, 1, 0,
479 /* opt state flags */ AUTHNOREQ_FLAGS, 0,
480 /* last opt argumnt */ { NULL },
481 /* arg list/cookie */ NULL,
482 /* must/cannot opts */ NULL, aAuthnoreqCantList,
483 /* option proc */ NULL,
484 /* desc, NAME, name */ zAuthnoreqText, zAuthnoreq_NAME, zAuthnoreq_Name,
485 /* disablement strs */ NULL, NULL },
487 { /* entry idx, value */ 4, VALUE_OPT_BCASTSYNC,
488 /* equiv idx, value */ 4, VALUE_OPT_BCASTSYNC,
489 /* equivalenced to */ NO_EQUIVALENT,
490 /* min, max, act ct */ 0, 1, 0,
491 /* opt state flags */ BCASTSYNC_FLAGS, 0,
492 /* last opt argumnt */ { NULL },
493 /* arg list/cookie */ NULL,
494 /* must/cannot opts */ NULL, NULL,
495 /* option proc */ NULL,
496 /* desc, NAME, name */ zBcastsyncText, zBcastsync_NAME, zBcastsync_Name,
497 /* disablement strs */ NULL, NULL },
499 { /* entry idx, value */ 5, VALUE_OPT_CONFIGFILE,
500 /* equiv idx, value */ 5, VALUE_OPT_CONFIGFILE,
501 /* equivalenced to */ NO_EQUIVALENT,
502 /* min, max, act ct */ 0, 1, 0,
503 /* opt state flags */ CONFIGFILE_FLAGS, 0,
504 /* last opt argumnt */ { NULL },
505 /* arg list/cookie */ NULL,
506 /* must/cannot opts */ NULL, NULL,
507 /* option proc */ NULL,
508 /* desc, NAME, name */ zConfigfileText, zConfigfile_NAME, zConfigfile_Name,
509 /* disablement strs */ NULL, NULL },
511 { /* entry idx, value */ 6, VALUE_OPT_DEBUG_LEVEL,
512 /* equiv idx, value */ 6, VALUE_OPT_DEBUG_LEVEL,
513 /* equivalenced to */ NO_EQUIVALENT,
514 /* min, max, act ct */ 0, NOLIMIT, 0,
515 /* opt state flags */ DEBUG_LEVEL_FLAGS, 0,
516 /* last opt argumnt */ { NULL },
517 /* arg list/cookie */ NULL,
518 /* must/cannot opts */ NULL, NULL,
519 /* option proc */ NULL,
520 /* desc, NAME, name */ zDebug_LevelText, zDebug_Level_NAME, zDebug_Level_Name,
521 /* disablement strs */ NULL, NULL },
523 { /* entry idx, value */ 7, VALUE_OPT_SET_DEBUG_LEVEL,
524 /* equiv idx, value */ 7, VALUE_OPT_SET_DEBUG_LEVEL,
525 /* equivalenced to */ NO_EQUIVALENT,
526 /* min, max, act ct */ 0, NOLIMIT, 0,
527 /* opt state flags */ SET_DEBUG_LEVEL_FLAGS, 0,
528 /* last opt argumnt */ { NULL },
529 /* arg list/cookie */ NULL,
530 /* must/cannot opts */ NULL, NULL,
531 /* option proc */ SET_DEBUG_LEVEL_OPT_PROC,
532 /* desc, NAME, name */ zSet_Debug_LevelText, zSet_Debug_Level_NAME, zSet_Debug_Level_Name,
533 /* disablement strs */ NULL, NULL },
535 { /* entry idx, value */ 8, VALUE_OPT_DRIFTFILE,
536 /* equiv idx, value */ 8, VALUE_OPT_DRIFTFILE,
537 /* equivalenced to */ NO_EQUIVALENT,
538 /* min, max, act ct */ 0, 1, 0,
539 /* opt state flags */ DRIFTFILE_FLAGS, 0,
540 /* last opt argumnt */ { NULL },
541 /* arg list/cookie */ NULL,
542 /* must/cannot opts */ NULL, NULL,
543 /* option proc */ NULL,
544 /* desc, NAME, name */ zDriftfileText, zDriftfile_NAME, zDriftfile_Name,
545 /* disablement strs */ NULL, NULL },
547 { /* entry idx, value */ 9, VALUE_OPT_PANICGATE,
548 /* equiv idx, value */ 9, VALUE_OPT_PANICGATE,
549 /* equivalenced to */ NO_EQUIVALENT,
550 /* min, max, act ct */ 0, 1, 0,
551 /* opt state flags */ PANICGATE_FLAGS, 0,
552 /* last opt argumnt */ { NULL },
553 /* arg list/cookie */ NULL,
554 /* must/cannot opts */ NULL, NULL,
555 /* option proc */ NULL,
556 /* desc, NAME, name */ zPanicgateText, zPanicgate_NAME, zPanicgate_Name,
557 /* disablement strs */ NULL, NULL },
559 { /* entry idx, value */ 10, VALUE_OPT_JAILDIR,
560 /* equiv idx, value */ 10, VALUE_OPT_JAILDIR,
561 /* equivalenced to */ NO_EQUIVALENT,
562 /* min, max, act ct */ 0, 1, 0,
563 /* opt state flags */ JAILDIR_FLAGS, 0,
564 /* last opt argumnt */ { NULL },
565 /* arg list/cookie */ NULL,
566 /* must/cannot opts */ NULL, NULL,
567 /* option proc */ NULL,
568 /* desc, NAME, name */ zJaildirText, zJaildir_NAME, zJaildir_Name,
569 /* disablement strs */ NULL, NULL },
571 { /* entry idx, value */ 11, VALUE_OPT_INTERFACE,
572 /* equiv idx, value */ 11, VALUE_OPT_INTERFACE,
573 /* equivalenced to */ NO_EQUIVALENT,
574 /* min, max, act ct */ 0, NOLIMIT, 0,
575 /* opt state flags */ INTERFACE_FLAGS, 0,
576 /* last opt argumnt */ { NULL },
577 /* arg list/cookie */ NULL,
578 /* must/cannot opts */ NULL, NULL,
579 /* option proc */ optionStackArg,
580 /* desc, NAME, name */ zInterfaceText, zInterface_NAME, zInterface_Name,
581 /* disablement strs */ NULL, NULL },
583 { /* entry idx, value */ 12, VALUE_OPT_KEYFILE,
584 /* equiv idx, value */ 12, VALUE_OPT_KEYFILE,
585 /* equivalenced to */ NO_EQUIVALENT,
586 /* min, max, act ct */ 0, 1, 0,
587 /* opt state flags */ KEYFILE_FLAGS, 0,
588 /* last opt argumnt */ { NULL },
589 /* arg list/cookie */ NULL,
590 /* must/cannot opts */ NULL, NULL,
591 /* option proc */ NULL,
592 /* desc, NAME, name */ zKeyfileText, zKeyfile_NAME, zKeyfile_Name,
593 /* disablement strs */ NULL, NULL },
595 { /* entry idx, value */ 13, VALUE_OPT_LOGFILE,
596 /* equiv idx, value */ 13, VALUE_OPT_LOGFILE,
597 /* equivalenced to */ NO_EQUIVALENT,
598 /* min, max, act ct */ 0, 1, 0,
599 /* opt state flags */ LOGFILE_FLAGS, 0,
600 /* last opt argumnt */ { NULL },
601 /* arg list/cookie */ NULL,
602 /* must/cannot opts */ NULL, NULL,
603 /* option proc */ NULL,
604 /* desc, NAME, name */ zLogfileText, zLogfile_NAME, zLogfile_Name,
605 /* disablement strs */ NULL, NULL },
607 { /* entry idx, value */ 14, VALUE_OPT_NOVIRTUALIPS,
608 /* equiv idx, value */ 14, VALUE_OPT_NOVIRTUALIPS,
609 /* equivalenced to */ NO_EQUIVALENT,
610 /* min, max, act ct */ 0, 1, 0,
611 /* opt state flags */ NOVIRTUALIPS_FLAGS, 0,
612 /* last opt argumnt */ { NULL },
613 /* arg list/cookie */ NULL,
614 /* must/cannot opts */ NULL, NULL,
615 /* option proc */ NULL,
616 /* desc, NAME, name */ zNovirtualipsText, zNovirtualips_NAME, zNovirtualips_Name,
617 /* disablement strs */ NULL, NULL },
619 { /* entry idx, value */ 15, VALUE_OPT_MODIFYMMTIMER,
620 /* equiv idx, value */ 15, VALUE_OPT_MODIFYMMTIMER,
621 /* equivalenced to */ NO_EQUIVALENT,
622 /* min, max, act ct */ 0, 1, 0,
623 /* opt state flags */ MODIFYMMTIMER_FLAGS, 0,
624 /* last opt argumnt */ { NULL },
625 /* arg list/cookie */ NULL,
626 /* must/cannot opts */ NULL, NULL,
627 /* option proc */ NULL,
628 /* desc, NAME, name */ zModifymmtimerText, zModifymmtimer_NAME, zModifymmtimer_Name,
629 /* disablement strs */ NULL, NULL },
631 { /* entry idx, value */ 16, VALUE_OPT_NOFORK,
632 /* equiv idx, value */ 16, VALUE_OPT_NOFORK,
633 /* equivalenced to */ NO_EQUIVALENT,
634 /* min, max, act ct */ 0, 1, 0,
635 /* opt state flags */ NOFORK_FLAGS, 0,
636 /* last opt argumnt */ { NULL },
637 /* arg list/cookie */ NULL,
638 /* must/cannot opts */ NULL, NULL,
639 /* option proc */ NULL,
640 /* desc, NAME, name */ zNoforkText, zNofork_NAME, zNofork_Name,
641 /* disablement strs */ NULL, NULL },
643 { /* entry idx, value */ 17, VALUE_OPT_NICE,
644 /* equiv idx, value */ 17, VALUE_OPT_NICE,
645 /* equivalenced to */ NO_EQUIVALENT,
646 /* min, max, act ct */ 0, 1, 0,
647 /* opt state flags */ NICE_FLAGS, 0,
648 /* last opt argumnt */ { NULL },
649 /* arg list/cookie */ NULL,
650 /* must/cannot opts */ NULL, NULL,
651 /* option proc */ NULL,
652 /* desc, NAME, name */ zNiceText, zNice_NAME, zNice_Name,
653 /* disablement strs */ NULL, NULL },
655 { /* entry idx, value */ 18, VALUE_OPT_PIDFILE,
656 /* equiv idx, value */ 18, VALUE_OPT_PIDFILE,
657 /* equivalenced to */ NO_EQUIVALENT,
658 /* min, max, act ct */ 0, 1, 0,
659 /* opt state flags */ PIDFILE_FLAGS, 0,
660 /* last opt argumnt */ { NULL },
661 /* arg list/cookie */ NULL,
662 /* must/cannot opts */ NULL, NULL,
663 /* option proc */ NULL,
664 /* desc, NAME, name */ zPidfileText, zPidfile_NAME, zPidfile_Name,
665 /* disablement strs */ NULL, NULL },
667 { /* entry idx, value */ 19, VALUE_OPT_PRIORITY,
668 /* equiv idx, value */ 19, VALUE_OPT_PRIORITY,
669 /* equivalenced to */ NO_EQUIVALENT,
670 /* min, max, act ct */ 0, 1, 0,
671 /* opt state flags */ PRIORITY_FLAGS, 0,
672 /* last opt argumnt */ { NULL },
673 /* arg list/cookie */ NULL,
674 /* must/cannot opts */ NULL, NULL,
675 /* option proc */ optionNumericVal,
676 /* desc, NAME, name */ zPriorityText, zPriority_NAME, zPriority_Name,
677 /* disablement strs */ NULL, NULL },
679 { /* entry idx, value */ 20, VALUE_OPT_QUIT,
680 /* equiv idx, value */ 20, VALUE_OPT_QUIT,
681 /* equivalenced to */ NO_EQUIVALENT,
682 /* min, max, act ct */ 0, 1, 0,
683 /* opt state flags */ QUIT_FLAGS, 0,
684 /* last opt argumnt */ { NULL },
685 /* arg list/cookie */ NULL,
686 /* must/cannot opts */ NULL, NULL,
687 /* option proc */ NULL,
688 /* desc, NAME, name */ zQuitText, zQuit_NAME, zQuit_Name,
689 /* disablement strs */ NULL, NULL },
691 { /* entry idx, value */ 21, VALUE_OPT_PROPAGATIONDELAY,
692 /* equiv idx, value */ 21, VALUE_OPT_PROPAGATIONDELAY,
693 /* equivalenced to */ NO_EQUIVALENT,
694 /* min, max, act ct */ 0, 1, 0,
695 /* opt state flags */ PROPAGATIONDELAY_FLAGS, 0,
696 /* last opt argumnt */ { NULL },
697 /* arg list/cookie */ NULL,
698 /* must/cannot opts */ NULL, NULL,
699 /* option proc */ NULL,
700 /* desc, NAME, name */ zPropagationdelayText, zPropagationdelay_NAME, zPropagationdelay_Name,
701 /* disablement strs */ NULL, NULL },
703 { /* entry idx, value */ 22, VALUE_OPT_UPDATEINTERVAL,
704 /* equiv idx, value */ 22, VALUE_OPT_UPDATEINTERVAL,
705 /* equivalenced to */ NO_EQUIVALENT,
706 /* min, max, act ct */ 0, 1, 0,
707 /* opt state flags */ UPDATEINTERVAL_FLAGS, 0,
708 /* last opt argumnt */ { NULL },
709 /* arg list/cookie */ NULL,
710 /* must/cannot opts */ NULL, NULL,
711 /* option proc */ optionNumericVal,
712 /* desc, NAME, name */ zUpdateintervalText, zUpdateinterval_NAME, zUpdateinterval_Name,
713 /* disablement strs */ NULL, NULL },
715 { /* entry idx, value */ 23, VALUE_OPT_STATSDIR,
716 /* equiv idx, value */ 23, VALUE_OPT_STATSDIR,
717 /* equivalenced to */ NO_EQUIVALENT,
718 /* min, max, act ct */ 0, 1, 0,
719 /* opt state flags */ STATSDIR_FLAGS, 0,
720 /* last opt argumnt */ { NULL },
721 /* arg list/cookie */ NULL,
722 /* must/cannot opts */ NULL, NULL,
723 /* option proc */ NULL,
724 /* desc, NAME, name */ zStatsdirText, zStatsdir_NAME, zStatsdir_Name,
725 /* disablement strs */ NULL, NULL },
727 { /* entry idx, value */ 24, VALUE_OPT_TRUSTEDKEY,
728 /* equiv idx, value */ 24, VALUE_OPT_TRUSTEDKEY,
729 /* equivalenced to */ NO_EQUIVALENT,
730 /* min, max, act ct */ 0, NOLIMIT, 0,
731 /* opt state flags */ TRUSTEDKEY_FLAGS, 0,
732 /* last opt argumnt */ { NULL },
733 /* arg list/cookie */ NULL,
734 /* must/cannot opts */ NULL, NULL,
735 /* option proc */ optionStackArg,
736 /* desc, NAME, name */ zTrustedkeyText, zTrustedkey_NAME, zTrustedkey_Name,
737 /* disablement strs */ NULL, NULL },
739 { /* entry idx, value */ 25, VALUE_OPT_USER,
740 /* equiv idx, value */ 25, VALUE_OPT_USER,
741 /* equivalenced to */ NO_EQUIVALENT,
742 /* min, max, act ct */ 0, 1, 0,
743 /* opt state flags */ USER_FLAGS, 0,
744 /* last opt argumnt */ { NULL },
745 /* arg list/cookie */ NULL,
746 /* must/cannot opts */ NULL, NULL,
747 /* option proc */ NULL,
748 /* desc, NAME, name */ zUserText, zUser_NAME, zUser_Name,
749 /* disablement strs */ NULL, NULL },
751 { /* entry idx, value */ 26, VALUE_OPT_VAR,
752 /* equiv idx, value */ 26, VALUE_OPT_VAR,
753 /* equivalenced to */ NO_EQUIVALENT,
754 /* min, max, act ct */ 0, NOLIMIT, 0,
755 /* opt state flags */ VAR_FLAGS, 0,
756 /* last opt argumnt */ { NULL },
757 /* arg list/cookie */ NULL,
758 /* must/cannot opts */ NULL, NULL,
759 /* option proc */ optionStackArg,
760 /* desc, NAME, name */ zVarText, zVar_NAME, zVar_Name,
761 /* disablement strs */ NULL, NULL },
763 { /* entry idx, value */ 27, VALUE_OPT_DVAR,
764 /* equiv idx, value */ 27, VALUE_OPT_DVAR,
765 /* equivalenced to */ NO_EQUIVALENT,
766 /* min, max, act ct */ 0, NOLIMIT, 0,
767 /* opt state flags */ DVAR_FLAGS, 0,
768 /* last opt argumnt */ { NULL },
769 /* arg list/cookie */ NULL,
770 /* must/cannot opts */ NULL, NULL,
771 /* option proc */ optionStackArg,
772 /* desc, NAME, name */ zDvarText, zDvar_NAME, zDvar_Name,
773 /* disablement strs */ NULL, NULL },
775 { /* entry idx, value */ 28, VALUE_OPT_SLEW,
776 /* equiv idx, value */ 28, VALUE_OPT_SLEW,
777 /* equivalenced to */ NO_EQUIVALENT,
778 /* min, max, act ct */ 0, 1, 0,
779 /* opt state flags */ SLEW_FLAGS, 0,
780 /* last opt argumnt */ { NULL },
781 /* arg list/cookie */ NULL,
782 /* must/cannot opts */ NULL, NULL,
783 /* option proc */ NULL,
784 /* desc, NAME, name */ zSlewText, zSlew_NAME, zSlew_Name,
785 /* disablement strs */ NULL, NULL },
787 #ifdef NO_OPTIONAL_OPT_ARGS
788 # define VERSION_OPT_FLAGS OPTST_IMM | OPTST_NO_INIT
789 #else
790 # define VERSION_OPT_FLAGS OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \
791 OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT
792 #endif
794 { /* entry idx, value */ INDEX_OPT_VERSION, VALUE_OPT_VERSION,
795 /* equiv idx value */ NO_EQUIVALENT, 0,
796 /* equivalenced to */ NO_EQUIVALENT,
797 /* min, max, act ct */ 0, 1, 0,
798 /* opt state flags */ VERSION_OPT_FLAGS, 0,
799 /* last opt argumnt */ { NULL },
800 /* arg list/cookie */ NULL,
801 /* must/cannot opts */ NULL, NULL,
802 /* option proc */ DOVERPROC,
803 /* desc, NAME, name */ zVersionText, NULL, zVersion_Name,
804 /* disablement strs */ NULL, NULL },
806 #undef VERSION_OPT_FLAGS
809 { /* entry idx, value */ INDEX_OPT_HELP, VALUE_OPT_HELP,
810 /* equiv idx value */ NO_EQUIVALENT, 0,
811 /* equivalenced to */ NO_EQUIVALENT,
812 /* min, max, act ct */ 0, 1, 0,
813 /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, 0,
814 /* last opt argumnt */ { NULL },
815 /* arg list/cookie */ NULL,
816 /* must/cannot opts */ NULL, NULL,
817 /* option proc */ doUsageOpt,
818 /* desc, NAME, name */ zHelpText, NULL, zHelp_Name,
819 /* disablement strs */ NULL, NULL },
821 { /* entry idx, value */ INDEX_OPT_MORE_HELP, VALUE_OPT_MORE_HELP,
822 /* equiv idx value */ NO_EQUIVALENT, 0,
823 /* equivalenced to */ NO_EQUIVALENT,
824 /* min, max, act ct */ 0, 1, 0,
825 /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, 0,
826 /* last opt argumnt */ { NULL },
827 /* arg list/cookie */ NULL,
828 /* must/cannot opts */ NULL, NULL,
829 /* option proc */ optionPagedUsage,
830 /* desc, NAME, name */ zMore_HelpText, NULL, zMore_Help_Name,
831 /* disablement strs */ NULL, NULL }
834 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
836 * Define the Ntpd Option Environment
838 tSCC zPROGNAME[] = "NTPD";
839 tSCC zUsageTitle[] =
840 "ntpd - NTP daemon program - Ver. 4.2.4p8\n\
841 USAGE: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n";
842 #define zRcName NULL
843 #define apzHomeList NULL
845 tSCC zBugsAddr[] = "http://bugs.ntp.org, bugs@ntp.org";
846 #define zExplain NULL
847 tSCC zDetail[] = "\n\n";
848 tSCC zFullVersion[] = NTPD_FULL_VERSION;
849 /* extracted from /usr/local/gnu/autogen-5.9.1/share/autogen/optcode.tpl near line 408 */
851 #if defined(ENABLE_NLS)
852 # define OPTPROC_BASE OPTPROC_TRANSLATE
853 static tOptionXlateProc translate_option_strings;
854 #else
855 # define OPTPROC_BASE OPTPROC_NONE
856 # define translate_option_strings NULL
857 #endif /* ENABLE_NLS */
859 tOptions ntpdOptions = {
860 OPTIONS_STRUCT_VERSION,
861 0, NULL, /* original argc + argv */
862 ( OPTPROC_BASE
863 + OPTPROC_ERRSTOP
864 + OPTPROC_SHORTOPT
865 + OPTPROC_LONGOPT
866 + OPTPROC_NO_REQ_OPT
867 + OPTPROC_ENVIRON
868 + OPTPROC_NO_ARGS ),
869 0, NULL, /* current option index, current option */
870 NULL, NULL, zPROGNAME,
871 zRcName, zCopyright, zCopyrightNotice,
872 zFullVersion, apzHomeList, zUsageTitle,
873 zExplain, zDetail, optDesc,
874 zBugsAddr, /* address to send bugs to */
875 NULL, NULL, /* extensions/saved state */
876 optionUsage, /* usage procedure */
877 translate_option_strings, /* translation procedure */
879 * Indexes to special options
881 { INDEX_OPT_MORE_HELP,
882 0 /* no option state saving */,
883 NO_EQUIVALENT /* index of '-#' option */,
884 NO_EQUIVALENT /* index of default opt */
886 32 /* full option count */, 29 /* user option count */
890 * Create the static procedure(s) declared above.
892 static void
893 doUsageOpt(
894 tOptions* pOptions,
895 tOptDesc* pOptDesc )
897 USAGE( EXIT_SUCCESS );
900 #if ! defined(TEST_NTPD_OPTS)
902 /* * * * * * *
904 * For the set-debug-level option, when DEBUG is #define-d.
906 #ifdef DEBUG
907 static void
908 doOptSet_Debug_Level(
909 tOptions* pOptions,
910 tOptDesc* pOptDesc )
912 /* extracted from ../include/debug-opt.def, line 29 */
913 DESC(DEBUG_LEVEL).optOccCt = atoi( pOptDesc->pzLastArg );
915 #endif /* defined DEBUG */
917 #endif /* defined(TEST_NTPD_OPTS) */
919 /* extracted from /usr/local/gnu/autogen-5.9.1/share/autogen/optmain.tpl near line 92 */
921 #if defined(TEST_NTPD_OPTS) /* TEST MAIN PROCEDURE: */
924 main( int argc, char** argv )
926 int res = EXIT_SUCCESS;
927 (void)optionProcess( &ntpdOptions, argc, argv );
929 void optionPutShell( tOptions* );
930 optionPutShell( &ntpdOptions );
932 return res;
934 #endif /* defined TEST_NTPD_OPTS */
935 /* extracted from /usr/local/gnu/autogen-5.9.1/share/autogen/optcode.tpl near line 514 */
937 #if ENABLE_NLS
938 #include <stdio.h>
939 #include <stdlib.h>
940 #include <string.h>
941 #include <unistd.h>
942 #include <autoopts/usage-txt.h>
944 static char* AO_gettext( char const* pz );
945 static void coerce_it(void** s);
947 static char*
948 AO_gettext( char const* pz )
950 char* pzRes;
951 if (pz == NULL)
952 return NULL;
953 pzRes = _(pz);
954 if (pzRes == pz)
955 return pzRes;
956 pzRes = strdup( pzRes );
957 if (pzRes == NULL) {
958 fputs( _("No memory for duping translated strings\n"), stderr );
959 exit( EXIT_FAILURE );
961 return pzRes;
964 static void coerce_it(void** s) { *s = AO_gettext(*s); }
965 #define COERSION(_f) \
966 coerce_it((void*)&(ntpdOptions._f))
969 * This invokes the translation code (e.g. gettext(3)).
971 static void
972 translate_option_strings( void )
975 * Guard against re-translation. It won't work. The strings will have
976 * been changed by the first pass through this code. One shot only.
978 if (option_usage_text.field_ct == 0)
979 return;
981 * Do the translations. The first pointer follows the field count field.
982 * The field count field is the size of a pointer.
985 char** ppz = (char**)(void*)&(option_usage_text);
986 int ix = option_usage_text.field_ct;
988 do {
989 ppz++;
990 *ppz = AO_gettext(*ppz);
991 } while (--ix > 0);
993 option_usage_text.field_ct = 0;
996 tOptDesc* pOD = ntpdOptions.pOptDesc;
997 int ix = ntpdOptions.optCt;
999 for (;;) {
1000 pOD->pzText = AO_gettext(pOD->pzText);
1001 pOD->pz_NAME = AO_gettext(pOD->pz_NAME);
1002 pOD->pz_Name = AO_gettext(pOD->pz_Name);
1003 pOD->pz_DisableName = AO_gettext(pOD->pz_DisableName);
1004 pOD->pz_DisablePfx = AO_gettext(pOD->pz_DisablePfx);
1005 if (--ix <= 0)
1006 break;
1007 pOD++;
1010 COERSION(pzCopyright);
1011 COERSION(pzCopyNotice);
1012 COERSION(pzFullVersion);
1013 COERSION(pzUsageTitle);
1014 COERSION(pzExplain);
1015 COERSION(pzDetail);
1018 #endif /* ENABLE_NLS */
1020 #ifdef __cplusplus
1022 #endif
1023 /* ntpd-opts.c ends here */