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