ntpsnmpd-opts.c revision 330141
1163953Srrs/* 2169382Srrs * EDIT THIS FILE WITH CAUTION (ntpsnmpd-opts.c) 3235828Stuexen * 4235828Stuexen * It has been AutoGen-ed February 27, 2018 at 05:15:31 PM by AutoGen 5.18.5 5163953Srrs * From the definitions ntpsnmpd-opts.def 6163953Srrs * and the template file options 7163953Srrs * 8163953Srrs * Generated from AutoOpts 41:0:16 templates. 9163953Srrs * 10228653Stuexen * AutoOpts is a copyrighted work. This source file is not encumbered 11163953Srrs * by AutoOpts licensing, but is provided under the licensing terms chosen 12163953Srrs * by the ntpsnmpd author or copyright holder. AutoOpts is 13163953Srrs * licensed under the terms of the LGPL. The redistributable library 14228653Stuexen * (``libopts'') is licensed under the terms of either the LGPL or, at the 15163953Srrs * users discretion, the BSD license. See the AutoOpts and/or libopts sources 16163953Srrs * for details. 17163953Srrs * 18163953Srrs * The ntpsnmpd program is copyrighted and licensed 19163953Srrs * under the following terms: 20163953Srrs * 21163953Srrs * Copyright (C) 1992-2017 The University of Delaware and Network Time Foundation, all rights reserved. 22163953Srrs * This is free software. It is licensed for use, modification and 23163953Srrs * redistribution under the terms of the NTP License, copies of which 24163953Srrs * can be seen at: 25163953Srrs * <http://ntp.org/license> 26163953Srrs * <http://opensource.org/licenses/ntp-license.php> 27163953Srrs * 28163953Srrs * Permission to use, copy, modify, and distribute this software and its 29163953Srrs * documentation for any purpose with or without fee is hereby granted, 30163953Srrs * provided that the above copyright notice appears in all copies and that 31163953Srrs * both the copyright notice and this permission notice appear in 32163953Srrs * supporting documentation, and that the name The University of Delaware not be used in 33163953Srrs * advertising or publicity pertaining to distribution of the software 34163953Srrs * without specific, written prior permission. The University of Delaware and Network Time Foundation makes no 35163953Srrs * representations about the suitability this software for any purpose. It 36235828Stuexen * is provided "as is" without express or implied warranty. 37235828Stuexen */ 38163953Srrs 39180387Srrs#ifndef __doxygen__ 40163953Srrs#define OPTION_CODE_COMPILE 1 41195918Srrs#include "ntpsnmpd-opts.h" 42195918Srrs#include <sys/types.h> 43168755Srrs 44168859Srrs#include <limits.h> 45168859Srrs#include <stdio.h> 46168859Srrs#include <stdlib.h> 47168859Srrs 48168859Srrs#ifdef __cplusplus 49163953Srrsextern "C" { 50163953Srrs#endif 51163953Srrsextern FILE * option_usage_fp; 52163953Srrs#define zCopyright (ntpsnmpd_opt_strs+0) 53163953Srrs#define zLicenseDescrip (ntpsnmpd_opt_strs+345) 54163953Srrs 55163953Srrs 56163953Srrs#ifndef NULL 57163953Srrs# define NULL 0 58171943Srrs#endif 59171943Srrs 60172157Srrs/** 61163953Srrs * static const strings for ntpsnmpd options 62171943Srrs */ 63171943Srrsstatic char const ntpsnmpd_opt_strs[1613] = 64163953Srrs/* 0 */ "ntpsnmpd 4.2.8p11\n" 65163953Srrs "Copyright (C) 1992-2017 The University of Delaware and Network Time Foundation, all rights reserved.\n" 66163953Srrs "This is free software. It is licensed for use, modification and\n" 67163953Srrs "redistribution under the terms of the NTP License, copies of which\n" 68163953Srrs "can be seen at:\n" 69163953Srrs " <http://ntp.org/license>\n" 70294149Stuexen " <http://opensource.org/licenses/ntp-license.php>\n\0" 71294149Stuexen/* 345 */ "Permission to use, copy, modify, and distribute this software and its\n" 72294149Stuexen "documentation for any purpose with or without fee is hereby granted,\n" 73167698Srrs "provided that the above copyright notice appears in all copies and that\n" 74167698Srrs "both the copyright notice and this permission notice appear in supporting\n" 75167698Srrs "documentation, and that the name The University of Delaware not be used in\n" 76167598Srrs "advertising or publicity pertaining to distribution of the software without\n" 77167598Srrs "specific, written prior permission. The University of Delaware and Network\n" 78163953Srrs "Time Foundation makes no representations about the suitability this\n" 79167598Srrs "software for any purpose. It is provided \"as is\" without express or\n" 80167598Srrs "implied warranty.\n\0" 81167598Srrs/* 1013 */ "Do not fork\0" 82163953Srrs/* 1025 */ "NOFORK\0" 83163953Srrs/* 1032 */ "nofork\0" 84185694Srrs/* 1039 */ "Log to syslog()\0" 85163953Srrs/* 1055 */ "SYSLOG\0" 86294215Stuexen/* 1062 */ "syslog\0" 87163953Srrs/* 1069 */ "The socket address ntpsnmpd uses to connect to net-snmpd\0" 88163953Srrs/* 1126 */ "AGENTXSOCKET\0" 89163953Srrs/* 1139 */ "agentxsocket\0" 90169420Srrs/* 1152 */ "unix:/var/agentx/master\0" 91233660Srrs/* 1176 */ "display extended usage information and exit\0" 92233660Srrs/* 1220 */ "help\0" 93233660Srrs/* 1225 */ "extended usage information passed thru pager\0" 94233660Srrs/* 1270 */ "more-help\0" 95233660Srrs/* 1280 */ "output version information and exit\0" 96233660Srrs/* 1316 */ "version\0" 97163953Srrs/* 1324 */ "save the option state to a config file\0" 98163953Srrs/* 1363 */ "save-opts\0" 99163953Srrs/* 1373 */ "load options from a config file\0" 100169378Srrs/* 1405 */ "LOAD_OPTS\0" 101163953Srrs/* 1415 */ "no-load-opts\0" 102165220Srrs/* 1428 */ "no\0" 103163953Srrs/* 1431 */ "NTPSNMPD\0" 104167598Srrs/* 1440 */ "ntpsnmpd - NTP SNMP MIB agent - Ver. 4.2.8p11\n" 105167598Srrs "Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n\0" 106167598Srrs/* 1544 */ "$HOME\0" 107163953Srrs/* 1550 */ ".\0" 108166023Srrs/* 1552 */ ".ntprc\0" 109163953Srrs/* 1559 */ "http://bugs.ntp.org, bugs@ntp.org\0" 110163953Srrs/* 1593 */ "\n\0" 111163953Srrs/* 1595 */ "ntpsnmpd 4.2.8p11"; 112163953Srrs 113163953Srrs/** 114163953Srrs * nofork option description: 115172090Srrs */ 116195918Srrs/** Descriptive text for the nofork option */ 117172090Srrs#define NOFORK_DESC (ntpsnmpd_opt_strs+1013) 118172090Srrs/** Upper-cased name for the nofork option */ 119172090Srrs#define NOFORK_NAME (ntpsnmpd_opt_strs+1025) 120172090Srrs/** Name string for the nofork option */ 121172090Srrs#define NOFORK_name (ntpsnmpd_opt_strs+1032) 122163953Srrs/** Compiled in flag settings for the nofork option */ 123163953Srrs#define NOFORK_FLAGS (OPTST_DISABLED) 124163953Srrs 125163953Srrs/** 126163953Srrs * syslog option description: 127163953Srrs */ 128163953Srrs/** Descriptive text for the syslog option */ 129163953Srrs#define SYSLOG_DESC (ntpsnmpd_opt_strs+1039) 130163953Srrs/** Upper-cased name for the syslog option */ 131163953Srrs#define SYSLOG_NAME (ntpsnmpd_opt_strs+1055) 132163953Srrs/** Name string for the syslog option */ 133167598Srrs#define SYSLOG_name (ntpsnmpd_opt_strs+1062) 134167598Srrs/** Compiled in flag settings for the syslog option */ 135214939Stuexen#define SYSLOG_FLAGS (OPTST_DISABLED) 136228653Stuexen 137163953Srrs/** 138163953Srrs * agentXSocket option description: 139163953Srrs */ 140163953Srrs/** Descriptive text for the agentXSocket option */ 141163953Srrs#define AGENTXSOCKET_DESC (ntpsnmpd_opt_strs+1069) 142163953Srrs/** Upper-cased name for the agentXSocket option */ 143218186Srrs#define AGENTXSOCKET_NAME (ntpsnmpd_opt_strs+1126) 144163953Srrs/** Name string for the agentXSocket option */ 145163953Srrs#define AGENTXSOCKET_name (ntpsnmpd_opt_strs+1139) 146163953Srrs/** The compiled in default value for the agentXSocket option argument */ 147163953Srrs#define AGENTXSOCKET_DFT_ARG (ntpsnmpd_opt_strs+1152) 148163953Srrs/** Compiled in flag settings for the agentXSocket option */ 149163953Srrs#define AGENTXSOCKET_FLAGS (OPTST_DISABLED \ 150163953Srrs | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) 151163953Srrs 152163953Srrs/* 153270354Stuexen * Help/More_Help/Version option descriptions: 154270354Stuexen */ 155163953Srrs#define HELP_DESC (ntpsnmpd_opt_strs+1176) 156270354Stuexen#define HELP_name (ntpsnmpd_opt_strs+1220) 157270354Stuexen#ifdef HAVE_WORKING_FORK 158163953Srrs#define MORE_HELP_DESC (ntpsnmpd_opt_strs+1225) 159172090Srrs#define MORE_HELP_name (ntpsnmpd_opt_strs+1270) 160172090Srrs#define MORE_HELP_FLAGS (OPTST_IMM | OPTST_NO_INIT) 161172090Srrs#else 162172090Srrs#define MORE_HELP_DESC HELP_DESC 163172090Srrs#define MORE_HELP_name HELP_name 164172090Srrs#define MORE_HELP_FLAGS (OPTST_OMITTED | OPTST_NO_INIT) 165163953Srrs#endif 166163953Srrs#ifdef NO_OPTIONAL_OPT_ARGS 167163953Srrs# define VER_FLAGS (OPTST_IMM | OPTST_NO_INIT) 168163953Srrs#else 169169208Srrs# define VER_FLAGS (OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \ 170163953Srrs OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT) 171163953Srrs#endif 172163953Srrs#define VER_DESC (ntpsnmpd_opt_strs+1280) 173163953Srrs#define VER_name (ntpsnmpd_opt_strs+1316) 174172090Srrs#define SAVE_OPTS_DESC (ntpsnmpd_opt_strs+1324) 175235416Stuexen#define SAVE_OPTS_name (ntpsnmpd_opt_strs+1363) 176172090Srrs#define LOAD_OPTS_DESC (ntpsnmpd_opt_strs+1373) 177172090Srrs#define LOAD_OPTS_NAME (ntpsnmpd_opt_strs+1405) 178172090Srrs#define NO_LOAD_OPTS_name (ntpsnmpd_opt_strs+1415) 179172090Srrs#define LOAD_OPTS_pfx (ntpsnmpd_opt_strs+1428) 180163953Srrs#define LOAD_OPTS_name (NO_LOAD_OPTS_name + 3) 181170138Srrs/** 182163953Srrs * Declare option callback procedures 183172090Srrs */ 184235403Stuexenextern tOptProc 185235360Stuexen ntpOptionPrintVersion, optionBooleanVal, optionNestedVal, 186172090Srrs optionNumericVal, optionPagedUsage, optionResetOpt, 187172090Srrs optionStackArg, optionTimeDate, optionTimeVal, 188172090Srrs optionUnstackArg, optionVendorOption; 189172090Srrsstatic tOptProc 190163953Srrs doUsageOpt; 191163953Srrs#define VER_PROC ntpOptionPrintVersion 192163953Srrs 193237049Stuexen/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 194237715Stuexen/** 195237715Stuexen * Define the ntpsnmpd Option Descriptions. 196237049Stuexen * This is an array of OPTION_CT entries, one for each 197237049Stuexen * option that the ntpsnmpd program responds to. 198163953Srrs */ 199169352Srrsstatic tOptDesc optDesc[OPTION_CT] = { 200163953Srrs { /* entry idx, value */ 0, VALUE_OPT_NOFORK, 201163953Srrs /* equiv idx, value */ 0, VALUE_OPT_NOFORK, 202235360Stuexen /* equivalenced to */ NO_EQUIVALENT, 203172090Srrs /* min, max, act ct */ 0, 1, 0, 204172090Srrs /* opt state flags */ NOFORK_FLAGS, 0, 205172090Srrs /* last opt argumnt */ { NULL }, /* --nofork */ 206172090Srrs /* arg list/cookie */ NULL, 207172090Srrs /* must/cannot opts */ NULL, NULL, 208163953Srrs /* option proc */ NULL, 209169352Srrs /* desc, NAME, name */ NOFORK_DESC, NOFORK_NAME, NOFORK_name, 210237715Stuexen /* disablement strs */ NULL, NULL }, 211237715Stuexen 212237715Stuexen { /* entry idx, value */ 1, VALUE_OPT_SYSLOG, 213267723Stuexen /* equiv idx, value */ 1, VALUE_OPT_SYSLOG, 214284633Stuexen /* equivalenced to */ NO_EQUIVALENT, 215237049Stuexen /* min, max, act ct */ 0, 1, 0, 216163953Srrs /* opt state flags */ SYSLOG_FLAGS, 0, 217170056Srrs /* last opt argumnt */ { NULL }, /* --syslog */ 218170056Srrs /* arg list/cookie */ NULL, 219170056Srrs /* must/cannot opts */ NULL, NULL, 220169352Srrs /* option proc */ NULL, 221169352Srrs /* desc, NAME, name */ SYSLOG_DESC, SYSLOG_NAME, SYSLOG_name, 222170056Srrs /* disablement strs */ NULL, NULL }, 223170056Srrs 224169352Srrs { /* entry idx, value */ 2, VALUE_OPT_AGENTXSOCKET, 225163953Srrs /* equiv idx, value */ 2, VALUE_OPT_AGENTXSOCKET, 226178251Srrs /* equivalenced to */ NO_EQUIVALENT, 227178251Srrs /* min, max, act ct */ 0, 1, 0, 228163953Srrs /* opt state flags */ AGENTXSOCKET_FLAGS, 0, 229166675Srrs /* last opt argumnt */ { AGENTXSOCKET_DFT_ARG }, 230163953Srrs /* arg list/cookie */ NULL, 231166675Srrs /* must/cannot opts */ NULL, NULL, 232163953Srrs /* option proc */ NULL, 233163953Srrs /* desc, NAME, name */ AGENTXSOCKET_DESC, AGENTXSOCKET_NAME, AGENTXSOCKET_name, 234166675Srrs /* disablement strs */ NULL, NULL }, 235166675Srrs 236166675Srrs { /* entry idx, value */ INDEX_OPT_VERSION, VALUE_OPT_VERSION, 237166675Srrs /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_VERSION, 238166675Srrs /* equivalenced to */ NO_EQUIVALENT, 239166675Srrs /* min, max, act ct */ 0, 1, 0, 240166675Srrs /* opt state flags */ VER_FLAGS, AOUSE_VERSION, 241166675Srrs /* last opt argumnt */ { NULL }, 242166675Srrs /* arg list/cookie */ NULL, 243166675Srrs /* must/cannot opts */ NULL, NULL, 244166675Srrs /* option proc */ VER_PROC, 245166675Srrs /* desc, NAME, name */ VER_DESC, NULL, VER_name, 246166675Srrs /* disablement strs */ NULL, NULL }, 247178251Srrs 248163953Srrs 249163953Srrs 250163953Srrs { /* entry idx, value */ INDEX_OPT_HELP, VALUE_OPT_HELP, 251163953Srrs /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_HELP, 252163953Srrs /* equivalenced to */ NO_EQUIVALENT, 253163953Srrs /* min, max, act ct */ 0, 1, 0, 254163953Srrs /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, AOUSE_HELP, 255235416Stuexen /* last opt argumnt */ { NULL }, 256172090Srrs /* arg list/cookie */ NULL, 257172090Srrs /* must/cannot opts */ NULL, NULL, 258172090Srrs /* option proc */ doUsageOpt, 259172090Srrs /* desc, NAME, name */ HELP_DESC, NULL, HELP_name, 260163953Srrs /* disablement strs */ NULL, NULL }, 261267723Stuexen 262267729Stuexen { /* entry idx, value */ INDEX_OPT_MORE_HELP, VALUE_OPT_MORE_HELP, 263163953Srrs /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_MORE_HELP, 264170606Srrs /* equivalenced to */ NO_EQUIVALENT, 265170606Srrs /* min, max, act ct */ 0, 1, 0, 266170606Srrs /* opt state flags */ MORE_HELP_FLAGS, AOUSE_MORE_HELP, 267170606Srrs /* last opt argumnt */ { NULL }, 268170606Srrs /* arg list/cookie */ NULL, 269228653Stuexen /* must/cannot opts */ NULL, NULL, 270170606Srrs /* option proc */ optionPagedUsage, 271170606Srrs /* desc, NAME, name */ MORE_HELP_DESC, NULL, MORE_HELP_name, 272163953Srrs /* disablement strs */ NULL, NULL }, 273171572Srrs 274171572Srrs { /* entry idx, value */ INDEX_OPT_SAVE_OPTS, VALUE_OPT_SAVE_OPTS, 275163953Srrs /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_SAVE_OPTS, 276163953Srrs /* equivalenced to */ NO_EQUIVALENT, 277163953Srrs /* min, max, act ct */ 0, 1, 0, 278170744Srrs /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) 279163953Srrs | OPTST_ARG_OPTIONAL | OPTST_NO_INIT, AOUSE_SAVE_OPTS, 280163953Srrs /* last opt argumnt */ { NULL }, 281163953Srrs /* arg list/cookie */ NULL, 282163953Srrs /* must/cannot opts */ NULL, NULL, 283163953Srrs /* option proc */ NULL, 284270352Stuexen /* desc, NAME, name */ SAVE_OPTS_DESC, NULL, SAVE_OPTS_name, 285163953Srrs /* disablement strs */ NULL, NULL }, 286169420Srrs 287163953Srrs { /* entry idx, value */ INDEX_OPT_LOAD_OPTS, VALUE_OPT_LOAD_OPTS, 288163953Srrs /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_LOAD_OPTS, 289163953Srrs /* equivalenced to */ NO_EQUIVALENT, 290270352Stuexen /* min, max, act ct */ 0, NOLIMIT, 0, 291270352Stuexen /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) 292163953Srrs | OPTST_DISABLE_IMM, AOUSE_LOAD_OPTS, 293169420Srrs /* last opt argumnt */ { NULL }, 294163953Srrs /* arg list/cookie */ NULL, 295163953Srrs /* must/cannot opts */ NULL, NULL, 296163953Srrs /* option proc */ optionLoadOpt, 297163953Srrs /* desc, NAME, name */ LOAD_OPTS_DESC, LOAD_OPTS_NAME, LOAD_OPTS_name, 298270352Stuexen /* disablement strs */ NO_LOAD_OPTS_name, LOAD_OPTS_pfx } 299163953Srrs}; 300163953Srrs 301163953Srrs 302163953Srrs/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 303163953Srrs/** Reference to the upper cased version of ntpsnmpd. */ 304163953Srrs#define zPROGNAME (ntpsnmpd_opt_strs+1431) 305270352Stuexen/** Reference to the title line for ntpsnmpd usage. */ 306163953Srrs#define zUsageTitle (ntpsnmpd_opt_strs+1440) 307169420Srrs/** ntpsnmpd configuration file name. */ 308163953Srrs#define zRcName (ntpsnmpd_opt_strs+1552) 309163953Srrs/** Directories to search for ntpsnmpd config files. */ 310163953Srrsstatic char const * const apzHomeList[3] = { 311270352Stuexen ntpsnmpd_opt_strs+1544, 312270352Stuexen ntpsnmpd_opt_strs+1550, 313163953Srrs NULL }; 314169420Srrs/** The ntpsnmpd program bug email address. */ 315163953Srrs#define zBugsAddr (ntpsnmpd_opt_strs+1559) 316163953Srrs/** Clarification/explanation of what ntpsnmpd does. */ 317163953Srrs#define zExplain (ntpsnmpd_opt_strs+1593) 318163953Srrs/** Extra detail explaining what ntpsnmpd does. */ 319270352Stuexen#define zDetail (NULL) 320163953Srrs/** The full version string for ntpsnmpd. */ 321163953Srrs#define zFullVersion (ntpsnmpd_opt_strs+1595) 322163953Srrs/* extracted from optcode.tlib near line 364 */ 323163953Srrs 324163953Srrs#if defined(ENABLE_NLS) 325163953Srrs# define OPTPROC_BASE OPTPROC_TRANSLATE 326163953Srrs static tOptionXlateProc translate_option_strings; 327163953Srrs#else 328163953Srrs# define OPTPROC_BASE OPTPROC_NONE 329163953Srrs# define translate_option_strings NULL 330163953Srrs#endif /* ENABLE_NLS */ 331163953Srrs 332221328Stuexen#define ntpsnmpd_full_usage (NULL) 333179157Srrs#define ntpsnmpd_short_usage (NULL) 334179157Srrs 335163953Srrs#endif /* not defined __doxygen__ */ 336163953Srrs 337163953Srrs/* 338163953Srrs * Create the static procedure(s) declared above. 339163953Srrs */ 340163953Srrs/** 341163953Srrs * The callout function that invokes the optionUsage function. 342163953Srrs * 343163953Srrs * @param[in] opts the AutoOpts option description structure 344163953Srrs * @param[in] od the descriptor for the "help" (usage) option. 345163953Srrs * @noreturn 346163953Srrs */ 347163953Srrsstatic void 348163953SrrsdoUsageOpt(tOptions * opts, tOptDesc * od) 349163953Srrs{ 350164181Srrs int ex_code; 351163953Srrs ex_code = NTPSNMPD_EXIT_SUCCESS; 352163953Srrs optionUsage(&ntpsnmpdOptions, ex_code); 353163953Srrs /* NOTREACHED */ 354163953Srrs exit(1); 355283708Stuexen (void)opts; 356163953Srrs (void)od; 357163953Srrs} 358163953Srrs/* extracted from optmain.tlib near line 1250 */ 359163953Srrs 360283708Stuexen/** 361283708Stuexen * The directory containing the data associated with ntpsnmpd. 362283708Stuexen */ 363283708Stuexen#ifndef PKGDATADIR 364283708Stuexen# define PKGDATADIR "" 365163953Srrs#endif 366163953Srrs 367163953Srrs/** 368163953Srrs * Information about the person or institution that packaged ntpsnmpd 369163953Srrs * for the current distribution. 370163953Srrs */ 371163953Srrs#ifndef WITH_PACKAGER 372163953Srrs# define ntpsnmpd_packager_info NULL 373163953Srrs#else 374163953Srrs/** Packager information for ntpsnmpd. */ 375163953Srrsstatic char const ntpsnmpd_packager_info[] = 376163953Srrs "Packaged by " WITH_PACKAGER 377163953Srrs 378163953Srrs# ifdef WITH_PACKAGER_VERSION 379228653Stuexen " ("WITH_PACKAGER_VERSION")" 380163953Srrs# endif 381163953Srrs 382167598Srrs# ifdef WITH_PACKAGER_BUG_REPORTS 383163953Srrs "\nReport ntpsnmpd bugs to " WITH_PACKAGER_BUG_REPORTS 384163953Srrs# endif 385163953Srrs "\n"; 386205502Srrs#endif 387163953Srrs#ifndef __doxygen__ 388163953Srrs 389163953Srrs#endif /* __doxygen__ */ 390163953Srrs/** 391163953Srrs * The option definitions for ntpsnmpd. The one structure that 392163953Srrs * binds them all. 393163953Srrs */ 394163953SrrstOptions ntpsnmpdOptions = { 395163953Srrs OPTIONS_STRUCT_VERSION, 396163953Srrs 0, NULL, /* original argc + argv */ 397163953Srrs ( OPTPROC_BASE 398163953Srrs + OPTPROC_ERRSTOP 399 + OPTPROC_SHORTOPT 400 + OPTPROC_LONGOPT 401 + OPTPROC_NO_REQ_OPT 402 + OPTPROC_ENVIRON 403 + OPTPROC_NO_ARGS 404 + OPTPROC_MISUSE ), 405 0, NULL, /* current option index, current option */ 406 NULL, NULL, zPROGNAME, 407 zRcName, zCopyright, zLicenseDescrip, 408 zFullVersion, apzHomeList, zUsageTitle, 409 zExplain, zDetail, optDesc, 410 zBugsAddr, /* address to send bugs to */ 411 NULL, NULL, /* extensions/saved state */ 412 optionUsage, /* usage procedure */ 413 translate_option_strings, /* translation procedure */ 414 /* 415 * Indexes to special options 416 */ 417 { INDEX_OPT_MORE_HELP, /* more-help option index */ 418 INDEX_OPT_SAVE_OPTS, /* save option index */ 419 NO_EQUIVALENT, /* '-#' option index */ 420 NO_EQUIVALENT /* index of default opt */ 421 }, 422 8 /* full option count */, 3 /* user option count */, 423 ntpsnmpd_full_usage, ntpsnmpd_short_usage, 424 NULL, NULL, 425 PKGDATADIR, ntpsnmpd_packager_info 426}; 427 428#if ENABLE_NLS 429/** 430 * This code is designed to translate translatable option text for the 431 * ntpsnmpd program. These translations happen upon entry 432 * to optionProcess(). 433 */ 434#include <stdio.h> 435#include <stdlib.h> 436#include <string.h> 437#include <unistd.h> 438#ifdef HAVE_DCGETTEXT 439# include <gettext.h> 440#endif 441#include <autoopts/usage-txt.h> 442 443static char * AO_gettext(char const * pz); 444static void coerce_it(void ** s); 445 446/** 447 * AutoGen specific wrapper function for gettext. It relies on the macro _() 448 * to convert from English to the target language, then strdup-duplicates the 449 * result string. It tries the "libopts" domain first, then whatever has been 450 * set via the \a textdomain(3) call. 451 * 452 * @param[in] pz the input text used as a lookup key. 453 * @returns the translated text (if there is one), 454 * or the original text (if not). 455 */ 456static char * 457AO_gettext(char const * pz) 458{ 459 char * res; 460 if (pz == NULL) 461 return NULL; 462#ifdef HAVE_DCGETTEXT 463 /* 464 * While processing the option_xlateable_txt data, try to use the 465 * "libopts" domain. Once we switch to the option descriptor data, 466 * do *not* use that domain. 467 */ 468 if (option_xlateable_txt.field_ct != 0) { 469 res = dgettext("libopts", pz); 470 if (res == pz) 471 res = (char *)VOIDP(_(pz)); 472 } else 473 res = (char *)VOIDP(_(pz)); 474#else 475 res = (char *)VOIDP(_(pz)); 476#endif 477 if (res == pz) 478 return res; 479 res = strdup(res); 480 if (res == NULL) { 481 fputs(_("No memory for duping translated strings\n"), stderr); 482 exit(NTPSNMPD_EXIT_FAILURE); 483 } 484 return res; 485} 486 487/** 488 * All the pointers we use are marked "* const", but they are stored in 489 * writable memory. Coerce the mutability and set the pointer. 490 */ 491static void coerce_it(void ** s) { *s = AO_gettext(*s); 492} 493 494/** 495 * Translate all the translatable strings in the ntpsnmpdOptions 496 * structure defined above. This is done only once. 497 */ 498static void 499translate_option_strings(void) 500{ 501 tOptions * const opts = &ntpsnmpdOptions; 502 503 /* 504 * Guard against re-translation. It won't work. The strings will have 505 * been changed by the first pass through this code. One shot only. 506 */ 507 if (option_xlateable_txt.field_ct != 0) { 508 /* 509 * Do the translations. The first pointer follows the field count 510 * field. The field count field is the size of a pointer. 511 */ 512 char ** ppz = (char**)VOIDP(&(option_xlateable_txt)); 513 int ix = option_xlateable_txt.field_ct; 514 515 do { 516 ppz++; /* skip over field_ct */ 517 *ppz = AO_gettext(*ppz); 518 } while (--ix > 0); 519 /* prevent re-translation and disable "libopts" domain lookup */ 520 option_xlateable_txt.field_ct = 0; 521 522 coerce_it(VOIDP(&(opts->pzCopyright))); 523 coerce_it(VOIDP(&(opts->pzCopyNotice))); 524 coerce_it(VOIDP(&(opts->pzFullVersion))); 525 coerce_it(VOIDP(&(opts->pzUsageTitle))); 526 coerce_it(VOIDP(&(opts->pzExplain))); 527 coerce_it(VOIDP(&(opts->pzDetail))); 528 { 529 tOptDesc * od = opts->pOptDesc; 530 for (ix = opts->optCt; ix > 0; ix--, od++) 531 coerce_it(VOIDP(&(od->pzText))); 532 } 533 } 534} 535#endif /* ENABLE_NLS */ 536 537#ifdef DO_NOT_COMPILE_THIS_CODE_IT_IS_FOR_GETTEXT 538/** I18N function strictly for xgettext. Do not compile. */ 539static void bogus_function(void) { 540 /* TRANSLATORS: 541 542 The following dummy function was crated solely so that xgettext can 543 extract the correct strings. These strings are actually referenced 544 by a field name in the ntpsnmpdOptions structure noted in the 545 comments below. The literal text is defined in ntpsnmpd_opt_strs. 546 547 NOTE: the strings below are segmented with respect to the source string 548 ntpsnmpd_opt_strs. The strings above are handed off for translation 549 at run time a paragraph at a time. Consequently, they are presented here 550 for translation a paragraph at a time. 551 552 ALSO: often the description for an option will reference another option 553 by name. These are set off with apostrophe quotes (I hope). Do not 554 translate option names. 555 */ 556 /* referenced via ntpsnmpdOptions.pzCopyright */ 557 puts(_("ntpsnmpd 4.2.8p11\n\ 558Copyright (C) 1992-2017 The University of Delaware and Network Time Foundation, all rights reserved.\n\ 559This is free software. It is licensed for use, modification and\n\ 560redistribution under the terms of the NTP License, copies of which\n\ 561can be seen at:\n")); 562 puts(_(" <http://ntp.org/license>\n\ 563 <http://opensource.org/licenses/ntp-license.php>\n")); 564 565 /* referenced via ntpsnmpdOptions.pzCopyNotice */ 566 puts(_("Permission to use, copy, modify, and distribute this software and its\n\ 567documentation for any purpose with or without fee is hereby granted,\n\ 568provided that the above copyright notice appears in all copies and that\n\ 569both the copyright notice and this permission notice appear in supporting\n\ 570documentation, and that the name The University of Delaware not be used in\n\ 571advertising or publicity pertaining to distribution of the software without\n\ 572specific, written prior permission. The University of Delaware and Network\n\ 573Time Foundation makes no representations about the suitability this\n\ 574software for any purpose. It is provided \"as is\" without express or\n\ 575implied warranty.\n")); 576 577 /* referenced via ntpsnmpdOptions.pOptDesc->pzText */ 578 puts(_("Do not fork")); 579 580 /* referenced via ntpsnmpdOptions.pOptDesc->pzText */ 581 puts(_("Log to syslog()")); 582 583 /* referenced via ntpsnmpdOptions.pOptDesc->pzText */ 584 puts(_("The socket address ntpsnmpd uses to connect to net-snmpd")); 585 586 /* referenced via ntpsnmpdOptions.pOptDesc->pzText */ 587 puts(_("display extended usage information and exit")); 588 589 /* referenced via ntpsnmpdOptions.pOptDesc->pzText */ 590 puts(_("extended usage information passed thru pager")); 591 592 /* referenced via ntpsnmpdOptions.pOptDesc->pzText */ 593 puts(_("output version information and exit")); 594 595 /* referenced via ntpsnmpdOptions.pOptDesc->pzText */ 596 puts(_("save the option state to a config file")); 597 598 /* referenced via ntpsnmpdOptions.pOptDesc->pzText */ 599 puts(_("load options from a config file")); 600 601 /* referenced via ntpsnmpdOptions.pzUsageTitle */ 602 puts(_("ntpsnmpd - NTP SNMP MIB agent - Ver. 4.2.8p11\n\ 603Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n")); 604 605 /* referenced via ntpsnmpdOptions.pzExplain */ 606 puts(_("\n")); 607 608 /* referenced via ntpsnmpdOptions.pzFullVersion */ 609 puts(_("ntpsnmpd 4.2.8p11")); 610 611 /* referenced via ntpsnmpdOptions.pzFullUsage */ 612 puts(_("<<<NOT-FOUND>>>")); 613 614 /* referenced via ntpsnmpdOptions.pzShortUsage */ 615 puts(_("<<<NOT-FOUND>>>")); 616 /* LIBOPTS-MESSAGES: */ 617#line 67 "../autoopts.c" 618 puts(_("allocation of %d bytes failed\n")); 619#line 93 "../autoopts.c" 620 puts(_("allocation of %d bytes failed\n")); 621#line 53 "../init.c" 622 puts(_("AutoOpts function called without option descriptor\n")); 623#line 86 "../init.c" 624 puts(_("\tThis exceeds the compiled library version: ")); 625#line 84 "../init.c" 626 puts(_("Automated Options Processing Error!\n" 627 "\t%s called AutoOpts function with structure version %d:%d:%d.\n")); 628#line 80 "../autoopts.c" 629 puts(_("realloc of %d bytes at 0x%p failed\n")); 630#line 88 "../init.c" 631 puts(_("\tThis is less than the minimum library version: ")); 632#line 121 "../version.c" 633 puts(_("Automated Options version %s\n" 634 "\tCopyright (C) 1999-2014 by Bruce Korb - all rights reserved\n")); 635#line 87 "../makeshell.c" 636 puts(_("(AutoOpts bug): %s.\n")); 637#line 90 "../reset.c" 638 puts(_("optionResetOpt() called, but reset-option not configured")); 639#line 292 "../usage.c" 640 puts(_("could not locate the 'help' option")); 641#line 336 "../autoopts.c" 642 puts(_("optionProcess() was called with invalid data")); 643#line 748 "../usage.c" 644 puts(_("invalid argument type specified")); 645#line 598 "../find.c" 646 puts(_("defaulted to option with optional arg")); 647#line 76 "../alias.c" 648 puts(_("aliasing option is out of range.")); 649#line 234 "../enum.c" 650 puts(_("%s error: the keyword '%s' is ambiguous for %s\n")); 651#line 108 "../find.c" 652 puts(_(" The following options match:\n")); 653#line 293 "../find.c" 654 puts(_("%s: ambiguous option name: %s (matches %d options)\n")); 655#line 161 "../check.c" 656 puts(_("%s: Command line arguments required\n")); 657#line 43 "../alias.c" 658 puts(_("%d %s%s options allowed\n")); 659#line 94 "../makeshell.c" 660 puts(_("%s error %d (%s) calling %s for '%s'\n")); 661#line 306 "../makeshell.c" 662 puts(_("interprocess pipe")); 663#line 168 "../version.c" 664 puts(_("error: version option argument '%c' invalid. Use:\n" 665 "\t'v' - version only\n" 666 "\t'c' - version and copyright\n" 667 "\t'n' - version and full copyright notice\n")); 668#line 58 "../check.c" 669 puts(_("%s error: the '%s' and '%s' options conflict\n")); 670#line 217 "../find.c" 671 puts(_("%s: The '%s' option has been disabled.")); 672#line 430 "../find.c" 673 puts(_("%s: The '%s' option has been disabled.")); 674#line 38 "../alias.c" 675 puts(_("-equivalence")); 676#line 469 "../find.c" 677 puts(_("%s: illegal option -- %c\n")); 678#line 110 "../reset.c" 679 puts(_("%s: illegal option -- %c\n")); 680#line 271 "../find.c" 681 puts(_("%s: illegal option -- %s\n")); 682#line 755 "../find.c" 683 puts(_("%s: illegal option -- %s\n")); 684#line 118 "../reset.c" 685 puts(_("%s: illegal option -- %s\n")); 686#line 335 "../find.c" 687 puts(_("%s: unknown vendor extension option -- %s\n")); 688#line 159 "../enum.c" 689 puts(_(" or an integer from %d through %d\n")); 690#line 169 "../enum.c" 691 puts(_(" or an integer from %d through %d\n")); 692#line 747 "../usage.c" 693 puts(_("%s error: invalid option descriptor for %s\n")); 694#line 1081 "../usage.c" 695 puts(_("%s error: invalid option descriptor for %s\n")); 696#line 385 "../find.c" 697 puts(_("%s: invalid option name: %s\n")); 698#line 527 "../find.c" 699 puts(_("%s: The '%s' option requires an argument.\n")); 700#line 156 "../autoopts.c" 701 puts(_("(AutoOpts bug): Equivalenced option '%s' was equivalenced to both\n" 702 "\t'%s' and '%s'.")); 703#line 94 "../check.c" 704 puts(_("%s error: The %s option is required\n")); 705#line 632 "../find.c" 706 puts(_("%s: The '%s' option cannot have an argument.\n")); 707#line 151 "../check.c" 708 puts(_("%s: Command line arguments are not allowed.\n")); 709#line 535 "../save.c" 710 puts(_("error %d (%s) creating %s\n")); 711#line 234 "../enum.c" 712 puts(_("%s error: '%s' does not match any %s keywords.\n")); 713#line 93 "../reset.c" 714 puts(_("%s error: The '%s' option requires an argument.\n")); 715#line 184 "../save.c" 716 puts(_("error %d (%s) stat-ing %s\n")); 717#line 238 "../save.c" 718 puts(_("error %d (%s) stat-ing %s\n")); 719#line 143 "../restore.c" 720 puts(_("%s error: no saved option state\n")); 721#line 231 "../autoopts.c" 722 puts(_("'%s' is not a command line option.\n")); 723#line 111 "../time.c" 724 puts(_("%s error: '%s' is not a recognizable date/time.\n")); 725#line 132 "../save.c" 726 puts(_("'%s' not defined\n")); 727#line 50 "../time.c" 728 puts(_("%s error: '%s' is not a recognizable time duration.\n")); 729#line 92 "../check.c" 730 puts(_("%s error: The %s option must appear %d times.\n")); 731#line 164 "../numeric.c" 732 puts(_("%s error: '%s' is not a recognizable number.\n")); 733#line 200 "../enum.c" 734 puts(_("%s error: %s exceeds %s keyword count\n")); 735#line 330 "../usage.c" 736 puts(_("Try '%s %s' for more information.\n")); 737#line 45 "../alias.c" 738 puts(_("one %s%s option allowed\n")); 739#line 208 "../makeshell.c" 740 puts(_("standard output")); 741#line 943 "../makeshell.c" 742 puts(_("standard output")); 743#line 274 "../usage.c" 744 puts(_("standard output")); 745#line 415 "../usage.c" 746 puts(_("standard output")); 747#line 625 "../usage.c" 748 puts(_("standard output")); 749#line 175 "../version.c" 750 puts(_("standard output")); 751#line 274 "../usage.c" 752 puts(_("standard error")); 753#line 415 "../usage.c" 754 puts(_("standard error")); 755#line 625 "../usage.c" 756 puts(_("standard error")); 757#line 175 "../version.c" 758 puts(_("standard error")); 759#line 208 "../makeshell.c" 760 puts(_("write")); 761#line 943 "../makeshell.c" 762 puts(_("write")); 763#line 273 "../usage.c" 764 puts(_("write")); 765#line 414 "../usage.c" 766 puts(_("write")); 767#line 624 "../usage.c" 768 puts(_("write")); 769#line 174 "../version.c" 770 puts(_("write")); 771#line 60 "../numeric.c" 772 puts(_("%s error: %s option value %ld is out of range.\n")); 773#line 44 "../check.c" 774 puts(_("%s error: %s option requires the %s option\n")); 775#line 131 "../save.c" 776 puts(_("%s warning: cannot save options - %s not regular file\n")); 777#line 183 "../save.c" 778 puts(_("%s warning: cannot save options - %s not regular file\n")); 779#line 237 "../save.c" 780 puts(_("%s warning: cannot save options - %s not regular file\n")); 781#line 256 "../save.c" 782 puts(_("%s warning: cannot save options - %s not regular file\n")); 783#line 534 "../save.c" 784 puts(_("%s warning: cannot save options - %s not regular file\n")); 785 /* END-LIBOPTS-MESSAGES */ 786 787 /* USAGE-TEXT: */ 788#line 873 "../usage.c" 789 puts(_("\t\t\t\t- an alternate for '%s'\n")); 790#line 1148 "../usage.c" 791 puts(_("Version, usage and configuration options:")); 792#line 924 "../usage.c" 793 puts(_("\t\t\t\t- default option for unnamed options\n")); 794#line 837 "../usage.c" 795 puts(_("\t\t\t\t- disabled as '--%s'\n")); 796#line 1117 "../usage.c" 797 puts(_(" --- %-14s %s\n")); 798#line 1115 "../usage.c" 799 puts(_("This option has been disabled")); 800#line 864 "../usage.c" 801 puts(_("\t\t\t\t- enabled by default\n")); 802#line 40 "../alias.c" 803 puts(_("%s error: only ")); 804#line 1194 "../usage.c" 805 puts(_(" - examining environment variables named %s_*\n")); 806#line 168 "../file.c" 807 puts(_("\t\t\t\t- file must not pre-exist\n")); 808#line 172 "../file.c" 809 puts(_("\t\t\t\t- file must pre-exist\n")); 810#line 380 "../usage.c" 811 puts(_("Options are specified by doubled hyphens and their name or by a single\n" 812 "hyphen and the flag character.\n")); 813#line 921 "../makeshell.c" 814 puts(_("\n" 815 "= = = = = = = =\n\n" 816 "This incarnation of genshell will produce\n" 817 "a shell script to parse the options for %s:\n\n")); 818#line 166 "../enum.c" 819 puts(_(" or an integer mask with any of the lower %d bits set\n")); 820#line 897 "../usage.c" 821 puts(_("\t\t\t\t- is a set membership option\n")); 822#line 918 "../usage.c" 823 puts(_("\t\t\t\t- must appear between %d and %d times\n")); 824#line 382 "../usage.c" 825 puts(_("Options are specified by single or double hyphens and their name.\n")); 826#line 904 "../usage.c" 827 puts(_("\t\t\t\t- may appear multiple times\n")); 828#line 891 "../usage.c" 829 puts(_("\t\t\t\t- may not be preset\n")); 830#line 1309 "../usage.c" 831 puts(_(" Arg Option-Name Description\n")); 832#line 1245 "../usage.c" 833 puts(_(" Flg Arg Option-Name Description\n")); 834#line 1303 "../usage.c" 835 puts(_(" Flg Arg Option-Name Description\n")); 836#line 1304 "../usage.c" 837 puts(_(" %3s %s")); 838#line 1310 "../usage.c" 839 puts(_(" %3s %s")); 840#line 387 "../usage.c" 841 puts(_("The '-#<number>' option may omit the hash char\n")); 842#line 383 "../usage.c" 843 puts(_("All arguments are named options.\n")); 844#line 971 "../usage.c" 845 puts(_(" - reading file %s")); 846#line 409 "../usage.c" 847 puts(_("\n" 848 "Please send bug reports to: <%s>\n")); 849#line 100 "../version.c" 850 puts(_("\n" 851 "Please send bug reports to: <%s>\n")); 852#line 129 "../version.c" 853 puts(_("\n" 854 "Please send bug reports to: <%s>\n")); 855#line 903 "../usage.c" 856 puts(_("\t\t\t\t- may NOT appear - preset only\n")); 857#line 944 "../usage.c" 858 puts(_("\n" 859 "The following option preset mechanisms are supported:\n")); 860#line 1192 "../usage.c" 861 puts(_("\n" 862 "The following option preset mechanisms are supported:\n")); 863#line 682 "../usage.c" 864 puts(_("prohibits these options:\n")); 865#line 677 "../usage.c" 866 puts(_("prohibits the option '%s'\n")); 867#line 81 "../numeric.c" 868 puts(_("%s%ld to %ld")); 869#line 79 "../numeric.c" 870 puts(_("%sgreater than or equal to %ld")); 871#line 75 "../numeric.c" 872 puts(_("%s%ld exactly")); 873#line 68 "../numeric.c" 874 puts(_("%sit must lie in one of the ranges:\n")); 875#line 68 "../numeric.c" 876 puts(_("%sit must be in the range:\n")); 877#line 88 "../numeric.c" 878 puts(_(", or\n")); 879#line 66 "../numeric.c" 880 puts(_("%sis scalable with a suffix: k/K/m/M/g/G/t/T\n")); 881#line 77 "../numeric.c" 882 puts(_("%sless than or equal to %ld")); 883#line 390 "../usage.c" 884 puts(_("Operands and options may be intermixed. They will be reordered.\n")); 885#line 652 "../usage.c" 886 puts(_("requires the option '%s'\n")); 887#line 655 "../usage.c" 888 puts(_("requires these options:\n")); 889#line 1321 "../usage.c" 890 puts(_(" Arg Option-Name Req? Description\n")); 891#line 1315 "../usage.c" 892 puts(_(" Flg Arg Option-Name Req? Description\n")); 893#line 167 "../enum.c" 894 puts(_("or you may use a numeric representation. Preceding these with a '!'\n" 895 "will clear the bits, specifying 'none' will clear all bits, and 'all'\n" 896 "will set them all. Multiple entries may be passed as an option\n" 897 "argument list.\n")); 898#line 910 "../usage.c" 899 puts(_("\t\t\t\t- may appear up to %d times\n")); 900#line 77 "../enum.c" 901 puts(_("The valid \"%s\" option keywords are:\n")); 902#line 1152 "../usage.c" 903 puts(_("The next option supports vendor supported extra options:")); 904#line 773 "../usage.c" 905 puts(_("These additional options are:")); 906 /* END-USAGE-TEXT */ 907} 908#endif /* uncompilable code */ 909#ifdef __cplusplus 910} 911#endif 912/* ntpsnmpd-opts.c ends here */ 913