diff options
Diffstat (limited to 'ntpd/ntpd-opts.c')
-rw-r--r-- | ntpd/ntpd-opts.c | 623 |
1 files changed, 381 insertions, 242 deletions
diff --git a/ntpd/ntpd-opts.c b/ntpd/ntpd-opts.c index 4d23d6674276..d5989bffde0f 100644 --- a/ntpd/ntpd-opts.c +++ b/ntpd/ntpd-opts.c @@ -1,31 +1,31 @@ /* * EDIT THIS FILE WITH CAUTION (ntpd-opts.c) * - * It has been AutoGen-ed Tuesday December 8, 2009 at 08:13:10 AM EST + * It has been AutoGen-ed December 24, 2011 at 06:34:01 PM by AutoGen 5.12 * From the definitions ntpd-opts.def * and the template file options * - * Generated from AutoOpts 29:0:4 templates. - */ - -/* - * This file was produced by an AutoOpts template. AutoOpts is a - * copyrighted work. This source file is not encumbered by AutoOpts - * licensing, but is provided under the licensing terms chosen by the - * ntpd author or copyright holder. AutoOpts is licensed under - * the terms of the LGPL. The redistributable library (``libopts'') is - * licensed under the terms of either the LGPL or, at the users discretion, - * the BSD license. See the AutoOpts and/or libopts sources for details. + * Generated from AutoOpts 35:0:10 templates. * - * This source file is copyrighted and licensed under the following terms: + * AutoOpts is a copyrighted work. This source file is not encumbered + * by AutoOpts licensing, but is provided under the licensing terms chosen + * by the ntpd author or copyright holder. AutoOpts is + * licensed under the terms of the LGPL. The redistributable library + * (``libopts'') is licensed under the terms of either the LGPL or, at the + * users discretion, the BSD license. See the AutoOpts and/or libopts sources + * for details. * - * ntpd copyright 1970-2009 David L. Mills and/or others - all rights reserved + * This source file is copyrighted and licensed under the following terms: * - * see html/copyright.html + * see html/copyright.html + * */ +#include <sys/types.h> #include <limits.h> +#include <stdio.h> +#include <stdlib.h> #define OPTION_CODE_COMPILE 1 #include "ntpd-opts.h" @@ -33,19 +33,23 @@ #ifdef __cplusplus extern "C" { #endif -tSCC zCopyright[] = - "ntpd copyright (c) 1970-2009 David L. Mills and/or others, all rights reserved"; -tSCC zCopyrightNotice[] = - -/* extracted from ../include/copyright.def near line 8 */ -"see html/copyright.html"; +extern FILE * option_usage_fp; + +/* TRANSLATORS: choose the translation for option names wisely because you + cannot ever change your mind. */ +static char const zCopyright[38] = +"ntpd 4.2.6p5\n\ +see html/copyright.html\n"; +static char const zLicenseDescrip[25] = +"see html/copyright.html\n"; + extern tUsageProc optionUsage; /* * global included definitions */ #ifdef __windows - extern int atoi(const char*); + extern int atoi(const char *); #else # include <stdlib.h> #endif @@ -53,38 +57,41 @@ extern tUsageProc optionUsage; #ifndef NULL # define NULL 0 #endif -#ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 -#endif -#ifndef EXIT_FAILURE -# define EXIT_FAILURE 1 -#endif + /* - * Ipv4 option description: + * Ipv4 option description with + * "Must also have options" and "Incompatible options": */ -tSCC zIpv4Text[] = +static char const zIpv4Text[] = "Force IPv4 DNS name resolution"; -tSCC zIpv4_NAME[] = "IPV4"; -tSCC zIpv4_Name[] = "ipv4"; +static char const zIpv4_NAME[] = "IPV4"; +static char const zIpv4_Name[] = "ipv4"; +static const int + aIpv4CantList[] = { + INDEX_OPT_IPV6, NO_EQUIVALENT }; #define IPV4_FLAGS (OPTST_DISABLED) /* - * Ipv6 option description: + * Ipv6 option description with + * "Must also have options" and "Incompatible options": */ -tSCC zIpv6Text[] = +static char const zIpv6Text[] = "Force IPv6 DNS name resolution"; -tSCC zIpv6_NAME[] = "IPV6"; -tSCC zIpv6_Name[] = "ipv6"; +static char const zIpv6_NAME[] = "IPV6"; +static char const zIpv6_Name[] = "ipv6"; +static const int + aIpv6CantList[] = { + INDEX_OPT_IPV4, NO_EQUIVALENT }; #define IPV6_FLAGS (OPTST_DISABLED) /* * Authreq option description with * "Must also have options" and "Incompatible options": */ -tSCC zAuthreqText[] = +static char const zAuthreqText[] = "Require crypto authentication"; -tSCC zAuthreq_NAME[] = "AUTHREQ"; -tSCC zAuthreq_Name[] = "authreq"; +static char const zAuthreq_NAME[] = "AUTHREQ"; +static char const zAuthreq_Name[] = "authreq"; static const int aAuthreqCantList[] = { INDEX_OPT_AUTHNOREQ, NO_EQUIVALENT }; @@ -94,10 +101,10 @@ static const int * Authnoreq option description with * "Must also have options" and "Incompatible options": */ -tSCC zAuthnoreqText[] = +static char const zAuthnoreqText[] = "Do not require crypto authentication"; -tSCC zAuthnoreq_NAME[] = "AUTHNOREQ"; -tSCC zAuthnoreq_Name[] = "authnoreq"; +static char const zAuthnoreq_NAME[] = "AUTHNOREQ"; +static char const zAuthnoreq_Name[] = "authnoreq"; static const int aAuthnoreqCantList[] = { INDEX_OPT_AUTHREQ, NO_EQUIVALENT }; @@ -106,19 +113,19 @@ static const int /* * Bcastsync option description: */ -tSCC zBcastsyncText[] = +static char const zBcastsyncText[] = "Allow us to sync to broadcast servers"; -tSCC zBcastsync_NAME[] = "BCASTSYNC"; -tSCC zBcastsync_Name[] = "bcastsync"; +static char const zBcastsync_NAME[] = "BCASTSYNC"; +static char const zBcastsync_Name[] = "bcastsync"; #define BCASTSYNC_FLAGS (OPTST_DISABLED) /* * Configfile option description: */ -tSCC zConfigfileText[] = +static char const zConfigfileText[] = "configuration file name"; -tSCC zConfigfile_NAME[] = "CONFIGFILE"; -tSCC zConfigfile_Name[] = "configfile"; +static char const zConfigfile_NAME[] = "CONFIGFILE"; +static char const zConfigfile_Name[] = "configfile"; #define CONFIGFILE_FLAGS (OPTST_DISABLED \ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) @@ -126,262 +133,340 @@ tSCC zConfigfile_Name[] = "configfile"; * Debug_Level option description: */ #ifdef DEBUG -tSCC zDebug_LevelText[] = +static char const zDebug_LevelText[] = "Increase output debug message level"; -tSCC zDebug_Level_NAME[] = "DEBUG_LEVEL"; -tSCC zDebug_Level_Name[] = "debug-level"; +static char const zDebug_Level_NAME[] = "DEBUG_LEVEL"; +static char const zDebug_Level_Name[] = "debug-level"; #define DEBUG_LEVEL_FLAGS (OPTST_DISABLED) #else /* disable Debug_Level */ -#define VALUE_OPT_DEBUG_LEVEL NO_EQUIVALENT #define DEBUG_LEVEL_FLAGS (OPTST_OMITTED | OPTST_NO_INIT) -#define zDebug_LevelText NULL #define zDebug_Level_NAME NULL -#define zDebug_Level_Name NULL +static char const zDebug_Level_Name[] = "debug-level"; +static char const zDebug_LevelText[] = "this package was built using 'configure --disable--debug'"; #endif /* DEBUG */ /* * Set_Debug_Level option description: */ #ifdef DEBUG -tSCC zSet_Debug_LevelText[] = +static char const zSet_Debug_LevelText[] = "Set the output debug message level"; -tSCC zSet_Debug_Level_NAME[] = "SET_DEBUG_LEVEL"; -tSCC zSet_Debug_Level_Name[] = "set-debug-level"; +static char const zSet_Debug_Level_NAME[] = "SET_DEBUG_LEVEL"; +static char const zSet_Debug_Level_Name[] = "set-debug-level"; #define SET_DEBUG_LEVEL_FLAGS (OPTST_DISABLED \ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) #else /* disable Set_Debug_Level */ -#define VALUE_OPT_SET_DEBUG_LEVEL NO_EQUIVALENT #define SET_DEBUG_LEVEL_FLAGS (OPTST_OMITTED | OPTST_NO_INIT) -#define zSet_Debug_LevelText NULL #define zSet_Debug_Level_NAME NULL -#define zSet_Debug_Level_Name NULL +static char const zSet_Debug_Level_Name[] = "set-debug-level"; +static char const zSet_Debug_LevelText[] = "this package was built using 'configure --disable--debug'"; #endif /* DEBUG */ /* * Driftfile option description: */ -tSCC zDriftfileText[] = +static char const zDriftfileText[] = "frequency drift file name"; -tSCC zDriftfile_NAME[] = "DRIFTFILE"; -tSCC zDriftfile_Name[] = "driftfile"; +static char const zDriftfile_NAME[] = "DRIFTFILE"; +static char const zDriftfile_Name[] = "driftfile"; #define DRIFTFILE_FLAGS (OPTST_DISABLED \ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) /* * Panicgate option description: */ -tSCC zPanicgateText[] = +static char const zPanicgateText[] = "Allow the first adjustment to be Big"; -tSCC zPanicgate_NAME[] = "PANICGATE"; -tSCC zPanicgate_Name[] = "panicgate"; +static char const zPanicgate_NAME[] = "PANICGATE"; +static char const zPanicgate_Name[] = "panicgate"; #define PANICGATE_FLAGS (OPTST_DISABLED) /* * Jaildir option description: */ -tSCC zJaildirText[] = +#ifdef HAVE_DROPROOT +static char const zJaildirText[] = "Jail directory"; -tSCC zJaildir_NAME[] = "JAILDIR"; -tSCC zJaildir_Name[] = "jaildir"; +static char const zJaildir_NAME[] = "JAILDIR"; +static char const zJaildir_Name[] = "jaildir"; #define JAILDIR_FLAGS (OPTST_DISABLED \ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) +#else /* disable Jaildir */ +#define JAILDIR_FLAGS (OPTST_OMITTED | OPTST_NO_INIT) +#define zJaildir_NAME NULL +static char const zJaildir_Name[] = "jaildir"; +static char const zJaildirText[] = "built without --enable-clockctl or --enable-linuxcaps"; +#endif /* HAVE_DROPROOT */ + /* * Interface option description: */ -tSCC zInterfaceText[] = - "Listen on interface"; -tSCC zInterface_NAME[] = "INTERFACE"; -tSCC zInterface_Name[] = "interface"; +static char const zInterfaceText[] = + "Listen on an interface name or address"; +static char const zInterface_NAME[] = "INTERFACE"; +static char const zInterface_Name[] = "interface"; #define INTERFACE_FLAGS (OPTST_DISABLED | OPTST_STACKED \ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) /* * Keyfile option description: */ -tSCC zKeyfileText[] = +static char const zKeyfileText[] = "path to symmetric keys"; -tSCC zKeyfile_NAME[] = "KEYFILE"; -tSCC zKeyfile_Name[] = "keyfile"; +static char const zKeyfile_NAME[] = "KEYFILE"; +static char const zKeyfile_Name[] = "keyfile"; #define KEYFILE_FLAGS (OPTST_DISABLED \ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) /* * Logfile option description: */ -tSCC zLogfileText[] = +static char const zLogfileText[] = "path to the log file"; -tSCC zLogfile_NAME[] = "LOGFILE"; -tSCC zLogfile_Name[] = "logfile"; +static char const zLogfile_NAME[] = "LOGFILE"; +static char const zLogfile_Name[] = "logfile"; #define LOGFILE_FLAGS (OPTST_DISABLED \ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) /* * Novirtualips option description: */ -tSCC zNovirtualipsText[] = - "Do not listen to virtual IPs"; -tSCC zNovirtualips_NAME[] = "NOVIRTUALIPS"; -tSCC zNovirtualips_Name[] = "novirtualips"; +static char const zNovirtualipsText[] = + "Do not listen to virtual interfaces"; +static char const zNovirtualips_NAME[] = "NOVIRTUALIPS"; +static char const zNovirtualips_Name[] = "novirtualips"; #define NOVIRTUALIPS_FLAGS (OPTST_DISABLED) /* * Modifymmtimer option description: */ #ifdef SYS_WINNT -tSCC zModifymmtimerText[] = +static char const zModifymmtimerText[] = "Modify Multimedia Timer (Windows only)"; -tSCC zModifymmtimer_NAME[] = "MODIFYMMTIMER"; -tSCC zModifymmtimer_Name[] = "modifymmtimer"; +static char const zModifymmtimer_NAME[] = "MODIFYMMTIMER"; +static char const zModifymmtimer_Name[] = "modifymmtimer"; #define MODIFYMMTIMER_FLAGS (OPTST_DISABLED) #else /* disable Modifymmtimer */ -#define VALUE_OPT_MODIFYMMTIMER NO_EQUIVALENT #define MODIFYMMTIMER_FLAGS (OPTST_OMITTED | OPTST_NO_INIT) -#define zModifymmtimerText NULL #define zModifymmtimer_NAME NULL +#define zModifymmtimerText NULL #define zModifymmtimer_Name NULL #endif /* SYS_WINNT */ /* * Nofork option description: */ -tSCC zNoforkText[] = +static char const zNoforkText[] = "Do not fork"; -tSCC zNofork_NAME[] = "NOFORK"; -tSCC zNofork_Name[] = "nofork"; +static char const zNofork_NAME[] = "NOFORK"; +static char const zNofork_Name[] = "nofork"; #define NOFORK_FLAGS (OPTST_DISABLED) /* * Nice option description: */ -tSCC zNiceText[] = +static char const zNiceText[] = "Run at high priority"; -tSCC zNice_NAME[] = "NICE"; -tSCC zNice_Name[] = "nice"; +static char const zNice_NAME[] = "NICE"; +static char const zNice_Name[] = "nice"; #define NICE_FLAGS (OPTST_DISABLED) /* * Pidfile option description: */ -tSCC zPidfileText[] = +static char const zPidfileText[] = "path to the PID file"; -tSCC zPidfile_NAME[] = "PIDFILE"; -tSCC zPidfile_Name[] = "pidfile"; +static char const zPidfile_NAME[] = "PIDFILE"; +static char const zPidfile_Name[] = "pidfile"; #define PIDFILE_FLAGS (OPTST_DISABLED \ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) /* * Priority option description: */ -tSCC zPriorityText[] = +static char const zPriorityText[] = "Process priority"; -tSCC zPriority_NAME[] = "PRIORITY"; -tSCC zPriority_Name[] = "priority"; +static char const zPriority_NAME[] = "PRIORITY"; +static char const zPriority_Name[] = "priority"; #define PRIORITY_FLAGS (OPTST_DISABLED \ | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC)) /* * Quit option description: */ -tSCC zQuitText[] = +static char const zQuitText[] = "Set the time and quit"; -tSCC zQuit_NAME[] = "QUIT"; -tSCC zQuit_Name[] = "quit"; +static char const zQuit_NAME[] = "QUIT"; +static char const zQuit_Name[] = "quit"; #define QUIT_FLAGS (OPTST_DISABLED) /* * Propagationdelay option description: */ -tSCC zPropagationdelayText[] = +static char const zPropagationdelayText[] = "Broadcast/propagation delay"; -tSCC zPropagationdelay_NAME[] = "PROPAGATIONDELAY"; -tSCC zPropagationdelay_Name[] = "propagationdelay"; +static char const zPropagationdelay_NAME[] = "PROPAGATIONDELAY"; +static char const zPropagationdelay_Name[] = "propagationdelay"; #define PROPAGATIONDELAY_FLAGS (OPTST_DISABLED \ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) /* - * Updateinterval option description: + * Saveconfigquit option description: */ -tSCC zUpdateintervalText[] = - "interval in seconds between scans for new or dropped interfaces"; -tSCC zUpdateinterval_NAME[] = "UPDATEINTERVAL"; -tSCC zUpdateinterval_Name[] = "updateinterval"; -#define UPDATEINTERVAL_FLAGS (OPTST_DISABLED \ - | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC)) +#ifdef SAVECONFIG +static char const zSaveconfigquitText[] = + "Save parsed configuration and quit"; +static char const zSaveconfigquit_NAME[] = "SAVECONFIGQUIT"; +static char const zSaveconfigquit_Name[] = "saveconfigquit"; +#define SAVECONFIGQUIT_FLAGS (OPTST_DISABLED \ + | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) + +#else /* disable Saveconfigquit */ +#define SAVECONFIGQUIT_FLAGS (OPTST_OMITTED | OPTST_NO_INIT) +#define zSaveconfigquit_NAME NULL +#define zSaveconfigquitText NULL +#define zSaveconfigquit_Name NULL +#endif /* SAVECONFIG */ /* * Statsdir option description: */ -tSCC zStatsdirText[] = +static char const zStatsdirText[] = "Statistics file location"; -tSCC zStatsdir_NAME[] = "STATSDIR"; -tSCC zStatsdir_Name[] = "statsdir"; +static char const zStatsdir_NAME[] = "STATSDIR"; +static char const zStatsdir_Name[] = "statsdir"; #define STATSDIR_FLAGS (OPTST_DISABLED \ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) /* * Trustedkey option description: */ -tSCC zTrustedkeyText[] = +static char const zTrustedkeyText[] = "Trusted key number"; -tSCC zTrustedkey_NAME[] = "TRUSTEDKEY"; -tSCC zTrustedkey_Name[] = "trustedkey"; +static char const zTrustedkey_NAME[] = "TRUSTEDKEY"; +static char const zTrustedkey_Name[] = "trustedkey"; #define TRUSTEDKEY_FLAGS (OPTST_DISABLED | OPTST_STACKED \ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) /* * User option description: */ -tSCC zUserText[] = +#ifdef HAVE_DROPROOT +static char const zUserText[] = "Run as userid (or userid:groupid)"; -tSCC zUser_NAME[] = "USER"; -tSCC zUser_Name[] = "user"; +static char const zUser_NAME[] = "USER"; +static char const zUser_Name[] = "user"; #define USER_FLAGS (OPTST_DISABLED \ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) +#else /* disable User */ +#define USER_FLAGS (OPTST_OMITTED | OPTST_NO_INIT) +#define zUser_NAME NULL +static char const zUser_Name[] = "user"; +static char const zUserText[] = "built without --enable-clockctl or --enable-linuxcaps"; +#endif /* HAVE_DROPROOT */ + +/* + * Updateinterval option description: + */ +static char const zUpdateintervalText[] = + "interval in seconds between scans for new or dropped interfaces"; +static char const zUpdateinterval_NAME[] = "UPDATEINTERVAL"; +static char const zUpdateinterval_Name[] = "updateinterval"; +#define UPDATEINTERVAL_FLAGS (OPTST_DISABLED \ + | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC)) + /* * Var option description: */ -tSCC zVarText[] = +static char const zVarText[] = "make ARG an ntp variable (RW)"; -tSCC zVar_NAME[] = "VAR"; -tSCC zVar_Name[] = "var"; +static char const zVar_NAME[] = "VAR"; +static char const zVar_Name[] = "var"; #define VAR_FLAGS (OPTST_DISABLED | OPTST_STACKED \ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) /* * Dvar option description: */ -tSCC zDvarText[] = +static char const zDvarText[] = "make ARG an ntp variable (RW|DEF)"; -tSCC zDvar_NAME[] = "DVAR"; -tSCC zDvar_Name[] = "dvar"; +static char const zDvar_NAME[] = "DVAR"; +static char const zDvar_Name[] = "dvar"; #define DVAR_FLAGS (OPTST_DISABLED | OPTST_STACKED \ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) /* * Slew option description: */ -tSCC zSlewText[] = +static char const zSlewText[] = "Slew up to 600 seconds"; -tSCC zSlew_NAME[] = "SLEW"; -tSCC zSlew_Name[] = "slew"; +static char const zSlew_NAME[] = "SLEW"; +static char const zSlew_Name[] = "slew"; #define SLEW_FLAGS (OPTST_DISABLED) /* - * Help/More_Help/Version option descriptions: + * Usepcc option description: + */ +#ifdef SYS_WINNT +static char const zUsepccText[] = + "Use CPU cycle counter (Windows only)"; +static char const zUsepcc_NAME[] = "USEPCC"; +static char const zUsepcc_Name[] = "usepcc"; +#define USEPCC_FLAGS (OPTST_DISABLED) + +#else /* disable Usepcc */ +#define USEPCC_FLAGS (OPTST_OMITTED | OPTST_NO_INIT) +#define zUsepcc_NAME NULL +#define zUsepccText NULL +#define zUsepcc_Name NULL +#endif /* SYS_WINNT */ + +/* + * Pccfreq option description: */ -tSCC zHelpText[] = "Display usage information and exit"; -tSCC zHelp_Name[] = "help"; +#ifdef SYS_WINNT +static char const zPccfreqText[] = + "Force CPU cycle counter use (Windows only)"; +static char const zPccfreq_NAME[] = "PCCFREQ"; +static char const zPccfreq_Name[] = "pccfreq"; +#define PCCFREQ_FLAGS (OPTST_DISABLED \ + | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) + +#else /* disable Pccfreq */ +#define PCCFREQ_FLAGS (OPTST_OMITTED | OPTST_NO_INIT) +#define zPccfreq_NAME NULL +#define zPccfreqText NULL +#define zPccfreq_Name NULL +#endif /* SYS_WINNT */ -tSCC zMore_HelpText[] = "Extended usage information passed thru pager"; -tSCC zMore_Help_Name[] = "more-help"; +/* + * Help/More_Help/Version option descriptions: + */ +static char const zHelpText[] = "Display extended usage information and exit"; +static char const zHelp_Name[] = "help"; +#ifdef HAVE_WORKING_FORK +#define OPTST_MORE_HELP_FLAGS (OPTST_IMM | OPTST_NO_INIT) +static char const zMore_Help_Name[] = "more-help"; +static char const zMore_HelpText[] = "Extended usage information passed thru pager"; +#else +#define OPTST_MORE_HELP_FLAGS (OPTST_OMITTED | OPTST_NO_INIT) +#define zMore_Help_Name NULL +#define zMore_HelpText NULL +#endif +#ifdef NO_OPTIONAL_OPT_ARGS +# define OPTST_VERSION_FLAGS OPTST_IMM | OPTST_NO_INIT +#else +# define OPTST_VERSION_FLAGS OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \ + OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT +#endif -tSCC zVersionText[] = "Output version information and exit"; -tSCC zVersion_Name[] = "version"; +static char const zVersionText[] = "Output version information and exit"; +static char const zVersion_Name[] = "version"; /* * Declare option callback procedures */ @@ -395,9 +480,6 @@ tSCC zVersion_Name[] = "version"; * Under test, omit argument processing, or call optionStackArg, * if multiple copies are allowed. */ -extern tOptProc - optionNumericVal, optionPagedUsage, optionStackArg, - optionVersionStderr; static tOptProc doUsageOpt; @@ -412,7 +494,10 @@ static tOptProc * When not under test, there are different procs to use */ extern tOptProc - optionNumericVal, optionPagedUsage, optionPrintVersion, optionStackArg; + optionBooleanVal, optionNestedVal, optionNumericVal, + optionPagedUsage, optionPrintVersion, optionResetOpt, + optionStackArg, optionTimeDate, optionTimeVal, + optionUnstackArg, optionVersionStderr; static tOptProc doUsageOpt; @@ -433,27 +518,27 @@ static tOptProc * * Define the Ntpd Option Descriptions. */ -static tOptDesc optDesc[ OPTION_CT ] = { +static tOptDesc optDesc[OPTION_CT] = { { /* entry idx, value */ 0, VALUE_OPT_IPV4, - /* equiv idx, value */ NO_EQUIVALENT, 0, + /* equiv idx, value */ 0, VALUE_OPT_IPV4, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ IPV4_FLAGS, 0, /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, - /* must/cannot opts */ NULL, NULL, + /* must/cannot opts */ NULL, aIpv4CantList, /* option proc */ NULL, /* desc, NAME, name */ zIpv4Text, zIpv4_NAME, zIpv4_Name, /* disablement strs */ NULL, NULL }, { /* entry idx, value */ 1, VALUE_OPT_IPV6, - /* equiv idx, value */ NOLIMIT, NOLIMIT, - /* equivalenced to */ INDEX_OPT_IPV4, + /* equiv idx, value */ 1, VALUE_OPT_IPV6, + /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ IPV6_FLAGS, 0, /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, - /* must/cannot opts */ NULL, NULL, + /* must/cannot opts */ NULL, aIpv6CantList, /* option proc */ NULL, /* desc, NAME, name */ zIpv6Text, zIpv6_NAME, zIpv6_Name, /* disablement strs */ NULL, NULL }, @@ -545,7 +630,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { { /* entry idx, value */ 9, VALUE_OPT_PANICGATE, /* equiv idx, value */ 9, VALUE_OPT_PANICGATE, /* equivalenced to */ NO_EQUIVALENT, - /* min, max, act ct */ 0, 1, 0, + /* min, max, act ct */ 0, NOLIMIT, 0, /* opt state flags */ PANICGATE_FLAGS, 0, /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, @@ -698,16 +783,16 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* desc, NAME, name */ zPropagationdelayText, zPropagationdelay_NAME, zPropagationdelay_Name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 22, VALUE_OPT_UPDATEINTERVAL, - /* equiv idx, value */ 22, VALUE_OPT_UPDATEINTERVAL, + { /* entry idx, value */ 22, VALUE_OPT_SAVECONFIGQUIT, + /* equiv idx, value */ 22, VALUE_OPT_SAVECONFIGQUIT, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, - /* opt state flags */ UPDATEINTERVAL_FLAGS, 0, + /* opt state flags */ SAVECONFIGQUIT_FLAGS, 0, /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, - /* option proc */ optionNumericVal, - /* desc, NAME, name */ zUpdateintervalText, zUpdateinterval_NAME, zUpdateinterval_Name, + /* option proc */ NULL, + /* desc, NAME, name */ zSaveconfigquitText, zSaveconfigquit_NAME, zSaveconfigquit_Name, /* disablement strs */ NULL, NULL }, { /* entry idx, value */ 23, VALUE_OPT_STATSDIR, @@ -746,8 +831,20 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* desc, NAME, name */ zUserText, zUser_NAME, zUser_Name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 26, VALUE_OPT_VAR, - /* equiv idx, value */ 26, VALUE_OPT_VAR, + { /* entry idx, value */ 26, VALUE_OPT_UPDATEINTERVAL, + /* equiv idx, value */ 26, VALUE_OPT_UPDATEINTERVAL, + /* equivalenced to */ NO_EQUIVALENT, + /* min, max, act ct */ 0, 1, 0, + /* opt state flags */ UPDATEINTERVAL_FLAGS, 0, + /* last opt argumnt */ { NULL }, + /* arg list/cookie */ NULL, + /* must/cannot opts */ NULL, NULL, + /* option proc */ optionNumericVal, + /* desc, NAME, name */ zUpdateintervalText, zUpdateinterval_NAME, zUpdateinterval_Name, + /* disablement strs */ NULL, NULL }, + + { /* entry idx, value */ 27, VALUE_OPT_VAR, + /* equiv idx, value */ 27, VALUE_OPT_VAR, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, NOLIMIT, 0, /* opt state flags */ VAR_FLAGS, 0, @@ -758,8 +855,8 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* desc, NAME, name */ zVarText, zVar_NAME, zVar_Name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 27, VALUE_OPT_DVAR, - /* equiv idx, value */ 27, VALUE_OPT_DVAR, + { /* entry idx, value */ 28, VALUE_OPT_DVAR, + /* equiv idx, value */ 28, VALUE_OPT_DVAR, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, NOLIMIT, 0, /* opt state flags */ DVAR_FLAGS, 0, @@ -770,8 +867,8 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* desc, NAME, name */ zDvarText, zDvar_NAME, zDvar_Name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 28, VALUE_OPT_SLEW, - /* equiv idx, value */ 28, VALUE_OPT_SLEW, + { /* entry idx, value */ 29, VALUE_OPT_SLEW, + /* equiv idx, value */ 29, VALUE_OPT_SLEW, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ SLEW_FLAGS, 0, @@ -782,18 +879,35 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* desc, NAME, name */ zSlewText, zSlew_NAME, zSlew_Name, /* disablement strs */ NULL, NULL }, -#ifdef NO_OPTIONAL_OPT_ARGS -# define VERSION_OPT_FLAGS OPTST_IMM | OPTST_NO_INIT -#else -# define VERSION_OPT_FLAGS OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \ - OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT -#endif + { /* entry idx, value */ 30, VALUE_OPT_USEPCC, + /* equiv idx, value */ 30, VALUE_OPT_USEPCC, + /* equivalenced to */ NO_EQUIVALENT, + /* min, max, act ct */ 0, 1, 0, + /* opt state flags */ USEPCC_FLAGS, 0, + /* last opt argumnt */ { NULL }, + /* arg list/cookie */ NULL, + /* must/cannot opts */ NULL, NULL, + /* option proc */ NULL, + /* desc, NAME, name */ zUsepccText, zUsepcc_NAME, zUsepcc_Name, + /* disablement strs */ NULL, NULL }, + + { /* entry idx, value */ 31, VALUE_OPT_PCCFREQ, + /* equiv idx, value */ 31, VALUE_OPT_PCCFREQ, + /* equivalenced to */ NO_EQUIVALENT, + /* min, max, act ct */ 0, 1, 0, + /* opt state flags */ PCCFREQ_FLAGS, 0, + /* last opt argumnt */ { NULL }, + /* arg list/cookie */ NULL, + /* must/cannot opts */ NULL, NULL, + /* option proc */ NULL, + /* desc, NAME, name */ zPccfreqText, zPccfreq_NAME, zPccfreq_Name, + /* disablement strs */ NULL, NULL }, { /* entry idx, value */ INDEX_OPT_VERSION, VALUE_OPT_VERSION, /* equiv idx value */ NO_EQUIVALENT, 0, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, - /* opt state flags */ VERSION_OPT_FLAGS, 0, + /* opt state flags */ OPTST_VERSION_FLAGS, 0, /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, @@ -801,7 +915,6 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* desc, NAME, name */ zVersionText, NULL, zVersion_Name, /* disablement strs */ NULL, NULL }, -#undef VERSION_OPT_FLAGS { /* entry idx, value */ INDEX_OPT_HELP, VALUE_OPT_HELP, @@ -820,7 +933,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* equiv idx value */ NO_EQUIVALENT, 0, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, - /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, 0, + /* opt state flags */ OPTST_MORE_HELP_FLAGS, 0, /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, @@ -833,18 +946,18 @@ static tOptDesc optDesc[ OPTION_CT ] = { * * Define the Ntpd Option Environment */ -tSCC zPROGNAME[] = "NTPD"; -tSCC zUsageTitle[] = -"ntpd - NTP daemon program - Ver. 4.2.4p8\n\ +static char const zPROGNAME[5] = "NTPD"; +static char const zUsageTitle[99] = +"ntpd - NTP daemon program - Ver. 4.2.6p5\n\ USAGE: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n"; #define zRcName NULL #define apzHomeList NULL -tSCC zBugsAddr[] = "http://bugs.ntp.org, bugs@ntp.org"; +static char const zBugsAddr[34] = "http://bugs.ntp.org, bugs@ntp.org"; #define zExplain NULL -tSCC zDetail[] = "\n\n"; -tSCC zFullVersion[] = NTPD_FULL_VERSION; -/* extracted from /usr/local/gnu/autogen-5.9.1/share/autogen/optcode.tpl near line 408 */ +static char const zDetail[7] = "\n\n"; +static char const zFullVersion[] = NTPD_FULL_VERSION; +/* extracted from optcode.tlib near line 515 */ #if defined(ENABLE_NLS) # define OPTPROC_BASE OPTPROC_TRANSLATE @@ -854,6 +967,29 @@ tSCC zFullVersion[] = NTPD_FULL_VERSION; # define translate_option_strings NULL #endif /* ENABLE_NLS */ + +#define ntpd_full_usage NULL +#define ntpd_short_usage NULL +#ifndef PKGDATADIR +# define PKGDATADIR "" +#endif + +#ifndef WITH_PACKAGER +# define ntpd_packager_info NULL +#else +static char const ntpd_packager_info[] = + "Packaged by " WITH_PACKAGER + +# ifdef WITH_PACKAGER_VERSION + " ("WITH_PACKAGER_VERSION")" +# endif + +# ifdef WITH_PACKAGER_BUG_REPORTS + "\nReport ntpd bugs to " WITH_PACKAGER_BUG_REPORTS +# endif + "\n"; +#endif + tOptions ntpdOptions = { OPTIONS_STRUCT_VERSION, 0, NULL, /* original argc + argv */ @@ -863,74 +999,75 @@ tOptions ntpdOptions = { + OPTPROC_LONGOPT + OPTPROC_NO_REQ_OPT + OPTPROC_ENVIRON - + OPTPROC_NO_ARGS ), + + OPTPROC_NO_ARGS + + OPTPROC_MISUSE ), 0, NULL, /* current option index, current option */ NULL, NULL, zPROGNAME, - zRcName, zCopyright, zCopyrightNotice, + zRcName, zCopyright, zLicenseDescrip, zFullVersion, apzHomeList, zUsageTitle, zExplain, zDetail, optDesc, zBugsAddr, /* address to send bugs to */ NULL, NULL, /* extensions/saved state */ - optionUsage, /* usage procedure */ + optionUsage, /* usage procedure */ translate_option_strings, /* translation procedure */ /* * Indexes to special options */ - { INDEX_OPT_MORE_HELP, - 0 /* no option state saving */, - NO_EQUIVALENT /* index of '-#' option */, + { INDEX_OPT_MORE_HELP, /* more-help option index */ + NO_EQUIVALENT, /* save option index */ + NO_EQUIVALENT, /* '-#' option index */ NO_EQUIVALENT /* index of default opt */ }, - 32 /* full option count */, 29 /* user option count */ + 35 /* full option count */, 32 /* user option count */, + ntpd_full_usage, ntpd_short_usage, + NULL, NULL, + PKGDATADIR, ntpd_packager_info }; /* * Create the static procedure(s) declared above. */ static void -doUsageOpt( - tOptions* pOptions, - tOptDesc* pOptDesc ) +doUsageOpt(tOptions * pOptions, tOptDesc * pOptDesc) { - USAGE( EXIT_SUCCESS ); + (void)pOptions; + USAGE(NTPD_EXIT_SUCCESS); } #if ! defined(TEST_NTPD_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 */ + /* extracted from ntpdbase-opts.def, line 100 */ DESC(DEBUG_LEVEL).optOccCt = atoi( pOptDesc->pzLastArg ); } #endif /* defined DEBUG */ - #endif /* defined(TEST_NTPD_OPTS) */ - -/* extracted from /usr/local/gnu/autogen-5.9.1/share/autogen/optmain.tpl near line 92 */ +/* extracted from optmain.tlib near line 128 */ #if defined(TEST_NTPD_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( &ntpdOptions, argc, argv ); - { - void optionPutShell( tOptions* ); - optionPutShell( &ntpdOptions ); - } + int res = NTPD_EXIT_SUCCESS; + (void)optionProcess(&ntpdOptions, argc, argv); + optionPutShell(&ntpdOptions); + res = ferror(stdout); + if (res != 0) + fputs("output error writing to stdout\n", stderr); return res; } #endif /* defined TEST_NTPD_OPTS */ -/* extracted from /usr/local/gnu/autogen-5.9.1/share/autogen/optcode.tpl near line 514 */ +/* extracted from optcode.tlib near line 666 */ #if ENABLE_NLS #include <stdio.h> @@ -939,11 +1076,11 @@ main( int argc, char** argv ) #include <unistd.h> #include <autoopts/usage-txt.h> -static char* AO_gettext( char const* pz ); +static char* AO_gettext(char const* pz); static void coerce_it(void** s); static char* -AO_gettext( char const* pz ) +AO_gettext(char const* pz) { char* pzRes; if (pz == NULL) @@ -951,66 +1088,68 @@ AO_gettext( char const* pz ) pzRes = _(pz); if (pzRes == pz) return pzRes; - pzRes = strdup( pzRes ); + pzRes = strdup(pzRes); if (pzRes == NULL) { - fputs( _("No memory for duping translated strings\n"), stderr ); - exit( EXIT_FAILURE ); + fputs(_("No memory for duping translated strings\n"), stderr); + exit(NTPD_EXIT_FAILURE); } return pzRes; } -static void coerce_it(void** s) { *s = AO_gettext(*s); } -#define COERSION(_f) \ - coerce_it((void*)&(ntpdOptions._f)) +static void coerce_it(void** s) { *s = AO_gettext(*s); +} /* * This invokes the translation code (e.g. gettext(3)). */ static void -translate_option_strings( void ) +translate_option_strings(void) { + tOptions * const pOpt = &ntpdOptions; + /* * 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 = pOpt->pOptDesc; + char ** ppz = (char**)(void*)&(option_usage_text); + int ix = option_usage_text.field_ct; do { ppz++; *ppz = AO_gettext(*ppz); } while (--ix > 0); + + coerce_it((void*)&(pOpt->pzCopyright)); + coerce_it((void*)&(pOpt->pzCopyNotice)); + coerce_it((void*)&(pOpt->pzFullVersion)); + coerce_it((void*)&(pOpt->pzUsageTitle)); + coerce_it((void*)&(pOpt->pzExplain)); + coerce_it((void*)&(pOpt->pzDetail)); + coerce_it((void*)&(pOpt->pzPackager)); + option_usage_text.field_ct = 0; + + for (ix = pOpt->optCt; ix > 0; ix--, pOD++) + coerce_it((void*)&(pOD->pzText)); } - option_usage_text.field_ct = 0; - - { - tOptDesc* pOD = ntpdOptions.pOptDesc; - int ix = ntpdOptions.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++; + + if ((pOpt->fOptSet & OPTPROC_NXLAT_OPT_CFG) == 0) { + tOptDesc * pOD = pOpt->pOptDesc; + int ix; + + for (ix = pOpt->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 */ + ntpdOptions.fOptSet |= OPTPROC_NXLAT_OPT_CFG | OPTPROC_NXLAT_OPT; } - COERSION(pzCopyright); - COERSION(pzCopyNotice); - COERSION(pzFullVersion); - COERSION(pzUsageTitle); - COERSION(pzExplain); - COERSION(pzDetail); } #endif /* ENABLE_NLS */ |