2
2
* EDIT THIS FILE WITH CAUTION (ntpdc-opts.c)
4
* It has been AutoGen-ed January 3, 2011 at 09:18:12 PM by AutoGen 5.11.6pre7
4
* It has been AutoGen-ed December 24, 2011 at 06:34:16 PM by AutoGen 5.12
5
5
* From the definitions ntpdc-opts.def
6
6
* and the template file options
8
* Generated from AutoOpts 34:0:9 templates.
8
* Generated from AutoOpts 35:0:10 templates.
10
10
* AutoOpts is a copyrighted work. This source file is not encumbered
11
11
* by AutoOpts licensing, but is provided under the licensing terms chosen
18
18
* This source file is copyrighted and licensed under the following terms:
20
* ntpdc copyright (c) 1970-2011 David L. Mills and/or others - all rights reserved
22
* see html/copyright.html
20
* see html/copyright.html
25
24
#include <sys/types.h>
26
26
#include <limits.h>
28
28
#include <stdlib.h>
36
extern FILE * option_usage_fp;
37
38
/* TRANSLATORS: choose the translation for option names wisely because you
38
39
cannot ever change your mind. */
40
"ntpdc copyright (c) 1970-2011 David L. Mills and/or others, all rights reserved"
41
/* extracted from ../include/copyright.def near line 8 */
43
tSCC zCopyrightNotice[24] =
44
"see html/copyright.html";
40
static char const zCopyright[39] =
42
see html/copyright.html\n";
43
static char const zLicenseDescrip[25] =
44
"see html/copyright.html\n";
46
46
extern tUsageProc optionUsage;
238
232
optionBooleanVal, optionNestedVal, optionNumericVal,
239
233
optionPagedUsage, optionPrintVersion, optionResetOpt,
240
optionStackArg, optionTimeVal, optionUnstackArg,
234
optionStackArg, optionTimeDate, optionTimeVal,
235
optionUnstackArg, optionVersionStderr;
243
237
doOptSet_Debug_Level, doUsageOpt;
260
254
* Define the Ntpdc Option Descriptions.
262
static tOptDesc optDesc[ OPTION_CT ] = {
256
static tOptDesc optDesc[OPTION_CT] = {
263
257
{ /* entry idx, value */ 0, VALUE_OPT_IPV4,
264
258
/* equiv idx, value */ 0, VALUE_OPT_IPV4,
265
259
/* equivalenced to */ NO_EQUIVALENT,
452
446
static char const zPROGNAME[6] = "NTPDC";
453
447
static char const zUsageTitle[127] =
454
"ntpdc - vendor-specific NTP query program - Ver. 4.2.6p3\n\
448
"ntpdc - vendor-specific NTP query program - Ver. 4.2.6p5\n\
455
449
USAGE: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ host ...]\n";
456
450
static char const zRcName[7] = ".ntprc";
457
451
static char const * const apzHomeList[3] = {
462
456
static char const zBugsAddr[34] = "http://bugs.ntp.org, bugs@ntp.org";
463
457
#define zExplain NULL
464
static char const zDetail[618] = "\n\
467
utility program is used to query an NTP daemon about its\n\
468
current state and to request changes in that state.\n\
469
It uses NTP mode 7 control message formats described in the source code.\n\
458
static char const zDetail[601] = "\n\
459
The [= prog-name =] utility program is used to query an NTP daemon about\n\
460
its current state and to request changes in that state. It uses NTP mode\n\
461
7 control message formats described in the source code. The program may\n\
471
462
be run either in interactive mode or controlled using command line\n\
473
Extensive state and statistics information is available\n\
477
In addition, nearly all the\n\
478
configuration options which can be specified at startup using\n\
479
ntpd's configuration file may also be specified at run time using\n\
480
[= prog-name =] .\n";
463
arguments. Extensive state and statistics information is available\n\
464
through the [= prog-name =] interface. In addition, nearly all the\n\
465
configuration options which can be specified at startup using ntpd's\n\
466
configuration file may also be specified at run time using [= prog-name =]\n\
481
468
static char const zFullVersion[] = NTPDC_FULL_VERSION;
482
/* extracted from /usr/local/gnu/share/autogen/optcode.tpl near line 504 */
469
/* extracted from optcode.tlib near line 515 */
484
471
#if defined(ENABLE_NLS)
485
472
# define OPTPROC_BASE OPTPROC_TRANSLATE
496
483
# define PKGDATADIR ""
486
#ifndef WITH_PACKAGER
487
# define ntpdc_packager_info NULL
489
static char const ntpdc_packager_info[] =
490
"Packaged by " WITH_PACKAGER
492
# ifdef WITH_PACKAGER_VERSION
493
" ("WITH_PACKAGER_VERSION")"
496
# ifdef WITH_PACKAGER_BUG_REPORTS
497
"\nReport ntpdc bugs to " WITH_PACKAGER_BUG_REPORTS
499
502
tOptions ntpdcOptions = {
500
503
OPTIONS_STRUCT_VERSION,
501
504
0, NULL, /* original argc + argv */
508
511
+ OPTPROC_MISUSE ),
509
512
0, NULL, /* current option index, current option */
510
513
NULL, NULL, zPROGNAME,
511
zRcName, zCopyright, zCopyrightNotice,
514
zRcName, zCopyright, zLicenseDescrip,
512
515
zFullVersion, apzHomeList, zUsageTitle,
513
516
zExplain, zDetail, optDesc,
514
517
zBugsAddr, /* address to send bugs to */
515
518
NULL, NULL, /* extensions/saved state */
516
optionUsage, /* usage procedure */
519
optionUsage, /* usage procedure */
517
520
translate_option_strings, /* translation procedure */
519
522
* Indexes to special options
526
529
15 /* full option count */, 10 /* user option count */,
527
530
ntpdc_full_usage, ntpdc_short_usage,
532
PKGDATADIR, ntpdc_packager_info
533
536
* Create the static procedure(s) declared above.
539
doUsageOpt(tOptions * pOptions, tOptDesc * pOptDesc)
542
USAGE(NTPDC_EXIT_SUCCESS);
544
545
#if ! defined(TEST_NTPDC_OPTS)
551
552
doOptSet_Debug_Level(tOptions* pOptions, tOptDesc* pOptDesc)
553
/* extracted from ../include/debug-opt.def, line 27 */
554
/* extracted from debug-opt.def, line 27 */
554
555
DESC(DEBUG_LEVEL).optOccCt = atoi( pOptDesc->pzLastArg );
556
557
#endif /* defined(TEST_NTPDC_OPTS) */
557
/* extracted from /usr/local/gnu/share/autogen/optmain.tpl near line 107 */
558
/* extracted from optmain.tlib near line 128 */
559
560
#if defined(TEST_NTPDC_OPTS) /* TEST MAIN PROCEDURE: */
561
562
extern void optionPutShell(tOptions*);
564
main(int argc, char** argv)
565
main(int argc, char ** argv)
566
int res = EXIT_SUCCESS;
567
int res = NTPDC_EXIT_SUCCESS;
567
568
(void)optionProcess(&ntpdcOptions, argc, argv);
568
569
optionPutShell(&ntpdcOptions);
569
570
res = ferror(stdout);
596
597
pzRes = strdup(pzRes);
597
598
if (pzRes == NULL) {
598
599
fputs(_("No memory for duping translated strings\n"), stderr);
600
exit(NTPDC_EXIT_FAILURE);
604
static void coerce_it(void** s) { *s = AO_gettext(*s); }
605
#define COERSION(_f) \
606
coerce_it((void*)&(ntpdcOptions._f))
605
static void coerce_it(void** s) { *s = AO_gettext(*s);
609
609
* This invokes the translation code (e.g. gettext(3)).
612
612
translate_option_strings(void)
614
tOptions * const pOpt = &ntpdcOptions;
615
617
* Guard against re-translation. It won't work. The strings will have
616
618
* been changed by the first pass through this code. One shot only.
618
620
if (option_usage_text.field_ct != 0) {
621
622
* Do the translations. The first pointer follows the field count
622
623
* field. The field count field is the size of a pointer.
624
tOptDesc* pOD = ntpdcOptions.pOptDesc;
625
char** ppz = (char**)(void*)&(option_usage_text);
626
int ix = option_usage_text.field_ct;
625
tOptDesc * pOD = pOpt->pOptDesc;
626
char ** ppz = (char**)(void*)&(option_usage_text);
627
int ix = option_usage_text.field_ct;
630
631
*ppz = AO_gettext(*ppz);
631
632
} while (--ix > 0);
633
COERSION(pzCopyright);
634
COERSION(pzCopyNotice);
635
COERSION(pzFullVersion);
636
COERSION(pzUsageTitle);
634
coerce_it((void*)&(pOpt->pzCopyright));
635
coerce_it((void*)&(pOpt->pzCopyNotice));
636
coerce_it((void*)&(pOpt->pzFullVersion));
637
coerce_it((void*)&(pOpt->pzUsageTitle));
638
coerce_it((void*)&(pOpt->pzExplain));
639
coerce_it((void*)&(pOpt->pzDetail));
640
coerce_it((void*)&(pOpt->pzPackager));
639
641
option_usage_text.field_ct = 0;
641
for (ix = ntpdcOptions.optCt; ix > 0; ix--, pOD++)
643
for (ix = pOpt->optCt; ix > 0; ix--, pOD++)
642
644
coerce_it((void*)&(pOD->pzText));
645
if ((ntpdcOptions.fOptSet & OPTPROC_NXLAT_OPT_CFG) == 0) {
646
tOptDesc* pOD = ntpdcOptions.pOptDesc;
647
if ((pOpt->fOptSet & OPTPROC_NXLAT_OPT_CFG) == 0) {
648
tOptDesc * pOD = pOpt->pOptDesc;
649
for (ix = ntpdcOptions.optCt; ix > 0; ix--, pOD++) {
651
for (ix = pOpt->optCt; ix > 0; ix--, pOD++) {
650
652
coerce_it((void*)&(pOD->pz_Name));
651
653
coerce_it((void*)&(pOD->pz_DisableName));
652
654
coerce_it((void*)&(pOD->pz_DisablePfx));