]> CyberLeo.Net >> Repos - FreeBSD/releng/10.3.git/blob - contrib/ntp/ntpsnmpd/ntpsnmpd-opts.c
Fix multiple vulnerabilities in ntp. [SA-18:02.ntp]
[FreeBSD/releng/10.3.git] / contrib / ntp / ntpsnmpd / ntpsnmpd-opts.c
1 /*
2  *  EDIT THIS FILE WITH CAUTION  (ntpsnmpd-opts.c)
3  *
4  *  It has been AutoGen-ed  February 27, 2018 at 05:15:31 PM by AutoGen 5.18.5
5  *  From the definitions    ntpsnmpd-opts.def
6  *  and the template file   options
7  *
8  * Generated from AutoOpts 41:0:16 templates.
9  *
10  *  AutoOpts is a copyrighted work.  This source file is not encumbered
11  *  by AutoOpts licensing, but is provided under the licensing terms chosen
12  *  by the ntpsnmpd author or copyright holder.  AutoOpts is
13  *  licensed under the terms of the LGPL.  The redistributable library
14  *  (``libopts'') is licensed under the terms of either the LGPL or, at the
15  *  users discretion, the BSD license.  See the AutoOpts and/or libopts sources
16  *  for details.
17  *
18  * The ntpsnmpd program is copyrighted and licensed
19  * under the following terms:
20  *
21  *  Copyright (C) 1992-2017 The University of Delaware and Network Time Foundation, all rights reserved.
22  *  This is free software. It is licensed for use, modification and
23  *  redistribution under the terms of the NTP License, copies of which
24  *  can be seen at:
25  *    <http://ntp.org/license>
26  *    <http://opensource.org/licenses/ntp-license.php>
27  *
28  *  Permission to use, copy, modify, and distribute this software and its
29  *  documentation for any purpose with or without fee is hereby granted,
30  *  provided that the above copyright notice appears in all copies and that
31  *  both the copyright notice and this permission notice appear in
32  *  supporting documentation, and that the name The University of Delaware not be used in
33  *  advertising or publicity pertaining to distribution of the software
34  *  without specific, written prior permission. The University of Delaware and Network Time Foundation makes no
35  *  representations about the suitability this software for any purpose. It
36  *  is provided "as is" without express or implied warranty.
37  */
38
39 #ifndef __doxygen__
40 #define OPTION_CODE_COMPILE 1
41 #include "ntpsnmpd-opts.h"
42 #include <sys/types.h>
43
44 #include <limits.h>
45 #include <stdio.h>
46 #include <stdlib.h>
47
48 #ifdef  __cplusplus
49 extern "C" {
50 #endif
51 extern FILE * option_usage_fp;
52 #define zCopyright      (ntpsnmpd_opt_strs+0)
53 #define zLicenseDescrip (ntpsnmpd_opt_strs+345)
54
55
56 #ifndef NULL
57 #  define NULL 0
58 #endif
59
60 /**
61  *  static const strings for ntpsnmpd options
62  */
63 static char const ntpsnmpd_opt_strs[1613] =
64 /*     0 */ "ntpsnmpd 4.2.8p11\n"
65             "Copyright (C) 1992-2017 The University of Delaware and Network Time Foundation, all rights reserved.\n"
66             "This is free software. It is licensed for use, modification and\n"
67             "redistribution under the terms of the NTP License, copies of which\n"
68             "can be seen at:\n"
69             "  <http://ntp.org/license>\n"
70             "  <http://opensource.org/licenses/ntp-license.php>\n\0"
71 /*   345 */ "Permission to use, copy, modify, and distribute this software and its\n"
72             "documentation for any purpose with or without fee is hereby granted,\n"
73             "provided that the above copyright notice appears in all copies and that\n"
74             "both the copyright notice and this permission notice appear in supporting\n"
75             "documentation, and that the name The University of Delaware not be used in\n"
76             "advertising or publicity pertaining to distribution of the software without\n"
77             "specific, written prior permission.  The University of Delaware and Network\n"
78             "Time Foundation makes no representations about the suitability this\n"
79             "software for any purpose.  It is provided \"as is\" without express or\n"
80             "implied warranty.\n\0"
81 /*  1013 */ "Do not fork\0"
82 /*  1025 */ "NOFORK\0"
83 /*  1032 */ "nofork\0"
84 /*  1039 */ "Log to syslog()\0"
85 /*  1055 */ "SYSLOG\0"
86 /*  1062 */ "syslog\0"
87 /*  1069 */ "The socket address ntpsnmpd uses to connect to net-snmpd\0"
88 /*  1126 */ "AGENTXSOCKET\0"
89 /*  1139 */ "agentxsocket\0"
90 /*  1152 */ "unix:/var/agentx/master\0"
91 /*  1176 */ "display extended usage information and exit\0"
92 /*  1220 */ "help\0"
93 /*  1225 */ "extended usage information passed thru pager\0"
94 /*  1270 */ "more-help\0"
95 /*  1280 */ "output version information and exit\0"
96 /*  1316 */ "version\0"
97 /*  1324 */ "save the option state to a config file\0"
98 /*  1363 */ "save-opts\0"
99 /*  1373 */ "load options from a config file\0"
100 /*  1405 */ "LOAD_OPTS\0"
101 /*  1415 */ "no-load-opts\0"
102 /*  1428 */ "no\0"
103 /*  1431 */ "NTPSNMPD\0"
104 /*  1440 */ "ntpsnmpd - NTP SNMP MIB agent - Ver. 4.2.8p11\n"
105             "Usage:  %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n\0"
106 /*  1544 */ "$HOME\0"
107 /*  1550 */ ".\0"
108 /*  1552 */ ".ntprc\0"
109 /*  1559 */ "http://bugs.ntp.org, bugs@ntp.org\0"
110 /*  1593 */ "\n\0"
111 /*  1595 */ "ntpsnmpd 4.2.8p11";
112
113 /**
114  *  nofork option description:
115  */
116 /** Descriptive text for the nofork option */
117 #define NOFORK_DESC      (ntpsnmpd_opt_strs+1013)
118 /** Upper-cased name for the nofork option */
119 #define NOFORK_NAME      (ntpsnmpd_opt_strs+1025)
120 /** Name string for the nofork option */
121 #define NOFORK_name      (ntpsnmpd_opt_strs+1032)
122 /** Compiled in flag settings for the nofork option */
123 #define NOFORK_FLAGS     (OPTST_DISABLED)
124
125 /**
126  *  syslog option description:
127  */
128 /** Descriptive text for the syslog option */
129 #define SYSLOG_DESC      (ntpsnmpd_opt_strs+1039)
130 /** Upper-cased name for the syslog option */
131 #define SYSLOG_NAME      (ntpsnmpd_opt_strs+1055)
132 /** Name string for the syslog option */
133 #define SYSLOG_name      (ntpsnmpd_opt_strs+1062)
134 /** Compiled in flag settings for the syslog option */
135 #define SYSLOG_FLAGS     (OPTST_DISABLED)
136
137 /**
138  *  agentXSocket option description:
139  */
140 /** Descriptive text for the agentXSocket option */
141 #define AGENTXSOCKET_DESC      (ntpsnmpd_opt_strs+1069)
142 /** Upper-cased name for the agentXSocket option */
143 #define AGENTXSOCKET_NAME      (ntpsnmpd_opt_strs+1126)
144 /** Name string for the agentXSocket option */
145 #define AGENTXSOCKET_name      (ntpsnmpd_opt_strs+1139)
146 /** The compiled in default value for the agentXSocket option argument */
147 #define AGENTXSOCKET_DFT_ARG   (ntpsnmpd_opt_strs+1152)
148 /** Compiled in flag settings for the agentXSocket option */
149 #define AGENTXSOCKET_FLAGS     (OPTST_DISABLED \
150         | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
151
152 /*
153  *  Help/More_Help/Version option descriptions:
154  */
155 #define HELP_DESC       (ntpsnmpd_opt_strs+1176)
156 #define HELP_name       (ntpsnmpd_opt_strs+1220)
157 #ifdef HAVE_WORKING_FORK
158 #define MORE_HELP_DESC  (ntpsnmpd_opt_strs+1225)
159 #define MORE_HELP_name  (ntpsnmpd_opt_strs+1270)
160 #define MORE_HELP_FLAGS (OPTST_IMM | OPTST_NO_INIT)
161 #else
162 #define MORE_HELP_DESC  HELP_DESC
163 #define MORE_HELP_name  HELP_name
164 #define MORE_HELP_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
165 #endif
166 #ifdef NO_OPTIONAL_OPT_ARGS
167 #  define VER_FLAGS     (OPTST_IMM | OPTST_NO_INIT)
168 #else
169 #  define VER_FLAGS     (OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \
170                          OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT)
171 #endif
172 #define VER_DESC        (ntpsnmpd_opt_strs+1280)
173 #define VER_name        (ntpsnmpd_opt_strs+1316)
174 #define SAVE_OPTS_DESC  (ntpsnmpd_opt_strs+1324)
175 #define SAVE_OPTS_name  (ntpsnmpd_opt_strs+1363)
176 #define LOAD_OPTS_DESC     (ntpsnmpd_opt_strs+1373)
177 #define LOAD_OPTS_NAME     (ntpsnmpd_opt_strs+1405)
178 #define NO_LOAD_OPTS_name  (ntpsnmpd_opt_strs+1415)
179 #define LOAD_OPTS_pfx      (ntpsnmpd_opt_strs+1428)
180 #define LOAD_OPTS_name     (NO_LOAD_OPTS_name + 3)
181 /**
182  *  Declare option callback procedures
183  */
184 extern tOptProc
185     ntpOptionPrintVersion, optionBooleanVal,      optionNestedVal,
186     optionNumericVal,      optionPagedUsage,      optionResetOpt,
187     optionStackArg,        optionTimeDate,        optionTimeVal,
188     optionUnstackArg,      optionVendorOption;
189 static tOptProc
190     doUsageOpt;
191 #define VER_PROC        ntpOptionPrintVersion
192
193 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
194 /**
195  *  Define the ntpsnmpd Option Descriptions.
196  * This is an array of OPTION_CT entries, one for each
197  * option that the ntpsnmpd program responds to.
198  */
199 static tOptDesc optDesc[OPTION_CT] = {
200   {  /* entry idx, value */ 0, VALUE_OPT_NOFORK,
201      /* equiv idx, value */ 0, VALUE_OPT_NOFORK,
202      /* equivalenced to  */ NO_EQUIVALENT,
203      /* min, max, act ct */ 0, 1, 0,
204      /* opt state flags  */ NOFORK_FLAGS, 0,
205      /* last opt argumnt */ { NULL }, /* --nofork */
206      /* arg list/cookie  */ NULL,
207      /* must/cannot opts */ NULL, NULL,
208      /* option proc      */ NULL,
209      /* desc, NAME, name */ NOFORK_DESC, NOFORK_NAME, NOFORK_name,
210      /* disablement strs */ NULL, NULL },
211
212   {  /* entry idx, value */ 1, VALUE_OPT_SYSLOG,
213      /* equiv idx, value */ 1, VALUE_OPT_SYSLOG,
214      /* equivalenced to  */ NO_EQUIVALENT,
215      /* min, max, act ct */ 0, 1, 0,
216      /* opt state flags  */ SYSLOG_FLAGS, 0,
217      /* last opt argumnt */ { NULL }, /* --syslog */
218      /* arg list/cookie  */ NULL,
219      /* must/cannot opts */ NULL, NULL,
220      /* option proc      */ NULL,
221      /* desc, NAME, name */ SYSLOG_DESC, SYSLOG_NAME, SYSLOG_name,
222      /* disablement strs */ NULL, NULL },
223
224   {  /* entry idx, value */ 2, VALUE_OPT_AGENTXSOCKET,
225      /* equiv idx, value */ 2, VALUE_OPT_AGENTXSOCKET,
226      /* equivalenced to  */ NO_EQUIVALENT,
227      /* min, max, act ct */ 0, 1, 0,
228      /* opt state flags  */ AGENTXSOCKET_FLAGS, 0,
229      /* last opt argumnt */ { AGENTXSOCKET_DFT_ARG },
230      /* arg list/cookie  */ NULL,
231      /* must/cannot opts */ NULL, NULL,
232      /* option proc      */ NULL,
233      /* desc, NAME, name */ AGENTXSOCKET_DESC, AGENTXSOCKET_NAME, AGENTXSOCKET_name,
234      /* disablement strs */ NULL, NULL },
235
236   {  /* entry idx, value */ INDEX_OPT_VERSION, VALUE_OPT_VERSION,
237      /* equiv idx value  */ NO_EQUIVALENT, VALUE_OPT_VERSION,
238      /* equivalenced to  */ NO_EQUIVALENT,
239      /* min, max, act ct */ 0, 1, 0,
240      /* opt state flags  */ VER_FLAGS, AOUSE_VERSION,
241      /* last opt argumnt */ { NULL },
242      /* arg list/cookie  */ NULL,
243      /* must/cannot opts */ NULL, NULL,
244      /* option proc      */ VER_PROC,
245      /* desc, NAME, name */ VER_DESC, NULL, VER_name,
246      /* disablement strs */ NULL, NULL },
247
248
249
250   {  /* entry idx, value */ INDEX_OPT_HELP, VALUE_OPT_HELP,
251      /* equiv idx value  */ NO_EQUIVALENT, VALUE_OPT_HELP,
252      /* equivalenced to  */ NO_EQUIVALENT,
253      /* min, max, act ct */ 0, 1, 0,
254      /* opt state flags  */ OPTST_IMM | OPTST_NO_INIT, AOUSE_HELP,
255      /* last opt argumnt */ { NULL },
256      /* arg list/cookie  */ NULL,
257      /* must/cannot opts */ NULL, NULL,
258      /* option proc      */ doUsageOpt,
259      /* desc, NAME, name */ HELP_DESC, NULL, HELP_name,
260      /* disablement strs */ NULL, NULL },
261
262   {  /* entry idx, value */ INDEX_OPT_MORE_HELP, VALUE_OPT_MORE_HELP,
263      /* equiv idx value  */ NO_EQUIVALENT, VALUE_OPT_MORE_HELP,
264      /* equivalenced to  */ NO_EQUIVALENT,
265      /* min, max, act ct */ 0, 1, 0,
266      /* opt state flags  */ MORE_HELP_FLAGS, AOUSE_MORE_HELP,
267      /* last opt argumnt */ { NULL },
268      /* arg list/cookie  */ NULL,
269      /* must/cannot opts */ NULL,  NULL,
270      /* option proc      */ optionPagedUsage,
271      /* desc, NAME, name */ MORE_HELP_DESC, NULL, MORE_HELP_name,
272      /* disablement strs */ NULL, NULL },
273
274   {  /* entry idx, value */ INDEX_OPT_SAVE_OPTS, VALUE_OPT_SAVE_OPTS,
275      /* equiv idx value  */ NO_EQUIVALENT, VALUE_OPT_SAVE_OPTS,
276      /* equivalenced to  */ NO_EQUIVALENT,
277      /* min, max, act ct */ 0, 1, 0,
278      /* opt state flags  */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)
279                        | OPTST_ARG_OPTIONAL | OPTST_NO_INIT, AOUSE_SAVE_OPTS,
280      /* last opt argumnt */ { NULL },
281      /* arg list/cookie  */ NULL,
282      /* must/cannot opts */ NULL,  NULL,
283      /* option proc      */ NULL,
284      /* desc, NAME, name */ SAVE_OPTS_DESC, NULL, SAVE_OPTS_name,
285      /* disablement strs */ NULL, NULL },
286
287   {  /* entry idx, value */ INDEX_OPT_LOAD_OPTS, VALUE_OPT_LOAD_OPTS,
288      /* equiv idx value  */ NO_EQUIVALENT, VALUE_OPT_LOAD_OPTS,
289      /* equivalenced to  */ NO_EQUIVALENT,
290      /* min, max, act ct */ 0, NOLIMIT, 0,
291      /* opt state flags  */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)
292                           | OPTST_DISABLE_IMM, AOUSE_LOAD_OPTS,
293      /* last opt argumnt */ { NULL },
294      /* arg list/cookie  */ NULL,
295      /* must/cannot opts */ NULL, NULL,
296      /* option proc      */ optionLoadOpt,
297      /* desc, NAME, name */ LOAD_OPTS_DESC, LOAD_OPTS_NAME, LOAD_OPTS_name,
298      /* disablement strs */ NO_LOAD_OPTS_name, LOAD_OPTS_pfx }
299 };
300
301
302 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
303 /** Reference to the upper cased version of ntpsnmpd. */
304 #define zPROGNAME       (ntpsnmpd_opt_strs+1431)
305 /** Reference to the title line for ntpsnmpd usage. */
306 #define zUsageTitle     (ntpsnmpd_opt_strs+1440)
307 /** ntpsnmpd configuration file name. */
308 #define zRcName         (ntpsnmpd_opt_strs+1552)
309 /** Directories to search for ntpsnmpd config files. */
310 static char const * const apzHomeList[3] = {
311     ntpsnmpd_opt_strs+1544,
312     ntpsnmpd_opt_strs+1550,
313     NULL };
314 /** The ntpsnmpd program bug email address. */
315 #define zBugsAddr       (ntpsnmpd_opt_strs+1559)
316 /** Clarification/explanation of what ntpsnmpd does. */
317 #define zExplain        (ntpsnmpd_opt_strs+1593)
318 /** Extra detail explaining what ntpsnmpd does. */
319 #define zDetail         (NULL)
320 /** The full version string for ntpsnmpd. */
321 #define zFullVersion    (ntpsnmpd_opt_strs+1595)
322 /* extracted from optcode.tlib near line 364 */
323
324 #if defined(ENABLE_NLS)
325 # define OPTPROC_BASE OPTPROC_TRANSLATE
326   static tOptionXlateProc translate_option_strings;
327 #else
328 # define OPTPROC_BASE OPTPROC_NONE
329 # define translate_option_strings NULL
330 #endif /* ENABLE_NLS */
331
332 #define ntpsnmpd_full_usage (NULL)
333 #define ntpsnmpd_short_usage (NULL)
334
335 #endif /* not defined __doxygen__ */
336
337 /*
338  *  Create the static procedure(s) declared above.
339  */
340 /**
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  */
347 static void
348 doUsageOpt(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. */
375 static 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  */
394 tOptions 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
443 static char * AO_gettext(char const * pz);
444 static 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  */
456 static char *
457 AO_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  */
491 static 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  */
498 static void
499 translate_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. */
539 static 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\
558 Copyright (C) 1992-2017 The University of Delaware and Network Time Foundation, all rights reserved.\n\
559 This is free software. It is licensed for use, modification and\n\
560 redistribution under the terms of the NTP License, copies of which\n\
561 can 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\
567 documentation for any purpose with or without fee is hereby granted,\n\
568 provided that the above copyright notice appears in all copies and that\n\
569 both the copyright notice and this permission notice appear in supporting\n\
570 documentation, and that the name The University of Delaware not be used in\n\
571 advertising or publicity pertaining to distribution of the software without\n\
572 specific, written prior permission.  The University of Delaware and Network\n\
573 Time Foundation makes no representations about the suitability this\n\
574 software for any purpose.  It is provided \"as is\" without express or\n\
575 implied 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\
603 Usage:  %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 */