From: Harlan Stenn Date: Sun, 24 Sep 2006 07:03:52 +0000 (-0400) Subject: autogen upgrade X-Git-Tag: NTP_4_2_3P50~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fd26cd5e9f083a972b485d8dc7245fdaa2618316;p=thirdparty%2Fntp.git autogen upgrade bk: 45162dd8HZG0jJRK_Q5s1gG5kfNu1g --- diff --git a/clockstuff/clktest-opts.c b/clockstuff/clktest-opts.c index fe2e317ee..20077cc66 100644 --- a/clockstuff/clktest-opts.c +++ b/clockstuff/clktest-opts.c @@ -2,7 +2,7 @@ * * DO NOT EDIT THIS FILE (clktest-opts.c) * - * It has been AutoGen-ed Saturday September 9, 2006 at 05:39:57 PM EDT + * It has been AutoGen-ed Sunday September 24, 2006 at 02:18:25 AM EDT * From the definitions clktest-opts.def * and the template file options */ @@ -24,8 +24,8 @@ */ -#include #include +#include #define OPTION_CODE_COMPILE 1 #include "clktest-opts.h" @@ -67,7 +67,7 @@ tSCC zMagic2Text[] = tSCC zMagic2_NAME[] = "MAGIC2"; tSCC zMagic2_Name[] = "magic2"; #define MAGIC2_FLAGS (OPTST_DISABLED \ - | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC)) + | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC)) #else /* disable Magic2 */ #define VALUE_OPT_MAGIC2 NO_EQUIVALENT @@ -86,7 +86,7 @@ tSCC zMagic1Text[] = tSCC zMagic1_NAME[] = "MAGIC1"; tSCC zMagic1_Name[] = "magic1"; #define MAGIC1_FLAGS (OPTST_DISABLED \ - | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC)) + | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC)) #else /* disable Magic1 */ #define VALUE_OPT_MAGIC1 NO_EQUIVALENT @@ -105,7 +105,7 @@ tSCC zMagic1Text[] = tSCC zMagic1_NAME[] = "MAGIC1"; tSCC zMagic1_Name[] = "magic1"; #define MAGIC1_FLAGS (OPTST_DISABLED \ - | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) + | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) #else /* disable Magic1 */ #define VALUE_OPT_MAGIC1 NO_EQUIVALENT @@ -123,7 +123,7 @@ tSCC zSpeedText[] = tSCC zSpeed_NAME[] = "SPEED"; tSCC zSpeed_Name[] = "speed"; #define SPEED_FLAGS (OPTST_DISABLED \ - | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) + | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) /* * Debug option description: @@ -155,7 +155,7 @@ static const int aCommandMustList[] = { INDEX_OPT_TIMEOUT, NO_EQUIVALENT }; #define COMMAND_FLAGS (OPTST_DISABLED \ - | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) + | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) /* * Timeout option description: @@ -165,7 +165,7 @@ tSCC zTimeoutText[] = tSCC zTimeout_NAME[] = "TIMEOUT"; tSCC zTimeout_Name[] = "timeout"; #define TIMEOUT_FLAGS (OPTST_DISABLED \ - | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC)) + | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC)) /* * Help/More_Help/Version option descriptions: @@ -260,7 +260,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ MAGIC2_FLAGS, 0, - /* last opt argumnt */ NULL, + /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, /* option proc */ doOptMagic2, @@ -272,7 +272,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ MAGIC1_FLAGS, 0, - /* last opt argumnt */ NULL, + /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, /* option proc */ doOptMagic1, @@ -284,7 +284,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ MAGIC1_FLAGS, 0, - /* last opt argumnt */ NULL, + /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, /* option proc */ doOptMagic1, @@ -296,7 +296,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ SPEED_FLAGS, 0, - /* last opt argumnt */ NULL, + /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, /* option proc */ SPEED_OPT_PROC, @@ -308,7 +308,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ DEBUG_FLAGS, 0, - /* last opt argumnt */ NULL, + /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, /* option proc */ NULL, @@ -320,7 +320,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ CRMOD_FLAGS, 0, - /* last opt argumnt */ NULL, + /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, /* option proc */ CRMOD_OPT_PROC, @@ -332,7 +332,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ COMMAND_FLAGS, 0, - /* last opt argumnt */ NULL, + /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ aCommandMustList, NULL, /* option proc */ NULL, @@ -344,7 +344,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ TIMEOUT_FLAGS, 0, - /* last opt argumnt */ NULL, + /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, /* option proc */ doOptTimeout, @@ -357,7 +357,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* min, max, act ct */ 0, 1, 0, /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | OPTST_ARG_OPTIONAL, 0, - /* last opt argumnt */ NULL, + /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, /* option proc */ DOVERPROC, @@ -369,7 +369,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ OPTST_IMM, 0, - /* last opt argumnt */ NULL, + /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, /* option proc */ doUsageOpt, @@ -381,7 +381,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ OPTST_IMM, 0, - /* last opt argumnt */ NULL, + /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, /* option proc */ optionPagedUsage, @@ -394,7 +394,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* min, max, act ct */ 0, 1, 0, /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | OPTST_ARG_OPTIONAL, 0, - /* last opt argumnt */ NULL, + /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, /* option proc */ NULL, @@ -407,7 +407,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* min, max, act ct */ 0, NOLIMIT, 0, /* opt state flags */ OPTST_DISABLE_IMM | \ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING), 0, - /* last opt argumnt */ NULL, + /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, /* option proc */ optionLoadOpt, @@ -421,7 +421,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { */ tSCC zPROGNAME[] = "CLKTEST"; tSCC zUsageTitle[] = -"clktest - test the clock line discipline - Ver. 4.2.3p41\n\ +"clktest - test the clock line discipline - Ver. 4.2.3p49\n\ USAGE: %s [ - [] | --[{=| }] ]... \n"; tSCC zRcName[] = ".ntprc"; tSCC* apzHomeList[] = { @@ -502,14 +502,14 @@ doOptMagic2( { 0, 255 } }; long val; int ix; - const char* pzIndent = "\t\t\t\t "; + char const* pzIndent = "\t\t\t\t "; extern FILE* option_usage_fp; if (pOptDesc == NULL) /* usage is requesting range list option_usage_fp has already been set */ goto emit_ranges; - val = atoi( pOptDesc->pzLastArg ); + val = atoi( pOptDesc->optArg.argString ); for (ix = 0; ix < 1; ix++) { if (val < rng[ix].rmin) continue; /* ranges need not be ordered. */ @@ -522,8 +522,8 @@ doOptMagic2( } option_usage_fp = stderr; - fprintf( stderr, _("%s error: %s option value ``%s''is out of range.\n"), - pOptions->pzProgName, pOptDesc->pz_Name, pOptDesc->pzLastArg ); + fprintf(stderr, _("%s error: %s option value ``%s''is out of range.\n"), + pOptions->pzProgName, pOptDesc->pz_Name, pOptDesc->optArg.argString); pzIndent = "\t"; emit_ranges: @@ -537,7 +537,7 @@ doOptMagic2( return; valid_return: - pOptDesc->pzLastArg = (char*)val; + pOptDesc->optArg.argString = (char*)val; } #endif /* defined CLKLDISC */ @@ -555,14 +555,14 @@ doOptMagic1( { 0, 255 } }; long val; int ix; - const char* pzIndent = "\t\t\t\t "; + char const* pzIndent = "\t\t\t\t "; extern FILE* option_usage_fp; if (pOptDesc == NULL) /* usage is requesting range list option_usage_fp has already been set */ goto emit_ranges; - val = atoi( pOptDesc->pzLastArg ); + val = atoi( pOptDesc->optArg.argString ); for (ix = 0; ix < 1; ix++) { if (val < rng[ix].rmin) continue; /* ranges need not be ordered. */ @@ -575,8 +575,8 @@ doOptMagic1( } option_usage_fp = stderr; - fprintf( stderr, _("%s error: %s option value ``%s''is out of range.\n"), - pOptions->pzProgName, pOptDesc->pz_Name, pOptDesc->pzLastArg ); + fprintf(stderr, _("%s error: %s option value ``%s''is out of range.\n"), + pOptions->pzProgName, pOptDesc->pz_Name, pOptDesc->optArg.argString); pzIndent = "\t"; emit_ranges: @@ -590,7 +590,7 @@ doOptMagic1( return; valid_return: - pOptDesc->pzLastArg = (char*)val; + pOptDesc->optArg.argString = (char*)val; } #endif /* defined CLKLDISC */ @@ -698,14 +698,14 @@ doOptTimeout( { 1, 600 } }; long val; int ix; - const char* pzIndent = "\t\t\t\t "; + char const* pzIndent = "\t\t\t\t "; extern FILE* option_usage_fp; if (pOptDesc == NULL) /* usage is requesting range list option_usage_fp has already been set */ goto emit_ranges; - val = atoi( pOptDesc->pzLastArg ); + val = atoi( pOptDesc->optArg.argString ); for (ix = 0; ix < 1; ix++) { if (val < rng[ix].rmin) continue; /* ranges need not be ordered. */ @@ -718,8 +718,8 @@ doOptTimeout( } option_usage_fp = stderr; - fprintf( stderr, _("%s error: %s option value ``%s''is out of range.\n"), - pOptions->pzProgName, pOptDesc->pz_Name, pOptDesc->pzLastArg ); + fprintf(stderr, _("%s error: %s option value ``%s''is out of range.\n"), + pOptions->pzProgName, pOptDesc->pz_Name, pOptDesc->optArg.argString); pzIndent = "\t"; emit_ranges: @@ -733,7 +733,7 @@ doOptTimeout( return; valid_return: - pOptDesc->pzLastArg = (char*)val; + pOptDesc->optArg.argString = (char*)val; } /* extracted from optmain.tpl near line 92 */ @@ -761,11 +761,11 @@ main( int argc, char** argv ) #include #include -static char* AO_gettext( const char* pz ); +static char* AO_gettext( char const* pz ); static void coerce_it(void** s); static char* -AO_gettext( const char* pz ) +AO_gettext( char const* pz ) { char* pzRes; if (pz == NULL) diff --git a/clockstuff/clktest-opts.h b/clockstuff/clktest-opts.h index b59d2bd44..4aeaeacb2 100644 --- a/clockstuff/clktest-opts.h +++ b/clockstuff/clktest-opts.h @@ -2,7 +2,7 @@ * * DO NOT EDIT THIS FILE (clktest-opts.h) * - * It has been AutoGen-ed Saturday September 9, 2006 at 05:39:56 PM EDT + * It has been AutoGen-ed Sunday September 24, 2006 at 02:18:25 AM EDT * From the definitions clktest-opts.def * and the template file options */ @@ -67,8 +67,8 @@ typedef enum { } teOptIndex; #define OPTION_CT 13 -#define CLKTEST_VERSION "4.2.3p41" -#define CLKTEST_FULL_VERSION "clktest - test the clock line discipline - Ver. 4.2.3p41" +#define CLKTEST_VERSION "4.2.3p49" +#define CLKTEST_FULL_VERSION "clktest - test the clock line discipline - Ver. 4.2.3p49" /* * Interface defines for all options. Replace "n" with the UPPER_CASED @@ -77,7 +77,7 @@ typedef enum { */ #define DESC(n) clktestOptions.pOptDesc[INDEX_OPT_ ## n] #define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n))) -#define OPT_ARG(n) (DESC(n).pzLastArg) +#define OPT_ARG(n) (DESC(n).optArg.argString) #define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK) #define COUNT_OPT(n) (DESC(n).optOccCt) #define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n))) @@ -143,11 +143,11 @@ typedef enum { */ #ifdef CLKLDISC #define VALUE_OPT_MAGIC2 'a' -#define OPT_VALUE_MAGIC2 (*(unsigned long*)(&DESC(MAGIC2).pzLastArg)) +#define OPT_VALUE_MAGIC2 (DESC(MAGIC2).optArg.argInt) #endif /* CLKLDISC */ #ifdef CLKLDISC #define VALUE_OPT_MAGIC1 'c' -#define OPT_VALUE_MAGIC1 (*(unsigned long*)(&DESC(MAGIC1).pzLastArg)) +#define OPT_VALUE_MAGIC1 (DESC(MAGIC1).optArg.argInt) #endif /* CLKLDISC */ #ifdef STREAM #define VALUE_OPT_MAGIC1 'c' @@ -157,7 +157,7 @@ typedef enum { #define VALUE_OPT_CRMOD 'f' #define VALUE_OPT_COMMAND 's' #define VALUE_OPT_TIMEOUT 't' -#define OPT_VALUE_TIMEOUT (*(unsigned long*)(&DESC(TIMEOUT).pzLastArg)) +#define OPT_VALUE_TIMEOUT (DESC(TIMEOUT).optArg.argInt) #define VALUE_OPT_VERSION 'v' #define VALUE_OPT_SAVE_OPTS '>' @@ -167,7 +167,7 @@ typedef enum { #define SET_OPT_SAVE_OPTS(a) STMTS( \ DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT; \ DESC(SAVE_OPTS).fOptState |= OPTST_SET; \ - DESC(SAVE_OPTS).pzLastArg = (const char*)(a) ) + DESC(SAVE_OPTS).optArg.argString = (char const*)(a) ) /* * Interface defines not associated with particular options */ @@ -178,7 +178,7 @@ typedef enum { clktestOptions.pzCurOpt = NULL ) #define START_OPT RESTART_OPT(1) #define USAGE(c) (*clktestOptions.pUsageProc)( &clktestOptions, c ) -/* extracted from opthead near line 311 */ +/* extracted from opthead near line 312 */ /* * * * * * * @@ -227,7 +227,7 @@ extern tOptions clktestOptions; #ifndef _ # if ENABLE_NLS # include - static inline char* aoGetsText( const char* pz ) { + static inline char* aoGetsText( char const* pz ) { if (pz == NULL) return NULL; return (char*)gettext( pz ); } diff --git a/libopts/autoopts.c b/libopts/autoopts.c index 22104a9f8..712be238f 100644 --- a/libopts/autoopts.c +++ b/libopts/autoopts.c @@ -1,7 +1,7 @@ /* - * $Id: autoopts.c,v 4.14 2006/09/13 14:31:07 bkorb Exp $ - * Time-stamp: "2006-09-10 14:42:45 bkorb" + * $Id: autoopts.c,v 4.24 2006/09/23 00:12:48 bkorb Exp $ + * Time-stamp: "2006-09-22 18:21:53 bkorb" * * This file contains all of the routines that must be linked into * an executable to use the generated option processing. The optional @@ -68,7 +68,7 @@ # include "compat/strchr.c" #endif -static const char zNil[] = ""; +static char const zNil[] = ""; #define SKIP_RC_FILES(po) \ DISABLED_OPT(&((po)->pOptDesc[ (po)->specOptIdx.save_opts+1])) @@ -148,7 +148,7 @@ handleOption( tOptions* pOpts, tOptState* pOptState ) tOptDesc* pOD = pOptState->pOD; tOptProc* pOP = pOD->pOptProc; - pOD->pzLastArg = pOptState->pzOptArg; + pOD->optArg.argString = pOptState->pzOptArg; /* * IF we are presetting options, then we will ignore any un-presettable @@ -213,7 +213,7 @@ handleOption( tOptions* pOpts, tOptState* pOptState ) * Copy the most recent option argument. set membership state * is kept in ``p->optCookie''. Do not overwrite. */ - p->pzLastArg = pOD->pzLastArg; + p->optArg.argString = pOD->optArg.argString; pOD = p; } else { @@ -230,11 +230,11 @@ handleOption( tOptions* pOpts, tOptState* pOptState ) */ if ( (pOD->fOptState & OPTST_DEFINED) && (++pOD->optOccCt > pOD->optMaxCt) ) { - const char* pzEqv = + char const* pzEqv = (pOD->optEquivIndex != NO_EQUIVALENT) ? zEquiv : zNil; if ((pOpts->fOptSet & OPTPROC_ERRSTOP) != 0) { - const char* pzFmt = (pOD->optMaxCt > 1) ? zAtMost : zOnlyOne; + char const* pzFmt = (pOD->optMaxCt > 1) ? zAtMost : zOnlyOne; fputs( zErrOnly, stderr ); fprintf( stderr, pzFmt, pOD->pz_Name, pzEqv, pOD->optMaxCt ); diff --git a/libopts/autoopts.h b/libopts/autoopts.h index 51f5269d8..e6fcd90bc 100644 --- a/libopts/autoopts.h +++ b/libopts/autoopts.h @@ -2,7 +2,7 @@ /* * Time-stamp: "2006-09-10 14:43:25 bkorb" * - * autoopts.h $Id: autoopts.h,v 4.15 2006/09/13 14:31:07 bkorb Exp $ + * autoopts.h $Id: autoopts.h,v 4.28 2006/09/23 00:12:48 bkorb Exp $ * Time-stamp: "2005-02-14 05:59:50 bkorb" * * This file defines all the global structures and special values @@ -307,8 +307,8 @@ typedef struct { #endif #ifndef HAVE_STRCHR -extern char* strchr( const char *s, int c); -extern char* strrchr( const char *s, int c); +extern char* strchr( char const *s, int c); +extern char* strrchr( char const *s, int c); #endif /* diff --git a/libopts/autoopts/options.h b/libopts/autoopts/options.h index 6c78724c8..da129fd29 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 Tuesday September 19, 2006 at 09:27:53 PM PDT + * It has been AutoGen-ed Friday September 22, 2006 at 06:21:59 PM PDT * From the definitions funcs.def * and the template file options_h * @@ -156,8 +156,8 @@ typedef struct optionValue { * because "static const" cannot both be applied to a type, * tho each individually can...so they all are */ -#define tSCC static const char -#define tCC const char +#define tSCC static char const +#define tCC char const #define tAoSC static char #define tAoUC unsigned char #define tAoUI unsigned int @@ -217,6 +217,14 @@ struct argList { tCC* apzArgs[ MIN_ARG_ALLOC_CT ]; }; +typedef union { + char const * argString; + uintptr_t argIntptr; + int argInt; + unsigned int argUint; + ag_bool argBool; +} optArgBucket_t; + /* * Descriptor structure for each option. * Only the fields marked "PUBLIC" are for public use. @@ -234,18 +242,19 @@ struct optDesc { tAoUI fOptState; /* PUBLIC */ tAoUI reserved; - tCC* pzLastArg; /* PUBLIC */ + optArgBucket_t optArg; /* PUBLIC */ +# define pzLastArg optArg.argString void* optCookie; /* PUBLIC */ const int * pOptMust; const int * pOptCant; tpOptProc pOptProc; - const char* pzText; + char const* pzText; - const char* pz_NAME; - const char* pz_Name; - const char* pz_DisableName; - const char* pz_DisablePfx; + char const* pz_NAME; + char const* pz_Name; + char const* pz_DisableName; + char const* pz_DisablePfx; }; /* @@ -278,19 +287,19 @@ struct options { unsigned int curOptIdx; char* pzCurOpt; - const char* pzProgPath; - const char* pzProgName; - const char* const pzPROGNAME; - const char* const pzRcName; - const char* const pzCopyright; - const char* const pzCopyNotice; - const char* const pzFullVersion; - const char* const* papzHomeList; - const char* const pzUsageTitle; - const char* const pzExplain; - const char* const pzDetail; + char const* pzProgPath; + char const* pzProgName; + char const* const pzPROGNAME; + char const* const pzRcName; + char const* const pzCopyright; + char const* const pzCopyNotice; + char const* const pzFullVersion; + char const* const* papzHomeList; + char const* const pzUsageTitle; + char const* const pzExplain; + char const* const pzDetail; tOptDesc* const pOptDesc; - const char* const pzBugAddr; + char const* const pzBugAddr; void* pExtensions; void* pSavedState; @@ -423,7 +432,7 @@ extern "C" { * Double quote strings are formed according to the rules of string * constants in ANSI-C programs. */ -extern token_list_t* ao_string_tokenize( const char* ); +extern token_list_t* ao_string_tokenize( char const* ); /* From: configfile.c line 113 @@ -443,7 +452,7 @@ extern token_list_t* ao_string_tokenize( const char* ); * @code{optionGetValue()}, @code{optionNextValue()} and * @code{optionUnloadNested()}. */ -extern const tOptionValue* configFileLoad( const char* ); +extern const tOptionValue* configFileLoad( char const* ); /* From: configfile.c line 871 @@ -473,7 +482,7 @@ extern const tOptionValue* configFileLoad( const char* ); * * Configuration files not found or not decipherable are simply ignored. */ -extern int optionFileLoad( tOptions*, const char* ); +extern int optionFileLoad( tOptions*, char const* ); /* From: configfile.c line 240 @@ -492,7 +501,7 @@ extern int optionFileLoad( tOptions*, const char* ); * configurable. It will search through the list and return the next entry * that matches the criteria. */ -extern const tOptionValue* optionFindNextValue( const tOptDesc*, const tOptionValue*, const char*, const char* ); +extern const tOptionValue* optionFindNextValue( const tOptDesc*, const tOptionValue*, char const*, char const* ); /* From: configfile.c line 166 @@ -509,7 +518,7 @@ extern const tOptionValue* optionFindNextValue( const tOptDesc*, const tOptionVa * This routine will find an entry in a nested value option or configurable. * It will search through the list and return a matching entry. */ -extern const tOptionValue* optionFindValue( const tOptDesc*, const char*, const char* ); +extern const tOptionValue* optionFindValue( const tOptDesc*, char const*, char const* ); /* From: restore.c line 157 @@ -540,7 +549,7 @@ extern void optionFree( tOptions* ); * the first entry with a name that exactly matches the argument will be * returned. */ -extern const tOptionValue* optionGetValue( const tOptionValue*, const char* ); +extern const tOptionValue* optionGetValue( const tOptionValue*, char const* ); /* From: load.c line 477 @@ -564,7 +573,7 @@ extern const tOptionValue* optionGetValue( const tOptionValue*, const char* ); * formation used in AutoGen definition files (@pxref{basic expression}), * except that you may not use backquotes. */ -extern void optionLoadLine( tOptions*, const char* ); +extern void optionLoadLine( tOptions*, char const* ); /* From: configfile.c line 368 @@ -701,12 +710,12 @@ extern void optionUnloadNested( const tOptionValue* ); * * optionVersion - return the compiled AutoOpts version number * - * Returns: const char* - the version string in constant memory + * Returns: char const* - the version string in constant memory * * Returns the full version string compiled into the library. * The returned string cannot be modified. */ -extern const char* optionVersion( void ); +extern char const* optionVersion( void ); /* From: ../compat/pathfind.c line 33 @@ -749,7 +758,7 @@ extern const char* optionVersion( void ); * @end example */ #ifndef HAVE_PATHFIND -extern char* pathfind( const char*, const char*, const char* ); +extern char* pathfind( char const*, char const*, char const* ); #endif /* HAVE_PATHFIND */ @@ -765,7 +774,7 @@ extern char* pathfind( const char*, const char*, const char* ); * This function name is mapped to option_strequate so as to not conflict * with the POSIX name space. */ -extern void strequate( const char* ); +extern void strequate( char const* ); /* From: streqvcmp.c line 143 @@ -784,7 +793,7 @@ extern void strequate( const char* ); * This function name is mapped to option_streqvcmp so as to not conflict * with the POSIX name space. */ -extern int streqvcmp( const char*, const char* ); +extern int streqvcmp( char const*, char const* ); /* From: streqvcmp.c line 180 @@ -833,7 +842,7 @@ extern void streqvmap( char, char, int ); * This function name is mapped to option_strneqvcmp so as to not conflict * with the POSIX name space. */ -extern int strneqvcmp( const char*, const char*, int ); +extern int strneqvcmp( char const*, char const*, int ); /* From: streqvcmp.c line 259 @@ -849,14 +858,14 @@ extern int strneqvcmp( const char*, const char*, int ); * This function name is mapped to option_strtransform so as to not conflict * with the POSIX name space. */ -extern void strtransform( char*, const char* ); +extern void strtransform( char*, char const* ); /* AutoOpts PRIVATE FUNCTIONS: */ tOptProc optionStackArg, optionUnstackArg, optionBooleanVal, optionNumericVal; extern char* ao_string_cook( char*, int* ); -extern unsigned int ao_string_cook_escape_char( const char*, char*, u_int ); +extern unsigned int ao_string_cook_escape_char( char const*, char*, u_int ); extern void export_options_to_guile( tOptions* ); @@ -864,15 +873,15 @@ extern void genshelloptUsage( tOptions*, int ); extern void optionBooleanVal( tOptions*, tOptDesc* ); -extern char* optionEnumerationVal( tOptions*, tOptDesc*, const char**, unsigned int ); +extern uintptr_t optionEnumerationVal( tOptions*, tOptDesc*, char const**, unsigned int ); -extern const char* optionKeywordName( tOptDesc*, unsigned int ); +extern char const* optionKeywordName( tOptDesc*, unsigned int ); -extern tOptionValue* optionLoadNested( const char*, const char*, size_t, tOptionLoadMode ); +extern tOptionValue* optionLoadNested( char const*, char const*, size_t, tOptionLoadMode ); extern void optionLoadOpt( tOptions*, tOptDesc* ); -extern ag_bool optionMakePath( char*, int, const char*, const char* ); +extern ag_bool optionMakePath( char*, int, char const*, char const* ); extern void optionNestedVal( tOptions*, tOptDesc* ); @@ -886,7 +895,7 @@ extern void optionPrintVersion( tOptions*, tOptDesc* ); extern void optionPutShell( tOptions* ); -extern void optionSetMembers( tOptions*, tOptDesc*, const char**, unsigned int ); +extern void optionSetMembers( tOptions*, tOptDesc*, char const**, unsigned int ); extern void optionStackArg( tOptions*, tOptDesc* ); @@ -896,7 +905,7 @@ extern void optionUsage( tOptions*, int ); extern void optionVersionStderr( tOptions*, tOptDesc* ); -extern void* text_mmap( const char*, int, int, tmap_info_t* ); +extern void* text_mmap( char const*, int, int, tmap_info_t* ); extern int text_munmap( tmap_info_t* ); diff --git a/libopts/autoopts/usage-txt.h b/libopts/autoopts/usage-txt.h index 013f4e418..849b8aa80 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 Tuesday September 19, 2006 at 09:27:51 PM PDT + * It has been AutoGen-ed Friday September 22, 2006 at 06:21:57 PM PDT * From the definitions usage-txt.def * and the template file usage-txt.tpl * @@ -33,7 +33,7 @@ #define AUTOOPTS_USAGE_TXT_H_GUARD #undef cch_t -#define cch_t const char +#define cch_t char const /* * One structure to hold all the pointers to all the stringlets. diff --git a/libopts/boolean.c b/libopts/boolean.c index b0c40a7fa..ad80794a5 100644 --- a/libopts/boolean.c +++ b/libopts/boolean.c @@ -1,7 +1,7 @@ /* - * $Id: boolean.c,v 4.4 2006/03/31 19:52:10 bkorb Exp $ - * Time-stamp: "2005-02-14 08:24:12 bkorb" + * $Id: boolean.c,v 4.6 2006/03/25 19:23:28 bkorb Exp $ + * Time-stamp: "2006-09-22 18:13:34 bkorb" * * Automated Options Paged Usage module. * @@ -71,9 +71,9 @@ optionBooleanVal( tOptions* pOpts, tOptDesc* pOD ) char* pz; ag_bool res = AG_TRUE; - switch (*(pOD->pzLastArg)) { + switch (*(pOD->optArg.argString)) { case '0': - val = strtol( pOD->pzLastArg, &pz, 0 ); + val = strtol( pOD->optArg.argString, &pz, 0 ); if ((val != 0) || (*pz != NUL)) break; /* FALLTHROUGH */ @@ -85,12 +85,12 @@ optionBooleanVal( tOptions* pOpts, tOptDesc* pOD ) res = AG_FALSE; break; case '#': - if (pOD->pzLastArg[1] != 'f') + if (pOD->optArg.argString[1] != 'f') break; res = AG_FALSE; } - pOD->pzLastArg = (char*)res; + pOD->optArg.argBool = res; } /* * Local Variables: diff --git a/libopts/compat/compat.h b/libopts/compat/compat.h index fc711db53..15ea0c6bc 100644 --- a/libopts/compat/compat.h +++ b/libopts/compat/compat.h @@ -7,7 +7,7 @@ * Author: Gary V Vaughan * Created: Mon Jun 30 15:54:46 1997 * - * $Id: compat.h,v 4.12 2006/09/16 19:58:55 bkorb Exp $ + * $Id: compat.h,v 4.13 2006/09/16 19:58:35 bkorb Exp $ */ #ifndef COMPAT_H_GUARD #define COMPAT_H_GUARD 1 diff --git a/libopts/compat/pathfind.c b/libopts/compat/pathfind.c index 9cfbebb1d..ab3d173ba 100644 --- a/libopts/compat/pathfind.c +++ b/libopts/compat/pathfind.c @@ -5,10 +5,10 @@ /* * Author: Gary V Vaughan * Created: Tue Jun 24 15:07:31 1997 - * Last Modified: $Date: 2006/08/22 16:09:02 $ + * Last Modified: $Date: 2006/09/23 00:48:05 $ * by: bkorb * - * $Id: pathfind.c,v 4.7 2006/08/22 16:09:02 bkorb Exp $ + * $Id: pathfind.c,v 4.8 2006/09/23 00:48:05 bkorb Exp $ */ /* Code: */ @@ -17,17 +17,17 @@ #ifndef HAVE_PATHFIND #if defined(__windows__) && !defined(__CYGWIN__) char* -pathfind( const char* path, - const char* fileName, - const char* mode ) +pathfind( char const* path, + char const* fileName, + char const* mode ) { return NULL; } #else -static char* make_absolute( const char *string, const char *dot_path ); +static char* make_absolute( char const *string, char const *dot_path ); static char* canonicalize_pathname( char *path ); -static char* extract_colon_unit( char* dir, const char *string, int *p_index ); +static char* extract_colon_unit( char* dir, char const *string, int *p_index ); /*=export_func pathfind @@ -36,9 +36,9 @@ static char* extract_colon_unit( char* dir, const char *string, int *p_index ); * * ifndef: HAVE_PATHFIND * - * arg: + const char* + path + colon separated list of search directories + - * arg: + const char* + file + the name of the file to look for + - * arg: + const char* + mode + the mode bits that must be set to match + + * arg: + char const* + path + colon separated list of search directories + + * arg: + char const* + file + the name of the file to look for + + * arg: + char const* + mode + the mode bits that must be set to match + * * ret_type: char* * ret_desc: the path to the located file @@ -85,9 +85,9 @@ static char* extract_colon_unit( char* dir, const char *string, int *p_index ); * err: returns NULL if the file is not found. =*/ char* -pathfind( const char* path, - const char* fileName, - const char* mode ) +pathfind( char const* path, + char const* fileName, + char const* mode ) { int p_index = 0; int mode_bits = 0; @@ -164,7 +164,7 @@ pathfind( const char* path, * a new string, even if STRING was an absolute pathname to begin with. */ static char* -make_absolute( const char *string, const char *dot_path ) +make_absolute( char const *string, char const *dot_path ) { char *result; int result_len; @@ -288,7 +288,7 @@ canonicalize_pathname( char *path ) * more. Advance (P_INDEX) to the character after the colon. */ static char* -extract_colon_unit( char* pzDir, const char *string, int *p_index ) +extract_colon_unit( char* pzDir, char const *string, int *p_index ) { char* pzDest = pzDir; int ix = *p_index; @@ -300,7 +300,7 @@ extract_colon_unit( char* pzDir, const char *string, int *p_index ) return NULL; { - const char* pzSrc = string + ix; + char const* pzSrc = string + ix; while (*pzSrc == ':') pzSrc++; diff --git a/libopts/compat/snprintf.c b/libopts/compat/snprintf.c index 99c7eb679..ae81f272d 100644 --- a/libopts/compat/snprintf.c +++ b/libopts/compat/snprintf.c @@ -24,7 +24,7 @@ #endif static int -snprintf(char *str, size_t n, const char *fmt, ...) +snprintf(char *str, size_t n, char const *fmt, ...) { va_list ap; int rval; @@ -50,7 +50,7 @@ snprintf(char *str, size_t n, const char *fmt, ...) } static int -vsnprintf( char *str, size_t n, const char *fmt, va_list ap ) +vsnprintf( char *str, size_t n, char const *fmt, va_list ap ) { #ifdef VSPRINTF_CHARSTAR return (strlen(vsprintf(str, fmt, ap))); diff --git a/libopts/compat/strchr.c b/libopts/compat/strchr.c index fd6507f4f..ca8a517a8 100644 --- a/libopts/compat/strchr.c +++ b/libopts/compat/strchr.c @@ -2,9 +2,9 @@ SYNOPSIS #include - char *strchr(const char *s, int c); + char *strchr(char const *s, int c); - char *strrchr(const char *s, int c); + char *strrchr(char const *s, int c); DESCRIPTION The strchr() function returns a pointer to the first occurrence of the @@ -25,7 +25,7 @@ */ char* -strchr( const char *s, int c) +strchr( char const *s, int c) { do { if ((unsigned)*s == (unsigned)c) @@ -37,9 +37,9 @@ strchr( const char *s, int c) } char* -strrchr( const char *s, int c) +strrchr( char const *s, int c) { - const char *e = s + strlen(s); + char const *e = s + strlen(s); for (;;) { if (--e < s) diff --git a/libopts/compat/strdup.c b/libopts/compat/strdup.c index a65dc4750..e2933a8af 100644 --- a/libopts/compat/strdup.c +++ b/libopts/compat/strdup.c @@ -3,7 +3,7 @@ */ static char * -strdup( const char *s ) +strdup( char const *s ) { char *cp; diff --git a/libopts/configfile.c b/libopts/configfile.c index 2b4d6d4af..64deccdd3 100644 --- a/libopts/configfile.c +++ b/libopts/configfile.c @@ -1,6 +1,6 @@ /* - * $Id: configfile.c,v 1.12 2006/09/20 04:27:44 bkorb Exp $ - * Time-stamp: "2006-09-10 13:57:10 bkorb" + * $Id: configfile.c,v 4.26 2006/09/23 00:12:48 bkorb Exp $ + * Time-stamp: "2006-09-22 18:01:50 bkorb" * * configuration/rc/ini file handling. */ @@ -53,7 +53,7 @@ static void filePreset( tOptions* pOpts, - const char* pzFileName, + char const* pzFileName, int direction ); static char* @@ -113,7 +113,7 @@ skipUnknown( char* pzText ); /*=export_func configFileLoad * * what: parse a configuration file - * arg: + const char* + pzFile + the file to load + + * arg: + char const* + pzFile + the file to load + * * ret_type: const tOptionValue* * ret_desc: An allocated, compound value structure @@ -141,7 +141,7 @@ skipUnknown( char* pzText ); * @end itemize =*/ const tOptionValue* -configFileLoad( const char* pzFile ) +configFileLoad( char const* pzFile ) { tmap_info_t cfgfile; tOptionValue* pRes = NULL; @@ -167,8 +167,8 @@ configFileLoad( const char* pzFile ) * * what: find a hierarcicaly valued option instance * arg: + const tOptDesc* + pOptDesc + an option with a nested arg type + - * arg: + const char* + name + name of value to find + - * arg: + const char* + value + the matching value + + * arg: + char const* + name + name of value to find + + * arg: + char const* + value + the matching value + * * ret_type: const tOptionValue* * ret_desc: a compound value structure @@ -189,7 +189,7 @@ configFileLoad( const char* pzFile ) =*/ const tOptionValue* optionFindValue( const tOptDesc* pOptDesc, - const char* pzName, const char* pzVal ) + char const* pzName, char const* pzVal ) { const tOptionValue* pRes = NULL; @@ -242,8 +242,8 @@ optionFindValue( const tOptDesc* pOptDesc, * what: find a hierarcicaly valued option instance * arg: + const tOptDesc* + pOptDesc + an option with a nested arg type + * arg: + const tOptionValue* + pPrevVal + the last entry + - * arg: + const char* + name + name of value to find + - * arg: + const char* + value + the matching value + + * arg: + char const* + name + name of value to find + + * arg: + char const* + value + the matching value + * * ret_type: const tOptionValue* * ret_desc: a compound value structure @@ -265,7 +265,7 @@ optionFindValue( const tOptDesc* pOptDesc, =*/ const tOptionValue* optionFindNextValue( const tOptDesc* pOptDesc, const tOptionValue* pPrevVal, - const char* pzName, const char* pzVal ) + char const* pzName, char const* pzVal ) { int foundOldVal = 0; tOptionValue* pRes = NULL; @@ -310,7 +310,7 @@ optionFindNextValue( const tOptDesc* pOptDesc, const tOptionValue* pPrevVal, * * what: get a specific value from a hierarcical list * arg: + const tOptionValue* + pOptValue + a hierarchcal value + - * arg: + const char* + valueName + name of value to get + + * arg: + char const* + valueName + name of value to get + * * ret_type: const tOptionValue* * ret_desc: a compound value structure @@ -332,7 +332,7 @@ optionFindNextValue( const tOptDesc* pOptDesc, const tOptionValue* pPrevVal, * @end itemize =*/ const tOptionValue* -optionGetValue( const tOptionValue* pOld, const char* pzValName ) +optionGetValue( const tOptionValue* pOld, char const* pzValName ) { tArgList* pAL; tOptionValue* pRes = NULL; @@ -435,7 +435,7 @@ optionNextValue( const tOptionValue* pOVList, const tOptionValue* pOldOV ) static void filePreset( tOptions* pOpts, - const char* pzFileName, + char const* pzFileName, int direction ) { tmap_info_t cfgfile; @@ -873,7 +873,7 @@ internalFileLoad( tOptions* pOpts ) * what: Load the locatable config files, in order * * arg: + tOptions* + pOpts + program options descriptor + - * arg: + const char* + pzProg + program name + + * arg: + char const* + pzProg + program name + * * ret_type: int * ret_desc: 0 -> SUCCESS, -1 -> FAILURE @@ -902,7 +902,7 @@ internalFileLoad( tOptions* pOpts ) * always be returned. =*/ int -optionFileLoad( tOptions* pOpts, const char* pzProgram ) +optionFileLoad( tOptions* pOpts, char const* pzProgram ) { if (! SUCCESSFUL( validateOptionsStruct( pOpts, pzProgram ))) return -1; @@ -921,7 +921,7 @@ optionFileLoad( tOptions* pOpts, const char* pzProgram ) * arg: + tOptDesc* + pOptDesc + the descriptor for this arg + * * doc: - * Processes the options found in the file named with pOptDesc->pzLastArg. + * Processes the options found in the file named with pOptDesc->optArg.argString. =*/ void optionLoadOpt( tOptions* pOpts, tOptDesc* pOptDesc ) @@ -935,12 +935,12 @@ optionLoadOpt( tOptions* pOpts, tOptDesc* pOptDesc ) */ if (! DISABLED_OPT( pOptDesc )) { struct stat sb; - if (stat( pOptDesc->pzLastArg, &sb ) != 0) { + if (stat( pOptDesc->optArg.argString, &sb ) != 0) { if ((pOpts->fOptSet & OPTPROC_ERRSTOP) == 0) return; fprintf( stderr, zFSErrOptLoad, errno, strerror( errno ), - pOptDesc->pzLastArg ); + pOptDesc->optArg.argString ); (*pOpts->pUsageProc)( pOpts, EXIT_FAILURE ); /* NOT REACHED */ } @@ -949,12 +949,12 @@ optionLoadOpt( tOptions* pOpts, tOptDesc* pOptDesc ) if ((pOpts->fOptSet & OPTPROC_ERRSTOP) == 0) return; - fprintf( stderr, zNotFile, pOptDesc->pzLastArg ); + fprintf( stderr, zNotFile, pOptDesc->optArg.argString ); (*pOpts->pUsageProc)( pOpts, EXIT_FAILURE ); /* NOT REACHED */ } - filePreset(pOpts, pOptDesc->pzLastArg, DIRECTION_CALLED); + filePreset(pOpts, pOptDesc->optArg.argString, DIRECTION_CALLED); } } @@ -1209,7 +1209,7 @@ skipUnknown( char* pzText ) * already been called.) */ LOCAL tSuccess -validateOptionsStruct( tOptions* pOpts, const char* pzProgram ) +validateOptionsStruct( tOptions* pOpts, char const* pzProgram ) { if (pOpts == NULL) { fputs( zAO_Bad, stderr ); @@ -1251,7 +1251,7 @@ validateOptionsStruct( tOptions* pOpts, const char* pzProgram ) * and the set of equivalent characters. */ if (pOpts->pzProgName == NULL) { - const char* pz = strrchr( pzProgram, DIRCH ); + char const* pz = strrchr( pzProgram, DIRCH ); if (pz == NULL) pOpts->pzProgName = pzProgram; diff --git a/libopts/cook.c b/libopts/cook.c index 134be4cfd..00503959a 100644 --- a/libopts/cook.c +++ b/libopts/cook.c @@ -1,6 +1,6 @@ /* - * $Id: cook.c,v 4.4 2006/06/24 23:36:07 bkorb Exp $ + * $Id: cook.c,v 4.7 2006/09/23 00:12:48 bkorb Exp $ * Time-stamp: "2006-06-24 11:29:58 bkorb" * * This file contains the routines that deal with processing quoted strings @@ -58,7 +58,7 @@ * private: * * what: escape-process a string fragment - * arg: + const char* + pzScan + points to character after the escape + + * arg: + char const* + pzScan + points to character after the escape + * arg: + char* + pRes + Where to put the result byte + * arg: + u_int + nl_ch + replacement char if scanned char is \n + * @@ -81,7 +81,7 @@ * err: @code{NULL} is returned if the string(s) is/are mal-formed. =*/ unsigned int -ao_string_cook_escape_char( const char* pzIn, char* pRes, u_int nl ) +ao_string_cook_escape_char( char const* pzIn, char* pRes, u_int nl ) { unsigned int res = 1; diff --git a/libopts/enumeration.c b/libopts/enumeration.c index cf5d6d117..29f624fa2 100644 --- a/libopts/enumeration.c +++ b/libopts/enumeration.c @@ -1,7 +1,7 @@ /* - * $Id: enumeration.c,v 4.9 2006/06/24 23:36:08 bkorb Exp $ - * Time-stamp: "2006-06-24 10:46:02 bkorb" + * $Id: enumeration.c,v 4.12 2006/09/23 00:12:48 bkorb Exp $ + * Time-stamp: "2006-09-22 18:00:53 bkorb" * * Automated Options Paged Usage module. * @@ -84,7 +84,7 @@ enumError( if (pOpts != NULL) fprintf( option_usage_fp, pz_enum_err_fmt, - pOpts->pzProgName, pOD->pzLastArg ); + pOpts->pzProgName, pOD->optArg.argString ); fprintf( option_usage_fp, zValidKeys, pOD->pz_Name ); @@ -223,21 +223,21 @@ findName( * arg: tOptDesc*, pOD, enumeration option description * arg: unsigned int, enum_val, the enumeration value to map * - * ret_type: const char* + * ret_type: char const* * ret_desc: the enumeration name from const memory * * doc: This converts an enumeration value into the matching string. =*/ -const char* +char const* optionKeywordName( tOptDesc* pOD, unsigned int enum_val ) { tOptDesc od; - od.pzLastArg = (const char*)(uintptr_t)enum_val; + od.optArg.argIntptr = enum_val; (*(pOD->pOptProc))( (void*)(2UL), &od ); - return od.pzLastArg; + return od.optArg.argString; } @@ -247,19 +247,19 @@ optionKeywordName( * * arg: tOptions*, pOpts, the program options descriptor * arg: tOptDesc*, pOD, enumeration option description - * arg: const char**, paz_names, list of enumeration names + * arg: char const**, paz_names, list of enumeration names * arg: unsigned int, name_ct, number of names in list * - * ret_type: char* - * ret_desc: the enumeration value cast as a char* + * ret_type: uintptr_t + * ret_desc: the enumeration value * - * doc: This converts the pzLastArg string from the option description + * doc: This converts the optArg.argString string from the option description * into the index corresponding to an entry in the name list. * This will match the generated enumeration value. * Full matches are always accepted. Partial matches are accepted * if there is only one partial match. =*/ -char* +uintptr_t optionEnumerationVal( tOptions* pOpts, tOptDesc* pOD, @@ -276,11 +276,11 @@ optionEnumerationVal( * print the list of enumeration names. */ enumError( pOpts, pOD, paz_names, (int)name_ct ); - return (char*)0UL; + return 0UL; case 1UL: { - unsigned int ix = (uintptr_t)(pOD->pzLastArg); + unsigned int ix = pOD->optArg.argIntptr; /* * print the name string. */ @@ -288,25 +288,25 @@ optionEnumerationVal( printf( "INVALID-%d", ix ); else fputs( paz_names[ ix ], stdout ); - return (char*)0UL; + return 0UL; } case 2UL: { tSCC zInval[] = "*INVALID*"; - unsigned int ix = (uintptr_t)(pOD->pzLastArg); + unsigned int ix = pOD->optArg.argIntptr; /* * Replace the enumeration value with the name string. */ if (ix >= name_ct) - return (char*)zInval; + return (uintptr_t)zInval; - return (char*)paz_names[ ix ]; + return (uintptr_t)paz_names[ ix ]; } default: break; } - return (char*)findName( pOD->pzLastArg, pOpts, pOD, paz_names, name_ct ); + return findName( pOD->optArg.argString, pOpts, pOD, paz_names, name_ct ); } @@ -316,10 +316,10 @@ optionEnumerationVal( * * arg: tOptions*, pOpts, the program options descriptor * arg: tOptDesc*, pOD, enumeration option description - * arg: const char**, paz_names, list of enumeration names + * arg: char const**, paz_names, list of enumeration names * arg: unsigned int, name_ct, number of names in list * - * doc: This converts the pzLastArg string from the option description + * doc: This converts the optArg.argString string from the option description * into the index corresponding to an entry in the name list. * This will match the generated enumeration value. * Full matches are always accepted. Partial matches are accepted @@ -382,7 +382,7 @@ optionSetMembers( bits >>= 1; } - pOD->pzLastArg = pz = malloc( len ); + pOD->optArg.argString = pz = malloc( len ); /* * Start by clearing all the bits. We want to turn off any defaults * because we will be restoring to current state, not adding to @@ -409,7 +409,7 @@ optionSetMembers( } { - tCC* pzArg = pOD->pzLastArg; + tCC* pzArg = pOD->optArg.argString; uintptr_t res; if ((pzArg == NULL) || (*pzArg == NUL)) { pOD->optCookie = (void*)0; diff --git a/libopts/environment.c b/libopts/environment.c index d7e9e8c74..aacb253b0 100644 --- a/libopts/environment.c +++ b/libopts/environment.c @@ -1,6 +1,6 @@ /* - * $Id: environment.c,v 4.7 2006/03/31 19:52:10 bkorb Exp $ + * $Id: environment.c,v 4.11 2006/09/23 00:12:48 bkorb Exp $ * Time-stamp: "2005-10-29 13:23:59 bkorb" * * This file contains all of the routines that must be linked into @@ -65,7 +65,7 @@ LOCAL void doPrognameEnv( tOptions* pOpts, teEnvPresetType type ) { - const char* pczOptStr = getenv( pOpts->pzPROGNAME ); + char const* pczOptStr = getenv( pOpts->pzPROGNAME ); token_list_t* pTL; int sv_argc; tAoUI sv_flag; diff --git a/libopts/genshell.c b/libopts/genshell.c index 404597466..f7549c881 100644 --- a/libopts/genshell.c +++ b/libopts/genshell.c @@ -2,7 +2,7 @@ * * DO NOT EDIT THIS FILE (genshell.c) * - * It has been AutoGen-ed Tuesday September 19, 2006 at 09:27:53 PM PDT + * It has been AutoGen-ed Friday September 22, 2006 at 06:22:00 PM PDT * From the definitions genshell.def * and the template file options */ @@ -124,7 +124,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ SCRIPT_FLAGS, 0, - /* last opt argumnt */ NULL, + /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, /* option proc */ NULL, @@ -136,7 +136,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ SHELL_FLAGS, 0, - /* last opt argumnt */ NULL, + /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, /* option proc */ NULL, @@ -149,7 +149,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* min, max, act ct */ 0, 1, 0, /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | OPTST_ARG_OPTIONAL, 0, - /* last opt argumnt */ NULL, + /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, /* option proc */ optionPrintVersion, @@ -161,7 +161,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ OPTST_IMM, 0, - /* last opt argumnt */ NULL, + /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, /* option proc */ doUsageOpt, @@ -173,7 +173,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ OPTST_IMM, 0, - /* last opt argumnt */ NULL, + /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, /* option proc */ optionPagedUsage, @@ -261,11 +261,11 @@ doUsageOpt( #include #include -static char* AO_gettext( const char* pz ); +static char* AO_gettext( char const* pz ); static void coerce_it(void** s); static char* -AO_gettext( const char* pz ) +AO_gettext( char const* pz ) { char* pzRes; if (pz == NULL) diff --git a/libopts/genshell.h b/libopts/genshell.h index 4f197c70b..bbb8ec3c5 100644 --- a/libopts/genshell.h +++ b/libopts/genshell.h @@ -2,7 +2,7 @@ * * DO NOT EDIT THIS FILE (genshell.h) * - * It has been AutoGen-ed Tuesday September 19, 2006 at 09:27:53 PM PDT + * It has been AutoGen-ed Friday September 22, 2006 at 06:21:59 PM PDT * From the definitions genshell.def * and the template file options */ @@ -82,7 +82,7 @@ typedef enum { */ #define DESC(n) genshelloptOptions.pOptDesc[INDEX_OPT_ ## n] #define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n))) -#define OPT_ARG(n) (DESC(n).pzLastArg) +#define OPT_ARG(n) (DESC(n).optArg.argString) #define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK) #define COUNT_OPT(n) (DESC(n).optOccCt) #define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n))) @@ -115,7 +115,7 @@ typedef enum { genshelloptOptions.pzCurOpt = NULL ) #define START_OPT RESTART_OPT(1) #define USAGE(c) (*genshelloptOptions.pUsageProc)( &genshelloptOptions, c ) -/* extracted from opthead near line 311 */ +/* extracted from opthead near line 312 */ /* * * * * * * @@ -130,7 +130,7 @@ extern tOptions genshelloptOptions; #ifndef _ # if ENABLE_NLS # include - static inline char* aoGetsText( const char* pz ) { + static inline char* aoGetsText( char const* pz ) { if (pz == NULL) return NULL; return (char*)gettext( pz ); } diff --git a/libopts/load.c b/libopts/load.c index 350f8208e..18ea27f4d 100644 --- a/libopts/load.c +++ b/libopts/load.c @@ -1,6 +1,6 @@ /* - * $Id: load.c,v 4.11 2006/07/14 04:31:37 bkorb Exp $ + * $Id: load.c,v 4.24 2006/09/23 00:12:48 bkorb Exp $ * Time-stamp: "2006-07-01 12:43:03 bkorb" * * This file contains the routines that deal with processing text strings @@ -77,8 +77,8 @@ assembleArgValue( char* pzTxt, tOptionLoadMode mode ); * what: translate and construct a path * arg: + char* + pzBuf + The result buffer + * arg: + int + bufSize + The size of this buffer + - * arg: + const char* + pzName + The input name + - * arg: + const char* + pzProgPath + The full path of the current program + + * arg: + char const* + pzName + The input name + + * arg: + char const* + pzProgPath + The full path of the current program + * * ret-type: ag_bool * ret-desc: AG_TRUE if the name was handled, otherwise AG_FALSE. @@ -479,7 +479,7 @@ loadOptionLine( * what: process a string for an option name and value * * arg: tOptions*, pOpts, program options descriptor - * arg: const char*, pzLine, NUL-terminated text + * arg: char const*, pzLine, NUL-terminated text * * doc: * diff --git a/libopts/m4/libopts.m4 b/libopts/m4/libopts.m4 index 7ef37ef20..3c9c214b7 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 Tuesday September 19, 2006 at 09:27:55 PM PDT +dnl It has been AutoGen-ed Friday September 22, 2006 at 06:22:01 PM PDT dnl From the definitions libopts.def dnl and the template file conftest.tpl dnl @@ -181,7 +181,7 @@ AC_DEFUN([LIBOPTS_WITHLIB_REGEX],[ @%:@include @%:@include REGEX_HEADER static regex_t re; -void comp_re( const char* pzPat ) { +void comp_re( char const* pzPat ) { int res = regcomp( &re, pzPat, REG_EXTENDED|REG_ICASE|REG_NEWLINE ); if (res == 0) return; exit( res ); } @@ -295,7 +295,7 @@ AC_DEFUN([LIBOPTS_RUN_STRFTIME],[ @%:@include char t_buf@<:@ 64 @:>@; int main() { - static const char z@<:@@:>@ = "Thursday Aug 28 240"; + static char const z@<:@@:>@ = "Thursday Aug 28 240"; struct tm tm; tm.tm_sec = 36; /* seconds after the minute @<:@0, 61@:>@ */ tm.tm_min = 44; /* minutes after the hour @<:@0, 59@:>@ */ diff --git a/libopts/makeshell.c b/libopts/makeshell.c index 171cb23b8..36d3201d6 100644 --- a/libopts/makeshell.c +++ b/libopts/makeshell.c @@ -1,7 +1,7 @@ /* - * $Id: makeshell.c,v 4.10 2006/07/27 02:59:08 bkorb Exp $ - * Time-stamp: "2006-07-24 21:30:51 bkorb" + * $Id: makeshell.c,v 4.15 2006/09/23 00:12:48 bkorb Exp $ + * Time-stamp: "2006-09-22 18:19:24 bkorb" * * This module will interpret the options set in the tOptions * structure and create a Bourne shell script capable of parsing them. @@ -390,7 +390,7 @@ static void emitLong( tOptions* pOpts ); static void -openOutput( const char* pzFile ); +openOutput( char const* pzFile ); /* = = = END-STATIC-FORWARD = = = */ /*=export_func optionParseShell @@ -503,7 +503,7 @@ textToVariable( tOptions* pOpts, teTextTo whichVar, tOptDesc* pOD ) TEXTTO_TABLE # undef _TT_ # define _TT_(n) z ## n , - static const char* apzTTNames[] = { TEXTTO_TABLE }; + static char const* apzTTNames[] = { TEXTTO_TABLE }; # undef _TT_ #if defined(__windows__) && !defined(__CYGWIN__) @@ -545,7 +545,7 @@ textToVariable( tOptions* pOpts, teTextTo whichVar, tOptDesc* pOD ) exit( EXIT_FAILURE ); case TT_VERSION: - pOD->pzLastArg = "c"; + pOD->optArg.argString = "c"; optionPrintVersion( pOpts, pOD ); /* NOTREACHED */ @@ -668,8 +668,8 @@ emitSetup( tOptions* pOpts ) { tOptDesc* pOptDesc = pOpts->pOptDesc; int optionCt = pOpts->presetOptCt; - const char* pzFmt; - const char* pzDefault; + char const* pzFmt; + char const* pzDefault; for (;optionCt > 0; pOptDesc++, --optionCt) { char zVal[16]; @@ -692,7 +692,7 @@ emitSetup( tOptions* pOpts ) switch (OPTST_GET_ARGTYPE(pOptDesc->fOptState)) { case OPARG_TYPE_ENUMERATION: (*(pOptDesc->pOptProc))( (tOptions*)2UL, pOptDesc ); - pzDefault = pOptDesc->pzLastArg; + pzDefault = pOptDesc->optArg.argString; break; /* @@ -700,18 +700,19 @@ emitSetup( tOptions* pOpts ) */ case OPARG_TYPE_NUMERIC: case OPARG_TYPE_MEMBERSHIP: - snprintf( zVal, sizeof( zVal ), "%ld", (tAoUL)pOptDesc->pzLastArg ); + snprintf( zVal, sizeof( zVal ), "%d", + (int)pOptDesc->optArg.argIntptr ); pzDefault = zVal; break; default: - if (pOptDesc->pzLastArg == NULL) { + if (pOptDesc->optArg.argString == NULL) { if (pzFmt == zSingleDef) pzFmt = zSingleNoDef; pzDefault = NULL; } else - pzDefault = pOptDesc->pzLastArg; + pzDefault = pOptDesc->optArg.argString; } printf( pzFmt, pOpts->pzPROGNAME, pOptDesc->pz_NAME, pzDefault ); @@ -928,7 +929,7 @@ emitLong( tOptions* pOpts ) static void -openOutput( const char* pzFile ) +openOutput( char const* pzFile ) { FILE* fp; char* pzData = NULL; diff --git a/libopts/nested.c b/libopts/nested.c index 2246654d6..f4e665068 100644 --- a/libopts/nested.c +++ b/libopts/nested.c @@ -1,7 +1,7 @@ /* - * $Id: nested.c,v 4.5 2006/09/20 04:27:44 bkorb Exp $ - * Time-stamp: "2005-07-27 10:10:28 bkorb" + * $Id: nested.c,v 4.11 2006/09/23 00:12:48 bkorb Exp $ + * Time-stamp: "2006-09-22 18:14:12 bkorb" * * Automated Options Nested Values module. */ @@ -53,30 +53,30 @@ static void removeBackslashes( char* pzSrc ); -static const char* -scanQuotedString( const char* pzTxt ); +static char const* +scanQuotedString( char const* pzTxt ); static tOptionValue* -addStringValue( void** pp, const char* pzName, size_t nameLen, - const char* pzValue, size_t dataLen ); +addStringValue( void** pp, char const* pzName, size_t nameLen, + char const* pzValue, size_t dataLen ); static tOptionValue* -addBoolValue( void** pp, const char* pzName, size_t nameLen, - const char* pzValue, size_t dataLen ); +addBoolValue( void** pp, char const* pzName, size_t nameLen, + char const* pzValue, size_t dataLen ); static tOptionValue* -addNumberValue( void** pp, const char* pzName, size_t nameLen, - const char* pzValue, size_t dataLen ); +addNumberValue( void** pp, char const* pzName, size_t nameLen, + char const* pzValue, size_t dataLen ); static tOptionValue* -addNestedValue( void** pp, const char* pzName, size_t nameLen, +addNestedValue( void** pp, char const* pzName, size_t nameLen, char* pzValue, size_t dataLen, tOptionLoadMode mode ); -static const char* -scanNameEntry( const char* pzName, tOptionValue* pRes, tOptionLoadMode mode ); +static char const* +scanNameEntry( char const* pzName, tOptionValue* pRes, tOptionLoadMode mode ); -static const char* -scanXmlEntry( const char* pzName, tOptionValue* pRes, tOptionLoadMode mode ); +static char const* +scanXmlEntry( char const* pzName, tOptionValue* pRes, tOptionLoadMode mode ); static void unloadNestedArglist( tArgList* pAL ); @@ -115,8 +115,8 @@ removeBackslashes( char* pzSrc ) * * Find the end of a quoted string, skipping escaped quote characters. */ -static const char* -scanQuotedString( const char* pzTxt ) +static char const* +scanQuotedString( char const* pzTxt ) { char q = *(pzTxt++); /* remember the type of quote */ @@ -154,8 +154,8 @@ scanQuotedString( const char* pzTxt ) * Associate a name with either a string or no value. */ static tOptionValue* -addStringValue( void** pp, const char* pzName, size_t nameLen, - const char* pzValue, size_t dataLen ) +addStringValue( void** pp, char const* pzName, size_t nameLen, + char const* pzValue, size_t dataLen ) { tOptionValue* pNV; size_t sz = nameLen + dataLen + sizeof(*pNV); @@ -188,8 +188,8 @@ addStringValue( void** pp, const char* pzName, size_t nameLen, * Associate a name with either a string or no value. */ static tOptionValue* -addBoolValue( void** pp, const char* pzName, size_t nameLen, - const char* pzValue, size_t dataLen ) +addBoolValue( void** pp, char const* pzName, size_t nameLen, + char const* pzValue, size_t dataLen ) { tOptionValue* pNV; size_t sz = nameLen + sizeof(*pNV) + 1; @@ -228,8 +228,8 @@ addBoolValue( void** pp, const char* pzName, size_t nameLen, * Associate a name with either a string or no value. */ static tOptionValue* -addNumberValue( void** pp, const char* pzName, size_t nameLen, - const char* pzValue, size_t dataLen ) +addNumberValue( void** pp, char const* pzName, size_t nameLen, + char const* pzValue, size_t dataLen ) { tOptionValue* pNV; size_t sz = nameLen + sizeof(*pNV) + 1; @@ -259,7 +259,7 @@ addNumberValue( void** pp, const char* pzName, size_t nameLen, * Associate a name with either a string or no value. */ static tOptionValue* -addNestedValue( void** pp, const char* pzName, size_t nameLen, +addNestedValue( void** pp, char const* pzName, size_t nameLen, char* pzValue, size_t dataLen, tOptionLoadMode mode ) { tOptionValue* pNV; @@ -291,12 +291,12 @@ addNestedValue( void** pp, const char* pzName, size_t nameLen, * We have an entry that starts with a name. Find the end of it, cook it * (if called for) and create the name/value association. */ -static const char* -scanNameEntry( const char* pzName, tOptionValue* pRes, tOptionLoadMode mode ) +static char const* +scanNameEntry( char const* pzName, tOptionValue* pRes, tOptionLoadMode mode ) { tOptionValue* pNV; - const char* pzScan = pzName+1; - const char* pzVal; + char const* pzScan = pzName+1; + char const* pzVal; size_t nameLen = 1; size_t dataLen = 0; @@ -381,12 +381,12 @@ scanNameEntry( const char* pzName, tOptionValue* pRes, tOptionLoadMode mode ) * directive. If it is something else, then whatever it is we are looking * at is bogus. Returning NULL stops processing. */ -static const char* -scanXmlEntry( const char* pzName, tOptionValue* pRes, tOptionLoadMode mode ) +static char const* +scanXmlEntry( char const* pzName, tOptionValue* pRes, tOptionLoadMode mode ) { size_t nameLen = 1, valLen = 0; - const char* pzScan = ++pzName; - const char* pzVal; + char const* pzScan = ++pzName; + char const* pzVal; tOptionValue valu; tOptionValue* pNewVal; @@ -445,7 +445,7 @@ scanXmlEntry( const char* pzName, tOptionValue* pRes, tOptionLoadMode mode ) char z[68]; char* pzD = z; int ct = nameLen; - const char* pzS = pzName; + char const* pzS = pzName; *(pzD++) = '<'; *(pzD++) = '/'; @@ -594,8 +594,8 @@ sortNestedList( tArgList* pAL ) * private: * * what: parse a hierarchical option argument - * arg: + const char* + pzTxt + the text to scan + - * arg: + const char* + pzName + the name for the text + + * arg: + char const* + pzTxt + the text to scan + + * arg: + char const* + pzName + the name for the text + * arg: + size_t + nameLen + the length of "name" + * arg: + tOptionLoadMode + mode + the value formation mode + * @@ -608,7 +608,7 @@ sortNestedList( tArgList* pAL ) * option that takes a hierarchical value. =*/ tOptionValue* -optionLoadNested( const char* pzTxt, const char* pzName, size_t nameLen, +optionLoadNested( char const* pzTxt, char const* pzName, size_t nameLen, tOptionLoadMode mode ) { tOptionValue* pRes; @@ -689,8 +689,8 @@ void optionNestedVal( tOptions* pOpts, tOptDesc* pOD ) { tOptionValue* pOV = - optionLoadNested(pOD->pzLastArg, pOD->pz_Name, strlen( pOD->pz_Name ), - OPTION_LOAD_UNCOOKED); + optionLoadNested(pOD->optArg.argString, pOD->pz_Name, + strlen(pOD->pz_Name), OPTION_LOAD_UNCOOKED); if (pOV != NULL) addArgListEntry( &(pOD->optCookie), (void*)pOV ); diff --git a/libopts/numeric.c b/libopts/numeric.c index 08c520be1..d21c927e1 100644 --- a/libopts/numeric.c +++ b/libopts/numeric.c @@ -1,7 +1,7 @@ /* - * $Id: numeric.c,v 4.5 2006/03/31 19:52:10 bkorb Exp $ - * Time-stamp: "2005-02-14 08:22:56 bkorb" + * $Id: numeric.c,v 4.7 2006/03/25 19:23:28 bkorb Exp $ + * Time-stamp: "2006-09-22 18:14:38 bkorb" */ /* @@ -61,23 +61,23 @@ void optionNumericVal( tOptions* pOpts, tOptDesc* pOD ) { char* pz; - long val; + int val; /* * Numeric options may have a range associated with it. * If it does, the usage procedure requests that it be * emitted by passing a NULL pOD pointer. */ - if ((pOD == NULL) || (pOD->pzLastArg == NULL)) + if ((pOD == NULL) || (pOD->optArg.argString == NULL)) return; - val = strtol( pOD->pzLastArg, &pz, 0 ); + val = (int)strtol( pOD->optArg.argString, &pz, 0 ); if (*pz != NUL) { - fprintf( stderr, zNotNumber, pOpts->pzProgName, pOD->pzLastArg ); + fprintf( stderr, zNotNumber, pOpts->pzProgName, pOD->optArg.argString ); (*(pOpts->pUsageProc))(pOpts, EXIT_FAILURE); } - pOD->pzLastArg = (char*)val; + pOD->optArg.argInt = val; } /* * Local Variables: diff --git a/libopts/pgusage.c b/libopts/pgusage.c index 4dc707541..61684555d 100644 --- a/libopts/pgusage.c +++ b/libopts/pgusage.c @@ -1,6 +1,6 @@ /* - * $Id: pgusage.c,v 4.10 2006/07/16 15:29:31 bkorb Exp $ + * $Id: pgusage.c,v 4.12 2006/07/16 15:27:50 bkorb Exp $ * Time-stamp: "2006-07-16 08:13:26 bkorb" * * Automated Options Paged Usage module. diff --git a/libopts/proto.h b/libopts/proto.h index 03d431d55..55bf229b5 100644 --- a/libopts/proto.h +++ b/libopts/proto.h @@ -1,7 +1,7 @@ /* -*- buffer-read-only: t -*- vi: set ro: * * Prototypes for autoopts - * Generated Tue Sep 19 21:27:54 PDT 2006 + * Generated Fri Sep 22 18:22:00 PDT 2006 */ #ifndef AUTOOPTS_PROTO_H_GUARD #define AUTOOPTS_PROTO_H_GUARD 1 @@ -55,7 +55,7 @@ parseAttributes( tOptionValue* pType ); LOCAL tSuccess -validateOptionsStruct( tOptions* pOpts, const char* pzProgram ); +validateOptionsStruct( tOptions* pOpts, char const* pzProgram ); /* * Extracted from environment.c diff --git a/libopts/putshell.c b/libopts/putshell.c index 1f7a611ce..b5b4d80ea 100644 --- a/libopts/putshell.c +++ b/libopts/putshell.c @@ -1,7 +1,7 @@ /* - * $Id: putshell.c,v 4.9 2006/07/16 15:29:31 bkorb Exp $ - * Time-stamp: "2006-07-16 08:13:24 bkorb" + * $Id: putshell.c,v 4.12 2006/07/16 15:27:50 bkorb Exp $ + * Time-stamp: "2006-09-22 18:08:30 bkorb" * * This module will interpret the options set in the tOptions * structure and print them to standard out in a fashion that @@ -162,8 +162,8 @@ optionPutShell( tOptions* pOpts ) * but copy over the set-state bits. */ if (pOD->optActualIndex != optIx) { - tOptDesc* p = pOpts->pOptDesc + pOD->optActualIndex; - p->pzLastArg = pOD->pzLastArg; + tOptDesc* p = pOpts->pOptDesc + pOD->optActualIndex; + p->optArg = pOD->optArg; p->fOptState &= OPTST_PERSISTENT; p->fOptState |= pOD->fOptState & ~OPTST_PERSISTENT; printf( zEquivMode, pOpts->pzPROGNAME, pOD->pz_NAME, p->pz_NAME ); @@ -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->pzLastArg + 7; + pz = (char*)pOD->optArg.argString + 7; while (*pz != NUL) { printf( "typeset -x -i %s_", pOD->pz_NAME ); pz += strspn( pz, " +\t\n\f" ); @@ -203,7 +203,7 @@ optionPutShell( tOptions* pOpts ) printf( "=%1$lu # 0x%1$lX\n", (unsigned long)val ); val <<= 1; } - free( (void*)(pOD->pzLastArg) ); + free( (void*)(pOD->optArg.argString) ); continue; } @@ -256,12 +256,12 @@ optionPutShell( tOptions* pOpts ) */ else if (OPTST_GET_ARGTYPE(pOD->fOptState) == OPARG_TYPE_NUMERIC) printf( zOptNumFmt, pOpts->pzPROGNAME, pOD->pz_NAME, - (uintptr_t)(pOD->pzLastArg) ); + pOD->optArg.argIntptr ); /* * If the argument type is an enumeration, then it is much * like a text value, except we call the callback function - * to emit the value corresponding to the "pzLastArg" number. + * to emit the value corresponding to the "optArg" number. */ else if (OPTST_GET_ARGTYPE(pOD->fOptState) == OPARG_TYPE_ENUMERATION) { printf( zOptValFmt, pOpts->pzPROGNAME, pOD->pz_NAME ); @@ -277,14 +277,14 @@ optionPutShell( tOptions* pOpts ) */ else if (OPTST_GET_ARGTYPE(pOD->fOptState) == OPARG_TYPE_BOOLEAN) printf( zFullOptFmt, pOpts->pzPROGNAME, pOD->pz_NAME, - ((uintptr_t)(pOD->pzLastArg) == 0) ? "false" : "true" ); + (pOD->optArg.argIntptr == 0) ? "false" : "true" ); /* * IF the option has an empty value, * THEN we set the argument to the occurrence count. */ - else if ( (pOD->pzLastArg == NULL) - || (pOD->pzLastArg[0] == NUL) ) + else if ( (pOD->optArg.argString == NULL) + || (pOD->optArg.argString[0] == NUL) ) printf( zOptNumFmt, pOpts->pzPROGNAME, pOD->pz_NAME, (int)pOD->optOccCt ); @@ -294,7 +294,7 @@ optionPutShell( tOptions* pOpts ) */ else { printf( zOptValFmt, pOpts->pzPROGNAME, pOD->pz_NAME ); - putQuotedStr( pOD->pzLastArg ); + putQuotedStr( pOD->optArg.argString ); printf( zOptEnd, pOpts->pzPROGNAME, pOD->pz_NAME ); } } while (++optIx < pOpts->presetOptCt ); diff --git a/libopts/restore.c b/libopts/restore.c index 798614cee..ce788b330 100644 --- a/libopts/restore.c +++ b/libopts/restore.c @@ -1,6 +1,6 @@ /* - * restore.c $Id: restore.c,v 4.5 2006/03/31 19:52:11 bkorb Exp $ + * restore.c $Id: restore.c,v 4.7 2006/03/25 19:23:28 bkorb Exp $ * Time-stamp: "2005-02-23 15:10:20 bkorb" * * This module's routines will save the current option state to memory diff --git a/libopts/save.c b/libopts/save.c index 9c73057e4..6aeb3b877 100644 --- a/libopts/save.c +++ b/libopts/save.c @@ -1,7 +1,7 @@ /* - * save.c $Id: save.c,v 4.8 2006/07/16 15:29:31 bkorb Exp $ - * Time-stamp: "2006-07-16 08:13:22 bkorb" + * save.c $Id: save.c,v 4.17 2006/09/23 00:09:48 bkorb Exp $ + * Time-stamp: "2006-09-22 18:11:20 bkorb" * * This module's routines will take the currently set options and * store them into an ".rc" file for re-interpretation the next @@ -76,7 +76,7 @@ findDirName( tOptions* pOpts, int* p_free ) if (pOpts->specOptIdx.save_opts == 0) return NULL; - pzDir = pOpts->pOptDesc[ pOpts->specOptIdx.save_opts ].pzLastArg; + pzDir = pOpts->pOptDesc[ pOpts->specOptIdx.save_opts ].optArg.argString; if ((pzDir != NULL) && (*pzDir != NUL)) return pzDir; @@ -370,7 +370,7 @@ optionSaveFile( tOptions* pOpts ) } { - const char* pz = pOpts->pzUsageTitle; + char const* pz = pOpts->pzUsageTitle; fputs( "# ", fp ); do { fputc( *pz, fp ); } while (*(pz++) != '\n'); } @@ -437,7 +437,7 @@ optionSaveFile( tOptions* pOpts ) switch (arg_state) { case 0: case OPARG_TYPE_NUMERIC: - printEntry( fp, p, p->pzLastArg ); + printEntry( fp, p, p->optArg.argString ); break; case OPARG_TYPE_STRING: @@ -455,31 +455,33 @@ optionSaveFile( tOptions* pOpts ) while (uct-- > 0) printEntry( fp, p, *(ppz++) ); } else { - printEntry( fp, p, p->pzLastArg ); + printEntry( fp, p, p->optArg.argString ); } break; case OPARG_TYPE_ENUMERATION: case OPARG_TYPE_MEMBERSHIP: { - tCC* val = p->pzLastArg; + tCC* val = p->optArg.argString; /* * 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->pzLastArg ); - if ((p->pzLastArg != NULL) && (arg_state != OPARG_TYPE_ENUMERATION)) + printEntry( fp, p, p->optArg.argString ); + if ( (p->optArg.argString != NULL) + && (arg_state != OPARG_TYPE_ENUMERATION)) /* * bit flag and enumeration strings get allocated */ - AGFREE( (void*)p->pzLastArg ); - p->pzLastArg = val; + AGFREE( (void*)p->optArg.argString ); + p->optArg.argString = val; break; } case OPARG_TYPE_BOOLEAN: - printEntry( fp, p, (p->pzLastArg != 0) ? "true" : "false" ); + printEntry( fp, p, (p->optArg.argBool != AG_FALSE) + ? "true" : "false" ); break; default: diff --git a/libopts/sort.c b/libopts/sort.c index 90c81a8c9..de0bd5634 100644 --- a/libopts/sort.c +++ b/libopts/sort.c @@ -1,6 +1,6 @@ /* - * sort.c $Id: sort.c,v 4.7 2006/06/24 23:36:08 bkorb Exp $ + * sort.c $Id: sort.c,v 4.10 2006/06/24 23:34:51 bkorb Exp $ * Time-stamp: "2006-06-24 10:53:35 bkorb" * * This module implements argument sorting. diff --git a/libopts/stack.c b/libopts/stack.c index 65db828eb..a5eb00407 100644 --- a/libopts/stack.c +++ b/libopts/stack.c @@ -1,8 +1,8 @@ /* * stack.c - * $Id: stack.c,v 4.7 2006/07/14 04:31:38 bkorb Exp $ - * Time-stamp: "2006-07-13 21:11:29 bkorb" + * $Id: stack.c,v 4.10 2006/07/14 04:20:17 bkorb Exp $ + * Time-stamp: "2006-09-22 18:13:19 bkorb" * * This is a special option processing routine that will save the * argument to an option in a FIFO queue. @@ -89,7 +89,7 @@ optionUnstackArg( regex_t re; int i, ct, dIdx; - if (regcomp( &re, pOptDesc->pzLastArg, REG_NOSUB ) != 0) + if (regcomp( &re, pOptDesc->optArg.argString, REG_NOSUB ) != 0) return; /* @@ -150,7 +150,7 @@ optionUnstackArg( if (pzEq != NULL) *pzEq = NUL; - if (strcmp( pzSrc, pOptDesc->pzLastArg ) == 0) { + if (strcmp( pzSrc, pOptDesc->optArg.argString ) == 0) { /* * Remove this entry by reducing the in-use count * and *not* putting the string pointer back into @@ -250,10 +250,10 @@ optionStackArg( tOptions* pOpts, tOptDesc* pOD ) { - if (pOD->pzLastArg == NULL) + if (pOD->optArg.argString == NULL) return; - addArgListEntry( &(pOD->optCookie), (void*)pOD->pzLastArg ); + addArgListEntry( &(pOD->optCookie), (void*)pOD->optArg.argString ); } /* * Local Variables: diff --git a/libopts/streqvcmp.c b/libopts/streqvcmp.c index f66ddd804..e16debd15 100644 --- a/libopts/streqvcmp.c +++ b/libopts/streqvcmp.c @@ -1,6 +1,6 @@ /* - * $Id: streqvcmp.c,v 4.7 2006/07/27 02:59:08 bkorb Exp $ + * $Id: streqvcmp.c,v 4.11 2006/09/23 00:09:48 bkorb Exp $ * Time-stamp: "2006-07-26 18:25:53 bkorb" * * String Equivalence Comparison @@ -103,8 +103,8 @@ static unsigned char charmap[] = { * * what: compare two strings with an equivalence mapping * - * arg: + const char* + str1 + first string + - * arg: + const char* + str2 + second string + + * arg: + char const* + str1 + first string + + * arg: + char const* + str2 + second string + * arg: + int + ct + compare length + * * ret_type: int @@ -144,8 +144,8 @@ strneqvcmp( tCC* s1, tCC* s2, int ct ) * * what: compare two strings with an equivalence mapping * - * arg: + const char* + str1 + first string + - * arg: + const char* + str2 + second string + + * arg: + char const* + str1 + first string + + * arg: + char const* + str2 + second string + * * ret_type: int * ret_desc: the difference between two differing characters @@ -234,7 +234,7 @@ streqvmap( char From, char To, int ct ) * * what: map a list of characters to the same value * - * arg: + const char* + ch_list + characters to equivalence + + * arg: + char const* + ch_list + characters to equivalence + * * doc: * @@ -246,7 +246,7 @@ streqvmap( char From, char To, int ct ) * err: none. =*/ void -strequate( const char* s ) +strequate( char const* s ) { if ((s != NULL) && (*s != NUL)) { unsigned char equiv = (unsigned)*s; @@ -261,7 +261,7 @@ strequate( const char* s ) * what: convert a string into its mapped-to value * * arg: + char* + dest + output string + - * arg: + const char* + src + input string + + * arg: + char const* + src + input string + * * doc: * @@ -273,7 +273,7 @@ strequate( const char* s ) * err: none. =*/ void -strtransform( char* d, const char* s ) +strtransform( char* d, char const* s ) { do { *(d++) = (char)charmap[ (unsigned)*s ]; diff --git a/libopts/text_mmap.c b/libopts/text_mmap.c index e0878f9c8..3455fd5ec 100644 --- a/libopts/text_mmap.c +++ b/libopts/text_mmap.c @@ -1,5 +1,5 @@ /* - * $Id: text_mmap.c,v 4.12 2006/09/16 19:58:54 bkorb Exp $ + * $Id: text_mmap.c,v 4.15 2006/09/23 00:09:48 bkorb Exp $ * * Time-stamp: "2006-09-10 14:50:04 bkorb" */ @@ -28,7 +28,7 @@ * * what: map a text file with terminating NUL * - * arg: const char*, pzFile, name of the file to map + * arg: char const*, pzFile, name of the file to map * arg: int, prot, mmap protections (see mmap(2)) * arg: int, flags, mmap flags (see mmap(2)) * arg: tmap_info_t*, mapinfo, returned info about the mapping @@ -77,7 +77,7 @@ * text_munmap( &mi ); =*/ void* -text_mmap( const char* pzFile, int prot, int flags, tmap_info_t* pMI ) +text_mmap( char const* pzFile, int prot, int flags, tmap_info_t* pMI ) { memset( pMI, 0, sizeof(*pMI) ); #ifdef HAVE_MMAP diff --git a/libopts/tokenize.c b/libopts/tokenize.c index 2c9c5e7ea..c1b4c9ba1 100644 --- a/libopts/tokenize.c +++ b/libopts/tokenize.c @@ -30,14 +30,14 @@ /* = = = START-STATIC-FORWARD = = = */ /* static forward declarations maintained by :mkfwd */ static void -copy_cooked( ch_t** ppDest, const char ** ppSrc ); +copy_cooked( ch_t** ppDest, char const ** ppSrc ); static void -copy_raw( ch_t** ppDest, const char ** ppSrc ); +copy_raw( ch_t** ppDest, char const ** ppSrc ); /* = = = END-STATIC-FORWARD = = = */ static void -copy_cooked( ch_t** ppDest, const char ** ppSrc ) +copy_cooked( ch_t** ppDest, char const ** ppSrc ) { ch_t* pDest = (ch_t*)*ppDest; const ch_t* pSrc = (const ch_t*)(*ppSrc + 1); @@ -60,12 +60,12 @@ copy_cooked( ch_t** ppDest, const char ** ppSrc ) done: *ppDest = (ch_t*)pDest; /* next spot for storing character */ - *ppSrc = (const char *)pSrc; /* char following closing quote */ + *ppSrc = (char const *)pSrc; /* char following closing quote */ } static void -copy_raw( ch_t** ppDest, const char ** ppSrc ) +copy_raw( ch_t** ppDest, char const ** ppSrc ) { ch_t* pDest = *ppDest; cc_t* pSrc = (cc_t*) (*ppSrc + 1); @@ -108,7 +108,7 @@ copy_raw( ch_t** ppDest, const char ** ppSrc ) done: *ppDest = pDest; /* next spot for storing character */ - *ppSrc = (const char *) pSrc; /* char following closing quote */ + *ppSrc = (char const *) pSrc; /* char following closing quote */ } @@ -116,7 +116,7 @@ copy_raw( ch_t** ppDest, const char ** ppSrc ) * * what: tokenize an input string * - * arg: + const char* + string + string to be tokenized + + * arg: + char const* + string + string to be tokenized + * * ret_type: token_list_t* * ret_desc: pointer to a structure that lists each token @@ -178,7 +178,7 @@ copy_raw( ch_t** ppDest, const char ** ppSrc ) * @end itemize =*/ token_list_t* -ao_string_tokenize( const char* str ) +ao_string_tokenize( char const* str ) { int max_token_ct = 1; /* allow for trailing NUL on string */ token_list_t* res; diff --git a/libopts/usage.c b/libopts/usage.c index 18843cdd0..4f0531823 100644 --- a/libopts/usage.c +++ b/libopts/usage.c @@ -1,6 +1,6 @@ /* - * usage.c $Id: usage.c,v 4.10 2006/08/12 17:36:43 bkorb Exp $ + * usage.c $Id: usage.c,v 4.16 2006/09/23 00:09:48 bkorb Exp $ * Time-stamp: "2006-07-01 12:41:02 bkorb" * * This module implements the default usage procedure for @@ -409,7 +409,7 @@ printInitList( *pInitIntro = AG_FALSE; for (;;) { - const char* pzPath = *(papz++); + char const* pzPath = *(papz++); if (pzPath == NULL) break; diff --git a/libopts/version.c b/libopts/version.c index dd50ec4d8..6b1e6917f 100644 --- a/libopts/version.c +++ b/libopts/version.c @@ -1,12 +1,12 @@ -/* $Id: version.c,v 4.7 2006/07/27 02:59:08 bkorb Exp $ - * Time-stamp: "2006-07-26 18:38:16 bkorb" +/* $Id: version.c,v 4.10 2006/09/23 00:09:48 bkorb Exp $ + * Time-stamp: "2006-09-22 18:15:00 bkorb" * * This module implements the default usage procedure for * Automated Options. It may be overridden, of course. */ -static const char zAOV[] = +static char const zAOV[] = "Automated Options version %s, copyright (c) 1999-2006 Bruce Korb\n"; /* Automated Options is free software. @@ -58,16 +58,16 @@ printVersion( tOptions* pOpts, tOptDesc* pOD, FILE* fp ); /*=export_func optionVersion * * what: return the compiled AutoOpts version number - * ret_type: const char* + * ret_type: char const* * ret_desc: the version string in constant memory * doc: * Returns the full version string compiled into the library. * The returned string cannot be modified. =*/ -const char* +char const* optionVersion( void ) { - static const char zVersion[] = + static char const zVersion[] = STR( AO_CURRENT.AO_REVISION ); return zVersion; @@ -79,16 +79,16 @@ printVersion( tOptions* pOpts, tOptDesc* pOD, FILE* fp ) { char swCh; - if (pOD->pzLastArg == NULL) + if (pOD->optArg.argString == NULL) swCh = 'v'; - else swCh = pOD->pzLastArg[0]; + else swCh = pOD->optArg.argString[0]; if (pOpts->pzFullVersion != NULL) { fputs( pOpts->pzFullVersion, fp ); fputc( '\n', fp ); } else { - const char *pz = pOpts->pzUsageTitle; + char const *pz = pOpts->pzUsageTitle; do { fputc( *pz, fp ); } while (*(pz++) != '\n'); } diff --git a/ntpq/ntpq-opts.c b/ntpq/ntpq-opts.c index 8cd128c8f..e5ab15634 100644 --- a/ntpq/ntpq-opts.c +++ b/ntpq/ntpq-opts.c @@ -2,7 +2,7 @@ * * DO NOT EDIT THIS FILE (ntpq-opts.c) * - * It has been AutoGen-ed Friday September 22, 2006 at 08:21:17 PM EDT + * It has been AutoGen-ed Sunday September 24, 2006 at 02:18:34 AM EDT * From the definitions ntpq-opts.def * and the template file options */ @@ -36,7 +36,7 @@ tSCC zCopyright[] = "ntpq copyright (c) 1970-2006 ntp.org, all rights reserved"; tSCC zCopyrightNotice[] = -/* extracted from ../include/copyright.def near line 8 */ +/* extracted from /backroom/ntp-dev/include/copyright.def near line 8 */ "see html/copyright.html"; extern tUsageProc optionUsage; @@ -239,7 +239,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ IPV4_FLAGS, 0, - /* last opt argumnt */ NULL, + /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, /* option proc */ NULL, @@ -251,7 +251,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* equivalenced to */ INDEX_OPT_IPV4, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ IPV6_FLAGS, 0, - /* last opt argumnt */ NULL, + /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, /* option proc */ NULL, @@ -263,7 +263,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, NOLIMIT, 0, /* opt state flags */ COMMAND_FLAGS, 0, - /* last opt argumnt */ NULL, + /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, /* option proc */ optionStackArg, @@ -275,7 +275,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, NOLIMIT, 0, /* opt state flags */ DEBUG_LEVEL_FLAGS, 0, - /* last opt argumnt */ NULL, + /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, /* option proc */ NULL, @@ -287,7 +287,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, NOLIMIT, 0, /* opt state flags */ SET_DEBUG_LEVEL_FLAGS, 0, - /* last opt argumnt */ NULL, + /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, /* option proc */ SET_DEBUG_LEVEL_OPT_PROC, @@ -299,7 +299,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ PEERS_FLAGS, 0, - /* last opt argumnt */ NULL, + /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, aPeersCantList, /* option proc */ NULL, @@ -311,7 +311,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ INTERACTIVE_FLAGS, 0, - /* last opt argumnt */ NULL, + /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, aInteractiveCantList, /* option proc */ NULL, @@ -323,7 +323,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ NUMERIC_FLAGS, 0, - /* last opt argumnt */ NULL, + /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, /* option proc */ NULL, @@ -336,7 +336,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* min, max, act ct */ 0, 1, 0, /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | OPTST_ARG_OPTIONAL, 0, - /* last opt argumnt */ NULL, + /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, /* option proc */ DOVERPROC, @@ -348,7 +348,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ OPTST_IMM, 0, - /* last opt argumnt */ NULL, + /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, /* option proc */ doUsageOpt, @@ -360,7 +360,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ OPTST_IMM, 0, - /* last opt argumnt */ NULL, + /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, /* option proc */ optionPagedUsage, @@ -373,7 +373,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* min, max, act ct */ 0, 1, 0, /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | OPTST_ARG_OPTIONAL, 0, - /* last opt argumnt */ NULL, + /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, /* option proc */ NULL, @@ -386,7 +386,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* min, max, act ct */ 0, NOLIMIT, 0, /* opt state flags */ OPTST_DISABLE_IMM | \ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING), 0, - /* last opt argumnt */ NULL, + /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, /* option proc */ optionLoadOpt, @@ -514,11 +514,11 @@ main( int argc, char** argv ) #include #include -static char* AO_gettext( const char* pz ); +static char* AO_gettext( char const* pz ); static void coerce_it(void** s); static char* -AO_gettext( const char* pz ) +AO_gettext( char const* pz ) { char* pzRes; if (pz == NULL) diff --git a/ntpq/ntpq-opts.h b/ntpq/ntpq-opts.h index 006e79615..e18d8b0c8 100644 --- a/ntpq/ntpq-opts.h +++ b/ntpq/ntpq-opts.h @@ -2,7 +2,7 @@ * * DO NOT EDIT THIS FILE (ntpq-opts.h) * - * It has been AutoGen-ed Friday September 22, 2006 at 08:21:17 PM EDT + * It has been AutoGen-ed Sunday September 24, 2006 at 02:18:34 AM EDT * From the definitions ntpq-opts.def * and the template file options */ @@ -77,7 +77,7 @@ typedef enum { */ #define DESC(n) ntpqOptions.pOptDesc[INDEX_OPT_ ## n] #define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n))) -#define OPT_ARG(n) (DESC(n).pzLastArg) +#define OPT_ARG(n) (DESC(n).optArg.argString) #define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK) #define COUNT_OPT(n) (DESC(n).optOccCt) #define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n))) @@ -164,7 +164,7 @@ typedef enum { #define SET_OPT_SAVE_OPTS(a) STMTS( \ DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT; \ DESC(SAVE_OPTS).fOptState |= OPTST_SET; \ - DESC(SAVE_OPTS).pzLastArg = (const char*)(a) ) + DESC(SAVE_OPTS).optArg.argString = (char const*)(a) ) /* * Interface defines not associated with particular options */ @@ -175,7 +175,7 @@ typedef enum { ntpqOptions.pzCurOpt = NULL ) #define START_OPT RESTART_OPT(1) #define USAGE(c) (*ntpqOptions.pUsageProc)( &ntpqOptions, c ) -/* extracted from opthead near line 311 */ +/* extracted from opthead near line 312 */ /* * * * * * * @@ -190,7 +190,7 @@ extern tOptions ntpqOptions; #ifndef _ # if ENABLE_NLS # include - static inline char* aoGetsText( const char* pz ) { + static inline char* aoGetsText( char const* pz ) { if (pz == NULL) return NULL; return (char*)gettext( pz ); } diff --git a/sntp/libopts/autoopts.c b/sntp/libopts/autoopts.c index 7efe8245b..712be238f 100644 --- a/sntp/libopts/autoopts.c +++ b/sntp/libopts/autoopts.c @@ -1,7 +1,7 @@ /* - * $Id: autoopts.c,v 4.22 2006/07/15 22:10:21 bkorb Exp $ - * Time-stamp: "2006-07-15 13:54:08 bkorb" + * $Id: autoopts.c,v 4.24 2006/09/23 00:12:48 bkorb Exp $ + * Time-stamp: "2006-09-22 18:21:53 bkorb" * * This file contains all of the routines that must be linked into * an executable to use the generated option processing. The optional @@ -68,7 +68,7 @@ # include "compat/strchr.c" #endif -static const char zNil[] = ""; +static char const zNil[] = ""; #define SKIP_RC_FILES(po) \ DISABLED_OPT(&((po)->pOptDesc[ (po)->specOptIdx.save_opts+1])) @@ -88,6 +88,50 @@ static int checkConsistency( tOptions* pOpts ); /* = = = END-STATIC-FORWARD = = = */ +LOCAL void * +ao_malloc( size_t sz ) +{ + void * res = malloc(sz); + if (res == NULL) { + fprintf( stderr, "malloc of %d bytes failed\n", sz ); + exit( EXIT_FAILURE ); + } + return res; +} + + +LOCAL void * +ao_realloc( void *p, size_t sz ) +{ + void * res = realloc(p, sz); + if (res == NULL) { + fprintf( stderr, "realloc of %d bytes at 0x%p failed\n", sz, p ); + exit( EXIT_FAILURE ); + } + return res; +} + + +LOCAL void +ao_free( void *p ) +{ + if (p != NULL) + free(p); +} + + +LOCAL char * +ao_strdup( char const *str ) +{ + char * res = strdup(str); + if (res == NULL) { + fprintf( stderr, "strdup of %d byte string failed\n", strlen(str) ); + exit( EXIT_FAILURE ); + } + return res; +} + + /* * handleOption * @@ -104,7 +148,7 @@ handleOption( tOptions* pOpts, tOptState* pOptState ) tOptDesc* pOD = pOptState->pOD; tOptProc* pOP = pOD->pOptProc; - pOD->pzLastArg = pOptState->pzOptArg; + pOD->optArg.argString = pOptState->pzOptArg; /* * IF we are presetting options, then we will ignore any un-presettable @@ -169,7 +213,7 @@ handleOption( tOptions* pOpts, tOptState* pOptState ) * Copy the most recent option argument. set membership state * is kept in ``p->optCookie''. Do not overwrite. */ - p->pzLastArg = pOD->pzLastArg; + p->optArg.argString = pOD->optArg.argString; pOD = p; } else { @@ -186,11 +230,11 @@ handleOption( tOptions* pOpts, tOptState* pOptState ) */ if ( (pOD->fOptState & OPTST_DEFINED) && (++pOD->optOccCt > pOD->optMaxCt) ) { - const char* pzEqv = + char const* pzEqv = (pOD->optEquivIndex != NO_EQUIVALENT) ? zEquiv : zNil; if ((pOpts->fOptSet & OPTPROC_ERRSTOP) != 0) { - const char* pzFmt = (pOD->optMaxCt > 1) ? zAtMost : zOnlyOne; + char const* pzFmt = (pOD->optMaxCt > 1) ? zAtMost : zOnlyOne; fputs( zErrOnly, stderr ); fprintf( stderr, pzFmt, pOD->pz_Name, pzEqv, pOD->optMaxCt ); diff --git a/sntp/libopts/autoopts.h b/sntp/libopts/autoopts.h index 628b14cf3..e6fcd90bc 100644 --- a/sntp/libopts/autoopts.h +++ b/sntp/libopts/autoopts.h @@ -1,8 +1,8 @@ /* - * Time-stamp: "2006-08-12 10:26:19 bkorb" + * Time-stamp: "2006-09-10 14:43:25 bkorb" * - * autoopts.h $Id: autoopts.h,v 4.14 2006/08/12 17:36:43 bkorb Exp $ + * autoopts.h $Id: autoopts.h,v 4.28 2006/09/23 00:12:48 bkorb Exp $ * Time-stamp: "2005-02-14 05:59:50 bkorb" * * This file defines all the global structures and special values @@ -195,11 +195,12 @@ typedef struct { tCC* pzOptFmt; } arg_types_t; -# define AGALOC( c, w ) malloc( (unsigned)c ) -# define AGREALOC( p, c, w ) realloc( p, (unsigned)c ) -# define AGFREE( p ) free( p ) -# define AGDUPSTR( p, s, w ) p = strdup( s ) -# define TAGMEM( m, t ) +#define AGALOC( c, w ) ao_malloc( (unsigned)c ) +#define AGREALOC( p, c, w ) ao_realloc( p, (unsigned)c ) +#define AGFREE( p ) ao_free( p ) +#define AGDUPSTR( p, s, w ) p = ao_strdup( s ) + +#define TAGMEM( m, t ) /* * DO option handling? @@ -306,8 +307,8 @@ typedef struct { #endif #ifndef HAVE_STRCHR -extern char* strchr( const char *s, int c); -extern char* strrchr( const char *s, int c); +extern char* strchr( char const *s, int c); +extern char* strrchr( char const *s, int c); #endif /* diff --git a/sntp/libopts/autoopts/options.h b/sntp/libopts/autoopts/options.h index c6027ff57..da129fd29 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 Saturday July 22, 2006 at 08:36:53 AM PDT + * It has been AutoGen-ed Friday September 22, 2006 at 06:21:59 PM PDT * From the definitions funcs.def * and the template file options_h * @@ -156,8 +156,8 @@ typedef struct optionValue { * because "static const" cannot both be applied to a type, * tho each individually can...so they all are */ -#define tSCC static const char -#define tCC const char +#define tSCC static char const +#define tCC char const #define tAoSC static char #define tAoUC unsigned char #define tAoUI unsigned int @@ -217,6 +217,14 @@ struct argList { tCC* apzArgs[ MIN_ARG_ALLOC_CT ]; }; +typedef union { + char const * argString; + uintptr_t argIntptr; + int argInt; + unsigned int argUint; + ag_bool argBool; +} optArgBucket_t; + /* * Descriptor structure for each option. * Only the fields marked "PUBLIC" are for public use. @@ -234,18 +242,19 @@ struct optDesc { tAoUI fOptState; /* PUBLIC */ tAoUI reserved; - tCC* pzLastArg; /* PUBLIC */ + optArgBucket_t optArg; /* PUBLIC */ +# define pzLastArg optArg.argString void* optCookie; /* PUBLIC */ const int * pOptMust; const int * pOptCant; tpOptProc pOptProc; - const char* pzText; + char const* pzText; - const char* pz_NAME; - const char* pz_Name; - const char* pz_DisableName; - const char* pz_DisablePfx; + char const* pz_NAME; + char const* pz_Name; + char const* pz_DisableName; + char const* pz_DisablePfx; }; /* @@ -260,10 +269,10 @@ struct optSpecIndex { const tAoUS default_opt; }; -#define OPTIONS_STRUCT_VERSION 110594 -#define OPTIONS_VERSION_STRING "27:4:2" -#define OPTIONS_MINIMUM_VERSION 102400 -#define OPTIONS_MIN_VER_STRING "25:0:0" +#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 @@ -278,19 +287,19 @@ struct options { unsigned int curOptIdx; char* pzCurOpt; - const char* pzProgPath; - const char* pzProgName; - const char* const pzPROGNAME; - const char* const pzRcName; - const char* const pzCopyright; - const char* const pzCopyNotice; - const char* const pzFullVersion; - const char* const* papzHomeList; - const char* const pzUsageTitle; - const char* const pzExplain; - const char* const pzDetail; + char const* pzProgPath; + char const* pzProgName; + char const* const pzPROGNAME; + char const* const pzRcName; + char const* const pzCopyright; + char const* const pzCopyNotice; + char const* const pzFullVersion; + char const* const* papzHomeList; + char const* const pzUsageTitle; + char const* const pzExplain; + char const* const pzDetail; tOptDesc* const pOptDesc; - const char* const pzBugAddr; + char const* const pzBugAddr; void* pExtensions; void* pSavedState; @@ -423,7 +432,7 @@ extern "C" { * Double quote strings are formed according to the rules of string * constants in ANSI-C programs. */ -extern token_list_t* ao_string_tokenize( const char* ); +extern token_list_t* ao_string_tokenize( char const* ); /* From: configfile.c line 113 @@ -443,10 +452,10 @@ extern token_list_t* ao_string_tokenize( const char* ); * @code{optionGetValue()}, @code{optionNextValue()} and * @code{optionUnloadNested()}. */ -extern const tOptionValue* configFileLoad( const char* ); +extern const tOptionValue* configFileLoad( char const* ); -/* From: configfile.c line 869 +/* From: configfile.c line 871 * * optionFileLoad - Load the locatable config files, in order * @@ -473,10 +482,10 @@ extern const tOptionValue* configFileLoad( const char* ); * * Configuration files not found or not decipherable are simply ignored. */ -extern int optionFileLoad( tOptions*, const char* ); +extern int optionFileLoad( tOptions*, char const* ); -/* From: configfile.c line 241 +/* From: configfile.c line 240 * * optionFindNextValue - find a hierarcicaly valued option instance * @@ -492,7 +501,7 @@ extern int optionFileLoad( tOptions*, const char* ); * configurable. It will search through the list and return the next entry * that matches the criteria. */ -extern const tOptionValue* optionFindNextValue( const tOptDesc*, const tOptionValue*, const char*, const char* ); +extern const tOptionValue* optionFindNextValue( const tOptDesc*, const tOptionValue*, char const*, char const* ); /* From: configfile.c line 166 @@ -509,7 +518,7 @@ extern const tOptionValue* optionFindNextValue( const tOptDesc*, const tOptionVa * This routine will find an entry in a nested value option or configurable. * It will search through the list and return a matching entry. */ -extern const tOptionValue* optionFindValue( const tOptDesc*, const char*, const char* ); +extern const tOptionValue* optionFindValue( const tOptDesc*, char const*, char const* ); /* From: restore.c line 157 @@ -525,7 +534,7 @@ extern const tOptionValue* optionFindValue( const tOptDesc*, const char*, const extern void optionFree( tOptions* ); -/* From: configfile.c line 310 +/* From: configfile.c line 309 * * optionGetValue - get a specific value from a hierarcical list * @@ -540,7 +549,7 @@ extern void optionFree( tOptions* ); * the first entry with a name that exactly matches the argument will be * returned. */ -extern const tOptionValue* optionGetValue( const tOptionValue*, const char* ); +extern const tOptionValue* optionGetValue( const tOptionValue*, char const* ); /* From: load.c line 477 @@ -564,10 +573,10 @@ extern const tOptionValue* optionGetValue( const tOptionValue*, const char* ); * formation used in AutoGen definition files (@pxref{basic expression}), * except that you may not use backquotes. */ -extern void optionLoadLine( tOptions*, const char* ); +extern void optionLoadLine( tOptions*, char const* ); -/* From: configfile.c line 369 +/* From: configfile.c line 368 * * optionNextValue - get the next value from a hierarchical list * @@ -601,7 +610,7 @@ extern const tOptionValue* optionNextValue( const tOptionValue*, const tOptionVa extern void optionOnlyUsage( tOptions*, int ); -/* From: autoopts.c line 936 +/* From: autoopts.c line 980 * * optionProcess - this is the main option processing routine * @@ -701,12 +710,12 @@ extern void optionUnloadNested( const tOptionValue* ); * * optionVersion - return the compiled AutoOpts version number * - * Returns: const char* - the version string in constant memory + * Returns: char const* - the version string in constant memory * * Returns the full version string compiled into the library. * The returned string cannot be modified. */ -extern const char* optionVersion( void ); +extern char const* optionVersion( void ); /* From: ../compat/pathfind.c line 33 @@ -749,7 +758,7 @@ extern const char* optionVersion( void ); * @end example */ #ifndef HAVE_PATHFIND -extern char* pathfind( const char*, const char*, const char* ); +extern char* pathfind( char const*, char const*, char const* ); #endif /* HAVE_PATHFIND */ @@ -765,7 +774,7 @@ extern char* pathfind( const char*, const char*, const char* ); * This function name is mapped to option_strequate so as to not conflict * with the POSIX name space. */ -extern void strequate( const char* ); +extern void strequate( char const* ); /* From: streqvcmp.c line 143 @@ -784,7 +793,7 @@ extern void strequate( const char* ); * This function name is mapped to option_streqvcmp so as to not conflict * with the POSIX name space. */ -extern int streqvcmp( const char*, const char* ); +extern int streqvcmp( char const*, char const* ); /* From: streqvcmp.c line 180 @@ -833,7 +842,7 @@ extern void streqvmap( char, char, int ); * This function name is mapped to option_strneqvcmp so as to not conflict * with the POSIX name space. */ -extern int strneqvcmp( const char*, const char*, int ); +extern int strneqvcmp( char const*, char const*, int ); /* From: streqvcmp.c line 259 @@ -849,14 +858,14 @@ extern int strneqvcmp( const char*, const char*, int ); * This function name is mapped to option_strtransform so as to not conflict * with the POSIX name space. */ -extern void strtransform( char*, const char* ); +extern void strtransform( char*, char const* ); /* AutoOpts PRIVATE FUNCTIONS: */ tOptProc optionStackArg, optionUnstackArg, optionBooleanVal, optionNumericVal; extern char* ao_string_cook( char*, int* ); -extern unsigned int ao_string_cook_escape_char( const char*, char*, u_int ); +extern unsigned int ao_string_cook_escape_char( char const*, char*, u_int ); extern void export_options_to_guile( tOptions* ); @@ -864,15 +873,15 @@ extern void genshelloptUsage( tOptions*, int ); extern void optionBooleanVal( tOptions*, tOptDesc* ); -extern char* optionEnumerationVal( tOptions*, tOptDesc*, const char**, unsigned int ); +extern uintptr_t optionEnumerationVal( tOptions*, tOptDesc*, char const**, unsigned int ); -extern const char* optionKeywordName( tOptDesc*, unsigned int ); +extern char const* optionKeywordName( tOptDesc*, unsigned int ); -extern tOptionValue* optionLoadNested( const char*, const char*, size_t, tOptionLoadMode ); +extern tOptionValue* optionLoadNested( char const*, char const*, size_t, tOptionLoadMode ); extern void optionLoadOpt( tOptions*, tOptDesc* ); -extern ag_bool optionMakePath( char*, int, const char*, const char* ); +extern ag_bool optionMakePath( char*, int, char const*, char const* ); extern void optionNestedVal( tOptions*, tOptDesc* ); @@ -886,7 +895,7 @@ extern void optionPrintVersion( tOptions*, tOptDesc* ); extern void optionPutShell( tOptions* ); -extern void optionSetMembers( tOptions*, tOptDesc*, const char**, unsigned int ); +extern void optionSetMembers( tOptions*, tOptDesc*, char const**, unsigned int ); extern void optionStackArg( tOptions*, tOptDesc* ); @@ -896,7 +905,7 @@ extern void optionUsage( tOptions*, int ); extern void optionVersionStderr( tOptions*, tOptDesc* ); -extern void* text_mmap( const char*, int, int, tmap_info_t* ); +extern void* text_mmap( char const*, int, int, tmap_info_t* ); extern int text_munmap( tmap_info_t* ); diff --git a/sntp/libopts/autoopts/usage-txt.h b/sntp/libopts/autoopts/usage-txt.h index 93cbdeb08..849b8aa80 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 Saturday July 22, 2006 at 08:36:51 AM PDT + * It has been AutoGen-ed Friday September 22, 2006 at 06:21:57 PM PDT * From the definitions usage-txt.def * and the template file usage-txt.tpl * @@ -33,7 +33,7 @@ #define AUTOOPTS_USAGE_TXT_H_GUARD #undef cch_t -#define cch_t const char +#define cch_t char const /* * One structure to hold all the pointers to all the stringlets. diff --git a/sntp/libopts/boolean.c b/sntp/libopts/boolean.c index d09833003..ad80794a5 100644 --- a/sntp/libopts/boolean.c +++ b/sntp/libopts/boolean.c @@ -1,7 +1,7 @@ /* * $Id: boolean.c,v 4.6 2006/03/25 19:23:28 bkorb Exp $ - * Time-stamp: "2005-02-14 08:24:12 bkorb" + * Time-stamp: "2006-09-22 18:13:34 bkorb" * * Automated Options Paged Usage module. * @@ -71,9 +71,9 @@ optionBooleanVal( tOptions* pOpts, tOptDesc* pOD ) char* pz; ag_bool res = AG_TRUE; - switch (*(pOD->pzLastArg)) { + switch (*(pOD->optArg.argString)) { case '0': - val = strtol( pOD->pzLastArg, &pz, 0 ); + val = strtol( pOD->optArg.argString, &pz, 0 ); if ((val != 0) || (*pz != NUL)) break; /* FALLTHROUGH */ @@ -85,12 +85,12 @@ optionBooleanVal( tOptions* pOpts, tOptDesc* pOD ) res = AG_FALSE; break; case '#': - if (pOD->pzLastArg[1] != 'f') + if (pOD->optArg.argString[1] != 'f') break; res = AG_FALSE; } - pOD->pzLastArg = (char*)res; + pOD->optArg.argBool = res; } /* * Local Variables: diff --git a/sntp/libopts/compat/compat.h b/sntp/libopts/compat/compat.h index 8c7f19e6a..15ea0c6bc 100644 --- a/sntp/libopts/compat/compat.h +++ b/sntp/libopts/compat/compat.h @@ -2,12 +2,12 @@ /* --- fake the preprocessor into handlng portability */ /* - * Time-stamp: "2006-07-15 08:27:23 bkorb" + * Time-stamp: "2006-09-07 06:49:09 bkorb" * * Author: Gary V Vaughan * Created: Mon Jun 30 15:54:46 1997 * - * $Id: compat.h,v 4.10 2006/07/15 22:10:21 bkorb Exp $ + * $Id: compat.h,v 4.13 2006/09/16 19:58:35 bkorb Exp $ */ #ifndef COMPAT_H_GUARD #define COMPAT_H_GUARD 1 @@ -37,7 +37,7 @@ * SYSTEM HEADERS: */ #include -#if HAVE_SYS_MMAN_H +#ifdef HAVE_SYS_MMAN_H # include #endif #include @@ -237,17 +237,17 @@ #ifndef HAVE_INT32_T # if SIZEOF_INT == 4 - typedef signed int int32_t; + typedef signed int int32_t; # elif SIZEOF_LONG == 4 - typedef signed long int32_t; + typedef signed long int32_t; # endif #endif #ifndef HAVE_UINT32_T # if SIZEOF_INT == 4 - typedef unsigned int uint32_t; + typedef unsigned int uint32_t; # elif SIZEOF_LONG == 4 - typedef unsigned long uint32_t; + typedef unsigned long uint32_t; # else # error Cannot create a uint32_t type. Choke Me. diff --git a/sntp/libopts/compat/pathfind.c b/sntp/libopts/compat/pathfind.c index 010bb2b27..ab3d173ba 100644 --- a/sntp/libopts/compat/pathfind.c +++ b/sntp/libopts/compat/pathfind.c @@ -5,10 +5,10 @@ /* * Author: Gary V Vaughan * Created: Tue Jun 24 15:07:31 1997 - * Last Modified: $Date: 2006/07/15 22:10:21 $ + * Last Modified: $Date: 2006/09/23 00:48:05 $ * by: bkorb * - * $Id: pathfind.c,v 4.6 2006/07/15 22:10:21 bkorb Exp $ + * $Id: pathfind.c,v 4.8 2006/09/23 00:48:05 bkorb Exp $ */ /* Code: */ @@ -17,17 +17,17 @@ #ifndef HAVE_PATHFIND #if defined(__windows__) && !defined(__CYGWIN__) char* -pathfind( const char* path, - const char* fileName, - const char* mode ) +pathfind( char const* path, + char const* fileName, + char const* mode ) { return NULL; } #else -static char* make_absolute( const char *string, const char *dot_path ); +static char* make_absolute( char const *string, char const *dot_path ); static char* canonicalize_pathname( char *path ); -static char* extract_colon_unit( char* dir, const char *string, int *p_index ); +static char* extract_colon_unit( char* dir, char const *string, int *p_index ); /*=export_func pathfind @@ -36,9 +36,9 @@ static char* extract_colon_unit( char* dir, const char *string, int *p_index ); * * ifndef: HAVE_PATHFIND * - * arg: + const char* + path + colon separated list of search directories + - * arg: + const char* + file + the name of the file to look for + - * arg: + const char* + mode + the mode bits that must be set to match + + * arg: + char const* + path + colon separated list of search directories + + * arg: + char const* + file + the name of the file to look for + + * arg: + char const* + mode + the mode bits that must be set to match + * * ret_type: char* * ret_desc: the path to the located file @@ -85,9 +85,9 @@ static char* extract_colon_unit( char* dir, const char *string, int *p_index ); * err: returns NULL if the file is not found. =*/ char* -pathfind( const char* path, - const char* fileName, - const char* mode ) +pathfind( char const* path, + char const* fileName, + char const* mode ) { int p_index = 0; int mode_bits = 0; @@ -148,7 +148,7 @@ pathfind( const char* path, break; } } - + closedir( dirP ); if (pathName != NULL) @@ -164,11 +164,11 @@ pathfind( const char* path, * a new string, even if STRING was an absolute pathname to begin with. */ static char* -make_absolute( const char *string, const char *dot_path ) +make_absolute( char const *string, char const *dot_path ) { char *result; int result_len; - + if (!dot_path || *string == '/') { result = strdup( string ); } else { @@ -179,7 +179,7 @@ make_absolute( const char *string, const char *dot_path ) if (result[result_len - 1] != '/') { result[result_len++] = '/'; result[result_len] = '\0'; - } + } } else { result = malloc( 3 + strlen( string ) ); result[0] = '.'; result[1] = '/'; result[2] = '\0'; @@ -288,7 +288,7 @@ canonicalize_pathname( char *path ) * more. Advance (P_INDEX) to the character after the colon. */ static char* -extract_colon_unit( char* pzDir, const char *string, int *p_index ) +extract_colon_unit( char* pzDir, char const *string, int *p_index ) { char* pzDest = pzDir; int ix = *p_index; @@ -300,7 +300,7 @@ extract_colon_unit( char* pzDir, const char *string, int *p_index ) return NULL; { - const char* pzSrc = string + ix; + char const* pzSrc = string + ix; while (*pzSrc == ':') pzSrc++; diff --git a/sntp/libopts/compat/snprintf.c b/sntp/libopts/compat/snprintf.c index 78bda479b..ae81f272d 100644 --- a/sntp/libopts/compat/snprintf.c +++ b/sntp/libopts/compat/snprintf.c @@ -7,7 +7,7 @@ # include # ifndef VA_START # define VA_START(a, f) va_start(a, f) -# define VA_END(a) va_end(a) +# define VA_END(a) va_end(a) # endif /* VA_START */ # define SNV_USING_STDARG_H @@ -15,7 +15,7 @@ # include # ifndef VA_START # define VA_START(a, f) va_start(a) -# define VA_END(a) va_end(a) +# define VA_END(a) va_end(a) # endif /* VA_START */ # undef SNV_USING_STDARG_H @@ -24,7 +24,7 @@ #endif static int -snprintf(char *str, size_t n, const char *fmt, ...) +snprintf(char *str, size_t n, char const *fmt, ...) { va_list ap; int rval; @@ -50,7 +50,7 @@ snprintf(char *str, size_t n, const char *fmt, ...) } static int -vsnprintf( char *str, size_t n, const char *fmt, va_list ap ) +vsnprintf( char *str, size_t n, char const *fmt, va_list ap ) { #ifdef VSPRINTF_CHARSTAR return (strlen(vsprintf(str, fmt, ap))); diff --git a/sntp/libopts/compat/strchr.c b/sntp/libopts/compat/strchr.c index fd6507f4f..ca8a517a8 100644 --- a/sntp/libopts/compat/strchr.c +++ b/sntp/libopts/compat/strchr.c @@ -2,9 +2,9 @@ SYNOPSIS #include - char *strchr(const char *s, int c); + char *strchr(char const *s, int c); - char *strrchr(const char *s, int c); + char *strrchr(char const *s, int c); DESCRIPTION The strchr() function returns a pointer to the first occurrence of the @@ -25,7 +25,7 @@ */ char* -strchr( const char *s, int c) +strchr( char const *s, int c) { do { if ((unsigned)*s == (unsigned)c) @@ -37,9 +37,9 @@ strchr( const char *s, int c) } char* -strrchr( const char *s, int c) +strrchr( char const *s, int c) { - const char *e = s + strlen(s); + char const *e = s + strlen(s); for (;;) { if (--e < s) diff --git a/sntp/libopts/compat/strdup.c b/sntp/libopts/compat/strdup.c index 34dbcc57f..e2933a8af 100644 --- a/sntp/libopts/compat/strdup.c +++ b/sntp/libopts/compat/strdup.c @@ -3,17 +3,17 @@ */ static char * -strdup( const char *s ) +strdup( char const *s ) { char *cp; if (s == NULL) - return NULL; + return NULL; cp = (char *) AGALOC((unsigned) (strlen(s)+1), "strdup"); if (cp != NULL) - (void) strcpy(cp, s); + (void) strcpy(cp, s); return cp; } diff --git a/sntp/libopts/configfile.c b/sntp/libopts/configfile.c index e8cd371ac..64deccdd3 100644 --- a/sntp/libopts/configfile.c +++ b/sntp/libopts/configfile.c @@ -1,6 +1,6 @@ /* - * $Id: configfile.c,v 4.23 2006/07/01 21:57:23 bkorb Exp $ - * Time-stamp: "2006-07-01 12:46:31 bkorb" + * $Id: configfile.c,v 4.26 2006/09/23 00:12:48 bkorb Exp $ + * Time-stamp: "2006-09-22 18:01:50 bkorb" * * configuration/rc/ini file handling. */ @@ -53,7 +53,7 @@ static void filePreset( tOptions* pOpts, - const char* pzFileName, + char const* pzFileName, int direction ); static char* @@ -113,7 +113,7 @@ skipUnknown( char* pzText ); /*=export_func configFileLoad * * what: parse a configuration file - * arg: + const char* + pzFile + the file to load + + * arg: + char const* + pzFile + the file to load + * * ret_type: const tOptionValue* * ret_desc: An allocated, compound value structure @@ -141,7 +141,7 @@ skipUnknown( char* pzText ); * @end itemize =*/ const tOptionValue* -configFileLoad( const char* pzFile ) +configFileLoad( char const* pzFile ) { tmap_info_t cfgfile; tOptionValue* pRes = NULL; @@ -167,8 +167,8 @@ configFileLoad( const char* pzFile ) * * what: find a hierarcicaly valued option instance * arg: + const tOptDesc* + pOptDesc + an option with a nested arg type + - * arg: + const char* + name + name of value to find + - * arg: + const char* + value + the matching value + + * arg: + char const* + name + name of value to find + + * arg: + char const* + value + the matching value + * * ret_type: const tOptionValue* * ret_desc: a compound value structure @@ -189,7 +189,7 @@ configFileLoad( const char* pzFile ) =*/ const tOptionValue* optionFindValue( const tOptDesc* pOptDesc, - const char* pzName, const char* pzVal ) + char const* pzName, char const* pzVal ) { const tOptionValue* pRes = NULL; @@ -205,8 +205,7 @@ optionFindValue( const tOptDesc* pOptDesc, else do { tArgList* pAL = pOptDesc->optCookie; int ct = pAL->useCt; - const tOptionValue** ppOV = - (const tOptionValue**)(void*)&(pAL->apzArgs); + tCC** ppOV = pAL->apzArgs; if (ct == 0) { errno = ENOENT; @@ -214,12 +213,12 @@ optionFindValue( const tOptDesc* pOptDesc, } if (pzName == NULL) { - pRes = *ppOV; + pRes = (tOptionValue*)*ppOV; break; } while (--ct >= 0) { - const tOptionValue* pOV = *(ppOV++); + const tOptionValue* pOV = (tOptionValue*)*(ppOV++); const tOptionValue* pRV = optionGetValue( pOV, pzName ); if (pRV == NULL) @@ -243,8 +242,8 @@ optionFindValue( const tOptDesc* pOptDesc, * what: find a hierarcicaly valued option instance * arg: + const tOptDesc* + pOptDesc + an option with a nested arg type + * arg: + const tOptionValue* + pPrevVal + the last entry + - * arg: + const char* + name + name of value to find + - * arg: + const char* + value + the matching value + + * arg: + char const* + name + name of value to find + + * arg: + char const* + value + the matching value + * * ret_type: const tOptionValue* * ret_desc: a compound value structure @@ -266,7 +265,7 @@ optionFindValue( const tOptDesc* pOptDesc, =*/ const tOptionValue* optionFindNextValue( const tOptDesc* pOptDesc, const tOptionValue* pPrevVal, - const char* pzName, const char* pzVal ) + char const* pzName, char const* pzVal ) { int foundOldVal = 0; tOptionValue* pRes = NULL; @@ -283,7 +282,7 @@ optionFindNextValue( const tOptDesc* pOptDesc, const tOptionValue* pPrevVal, else do { tArgList* pAL = pOptDesc->optCookie; int ct = pAL->useCt; - tOptionValue** ppOV = (tOptionValue**)(void*)&(pAL->apzArgs); + tCC** ppOV = pAL->apzArgs; if (ct == 0) { errno = ENOENT; @@ -291,7 +290,7 @@ optionFindNextValue( const tOptDesc* pOptDesc, const tOptionValue* pPrevVal, } while (--ct >= 0) { - tOptionValue* pOV = *(ppOV++); + tOptionValue* pOV = (tOptionValue*)*(ppOV++); if (foundOldVal) { pRes = pOV; break; @@ -311,7 +310,7 @@ optionFindNextValue( const tOptDesc* pOptDesc, const tOptionValue* pPrevVal, * * what: get a specific value from a hierarcical list * arg: + const tOptionValue* + pOptValue + a hierarchcal value + - * arg: + const char* + valueName + name of value to get + + * arg: + char const* + valueName + name of value to get + * * ret_type: const tOptionValue* * ret_desc: a compound value structure @@ -333,7 +332,7 @@ optionFindNextValue( const tOptDesc* pOptDesc, const tOptionValue* pPrevVal, * @end itemize =*/ const tOptionValue* -optionGetValue( const tOptionValue* pOld, const char* pzValName ) +optionGetValue( const tOptionValue* pOld, char const* pzValName ) { tArgList* pAL; tOptionValue* pRes = NULL; @@ -346,14 +345,14 @@ optionGetValue( const tOptionValue* pOld, const char* pzValName ) if (pAL->useCt > 0) { int ct = pAL->useCt; - tOptionValue** papOV = (tOptionValue**)(pAL->apzArgs); + tCC** papOV = pAL->apzArgs; if (pzValName == NULL) { - pRes = *papOV; + pRes = (tOptionValue*)*papOV; } else do { - tOptionValue* pOV = *(papOV++); + tOptionValue* pOV = (tOptionValue*)*(papOV++); if (strcmp( pOV->pzName, pzValName ) == 0) { pRes = pOV; break; @@ -407,17 +406,17 @@ optionNextValue( const tOptionValue* pOVList, const tOptionValue* pOldOV ) pAL = pOVList->v.nestVal; { int ct = pAL->useCt; - tOptionValue** papNV = (tOptionValue**)(pAL->apzArgs); + tCC** papNV = pAL->apzArgs; while (ct-- > 0) { - tOptionValue* pNV = *(papNV++); + tOptionValue* pNV = (tOptionValue*)*(papNV++); if (pNV == pOldOV) { if (ct == 0) { err = ENOENT; } else { err = 0; - pRes = *papNV; + pRes = (tOptionValue*)*papNV; } break; } @@ -436,7 +435,7 @@ optionNextValue( const tOptionValue* pOVList, const tOptionValue* pOldOV ) static void filePreset( tOptions* pOpts, - const char* pzFileName, + char const* pzFileName, int direction ) { tmap_info_t cfgfile; @@ -542,6 +541,9 @@ handleConfig( char* pzName = pzText++; char* pzEnd = strchr( pzText, '\n' ); + if (pzEnd == NULL) + return pzText + strlen(pzText); + while (ISNAMECHAR( *pzText )) pzText++; while (isspace( *pzText )) pzText++; if (pzText > pzEnd) { @@ -871,7 +873,7 @@ internalFileLoad( tOptions* pOpts ) * what: Load the locatable config files, in order * * arg: + tOptions* + pOpts + program options descriptor + - * arg: + const char* + pzProg + program name + + * arg: + char const* + pzProg + program name + * * ret_type: int * ret_desc: 0 -> SUCCESS, -1 -> FAILURE @@ -900,7 +902,7 @@ internalFileLoad( tOptions* pOpts ) * always be returned. =*/ int -optionFileLoad( tOptions* pOpts, const char* pzProgram ) +optionFileLoad( tOptions* pOpts, char const* pzProgram ) { if (! SUCCESSFUL( validateOptionsStruct( pOpts, pzProgram ))) return -1; @@ -919,7 +921,7 @@ optionFileLoad( tOptions* pOpts, const char* pzProgram ) * arg: + tOptDesc* + pOptDesc + the descriptor for this arg + * * doc: - * Processes the options found in the file named with pOptDesc->pzLastArg. + * Processes the options found in the file named with pOptDesc->optArg.argString. =*/ void optionLoadOpt( tOptions* pOpts, tOptDesc* pOptDesc ) @@ -933,12 +935,12 @@ optionLoadOpt( tOptions* pOpts, tOptDesc* pOptDesc ) */ if (! DISABLED_OPT( pOptDesc )) { struct stat sb; - if (stat( pOptDesc->pzLastArg, &sb ) != 0) { + if (stat( pOptDesc->optArg.argString, &sb ) != 0) { if ((pOpts->fOptSet & OPTPROC_ERRSTOP) == 0) return; fprintf( stderr, zFSErrOptLoad, errno, strerror( errno ), - pOptDesc->pzLastArg ); + pOptDesc->optArg.argString ); (*pOpts->pUsageProc)( pOpts, EXIT_FAILURE ); /* NOT REACHED */ } @@ -947,12 +949,12 @@ optionLoadOpt( tOptions* pOpts, tOptDesc* pOptDesc ) if ((pOpts->fOptSet & OPTPROC_ERRSTOP) == 0) return; - fprintf( stderr, zNotFile, pOptDesc->pzLastArg ); + fprintf( stderr, zNotFile, pOptDesc->optArg.argString ); (*pOpts->pUsageProc)( pOpts, EXIT_FAILURE ); /* NOT REACHED */ } - filePreset(pOpts, pOptDesc->pzLastArg, DIRECTION_CALLED); + filePreset(pOpts, pOptDesc->optArg.argString, DIRECTION_CALLED); } } @@ -1207,7 +1209,7 @@ skipUnknown( char* pzText ) * already been called.) */ LOCAL tSuccess -validateOptionsStruct( tOptions* pOpts, const char* pzProgram ) +validateOptionsStruct( tOptions* pOpts, char const* pzProgram ) { if (pOpts == NULL) { fputs( zAO_Bad, stderr ); @@ -1249,7 +1251,7 @@ validateOptionsStruct( tOptions* pOpts, const char* pzProgram ) * and the set of equivalent characters. */ if (pOpts->pzProgName == NULL) { - const char* pz = strrchr( pzProgram, DIRCH ); + char const* pz = strrchr( pzProgram, DIRCH ); if (pz == NULL) pOpts->pzProgName = pzProgram; diff --git a/sntp/libopts/cook.c b/sntp/libopts/cook.c index aecd4ec48..00503959a 100644 --- a/sntp/libopts/cook.c +++ b/sntp/libopts/cook.c @@ -1,6 +1,6 @@ /* - * $Id: cook.c,v 4.6 2006/06/24 23:34:51 bkorb Exp $ + * $Id: cook.c,v 4.7 2006/09/23 00:12:48 bkorb Exp $ * Time-stamp: "2006-06-24 11:29:58 bkorb" * * This file contains the routines that deal with processing quoted strings @@ -58,7 +58,7 @@ * private: * * what: escape-process a string fragment - * arg: + const char* + pzScan + points to character after the escape + + * arg: + char const* + pzScan + points to character after the escape + * arg: + char* + pRes + Where to put the result byte + * arg: + u_int + nl_ch + replacement char if scanned char is \n + * @@ -81,7 +81,7 @@ * err: @code{NULL} is returned if the string(s) is/are mal-formed. =*/ unsigned int -ao_string_cook_escape_char( const char* pzIn, char* pRes, u_int nl ) +ao_string_cook_escape_char( char const* pzIn, char* pRes, u_int nl ) { unsigned int res = 1; diff --git a/sntp/libopts/enumeration.c b/sntp/libopts/enumeration.c index 0dbe56614..29f624fa2 100644 --- a/sntp/libopts/enumeration.c +++ b/sntp/libopts/enumeration.c @@ -1,7 +1,7 @@ /* - * $Id: enumeration.c,v 4.11 2006/06/24 23:34:51 bkorb Exp $ - * Time-stamp: "2006-06-24 10:46:02 bkorb" + * $Id: enumeration.c,v 4.12 2006/09/23 00:12:48 bkorb Exp $ + * Time-stamp: "2006-09-22 18:00:53 bkorb" * * Automated Options Paged Usage module. * @@ -84,7 +84,7 @@ enumError( if (pOpts != NULL) fprintf( option_usage_fp, pz_enum_err_fmt, - pOpts->pzProgName, pOD->pzLastArg ); + pOpts->pzProgName, pOD->optArg.argString ); fprintf( option_usage_fp, zValidKeys, pOD->pz_Name ); @@ -223,21 +223,21 @@ findName( * arg: tOptDesc*, pOD, enumeration option description * arg: unsigned int, enum_val, the enumeration value to map * - * ret_type: const char* + * ret_type: char const* * ret_desc: the enumeration name from const memory * * doc: This converts an enumeration value into the matching string. =*/ -const char* +char const* optionKeywordName( tOptDesc* pOD, unsigned int enum_val ) { tOptDesc od; - od.pzLastArg = (const char*)(uintptr_t)enum_val; + od.optArg.argIntptr = enum_val; (*(pOD->pOptProc))( (void*)(2UL), &od ); - return od.pzLastArg; + return od.optArg.argString; } @@ -247,19 +247,19 @@ optionKeywordName( * * arg: tOptions*, pOpts, the program options descriptor * arg: tOptDesc*, pOD, enumeration option description - * arg: const char**, paz_names, list of enumeration names + * arg: char const**, paz_names, list of enumeration names * arg: unsigned int, name_ct, number of names in list * - * ret_type: char* - * ret_desc: the enumeration value cast as a char* + * ret_type: uintptr_t + * ret_desc: the enumeration value * - * doc: This converts the pzLastArg string from the option description + * doc: This converts the optArg.argString string from the option description * into the index corresponding to an entry in the name list. * This will match the generated enumeration value. * Full matches are always accepted. Partial matches are accepted * if there is only one partial match. =*/ -char* +uintptr_t optionEnumerationVal( tOptions* pOpts, tOptDesc* pOD, @@ -276,11 +276,11 @@ optionEnumerationVal( * print the list of enumeration names. */ enumError( pOpts, pOD, paz_names, (int)name_ct ); - return (char*)0UL; + return 0UL; case 1UL: { - unsigned int ix = (uintptr_t)(pOD->pzLastArg); + unsigned int ix = pOD->optArg.argIntptr; /* * print the name string. */ @@ -288,25 +288,25 @@ optionEnumerationVal( printf( "INVALID-%d", ix ); else fputs( paz_names[ ix ], stdout ); - return (char*)0UL; + return 0UL; } case 2UL: { tSCC zInval[] = "*INVALID*"; - unsigned int ix = (uintptr_t)(pOD->pzLastArg); + unsigned int ix = pOD->optArg.argIntptr; /* * Replace the enumeration value with the name string. */ if (ix >= name_ct) - return (char*)zInval; + return (uintptr_t)zInval; - return (char*)paz_names[ ix ]; + return (uintptr_t)paz_names[ ix ]; } default: break; } - return (char*)findName( pOD->pzLastArg, pOpts, pOD, paz_names, name_ct ); + return findName( pOD->optArg.argString, pOpts, pOD, paz_names, name_ct ); } @@ -316,10 +316,10 @@ optionEnumerationVal( * * arg: tOptions*, pOpts, the program options descriptor * arg: tOptDesc*, pOD, enumeration option description - * arg: const char**, paz_names, list of enumeration names + * arg: char const**, paz_names, list of enumeration names * arg: unsigned int, name_ct, number of names in list * - * doc: This converts the pzLastArg string from the option description + * doc: This converts the optArg.argString string from the option description * into the index corresponding to an entry in the name list. * This will match the generated enumeration value. * Full matches are always accepted. Partial matches are accepted @@ -382,7 +382,7 @@ optionSetMembers( bits >>= 1; } - pOD->pzLastArg = pz = malloc( len ); + pOD->optArg.argString = pz = malloc( len ); /* * Start by clearing all the bits. We want to turn off any defaults * because we will be restoring to current state, not adding to @@ -409,7 +409,7 @@ optionSetMembers( } { - tCC* pzArg = pOD->pzLastArg; + tCC* pzArg = pOD->optArg.argString; uintptr_t res; if ((pzArg == NULL) || (*pzArg == NUL)) { pOD->optCookie = (void*)0; diff --git a/sntp/libopts/environment.c b/sntp/libopts/environment.c index caaa712ba..aacb253b0 100644 --- a/sntp/libopts/environment.c +++ b/sntp/libopts/environment.c @@ -1,6 +1,6 @@ /* - * $Id: environment.c,v 4.10 2006/03/25 19:23:28 bkorb Exp $ + * $Id: environment.c,v 4.11 2006/09/23 00:12:48 bkorb Exp $ * Time-stamp: "2005-10-29 13:23:59 bkorb" * * This file contains all of the routines that must be linked into @@ -65,7 +65,7 @@ LOCAL void doPrognameEnv( tOptions* pOpts, teEnvPresetType type ) { - const char* pczOptStr = getenv( pOpts->pzPROGNAME ); + char const* pczOptStr = getenv( pOpts->pzPROGNAME ); token_list_t* pTL; int sv_argc; tAoUI sv_flag; diff --git a/sntp/libopts/genshell.c b/sntp/libopts/genshell.c index d32d55c88..f7549c881 100644 --- a/sntp/libopts/genshell.c +++ b/sntp/libopts/genshell.c @@ -2,7 +2,7 @@ * * DO NOT EDIT THIS FILE (genshell.c) * - * It has been AutoGen-ed Saturday July 22, 2006 at 08:36:53 AM PDT + * It has been AutoGen-ed Friday September 22, 2006 at 06:22:00 PM PDT * From the definitions genshell.def * and the template file options */ @@ -38,6 +38,7 @@ */ +#include #define OPTION_CODE_COMPILE 1 #include "genshell.h" @@ -80,7 +81,7 @@ tSCC zScriptText[] = tSCC zScript_NAME[] = "SCRIPT"; tSCC zScript_Name[] = "script"; #define SCRIPT_FLAGS (OPTST_DISABLED \ - | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) + | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) /* * Shell option description: @@ -92,7 +93,7 @@ tSCC zNotShell_Name[] = "no-shell"; tSCC zNotShell_Pfx[] = "no"; #define zShell_Name (zNotShell_Name + 3) #define SHELL_FLAGS (OPTST_INITENABLED \ - | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) + | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) /* * Help/More_Help/Version option descriptions: @@ -123,7 +124,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ SCRIPT_FLAGS, 0, - /* last opt argumnt */ NULL, + /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, /* option proc */ NULL, @@ -135,7 +136,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ SHELL_FLAGS, 0, - /* last opt argumnt */ NULL, + /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, /* option proc */ NULL, @@ -148,7 +149,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* min, max, act ct */ 0, 1, 0, /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | OPTST_ARG_OPTIONAL, 0, - /* last opt argumnt */ NULL, + /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, /* option proc */ optionPrintVersion, @@ -160,7 +161,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ OPTST_IMM, 0, - /* last opt argumnt */ NULL, + /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, /* option proc */ doUsageOpt, @@ -172,7 +173,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ OPTST_IMM, 0, - /* last opt argumnt */ NULL, + /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, /* option proc */ optionPagedUsage, @@ -260,11 +261,11 @@ doUsageOpt( #include #include -static char* AO_gettext( const char* pz ); +static char* AO_gettext( char const* pz ); static void coerce_it(void** s); static char* -AO_gettext( const char* pz ) +AO_gettext( char const* pz ) { char* pzRes; if (pz == NULL) diff --git a/sntp/libopts/genshell.h b/sntp/libopts/genshell.h index 657e49ea3..bbb8ec3c5 100644 --- a/sntp/libopts/genshell.h +++ b/sntp/libopts/genshell.h @@ -2,7 +2,7 @@ * * DO NOT EDIT THIS FILE (genshell.h) * - * It has been AutoGen-ed Saturday July 22, 2006 at 08:36:53 AM PDT + * It has been AutoGen-ed Friday September 22, 2006 at 06:21:59 PM PDT * From the definitions genshell.def * and the template file options */ @@ -76,13 +76,13 @@ typedef enum { #define GENSHELLOPT_FULL_VERSION "genshellopt - Generate Shell Option Processing Script - Ver. 1" /* - * Interface defines for all options. Replace "n" with - * the UPPER_CASED option name (as in the teOptIndex - * enumeration above). e.g. HAVE_OPT( SCRIPT ) + * Interface defines for all options. Replace "n" with the UPPER_CASED + * option name (as in the teOptIndex enumeration above). + * e.g. HAVE_OPT( SCRIPT ) */ -#define DESC(n) genshelloptOptions.pOptDesc[INDEX_OPT_ ## n] +#define DESC(n) genshelloptOptions.pOptDesc[INDEX_OPT_ ## n] #define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n))) -#define OPT_ARG(n) (DESC(n).pzLastArg) +#define OPT_ARG(n) (DESC(n).optArg.argString) #define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK) #define COUNT_OPT(n) (DESC(n).optOccCt) #define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n))) @@ -115,7 +115,7 @@ typedef enum { genshelloptOptions.pzCurOpt = NULL ) #define START_OPT RESTART_OPT(1) #define USAGE(c) (*genshelloptOptions.pUsageProc)( &genshelloptOptions, c ) -/* extracted from opthead near line 288 */ +/* extracted from opthead near line 312 */ /* * * * * * * @@ -130,7 +130,7 @@ extern tOptions genshelloptOptions; #ifndef _ # if ENABLE_NLS # include - static inline char* aoGetsText( const char* pz ) { + static inline char* aoGetsText( char const* pz ) { if (pz == NULL) return NULL; return (char*)gettext( pz ); } diff --git a/sntp/libopts/load.c b/sntp/libopts/load.c index 19edbcd34..18ea27f4d 100644 --- a/sntp/libopts/load.c +++ b/sntp/libopts/load.c @@ -1,6 +1,6 @@ /* - * $Id: load.c,v 4.23 2006/07/01 21:57:23 bkorb Exp $ + * $Id: load.c,v 4.24 2006/09/23 00:12:48 bkorb Exp $ * Time-stamp: "2006-07-01 12:43:03 bkorb" * * This file contains the routines that deal with processing text strings @@ -77,8 +77,8 @@ assembleArgValue( char* pzTxt, tOptionLoadMode mode ); * what: translate and construct a path * arg: + char* + pzBuf + The result buffer + * arg: + int + bufSize + The size of this buffer + - * arg: + const char* + pzName + The input name + - * arg: + const char* + pzProgPath + The full path of the current program + + * arg: + char const* + pzName + The input name + + * arg: + char const* + pzProgPath + The full path of the current program + * * ret-type: ag_bool * ret-desc: AG_TRUE if the name was handled, otherwise AG_FALSE. @@ -479,7 +479,7 @@ loadOptionLine( * what: process a string for an option name and value * * arg: tOptions*, pOpts, program options descriptor - * arg: const char*, pzLine, NUL-terminated text + * arg: char const*, pzLine, NUL-terminated text * * doc: * diff --git a/sntp/libopts/m4/libopts.m4 b/sntp/libopts/m4/libopts.m4 index a044564ed..3c9c214b7 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 Saturday August 12, 2006 at 10:36:56 AM PDT +dnl It has been AutoGen-ed Friday September 22, 2006 at 06:22:01 PM PDT dnl From the definitions libopts.def dnl and the template file conftest.tpl dnl @@ -181,7 +181,7 @@ AC_DEFUN([LIBOPTS_WITHLIB_REGEX],[ @%:@include @%:@include REGEX_HEADER static regex_t re; -void comp_re( const char* pzPat ) { +void comp_re( char const* pzPat ) { int res = regcomp( &re, pzPat, REG_EXTENDED|REG_ICASE|REG_NEWLINE ); if (res == 0) return; exit( res ); } @@ -295,7 +295,7 @@ AC_DEFUN([LIBOPTS_RUN_STRFTIME],[ @%:@include char t_buf@<:@ 64 @:>@; int main() { - static const char z@<:@@:>@ = "Thursday Aug 28 240"; + static char const z@<:@@:>@ = "Thursday Aug 28 240"; struct tm tm; tm.tm_sec = 36; /* seconds after the minute @<:@0, 61@:>@ */ tm.tm_min = 44; /* minutes after the hour @<:@0, 59@:>@ */ @@ -422,6 +422,11 @@ AC_DEFUN([LIBOPTS_CHECK],[ NEED_LIBOPTS_DIR=true fi]) + AC_ARG_ENABLE([libopts-install], + AC_HELP_STRING([--disable-libopts-install], + [Do not install libopts with client installation])) + AM_CONDITIONAL([INSTALL_LIBOPTS],[test "X${enable_libopts_install}" != Xno]) + [if test -z "${NEED_LIBOPTS_DIR}" ; then] AC_MSG_CHECKING([whether autoopts-config can be found]) AC_ARG_WITH([autoopts-config], diff --git a/sntp/libopts/makeshell.c b/sntp/libopts/makeshell.c index dbb4ff590..36d3201d6 100644 --- a/sntp/libopts/makeshell.c +++ b/sntp/libopts/makeshell.c @@ -1,7 +1,7 @@ /* - * $Id: makeshell.c,v 4.14 2006/07/27 02:51:47 bkorb Exp $ - * Time-stamp: "2006-07-24 21:30:51 bkorb" + * $Id: makeshell.c,v 4.15 2006/09/23 00:12:48 bkorb Exp $ + * Time-stamp: "2006-09-22 18:19:24 bkorb" * * This module will interpret the options set in the tOptions * structure and create a Bourne shell script capable of parsing them. @@ -390,7 +390,7 @@ static void emitLong( tOptions* pOpts ); static void -openOutput( const char* pzFile ); +openOutput( char const* pzFile ); /* = = = END-STATIC-FORWARD = = = */ /*=export_func optionParseShell @@ -503,7 +503,7 @@ textToVariable( tOptions* pOpts, teTextTo whichVar, tOptDesc* pOD ) TEXTTO_TABLE # undef _TT_ # define _TT_(n) z ## n , - static const char* apzTTNames[] = { TEXTTO_TABLE }; + static char const* apzTTNames[] = { TEXTTO_TABLE }; # undef _TT_ #if defined(__windows__) && !defined(__CYGWIN__) @@ -545,7 +545,7 @@ textToVariable( tOptions* pOpts, teTextTo whichVar, tOptDesc* pOD ) exit( EXIT_FAILURE ); case TT_VERSION: - pOD->pzLastArg = "c"; + pOD->optArg.argString = "c"; optionPrintVersion( pOpts, pOD ); /* NOTREACHED */ @@ -668,8 +668,8 @@ emitSetup( tOptions* pOpts ) { tOptDesc* pOptDesc = pOpts->pOptDesc; int optionCt = pOpts->presetOptCt; - const char* pzFmt; - const char* pzDefault; + char const* pzFmt; + char const* pzDefault; for (;optionCt > 0; pOptDesc++, --optionCt) { char zVal[16]; @@ -692,7 +692,7 @@ emitSetup( tOptions* pOpts ) switch (OPTST_GET_ARGTYPE(pOptDesc->fOptState)) { case OPARG_TYPE_ENUMERATION: (*(pOptDesc->pOptProc))( (tOptions*)2UL, pOptDesc ); - pzDefault = pOptDesc->pzLastArg; + pzDefault = pOptDesc->optArg.argString; break; /* @@ -700,18 +700,19 @@ emitSetup( tOptions* pOpts ) */ case OPARG_TYPE_NUMERIC: case OPARG_TYPE_MEMBERSHIP: - snprintf( zVal, sizeof( zVal ), "%ld", (tAoUL)pOptDesc->pzLastArg ); + snprintf( zVal, sizeof( zVal ), "%d", + (int)pOptDesc->optArg.argIntptr ); pzDefault = zVal; break; default: - if (pOptDesc->pzLastArg == NULL) { + if (pOptDesc->optArg.argString == NULL) { if (pzFmt == zSingleDef) pzFmt = zSingleNoDef; pzDefault = NULL; } else - pzDefault = pOptDesc->pzLastArg; + pzDefault = pOptDesc->optArg.argString; } printf( pzFmt, pOpts->pzPROGNAME, pOptDesc->pz_NAME, pzDefault ); @@ -928,7 +929,7 @@ emitLong( tOptions* pOpts ) static void -openOutput( const char* pzFile ) +openOutput( char const* pzFile ) { FILE* fp; char* pzData = NULL; diff --git a/sntp/libopts/nested.c b/sntp/libopts/nested.c index 00b88691a..f4e665068 100644 --- a/sntp/libopts/nested.c +++ b/sntp/libopts/nested.c @@ -1,7 +1,7 @@ /* - * $Id: nested.c,v 4.9 2006/03/25 19:23:28 bkorb Exp $ - * Time-stamp: "2005-07-27 10:10:28 bkorb" + * $Id: nested.c,v 4.11 2006/09/23 00:12:48 bkorb Exp $ + * Time-stamp: "2006-09-22 18:14:12 bkorb" * * Automated Options Nested Values module. */ @@ -53,30 +53,30 @@ static void removeBackslashes( char* pzSrc ); -static const char* -scanQuotedString( const char* pzTxt ); +static char const* +scanQuotedString( char const* pzTxt ); static tOptionValue* -addStringValue( void** pp, const char* pzName, size_t nameLen, - const char* pzValue, size_t dataLen ); +addStringValue( void** pp, char const* pzName, size_t nameLen, + char const* pzValue, size_t dataLen ); static tOptionValue* -addBoolValue( void** pp, const char* pzName, size_t nameLen, - const char* pzValue, size_t dataLen ); +addBoolValue( void** pp, char const* pzName, size_t nameLen, + char const* pzValue, size_t dataLen ); static tOptionValue* -addNumberValue( void** pp, const char* pzName, size_t nameLen, - const char* pzValue, size_t dataLen ); +addNumberValue( void** pp, char const* pzName, size_t nameLen, + char const* pzValue, size_t dataLen ); static tOptionValue* -addNestedValue( void** pp, const char* pzName, size_t nameLen, +addNestedValue( void** pp, char const* pzName, size_t nameLen, char* pzValue, size_t dataLen, tOptionLoadMode mode ); -static const char* -scanNameEntry( const char* pzName, tOptionValue* pRes, tOptionLoadMode mode ); +static char const* +scanNameEntry( char const* pzName, tOptionValue* pRes, tOptionLoadMode mode ); -static const char* -scanXmlEntry( const char* pzName, tOptionValue* pRes, tOptionLoadMode mode ); +static char const* +scanXmlEntry( char const* pzName, tOptionValue* pRes, tOptionLoadMode mode ); static void unloadNestedArglist( tArgList* pAL ); @@ -115,8 +115,8 @@ removeBackslashes( char* pzSrc ) * * Find the end of a quoted string, skipping escaped quote characters. */ -static const char* -scanQuotedString( const char* pzTxt ) +static char const* +scanQuotedString( char const* pzTxt ) { char q = *(pzTxt++); /* remember the type of quote */ @@ -154,8 +154,8 @@ scanQuotedString( const char* pzTxt ) * Associate a name with either a string or no value. */ static tOptionValue* -addStringValue( void** pp, const char* pzName, size_t nameLen, - const char* pzValue, size_t dataLen ) +addStringValue( void** pp, char const* pzName, size_t nameLen, + char const* pzValue, size_t dataLen ) { tOptionValue* pNV; size_t sz = nameLen + dataLen + sizeof(*pNV); @@ -188,8 +188,8 @@ addStringValue( void** pp, const char* pzName, size_t nameLen, * Associate a name with either a string or no value. */ static tOptionValue* -addBoolValue( void** pp, const char* pzName, size_t nameLen, - const char* pzValue, size_t dataLen ) +addBoolValue( void** pp, char const* pzName, size_t nameLen, + char const* pzValue, size_t dataLen ) { tOptionValue* pNV; size_t sz = nameLen + sizeof(*pNV) + 1; @@ -228,8 +228,8 @@ addBoolValue( void** pp, const char* pzName, size_t nameLen, * Associate a name with either a string or no value. */ static tOptionValue* -addNumberValue( void** pp, const char* pzName, size_t nameLen, - const char* pzValue, size_t dataLen ) +addNumberValue( void** pp, char const* pzName, size_t nameLen, + char const* pzValue, size_t dataLen ) { tOptionValue* pNV; size_t sz = nameLen + sizeof(*pNV) + 1; @@ -259,7 +259,7 @@ addNumberValue( void** pp, const char* pzName, size_t nameLen, * Associate a name with either a string or no value. */ static tOptionValue* -addNestedValue( void** pp, const char* pzName, size_t nameLen, +addNestedValue( void** pp, char const* pzName, size_t nameLen, char* pzValue, size_t dataLen, tOptionLoadMode mode ) { tOptionValue* pNV; @@ -291,12 +291,12 @@ addNestedValue( void** pp, const char* pzName, size_t nameLen, * We have an entry that starts with a name. Find the end of it, cook it * (if called for) and create the name/value association. */ -static const char* -scanNameEntry( const char* pzName, tOptionValue* pRes, tOptionLoadMode mode ) +static char const* +scanNameEntry( char const* pzName, tOptionValue* pRes, tOptionLoadMode mode ) { tOptionValue* pNV; - const char* pzScan = pzName+1; - const char* pzVal; + char const* pzScan = pzName+1; + char const* pzVal; size_t nameLen = 1; size_t dataLen = 0; @@ -381,12 +381,12 @@ scanNameEntry( const char* pzName, tOptionValue* pRes, tOptionLoadMode mode ) * directive. If it is something else, then whatever it is we are looking * at is bogus. Returning NULL stops processing. */ -static const char* -scanXmlEntry( const char* pzName, tOptionValue* pRes, tOptionLoadMode mode ) +static char const* +scanXmlEntry( char const* pzName, tOptionValue* pRes, tOptionLoadMode mode ) { size_t nameLen = 1, valLen = 0; - const char* pzScan = ++pzName; - const char* pzVal; + char const* pzScan = ++pzName; + char const* pzVal; tOptionValue valu; tOptionValue* pNewVal; @@ -445,7 +445,7 @@ scanXmlEntry( const char* pzName, tOptionValue* pRes, tOptionLoadMode mode ) char z[68]; char* pzD = z; int ct = nameLen; - const char* pzS = pzName; + char const* pzS = pzName; *(pzD++) = '<'; *(pzD++) = '/'; @@ -511,10 +511,10 @@ static void unloadNestedArglist( tArgList* pAL ) { int ct = pAL->useCt; - tOptionValue** ppNV = (tOptionValue**)(pAL->apzArgs); + tCC** ppNV = pAL->apzArgs; while (ct-- > 0) { - tOptionValue* pNV = *(ppNV++); + tOptionValue* pNV = (tOptionValue*)*(ppNV++); if (pNV->valType == OPARG_TYPE_HIERARCHY) unloadNestedArglist( pNV->v.nestVal ); free( pNV ); @@ -594,8 +594,8 @@ sortNestedList( tArgList* pAL ) * private: * * what: parse a hierarchical option argument - * arg: + const char* + pzTxt + the text to scan + - * arg: + const char* + pzName + the name for the text + + * arg: + char const* + pzTxt + the text to scan + + * arg: + char const* + pzName + the name for the text + * arg: + size_t + nameLen + the length of "name" + * arg: + tOptionLoadMode + mode + the value formation mode + * @@ -608,7 +608,7 @@ sortNestedList( tArgList* pAL ) * option that takes a hierarchical value. =*/ tOptionValue* -optionLoadNested( const char* pzTxt, const char* pzName, size_t nameLen, +optionLoadNested( char const* pzTxt, char const* pzName, size_t nameLen, tOptionLoadMode mode ) { tOptionValue* pRes; @@ -689,8 +689,8 @@ void optionNestedVal( tOptions* pOpts, tOptDesc* pOD ) { tOptionValue* pOV = - optionLoadNested(pOD->pzLastArg, pOD->pz_Name, strlen( pOD->pz_Name ), - OPTION_LOAD_UNCOOKED); + optionLoadNested(pOD->optArg.argString, pOD->pz_Name, + strlen(pOD->pz_Name), OPTION_LOAD_UNCOOKED); if (pOV != NULL) addArgListEntry( &(pOD->optCookie), (void*)pOV ); diff --git a/sntp/libopts/numeric.c b/sntp/libopts/numeric.c index 26790df3c..d21c927e1 100644 --- a/sntp/libopts/numeric.c +++ b/sntp/libopts/numeric.c @@ -1,7 +1,7 @@ /* * $Id: numeric.c,v 4.7 2006/03/25 19:23:28 bkorb Exp $ - * Time-stamp: "2005-02-14 08:22:56 bkorb" + * Time-stamp: "2006-09-22 18:14:38 bkorb" */ /* @@ -61,23 +61,23 @@ void optionNumericVal( tOptions* pOpts, tOptDesc* pOD ) { char* pz; - long val; + int val; /* * Numeric options may have a range associated with it. * If it does, the usage procedure requests that it be * emitted by passing a NULL pOD pointer. */ - if ((pOD == NULL) || (pOD->pzLastArg == NULL)) + if ((pOD == NULL) || (pOD->optArg.argString == NULL)) return; - val = strtol( pOD->pzLastArg, &pz, 0 ); + val = (int)strtol( pOD->optArg.argString, &pz, 0 ); if (*pz != NUL) { - fprintf( stderr, zNotNumber, pOpts->pzProgName, pOD->pzLastArg ); + fprintf( stderr, zNotNumber, pOpts->pzProgName, pOD->optArg.argString ); (*(pOpts->pUsageProc))(pOpts, EXIT_FAILURE); } - pOD->pzLastArg = (char*)val; + pOD->optArg.argInt = val; } /* * Local Variables: diff --git a/sntp/libopts/proto.h b/sntp/libopts/proto.h index fc0536637..55bf229b5 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 Thu Jul 27 21:15:11 PDT 2006 + * Generated Fri Sep 22 18:22:00 PDT 2006 */ #ifndef AUTOOPTS_PROTO_H_GUARD #define AUTOOPTS_PROTO_H_GUARD 1 @@ -14,6 +14,18 @@ /* * Extracted from autoopts.c */ +LOCAL void * +ao_malloc( size_t sz ); + +LOCAL void * +ao_realloc( void *p, size_t sz ); + +LOCAL void +ao_free( void *p ); + +LOCAL char * +ao_strdup( char const *str ); + LOCAL tSuccess handleOption( tOptions* pOpts, tOptState* pOptState ); @@ -43,7 +55,7 @@ parseAttributes( tOptionValue* pType ); LOCAL tSuccess -validateOptionsStruct( tOptions* pOpts, const char* pzProgram ); +validateOptionsStruct( tOptions* pOpts, char const* pzProgram ); /* * Extracted from environment.c diff --git a/sntp/libopts/putshell.c b/sntp/libopts/putshell.c index f98f75260..b5b4d80ea 100644 --- a/sntp/libopts/putshell.c +++ b/sntp/libopts/putshell.c @@ -1,7 +1,7 @@ /* * $Id: putshell.c,v 4.12 2006/07/16 15:27:50 bkorb Exp $ - * Time-stamp: "2006-07-16 08:13:24 bkorb" + * Time-stamp: "2006-09-22 18:08:30 bkorb" * * This module will interpret the options set in the tOptions * structure and print them to standard out in a fashion that @@ -162,8 +162,8 @@ optionPutShell( tOptions* pOpts ) * but copy over the set-state bits. */ if (pOD->optActualIndex != optIx) { - tOptDesc* p = pOpts->pOptDesc + pOD->optActualIndex; - p->pzLastArg = pOD->pzLastArg; + tOptDesc* p = pOpts->pOptDesc + pOD->optActualIndex; + p->optArg = pOD->optArg; p->fOptState &= OPTST_PERSISTENT; p->fOptState |= pOD->fOptState & ~OPTST_PERSISTENT; printf( zEquivMode, pOpts->pzPROGNAME, pOD->pz_NAME, p->pz_NAME ); @@ -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->pzLastArg + 7; + pz = (char*)pOD->optArg.argString + 7; while (*pz != NUL) { printf( "typeset -x -i %s_", pOD->pz_NAME ); pz += strspn( pz, " +\t\n\f" ); @@ -203,7 +203,7 @@ optionPutShell( tOptions* pOpts ) printf( "=%1$lu # 0x%1$lX\n", (unsigned long)val ); val <<= 1; } - free( (void*)(pOD->pzLastArg) ); + free( (void*)(pOD->optArg.argString) ); continue; } @@ -256,12 +256,12 @@ optionPutShell( tOptions* pOpts ) */ else if (OPTST_GET_ARGTYPE(pOD->fOptState) == OPARG_TYPE_NUMERIC) printf( zOptNumFmt, pOpts->pzPROGNAME, pOD->pz_NAME, - (uintptr_t)(pOD->pzLastArg) ); + pOD->optArg.argIntptr ); /* * If the argument type is an enumeration, then it is much * like a text value, except we call the callback function - * to emit the value corresponding to the "pzLastArg" number. + * to emit the value corresponding to the "optArg" number. */ else if (OPTST_GET_ARGTYPE(pOD->fOptState) == OPARG_TYPE_ENUMERATION) { printf( zOptValFmt, pOpts->pzPROGNAME, pOD->pz_NAME ); @@ -277,14 +277,14 @@ optionPutShell( tOptions* pOpts ) */ else if (OPTST_GET_ARGTYPE(pOD->fOptState) == OPARG_TYPE_BOOLEAN) printf( zFullOptFmt, pOpts->pzPROGNAME, pOD->pz_NAME, - ((uintptr_t)(pOD->pzLastArg) == 0) ? "false" : "true" ); + (pOD->optArg.argIntptr == 0) ? "false" : "true" ); /* * IF the option has an empty value, * THEN we set the argument to the occurrence count. */ - else if ( (pOD->pzLastArg == NULL) - || (pOD->pzLastArg[0] == NUL) ) + else if ( (pOD->optArg.argString == NULL) + || (pOD->optArg.argString[0] == NUL) ) printf( zOptNumFmt, pOpts->pzPROGNAME, pOD->pz_NAME, (int)pOD->optOccCt ); @@ -294,7 +294,7 @@ optionPutShell( tOptions* pOpts ) */ else { printf( zOptValFmt, pOpts->pzPROGNAME, pOD->pz_NAME ); - putQuotedStr( pOD->pzLastArg ); + putQuotedStr( pOD->optArg.argString ); printf( zOptEnd, pOpts->pzPROGNAME, pOD->pz_NAME ); } } while (++optIx < pOpts->presetOptCt ); diff --git a/sntp/libopts/save.c b/sntp/libopts/save.c index d225c27b4..6aeb3b877 100644 --- a/sntp/libopts/save.c +++ b/sntp/libopts/save.c @@ -1,7 +1,7 @@ /* - * save.c $Id: save.c,v 4.16 2006/07/16 15:27:50 bkorb Exp $ - * Time-stamp: "2006-07-16 08:13:22 bkorb" + * save.c $Id: save.c,v 4.17 2006/09/23 00:09:48 bkorb Exp $ + * Time-stamp: "2006-09-22 18:11:20 bkorb" * * This module's routines will take the currently set options and * store them into an ".rc" file for re-interpretation the next @@ -76,7 +76,7 @@ findDirName( tOptions* pOpts, int* p_free ) if (pOpts->specOptIdx.save_opts == 0) return NULL; - pzDir = pOpts->pOptDesc[ pOpts->specOptIdx.save_opts ].pzLastArg; + pzDir = pOpts->pOptDesc[ pOpts->specOptIdx.save_opts ].optArg.argString; if ((pzDir != NULL) && (*pzDir != NUL)) return pzDir; @@ -370,7 +370,7 @@ optionSaveFile( tOptions* pOpts ) } { - const char* pz = pOpts->pzUsageTitle; + char const* pz = pOpts->pzUsageTitle; fputs( "# ", fp ); do { fputc( *pz, fp ); } while (*(pz++) != '\n'); } @@ -437,7 +437,7 @@ optionSaveFile( tOptions* pOpts ) switch (arg_state) { case 0: case OPARG_TYPE_NUMERIC: - printEntry( fp, p, p->pzLastArg ); + printEntry( fp, p, p->optArg.argString ); break; case OPARG_TYPE_STRING: @@ -455,31 +455,33 @@ optionSaveFile( tOptions* pOpts ) while (uct-- > 0) printEntry( fp, p, *(ppz++) ); } else { - printEntry( fp, p, p->pzLastArg ); + printEntry( fp, p, p->optArg.argString ); } break; case OPARG_TYPE_ENUMERATION: case OPARG_TYPE_MEMBERSHIP: { - tCC* val = p->pzLastArg; + tCC* val = p->optArg.argString; /* * 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->pzLastArg ); - if ((p->pzLastArg != NULL) && (arg_state != OPARG_TYPE_ENUMERATION)) + printEntry( fp, p, p->optArg.argString ); + if ( (p->optArg.argString != NULL) + && (arg_state != OPARG_TYPE_ENUMERATION)) /* * bit flag and enumeration strings get allocated */ - AGFREE( (void*)p->pzLastArg ); - p->pzLastArg = val; + AGFREE( (void*)p->optArg.argString ); + p->optArg.argString = val; break; } case OPARG_TYPE_BOOLEAN: - printEntry( fp, p, (p->pzLastArg != 0) ? "true" : "false" ); + printEntry( fp, p, (p->optArg.argBool != AG_FALSE) + ? "true" : "false" ); break; default: diff --git a/sntp/libopts/stack.c b/sntp/libopts/stack.c index 5f51f37db..a5eb00407 100644 --- a/sntp/libopts/stack.c +++ b/sntp/libopts/stack.c @@ -2,7 +2,7 @@ /* * stack.c * $Id: stack.c,v 4.10 2006/07/14 04:20:17 bkorb Exp $ - * Time-stamp: "2006-07-13 21:11:29 bkorb" + * Time-stamp: "2006-09-22 18:13:19 bkorb" * * This is a special option processing routine that will save the * argument to an option in a FIFO queue. @@ -89,7 +89,7 @@ optionUnstackArg( regex_t re; int i, ct, dIdx; - if (regcomp( &re, pOptDesc->pzLastArg, REG_NOSUB ) != 0) + if (regcomp( &re, pOptDesc->optArg.argString, REG_NOSUB ) != 0) return; /* @@ -150,7 +150,7 @@ optionUnstackArg( if (pzEq != NULL) *pzEq = NUL; - if (strcmp( pzSrc, pOptDesc->pzLastArg ) == 0) { + if (strcmp( pzSrc, pOptDesc->optArg.argString ) == 0) { /* * Remove this entry by reducing the in-use count * and *not* putting the string pointer back into @@ -250,10 +250,10 @@ optionStackArg( tOptions* pOpts, tOptDesc* pOD ) { - if (pOD->pzLastArg == NULL) + if (pOD->optArg.argString == NULL) return; - addArgListEntry( &(pOD->optCookie), (void*)pOD->pzLastArg ); + addArgListEntry( &(pOD->optCookie), (void*)pOD->optArg.argString ); } /* * Local Variables: diff --git a/sntp/libopts/streqvcmp.c b/sntp/libopts/streqvcmp.c index 42336dc97..e16debd15 100644 --- a/sntp/libopts/streqvcmp.c +++ b/sntp/libopts/streqvcmp.c @@ -1,6 +1,6 @@ /* - * $Id: streqvcmp.c,v 4.10 2006/07/27 02:51:47 bkorb Exp $ + * $Id: streqvcmp.c,v 4.11 2006/09/23 00:09:48 bkorb Exp $ * Time-stamp: "2006-07-26 18:25:53 bkorb" * * String Equivalence Comparison @@ -103,8 +103,8 @@ static unsigned char charmap[] = { * * what: compare two strings with an equivalence mapping * - * arg: + const char* + str1 + first string + - * arg: + const char* + str2 + second string + + * arg: + char const* + str1 + first string + + * arg: + char const* + str2 + second string + * arg: + int + ct + compare length + * * ret_type: int @@ -144,8 +144,8 @@ strneqvcmp( tCC* s1, tCC* s2, int ct ) * * what: compare two strings with an equivalence mapping * - * arg: + const char* + str1 + first string + - * arg: + const char* + str2 + second string + + * arg: + char const* + str1 + first string + + * arg: + char const* + str2 + second string + * * ret_type: int * ret_desc: the difference between two differing characters @@ -234,7 +234,7 @@ streqvmap( char From, char To, int ct ) * * what: map a list of characters to the same value * - * arg: + const char* + ch_list + characters to equivalence + + * arg: + char const* + ch_list + characters to equivalence + * * doc: * @@ -246,7 +246,7 @@ streqvmap( char From, char To, int ct ) * err: none. =*/ void -strequate( const char* s ) +strequate( char const* s ) { if ((s != NULL) && (*s != NUL)) { unsigned char equiv = (unsigned)*s; @@ -261,7 +261,7 @@ strequate( const char* s ) * what: convert a string into its mapped-to value * * arg: + char* + dest + output string + - * arg: + const char* + src + input string + + * arg: + char const* + src + input string + * * doc: * @@ -273,7 +273,7 @@ strequate( const char* s ) * err: none. =*/ void -strtransform( char* d, const char* s ) +strtransform( char* d, char const* s ) { do { *(d++) = (char)charmap[ (unsigned)*s ]; diff --git a/sntp/libopts/text_mmap.c b/sntp/libopts/text_mmap.c index a8d06b3a6..3455fd5ec 100644 --- a/sntp/libopts/text_mmap.c +++ b/sntp/libopts/text_mmap.c @@ -1,14 +1,14 @@ /* - * $Id: text_mmap.c,v 4.11 2006/06/24 23:34:51 bkorb Exp $ + * $Id: text_mmap.c,v 4.15 2006/09/23 00:09:48 bkorb Exp $ * - * Time-stamp: "2006-06-24 10:54:43 bkorb" + * Time-stamp: "2006-09-10 14:50:04 bkorb" */ -#ifndef MAP_ANONYMOUS -# ifdef MAP_ANON -# define MAP_ANONYMOUS MAP_ANON -# endif -#endif +#ifndef MAP_ANONYMOUS +# ifdef MAP_ANON +# define MAP_ANONYMOUS MAP_ANON +# endif +#endif /* * Some weird systems require that a specifically invalid FD number @@ -19,7 +19,8 @@ #define AO_INVALID_FD -1 #define FILE_WRITABLE(_prt,_flg) \ - ((_prt & PROT_WRITE) && ((_flg & (MAP_SHARED|MAP_PRIVATE)) == MAP_SHARED)) + ( (_prt & PROT_WRITE) \ + && ((_flg & (MAP_SHARED|MAP_PRIVATE)) == MAP_SHARED)) #define MAP_FAILED_PTR ((void*)MAP_FAILED) /*=export_func text_mmap @@ -27,7 +28,7 @@ * * what: map a text file with terminating NUL * - * arg: const char*, pzFile, name of the file to map + * arg: char const*, pzFile, name of the file to map * arg: int, prot, mmap protections (see mmap(2)) * arg: int, flags, mmap flags (see mmap(2)) * arg: tmap_info_t*, mapinfo, returned info about the mapping @@ -76,7 +77,7 @@ * text_munmap( &mi ); =*/ void* -text_mmap( const char* pzFile, int prot, int flags, tmap_info_t* pMI ) +text_mmap( char const* pzFile, int prot, int flags, tmap_info_t* pMI ) { memset( pMI, 0, sizeof(*pMI) ); #ifdef HAVE_MMAP @@ -183,9 +184,8 @@ text_mmap( const char* pzFile, int prot, int flags, tmap_info_t* pMI ) return pMI->txt_data; pMI->txt_errno = errno; -#endif -#if defined(HAVE_DEV_ZERO) +#elif defined(HAVE_DEV_ZERO) pMI->txt_zero_fd = open( "/dev/zero", O_RDONLY ); if (pMI->txt_zero_fd == AO_INVALID_FD) { @@ -211,10 +211,6 @@ text_mmap( const char* pzFile, int prot, int flags, tmap_info_t* pMI ) { void* p = AGALOC( pMI->txt_size+1, "file text" ); - if (pMI->txt_data == NULL) { - pMI->txt_errno = ENOMEM; - goto fail_return; - } memcpy( p, pMI->txt_data, pMI->txt_size ); ((char*)p)[pMI->txt_size] = NUL; munmap(pMI->txt_data, pMI->txt_size ); diff --git a/sntp/libopts/tokenize.c b/sntp/libopts/tokenize.c index 09b80f585..c1b4c9ba1 100644 --- a/sntp/libopts/tokenize.c +++ b/sntp/libopts/tokenize.c @@ -30,14 +30,14 @@ /* = = = START-STATIC-FORWARD = = = */ /* static forward declarations maintained by :mkfwd */ static void -copy_cooked( ch_t** ppDest, cc_t** ppSrc ); +copy_cooked( ch_t** ppDest, char const ** ppSrc ); static void -copy_raw( ch_t** ppDest, cc_t** ppSrc ); +copy_raw( ch_t** ppDest, char const ** ppSrc ); /* = = = END-STATIC-FORWARD = = = */ static void -copy_cooked( ch_t** ppDest, cc_t** ppSrc ) +copy_cooked( ch_t** ppDest, char const ** ppSrc ) { ch_t* pDest = (ch_t*)*ppDest; const ch_t* pSrc = (const ch_t*)(*ppSrc + 1); @@ -60,15 +60,15 @@ copy_cooked( ch_t** ppDest, cc_t** ppSrc ) done: *ppDest = (ch_t*)pDest; /* next spot for storing character */ - *ppSrc = (ch_t*)pSrc; /* char following closing quote */ + *ppSrc = (char const *)pSrc; /* char following closing quote */ } static void -copy_raw( ch_t** ppDest, cc_t** ppSrc ) +copy_raw( ch_t** ppDest, char const ** ppSrc ) { ch_t* pDest = *ppDest; - cc_t* pSrc = *ppSrc + 1; + cc_t* pSrc = (cc_t*) (*ppSrc + 1); for (;;) { ch_t ch = *(pSrc++); @@ -108,7 +108,7 @@ copy_raw( ch_t** ppDest, cc_t** ppSrc ) done: *ppDest = pDest; /* next spot for storing character */ - *ppSrc = pSrc; /* char following closing quote */ + *ppSrc = (char const *) pSrc; /* char following closing quote */ } @@ -116,7 +116,7 @@ copy_raw( ch_t** ppDest, cc_t** ppSrc ) * * what: tokenize an input string * - * arg: + const char* + string + string to be tokenized + + * arg: + char const* + string + string to be tokenized + * * ret_type: token_list_t* * ret_desc: pointer to a structure that lists each token @@ -178,7 +178,7 @@ copy_raw( ch_t** ppDest, cc_t** ppSrc ) * @end itemize =*/ token_list_t* -ao_string_tokenize( const char* str ) +ao_string_tokenize( char const* str ) { int max_token_ct = 1; /* allow for trailing NUL on string */ token_list_t* res; @@ -189,7 +189,7 @@ ao_string_tokenize( const char* str ) * Trim leading white space. Use "ENOENT" and a NULL return to indicate * an empty string was passed. */ - while (isspace( *str )) str++; + while (isspace( (ch_t)*str )) str++; if (*str == NUL) { bogus_str: errno = ENOENT; @@ -231,33 +231,33 @@ ao_string_tokenize( const char* str ) do { res->tkn_list[ res->tkn_ct++ ] = pzDest; for (;;) { - char ch = *str; + int ch = (ch_t)*str; if (isspace( ch )) { found_white_space: - while (isspace( *++str )) ; + while (isspace( (ch_t)*++str )) ; break; } switch (ch) { case '"': - copy_cooked( &pzDest, (cc_t**)(void*)&str ); + copy_cooked( &pzDest, &str ); if (str == NULL) { free(res); errno = EINVAL; return NULL; } - if (isspace( *str )) + if (isspace( (ch_t)*str )) goto found_white_space; break; case '\'': - copy_raw( &pzDest, (cc_t**)(void*)&str ); + copy_raw( &pzDest, &str ); if (str == NULL) { free(res); errno = EINVAL; return NULL; } - if (isspace( *str )) + if (isspace( (ch_t)*str )) goto found_white_space; break; diff --git a/sntp/libopts/usage.c b/sntp/libopts/usage.c index 18843cdd0..4f0531823 100644 --- a/sntp/libopts/usage.c +++ b/sntp/libopts/usage.c @@ -1,6 +1,6 @@ /* - * usage.c $Id: usage.c,v 4.10 2006/08/12 17:36:43 bkorb Exp $ + * usage.c $Id: usage.c,v 4.16 2006/09/23 00:09:48 bkorb Exp $ * Time-stamp: "2006-07-01 12:41:02 bkorb" * * This module implements the default usage procedure for @@ -409,7 +409,7 @@ printInitList( *pInitIntro = AG_FALSE; for (;;) { - const char* pzPath = *(papz++); + char const* pzPath = *(papz++); if (pzPath == NULL) break; diff --git a/sntp/libopts/version.c b/sntp/libopts/version.c index e01809a80..6b1e6917f 100644 --- a/sntp/libopts/version.c +++ b/sntp/libopts/version.c @@ -1,12 +1,12 @@ -/* $Id: version.c,v 4.9 2006/07/27 02:51:47 bkorb Exp $ - * Time-stamp: "2006-07-26 18:38:16 bkorb" +/* $Id: version.c,v 4.10 2006/09/23 00:09:48 bkorb Exp $ + * Time-stamp: "2006-09-22 18:15:00 bkorb" * * This module implements the default usage procedure for * Automated Options. It may be overridden, of course. */ -static const char zAOV[] = +static char const zAOV[] = "Automated Options version %s, copyright (c) 1999-2006 Bruce Korb\n"; /* Automated Options is free software. @@ -58,16 +58,16 @@ printVersion( tOptions* pOpts, tOptDesc* pOD, FILE* fp ); /*=export_func optionVersion * * what: return the compiled AutoOpts version number - * ret_type: const char* + * ret_type: char const* * ret_desc: the version string in constant memory * doc: * Returns the full version string compiled into the library. * The returned string cannot be modified. =*/ -const char* +char const* optionVersion( void ) { - static const char zVersion[] = + static char const zVersion[] = STR( AO_CURRENT.AO_REVISION ); return zVersion; @@ -79,16 +79,16 @@ printVersion( tOptions* pOpts, tOptDesc* pOD, FILE* fp ) { char swCh; - if (pOD->pzLastArg == NULL) + if (pOD->optArg.argString == NULL) swCh = 'v'; - else swCh = pOD->pzLastArg[0]; + else swCh = pOD->optArg.argString[0]; if (pOpts->pzFullVersion != NULL) { fputs( pOpts->pzFullVersion, fp ); fputc( '\n', fp ); } else { - const char *pz = pOpts->pzUsageTitle; + char const *pz = pOpts->pzUsageTitle; do { fputc( *pz, fp ); } while (*(pz++) != '\n'); }