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