From: Harlan Stenn Date: Mon, 20 Jul 2009 09:20:37 +0000 (-0400) Subject: Updated to AutoGen-5.9.8 X-Git-Tag: NTP_4_2_5P190~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9b71bca58b82e0fd2af660f819aa0115c07912a1;p=thirdparty%2Fntp.git Updated to AutoGen-5.9.8 bk: 4a6436e5PxFNT-6E_Rq-7dDYYCep1A --- diff --git a/gsoc_sntp/sntp-opts.c b/gsoc_sntp/sntp-opts.c index 3a53b9adc..bddd49230 100644 --- a/gsoc_sntp/sntp-opts.c +++ b/gsoc_sntp/sntp-opts.c @@ -1,11 +1,11 @@ /* * EDIT THIS FILE WITH CAUTION (sntp-opts.c) * - * It has been AutoGen-ed Thursday July 16, 2009 at 07:51:45 AM EDT + * It has been AutoGen-ed Monday July 20, 2009 at 05:13:42 AM EDT * From the definitions sntp-opts.def * and the template file options * - * Generated from AutoOpts 29:0:4 templates. + * Generated from AutoOpts 32:1:7 templates. */ /* @@ -24,8 +24,10 @@ * */ - +#include #include +#include +#include #define OPTION_CODE_COMPILE 1 #include "sntp-opts.h" @@ -33,12 +35,16 @@ #ifdef __cplusplus extern "C" { #endif + +/* TRANSLATORS: choose the translation for option names wisely because you + cannot ever change your mind. */ tSCC zCopyright[] = - "sntp copyright (c) 2008 ntp.org, all rights reserved"; -tSCC zCopyrightNotice[] = - + "sntp copyright (c) 2008 ntp.org, all rights reserved" /* extracted from sntp-opts.def near line 17 */ +; +tSCC zCopyrightNotice[1] = ""; + extern tUsageProc optionUsage; #ifndef NULL @@ -183,24 +189,16 @@ tSCC zKeyfile_Name[] = "keyfile"; /* * Help/More_Help/Version option descriptions: */ -tSCC zHelpText[] = "Display usage information and exit"; -tSCC zHelp_Name[] = "help"; - -tSCC zMore_HelpText[] = "Extended usage information passed thru pager"; -tSCC zMore_Help_Name[] = "more-help"; - -tSCC zVersionText[] = "Output version information and exit"; -tSCC zVersion_Name[] = "version"; - -/* - * Save/Load_Opts option description: - */ +tSCC zHelpText[] = "Display usage information and exit"; +tSCC zHelp_Name[] = "help"; +tSCC zMore_HelpText[] = "Extended usage information passed thru pager"; +tSCC zMore_Help_Name[] = "more-help"; +tSCC zVersionText[] = "Output version information and exit"; +tSCC zVersion_Name[] = "version"; tSCC zSave_OptsText[] = "Save the option state to a config file"; tSCC zSave_Opts_Name[] = "save-opts"; - tSCC zLoad_OptsText[] = "Load options from a config file"; tSCC zLoad_Opts_NAME[] = "LOAD_OPTS"; - tSCC zNotLoad_Opts_Name[] = "no-load-opts"; tSCC zNotLoad_Opts_Pfx[] = "no"; #define zLoad_Opts_Name (zNotLoad_Opts_Name + 3) @@ -444,7 +442,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* equiv idx value */ NO_EQUIVALENT, 0, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, NOLIMIT, 0, - /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) \ + /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | OPTST_DISABLE_IMM, 0, /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, @@ -480,7 +478,7 @@ job.\n\ NTP is the Network Time Protocol (RFC 1305) and SNTP is the\n\ Simple Network Time Protocol (RFC 2030, which supersedes RFC 1769).\n"; tSCC zFullVersion[] = SNTP_FULL_VERSION; -/* extracted from /usr/local/gnu/share/autogen/optcode.tpl near line 408 */ +/* extracted from /usr/local/gnu/share/autogen/optcode.tpl near line 501 */ #if defined(ENABLE_NLS) # define OPTPROC_BASE OPTPROC_TRANSLATE @@ -490,6 +488,9 @@ tSCC zFullVersion[] = SNTP_FULL_VERSION; # define translate_option_strings NULL #endif /* ENABLE_NLS */ + +#define sntp_full_usage NULL +#define sntp_short_usage NULL tOptions sntpOptions = { OPTIONS_STRUCT_VERSION, 0, NULL, /* original argc + argv */ @@ -499,8 +500,7 @@ tOptions sntpOptions = { + OPTPROC_LONGOPT + OPTPROC_NO_REQ_OPT + OPTPROC_ENVIRON - + OPTPROC_ARGS_REQ - + OPTPROC_HAS_IMMED ), + + OPTPROC_ARGS_REQ ), 0, NULL, /* current option index, current option */ NULL, NULL, zPROGNAME, zRcName, zCopyright, zCopyrightNotice, @@ -513,12 +513,14 @@ tOptions sntpOptions = { /* * Indexes to special options */ - { INDEX_OPT_MORE_HELP, - INDEX_OPT_SAVE_OPTS, - NO_EQUIVALENT /* index of '-#' option */, + { INDEX_OPT_MORE_HELP, /* more-help option index */ + INDEX_OPT_SAVE_OPTS, /* save option index */ + NO_EQUIVALENT, /* '-#' option index */ NO_EQUIVALENT /* index of default opt */ }, - 17 /* full option count */, 12 /* user option count */ + 17 /* full option count */, 12 /* user option count */, + sntp_full_usage, sntp_short_usage, + NULL, NULL }; /* @@ -529,25 +531,25 @@ doUsageOpt( tOptions* pOptions, tOptDesc* pOptDesc ) { + (void)pOptions; USAGE( EXIT_SUCCESS ); } -/* extracted from /usr/local/gnu/share/autogen/optmain.tpl near line 92 */ +/* extracted from /usr/local/gnu/share/autogen/optmain.tpl near line 109 */ #if defined(TEST_SNTP_OPTS) /* TEST MAIN PROCEDURE: */ +extern void optionPutShell( tOptions* ); + int -main( int argc, char** argv ) +main(int argc, char** argv) { int res = EXIT_SUCCESS; (void)optionProcess( &sntpOptions, argc, argv ); - { - void optionPutShell( tOptions* ); - optionPutShell( &sntpOptions ); - } + optionPutShell( &sntpOptions ); return res; } #endif /* defined TEST_SNTP_OPTS */ -/* extracted from /usr/local/gnu/share/autogen/optcode.tpl near line 514 */ +/* extracted from /usr/local/gnu/share/autogen/optcode.tpl near line 633 */ #if ENABLE_NLS #include @@ -590,44 +592,45 @@ translate_option_strings( void ) * Guard against re-translation. It won't work. The strings will have * been changed by the first pass through this code. One shot only. */ - if (option_usage_text.field_ct == 0) - return; - /* - * Do the translations. The first pointer follows the field count field. - * The field count field is the size of a pointer. - */ - { - char** ppz = (char**)(void*)&(option_usage_text); - int ix = option_usage_text.field_ct; + if (option_usage_text.field_ct != 0) { + + /* + * Do the translations. The first pointer follows the field count + * field. The field count field is the size of a pointer. + */ + tOptDesc* pOD = sntpOptions.pOptDesc; + char** ppz = (char**)(void*)&(option_usage_text); + int ix = option_usage_text.field_ct; do { ppz++; *ppz = AO_gettext(*ppz); } while (--ix > 0); + + COERSION(pzCopyright); + COERSION(pzCopyNotice); + COERSION(pzFullVersion); + COERSION(pzUsageTitle); + COERSION(pzExplain); + COERSION(pzDetail); + option_usage_text.field_ct = 0; + + for (ix = sntpOptions.optCt; ix > 0; ix--, pOD++) + coerce_it((void*)&(pOD->pzText)); } - option_usage_text.field_ct = 0; - { + if ((sntpOptions.fOptSet & OPTPROC_NXLAT_OPT_CFG) == 0) { tOptDesc* pOD = sntpOptions.pOptDesc; - int ix = sntpOptions.optCt; - - for (;;) { - pOD->pzText = AO_gettext(pOD->pzText); - pOD->pz_NAME = AO_gettext(pOD->pz_NAME); - pOD->pz_Name = AO_gettext(pOD->pz_Name); - pOD->pz_DisableName = AO_gettext(pOD->pz_DisableName); - pOD->pz_DisablePfx = AO_gettext(pOD->pz_DisablePfx); - if (--ix <= 0) - break; - pOD++; + int ix; + + for (ix = sntpOptions.optCt; ix > 0; ix--, pOD++) { + coerce_it((void*)&(pOD->pz_Name)); + coerce_it((void*)&(pOD->pz_DisableName)); + coerce_it((void*)&(pOD->pz_DisablePfx)); } + /* prevent re-translation */ + sntpOptions.fOptSet |= OPTPROC_NXLAT_OPT_CFG | OPTPROC_NXLAT_OPT; } - COERSION(pzCopyright); - COERSION(pzCopyNotice); - COERSION(pzFullVersion); - COERSION(pzUsageTitle); - COERSION(pzExplain); - COERSION(pzDetail); } #endif /* ENABLE_NLS */ diff --git a/gsoc_sntp/sntp-opts.h b/gsoc_sntp/sntp-opts.h index e8618693f..1e8891f76 100644 --- a/gsoc_sntp/sntp-opts.h +++ b/gsoc_sntp/sntp-opts.h @@ -1,11 +1,11 @@ /* * EDIT THIS FILE WITH CAUTION (sntp-opts.h) * - * It has been AutoGen-ed Thursday July 16, 2009 at 07:51:45 AM EDT + * It has been AutoGen-ed Monday July 20, 2009 at 05:13:41 AM EDT * From the definitions sntp-opts.def * and the template file options * - * Generated from AutoOpts 29:0:4 templates. + * Generated from AutoOpts 32:1:7 templates. */ /* @@ -30,7 +30,7 @@ * "AutoOpts" chapter. Please refer to that doc for usage help. */ #ifndef AUTOOPTS_SNTP_OPTS_H_GUARD -#define AUTOOPTS_SNTP_OPTS_H_GUARD +#define AUTOOPTS_SNTP_OPTS_H_GUARD 1 #include "config.h" #include @@ -41,7 +41,7 @@ * tolerable version is at least as old as what was current when the header * template was released. */ -#define AO_TEMPLATE_VERSION 118784 +#define AO_TEMPLATE_VERSION 131073 #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \ || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION) # error option template version mismatches autoopts/options.h header @@ -52,23 +52,23 @@ * Enumeration of each option: */ typedef enum { - INDEX_OPT_IPV4 = 0, - INDEX_OPT_IPV6 = 1, - INDEX_OPT_NORMALVERBOSE = 2, - INDEX_OPT_KOD = 3, - INDEX_OPT_SYSLOG = 4, - INDEX_OPT_FILELOG = 5, - INDEX_OPT_SETTOD = 6, - INDEX_OPT_ADJTIME = 7, - INDEX_OPT_BROADCAST = 8, - INDEX_OPT_TIMEOUT = 9, - INDEX_OPT_AUTHENTICATION = 10, - INDEX_OPT_KEYFILE = 11, - INDEX_OPT_VERSION = 12, - INDEX_OPT_HELP = 13, - INDEX_OPT_MORE_HELP = 14, - INDEX_OPT_SAVE_OPTS = 15, - INDEX_OPT_LOAD_OPTS = 16 + INDEX_OPT_IPV4 = 0, + INDEX_OPT_IPV6 = 1, + INDEX_OPT_NORMALVERBOSE = 2, + INDEX_OPT_KOD = 3, + INDEX_OPT_SYSLOG = 4, + INDEX_OPT_FILELOG = 5, + INDEX_OPT_SETTOD = 6, + INDEX_OPT_ADJTIME = 7, + INDEX_OPT_BROADCAST = 8, + INDEX_OPT_TIMEOUT = 9, + INDEX_OPT_AUTHENTICATION = 10, + INDEX_OPT_KEYFILE = 11, + INDEX_OPT_VERSION = 12, + INDEX_OPT_HELP = 13, + INDEX_OPT_MORE_HELP = 14, + INDEX_OPT_SAVE_OPTS = 15, + INDEX_OPT_LOAD_OPTS = 16 } teOptIndex; #define OPTION_CT 17 @@ -163,7 +163,8 @@ typedef enum { # undef KEYFILE #endif /* NO_OPTION_NAME_WARNINGS */ -/* +/* * * * * * + * * Interface defines for specific options. */ #define VALUE_OPT_IPV4 '4' @@ -182,10 +183,9 @@ typedef enum { #define VALUE_OPT_AUTHENTICATION 'a' #define OPT_VALUE_AUTHENTICATION (DESC(AUTHENTICATION).optArg.argInt) #define VALUE_OPT_KEYFILE 'k' - -#define VALUE_OPT_VERSION 'v' #define VALUE_OPT_HELP '?' #define VALUE_OPT_MORE_HELP '!' +#define VALUE_OPT_VERSION 'v' #define VALUE_OPT_SAVE_OPTS '>' #define VALUE_OPT_LOAD_OPTS '<' #define SET_OPT_SAVE_OPTS(a) STMTS( \ @@ -202,7 +202,7 @@ typedef enum { sntpOptions.pzCurOpt = NULL ) #define START_OPT RESTART_OPT(1) #define USAGE(c) (*sntpOptions.pUsageProc)( &sntpOptions, c ) -/* extracted from /usr/local/gnu/share/autogen/opthead.tpl near line 360 */ +/* extracted from /usr/local/gnu/share/autogen/opthead.tpl near line 409 */ /* * * * * * * @@ -214,18 +214,37 @@ extern "C" { extern tOptions sntpOptions; -#ifndef _ -# if ENABLE_NLS -# include - static inline char* aoGetsText( char const* pz ) { - if (pz == NULL) return NULL; - return (char*)gettext( pz ); - } -# define _(s) aoGetsText(s) -# else /* ENABLE_NLS */ -# define _(s) s -# endif /* ENABLE_NLS */ -#endif +#if defined(ENABLE_NLS) +# ifndef _ +# include + static inline char* aoGetsText( char const* pz ) { + if (pz == NULL) return NULL; + return (char*)gettext( pz ); + } +# define _(s) aoGetsText(s) +# endif /* _() */ + +# define OPT_NO_XLAT_CFG_NAMES STMTS(sntpOptions.fOptSet |= \ + OPTPROC_NXLAT_OPT_CFG;) +# define OPT_NO_XLAT_OPT_NAMES STMTS(sntpOptions.fOptSet |= \ + OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;) + +# define OPT_XLAT_CFG_NAMES STMTS(sntpOptions.fOptSet &= \ + ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);) +# define OPT_XLAT_OPT_NAMES STMTS(sntpOptions.fOptSet &= \ + ~OPTPROC_NXLAT_OPT;) + +#else /* ENABLE_NLS */ +# define OPT_NO_XLAT_CFG_NAMES +# define OPT_NO_XLAT_OPT_NAMES + +# define OPT_XLAT_CFG_NAMES +# define OPT_XLAT_OPT_NAMES + +# ifndef _ +# define _(_s) _s +# endif +#endif /* ENABLE_NLS */ #ifdef __cplusplus } diff --git a/gsoc_sntp/sntp-opts.texi b/gsoc_sntp/sntp-opts.texi index 0baafd981..7cc5fffa7 100644 --- a/gsoc_sntp/sntp-opts.texi +++ b/gsoc_sntp/sntp-opts.texi @@ -6,7 +6,7 @@ # # EDIT THIS FILE WITH CAUTION (sntp-opts.texi) # -# It has been AutoGen-ed Thursday July 16, 2009 at 07:51:48 AM EDT +# It has been AutoGen-ed Monday July 20, 2009 at 05:13:44 AM EDT # From the definitions sntp-opts.def # and the template file aginfo.tpl @end ignore diff --git a/gsoc_sntp/sntp.1 b/gsoc_sntp/sntp.1 index 24a250d53..67879cdf6 100644 --- a/gsoc_sntp/sntp.1 +++ b/gsoc_sntp/sntp.1 @@ -1,7 +1,7 @@ -.TH SNTP 1 2009-07-16 "( 4.2.5p189)" "Programmer's Manual" +.TH SNTP 1 2009-07-20 "( 4.2.5p189)" "Programmer's Manual" .\" EDIT THIS FILE WITH CAUTION (sntp.1) .\" -.\" It has been AutoGen-ed Thursday July 16, 2009 at 07:51:47 AM EDT +.\" It has been AutoGen-ed Monday July 20, 2009 at 05:13:42 AM EDT .\" From the definitions sntp-opts.def .\" and the template file agman1.tpl .\" @@ -15,7 +15,7 @@ sntp \- standard SNTP program .in +8 ... .SH "DESCRIPTION" -This manual page documents, briefly, the \fBsntp\fP command. +This manual page briefly documents the \fBsntp\fP command. .I sntp can be used as a SNTP client to query a NTP or SNTP server and either display the time or set the local system's time (given suitable privilege). It can be @@ -276,7 +276,7 @@ environment variables named: .nf \fBSNTP_\fP or \fBSNTP\fP .fi -.aj +.ad The environmental presets take precedence (are processed later than) the configuration files. The \fIhomerc\fP files are "\fI$HOME\fP", and "\fI.\fP". diff --git a/ntpdc/ntpdc-opts.c b/ntpdc/ntpdc-opts.c index e2ef74e41..3388f9cb5 100644 --- a/ntpdc/ntpdc-opts.c +++ b/ntpdc/ntpdc-opts.c @@ -1,11 +1,11 @@ /* * EDIT THIS FILE WITH CAUTION (ntpdc-opts.c) * - * It has been AutoGen-ed Thursday July 16, 2009 at 07:45:36 AM EDT + * It has been AutoGen-ed Monday July 20, 2009 at 05:09:22 AM EDT * From the definitions ntpdc-opts.def * and the template file options * - * Generated from AutoOpts 29:0:4 templates. + * Generated from AutoOpts 32:1:7 templates. */ /* @@ -24,8 +24,10 @@ * see html/copyright.html */ - +#include #include +#include +#include #define OPTION_CODE_COMPILE 1 #include "ntpdc-opts.h" @@ -33,12 +35,16 @@ #ifdef __cplusplus extern "C" { #endif + +/* TRANSLATORS: choose the translation for option names wisely because you + cannot ever change your mind. */ tSCC zCopyright[] = - "ntpdc copyright (c) 1970-2009 David L. Mills and/or others, all rights reserved"; -tSCC zCopyrightNotice[] = - + "ntpdc copyright (c) 1970-2009 David L. Mills and/or others, all rights reserved" /* extracted from ../include/copyright.def near line 8 */ +; +tSCC zCopyrightNotice[24] = "see html/copyright.html"; + extern tUsageProc optionUsage; /* @@ -191,24 +197,16 @@ tSCC zNumeric_Name[] = "numeric"; /* * Help/More_Help/Version option descriptions: */ -tSCC zHelpText[] = "Display usage information and exit"; -tSCC zHelp_Name[] = "help"; - -tSCC zMore_HelpText[] = "Extended usage information passed thru pager"; -tSCC zMore_Help_Name[] = "more-help"; - -tSCC zVersionText[] = "Output version information and exit"; -tSCC zVersion_Name[] = "version"; - -/* - * Save/Load_Opts option description: - */ +tSCC zHelpText[] = "Display usage information and exit"; +tSCC zHelp_Name[] = "help"; +tSCC zMore_HelpText[] = "Extended usage information passed thru pager"; +tSCC zMore_Help_Name[] = "more-help"; +tSCC zVersionText[] = "Output version information and exit"; +tSCC zVersion_Name[] = "version"; tSCC zSave_OptsText[] = "Save the option state to a config file"; tSCC zSave_Opts_Name[] = "save-opts"; - tSCC zLoad_OptsText[] = "Load options from a config file"; tSCC zLoad_Opts_NAME[] = "LOAD_OPTS"; - tSCC zNotLoad_Opts_Name[] = "no-load-opts"; tSCC zNotLoad_Opts_Pfx[] = "no"; #define zLoad_Opts_Name (zNotLoad_Opts_Name + 3) @@ -446,7 +444,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* equiv idx value */ NO_EQUIVALENT, 0, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, NOLIMIT, 0, - /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) \ + /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | OPTST_DISABLE_IMM, 0, /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, @@ -490,7 +488,7 @@ configuration options which can be specified at startup using\n\ ntpd's configuration file may also be specified at run time using\n\ [= prog-name =] .\n"; tSCC zFullVersion[] = NTPDC_FULL_VERSION; -/* extracted from /usr/local/gnu/share/autogen/optcode.tpl near line 408 */ +/* extracted from /usr/local/gnu/share/autogen/optcode.tpl near line 501 */ #if defined(ENABLE_NLS) # define OPTPROC_BASE OPTPROC_TRANSLATE @@ -500,6 +498,9 @@ tSCC zFullVersion[] = NTPDC_FULL_VERSION; # define translate_option_strings NULL #endif /* ENABLE_NLS */ + +#define ntpdc_full_usage NULL +#define ntpdc_short_usage NULL tOptions ntpdcOptions = { OPTIONS_STRUCT_VERSION, 0, NULL, /* original argc + argv */ @@ -508,8 +509,7 @@ tOptions ntpdcOptions = { + OPTPROC_SHORTOPT + OPTPROC_LONGOPT + OPTPROC_NO_REQ_OPT - + OPTPROC_ENVIRON - + OPTPROC_HAS_IMMED ), + + OPTPROC_ENVIRON ), 0, NULL, /* current option index, current option */ NULL, NULL, zPROGNAME, zRcName, zCopyright, zCopyrightNotice, @@ -522,12 +522,14 @@ tOptions ntpdcOptions = { /* * Indexes to special options */ - { INDEX_OPT_MORE_HELP, - INDEX_OPT_SAVE_OPTS, - NO_EQUIVALENT /* index of '-#' option */, + { INDEX_OPT_MORE_HELP, /* more-help option index */ + INDEX_OPT_SAVE_OPTS, /* save option index */ + NO_EQUIVALENT, /* '-#' option index */ NO_EQUIVALENT /* index of default opt */ }, - 15 /* full option count */, 10 /* user option count */ + 15 /* full option count */, 10 /* user option count */, + ntpdc_full_usage, ntpdc_short_usage, + NULL, NULL }; /* @@ -538,45 +540,41 @@ doUsageOpt( tOptions* pOptions, tOptDesc* pOptDesc ) { + (void)pOptions; USAGE( EXIT_SUCCESS ); } #if ! defined(TEST_NTPDC_OPTS) -/* * * * * * * +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * For the set-debug-level option, when DEBUG is #define-d. */ #ifdef DEBUG static void -doOptSet_Debug_Level( - tOptions* pOptions, - tOptDesc* pOptDesc ) +doOptSet_Debug_Level(tOptions* pOptions, tOptDesc* pOptDesc) { /* extracted from ../include/debug-opt.def, line 29 */ DESC(DEBUG_LEVEL).optOccCt = atoi( pOptDesc->pzLastArg ); } #endif /* defined DEBUG */ - #endif /* defined(TEST_NTPDC_OPTS) */ - -/* extracted from /usr/local/gnu/share/autogen/optmain.tpl near line 92 */ +/* extracted from /usr/local/gnu/share/autogen/optmain.tpl near line 109 */ #if defined(TEST_NTPDC_OPTS) /* TEST MAIN PROCEDURE: */ +extern void optionPutShell( tOptions* ); + int -main( int argc, char** argv ) +main(int argc, char** argv) { int res = EXIT_SUCCESS; (void)optionProcess( &ntpdcOptions, argc, argv ); - { - void optionPutShell( tOptions* ); - optionPutShell( &ntpdcOptions ); - } + optionPutShell( &ntpdcOptions ); return res; } #endif /* defined TEST_NTPDC_OPTS */ -/* extracted from /usr/local/gnu/share/autogen/optcode.tpl near line 514 */ +/* extracted from /usr/local/gnu/share/autogen/optcode.tpl near line 633 */ #if ENABLE_NLS #include @@ -619,44 +617,45 @@ translate_option_strings( void ) * Guard against re-translation. It won't work. The strings will have * been changed by the first pass through this code. One shot only. */ - if (option_usage_text.field_ct == 0) - return; - /* - * Do the translations. The first pointer follows the field count field. - * The field count field is the size of a pointer. - */ - { - char** ppz = (char**)(void*)&(option_usage_text); - int ix = option_usage_text.field_ct; + if (option_usage_text.field_ct != 0) { + + /* + * Do the translations. The first pointer follows the field count + * field. The field count field is the size of a pointer. + */ + tOptDesc* pOD = ntpdcOptions.pOptDesc; + char** ppz = (char**)(void*)&(option_usage_text); + int ix = option_usage_text.field_ct; do { ppz++; *ppz = AO_gettext(*ppz); } while (--ix > 0); + + COERSION(pzCopyright); + COERSION(pzCopyNotice); + COERSION(pzFullVersion); + COERSION(pzUsageTitle); + COERSION(pzExplain); + COERSION(pzDetail); + option_usage_text.field_ct = 0; + + for (ix = ntpdcOptions.optCt; ix > 0; ix--, pOD++) + coerce_it((void*)&(pOD->pzText)); } - option_usage_text.field_ct = 0; - { + if ((ntpdcOptions.fOptSet & OPTPROC_NXLAT_OPT_CFG) == 0) { tOptDesc* pOD = ntpdcOptions.pOptDesc; - int ix = ntpdcOptions.optCt; - - for (;;) { - pOD->pzText = AO_gettext(pOD->pzText); - pOD->pz_NAME = AO_gettext(pOD->pz_NAME); - pOD->pz_Name = AO_gettext(pOD->pz_Name); - pOD->pz_DisableName = AO_gettext(pOD->pz_DisableName); - pOD->pz_DisablePfx = AO_gettext(pOD->pz_DisablePfx); - if (--ix <= 0) - break; - pOD++; + int ix; + + for (ix = ntpdcOptions.optCt; ix > 0; ix--, pOD++) { + coerce_it((void*)&(pOD->pz_Name)); + coerce_it((void*)&(pOD->pz_DisableName)); + coerce_it((void*)&(pOD->pz_DisablePfx)); } + /* prevent re-translation */ + ntpdcOptions.fOptSet |= OPTPROC_NXLAT_OPT_CFG | OPTPROC_NXLAT_OPT; } - COERSION(pzCopyright); - COERSION(pzCopyNotice); - COERSION(pzFullVersion); - COERSION(pzUsageTitle); - COERSION(pzExplain); - COERSION(pzDetail); } #endif /* ENABLE_NLS */ diff --git a/ntpdc/ntpdc-opts.h b/ntpdc/ntpdc-opts.h index 18cbdcece..fbca8cf83 100644 --- a/ntpdc/ntpdc-opts.h +++ b/ntpdc/ntpdc-opts.h @@ -1,11 +1,11 @@ /* * EDIT THIS FILE WITH CAUTION (ntpdc-opts.h) * - * It has been AutoGen-ed Thursday July 16, 2009 at 07:45:36 AM EDT + * It has been AutoGen-ed Monday July 20, 2009 at 05:09:21 AM EDT * From the definitions ntpdc-opts.def * and the template file options * - * Generated from AutoOpts 29:0:4 templates. + * Generated from AutoOpts 32:1:7 templates. */ /* @@ -30,7 +30,7 @@ * "AutoOpts" chapter. Please refer to that doc for usage help. */ #ifndef AUTOOPTS_NTPDC_OPTS_H_GUARD -#define AUTOOPTS_NTPDC_OPTS_H_GUARD +#define AUTOOPTS_NTPDC_OPTS_H_GUARD 1 #include "config.h" #include @@ -41,7 +41,7 @@ * tolerable version is at least as old as what was current when the header * template was released. */ -#define AO_TEMPLATE_VERSION 118784 +#define AO_TEMPLATE_VERSION 131073 #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \ || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION) # error option template version mismatches autoopts/options.h header @@ -52,21 +52,21 @@ * Enumeration of each option: */ typedef enum { - INDEX_OPT_IPV4 = 0, - INDEX_OPT_IPV6 = 1, - INDEX_OPT_COMMAND = 2, - INDEX_OPT_LISTPEERS = 3, - INDEX_OPT_PEERS = 4, - INDEX_OPT_SHOWPEERS = 5, - INDEX_OPT_INTERACTIVE = 6, - INDEX_OPT_DEBUG_LEVEL = 7, - INDEX_OPT_SET_DEBUG_LEVEL = 8, - INDEX_OPT_NUMERIC = 9, - INDEX_OPT_VERSION = 10, - INDEX_OPT_HELP = 11, - INDEX_OPT_MORE_HELP = 12, - INDEX_OPT_SAVE_OPTS = 13, - INDEX_OPT_LOAD_OPTS = 14 + INDEX_OPT_IPV4 = 0, + INDEX_OPT_IPV6 = 1, + INDEX_OPT_COMMAND = 2, + INDEX_OPT_LISTPEERS = 3, + INDEX_OPT_PEERS = 4, + INDEX_OPT_SHOWPEERS = 5, + INDEX_OPT_INTERACTIVE = 6, + INDEX_OPT_DEBUG_LEVEL = 7, + INDEX_OPT_SET_DEBUG_LEVEL = 8, + INDEX_OPT_NUMERIC = 9, + INDEX_OPT_VERSION = 10, + INDEX_OPT_HELP = 11, + INDEX_OPT_MORE_HELP = 12, + INDEX_OPT_SAVE_OPTS = 13, + INDEX_OPT_LOAD_OPTS = 14 } teOptIndex; #define OPTION_CT 15 @@ -151,7 +151,8 @@ typedef enum { # undef NUMERIC #endif /* NO_OPTION_NAME_WARNINGS */ -/* +/* * * * * * + * * Interface defines for specific options. */ #define VALUE_OPT_IPV4 '4' @@ -170,10 +171,9 @@ typedef enum { #define VALUE_OPT_SET_DEBUG_LEVEL 'D' #endif /* DEBUG */ #define VALUE_OPT_NUMERIC 'n' - -#define VALUE_OPT_VERSION INDEX_OPT_VERSION #define VALUE_OPT_HELP '?' #define VALUE_OPT_MORE_HELP '!' +#define VALUE_OPT_VERSION INDEX_OPT_VERSION #define VALUE_OPT_SAVE_OPTS '>' #define VALUE_OPT_LOAD_OPTS '<' #define SET_OPT_SAVE_OPTS(a) STMTS( \ @@ -190,7 +190,7 @@ typedef enum { ntpdcOptions.pzCurOpt = NULL ) #define START_OPT RESTART_OPT(1) #define USAGE(c) (*ntpdcOptions.pUsageProc)( &ntpdcOptions, c ) -/* extracted from /usr/local/gnu/share/autogen/opthead.tpl near line 360 */ +/* extracted from /usr/local/gnu/share/autogen/opthead.tpl near line 409 */ /* * * * * * * @@ -202,18 +202,37 @@ extern "C" { extern tOptions ntpdcOptions; -#ifndef _ -# if ENABLE_NLS -# include - static inline char* aoGetsText( char const* pz ) { - if (pz == NULL) return NULL; - return (char*)gettext( pz ); - } -# define _(s) aoGetsText(s) -# else /* ENABLE_NLS */ -# define _(s) s -# endif /* ENABLE_NLS */ -#endif +#if defined(ENABLE_NLS) +# ifndef _ +# include + static inline char* aoGetsText( char const* pz ) { + if (pz == NULL) return NULL; + return (char*)gettext( pz ); + } +# define _(s) aoGetsText(s) +# endif /* _() */ + +# define OPT_NO_XLAT_CFG_NAMES STMTS(ntpdcOptions.fOptSet |= \ + OPTPROC_NXLAT_OPT_CFG;) +# define OPT_NO_XLAT_OPT_NAMES STMTS(ntpdcOptions.fOptSet |= \ + OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;) + +# define OPT_XLAT_CFG_NAMES STMTS(ntpdcOptions.fOptSet &= \ + ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);) +# define OPT_XLAT_OPT_NAMES STMTS(ntpdcOptions.fOptSet &= \ + ~OPTPROC_NXLAT_OPT;) + +#else /* ENABLE_NLS */ +# define OPT_NO_XLAT_CFG_NAMES +# define OPT_NO_XLAT_OPT_NAMES + +# define OPT_XLAT_CFG_NAMES +# define OPT_XLAT_OPT_NAMES + +# ifndef _ +# define _(_s) _s +# endif +#endif /* ENABLE_NLS */ #ifdef __cplusplus } diff --git a/ntpdc/ntpdc-opts.texi b/ntpdc/ntpdc-opts.texi index fd3264f56..da75f7392 100644 --- a/ntpdc/ntpdc-opts.texi +++ b/ntpdc/ntpdc-opts.texi @@ -6,7 +6,7 @@ # # EDIT THIS FILE WITH CAUTION (ntpdc-opts.texi) # -# It has been AutoGen-ed Thursday July 16, 2009 at 07:45:38 AM EDT +# It has been AutoGen-ed Monday July 20, 2009 at 05:09:24 AM EDT # From the definitions ntpdc-opts.def # and the template file aginfo.tpl @end ignore @@ -99,7 +99,7 @@ or by a single hyphen and the flag character. The following option preset mechanisms are supported: - reading file /users/stenn/.ntprc - - reading file /deacon/backroom/snaps/ntp-dev/ntpdc/.ntprc + - reading file /deacon/backroom/ntp-dev/ntpdc/.ntprc - examining environment variables named NTPDC_* The diff --git a/ntpdc/ntpdc.1 b/ntpdc/ntpdc.1 index 6fe8aa863..fe6d07a50 100644 --- a/ntpdc/ntpdc.1 +++ b/ntpdc/ntpdc.1 @@ -1,7 +1,7 @@ -.TH NTPDC 1 2009-07-16 "( 4.2.5p189)" "Programmer's Manual" +.TH NTPDC 1 2009-07-20 "( 4.2.5p189)" "Programmer's Manual" .\" EDIT THIS FILE WITH CAUTION (ntpdc.1) .\" -.\" It has been AutoGen-ed Thursday July 16, 2009 at 07:45:38 AM EDT +.\" It has been AutoGen-ed Monday July 20, 2009 at 05:09:23 AM EDT .\" From the definitions ntpdc-opts.def .\" and the template file agman1.tpl .\" @@ -15,7 +15,7 @@ ntpdc \- vendor-specific NTP query program .in +8 [ host ...] .SH "DESCRIPTION" -This manual page documents, briefly, the \fBntpdc\fP command. +This manual page briefly documents the \fBntpdc\fP command. The [= prog-name =] utility program is used to query an NTP daemon about its @@ -136,7 +136,7 @@ environment variables named: .nf \fBNTPDC_\fP or \fBNTPDC\fP .fi -.aj +.ad The environmental presets take precedence (are processed later than) the configuration files. The \fIhomerc\fP files are "\fI$HOME\fP", and "\fI.\fP". diff --git a/ntpq/ntpq-opts.c b/ntpq/ntpq-opts.c index 89f648b58..07fecdceb 100644 --- a/ntpq/ntpq-opts.c +++ b/ntpq/ntpq-opts.c @@ -1,11 +1,11 @@ /* * EDIT THIS FILE WITH CAUTION (ntpq-opts.c) * - * It has been AutoGen-ed Thursday July 16, 2009 at 07:46:05 AM EDT + * It has been AutoGen-ed Monday July 20, 2009 at 05:12:10 AM EDT * From the definitions ntpq-opts.def * and the template file options * - * Generated from AutoOpts 29:0:4 templates. + * Generated from AutoOpts 32:1:7 templates. */ /* @@ -24,8 +24,10 @@ * see html/copyright.html */ - +#include #include +#include +#include #define OPTION_CODE_COMPILE 1 #include "ntpq-opts.h" @@ -33,12 +35,16 @@ #ifdef __cplusplus extern "C" { #endif + +/* TRANSLATORS: choose the translation for option names wisely because you + cannot ever change your mind. */ tSCC zCopyright[] = - "ntpq copyright (c) 1970-2009 David L. Mills and/or others, all rights reserved"; -tSCC zCopyrightNotice[] = - + "ntpq copyright (c) 1970-2009 David L. Mills and/or others, all rights reserved" /* extracted from ../include/copyright.def near line 8 */ +; +tSCC zCopyrightNotice[24] = "see html/copyright.html"; + extern tUsageProc optionUsage; /* @@ -163,24 +169,16 @@ tSCC zNumeric_Name[] = "numeric"; /* * Help/More_Help/Version option descriptions: */ -tSCC zHelpText[] = "Display usage information and exit"; -tSCC zHelp_Name[] = "help"; - -tSCC zMore_HelpText[] = "Extended usage information passed thru pager"; -tSCC zMore_Help_Name[] = "more-help"; - -tSCC zVersionText[] = "Output version information and exit"; -tSCC zVersion_Name[] = "version"; - -/* - * Save/Load_Opts option description: - */ +tSCC zHelpText[] = "Display usage information and exit"; +tSCC zHelp_Name[] = "help"; +tSCC zMore_HelpText[] = "Extended usage information passed thru pager"; +tSCC zMore_Help_Name[] = "more-help"; +tSCC zVersionText[] = "Output version information and exit"; +tSCC zVersion_Name[] = "version"; tSCC zSave_OptsText[] = "Save the option state to a config file"; tSCC zSave_Opts_Name[] = "save-opts"; - tSCC zLoad_OptsText[] = "Load options from a config file"; tSCC zLoad_Opts_NAME[] = "LOAD_OPTS"; - tSCC zNotLoad_Opts_Name[] = "no-load-opts"; tSCC zNotLoad_Opts_Pfx[] = "no"; #define zLoad_Opts_Name (zNotLoad_Opts_Name + 3) @@ -394,7 +392,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* equiv idx value */ NO_EQUIVALENT, 0, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, NOLIMIT, 0, - /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) \ + /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | OPTST_DISABLE_IMM, 0, /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, @@ -430,7 +428,7 @@ information about current state and/or changes in that state.\n\ The same formats are used in NTPv4, although some of the\n\ variables have changed and new ones added.\n"; tSCC zFullVersion[] = NTPQ_FULL_VERSION; -/* extracted from /usr/local/gnu/share/autogen/optcode.tpl near line 408 */ +/* extracted from /usr/local/gnu/share/autogen/optcode.tpl near line 501 */ #if defined(ENABLE_NLS) # define OPTPROC_BASE OPTPROC_TRANSLATE @@ -440,6 +438,9 @@ tSCC zFullVersion[] = NTPQ_FULL_VERSION; # define translate_option_strings NULL #endif /* ENABLE_NLS */ + +#define ntpq_full_usage NULL +#define ntpq_short_usage NULL tOptions ntpqOptions = { OPTIONS_STRUCT_VERSION, 0, NULL, /* original argc + argv */ @@ -448,8 +449,7 @@ tOptions ntpqOptions = { + OPTPROC_SHORTOPT + OPTPROC_LONGOPT + OPTPROC_NO_REQ_OPT - + OPTPROC_ENVIRON - + OPTPROC_HAS_IMMED ), + + OPTPROC_ENVIRON ), 0, NULL, /* current option index, current option */ NULL, NULL, zPROGNAME, zRcName, zCopyright, zCopyrightNotice, @@ -462,12 +462,14 @@ tOptions ntpqOptions = { /* * Indexes to special options */ - { INDEX_OPT_MORE_HELP, - INDEX_OPT_SAVE_OPTS, - NO_EQUIVALENT /* index of '-#' option */, + { INDEX_OPT_MORE_HELP, /* more-help option index */ + INDEX_OPT_SAVE_OPTS, /* save option index */ + NO_EQUIVALENT, /* '-#' option index */ NO_EQUIVALENT /* index of default opt */ }, - 13 /* full option count */, 8 /* user option count */ + 13 /* full option count */, 8 /* user option count */, + ntpq_full_usage, ntpq_short_usage, + NULL, NULL }; /* @@ -478,45 +480,41 @@ doUsageOpt( tOptions* pOptions, tOptDesc* pOptDesc ) { + (void)pOptions; USAGE( EXIT_SUCCESS ); } #if ! defined(TEST_NTPQ_OPTS) -/* * * * * * * +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * For the set-debug-level option, when DEBUG is #define-d. */ #ifdef DEBUG static void -doOptSet_Debug_Level( - tOptions* pOptions, - tOptDesc* pOptDesc ) +doOptSet_Debug_Level(tOptions* pOptions, tOptDesc* pOptDesc) { /* extracted from ../include/debug-opt.def, line 29 */ DESC(DEBUG_LEVEL).optOccCt = atoi( pOptDesc->pzLastArg ); } #endif /* defined DEBUG */ - #endif /* defined(TEST_NTPQ_OPTS) */ - -/* extracted from /usr/local/gnu/share/autogen/optmain.tpl near line 92 */ +/* extracted from /usr/local/gnu/share/autogen/optmain.tpl near line 109 */ #if defined(TEST_NTPQ_OPTS) /* TEST MAIN PROCEDURE: */ +extern void optionPutShell( tOptions* ); + int -main( int argc, char** argv ) +main(int argc, char** argv) { int res = EXIT_SUCCESS; (void)optionProcess( &ntpqOptions, argc, argv ); - { - void optionPutShell( tOptions* ); - optionPutShell( &ntpqOptions ); - } + optionPutShell( &ntpqOptions ); return res; } #endif /* defined TEST_NTPQ_OPTS */ -/* extracted from /usr/local/gnu/share/autogen/optcode.tpl near line 514 */ +/* extracted from /usr/local/gnu/share/autogen/optcode.tpl near line 633 */ #if ENABLE_NLS #include @@ -559,44 +557,45 @@ translate_option_strings( void ) * Guard against re-translation. It won't work. The strings will have * been changed by the first pass through this code. One shot only. */ - if (option_usage_text.field_ct == 0) - return; - /* - * Do the translations. The first pointer follows the field count field. - * The field count field is the size of a pointer. - */ - { - char** ppz = (char**)(void*)&(option_usage_text); - int ix = option_usage_text.field_ct; + if (option_usage_text.field_ct != 0) { + + /* + * Do the translations. The first pointer follows the field count + * field. The field count field is the size of a pointer. + */ + tOptDesc* pOD = ntpqOptions.pOptDesc; + char** ppz = (char**)(void*)&(option_usage_text); + int ix = option_usage_text.field_ct; do { ppz++; *ppz = AO_gettext(*ppz); } while (--ix > 0); + + COERSION(pzCopyright); + COERSION(pzCopyNotice); + COERSION(pzFullVersion); + COERSION(pzUsageTitle); + COERSION(pzExplain); + COERSION(pzDetail); + option_usage_text.field_ct = 0; + + for (ix = ntpqOptions.optCt; ix > 0; ix--, pOD++) + coerce_it((void*)&(pOD->pzText)); } - option_usage_text.field_ct = 0; - { + if ((ntpqOptions.fOptSet & OPTPROC_NXLAT_OPT_CFG) == 0) { tOptDesc* pOD = ntpqOptions.pOptDesc; - int ix = ntpqOptions.optCt; - - for (;;) { - pOD->pzText = AO_gettext(pOD->pzText); - pOD->pz_NAME = AO_gettext(pOD->pz_NAME); - pOD->pz_Name = AO_gettext(pOD->pz_Name); - pOD->pz_DisableName = AO_gettext(pOD->pz_DisableName); - pOD->pz_DisablePfx = AO_gettext(pOD->pz_DisablePfx); - if (--ix <= 0) - break; - pOD++; + int ix; + + for (ix = ntpqOptions.optCt; ix > 0; ix--, pOD++) { + coerce_it((void*)&(pOD->pz_Name)); + coerce_it((void*)&(pOD->pz_DisableName)); + coerce_it((void*)&(pOD->pz_DisablePfx)); } + /* prevent re-translation */ + ntpqOptions.fOptSet |= OPTPROC_NXLAT_OPT_CFG | OPTPROC_NXLAT_OPT; } - COERSION(pzCopyright); - COERSION(pzCopyNotice); - COERSION(pzFullVersion); - COERSION(pzUsageTitle); - COERSION(pzExplain); - COERSION(pzDetail); } #endif /* ENABLE_NLS */ diff --git a/ntpq/ntpq-opts.h b/ntpq/ntpq-opts.h index c8356369f..f1865405b 100644 --- a/ntpq/ntpq-opts.h +++ b/ntpq/ntpq-opts.h @@ -1,11 +1,11 @@ /* * EDIT THIS FILE WITH CAUTION (ntpq-opts.h) * - * It has been AutoGen-ed Thursday July 16, 2009 at 07:46:05 AM EDT + * It has been AutoGen-ed Monday July 20, 2009 at 05:12:09 AM EDT * From the definitions ntpq-opts.def * and the template file options * - * Generated from AutoOpts 29:0:4 templates. + * Generated from AutoOpts 32:1:7 templates. */ /* @@ -30,7 +30,7 @@ * "AutoOpts" chapter. Please refer to that doc for usage help. */ #ifndef AUTOOPTS_NTPQ_OPTS_H_GUARD -#define AUTOOPTS_NTPQ_OPTS_H_GUARD +#define AUTOOPTS_NTPQ_OPTS_H_GUARD 1 #include "config.h" #include @@ -41,7 +41,7 @@ * tolerable version is at least as old as what was current when the header * template was released. */ -#define AO_TEMPLATE_VERSION 118784 +#define AO_TEMPLATE_VERSION 131073 #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \ || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION) # error option template version mismatches autoopts/options.h header @@ -52,19 +52,19 @@ * Enumeration of each option: */ typedef enum { - INDEX_OPT_IPV4 = 0, - INDEX_OPT_IPV6 = 1, - INDEX_OPT_COMMAND = 2, - INDEX_OPT_DEBUG_LEVEL = 3, - INDEX_OPT_SET_DEBUG_LEVEL = 4, - INDEX_OPT_PEERS = 5, - INDEX_OPT_INTERACTIVE = 6, - INDEX_OPT_NUMERIC = 7, - INDEX_OPT_VERSION = 8, - INDEX_OPT_HELP = 9, - INDEX_OPT_MORE_HELP = 10, - INDEX_OPT_SAVE_OPTS = 11, - INDEX_OPT_LOAD_OPTS = 12 + INDEX_OPT_IPV4 = 0, + INDEX_OPT_IPV6 = 1, + INDEX_OPT_COMMAND = 2, + INDEX_OPT_DEBUG_LEVEL = 3, + INDEX_OPT_SET_DEBUG_LEVEL = 4, + INDEX_OPT_PEERS = 5, + INDEX_OPT_INTERACTIVE = 6, + INDEX_OPT_NUMERIC = 7, + INDEX_OPT_VERSION = 8, + INDEX_OPT_HELP = 9, + INDEX_OPT_MORE_HELP = 10, + INDEX_OPT_SAVE_OPTS = 11, + INDEX_OPT_LOAD_OPTS = 12 } teOptIndex; #define OPTION_CT 13 @@ -139,7 +139,8 @@ typedef enum { # undef NUMERIC #endif /* NO_OPTION_NAME_WARNINGS */ -/* +/* * * * * * + * * Interface defines for specific options. */ #define VALUE_OPT_IPV4 '4' @@ -156,10 +157,9 @@ typedef enum { #define VALUE_OPT_PEERS 'p' #define VALUE_OPT_INTERACTIVE 'i' #define VALUE_OPT_NUMERIC 'n' - -#define VALUE_OPT_VERSION INDEX_OPT_VERSION #define VALUE_OPT_HELP '?' #define VALUE_OPT_MORE_HELP '!' +#define VALUE_OPT_VERSION INDEX_OPT_VERSION #define VALUE_OPT_SAVE_OPTS '>' #define VALUE_OPT_LOAD_OPTS '<' #define SET_OPT_SAVE_OPTS(a) STMTS( \ @@ -176,7 +176,7 @@ typedef enum { ntpqOptions.pzCurOpt = NULL ) #define START_OPT RESTART_OPT(1) #define USAGE(c) (*ntpqOptions.pUsageProc)( &ntpqOptions, c ) -/* extracted from /usr/local/gnu/share/autogen/opthead.tpl near line 360 */ +/* extracted from /usr/local/gnu/share/autogen/opthead.tpl near line 409 */ /* * * * * * * @@ -188,18 +188,37 @@ extern "C" { extern tOptions ntpqOptions; -#ifndef _ -# if ENABLE_NLS -# include - static inline char* aoGetsText( char const* pz ) { - if (pz == NULL) return NULL; - return (char*)gettext( pz ); - } -# define _(s) aoGetsText(s) -# else /* ENABLE_NLS */ -# define _(s) s -# endif /* ENABLE_NLS */ -#endif +#if defined(ENABLE_NLS) +# ifndef _ +# include + static inline char* aoGetsText( char const* pz ) { + if (pz == NULL) return NULL; + return (char*)gettext( pz ); + } +# define _(s) aoGetsText(s) +# endif /* _() */ + +# define OPT_NO_XLAT_CFG_NAMES STMTS(ntpqOptions.fOptSet |= \ + OPTPROC_NXLAT_OPT_CFG;) +# define OPT_NO_XLAT_OPT_NAMES STMTS(ntpqOptions.fOptSet |= \ + OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;) + +# define OPT_XLAT_CFG_NAMES STMTS(ntpqOptions.fOptSet &= \ + ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);) +# define OPT_XLAT_OPT_NAMES STMTS(ntpqOptions.fOptSet &= \ + ~OPTPROC_NXLAT_OPT;) + +#else /* ENABLE_NLS */ +# define OPT_NO_XLAT_CFG_NAMES +# define OPT_NO_XLAT_OPT_NAMES + +# define OPT_XLAT_CFG_NAMES +# define OPT_XLAT_OPT_NAMES + +# ifndef _ +# define _(_s) _s +# endif +#endif /* ENABLE_NLS */ #ifdef __cplusplus } diff --git a/ntpq/ntpq-opts.texi b/ntpq/ntpq-opts.texi index c61c823e0..7e2477803 100644 --- a/ntpq/ntpq-opts.texi +++ b/ntpq/ntpq-opts.texi @@ -6,7 +6,7 @@ # # EDIT THIS FILE WITH CAUTION (ntpq-opts.texi) # -# It has been AutoGen-ed Thursday July 16, 2009 at 07:46:08 AM EDT +# It has been AutoGen-ed Monday July 20, 2009 at 05:12:12 AM EDT # From the definitions ntpq-opts.def # and the template file aginfo.tpl @end ignore @@ -79,7 +79,7 @@ or by a single hyphen and the flag character. The following option preset mechanisms are supported: - reading file /users/stenn/.ntprc - - reading file /deacon/backroom/snaps/ntp-dev/ntpq/.ntprc + - reading file /deacon/backroom/ntp-dev/ntpq/.ntprc - examining environment variables named NTPQ_* The diff --git a/ntpq/ntpq.1 b/ntpq/ntpq.1 index ca57bbc45..27406441b 100644 --- a/ntpq/ntpq.1 +++ b/ntpq/ntpq.1 @@ -1,7 +1,7 @@ -.TH NTPQ 1 2009-07-16 "( 4.2.5p189)" "Programmer's Manual" +.TH NTPQ 1 2009-07-20 "( 4.2.5p189)" "Programmer's Manual" .\" EDIT THIS FILE WITH CAUTION (ntpq.1) .\" -.\" It has been AutoGen-ed Thursday July 16, 2009 at 07:46:07 AM EDT +.\" It has been AutoGen-ed Monday July 20, 2009 at 05:12:11 AM EDT .\" From the definitions ntpq-opts.def .\" and the template file agman1.tpl .\" @@ -15,7 +15,7 @@ ntpq \- standard NTP query program .in +8 [ host ...] .SH "DESCRIPTION" -This manual page documents, briefly, the \fBntpq\fP command. +This manual page briefly documents the \fBntpq\fP command. The [= prog-name =] utility program is used to query NTP servers which @@ -363,7 +363,7 @@ environment variables named: .nf \fBNTPQ_\fP or \fBNTPQ\fP .fi -.aj +.ad The environmental presets take precedence (are processed later than) the configuration files. The \fIhomerc\fP files are "\fI$HOME\fP", and "\fI.\fP". diff --git a/sntp/sntp-opts.c b/sntp/sntp-opts.c index 470c92ee3..05b81c3d8 100644 --- a/sntp/sntp-opts.c +++ b/sntp/sntp-opts.c @@ -1,11 +1,11 @@ /* * EDIT THIS FILE WITH CAUTION (sntp-opts.c) * - * It has been AutoGen-ed Thursday July 16, 2009 at 07:52:45 AM EDT + * It has been AutoGen-ed Monday July 20, 2009 at 05:15:22 AM EDT * From the definitions sntp-opts.def * and the template file options * - * Generated from AutoOpts 29:0:4 templates. + * Generated from AutoOpts 32:1:7 templates. */ /* @@ -103,8 +103,10 @@ * October 2000 */ - +#include #include +#include +#include #define OPTION_CODE_COMPILE 1 #include "sntp-opts.h" @@ -112,29 +114,31 @@ #ifdef __cplusplus extern "C" { #endif + +/* TRANSLATORS: choose the translation for option names wisely because you + cannot ever change your mind. */ tSCC zCopyright[] = - "sntp copyright (c) 1970-2006 ntp.org, all rights reserved"; -tSCC zCopyrightNotice[] = - + "sntp copyright (c) 1970-2006 ntp.org, all rights reserved" /* extracted from sntp-opts.def near line 12 */ -" General Public Licence for the software known as MSNTP\n\ - ------------------------------------------------------\n\n\ -\t (c) Copyright, N.M. Maclaren, 1996, 1997, 2000\n\ -\t (c) Copyright, University of Cambridge, 1996, 1997, 2000\n\n\n\n\ +; +tSCC zCopyrightNotice[3602] = +"General Public Licence for the software known as MSNTP\n\ +------------------------------------------------------\n\n\ +(c) Copyright, N.M. Maclaren, 1996, 1997, 2000 (c) Copyright, University of\n\ +Cambridge, 1996, 1997, 2000\n\n\n\n\ Free use of MSNTP in source and binary forms is permitted, provided that this\n\ entire licence is duplicated in all copies, and that any documentation,\n\ announcements, and other materials related to use acknowledge that the software\n\ -was developed by N.M. Maclaren (hereafter refered to as the Author) at the\n\ +was developed by N.M. Maclaren (hereafter refered to as the Author) at the\n\ University of Cambridge. Neither the name of the Author nor the University of\n\ Cambridge may be used to endorse or promote products derived from this material\n\ without specific prior written permission.\n\n\ The Author and the University of Cambridge retain the copyright and all other\n\ legal rights to the software and make it available non-exclusively. All users\n\ must ensure that the software in all its derivations carries a copyright notice\n\ -in the form:\n\ -\t (c) Copyright N.M. Maclaren,\n\ -\t (c) Copyright University of Cambridge.\n\n\n\n\ - NO WARRANTY\n\n\ +in the form: (c) Copyright N.M. Maclaren, (c) Copyright University of\n\ +Cambridge.\n\n\n\n\ +NO WARRANTY\n\n\ Because the MSNTP software is licensed free of charge, the Author and the\n\ University of Cambridge provide absolutely no warranty, either expressed or\n\ implied, including, but not limited to, the implied warranties of\n\ @@ -147,34 +151,33 @@ permitted in accordance with the provisions below, be liable for damages for\n\ any losses whatsoever, including but not limited to lost profits, lost monies,\n\ lost or corrupted data, or other special, incidental or consequential losses\n\ that may arise out of the use or inability to use the MSNTP software.\n\n\n\n\ - COPYING POLICY\n\n\ +COPYING POLICY\n\n\ Permission is hereby granted for copying and distribution of copies of the\n\ MSNTP source and binary files, and of any part thereof, subject to the\n\ following licence conditions:\n\n\ -1. You may distribute MSNTP or components of MSNTP, with or without additions\n\ +1. You may distribute MSNTP or components of MSNTP, with or without additions\n\ developed by you or by others. No charge, other than an \"at-cost\" distribution\n\ fee, may be charged for copies, derivations, or distributions of this material\n\ without the express written consent of the copyright holders.\n\n\ -2. You may also distribute MSNTP along with any other product for sale,\n\ +2. You may also distribute MSNTP along with any other product for sale,\n\ provided that the cost of the bundled package is the same regardless of whether\n\ MSNTP is included or not, and provided that those interested only in MSNTP must\n\ be notified that it is a product freely available from the University of\n\ Cambridge.\n\n\ -3. If you distribute MSNTP software or parts of MSNTP, with or without\n\ +3. If you distribute MSNTP software or parts of MSNTP, with or without\n\ additions developed by you or others, then you must either make available the\n\ source to all portions of the MSNTP system (exclusive of any additions made by\n\ you or by others) upon request, or instead you may notify anyone requesting\n\ source that it is freely available from the University of Cambridge.\n\n\ -4. You may not omit any of the copyright notices on either the source files,\n\ +4. You may not omit any of the copyright notices on either the source files,\n\ the executable files, or the documentation.\n\n\ -5. You may not omit transmission of this License agreement with whatever\n\ +5. You may not omit transmission of this License agreement with whatever\n\ portions of MSNTP that are distributed.\n\n\ -6. Any users of this software must be notified that it is without warranty or\n\ +6. Any users of this software must be notified that it is without warranty or\n\ guarantee of any nature, express or implied, nor is there any fitness for use\n\ represented.\n\n\n\ -October 1996\n\ -April 1997\n\ -October 2000"; +October 1996 April 1997 October 2000"; + extern tUsageProc optionUsage; #ifndef NULL @@ -284,24 +287,16 @@ static const int /* * Help/More_Help/Version option descriptions: */ -tSCC zHelpText[] = "Display usage information and exit"; -tSCC zHelp_Name[] = "help"; - -tSCC zMore_HelpText[] = "Extended usage information passed thru pager"; -tSCC zMore_Help_Name[] = "more-help"; - -tSCC zVersionText[] = "Output version information and exit"; -tSCC zVersion_Name[] = "version"; - -/* - * Save/Load_Opts option description: - */ +tSCC zHelpText[] = "Display usage information and exit"; +tSCC zHelp_Name[] = "help"; +tSCC zMore_HelpText[] = "Extended usage information passed thru pager"; +tSCC zMore_Help_Name[] = "more-help"; +tSCC zVersionText[] = "Output version information and exit"; +tSCC zVersion_Name[] = "version"; tSCC zSave_OptsText[] = "Save the option state to a config file"; tSCC zSave_Opts_Name[] = "save-opts"; - tSCC zLoad_OptsText[] = "Load options from a config file"; tSCC zLoad_Opts_NAME[] = "LOAD_OPTS"; - tSCC zNotLoad_Opts_Name[] = "no-load-opts"; tSCC zNotLoad_Opts_Pfx[] = "no"; #define zLoad_Opts_Name (zNotLoad_Opts_Name + 3) @@ -497,7 +492,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* equiv idx value */ NO_EQUIVALENT, 0, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, NOLIMIT, 0, - /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) \ + /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | OPTST_DISABLE_IMM, 0, /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, @@ -533,7 +528,7 @@ job.\n\ NTP is the Network Time Protocol (RFC 1305) and SNTP is the\n\ Simple Network Time Protocol (RFC 2030, which supersedes RFC 1769).\n"; tSCC zFullVersion[] = SNTP_FULL_VERSION; -/* extracted from /usr/local/gnu/share/autogen/optcode.tpl near line 408 */ +/* extracted from /usr/local/gnu/share/autogen/optcode.tpl near line 501 */ #if defined(ENABLE_NLS) # define OPTPROC_BASE OPTPROC_TRANSLATE @@ -543,6 +538,9 @@ tSCC zFullVersion[] = SNTP_FULL_VERSION; # define translate_option_strings NULL #endif /* ENABLE_NLS */ + +#define sntp_full_usage NULL +#define sntp_short_usage NULL tOptions sntpOptions = { OPTIONS_STRUCT_VERSION, 0, NULL, /* original argc + argv */ @@ -552,8 +550,7 @@ tOptions sntpOptions = { + OPTPROC_LONGOPT + OPTPROC_NO_REQ_OPT + OPTPROC_ENVIRON - + OPTPROC_NO_ARGS - + OPTPROC_HAS_IMMED ), + + OPTPROC_NO_ARGS ), 0, NULL, /* current option index, current option */ NULL, NULL, zPROGNAME, zRcName, zCopyright, zCopyrightNotice, @@ -566,12 +563,14 @@ tOptions sntpOptions = { /* * Indexes to special options */ - { INDEX_OPT_MORE_HELP, - INDEX_OPT_SAVE_OPTS, - NO_EQUIVALENT /* index of '-#' option */, + { INDEX_OPT_MORE_HELP, /* more-help option index */ + INDEX_OPT_SAVE_OPTS, /* save option index */ + NO_EQUIVALENT, /* '-#' option index */ NO_EQUIVALENT /* index of default opt */ }, - 13 /* full option count */, 8 /* user option count */ + 13 /* full option count */, 8 /* user option count */, + sntp_full_usage, sntp_short_usage, + NULL, NULL }; /* @@ -582,25 +581,25 @@ doUsageOpt( tOptions* pOptions, tOptDesc* pOptDesc ) { + (void)pOptions; USAGE( EXIT_SUCCESS ); } -/* extracted from /usr/local/gnu/share/autogen/optmain.tpl near line 92 */ +/* extracted from /usr/local/gnu/share/autogen/optmain.tpl near line 109 */ #if defined(TEST_SNTP_OPTS) /* TEST MAIN PROCEDURE: */ +extern void optionPutShell( tOptions* ); + int -main( int argc, char** argv ) +main(int argc, char** argv) { int res = EXIT_SUCCESS; (void)optionProcess( &sntpOptions, argc, argv ); - { - void optionPutShell( tOptions* ); - optionPutShell( &sntpOptions ); - } + optionPutShell( &sntpOptions ); return res; } #endif /* defined TEST_SNTP_OPTS */ -/* extracted from /usr/local/gnu/share/autogen/optcode.tpl near line 514 */ +/* extracted from /usr/local/gnu/share/autogen/optcode.tpl near line 633 */ #if ENABLE_NLS #include @@ -643,44 +642,45 @@ translate_option_strings( void ) * Guard against re-translation. It won't work. The strings will have * been changed by the first pass through this code. One shot only. */ - if (option_usage_text.field_ct == 0) - return; - /* - * Do the translations. The first pointer follows the field count field. - * The field count field is the size of a pointer. - */ - { - char** ppz = (char**)(void*)&(option_usage_text); - int ix = option_usage_text.field_ct; + if (option_usage_text.field_ct != 0) { + + /* + * Do the translations. The first pointer follows the field count + * field. The field count field is the size of a pointer. + */ + tOptDesc* pOD = sntpOptions.pOptDesc; + char** ppz = (char**)(void*)&(option_usage_text); + int ix = option_usage_text.field_ct; do { ppz++; *ppz = AO_gettext(*ppz); } while (--ix > 0); + + COERSION(pzCopyright); + COERSION(pzCopyNotice); + COERSION(pzFullVersion); + COERSION(pzUsageTitle); + COERSION(pzExplain); + COERSION(pzDetail); + option_usage_text.field_ct = 0; + + for (ix = sntpOptions.optCt; ix > 0; ix--, pOD++) + coerce_it((void*)&(pOD->pzText)); } - option_usage_text.field_ct = 0; - { + if ((sntpOptions.fOptSet & OPTPROC_NXLAT_OPT_CFG) == 0) { tOptDesc* pOD = sntpOptions.pOptDesc; - int ix = sntpOptions.optCt; - - for (;;) { - pOD->pzText = AO_gettext(pOD->pzText); - pOD->pz_NAME = AO_gettext(pOD->pz_NAME); - pOD->pz_Name = AO_gettext(pOD->pz_Name); - pOD->pz_DisableName = AO_gettext(pOD->pz_DisableName); - pOD->pz_DisablePfx = AO_gettext(pOD->pz_DisablePfx); - if (--ix <= 0) - break; - pOD++; + int ix; + + for (ix = sntpOptions.optCt; ix > 0; ix--, pOD++) { + coerce_it((void*)&(pOD->pz_Name)); + coerce_it((void*)&(pOD->pz_DisableName)); + coerce_it((void*)&(pOD->pz_DisablePfx)); } + /* prevent re-translation */ + sntpOptions.fOptSet |= OPTPROC_NXLAT_OPT_CFG | OPTPROC_NXLAT_OPT; } - COERSION(pzCopyright); - COERSION(pzCopyNotice); - COERSION(pzFullVersion); - COERSION(pzUsageTitle); - COERSION(pzExplain); - COERSION(pzDetail); } #endif /* ENABLE_NLS */ diff --git a/sntp/sntp-opts.h b/sntp/sntp-opts.h index 70f39f592..c7d4e6f15 100644 --- a/sntp/sntp-opts.h +++ b/sntp/sntp-opts.h @@ -1,11 +1,11 @@ /* * EDIT THIS FILE WITH CAUTION (sntp-opts.h) * - * It has been AutoGen-ed Thursday July 16, 2009 at 07:52:44 AM EDT + * It has been AutoGen-ed Monday July 20, 2009 at 05:15:21 AM EDT * From the definitions sntp-opts.def * and the template file options * - * Generated from AutoOpts 29:0:4 templates. + * Generated from AutoOpts 32:1:7 templates. */ /* @@ -109,7 +109,7 @@ * "AutoOpts" chapter. Please refer to that doc for usage help. */ #ifndef AUTOOPTS_SNTP_OPTS_H_GUARD -#define AUTOOPTS_SNTP_OPTS_H_GUARD +#define AUTOOPTS_SNTP_OPTS_H_GUARD 1 #include "config.h" #include @@ -120,7 +120,7 @@ * tolerable version is at least as old as what was current when the header * template was released. */ -#define AO_TEMPLATE_VERSION 118784 +#define AO_TEMPLATE_VERSION 131073 #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \ || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION) # error option template version mismatches autoopts/options.h header @@ -131,19 +131,19 @@ * Enumeration of each option: */ typedef enum { - INDEX_OPT_IPV4 = 0, - INDEX_OPT_IPV6 = 1, - INDEX_OPT_UNPRIVPORT = 2, - INDEX_OPT_NORMALVERBOSE = 3, - INDEX_OPT_EXTRAVERBOSE = 4, - INDEX_OPT_MEGAVERBOSE = 5, - INDEX_OPT_SETTIMEOFDAY = 6, - INDEX_OPT_ADJTIME = 7, - INDEX_OPT_VERSION = 8, - INDEX_OPT_HELP = 9, - INDEX_OPT_MORE_HELP = 10, - INDEX_OPT_SAVE_OPTS = 11, - INDEX_OPT_LOAD_OPTS = 12 + INDEX_OPT_IPV4 = 0, + INDEX_OPT_IPV6 = 1, + INDEX_OPT_UNPRIVPORT = 2, + INDEX_OPT_NORMALVERBOSE = 3, + INDEX_OPT_EXTRAVERBOSE = 4, + INDEX_OPT_MEGAVERBOSE = 5, + INDEX_OPT_SETTIMEOFDAY = 6, + INDEX_OPT_ADJTIME = 7, + INDEX_OPT_VERSION = 8, + INDEX_OPT_HELP = 9, + INDEX_OPT_MORE_HELP = 10, + INDEX_OPT_SAVE_OPTS = 11, + INDEX_OPT_LOAD_OPTS = 12 } teOptIndex; #define OPTION_CT 13 @@ -218,7 +218,8 @@ typedef enum { # undef ADJTIME #endif /* NO_OPTION_NAME_WARNINGS */ -/* +/* * * * * * + * * Interface defines for specific options. */ #define VALUE_OPT_IPV4 '4' @@ -231,10 +232,9 @@ typedef enum { #define VALUE_OPT_MEGAVERBOSE 'W' #define VALUE_OPT_SETTIMEOFDAY 'r' #define VALUE_OPT_ADJTIME 'a' - -#define VALUE_OPT_VERSION 'v' #define VALUE_OPT_HELP '?' #define VALUE_OPT_MORE_HELP '!' +#define VALUE_OPT_VERSION 'v' #define VALUE_OPT_SAVE_OPTS '>' #define VALUE_OPT_LOAD_OPTS '<' #define SET_OPT_SAVE_OPTS(a) STMTS( \ @@ -251,7 +251,7 @@ typedef enum { sntpOptions.pzCurOpt = NULL ) #define START_OPT RESTART_OPT(1) #define USAGE(c) (*sntpOptions.pUsageProc)( &sntpOptions, c ) -/* extracted from /usr/local/gnu/share/autogen/opthead.tpl near line 360 */ +/* extracted from /usr/local/gnu/share/autogen/opthead.tpl near line 409 */ /* * * * * * * @@ -263,18 +263,37 @@ extern "C" { extern tOptions sntpOptions; -#ifndef _ -# if ENABLE_NLS -# include - static inline char* aoGetsText( char const* pz ) { - if (pz == NULL) return NULL; - return (char*)gettext( pz ); - } -# define _(s) aoGetsText(s) -# else /* ENABLE_NLS */ -# define _(s) s -# endif /* ENABLE_NLS */ -#endif +#if defined(ENABLE_NLS) +# ifndef _ +# include + static inline char* aoGetsText( char const* pz ) { + if (pz == NULL) return NULL; + return (char*)gettext( pz ); + } +# define _(s) aoGetsText(s) +# endif /* _() */ + +# define OPT_NO_XLAT_CFG_NAMES STMTS(sntpOptions.fOptSet |= \ + OPTPROC_NXLAT_OPT_CFG;) +# define OPT_NO_XLAT_OPT_NAMES STMTS(sntpOptions.fOptSet |= \ + OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;) + +# define OPT_XLAT_CFG_NAMES STMTS(sntpOptions.fOptSet &= \ + ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);) +# define OPT_XLAT_OPT_NAMES STMTS(sntpOptions.fOptSet &= \ + ~OPTPROC_NXLAT_OPT;) + +#else /* ENABLE_NLS */ +# define OPT_NO_XLAT_CFG_NAMES +# define OPT_NO_XLAT_OPT_NAMES + +# define OPT_XLAT_CFG_NAMES +# define OPT_XLAT_OPT_NAMES + +# ifndef _ +# define _(_s) _s +# endif +#endif /* ENABLE_NLS */ #ifdef __cplusplus } diff --git a/sntp/sntp-opts.texi b/sntp/sntp-opts.texi index c81a565a7..83b07389e 100644 --- a/sntp/sntp-opts.texi +++ b/sntp/sntp-opts.texi @@ -6,7 +6,7 @@ # # EDIT THIS FILE WITH CAUTION (sntp-opts.texi) # -# It has been AutoGen-ed Thursday July 16, 2009 at 07:52:47 AM EDT +# It has been AutoGen-ed Monday July 20, 2009 at 05:15:24 AM EDT # From the definitions sntp-opts.def # and the template file aginfo.tpl @end ignore diff --git a/sntp/sntp.1 b/sntp/sntp.1 index 6b04c0ee1..b2ca122e0 100644 --- a/sntp/sntp.1 +++ b/sntp/sntp.1 @@ -1,7 +1,7 @@ -.TH SNTP 1 2009-07-16 "( 4.2.5p189)" "Programmer's Manual" +.TH SNTP 1 2009-07-20 "( 4.2.5p189)" "Programmer's Manual" .\" EDIT THIS FILE WITH CAUTION (sntp.1) .\" -.\" It has been AutoGen-ed Thursday July 16, 2009 at 07:52:46 AM EDT +.\" It has been AutoGen-ed Monday July 20, 2009 at 05:15:22 AM EDT .\" From the definitions sntp-opts.def .\" and the template file agman1.tpl .\" @@ -14,7 +14,7 @@ sntp \- standard SNTP program .PP All arguments must be options. .SH "DESCRIPTION" -This manual page documents, briefly, the \fBsntp\fP command. +This manual page briefly documents the \fBsntp\fP command. .I sntp can be used as a SNTP client to query a NTP or SNTP server and either display the time or set the local system's time (given suitable privilege). It can be @@ -299,7 +299,7 @@ environment variables named: .nf \fBSNTP_\fP or \fBSNTP\fP .fi -.aj +.ad The environmental presets take precedence (are processed later than) the configuration files. The \fIhomerc\fP files are "\fI$HOME\fP", and "\fI.\fP". diff --git a/util/ntp-keygen-opts.c b/util/ntp-keygen-opts.c index 0898540b7..01dd94f23 100644 --- a/util/ntp-keygen-opts.c +++ b/util/ntp-keygen-opts.c @@ -1,11 +1,11 @@ /* * EDIT THIS FILE WITH CAUTION (ntp-keygen-opts.c) * - * It has been AutoGen-ed Thursday July 16, 2009 at 07:52:54 AM EDT + * It has been AutoGen-ed Monday July 20, 2009 at 05:16:04 AM EDT * From the definitions ntp-keygen-opts.def * and the template file options * - * Generated from AutoOpts 29:0:4 templates. + * Generated from AutoOpts 32:1:7 templates. */ /* @@ -24,21 +24,28 @@ * see html/copyright.html */ - +#include #include #include +#include +#include +extern FILE * option_usage_fp; #define OPTION_CODE_COMPILE 1 #include "ntp-keygen-opts.h" #ifdef __cplusplus extern "C" { #endif + +/* TRANSLATORS: choose the translation for option names wisely because you + cannot ever change your mind. */ tSCC zCopyright[] = - "ntp-keygen copyright (c) 1970-2009 David L. Mills and/or others, all rights reserved"; -tSCC zCopyrightNotice[] = - + "ntp-keygen copyright (c) 1970-2009 David L. Mills and/or others, all rights reserved" /* extracted from ../include/copyright.def near line 8 */ +; +tSCC zCopyrightNotice[24] = "see html/copyright.html"; + extern tUsageProc optionUsage; /* @@ -388,24 +395,16 @@ tSCC zMv_Keys_Name[] = "mv-keys"; /* * Help/More_Help/Version option descriptions: */ -tSCC zHelpText[] = "Display usage information and exit"; -tSCC zHelp_Name[] = "help"; - -tSCC zMore_HelpText[] = "Extended usage information passed thru pager"; -tSCC zMore_Help_Name[] = "more-help"; - -tSCC zVersionText[] = "Output version information and exit"; -tSCC zVersion_Name[] = "version"; - -/* - * Save/Load_Opts option description: - */ +tSCC zHelpText[] = "Display usage information and exit"; +tSCC zHelp_Name[] = "help"; +tSCC zMore_HelpText[] = "Extended usage information passed thru pager"; +tSCC zMore_Help_Name[] = "more-help"; +tSCC zVersionText[] = "Output version information and exit"; +tSCC zVersion_Name[] = "version"; tSCC zSave_OptsText[] = "Save the option state to a config file"; tSCC zSave_Opts_Name[] = "save-opts"; - tSCC zLoad_OptsText[] = "Load options from a config file"; tSCC zLoad_Opts_NAME[] = "LOAD_OPTS"; - tSCC zNotLoad_Opts_Name[] = "no-load-opts"; tSCC zNotLoad_Opts_Pfx[] = "no"; #define zLoad_Opts_Name (zNotLoad_Opts_Name + 3) @@ -754,7 +753,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* equiv idx value */ NO_EQUIVALENT, 0, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, NOLIMIT, 0, - /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) \ + /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | OPTST_DISABLE_IMM, 0, /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, @@ -784,7 +783,7 @@ tSCC zDetail[] = "\n\ If there is no new host key, look for an existing one.\n\ If one is not found, create it.\n"; tSCC zFullVersion[] = NTP_KEYGEN_FULL_VERSION; -/* extracted from /usr/local/gnu/share/autogen/optcode.tpl near line 408 */ +/* extracted from /usr/local/gnu/share/autogen/optcode.tpl near line 501 */ #if defined(ENABLE_NLS) # define OPTPROC_BASE OPTPROC_TRANSLATE @@ -794,6 +793,9 @@ tSCC zFullVersion[] = NTP_KEYGEN_FULL_VERSION; # define translate_option_strings NULL #endif /* ENABLE_NLS */ + +#define ntp_keygen_full_usage NULL +#define ntp_keygen_short_usage NULL tOptions ntp_keygenOptions = { OPTIONS_STRUCT_VERSION, 0, NULL, /* original argc + argv */ @@ -803,8 +805,7 @@ tOptions ntp_keygenOptions = { + OPTPROC_LONGOPT + OPTPROC_NO_REQ_OPT + OPTPROC_ENVIRON - + OPTPROC_NO_ARGS - + OPTPROC_HAS_IMMED ), + + OPTPROC_NO_ARGS ), 0, NULL, /* current option index, current option */ NULL, NULL, zPROGNAME, zRcName, zCopyright, zCopyrightNotice, @@ -817,12 +818,14 @@ tOptions ntp_keygenOptions = { /* * Indexes to special options */ - { INDEX_OPT_MORE_HELP, - INDEX_OPT_SAVE_OPTS, - NO_EQUIVALENT /* index of '-#' option */, + { INDEX_OPT_MORE_HELP, /* more-help option index */ + INDEX_OPT_SAVE_OPTS, /* save option index */ + NO_EQUIVALENT, /* '-#' option index */ NO_EQUIVALENT /* index of default opt */ }, - 23 /* full option count */, 18 /* user option count */ + 23 /* full option count */, 18 /* user option count */, + ntp_keygen_full_usage, ntp_keygen_short_usage, + NULL, NULL }; /* @@ -833,98 +836,93 @@ doUsageOpt( tOptions* pOptions, tOptDesc* pOptDesc ) { + (void)pOptions; USAGE( EXIT_SUCCESS ); } #if ! defined(TEST_NTP_KEYGEN_OPTS) -/* * * * * * * +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * For the set-debug-level option, when DEBUG is #define-d. */ #ifdef DEBUG static void -doOptSet_Debug_Level( - tOptions* pOptions, - tOptDesc* pOptDesc ) +doOptSet_Debug_Level(tOptions* pOptions, tOptDesc* pOptDesc) { /* extracted from ../include/debug-opt.def, line 29 */ DESC(DEBUG_LEVEL).optOccCt = atoi( pOptDesc->pzLastArg ); } #endif /* defined DEBUG */ - #endif /* defined(TEST_NTP_KEYGEN_OPTS) */ -/* * * * * * * +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * For the modulus option, when OPENSSL is #define-d. */ #ifdef OPENSSL static void -doOptModulus( - tOptions* pOptions, - tOptDesc* pOptDesc ) +doOptModulus(tOptions* pOptions, tOptDesc* pOptDesc) { - static const struct {const int rmin, rmax;} rng[ 1 ] = { + static const struct {long const rmin, rmax;} rng[1] = { { 256, 2048 } }; - int val; - int ix; - char const* pzIndent = "\t\t\t\t "; - extern FILE* option_usage_fp; + long val; + int ix; + char * pzEnd; - if (pOptDesc == NULL) /* usage is requesting range list - option_usage_fp has already been set */ + if (pOptions <= OPTPROC_EMIT_LIMIT) goto emit_ranges; - val = atoi( pOptDesc->optArg.argString ); + errno = 0; + val = strtol(pOptDesc->optArg.argString, &pzEnd, 0); + if ((pOptDesc->optArg.argString == pzEnd) || (errno != 0)) + goto bad_value; + + if (*pzEnd != '\0') + goto bad_value; for (ix = 0; ix < 1; ix++) { if (val < rng[ix].rmin) continue; /* ranges need not be ordered. */ if (val == rng[ix].rmin) goto valid_return; - if (rng[ix].rmax == INT_MIN) + if (rng[ix].rmax == LONG_MIN) continue; if (val <= rng[ix].rmax) goto valid_return; } + bad_value: + option_usage_fp = stderr; - fprintf(stderr, _("%s error: %s option value ``%s''is out of range.\n"), - pOptions->pzProgName, pOptDesc->pz_Name, pOptDesc->optArg.argString); - pzIndent = "\t"; emit_ranges: - fprintf( option_usage_fp, _("%sit must lie in the range: %d to %d\n"), - pzIndent, rng[0].rmin, rng[0].rmax ); - if (pOptDesc == NULL) - return; - - USAGE( EXIT_FAILURE ); - /* NOTREACHED */ + optionShowRange(pOptions, pOptDesc, (void *)rng, 1); return; valid_return: + if ((pOptDesc->fOptState & OPTST_ALLOC_ARG) != 0) { + free((void *)pOptDesc->optArg.argString); + pOptDesc->fOptState &= ~OPTST_ALLOC_ARG; + } pOptDesc->optArg.argInt = val; } #endif /* defined OPENSSL */ - -/* extracted from /usr/local/gnu/share/autogen/optmain.tpl near line 92 */ +/* extracted from /usr/local/gnu/share/autogen/optmain.tpl near line 109 */ #if defined(TEST_NTP_KEYGEN_OPTS) /* TEST MAIN PROCEDURE: */ +extern void optionPutShell( tOptions* ); + int -main( int argc, char** argv ) +main(int argc, char** argv) { int res = EXIT_SUCCESS; (void)optionProcess( &ntp_keygenOptions, argc, argv ); - { - void optionPutShell( tOptions* ); - optionPutShell( &ntp_keygenOptions ); - } + optionPutShell( &ntp_keygenOptions ); return res; } #endif /* defined TEST_NTP_KEYGEN_OPTS */ -/* extracted from /usr/local/gnu/share/autogen/optcode.tpl near line 514 */ +/* extracted from /usr/local/gnu/share/autogen/optcode.tpl near line 633 */ #if ENABLE_NLS #include @@ -967,44 +965,45 @@ translate_option_strings( void ) * Guard against re-translation. It won't work. The strings will have * been changed by the first pass through this code. One shot only. */ - if (option_usage_text.field_ct == 0) - return; - /* - * Do the translations. The first pointer follows the field count field. - * The field count field is the size of a pointer. - */ - { - char** ppz = (char**)(void*)&(option_usage_text); - int ix = option_usage_text.field_ct; + if (option_usage_text.field_ct != 0) { + + /* + * Do the translations. The first pointer follows the field count + * field. The field count field is the size of a pointer. + */ + tOptDesc* pOD = ntp_keygenOptions.pOptDesc; + char** ppz = (char**)(void*)&(option_usage_text); + int ix = option_usage_text.field_ct; do { ppz++; *ppz = AO_gettext(*ppz); } while (--ix > 0); + + COERSION(pzCopyright); + COERSION(pzCopyNotice); + COERSION(pzFullVersion); + COERSION(pzUsageTitle); + COERSION(pzExplain); + COERSION(pzDetail); + option_usage_text.field_ct = 0; + + for (ix = ntp_keygenOptions.optCt; ix > 0; ix--, pOD++) + coerce_it((void*)&(pOD->pzText)); } - option_usage_text.field_ct = 0; - { + if ((ntp_keygenOptions.fOptSet & OPTPROC_NXLAT_OPT_CFG) == 0) { tOptDesc* pOD = ntp_keygenOptions.pOptDesc; - int ix = ntp_keygenOptions.optCt; - - for (;;) { - pOD->pzText = AO_gettext(pOD->pzText); - pOD->pz_NAME = AO_gettext(pOD->pz_NAME); - pOD->pz_Name = AO_gettext(pOD->pz_Name); - pOD->pz_DisableName = AO_gettext(pOD->pz_DisableName); - pOD->pz_DisablePfx = AO_gettext(pOD->pz_DisablePfx); - if (--ix <= 0) - break; - pOD++; + int ix; + + for (ix = ntp_keygenOptions.optCt; ix > 0; ix--, pOD++) { + coerce_it((void*)&(pOD->pz_Name)); + coerce_it((void*)&(pOD->pz_DisableName)); + coerce_it((void*)&(pOD->pz_DisablePfx)); } + /* prevent re-translation */ + ntp_keygenOptions.fOptSet |= OPTPROC_NXLAT_OPT_CFG | OPTPROC_NXLAT_OPT; } - COERSION(pzCopyright); - COERSION(pzCopyNotice); - COERSION(pzFullVersion); - COERSION(pzUsageTitle); - COERSION(pzExplain); - COERSION(pzDetail); } #endif /* ENABLE_NLS */ diff --git a/util/ntp-keygen-opts.h b/util/ntp-keygen-opts.h index 0f7d0090e..59eb5438c 100644 --- a/util/ntp-keygen-opts.h +++ b/util/ntp-keygen-opts.h @@ -1,11 +1,11 @@ /* * EDIT THIS FILE WITH CAUTION (ntp-keygen-opts.h) * - * It has been AutoGen-ed Thursday July 16, 2009 at 07:52:53 AM EDT + * It has been AutoGen-ed Monday July 20, 2009 at 05:16:03 AM EDT * From the definitions ntp-keygen-opts.def * and the template file options * - * Generated from AutoOpts 29:0:4 templates. + * Generated from AutoOpts 32:1:7 templates. */ /* @@ -30,7 +30,7 @@ * "AutoOpts" chapter. Please refer to that doc for usage help. */ #ifndef AUTOOPTS_NTP_KEYGEN_OPTS_H_GUARD -#define AUTOOPTS_NTP_KEYGEN_OPTS_H_GUARD +#define AUTOOPTS_NTP_KEYGEN_OPTS_H_GUARD 1 #include "config.h" #include @@ -41,7 +41,7 @@ * tolerable version is at least as old as what was current when the header * template was released. */ -#define AO_TEMPLATE_VERSION 118784 +#define AO_TEMPLATE_VERSION 131073 #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \ || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION) # error option template version mismatches autoopts/options.h header @@ -52,29 +52,29 @@ * Enumeration of each option: */ typedef enum { - INDEX_OPT_CERTIFICATE = 0, - INDEX_OPT_DEBUG_LEVEL = 1, - INDEX_OPT_SET_DEBUG_LEVEL = 2, - INDEX_OPT_ID_KEY = 3, - INDEX_OPT_GQ_PARAMS = 4, - INDEX_OPT_HOST_KEY = 5, - INDEX_OPT_IFFKEY = 6, - INDEX_OPT_ISSUER_NAME = 7, - INDEX_OPT_MD5KEY = 8, - INDEX_OPT_MODULUS = 9, - INDEX_OPT_PVT_CERT = 10, - INDEX_OPT_PVT_PASSWD = 11, - INDEX_OPT_GET_PVT_PASSWD = 12, - INDEX_OPT_SIGN_KEY = 13, - INDEX_OPT_SUBJECT_NAME = 14, - INDEX_OPT_TRUSTED_CERT = 15, - INDEX_OPT_MV_PARAMS = 16, - INDEX_OPT_MV_KEYS = 17, - INDEX_OPT_VERSION = 18, - INDEX_OPT_HELP = 19, - INDEX_OPT_MORE_HELP = 20, - INDEX_OPT_SAVE_OPTS = 21, - INDEX_OPT_LOAD_OPTS = 22 + INDEX_OPT_CERTIFICATE = 0, + INDEX_OPT_DEBUG_LEVEL = 1, + INDEX_OPT_SET_DEBUG_LEVEL = 2, + INDEX_OPT_ID_KEY = 3, + INDEX_OPT_GQ_PARAMS = 4, + INDEX_OPT_HOST_KEY = 5, + INDEX_OPT_IFFKEY = 6, + INDEX_OPT_ISSUER_NAME = 7, + INDEX_OPT_MD5KEY = 8, + INDEX_OPT_MODULUS = 9, + INDEX_OPT_PVT_CERT = 10, + INDEX_OPT_PVT_PASSWD = 11, + INDEX_OPT_GET_PVT_PASSWD = 12, + INDEX_OPT_SIGN_KEY = 13, + INDEX_OPT_SUBJECT_NAME = 14, + INDEX_OPT_TRUSTED_CERT = 15, + INDEX_OPT_MV_PARAMS = 16, + INDEX_OPT_MV_KEYS = 17, + INDEX_OPT_VERSION = 18, + INDEX_OPT_HELP = 19, + INDEX_OPT_MORE_HELP = 20, + INDEX_OPT_SAVE_OPTS = 21, + INDEX_OPT_LOAD_OPTS = 22 } teOptIndex; #define OPTION_CT 23 @@ -199,7 +199,8 @@ typedef enum { # undef MV_KEYS #endif /* NO_OPTION_NAME_WARNINGS */ -/* +/* * * * * * + * * Interface defines for specific options. */ #ifdef OPENSSL @@ -257,10 +258,9 @@ typedef enum { #define VALUE_OPT_MV_KEYS 'v' #define OPT_VALUE_MV_KEYS (DESC(MV_KEYS).optArg.argInt) #endif /* OPENSSL */ - -#define VALUE_OPT_VERSION INDEX_OPT_VERSION #define VALUE_OPT_HELP '?' #define VALUE_OPT_MORE_HELP '!' +#define VALUE_OPT_VERSION INDEX_OPT_VERSION #define VALUE_OPT_SAVE_OPTS '>' #define VALUE_OPT_LOAD_OPTS '<' #define SET_OPT_SAVE_OPTS(a) STMTS( \ @@ -277,7 +277,7 @@ typedef enum { ntp_keygenOptions.pzCurOpt = NULL ) #define START_OPT RESTART_OPT(1) #define USAGE(c) (*ntp_keygenOptions.pUsageProc)( &ntp_keygenOptions, c ) -/* extracted from /usr/local/gnu/share/autogen/opthead.tpl near line 360 */ +/* extracted from /usr/local/gnu/share/autogen/opthead.tpl near line 409 */ /* * * * * * * @@ -289,18 +289,37 @@ extern "C" { extern tOptions ntp_keygenOptions; -#ifndef _ -# if ENABLE_NLS -# include - static inline char* aoGetsText( char const* pz ) { - if (pz == NULL) return NULL; - return (char*)gettext( pz ); - } -# define _(s) aoGetsText(s) -# else /* ENABLE_NLS */ -# define _(s) s -# endif /* ENABLE_NLS */ -#endif +#if defined(ENABLE_NLS) +# ifndef _ +# include + static inline char* aoGetsText( char const* pz ) { + if (pz == NULL) return NULL; + return (char*)gettext( pz ); + } +# define _(s) aoGetsText(s) +# endif /* _() */ + +# define OPT_NO_XLAT_CFG_NAMES STMTS(ntp_keygenOptions.fOptSet |= \ + OPTPROC_NXLAT_OPT_CFG;) +# define OPT_NO_XLAT_OPT_NAMES STMTS(ntp_keygenOptions.fOptSet |= \ + OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;) + +# define OPT_XLAT_CFG_NAMES STMTS(ntp_keygenOptions.fOptSet &= \ + ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);) +# define OPT_XLAT_OPT_NAMES STMTS(ntp_keygenOptions.fOptSet &= \ + ~OPTPROC_NXLAT_OPT;) + +#else /* ENABLE_NLS */ +# define OPT_NO_XLAT_CFG_NAMES +# define OPT_NO_XLAT_OPT_NAMES + +# define OPT_XLAT_CFG_NAMES +# define OPT_XLAT_OPT_NAMES + +# ifndef _ +# define _(_s) _s +# endif +#endif /* ENABLE_NLS */ #ifdef __cplusplus } diff --git a/util/ntp-keygen-opts.texi b/util/ntp-keygen-opts.texi index 1af55d9fd..ec36e9e12 100644 --- a/util/ntp-keygen-opts.texi +++ b/util/ntp-keygen-opts.texi @@ -6,7 +6,7 @@ # # EDIT THIS FILE WITH CAUTION (ntp-keygen-opts.texi) # -# It has been AutoGen-ed Thursday July 16, 2009 at 07:52:56 AM EDT +# It has been AutoGen-ed Monday July 20, 2009 at 05:16:06 AM EDT # From the definitions ntp-keygen-opts.def # and the template file aginfo.tpl @end ignore @@ -88,7 +88,7 @@ or by a single hyphen and the flag character. The following option preset mechanisms are supported: - reading file /users/stenn/.ntprc - - reading file /deacon/backroom/snaps/ntp-dev/util/.ntprc + - reading file /deacon/backroom/ntp-dev/util/.ntprc - examining environment variables named NTP_KEYGEN_* If there is no new host key, look for an existing one. diff --git a/util/ntp-keygen.1 b/util/ntp-keygen.1 index 6eadb597a..4ca9182da 100644 --- a/util/ntp-keygen.1 +++ b/util/ntp-keygen.1 @@ -1,7 +1,7 @@ -.TH NTP-KEYGEN 1 2009-07-16 "(ntp 4.2.5p189)" "Programmer's Manual" +.TH NTP-KEYGEN 1 2009-07-20 "(ntp 4.2.5p189)" "Programmer's Manual" .\" EDIT THIS FILE WITH CAUTION (ntp-keygen.1) .\" -.\" It has been AutoGen-ed Thursday July 16, 2009 at 07:52:55 AM EDT +.\" It has been AutoGen-ed Monday July 20, 2009 at 05:16:05 AM EDT .\" From the definitions ntp-keygen-opts.def .\" and the template file agman1.tpl .\" @@ -14,7 +14,7 @@ ntp-keygen \- Create a NTP host key .PP All arguments must be options. .SH "DESCRIPTION" -This manual page documents, briefly, the \fBntp-keygen\fP command. +This manual page briefly documents the \fBntp-keygen\fP command. If there is no new host key, look for an existing one. If one is not found, create it. .SH OPTIONS @@ -167,7 +167,7 @@ environment variables named: .nf \fBNTP_KEYGEN_\fP or \fBNTP_KEYGEN\fP .fi -.aj +.ad The environmental presets take precedence (are processed later than) the configuration files. The \fIhomerc\fP files are "\fI$HOME\fP", and "\fI.\fP".