1 /* $NetBSD: ntpd-opts.c,v 1.15 2024/08/18 20:47:18 christos Exp $ */
2
3 /*
4 * EDIT THIS FILE WITH CAUTION (ntpd-opts.c)
5 *
6 * It has been AutoGen-ed May 25, 2024 at 12:03:09 AM by AutoGen 5.18.16
7 * From the definitions ntpd-opts.def
8 * and the template file options
9 *
10 * Generated from AutoOpts 42:1:17 templates.
11 *
12 * AutoOpts is a copyrighted work. This source file is not encumbered
13 * by AutoOpts licensing, but is provided under the licensing terms chosen
14 * by the ntpd author or copyright holder. AutoOpts is
15 * licensed under the terms of the LGPL. The redistributable library
16 * (``libopts'') is licensed under the terms of either the LGPL or, at the
17 * users discretion, the BSD license. See the AutoOpts and/or libopts sources
18 * for details.
19 *
20 * The ntpd program is copyrighted and licensed
21 * under the following terms:
22 *
23 * Copyright (C) 1992-2024 The University of Delaware and Network Time Foundation, all rights reserved.
24 * This is free software. It is licensed for use, modification and
25 * redistribution under the terms of the NTP License, copies of which
26 * can be seen at:
27 * <http://ntp.org/license>
28 * <http://opensource.org/licenses/ntp-license.php>
29 *
30 * Permission to use, copy, modify, and distribute this software and its
31 * documentation for any purpose with or without fee is hereby granted,
32 * provided that the above copyright notice appears in all copies and that
33 * both the copyright notice and this permission notice appear in
34 * supporting documentation, and that the name The University of Delaware not be used in
35 * advertising or publicity pertaining to distribution of the software
36 * without specific, written prior permission. The University of Delaware and Network Time Foundation makes no
37 * representations about the suitability this software for any purpose. It
38 * is provided "as is" without express or implied warranty.
39 */
40
41 #ifndef __doxygen__
42 #define OPTION_CODE_COMPILE 1
43 #include "ntpd-opts.h"
44 #include <sys/types.h>
45 #include <sys/stat.h>
46
47 #include <errno.h>
48 #include <fcntl.h>
49 #include <limits.h>
50 #include <stdio.h>
51 #include <stdlib.h>
52 #include <string.h>
53 #include <unistd.h>
54
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58 extern FILE * option_usage_fp;
59 #define zCopyright (ntpd_opt_strs+0)
60 #define zLicenseDescrip (ntpd_opt_strs+341)
61
62 /*
63 * global included definitions
64 */
65 #ifdef __windows
66 extern int atoi(const char *);
67 #else
68 # include <stdlib.h>
69 #endif
70
71 #ifdef __windows
72 extern int atoi(const char*);
73 #else
74 # include <stdlib.h>
75 #endif
76
77 #ifndef NULL
78 # define NULL 0
79 #endif
80
81 /**
82 * static const strings for ntpd options
83 */
84 static char const ntpd_opt_strs[3133] =
85 /* 0 */ "ntpd 4.2.8p18\n"
86 "Copyright (C) 1992-2024 The University of Delaware and Network Time Foundation, all rights reserved.\n"
87 "This is free software. It is licensed for use, modification and\n"
88 "redistribution under the terms of the NTP License, copies of which\n"
89 "can be seen at:\n"
90 " <http://ntp.org/license>\n"
91 " <http://opensource.org/licenses/ntp-license.php>\n\0"
92 /* 341 */ "Permission to use, copy, modify, and distribute this software and its\n"
93 "documentation for any purpose with or without fee is hereby granted,\n"
94 "provided that the above copyright notice appears in all copies and that\n"
95 "both the copyright notice and this permission notice appear in supporting\n"
96 "documentation, and that the name The University of Delaware not be used in\n"
97 "advertising or publicity pertaining to distribution of the software without\n"
98 "specific, written prior permission. The University of Delaware and Network\n"
99 "Time Foundation makes no representations about the suitability this\n"
100 "software for any purpose. It is provided \"as is\" without express or\n"
101 "implied warranty.\n\0"
102 /* 1009 */ "Force IPv4 DNS name resolution\0"
103 /* 1040 */ "IPV4\0"
104 /* 1045 */ "ipv4\0"
105 /* 1050 */ "Force IPv6 DNS name resolution\0"
106 /* 1081 */ "IPV6\0"
107 /* 1086 */ "ipv6\0"
108 /* 1091 */ "Require crypto authentication\0"
109 /* 1121 */ "AUTHREQ\0"
110 /* 1129 */ "authreq\0"
111 /* 1137 */ "Do not require crypto authentication\0"
112 /* 1174 */ "AUTHNOREQ\0"
113 /* 1184 */ "authnoreq\0"
114 /* 1194 */ "Allow us to sync to broadcast servers\0"
115 /* 1232 */ "BCASTSYNC\0"
116 /* 1242 */ "bcastsync\0"
117 /* 1252 */ "configuration file name\0"
118 /* 1276 */ "CONFIGFILE\0"
119 /* 1287 */ "configfile\0"
120 /* 1298 */ "Increase debug verbosity level\0"
121 /* 1329 */ "DEBUG_LEVEL\0"
122 /* 1341 */ "debug-level\0"
123 /* 1353 */ "Set the debug verbosity level\0"
124 /* 1383 */ "SET_DEBUG_LEVEL\0"
125 /* 1399 */ "set-debug-level\0"
126 /* 1415 */ "frequency drift file name\0"
127 /* 1441 */ "DRIFTFILE\0"
128 /* 1451 */ "driftfile\0"
129 /* 1461 */ "Allow the first adjustment to be Big\0"
130 /* 1498 */ "PANICGATE\0"
131 /* 1508 */ "panicgate\0"
132 /* 1518 */ "Step any initial offset correction.\0"
133 /* 1554 */ "FORCE_STEP_ONCE\0"
134 /* 1570 */ "force-step-once\0"
135 /* 1586 */ "Jail directory\0"
136 /* 1601 */ "JAILDIR\0"
137 /* 1609 */ "jaildir\0"
138 /* 1617 */ "built without --enable-clockctl or --enable-linuxcaps or --enable-solarisprivs\0"
139 /* 1696 */ "Listen on an interface name or address\0"
140 /* 1735 */ "INTERFACE\0"
141 /* 1745 */ "interface\0"
142 /* 1755 */ "path to symmetric keys\0"
143 /* 1778 */ "KEYFILE\0"
144 /* 1786 */ "keyfile\0"
145 /* 1794 */ "path to the log file\0"
146 /* 1815 */ "LOGFILE\0"
147 /* 1823 */ "logfile\0"
148 /* 1831 */ "Do not listen to virtual interfaces\0"
149 /* 1867 */ "NOVIRTUALIPS\0"
150 /* 1880 */ "novirtualips\0"
151 /* 1893 */ "Modify Multimedia Timer (Windows only)\0"
152 /* 1932 */ "MODIFYMMTIMER\0"
153 /* 1946 */ "modifymmtimer\0"
154 /* 1960 */ "Do not fork\0"
155 /* 1972 */ "NOFORK\0"
156 /* 1979 */ "nofork\0"
157 /* 1986 */ "Run at high priority\0"
158 /* 2007 */ "NICE\0"
159 /* 2012 */ "nice\0"
160 /* 2017 */ "path to the PID file\0"
161 /* 2038 */ "PIDFILE\0"
162 /* 2046 */ "pidfile\0"
163 /* 2054 */ "Process priority\0"
164 /* 2071 */ "PRIORITY\0"
165 /* 2080 */ "priority\0"
166 /* 2089 */ "Set the time and quit\0"
167 /* 2111 */ "QUIT\0"
168 /* 2116 */ "quit\0"
169 /* 2121 */ "Broadcast/propagation delay\0"
170 /* 2149 */ "PROPAGATIONDELAY\0"
171 /* 2166 */ "propagationdelay\0"
172 /* 2183 */ "Save parsed configuration and quit\0"
173 /* 2218 */ "SAVECONFIGQUIT\0"
174 /* 2233 */ "saveconfigquit\0"
175 /* 2248 */ "Statistics file location\0"
176 /* 2273 */ "STATSDIR\0"
177 /* 2282 */ "statsdir\0"
178 /* 2291 */ "Trusted key number\0"
179 /* 2310 */ "TRUSTEDKEY\0"
180 /* 2321 */ "trustedkey\0"
181 /* 2332 */ "Run as userid (or userid:groupid)\0"
182 /* 2366 */ "USER\0"
183 /* 2371 */ "user\0"
184 /* 2376 */ "interval in seconds between scans for new or dropped interfaces\0"
185 /* 2440 */ "UPDATEINTERVAL\0"
186 /* 2455 */ "updateinterval\0"
187 /* 2470 */ "make ARG an ntp variable (RW)\0"
188 /* 2500 */ "VAR\0"
189 /* 2504 */ "var\0"
190 /* 2508 */ "make ARG an ntp variable (RW|DEF)\0"
191 /* 2542 */ "DVAR\0"
192 /* 2547 */ "dvar\0"
193 /* 2552 */ "Seconds to wait for first clock sync\0"
194 /* 2589 */ "WAIT_SYNC\0"
195 /* 2599 */ "wait-sync\0"
196 /* 2609 */ "Slew up to 600 seconds\0"
197 /* 2632 */ "SLEW\0"
198 /* 2637 */ "slew\0"
199 /* 2642 */ "Use CPU cycle counter (Windows only)\0"
200 /* 2679 */ "USEPCC\0"
201 /* 2686 */ "usepcc\0"
202 /* 2693 */ "Force CPU cycle counter use (Windows only)\0"
203 /* 2736 */ "PCCFREQ\0"
204 /* 2744 */ "pccfreq\0"
205 /* 2752 */ "Register with mDNS as a NTP server\0"
206 /* 2787 */ "MDNS\0"
207 /* 2792 */ "mdns\0"
208 /* 2797 */ "display extended usage information and exit\0"
209 /* 2841 */ "help\0"
210 /* 2846 */ "extended usage information passed thru pager\0"
211 /* 2891 */ "more-help\0"
212 /* 2901 */ "output version information and exit\0"
213 /* 2937 */ "version\0"
214 /* 2945 */ "NTPD\0"
215 /* 2950 */ "ntpd - NTP daemon program - Ver. 4.2.8p18\n"
216 "Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \\\n"
217 "\t\t[ <server1> ... <serverN> ]\n\0"
218 /* 3082 */ "https://bugs.ntp.org, bugs@ntp.org\0"
219 /* 3117 */ "\n\0"
220 /* 3119 */ "ntpd 4.2.8p18";
221
222 /**
223 * ipv4 option description with
224 * "Must also have options" and "Incompatible options":
225 */
226 /** Descriptive text for the ipv4 option */
227 #define IPV4_DESC (ntpd_opt_strs+1009)
228 /** Upper-cased name for the ipv4 option */
229 #define IPV4_NAME (ntpd_opt_strs+1040)
230 /** Name string for the ipv4 option */
231 #define IPV4_name (ntpd_opt_strs+1045)
232 /** Other options that appear in conjunction with the ipv4 option */
233 static int const aIpv4CantList[] = {
234 INDEX_OPT_IPV6, NO_EQUIVALENT };
235 /** Compiled in flag settings for the ipv4 option */
236 #define IPV4_FLAGS (OPTST_DISABLED)
237
238 /**
239 * ipv6 option description with
240 * "Must also have options" and "Incompatible options":
241 */
242 /** Descriptive text for the ipv6 option */
243 #define IPV6_DESC (ntpd_opt_strs+1050)
244 /** Upper-cased name for the ipv6 option */
245 #define IPV6_NAME (ntpd_opt_strs+1081)
246 /** Name string for the ipv6 option */
247 #define IPV6_name (ntpd_opt_strs+1086)
248 /** Other options that appear in conjunction with the ipv6 option */
249 static int const aIpv6CantList[] = {
250 INDEX_OPT_IPV4, NO_EQUIVALENT };
251 /** Compiled in flag settings for the ipv6 option */
252 #define IPV6_FLAGS (OPTST_DISABLED)
253
254 /**
255 * authreq option description with
256 * "Must also have options" and "Incompatible options":
257 */
258 /** Descriptive text for the authreq option */
259 #define AUTHREQ_DESC (ntpd_opt_strs+1091)
260 /** Upper-cased name for the authreq option */
261 #define AUTHREQ_NAME (ntpd_opt_strs+1121)
262 /** Name string for the authreq option */
263 #define AUTHREQ_name (ntpd_opt_strs+1129)
264 /** Other options that appear in conjunction with the authreq option */
265 static int const aAuthreqCantList[] = {
266 INDEX_OPT_AUTHNOREQ, NO_EQUIVALENT };
267 /** Compiled in flag settings for the authreq option */
268 #define AUTHREQ_FLAGS (OPTST_DISABLED)
269
270 /**
271 * authnoreq option description with
272 * "Must also have options" and "Incompatible options":
273 */
274 /** Descriptive text for the authnoreq option */
275 #define AUTHNOREQ_DESC (ntpd_opt_strs+1137)
276 /** Upper-cased name for the authnoreq option */
277 #define AUTHNOREQ_NAME (ntpd_opt_strs+1174)
278 /** Name string for the authnoreq option */
279 #define AUTHNOREQ_name (ntpd_opt_strs+1184)
280 /** Other options that appear in conjunction with the authnoreq option */
281 static int const aAuthnoreqCantList[] = {
282 INDEX_OPT_AUTHREQ, NO_EQUIVALENT };
283 /** Compiled in flag settings for the authnoreq option */
284 #define AUTHNOREQ_FLAGS (OPTST_DISABLED)
285
286 /**
287 * bcastsync option description:
288 */
289 /** Descriptive text for the bcastsync option */
290 #define BCASTSYNC_DESC (ntpd_opt_strs+1194)
291 /** Upper-cased name for the bcastsync option */
292 #define BCASTSYNC_NAME (ntpd_opt_strs+1232)
293 /** Name string for the bcastsync option */
294 #define BCASTSYNC_name (ntpd_opt_strs+1242)
295 /** Compiled in flag settings for the bcastsync option */
296 #define BCASTSYNC_FLAGS (OPTST_DISABLED)
297
298 /**
299 * configfile option description:
300 */
301 /** Descriptive text for the configfile option */
302 #define CONFIGFILE_DESC (ntpd_opt_strs+1252)
303 /** Upper-cased name for the configfile option */
304 #define CONFIGFILE_NAME (ntpd_opt_strs+1276)
305 /** Name string for the configfile option */
306 #define CONFIGFILE_name (ntpd_opt_strs+1287)
307 /** Compiled in flag settings for the configfile option */
308 #define CONFIGFILE_FLAGS (OPTST_DISABLED \
309 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
310
311 /**
312 * debug-level option description:
313 */
314 /** Descriptive text for the debug-level option */
315 #define DEBUG_LEVEL_DESC (ntpd_opt_strs+1298)
316 /** Upper-cased name for the debug-level option */
317 #define DEBUG_LEVEL_NAME (ntpd_opt_strs+1329)
318 /** Name string for the debug-level option */
319 #define DEBUG_LEVEL_name (ntpd_opt_strs+1341)
320 /** Compiled in flag settings for the debug-level option */
321 #define DEBUG_LEVEL_FLAGS (OPTST_DISABLED)
322
323 /**
324 * set-debug-level option description:
325 */
326 /** Descriptive text for the set-debug-level option */
327 #define SET_DEBUG_LEVEL_DESC (ntpd_opt_strs+1353)
328 /** Upper-cased name for the set-debug-level option */
329 #define SET_DEBUG_LEVEL_NAME (ntpd_opt_strs+1383)
330 /** Name string for the set-debug-level option */
331 #define SET_DEBUG_LEVEL_name (ntpd_opt_strs+1399)
332 /** Compiled in flag settings for the set-debug-level option */
333 #define SET_DEBUG_LEVEL_FLAGS (OPTST_DISABLED \
334 | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
335
336 /**
337 * driftfile option description:
338 */
339 /** Descriptive text for the driftfile option */
340 #define DRIFTFILE_DESC (ntpd_opt_strs+1415)
341 /** Upper-cased name for the driftfile option */
342 #define DRIFTFILE_NAME (ntpd_opt_strs+1441)
343 /** Name string for the driftfile option */
344 #define DRIFTFILE_name (ntpd_opt_strs+1451)
345 /** Compiled in flag settings for the driftfile option */
346 #define DRIFTFILE_FLAGS (OPTST_DISABLED \
347 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
348
349 /**
350 * panicgate option description:
351 */
352 /** Descriptive text for the panicgate option */
353 #define PANICGATE_DESC (ntpd_opt_strs+1461)
354 /** Upper-cased name for the panicgate option */
355 #define PANICGATE_NAME (ntpd_opt_strs+1498)
356 /** Name string for the panicgate option */
357 #define PANICGATE_name (ntpd_opt_strs+1508)
358 /** Compiled in flag settings for the panicgate option */
359 #define PANICGATE_FLAGS (OPTST_DISABLED)
360
361 /**
362 * force_step_once option description:
363 */
364 /** Descriptive text for the force_step_once option */
365 #define FORCE_STEP_ONCE_DESC (ntpd_opt_strs+1518)
366 /** Upper-cased name for the force_step_once option */
367 #define FORCE_STEP_ONCE_NAME (ntpd_opt_strs+1554)
368 /** Name string for the force_step_once option */
369 #define FORCE_STEP_ONCE_name (ntpd_opt_strs+1570)
370 /** Compiled in flag settings for the force_step_once option */
371 #define FORCE_STEP_ONCE_FLAGS (OPTST_DISABLED)
372
373 /**
374 * jaildir option description:
375 */
376 #ifdef HAVE_DROPROOT
377 /** Descriptive text for the jaildir option */
378 #define JAILDIR_DESC (ntpd_opt_strs+1586)
379 /** Upper-cased name for the jaildir option */
380 #define JAILDIR_NAME (ntpd_opt_strs+1601)
381 /** Name string for the jaildir option */
382 #define JAILDIR_name (ntpd_opt_strs+1609)
383 /** Compiled in flag settings for the jaildir option */
384 #define JAILDIR_FLAGS (OPTST_DISABLED \
385 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
386
387 #else /* disable jaildir */
388 #define JAILDIR_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
389 #define JAILDIR_NAME NULL
390 /** Descriptive text for the jaildir option */
391 #define JAILDIR_DESC (ntpd_opt_strs+1617)
392 #define JAILDIR_name (ntpd_opt_strs+1609)
393 #endif /* HAVE_DROPROOT */
394
395 /**
396 * interface option description:
397 */
398 /** Descriptive text for the interface option */
399 #define INTERFACE_DESC (ntpd_opt_strs+1696)
400 /** Upper-cased name for the interface option */
401 #define INTERFACE_NAME (ntpd_opt_strs+1735)
402 /** Name string for the interface option */
403 #define INTERFACE_name (ntpd_opt_strs+1745)
404 /** Compiled in flag settings for the interface option */
405 #define INTERFACE_FLAGS (OPTST_DISABLED | OPTST_STACKED \
406 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
407
408 /**
409 * keyfile option description:
410 */
411 /** Descriptive text for the keyfile option */
412 #define KEYFILE_DESC (ntpd_opt_strs+1755)
413 /** Upper-cased name for the keyfile option */
414 #define KEYFILE_NAME (ntpd_opt_strs+1778)
415 /** Name string for the keyfile option */
416 #define KEYFILE_name (ntpd_opt_strs+1786)
417 /** Compiled in flag settings for the keyfile option */
418 #define KEYFILE_FLAGS (OPTST_DISABLED \
419 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
420
421 /**
422 * logfile option description:
423 */
424 /** Descriptive text for the logfile option */
425 #define LOGFILE_DESC (ntpd_opt_strs+1794)
426 /** Upper-cased name for the logfile option */
427 #define LOGFILE_NAME (ntpd_opt_strs+1815)
428 /** Name string for the logfile option */
429 #define LOGFILE_name (ntpd_opt_strs+1823)
430 /** Compiled in flag settings for the logfile option */
431 #define LOGFILE_FLAGS (OPTST_DISABLED \
432 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
433
434 /**
435 * novirtualips option description:
436 */
437 /** Descriptive text for the novirtualips option */
438 #define NOVIRTUALIPS_DESC (ntpd_opt_strs+1831)
439 /** Upper-cased name for the novirtualips option */
440 #define NOVIRTUALIPS_NAME (ntpd_opt_strs+1867)
441 /** Name string for the novirtualips option */
442 #define NOVIRTUALIPS_name (ntpd_opt_strs+1880)
443 /** Compiled in flag settings for the novirtualips option */
444 #define NOVIRTUALIPS_FLAGS (OPTST_DISABLED)
445
446 /**
447 * modifymmtimer option description:
448 */
449 #ifdef SYS_WINNT
450 /** Descriptive text for the modifymmtimer option */
451 #define MODIFYMMTIMER_DESC (ntpd_opt_strs+1893)
452 /** Upper-cased name for the modifymmtimer option */
453 #define MODIFYMMTIMER_NAME (ntpd_opt_strs+1932)
454 /** Name string for the modifymmtimer option */
455 #define MODIFYMMTIMER_name (ntpd_opt_strs+1946)
456 /** Compiled in flag settings for the modifymmtimer option */
457 #define MODIFYMMTIMER_FLAGS (OPTST_DISABLED)
458
459 #else /* disable modifymmtimer */
460 #define MODIFYMMTIMER_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
461 #define MODIFYMMTIMER_NAME NULL
462 #define MODIFYMMTIMER_DESC NULL
463 #define MODIFYMMTIMER_name NULL
464 #endif /* SYS_WINNT */
465
466 /**
467 * nofork option description with
468 * "Must also have options" and "Incompatible options":
469 */
470 /** Descriptive text for the nofork option */
471 #define NOFORK_DESC (ntpd_opt_strs+1960)
472 /** Upper-cased name for the nofork option */
473 #define NOFORK_NAME (ntpd_opt_strs+1972)
474 /** Name string for the nofork option */
475 #define NOFORK_name (ntpd_opt_strs+1979)
476 /** Other options that appear in conjunction with the nofork option */
477 static int const aNoforkCantList[] = {
478 INDEX_OPT_WAIT_SYNC, NO_EQUIVALENT };
479 /** Compiled in flag settings for the nofork option */
480 #define NOFORK_FLAGS (OPTST_DISABLED)
481
482 /**
483 * nice option description:
484 */
485 /** Descriptive text for the nice option */
486 #define NICE_DESC (ntpd_opt_strs+1986)
487 /** Upper-cased name for the nice option */
488 #define NICE_NAME (ntpd_opt_strs+2007)
489 /** Name string for the nice option */
490 #define NICE_name (ntpd_opt_strs+2012)
491 /** Compiled in flag settings for the nice option */
492 #define NICE_FLAGS (OPTST_DISABLED)
493
494 /**
495 * pidfile option description:
496 */
497 /** Descriptive text for the pidfile option */
498 #define PIDFILE_DESC (ntpd_opt_strs+2017)
499 /** Upper-cased name for the pidfile option */
500 #define PIDFILE_NAME (ntpd_opt_strs+2038)
501 /** Name string for the pidfile option */
502 #define PIDFILE_name (ntpd_opt_strs+2046)
503 /** Compiled in flag settings for the pidfile option */
504 #define PIDFILE_FLAGS (OPTST_DISABLED \
505 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
506
507 /**
508 * priority option description:
509 */
510 /** Descriptive text for the priority option */
511 #define PRIORITY_DESC (ntpd_opt_strs+2054)
512 /** Upper-cased name for the priority option */
513 #define PRIORITY_NAME (ntpd_opt_strs+2071)
514 /** Name string for the priority option */
515 #define PRIORITY_name (ntpd_opt_strs+2080)
516 /** Compiled in flag settings for the priority option */
517 #define PRIORITY_FLAGS (OPTST_DISABLED \
518 | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
519
520 /**
521 * quit option description with
522 * "Must also have options" and "Incompatible options":
523 */
524 /** Descriptive text for the quit option */
525 #define QUIT_DESC (ntpd_opt_strs+2089)
526 /** Upper-cased name for the quit option */
527 #define QUIT_NAME (ntpd_opt_strs+2111)
528 /** Name string for the quit option */
529 #define QUIT_name (ntpd_opt_strs+2116)
530 /** Other options that appear in conjunction with the quit option */
531 static int const aQuitCantList[] = {
532 INDEX_OPT_SAVECONFIGQUIT,
533 INDEX_OPT_WAIT_SYNC, NO_EQUIVALENT };
534 /** Compiled in flag settings for the quit option */
535 #define QUIT_FLAGS (OPTST_DISABLED)
536
537 /**
538 * propagationdelay option description:
539 */
540 /** Descriptive text for the propagationdelay option */
541 #define PROPAGATIONDELAY_DESC (ntpd_opt_strs+2121)
542 /** Upper-cased name for the propagationdelay option */
543 #define PROPAGATIONDELAY_NAME (ntpd_opt_strs+2149)
544 /** Name string for the propagationdelay option */
545 #define PROPAGATIONDELAY_name (ntpd_opt_strs+2166)
546 /** Compiled in flag settings for the propagationdelay option */
547 #define PROPAGATIONDELAY_FLAGS (OPTST_DISABLED \
548 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
549
550 /**
551 * saveconfigquit option description with
552 * "Must also have options" and "Incompatible options":
553 */
554 #ifdef SAVECONFIG
555 /** Descriptive text for the saveconfigquit option */
556 #define SAVECONFIGQUIT_DESC (ntpd_opt_strs+2183)
557 /** Upper-cased name for the saveconfigquit option */
558 #define SAVECONFIGQUIT_NAME (ntpd_opt_strs+2218)
559 /** Name string for the saveconfigquit option */
560 #define SAVECONFIGQUIT_name (ntpd_opt_strs+2233)
561 /** Other options that appear in conjunction with the saveconfigquit option */
562 static int const aSaveconfigquitCantList[] = {
563 INDEX_OPT_QUIT,
564 INDEX_OPT_WAIT_SYNC, NO_EQUIVALENT };
565 /** Compiled in flag settings for the saveconfigquit option */
566 #define SAVECONFIGQUIT_FLAGS (OPTST_DISABLED \
567 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
568
569 #else /* disable saveconfigquit */
570 #define SAVECONFIGQUIT_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
571 #define aSaveconfigquitCantList NULL
572 #define SAVECONFIGQUIT_NAME NULL
573 #define SAVECONFIGQUIT_DESC NULL
574 #define SAVECONFIGQUIT_name NULL
575 #endif /* SAVECONFIG */
576
577 /**
578 * statsdir option description:
579 */
580 /** Descriptive text for the statsdir option */
581 #define STATSDIR_DESC (ntpd_opt_strs+2248)
582 /** Upper-cased name for the statsdir option */
583 #define STATSDIR_NAME (ntpd_opt_strs+2273)
584 /** Name string for the statsdir option */
585 #define STATSDIR_name (ntpd_opt_strs+2282)
586 /** Compiled in flag settings for the statsdir option */
587 #define STATSDIR_FLAGS (OPTST_DISABLED \
588 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
589
590 /**
591 * trustedkey option description:
592 */
593 /** Descriptive text for the trustedkey option */
594 #define TRUSTEDKEY_DESC (ntpd_opt_strs+2291)
595 /** Upper-cased name for the trustedkey option */
596 #define TRUSTEDKEY_NAME (ntpd_opt_strs+2310)
597 /** Name string for the trustedkey option */
598 #define TRUSTEDKEY_name (ntpd_opt_strs+2321)
599 /** Compiled in flag settings for the trustedkey option */
600 #define TRUSTEDKEY_FLAGS (OPTST_DISABLED | OPTST_STACKED \
601 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
602
603 /**
604 * user option description:
605 */
606 #ifdef HAVE_DROPROOT
607 /** Descriptive text for the user option */
608 #define USER_DESC (ntpd_opt_strs+2332)
609 /** Upper-cased name for the user option */
610 #define USER_NAME (ntpd_opt_strs+2366)
611 /** Name string for the user option */
612 #define USER_name (ntpd_opt_strs+2371)
613 /** Compiled in flag settings for the user option */
614 #define USER_FLAGS (OPTST_DISABLED \
615 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
616
617 #else /* disable user */
618 #define USER_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
619 #define USER_NAME NULL
620 /** Descriptive text for the user option */
621 #define USER_DESC (ntpd_opt_strs+1617)
622 #define USER_name (ntpd_opt_strs+2371)
623 #endif /* HAVE_DROPROOT */
624
625 /**
626 * updateinterval option description:
627 */
628 /** Descriptive text for the updateinterval option */
629 #define UPDATEINTERVAL_DESC (ntpd_opt_strs+2376)
630 /** Upper-cased name for the updateinterval option */
631 #define UPDATEINTERVAL_NAME (ntpd_opt_strs+2440)
632 /** Name string for the updateinterval option */
633 #define UPDATEINTERVAL_name (ntpd_opt_strs+2455)
634 /** Compiled in flag settings for the updateinterval option */
635 #define UPDATEINTERVAL_FLAGS (OPTST_DISABLED \
636 | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
637
638 /**
639 * var option description:
640 */
641 /** Descriptive text for the var option */
642 #define VAR_DESC (ntpd_opt_strs+2470)
643 /** Upper-cased name for the var option */
644 #define VAR_NAME (ntpd_opt_strs+2500)
645 /** Name string for the var option */
646 #define VAR_name (ntpd_opt_strs+2504)
647 /** Compiled in flag settings for the var option */
648 #define VAR_FLAGS (OPTST_DISABLED | OPTST_STACKED \
649 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
650
651 /**
652 * dvar option description:
653 */
654 /** Descriptive text for the dvar option */
655 #define DVAR_DESC (ntpd_opt_strs+2508)
656 /** Upper-cased name for the dvar option */
657 #define DVAR_NAME (ntpd_opt_strs+2542)
658 /** Name string for the dvar option */
659 #define DVAR_name (ntpd_opt_strs+2547)
660 /** Compiled in flag settings for the dvar option */
661 #define DVAR_FLAGS (OPTST_DISABLED | OPTST_STACKED \
662 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
663
664 /**
665 * wait-sync option description with
666 * "Must also have options" and "Incompatible options":
667 */
668 #ifdef HAVE_WORKING_FORK
669 /** Descriptive text for the wait-sync option */
670 #define WAIT_SYNC_DESC (ntpd_opt_strs+2552)
671 /** Upper-cased name for the wait-sync option */
672 #define WAIT_SYNC_NAME (ntpd_opt_strs+2589)
673 /** Name string for the wait-sync option */
674 #define WAIT_SYNC_name (ntpd_opt_strs+2599)
675 /** Other options that appear in conjunction with the wait-sync option */
676 static int const aWait_SyncCantList[] = {
677 INDEX_OPT_NOFORK,
678 INDEX_OPT_QUIT,
679 INDEX_OPT_SAVECONFIGQUIT, NO_EQUIVALENT };
680 /** Compiled in flag settings for the wait-sync option */
681 #define WAIT_SYNC_FLAGS (OPTST_DISABLED \
682 | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
683
684 #else /* disable wait-sync */
685 #define WAIT_SYNC_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
686 #define aWait_SyncCantList NULL
687 #define WAIT_SYNC_NAME NULL
688 #define WAIT_SYNC_DESC NULL
689 #define WAIT_SYNC_name NULL
690 #endif /* HAVE_WORKING_FORK */
691
692 /**
693 * slew option description:
694 */
695 /** Descriptive text for the slew option */
696 #define SLEW_DESC (ntpd_opt_strs+2609)
697 /** Upper-cased name for the slew option */
698 #define SLEW_NAME (ntpd_opt_strs+2632)
699 /** Name string for the slew option */
700 #define SLEW_name (ntpd_opt_strs+2637)
701 /** Compiled in flag settings for the slew option */
702 #define SLEW_FLAGS (OPTST_DISABLED)
703
704 /**
705 * usepcc option description:
706 */
707 #ifdef SYS_WINNT
708 /** Descriptive text for the usepcc option */
709 #define USEPCC_DESC (ntpd_opt_strs+2642)
710 /** Upper-cased name for the usepcc option */
711 #define USEPCC_NAME (ntpd_opt_strs+2679)
712 /** Name string for the usepcc option */
713 #define USEPCC_name (ntpd_opt_strs+2686)
714 /** Compiled in flag settings for the usepcc option */
715 #define USEPCC_FLAGS (OPTST_DISABLED)
716
717 #else /* disable usepcc */
718 #define USEPCC_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
719 #define USEPCC_NAME NULL
720 #define USEPCC_DESC NULL
721 #define USEPCC_name NULL
722 #endif /* SYS_WINNT */
723
724 /**
725 * pccfreq option description:
726 */
727 #ifdef SYS_WINNT
728 /** Descriptive text for the pccfreq option */
729 #define PCCFREQ_DESC (ntpd_opt_strs+2693)
730 /** Upper-cased name for the pccfreq option */
731 #define PCCFREQ_NAME (ntpd_opt_strs+2736)
732 /** Name string for the pccfreq option */
733 #define PCCFREQ_name (ntpd_opt_strs+2744)
734 /** Compiled in flag settings for the pccfreq option */
735 #define PCCFREQ_FLAGS (OPTST_DISABLED \
736 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
737
738 #else /* disable pccfreq */
739 #define PCCFREQ_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
740 #define PCCFREQ_NAME NULL
741 #define PCCFREQ_DESC NULL
742 #define PCCFREQ_name NULL
743 #endif /* SYS_WINNT */
744
745 /**
746 * mdns option description:
747 */
748 #ifdef HAVE_DNSREGISTRATION
749 /** Descriptive text for the mdns option */
750 #define MDNS_DESC (ntpd_opt_strs+2752)
751 /** Upper-cased name for the mdns option */
752 #define MDNS_NAME (ntpd_opt_strs+2787)
753 /** Name string for the mdns option */
754 #define MDNS_name (ntpd_opt_strs+2792)
755 /** Compiled in flag settings for the mdns option */
756 #define MDNS_FLAGS (OPTST_DISABLED)
757
758 #else /* disable mdns */
759 #define MDNS_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
760 #define MDNS_NAME NULL
761 #define MDNS_DESC NULL
762 #define MDNS_name NULL
763 #endif /* HAVE_DNSREGISTRATION */
764
765 /*
766 * Help/More_Help/Version option descriptions:
767 */
768 #define HELP_DESC (ntpd_opt_strs+2797)
769 #define HELP_name (ntpd_opt_strs+2841)
770 #ifdef HAVE_WORKING_FORK
771 #define MORE_HELP_DESC (ntpd_opt_strs+2846)
772 #define MORE_HELP_name (ntpd_opt_strs+2891)
773 #define MORE_HELP_FLAGS (OPTST_IMM | OPTST_NO_INIT)
774 #else
775 #define MORE_HELP_DESC HELP_DESC
776 #define MORE_HELP_name HELP_name
777 #define MORE_HELP_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
778 #endif
779 #ifdef NO_OPTIONAL_OPT_ARGS
780 # define VER_FLAGS (OPTST_IMM | OPTST_NO_INIT)
781 #else
782 # define VER_FLAGS (OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \
783 OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT)
784 #endif
785 #define VER_DESC (ntpd_opt_strs+2901)
786 #define VER_name (ntpd_opt_strs+2937)
787 /**
788 * Declare option callback procedures
789 */
790 extern tOptProc
791 ntpOptionPrintVersion, optionBooleanVal, optionNestedVal,
792 optionNumericVal, optionPagedUsage, optionResetOpt,
793 optionStackArg, optionTimeDate, optionTimeVal,
794 optionUnstackArg, optionVendorOption;
795 static tOptProc
796 doOptDebug_Level, doUsageOpt;
797 #define VER_PROC ntpOptionPrintVersion
798
799 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
800 /**
801 * Define the ntpd Option Descriptions.
802 * This is an array of OPTION_CT entries, one for each
803 * option that the ntpd program responds to.
804 */
805 static tOptDesc optDesc[OPTION_CT] = {
806 { /* entry idx, value */ 0, VALUE_OPT_IPV4,
807 /* equiv idx, value */ 0, VALUE_OPT_IPV4,
808 /* equivalenced to */ NO_EQUIVALENT,
809 /* min, max, act ct */ 0, 1, 0,
810 /* opt state flags */ IPV4_FLAGS, 0,
811 /* last opt argumnt */ { NULL }, /* --ipv4 */
812 /* arg list/cookie */ NULL,
813 /* must/cannot opts */ NULL, aIpv4CantList,
814 /* option proc */ NULL,
815 /* desc, NAME, name */ IPV4_DESC, IPV4_NAME, IPV4_name,
816 /* disablement strs */ NULL, NULL },
817
818 { /* entry idx, value */ 1, VALUE_OPT_IPV6,
819 /* equiv idx, value */ 1, VALUE_OPT_IPV6,
820 /* equivalenced to */ NO_EQUIVALENT,
821 /* min, max, act ct */ 0, 1, 0,
822 /* opt state flags */ IPV6_FLAGS, 0,
823 /* last opt argumnt */ { NULL }, /* --ipv6 */
824 /* arg list/cookie */ NULL,
825 /* must/cannot opts */ NULL, aIpv6CantList,
826 /* option proc */ NULL,
827 /* desc, NAME, name */ IPV6_DESC, IPV6_NAME, IPV6_name,
828 /* disablement strs */ NULL, NULL },
829
830 { /* entry idx, value */ 2, VALUE_OPT_AUTHREQ,
831 /* equiv idx, value */ 2, VALUE_OPT_AUTHREQ,
832 /* equivalenced to */ NO_EQUIVALENT,
833 /* min, max, act ct */ 0, 1, 0,
834 /* opt state flags */ AUTHREQ_FLAGS, 0,
835 /* last opt argumnt */ { NULL }, /* --authreq */
836 /* arg list/cookie */ NULL,
837 /* must/cannot opts */ NULL, aAuthreqCantList,
838 /* option proc */ NULL,
839 /* desc, NAME, name */ AUTHREQ_DESC, AUTHREQ_NAME, AUTHREQ_name,
840 /* disablement strs */ NULL, NULL },
841
842 { /* entry idx, value */ 3, VALUE_OPT_AUTHNOREQ,
843 /* equiv idx, value */ 3, VALUE_OPT_AUTHNOREQ,
844 /* equivalenced to */ NO_EQUIVALENT,
845 /* min, max, act ct */ 0, 1, 0,
846 /* opt state flags */ AUTHNOREQ_FLAGS, 0,
847 /* last opt argumnt */ { NULL }, /* --authnoreq */
848 /* arg list/cookie */ NULL,
849 /* must/cannot opts */ NULL, aAuthnoreqCantList,
850 /* option proc */ NULL,
851 /* desc, NAME, name */ AUTHNOREQ_DESC, AUTHNOREQ_NAME, AUTHNOREQ_name,
852 /* disablement strs */ NULL, NULL },
853
854 { /* entry idx, value */ 4, VALUE_OPT_BCASTSYNC,
855 /* equiv idx, value */ 4, VALUE_OPT_BCASTSYNC,
856 /* equivalenced to */ NO_EQUIVALENT,
857 /* min, max, act ct */ 0, 1, 0,
858 /* opt state flags */ BCASTSYNC_FLAGS, 0,
859 /* last opt argumnt */ { NULL }, /* --bcastsync */
860 /* arg list/cookie */ NULL,
861 /* must/cannot opts */ NULL, NULL,
862 /* option proc */ NULL,
863 /* desc, NAME, name */ BCASTSYNC_DESC, BCASTSYNC_NAME, BCASTSYNC_name,
864 /* disablement strs */ NULL, NULL },
865
866 { /* entry idx, value */ 5, VALUE_OPT_CONFIGFILE,
867 /* equiv idx, value */ 5, VALUE_OPT_CONFIGFILE,
868 /* equivalenced to */ NO_EQUIVALENT,
869 /* min, max, act ct */ 0, 1, 0,
870 /* opt state flags */ CONFIGFILE_FLAGS, 0,
871 /* last opt argumnt */ { NULL }, /* --configfile */
872 /* arg list/cookie */ NULL,
873 /* must/cannot opts */ NULL, NULL,
874 /* option proc */ NULL,
875 /* desc, NAME, name */ CONFIGFILE_DESC, CONFIGFILE_NAME, CONFIGFILE_name,
876 /* disablement strs */ NULL, NULL },
877
878 { /* entry idx, value */ 6, VALUE_OPT_DEBUG_LEVEL,
879 /* equiv idx, value */ 6, VALUE_OPT_DEBUG_LEVEL,
880 /* equivalenced to */ NO_EQUIVALENT,
881 /* min, max, act ct */ 0, NOLIMIT, 0,
882 /* opt state flags */ DEBUG_LEVEL_FLAGS, 0,
883 /* last opt argumnt */ { NULL }, /* --debug-level */
884 /* arg list/cookie */ NULL,
885 /* must/cannot opts */ NULL, NULL,
886 /* option proc */ doOptDebug_Level,
887 /* desc, NAME, name */ DEBUG_LEVEL_DESC, DEBUG_LEVEL_NAME, DEBUG_LEVEL_name,
888 /* disablement strs */ NULL, NULL },
889
890 { /* entry idx, value */ 7, VALUE_OPT_SET_DEBUG_LEVEL,
891 /* equiv idx, value */ 7, VALUE_OPT_SET_DEBUG_LEVEL,
892 /* equivalenced to */ NO_EQUIVALENT,
893 /* min, max, act ct */ 0, NOLIMIT, 0,
894 /* opt state flags */ SET_DEBUG_LEVEL_FLAGS, 0,
895 /* last opt argumnt */ { NULL }, /* --set-debug-level */
896 /* arg list/cookie */ NULL,
897 /* must/cannot opts */ NULL, NULL,
898 /* option proc */ optionNumericVal,
899 /* desc, NAME, name */ SET_DEBUG_LEVEL_DESC, SET_DEBUG_LEVEL_NAME, SET_DEBUG_LEVEL_name,
900 /* disablement strs */ NULL, NULL },
901
902 { /* entry idx, value */ 8, VALUE_OPT_DRIFTFILE,
903 /* equiv idx, value */ 8, VALUE_OPT_DRIFTFILE,
904 /* equivalenced to */ NO_EQUIVALENT,
905 /* min, max, act ct */ 0, 1, 0,
906 /* opt state flags */ DRIFTFILE_FLAGS, 0,
907 /* last opt argumnt */ { NULL }, /* --driftfile */
908 /* arg list/cookie */ NULL,
909 /* must/cannot opts */ NULL, NULL,
910 /* option proc */ NULL,
911 /* desc, NAME, name */ DRIFTFILE_DESC, DRIFTFILE_NAME, DRIFTFILE_name,
912 /* disablement strs */ NULL, NULL },
913
914 { /* entry idx, value */ 9, VALUE_OPT_PANICGATE,
915 /* equiv idx, value */ 9, VALUE_OPT_PANICGATE,
916 /* equivalenced to */ NO_EQUIVALENT,
917 /* min, max, act ct */ 0, NOLIMIT, 0,
918 /* opt state flags */ PANICGATE_FLAGS, 0,
919 /* last opt argumnt */ { NULL }, /* --panicgate */
920 /* arg list/cookie */ NULL,
921 /* must/cannot opts */ NULL, NULL,
922 /* option proc */ NULL,
923 /* desc, NAME, name */ PANICGATE_DESC, PANICGATE_NAME, PANICGATE_name,
924 /* disablement strs */ NULL, NULL },
925
926 { /* entry idx, value */ 10, VALUE_OPT_FORCE_STEP_ONCE,
927 /* equiv idx, value */ 10, VALUE_OPT_FORCE_STEP_ONCE,
928 /* equivalenced to */ NO_EQUIVALENT,
929 /* min, max, act ct */ 0, 1, 0,
930 /* opt state flags */ FORCE_STEP_ONCE_FLAGS, 0,
931 /* last opt argumnt */ { NULL }, /* --force_step_once */
932 /* arg list/cookie */ NULL,
933 /* must/cannot opts */ NULL, NULL,
934 /* option proc */ NULL,
935 /* desc, NAME, name */ FORCE_STEP_ONCE_DESC, FORCE_STEP_ONCE_NAME, FORCE_STEP_ONCE_name,
936 /* disablement strs */ NULL, NULL },
937
938 { /* entry idx, value */ 11, VALUE_OPT_JAILDIR,
939 /* equiv idx, value */ 11, VALUE_OPT_JAILDIR,
940 /* equivalenced to */ NO_EQUIVALENT,
941 /* min, max, act ct */ 0, 1, 0,
942 /* opt state flags */ JAILDIR_FLAGS, 0,
943 /* last opt argumnt */ { NULL }, /* --jaildir */
944 /* arg list/cookie */ NULL,
945 /* must/cannot opts */ NULL, NULL,
946 /* option proc */ NULL,
947 /* desc, NAME, name */ JAILDIR_DESC, JAILDIR_NAME, JAILDIR_name,
948 /* disablement strs */ NULL, NULL },
949
950 { /* entry idx, value */ 12, VALUE_OPT_INTERFACE,
951 /* equiv idx, value */ 12, VALUE_OPT_INTERFACE,
952 /* equivalenced to */ NO_EQUIVALENT,
953 /* min, max, act ct */ 0, NOLIMIT, 0,
954 /* opt state flags */ INTERFACE_FLAGS, 0,
955 /* last opt argumnt */ { NULL }, /* --interface */
956 /* arg list/cookie */ NULL,
957 /* must/cannot opts */ NULL, NULL,
958 /* option proc */ optionStackArg,
959 /* desc, NAME, name */ INTERFACE_DESC, INTERFACE_NAME, INTERFACE_name,
960 /* disablement strs */ NULL, NULL },
961
962 { /* entry idx, value */ 13, VALUE_OPT_KEYFILE,
963 /* equiv idx, value */ 13, VALUE_OPT_KEYFILE,
964 /* equivalenced to */ NO_EQUIVALENT,
965 /* min, max, act ct */ 0, 1, 0,
966 /* opt state flags */ KEYFILE_FLAGS, 0,
967 /* last opt argumnt */ { NULL }, /* --keyfile */
968 /* arg list/cookie */ NULL,
969 /* must/cannot opts */ NULL, NULL,
970 /* option proc */ NULL,
971 /* desc, NAME, name */ KEYFILE_DESC, KEYFILE_NAME, KEYFILE_name,
972 /* disablement strs */ NULL, NULL },
973
974 { /* entry idx, value */ 14, VALUE_OPT_LOGFILE,
975 /* equiv idx, value */ 14, VALUE_OPT_LOGFILE,
976 /* equivalenced to */ NO_EQUIVALENT,
977 /* min, max, act ct */ 0, 1, 0,
978 /* opt state flags */ LOGFILE_FLAGS, 0,
979 /* last opt argumnt */ { NULL }, /* --logfile */
980 /* arg list/cookie */ NULL,
981 /* must/cannot opts */ NULL, NULL,
982 /* option proc */ NULL,
983 /* desc, NAME, name */ LOGFILE_DESC, LOGFILE_NAME, LOGFILE_name,
984 /* disablement strs */ NULL, NULL },
985
986 { /* entry idx, value */ 15, VALUE_OPT_NOVIRTUALIPS,
987 /* equiv idx, value */ 15, VALUE_OPT_NOVIRTUALIPS,
988 /* equivalenced to */ NO_EQUIVALENT,
989 /* min, max, act ct */ 0, 1, 0,
990 /* opt state flags */ NOVIRTUALIPS_FLAGS, 0,
991 /* last opt argumnt */ { NULL }, /* --novirtualips */
992 /* arg list/cookie */ NULL,
993 /* must/cannot opts */ NULL, NULL,
994 /* option proc */ NULL,
995 /* desc, NAME, name */ NOVIRTUALIPS_DESC, NOVIRTUALIPS_NAME, NOVIRTUALIPS_name,
996 /* disablement strs */ NULL, NULL },
997
998 { /* entry idx, value */ 16, VALUE_OPT_MODIFYMMTIMER,
999 /* equiv idx, value */ 16, VALUE_OPT_MODIFYMMTIMER,
1000 /* equivalenced to */ NO_EQUIVALENT,
1001 /* min, max, act ct */ 0, 1, 0,
1002 /* opt state flags */ MODIFYMMTIMER_FLAGS, 0,
1003 /* last opt argumnt */ { NULL }, /* --modifymmtimer */
1004 /* arg list/cookie */ NULL,
1005 /* must/cannot opts */ NULL, NULL,
1006 /* option proc */ NULL,
1007 /* desc, NAME, name */ MODIFYMMTIMER_DESC, MODIFYMMTIMER_NAME, MODIFYMMTIMER_name,
1008 /* disablement strs */ NULL, NULL },
1009
1010 { /* entry idx, value */ 17, VALUE_OPT_NOFORK,
1011 /* equiv idx, value */ 17, VALUE_OPT_NOFORK,
1012 /* equivalenced to */ NO_EQUIVALENT,
1013 /* min, max, act ct */ 0, 1, 0,
1014 /* opt state flags */ NOFORK_FLAGS, 0,
1015 /* last opt argumnt */ { NULL }, /* --nofork */
1016 /* arg list/cookie */ NULL,
1017 /* must/cannot opts */ NULL, aNoforkCantList,
1018 /* option proc */ NULL,
1019 /* desc, NAME, name */ NOFORK_DESC, NOFORK_NAME, NOFORK_name,
1020 /* disablement strs */ NULL, NULL },
1021
1022 { /* entry idx, value */ 18, VALUE_OPT_NICE,
1023 /* equiv idx, value */ 18, VALUE_OPT_NICE,
1024 /* equivalenced to */ NO_EQUIVALENT,
1025 /* min, max, act ct */ 0, 1, 0,
1026 /* opt state flags */ NICE_FLAGS, 0,
1027 /* last opt argumnt */ { NULL }, /* --nice */
1028 /* arg list/cookie */ NULL,
1029 /* must/cannot opts */ NULL, NULL,
1030 /* option proc */ NULL,
1031 /* desc, NAME, name */ NICE_DESC, NICE_NAME, NICE_name,
1032 /* disablement strs */ NULL, NULL },
1033
1034 { /* entry idx, value */ 19, VALUE_OPT_PIDFILE,
1035 /* equiv idx, value */ 19, VALUE_OPT_PIDFILE,
1036 /* equivalenced to */ NO_EQUIVALENT,
1037 /* min, max, act ct */ 0, 1, 0,
1038 /* opt state flags */ PIDFILE_FLAGS, 0,
1039 /* last opt argumnt */ { NULL }, /* --pidfile */
1040 /* arg list/cookie */ NULL,
1041 /* must/cannot opts */ NULL, NULL,
1042 /* option proc */ NULL,
1043 /* desc, NAME, name */ PIDFILE_DESC, PIDFILE_NAME, PIDFILE_name,
1044 /* disablement strs */ NULL, NULL },
1045
1046 { /* entry idx, value */ 20, VALUE_OPT_PRIORITY,
1047 /* equiv idx, value */ 20, VALUE_OPT_PRIORITY,
1048 /* equivalenced to */ NO_EQUIVALENT,
1049 /* min, max, act ct */ 0, 1, 0,
1050 /* opt state flags */ PRIORITY_FLAGS, 0,
1051 /* last opt argumnt */ { NULL }, /* --priority */
1052 /* arg list/cookie */ NULL,
1053 /* must/cannot opts */ NULL, NULL,
1054 /* option proc */ optionNumericVal,
1055 /* desc, NAME, name */ PRIORITY_DESC, PRIORITY_NAME, PRIORITY_name,
1056 /* disablement strs */ NULL, NULL },
1057
1058 { /* entry idx, value */ 21, VALUE_OPT_QUIT,
1059 /* equiv idx, value */ 21, VALUE_OPT_QUIT,
1060 /* equivalenced to */ NO_EQUIVALENT,
1061 /* min, max, act ct */ 0, 1, 0,
1062 /* opt state flags */ QUIT_FLAGS, 0,
1063 /* last opt argumnt */ { NULL }, /* --quit */
1064 /* arg list/cookie */ NULL,
1065 /* must/cannot opts */ NULL, aQuitCantList,
1066 /* option proc */ NULL,
1067 /* desc, NAME, name */ QUIT_DESC, QUIT_NAME, QUIT_name,
1068 /* disablement strs */ NULL, NULL },
1069
1070 { /* entry idx, value */ 22, VALUE_OPT_PROPAGATIONDELAY,
1071 /* equiv idx, value */ 22, VALUE_OPT_PROPAGATIONDELAY,
1072 /* equivalenced to */ NO_EQUIVALENT,
1073 /* min, max, act ct */ 0, 1, 0,
1074 /* opt state flags */ PROPAGATIONDELAY_FLAGS, 0,
1075 /* last opt argumnt */ { NULL }, /* --propagationdelay */
1076 /* arg list/cookie */ NULL,
1077 /* must/cannot opts */ NULL, NULL,
1078 /* option proc */ NULL,
1079 /* desc, NAME, name */ PROPAGATIONDELAY_DESC, PROPAGATIONDELAY_NAME, PROPAGATIONDELAY_name,
1080 /* disablement strs */ NULL, NULL },
1081
1082 { /* entry idx, value */ 23, VALUE_OPT_SAVECONFIGQUIT,
1083 /* equiv idx, value */ 23, VALUE_OPT_SAVECONFIGQUIT,
1084 /* equivalenced to */ NO_EQUIVALENT,
1085 /* min, max, act ct */ 0, 1, 0,
1086 /* opt state flags */ SAVECONFIGQUIT_FLAGS, 0,
1087 /* last opt argumnt */ { NULL }, /* --saveconfigquit */
1088 /* arg list/cookie */ NULL,
1089 /* must/cannot opts */ NULL, aSaveconfigquitCantList,
1090 /* option proc */ NULL,
1091 /* desc, NAME, name */ SAVECONFIGQUIT_DESC, SAVECONFIGQUIT_NAME, SAVECONFIGQUIT_name,
1092 /* disablement strs */ NULL, NULL },
1093
1094 { /* entry idx, value */ 24, VALUE_OPT_STATSDIR,
1095 /* equiv idx, value */ 24, VALUE_OPT_STATSDIR,
1096 /* equivalenced to */ NO_EQUIVALENT,
1097 /* min, max, act ct */ 0, 1, 0,
1098 /* opt state flags */ STATSDIR_FLAGS, 0,
1099 /* last opt argumnt */ { NULL }, /* --statsdir */
1100 /* arg list/cookie */ NULL,
1101 /* must/cannot opts */ NULL, NULL,
1102 /* option proc */ NULL,
1103 /* desc, NAME, name */ STATSDIR_DESC, STATSDIR_NAME, STATSDIR_name,
1104 /* disablement strs */ NULL, NULL },
1105
1106 { /* entry idx, value */ 25, VALUE_OPT_TRUSTEDKEY,
1107 /* equiv idx, value */ 25, VALUE_OPT_TRUSTEDKEY,
1108 /* equivalenced to */ NO_EQUIVALENT,
1109 /* min, max, act ct */ 0, NOLIMIT, 0,
1110 /* opt state flags */ TRUSTEDKEY_FLAGS, 0,
1111 /* last opt argumnt */ { NULL }, /* --trustedkey */
1112 /* arg list/cookie */ NULL,
1113 /* must/cannot opts */ NULL, NULL,
1114 /* option proc */ optionStackArg,
1115 /* desc, NAME, name */ TRUSTEDKEY_DESC, TRUSTEDKEY_NAME, TRUSTEDKEY_name,
1116 /* disablement strs */ NULL, NULL },
1117
1118 { /* entry idx, value */ 26, VALUE_OPT_USER,
1119 /* equiv idx, value */ 26, VALUE_OPT_USER,
1120 /* equivalenced to */ NO_EQUIVALENT,
1121 /* min, max, act ct */ 0, 1, 0,
1122 /* opt state flags */ USER_FLAGS, 0,
1123 /* last opt argumnt */ { NULL }, /* --user */
1124 /* arg list/cookie */ NULL,
1125 /* must/cannot opts */ NULL, NULL,
1126 /* option proc */ NULL,
1127 /* desc, NAME, name */ USER_DESC, USER_NAME, USER_name,
1128 /* disablement strs */ NULL, NULL },
1129
1130 { /* entry idx, value */ 27, VALUE_OPT_UPDATEINTERVAL,
1131 /* equiv idx, value */ 27, VALUE_OPT_UPDATEINTERVAL,
1132 /* equivalenced to */ NO_EQUIVALENT,
1133 /* min, max, act ct */ 0, 1, 0,
1134 /* opt state flags */ UPDATEINTERVAL_FLAGS, 0,
1135 /* last opt argumnt */ { NULL }, /* --updateinterval */
1136 /* arg list/cookie */ NULL,
1137 /* must/cannot opts */ NULL, NULL,
1138 /* option proc */ optionNumericVal,
1139 /* desc, NAME, name */ UPDATEINTERVAL_DESC, UPDATEINTERVAL_NAME, UPDATEINTERVAL_name,
1140 /* disablement strs */ NULL, NULL },
1141
1142 { /* entry idx, value */ 28, VALUE_OPT_VAR,
1143 /* equiv idx, value */ 28, VALUE_OPT_VAR,
1144 /* equivalenced to */ NO_EQUIVALENT,
1145 /* min, max, act ct */ 0, NOLIMIT, 0,
1146 /* opt state flags */ VAR_FLAGS, 0,
1147 /* last opt argumnt */ { NULL }, /* --var */
1148 /* arg list/cookie */ NULL,
1149 /* must/cannot opts */ NULL, NULL,
1150 /* option proc */ optionStackArg,
1151 /* desc, NAME, name */ VAR_DESC, VAR_NAME, VAR_name,
1152 /* disablement strs */ NULL, NULL },
1153
1154 { /* entry idx, value */ 29, VALUE_OPT_DVAR,
1155 /* equiv idx, value */ 29, VALUE_OPT_DVAR,
1156 /* equivalenced to */ NO_EQUIVALENT,
1157 /* min, max, act ct */ 0, NOLIMIT, 0,
1158 /* opt state flags */ DVAR_FLAGS, 0,
1159 /* last opt argumnt */ { NULL }, /* --dvar */
1160 /* arg list/cookie */ NULL,
1161 /* must/cannot opts */ NULL, NULL,
1162 /* option proc */ optionStackArg,
1163 /* desc, NAME, name */ DVAR_DESC, DVAR_NAME, DVAR_name,
1164 /* disablement strs */ NULL, NULL },
1165
1166 { /* entry idx, value */ 30, VALUE_OPT_WAIT_SYNC,
1167 /* equiv idx, value */ 30, VALUE_OPT_WAIT_SYNC,
1168 /* equivalenced to */ NO_EQUIVALENT,
1169 /* min, max, act ct */ 0, 1, 0,
1170 /* opt state flags */ WAIT_SYNC_FLAGS, 0,
1171 /* last opt argumnt */ { NULL }, /* --wait-sync */
1172 /* arg list/cookie */ NULL,
1173 /* must/cannot opts */ NULL, aWait_SyncCantList,
1174 /* option proc */ optionNumericVal,
1175 /* desc, NAME, name */ WAIT_SYNC_DESC, WAIT_SYNC_NAME, WAIT_SYNC_name,
1176 /* disablement strs */ NULL, NULL },
1177
1178 { /* entry idx, value */ 31, VALUE_OPT_SLEW,
1179 /* equiv idx, value */ 31, VALUE_OPT_SLEW,
1180 /* equivalenced to */ NO_EQUIVALENT,
1181 /* min, max, act ct */ 0, 1, 0,
1182 /* opt state flags */ SLEW_FLAGS, 0,
1183 /* last opt argumnt */ { NULL }, /* --slew */
1184 /* arg list/cookie */ NULL,
1185 /* must/cannot opts */ NULL, NULL,
1186 /* option proc */ NULL,
1187 /* desc, NAME, name */ SLEW_DESC, SLEW_NAME, SLEW_name,
1188 /* disablement strs */ NULL, NULL },
1189
1190 { /* entry idx, value */ 32, VALUE_OPT_USEPCC,
1191 /* equiv idx, value */ 32, VALUE_OPT_USEPCC,
1192 /* equivalenced to */ NO_EQUIVALENT,
1193 /* min, max, act ct */ 0, 1, 0,
1194 /* opt state flags */ USEPCC_FLAGS, 0,
1195 /* last opt argumnt */ { NULL }, /* --usepcc */
1196 /* arg list/cookie */ NULL,
1197 /* must/cannot opts */ NULL, NULL,
1198 /* option proc */ NULL,
1199 /* desc, NAME, name */ USEPCC_DESC, USEPCC_NAME, USEPCC_name,
1200 /* disablement strs */ NULL, NULL },
1201
1202 { /* entry idx, value */ 33, VALUE_OPT_PCCFREQ,
1203 /* equiv idx, value */ 33, VALUE_OPT_PCCFREQ,
1204 /* equivalenced to */ NO_EQUIVALENT,
1205 /* min, max, act ct */ 0, 1, 0,
1206 /* opt state flags */ PCCFREQ_FLAGS, 0,
1207 /* last opt argumnt */ { NULL }, /* --pccfreq */
1208 /* arg list/cookie */ NULL,
1209 /* must/cannot opts */ NULL, NULL,
1210 /* option proc */ NULL,
1211 /* desc, NAME, name */ PCCFREQ_DESC, PCCFREQ_NAME, PCCFREQ_name,
1212 /* disablement strs */ NULL, NULL },
1213
1214 { /* entry idx, value */ 34, VALUE_OPT_MDNS,
1215 /* equiv idx, value */ 34, VALUE_OPT_MDNS,
1216 /* equivalenced to */ NO_EQUIVALENT,
1217 /* min, max, act ct */ 0, 1, 0,
1218 /* opt state flags */ MDNS_FLAGS, 0,
1219 /* last opt argumnt */ { NULL }, /* --mdns */
1220 /* arg list/cookie */ NULL,
1221 /* must/cannot opts */ NULL, NULL,
1222 /* option proc */ NULL,
1223 /* desc, NAME, name */ MDNS_DESC, MDNS_NAME, MDNS_name,
1224 /* disablement strs */ NULL, NULL },
1225
1226 { /* entry idx, value */ INDEX_OPT_VERSION, VALUE_OPT_VERSION,
1227 /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_VERSION,
1228 /* equivalenced to */ NO_EQUIVALENT,
1229 /* min, max, act ct */ 0, 1, 0,
1230 /* opt state flags */ VER_FLAGS, AOUSE_VERSION,
1231 /* last opt argumnt */ { NULL },
1232 /* arg list/cookie */ NULL,
1233 /* must/cannot opts */ NULL, NULL,
1234 /* option proc */ VER_PROC,
1235 /* desc, NAME, name */ VER_DESC, NULL, VER_name,
1236 /* disablement strs */ NULL, NULL },
1237
1238
1239
1240 { /* entry idx, value */ INDEX_OPT_HELP, VALUE_OPT_HELP,
1241 /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_HELP,
1242 /* equivalenced to */ NO_EQUIVALENT,
1243 /* min, max, act ct */ 0, 1, 0,
1244 /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, AOUSE_HELP,
1245 /* last opt argumnt */ { NULL },
1246 /* arg list/cookie */ NULL,
1247 /* must/cannot opts */ NULL, NULL,
1248 /* option proc */ doUsageOpt,
1249 /* desc, NAME, name */ HELP_DESC, NULL, HELP_name,
1250 /* disablement strs */ NULL, NULL },
1251
1252 { /* entry idx, value */ INDEX_OPT_MORE_HELP, VALUE_OPT_MORE_HELP,
1253 /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_MORE_HELP,
1254 /* equivalenced to */ NO_EQUIVALENT,
1255 /* min, max, act ct */ 0, 1, 0,
1256 /* opt state flags */ MORE_HELP_FLAGS, AOUSE_MORE_HELP,
1257 /* last opt argumnt */ { NULL },
1258 /* arg list/cookie */ NULL,
1259 /* must/cannot opts */ NULL, NULL,
1260 /* option proc */ optionPagedUsage,
1261 /* desc, NAME, name */ MORE_HELP_DESC, NULL, MORE_HELP_name,
1262 /* disablement strs */ NULL, NULL }
1263 };
1264
1265
1266 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1267 /** Reference to the upper cased version of ntpd. */
1268 #define zPROGNAME (ntpd_opt_strs+2945)
1269 /** Reference to the title line for ntpd usage. */
1270 #define zUsageTitle (ntpd_opt_strs+2950)
1271 /** There is no ntpd configuration file. */
1272 #define zRcName NULL
1273 /** There are no directories to search for ntpd config files. */
1274 #define apzHomeList NULL
1275 /** The ntpd program bug email address. */
1276 #define zBugsAddr (ntpd_opt_strs+3082)
1277 /** Clarification/explanation of what ntpd does. */
1278 #define zExplain (ntpd_opt_strs+3117)
1279 /** Extra detail explaining what ntpd does. */
1280 #define zDetail (NULL)
1281 /** The full version string for ntpd. */
1282 #define zFullVersion (ntpd_opt_strs+3119)
1283 /* extracted from optcode.tlib near line 342 */
1284
1285 #if defined(ENABLE_NLS)
1286 # define OPTPROC_BASE OPTPROC_TRANSLATE
1287 static tOptionXlateProc translate_option_strings;
1288 #else
1289 # define OPTPROC_BASE OPTPROC_NONE
1290 # define translate_option_strings NULL
1291 #endif /* ENABLE_NLS */
1292
1293 #define ntpd_full_usage (NULL)
1294 #define ntpd_short_usage (NULL)
1295
1296 #endif /* not defined __doxygen__ */
1297
1298 /*
1299 * Create the static procedure(s) declared above.
1300 */
1301 /**
1302 * The callout function that invokes the optionUsage function.
1303 *
1304 * @param[in] opts the AutoOpts option description structure
1305 * @param[in] od the descriptor for the "help" (usage) option.
1306 * @noreturn
1307 */
1308 static void
doUsageOpt(tOptions * opts,tOptDesc * od)1309 doUsageOpt(tOptions * opts, tOptDesc * od)
1310 {
1311 int ex_code;
1312 ex_code = NTPD_EXIT_SUCCESS;
1313 optionUsage(&ntpdOptions, ex_code);
1314 /* NOTREACHED */
1315 exit(NTPD_EXIT_FAILURE);
1316 (void)opts;
1317 (void)od;
1318 }
1319
1320 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1321 /**
1322 * Code to handle the debug-level option.
1323 *
1324 * @param[in] pOptions the ntpd options data structure
1325 * @param[in,out] pOptDesc the option descriptor for this option.
1326 */
1327 static void
doOptDebug_Level(tOptions * pOptions,tOptDesc * pOptDesc)1328 doOptDebug_Level(tOptions* pOptions, tOptDesc* pOptDesc)
1329 {
1330 /*
1331 * Be sure the flag-code[0] handles special values for the options pointer
1332 * viz. (poptions <= OPTPROC_EMIT_LIMIT) *and also* the special flag bit
1333 * ((poptdesc->fOptState & OPTST_RESET) != 0) telling the option to
1334 * reset its state.
1335 */
1336 /* extracted from debug-opt.def, line 15 */
1337 OPT_VALUE_SET_DEBUG_LEVEL++;
1338 (void)pOptDesc;
1339 (void)pOptions;
1340 }
1341 /* extracted from optmain.tlib near line 1250 */
1342
1343 /**
1344 * The directory containing the data associated with ntpd.
1345 */
1346 #ifndef PKGDATADIR
1347 # define PKGDATADIR ""
1348 #endif
1349
1350 /**
1351 * Information about the person or institution that packaged ntpd
1352 * for the current distribution.
1353 */
1354 #ifndef WITH_PACKAGER
1355 # define ntpd_packager_info NULL
1356 #else
1357 /** Packager information for ntpd. */
1358 static char const ntpd_packager_info[] =
1359 "Packaged by " WITH_PACKAGER
1360
1361 # ifdef WITH_PACKAGER_VERSION
1362 " ("WITH_PACKAGER_VERSION")"
1363 # endif
1364
1365 # ifdef WITH_PACKAGER_BUG_REPORTS
1366 "\nReport ntpd bugs to " WITH_PACKAGER_BUG_REPORTS
1367 # endif
1368 "\n";
1369 #endif
1370 #ifndef __doxygen__
1371
1372 #endif /* __doxygen__ */
1373 /**
1374 * The option definitions for ntpd. The one structure that
1375 * binds them all.
1376 */
1377 tOptions ntpdOptions = {
1378 OPTIONS_STRUCT_VERSION,
1379 0, NULL, /* original argc + argv */
1380 ( OPTPROC_BASE
1381 + OPTPROC_ERRSTOP
1382 + OPTPROC_SHORTOPT
1383 + OPTPROC_LONGOPT
1384 + OPTPROC_NO_REQ_OPT
1385 + OPTPROC_ENVIRON
1386 + OPTPROC_MISUSE ),
1387 0, NULL, /* current option index, current option */
1388 NULL, NULL, zPROGNAME,
1389 zRcName, zCopyright, zLicenseDescrip,
1390 zFullVersion, apzHomeList, zUsageTitle,
1391 zExplain, zDetail, optDesc,
1392 zBugsAddr, /* address to send bugs to */
1393 NULL, NULL, /* extensions/saved state */
1394 optionUsage, /* usage procedure */
1395 translate_option_strings, /* translation procedure */
1396 /*
1397 * Indexes to special options
1398 */
1399 { INDEX_OPT_MORE_HELP, /* more-help option index */
1400 NO_EQUIVALENT, /* save option index */
1401 NO_EQUIVALENT, /* '-#' option index */
1402 NO_EQUIVALENT /* index of default opt */
1403 },
1404 38 /* full option count */, 35 /* user option count */,
1405 ntpd_full_usage, ntpd_short_usage,
1406 NULL, NULL,
1407 PKGDATADIR, ntpd_packager_info
1408 };
1409
1410 #if ENABLE_NLS
1411 /**
1412 * This code is designed to translate translatable option text for the
1413 * ntpd program. These translations happen upon entry
1414 * to optionProcess().
1415 */
1416 #include <stdio.h>
1417 #include <stdlib.h>
1418 #include <string.h>
1419 #include <unistd.h>
1420 #ifdef HAVE_DCGETTEXT
1421 # include <gettext.h>
1422 #endif
1423 #include <autoopts/usage-txt.h>
1424
1425 static char * AO_gettext(char const * pz);
1426 static void coerce_it(void ** s);
1427
1428 /**
1429 * AutoGen specific wrapper function for gettext. It relies on the macro _()
1430 * to convert from English to the target language, then strdup-duplicates the
1431 * result string. It tries the "libopts" domain first, then whatever has been
1432 * set via the \a textdomain(3) call.
1433 *
1434 * @param[in] pz the input text used as a lookup key.
1435 * @returns the translated text (if there is one),
1436 * or the original text (if not).
1437 */
1438 static char *
AO_gettext(char const * pz)1439 AO_gettext(char const * pz)
1440 {
1441 char * res;
1442 if (pz == NULL)
1443 return NULL;
1444 #ifdef HAVE_DCGETTEXT
1445 /*
1446 * While processing the option_xlateable_txt data, try to use the
1447 * "libopts" domain. Once we switch to the option descriptor data,
1448 * do *not* use that domain.
1449 */
1450 if (option_xlateable_txt.field_ct != 0) {
1451 res = dgettext("libopts", pz);
1452 if (res == pz)
1453 res = (char *)VOIDP(_(pz));
1454 } else
1455 res = (char *)VOIDP(_(pz));
1456 #else
1457 res = (char *)VOIDP(_(pz));
1458 #endif
1459 if (res == pz)
1460 return res;
1461 res = strdup(res);
1462 if (res == NULL) {
1463 fputs(_("No memory for duping translated strings\n"), stderr);
1464 exit(NTPD_EXIT_FAILURE);
1465 }
1466 return res;
1467 }
1468
1469 /**
1470 * All the pointers we use are marked "* const", but they are stored in
1471 * writable memory. Coerce the mutability and set the pointer.
1472 */
coerce_it(void ** s)1473 static void coerce_it(void ** s) { *s = AO_gettext(*s);
1474 }
1475
1476 /**
1477 * Translate all the translatable strings in the ntpdOptions
1478 * structure defined above. This is done only once.
1479 */
1480 static void
translate_option_strings(void)1481 translate_option_strings(void)
1482 {
1483 tOptions * const opts = &ntpdOptions;
1484
1485 /*
1486 * Guard against re-translation. It won't work. The strings will have
1487 * been changed by the first pass through this code. One shot only.
1488 */
1489 if (option_xlateable_txt.field_ct != 0) {
1490 /*
1491 * Do the translations. The first pointer follows the field count
1492 * field. The field count field is the size of a pointer.
1493 */
1494 char ** ppz = (char**)VOIDP(&(option_xlateable_txt));
1495 int ix = option_xlateable_txt.field_ct;
1496
1497 do {
1498 ppz++; /* skip over field_ct */
1499 *ppz = AO_gettext(*ppz);
1500 } while (--ix > 0);
1501 /* prevent re-translation and disable "libopts" domain lookup */
1502 option_xlateable_txt.field_ct = 0;
1503
1504 coerce_it(VOIDP(&(opts->pzCopyright)));
1505 coerce_it(VOIDP(&(opts->pzCopyNotice)));
1506 coerce_it(VOIDP(&(opts->pzFullVersion)));
1507 coerce_it(VOIDP(&(opts->pzUsageTitle)));
1508 coerce_it(VOIDP(&(opts->pzExplain)));
1509 coerce_it(VOIDP(&(opts->pzDetail)));
1510 {
1511 tOptDesc * od = opts->pOptDesc;
1512 for (ix = opts->optCt; ix > 0; ix--, od++)
1513 coerce_it(VOIDP(&(od->pzText)));
1514 }
1515 }
1516 }
1517 #endif /* ENABLE_NLS */
1518
1519 #ifdef DO_NOT_COMPILE_THIS_CODE_IT_IS_FOR_GETTEXT
1520 /** I18N function strictly for xgettext. Do not compile. */
bogus_function(void)1521 static void bogus_function(void) {
1522 /* TRANSLATORS:
1523
1524 The following dummy function was crated solely so that xgettext can
1525 extract the correct strings. These strings are actually referenced
1526 by a field name in the ntpdOptions structure noted in the
1527 comments below. The literal text is defined in ntpd_opt_strs.
1528
1529 NOTE: the strings below are segmented with respect to the source string
1530 ntpd_opt_strs. The strings above are handed off for translation
1531 at run time a paragraph at a time. Consequently, they are presented here
1532 for translation a paragraph at a time.
1533
1534 ALSO: often the description for an option will reference another option
1535 by name. These are set off with apostrophe quotes (I hope). Do not
1536 translate option names.
1537 */
1538 /* referenced via ntpdOptions.pzCopyright */
1539 puts(_("ntpd 4.2.8p18\n\
1540 Copyright (C) 1992-2024 The University of Delaware and Network Time Foundation, all rights reserved.\n\
1541 This is free software. It is licensed for use, modification and\n\
1542 redistribution under the terms of the NTP License, copies of which\n\
1543 can be seen at:\n"));
1544 puts(_(" <http://ntp.org/license>\n\
1545 <http://opensource.org/licenses/ntp-license.php>\n"));
1546
1547 /* referenced via ntpdOptions.pzCopyNotice */
1548 puts(_("Permission to use, copy, modify, and distribute this software and its\n\
1549 documentation for any purpose with or without fee is hereby granted,\n\
1550 provided that the above copyright notice appears in all copies and that\n\
1551 both the copyright notice and this permission notice appear in supporting\n\
1552 documentation, and that the name The University of Delaware not be used in\n\
1553 advertising or publicity pertaining to distribution of the software without\n\
1554 specific, written prior permission. The University of Delaware and Network\n\
1555 Time Foundation makes no representations about the suitability this\n\
1556 software for any purpose. It is provided \"as is\" without express or\n\
1557 implied warranty.\n"));
1558
1559 /* referenced via ntpdOptions.pOptDesc->pzText */
1560 puts(_("Force IPv4 DNS name resolution"));
1561
1562 /* referenced via ntpdOptions.pOptDesc->pzText */
1563 puts(_("Force IPv6 DNS name resolution"));
1564
1565 /* referenced via ntpdOptions.pOptDesc->pzText */
1566 puts(_("Require crypto authentication"));
1567
1568 /* referenced via ntpdOptions.pOptDesc->pzText */
1569 puts(_("Do not require crypto authentication"));
1570
1571 /* referenced via ntpdOptions.pOptDesc->pzText */
1572 puts(_("Allow us to sync to broadcast servers"));
1573
1574 /* referenced via ntpdOptions.pOptDesc->pzText */
1575 puts(_("configuration file name"));
1576
1577 /* referenced via ntpdOptions.pOptDesc->pzText */
1578 puts(_("Increase debug verbosity level"));
1579
1580 /* referenced via ntpdOptions.pOptDesc->pzText */
1581 puts(_("Set the debug verbosity level"));
1582
1583 /* referenced via ntpdOptions.pOptDesc->pzText */
1584 puts(_("frequency drift file name"));
1585
1586 /* referenced via ntpdOptions.pOptDesc->pzText */
1587 puts(_("Allow the first adjustment to be Big"));
1588
1589 /* referenced via ntpdOptions.pOptDesc->pzText */
1590 puts(_("Step any initial offset correction."));
1591
1592 /* referenced via ntpdOptions.pOptDesc->pzText */
1593 puts(_("Jail directory"));
1594
1595 /* referenced via ntpdOptions.pOptDesc->pzText */
1596 puts(_("built without --enable-clockctl or --enable-linuxcaps or --enable-solarisprivs"));
1597
1598 /* referenced via ntpdOptions.pOptDesc->pzText */
1599 puts(_("Listen on an interface name or address"));
1600
1601 /* referenced via ntpdOptions.pOptDesc->pzText */
1602 puts(_("path to symmetric keys"));
1603
1604 /* referenced via ntpdOptions.pOptDesc->pzText */
1605 puts(_("path to the log file"));
1606
1607 /* referenced via ntpdOptions.pOptDesc->pzText */
1608 puts(_("Do not listen to virtual interfaces"));
1609
1610 /* referenced via ntpdOptions.pOptDesc->pzText */
1611 puts(_("Modify Multimedia Timer (Windows only)"));
1612
1613 /* referenced via ntpdOptions.pOptDesc->pzText */
1614 puts(_("Do not fork"));
1615
1616 /* referenced via ntpdOptions.pOptDesc->pzText */
1617 puts(_("Run at high priority"));
1618
1619 /* referenced via ntpdOptions.pOptDesc->pzText */
1620 puts(_("path to the PID file"));
1621
1622 /* referenced via ntpdOptions.pOptDesc->pzText */
1623 puts(_("Process priority"));
1624
1625 /* referenced via ntpdOptions.pOptDesc->pzText */
1626 puts(_("Set the time and quit"));
1627
1628 /* referenced via ntpdOptions.pOptDesc->pzText */
1629 puts(_("Broadcast/propagation delay"));
1630
1631 /* referenced via ntpdOptions.pOptDesc->pzText */
1632 puts(_("Save parsed configuration and quit"));
1633
1634 /* referenced via ntpdOptions.pOptDesc->pzText */
1635 puts(_("Statistics file location"));
1636
1637 /* referenced via ntpdOptions.pOptDesc->pzText */
1638 puts(_("Trusted key number"));
1639
1640 /* referenced via ntpdOptions.pOptDesc->pzText */
1641 puts(_("Run as userid (or userid:groupid)"));
1642
1643 /* referenced via ntpdOptions.pOptDesc->pzText */
1644 puts(_("built without --enable-clockctl or --enable-linuxcaps or --enable-solarisprivs"));
1645
1646 /* referenced via ntpdOptions.pOptDesc->pzText */
1647 puts(_("interval in seconds between scans for new or dropped interfaces"));
1648
1649 /* referenced via ntpdOptions.pOptDesc->pzText */
1650 puts(_("make ARG an ntp variable (RW)"));
1651
1652 /* referenced via ntpdOptions.pOptDesc->pzText */
1653 puts(_("make ARG an ntp variable (RW|DEF)"));
1654
1655 /* referenced via ntpdOptions.pOptDesc->pzText */
1656 puts(_("Seconds to wait for first clock sync"));
1657
1658 /* referenced via ntpdOptions.pOptDesc->pzText */
1659 puts(_("Slew up to 600 seconds"));
1660
1661 /* referenced via ntpdOptions.pOptDesc->pzText */
1662 puts(_("Use CPU cycle counter (Windows only)"));
1663
1664 /* referenced via ntpdOptions.pOptDesc->pzText */
1665 puts(_("Force CPU cycle counter use (Windows only)"));
1666
1667 /* referenced via ntpdOptions.pOptDesc->pzText */
1668 puts(_("Register with mDNS as a NTP server"));
1669
1670 /* referenced via ntpdOptions.pOptDesc->pzText */
1671 puts(_("display extended usage information and exit"));
1672
1673 /* referenced via ntpdOptions.pOptDesc->pzText */
1674 puts(_("extended usage information passed thru pager"));
1675
1676 /* referenced via ntpdOptions.pOptDesc->pzText */
1677 puts(_("output version information and exit"));
1678
1679 /* referenced via ntpdOptions.pzUsageTitle */
1680 puts(_("ntpd - NTP daemon program - Ver. 4.2.8p18\n\
1681 Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \\\n\
1682 \t\t[ <server1> ... <serverN> ]\n"));
1683
1684 /* referenced via ntpdOptions.pzExplain */
1685 puts(_("\n"));
1686
1687 /* referenced via ntpdOptions.pzFullVersion */
1688 puts(_("ntpd 4.2.8p18"));
1689
1690 /* referenced via ntpdOptions.pzFullUsage */
1691 puts(_("<<<NOT-FOUND>>>"));
1692
1693 /* referenced via ntpdOptions.pzShortUsage */
1694 puts(_("<<<NOT-FOUND>>>"));
1695 /* LIBOPTS-MESSAGES: */
1696 #line 67 "../autoopts.c"
1697 puts(_("allocation of %d bytes failed\n"));
1698 #line 89 "../autoopts.c"
1699 puts(_("allocation of %d bytes failed\n"));
1700 #line 48 "../init.c"
1701 puts(_("AutoOpts function called without option descriptor\n"));
1702 #line 81 "../init.c"
1703 puts(_("\tThis exceeds the compiled library version: "));
1704 #line 79 "../init.c"
1705 puts(_("Automated Options Processing Error!\n"
1706 "\t%s called AutoOpts function with structure version %d:%d:%d.\n"));
1707 #line 78 "../autoopts.c"
1708 puts(_("realloc of %d bytes at 0x%p failed\n"));
1709 #line 83 "../init.c"
1710 puts(_("\tThis is less than the minimum library version: "));
1711 #line 121 "../version.c"
1712 puts(_("Automated Options version %s\n"
1713 "\tCopyright (C) 1999-2017 by Bruce Korb - all rights reserved\n"));
1714 #line 49 "../makeshell.c"
1715 puts(_("(AutoOpts bug): %s.\n"));
1716 #line 90 "../reset.c"
1717 puts(_("optionResetOpt() called, but reset-option not configured"));
1718 #line 241 "../usage.c"
1719 puts(_("could not locate the 'help' option"));
1720 #line 330 "../autoopts.c"
1721 puts(_("optionProcess() was called with invalid data"));
1722 #line 697 "../usage.c"
1723 puts(_("invalid argument type specified"));
1724 #line 568 "../find.c"
1725 puts(_("defaulted to option with optional arg"));
1726 #line 76 "../alias.c"
1727 puts(_("aliasing option is out of range."));
1728 #line 210 "../enum.c"
1729 puts(_("%s error: the keyword '%s' is ambiguous for %s\n"));
1730 #line 78 "../find.c"
1731 puts(_(" The following options match:\n"));
1732 #line 263 "../find.c"
1733 puts(_("%s: ambiguous option name: %s (matches %d options)\n"));
1734 #line 161 "../check.c"
1735 puts(_("%s: Command line arguments required\n"));
1736 #line 43 "../alias.c"
1737 puts(_("%d %s%s options allowed\n"));
1738 #line 56 "../makeshell.c"
1739 puts(_("%s error %d (%s) calling %s for '%s'\n"));
1740 #line 268 "../makeshell.c"
1741 puts(_("interprocess pipe"));
1742 #line 171 "../version.c"
1743 puts(_("error: version option argument '%c' invalid. Use:\n"
1744 "\t'v' - version only\n"
1745 "\t'c' - version and copyright\n"
1746 "\t'n' - version and full copyright notice\n"));
1747 #line 58 "../check.c"
1748 puts(_("%s error: the '%s' and '%s' options conflict\n"));
1749 #line 187 "../find.c"
1750 puts(_("%s: The '%s' option has been disabled."));
1751 #line 400 "../find.c"
1752 puts(_("%s: The '%s' option has been disabled."));
1753 #line 38 "../alias.c"
1754 puts(_("-equivalence"));
1755 #line 439 "../find.c"
1756 puts(_("%s: illegal option -- %c\n"));
1757 #line 110 "../reset.c"
1758 puts(_("%s: illegal option -- %c\n"));
1759 #line 241 "../find.c"
1760 puts(_("%s: illegal option -- %s\n"));
1761 #line 740 "../find.c"
1762 puts(_("%s: illegal option -- %s\n"));
1763 #line 118 "../reset.c"
1764 puts(_("%s: illegal option -- %s\n"));
1765 #line 305 "../find.c"
1766 puts(_("%s: unknown vendor extension option -- %s\n"));
1767 #line 135 "../enum.c"
1768 puts(_(" or an integer from %d through %d\n"));
1769 #line 145 "../enum.c"
1770 puts(_(" or an integer from %d through %d\n"));
1771 #line 696 "../usage.c"
1772 puts(_("%s error: invalid option descriptor for %s\n"));
1773 #line 1030 "../usage.c"
1774 puts(_("%s error: invalid option descriptor for %s\n"));
1775 #line 355 "../find.c"
1776 puts(_("%s: invalid option name: %s\n"));
1777 #line 497 "../find.c"
1778 puts(_("%s: The '%s' option requires an argument.\n"));
1779 #line 150 "../autoopts.c"
1780 puts(_("(AutoOpts bug): Equivalenced option '%s' was equivalenced to both\n"
1781 "\t'%s' and '%s'."));
1782 #line 94 "../check.c"
1783 puts(_("%s error: The %s option is required\n"));
1784 #line 602 "../find.c"
1785 puts(_("%s: The '%s' option cannot have an argument.\n"));
1786 #line 151 "../check.c"
1787 puts(_("%s: Command line arguments are not allowed.\n"));
1788 #line 568 "../save.c"
1789 puts(_("error %d (%s) creating %s\n"));
1790 #line 210 "../enum.c"
1791 puts(_("%s error: '%s' does not match any %s keywords.\n"));
1792 #line 93 "../reset.c"
1793 puts(_("%s error: The '%s' option requires an argument.\n"));
1794 #line 122 "../save.c"
1795 puts(_("error %d (%s) stat-ing %s\n"));
1796 #line 175 "../save.c"
1797 puts(_("error %d (%s) stat-ing %s\n"));
1798 #line 143 "../restore.c"
1799 puts(_("%s error: no saved option state\n"));
1800 #line 225 "../autoopts.c"
1801 puts(_("'%s' is not a command line option.\n"));
1802 #line 113 "../time.c"
1803 puts(_("%s error: '%s' is not a recognizable date/time.\n"));
1804 #line 50 "../time.c"
1805 puts(_("%s error: '%s' is not a recognizable time duration.\n"));
1806 #line 92 "../check.c"
1807 puts(_("%s error: The %s option must appear %d times.\n"));
1808 #line 165 "../numeric.c"
1809 puts(_("%s error: '%s' is not a recognizable number.\n"));
1810 #line 176 "../enum.c"
1811 puts(_("%s error: %s exceeds %s keyword count\n"));
1812 #line 279 "../usage.c"
1813 puts(_("Try '%s %s' for more information.\n"));
1814 #line 45 "../alias.c"
1815 puts(_("one %s%s option allowed\n"));
1816 #line 170 "../makeshell.c"
1817 puts(_("standard output"));
1818 #line 905 "../makeshell.c"
1819 puts(_("standard output"));
1820 #line 223 "../usage.c"
1821 puts(_("standard output"));
1822 #line 364 "../usage.c"
1823 puts(_("standard output"));
1824 #line 574 "../usage.c"
1825 puts(_("standard output"));
1826 #line 178 "../version.c"
1827 puts(_("standard output"));
1828 #line 223 "../usage.c"
1829 puts(_("standard error"));
1830 #line 364 "../usage.c"
1831 puts(_("standard error"));
1832 #line 574 "../usage.c"
1833 puts(_("standard error"));
1834 #line 178 "../version.c"
1835 puts(_("standard error"));
1836 #line 170 "../makeshell.c"
1837 puts(_("write"));
1838 #line 905 "../makeshell.c"
1839 puts(_("write"));
1840 #line 222 "../usage.c"
1841 puts(_("write"));
1842 #line 363 "../usage.c"
1843 puts(_("write"));
1844 #line 573 "../usage.c"
1845 puts(_("write"));
1846 #line 177 "../version.c"
1847 puts(_("write"));
1848 #line 60 "../numeric.c"
1849 puts(_("%s error: %s option value %ld is out of range.\n"));
1850 #line 44 "../check.c"
1851 puts(_("%s error: %s option requires the %s option\n"));
1852 #line 121 "../save.c"
1853 puts(_("%s warning: cannot save options - %s not regular file\n"));
1854 #line 174 "../save.c"
1855 puts(_("%s warning: cannot save options - %s not regular file\n"));
1856 #line 193 "../save.c"
1857 puts(_("%s warning: cannot save options - %s not regular file\n"));
1858 #line 567 "../save.c"
1859 puts(_("%s warning: cannot save options - %s not regular file\n"));
1860 /* END-LIBOPTS-MESSAGES */
1861
1862 /* USAGE-TEXT: */
1863 #line 822 "../usage.c"
1864 puts(_("\t\t\t\t- an alternate for '%s'\n"));
1865 #line 1097 "../usage.c"
1866 puts(_("Version, usage and configuration options:"));
1867 #line 873 "../usage.c"
1868 puts(_("\t\t\t\t- default option for unnamed options\n"));
1869 #line 786 "../usage.c"
1870 puts(_("\t\t\t\t- disabled as '--%s'\n"));
1871 #line 1066 "../usage.c"
1872 puts(_(" --- %-14s %s\n"));
1873 #line 1064 "../usage.c"
1874 puts(_("This option has been disabled"));
1875 #line 813 "../usage.c"
1876 puts(_("\t\t\t\t- enabled by default\n"));
1877 #line 40 "../alias.c"
1878 puts(_("%s error: only "));
1879 #line 1143 "../usage.c"
1880 puts(_(" - examining environment variables named %s_*\n"));
1881 #line 168 "../file.c"
1882 puts(_("\t\t\t\t- file must not pre-exist\n"));
1883 #line 172 "../file.c"
1884 puts(_("\t\t\t\t- file must pre-exist\n"));
1885 #line 329 "../usage.c"
1886 puts(_("Options are specified by doubled hyphens and their name or by a single\n"
1887 "hyphen and the flag character.\n"));
1888 #line 882 "../makeshell.c"
1889 puts(_("\n"
1890 "= = = = = = = =\n\n"
1891 "This incarnation of genshell will produce\n"
1892 "a shell script to parse the options for %s:\n\n"));
1893 #line 142 "../enum.c"
1894 puts(_(" or an integer mask with any of the lower %d bits set\n"));
1895 #line 846 "../usage.c"
1896 puts(_("\t\t\t\t- is a set membership option\n"));
1897 #line 867 "../usage.c"
1898 puts(_("\t\t\t\t- must appear between %d and %d times\n"));
1899 #line 331 "../usage.c"
1900 puts(_("Options are specified by single or double hyphens and their name.\n"));
1901 #line 853 "../usage.c"
1902 puts(_("\t\t\t\t- may appear multiple times\n"));
1903 #line 840 "../usage.c"
1904 puts(_("\t\t\t\t- may not be preset\n"));
1905 #line 1258 "../usage.c"
1906 puts(_(" Arg Option-Name Description\n"));
1907 #line 1194 "../usage.c"
1908 puts(_(" Flg Arg Option-Name Description\n"));
1909 #line 1252 "../usage.c"
1910 puts(_(" Flg Arg Option-Name Description\n"));
1911 #line 1253 "../usage.c"
1912 puts(_(" %3s %s"));
1913 #line 1259 "../usage.c"
1914 puts(_(" %3s %s"));
1915 #line 336 "../usage.c"
1916 puts(_("The '-#<number>' option may omit the hash char\n"));
1917 #line 332 "../usage.c"
1918 puts(_("All arguments are named options.\n"));
1919 #line 920 "../usage.c"
1920 puts(_(" - reading file %s"));
1921 #line 358 "../usage.c"
1922 puts(_("\n"
1923 "Please send bug reports to: <%s>\n"));
1924 #line 100 "../version.c"
1925 puts(_("\n"
1926 "Please send bug reports to: <%s>\n"));
1927 #line 129 "../version.c"
1928 puts(_("\n"
1929 "Please send bug reports to: <%s>\n"));
1930 #line 852 "../usage.c"
1931 puts(_("\t\t\t\t- may NOT appear - preset only\n"));
1932 #line 893 "../usage.c"
1933 puts(_("\n"
1934 "The following option preset mechanisms are supported:\n"));
1935 #line 1141 "../usage.c"
1936 puts(_("\n"
1937 "The following option preset mechanisms are supported:\n"));
1938 #line 631 "../usage.c"
1939 puts(_("prohibits these options:\n"));
1940 #line 626 "../usage.c"
1941 puts(_("prohibits the option '%s'\n"));
1942 #line 81 "../numeric.c"
1943 puts(_("%s%ld to %ld"));
1944 #line 79 "../numeric.c"
1945 puts(_("%sgreater than or equal to %ld"));
1946 #line 75 "../numeric.c"
1947 puts(_("%s%ld exactly"));
1948 #line 68 "../numeric.c"
1949 puts(_("%sit must lie in one of the ranges:\n"));
1950 #line 68 "../numeric.c"
1951 puts(_("%sit must be in the range:\n"));
1952 #line 88 "../numeric.c"
1953 puts(_(", or\n"));
1954 #line 66 "../numeric.c"
1955 puts(_("%sis scalable with a suffix: k/K/m/M/g/G/t/T\n"));
1956 #line 77 "../numeric.c"
1957 puts(_("%sless than or equal to %ld"));
1958 #line 339 "../usage.c"
1959 puts(_("Operands and options may be intermixed. They will be reordered.\n"));
1960 #line 601 "../usage.c"
1961 puts(_("requires the option '%s'\n"));
1962 #line 604 "../usage.c"
1963 puts(_("requires these options:\n"));
1964 #line 1270 "../usage.c"
1965 puts(_(" Arg Option-Name Req? Description\n"));
1966 #line 1264 "../usage.c"
1967 puts(_(" Flg Arg Option-Name Req? Description\n"));
1968 #line 143 "../enum.c"
1969 puts(_("or you may use a numeric representation. Preceding these with a '!'\n"
1970 "will clear the bits, specifying 'none' will clear all bits, and 'all'\n"
1971 "will set them all. Multiple entries may be passed as an option\n"
1972 "argument list.\n"));
1973 #line 859 "../usage.c"
1974 puts(_("\t\t\t\t- may appear up to %d times\n"));
1975 #line 52 "../enum.c"
1976 puts(_("The valid \"%s\" option keywords are:\n"));
1977 #line 1101 "../usage.c"
1978 puts(_("The next option supports vendor supported extra options:"));
1979 #line 722 "../usage.c"
1980 puts(_("These additional options are:"));
1981 /* END-USAGE-TEXT */
1982 }
1983 #endif /* uncompilable code */
1984 #ifdef __cplusplus
1985 }
1986 #endif
1987 /* ntpd-opts.c ends here */
1988