1 /* 2 * EDIT THIS FILE WITH CAUTION (ntpdc-opts.c) 3 * 4 * It has been AutoGen-ed Tuesday December 8, 2009 at 08:14:00 AM EST 5 * From the definitions ntpdc-opts.def 6 * and the template file options 7 * 8 * Generated from AutoOpts 29:0:4 templates. 9 */ 10 11 /* 12 * This file was produced by an AutoOpts template. AutoOpts is a 13 * copyrighted work. This source file is not encumbered by AutoOpts 14 * licensing, but is provided under the licensing terms chosen by the 15 * ntpdc author or copyright holder. AutoOpts is licensed under 16 * the terms of the LGPL. The redistributable library (``libopts'') is 17 * licensed under the terms of either the LGPL or, at the users discretion, 18 * the BSD license. See the AutoOpts and/or libopts sources for details. 19 * 20 * This source file is copyrighted and licensed under the following terms: 21 * 22 * ntpdc copyright 1970-2009 David L. Mills and/or others - all rights reserved 23 * 24 * see html/copyright.html 25 */ 26 27 28 #include <limits.h> 29 30 #define OPTION_CODE_COMPILE 1 31 #include "ntpdc-opts.h" 32 33 #ifdef __cplusplus 34 extern "C" { 35 #endif 36 tSCC zCopyright[] = 37 "ntpdc copyright (c) 1970-2009 David L. Mills and/or others, all rights reserved"; 38 tSCC zCopyrightNotice[] = 39 40 /* extracted from ../include/copyright.def near line 8 */ 41 "see html/copyright.html"; 42 extern tUsageProc optionUsage; 43 44 /* 45 * global included definitions 46 */ 47 #ifdef __windows 48 extern int atoi(const char*); 49 #else 50 # include <stdlib.h> 51 #endif 52 53 #ifndef NULL 54 # define NULL 0 55 #endif 56 #ifndef EXIT_SUCCESS 57 # define EXIT_SUCCESS 0 58 #endif 59 #ifndef EXIT_FAILURE 60 # define EXIT_FAILURE 1 61 #endif 62 /* 63 * Ipv4 option description: 64 */ 65 tSCC zIpv4Text[] = 66 "Force IPv4 DNS name resolution"; 67 tSCC zIpv4_NAME[] = "IPV4"; 68 tSCC zIpv4_Name[] = "ipv4"; 69 #define IPV4_FLAGS (OPTST_DISABLED) 70 71 /* 72 * Ipv6 option description: 73 */ 74 tSCC zIpv6Text[] = 75 "Force IPv6 DNS name resolution"; 76 tSCC zIpv6_NAME[] = "IPV6"; 77 tSCC zIpv6_Name[] = "ipv6"; 78 #define IPV6_FLAGS (OPTST_DISABLED) 79 80 /* 81 * Command option description: 82 */ 83 tSCC zCommandText[] = 84 "run a command and exit"; 85 tSCC zCommand_NAME[] = "COMMAND"; 86 tSCC zCommand_Name[] = "command"; 87 #define COMMAND_FLAGS (OPTST_DISABLED | OPTST_STACKED \ 88 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) 89 90 /* 91 * Listpeers option description with 92 * "Must also have options" and "Incompatible options": 93 */ 94 tSCC zListpeersText[] = 95 "Print a list of the peers"; 96 tSCC zListpeers_NAME[] = "LISTPEERS"; 97 tSCC zListpeers_Name[] = "listpeers"; 98 static const int 99 aListpeersCantList[] = { 100 INDEX_OPT_COMMAND, NO_EQUIVALENT }; 101 #define LISTPEERS_FLAGS (OPTST_DISABLED) 102 103 /* 104 * Peers option description with 105 * "Must also have options" and "Incompatible options": 106 */ 107 tSCC zPeersText[] = 108 "Print a list of the peers"; 109 tSCC zPeers_NAME[] = "PEERS"; 110 tSCC zPeers_Name[] = "peers"; 111 static const int 112 aPeersCantList[] = { 113 INDEX_OPT_COMMAND, NO_EQUIVALENT }; 114 #define PEERS_FLAGS (OPTST_DISABLED) 115 116 /* 117 * Showpeers option description with 118 * "Must also have options" and "Incompatible options": 119 */ 120 tSCC zShowpeersText[] = 121 "Show a list of the peers"; 122 tSCC zShowpeers_NAME[] = "SHOWPEERS"; 123 tSCC zShowpeers_Name[] = "showpeers"; 124 static const int 125 aShowpeersCantList[] = { 126 INDEX_OPT_COMMAND, NO_EQUIVALENT }; 127 #define SHOWPEERS_FLAGS (OPTST_DISABLED) 128 129 /* 130 * Interactive option description with 131 * "Must also have options" and "Incompatible options": 132 */ 133 tSCC zInteractiveText[] = 134 "Force ntpq to operate in interactive mode"; 135 tSCC zInteractive_NAME[] = "INTERACTIVE"; 136 tSCC zInteractive_Name[] = "interactive"; 137 static const int 138 aInteractiveCantList[] = { 139 INDEX_OPT_COMMAND, 140 INDEX_OPT_LISTPEERS, 141 INDEX_OPT_PEERS, 142 INDEX_OPT_SHOWPEERS, NO_EQUIVALENT }; 143 #define INTERACTIVE_FLAGS (OPTST_DISABLED) 144 145 /* 146 * Debug_Level option description: 147 */ 148 #ifdef DEBUG 149 tSCC zDebug_LevelText[] = 150 "Increase output debug message level"; 151 tSCC zDebug_Level_NAME[] = "DEBUG_LEVEL"; 152 tSCC zDebug_Level_Name[] = "debug-level"; 153 #define DEBUG_LEVEL_FLAGS (OPTST_DISABLED) 154 155 #else /* disable Debug_Level */ 156 #define VALUE_OPT_DEBUG_LEVEL NO_EQUIVALENT 157 #define DEBUG_LEVEL_FLAGS (OPTST_OMITTED | OPTST_NO_INIT) 158 #define zDebug_LevelText NULL 159 #define zDebug_Level_NAME NULL 160 #define zDebug_Level_Name NULL 161 #endif /* DEBUG */ 162 163 /* 164 * Set_Debug_Level option description: 165 */ 166 #ifdef DEBUG 167 tSCC zSet_Debug_LevelText[] = 168 "Set the output debug message level"; 169 tSCC zSet_Debug_Level_NAME[] = "SET_DEBUG_LEVEL"; 170 tSCC zSet_Debug_Level_Name[] = "set-debug-level"; 171 #define SET_DEBUG_LEVEL_FLAGS (OPTST_DISABLED \ 172 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) 173 174 #else /* disable Set_Debug_Level */ 175 #define VALUE_OPT_SET_DEBUG_LEVEL NO_EQUIVALENT 176 #define SET_DEBUG_LEVEL_FLAGS (OPTST_OMITTED | OPTST_NO_INIT) 177 #define zSet_Debug_LevelText NULL 178 #define zSet_Debug_Level_NAME NULL 179 #define zSet_Debug_Level_Name NULL 180 #endif /* DEBUG */ 181 182 /* 183 * Numeric option description: 184 */ 185 tSCC zNumericText[] = 186 "numeric host addresses"; 187 tSCC zNumeric_NAME[] = "NUMERIC"; 188 tSCC zNumeric_Name[] = "numeric"; 189 #define NUMERIC_FLAGS (OPTST_DISABLED) 190 191 /* 192 * Help/More_Help/Version option descriptions: 193 */ 194 tSCC zHelpText[] = "Display usage information and exit"; 195 tSCC zHelp_Name[] = "help"; 196 197 tSCC zMore_HelpText[] = "Extended usage information passed thru pager"; 198 tSCC zMore_Help_Name[] = "more-help"; 199 200 tSCC zVersionText[] = "Output version information and exit"; 201 tSCC zVersion_Name[] = "version"; 202 203 /* 204 * Save/Load_Opts option description: 205 */ 206 tSCC zSave_OptsText[] = "Save the option state to a config file"; 207 tSCC zSave_Opts_Name[] = "save-opts"; 208 209 tSCC zLoad_OptsText[] = "Load options from a config file"; 210 tSCC zLoad_Opts_NAME[] = "LOAD_OPTS"; 211 212 tSCC zNotLoad_Opts_Name[] = "no-load-opts"; 213 tSCC zNotLoad_Opts_Pfx[] = "no"; 214 #define zLoad_Opts_Name (zNotLoad_Opts_Name + 3) 215 /* 216 * Declare option callback procedures 217 */ 218 #ifdef DEBUG 219 static tOptProc doOptSet_Debug_Level; 220 #else /* not DEBUG */ 221 # define doOptSet_Debug_Level NULL 222 #endif /* def/not DEBUG */ 223 #if defined(TEST_NTPDC_OPTS) 224 /* 225 * Under test, omit argument processing, or call optionStackArg, 226 * if multiple copies are allowed. 227 */ 228 extern tOptProc 229 optionPagedUsage, optionStackArg, optionVersionStderr; 230 static tOptProc 231 doUsageOpt; 232 233 /* 234 * #define map the "normal" callout procs to the test ones... 235 */ 236 #define SET_DEBUG_LEVEL_OPT_PROC optionStackArg 237 238 239 #else /* NOT defined TEST_NTPDC_OPTS */ 240 /* 241 * When not under test, there are different procs to use 242 */ 243 extern tOptProc 244 optionPagedUsage, optionPrintVersion, optionStackArg; 245 static tOptProc 246 doUsageOpt; 247 248 /* 249 * #define map the "normal" callout procs 250 */ 251 #define SET_DEBUG_LEVEL_OPT_PROC doOptSet_Debug_Level 252 253 #define SET_DEBUG_LEVEL_OPT_PROC doOptSet_Debug_Level 254 #endif /* defined(TEST_NTPDC_OPTS) */ 255 #ifdef TEST_NTPDC_OPTS 256 # define DOVERPROC optionVersionStderr 257 #else 258 # define DOVERPROC optionPrintVersion 259 #endif /* TEST_NTPDC_OPTS */ 260 261 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 262 * 263 * Define the Ntpdc Option Descriptions. 264 */ 265 static tOptDesc optDesc[ OPTION_CT ] = { 266 { /* entry idx, value */ 0, VALUE_OPT_IPV4, 267 /* equiv idx, value */ NO_EQUIVALENT, 0, 268 /* equivalenced to */ NO_EQUIVALENT, 269 /* min, max, act ct */ 0, 1, 0, 270 /* opt state flags */ IPV4_FLAGS, 0, 271 /* last opt argumnt */ { NULL }, 272 /* arg list/cookie */ NULL, 273 /* must/cannot opts */ NULL, NULL, 274 /* option proc */ NULL, 275 /* desc, NAME, name */ zIpv4Text, zIpv4_NAME, zIpv4_Name, 276 /* disablement strs */ NULL, NULL }, 277 278 { /* entry idx, value */ 1, VALUE_OPT_IPV6, 279 /* equiv idx, value */ NOLIMIT, NOLIMIT, 280 /* equivalenced to */ INDEX_OPT_IPV4, 281 /* min, max, act ct */ 0, 1, 0, 282 /* opt state flags */ IPV6_FLAGS, 0, 283 /* last opt argumnt */ { NULL }, 284 /* arg list/cookie */ NULL, 285 /* must/cannot opts */ NULL, NULL, 286 /* option proc */ NULL, 287 /* desc, NAME, name */ zIpv6Text, zIpv6_NAME, zIpv6_Name, 288 /* disablement strs */ NULL, NULL }, 289 290 { /* entry idx, value */ 2, VALUE_OPT_COMMAND, 291 /* equiv idx, value */ 2, VALUE_OPT_COMMAND, 292 /* equivalenced to */ NO_EQUIVALENT, 293 /* min, max, act ct */ 0, NOLIMIT, 0, 294 /* opt state flags */ COMMAND_FLAGS, 0, 295 /* last opt argumnt */ { NULL }, 296 /* arg list/cookie */ NULL, 297 /* must/cannot opts */ NULL, NULL, 298 /* option proc */ optionStackArg, 299 /* desc, NAME, name */ zCommandText, zCommand_NAME, zCommand_Name, 300 /* disablement strs */ NULL, NULL }, 301 302 { /* entry idx, value */ 3, VALUE_OPT_LISTPEERS, 303 /* equiv idx, value */ 3, VALUE_OPT_LISTPEERS, 304 /* equivalenced to */ NO_EQUIVALENT, 305 /* min, max, act ct */ 0, 1, 0, 306 /* opt state flags */ LISTPEERS_FLAGS, 0, 307 /* last opt argumnt */ { NULL }, 308 /* arg list/cookie */ NULL, 309 /* must/cannot opts */ NULL, aListpeersCantList, 310 /* option proc */ NULL, 311 /* desc, NAME, name */ zListpeersText, zListpeers_NAME, zListpeers_Name, 312 /* disablement strs */ NULL, NULL }, 313 314 { /* entry idx, value */ 4, VALUE_OPT_PEERS, 315 /* equiv idx, value */ 4, VALUE_OPT_PEERS, 316 /* equivalenced to */ NO_EQUIVALENT, 317 /* min, max, act ct */ 0, 1, 0, 318 /* opt state flags */ PEERS_FLAGS, 0, 319 /* last opt argumnt */ { NULL }, 320 /* arg list/cookie */ NULL, 321 /* must/cannot opts */ NULL, aPeersCantList, 322 /* option proc */ NULL, 323 /* desc, NAME, name */ zPeersText, zPeers_NAME, zPeers_Name, 324 /* disablement strs */ NULL, NULL }, 325 326 { /* entry idx, value */ 5, VALUE_OPT_SHOWPEERS, 327 /* equiv idx, value */ 5, VALUE_OPT_SHOWPEERS, 328 /* equivalenced to */ NO_EQUIVALENT, 329 /* min, max, act ct */ 0, 1, 0, 330 /* opt state flags */ SHOWPEERS_FLAGS, 0, 331 /* last opt argumnt */ { NULL }, 332 /* arg list/cookie */ NULL, 333 /* must/cannot opts */ NULL, aShowpeersCantList, 334 /* option proc */ NULL, 335 /* desc, NAME, name */ zShowpeersText, zShowpeers_NAME, zShowpeers_Name, 336 /* disablement strs */ NULL, NULL }, 337 338 { /* entry idx, value */ 6, VALUE_OPT_INTERACTIVE, 339 /* equiv idx, value */ 6, VALUE_OPT_INTERACTIVE, 340 /* equivalenced to */ NO_EQUIVALENT, 341 /* min, max, act ct */ 0, 1, 0, 342 /* opt state flags */ INTERACTIVE_FLAGS, 0, 343 /* last opt argumnt */ { NULL }, 344 /* arg list/cookie */ NULL, 345 /* must/cannot opts */ NULL, aInteractiveCantList, 346 /* option proc */ NULL, 347 /* desc, NAME, name */ zInteractiveText, zInteractive_NAME, zInteractive_Name, 348 /* disablement strs */ NULL, NULL }, 349 350 { /* entry idx, value */ 7, VALUE_OPT_DEBUG_LEVEL, 351 /* equiv idx, value */ 7, VALUE_OPT_DEBUG_LEVEL, 352 /* equivalenced to */ NO_EQUIVALENT, 353 /* min, max, act ct */ 0, NOLIMIT, 0, 354 /* opt state flags */ DEBUG_LEVEL_FLAGS, 0, 355 /* last opt argumnt */ { NULL }, 356 /* arg list/cookie */ NULL, 357 /* must/cannot opts */ NULL, NULL, 358 /* option proc */ NULL, 359 /* desc, NAME, name */ zDebug_LevelText, zDebug_Level_NAME, zDebug_Level_Name, 360 /* disablement strs */ NULL, NULL }, 361 362 { /* entry idx, value */ 8, VALUE_OPT_SET_DEBUG_LEVEL, 363 /* equiv idx, value */ 8, VALUE_OPT_SET_DEBUG_LEVEL, 364 /* equivalenced to */ NO_EQUIVALENT, 365 /* min, max, act ct */ 0, NOLIMIT, 0, 366 /* opt state flags */ SET_DEBUG_LEVEL_FLAGS, 0, 367 /* last opt argumnt */ { NULL }, 368 /* arg list/cookie */ NULL, 369 /* must/cannot opts */ NULL, NULL, 370 /* option proc */ SET_DEBUG_LEVEL_OPT_PROC, 371 /* desc, NAME, name */ zSet_Debug_LevelText, zSet_Debug_Level_NAME, zSet_Debug_Level_Name, 372 /* disablement strs */ NULL, NULL }, 373 374 { /* entry idx, value */ 9, VALUE_OPT_NUMERIC, 375 /* equiv idx, value */ 9, VALUE_OPT_NUMERIC, 376 /* equivalenced to */ NO_EQUIVALENT, 377 /* min, max, act ct */ 0, 1, 0, 378 /* opt state flags */ NUMERIC_FLAGS, 0, 379 /* last opt argumnt */ { NULL }, 380 /* arg list/cookie */ NULL, 381 /* must/cannot opts */ NULL, NULL, 382 /* option proc */ NULL, 383 /* desc, NAME, name */ zNumericText, zNumeric_NAME, zNumeric_Name, 384 /* disablement strs */ NULL, NULL }, 385 386 #ifdef NO_OPTIONAL_OPT_ARGS 387 # define VERSION_OPT_FLAGS OPTST_IMM | OPTST_NO_INIT 388 #else 389 # define VERSION_OPT_FLAGS OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \ 390 OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT 391 #endif 392 393 { /* entry idx, value */ INDEX_OPT_VERSION, VALUE_OPT_VERSION, 394 /* equiv idx value */ NO_EQUIVALENT, 0, 395 /* equivalenced to */ NO_EQUIVALENT, 396 /* min, max, act ct */ 0, 1, 0, 397 /* opt state flags */ VERSION_OPT_FLAGS, 0, 398 /* last opt argumnt */ { NULL }, 399 /* arg list/cookie */ NULL, 400 /* must/cannot opts */ NULL, NULL, 401 /* option proc */ DOVERPROC, 402 /* desc, NAME, name */ zVersionText, NULL, zVersion_Name, 403 /* disablement strs */ NULL, NULL }, 404 405 #undef VERSION_OPT_FLAGS 406 407 408 { /* entry idx, value */ INDEX_OPT_HELP, VALUE_OPT_HELP, 409 /* equiv idx value */ NO_EQUIVALENT, 0, 410 /* equivalenced to */ NO_EQUIVALENT, 411 /* min, max, act ct */ 0, 1, 0, 412 /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, 0, 413 /* last opt argumnt */ { NULL }, 414 /* arg list/cookie */ NULL, 415 /* must/cannot opts */ NULL, NULL, 416 /* option proc */ doUsageOpt, 417 /* desc, NAME, name */ zHelpText, NULL, zHelp_Name, 418 /* disablement strs */ NULL, NULL }, 419 420 { /* entry idx, value */ INDEX_OPT_MORE_HELP, VALUE_OPT_MORE_HELP, 421 /* equiv idx value */ NO_EQUIVALENT, 0, 422 /* equivalenced to */ NO_EQUIVALENT, 423 /* min, max, act ct */ 0, 1, 0, 424 /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, 0, 425 /* last opt argumnt */ { NULL }, 426 /* arg list/cookie */ NULL, 427 /* must/cannot opts */ NULL, NULL, 428 /* option proc */ optionPagedUsage, 429 /* desc, NAME, name */ zMore_HelpText, NULL, zMore_Help_Name, 430 /* disablement strs */ NULL, NULL }, 431 432 { /* entry idx, value */ INDEX_OPT_SAVE_OPTS, VALUE_OPT_SAVE_OPTS, 433 /* equiv idx value */ NO_EQUIVALENT, 0, 434 /* equivalenced to */ NO_EQUIVALENT, 435 /* min, max, act ct */ 0, 1, 0, 436 /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) 437 | OPTST_ARG_OPTIONAL | OPTST_NO_INIT, 0, 438 /* last opt argumnt */ { NULL }, 439 /* arg list/cookie */ NULL, 440 /* must/cannot opts */ NULL, NULL, 441 /* option proc */ NULL, 442 /* desc, NAME, name */ zSave_OptsText, NULL, zSave_Opts_Name, 443 /* disablement strs */ NULL, NULL }, 444 445 { /* entry idx, value */ INDEX_OPT_LOAD_OPTS, VALUE_OPT_LOAD_OPTS, 446 /* equiv idx value */ NO_EQUIVALENT, 0, 447 /* equivalenced to */ NO_EQUIVALENT, 448 /* min, max, act ct */ 0, NOLIMIT, 0, 449 /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) \ 450 | OPTST_DISABLE_IMM, 0, 451 /* last opt argumnt */ { NULL }, 452 /* arg list/cookie */ NULL, 453 /* must/cannot opts */ NULL, NULL, 454 /* option proc */ optionLoadOpt, 455 /* desc, NAME, name */ zLoad_OptsText, zLoad_Opts_NAME, zLoad_Opts_Name, 456 /* disablement strs */ zNotLoad_Opts_Name, zNotLoad_Opts_Pfx } 457 }; 458 459 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 460 * 461 * Define the Ntpdc Option Environment 462 */ 463 tSCC zPROGNAME[] = "NTPDC"; 464 tSCC zUsageTitle[] = 465 "ntpdc - vendor-specific NTP query program - Ver. 4.2.4p8\n\ 466 USAGE: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ host ...]\n"; 467 tSCC zRcName[] = ".ntprc"; 468 tSCC* apzHomeList[] = { 469 "$HOME", 470 ".", 471 NULL }; 472 473 tSCC zBugsAddr[] = "http://bugs.ntp.org, bugs@ntp.org"; 474 #define zExplain NULL 475 tSCC zDetail[] = "\n\ 476 The\n\ 477 [= prog-name =]\n\ 478 utility program is used to query an NTP daemon about its\n\ 479 current state and to request changes in that state.\n\ 480 It uses NTP mode 7 control message formats described in the source code.\n\ 481 The program may\n\ 482 be run either in interactive mode or controlled using command line\n\ 483 arguments.\n\ 484 Extensive state and statistics information is available\n\ 485 through the\n\ 486 [= prog-name =]\n\ 487 interface.\n\ 488 In addition, nearly all the\n\ 489 configuration options which can be specified at startup using\n\ 490 ntpd's configuration file may also be specified at run time using\n\ 491 [= prog-name =] .\n"; 492 tSCC zFullVersion[] = NTPDC_FULL_VERSION; 493 /* extracted from /usr/local/gnu/autogen-5.9.1/share/autogen/optcode.tpl near line 408 */ 494 495 #if defined(ENABLE_NLS) 496 # define OPTPROC_BASE OPTPROC_TRANSLATE 497 static tOptionXlateProc translate_option_strings; 498 #else 499 # define OPTPROC_BASE OPTPROC_NONE 500 # define translate_option_strings NULL 501 #endif /* ENABLE_NLS */ 502 503 tOptions ntpdcOptions = { 504 OPTIONS_STRUCT_VERSION, 505 0, NULL, /* original argc + argv */ 506 ( OPTPROC_BASE 507 + OPTPROC_ERRSTOP 508 + OPTPROC_SHORTOPT 509 + OPTPROC_LONGOPT 510 + OPTPROC_NO_REQ_OPT 511 + OPTPROC_ENVIRON 512 + OPTPROC_HAS_IMMED ), 513 0, NULL, /* current option index, current option */ 514 NULL, NULL, zPROGNAME, 515 zRcName, zCopyright, zCopyrightNotice, 516 zFullVersion, apzHomeList, zUsageTitle, 517 zExplain, zDetail, optDesc, 518 zBugsAddr, /* address to send bugs to */ 519 NULL, NULL, /* extensions/saved state */ 520 optionUsage, /* usage procedure */ 521 translate_option_strings, /* translation procedure */ 522 /* 523 * Indexes to special options 524 */ 525 { INDEX_OPT_MORE_HELP, 526 INDEX_OPT_SAVE_OPTS, 527 NO_EQUIVALENT /* index of '-#' option */, 528 NO_EQUIVALENT /* index of default opt */ 529 }, 530 15 /* full option count */, 10 /* user option count */ 531 }; 532 533 /* 534 * Create the static procedure(s) declared above. 535 */ 536 static void 537 doUsageOpt( 538 tOptions* pOptions, 539 tOptDesc* pOptDesc ) 540 { 541 USAGE( EXIT_SUCCESS ); 542 } 543 544 #if ! defined(TEST_NTPDC_OPTS) 545 546 /* * * * * * * 547 * 548 * For the set-debug-level option, when DEBUG is #define-d. 549 */ 550 #ifdef DEBUG 551 static void 552 doOptSet_Debug_Level( 553 tOptions* pOptions, 554 tOptDesc* pOptDesc ) 555 { 556 /* extracted from ../include/debug-opt.def, line 29 */ 557 DESC(DEBUG_LEVEL).optOccCt = atoi( pOptDesc->pzLastArg ); 558 } 559 #endif /* defined DEBUG */ 560 561 #endif /* defined(TEST_NTPDC_OPTS) */ 562 563 /* extracted from /usr/local/gnu/autogen-5.9.1/share/autogen/optmain.tpl near line 92 */ 564 565 #if defined(TEST_NTPDC_OPTS) /* TEST MAIN PROCEDURE: */ 566 567 int 568 main( int argc, char** argv ) 569 { 570 int res = EXIT_SUCCESS; 571 (void)optionProcess( &ntpdcOptions, argc, argv ); 572 { 573 void optionPutShell( tOptions* ); 574 optionPutShell( &ntpdcOptions ); 575 } 576 return res; 577 } 578 #endif /* defined TEST_NTPDC_OPTS */ 579 /* extracted from /usr/local/gnu/autogen-5.9.1/share/autogen/optcode.tpl near line 514 */ 580 581 #if ENABLE_NLS 582 #include <stdio.h> 583 #include <stdlib.h> 584 #include <string.h> 585 #include <unistd.h> 586 #include <autoopts/usage-txt.h> 587 588 static char* AO_gettext( char const* pz ); 589 static void coerce_it(void** s); 590 591 static char* 592 AO_gettext( char const* pz ) 593 { 594 char* pzRes; 595 if (pz == NULL) 596 return NULL; 597 pzRes = _(pz); 598 if (pzRes == pz) 599 return pzRes; 600 pzRes = strdup( pzRes ); 601 if (pzRes == NULL) { 602 fputs( _("No memory for duping translated strings\n"), stderr ); 603 exit( EXIT_FAILURE ); 604 } 605 return pzRes; 606 } 607 608 static void coerce_it(void** s) { *s = AO_gettext(*s); } 609 #define COERSION(_f) \ 610 coerce_it((void*)&(ntpdcOptions._f)) 611 612 /* 613 * This invokes the translation code (e.g. gettext(3)). 614 */ 615 static void 616 translate_option_strings( void ) 617 { 618 /* 619 * Guard against re-translation. It won't work. The strings will have 620 * been changed by the first pass through this code. One shot only. 621 */ 622 if (option_usage_text.field_ct == 0) 623 return; 624 /* 625 * Do the translations. The first pointer follows the field count field. 626 * The field count field is the size of a pointer. 627 */ 628 { 629 char** ppz = (char**)(void*)&(option_usage_text); 630 int ix = option_usage_text.field_ct; 631 632 do { 633 ppz++; 634 *ppz = AO_gettext(*ppz); 635 } while (--ix > 0); 636 } 637 option_usage_text.field_ct = 0; 638 639 { 640 tOptDesc* pOD = ntpdcOptions.pOptDesc; 641 int ix = ntpdcOptions.optCt; 642 643 for (;;) { 644 pOD->pzText = AO_gettext(pOD->pzText); 645 pOD->pz_NAME = AO_gettext(pOD->pz_NAME); 646 pOD->pz_Name = AO_gettext(pOD->pz_Name); 647 pOD->pz_DisableName = AO_gettext(pOD->pz_DisableName); 648 pOD->pz_DisablePfx = AO_gettext(pOD->pz_DisablePfx); 649 if (--ix <= 0) 650 break; 651 pOD++; 652 } 653 } 654 COERSION(pzCopyright); 655 COERSION(pzCopyNotice); 656 COERSION(pzFullVersion); 657 COERSION(pzUsageTitle); 658 COERSION(pzExplain); 659 COERSION(pzDetail); 660 } 661 662 #endif /* ENABLE_NLS */ 663 664 #ifdef __cplusplus 665 } 666 #endif 667 /* ntpdc-opts.c ends here */ 668