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