~ubuntu-branches/debian/sid/ntp/sid

« back to all changes in this revision

Viewing changes to ntpdc/ntpdc-opts.c

  • Committer: Package Import Robot
  • Author(s): Peter Eisentraut
  • Date: 2012-02-27 13:55:56 UTC
  • mfrom: (1.2.12)
  • Revision ID: package-import@ubuntu.com-20120227135556-dkx4mkod5trl5bgt
Tags: 1:4.2.6.p5+dfsg-1
* New upstream release (closes: #644673)
* Updated instructions on generating autotools.patch
* Updated standards version

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*  
2
2
 *  EDIT THIS FILE WITH CAUTION  (ntpdc-opts.c)
3
3
 *  
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
7
7
 *
8
 
 * Generated from AutoOpts 34:0:9 templates.
 
8
 * Generated from AutoOpts 35:0:10 templates.
9
9
 *
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
17
17
 *
18
18
 * This source file is copyrighted and licensed under the following terms:
19
19
 *
20
 
 * ntpdc copyright (c) 1970-2011 David L. Mills and/or others - all rights reserved
21
 
 *
22
 
 * see html/copyright.html
 
20
 *  see html/copyright.html
 
21
 *  
23
22
 */
24
23
 
25
24
#include <sys/types.h>
 
25
 
26
26
#include <limits.h>
27
27
#include <stdio.h>
28
28
#include <stdlib.h>
33
33
#ifdef  __cplusplus
34
34
extern "C" {
35
35
#endif
 
36
extern FILE * option_usage_fp;
36
37
 
37
38
/* TRANSLATORS: choose the translation for option names wisely because you
38
39
                cannot ever change your mind. */
39
 
tSCC zCopyright[] =
40
 
       "ntpdc copyright (c) 1970-2011 David L. Mills and/or others, all rights reserved"
41
 
/* extracted from ../include/copyright.def near line 8 */
42
 
;
43
 
tSCC zCopyrightNotice[24] =
44
 
"see html/copyright.html";
 
40
static char const zCopyright[39] =
 
41
"ntpdc 4.2.6p5\n\
 
42
see html/copyright.html\n";
 
43
static char const zLicenseDescrip[25] =
 
44
"see html/copyright.html\n";
45
45
 
46
46
extern tUsageProc optionUsage;
47
47
 
57
57
#ifndef NULL
58
58
#  define NULL 0
59
59
#endif
60
 
#ifndef EXIT_SUCCESS
61
 
#  define  EXIT_SUCCESS 0
62
 
#endif
63
 
#ifndef EXIT_FAILURE
64
 
#  define  EXIT_FAILURE 1
65
 
#endif
66
60
 
67
61
/*
68
62
 *  Ipv4 option description with
237
231
extern tOptProc
238
232
    optionBooleanVal,    optionNestedVal,     optionNumericVal,
239
233
    optionPagedUsage,    optionPrintVersion,  optionResetOpt,
240
 
    optionStackArg,      optionTimeVal,       optionUnstackArg,
241
 
    optionVersionStderr;
 
234
    optionStackArg,      optionTimeDate,      optionTimeVal,
 
235
    optionUnstackArg,    optionVersionStderr;
242
236
static tOptProc
243
237
    doOptSet_Debug_Level, doUsageOpt;
244
238
 
259
253
 *
260
254
 *  Define the Ntpdc Option Descriptions.
261
255
 */
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,
451
445
 */
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] = {
461
455
 
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\
465
 
The\n\
466
 
[= prog-name =]\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\
470
 
The program may\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\
472
 
arguments.\n\
473
 
Extensive state and statistics information is available\n\
474
 
through the\n\
475
 
[= prog-name =]\n\
476
 
interface.\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\
 
467
.\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 */
483
470
 
484
471
#if defined(ENABLE_NLS)
485
472
# define OPTPROC_BASE OPTPROC_TRANSLATE
496
483
# define PKGDATADIR ""
497
484
#endif
498
485
 
 
486
#ifndef  WITH_PACKAGER
 
487
# define ntpdc_packager_info NULL
 
488
#else
 
489
static char const ntpdc_packager_info[] =
 
490
    "Packaged by " WITH_PACKAGER
 
491
 
 
492
# ifdef WITH_PACKAGER_VERSION
 
493
        " ("WITH_PACKAGER_VERSION")"
 
494
# endif
 
495
 
 
496
# ifdef WITH_PACKAGER_BUG_REPORTS
 
497
    "\nReport ntpdc bugs to " WITH_PACKAGER_BUG_REPORTS
 
498
# endif
 
499
    "\n";
 
500
#endif
 
501
 
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 */
518
521
    /*
519
522
     *  Indexes to special options
526
529
    15 /* full option count */, 10 /* user option count */,
527
530
    ntpdc_full_usage, ntpdc_short_usage,
528
531
    NULL, NULL,
529
 
    PKGDATADIR
 
532
    PKGDATADIR, ntpdc_packager_info
530
533
};
531
534
 
532
535
/*
533
536
 *  Create the static procedure(s) declared above.
534
537
 */
535
538
static void
536
 
doUsageOpt(
537
 
    tOptions*   pOptions,
538
 
    tOptDesc*   pOptDesc )
 
539
doUsageOpt(tOptions * pOptions, tOptDesc * pOptDesc)
539
540
{
540
541
    (void)pOptions;
541
 
    USAGE(EXIT_SUCCESS);
 
542
    USAGE(NTPDC_EXIT_SUCCESS);
542
543
}
543
544
 
544
545
#if ! defined(TEST_NTPDC_OPTS)
550
551
static void
551
552
doOptSet_Debug_Level(tOptions* pOptions, tOptDesc* pOptDesc)
552
553
{
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 );
555
556
}
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 */
558
559
 
559
560
#if defined(TEST_NTPDC_OPTS) /* TEST MAIN PROCEDURE: */
560
561
 
561
562
extern void optionPutShell(tOptions*);
562
563
 
563
564
int
564
 
main(int argc, char** argv)
 
565
main(int argc, char ** argv)
565
566
{
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);
572
573
    return res;
573
574
}
574
575
#endif  /* defined TEST_NTPDC_OPTS */
575
 
/* extracted from /usr/local/gnu/share/autogen/optcode.tpl near line 641 */
 
576
/* extracted from optcode.tlib near line 666 */
576
577
 
577
578
#if ENABLE_NLS
578
579
#include <stdio.h>
596
597
    pzRes = strdup(pzRes);
597
598
    if (pzRes == NULL) {
598
599
        fputs(_("No memory for duping translated strings\n"), stderr);
599
 
        exit(EXIT_FAILURE);
 
600
        exit(NTPDC_EXIT_FAILURE);
600
601
    }
601
602
    return pzRes;
602
603
}
603
604
 
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);
 
606
}
607
607
 
608
608
/*
609
609
 *  This invokes the translation code (e.g. gettext(3)).
611
611
static void
612
612
translate_option_strings(void)
613
613
{
 
614
    tOptions * const pOpt = &ntpdcOptions;
 
615
 
614
616
    /*
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.
617
619
     */
618
620
    if (option_usage_text.field_ct != 0) {
619
 
 
620
621
        /*
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.
623
624
         */
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;
627
628
 
628
629
        do {
629
630
            ppz++;
630
631
            *ppz = AO_gettext(*ppz);
631
632
        } while (--ix > 0);
632
633
 
633
 
        COERSION(pzCopyright);
634
 
        COERSION(pzCopyNotice);
635
 
        COERSION(pzFullVersion);
636
 
        COERSION(pzUsageTitle);
637
 
        COERSION(pzExplain);
638
 
        COERSION(pzDetail);
 
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;
640
642
 
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));
643
645
    }
644
646
 
645
 
    if ((ntpdcOptions.fOptSet & OPTPROC_NXLAT_OPT_CFG) == 0) {
646
 
        tOptDesc* pOD = ntpdcOptions.pOptDesc;
647
 
        int       ix;
 
647
    if ((pOpt->fOptSet & OPTPROC_NXLAT_OPT_CFG) == 0) {
 
648
        tOptDesc * pOD = pOpt->pOptDesc;
 
649
        int        ix;
648
650
 
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));