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