Expand PMF_FN_* macros.
[netbsd-mini2440.git] / dist / ntp / ntpdc / ntpdc-opts.c
blob4c6a76317995c3c144117bfd7cf173fff02f97e2
1 /* $NetBSD$ */
3 /*
4 * EDIT THIS FILE WITH CAUTION (ntpdc-opts.c)
5 *
6 * It has been AutoGen-ed Tuesday December 8, 2009 at 08:14:00 AM EST
7 * From the definitions ntpdc-opts.def
8 * and the template file options
10 * Generated from AutoOpts 29:0:4 templates.
14 * This file was produced by an AutoOpts template. AutoOpts is a
15 * copyrighted work. This source file is not encumbered by AutoOpts
16 * licensing, but is provided under the licensing terms chosen by the
17 * ntpdc author or copyright holder. AutoOpts is licensed under
18 * the terms of the LGPL. The redistributable library (``libopts'') is
19 * licensed under the terms of either the LGPL or, at the users discretion,
20 * the BSD license. See the AutoOpts and/or libopts sources for details.
22 * This source file is copyrighted and licensed under the following terms:
24 * ntpdc copyright 1970-2009 David L. Mills and/or others - all rights reserved
26 * see html/copyright.html
30 #include <limits.h>
32 #define OPTION_CODE_COMPILE 1
33 #include "ntpdc-opts.h"
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 tSCC zCopyright[] =
39 "ntpdc copyright (c) 1970-2009 David L. Mills and/or others, all rights reserved";
40 tSCC zCopyrightNotice[] =
42 /* extracted from ../include/copyright.def near line 8 */
43 "see html/copyright.html";
44 extern tUsageProc optionUsage;
47 * global included definitions
49 #ifdef __windows
50 extern int atoi(const char*);
51 #else
52 # include <stdlib.h>
53 #endif
55 #ifndef NULL
56 # define NULL 0
57 #endif
58 #ifndef EXIT_SUCCESS
59 # define EXIT_SUCCESS 0
60 #endif
61 #ifndef EXIT_FAILURE
62 # define EXIT_FAILURE 1
63 #endif
65 * Ipv4 option description:
67 tSCC zIpv4Text[] =
68 "Force IPv4 DNS name resolution";
69 tSCC zIpv4_NAME[] = "IPV4";
70 tSCC zIpv4_Name[] = "ipv4";
71 #define IPV4_FLAGS (OPTST_DISABLED)
74 * Ipv6 option description:
76 tSCC zIpv6Text[] =
77 "Force IPv6 DNS name resolution";
78 tSCC zIpv6_NAME[] = "IPV6";
79 tSCC zIpv6_Name[] = "ipv6";
80 #define IPV6_FLAGS (OPTST_DISABLED)
83 * Command option description:
85 tSCC zCommandText[] =
86 "run a command and exit";
87 tSCC zCommand_NAME[] = "COMMAND";
88 tSCC zCommand_Name[] = "command";
89 #define COMMAND_FLAGS (OPTST_DISABLED | OPTST_STACKED \
90 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
93 * Listpeers option description with
94 * "Must also have options" and "Incompatible options":
96 tSCC zListpeersText[] =
97 "Print a list of the peers";
98 tSCC zListpeers_NAME[] = "LISTPEERS";
99 tSCC zListpeers_Name[] = "listpeers";
100 static const int
101 aListpeersCantList[] = {
102 INDEX_OPT_COMMAND, NO_EQUIVALENT };
103 #define LISTPEERS_FLAGS (OPTST_DISABLED)
106 * Peers option description with
107 * "Must also have options" and "Incompatible options":
109 tSCC zPeersText[] =
110 "Print a list of the peers";
111 tSCC zPeers_NAME[] = "PEERS";
112 tSCC zPeers_Name[] = "peers";
113 static const int
114 aPeersCantList[] = {
115 INDEX_OPT_COMMAND, NO_EQUIVALENT };
116 #define PEERS_FLAGS (OPTST_DISABLED)
119 * Showpeers option description with
120 * "Must also have options" and "Incompatible options":
122 tSCC zShowpeersText[] =
123 "Show a list of the peers";
124 tSCC zShowpeers_NAME[] = "SHOWPEERS";
125 tSCC zShowpeers_Name[] = "showpeers";
126 static const int
127 aShowpeersCantList[] = {
128 INDEX_OPT_COMMAND, NO_EQUIVALENT };
129 #define SHOWPEERS_FLAGS (OPTST_DISABLED)
132 * Interactive option description with
133 * "Must also have options" and "Incompatible options":
135 tSCC zInteractiveText[] =
136 "Force ntpq to operate in interactive mode";
137 tSCC zInteractive_NAME[] = "INTERACTIVE";
138 tSCC zInteractive_Name[] = "interactive";
139 static const int
140 aInteractiveCantList[] = {
141 INDEX_OPT_COMMAND,
142 INDEX_OPT_LISTPEERS,
143 INDEX_OPT_PEERS,
144 INDEX_OPT_SHOWPEERS, NO_EQUIVALENT };
145 #define INTERACTIVE_FLAGS (OPTST_DISABLED)
148 * Debug_Level option description:
150 #ifdef DEBUG
151 tSCC zDebug_LevelText[] =
152 "Increase output debug message level";
153 tSCC zDebug_Level_NAME[] = "DEBUG_LEVEL";
154 tSCC zDebug_Level_Name[] = "debug-level";
155 #define DEBUG_LEVEL_FLAGS (OPTST_DISABLED)
157 #else /* disable Debug_Level */
158 #define VALUE_OPT_DEBUG_LEVEL NO_EQUIVALENT
159 #define DEBUG_LEVEL_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
160 #define zDebug_LevelText NULL
161 #define zDebug_Level_NAME NULL
162 #define zDebug_Level_Name NULL
163 #endif /* DEBUG */
166 * Set_Debug_Level option description:
168 #ifdef DEBUG
169 tSCC zSet_Debug_LevelText[] =
170 "Set the output debug message level";
171 tSCC zSet_Debug_Level_NAME[] = "SET_DEBUG_LEVEL";
172 tSCC zSet_Debug_Level_Name[] = "set-debug-level";
173 #define SET_DEBUG_LEVEL_FLAGS (OPTST_DISABLED \
174 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
176 #else /* disable Set_Debug_Level */
177 #define VALUE_OPT_SET_DEBUG_LEVEL NO_EQUIVALENT
178 #define SET_DEBUG_LEVEL_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
179 #define zSet_Debug_LevelText NULL
180 #define zSet_Debug_Level_NAME NULL
181 #define zSet_Debug_Level_Name NULL
182 #endif /* DEBUG */
185 * Numeric option description:
187 tSCC zNumericText[] =
188 "numeric host addresses";
189 tSCC zNumeric_NAME[] = "NUMERIC";
190 tSCC zNumeric_Name[] = "numeric";
191 #define NUMERIC_FLAGS (OPTST_DISABLED)
194 * Help/More_Help/Version option descriptions:
196 tSCC zHelpText[] = "Display usage information and exit";
197 tSCC zHelp_Name[] = "help";
199 tSCC zMore_HelpText[] = "Extended usage information passed thru pager";
200 tSCC zMore_Help_Name[] = "more-help";
202 tSCC zVersionText[] = "Output version information and exit";
203 tSCC zVersion_Name[] = "version";
206 * Save/Load_Opts option description:
208 tSCC zSave_OptsText[] = "Save the option state to a config file";
209 tSCC zSave_Opts_Name[] = "save-opts";
211 tSCC zLoad_OptsText[] = "Load options from a config file";
212 tSCC zLoad_Opts_NAME[] = "LOAD_OPTS";
214 tSCC zNotLoad_Opts_Name[] = "no-load-opts";
215 tSCC zNotLoad_Opts_Pfx[] = "no";
216 #define zLoad_Opts_Name (zNotLoad_Opts_Name + 3)
218 * Declare option callback procedures
220 #ifdef DEBUG
221 static tOptProc doOptSet_Debug_Level;
222 #else /* not DEBUG */
223 # define doOptSet_Debug_Level NULL
224 #endif /* def/not DEBUG */
225 #if defined(TEST_NTPDC_OPTS)
227 * Under test, omit argument processing, or call optionStackArg,
228 * if multiple copies are allowed.
230 extern tOptProc
231 optionPagedUsage, optionStackArg, optionVersionStderr;
232 static tOptProc
233 doUsageOpt;
236 * #define map the "normal" callout procs to the test ones...
238 #define SET_DEBUG_LEVEL_OPT_PROC optionStackArg
241 #else /* NOT defined TEST_NTPDC_OPTS */
243 * When not under test, there are different procs to use
245 extern tOptProc
246 optionPagedUsage, optionPrintVersion, optionStackArg;
247 static tOptProc
248 doUsageOpt;
251 * #define map the "normal" callout procs
253 #define SET_DEBUG_LEVEL_OPT_PROC doOptSet_Debug_Level
255 #define SET_DEBUG_LEVEL_OPT_PROC doOptSet_Debug_Level
256 #endif /* defined(TEST_NTPDC_OPTS) */
257 #ifdef TEST_NTPDC_OPTS
258 # define DOVERPROC optionVersionStderr
259 #else
260 # define DOVERPROC optionPrintVersion
261 #endif /* TEST_NTPDC_OPTS */
263 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
265 * Define the Ntpdc Option Descriptions.
267 static tOptDesc optDesc[ OPTION_CT ] = {
268 { /* entry idx, value */ 0, VALUE_OPT_IPV4,
269 /* equiv idx, value */ NO_EQUIVALENT, 0,
270 /* equivalenced to */ NO_EQUIVALENT,
271 /* min, max, act ct */ 0, 1, 0,
272 /* opt state flags */ IPV4_FLAGS, 0,
273 /* last opt argumnt */ { NULL },
274 /* arg list/cookie */ NULL,
275 /* must/cannot opts */ NULL, NULL,
276 /* option proc */ NULL,
277 /* desc, NAME, name */ zIpv4Text, zIpv4_NAME, zIpv4_Name,
278 /* disablement strs */ NULL, NULL },
280 { /* entry idx, value */ 1, VALUE_OPT_IPV6,
281 /* equiv idx, value */ NOLIMIT, NOLIMIT,
282 /* equivalenced to */ INDEX_OPT_IPV4,
283 /* min, max, act ct */ 0, 1, 0,
284 /* opt state flags */ IPV6_FLAGS, 0,
285 /* last opt argumnt */ { NULL },
286 /* arg list/cookie */ NULL,
287 /* must/cannot opts */ NULL, NULL,
288 /* option proc */ NULL,
289 /* desc, NAME, name */ zIpv6Text, zIpv6_NAME, zIpv6_Name,
290 /* disablement strs */ NULL, NULL },
292 { /* entry idx, value */ 2, VALUE_OPT_COMMAND,
293 /* equiv idx, value */ 2, VALUE_OPT_COMMAND,
294 /* equivalenced to */ NO_EQUIVALENT,
295 /* min, max, act ct */ 0, NOLIMIT, 0,
296 /* opt state flags */ COMMAND_FLAGS, 0,
297 /* last opt argumnt */ { NULL },
298 /* arg list/cookie */ NULL,
299 /* must/cannot opts */ NULL, NULL,
300 /* option proc */ optionStackArg,
301 /* desc, NAME, name */ zCommandText, zCommand_NAME, zCommand_Name,
302 /* disablement strs */ NULL, NULL },
304 { /* entry idx, value */ 3, VALUE_OPT_LISTPEERS,
305 /* equiv idx, value */ 3, VALUE_OPT_LISTPEERS,
306 /* equivalenced to */ NO_EQUIVALENT,
307 /* min, max, act ct */ 0, 1, 0,
308 /* opt state flags */ LISTPEERS_FLAGS, 0,
309 /* last opt argumnt */ { NULL },
310 /* arg list/cookie */ NULL,
311 /* must/cannot opts */ NULL, aListpeersCantList,
312 /* option proc */ NULL,
313 /* desc, NAME, name */ zListpeersText, zListpeers_NAME, zListpeers_Name,
314 /* disablement strs */ NULL, NULL },
316 { /* entry idx, value */ 4, VALUE_OPT_PEERS,
317 /* equiv idx, value */ 4, VALUE_OPT_PEERS,
318 /* equivalenced to */ NO_EQUIVALENT,
319 /* min, max, act ct */ 0, 1, 0,
320 /* opt state flags */ PEERS_FLAGS, 0,
321 /* last opt argumnt */ { NULL },
322 /* arg list/cookie */ NULL,
323 /* must/cannot opts */ NULL, aPeersCantList,
324 /* option proc */ NULL,
325 /* desc, NAME, name */ zPeersText, zPeers_NAME, zPeers_Name,
326 /* disablement strs */ NULL, NULL },
328 { /* entry idx, value */ 5, VALUE_OPT_SHOWPEERS,
329 /* equiv idx, value */ 5, VALUE_OPT_SHOWPEERS,
330 /* equivalenced to */ NO_EQUIVALENT,
331 /* min, max, act ct */ 0, 1, 0,
332 /* opt state flags */ SHOWPEERS_FLAGS, 0,
333 /* last opt argumnt */ { NULL },
334 /* arg list/cookie */ NULL,
335 /* must/cannot opts */ NULL, aShowpeersCantList,
336 /* option proc */ NULL,
337 /* desc, NAME, name */ zShowpeersText, zShowpeers_NAME, zShowpeers_Name,
338 /* disablement strs */ NULL, NULL },
340 { /* entry idx, value */ 6, VALUE_OPT_INTERACTIVE,
341 /* equiv idx, value */ 6, VALUE_OPT_INTERACTIVE,
342 /* equivalenced to */ NO_EQUIVALENT,
343 /* min, max, act ct */ 0, 1, 0,
344 /* opt state flags */ INTERACTIVE_FLAGS, 0,
345 /* last opt argumnt */ { NULL },
346 /* arg list/cookie */ NULL,
347 /* must/cannot opts */ NULL, aInteractiveCantList,
348 /* option proc */ NULL,
349 /* desc, NAME, name */ zInteractiveText, zInteractive_NAME, zInteractive_Name,
350 /* disablement strs */ NULL, NULL },
352 { /* entry idx, value */ 7, VALUE_OPT_DEBUG_LEVEL,
353 /* equiv idx, value */ 7, VALUE_OPT_DEBUG_LEVEL,
354 /* equivalenced to */ NO_EQUIVALENT,
355 /* min, max, act ct */ 0, NOLIMIT, 0,
356 /* opt state flags */ DEBUG_LEVEL_FLAGS, 0,
357 /* last opt argumnt */ { NULL },
358 /* arg list/cookie */ NULL,
359 /* must/cannot opts */ NULL, NULL,
360 /* option proc */ NULL,
361 /* desc, NAME, name */ zDebug_LevelText, zDebug_Level_NAME, zDebug_Level_Name,
362 /* disablement strs */ NULL, NULL },
364 { /* entry idx, value */ 8, VALUE_OPT_SET_DEBUG_LEVEL,
365 /* equiv idx, value */ 8, VALUE_OPT_SET_DEBUG_LEVEL,
366 /* equivalenced to */ NO_EQUIVALENT,
367 /* min, max, act ct */ 0, NOLIMIT, 0,
368 /* opt state flags */ SET_DEBUG_LEVEL_FLAGS, 0,
369 /* last opt argumnt */ { NULL },
370 /* arg list/cookie */ NULL,
371 /* must/cannot opts */ NULL, NULL,
372 /* option proc */ SET_DEBUG_LEVEL_OPT_PROC,
373 /* desc, NAME, name */ zSet_Debug_LevelText, zSet_Debug_Level_NAME, zSet_Debug_Level_Name,
374 /* disablement strs */ NULL, NULL },
376 { /* entry idx, value */ 9, VALUE_OPT_NUMERIC,
377 /* equiv idx, value */ 9, VALUE_OPT_NUMERIC,
378 /* equivalenced to */ NO_EQUIVALENT,
379 /* min, max, act ct */ 0, 1, 0,
380 /* opt state flags */ NUMERIC_FLAGS, 0,
381 /* last opt argumnt */ { NULL },
382 /* arg list/cookie */ NULL,
383 /* must/cannot opts */ NULL, NULL,
384 /* option proc */ NULL,
385 /* desc, NAME, name */ zNumericText, zNumeric_NAME, zNumeric_Name,
386 /* disablement strs */ NULL, NULL },
388 #ifdef NO_OPTIONAL_OPT_ARGS
389 # define VERSION_OPT_FLAGS OPTST_IMM | OPTST_NO_INIT
390 #else
391 # define VERSION_OPT_FLAGS OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \
392 OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT
393 #endif
395 { /* entry idx, value */ INDEX_OPT_VERSION, VALUE_OPT_VERSION,
396 /* equiv idx value */ NO_EQUIVALENT, 0,
397 /* equivalenced to */ NO_EQUIVALENT,
398 /* min, max, act ct */ 0, 1, 0,
399 /* opt state flags */ VERSION_OPT_FLAGS, 0,
400 /* last opt argumnt */ { NULL },
401 /* arg list/cookie */ NULL,
402 /* must/cannot opts */ NULL, NULL,
403 /* option proc */ DOVERPROC,
404 /* desc, NAME, name */ zVersionText, NULL, zVersion_Name,
405 /* disablement strs */ NULL, NULL },
407 #undef VERSION_OPT_FLAGS
410 { /* entry idx, value */ INDEX_OPT_HELP, VALUE_OPT_HELP,
411 /* equiv idx value */ NO_EQUIVALENT, 0,
412 /* equivalenced to */ NO_EQUIVALENT,
413 /* min, max, act ct */ 0, 1, 0,
414 /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, 0,
415 /* last opt argumnt */ { NULL },
416 /* arg list/cookie */ NULL,
417 /* must/cannot opts */ NULL, NULL,
418 /* option proc */ doUsageOpt,
419 /* desc, NAME, name */ zHelpText, NULL, zHelp_Name,
420 /* disablement strs */ NULL, NULL },
422 { /* entry idx, value */ INDEX_OPT_MORE_HELP, VALUE_OPT_MORE_HELP,
423 /* equiv idx value */ NO_EQUIVALENT, 0,
424 /* equivalenced to */ NO_EQUIVALENT,
425 /* min, max, act ct */ 0, 1, 0,
426 /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, 0,
427 /* last opt argumnt */ { NULL },
428 /* arg list/cookie */ NULL,
429 /* must/cannot opts */ NULL, NULL,
430 /* option proc */ optionPagedUsage,
431 /* desc, NAME, name */ zMore_HelpText, NULL, zMore_Help_Name,
432 /* disablement strs */ NULL, NULL },
434 { /* entry idx, value */ INDEX_OPT_SAVE_OPTS, VALUE_OPT_SAVE_OPTS,
435 /* equiv idx value */ NO_EQUIVALENT, 0,
436 /* equivalenced to */ NO_EQUIVALENT,
437 /* min, max, act ct */ 0, 1, 0,
438 /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)
439 | OPTST_ARG_OPTIONAL | OPTST_NO_INIT, 0,
440 /* last opt argumnt */ { NULL },
441 /* arg list/cookie */ NULL,
442 /* must/cannot opts */ NULL, NULL,
443 /* option proc */ NULL,
444 /* desc, NAME, name */ zSave_OptsText, NULL, zSave_Opts_Name,
445 /* disablement strs */ NULL, NULL },
447 { /* entry idx, value */ INDEX_OPT_LOAD_OPTS, VALUE_OPT_LOAD_OPTS,
448 /* equiv idx value */ NO_EQUIVALENT, 0,
449 /* equivalenced to */ NO_EQUIVALENT,
450 /* min, max, act ct */ 0, NOLIMIT, 0,
451 /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) \
452 | OPTST_DISABLE_IMM, 0,
453 /* last opt argumnt */ { NULL },
454 /* arg list/cookie */ NULL,
455 /* must/cannot opts */ NULL, NULL,
456 /* option proc */ optionLoadOpt,
457 /* desc, NAME, name */ zLoad_OptsText, zLoad_Opts_NAME, zLoad_Opts_Name,
458 /* disablement strs */ zNotLoad_Opts_Name, zNotLoad_Opts_Pfx }
461 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
463 * Define the Ntpdc Option Environment
465 tSCC zPROGNAME[] = "NTPDC";
466 tSCC zUsageTitle[] =
467 "ntpdc - vendor-specific NTP query program - Ver. 4.2.4p8\n\
468 USAGE: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ host ...]\n";
469 tSCC zRcName[] = ".ntprc";
470 tSCC* apzHomeList[] = {
471 "$HOME",
472 ".",
473 NULL };
475 tSCC zBugsAddr[] = "http://bugs.ntp.org, bugs@ntp.org";
476 #define zExplain NULL
477 tSCC zDetail[] = "\n\
478 The\n\
479 [= prog-name =]\n\
480 utility program is used to query an NTP daemon about its\n\
481 current state and to request changes in that state.\n\
482 It uses NTP mode 7 control message formats described in the source code.\n\
483 The program may\n\
484 be run either in interactive mode or controlled using command line\n\
485 arguments.\n\
486 Extensive state and statistics information is available\n\
487 through the\n\
488 [= prog-name =]\n\
489 interface.\n\
490 In addition, nearly all the\n\
491 configuration options which can be specified at startup using\n\
492 ntpd's configuration file may also be specified at run time using\n\
493 [= prog-name =] .\n";
494 tSCC zFullVersion[] = NTPDC_FULL_VERSION;
495 /* extracted from /usr/local/gnu/autogen-5.9.1/share/autogen/optcode.tpl near line 408 */
497 #if defined(ENABLE_NLS)
498 # define OPTPROC_BASE OPTPROC_TRANSLATE
499 static tOptionXlateProc translate_option_strings;
500 #else
501 # define OPTPROC_BASE OPTPROC_NONE
502 # define translate_option_strings NULL
503 #endif /* ENABLE_NLS */
505 tOptions ntpdcOptions = {
506 OPTIONS_STRUCT_VERSION,
507 0, NULL, /* original argc + argv */
508 ( OPTPROC_BASE
509 + OPTPROC_ERRSTOP
510 + OPTPROC_SHORTOPT
511 + OPTPROC_LONGOPT
512 + OPTPROC_NO_REQ_OPT
513 + OPTPROC_ENVIRON
514 + OPTPROC_HAS_IMMED ),
515 0, NULL, /* current option index, current option */
516 NULL, NULL, zPROGNAME,
517 zRcName, zCopyright, zCopyrightNotice,
518 zFullVersion, apzHomeList, zUsageTitle,
519 zExplain, zDetail, optDesc,
520 zBugsAddr, /* address to send bugs to */
521 NULL, NULL, /* extensions/saved state */
522 optionUsage, /* usage procedure */
523 translate_option_strings, /* translation procedure */
525 * Indexes to special options
527 { INDEX_OPT_MORE_HELP,
528 INDEX_OPT_SAVE_OPTS,
529 NO_EQUIVALENT /* index of '-#' option */,
530 NO_EQUIVALENT /* index of default opt */
532 15 /* full option count */, 10 /* user option count */
536 * Create the static procedure(s) declared above.
538 static void
539 doUsageOpt(
540 tOptions* pOptions,
541 tOptDesc* pOptDesc )
543 USAGE( EXIT_SUCCESS );
546 #if ! defined(TEST_NTPDC_OPTS)
548 /* * * * * * *
550 * For the set-debug-level option, when DEBUG is #define-d.
552 #ifdef DEBUG
553 static void
554 doOptSet_Debug_Level(
555 tOptions* pOptions,
556 tOptDesc* pOptDesc )
558 /* extracted from ../include/debug-opt.def, line 29 */
559 DESC(DEBUG_LEVEL).optOccCt = atoi( pOptDesc->pzLastArg );
561 #endif /* defined DEBUG */
563 #endif /* defined(TEST_NTPDC_OPTS) */
565 /* extracted from /usr/local/gnu/autogen-5.9.1/share/autogen/optmain.tpl near line 92 */
567 #if defined(TEST_NTPDC_OPTS) /* TEST MAIN PROCEDURE: */
570 main( int argc, char** argv )
572 int res = EXIT_SUCCESS;
573 (void)optionProcess( &ntpdcOptions, argc, argv );
575 void optionPutShell( tOptions* );
576 optionPutShell( &ntpdcOptions );
578 return res;
580 #endif /* defined TEST_NTPDC_OPTS */
581 /* extracted from /usr/local/gnu/autogen-5.9.1/share/autogen/optcode.tpl near line 514 */
583 #if ENABLE_NLS
584 #include <stdio.h>
585 #include <stdlib.h>
586 #include <string.h>
587 #include <unistd.h>
588 #include <autoopts/usage-txt.h>
590 static char* AO_gettext( char const* pz );
591 static void coerce_it(void** s);
593 static char*
594 AO_gettext( char const* pz )
596 char* pzRes;
597 if (pz == NULL)
598 return NULL;
599 pzRes = _(pz);
600 if (pzRes == pz)
601 return pzRes;
602 pzRes = strdup( pzRes );
603 if (pzRes == NULL) {
604 fputs( _("No memory for duping translated strings\n"), stderr );
605 exit( EXIT_FAILURE );
607 return pzRes;
610 static void coerce_it(void** s) { *s = AO_gettext(*s); }
611 #define COERSION(_f) \
612 coerce_it((void*)&(ntpdcOptions._f))
615 * This invokes the translation code (e.g. gettext(3)).
617 static void
618 translate_option_strings( void )
621 * Guard against re-translation. It won't work. The strings will have
622 * been changed by the first pass through this code. One shot only.
624 if (option_usage_text.field_ct == 0)
625 return;
627 * Do the translations. The first pointer follows the field count field.
628 * The field count field is the size of a pointer.
631 char** ppz = (char**)(void*)&(option_usage_text);
632 int ix = option_usage_text.field_ct;
634 do {
635 ppz++;
636 *ppz = AO_gettext(*ppz);
637 } while (--ix > 0);
639 option_usage_text.field_ct = 0;
642 tOptDesc* pOD = ntpdcOptions.pOptDesc;
643 int ix = ntpdcOptions.optCt;
645 for (;;) {
646 pOD->pzText = AO_gettext(pOD->pzText);
647 pOD->pz_NAME = AO_gettext(pOD->pz_NAME);
648 pOD->pz_Name = AO_gettext(pOD->pz_Name);
649 pOD->pz_DisableName = AO_gettext(pOD->pz_DisableName);
650 pOD->pz_DisablePfx = AO_gettext(pOD->pz_DisablePfx);
651 if (--ix <= 0)
652 break;
653 pOD++;
656 COERSION(pzCopyright);
657 COERSION(pzCopyNotice);
658 COERSION(pzFullVersion);
659 COERSION(pzUsageTitle);
660 COERSION(pzExplain);
661 COERSION(pzDetail);
664 #endif /* ENABLE_NLS */
666 #ifdef __cplusplus
668 #endif
669 /* ntpdc-opts.c ends here */