*
* 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
*/
*/
-#include <stdio.h>
#include <limits.h>
+#include <stdio.h>
#define OPTION_CODE_COMPILE 1
#include "clktest-opts.h"
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
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
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
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:
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:
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:
/* 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,
/* 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,
/* 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,
/* 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,
/* 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,
/* 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,
/* 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,
/* 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,
/* 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,
/* 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,
/* 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,
/* 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,
/* 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,
*/
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 [ -<flag> [<val>] | --<name>[{=| }<val>] ]... <tty_device>\n";
tSCC zRcName[] = ".ntprc";
tSCC* apzHomeList[] = {
{ 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. */
}
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:
return;
valid_return:
- pOptDesc->pzLastArg = (char*)val;
+ pOptDesc->optArg.argString = (char*)val;
}
#endif /* defined CLKLDISC */
{ 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. */
}
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:
return;
valid_return:
- pOptDesc->pzLastArg = (char*)val;
+ pOptDesc->optArg.argString = (char*)val;
}
#endif /* defined CLKLDISC */
{ 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. */
}
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:
return;
valid_return:
- pOptDesc->pzLastArg = (char*)val;
+ pOptDesc->optArg.argString = (char*)val;
}
/* extracted from optmain.tpl near line 92 */
#include <unistd.h>
#include <autoopts/usage-txt.h>
-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)
*
* 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
*/
} 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
*/
#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)))
*/
#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'
#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 '>'
#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
*/
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 */
/* * * * * *
*
#ifndef _
# if ENABLE_NLS
# include <stdio.h>
- static inline char* aoGetsText( const char* pz ) {
+ static inline char* aoGetsText( char const* pz ) {
if (pz == NULL) return NULL;
return (char*)gettext( pz );
}
/*
- * $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
# 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]))
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
* 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 {
*/
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 );
/*
* 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
#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
/*
*
* 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
*
* 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
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.
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;
};
/*
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;
* 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
* @code{optionGetValue()}, @code{optionNextValue()} and
* @code{optionUnloadNested()}.
*/
-extern const tOptionValue* configFileLoad( const char* );
+extern const tOptionValue* configFileLoad( char const* );
/* From: configfile.c line 871
*
* 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
* 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
* 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
* 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
* 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
*
* 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
* @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 */
* 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
* 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
* 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
* 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* );
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* );
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* );
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* );
*
* 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
*
#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.
/*
- * $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.
*
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 */
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:
* Author: Gary V Vaughan <gvaughan@oranda.demon.co.uk>
* 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
/*
* Author: Gary V Vaughan <gvaughan@oranda.demon.co.uk>
* 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: */
#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
*
* 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
* 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;
* 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;
* 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;
return NULL;
{
- const char* pzSrc = string + ix;
+ char const* pzSrc = string + ix;
while (*pzSrc == ':') pzSrc++;
#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;
}
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)));
SYNOPSIS
#include <string.h>
- 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
*/
char*
-strchr( const char *s, int c)
+strchr( char const *s, int c)
{
do {
if ((unsigned)*s == (unsigned)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)
*/
static char *
-strdup( const char *s )
+strdup( char const *s )
{
char *cp;
/*
- * $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.
*/
static void
filePreset(
tOptions* pOpts,
- const char* pzFileName,
+ char const* pzFileName,
int direction );
static char*
/*=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
* @end itemize
=*/
const tOptionValue*
-configFileLoad( const char* pzFile )
+configFileLoad( char const* pzFile )
{
tmap_info_t cfgfile;
tOptionValue* pRes = NULL;
*
* 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
=*/
const tOptionValue*
optionFindValue( const tOptDesc* pOptDesc,
- const char* pzName, const char* pzVal )
+ char const* pzName, char const* pzVal )
{
const tOptionValue* pRes = NULL;
* 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
=*/
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;
*
* 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
* @end itemize
=*/
const tOptionValue*
-optionGetValue( const tOptionValue* pOld, const char* pzValName )
+optionGetValue( const tOptionValue* pOld, char const* pzValName )
{
tArgList* pAL;
tOptionValue* pRes = NULL;
static void
filePreset(
tOptions* pOpts,
- const char* pzFileName,
+ char const* pzFileName,
int direction )
{
tmap_info_t cfgfile;
* 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
* always be returned.
=*/
int
-optionFileLoad( tOptions* pOpts, const char* pzProgram )
+optionFileLoad( tOptions* pOpts, char const* pzProgram )
{
if (! SUCCESSFUL( validateOptionsStruct( pOpts, pzProgram )))
return -1;
* 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 )
*/
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 */
}
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);
}
}
* already been called.)
*/
LOCAL tSuccess
-validateOptionsStruct( tOptions* pOpts, const char* pzProgram )
+validateOptionsStruct( tOptions* pOpts, char const* pzProgram )
{
if (pOpts == NULL) {
fputs( zAO_Bad, stderr );
* 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;
/*
- * $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
* 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 +
*
* 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;
/*
- * $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.
*
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 );
* 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;
}
*
* 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,
* 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.
*/
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 );
}
*
* 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
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
}
{
- tCC* pzArg = pOD->pzLastArg;
+ tCC* pzArg = pOD->optArg.argString;
uintptr_t res;
if ((pzArg == NULL) || (*pzArg == NUL)) {
pOD->optCookie = (void*)0;
/*
- * $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
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;
*
* 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
*/
/* 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,
/* 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,
/* 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,
/* 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,
/* 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,
#include <unistd.h>
#include <autoopts/usage-txt.h>
-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)
*
* 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
*/
*/
#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)))
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 */
/* * * * * *
*
#ifndef _
# if ENABLE_NLS
# include <stdio.h>
- static inline char* aoGetsText( const char* pz ) {
+ static inline char* aoGetsText( char const* pz ) {
if (pz == NULL) return NULL;
return (char*)gettext( pz );
}
/*
- * $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
* 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.
* 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:
*
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
@%:@include <sys/types.h>
@%:@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 ); }
@%:@include <string.h>
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@:>@ */
/*
- * $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.
emitLong( tOptions* pOpts );
static void
-openOutput( const char* pzFile );
+openOutput( char const* pzFile );
/* = = = END-STATIC-FORWARD = = = */
/*=export_func optionParseShell
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__)
exit( EXIT_FAILURE );
case TT_VERSION:
- pOD->pzLastArg = "c";
+ pOD->optArg.argString = "c";
optionPrintVersion( pOpts, pOD );
/* NOTREACHED */
{
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];
switch (OPTST_GET_ARGTYPE(pOptDesc->fOptState)) {
case OPARG_TYPE_ENUMERATION:
(*(pOptDesc->pOptProc))( (tOptions*)2UL, pOptDesc );
- pzDefault = pOptDesc->pzLastArg;
+ pzDefault = pOptDesc->optArg.argString;
break;
/*
*/
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 );
static void
-openOutput( const char* pzFile )
+openOutput( char const* pzFile )
{
FILE* fp;
char* pzData = NULL;
/*
- * $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.
*/
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 );
*
* 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 */
* 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);
* 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;
* 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;
* 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;
* 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;
* 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;
char z[68];
char* pzD = z;
int ct = nameLen;
- const char* pzS = pzName;
+ char const* pzS = pzName;
*(pzD++) = '<';
*(pzD++) = '/';
* 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 +
*
* 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;
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 );
/*
- * $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"
*/
/*
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:
/*
- * $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.
/* -*- 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
tOptionValue* pType );
LOCAL tSuccess
-validateOptionsStruct( tOptions* pOpts, const char* pzProgram );
+validateOptionsStruct( tOptions* pOpts, char const* pzProgram );
/*
* Extracted from environment.c
/*
- * $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
* 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 );
* 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" );
printf( "=%1$lu # 0x%1$lX\n", (unsigned long)val );
val <<= 1;
}
- free( (void*)(pOD->pzLastArg) );
+ free( (void*)(pOD->optArg.argString) );
continue;
}
*/
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 );
*/
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 );
*/
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 );
/*
- * 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
/*
- * 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
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;
}
{
- const char* pz = pOpts->pzUsageTitle;
+ char const* pz = pOpts->pzUsageTitle;
fputs( "# ", fp );
do { fputc( *pz, fp ); } while (*(pz++) != '\n');
}
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:
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:
/*
- * 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.
/*
* 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.
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;
/*
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
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:
/*
- * $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
*
* 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
*
* 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
*
* 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:
*
* err: none.
=*/
void
-strequate( const char* s )
+strequate( char const* s )
{
if ((s != NULL) && (*s != NUL)) {
unsigned char equiv = (unsigned)*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:
*
* err: none.
=*/
void
-strtransform( char* d, const char* s )
+strtransform( char* d, char const* s )
{
do {
*(d++) = (char)charmap[ (unsigned)*s ];
/*
- * $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"
*/
*
* 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
* 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
/* = = = 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);
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);
done:
*ppDest = pDest; /* next spot for storing character */
- *ppSrc = (const char *) pSrc; /* char following closing quote */
+ *ppSrc = (char const *) pSrc; /* char following closing quote */
}
*
* 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
* @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;
/*
- * 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
*pInitIntro = AG_FALSE;
for (;;) {
- const char* pzPath = *(papz++);
+ char const* pzPath = *(papz++);
if (pzPath == NULL)
break;
-/* $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.
/*=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;
{
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');
}
*
* 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
*/
"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;
/* 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,
/* 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,
/* 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,
/* 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,
/* 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,
/* 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,
/* 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,
/* 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,
/* 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,
/* 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,
/* 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,
/* 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,
/* 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,
#include <unistd.h>
#include <autoopts/usage-txt.h>
-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)
*
* 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
*/
*/
#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)))
#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
*/
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 */
/* * * * * *
*
#ifndef _
# if ENABLE_NLS
# include <stdio.h>
- static inline char* aoGetsText( const char* pz ) {
+ static inline char* aoGetsText( char const* pz ) {
if (pz == NULL) return NULL;
return (char*)gettext( pz );
}
/*
- * $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
# 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]))
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
*
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
* 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 {
*/
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 );
/*
- * 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
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?
#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
/*
*
* 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
*
* 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
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.
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;
};
/*
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
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;
* 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
* @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
*
*
* 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
*
* 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
* 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
extern void optionFree( tOptions* );
-/* From: configfile.c line 310
+/* From: configfile.c line 309
*
* optionGetValue - get a specific value from a hierarcical list
*
* 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
* 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
*
extern void optionOnlyUsage( tOptions*, int );
-/* From: autoopts.c line 936
+/* From: autoopts.c line 980
*
* optionProcess - this is the main option processing routine
*
*
* 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
* @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 */
* 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
* 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
* 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
* 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* );
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* );
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* );
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* );
*
* 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
*
#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.
/*
* $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.
*
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 */
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:
/* --- 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 <gvaughan@oranda.demon.co.uk>
* 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
* SYSTEM HEADERS:
*/
#include <sys/types.h>
-#if HAVE_SYS_MMAN_H
+#ifdef HAVE_SYS_MMAN_H
# include <sys/mman.h>
#endif
#include <sys/param.h>
#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.
/*
* Author: Gary V Vaughan <gvaughan@oranda.demon.co.uk>
* 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: */
#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
*
* 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
* 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;
break;
}
}
-
+
closedir( dirP );
if (pathName != NULL)
* 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 {
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';
* 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;
return NULL;
{
- const char* pzSrc = string + ix;
+ char const* pzSrc = string + ix;
while (*pzSrc == ':') pzSrc++;
# include <stdarg.h>
# 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
# include <varargs.h>
# 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
#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;
}
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)));
SYNOPSIS
#include <string.h>
- 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
*/
char*
-strchr( const char *s, int c)
+strchr( char const *s, int c)
{
do {
if ((unsigned)*s == (unsigned)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)
*/
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;
}
/*
- * $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.
*/
static void
filePreset(
tOptions* pOpts,
- const char* pzFileName,
+ char const* pzFileName,
int direction );
static char*
/*=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
* @end itemize
=*/
const tOptionValue*
-configFileLoad( const char* pzFile )
+configFileLoad( char const* pzFile )
{
tmap_info_t cfgfile;
tOptionValue* pRes = NULL;
*
* 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
=*/
const tOptionValue*
optionFindValue( const tOptDesc* pOptDesc,
- const char* pzName, const char* pzVal )
+ char const* pzName, char const* pzVal )
{
const tOptionValue* pRes = NULL;
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;
}
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)
* 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
=*/
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;
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;
}
while (--ct >= 0) {
- tOptionValue* pOV = *(ppOV++);
+ tOptionValue* pOV = (tOptionValue*)*(ppOV++);
if (foundOldVal) {
pRes = pOV;
break;
*
* 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
* @end itemize
=*/
const tOptionValue*
-optionGetValue( const tOptionValue* pOld, const char* pzValName )
+optionGetValue( const tOptionValue* pOld, char const* pzValName )
{
tArgList* pAL;
tOptionValue* pRes = NULL;
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;
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;
}
static void
filePreset(
tOptions* pOpts,
- const char* pzFileName,
+ char const* pzFileName,
int direction )
{
tmap_info_t cfgfile;
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) {
* 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
* always be returned.
=*/
int
-optionFileLoad( tOptions* pOpts, const char* pzProgram )
+optionFileLoad( tOptions* pOpts, char const* pzProgram )
{
if (! SUCCESSFUL( validateOptionsStruct( pOpts, pzProgram )))
return -1;
* 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 )
*/
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 */
}
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);
}
}
* already been called.)
*/
LOCAL tSuccess
-validateOptionsStruct( tOptions* pOpts, const char* pzProgram )
+validateOptionsStruct( tOptions* pOpts, char const* pzProgram )
{
if (pOpts == NULL) {
fputs( zAO_Bad, stderr );
* 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;
/*
- * $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
* 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 +
*
* 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;
/*
- * $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.
*
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 );
* 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;
}
*
* 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,
* 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.
*/
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 );
}
*
* 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
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
}
{
- tCC* pzArg = pOD->pzLastArg;
+ tCC* pzArg = pOD->optArg.argString;
uintptr_t res;
if ((pzArg == NULL) || (*pzArg == NUL)) {
pOD->optCookie = (void*)0;
/*
- * $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
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;
*
* 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
*/
*/
+#include <limits.h>
#define OPTION_CODE_COMPILE 1
#include "genshell.h"
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:
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:
/* 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,
/* 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,
/* 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,
/* 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,
/* 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,
#include <unistd.h>
#include <autoopts/usage-txt.h>
-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)
*
* 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
*/
#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)))
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 */
/* * * * * *
*
#ifndef _
# if ENABLE_NLS
# include <stdio.h>
- static inline char* aoGetsText( const char* pz ) {
+ static inline char* aoGetsText( char const* pz ) {
if (pz == NULL) return NULL;
return (char*)gettext( pz );
}
/*
- * $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
* 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.
* 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:
*
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
@%:@include <sys/types.h>
@%:@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 ); }
@%:@include <string.h>
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@:>@ */
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],
/*
- * $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.
emitLong( tOptions* pOpts );
static void
-openOutput( const char* pzFile );
+openOutput( char const* pzFile );
/* = = = END-STATIC-FORWARD = = = */
/*=export_func optionParseShell
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__)
exit( EXIT_FAILURE );
case TT_VERSION:
- pOD->pzLastArg = "c";
+ pOD->optArg.argString = "c";
optionPrintVersion( pOpts, pOD );
/* NOTREACHED */
{
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];
switch (OPTST_GET_ARGTYPE(pOptDesc->fOptState)) {
case OPARG_TYPE_ENUMERATION:
(*(pOptDesc->pOptProc))( (tOptions*)2UL, pOptDesc );
- pzDefault = pOptDesc->pzLastArg;
+ pzDefault = pOptDesc->optArg.argString;
break;
/*
*/
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 );
static void
-openOutput( const char* pzFile )
+openOutput( char const* pzFile )
{
FILE* fp;
char* pzData = NULL;
/*
- * $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.
*/
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 );
*
* 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 */
* 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);
* 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;
* 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;
* 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;
* 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;
* 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;
char z[68];
char* pzD = z;
int ct = nameLen;
- const char* pzS = pzName;
+ char const* pzS = pzName;
*(pzD++) = '<';
*(pzD++) = '/';
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 );
* 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 +
*
* 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;
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 );
/*
* $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"
*/
/*
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:
/* -*- 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
/*
* 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 );
tOptionValue* pType );
LOCAL tSuccess
-validateOptionsStruct( tOptions* pOpts, const char* pzProgram );
+validateOptionsStruct( tOptions* pOpts, char const* pzProgram );
/*
* Extracted from environment.c
/*
* $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
* 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 );
* 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" );
printf( "=%1$lu # 0x%1$lX\n", (unsigned long)val );
val <<= 1;
}
- free( (void*)(pOD->pzLastArg) );
+ free( (void*)(pOD->optArg.argString) );
continue;
}
*/
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 );
*/
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 );
*/
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 );
/*
- * 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
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;
}
{
- const char* pz = pOpts->pzUsageTitle;
+ char const* pz = pOpts->pzUsageTitle;
fputs( "# ", fp );
do { fputc( *pz, fp ); } while (*(pz++) != '\n');
}
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:
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:
/*
* 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.
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;
/*
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
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:
/*
- * $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
*
* 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
*
* 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
*
* 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:
*
* err: none.
=*/
void
-strequate( const char* s )
+strequate( char const* s )
{
if ((s != NULL) && (*s != NUL)) {
unsigned char equiv = (unsigned)*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:
*
* err: none.
=*/
void
-strtransform( char* d, const char* s )
+strtransform( char* d, char const* s )
{
do {
*(d++) = (char)charmap[ (unsigned)*s ];
/*
- * $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
#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
*
* 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
* 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
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) {
{
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 );
/* = = = 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);
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++);
done:
*ppDest = pDest; /* next spot for storing character */
- *ppSrc = pSrc; /* char following closing quote */
+ *ppSrc = (char const *) pSrc; /* char following closing quote */
}
*
* 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
* @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;
* 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;
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;
/*
- * 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
*pInitIntro = AG_FALSE;
for (;;) {
- const char* pzPath = *(papz++);
+ char const* pzPath = *(papz++);
if (pzPath == NULL)
break;
-/* $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.
/*=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;
{
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');
}