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