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