ntpsnmpd-opts.c revision 285612
126238Swpaul/*
226238Swpaul *  EDIT THIS FILE WITH CAUTION  (ntpsnmpd-opts.c)
326238Swpaul *
426238Swpaul *  It has been AutoGen-ed  June 29, 2015 at 04:31:44 PM by AutoGen 5.18.5
526238Swpaul *  From the definitions    ntpsnmpd-opts.def
626238Swpaul *  and the template file   options
726238Swpaul *
826238Swpaul * Generated from AutoOpts 41:0:16 templates.
926238Swpaul *
1026238Swpaul *  AutoOpts is a copyrighted work.  This source file is not encumbered
1126238Swpaul *  by AutoOpts licensing, but is provided under the licensing terms chosen
1226238Swpaul *  by the ntpsnmpd author or copyright holder.  AutoOpts is
1326238Swpaul *  licensed under the terms of the LGPL.  The redistributable library
1426238Swpaul *  (``libopts'') is licensed under the terms of either the LGPL or, at the
1526238Swpaul *  users discretion, the BSD license.  See the AutoOpts and/or libopts sources
1626238Swpaul *  for details.
1726238Swpaul *
1826238Swpaul * The ntpsnmpd program is copyrighted and licensed
1926238Swpaul * under the following terms:
2026238Swpaul *
2126238Swpaul *  Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation, all rights reserved.
2226238Swpaul *  This is free software. It is licensed for use, modification and
2326238Swpaul *  redistribution under the terms of the NTP License, copies of which
2426238Swpaul *  can be seen at:
2526238Swpaul *    <http://ntp.org/license>
2626238Swpaul *    <http://opensource.org/licenses/ntp-license.php>
2726238Swpaul *
2826238Swpaul *  Permission to use, copy, modify, and distribute this software and its
2926238Swpaul *  documentation for any purpose with or without fee is hereby granted,
3095633Smarkm *  provided that the above copyright notice appears in all copies and that
3126238Swpaul *  both the copyright notice and this permission notice appear in
3227754Scharnier *  supporting documentation, and that the name The University of Delaware not be used in
3326238Swpaul *  advertising or publicity pertaining to distribution of the software
3426238Swpaul *  without specific, written prior permission. The University of Delaware and Network Time Foundation makes no
3527754Scharnier *  representations about the suitability this software for any purpose. It
3626238Swpaul *  is provided "as is" without express or implied warranty.
3726238Swpaul */
3826238Swpaul
3926238Swpaul#ifndef __doxygen__
4026238Swpaul#define OPTION_CODE_COMPILE 1
4126238Swpaul#include "ntpsnmpd-opts.h"
4226238Swpaul#include <sys/types.h>
4326238Swpaul
4495633Smarkm#include <limits.h>
4595633Smarkm#include <stdio.h>
4695633Smarkm#include <stdlib.h>
4787204Smarkm
4887204Smarkm#ifdef  __cplusplus
4987204Smarkmextern "C" {
5095633Smarkm#endif
5126238Swpaulextern FILE * option_usage_fp;
5226238Swpaul#define zCopyright      (ntpsnmpd_opt_strs+0)
5395633Smarkm#define zLicenseDescrip (ntpsnmpd_opt_strs+344)
5426238Swpaul
5587204Smarkm
5626238Swpaul#ifndef NULL
5726238Swpaul#  define NULL 0
5826238Swpaul#endif
5926238Swpaul
6095633Smarkm/**
61200462Sdelphij *  static const strings for ntpsnmpd options
6287204Smarkm */
6387204Smarkmstatic char const ntpsnmpd_opt_strs[1610] =
6426238Swpaul/*     0 */ "ntpsnmpd 4.2.8p3\n"
6527754Scharnier            "Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation, all rights reserved.\n"
6626238Swpaul            "This is free software. It is licensed for use, modification and\n"
6787204Smarkm            "redistribution under the terms of the NTP License, copies of which\n"
6826238Swpaul            "can be seen at:\n"
6926238Swpaul            "  <http://ntp.org/license>\n"
7026238Swpaul            "  <http://opensource.org/licenses/ntp-license.php>\n\0"
7126238Swpaul/*   344 */ "Permission to use, copy, modify, and distribute this software and its\n"
7226238Swpaul            "documentation for any purpose with or without fee is hereby granted,\n"
7326238Swpaul            "provided that the above copyright notice appears in all copies and that\n"
7492921Simp            "both the copyright notice and this permission notice appear in supporting\n"
7592921Simp            "documentation, and that the name The University of Delaware not be used in\n"
7626238Swpaul            "advertising or publicity pertaining to distribution of the software without\n"
7726238Swpaul            "specific, written prior permission.  The University of Delaware and Network\n"
7826238Swpaul            "Time Foundation makes no representations about the suitability this\n"
7926238Swpaul            "software for any purpose.  It is provided \"as is\" without express or\n"
8026238Swpaul            "implied warranty.\n\0"
8126238Swpaul/*  1012 */ "Do not fork\0"
8287204Smarkm/*  1024 */ "NOFORK\0"
8395633Smarkm/*  1031 */ "nofork\0"
8495633Smarkm/*  1038 */ "Log to syslog()\0"
8526238Swpaul/*  1054 */ "SYSLOG\0"
8626238Swpaul/*  1061 */ "syslog\0"
8726238Swpaul/*  1068 */ "The socket address ntpsnmpd uses to connect to net-snmpd\0"
8826238Swpaul/*  1125 */ "AGENTXSOCKET\0"
8926238Swpaul/*  1138 */ "agentxsocket\0"
9026238Swpaul/*  1151 */ "unix:/var/agentx/master\0"
9126238Swpaul/*  1175 */ "display extended usage information and exit\0"
9226238Swpaul/*  1219 */ "help\0"
9326238Swpaul/*  1224 */ "extended usage information passed thru pager\0"
9426238Swpaul/*  1269 */ "more-help\0"
9526238Swpaul/*  1279 */ "output version information and exit\0"
9626238Swpaul/*  1315 */ "version\0"
9726238Swpaul/*  1323 */ "save the option state to a config file\0"
9826238Swpaul/*  1362 */ "save-opts\0"
9926238Swpaul/*  1372 */ "load options from a config file\0"
10026238Swpaul/*  1404 */ "LOAD_OPTS\0"
10126238Swpaul/*  1414 */ "no-load-opts\0"
10226238Swpaul/*  1427 */ "no\0"
10326238Swpaul/*  1430 */ "NTPSNMPD\0"
10426238Swpaul/*  1439 */ "ntpsnmpd - NTP SNMP MIB agent - Ver. 4.2.8p3\n"
10526238Swpaul            "Usage:  %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n\0"
10626238Swpaul/*  1542 */ "$HOME\0"
10726238Swpaul/*  1548 */ ".\0"
10826238Swpaul/*  1550 */ ".ntprc\0"
10926238Swpaul/*  1557 */ "http://bugs.ntp.org, bugs@ntp.org\0"
11026238Swpaul/*  1591 */ "\n\0"
11126238Swpaul/*  1593 */ "ntpsnmpd 4.2.8p3";
11226238Swpaul
11326238Swpaul/**
11426238Swpaul *  nofork option description:
11526238Swpaul */
11626238Swpaul/** Descriptive text for the nofork option */
11726238Swpaul#define NOFORK_DESC      (ntpsnmpd_opt_strs+1012)
11826238Swpaul/** Upper-cased name for the nofork option */
11926238Swpaul#define NOFORK_NAME      (ntpsnmpd_opt_strs+1024)
12026238Swpaul/** Name string for the nofork option */
12126238Swpaul#define NOFORK_name      (ntpsnmpd_opt_strs+1031)
12226238Swpaul/** Compiled in flag settings for the nofork option */
12326238Swpaul#define NOFORK_FLAGS     (OPTST_DISABLED)
12426238Swpaul
12526238Swpaul/**
12626238Swpaul *  syslog option description:
12726238Swpaul */
12826238Swpaul/** Descriptive text for the syslog option */
12926238Swpaul#define SYSLOG_DESC      (ntpsnmpd_opt_strs+1038)
13026238Swpaul/** Upper-cased name for the syslog option */
13126238Swpaul#define SYSLOG_NAME      (ntpsnmpd_opt_strs+1054)
13226238Swpaul/** Name string for the syslog option */
13326238Swpaul#define SYSLOG_name      (ntpsnmpd_opt_strs+1061)
13426238Swpaul/** Compiled in flag settings for the syslog option */
13526238Swpaul#define SYSLOG_FLAGS     (OPTST_DISABLED)
13626238Swpaul
13726238Swpaul/**
13826238Swpaul *  agentXSocket option description:
13926238Swpaul */
14026238Swpaul/** Descriptive text for the agentXSocket option */
14187204Smarkm#define AGENTXSOCKET_DESC      (ntpsnmpd_opt_strs+1068)
14295633Smarkm/** Upper-cased name for the agentXSocket option */
14326238Swpaul#define AGENTXSOCKET_NAME      (ntpsnmpd_opt_strs+1125)
14426238Swpaul/** Name string for the agentXSocket option */
14526238Swpaul#define AGENTXSOCKET_name      (ntpsnmpd_opt_strs+1138)
14626238Swpaul/** The compiled in default value for the agentXSocket option argument */
14726238Swpaul#define AGENTXSOCKET_DFT_ARG   (ntpsnmpd_opt_strs+1151)
14826238Swpaul/** Compiled in flag settings for the agentXSocket option */
14926238Swpaul#define AGENTXSOCKET_FLAGS     (OPTST_DISABLED \
15026238Swpaul        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
15126238Swpaul
15226238Swpaul/*
15326238Swpaul *  Help/More_Help/Version option descriptions:
15426238Swpaul */
15526238Swpaul#define HELP_DESC       (ntpsnmpd_opt_strs+1175)
15626238Swpaul#define HELP_name       (ntpsnmpd_opt_strs+1219)
15726238Swpaul#ifdef HAVE_WORKING_FORK
15826238Swpaul#define MORE_HELP_DESC  (ntpsnmpd_opt_strs+1224)
15926238Swpaul#define MORE_HELP_name  (ntpsnmpd_opt_strs+1269)
16026238Swpaul#define MORE_HELP_FLAGS (OPTST_IMM | OPTST_NO_INIT)
16126238Swpaul#else
16226238Swpaul#define MORE_HELP_DESC  HELP_DESC
16326238Swpaul#define MORE_HELP_name  HELP_name
16426238Swpaul#define MORE_HELP_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
16526238Swpaul#endif
16626238Swpaul#ifdef NO_OPTIONAL_OPT_ARGS
16726238Swpaul#  define VER_FLAGS     (OPTST_IMM | OPTST_NO_INIT)
16826238Swpaul#else
16926238Swpaul#  define VER_FLAGS     (OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \
17026238Swpaul                         OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT)
17126238Swpaul#endif
17226238Swpaul#define VER_DESC        (ntpsnmpd_opt_strs+1279)
17326238Swpaul#define VER_name        (ntpsnmpd_opt_strs+1315)
17426238Swpaul#define SAVE_OPTS_DESC  (ntpsnmpd_opt_strs+1323)
17526238Swpaul#define SAVE_OPTS_name  (ntpsnmpd_opt_strs+1362)
17626238Swpaul#define LOAD_OPTS_DESC     (ntpsnmpd_opt_strs+1372)
17726238Swpaul#define LOAD_OPTS_NAME     (ntpsnmpd_opt_strs+1404)
17879452Sbrian#define NO_LOAD_OPTS_name  (ntpsnmpd_opt_strs+1414)
17926238Swpaul#define LOAD_OPTS_pfx      (ntpsnmpd_opt_strs+1427)
18026238Swpaul#define LOAD_OPTS_name     (NO_LOAD_OPTS_name + 3)
18126238Swpaul/**
18226238Swpaul *  Declare option callback procedures
18326238Swpaul */
18426238Swpaulextern tOptProc
18526238Swpaul    ntpOptionPrintVersion, optionBooleanVal,      optionNestedVal,
18626238Swpaul    optionNumericVal,      optionPagedUsage,      optionResetOpt,
18726238Swpaul    optionStackArg,        optionTimeDate,        optionTimeVal,
18826238Swpaul    optionUnstackArg,      optionVendorOption;
18926238Swpaulstatic tOptProc
19026238Swpaul    doUsageOpt;
19126238Swpaul#define VER_PROC        ntpOptionPrintVersion
19226238Swpaul
19326238Swpaul/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
19426238Swpaul/**
19526238Swpaul *  Define the ntpsnmpd Option Descriptions.
19626238Swpaul * This is an array of OPTION_CT entries, one for each
19726238Swpaul * option that the ntpsnmpd program responds to.
19826238Swpaul */
19926238Swpaulstatic tOptDesc optDesc[OPTION_CT] = {
20026238Swpaul  {  /* entry idx, value */ 0, VALUE_OPT_NOFORK,
20126238Swpaul     /* equiv idx, value */ 0, VALUE_OPT_NOFORK,
20226238Swpaul     /* equivalenced to  */ NO_EQUIVALENT,
20326238Swpaul     /* min, max, act ct */ 0, 1, 0,
20426238Swpaul     /* opt state flags  */ NOFORK_FLAGS, 0,
20526238Swpaul     /* last opt argumnt */ { NULL }, /* --nofork */
20626238Swpaul     /* arg list/cookie  */ NULL,
20795633Smarkm     /* must/cannot opts */ NULL, NULL,
20826238Swpaul     /* option proc      */ NULL,
20926238Swpaul     /* desc, NAME, name */ NOFORK_DESC, NOFORK_NAME, NOFORK_name,
21026238Swpaul     /* disablement strs */ NULL, NULL },
21126238Swpaul
21226238Swpaul  {  /* entry idx, value */ 1, VALUE_OPT_SYSLOG,
21326238Swpaul     /* equiv idx, value */ 1, VALUE_OPT_SYSLOG,
21426238Swpaul     /* equivalenced to  */ NO_EQUIVALENT,
21526238Swpaul     /* min, max, act ct */ 0, 1, 0,
21626238Swpaul     /* opt state flags  */ SYSLOG_FLAGS, 0,
21726238Swpaul     /* last opt argumnt */ { NULL }, /* --syslog */
21826238Swpaul     /* arg list/cookie  */ NULL,
21926238Swpaul     /* must/cannot opts */ NULL, NULL,
22026238Swpaul     /* option proc      */ NULL,
22126238Swpaul     /* desc, NAME, name */ SYSLOG_DESC, SYSLOG_NAME, SYSLOG_name,
22226238Swpaul     /* disablement strs */ NULL, NULL },
22326238Swpaul
22426238Swpaul  {  /* entry idx, value */ 2, VALUE_OPT_AGENTXSOCKET,
22526238Swpaul     /* equiv idx, value */ 2, VALUE_OPT_AGENTXSOCKET,
22626238Swpaul     /* equivalenced to  */ NO_EQUIVALENT,
22726238Swpaul     /* min, max, act ct */ 0, 1, 0,
22895633Smarkm     /* opt state flags  */ AGENTXSOCKET_FLAGS, 0,
22926238Swpaul     /* last opt argumnt */ { AGENTXSOCKET_DFT_ARG },
23026238Swpaul     /* arg list/cookie  */ NULL,
23126238Swpaul     /* must/cannot opts */ NULL, NULL,
23226238Swpaul     /* option proc      */ NULL,
23326238Swpaul     /* desc, NAME, name */ AGENTXSOCKET_DESC, AGENTXSOCKET_NAME, AGENTXSOCKET_name,
23426238Swpaul     /* disablement strs */ NULL, NULL },
23526238Swpaul
236141482Sstefanf  {  /* entry idx, value */ INDEX_OPT_VERSION, VALUE_OPT_VERSION,
237189169Sed     /* equiv idx value  */ NO_EQUIVALENT, VALUE_OPT_VERSION,
238189169Sed     /* equivalenced to  */ NO_EQUIVALENT,
23926238Swpaul     /* min, max, act ct */ 0, 1, 0,
24026238Swpaul     /* opt state flags  */ VER_FLAGS, AOUSE_VERSION,
24126238Swpaul     /* last opt argumnt */ { NULL },
24226238Swpaul     /* arg list/cookie  */ NULL,
24326238Swpaul     /* must/cannot opts */ NULL, NULL,
24426238Swpaul     /* option proc      */ VER_PROC,
24526238Swpaul     /* desc, NAME, name */ VER_DESC, NULL, VER_name,
24626238Swpaul     /* disablement strs */ NULL, NULL },
24726238Swpaul
24826238Swpaul
24926238Swpaul
25026238Swpaul  {  /* entry idx, value */ INDEX_OPT_HELP, VALUE_OPT_HELP,
25126238Swpaul     /* equiv idx value  */ NO_EQUIVALENT, VALUE_OPT_HELP,
25226238Swpaul     /* equivalenced to  */ NO_EQUIVALENT,
25326238Swpaul     /* min, max, act ct */ 0, 1, 0,
25426238Swpaul     /* opt state flags  */ OPTST_IMM | OPTST_NO_INIT, AOUSE_HELP,
25526238Swpaul     /* last opt argumnt */ { NULL },
25626238Swpaul     /* arg list/cookie  */ NULL,
25726238Swpaul     /* must/cannot opts */ NULL, NULL,
25826238Swpaul     /* option proc      */ doUsageOpt,
25926238Swpaul     /* desc, NAME, name */ HELP_DESC, NULL, HELP_name,
26026238Swpaul     /* disablement strs */ NULL, NULL },
26126238Swpaul
26226238Swpaul  {  /* entry idx, value */ INDEX_OPT_MORE_HELP, VALUE_OPT_MORE_HELP,
26326238Swpaul     /* equiv idx value  */ NO_EQUIVALENT, VALUE_OPT_MORE_HELP,
26426238Swpaul     /* equivalenced to  */ NO_EQUIVALENT,
26526238Swpaul     /* min, max, act ct */ 0, 1, 0,
26626238Swpaul     /* opt state flags  */ MORE_HELP_FLAGS, AOUSE_MORE_HELP,
26726238Swpaul     /* last opt argumnt */ { NULL },
26826238Swpaul     /* arg list/cookie  */ NULL,
269344193Savos     /* must/cannot opts */ NULL,  NULL,
270344193Savos     /* option proc      */ optionPagedUsage,
27126238Swpaul     /* desc, NAME, name */ MORE_HELP_DESC, NULL, MORE_HELP_name,
27226238Swpaul     /* disablement strs */ NULL, NULL },
27326238Swpaul
274344193Savos  {  /* entry idx, value */ INDEX_OPT_SAVE_OPTS, VALUE_OPT_SAVE_OPTS,
275344193Savos     /* equiv idx value  */ NO_EQUIVALENT, VALUE_OPT_SAVE_OPTS,
276344193Savos     /* equivalenced to  */ NO_EQUIVALENT,
27726238Swpaul     /* min, max, act ct */ 0, 1, 0,
27826238Swpaul     /* opt state flags  */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)
27926238Swpaul                       | OPTST_ARG_OPTIONAL | OPTST_NO_INIT, AOUSE_SAVE_OPTS,
28026238Swpaul     /* last opt argumnt */ { NULL },
28126238Swpaul     /* arg list/cookie  */ NULL,
28226238Swpaul     /* must/cannot opts */ NULL,  NULL,
28326238Swpaul     /* option proc      */ NULL,
28426238Swpaul     /* desc, NAME, name */ SAVE_OPTS_DESC, NULL, SAVE_OPTS_name,
28526238Swpaul     /* disablement strs */ NULL, NULL },
28626238Swpaul
28726238Swpaul  {  /* entry idx, value */ INDEX_OPT_LOAD_OPTS, VALUE_OPT_LOAD_OPTS,
28826238Swpaul     /* equiv idx value  */ NO_EQUIVALENT, VALUE_OPT_LOAD_OPTS,
28926238Swpaul     /* equivalenced to  */ NO_EQUIVALENT,
29026238Swpaul     /* min, max, act ct */ 0, NOLIMIT, 0,
29126238Swpaul     /* opt state flags  */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)
29226238Swpaul			  | OPTST_DISABLE_IMM, AOUSE_LOAD_OPTS,
29326238Swpaul     /* last opt argumnt */ { NULL },
29426238Swpaul     /* arg list/cookie  */ NULL,
29526238Swpaul     /* must/cannot opts */ NULL, NULL,
29626238Swpaul     /* option proc      */ optionLoadOpt,
29726238Swpaul     /* desc, NAME, name */ LOAD_OPTS_DESC, LOAD_OPTS_NAME, LOAD_OPTS_name,
29826238Swpaul     /* disablement strs */ NO_LOAD_OPTS_name, LOAD_OPTS_pfx }
29926238Swpaul};
30026238Swpaul
30126238Swpaul
30226238Swpaul/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
30326238Swpaul/** Reference to the upper cased version of ntpsnmpd. */
30426238Swpaul#define zPROGNAME       (ntpsnmpd_opt_strs+1430)
30526238Swpaul/** Reference to the title line for ntpsnmpd usage. */
30626238Swpaul#define zUsageTitle     (ntpsnmpd_opt_strs+1439)
30726238Swpaul/** ntpsnmpd configuration file name. */
30826238Swpaul#define zRcName         (ntpsnmpd_opt_strs+1550)
30926238Swpaul/** Directories to search for ntpsnmpd config files. */
31026238Swpaulstatic char const * const apzHomeList[3] = {
31126238Swpaul    ntpsnmpd_opt_strs+1542,
31226238Swpaul    ntpsnmpd_opt_strs+1548,
31326238Swpaul    NULL };
31426238Swpaul/** The ntpsnmpd program bug email address. */
31526238Swpaul#define zBugsAddr       (ntpsnmpd_opt_strs+1557)
316344193Savos/** Clarification/explanation of what ntpsnmpd does. */
317344193Savos#define zExplain        (ntpsnmpd_opt_strs+1591)
31826238Swpaul/** Extra detail explaining what ntpsnmpd does. */
31926238Swpaul#define zDetail         (NULL)
32026238Swpaul/** The full version string for ntpsnmpd. */
321344193Savos#define zFullVersion    (ntpsnmpd_opt_strs+1593)
322344193Savos/* extracted from optcode.tlib near line 364 */
32326238Swpaul
32426238Swpaul#if defined(ENABLE_NLS)
325344193Savos# define OPTPROC_BASE OPTPROC_TRANSLATE
326344193Savos  static tOptionXlateProc translate_option_strings;
327344193Savos#else
32826238Swpaul# define OPTPROC_BASE OPTPROC_NONE
32926238Swpaul# define translate_option_strings NULL
33026238Swpaul#endif /* ENABLE_NLS */
331141482Sstefanf
33295633Smarkm#define ntpsnmpd_full_usage (NULL)
33326238Swpaul#define ntpsnmpd_short_usage (NULL)
33426238Swpaul
33526238Swpaul#endif /* not defined __doxygen__ */
33626238Swpaul
33726238Swpaul/*
33826238Swpaul *  Create the static procedure(s) declared above.
33926238Swpaul */
34026238Swpaul/**
341 * The callout function that invokes the optionUsage function.
342 *
343 * @param[in] opts the AutoOpts option description structure
344 * @param[in] od   the descriptor for the "help" (usage) option.
345 * @noreturn
346 */
347static void
348doUsageOpt(tOptions * opts, tOptDesc * od)
349{
350    int ex_code;
351    ex_code = NTPSNMPD_EXIT_SUCCESS;
352    optionUsage(&ntpsnmpdOptions, ex_code);
353    /* NOTREACHED */
354    exit(1);
355    (void)opts;
356    (void)od;
357}
358/* extracted from optmain.tlib near line 1250 */
359
360/**
361 * The directory containing the data associated with ntpsnmpd.
362 */
363#ifndef  PKGDATADIR
364# define PKGDATADIR ""
365#endif
366
367/**
368 * Information about the person or institution that packaged ntpsnmpd
369 * for the current distribution.
370 */
371#ifndef  WITH_PACKAGER
372# define ntpsnmpd_packager_info NULL
373#else
374/** Packager information for ntpsnmpd. */
375static char const ntpsnmpd_packager_info[] =
376    "Packaged by " WITH_PACKAGER
377
378# ifdef WITH_PACKAGER_VERSION
379        " ("WITH_PACKAGER_VERSION")"
380# endif
381
382# ifdef WITH_PACKAGER_BUG_REPORTS
383    "\nReport ntpsnmpd bugs to " WITH_PACKAGER_BUG_REPORTS
384# endif
385    "\n";
386#endif
387#ifndef __doxygen__
388
389#endif /* __doxygen__ */
390/**
391 * The option definitions for ntpsnmpd.  The one structure that
392 * binds them all.
393 */
394tOptions ntpsnmpdOptions = {
395    OPTIONS_STRUCT_VERSION,
396    0, NULL,                    /* original argc + argv    */
397    ( OPTPROC_BASE
398    + 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.8p3\n\
558Copyright (C) 1992-2015 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.8p3\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.8p3"));
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