From: Harlan Stenn Date: Sun, 8 Oct 2006 08:32:17 +0000 (-0400) Subject: libopts-27.5.3 X-Git-Tag: NTP_4_2_3P52~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1758bddef0db7b9116bf35db8a21737a104da787;p=thirdparty%2Fntp.git libopts-27.5.3 bk: 4528b791tsoSriFA6aLtRM0JToirig --- diff --git a/clockstuff/clktest-opts.c b/clockstuff/clktest-opts.c index 2d518f0e7..3cfe3c446 100644 --- a/clockstuff/clktest-opts.c +++ b/clockstuff/clktest-opts.c @@ -2,9 +2,11 @@ * * DO NOT EDIT THIS FILE (clktest-opts.c) * - * It has been AutoGen-ed Monday September 25, 2006 at 02:49:53 PM EDT + * It has been AutoGen-ed Sunday October 8, 2006 at 03:53:03 AM EDT * From the definitions clktest-opts.def * and the template file options + * + * Generated from AutoOpts 27:5:3 templates. */ /* @@ -500,7 +502,7 @@ doOptMagic2( { static const struct {const int rmin, rmax;} rng[ 1 ] = { { 0, 255 } }; - long val; + int val; int ix; char const* pzIndent = "\t\t\t\t "; extern FILE* option_usage_fp; @@ -537,7 +539,7 @@ doOptMagic2( return; valid_return: - pOptDesc->optArg.argString = (char*)val; + pOptDesc->optArg.argInt = val; } #endif /* defined CLKLDISC */ @@ -553,7 +555,7 @@ doOptMagic1( { static const struct {const int rmin, rmax;} rng[ 1 ] = { { 0, 255 } }; - long val; + int val; int ix; char const* pzIndent = "\t\t\t\t "; extern FILE* option_usage_fp; @@ -590,7 +592,7 @@ doOptMagic1( return; valid_return: - pOptDesc->optArg.argString = (char*)val; + pOptDesc->optArg.argInt = val; } #endif /* defined CLKLDISC */ @@ -699,7 +701,7 @@ doOptTimeout( { static const struct {const int rmin, rmax;} rng[ 1 ] = { { 1, 600 } }; - long val; + int val; int ix; char const* pzIndent = "\t\t\t\t "; extern FILE* option_usage_fp; @@ -736,7 +738,7 @@ doOptTimeout( return; valid_return: - pOptDesc->optArg.argString = (char*)val; + pOptDesc->optArg.argInt = val; } /* extracted from optmain.tpl near line 92 */ diff --git a/clockstuff/clktest-opts.h b/clockstuff/clktest-opts.h index 0672ace8a..3b97ebf73 100644 --- a/clockstuff/clktest-opts.h +++ b/clockstuff/clktest-opts.h @@ -2,9 +2,11 @@ * * DO NOT EDIT THIS FILE (clktest-opts.h) * - * It has been AutoGen-ed Monday September 25, 2006 at 02:49:53 PM EDT + * It has been AutoGen-ed Sunday October 8, 2006 at 03:53:02 AM EDT * From the definitions clktest-opts.def * and the template file options + * + * Generated from AutoOpts 27:5:3 templates. */ /* @@ -40,7 +42,7 @@ * tolerable version is at least as old as what was current when the header * template was released. */ -#define AO_TEMPLATE_VERSION 110592 +#define AO_TEMPLATE_VERSION 110597 #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \ || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION) # error option template version mismatches autoopts/options.h header @@ -86,7 +88,7 @@ typedef enum { #define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt) #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs) #define CLEAR_OPT(n) STMTS( \ - DESC(n).fOptState &= OPTST_PERSISTENT; \ + DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \ if ( (DESC(n).fOptState & OPTST_INITENABLED) == 0) \ DESC(n).fOptState |= OPTST_DISABLED; \ DESC(n).optCookie = NULL ) @@ -165,7 +167,7 @@ typedef enum { #define VALUE_OPT_HELP '?' #define VALUE_OPT_MORE_HELP '!' #define SET_OPT_SAVE_OPTS(a) STMTS( \ - DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT; \ + DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \ DESC(SAVE_OPTS).fOptState |= OPTST_SET; \ DESC(SAVE_OPTS).optArg.argString = (char const*)(a) ) /* diff --git a/libopts/Makefile.am b/libopts/Makefile.am index a5729889c..cb8218088 100644 --- a/libopts/Makefile.am +++ b/libopts/Makefile.am @@ -7,7 +7,7 @@ noinst_LTLIBRARIES = libopts.la endif libopts_la_SOURCES = libopts.c libopts_la_CPPFLAGS = -I$(top_srcdir) -libopts_la_LDFLAGS = -version-info 27:4:3 +libopts_la_LDFLAGS = -version-info 27:5:3 EXTRA_DIST = \ COPYING.lgpl COPYING.mbsd MakeDefs.inc \ README autoopts/options.h autoopts/usage-txt.h \ diff --git a/libopts/autoopts.c b/libopts/autoopts.c index c08885083..a97083e49 100644 --- a/libopts/autoopts.c +++ b/libopts/autoopts.c @@ -1,7 +1,7 @@ /* - * $Id: autoopts.c,v 4.26 2006/09/24 02:10:44 bkorb Exp $ - * Time-stamp: "2006-09-22 18:21:53 bkorb" + * $Id: autoopts.c,v 4.27 2006/10/05 03:39:53 bkorb Exp $ + * Time-stamp: "2006-10-04 19:32:32 bkorb" * * This file contains all of the routines that must be linked into * an executable to use the generated option processing. The optional @@ -221,8 +221,8 @@ handleOption( tOptions* pOpts, tOptState* pOptState ) pOD->optActualIndex = pOD->optIndex; } - pOD->fOptState &= OPTST_PERSISTENT; - pOD->fOptState |= (pOptState->flags & ~OPTST_PERSISTENT); + pOD->fOptState &= OPTST_PERSISTENT_MASK; + pOD->fOptState |= (pOptState->flags & ~OPTST_PERSISTENT_MASK); /* * Keep track of count only for DEFINED (command line) options. @@ -558,11 +558,13 @@ nextOption( tOptions* pOpts, tOptState* pOptState ) { tSuccess res; enum { ARG_NONE, ARG_MAY, ARG_MUST } arg_type = ARG_NONE; + teOptArgType at; res = findOptDesc( pOpts, pOptState ); if (! SUCCESSFUL( res )) return res; - pOptState->flags |= (pOptState->pOD->fOptState & OPTST_PERSISTENT); + pOptState->flags |= (pOptState->pOD->fOptState & OPTST_PERSISTENT_MASK); + at = OPTST_GET_ARGTYPE(pOptState->flags); /* * Figure out what to do about option arguments. An argument may be @@ -572,7 +574,7 @@ nextOption( tOptions* pOpts, tOptState* pOptState ) */ if ((pOptState->flags & OPTST_DISABLED) != 0) arg_type = ARG_NONE; - else if (OPTST_GET_ARGTYPE(pOptState->flags) == OPARG_TYPE_NONE) + else if (at == OPARG_TYPE_NONE) arg_type = ARG_NONE; else if (pOptState->flags & OPTST_ARG_OPTIONAL) arg_type = ARG_MAY; diff --git a/libopts/autoopts/options.h b/libopts/autoopts/options.h index 1dfc6f0d8..97814ee3f 100644 --- a/libopts/autoopts/options.h +++ b/libopts/autoopts/options.h @@ -2,7 +2,7 @@ * * DO NOT EDIT THIS FILE (options.h) * - * It has been AutoGen-ed Sunday September 24, 2006 at 03:28:25 PM PDT + * It has been AutoGen-ed Thursday October 5, 2006 at 09:15:13 PM PDT * From the definitions funcs.def * and the template file options_h * @@ -60,6 +60,11 @@ * values for "opt_name" are available. */ +#define OPTIONS_STRUCT_VERSION 110597 +#define OPTIONS_VERSION_STRING "27:5:3" +#define OPTIONS_MINIMUM_VERSION 98304 +#define OPTIONS_MIN_VER_STRING "24:0:0" + typedef enum { OPARG_TYPE_NONE = 0, OPARG_TYPE_STRING = 1, /* default type/ vanilla string */ @@ -75,50 +80,96 @@ typedef struct optionValue { char* pzName; union { char strVal[1]; /* OPARG_TYPE_STRING */ - int enumVal; /* OPARG_TYPE_ENUMERATION */ - int boolVal; /* OPARG_TYPE_BOOLEAN */ - long setVal; /* OPARG_TYPE_MEMBERSHIP */ + unsigned int enumVal; /* OPARG_TYPE_ENUMERATION */ + unsigned int boolVal; /* OPARG_TYPE_BOOLEAN */ + unsigned long setVal; /* OPARG_TYPE_MEMBERSHIP */ long longVal; /* OPARG_TYPE_NUMERIC */ void* nestVal; /* OPARG_TYPE_HIERARCHY */ } v; } tOptionValue; -#define OPTST_SET_ARGTYPE(n) ((n) << 12) -#define OPTST_GET_ARGTYPE(f) (((f) & OPTST_ARG_TYPE_MASK) >> 12) - /* * Bits in the fOptState option descriptor field. */ -#define OPTST_INIT 0x0000000U /* Initial compiled value */ -#define OPTST_SET 0x0000001U /* Set via the "SET_OPT()" macro */ -#define OPTST_PRESET 0x0000002U /* Set via an RC/INI file */ -#define OPTST_DEFINED 0x0000004U /* Set via a command line option */ - -#define OPTST_SET_MASK 0x0000007U /* mask of flags that show set state */ - -#define OPTST_EQUIVALENCE 0x0000010U /* selected by equiv'ed option */ -#define OPTST_DISABLED 0x0000020U /* option is in disabled state */ - -#define OPTST_NO_INIT 0x0000100U /* option cannot be preset */ -#define OPTST_NUMBER_OPT 0x0000200U /* opt value (flag) is any digit */ -#define OPTST_STACKED 0x0000400U /* opt uses optionStackArg procedure */ -#define OPTST_INITENABLED 0x0000800U /* option defaults to enabled */ -#define OPTST_ARG_TYPE_MASK 0x000F000U /* bits used to specify opt arg type */ -#define OPTST_ARG_OPTIONAL 0x0010000U /* the option argument not required */ -#define OPTST_IMM 0x0020000U /* process option on first pass */ -#define OPTST_DISABLE_IMM 0x0040000U /* process disablement on first pass */ -#define OPTST_OMITTED 0x0080000U /* compiled out of program */ -#define OPTST_MUST_SET 0x0100000U /* must be set or pre-set */ -#define OPTST_DOCUMENT 0x0200000U /* opt is for documentation only */ -#define OPTST_TWICE 0x0400000U /* process option twice - imm + reg */ -#define OPTST_DISABLE_TWICE 0x0800000U /* process disabled option twice */ - -#define OPTST_PERSISTENT 0xFFFFF00U /* mask of flags that do not change */ - -#define SELECTED_OPT( pod ) ( (pod)->fOptState & (OPTST_SET | OPTST_DEFINED)) -#define UNUSED_OPT( pod ) (((pod)->fOptState & OPTST_SET_MASK) == 0) -#define DISABLED_OPT( pod ) ( (pod)->fOptState & OPTST_DISABLED) -#define OPTION_STATE( pod ) ((pod)->fOptState) +typedef enum { + OPTST_SET_ID = 0, /* Set via the "SET_OPT()" macro */ + OPTST_PRESET_ID = 1, /* Set via an RC/INI file */ + OPTST_DEFINED_ID = 2, /* Set via a command line option */ + OPTST_EQUIVALENCE_ID = 4, /* selected by equiv'ed option */ + OPTST_DISABLED_ID = 5, /* option is in disabled state */ + OPTST_NO_INIT_ID = 8, /* option cannot be preset */ + OPTST_NUMBER_OPT_ID = 9, /* opt value (flag) is any digit */ + OPTST_STACKED_ID = 10, /* opt uses optionStackArg proc */ + OPTST_INITENABLED_ID = 11, /* option defaults to enabled */ + OPTST_ARG_TYPE_1_ID = 12, /* bit 1 of arg type enum */ + OPTST_ARG_TYPE_2_ID = 13, /* bit 2 of arg type enum */ + OPTST_ARG_TYPE_3_ID = 14, /* bit 3 of arg type enum */ + OPTST_ARG_TYPE_4_ID = 15, /* bit 4 of arg type enum */ + OPTST_ARG_OPTIONAL_ID = 16, /* the option arg not required */ + OPTST_IMM_ID = 17, /* process opt on first pass */ + OPTST_DISABLE_IMM_ID = 18, /* process disablement immed. */ + OPTST_OMITTED_ID = 19, /* compiled out of program */ + OPTST_MUST_SET_ID = 20, /* must be set or pre-set */ + OPTST_DOCUMENT_ID = 21, /* opt is for doc only */ + OPTST_TWICE_ID = 22, /* process opt twice - imm + reg */ + OPTST_DISABLE_TWICE_ID = 23 /* process disabled option twice */ +} opt_state_enum_t; + +#define OPTST_INIT 0U +#define OPTST_SET (1U << OPTST_SET_ID) +#define OPTST_PRESET (1U << OPTST_PRESET_ID) +#define OPTST_DEFINED (1U << OPTST_DEFINED_ID) +#define OPTST_EQUIVALENCE (1U << OPTST_EQUIVALENCE_ID) +#define OPTST_DISABLED (1U << OPTST_DISABLED_ID) +#define OPTST_NO_INIT (1U << OPTST_NO_INIT_ID) +#define OPTST_NUMBER_OPT (1U << OPTST_NUMBER_OPT_ID) +#define OPTST_STACKED (1U << OPTST_STACKED_ID) +#define OPTST_INITENABLED (1U << OPTST_INITENABLED_ID) +#define OPTST_ARG_TYPE_1 (1U << OPTST_ARG_TYPE_1_ID) +#define OPTST_ARG_TYPE_2 (1U << OPTST_ARG_TYPE_2_ID) +#define OPTST_ARG_TYPE_3 (1U << OPTST_ARG_TYPE_3_ID) +#define OPTST_ARG_TYPE_4 (1U << OPTST_ARG_TYPE_4_ID) +#define OPTST_ARG_OPTIONAL (1U << OPTST_ARG_OPTIONAL_ID) +#define OPTST_IMM (1U << OPTST_IMM_ID) +#define OPTST_DISABLE_IMM (1U << OPTST_DISABLE_IMM_ID) +#define OPTST_OMITTED (1U << OPTST_OMITTED_ID) +#define OPTST_MUST_SET (1U << OPTST_MUST_SET_ID) +#define OPTST_DOCUMENT (1U << OPTST_DOCUMENT_ID) +#define OPTST_TWICE (1U << OPTST_TWICE_ID) +#define OPTST_DISABLE_TWICE (1U << OPTST_DISABLE_TWICE_ID) +#define OPT_STATE_MASK 0x00FFFF37U + +#define OPTST_SET_MASK ( \ + OPTST_SET | \ + OPTST_PRESET | \ + OPTST_DEFINED ) + +#define OPTST_MUTABLE_MASK ( \ + OPTST_SET | \ + OPTST_PRESET | \ + OPTST_DEFINED | \ + OPTST_EQUIVALENCE | \ + OPTST_DISABLED ) + +#define OPTST_SELECTED_MASK ( \ + OPTST_SET | \ + OPTST_DEFINED ) + +#define OPTST_ARG_TYPE_MASK ( \ + OPTST_ARG_TYPE_1 | \ + OPTST_ARG_TYPE_2 | \ + OPTST_ARG_TYPE_3 | \ + OPTST_ARG_TYPE_4 ) + +#define OPTST_PERSISTENT_MASK (~OPTST_MUTABLE_MASK) + +#define SELECTED_OPT( pod ) ((pod)->fOptState & OPTST_SELECTED_MASK) +#define UNUSED_OPT( pod ) (((pod)->fOptState & OPTST_SET_MASK) == 0) +#define DISABLED_OPT( pod ) ((pod)->fOptState & OPTST_DISABLED) +#define OPTION_STATE( pod ) ((pod)->fOptState) + +#define OPTST_SET_ARGTYPE(n) ((n) << OPTST_ARG_TYPE_1_ID) +#define OPTST_GET_ARGTYPE(f) (((f) & OPTST_ARG_TYPE_MASK)>>OPTST_ARG_TYPE_1_ID) /* * PRIVATE INTERFACES @@ -129,25 +180,45 @@ typedef struct optionValue { */ /* - * Define any special processing flags - */ -#define OPTPROC_NONE 0x000000 -#define OPTPROC_LONGOPT 0x000001 /* Process long style options */ -#define OPTPROC_SHORTOPT 0x000002 /* Process short style "flags" */ -#define OPTPROC_ERRSTOP 0x000004 /* Stop on argument errors */ -#define OPTPROC_DISABLEDOPT 0x000008 /* Current option is disabled */ -#define OPTPROC_NO_REQ_OPT 0x000010 /* no options are required */ -#define OPTPROC_NUM_OPT 0x000020 /* there is a number option */ -#define OPTPROC_INITDONE 0x000040 /* have initializations been done? */ -#define OPTPROC_NEGATIONS 0x000080 /* any negation options? */ -#define OPTPROC_ENVIRON 0x000100 /* check environment? */ -#define OPTPROC_NO_ARGS 0x000200 /* Disallow remaining arguments */ -#define OPTPROC_ARGS_REQ 0x000400 /* Require arguments after options */ -#define OPTPROC_REORDER 0x000800 /* reorder arguments after options */ -#define OPTPROC_GNUUSAGE 0x001000 /* emit usage in GNU style */ -#define OPTPROC_TRANSLATE 0x002000 /* Translate strings in tOptions */ -#define OPTPROC_HAS_IMMED 0x004000 /* program defines immed options */ -#define OPTPROC_PRESETTING 0x800000 /* opt processing in preset state */ + * Define the processing state flags + */ +typedef enum { + OPTPROC_LONGOPT_ID = 0, /* Process long style options */ + OPTPROC_SHORTOPT_ID = 1, /* Process short style "flags" */ + OPTPROC_ERRSTOP_ID = 2, /* Stop on argument errors */ + OPTPROC_DISABLEDOPT_ID = 3, /* Current option is disabled */ + OPTPROC_NO_REQ_OPT_ID = 4, /* no options are required */ + OPTPROC_NUM_OPT_ID = 5, /* there is a number option */ + OPTPROC_INITDONE_ID = 6, /* have initializations been done? */ + OPTPROC_NEGATIONS_ID = 7, /* any negation options? */ + OPTPROC_ENVIRON_ID = 8, /* check environment? */ + OPTPROC_NO_ARGS_ID = 9, /* Disallow remaining arguments */ + OPTPROC_ARGS_REQ_ID = 10, /* Require arguments after options */ + OPTPROC_REORDER_ID = 11, /* reorder operands after options */ + OPTPROC_GNUUSAGE_ID = 12, /* emit usage in GNU style */ + OPTPROC_TRANSLATE_ID = 13, /* Translate strings in tOptions */ + OPTPROC_HAS_IMMED_ID = 14, /* program defines immed options */ + OPTPROC_PRESETTING_ID = 19 /* opt processing in preset state */ +} optproc_state_enum_t; + +#define OPTPROC_NONE 0U +#define OPTPROC_LONGOPT (1U << OPTPROC_LONGOPT_ID) +#define OPTPROC_SHORTOPT (1U << OPTPROC_SHORTOPT_ID) +#define OPTPROC_ERRSTOP (1U << OPTPROC_ERRSTOP_ID) +#define OPTPROC_DISABLEDOPT (1U << OPTPROC_DISABLEDOPT_ID) +#define OPTPROC_NO_REQ_OPT (1U << OPTPROC_NO_REQ_OPT_ID) +#define OPTPROC_NUM_OPT (1U << OPTPROC_NUM_OPT_ID) +#define OPTPROC_INITDONE (1U << OPTPROC_INITDONE_ID) +#define OPTPROC_NEGATIONS (1U << OPTPROC_NEGATIONS_ID) +#define OPTPROC_ENVIRON (1U << OPTPROC_ENVIRON_ID) +#define OPTPROC_NO_ARGS (1U << OPTPROC_NO_ARGS_ID) +#define OPTPROC_ARGS_REQ (1U << OPTPROC_ARGS_REQ_ID) +#define OPTPROC_REORDER (1U << OPTPROC_REORDER_ID) +#define OPTPROC_GNUUSAGE (1U << OPTPROC_GNUUSAGE_ID) +#define OPTPROC_TRANSLATE (1U << OPTPROC_TRANSLATE_ID) +#define OPTPROC_HAS_IMMED (1U << OPTPROC_HAS_IMMED_ID) +#define OPTPROC_PRESETTING (1U << OPTPROC_PRESETTING_ID) +#define OPTPROC_STATE_MASK 0x00087FFFU #define STMTS(s) do { s; } while (0) @@ -219,10 +290,11 @@ struct argList { typedef union { char const * argString; + uintptr_t argEnum; uintptr_t argIntptr; - int argInt; - unsigned int argUint; - ag_bool argBool; + long argInt; + unsigned long argUint; + unsigned int argBool; } optArgBucket_t; /* @@ -269,11 +341,6 @@ struct optSpecIndex { const tAoUS default_opt; }; -#define OPTIONS_STRUCT_VERSION 110595 -#define OPTIONS_VERSION_STRING "27:4:3" -#define OPTIONS_MINIMUM_VERSION 98304 -#define OPTIONS_MIN_VER_STRING "24:0:0" - /* * The procedure generated for translating option text */ @@ -610,7 +677,7 @@ extern const tOptionValue* optionNextValue( const tOptionValue*, const tOptionVa extern void optionOnlyUsage( tOptions*, int ); -/* From: autoopts.c line 980 +/* From: autoopts.c line 982 * * optionProcess - this is the main option processing routine * diff --git a/libopts/autoopts/usage-txt.h b/libopts/autoopts/usage-txt.h index 8bc08065b..9c7079b8c 100644 --- a/libopts/autoopts/usage-txt.h +++ b/libopts/autoopts/usage-txt.h @@ -2,7 +2,7 @@ * * DO NOT EDIT THIS FILE (usage-txt.h) * - * It has been AutoGen-ed Sunday September 24, 2006 at 03:28:22 PM PDT + * It has been AutoGen-ed Thursday October 5, 2006 at 09:15:10 PM PDT * From the definitions usage-txt.def * and the template file usage-txt.tpl * diff --git a/libopts/configfile.c b/libopts/configfile.c index bdde8de80..59037d6b2 100644 --- a/libopts/configfile.c +++ b/libopts/configfile.c @@ -1,5 +1,5 @@ /* - * $Id: configfile.c,v 4.28 2006/09/24 02:10:45 bkorb Exp $ + * $Id: configfile.c,v 4.29 2006/09/28 01:26:16 bkorb Exp $ * Time-stamp: "2006-09-24 15:18:51 bkorb" * * configuration/rc/ini file handling. diff --git a/libopts/cook.c b/libopts/cook.c index 9685d0641..56d4c0408 100644 --- a/libopts/cook.c +++ b/libopts/cook.c @@ -1,6 +1,6 @@ /* - * $Id: cook.c,v 4.8 2006/09/24 02:10:45 bkorb Exp $ + * $Id: cook.c,v 4.9 2006/09/28 01:26:16 bkorb Exp $ * Time-stamp: "2006-09-24 15:21:02 bkorb" * * This file contains the routines that deal with processing quoted strings diff --git a/libopts/enumeration.c b/libopts/enumeration.c index 4586967c7..dd51b1111 100644 --- a/libopts/enumeration.c +++ b/libopts/enumeration.c @@ -1,7 +1,7 @@ /* * $Id: enumeration.c,v 4.14 2006/09/24 02:10:45 bkorb Exp $ - * Time-stamp: "2006-09-22 18:00:53 bkorb" + * Time-stamp: "2006-10-05 21:10:21 bkorb" * * Automated Options Paged Usage module. * @@ -235,7 +235,7 @@ optionKeywordName( { tOptDesc od; - od.optArg.argIntptr = enum_val; + od.optArg.argEnum = enum_val; (*(pOD->pOptProc))( (void*)(2UL), &od ); return od.optArg.argString; } @@ -280,7 +280,7 @@ optionEnumerationVal( case 1UL: { - unsigned int ix = pOD->optArg.argIntptr; + unsigned int ix = pOD->optArg.argEnum; /* * print the name string. */ @@ -293,7 +293,7 @@ optionEnumerationVal( case 2UL: { tSCC zInval[] = "*INVALID*"; - unsigned int ix = pOD->optArg.argIntptr; + unsigned int ix = pOD->optArg.argEnum; /* * Replace the enumeration value with the name string. */ diff --git a/libopts/genshell.c b/libopts/genshell.c index 7c5e12f74..c7331f49f 100644 --- a/libopts/genshell.c +++ b/libopts/genshell.c @@ -2,9 +2,11 @@ * * DO NOT EDIT THIS FILE (genshell.c) * - * It has been AutoGen-ed Sunday September 24, 2006 at 03:28:26 PM PDT + * It has been AutoGen-ed Thursday October 5, 2006 at 09:15:14 PM PDT * From the definitions genshell.def * and the template file options + * + * Generated from AutoOpts 27:5:3 templates. */ /* diff --git a/libopts/genshell.h b/libopts/genshell.h index 44760b784..e7c524eab 100644 --- a/libopts/genshell.h +++ b/libopts/genshell.h @@ -2,9 +2,11 @@ * * DO NOT EDIT THIS FILE (genshell.h) * - * It has been AutoGen-ed Sunday September 24, 2006 at 03:28:26 PM PDT + * It has been AutoGen-ed Thursday October 5, 2006 at 09:15:14 PM PDT * From the definitions genshell.def * and the template file options + * + * Generated from AutoOpts 27:5:3 templates. */ /* @@ -53,7 +55,7 @@ * tolerable version is at least as old as what was current when the header * template was released. */ -#define AO_TEMPLATE_VERSION 110592 +#define AO_TEMPLATE_VERSION 110597 #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \ || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION) # error option template version mismatches autoopts/options.h header @@ -91,7 +93,7 @@ typedef enum { #define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt) #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs) #define CLEAR_OPT(n) STMTS( \ - DESC(n).fOptState &= OPTST_PERSISTENT; \ + DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \ if ( (DESC(n).fOptState & OPTST_INITENABLED) == 0) \ DESC(n).fOptState |= OPTST_DISABLED; \ DESC(n).optCookie = NULL ) diff --git a/libopts/load.c b/libopts/load.c index 46ac97dc2..45fb53a47 100644 --- a/libopts/load.c +++ b/libopts/load.c @@ -1,6 +1,6 @@ /* - * $Id: load.c,v 4.25 2006/09/24 02:10:45 bkorb Exp $ + * $Id: load.c,v 4.26 2006/09/28 01:26:16 bkorb Exp $ * Time-stamp: "2006-09-24 15:23:01 bkorb" * * This file contains the routines that deal with processing text strings diff --git a/libopts/m4/libopts.m4 b/libopts/m4/libopts.m4 index 6fea8bfd7..4c6f71151 100644 --- a/libopts/m4/libopts.m4 +++ b/libopts/m4/libopts.m4 @@ -2,7 +2,7 @@ dnl -*- buffer-read-only: t -*- vi: set ro: dnl dnl DO NOT EDIT THIS FILE (libopts.m4) dnl -dnl It has been AutoGen-ed Sunday September 24, 2006 at 03:28:29 PM PDT +dnl It has been AutoGen-ed Thursday October 5, 2006 at 09:15:16 PM PDT dnl From the definitions libopts.def dnl and the template file conftest.tpl dnl diff --git a/libopts/makeshell.c b/libopts/makeshell.c index 4051a27b5..088df02f9 100644 --- a/libopts/makeshell.c +++ b/libopts/makeshell.c @@ -1,7 +1,7 @@ /* - * $Id: makeshell.c,v 4.17 2006/09/24 02:10:45 bkorb Exp $ - * Time-stamp: "2006-09-22 18:19:24 bkorb" + * $Id: makeshell.c,v 4.18 2006/10/05 03:39:53 bkorb Exp $ + * Time-stamp: "2006-10-05 20:41:23 bkorb" * * This module will interpret the options set in the tOptions * structure and create a Bourne shell script capable of parsing them. @@ -699,12 +699,21 @@ emitSetup( tOptions* pOpts ) * Numeric and membership bit options are just printed as a number. */ case OPARG_TYPE_NUMERIC: - case OPARG_TYPE_MEMBERSHIP: snprintf( zVal, sizeof( zVal ), "%d", - (int)pOptDesc->optArg.argIntptr ); + (int)pOptDesc->optArg.argInt ); pzDefault = zVal; break; + case OPARG_TYPE_MEMBERSHIP: + snprintf( zVal, sizeof( zVal ), "%lu", + (unsigned long)pOptDesc->optArg.argIntptr ); + pzDefault = zVal; + break; + + case OPARG_TYPE_BOOLEAN: + pzDefault = (pOptDesc->optArg.argBool) ? "true" : "false"; + break; + default: if (pOptDesc->optArg.argString == NULL) { if (pzFmt == zSingleDef) diff --git a/libopts/nested.c b/libopts/nested.c index 013b742c3..0989cec17 100644 --- a/libopts/nested.c +++ b/libopts/nested.c @@ -1,6 +1,6 @@ /* - * $Id: nested.c,v 4.13 2006/09/24 02:10:45 bkorb Exp $ + * $Id: nested.c,v 4.14 2006/09/28 01:26:16 bkorb Exp $ * Time-stamp: "2006-09-24 15:27:32 bkorb" * * Automated Options Nested Values module. diff --git a/libopts/numeric.c b/libopts/numeric.c index 486981fb5..a186984e6 100644 --- a/libopts/numeric.c +++ b/libopts/numeric.c @@ -1,7 +1,7 @@ /* - * $Id: numeric.c,v 4.9 2006/09/24 02:10:45 bkorb Exp $ - * Time-stamp: "2006-09-22 18:14:38 bkorb" + * $Id: numeric.c,v 4.10 2006/10/05 03:39:53 bkorb Exp $ + * Time-stamp: "2006-10-04 16:12:34 bkorb" */ /* @@ -61,7 +61,7 @@ void optionNumericVal( tOptions* pOpts, tOptDesc* pOD ) { char* pz; - int val; + long val; /* * Numeric options may have a range associated with it. @@ -71,7 +71,7 @@ optionNumericVal( tOptions* pOpts, tOptDesc* pOD ) if ((pOD == NULL) || (pOD->optArg.argString == NULL)) return; - val = (int)strtol( pOD->optArg.argString, &pz, 0 ); + val = strtol( pOD->optArg.argString, &pz, 0 ); if (*pz != NUL) { fprintf( stderr, zNotNumber, pOpts->pzProgName, pOD->optArg.argString ); (*(pOpts->pUsageProc))(pOpts, EXIT_FAILURE); diff --git a/libopts/proto.h b/libopts/proto.h index 80f1d06e3..70a421b10 100644 --- a/libopts/proto.h +++ b/libopts/proto.h @@ -1,7 +1,7 @@ /* -*- buffer-read-only: t -*- vi: set ro: * * Prototypes for autoopts - * Generated Sun Sep 24 15:28:27 PDT 2006 + * Generated Thu Oct 5 21:15:15 PDT 2006 */ #ifndef AUTOOPTS_PROTO_H_GUARD #define AUTOOPTS_PROTO_H_GUARD 1 diff --git a/libopts/putshell.c b/libopts/putshell.c index fda77eea7..a9ff3ef42 100644 --- a/libopts/putshell.c +++ b/libopts/putshell.c @@ -1,7 +1,7 @@ /* - * $Id: putshell.c,v 4.14 2006/09/24 02:10:45 bkorb Exp $ - * Time-stamp: "2006-09-24 15:28:15 bkorb" + * $Id: putshell.c,v 4.16 2006/10/05 03:39:53 bkorb Exp $ + * Time-stamp: "2006-10-05 20:37:42 bkorb" * * This module will interpret the options set in the tOptions * structure and print them to standard out in a fashion that @@ -164,8 +164,8 @@ optionPutShell( tOptions* pOpts ) if (pOD->optActualIndex != optIx) { tOptDesc* p = pOpts->pOptDesc + pOD->optActualIndex; p->optArg = pOD->optArg; - p->fOptState &= OPTST_PERSISTENT; - p->fOptState |= pOD->fOptState & ~OPTST_PERSISTENT; + p->fOptState &= OPTST_PERSISTENT_MASK; + p->fOptState |= pOD->fOptState & ~OPTST_PERSISTENT_MASK; printf( zEquivMode, pOpts->pzPROGNAME, pOD->pz_NAME, p->pz_NAME ); pOD = p; } @@ -176,7 +176,7 @@ optionPutShell( tOptions* pOpts ) * of bitmask value and we need to emit the bit values. */ if (OPTST_GET_ARGTYPE(pOD->fOptState) == OPARG_TYPE_MEMBERSHIP) { - char* pz; + char const * pz; uintptr_t val = 1; printf( zOptNumFmt, pOpts->pzPROGNAME, pOD->pz_NAME, (uintptr_t)(pOD->optCookie) ); @@ -187,7 +187,7 @@ optionPutShell( tOptions* pOpts ) * We are building the typeset list. The list returned starts with * 'none + ' for use by option saving stuff. We must ignore that. */ - pz = (char*)pOD->optArg.argString + 7; + pz = pOD->optArg.argString + 7; while (*pz != NUL) { printf( "typeset -x -i %s_", pOD->pz_NAME ); pz += strspn( pz, " +\t\n\f" ); @@ -256,7 +256,7 @@ optionPutShell( tOptions* pOpts ) */ else if (OPTST_GET_ARGTYPE(pOD->fOptState) == OPARG_TYPE_NUMERIC) printf( zOptNumFmt, pOpts->pzPROGNAME, pOD->pz_NAME, - pOD->optArg.argIntptr ); + (int)pOD->optArg.argInt ); /* * If the argument type is an enumeration, then it is much @@ -277,7 +277,7 @@ optionPutShell( tOptions* pOpts ) */ else if (OPTST_GET_ARGTYPE(pOD->fOptState) == OPARG_TYPE_BOOLEAN) printf( zFullOptFmt, pOpts->pzPROGNAME, pOD->pz_NAME, - (pOD->optArg.argIntptr == 0) ? "false" : "true" ); + (pOD->optArg.argBool == 0) ? "false" : "true" ); /* * IF the option has an empty value, diff --git a/libopts/restore.c b/libopts/restore.c index 0bd7e1f07..c5d56f9c7 100644 --- a/libopts/restore.c +++ b/libopts/restore.c @@ -1,6 +1,6 @@ /* - * restore.c $Id: restore.c,v 4.8 2006/09/24 02:10:45 bkorb Exp $ + * restore.c $Id: restore.c,v 4.9 2006/10/05 03:39:53 bkorb Exp $ * Time-stamp: "2005-02-23 15:10:20 bkorb" * * This module's routines will save the current option state to memory @@ -181,7 +181,7 @@ optionFree( tOptions* pOpts ) if ( (p->fOptState & OPTST_STACKED) && (p->optCookie != NULL)) { AGFREE( p->optCookie ); - p->fOptState &= OPTST_PERSISTENT; + p->fOptState &= OPTST_PERSISTENT_MASK; if ((p->fOptState & OPTST_INITENABLED) == 0) p->fOptState |= OPTST_DISABLED; } diff --git a/libopts/save.c b/libopts/save.c index 6c5666e0c..573508c56 100644 --- a/libopts/save.c +++ b/libopts/save.c @@ -1,7 +1,7 @@ /* - * save.c $Id: save.c,v 4.19 2006/09/24 02:10:45 bkorb Exp $ - * Time-stamp: "2006-09-22 18:11:20 bkorb" + * save.c $Id: save.c,v 4.20 2006/10/05 03:39:53 bkorb Exp $ + * Time-stamp: "2006-10-05 21:09:18 bkorb" * * This module's routines will take the currently set options and * store them into an ".rc" file for re-interpretation the next @@ -437,7 +437,7 @@ optionSaveFile( tOptions* pOpts ) switch (arg_state) { case 0: case OPARG_TYPE_NUMERIC: - printEntry( fp, p, p->optArg.argString ); + printEntry( fp, p, (void*)(p->optArg.argInt)); break; case OPARG_TYPE_STRING: @@ -462,26 +462,25 @@ optionSaveFile( tOptions* pOpts ) case OPARG_TYPE_ENUMERATION: case OPARG_TYPE_MEMBERSHIP: { - tCC* val = p->optArg.argString; + uintptr_t val = p->optArg.argEnum; /* * This is a magic incantation that will convert the * bit flag values back into a string suitable for printing. */ (*(p->pOptProc))( (tOptions*)2UL, p ); - printEntry( fp, p, p->optArg.argString ); + printEntry( fp, p, (void*)(p->optArg.argString)); if ( (p->optArg.argString != NULL) && (arg_state != OPARG_TYPE_ENUMERATION)) /* * bit flag and enumeration strings get allocated */ AGFREE( (void*)p->optArg.argString ); - p->optArg.argString = val; + p->optArg.argEnum = val; break; } case OPARG_TYPE_BOOLEAN: - printEntry( fp, p, (p->optArg.argBool != AG_FALSE) - ? "true" : "false" ); + printEntry( fp, p, p->optArg.argBool ? "true" : "false" ); break; default: diff --git a/libopts/stack.c b/libopts/stack.c index fb78898e1..9d8f3a3d9 100644 --- a/libopts/stack.c +++ b/libopts/stack.c @@ -1,7 +1,7 @@ /* * stack.c - * $Id: stack.c,v 4.12 2006/09/24 02:10:45 bkorb Exp $ + * $Id: stack.c,v 4.13 2006/10/05 03:39:53 bkorb Exp $ * Time-stamp: "2006-09-22 18:13:19 bkorb" * * This is a special option processing routine that will save the @@ -78,7 +78,7 @@ optionUnstackArg( * THEN indicate that we don't have any of these options */ if (pAL == NULL) { - pOptDesc->fOptState &= OPTST_PERSISTENT; + pOptDesc->fOptState &= OPTST_PERSISTENT_MASK; if ( (pOptDesc->fOptState & OPTST_INITENABLED) == 0) pOptDesc->fOptState |= OPTST_DISABLED; return; @@ -177,7 +177,7 @@ optionUnstackArg( * THEN indicate that we don't have any of these options */ if (pAL->useCt == 0) { - pOptDesc->fOptState &= OPTST_PERSISTENT; + pOptDesc->fOptState &= OPTST_PERSISTENT_MASK; if ( (pOptDesc->fOptState & OPTST_INITENABLED) == 0) pOptDesc->fOptState |= OPTST_DISABLED; free( (void*)pAL ); diff --git a/ntpd/ntpd-opts.c b/ntpd/ntpd-opts.c index 89f67ed33..5488f54c5 100644 --- a/ntpd/ntpd-opts.c +++ b/ntpd/ntpd-opts.c @@ -2,9 +2,11 @@ * * DO NOT EDIT THIS FILE (ntpd-opts.c) * - * It has been AutoGen-ed Monday September 25, 2006 at 02:49:56 PM EDT + * It has been AutoGen-ed Sunday October 8, 2006 at 03:53:05 AM EDT * From the definitions ntpd-opts.def * and the template file options + * + * Generated from AutoOpts 27:5:3 templates. */ /* diff --git a/ntpd/ntpd-opts.h b/ntpd/ntpd-opts.h index 8c5e665c0..45cd4451f 100644 --- a/ntpd/ntpd-opts.h +++ b/ntpd/ntpd-opts.h @@ -2,9 +2,11 @@ * * DO NOT EDIT THIS FILE (ntpd-opts.h) * - * It has been AutoGen-ed Monday September 25, 2006 at 02:49:55 PM EDT + * It has been AutoGen-ed Sunday October 8, 2006 at 03:53:04 AM EDT * From the definitions ntpd-opts.def * and the template file options + * + * Generated from AutoOpts 27:5:3 templates. */ /* @@ -40,7 +42,7 @@ * tolerable version is at least as old as what was current when the header * template was released. */ -#define AO_TEMPLATE_VERSION 110592 +#define AO_TEMPLATE_VERSION 110597 #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \ || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION) # error option template version mismatches autoopts/options.h header @@ -107,7 +109,7 @@ typedef enum { #define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt) #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs) #define CLEAR_OPT(n) STMTS( \ - DESC(n).fOptState &= OPTST_PERSISTENT; \ + DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \ if ( (DESC(n).fOptState & OPTST_INITENABLED) == 0) \ DESC(n).fOptState |= OPTST_DISABLED; \ DESC(n).optCookie = NULL ) @@ -313,7 +315,7 @@ typedef enum { #define VALUE_OPT_HELP '?' #define VALUE_OPT_MORE_HELP '!' #define SET_OPT_SAVE_OPTS(a) STMTS( \ - DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT; \ + DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \ DESC(SAVE_OPTS).fOptState |= OPTST_SET; \ DESC(SAVE_OPTS).optArg.argString = (char const*)(a) ) /* diff --git a/ntpd/ntpdsim-opts.c b/ntpd/ntpdsim-opts.c index 93e32d4ac..ad988a0b6 100644 --- a/ntpd/ntpdsim-opts.c +++ b/ntpd/ntpdsim-opts.c @@ -2,9 +2,11 @@ * * DO NOT EDIT THIS FILE (ntpdsim-opts.c) * - * It has been AutoGen-ed Monday September 25, 2006 at 02:49:58 PM EDT + * It has been AutoGen-ed Sunday October 8, 2006 at 03:53:07 AM EDT * From the definitions ntpdsim-opts.def * and the template file options + * + * Generated from AutoOpts 27:5:3 templates. */ /* diff --git a/ntpd/ntpdsim-opts.h b/ntpd/ntpdsim-opts.h index ea06b08b4..abdcbf424 100644 --- a/ntpd/ntpdsim-opts.h +++ b/ntpd/ntpdsim-opts.h @@ -2,9 +2,11 @@ * * DO NOT EDIT THIS FILE (ntpdsim-opts.h) * - * It has been AutoGen-ed Monday September 25, 2006 at 02:49:57 PM EDT + * It has been AutoGen-ed Sunday October 8, 2006 at 03:53:06 AM EDT * From the definitions ntpdsim-opts.def * and the template file options + * + * Generated from AutoOpts 27:5:3 templates. */ /* @@ -40,7 +42,7 @@ * tolerable version is at least as old as what was current when the header * template was released. */ -#define AO_TEMPLATE_VERSION 110592 +#define AO_TEMPLATE_VERSION 110597 #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \ || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION) # error option template version mismatches autoopts/options.h header @@ -116,7 +118,7 @@ typedef enum { #define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt) #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs) #define CLEAR_OPT(n) STMTS( \ - DESC(n).fOptState &= OPTST_PERSISTENT; \ + DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \ if ( (DESC(n).fOptState & OPTST_INITENABLED) == 0) \ DESC(n).fOptState |= OPTST_DISABLED; \ DESC(n).optCookie = NULL ) @@ -376,7 +378,7 @@ typedef enum { #define VALUE_OPT_HELP '?' #define VALUE_OPT_MORE_HELP '!' #define SET_OPT_SAVE_OPTS(a) STMTS( \ - DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT; \ + DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \ DESC(SAVE_OPTS).fOptState |= OPTST_SET; \ DESC(SAVE_OPTS).optArg.argString = (char const*)(a) ) /* diff --git a/ntpdc/ntpdc-opts.c b/ntpdc/ntpdc-opts.c index 571c069d0..d2b07d049 100644 --- a/ntpdc/ntpdc-opts.c +++ b/ntpdc/ntpdc-opts.c @@ -2,9 +2,11 @@ * * DO NOT EDIT THIS FILE (ntpdc-opts.c) * - * It has been AutoGen-ed Monday September 25, 2006 at 02:50:00 PM EDT + * It has been AutoGen-ed Sunday October 8, 2006 at 03:53:09 AM EDT * From the definitions ntpdc-opts.def * and the template file options + * + * Generated from AutoOpts 27:5:3 templates. */ /* diff --git a/ntpdc/ntpdc-opts.h b/ntpdc/ntpdc-opts.h index 83be94896..1a01d28af 100644 --- a/ntpdc/ntpdc-opts.h +++ b/ntpdc/ntpdc-opts.h @@ -2,9 +2,11 @@ * * DO NOT EDIT THIS FILE (ntpdc-opts.h) * - * It has been AutoGen-ed Monday September 25, 2006 at 02:49:59 PM EDT + * It has been AutoGen-ed Sunday October 8, 2006 at 03:53:09 AM EDT * From the definitions ntpdc-opts.def * and the template file options + * + * Generated from AutoOpts 27:5:3 templates. */ /* @@ -40,7 +42,7 @@ * tolerable version is at least as old as what was current when the header * template was released. */ -#define AO_TEMPLATE_VERSION 110592 +#define AO_TEMPLATE_VERSION 110597 #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \ || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION) # error option template version mismatches autoopts/options.h header @@ -88,7 +90,7 @@ typedef enum { #define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt) #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs) #define CLEAR_OPT(n) STMTS( \ - DESC(n).fOptState &= OPTST_PERSISTENT; \ + DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \ if ( (DESC(n).fOptState & OPTST_INITENABLED) == 0) \ DESC(n).fOptState |= OPTST_DISABLED; \ DESC(n).optCookie = NULL ) @@ -176,7 +178,7 @@ typedef enum { #define VALUE_OPT_HELP '?' #define VALUE_OPT_MORE_HELP '!' #define SET_OPT_SAVE_OPTS(a) STMTS( \ - DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT; \ + DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \ DESC(SAVE_OPTS).fOptState |= OPTST_SET; \ DESC(SAVE_OPTS).optArg.argString = (char const*)(a) ) /* diff --git a/ntpq/ntpq-opts.c b/ntpq/ntpq-opts.c index 9e827979f..5da6e50ac 100644 --- a/ntpq/ntpq-opts.c +++ b/ntpq/ntpq-opts.c @@ -2,9 +2,11 @@ * * DO NOT EDIT THIS FILE (ntpq-opts.c) * - * It has been AutoGen-ed Monday September 25, 2006 at 02:50:02 PM EDT + * It has been AutoGen-ed Sunday October 8, 2006 at 03:53:10 AM EDT * From the definitions ntpq-opts.def * and the template file options + * + * Generated from AutoOpts 27:5:3 templates. */ /* diff --git a/ntpq/ntpq-opts.h b/ntpq/ntpq-opts.h index dcc0e4e9e..5c42be9cc 100644 --- a/ntpq/ntpq-opts.h +++ b/ntpq/ntpq-opts.h @@ -2,9 +2,11 @@ * * DO NOT EDIT THIS FILE (ntpq-opts.h) * - * It has been AutoGen-ed Monday September 25, 2006 at 02:50:01 PM EDT + * It has been AutoGen-ed Sunday October 8, 2006 at 03:53:10 AM EDT * From the definitions ntpq-opts.def * and the template file options + * + * Generated from AutoOpts 27:5:3 templates. */ /* @@ -40,7 +42,7 @@ * tolerable version is at least as old as what was current when the header * template was released. */ -#define AO_TEMPLATE_VERSION 110592 +#define AO_TEMPLATE_VERSION 110597 #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \ || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION) # error option template version mismatches autoopts/options.h header @@ -86,7 +88,7 @@ typedef enum { #define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt) #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs) #define CLEAR_OPT(n) STMTS( \ - DESC(n).fOptState &= OPTST_PERSISTENT; \ + DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \ if ( (DESC(n).fOptState & OPTST_INITENABLED) == 0) \ DESC(n).fOptState |= OPTST_DISABLED; \ DESC(n).optCookie = NULL ) @@ -162,7 +164,7 @@ typedef enum { #define VALUE_OPT_HELP '?' #define VALUE_OPT_MORE_HELP '!' #define SET_OPT_SAVE_OPTS(a) STMTS( \ - DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT; \ + DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \ DESC(SAVE_OPTS).fOptState |= OPTST_SET; \ DESC(SAVE_OPTS).optArg.argString = (char const*)(a) ) /* diff --git a/ntpq/ntpq-opts.texi b/ntpq/ntpq-opts.texi index 573f1ae5f..b63061716 100644 --- a/ntpq/ntpq-opts.texi +++ b/ntpq/ntpq-opts.texi @@ -7,7 +7,7 @@ # # DO NOT EDIT THIS FILE (ntpq-opts.texi) # -# It has been AutoGen-ed Monday September 25, 2006 at 08:59:28 AM EDT +# It has been AutoGen-ed Sunday October 8, 2006 at 03:44:53 AM EDT # From the definitions ntpq-opts.def # and the template file aginfo.tpl @end ignore diff --git a/sntp/libopts/Makefile.am b/sntp/libopts/Makefile.am index 31b312ff8..cb8218088 100644 --- a/sntp/libopts/Makefile.am +++ b/sntp/libopts/Makefile.am @@ -1,10 +1,14 @@ ## LIBOPTS Makefile -MAINTAINERCLEANFILES = Makefile.in -lib_LTLIBRARIES = libopts.la -libopts_la_SOURCES = libopts.c -libopts_la_CPPFLAGS = -I$(top_srcdir) -libopts_la_LDFLAGS = -version-info 27:4:2 -EXTRA_DIST = \ +MAINTAINERCLEANFILES = Makefile.in +if INSTALL_LIBOPTS +lib_LTLIBRARIES = libopts.la +else +noinst_LTLIBRARIES = libopts.la +endif +libopts_la_SOURCES = libopts.c +libopts_la_CPPFLAGS = -I$(top_srcdir) +libopts_la_LDFLAGS = -version-info 27:5:3 +EXTRA_DIST = \ COPYING.lgpl COPYING.mbsd MakeDefs.inc \ README autoopts/options.h autoopts/usage-txt.h \ autoopts.c autoopts.h boolean.c \ diff --git a/sntp/libopts/autoopts.c b/sntp/libopts/autoopts.c index c08885083..a97083e49 100644 --- a/sntp/libopts/autoopts.c +++ b/sntp/libopts/autoopts.c @@ -1,7 +1,7 @@ /* - * $Id: autoopts.c,v 4.26 2006/09/24 02:10:44 bkorb Exp $ - * Time-stamp: "2006-09-22 18:21:53 bkorb" + * $Id: autoopts.c,v 4.27 2006/10/05 03:39:53 bkorb Exp $ + * Time-stamp: "2006-10-04 19:32:32 bkorb" * * This file contains all of the routines that must be linked into * an executable to use the generated option processing. The optional @@ -221,8 +221,8 @@ handleOption( tOptions* pOpts, tOptState* pOptState ) pOD->optActualIndex = pOD->optIndex; } - pOD->fOptState &= OPTST_PERSISTENT; - pOD->fOptState |= (pOptState->flags & ~OPTST_PERSISTENT); + pOD->fOptState &= OPTST_PERSISTENT_MASK; + pOD->fOptState |= (pOptState->flags & ~OPTST_PERSISTENT_MASK); /* * Keep track of count only for DEFINED (command line) options. @@ -558,11 +558,13 @@ nextOption( tOptions* pOpts, tOptState* pOptState ) { tSuccess res; enum { ARG_NONE, ARG_MAY, ARG_MUST } arg_type = ARG_NONE; + teOptArgType at; res = findOptDesc( pOpts, pOptState ); if (! SUCCESSFUL( res )) return res; - pOptState->flags |= (pOptState->pOD->fOptState & OPTST_PERSISTENT); + pOptState->flags |= (pOptState->pOD->fOptState & OPTST_PERSISTENT_MASK); + at = OPTST_GET_ARGTYPE(pOptState->flags); /* * Figure out what to do about option arguments. An argument may be @@ -572,7 +574,7 @@ nextOption( tOptions* pOpts, tOptState* pOptState ) */ if ((pOptState->flags & OPTST_DISABLED) != 0) arg_type = ARG_NONE; - else if (OPTST_GET_ARGTYPE(pOptState->flags) == OPARG_TYPE_NONE) + else if (at == OPARG_TYPE_NONE) arg_type = ARG_NONE; else if (pOptState->flags & OPTST_ARG_OPTIONAL) arg_type = ARG_MAY; diff --git a/sntp/libopts/autoopts/options.h b/sntp/libopts/autoopts/options.h index 1dfc6f0d8..97814ee3f 100644 --- a/sntp/libopts/autoopts/options.h +++ b/sntp/libopts/autoopts/options.h @@ -2,7 +2,7 @@ * * DO NOT EDIT THIS FILE (options.h) * - * It has been AutoGen-ed Sunday September 24, 2006 at 03:28:25 PM PDT + * It has been AutoGen-ed Thursday October 5, 2006 at 09:15:13 PM PDT * From the definitions funcs.def * and the template file options_h * @@ -60,6 +60,11 @@ * values for "opt_name" are available. */ +#define OPTIONS_STRUCT_VERSION 110597 +#define OPTIONS_VERSION_STRING "27:5:3" +#define OPTIONS_MINIMUM_VERSION 98304 +#define OPTIONS_MIN_VER_STRING "24:0:0" + typedef enum { OPARG_TYPE_NONE = 0, OPARG_TYPE_STRING = 1, /* default type/ vanilla string */ @@ -75,50 +80,96 @@ typedef struct optionValue { char* pzName; union { char strVal[1]; /* OPARG_TYPE_STRING */ - int enumVal; /* OPARG_TYPE_ENUMERATION */ - int boolVal; /* OPARG_TYPE_BOOLEAN */ - long setVal; /* OPARG_TYPE_MEMBERSHIP */ + unsigned int enumVal; /* OPARG_TYPE_ENUMERATION */ + unsigned int boolVal; /* OPARG_TYPE_BOOLEAN */ + unsigned long setVal; /* OPARG_TYPE_MEMBERSHIP */ long longVal; /* OPARG_TYPE_NUMERIC */ void* nestVal; /* OPARG_TYPE_HIERARCHY */ } v; } tOptionValue; -#define OPTST_SET_ARGTYPE(n) ((n) << 12) -#define OPTST_GET_ARGTYPE(f) (((f) & OPTST_ARG_TYPE_MASK) >> 12) - /* * Bits in the fOptState option descriptor field. */ -#define OPTST_INIT 0x0000000U /* Initial compiled value */ -#define OPTST_SET 0x0000001U /* Set via the "SET_OPT()" macro */ -#define OPTST_PRESET 0x0000002U /* Set via an RC/INI file */ -#define OPTST_DEFINED 0x0000004U /* Set via a command line option */ - -#define OPTST_SET_MASK 0x0000007U /* mask of flags that show set state */ - -#define OPTST_EQUIVALENCE 0x0000010U /* selected by equiv'ed option */ -#define OPTST_DISABLED 0x0000020U /* option is in disabled state */ - -#define OPTST_NO_INIT 0x0000100U /* option cannot be preset */ -#define OPTST_NUMBER_OPT 0x0000200U /* opt value (flag) is any digit */ -#define OPTST_STACKED 0x0000400U /* opt uses optionStackArg procedure */ -#define OPTST_INITENABLED 0x0000800U /* option defaults to enabled */ -#define OPTST_ARG_TYPE_MASK 0x000F000U /* bits used to specify opt arg type */ -#define OPTST_ARG_OPTIONAL 0x0010000U /* the option argument not required */ -#define OPTST_IMM 0x0020000U /* process option on first pass */ -#define OPTST_DISABLE_IMM 0x0040000U /* process disablement on first pass */ -#define OPTST_OMITTED 0x0080000U /* compiled out of program */ -#define OPTST_MUST_SET 0x0100000U /* must be set or pre-set */ -#define OPTST_DOCUMENT 0x0200000U /* opt is for documentation only */ -#define OPTST_TWICE 0x0400000U /* process option twice - imm + reg */ -#define OPTST_DISABLE_TWICE 0x0800000U /* process disabled option twice */ - -#define OPTST_PERSISTENT 0xFFFFF00U /* mask of flags that do not change */ - -#define SELECTED_OPT( pod ) ( (pod)->fOptState & (OPTST_SET | OPTST_DEFINED)) -#define UNUSED_OPT( pod ) (((pod)->fOptState & OPTST_SET_MASK) == 0) -#define DISABLED_OPT( pod ) ( (pod)->fOptState & OPTST_DISABLED) -#define OPTION_STATE( pod ) ((pod)->fOptState) +typedef enum { + OPTST_SET_ID = 0, /* Set via the "SET_OPT()" macro */ + OPTST_PRESET_ID = 1, /* Set via an RC/INI file */ + OPTST_DEFINED_ID = 2, /* Set via a command line option */ + OPTST_EQUIVALENCE_ID = 4, /* selected by equiv'ed option */ + OPTST_DISABLED_ID = 5, /* option is in disabled state */ + OPTST_NO_INIT_ID = 8, /* option cannot be preset */ + OPTST_NUMBER_OPT_ID = 9, /* opt value (flag) is any digit */ + OPTST_STACKED_ID = 10, /* opt uses optionStackArg proc */ + OPTST_INITENABLED_ID = 11, /* option defaults to enabled */ + OPTST_ARG_TYPE_1_ID = 12, /* bit 1 of arg type enum */ + OPTST_ARG_TYPE_2_ID = 13, /* bit 2 of arg type enum */ + OPTST_ARG_TYPE_3_ID = 14, /* bit 3 of arg type enum */ + OPTST_ARG_TYPE_4_ID = 15, /* bit 4 of arg type enum */ + OPTST_ARG_OPTIONAL_ID = 16, /* the option arg not required */ + OPTST_IMM_ID = 17, /* process opt on first pass */ + OPTST_DISABLE_IMM_ID = 18, /* process disablement immed. */ + OPTST_OMITTED_ID = 19, /* compiled out of program */ + OPTST_MUST_SET_ID = 20, /* must be set or pre-set */ + OPTST_DOCUMENT_ID = 21, /* opt is for doc only */ + OPTST_TWICE_ID = 22, /* process opt twice - imm + reg */ + OPTST_DISABLE_TWICE_ID = 23 /* process disabled option twice */ +} opt_state_enum_t; + +#define OPTST_INIT 0U +#define OPTST_SET (1U << OPTST_SET_ID) +#define OPTST_PRESET (1U << OPTST_PRESET_ID) +#define OPTST_DEFINED (1U << OPTST_DEFINED_ID) +#define OPTST_EQUIVALENCE (1U << OPTST_EQUIVALENCE_ID) +#define OPTST_DISABLED (1U << OPTST_DISABLED_ID) +#define OPTST_NO_INIT (1U << OPTST_NO_INIT_ID) +#define OPTST_NUMBER_OPT (1U << OPTST_NUMBER_OPT_ID) +#define OPTST_STACKED (1U << OPTST_STACKED_ID) +#define OPTST_INITENABLED (1U << OPTST_INITENABLED_ID) +#define OPTST_ARG_TYPE_1 (1U << OPTST_ARG_TYPE_1_ID) +#define OPTST_ARG_TYPE_2 (1U << OPTST_ARG_TYPE_2_ID) +#define OPTST_ARG_TYPE_3 (1U << OPTST_ARG_TYPE_3_ID) +#define OPTST_ARG_TYPE_4 (1U << OPTST_ARG_TYPE_4_ID) +#define OPTST_ARG_OPTIONAL (1U << OPTST_ARG_OPTIONAL_ID) +#define OPTST_IMM (1U << OPTST_IMM_ID) +#define OPTST_DISABLE_IMM (1U << OPTST_DISABLE_IMM_ID) +#define OPTST_OMITTED (1U << OPTST_OMITTED_ID) +#define OPTST_MUST_SET (1U << OPTST_MUST_SET_ID) +#define OPTST_DOCUMENT (1U << OPTST_DOCUMENT_ID) +#define OPTST_TWICE (1U << OPTST_TWICE_ID) +#define OPTST_DISABLE_TWICE (1U << OPTST_DISABLE_TWICE_ID) +#define OPT_STATE_MASK 0x00FFFF37U + +#define OPTST_SET_MASK ( \ + OPTST_SET | \ + OPTST_PRESET | \ + OPTST_DEFINED ) + +#define OPTST_MUTABLE_MASK ( \ + OPTST_SET | \ + OPTST_PRESET | \ + OPTST_DEFINED | \ + OPTST_EQUIVALENCE | \ + OPTST_DISABLED ) + +#define OPTST_SELECTED_MASK ( \ + OPTST_SET | \ + OPTST_DEFINED ) + +#define OPTST_ARG_TYPE_MASK ( \ + OPTST_ARG_TYPE_1 | \ + OPTST_ARG_TYPE_2 | \ + OPTST_ARG_TYPE_3 | \ + OPTST_ARG_TYPE_4 ) + +#define OPTST_PERSISTENT_MASK (~OPTST_MUTABLE_MASK) + +#define SELECTED_OPT( pod ) ((pod)->fOptState & OPTST_SELECTED_MASK) +#define UNUSED_OPT( pod ) (((pod)->fOptState & OPTST_SET_MASK) == 0) +#define DISABLED_OPT( pod ) ((pod)->fOptState & OPTST_DISABLED) +#define OPTION_STATE( pod ) ((pod)->fOptState) + +#define OPTST_SET_ARGTYPE(n) ((n) << OPTST_ARG_TYPE_1_ID) +#define OPTST_GET_ARGTYPE(f) (((f) & OPTST_ARG_TYPE_MASK)>>OPTST_ARG_TYPE_1_ID) /* * PRIVATE INTERFACES @@ -129,25 +180,45 @@ typedef struct optionValue { */ /* - * Define any special processing flags - */ -#define OPTPROC_NONE 0x000000 -#define OPTPROC_LONGOPT 0x000001 /* Process long style options */ -#define OPTPROC_SHORTOPT 0x000002 /* Process short style "flags" */ -#define OPTPROC_ERRSTOP 0x000004 /* Stop on argument errors */ -#define OPTPROC_DISABLEDOPT 0x000008 /* Current option is disabled */ -#define OPTPROC_NO_REQ_OPT 0x000010 /* no options are required */ -#define OPTPROC_NUM_OPT 0x000020 /* there is a number option */ -#define OPTPROC_INITDONE 0x000040 /* have initializations been done? */ -#define OPTPROC_NEGATIONS 0x000080 /* any negation options? */ -#define OPTPROC_ENVIRON 0x000100 /* check environment? */ -#define OPTPROC_NO_ARGS 0x000200 /* Disallow remaining arguments */ -#define OPTPROC_ARGS_REQ 0x000400 /* Require arguments after options */ -#define OPTPROC_REORDER 0x000800 /* reorder arguments after options */ -#define OPTPROC_GNUUSAGE 0x001000 /* emit usage in GNU style */ -#define OPTPROC_TRANSLATE 0x002000 /* Translate strings in tOptions */ -#define OPTPROC_HAS_IMMED 0x004000 /* program defines immed options */ -#define OPTPROC_PRESETTING 0x800000 /* opt processing in preset state */ + * Define the processing state flags + */ +typedef enum { + OPTPROC_LONGOPT_ID = 0, /* Process long style options */ + OPTPROC_SHORTOPT_ID = 1, /* Process short style "flags" */ + OPTPROC_ERRSTOP_ID = 2, /* Stop on argument errors */ + OPTPROC_DISABLEDOPT_ID = 3, /* Current option is disabled */ + OPTPROC_NO_REQ_OPT_ID = 4, /* no options are required */ + OPTPROC_NUM_OPT_ID = 5, /* there is a number option */ + OPTPROC_INITDONE_ID = 6, /* have initializations been done? */ + OPTPROC_NEGATIONS_ID = 7, /* any negation options? */ + OPTPROC_ENVIRON_ID = 8, /* check environment? */ + OPTPROC_NO_ARGS_ID = 9, /* Disallow remaining arguments */ + OPTPROC_ARGS_REQ_ID = 10, /* Require arguments after options */ + OPTPROC_REORDER_ID = 11, /* reorder operands after options */ + OPTPROC_GNUUSAGE_ID = 12, /* emit usage in GNU style */ + OPTPROC_TRANSLATE_ID = 13, /* Translate strings in tOptions */ + OPTPROC_HAS_IMMED_ID = 14, /* program defines immed options */ + OPTPROC_PRESETTING_ID = 19 /* opt processing in preset state */ +} optproc_state_enum_t; + +#define OPTPROC_NONE 0U +#define OPTPROC_LONGOPT (1U << OPTPROC_LONGOPT_ID) +#define OPTPROC_SHORTOPT (1U << OPTPROC_SHORTOPT_ID) +#define OPTPROC_ERRSTOP (1U << OPTPROC_ERRSTOP_ID) +#define OPTPROC_DISABLEDOPT (1U << OPTPROC_DISABLEDOPT_ID) +#define OPTPROC_NO_REQ_OPT (1U << OPTPROC_NO_REQ_OPT_ID) +#define OPTPROC_NUM_OPT (1U << OPTPROC_NUM_OPT_ID) +#define OPTPROC_INITDONE (1U << OPTPROC_INITDONE_ID) +#define OPTPROC_NEGATIONS (1U << OPTPROC_NEGATIONS_ID) +#define OPTPROC_ENVIRON (1U << OPTPROC_ENVIRON_ID) +#define OPTPROC_NO_ARGS (1U << OPTPROC_NO_ARGS_ID) +#define OPTPROC_ARGS_REQ (1U << OPTPROC_ARGS_REQ_ID) +#define OPTPROC_REORDER (1U << OPTPROC_REORDER_ID) +#define OPTPROC_GNUUSAGE (1U << OPTPROC_GNUUSAGE_ID) +#define OPTPROC_TRANSLATE (1U << OPTPROC_TRANSLATE_ID) +#define OPTPROC_HAS_IMMED (1U << OPTPROC_HAS_IMMED_ID) +#define OPTPROC_PRESETTING (1U << OPTPROC_PRESETTING_ID) +#define OPTPROC_STATE_MASK 0x00087FFFU #define STMTS(s) do { s; } while (0) @@ -219,10 +290,11 @@ struct argList { typedef union { char const * argString; + uintptr_t argEnum; uintptr_t argIntptr; - int argInt; - unsigned int argUint; - ag_bool argBool; + long argInt; + unsigned long argUint; + unsigned int argBool; } optArgBucket_t; /* @@ -269,11 +341,6 @@ struct optSpecIndex { const tAoUS default_opt; }; -#define OPTIONS_STRUCT_VERSION 110595 -#define OPTIONS_VERSION_STRING "27:4:3" -#define OPTIONS_MINIMUM_VERSION 98304 -#define OPTIONS_MIN_VER_STRING "24:0:0" - /* * The procedure generated for translating option text */ @@ -610,7 +677,7 @@ extern const tOptionValue* optionNextValue( const tOptionValue*, const tOptionVa extern void optionOnlyUsage( tOptions*, int ); -/* From: autoopts.c line 980 +/* From: autoopts.c line 982 * * optionProcess - this is the main option processing routine * diff --git a/sntp/libopts/autoopts/usage-txt.h b/sntp/libopts/autoopts/usage-txt.h index 8bc08065b..9c7079b8c 100644 --- a/sntp/libopts/autoopts/usage-txt.h +++ b/sntp/libopts/autoopts/usage-txt.h @@ -2,7 +2,7 @@ * * DO NOT EDIT THIS FILE (usage-txt.h) * - * It has been AutoGen-ed Sunday September 24, 2006 at 03:28:22 PM PDT + * It has been AutoGen-ed Thursday October 5, 2006 at 09:15:10 PM PDT * From the definitions usage-txt.def * and the template file usage-txt.tpl * diff --git a/sntp/libopts/configfile.c b/sntp/libopts/configfile.c index bdde8de80..59037d6b2 100644 --- a/sntp/libopts/configfile.c +++ b/sntp/libopts/configfile.c @@ -1,5 +1,5 @@ /* - * $Id: configfile.c,v 4.28 2006/09/24 02:10:45 bkorb Exp $ + * $Id: configfile.c,v 4.29 2006/09/28 01:26:16 bkorb Exp $ * Time-stamp: "2006-09-24 15:18:51 bkorb" * * configuration/rc/ini file handling. diff --git a/sntp/libopts/cook.c b/sntp/libopts/cook.c index 9685d0641..56d4c0408 100644 --- a/sntp/libopts/cook.c +++ b/sntp/libopts/cook.c @@ -1,6 +1,6 @@ /* - * $Id: cook.c,v 4.8 2006/09/24 02:10:45 bkorb Exp $ + * $Id: cook.c,v 4.9 2006/09/28 01:26:16 bkorb Exp $ * Time-stamp: "2006-09-24 15:21:02 bkorb" * * This file contains the routines that deal with processing quoted strings diff --git a/sntp/libopts/enumeration.c b/sntp/libopts/enumeration.c index 4586967c7..dd51b1111 100644 --- a/sntp/libopts/enumeration.c +++ b/sntp/libopts/enumeration.c @@ -1,7 +1,7 @@ /* * $Id: enumeration.c,v 4.14 2006/09/24 02:10:45 bkorb Exp $ - * Time-stamp: "2006-09-22 18:00:53 bkorb" + * Time-stamp: "2006-10-05 21:10:21 bkorb" * * Automated Options Paged Usage module. * @@ -235,7 +235,7 @@ optionKeywordName( { tOptDesc od; - od.optArg.argIntptr = enum_val; + od.optArg.argEnum = enum_val; (*(pOD->pOptProc))( (void*)(2UL), &od ); return od.optArg.argString; } @@ -280,7 +280,7 @@ optionEnumerationVal( case 1UL: { - unsigned int ix = pOD->optArg.argIntptr; + unsigned int ix = pOD->optArg.argEnum; /* * print the name string. */ @@ -293,7 +293,7 @@ optionEnumerationVal( case 2UL: { tSCC zInval[] = "*INVALID*"; - unsigned int ix = pOD->optArg.argIntptr; + unsigned int ix = pOD->optArg.argEnum; /* * Replace the enumeration value with the name string. */ diff --git a/sntp/libopts/genshell.c b/sntp/libopts/genshell.c index 7c5e12f74..c7331f49f 100644 --- a/sntp/libopts/genshell.c +++ b/sntp/libopts/genshell.c @@ -2,9 +2,11 @@ * * DO NOT EDIT THIS FILE (genshell.c) * - * It has been AutoGen-ed Sunday September 24, 2006 at 03:28:26 PM PDT + * It has been AutoGen-ed Thursday October 5, 2006 at 09:15:14 PM PDT * From the definitions genshell.def * and the template file options + * + * Generated from AutoOpts 27:5:3 templates. */ /* diff --git a/sntp/libopts/genshell.h b/sntp/libopts/genshell.h index 44760b784..e7c524eab 100644 --- a/sntp/libopts/genshell.h +++ b/sntp/libopts/genshell.h @@ -2,9 +2,11 @@ * * DO NOT EDIT THIS FILE (genshell.h) * - * It has been AutoGen-ed Sunday September 24, 2006 at 03:28:26 PM PDT + * It has been AutoGen-ed Thursday October 5, 2006 at 09:15:14 PM PDT * From the definitions genshell.def * and the template file options + * + * Generated from AutoOpts 27:5:3 templates. */ /* @@ -53,7 +55,7 @@ * tolerable version is at least as old as what was current when the header * template was released. */ -#define AO_TEMPLATE_VERSION 110592 +#define AO_TEMPLATE_VERSION 110597 #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \ || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION) # error option template version mismatches autoopts/options.h header @@ -91,7 +93,7 @@ typedef enum { #define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt) #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs) #define CLEAR_OPT(n) STMTS( \ - DESC(n).fOptState &= OPTST_PERSISTENT; \ + DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \ if ( (DESC(n).fOptState & OPTST_INITENABLED) == 0) \ DESC(n).fOptState |= OPTST_DISABLED; \ DESC(n).optCookie = NULL ) diff --git a/sntp/libopts/load.c b/sntp/libopts/load.c index 46ac97dc2..45fb53a47 100644 --- a/sntp/libopts/load.c +++ b/sntp/libopts/load.c @@ -1,6 +1,6 @@ /* - * $Id: load.c,v 4.25 2006/09/24 02:10:45 bkorb Exp $ + * $Id: load.c,v 4.26 2006/09/28 01:26:16 bkorb Exp $ * Time-stamp: "2006-09-24 15:23:01 bkorb" * * This file contains the routines that deal with processing text strings diff --git a/sntp/libopts/m4/libopts.m4 b/sntp/libopts/m4/libopts.m4 index 6fea8bfd7..4c6f71151 100644 --- a/sntp/libopts/m4/libopts.m4 +++ b/sntp/libopts/m4/libopts.m4 @@ -2,7 +2,7 @@ dnl -*- buffer-read-only: t -*- vi: set ro: dnl dnl DO NOT EDIT THIS FILE (libopts.m4) dnl -dnl It has been AutoGen-ed Sunday September 24, 2006 at 03:28:29 PM PDT +dnl It has been AutoGen-ed Thursday October 5, 2006 at 09:15:16 PM PDT dnl From the definitions libopts.def dnl and the template file conftest.tpl dnl diff --git a/sntp/libopts/makeshell.c b/sntp/libopts/makeshell.c index 4051a27b5..088df02f9 100644 --- a/sntp/libopts/makeshell.c +++ b/sntp/libopts/makeshell.c @@ -1,7 +1,7 @@ /* - * $Id: makeshell.c,v 4.17 2006/09/24 02:10:45 bkorb Exp $ - * Time-stamp: "2006-09-22 18:19:24 bkorb" + * $Id: makeshell.c,v 4.18 2006/10/05 03:39:53 bkorb Exp $ + * Time-stamp: "2006-10-05 20:41:23 bkorb" * * This module will interpret the options set in the tOptions * structure and create a Bourne shell script capable of parsing them. @@ -699,12 +699,21 @@ emitSetup( tOptions* pOpts ) * Numeric and membership bit options are just printed as a number. */ case OPARG_TYPE_NUMERIC: - case OPARG_TYPE_MEMBERSHIP: snprintf( zVal, sizeof( zVal ), "%d", - (int)pOptDesc->optArg.argIntptr ); + (int)pOptDesc->optArg.argInt ); pzDefault = zVal; break; + case OPARG_TYPE_MEMBERSHIP: + snprintf( zVal, sizeof( zVal ), "%lu", + (unsigned long)pOptDesc->optArg.argIntptr ); + pzDefault = zVal; + break; + + case OPARG_TYPE_BOOLEAN: + pzDefault = (pOptDesc->optArg.argBool) ? "true" : "false"; + break; + default: if (pOptDesc->optArg.argString == NULL) { if (pzFmt == zSingleDef) diff --git a/sntp/libopts/nested.c b/sntp/libopts/nested.c index 013b742c3..0989cec17 100644 --- a/sntp/libopts/nested.c +++ b/sntp/libopts/nested.c @@ -1,6 +1,6 @@ /* - * $Id: nested.c,v 4.13 2006/09/24 02:10:45 bkorb Exp $ + * $Id: nested.c,v 4.14 2006/09/28 01:26:16 bkorb Exp $ * Time-stamp: "2006-09-24 15:27:32 bkorb" * * Automated Options Nested Values module. diff --git a/sntp/libopts/numeric.c b/sntp/libopts/numeric.c index 486981fb5..a186984e6 100644 --- a/sntp/libopts/numeric.c +++ b/sntp/libopts/numeric.c @@ -1,7 +1,7 @@ /* - * $Id: numeric.c,v 4.9 2006/09/24 02:10:45 bkorb Exp $ - * Time-stamp: "2006-09-22 18:14:38 bkorb" + * $Id: numeric.c,v 4.10 2006/10/05 03:39:53 bkorb Exp $ + * Time-stamp: "2006-10-04 16:12:34 bkorb" */ /* @@ -61,7 +61,7 @@ void optionNumericVal( tOptions* pOpts, tOptDesc* pOD ) { char* pz; - int val; + long val; /* * Numeric options may have a range associated with it. @@ -71,7 +71,7 @@ optionNumericVal( tOptions* pOpts, tOptDesc* pOD ) if ((pOD == NULL) || (pOD->optArg.argString == NULL)) return; - val = (int)strtol( pOD->optArg.argString, &pz, 0 ); + val = strtol( pOD->optArg.argString, &pz, 0 ); if (*pz != NUL) { fprintf( stderr, zNotNumber, pOpts->pzProgName, pOD->optArg.argString ); (*(pOpts->pUsageProc))(pOpts, EXIT_FAILURE); diff --git a/sntp/libopts/proto.h b/sntp/libopts/proto.h index 80f1d06e3..70a421b10 100644 --- a/sntp/libopts/proto.h +++ b/sntp/libopts/proto.h @@ -1,7 +1,7 @@ /* -*- buffer-read-only: t -*- vi: set ro: * * Prototypes for autoopts - * Generated Sun Sep 24 15:28:27 PDT 2006 + * Generated Thu Oct 5 21:15:15 PDT 2006 */ #ifndef AUTOOPTS_PROTO_H_GUARD #define AUTOOPTS_PROTO_H_GUARD 1 diff --git a/sntp/libopts/putshell.c b/sntp/libopts/putshell.c index fda77eea7..a9ff3ef42 100644 --- a/sntp/libopts/putshell.c +++ b/sntp/libopts/putshell.c @@ -1,7 +1,7 @@ /* - * $Id: putshell.c,v 4.14 2006/09/24 02:10:45 bkorb Exp $ - * Time-stamp: "2006-09-24 15:28:15 bkorb" + * $Id: putshell.c,v 4.16 2006/10/05 03:39:53 bkorb Exp $ + * Time-stamp: "2006-10-05 20:37:42 bkorb" * * This module will interpret the options set in the tOptions * structure and print them to standard out in a fashion that @@ -164,8 +164,8 @@ optionPutShell( tOptions* pOpts ) if (pOD->optActualIndex != optIx) { tOptDesc* p = pOpts->pOptDesc + pOD->optActualIndex; p->optArg = pOD->optArg; - p->fOptState &= OPTST_PERSISTENT; - p->fOptState |= pOD->fOptState & ~OPTST_PERSISTENT; + p->fOptState &= OPTST_PERSISTENT_MASK; + p->fOptState |= pOD->fOptState & ~OPTST_PERSISTENT_MASK; printf( zEquivMode, pOpts->pzPROGNAME, pOD->pz_NAME, p->pz_NAME ); pOD = p; } @@ -176,7 +176,7 @@ optionPutShell( tOptions* pOpts ) * of bitmask value and we need to emit the bit values. */ if (OPTST_GET_ARGTYPE(pOD->fOptState) == OPARG_TYPE_MEMBERSHIP) { - char* pz; + char const * pz; uintptr_t val = 1; printf( zOptNumFmt, pOpts->pzPROGNAME, pOD->pz_NAME, (uintptr_t)(pOD->optCookie) ); @@ -187,7 +187,7 @@ optionPutShell( tOptions* pOpts ) * We are building the typeset list. The list returned starts with * 'none + ' for use by option saving stuff. We must ignore that. */ - pz = (char*)pOD->optArg.argString + 7; + pz = pOD->optArg.argString + 7; while (*pz != NUL) { printf( "typeset -x -i %s_", pOD->pz_NAME ); pz += strspn( pz, " +\t\n\f" ); @@ -256,7 +256,7 @@ optionPutShell( tOptions* pOpts ) */ else if (OPTST_GET_ARGTYPE(pOD->fOptState) == OPARG_TYPE_NUMERIC) printf( zOptNumFmt, pOpts->pzPROGNAME, pOD->pz_NAME, - pOD->optArg.argIntptr ); + (int)pOD->optArg.argInt ); /* * If the argument type is an enumeration, then it is much @@ -277,7 +277,7 @@ optionPutShell( tOptions* pOpts ) */ else if (OPTST_GET_ARGTYPE(pOD->fOptState) == OPARG_TYPE_BOOLEAN) printf( zFullOptFmt, pOpts->pzPROGNAME, pOD->pz_NAME, - (pOD->optArg.argIntptr == 0) ? "false" : "true" ); + (pOD->optArg.argBool == 0) ? "false" : "true" ); /* * IF the option has an empty value, diff --git a/sntp/libopts/restore.c b/sntp/libopts/restore.c index 0bd7e1f07..c5d56f9c7 100644 --- a/sntp/libopts/restore.c +++ b/sntp/libopts/restore.c @@ -1,6 +1,6 @@ /* - * restore.c $Id: restore.c,v 4.8 2006/09/24 02:10:45 bkorb Exp $ + * restore.c $Id: restore.c,v 4.9 2006/10/05 03:39:53 bkorb Exp $ * Time-stamp: "2005-02-23 15:10:20 bkorb" * * This module's routines will save the current option state to memory @@ -181,7 +181,7 @@ optionFree( tOptions* pOpts ) if ( (p->fOptState & OPTST_STACKED) && (p->optCookie != NULL)) { AGFREE( p->optCookie ); - p->fOptState &= OPTST_PERSISTENT; + p->fOptState &= OPTST_PERSISTENT_MASK; if ((p->fOptState & OPTST_INITENABLED) == 0) p->fOptState |= OPTST_DISABLED; } diff --git a/sntp/libopts/save.c b/sntp/libopts/save.c index 6c5666e0c..573508c56 100644 --- a/sntp/libopts/save.c +++ b/sntp/libopts/save.c @@ -1,7 +1,7 @@ /* - * save.c $Id: save.c,v 4.19 2006/09/24 02:10:45 bkorb Exp $ - * Time-stamp: "2006-09-22 18:11:20 bkorb" + * save.c $Id: save.c,v 4.20 2006/10/05 03:39:53 bkorb Exp $ + * Time-stamp: "2006-10-05 21:09:18 bkorb" * * This module's routines will take the currently set options and * store them into an ".rc" file for re-interpretation the next @@ -437,7 +437,7 @@ optionSaveFile( tOptions* pOpts ) switch (arg_state) { case 0: case OPARG_TYPE_NUMERIC: - printEntry( fp, p, p->optArg.argString ); + printEntry( fp, p, (void*)(p->optArg.argInt)); break; case OPARG_TYPE_STRING: @@ -462,26 +462,25 @@ optionSaveFile( tOptions* pOpts ) case OPARG_TYPE_ENUMERATION: case OPARG_TYPE_MEMBERSHIP: { - tCC* val = p->optArg.argString; + uintptr_t val = p->optArg.argEnum; /* * This is a magic incantation that will convert the * bit flag values back into a string suitable for printing. */ (*(p->pOptProc))( (tOptions*)2UL, p ); - printEntry( fp, p, p->optArg.argString ); + printEntry( fp, p, (void*)(p->optArg.argString)); if ( (p->optArg.argString != NULL) && (arg_state != OPARG_TYPE_ENUMERATION)) /* * bit flag and enumeration strings get allocated */ AGFREE( (void*)p->optArg.argString ); - p->optArg.argString = val; + p->optArg.argEnum = val; break; } case OPARG_TYPE_BOOLEAN: - printEntry( fp, p, (p->optArg.argBool != AG_FALSE) - ? "true" : "false" ); + printEntry( fp, p, p->optArg.argBool ? "true" : "false" ); break; default: diff --git a/sntp/libopts/stack.c b/sntp/libopts/stack.c index fb78898e1..9d8f3a3d9 100644 --- a/sntp/libopts/stack.c +++ b/sntp/libopts/stack.c @@ -1,7 +1,7 @@ /* * stack.c - * $Id: stack.c,v 4.12 2006/09/24 02:10:45 bkorb Exp $ + * $Id: stack.c,v 4.13 2006/10/05 03:39:53 bkorb Exp $ * Time-stamp: "2006-09-22 18:13:19 bkorb" * * This is a special option processing routine that will save the @@ -78,7 +78,7 @@ optionUnstackArg( * THEN indicate that we don't have any of these options */ if (pAL == NULL) { - pOptDesc->fOptState &= OPTST_PERSISTENT; + pOptDesc->fOptState &= OPTST_PERSISTENT_MASK; if ( (pOptDesc->fOptState & OPTST_INITENABLED) == 0) pOptDesc->fOptState |= OPTST_DISABLED; return; @@ -177,7 +177,7 @@ optionUnstackArg( * THEN indicate that we don't have any of these options */ if (pAL->useCt == 0) { - pOptDesc->fOptState &= OPTST_PERSISTENT; + pOptDesc->fOptState &= OPTST_PERSISTENT_MASK; if ( (pOptDesc->fOptState & OPTST_INITENABLED) == 0) pOptDesc->fOptState |= OPTST_DISABLED; free( (void*)pAL ); diff --git a/sntp/sntp-opts.c b/sntp/sntp-opts.c index d1d4d331a..2f5a6d3d8 100644 --- a/sntp/sntp-opts.c +++ b/sntp/sntp-opts.c @@ -2,9 +2,11 @@ * * DO NOT EDIT THIS FILE (sntp-opts.c) * - * It has been AutoGen-ed Monday September 25, 2006 at 02:50:04 PM EDT + * It has been AutoGen-ed Sunday October 8, 2006 at 03:53:12 AM EDT * From the definitions sntp-opts.def * and the template file options + * + * Generated from AutoOpts 27:5:3 templates. */ /* diff --git a/sntp/sntp-opts.h b/sntp/sntp-opts.h index 4db8a182e..c5b10b7c2 100644 --- a/sntp/sntp-opts.h +++ b/sntp/sntp-opts.h @@ -2,9 +2,11 @@ * * DO NOT EDIT THIS FILE (sntp-opts.h) * - * It has been AutoGen-ed Monday September 25, 2006 at 02:50:03 PM EDT + * It has been AutoGen-ed Sunday October 8, 2006 at 03:53:12 AM EDT * From the definitions sntp-opts.def * and the template file options + * + * Generated from AutoOpts 27:5:3 templates. */ /* @@ -119,7 +121,7 @@ * tolerable version is at least as old as what was current when the header * template was released. */ -#define AO_TEMPLATE_VERSION 110592 +#define AO_TEMPLATE_VERSION 110597 #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \ || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION) # error option template version mismatches autoopts/options.h header @@ -164,7 +166,7 @@ typedef enum { #define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt) #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs) #define CLEAR_OPT(n) STMTS( \ - DESC(n).fOptState &= OPTST_PERSISTENT; \ + DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \ if ( (DESC(n).fOptState & OPTST_INITENABLED) == 0) \ DESC(n).fOptState |= OPTST_DISABLED; \ DESC(n).optCookie = NULL ) @@ -230,7 +232,7 @@ typedef enum { #define VALUE_OPT_HELP '?' #define VALUE_OPT_MORE_HELP '!' #define SET_OPT_SAVE_OPTS(a) STMTS( \ - DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT; \ + DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \ DESC(SAVE_OPTS).fOptState |= OPTST_SET; \ DESC(SAVE_OPTS).optArg.argString = (char const*)(a) ) /* diff --git a/util/ntp-keygen-opts.c b/util/ntp-keygen-opts.c index 74e4eba27..3700a617d 100644 --- a/util/ntp-keygen-opts.c +++ b/util/ntp-keygen-opts.c @@ -2,9 +2,11 @@ * * DO NOT EDIT THIS FILE (ntp-keygen-opts.c) * - * It has been AutoGen-ed Monday September 25, 2006 at 02:50:06 PM EDT + * It has been AutoGen-ed Sunday October 8, 2006 at 03:53:14 AM EDT * From the definitions ntp-keygen-opts.def * and the template file options + * + * Generated from AutoOpts 27:5:3 templates. */ /* @@ -886,7 +888,7 @@ doOptModulus( { static const struct {const int rmin, rmax;} rng[ 1 ] = { { 256, 2048 } }; - long val; + int val; int ix; char const* pzIndent = "\t\t\t\t "; extern FILE* option_usage_fp; @@ -923,7 +925,7 @@ doOptModulus( return; valid_return: - pOptDesc->optArg.argString = (char*)val; + pOptDesc->optArg.argInt = val; } #endif /* defined OPENSSL */ diff --git a/util/ntp-keygen-opts.h b/util/ntp-keygen-opts.h index fd6192b2f..3f98056bd 100644 --- a/util/ntp-keygen-opts.h +++ b/util/ntp-keygen-opts.h @@ -2,9 +2,11 @@ * * DO NOT EDIT THIS FILE (ntp-keygen-opts.h) * - * It has been AutoGen-ed Monday September 25, 2006 at 02:50:05 PM EDT + * It has been AutoGen-ed Sunday October 8, 2006 at 03:53:13 AM EDT * From the definitions ntp-keygen-opts.def * and the template file options + * + * Generated from AutoOpts 27:5:3 templates. */ /* @@ -40,7 +42,7 @@ * tolerable version is at least as old as what was current when the header * template was released. */ -#define AO_TEMPLATE_VERSION 110592 +#define AO_TEMPLATE_VERSION 110597 #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \ || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION) # error option template version mismatches autoopts/options.h header @@ -97,7 +99,7 @@ typedef enum { #define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt) #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs) #define CLEAR_OPT(n) STMTS( \ - DESC(n).fOptState &= OPTST_PERSISTENT; \ + DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \ if ( (DESC(n).fOptState & OPTST_INITENABLED) == 0) \ DESC(n).fOptState |= OPTST_DISABLED; \ DESC(n).optCookie = NULL ) @@ -272,7 +274,7 @@ typedef enum { #define VALUE_OPT_HELP '?' #define VALUE_OPT_MORE_HELP '!' #define SET_OPT_SAVE_OPTS(a) STMTS( \ - DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT; \ + DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \ DESC(SAVE_OPTS).fOptState |= OPTST_SET; \ DESC(SAVE_OPTS).optArg.argString = (char const*)(a) ) /*