From: Dave Hart Date: Sun, 19 Dec 2010 00:50:10 +0000 (+0000) Subject: libopts 34.0.9 (AutoGen 5.11.6pre5) X-Git-Tag: NTP_4_2_7P97~3^2~2^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8b43caf263070e04cb076f6183cfe80cedaef3ab;p=thirdparty%2Fntp.git libopts 34.0.9 (AutoGen 5.11.6pre5) bk: 4d0d56c2pNTbfbR5f7xRbPjsACCi_g --- diff --git a/sntp/libopts/Makefile.am b/sntp/libopts/Makefile.am index 6473fb441..e99ce89d1 100644 --- a/sntp/libopts/Makefile.am +++ b/sntp/libopts/Makefile.am @@ -7,14 +7,14 @@ noinst_LTLIBRARIES = libopts.la endif libopts_la_SOURCES = libopts.c libopts_la_CPPFLAGS = -I$(top_srcdir) -libopts_la_LDFLAGS = -version-info 33:5:8 +libopts_la_LDFLAGS = -version-info 34:0:9 EXTRA_DIST = \ COPYING.gplv3 COPYING.lgplv3 COPYING.mbsd \ MakeDefs.inc README ag-char-map.h \ - autoopts/usage-txt.h autoopts/options.h autoopts.c \ - autoopts.h boolean.c compat/strchr.c \ - compat/snprintf.c compat/windows-config.h compat/pathfind.c \ - compat/compat.h compat/strdup.c configfile.c \ + autoopts/options.h autoopts/usage-txt.h autoopts.c \ + autoopts.h boolean.c compat/snprintf.c \ + compat/windows-config.h compat/strdup.c compat/compat.h \ + compat/pathfind.c compat/strchr.c configfile.c \ cook.c enumeration.c environment.c \ file.c genshell.c genshell.h \ load.c m4/liboptschk.m4 m4/libopts.m4 \ diff --git a/sntp/libopts/ag-char-map.h b/sntp/libopts/ag-char-map.h index e19edce5b..d35fc97ea 100644 --- a/sntp/libopts/ag-char-map.h +++ b/sntp/libopts/ag-char-map.h @@ -1,5 +1,5 @@ /* - * Character mapping generated 12/16/10 15:59:15 + * Character mapping generated 12/18/10 12:13:30 * * This file contains the character classifications * used by AutoGen and AutoOpts for identifying tokens. @@ -70,7 +70,7 @@ // // %guard autoopts_internal // %file ag-char-map.h -// %table opt-char-cat +// %table option-char-category // // %comment // This file contains the character classifications @@ -120,41 +120,41 @@ // #endif /* 0 -- mapping spec. source */ -typedef uint32_t opt_char_cat_mask_t; -extern opt_char_cat_mask_t const opt_char_cat[128]; +typedef uint32_t option_char_category_mask_t; +extern option_char_category_mask_t const option_char_category[128]; -static inline int is_opt_char_cat_char(char ch, opt_char_cat_mask_t mask) { +static inline int is_option_char_category_char(char ch, option_char_category_mask_t mask) { unsigned int ix = (unsigned char)ch; - return ((ix < 0x7F) && ((opt_char_cat[ix] & mask) != 0)); } + return ((ix < 0x7F) && ((option_char_category[ix] & mask) != 0)); } -#define IS_LOWER_CASE_CHAR(_c) is_opt_char_cat_char((_c), 0x000001) -#define IS_UPPER_CASE_CHAR(_c) is_opt_char_cat_char((_c), 0x000002) -#define IS_ALPHABETIC_CHAR(_c) is_opt_char_cat_char((_c), 0x000003) -#define IS_OCT_DIGIT_CHAR(_c) is_opt_char_cat_char((_c), 0x000004) -#define IS_DEC_DIGIT_CHAR(_c) is_opt_char_cat_char((_c), 0x00000C) -#define IS_HEX_DIGIT_CHAR(_c) is_opt_char_cat_char((_c), 0x00001C) -#define IS_ALPHANUMERIC_CHAR(_c) is_opt_char_cat_char((_c), 0x00000F) -#define IS_VAR_FIRST_CHAR(_c) is_opt_char_cat_char((_c), 0x000023) -#define IS_VARIABLE_NAME_CHAR(_c) is_opt_char_cat_char((_c), 0x00002F) -#define IS_OPTION_NAME_CHAR(_c) is_opt_char_cat_char((_c), 0x00006F) -#define IS_VALUE_NAME_CHAR(_c) is_opt_char_cat_char((_c), 0x0000EF) -#define IS_HORIZ_WHITE_CHAR(_c) is_opt_char_cat_char((_c), 0x000100) -#define IS_COMPOUND_NAME_CHAR(_c) is_opt_char_cat_char((_c), 0x0003EF) -#define IS_WHITESPACE_CHAR(_c) is_opt_char_cat_char((_c), 0x000500) -#define IS_UNQUOTABLE_CHAR(_c) is_opt_char_cat_char((_c), 0x000800) -#define IS_END_XML_TOKEN_CHAR(_c) is_opt_char_cat_char((_c), 0x001500) -#define IS_GRAPHIC_CHAR(_c) is_opt_char_cat_char((_c), 0x002000) -#define IS_PLUS_N_SPACE_CHAR(_c) is_opt_char_cat_char((_c), 0x004500) -#define IS_PUNCTUATION_CHAR(_c) is_opt_char_cat_char((_c), 0x008000) -#define IS_SUFFIX_CHAR(_c) is_opt_char_cat_char((_c), 0x01000F) -#define IS_SUFFIX_FMT_CHAR(_c) is_opt_char_cat_char((_c), 0x03000F) -#define IS_FALSE_TYPE_CHAR(_c) is_opt_char_cat_char((_c), 0x040000) -#define IS_FILE_NAME_CHAR(_c) is_opt_char_cat_char((_c), 0x09000F) -#define IS_END_TOKEN_CHAR(_c) is_opt_char_cat_char((_c), 0x100500) -#define IS_END_LIST_ENTRY_CHAR(_c) is_opt_char_cat_char((_c), 0x300500) +#define IS_LOWER_CASE_CHAR(_c) is_option_char_category_char((_c), 0x000001) +#define IS_UPPER_CASE_CHAR(_c) is_option_char_category_char((_c), 0x000002) +#define IS_ALPHABETIC_CHAR(_c) is_option_char_category_char((_c), 0x000003) +#define IS_OCT_DIGIT_CHAR(_c) is_option_char_category_char((_c), 0x000004) +#define IS_DEC_DIGIT_CHAR(_c) is_option_char_category_char((_c), 0x00000C) +#define IS_HEX_DIGIT_CHAR(_c) is_option_char_category_char((_c), 0x00001C) +#define IS_ALPHANUMERIC_CHAR(_c) is_option_char_category_char((_c), 0x00000F) +#define IS_VAR_FIRST_CHAR(_c) is_option_char_category_char((_c), 0x000023) +#define IS_VARIABLE_NAME_CHAR(_c) is_option_char_category_char((_c), 0x00002F) +#define IS_OPTION_NAME_CHAR(_c) is_option_char_category_char((_c), 0x00006F) +#define IS_VALUE_NAME_CHAR(_c) is_option_char_category_char((_c), 0x0000EF) +#define IS_HORIZ_WHITE_CHAR(_c) is_option_char_category_char((_c), 0x000100) +#define IS_COMPOUND_NAME_CHAR(_c) is_option_char_category_char((_c), 0x0003EF) +#define IS_WHITESPACE_CHAR(_c) is_option_char_category_char((_c), 0x000500) +#define IS_UNQUOTABLE_CHAR(_c) is_option_char_category_char((_c), 0x000800) +#define IS_END_XML_TOKEN_CHAR(_c) is_option_char_category_char((_c), 0x001500) +#define IS_GRAPHIC_CHAR(_c) is_option_char_category_char((_c), 0x002000) +#define IS_PLUS_N_SPACE_CHAR(_c) is_option_char_category_char((_c), 0x004500) +#define IS_PUNCTUATION_CHAR(_c) is_option_char_category_char((_c), 0x008000) +#define IS_SUFFIX_CHAR(_c) is_option_char_category_char((_c), 0x01000F) +#define IS_SUFFIX_FMT_CHAR(_c) is_option_char_category_char((_c), 0x03000F) +#define IS_FALSE_TYPE_CHAR(_c) is_option_char_category_char((_c), 0x040000) +#define IS_FILE_NAME_CHAR(_c) is_option_char_category_char((_c), 0x09000F) +#define IS_END_TOKEN_CHAR(_c) is_option_char_category_char((_c), 0x100500) +#define IS_END_LIST_ENTRY_CHAR(_c) is_option_char_category_char((_c), 0x300500) #ifdef AUTOOPTS_INTERNAL -opt_char_cat_mask_t const opt_char_cat[128] = { +option_char_category_mask_t const option_char_category[128] = { /*x00*/ 0x140000, /*x01*/ 0x000000, /*x02*/ 0x000000, /*x03*/ 0x000000, /*x04*/ 0x000000, /*x05*/ 0x000000, /*x06*/ 0x000000, /*\a */ 0x000000, /*\b */ 0x000400, /*\t */ 0x000100, /*\n */ 0x000400, /*\v */ 0x000400, diff --git a/sntp/libopts/autoopts.c b/sntp/libopts/autoopts.c index 9b6cd5f6e..6b75f4a5f 100644 --- a/sntp/libopts/autoopts.c +++ b/sntp/libopts/autoopts.c @@ -2,7 +2,7 @@ /** * \file autoopts.c * - * Time-stamp: "2010-12-06 14:02:35 bkorb" + * Time-stamp: "2010-12-18 12:09:04 bkorb" * * This file contains all of the routines that must be linked into * an executable to use the generated option processing. The optional @@ -30,7 +30,19 @@ * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd */ -static char const zNil[] = ""; +#ifndef PKGDATADIR +# define PKGDATADIR "" +#endif + +static char const zNil[] = ""; +static arg_types_t argTypes = { NULL }; +static char zOptFmtLine[16] = { NUL }; +static ag_bool displayEnum = AG_FALSE; +static char const pkgdatadir_default[] = PKGDATADIR; +static char const * program_pkgdatadir = pkgdatadir_default; +static tOptionLoadMode option_load_mode = OPTION_LOAD_UNCOOKED; + + FILE * option_usage_fp = NULL; /* = = = START-STATIC-FORWARD = = = */ static tSuccess @@ -60,7 +72,7 @@ ao_malloc(size_t sz) { void * res = malloc(sz); if (res == NULL) { - fprintf(stderr, "malloc of %d bytes failed\n", (int)sz); + fprintf(stderr, zAO_Alloc, (int)sz); exit(EXIT_FAILURE); } return res; @@ -73,7 +85,7 @@ ao_realloc(void *p, size_t sz) { void * res = (p == NULL) ? malloc(sz) : realloc(p, sz); if (res == NULL) { - fprintf(stderr, "realloc of %d bytes at 0x%p failed\n", (int)sz, p); + fprintf(stderr, zAO_Realloc, (int)sz, p); exit(EXIT_FAILURE); } return res; @@ -97,7 +109,7 @@ ao_strdup(char const *str) { char * res = strdup(str); if (res == NULL) { - fprintf(stderr, "strdup of %d byte string failed\n", (int)strlen(str)); + fprintf(stderr, zAO_Strdup, (int)strlen(str)); exit(EXIT_FAILURE); } return res; @@ -457,7 +469,7 @@ shortOptionFind(tOptions* pOpts, uint_t optValue, tOptState* pOptState) return SUCCESS; } - short_opt_error: +short_opt_error: /* * IF we are to stop on errors (the default, actually) @@ -1091,10 +1103,7 @@ checkConsistency(tOptions* pOpts) * ERRSKIP_OPTERR or ERRSTOP_OPTERR macros were invoked. =*/ int -optionProcess( - tOptions* pOpts, - int argCt, - char** argVect ) +optionProcess(tOptions * pOpts, int argCt, char ** argVect) { if (! SUCCESSFUL(validateOptionsStruct(pOpts, argVect[0]))) exit(EX_SOFTWARE); @@ -1107,6 +1116,8 @@ optionProcess( pOpts->origArgCt = argCt; pOpts->origArgVect = argVect; pOpts->fOptSet |= OPTPROC_INITDONE; + if (HAS_pzPkgDataDir(pOpts)) + program_pkgdatadir = pOpts->pzPkgDataDir; if (! SUCCESSFUL(doPresets(pOpts))) return 0; diff --git a/sntp/libopts/autoopts.h b/sntp/libopts/autoopts.h index 44675d68e..56eb1ec15 100644 --- a/sntp/libopts/autoopts.h +++ b/sntp/libopts/autoopts.h @@ -2,7 +2,7 @@ /* * \file autoopts.h * - * Time-stamp: "2010-07-17 10:39:18 bkorb" + * Time-stamp: "2010-12-18 11:53:11 bkorb" * * This file defines all the global structures and special values * used in the automated option processing library. @@ -145,7 +145,7 @@ typedef enum { OPTION_LOAD_KEEP } tOptionLoadMode; -extern tOptionLoadMode option_load_mode; +static tOptionLoadMode option_load_mode; /* * The pager state is used by optionPagedUsage() procedure. @@ -197,21 +197,21 @@ typedef enum { TEXTTO_TABLE COUNT_TT } teTextTo; #undef _TT_ typedef struct { - tCC* pzStr; - tCC* pzReq; - tCC* pzNum; - tCC* pzFile; - tCC* pzKey; - tCC* pzKeyL; - tCC* pzBool; - tCC* pzNest; - tCC* pzOpt; - tCC* pzNo; - tCC* pzBrk; - tCC* pzNoF; - tCC* pzSpc; - tCC* pzOptFmt; - tCC* pzTime; + char const * pzStr; + char const * pzReq; + char const * pzNum; + char const * pzFile; + char const * pzKey; + char const * pzKeyL; + char const * pzBool; + char const * pzNest; + char const * pzOpt; + char const * pzNo; + char const * pzBrk; + char const * pzNoF; + char const * pzSpc; + char const * pzOptFmt; + char const * pzTime; } arg_types_t; #define AGALOC(c, w) ao_malloc((size_t)c) @@ -353,7 +353,8 @@ extern char* strrchr(char const *s, int c); /* * File pointer for usage output */ -extern FILE* option_usage_fp; +FILE * option_usage_fp; +static char const * program_pkgdatadir; extern tOptProc optionPrintVersion, optionPagedUsage, optionLoadOpt; diff --git a/sntp/libopts/autoopts/options.h b/sntp/libopts/autoopts/options.h index e7a121eca..a03e271c4 100644 --- a/sntp/libopts/autoopts/options.h +++ b/sntp/libopts/autoopts/options.h @@ -2,7 +2,7 @@ * * DO NOT EDIT THIS FILE (options.h) * - * It has been AutoGen-ed December 16, 2010 at 03:59:18 PM by AutoGen 5.11.6pre3 + * It has been AutoGen-ed December 18, 2010 at 12:13:34 PM by AutoGen 5.11.6pre4 * From the definitions funcs.def * and the template file options_h * @@ -65,8 +65,8 @@ * See the relevant generated header file to determine which and what * values for "opt_name" are available. */ -#define OPTIONS_STRUCT_VERSION 135173 -#define OPTIONS_VERSION_STRING "33:5:8" +#define OPTIONS_STRUCT_VERSION 139264 +#define OPTIONS_VERSION_STRING "34:0:9" #define OPTIONS_MINIMUM_VERSION 102400 #define OPTIONS_MIN_VER_STRING "25:0:0" @@ -454,6 +454,7 @@ struct options { /* PUBLIC: */ optArgBucket_t const * const originalOptArgArray; void * const * const originalOptArgCookie; + char const * const pzPkgDataDir; }; /* @@ -464,6 +465,10 @@ struct options { #define HAS_originalOptArgArray(_opt) \ ((_opt)->structVersion >= originalOptArgArray_STRUCT_VERSION) +#define pzPkgDataDir_STRUCT_VERSION 139264 /* AO_CURRENT = 34 */ +#define HAS_pzPkgDataDir(_opt) \ + ((_opt)->structVersion >= pzPkgDataDir_STRUCT_VERSION) + /* * "token list" structure returned by "string_tokenize()" */ @@ -677,7 +682,7 @@ extern void optionFree(tOptions*); extern const tOptionValue* optionGetValue(const tOptionValue*, char const*); -/* From: load.c line 482 +/* From: load.c line 478 * * optionLoadLine - process a string for an option name and value * @@ -720,7 +725,7 @@ extern void optionLoadLine(tOptions*, char const*); extern const tOptionValue* optionNextValue(const tOptionValue*, const tOptionValue*); -/* From: usage.c line 204 +/* From: usage.c line 195 * * optionOnlyUsage - Print usage text for just the options * @@ -735,7 +740,7 @@ extern const tOptionValue* optionNextValue(const tOptionValue*, const tOptionVal extern void optionOnlyUsage(tOptions*, int); -/* From: autoopts.c line 1059 +/* From: autoopts.c line 1071 * * optionProcess - this is the main option processing routine * diff --git a/sntp/libopts/autoopts/usage-txt.h b/sntp/libopts/autoopts/usage-txt.h index 3c77e40ef..c797eb7a7 100644 --- a/sntp/libopts/autoopts/usage-txt.h +++ b/sntp/libopts/autoopts/usage-txt.h @@ -2,12 +2,12 @@ * * DO NOT EDIT THIS FILE (usage-txt.h) * - * It has been AutoGen-ed December 16, 2010 at 03:59:16 PM by AutoGen 5.11.6pre3 + * It has been AutoGen-ed December 18, 2010 at 12:13:32 PM by AutoGen 5.11.6pre4 * From the definitions usage-txt.def * and the template file usage-txt.tpl * * This file handles all the bookkeeping required for tracking all the little - * tiny strings used by the AutoOpts library. There are 137 + * tiny strings used by the AutoOpts library. There are 140 * of them. This is not versioned because it is entirely internal to the * library and accessed by client code only in a very well-controlled way: * they may substitute translated strings using a procedure that steps through @@ -44,7 +44,7 @@ typedef struct { char* utpz_GnuTimeArg; char* utpz_GnuNumArg; char* utpz_GnuStrArg; - cch_t* apz_str[ 130 ]; + cch_t* apz_str[ 133 ]; } usage_text_t; /* @@ -57,143 +57,146 @@ extern usage_text_t option_usage_text; /* * Provide a mapping from a short name to fields in this structure. */ -#define zAO_Bad (option_usage_text.apz_str[ 0]) -#define zAO_Big (option_usage_text.apz_str[ 1]) -#define zAO_Err (option_usage_text.apz_str[ 2]) -#define zAO_Sml (option_usage_text.apz_str[ 3]) -#define zAO_Ver (option_usage_text.apz_str[ 4]) -#define zAO_Woops (option_usage_text.apz_str[ 5]) -#define zAliasRange (option_usage_text.apz_str[ 6]) -#define zAll (option_usage_text.apz_str[ 7]) -#define zAlt (option_usage_text.apz_str[ 8]) -#define zAmbigKey (option_usage_text.apz_str[ 9]) -#define zAmbigOptStr (option_usage_text.apz_str[ 10]) -#define zArgsMust (option_usage_text.apz_str[ 11]) -#define zAtMost (option_usage_text.apz_str[ 12]) -#define zAuto (option_usage_text.apz_str[ 13]) -#define zBadPipe (option_usage_text.apz_str[ 14]) -#define zBadVerArg (option_usage_text.apz_str[ 15]) -#define zCantFmt (option_usage_text.apz_str[ 16]) -#define zCantSave (option_usage_text.apz_str[ 17]) -#define zCfgAO_Flags (option_usage_text.apz_str[ 18]) -#define zCfgProg (option_usage_text.apz_str[ 19]) -#define zDefaultOpt (option_usage_text.apz_str[ 20]) -#define zDis (option_usage_text.apz_str[ 21]) -#define zDisabledErr (option_usage_text.apz_str[ 22]) -#define zDisabledOpt (option_usage_text.apz_str[ 23]) -#define zDisabledWhy (option_usage_text.apz_str[ 24]) -#define zEnab (option_usage_text.apz_str[ 25]) -#define zEquiv (option_usage_text.apz_str[ 26]) -#define zErrOnly (option_usage_text.apz_str[ 27]) -#define zExamineFmt (option_usage_text.apz_str[ 28]) -#define zFiveSpaces (option_usage_text.apz_str[ 29]) -#define zFlagOkay (option_usage_text.apz_str[ 30]) -#define zFmtFmt (option_usage_text.apz_str[ 31]) -#define zForkFail (option_usage_text.apz_str[ 32]) -#define zFreopenFail (option_usage_text.apz_str[ 33]) -#define zFSErrOptLoad (option_usage_text.apz_str[ 34]) -#define zFSErrReadFile (option_usage_text.apz_str[ 35]) -#define zFSOptError (option_usage_text.apz_str[ 36]) -#define zFSOptErrMayExist (option_usage_text.apz_str[ 37]) -#define zFSOptErrMustExist (option_usage_text.apz_str[ 38]) -#define zFSOptErrNoExist (option_usage_text.apz_str[ 39]) -#define zFSOptErrOpen (option_usage_text.apz_str[ 40]) -#define zFSOptErrFopen (option_usage_text.apz_str[ 41]) -#define zFileCannotExist (option_usage_text.apz_str[ 42]) -#define zFileMustExist (option_usage_text.apz_str[ 43]) -#define zGenshell (option_usage_text.apz_str[ 44]) +#define zAO_Alloc (option_usage_text.apz_str[ 0]) +#define zAO_Bad (option_usage_text.apz_str[ 1]) +#define zAO_Big (option_usage_text.apz_str[ 2]) +#define zAO_Err (option_usage_text.apz_str[ 3]) +#define zAO_Realloc (option_usage_text.apz_str[ 4]) +#define zAO_Sml (option_usage_text.apz_str[ 5]) +#define zAO_Strdup (option_usage_text.apz_str[ 6]) +#define zAO_Ver (option_usage_text.apz_str[ 7]) +#define zAO_Woops (option_usage_text.apz_str[ 8]) +#define zAliasRange (option_usage_text.apz_str[ 9]) +#define zAll (option_usage_text.apz_str[ 10]) +#define zAlt (option_usage_text.apz_str[ 11]) +#define zAmbigKey (option_usage_text.apz_str[ 12]) +#define zAmbigOptStr (option_usage_text.apz_str[ 13]) +#define zArgsMust (option_usage_text.apz_str[ 14]) +#define zAtMost (option_usage_text.apz_str[ 15]) +#define zAuto (option_usage_text.apz_str[ 16]) +#define zBadPipe (option_usage_text.apz_str[ 17]) +#define zBadVerArg (option_usage_text.apz_str[ 18]) +#define zCantFmt (option_usage_text.apz_str[ 19]) +#define zCantSave (option_usage_text.apz_str[ 20]) +#define zCfgAO_Flags (option_usage_text.apz_str[ 21]) +#define zCfgProg (option_usage_text.apz_str[ 22]) +#define zDefaultOpt (option_usage_text.apz_str[ 23]) +#define zDis (option_usage_text.apz_str[ 24]) +#define zDisabledErr (option_usage_text.apz_str[ 25]) +#define zDisabledOpt (option_usage_text.apz_str[ 26]) +#define zDisabledWhy (option_usage_text.apz_str[ 27]) +#define zEnab (option_usage_text.apz_str[ 28]) +#define zEquiv (option_usage_text.apz_str[ 29]) +#define zErrOnly (option_usage_text.apz_str[ 30]) +#define zExamineFmt (option_usage_text.apz_str[ 31]) +#define zFiveSpaces (option_usage_text.apz_str[ 32]) +#define zFlagOkay (option_usage_text.apz_str[ 33]) +#define zFmtFmt (option_usage_text.apz_str[ 34]) +#define zForkFail (option_usage_text.apz_str[ 35]) +#define zFreopenFail (option_usage_text.apz_str[ 36]) +#define zFSErrOptLoad (option_usage_text.apz_str[ 37]) +#define zFSErrReadFile (option_usage_text.apz_str[ 38]) +#define zFSOptError (option_usage_text.apz_str[ 39]) +#define zFSOptErrMayExist (option_usage_text.apz_str[ 40]) +#define zFSOptErrMustExist (option_usage_text.apz_str[ 41]) +#define zFSOptErrNoExist (option_usage_text.apz_str[ 42]) +#define zFSOptErrOpen (option_usage_text.apz_str[ 43]) +#define zFSOptErrFopen (option_usage_text.apz_str[ 44]) +#define zFileCannotExist (option_usage_text.apz_str[ 45]) +#define zFileMustExist (option_usage_text.apz_str[ 46]) +#define zGenshell (option_usage_text.apz_str[ 47]) #define zGnuBoolArg (option_usage_text.utpz_GnuBoolArg) -#define zGnuBreak (option_usage_text.apz_str[ 45]) +#define zGnuBreak (option_usage_text.apz_str[ 48]) #define zGnuKeyArg (option_usage_text.utpz_GnuKeyArg) #define zGnuFileArg (option_usage_text.utpz_GnuFileArg) #define zGnuKeyLArg (option_usage_text.utpz_GnuKeyLArg) #define zGnuTimeArg (option_usage_text.utpz_GnuTimeArg) -#define zGnuNestArg (option_usage_text.apz_str[ 46]) +#define zGnuNestArg (option_usage_text.apz_str[ 49]) #define zGnuNumArg (option_usage_text.utpz_GnuNumArg) -#define zGnuOptArg (option_usage_text.apz_str[ 47]) -#define zGnuOptFmt (option_usage_text.apz_str[ 48]) +#define zGnuOptArg (option_usage_text.apz_str[ 50]) +#define zGnuOptFmt (option_usage_text.apz_str[ 51]) #define zGnuStrArg (option_usage_text.utpz_GnuStrArg) -#define zIllOptChr (option_usage_text.apz_str[ 49]) -#define zIllOptStr (option_usage_text.apz_str[ 50]) -#define zIllegal (option_usage_text.apz_str[ 51]) -#define zIntRange (option_usage_text.apz_str[ 52]) -#define zInvalOptDesc (option_usage_text.apz_str[ 53]) -#define zLowerBits (option_usage_text.apz_str[ 54]) -#define zMembers (option_usage_text.apz_str[ 55]) -#define zMisArg (option_usage_text.apz_str[ 56]) -#define zMultiEquiv (option_usage_text.apz_str[ 57]) -#define zMust (option_usage_text.apz_str[ 58]) -#define zNeedOne (option_usage_text.apz_str[ 59]) -#define zNoArg (option_usage_text.apz_str[ 60]) -#define zNoArgs (option_usage_text.apz_str[ 61]) -#define zNoCreat (option_usage_text.apz_str[ 62]) -#define zNoFlags (option_usage_text.apz_str[ 63]) -#define zNoKey (option_usage_text.apz_str[ 64]) -#define zNoLim (option_usage_text.apz_str[ 65]) -#define zNoPreset (option_usage_text.apz_str[ 66]) -#define zNoResetArg (option_usage_text.apz_str[ 67]) -#define zNoRq_NoShrtTtl (option_usage_text.apz_str[ 68]) -#define zNoRq_ShrtTtl (option_usage_text.apz_str[ 69]) -#define zNoStat (option_usage_text.apz_str[ 70]) -#define zNoState (option_usage_text.apz_str[ 71]) -#define zNone (option_usage_text.apz_str[ 72]) -#define zNotDef (option_usage_text.apz_str[ 73]) -#define zNotCmdOpt (option_usage_text.apz_str[ 74]) -#define zNotEnough (option_usage_text.apz_str[ 75]) -#define zNotFile (option_usage_text.apz_str[ 76]) -#define zNotNumber (option_usage_text.apz_str[ 77]) -#define zNrmOptFmt (option_usage_text.apz_str[ 78]) -#define zNumberOpt (option_usage_text.apz_str[ 79]) -#define zOneSpace (option_usage_text.apz_str[ 80]) -#define zOnlyOne (option_usage_text.apz_str[ 81]) -#define zOptsOnly (option_usage_text.apz_str[ 82]) -#define zOutputFail (option_usage_text.apz_str[ 83]) -#define zPathFmt (option_usage_text.apz_str[ 84]) -#define zPlsSendBugs (option_usage_text.apz_str[ 85]) -#define zPreset (option_usage_text.apz_str[ 86]) -#define zPresetFile (option_usage_text.apz_str[ 87]) -#define zPresetIntro (option_usage_text.apz_str[ 88]) -#define zProhib (option_usage_text.apz_str[ 89]) -#define zReorder (option_usage_text.apz_str[ 90]) -#define zRange (option_usage_text.apz_str[ 91]) -#define zRangeAbove (option_usage_text.apz_str[ 92]) -#define zRangeLie (option_usage_text.apz_str[ 93]) -#define zRangeBadLie (option_usage_text.apz_str[ 94]) -#define zRangeOnly (option_usage_text.apz_str[ 95]) -#define zRangeOr (option_usage_text.apz_str[ 96]) -#define zRangeErr (option_usage_text.apz_str[ 97]) -#define zRangeExact (option_usage_text.apz_str[ 98]) -#define zRangeScaled (option_usage_text.apz_str[ 99]) -#define zRangeUpto (option_usage_text.apz_str[100]) -#define zResetNotConfig (option_usage_text.apz_str[101]) -#define zReqFmt (option_usage_text.apz_str[102]) -#define zReqOptFmt (option_usage_text.apz_str[103]) -#define zReqThese (option_usage_text.apz_str[104]) -#define zReq_NoShrtTtl (option_usage_text.apz_str[105]) -#define zReq_ShrtTtl (option_usage_text.apz_str[106]) -#define zSepChars (option_usage_text.apz_str[107]) -#define zSetMemberSettings (option_usage_text.apz_str[108]) -#define zShrtGnuOptFmt (option_usage_text.apz_str[109]) -#define zSixSpaces (option_usage_text.apz_str[110]) -#define zStdBoolArg (option_usage_text.apz_str[111]) -#define zStdBreak (option_usage_text.apz_str[112]) -#define zStdFileArg (option_usage_text.apz_str[113]) -#define zStdKeyArg (option_usage_text.apz_str[114]) -#define zStdKeyLArg (option_usage_text.apz_str[115]) -#define zStdTimeArg (option_usage_text.apz_str[116]) -#define zStdNestArg (option_usage_text.apz_str[117]) -#define zStdNoArg (option_usage_text.apz_str[118]) -#define zStdNumArg (option_usage_text.apz_str[119]) -#define zStdOptArg (option_usage_text.apz_str[120]) -#define zStdReqArg (option_usage_text.apz_str[121]) -#define zStdStrArg (option_usage_text.apz_str[122]) -#define zTabHyp (option_usage_text.apz_str[123]) -#define zTabHypAnd (option_usage_text.apz_str[124]) -#define zTabout (option_usage_text.apz_str[125]) -#define zThreeSpaces (option_usage_text.apz_str[126]) -#define zTwoSpaces (option_usage_text.apz_str[127]) -#define zUpTo (option_usage_text.apz_str[128]) -#define zValidKeys (option_usage_text.apz_str[129]) +#define zIllOptChr (option_usage_text.apz_str[ 52]) +#define zIllOptStr (option_usage_text.apz_str[ 53]) +#define zIllegal (option_usage_text.apz_str[ 54]) +#define zIntRange (option_usage_text.apz_str[ 55]) +#define zInvalOptDesc (option_usage_text.apz_str[ 56]) +#define zLowerBits (option_usage_text.apz_str[ 57]) +#define zMembers (option_usage_text.apz_str[ 58]) +#define zMisArg (option_usage_text.apz_str[ 59]) +#define zMultiEquiv (option_usage_text.apz_str[ 60]) +#define zMust (option_usage_text.apz_str[ 61]) +#define zNeedOne (option_usage_text.apz_str[ 62]) +#define zNoArg (option_usage_text.apz_str[ 63]) +#define zNoArgs (option_usage_text.apz_str[ 64]) +#define zNoCreat (option_usage_text.apz_str[ 65]) +#define zNoFlags (option_usage_text.apz_str[ 66]) +#define zNoKey (option_usage_text.apz_str[ 67]) +#define zNoLim (option_usage_text.apz_str[ 68]) +#define zNoPreset (option_usage_text.apz_str[ 69]) +#define zNoResetArg (option_usage_text.apz_str[ 70]) +#define zNoRq_NoShrtTtl (option_usage_text.apz_str[ 71]) +#define zNoRq_ShrtTtl (option_usage_text.apz_str[ 72]) +#define zNoStat (option_usage_text.apz_str[ 73]) +#define zNoState (option_usage_text.apz_str[ 74]) +#define zNone (option_usage_text.apz_str[ 75]) +#define zNotDef (option_usage_text.apz_str[ 76]) +#define zNotCmdOpt (option_usage_text.apz_str[ 77]) +#define zNotEnough (option_usage_text.apz_str[ 78]) +#define zNotFile (option_usage_text.apz_str[ 79]) +#define zNotNumber (option_usage_text.apz_str[ 80]) +#define zNrmOptFmt (option_usage_text.apz_str[ 81]) +#define zNumberOpt (option_usage_text.apz_str[ 82]) +#define zOneSpace (option_usage_text.apz_str[ 83]) +#define zOnlyOne (option_usage_text.apz_str[ 84]) +#define zOptsOnly (option_usage_text.apz_str[ 85]) +#define zOutputFail (option_usage_text.apz_str[ 86]) +#define zPathFmt (option_usage_text.apz_str[ 87]) +#define zPlsSendBugs (option_usage_text.apz_str[ 88]) +#define zPreset (option_usage_text.apz_str[ 89]) +#define zPresetFile (option_usage_text.apz_str[ 90]) +#define zPresetIntro (option_usage_text.apz_str[ 91]) +#define zProhib (option_usage_text.apz_str[ 92]) +#define zReorder (option_usage_text.apz_str[ 93]) +#define zRange (option_usage_text.apz_str[ 94]) +#define zRangeAbove (option_usage_text.apz_str[ 95]) +#define zRangeLie (option_usage_text.apz_str[ 96]) +#define zRangeBadLie (option_usage_text.apz_str[ 97]) +#define zRangeOnly (option_usage_text.apz_str[ 98]) +#define zRangeOr (option_usage_text.apz_str[ 99]) +#define zRangeErr (option_usage_text.apz_str[100]) +#define zRangeExact (option_usage_text.apz_str[101]) +#define zRangeScaled (option_usage_text.apz_str[102]) +#define zRangeUpto (option_usage_text.apz_str[103]) +#define zResetNotConfig (option_usage_text.apz_str[104]) +#define zReqFmt (option_usage_text.apz_str[105]) +#define zReqOptFmt (option_usage_text.apz_str[106]) +#define zReqThese (option_usage_text.apz_str[107]) +#define zReq_NoShrtTtl (option_usage_text.apz_str[108]) +#define zReq_ShrtTtl (option_usage_text.apz_str[109]) +#define zSepChars (option_usage_text.apz_str[110]) +#define zSetMemberSettings (option_usage_text.apz_str[111]) +#define zShrtGnuOptFmt (option_usage_text.apz_str[112]) +#define zSixSpaces (option_usage_text.apz_str[113]) +#define zStdBoolArg (option_usage_text.apz_str[114]) +#define zStdBreak (option_usage_text.apz_str[115]) +#define zStdFileArg (option_usage_text.apz_str[116]) +#define zStdKeyArg (option_usage_text.apz_str[117]) +#define zStdKeyLArg (option_usage_text.apz_str[118]) +#define zStdTimeArg (option_usage_text.apz_str[119]) +#define zStdNestArg (option_usage_text.apz_str[120]) +#define zStdNoArg (option_usage_text.apz_str[121]) +#define zStdNumArg (option_usage_text.apz_str[122]) +#define zStdOptArg (option_usage_text.apz_str[123]) +#define zStdReqArg (option_usage_text.apz_str[124]) +#define zStdStrArg (option_usage_text.apz_str[125]) +#define zTabHyp (option_usage_text.apz_str[126]) +#define zTabHypAnd (option_usage_text.apz_str[127]) +#define zTabout (option_usage_text.apz_str[128]) +#define zThreeSpaces (option_usage_text.apz_str[129]) +#define zTwoSpaces (option_usage_text.apz_str[130]) +#define zUpTo (option_usage_text.apz_str[131]) +#define zValidKeys (option_usage_text.apz_str[132]) /* * First, set up the strings. Some of these are writable. These are all in @@ -208,12 +211,15 @@ extern usage_text_t option_usage_text; static char eng_zGnuTimeArg[] = "=Tim"; static char eng_zGnuNumArg[] = "=num"; static char eng_zGnuStrArg[] = "=str"; -static char const usage_txt[4230] = +static char const usage_txt[4326] = + "malloc of %d bytes failed\n\0" "AutoOpts function called without option descriptor\n\0" "\tThis exceeds the compiled library version: \0" "Automated Options Processing Error!\n" "\t%s called AutoOpts function with structure version %d:%d:%d.\n\0" + "realloc of %d bytes at 0x%p failed\n\0" "\tThis is less than the minimum library version: \0" + "strdup of %d byte string failed\n\0" "Automated Options version %s\n" "\tcopyright (c) 1999-2010 by Bruce Korb - all rights reserved\n\0" "AutoOpts lib error: defaulted to option with optional arg\n\0" @@ -365,43 +371,44 @@ static char const usage_txt[4230] = * Aren't you glad you don't maintain this by hand? */ usage_text_t option_usage_text = { - 137, + 140, eng_zGnuBoolArg, eng_zGnuKeyArg, eng_zGnuFileArg, eng_zGnuKeyLArg, eng_zGnuTimeArg, eng_zGnuNumArg, eng_zGnuStrArg, { - usage_txt + 0, usage_txt + 52, usage_txt + 98, usage_txt + 197, - usage_txt + 247, usage_txt + 338, usage_txt + 397, usage_txt + 447, - usage_txt + 451, usage_txt + 478, usage_txt + 527, usage_txt + 555, - usage_txt + 592, usage_txt + 617, usage_txt + 643, usage_txt + 683, - usage_txt + 820, usage_txt + 868, usage_txt + 922, usage_txt + 935, - usage_txt + 943, usage_txt + 985, usage_txt +1009, usage_txt +1049, - usage_txt +1064, usage_txt +1094, usage_txt +1120, usage_txt +1133, - usage_txt +1147, usage_txt +1194, usage_txt +1200, usage_txt +1303, - usage_txt +1315, usage_txt +1366, usage_txt +1395, usage_txt +1446, - usage_txt +1480, usage_txt +1521, usage_txt +1544, usage_txt +1570, - usage_txt +1601, usage_txt +1615, usage_txt +1630, usage_txt +1661, - usage_txt +1688, usage_txt +1794, usage_txt +1800, usage_txt +1806, - usage_txt +1813, usage_txt +1824, usage_txt +1850, usage_txt +1876, - usage_txt +1884, usage_txt +1920, usage_txt +1971, usage_txt +2027, - usage_txt +2061, usage_txt +2099, usage_txt +2164, usage_txt +2207, - usage_txt +2242, usage_txt +2283, usage_txt +2323, usage_txt +2350, - usage_txt +2417, usage_txt +2465, usage_txt +2498, usage_txt +2523, - usage_txt +2571, usage_txt +2606, usage_txt +2644, usage_txt +2671, - usage_txt +2720, usage_txt +2725, usage_txt +2743, usage_txt +2778, - usage_txt +2822, usage_txt +2876, usage_txt +2922, usage_txt +2930, - usage_txt +2978, usage_txt +2980, usage_txt +3005, usage_txt +3039, - usage_txt +3068, usage_txt +3087, usage_txt +3121, usage_txt +3157, - usage_txt +3195, usage_txt +3251, usage_txt +3277, usage_txt +3343, - usage_txt +3356, usage_txt +3387, usage_txt +3424, usage_txt +3470, - usage_txt +3486, usage_txt +3492, usage_txt +3544, usage_txt +3558, - usage_txt +3604, usage_txt +3632, usage_txt +3677, usage_txt +3719, - usage_txt +3733, usage_txt +3758, usage_txt +3798, usage_txt +3841, - usage_txt +3845, usage_txt +4064, usage_txt +4067, usage_txt +4074, - usage_txt +4078, usage_txt +4086, usage_txt +4090, usage_txt +4094, - usage_txt +4098, usage_txt +4102, usage_txt +4106, usage_txt +4110, - usage_txt +4114, usage_txt +4118, usage_txt +4122, usage_txt +4126, - usage_txt +4133, usage_txt +4145, usage_txt +4153, usage_txt +4157, - usage_txt +4160, usage_txt +4193 + usage_txt + 0, usage_txt + 27, usage_txt + 79, usage_txt + 125, + usage_txt + 224, usage_txt + 260, usage_txt + 310, usage_txt + 343, + usage_txt + 434, usage_txt + 493, usage_txt + 543, usage_txt + 547, + usage_txt + 574, usage_txt + 623, usage_txt + 651, usage_txt + 688, + usage_txt + 713, usage_txt + 739, usage_txt + 779, usage_txt + 916, + usage_txt + 964, usage_txt +1018, usage_txt +1031, usage_txt +1039, + usage_txt +1081, usage_txt +1105, usage_txt +1145, usage_txt +1160, + usage_txt +1190, usage_txt +1216, usage_txt +1229, usage_txt +1243, + usage_txt +1290, usage_txt +1296, usage_txt +1399, usage_txt +1411, + usage_txt +1462, usage_txt +1491, usage_txt +1542, usage_txt +1576, + usage_txt +1617, usage_txt +1640, usage_txt +1666, usage_txt +1697, + usage_txt +1711, usage_txt +1726, usage_txt +1757, usage_txt +1784, + usage_txt +1890, usage_txt +1896, usage_txt +1902, usage_txt +1909, + usage_txt +1920, usage_txt +1946, usage_txt +1972, usage_txt +1980, + usage_txt +2016, usage_txt +2067, usage_txt +2123, usage_txt +2157, + usage_txt +2195, usage_txt +2260, usage_txt +2303, usage_txt +2338, + usage_txt +2379, usage_txt +2419, usage_txt +2446, usage_txt +2513, + usage_txt +2561, usage_txt +2594, usage_txt +2619, usage_txt +2667, + usage_txt +2702, usage_txt +2740, usage_txt +2767, usage_txt +2816, + usage_txt +2821, usage_txt +2839, usage_txt +2874, usage_txt +2918, + usage_txt +2972, usage_txt +3018, usage_txt +3026, usage_txt +3074, + usage_txt +3076, usage_txt +3101, usage_txt +3135, usage_txt +3164, + usage_txt +3183, usage_txt +3217, usage_txt +3253, usage_txt +3291, + usage_txt +3347, usage_txt +3373, usage_txt +3439, usage_txt +3452, + usage_txt +3483, usage_txt +3520, usage_txt +3566, usage_txt +3582, + usage_txt +3588, usage_txt +3640, usage_txt +3654, usage_txt +3700, + usage_txt +3728, usage_txt +3773, usage_txt +3815, usage_txt +3829, + usage_txt +3854, usage_txt +3894, usage_txt +3937, usage_txt +3941, + usage_txt +4160, usage_txt +4163, usage_txt +4170, usage_txt +4174, + usage_txt +4182, usage_txt +4186, usage_txt +4190, usage_txt +4194, + usage_txt +4198, usage_txt +4202, usage_txt +4206, usage_txt +4210, + usage_txt +4214, usage_txt +4218, usage_txt +4222, usage_txt +4229, + usage_txt +4241, usage_txt +4249, usage_txt +4253, usage_txt +4256, + usage_txt +4289 } }; diff --git a/sntp/libopts/genshell.c b/sntp/libopts/genshell.c index c1deb9621..f61d025ee 100644 --- a/sntp/libopts/genshell.c +++ b/sntp/libopts/genshell.c @@ -2,11 +2,11 @@ * * DO NOT EDIT THIS FILE (genshell.c) * - * It has been AutoGen-ed December 16, 2010 at 03:59:15 PM by AutoGen 5.11.6pre3 + * It has been AutoGen-ed December 18, 2010 at 12:13:31 PM by AutoGen 5.11.6pre4 * From the definitions genshell.def * and the template file options * - * Generated from AutoOpts 33:5:8 templates. + * Generated from AutoOpts 34:0:9 templates. * * AutoOpts is a copyrighted work. This source file is not encumbered * by AutoOpts licensing, but is provided under the licensing terms chosen @@ -201,24 +201,24 @@ static tOptDesc optDesc[ OPTION_CT ] = { * * Define the Genshellopt Option Environment */ -tSCC zPROGNAME[] = "GENSHELLOPT"; -tSCC zUsageTitle[] = +static char const zPROGNAME[12] = "GENSHELLOPT"; +static char const zUsageTitle[121] = "genshellopt - Generate Shell Option Processing Script - Ver. 1\n\ USAGE: %s [ - [] | --[{=| }] ]...\n"; #define zRcName NULL #define apzHomeList NULL -tSCC zBugsAddr[] = "autogen-users@lists.sourceforge.net"; -tSCC zExplain[] = "\n\ +static char const zBugsAddr[36] = "autogen-users@lists.sourceforge.net"; +static char const zExplain[] = "\n\ Note that `shell' is only useful if the output file does not already\n\ exist. If it does, then the shell name and optional first argument\n\ will be extracted from the script file.\n"; -tSCC zDetail[] = "\n\ +static char const zDetail[234] = "\n\ If the script file already exists and contains Automated Option Processing\n\ text, the second line of the file through the ending tag will be replaced\n\ by the newly generated text. The first `#!' line will be regenerated.\n"; -tSCC zFullVersion[] = GENSHELLOPT_FULL_VERSION; -/* extracted from /old-home/bkorb/ag/ag/autoopts/tpl/optcode.tpl near line 493 */ +static char const zFullVersion[] = GENSHELLOPT_FULL_VERSION; +/* extracted from /old-home/bkorb/ag/ag/autoopts/tpl/optcode.tpl near line 504 */ #if defined(ENABLE_NLS) # define OPTPROC_BASE OPTPROC_TRANSLATE @@ -231,6 +231,10 @@ tSCC zFullVersion[] = GENSHELLOPT_FULL_VERSION; #define genshellopt_full_usage NULL #define genshellopt_short_usage NULL +#ifndef PKGDATADIR +# define PKGDATADIR "" +#endif + tOptions genshelloptOptions = { OPTIONS_STRUCT_VERSION, 0, NULL, /* original argc + argv */ @@ -260,7 +264,8 @@ tOptions genshelloptOptions = { }, 5 /* full option count */, 2 /* user option count */, genshellopt_full_usage, genshellopt_short_usage, - NULL, NULL + NULL, NULL, + PKGDATADIR }; /* @@ -274,7 +279,7 @@ doUsageOpt( (void)pOptions; USAGE(EXIT_SUCCESS); } -/* extracted from /old-home/bkorb/ag/ag/autoopts/tpl/optcode.tpl near line 626 */ +/* extracted from /old-home/bkorb/ag/ag/autoopts/tpl/optcode.tpl near line 641 */ #if ENABLE_NLS #include diff --git a/sntp/libopts/genshell.h b/sntp/libopts/genshell.h index 77397aedd..90e415a47 100644 --- a/sntp/libopts/genshell.h +++ b/sntp/libopts/genshell.h @@ -2,11 +2,11 @@ * * DO NOT EDIT THIS FILE (genshell.h) * - * It has been AutoGen-ed December 16, 2010 at 03:59:15 PM by AutoGen 5.11.6pre3 + * It has been AutoGen-ed December 18, 2010 at 12:13:31 PM by AutoGen 5.11.6pre4 * From the definitions genshell.def * and the template file options * - * Generated from AutoOpts 33:5:8 templates. + * Generated from AutoOpts 34:0:9 templates. * * AutoOpts is a copyrighted work. This header file is not encumbered * by AutoOpts licensing, but is provided under the licensing terms chosen @@ -50,7 +50,7 @@ * tolerable version is at least as old as what was current when the header * template was released. */ -#define AO_TEMPLATE_VERSION 135173 +#define AO_TEMPLATE_VERSION 139264 #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \ || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION) # error option template version mismatches autoopts/options.h header diff --git a/sntp/libopts/load.c b/sntp/libopts/load.c index 69bb1bb40..204209348 100644 --- a/sntp/libopts/load.c +++ b/sntp/libopts/load.c @@ -1,7 +1,7 @@ /** * \file load.c - * Time-stamp: "2010-12-06 14:03:01 bkorb" + * Time-stamp: "2010-12-18 11:46:07 bkorb" * * This file contains the routines that deal with processing text strings * for options, either from a NUL-terminated string passed in or from an @@ -28,8 +28,6 @@ * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd */ -tOptionLoadMode option_load_mode = OPTION_LOAD_UNCOOKED; - /* = = = START-STATIC-FORWARD = = = */ static ag_bool insertProgramPath(char * pzBuf, int bufSize, char const * pzName, @@ -61,8 +59,8 @@ assembleArgValue(char* pzTxt, tOptionLoadMode mode); * * doc: * - * This routine will copy the @code{pzName} input name into the @code{pzBuf} - * output buffer, carefully not exceeding @code{bufSize} bytes. If the + * This routine will copy the @code{pzName} input name into the + * @code{pzBuf} output buffer, not exceeding @code{bufSize} bytes. If the * first character of the input name is a @code{'$'} character, then there * is special handling: * @* @@ -98,17 +96,9 @@ ag_bool optionMakePath(char * pzBuf, int bufSize, char const * pzName, char const * pzProgPath) { - size_t name_len = strlen(pzName); - -# ifndef PKGDATADIR -# define PKGDATADIR "" -# endif - - static char const pkgdatadir[] = PKGDATADIR; - - ag_bool res = AG_TRUE; + size_t name_len = strlen(pzName); - if (bufSize <= name_len) + if ((bufSize <= name_len) || (name_len == 0)) return AG_FALSE; /* @@ -137,46 +127,52 @@ optionMakePath(char * pzBuf, int bufSize, char const * pzName, return AG_FALSE; case '$': - res = insertProgramPath(pzBuf, bufSize, pzName, pzProgPath); + if (! insertProgramPath(pzBuf, bufSize, pzName, pzProgPath)) + return AG_FALSE; break; case '@': - if (pkgdatadir[0] == NUL) + if (program_pkgdatadir[0] == NUL) return AG_FALSE; - if (name_len + sizeof (pkgdatadir) > bufSize) + if (snprintf(pzBuf, bufSize, "%s%s", program_pkgdatadir, pzName + 2) + >= bufSize) return AG_FALSE; - - strcpy(pzBuf, pkgdatadir); - strcpy(pzBuf + sizeof(pkgdatadir) - 1, pzName + 2); break; default: - res = insertEnvVal(pzBuf, bufSize, pzName, pzProgPath); + if (! insertEnvVal(pzBuf, bufSize, pzName, pzProgPath)) + return AG_FALSE; } - if (! res) - return AG_FALSE; - #if defined(HAVE_CANONICALIZE_FILE_NAME) { - char* pz = canonicalize_file_name(pzBuf); + char * pz = canonicalize_file_name(pzBuf); if (pz == NULL) return AG_FALSE; - if (strlen(pz) < bufSize) - strcpy(pzBuf, pz); + + name_len = strlen(pz); + if (name_len >= bufSize) { + free(pz); + return AG_FALSE; + } + + memcpy(pzBuf, pz, name_len + 1); free(pz); } #elif defined(HAVE_REALPATH) { - char z[ PATH_MAX+1 ]; + char z[PATH_MAX+1]; if (realpath(pzBuf, z) == NULL) return AG_FALSE; - if (strlen(z) < bufSize) - strcpy(pzBuf, z); + name_len = strlen(z); + if (name_len >= bufSize) + return AG_FALSE; + + memcpy(pzBuf, z, name_len + 1); } #endif diff --git a/sntp/libopts/m4/libopts.m4 b/sntp/libopts/m4/libopts.m4 index 7841cf4e7..8ea010ed4 100644 --- a/sntp/libopts/m4/libopts.m4 +++ b/sntp/libopts/m4/libopts.m4 @@ -2,7 +2,7 @@ dnl -*- buffer-read-only: t -*- vi: set ro: dnl dnl DO NOT EDIT THIS FILE (libopts.m4) dnl -dnl It has been AutoGen-ed December 16, 2010 at 03:59:13 PM by AutoGen 5.11.6pre3 +dnl It has been AutoGen-ed December 18, 2010 at 12:13:28 PM by AutoGen 5.11.6pre4 dnl From the definitions libopts.def dnl and the template file conftest.tpl dnl diff --git a/sntp/libopts/proto.h b/sntp/libopts/proto.h index fd19028aa..c18b4f7a1 100644 --- a/sntp/libopts/proto.h +++ b/sntp/libopts/proto.h @@ -1,7 +1,7 @@ /* -*- buffer-read-only: t -*- vi: set ro: * * Prototypes for autoopts - * Generated Thu Dec 16 15:59:23 PST 2010 + * Generated Sat Dec 18 12:13:39 PST 2010 */ #ifndef AUTOOPTS_PROTO_H_GUARD #define AUTOOPTS_PROTO_H_GUARD 1 diff --git a/sntp/libopts/usage.c b/sntp/libopts/usage.c index b0977560c..b65ff135e 100644 --- a/sntp/libopts/usage.c +++ b/sntp/libopts/usage.c @@ -2,7 +2,7 @@ /* * \file usage.c * - * Time-stamp: "2010-11-05 11:41:54 bkorb" + * Time-stamp: "2010-12-18 11:41:41 bkorb" * * This module implements the default usage procedure for * Automated Options. It may be overridden, of course. @@ -37,12 +37,6 @@ #define OPTPROC_L_N_S (OPTPROC_LONGOPT | OPTPROC_SHORTOPT) -static arg_types_t argTypes; - -FILE * option_usage_fp = NULL; -static char zOptFmtLine[ 16 ]; -static ag_bool displayEnum; - /* = = = START-STATIC-FORWARD = = = */ static void set_usage_flags(tOptions * opts, char const * flg_txt); @@ -60,11 +54,8 @@ static void prt_extd_usage(tOptions * pOptions, tOptDesc * pOD, arg_types_t * pAT); static void -prt_ini_list( - char const * const * papz, - ag_bool * pInitIntro, - char const * pzRc, - char const * pzPN ); +prt_ini_list(char const * const * papz, ag_bool * pInitIntro, + char const * pzRc, char const * pzPN); static void prt_preamble(tOptions * pOptions, tOptDesc * pOD, arg_types_t * pAT); @@ -532,13 +523,10 @@ prt_extd_usage(tOptions * pOptions, tOptDesc * pOD, arg_types_t * pAT) * squishy, but important to tell users how to find these files. */ static void -prt_ini_list( - char const * const * papz, - ag_bool * pInitIntro, - char const * pzRc, - char const * pzPN ) +prt_ini_list(char const * const * papz, ag_bool * pInitIntro, + char const * pzRc, char const * pzPN) { - char zPath[ AG_PATH_MAX+1 ]; + char zPath[AG_PATH_MAX+1]; if (papz == NULL) return; @@ -547,13 +535,25 @@ prt_ini_list( *pInitIntro = AG_FALSE; for (;;) { - char const* pzPath = *(papz++); + char const * pzPath = *(papz++); + char const * pzReal = zPath; if (pzPath == NULL) break; - if (optionMakePath(zPath, (int)sizeof(zPath), pzPath, pzPN)) - pzPath = zPath; + /* + * Ignore any invalid paths + */ + if (! optionMakePath(zPath, (int)sizeof(zPath), pzPath, pzPN)) + pzReal = pzPath; + + /* + * Expand paths that are relative to the executable or installation + * directories. Leave alone paths that use environment variables. + */ + else if ((*pzPath == '$') + && ((pzPath[1] == '$') || (pzPath[1] == '@'))) + pzPath = pzReal; /* * Print the name of the "homerc" file. If the "rcfile" name is @@ -567,10 +567,9 @@ prt_ini_list( * IF the "homerc" file is a directory, * then append the "rcfile" name. */ - if ( (stat(pzPath, &sb) == 0) - && S_ISDIR(sb.st_mode)) { + if ((stat(pzReal, &sb) == 0) && S_ISDIR(sb.st_mode)) { fputc(DIRCH, option_usage_fp); - fputs(pzRc, option_usage_fp); + fputs(pzRc, option_usage_fp); } } diff --git a/sntp/libopts/value-type.h b/sntp/libopts/value-type.h index 0b13b2a19..f67a397ec 100644 --- a/sntp/libopts/value-type.h +++ b/sntp/libopts/value-type.h @@ -1,5 +1,5 @@ /* - * Generated header for gperf generated source Thu Dec 16 15:59:15 PST 2010 + * Generated header for gperf generated source Sat Dec 18 12:13:31 PST 2010 * This file enumerates the list of names and declares the * procedure for mapping string names to the enum value. */ diff --git a/sntp/libopts/xat-attribute.h b/sntp/libopts/xat-attribute.h index 28009cd0b..e9360f175 100644 --- a/sntp/libopts/xat-attribute.h +++ b/sntp/libopts/xat-attribute.h @@ -1,5 +1,5 @@ /* - * Generated header for gperf generated source Thu Dec 16 15:59:15 PST 2010 + * Generated header for gperf generated source Sat Dec 18 12:13:30 PST 2010 * This file enumerates the list of names and declares the * procedure for mapping string names to the enum value. */