1 /* $NetBSD: ntpsnmpd-opts.c,v 1.1.1.3 2013/12/27 23:31:07 christos Exp $ */ 2 3 /* 4 * EDIT THIS FILE WITH CAUTION (ntpsnmpd-opts.c) 5 * 6 * It has been AutoGen-ed December 24, 2013 at 11:39:05 AM by AutoGen 5.18.3pre5 7 * From the definitions ntpsnmpd-opts.def 8 * and the template file options 9 * 10 * Generated from AutoOpts 40:1:15 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 ntpsnmpd 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 ntpsnmpd program is copyrighted and licensed 21 * under the following terms: 22 * 23 * Copyright (C) 1970-2013 The University of Delaware, 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 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 "ntpsnmpd-opts.h" 44 #include <sys/types.h> 45 46 #include <limits.h> 47 #include <stdio.h> 48 #include <stdlib.h> 49 50 #ifdef __cplusplus 51 extern "C" { 52 #endif 53 extern FILE * option_usage_fp; 54 #define zCopyright (ntpsnmpd_opt_strs+0) 55 #define zLicenseDescrip (ntpsnmpd_opt_strs+318) 56 57 58 #ifndef NULL 59 # define NULL 0 60 #endif 61 62 /** 63 * static const strings for ntpsnmpd options 64 */ 65 static char const ntpsnmpd_opt_strs[1560] = 66 /* 0 */ "ntpsnmpd 4.2.7p404\n" 67 "Copyright (C) 1970-2013 The University of Delaware, all rights reserved.\n" 68 "This is free software. It is licensed for use, modification and\n" 69 "redistribution under the terms of the NTP License, copies of which\n" 70 "can be seen at:\n" 71 " <http://ntp.org/license>\n" 72 " <http://opensource.org/licenses/ntp-license.php>\n\0" 73 /* 318 */ "Permission to use, copy, modify, and distribute this software and its\n" 74 "documentation for any purpose with or without fee is hereby granted,\n" 75 "provided that the above copyright notice appears in all copies and that\n" 76 "both the copyright notice and this permission notice appear in supporting\n" 77 "documentation, and that the name The University of Delaware not be used in\n" 78 "advertising or publicity pertaining to distribution of the software without\n" 79 "specific, written prior permission. The University of Delaware makes no\n" 80 "representations about the suitability this software for any purpose. It is\n" 81 "provided \"as is\" without express or implied warranty.\n\0" 82 /* 958 */ "Do not fork\0" 83 /* 970 */ "NOFORK\0" 84 /* 977 */ "nofork\0" 85 /* 984 */ "Log to syslog()\0" 86 /* 1000 */ "SYSLOG\0" 87 /* 1007 */ "syslog\0" 88 /* 1014 */ "The socket address ntpsnmpd uses to connect to net-snmpd\0" 89 /* 1071 */ "AGENTXSOCKET\0" 90 /* 1084 */ "agentxsocket\0" 91 /* 1097 */ "unix:/var/agentx/master\0" 92 /* 1121 */ "display extended usage information and exit\0" 93 /* 1165 */ "help\0" 94 /* 1170 */ "extended usage information passed thru pager\0" 95 /* 1215 */ "more-help\0" 96 /* 1225 */ "output version information and exit\0" 97 /* 1261 */ "version\0" 98 /* 1269 */ "save the option state to a config file\0" 99 /* 1308 */ "save-opts\0" 100 /* 1318 */ "load options from a config file\0" 101 /* 1350 */ "LOAD_OPTS\0" 102 /* 1360 */ "no-load-opts\0" 103 /* 1373 */ "no\0" 104 /* 1376 */ "NTPSNMPD\0" 105 /* 1385 */ "ntpsnmpd - NTP SNMP MIB agent - Ver. 4.2.7p404\n" 106 "Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n\0" 107 /* 1490 */ "$HOME\0" 108 /* 1496 */ ".\0" 109 /* 1498 */ ".ntprc\0" 110 /* 1505 */ "http://bugs.ntp.org, bugs@ntp.org\0" 111 /* 1539 */ "\n\0" 112 /* 1541 */ "ntpsnmpd 4.2.7p404"; 113 114 /** 115 * nofork option description: 116 */ 117 /** Descriptive text for the nofork option */ 118 #define NOFORK_DESC (ntpsnmpd_opt_strs+958) 119 /** Upper-cased name for the nofork option */ 120 #define NOFORK_NAME (ntpsnmpd_opt_strs+970) 121 /** Name string for the nofork option */ 122 #define NOFORK_name (ntpsnmpd_opt_strs+977) 123 /** Compiled in flag settings for the nofork option */ 124 #define NOFORK_FLAGS (OPTST_DISABLED) 125 126 /** 127 * syslog option description: 128 */ 129 /** Descriptive text for the syslog option */ 130 #define SYSLOG_DESC (ntpsnmpd_opt_strs+984) 131 /** Upper-cased name for the syslog option */ 132 #define SYSLOG_NAME (ntpsnmpd_opt_strs+1000) 133 /** Name string for the syslog option */ 134 #define SYSLOG_name (ntpsnmpd_opt_strs+1007) 135 /** Compiled in flag settings for the syslog option */ 136 #define SYSLOG_FLAGS (OPTST_DISABLED) 137 138 /** 139 * agentXSocket option description: 140 */ 141 /** Descriptive text for the agentXSocket option */ 142 #define AGENTXSOCKET_DESC (ntpsnmpd_opt_strs+1014) 143 /** Upper-cased name for the agentXSocket option */ 144 #define AGENTXSOCKET_NAME (ntpsnmpd_opt_strs+1071) 145 /** Name string for the agentXSocket option */ 146 #define AGENTXSOCKET_name (ntpsnmpd_opt_strs+1084) 147 /** The compiled in default value for the agentXSocket option argument */ 148 #define AGENTXSOCKET_DFT_ARG (ntpsnmpd_opt_strs+1097) 149 /** Compiled in flag settings for the agentXSocket option */ 150 #define AGENTXSOCKET_FLAGS (OPTST_DISABLED \ 151 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) 152 153 /* 154 * Help/More_Help/Version option descriptions: 155 */ 156 #define HELP_DESC (ntpsnmpd_opt_strs+1121) 157 #define HELP_name (ntpsnmpd_opt_strs+1165) 158 #ifdef HAVE_WORKING_FORK 159 #define MORE_HELP_DESC (ntpsnmpd_opt_strs+1170) 160 #define MORE_HELP_name (ntpsnmpd_opt_strs+1215) 161 #define MORE_HELP_FLAGS (OPTST_IMM | OPTST_NO_INIT) 162 #else 163 #define MORE_HELP_DESC HELP_DESC 164 #define MORE_HELP_name HELP_name 165 #define MORE_HELP_FLAGS (OPTST_OMITTED | OPTST_NO_INIT) 166 #endif 167 #ifdef NO_OPTIONAL_OPT_ARGS 168 # define VER_FLAGS (OPTST_IMM | OPTST_NO_INIT) 169 #else 170 # define VER_FLAGS (OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \ 171 OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT) 172 #endif 173 #define VER_DESC (ntpsnmpd_opt_strs+1225) 174 #define VER_name (ntpsnmpd_opt_strs+1261) 175 #define SAVE_OPTS_DESC (ntpsnmpd_opt_strs+1269) 176 #define SAVE_OPTS_name (ntpsnmpd_opt_strs+1308) 177 #define LOAD_OPTS_DESC (ntpsnmpd_opt_strs+1318) 178 #define LOAD_OPTS_NAME (ntpsnmpd_opt_strs+1350) 179 #define NO_LOAD_OPTS_name (ntpsnmpd_opt_strs+1360) 180 #define LOAD_OPTS_pfx (ntpsnmpd_opt_strs+1373) 181 #define LOAD_OPTS_name (NO_LOAD_OPTS_name + 3) 182 /** 183 * Declare option callback procedures 184 */ 185 /* extracted from optmain.tlib near line 723 */ 186 187 #if defined(TEST_NTPSNMPD_OPTS) 188 /* 189 * Under test, omit argument processing, or call optionStackArg, 190 * if multiple copies are allowed. 191 */ 192 static tOptProc 193 doUsageOpt; 194 195 #else /* NOT defined TEST_NTPSNMPD_OPTS */ 196 /* 197 * When not under test, there are different procs to use 198 */ 199 extern tOptProc 200 ntpOptionPrintVersion, optionBooleanVal, optionNestedVal, 201 optionNumericVal, optionPagedUsage, optionResetOpt, 202 optionStackArg, optionTimeDate, optionTimeVal, 203 optionUnstackArg, optionVendorOption, optionVersionStderr; 204 static tOptProc 205 doUsageOpt; 206 #endif /* TEST_NTPSNMPD_OPTS */ 207 #define VER_PROC ntpOptionPrintVersion 208 209 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 210 /** 211 * Define the ntpsnmpd Option Descriptions. 212 * This is an array of OPTION_CT entries, one for each 213 * option that the ntpsnmpd program responds to. 214 */ 215 static tOptDesc optDesc[OPTION_CT] = { 216 { /* entry idx, value */ 0, VALUE_OPT_NOFORK, 217 /* equiv idx, value */ 0, VALUE_OPT_NOFORK, 218 /* equivalenced to */ NO_EQUIVALENT, 219 /* min, max, act ct */ 0, 1, 0, 220 /* opt state flags */ NOFORK_FLAGS, 0, 221 /* last opt argumnt */ { NULL }, /* --nofork */ 222 /* arg list/cookie */ NULL, 223 /* must/cannot opts */ NULL, NULL, 224 /* option proc */ NULL, 225 /* desc, NAME, name */ NOFORK_DESC, NOFORK_NAME, NOFORK_name, 226 /* disablement strs */ NULL, NULL }, 227 228 { /* entry idx, value */ 1, VALUE_OPT_SYSLOG, 229 /* equiv idx, value */ 1, VALUE_OPT_SYSLOG, 230 /* equivalenced to */ NO_EQUIVALENT, 231 /* min, max, act ct */ 0, 1, 0, 232 /* opt state flags */ SYSLOG_FLAGS, 0, 233 /* last opt argumnt */ { NULL }, /* --syslog */ 234 /* arg list/cookie */ NULL, 235 /* must/cannot opts */ NULL, NULL, 236 /* option proc */ NULL, 237 /* desc, NAME, name */ SYSLOG_DESC, SYSLOG_NAME, SYSLOG_name, 238 /* disablement strs */ NULL, NULL }, 239 240 { /* entry idx, value */ 2, VALUE_OPT_AGENTXSOCKET, 241 /* equiv idx, value */ 2, VALUE_OPT_AGENTXSOCKET, 242 /* equivalenced to */ NO_EQUIVALENT, 243 /* min, max, act ct */ 0, 1, 0, 244 /* opt state flags */ AGENTXSOCKET_FLAGS, 0, 245 /* last opt argumnt */ { AGENTXSOCKET_DFT_ARG }, 246 /* arg list/cookie */ NULL, 247 /* must/cannot opts */ NULL, NULL, 248 /* option proc */ NULL, 249 /* desc, NAME, name */ AGENTXSOCKET_DESC, AGENTXSOCKET_NAME, AGENTXSOCKET_name, 250 /* disablement strs */ NULL, NULL }, 251 252 { /* entry idx, value */ INDEX_OPT_VERSION, VALUE_OPT_VERSION, 253 /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_VERSION, 254 /* equivalenced to */ NO_EQUIVALENT, 255 /* min, max, act ct */ 0, 1, 0, 256 /* opt state flags */ VER_FLAGS, AOUSE_VERSION, 257 /* last opt argumnt */ { NULL }, 258 /* arg list/cookie */ NULL, 259 /* must/cannot opts */ NULL, NULL, 260 /* option proc */ VER_PROC, 261 /* desc, NAME, name */ VER_DESC, NULL, VER_name, 262 /* disablement strs */ NULL, NULL }, 263 264 265 266 { /* entry idx, value */ INDEX_OPT_HELP, VALUE_OPT_HELP, 267 /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_HELP, 268 /* equivalenced to */ NO_EQUIVALENT, 269 /* min, max, act ct */ 0, 1, 0, 270 /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, AOUSE_HELP, 271 /* last opt argumnt */ { NULL }, 272 /* arg list/cookie */ NULL, 273 /* must/cannot opts */ NULL, NULL, 274 /* option proc */ doUsageOpt, 275 /* desc, NAME, name */ HELP_DESC, NULL, HELP_name, 276 /* disablement strs */ NULL, NULL }, 277 278 { /* entry idx, value */ INDEX_OPT_MORE_HELP, VALUE_OPT_MORE_HELP, 279 /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_MORE_HELP, 280 /* equivalenced to */ NO_EQUIVALENT, 281 /* min, max, act ct */ 0, 1, 0, 282 /* opt state flags */ MORE_HELP_FLAGS, AOUSE_MORE_HELP, 283 /* last opt argumnt */ { NULL }, 284 /* arg list/cookie */ NULL, 285 /* must/cannot opts */ NULL, NULL, 286 /* option proc */ optionPagedUsage, 287 /* desc, NAME, name */ MORE_HELP_DESC, NULL, MORE_HELP_name, 288 /* disablement strs */ NULL, NULL }, 289 290 { /* entry idx, value */ INDEX_OPT_SAVE_OPTS, VALUE_OPT_SAVE_OPTS, 291 /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_SAVE_OPTS, 292 /* equivalenced to */ NO_EQUIVALENT, 293 /* min, max, act ct */ 0, 1, 0, 294 /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) 295 | OPTST_ARG_OPTIONAL | OPTST_NO_INIT, AOUSE_SAVE_OPTS, 296 /* last opt argumnt */ { NULL }, 297 /* arg list/cookie */ NULL, 298 /* must/cannot opts */ NULL, NULL, 299 /* option proc */ NULL, 300 /* desc, NAME, name */ SAVE_OPTS_DESC, NULL, SAVE_OPTS_name, 301 /* disablement strs */ NULL, NULL }, 302 303 { /* entry idx, value */ INDEX_OPT_LOAD_OPTS, VALUE_OPT_LOAD_OPTS, 304 /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_LOAD_OPTS, 305 /* equivalenced to */ NO_EQUIVALENT, 306 /* min, max, act ct */ 0, NOLIMIT, 0, 307 /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) 308 | OPTST_DISABLE_IMM, AOUSE_LOAD_OPTS, 309 /* last opt argumnt */ { NULL }, 310 /* arg list/cookie */ NULL, 311 /* must/cannot opts */ NULL, NULL, 312 /* option proc */ optionLoadOpt, 313 /* desc, NAME, name */ LOAD_OPTS_DESC, LOAD_OPTS_NAME, LOAD_OPTS_name, 314 /* disablement strs */ NO_LOAD_OPTS_name, LOAD_OPTS_pfx } 315 }; 316 317 318 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 319 /** Reference to the upper cased version of ntpsnmpd. */ 320 #define zPROGNAME (ntpsnmpd_opt_strs+1376) 321 /** Reference to the title line for ntpsnmpd usage. */ 322 #define zUsageTitle (ntpsnmpd_opt_strs+1385) 323 /** ntpsnmpd configuration file name. */ 324 #define zRcName (ntpsnmpd_opt_strs+1498) 325 /** Directories to search for ntpsnmpd config files. */ 326 static char const * const apzHomeList[3] = { 327 ntpsnmpd_opt_strs+1490, 328 ntpsnmpd_opt_strs+1496, 329 NULL }; 330 /** The ntpsnmpd program bug email address. */ 331 #define zBugsAddr (ntpsnmpd_opt_strs+1505) 332 /** Clarification/explanation of what ntpsnmpd does. */ 333 #define zExplain (ntpsnmpd_opt_strs+1539) 334 /** Extra detail explaining what ntpsnmpd does. */ 335 #define zDetail (NULL) 336 /** The full version string for ntpsnmpd. */ 337 #define zFullVersion (ntpsnmpd_opt_strs+1541) 338 /* extracted from optcode.tlib near line 364 */ 339 340 #if defined(ENABLE_NLS) 341 # define OPTPROC_BASE OPTPROC_TRANSLATE 342 static tOptionXlateProc translate_option_strings; 343 #else 344 # define OPTPROC_BASE OPTPROC_NONE 345 # define translate_option_strings NULL 346 #endif /* ENABLE_NLS */ 347 348 #define ntpsnmpd_full_usage (NULL) 349 #define ntpsnmpd_short_usage (NULL) 350 351 #endif /* not defined __doxygen__ */ 352 353 /* 354 * Create the static procedure(s) declared above. 355 */ 356 /** 357 * The callout function that invokes the optionUsage function. 358 * 359 * @param[in] opts the AutoOpts option description structure 360 * @param[in] od the descriptor for the "help" (usage) option. 361 * @noreturn 362 */ 363 static void 364 doUsageOpt(tOptions * opts, tOptDesc * od) 365 { 366 int ex_code; 367 ex_code = NTPSNMPD_EXIT_SUCCESS; 368 optionUsage(&ntpsnmpdOptions, ex_code); 369 /* NOTREACHED */ 370 exit(1); 371 (void)opts; 372 (void)od; 373 } 374 /* extracted from optmain.tlib near line 46 */ 375 376 #if defined(TEST_NTPSNMPD_OPTS) /* TEST-MAIN-PROCEDURE: */ 377 378 extern void optionPutShell(tOptions*); 379 380 /** 381 * Generated main procedure. This will emit text that a Bourne shell can 382 * process to handle its command line arguments. 383 * 384 * @param[in] argc argument count 385 * @param[in] argv argument vector 386 * @returns program exit code 387 */ 388 int 389 main(int argc, char ** argv) 390 { 391 int res = NTPSNMPD_EXIT_SUCCESS; 392 (void)optionProcess(&ntpsnmpdOptions, argc, argv); 393 optionPutShell(&ntpsnmpdOptions); 394 res = ferror(stdout); 395 if (res != 0) 396 fputs("output error writing to stdout\n", stderr); 397 return res; 398 } 399 #endif /* TEST_NTPSNMPD_OPTS END-TEST-MAIN-PROCEDURE */ 400 /* extracted from optmain.tlib near line 1245 */ 401 402 /** 403 * The directory containing the data associated with ntpsnmpd. 404 */ 405 #ifndef PKGDATADIR 406 # define PKGDATADIR "" 407 #endif 408 409 /** 410 * Information about the person or institution that packaged ntpsnmpd 411 * for the current distribution. 412 */ 413 #ifndef WITH_PACKAGER 414 # define ntpsnmpd_packager_info NULL 415 #else 416 /** Packager information for ntpsnmpd. */ 417 static char const ntpsnmpd_packager_info[] = 418 "Packaged by " WITH_PACKAGER 419 420 # ifdef WITH_PACKAGER_VERSION 421 " ("WITH_PACKAGER_VERSION")" 422 # endif 423 424 # ifdef WITH_PACKAGER_BUG_REPORTS 425 "\nReport ntpsnmpd bugs to " WITH_PACKAGER_BUG_REPORTS 426 # endif 427 "\n"; 428 #endif 429 #ifndef __doxygen__ 430 431 #endif /* __doxygen__ */ 432 /** 433 * The option definitions for ntpsnmpd. The one structure that 434 * binds them all. 435 */ 436 tOptions ntpsnmpdOptions = { 437 OPTIONS_STRUCT_VERSION, 438 0, NULL, /* original argc + argv */ 439 ( OPTPROC_BASE 440 + OPTPROC_ERRSTOP 441 + OPTPROC_SHORTOPT 442 + OPTPROC_LONGOPT 443 + OPTPROC_NO_REQ_OPT 444 + OPTPROC_ENVIRON 445 + OPTPROC_NO_ARGS 446 + OPTPROC_MISUSE 447 + OPTPROC_SHELL_OUTPUT ), 448 0, NULL, /* current option index, current option */ 449 NULL, NULL, zPROGNAME, 450 zRcName, zCopyright, zLicenseDescrip, 451 zFullVersion, apzHomeList, zUsageTitle, 452 zExplain, zDetail, optDesc, 453 zBugsAddr, /* address to send bugs to */ 454 NULL, NULL, /* extensions/saved state */ 455 optionUsage, /* usage procedure */ 456 translate_option_strings, /* translation procedure */ 457 /* 458 * Indexes to special options 459 */ 460 { INDEX_OPT_MORE_HELP, /* more-help option index */ 461 INDEX_OPT_SAVE_OPTS, /* save option index */ 462 NO_EQUIVALENT, /* '-#' option index */ 463 NO_EQUIVALENT /* index of default opt */ 464 }, 465 8 /* full option count */, 3 /* user option count */, 466 ntpsnmpd_full_usage, ntpsnmpd_short_usage, 467 NULL, NULL, 468 PKGDATADIR, ntpsnmpd_packager_info 469 }; 470 471 #if ENABLE_NLS 472 /** 473 * This code is designed to translate translatable option text for the 474 * ntpsnmpd program. These translations happen upon entry 475 * to optionProcess(). 476 */ 477 #include <stdio.h> 478 #include <stdlib.h> 479 #include <string.h> 480 #include <unistd.h> 481 #ifdef HAVE_DCGETTEXT 482 # include <gettext.h> 483 #endif 484 #include <autoopts/usage-txt.h> 485 486 static char * AO_gettext(char const * pz); 487 static void coerce_it(void ** s); 488 489 /** 490 * AutoGen specific wrapper function for gettext. It relies on the macro _() 491 * to convert from English to the target language, then strdup-duplicates the 492 * result string. It tries the "libopts" domain first, then whatever has been 493 * set via the \a textdomain(3) call. 494 * 495 * @param[in] pz the input text used as a lookup key. 496 * @returns the translated text (if there is one), 497 * or the original text (if not). 498 */ 499 static char * 500 AO_gettext(char const * pz) 501 { 502 char * res; 503 if (pz == NULL) 504 return NULL; 505 #ifdef HAVE_DCGETTEXT 506 /* 507 * While processing the option_xlateable_txt data, try to use the 508 * "libopts" domain. Once we switch to the option descriptor data, 509 * do *not* use that domain. 510 */ 511 if (option_xlateable_txt.field_ct != 0) { 512 res = dgettext("libopts", pz); 513 if (res == pz) 514 res = (char *)(void *)_(pz); 515 } else 516 res = (char *)(void *)_(pz); 517 #else 518 res = (char *)(void *)_(pz); 519 #endif 520 if (res == pz) 521 return res; 522 res = strdup(res); 523 if (res == NULL) { 524 fputs(_("No memory for duping translated strings\n"), stderr); 525 exit(NTPSNMPD_EXIT_FAILURE); 526 } 527 return res; 528 } 529 530 /** 531 * All the pointers we use are marked "* const", but they are stored in 532 * writable memory. Coerce the mutability and set the pointer. 533 */ 534 static void coerce_it(void ** s) { *s = AO_gettext(*s); 535 } 536 537 /** 538 * Translate all the translatable strings in the ntpsnmpdOptions 539 * structure defined above. This is done only once. 540 */ 541 static void 542 translate_option_strings(void) 543 { 544 tOptions * const opts = &ntpsnmpdOptions; 545 546 /* 547 * Guard against re-translation. It won't work. The strings will have 548 * been changed by the first pass through this code. One shot only. 549 */ 550 if (option_xlateable_txt.field_ct != 0) { 551 /* 552 * Do the translations. The first pointer follows the field count 553 * field. The field count field is the size of a pointer. 554 */ 555 char ** ppz = (char**)(void*)&(option_xlateable_txt); 556 int ix = option_xlateable_txt.field_ct; 557 558 do { 559 ppz++; /* skip over field_ct */ 560 *ppz = AO_gettext(*ppz); 561 } while (--ix > 0); 562 /* prevent re-translation and disable "libopts" domain lookup */ 563 option_xlateable_txt.field_ct = 0; 564 565 coerce_it((void*)&(opts->pzCopyright)); 566 coerce_it((void*)&(opts->pzCopyNotice)); 567 coerce_it((void*)&(opts->pzFullVersion)); 568 coerce_it((void*)&(opts->pzUsageTitle)); 569 coerce_it((void*)&(opts->pzExplain)); 570 coerce_it((void*)&(opts->pzDetail)); 571 { 572 tOptDesc * od = opts->pOptDesc; 573 for (ix = opts->optCt; ix > 0; ix--, od++) 574 coerce_it((void*)&(od->pzText)); 575 } 576 } 577 } 578 #endif /* ENABLE_NLS */ 579 580 #ifdef DO_NOT_COMPILE_THIS_CODE_IT_IS_FOR_GETTEXT 581 /** I18N function strictly for xgettext. Do not compile. */ 582 static void bogus_function(void) { 583 /* TRANSLATORS: 584 585 The following dummy function was crated solely so that xgettext can 586 extract the correct strings. These strings are actually referenced 587 by a field name in the ntpsnmpdOptions structure noted in the 588 comments below. The literal text is defined in ntpsnmpd_opt_strs. 589 590 NOTE: the strings below are segmented with respect to the source string 591 ntpsnmpd_opt_strs. The strings above are handed off for translation 592 at run time a paragraph at a time. Consequently, they are presented here 593 for translation a paragraph at a time. 594 595 ALSO: often the description for an option will reference another option 596 by name. These are set off with apostrophe quotes (I hope). Do not 597 translate option names. 598 */ 599 /* referenced via ntpsnmpdOptions.pzCopyright */ 600 puts(_("ntpsnmpd 4.2.7p404\n\ 601 Copyright (C) 1970-2013 The University of Delaware, all rights reserved.\n\ 602 This is free software. It is licensed for use, modification and\n\ 603 redistribution under the terms of the NTP License, copies of which\n\ 604 can be seen at:\n")); 605 puts(_(" <http://ntp.org/license>\n\ 606 <http://opensource.org/licenses/ntp-license.php>\n")); 607 608 /* referenced via ntpsnmpdOptions.pzCopyNotice */ 609 puts(_("Permission to use, copy, modify, and distribute this software and its\n\ 610 documentation for any purpose with or without fee is hereby granted,\n\ 611 provided that the above copyright notice appears in all copies and that\n\ 612 both the copyright notice and this permission notice appear in supporting\n\ 613 documentation, and that the name The University of Delaware not be used in\n\ 614 advertising or publicity pertaining to distribution of the software without\n\ 615 specific, written prior permission. The University of Delaware makes no\n\ 616 representations about the suitability this software for any purpose. It is\n\ 617 provided \"as is\" without express or implied warranty.\n")); 618 619 /* referenced via ntpsnmpdOptions.pOptDesc->pzText */ 620 puts(_("Do not fork")); 621 622 /* referenced via ntpsnmpdOptions.pOptDesc->pzText */ 623 puts(_("Log to syslog()")); 624 625 /* referenced via ntpsnmpdOptions.pOptDesc->pzText */ 626 puts(_("The socket address ntpsnmpd uses to connect to net-snmpd")); 627 628 /* referenced via ntpsnmpdOptions.pOptDesc->pzText */ 629 puts(_("display extended usage information and exit")); 630 631 /* referenced via ntpsnmpdOptions.pOptDesc->pzText */ 632 puts(_("extended usage information passed thru pager")); 633 634 /* referenced via ntpsnmpdOptions.pOptDesc->pzText */ 635 puts(_("output version information and exit")); 636 637 /* referenced via ntpsnmpdOptions.pOptDesc->pzText */ 638 puts(_("save the option state to a config file")); 639 640 /* referenced via ntpsnmpdOptions.pOptDesc->pzText */ 641 puts(_("load options from a config file")); 642 643 /* referenced via ntpsnmpdOptions.pzUsageTitle */ 644 puts(_("ntpsnmpd - NTP SNMP MIB agent - Ver. 4.2.7p404\n\ 645 Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n")); 646 647 /* referenced via ntpsnmpdOptions.pzExplain */ 648 puts(_("\n")); 649 650 /* referenced via ntpsnmpdOptions.pzFullVersion */ 651 puts(_("ntpsnmpd 4.2.7p404")); 652 653 /* referenced via ntpsnmpdOptions.pzFullUsage */ 654 puts(_("<<<NOT-FOUND>>>")); 655 656 /* referenced via ntpsnmpdOptions.pzShortUsage */ 657 puts(_("<<<NOT-FOUND>>>")); 658 /* LIBOPTS-MESSAGES: */ 659 #line 67 "../autoopts.c" 660 puts(_("allocation of %d bytes failed\n")); 661 #line 93 "../autoopts.c" 662 puts(_("allocation of %d bytes failed\n")); 663 #line 53 "../init.c" 664 puts(_("AutoOpts function called without option descriptor\n")); 665 #line 90 "../init.c" 666 puts(_("\tThis exceeds the compiled library version: ")); 667 #line 88 "../init.c" 668 puts(_("Automated Options Processing Error!\n" 669 "\t%s called AutoOpts function with structure version %d:%d:%d.\n")); 670 #line 80 "../autoopts.c" 671 puts(_("realloc of %d bytes at 0x%p failed\n")); 672 #line 92 "../init.c" 673 puts(_("\tThis is less than the minimum library version: ")); 674 #line 121 "../version.c" 675 puts(_("Automated Options version %s\n" 676 "\tCopyright (C) 1999-2013 by Bruce Korb - all rights reserved\n")); 677 #line 82 "../makeshell.c" 678 puts(_("(AutoOpts bug): %s.\n")); 679 #line 90 "../reset.c" 680 puts(_("optionResetOpt() called, but reset-option not configured")); 681 #line 292 "../usage.c" 682 puts(_("could not locate the 'help' option")); 683 #line 336 "../autoopts.c" 684 puts(_("optionProcess() was called with invalid data")); 685 #line 748 "../usage.c" 686 puts(_("invalid argument type specified")); 687 #line 598 "../find.c" 688 puts(_("defaulted to option with optional arg")); 689 #line 76 "../alias.c" 690 puts(_("aliasing option is out of range.")); 691 #line 234 "../enum.c" 692 puts(_("%s error: the keyword '%s' is ambiguous for %s\n")); 693 #line 108 "../find.c" 694 puts(_(" The following options match:\n")); 695 #line 293 "../find.c" 696 puts(_("%s: ambiguous option name: %s (matches %d options)\n")); 697 #line 161 "../check.c" 698 puts(_("%s: Command line arguments required\n")); 699 #line 43 "../alias.c" 700 puts(_("%d %s%s options allowed\n")); 701 #line 89 "../makeshell.c" 702 puts(_("%s error %d (%s) calling %s for '%s'\n")); 703 #line 301 "../makeshell.c" 704 puts(_("interprocess pipe")); 705 #line 168 "../version.c" 706 puts(_("error: version option argument '%c' invalid. Use:\n" 707 "\t'v' - version only\n" 708 "\t'c' - version and copyright\n" 709 "\t'n' - version and full copyright notice\n")); 710 #line 58 "../check.c" 711 puts(_("%s error: the '%s' and '%s' options conflict\n")); 712 #line 217 "../find.c" 713 puts(_("%s: The '%s' option has been disabled.")); 714 #line 430 "../find.c" 715 puts(_("%s: The '%s' option has been disabled.")); 716 #line 38 "../alias.c" 717 puts(_("-equivalence")); 718 #line 469 "../find.c" 719 puts(_("%s: illegal option -- %c\n")); 720 #line 110 "../reset.c" 721 puts(_("%s: illegal option -- %c\n")); 722 #line 271 "../find.c" 723 puts(_("%s: illegal option -- %s\n")); 724 #line 755 "../find.c" 725 puts(_("%s: illegal option -- %s\n")); 726 #line 118 "../reset.c" 727 puts(_("%s: illegal option -- %s\n")); 728 #line 335 "../find.c" 729 puts(_("%s: unknown vendor extension option -- %s\n")); 730 #line 159 "../enum.c" 731 puts(_(" or an integer from %d through %d\n")); 732 #line 169 "../enum.c" 733 puts(_(" or an integer from %d through %d\n")); 734 #line 747 "../usage.c" 735 puts(_("%s error: invalid option descriptor for %s\n")); 736 #line 1081 "../usage.c" 737 puts(_("%s error: invalid option descriptor for %s\n")); 738 #line 385 "../find.c" 739 puts(_("%s: invalid option name: %s\n")); 740 #line 527 "../find.c" 741 puts(_("%s: The '%s' option requires an argument.\n")); 742 #line 156 "../autoopts.c" 743 puts(_("(AutoOpts bug): Equivalenced option '%s' was equivalenced to both\n" 744 "\t'%s' and '%s'.")); 745 #line 94 "../check.c" 746 puts(_("%s error: The %s option is required\n")); 747 #line 632 "../find.c" 748 puts(_("%s: The '%s' option cannot have an argument.\n")); 749 #line 151 "../check.c" 750 puts(_("%s: Command line arguments are not allowed.\n")); 751 #line 535 "../save.c" 752 puts(_("error %d (%s) creating %s\n")); 753 #line 234 "../enum.c" 754 puts(_("%s error: '%s' does not match any %s keywords.\n")); 755 #line 93 "../reset.c" 756 puts(_("%s error: The '%s' option requires an argument.\n")); 757 #line 184 "../save.c" 758 puts(_("error %d (%s) stat-ing %s\n")); 759 #line 238 "../save.c" 760 puts(_("error %d (%s) stat-ing %s\n")); 761 #line 143 "../restore.c" 762 puts(_("%s error: no saved option state\n")); 763 #line 231 "../autoopts.c" 764 puts(_("'%s' is not a command line option.\n")); 765 #line 114 "../time.c" 766 puts(_("%s error: '%s' is not a recognizable date/time.\n")); 767 #line 132 "../save.c" 768 puts(_("'%s' not defined\n")); 769 #line 53 "../time.c" 770 puts(_("%s error: '%s' is not a recognizable time duration.\n")); 771 #line 92 "../check.c" 772 puts(_("%s error: The %s option must appear %d times.\n")); 773 #line 157 "../numeric.c" 774 puts(_("%s error: '%s' is not a recognizable number.\n")); 775 #line 200 "../enum.c" 776 puts(_("%s error: %s exceeds %s keyword count\n")); 777 #line 330 "../usage.c" 778 puts(_("Try '%s %s' for more information.\n")); 779 #line 45 "../alias.c" 780 puts(_("one %s%s option allowed\n")); 781 #line 203 "../makeshell.c" 782 puts(_("standard output")); 783 #line 938 "../makeshell.c" 784 puts(_("standard output")); 785 #line 274 "../usage.c" 786 puts(_("standard output")); 787 #line 415 "../usage.c" 788 puts(_("standard output")); 789 #line 625 "../usage.c" 790 puts(_("standard output")); 791 #line 175 "../version.c" 792 puts(_("standard output")); 793 #line 274 "../usage.c" 794 puts(_("standard error")); 795 #line 415 "../usage.c" 796 puts(_("standard error")); 797 #line 625 "../usage.c" 798 puts(_("standard error")); 799 #line 175 "../version.c" 800 puts(_("standard error")); 801 #line 203 "../makeshell.c" 802 puts(_("write")); 803 #line 938 "../makeshell.c" 804 puts(_("write")); 805 #line 273 "../usage.c" 806 puts(_("write")); 807 #line 414 "../usage.c" 808 puts(_("write")); 809 #line 624 "../usage.c" 810 puts(_("write")); 811 #line 174 "../version.c" 812 puts(_("write")); 813 #line 60 "../numeric.c" 814 puts(_("%s error: %s option value %ld is out of range.\n")); 815 #line 44 "../check.c" 816 puts(_("%s error: %s option requires the %s option\n")); 817 #line 131 "../save.c" 818 puts(_("%s warning: cannot save options - %s not regular file\n")); 819 #line 183 "../save.c" 820 puts(_("%s warning: cannot save options - %s not regular file\n")); 821 #line 237 "../save.c" 822 puts(_("%s warning: cannot save options - %s not regular file\n")); 823 #line 256 "../save.c" 824 puts(_("%s warning: cannot save options - %s not regular file\n")); 825 #line 534 "../save.c" 826 puts(_("%s warning: cannot save options - %s not regular file\n")); 827 /* END-LIBOPTS-MESSAGES */ 828 829 /* USAGE-TEXT: */ 830 #line 873 "../usage.c" 831 puts(_("\t\t\t\t- an alternate for '%s'\n")); 832 #line 1148 "../usage.c" 833 puts(_("Version, usage and configuration options:")); 834 #line 924 "../usage.c" 835 puts(_("\t\t\t\t- default option for unnamed options\n")); 836 #line 837 "../usage.c" 837 puts(_("\t\t\t\t- disabled as '--%s'\n")); 838 #line 1117 "../usage.c" 839 puts(_(" --- %-14s %s\n")); 840 #line 1115 "../usage.c" 841 puts(_("This option has been disabled")); 842 #line 864 "../usage.c" 843 puts(_("\t\t\t\t- enabled by default\n")); 844 #line 40 "../alias.c" 845 puts(_("%s error: only ")); 846 #line 1194 "../usage.c" 847 puts(_(" - examining environment variables named %s_*\n")); 848 #line 168 "../file.c" 849 puts(_("\t\t\t\t- file must not pre-exist\n")); 850 #line 172 "../file.c" 851 puts(_("\t\t\t\t- file must pre-exist\n")); 852 #line 380 "../usage.c" 853 puts(_("Options are specified by doubled hyphens and their name or by a single\n" 854 "hyphen and the flag character.\n")); 855 #line 916 "../makeshell.c" 856 puts(_("\n" 857 "= = = = = = = =\n\n" 858 "This incarnation of genshell will produce\n" 859 "a shell script to parse the options for %s:\n\n")); 860 #line 166 "../enum.c" 861 puts(_(" or an integer mask with any of the lower %d bits set\n")); 862 #line 897 "../usage.c" 863 puts(_("\t\t\t\t- is a set membership option\n")); 864 #line 918 "../usage.c" 865 puts(_("\t\t\t\t- must appear between %d and %d times\n")); 866 #line 382 "../usage.c" 867 puts(_("Options are specified by single or double hyphens and their name.\n")); 868 #line 904 "../usage.c" 869 puts(_("\t\t\t\t- may appear multiple times\n")); 870 #line 891 "../usage.c" 871 puts(_("\t\t\t\t- may not be preset\n")); 872 #line 1309 "../usage.c" 873 puts(_(" Arg Option-Name Description\n")); 874 #line 1245 "../usage.c" 875 puts(_(" Flg Arg Option-Name Description\n")); 876 #line 1303 "../usage.c" 877 puts(_(" Flg Arg Option-Name Description\n")); 878 #line 1304 "../usage.c" 879 puts(_(" %3s %s")); 880 #line 1310 "../usage.c" 881 puts(_(" %3s %s")); 882 #line 387 "../usage.c" 883 puts(_("The '-#<number>' option may omit the hash char\n")); 884 #line 383 "../usage.c" 885 puts(_("All arguments are named options.\n")); 886 #line 971 "../usage.c" 887 puts(_(" - reading file %s")); 888 #line 409 "../usage.c" 889 puts(_("\n" 890 "Please send bug reports to: <%s>\n")); 891 #line 100 "../version.c" 892 puts(_("\n" 893 "Please send bug reports to: <%s>\n")); 894 #line 129 "../version.c" 895 puts(_("\n" 896 "Please send bug reports to: <%s>\n")); 897 #line 903 "../usage.c" 898 puts(_("\t\t\t\t- may NOT appear - preset only\n")); 899 #line 944 "../usage.c" 900 puts(_("\n" 901 "The following option preset mechanisms are supported:\n")); 902 #line 1192 "../usage.c" 903 puts(_("\n" 904 "The following option preset mechanisms are supported:\n")); 905 #line 682 "../usage.c" 906 puts(_("prohibits these options:\n")); 907 #line 677 "../usage.c" 908 puts(_("prohibits the option '%s'\n")); 909 #line 81 "../numeric.c" 910 puts(_("%s%ld to %ld")); 911 #line 79 "../numeric.c" 912 puts(_("%sgreater than or equal to %ld")); 913 #line 75 "../numeric.c" 914 puts(_("%s%ld exactly")); 915 #line 68 "../numeric.c" 916 puts(_("%sit must lie in one of the ranges:\n")); 917 #line 68 "../numeric.c" 918 puts(_("%sit must be in the range:\n")); 919 #line 88 "../numeric.c" 920 puts(_(", or\n")); 921 #line 66 "../numeric.c" 922 puts(_("%sis scalable with a suffix: k/K/m/M/g/G/t/T\n")); 923 #line 77 "../numeric.c" 924 puts(_("%sless than or equal to %ld")); 925 #line 390 "../usage.c" 926 puts(_("Operands and options may be intermixed. They will be reordered.\n")); 927 #line 652 "../usage.c" 928 puts(_("requires the option '%s'\n")); 929 #line 655 "../usage.c" 930 puts(_("requires these options:\n")); 931 #line 1321 "../usage.c" 932 puts(_(" Arg Option-Name Req? Description\n")); 933 #line 1315 "../usage.c" 934 puts(_(" Flg Arg Option-Name Req? Description\n")); 935 #line 167 "../enum.c" 936 puts(_("or you may use a numeric representation. Preceding these with a '!'\n" 937 "will clear the bits, specifying 'none' will clear all bits, and 'all'\n" 938 "will set them all. Multiple entries may be passed as an option\n" 939 "argument list.\n")); 940 #line 910 "../usage.c" 941 puts(_("\t\t\t\t- may appear up to %d times\n")); 942 #line 77 "../enum.c" 943 puts(_("The valid \"%s\" option keywords are:\n")); 944 #line 1152 "../usage.c" 945 puts(_("The next option supports vendor supported extra options:")); 946 #line 773 "../usage.c" 947 puts(_("These additional options are:")); 948 /* END-USAGE-TEXT */ 949 } 950 #endif /* uncompilable code */ 951 #ifdef __cplusplus 952 } 953 #endif 954 /* ntpsnmpd-opts.c ends here */ 955