From: Harlan Stenn Date: Mon, 3 Jul 2006 23:05:18 +0000 (-0400) Subject: Upgrade to libopts-27.3.2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=67dab2eaa59bf75bf4291060694ed2b71f0efd82;p=thirdparty%2Fntp.git Upgrade to libopts-27.3.2 bk: 44a9a2aeMtPyoR7P_cxfQ8yt0ATx_g --- diff --git a/libopts/Makefile.am b/libopts/Makefile.am index ca0f8a676d..6108426441 100644 --- a/libopts/Makefile.am +++ b/libopts/Makefile.am @@ -3,18 +3,18 @@ MAINTAINERCLEANFILES = Makefile.in lib_LTLIBRARIES = libopts.la libopts_la_SOURCES = libopts.c libopts_la_CPPFLAGS = -I$(top_srcdir) -libopts_la_LDFLAGS = -version-info 27:1:2 +libopts_la_LDFLAGS = -version-info 27:3:2 EXTRA_DIST = \ COPYING.lgpl COPYING.mbsd MakeDefs.inc \ README autoopts/options.h autoopts/usage-txt.h \ autoopts.c autoopts.h boolean.c \ compat/compat.h compat/pathfind.c compat/snprintf.c \ - compat/strdup.c configfile.c cook.c \ - enumeration.c environment.c genshell.c \ - genshell.h load.c m4/libopts.m4 \ - m4/liboptschk.m4 makeshell.c nested.c \ - numeric.c pgusage.c proto.h \ - putshell.c restore.c save.c \ - sort.c stack.c streqvcmp.c \ - text_mmap.c tokenize.c usage.c \ - version.c + compat/strdup.c compat/strchr.c configfile.c \ + cook.c enumeration.c environment.c \ + genshell.c genshell.h load.c \ + m4/libopts.m4 m4/liboptschk.m4 makeshell.c \ + nested.c numeric.c pgusage.c \ + proto.h putshell.c restore.c \ + save.c sort.c stack.c \ + streqvcmp.c text_mmap.c tokenize.c \ + usage.c version.c diff --git a/libopts/autoopts.c b/libopts/autoopts.c index 6d88967e48..806d71b9d2 100644 --- a/libopts/autoopts.c +++ b/libopts/autoopts.c @@ -1,7 +1,7 @@ /* - * $Id: autoopts.c,v 4.14 2006/03/25 19:24:56 bkorb Exp $ - * Time-stamp: "2005-10-29 13:19:36 bkorb" + * $Id: autoopts.c,v 4.20 2006/06/24 23:34:51 bkorb Exp $ + * Time-stamp: "2006-07-01 14:41:46 bkorb" * * This file contains all of the routines that must be linked into * an executable to use the generated option processing. The optional @@ -66,6 +66,10 @@ # endif #endif +#ifndef HAVE_STRCHR +# include "compat/strchr.c" +#endif + static const char zNil[] = ""; #define SKIP_RC_FILES(po) \ @@ -350,7 +354,7 @@ longOptionFind( tOptions* pOpts, char* pzOptName, tOptState* pOptState ) * Find the short option descriptor for the current option */ LOCAL tSuccess -shortOptionFind( tOptions* pOpts, tAoUC optValue, tOptState* pOptState ) +shortOptionFind( tOptions* pOpts, uint_t optValue, tOptState* pOptState ) { tOptDesc* pRes = pOpts->pOptDesc; int ct = pOpts->optCt; @@ -423,7 +427,7 @@ findOptDesc( tOptions* pOpts, tOptState* pOptState ) * OTHERWISE see if there is room to advance and then do so. */ if ((pOpts->pzCurOpt != NULL) && (*pOpts->pzCurOpt != NUL)) - return shortOptionFind( pOpts, *pOpts->pzCurOpt, pOptState ); + return shortOptionFind( pOpts, (tAoUC)*(pOpts->pzCurOpt), pOptState ); if (pOpts->curOptIdx >= pOpts->origArgCt) return PROBLEM; /* NORMAL COMPLETION */ @@ -493,7 +497,7 @@ findOptDesc( tOptions* pOpts, tOptState* pOptState ) * short (i.e. single character) option. */ if ((pOpts->fOptSet & OPTPROC_SHORTOPT) != 0) - return shortOptionFind( pOpts, *pOpts->pzCurOpt, pOptState ); + return shortOptionFind( pOpts, (tAoUC)*(pOpts->pzCurOpt), pOptState ); return longOptionFind( pOpts, pOpts->pzCurOpt, pOptState ); } diff --git a/libopts/autoopts.h b/libopts/autoopts.h index af01f07cad..675da5373c 100644 --- a/libopts/autoopts.h +++ b/libopts/autoopts.h @@ -1,8 +1,8 @@ /* - * Time-stamp: "2005-10-29 15:06:44 bkorb" + * Time-stamp: "2006-07-01 14:40:47 bkorb" * - * autoopts.h $Id: autoopts.h,v 4.17 2006/03/25 19:24:56 bkorb Exp $ + * autoopts.h $Id: autoopts.h,v 4.22 2006/06/24 23:34:51 bkorb Exp $ * Time-stamp: "2005-02-14 05:59:50 bkorb" * * This file defines all the global structures and special values @@ -76,6 +76,12 @@ #undef EXPORT #define EXPORT +#if defined(_WIN32) +# define DIRch '\\' +#else +# define DIRCH '/' +#endif + /* * Convert the number to a list usable in a printf call */ @@ -178,8 +184,8 @@ typedef struct { tCC* pzOptFmt; } arg_types_t; -# define AGALOC( c, w ) malloc( c ) -# define AGREALOC( p, c, w ) realloc( p, c ) +# 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 ) @@ -292,6 +298,11 @@ typedef struct { # endif #endif +#ifndef HAVE_STRCHR +extern char* strchr( const char *s, int c); +extern char* strrchr( const char *s, int c); +#endif + /* * Define and initialize all the user visible strings. * We do not do translations. If translations are to be done, then @@ -307,9 +318,6 @@ extern FILE* option_usage_fp; extern tOptProc optionPrintVersion, optionPagedUsage, optionLoadOpt; -#define LOCAL static -#include "proto.h" - #endif /* AUTOGEN_AUTOOPTS_H */ /* * Local Variables: diff --git a/libopts/boolean.c b/libopts/boolean.c index 30ccd0d5e2..d098330034 100644 --- a/libopts/boolean.c +++ b/libopts/boolean.c @@ -1,6 +1,6 @@ /* - * $Id: boolean.c,v 4.5 2006/03/25 19:24:56 bkorb Exp $ + * $Id: boolean.c,v 4.6 2006/03/25 19:23:28 bkorb Exp $ * Time-stamp: "2005-02-14 08:24:12 bkorb" * * Automated Options Paged Usage module. diff --git a/libopts/compat/compat.h b/libopts/compat/compat.h index 5c9e923016..b23790b46b 100644 --- a/libopts/compat/compat.h +++ b/libopts/compat/compat.h @@ -2,12 +2,12 @@ /* --- fake the preprocessor into handlng portability */ /* - * Time-stamp: "2005-09-21 20:56:13 bkorb" + * Time-stamp: "2006-06-24 10:57:22 bkorb" * * Author: Gary V Vaughan * Created: Mon Jun 30 15:54:46 1997 * - * $Id: compat.h,v 4.6 2005/10/02 16:34:30 bkorb Exp $ + * $Id: compat.h,v 4.8 2006/06/24 23:34:51 bkorb Exp $ */ #ifndef COMPAT_H #define COMPAT_H 1 @@ -214,6 +214,9 @@ #ifndef HAVE_UINT16_T typedef unsigned short uint16_t; #endif +#ifndef HAVE_UINT_T + typedef unsigned int uint_t; +#endif #ifndef HAVE_INT32_T # if SIZEOF_INT == 4 diff --git a/libopts/compat/pathfind.c b/libopts/compat/pathfind.c index 4da759f3ba..d827cf7d75 100644 --- a/libopts/compat/pathfind.c +++ b/libopts/compat/pathfind.c @@ -5,10 +5,10 @@ /* * Author: Gary V Vaughan * Created: Tue Jun 24 15:07:31 1997 - * Last Modified: $Date: 2005/07/27 17:26:32 $ + * Last Modified: $Date: 2005/09/04 21:13:39 $ * by: bkorb * - * $Id: pathfind.c,v 4.4 2005/07/27 17:26:32 bkorb Exp $ + * $Id: pathfind.c,v 4.4 2005/09/04 21:13:39 bkorb Exp $ */ /* Code: */ diff --git a/libopts/compat/strchr.c b/libopts/compat/strchr.c new file mode 100644 index 0000000000..fd6507f4ff --- /dev/null +++ b/libopts/compat/strchr.c @@ -0,0 +1,61 @@ +/* + SYNOPSIS + #include + + char *strchr(const char *s, int c); + + char *strrchr(const char *s, int c); + + DESCRIPTION + The strchr() function returns a pointer to the first occurrence of the + character c in the string s. + + The strrchr() function returns a pointer to the last occurrence of the + character c in the string s. + + Here "character" means "byte" - these functions do not work with wide + or multi-byte characters. + + RETURN VALUE + The strchr() and strrchr() functions return a pointer to the matched + character or NULL if the character is not found. + + CONFORMING TO + SVID 3, POSIX, BSD 4.3, ISO 9899 +*/ + +char* +strchr( const char *s, int c) +{ + do { + if ((unsigned)*s == (unsigned)c) + return s; + + } while (*(++s) != NUL); + + return NULL; +} + +char* +strrchr( const char *s, int c) +{ + const char *e = s + strlen(s); + + for (;;) { + if (--e < s) + break; + + if ((unsigned)*e == (unsigned)c) + return e; + } + return NULL; +} + +/* + * Local Variables: + * mode: C + * c-file-style: "stroustrup" + * tab-width: 4 + * indent-tabs-mode: nil + * End: + * end of compat/strsignal.c */ diff --git a/libopts/configfile.c b/libopts/configfile.c index 4a2155a48c..be228bc357 100644 --- a/libopts/configfile.c +++ b/libopts/configfile.c @@ -1,6 +1,6 @@ /* - * $Id: configfile.c,v 4.12 2006/03/25 19:24:56 bkorb Exp $ - * Time-stamp: "2005-10-16 15:16:32 bkorb" + * $Id: configfile.c,v 4.22 2006/06/24 23:34:51 bkorb Exp $ + * Time-stamp: "2006-07-01 12:46:31 bkorb" * * configuration/rc/ini file handling. */ @@ -640,7 +640,7 @@ handleDirective( if (isspace(*pzText)) { while (isspace(*pzText)) pzText++; - if ( (strneqvcmp( pzText, pOpts->pzProgName, name_len ) == 0) + if ( (strneqvcmp( pzText, pOpts->pzProgName, (int)name_len) == 0) && (pzText[name_len] == '>')) { pzText += name_len + 1; break; @@ -847,8 +847,8 @@ internalFileLoad( tOptions* pOpts ) continue; pz = zFileName + len; - if (pz[-1] != '/') - *(pz++) = '/'; + if (pz[-1] != DIRCH) + *(pz++) = DIRCH; strcpy( pz, pOpts->pzRcName ); } @@ -1249,7 +1249,7 @@ validateOptionsStruct( tOptions* pOpts, const char* pzProgram ) * and the set of equivalent characters. */ if (pOpts->pzProgName == NULL) { - const char* pz = strrchr( pzProgram, '/' ); + const char* pz = strrchr( pzProgram, DIRCH ); if (pz == NULL) pOpts->pzProgName = pzProgram; diff --git a/libopts/cook.c b/libopts/cook.c index 763f697da3..aecd4ec483 100644 --- a/libopts/cook.c +++ b/libopts/cook.c @@ -1,7 +1,7 @@ /* - * $Id: cook.c,v 4.3 2006/03/25 19:24:56 bkorb Exp $ - * Time-stamp: "2005-05-20 13:58:56 bkorb" + * $Id: cook.c,v 4.6 2006/06/24 23:34:51 bkorb Exp $ + * Time-stamp: "2006-06-24 11:29:58 bkorb" * * This file contains the routines that deal with processing quoted strings * into an internal format. @@ -60,7 +60,7 @@ * what: escape-process a string fragment * arg: + const char* + pzScan + points to character after the escape + * arg: + char* + pRes + Where to put the result byte + - * arg: + char + nl_ch + replacement char if scanned char is \n + + * arg: + u_int + nl_ch + replacement char if scanned char is \n + * * ret-type: unsigned int * ret-desc: The number of bytes consumed processing the escaped character. @@ -81,7 +81,7 @@ * err: @code{NULL} is returned if the string(s) is/are mal-formed. =*/ unsigned int -ao_string_cook_escape_char( const char* pzIn, char* pRes, char nl ) +ao_string_cook_escape_char( const char* pzIn, char* pRes, u_int nl ) { unsigned int res = 1; @@ -94,7 +94,7 @@ ao_string_cook_escape_char( const char* pzIn, char* pRes, char nl ) res++; /* FALLTHROUGH */ case '\n': /* NL - emit newline */ - *pRes = nl; + *pRes = (char)nl; return res; case 'a': *pRes = '\a'; break; @@ -325,7 +325,7 @@ ao_string_cook( char* pzScan, int* pLineCt ) * THEN we do the full escape character processing */ else if (q != '\'') { - int ct = ao_string_cook_escape_char( pzS, pzD-1, '\n' ); + int ct = ao_string_cook_escape_char( pzS, pzD-1, (u_int)'\n' ); if (ct == 0) return NULL; diff --git a/libopts/enumeration.c b/libopts/enumeration.c index 86f7cc0e05..0dbe566141 100644 --- a/libopts/enumeration.c +++ b/libopts/enumeration.c @@ -1,7 +1,7 @@ /* - * $Id: enumeration.c,v 4.9 2006/03/25 19:24:56 bkorb Exp $ - * Time-stamp: "2005-12-09 06:37:15 bkorb" + * $Id: enumeration.c,v 4.11 2006/06/24 23:34:51 bkorb Exp $ + * Time-stamp: "2006-06-24 10:46:02 bkorb" * * Automated Options Paged Usage module. * @@ -193,7 +193,7 @@ findName( if (res != name_ct) { pz_enum_err_fmt = zAmbigKey; option_usage_fp = stderr; - enumError( pOpts, pOD, paz_names, name_ct ); + enumError( pOpts, pOD, paz_names, (int)name_ct ); } res = idx; /* save partial match */ } @@ -205,7 +205,7 @@ findName( if (res == name_ct) { pz_enum_err_fmt = zNoKey; option_usage_fp = stderr; - enumError( pOpts, pOD, paz_names, name_ct ); + enumError( pOpts, pOD, paz_names, (int)name_ct ); } /* @@ -275,7 +275,7 @@ optionEnumerationVal( /* * print the list of enumeration names. */ - enumError( pOpts, pOD, paz_names, name_ct ); + enumError( pOpts, pOD, paz_names, (int)name_ct ); return (char*)0UL; case 1UL: @@ -341,7 +341,7 @@ optionSetMembers( /* * print the list of enumeration names. */ - enumError( pOpts, pOD, paz_names, name_ct ); + enumError( pOpts, pOD, paz_names, (int)name_ct ); return; case 1UL: @@ -433,7 +433,7 @@ optionSetMembers( if ((len == 3) && (strncmp( pzArg, zAll, 3 ) == 0)) { if (iv) res = 0; - else res = ~0; + else res = ~0UL; } else if ((len == 4) && (strncmp( pzArg, zNone, 4 ) == 0)) { if (! iv) @@ -449,7 +449,7 @@ optionSetMembers( if (*pz != NUL) { if (len >= AO_NAME_LIMIT) break; - strncpy( z, pzArg, len ); + strncpy( z, pzArg, (unsigned)len ); z[len] = NUL; p = z; } else { diff --git a/libopts/environment.c b/libopts/environment.c index 285b229a95..caaa712bac 100644 --- a/libopts/environment.c +++ b/libopts/environment.c @@ -1,6 +1,6 @@ /* - * $Id: environment.c,v 4.8 2006/03/25 19:24:56 bkorb Exp $ + * $Id: environment.c,v 4.10 2006/03/25 19:23:28 bkorb Exp $ * Time-stamp: "2005-10-29 13:23:59 bkorb" * * This file contains all of the routines that must be linked into diff --git a/libopts/libopts.c b/libopts/libopts.c index 960a492fbb..7222a8c134 100644 --- a/libopts/libopts.c +++ b/libopts/libopts.c @@ -1,6 +1,7 @@ #define AUTOOPTS_INTERNAL #include "compat/compat.h" #define HAVE_LIBSNPRINTFV +#define LOCAL static #include "autoopts/options.h" #include "autoopts/usage-txt.h" #include "genshell.h" diff --git a/libopts/load.c b/libopts/load.c index e5a2b8ff2a..19b446457a 100644 --- a/libopts/load.c +++ b/libopts/load.c @@ -1,7 +1,7 @@ /* - * $Id: load.c,v 4.18 2006/03/25 19:24:56 bkorb Exp $ - * Time-stamp: "2005-10-29 14:45:36 bkorb" + * $Id: load.c,v 4.22 2006/06/24 23:34:51 bkorb Exp $ + * Time-stamp: "2006-07-01 12:43:03 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 @@ -102,7 +102,7 @@ assembleArgValue( char* pzTxt, tOptionLoadMode mode ); * * Please note: both @code{$$} and @code{$NAME} must be at the start of the * @code{pzName} string and must either be the entire string or be followed - * by the @code{'/'} character. + * by the @code{'/'} (backslash on windows) character. * * err: @code{AG_FALSE} is returned if: * @* @@ -195,7 +195,7 @@ insertProgramPath( int skip = 2; switch (pzName[2]) { - case '/': + case DIRCH: skip = 3; case NUL: break; @@ -208,7 +208,7 @@ insertProgramPath( * If it is, we're done. Otherwise, we have to hunt * for the program using "pathfind". */ - if (strchr( pzProgPath, '/' ) != NULL) + if (strchr( pzProgPath, DIRCH ) != NULL) pzPath = pzProgPath; else { pzPath = pathfind( getenv( "PATH" ), (char*)pzProgPath, "rx" ); @@ -217,7 +217,7 @@ insertProgramPath( return AG_FALSE; } - pz = strrchr( pzPath, '/' ); + pz = strrchr( pzPath, DIRCH ); /* * IF we cannot find a directory name separator, @@ -235,7 +235,7 @@ insertProgramPath( if ((pz - pzPath)+1 + strlen(pzName) >= bufSize) return AG_FALSE; - memcpy( pzBuf, pzPath, (pz - pzPath)+1 ); + memcpy( pzBuf, pzPath, (unsigned)((pz - pzPath)+1) ); strcpy( pzBuf + (pz - pzPath) + 1, pzName ); /* diff --git a/libopts/m4/libopts.m4 b/libopts/m4/libopts.m4 index 085c776441..3e9c2432a5 100644 --- a/libopts/m4/libopts.m4 +++ b/libopts/m4/libopts.m4 @@ -2,7 +2,7 @@ dnl -*- buffer-read-only: t -*- vi: set ro: dnl dnl DO NOT EDIT THIS FILE (libopts.m4) dnl -dnl It has been AutoGen-ed Sunday April 9, 2006 at 11:49:18 AM PDT +dnl It has been AutoGen-ed Saturday July 1, 2006 at 02:52:02 PM PDT dnl From the definitions libopts.def dnl and the template file conftest.tpl dnl @@ -84,7 +84,7 @@ AC_DEFUN([INVOKE_LIBOPTS_MACROS_FIRST],[ # ---------------------------------------------------------------------- AC_CHECK_LIB(gen, pathfind) AC_FUNC_VPRINTF - AC_CHECK_FUNCS([mmap canonicalize_file_name snprintf strdup]) + AC_CHECK_FUNCS([mmap canonicalize_file_name snprintf strdup strchr strrchr]) [ INVOKE_LIBOPTS_MACROS_FIRST_done=yes fi]]) @@ -200,20 +200,13 @@ int main() { ]) # end of AC_CACHE_VAL for libopts_cv_with_libregex AC_MSG_RESULT([${libopts_cv_with_libregex}]) - if test "X${libopts_cv_with_libregex}" = Xno + if test "X${libopts_cv_with_libregex}" != Xno then + AC_DEFINE([WITH_LIBREGEX],[1], + [Define this if a working libregex can be found]) + else CPPFLAGS="${libopts_save_CPPFLAGS}" LIBS="${libopts_save_LIBS}" - cat >&2 <<'_EOF_' -I cannot detect POSIX compliant regcomp/regexec routines. -These are required for AutoGen to work correctly. If you have -such a library present on your system, you must specify it by -setting the LIBS environment variable, e.g., "LIBS='-lregex'". -If you do not have such a library on your system, then you should -download and install, for example, the one from: - ftp://ftp.gnu.org/gnu/rx/ -_EOF_ -AC_MSG_ERROR([Cannot find working POSIX regex library]) fi ]) # end of AC_DEFUN of LIBOPTS_WITHLIB_REGEX diff --git a/libopts/makeshell.c b/libopts/makeshell.c index 32bcaa3e9b..40ccedefec 100644 --- a/libopts/makeshell.c +++ b/libopts/makeshell.c @@ -1,7 +1,7 @@ /* - * $Id: makeshell.c,v 4.8 2006/03/25 19:24:56 bkorb Exp $ - * Time-stamp: "2005-10-29 13:23:33 bkorb" + * $Id: makeshell.c,v 4.11 2006/06/24 23:34:51 bkorb Exp $ + * Time-stamp: "2006-06-24 10:47:07 bkorb" * * This module will interpret the options set in the tOptions * structure and create a Bourne shell script capable of parsing them. @@ -930,8 +930,8 @@ openOutput( const char* pzFile ) struct stat stbf; do { - char* pzScan; - int sizeLeft; + char* pzScan; + uint32_t sizeLeft; /* * IF we cannot stat the file, @@ -949,10 +949,10 @@ openOutput( const char* pzFile ) exit( EXIT_FAILURE ); } - pzData = (char*)malloc( stbf.st_size + 1 ); + pzData = (char*)malloc( (unsigned)(stbf.st_size + 1) ); fp = fopen( pzFile, "r" FOPEN_BINARY_FLAG ); - sizeLeft = stbf.st_size; + sizeLeft = (unsigned)stbf.st_size; pzScan = pzData; /* @@ -1045,8 +1045,8 @@ genshelloptUsage( tOptions* pOpts, int exitCode ) default: { - int stat; - wait( &stat ); + int sts; + wait( &sts ); } } @@ -1082,8 +1082,8 @@ genshelloptUsage( tOptions* pOpts, int exitCode ) default: { - int stat; - wait( &stat ); + int sts; + wait( &sts ); } } diff --git a/libopts/nested.c b/libopts/nested.c index ef32f2845c..00b88691af 100644 --- a/libopts/nested.c +++ b/libopts/nested.c @@ -1,6 +1,6 @@ /* - * $Id: nested.c,v 4.4 2006/03/25 19:24:56 bkorb Exp $ + * $Id: nested.c,v 4.9 2006/03/25 19:23:28 bkorb Exp $ * Time-stamp: "2005-07-27 10:10:28 bkorb" * * Automated Options Nested Values module. diff --git a/libopts/numeric.c b/libopts/numeric.c index 54be7c10a5..26790df3c7 100644 --- a/libopts/numeric.c +++ b/libopts/numeric.c @@ -1,6 +1,6 @@ /* - * $Id: numeric.c,v 4.6 2006/03/25 19:24:56 bkorb Exp $ + * $Id: numeric.c,v 4.7 2006/03/25 19:23:28 bkorb Exp $ * Time-stamp: "2005-02-14 08:22:56 bkorb" */ diff --git a/libopts/pgusage.c b/libopts/pgusage.c index 9842a72313..353e0f2775 100644 --- a/libopts/pgusage.c +++ b/libopts/pgusage.c @@ -1,7 +1,7 @@ /* - * $Id: pgusage.c,v 4.7 2006/03/25 19:24:56 bkorb Exp $ - * Time-stamp: "2005-10-29 13:23:12 bkorb" + * $Id: pgusage.c,v 4.9 2006/06/24 23:34:51 bkorb Exp $ + * Time-stamp: "2006-06-24 10:48:00 bkorb" * * Automated Options Paged Usage module. * @@ -114,7 +114,7 @@ optionPagedUsage( tOptions* pOptions, tOptDesc* pOD ) case PAGER_STATE_READY: { tSCC zPage[] = "%1$s /tmp/use.%2$lu ; rm -f /tmp/use.%2$lu"; - char* pzPager = getenv( "PAGER" ); + tCC* pzPager = (tCC*)getenv( "PAGER" ); /* * Use the "more(1)" program if "PAGER" has not been defined diff --git a/libopts/proto.h b/libopts/proto.h index f15050179a..2779c5c671 100644 --- a/libopts/proto.h +++ b/libopts/proto.h @@ -1,7 +1,7 @@ /* -*- buffer-read-only: t -*- vi: set ro: * * Prototypes for autoopts - * Generated Sun Apr 9 11:50:00 PDT 2006 + * Generated Sat Jul 1 14:52:42 PDT 2006 */ #ifndef AUTOOPTS_PROTO_H_GUARD #define AUTOOPTS_PROTO_H_GUARD 1 @@ -21,7 +21,7 @@ LOCAL tSuccess longOptionFind( tOptions* pOpts, char* pzOptName, tOptState* pOptState ); LOCAL tSuccess -shortOptionFind( tOptions* pOpts, tAoUC optValue, tOptState* pOptState ); +shortOptionFind( tOptions* pOpts, uint_t optValue, tOptState* pOptState ); LOCAL tSuccess doImmediateOpts( tOptions* pOpts ); diff --git a/libopts/putshell.c b/libopts/putshell.c index feed57b3ae..a97574bb7b 100644 --- a/libopts/putshell.c +++ b/libopts/putshell.c @@ -1,7 +1,7 @@ /* - * $Id: putshell.c,v 4.9 2006/03/25 19:24:56 bkorb Exp $ - * Time-stamp: "2005-12-13 10:28:47 bkorb" + * $Id: putshell.c,v 4.11 2006/06/24 23:34:51 bkorb Exp $ + * Time-stamp: "2006-06-24 14:29:07 bkorb" * * This module will interpret the options set in the tOptions * structure and print them to standard out in a fashion that @@ -95,7 +95,7 @@ putQuotedStr( tCC* pzStr ) /* * Emit the string up to the single quote (apostrophe) we just found. */ - fwrite( pzStr, (pz - pzStr), 1, stdout ); + fwrite( pzStr, (unsigned)(pz - pzStr), 1, stdout ); fputc( '\'', stdout ); pzStr = pz; @@ -200,7 +200,7 @@ optionPutShell( tOptions* pOpts ) else if (ch == NUL) { pz--; goto name_done; } else fputc( '_', stdout ); } name_done:; - printf( "=%1$ld # 0x%1$lX\n", val ); + printf( "=%1$lu # 0x%1$lX\n", (unsigned long)val ); val <<= 1; } free( (void*)(pOD->pzLastArg) ); @@ -230,13 +230,13 @@ optionPutShell( tOptions* pOpts ) printf( zOptCookieCt, pOpts->pzPROGNAME, pOD->pz_NAME, ct ); while (--ct >= 0) { - tSCC zOptNumArg[] = "%s_%s_%d="; - tSCC zOptEnd[] = "\nexport %s_%s_%d\n"; + tSCC numarg_z[] = "%s_%s_%d="; + tSCC end_z[] = "\nexport %s_%s_%d\n"; - printf( zOptNumArg, pOpts->pzPROGNAME, pOD->pz_NAME, + printf( numarg_z, pOpts->pzPROGNAME, pOD->pz_NAME, pAL->useCt - ct ); putQuotedStr( *(ppz++) ); - printf( zOptEnd, pOpts->pzPROGNAME, pOD->pz_NAME, + printf( end_z, pOpts->pzPROGNAME, pOD->pz_NAME, pAL->useCt - ct ); } } diff --git a/libopts/restore.c b/libopts/restore.c index 959e0f9d62..ce788b3303 100644 --- a/libopts/restore.c +++ b/libopts/restore.c @@ -1,6 +1,6 @@ /* - * restore.c $Id: restore.c,v 4.6 2006/03/25 19:24:56 bkorb Exp $ + * restore.c $Id: restore.c,v 4.7 2006/03/25 19:23:28 bkorb Exp $ * Time-stamp: "2005-02-23 15:10:20 bkorb" * * This module's routines will save the current option state to memory diff --git a/libopts/save.c b/libopts/save.c index 51fa212f7f..938a4fd124 100644 --- a/libopts/save.c +++ b/libopts/save.c @@ -1,7 +1,7 @@ /* - * save.c $Id: save.c,v 4.12 2006/03/25 19:24:56 bkorb Exp $ - * Time-stamp: "2005-02-20 13:49:46 bkorb" + * save.c $Id: save.c,v 4.14 2006/06/24 23:34:51 bkorb Exp $ + * Time-stamp: "2006-07-01 12:41:27 bkorb" * * This module's routines will take the currently set options and * store them into an ".rc" file for re-interpretation the next @@ -100,7 +100,7 @@ findDirName( tOptions* pOpts, int* p_free ) return pzDir; { - tCC* pzEndDir = strchr( ++pzDir, '/' ); + tCC* pzEndDir = strchr( ++pzDir, DIRCH ); char* pzFileName; char* pzEnv; @@ -108,7 +108,7 @@ findDirName( tOptions* pOpts, int* p_free ) char z[ AO_NAME_SIZE ]; if ((pzEndDir - pzDir) > AO_NAME_LIMIT ) return NULL; - strncpy( z, pzDir, (pzEndDir - pzDir) ); + strncpy( z, pzDir, (unsigned)(pzEndDir - pzDir) ); z[ (pzEndDir - pzDir) ] = NUL; pzEnv = getenv( z ); } else { @@ -176,13 +176,13 @@ findFileName( tOptions* pOpts, int* p_free_name ) * Strip off the last component, stat the remaining string and * that string must name a directory */ - char* pzDirCh = strrchr( pzDir, '/' ); + char* pzDirCh = strrchr( pzDir, DIRCH ); if (pzDirCh == NULL) { stBuf.st_mode = S_IFREG; continue; /* bail out of error condition */ } - strncpy( z, pzDir, pzDirCh - pzDir ); + strncpy( z, pzDir, (unsigned)(pzDirCh - pzDir)); z[ pzDirCh - pzDir ] = NUL; if ( (stat( z, &stBuf ) == 0) @@ -308,7 +308,7 @@ printEntry( /* * Print the continuation and the text from the current line */ - fwrite( pzLA, pzNl - pzLA, 1, fp ); + fwrite( pzLA, (unsigned)(pzNl - pzLA), 1, fp ); pzLA = pzNl+1; /* advance the Last Arg pointer */ fputs( "\\\n", fp ); } diff --git a/libopts/sort.c b/libopts/sort.c index e7f29ed188..de0bd5634d 100644 --- a/libopts/sort.c +++ b/libopts/sort.c @@ -1,7 +1,7 @@ /* - * sort.c $Id: sort.c,v 4.7 2006/03/25 19:24:56 bkorb Exp $ - * Time-stamp: "2005-02-20 17:18:41 bkorb" + * 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. */ @@ -155,7 +155,7 @@ checkShortOpts( tOptions* pOpts, char* pzArg, tOptState* pOS, char** ppzOpts, int* pOptsIdx ) { while (*pzArg != NUL) { - if (FAILED( shortOptionFind( pOpts, *pzArg, pOS ))) + if (FAILED( shortOptionFind( pOpts, (tAoUC)*pzArg, pOS ))) return FAILURE; /* @@ -295,7 +295,7 @@ optionSort( tOptions* pOpts ) if ((pOpts->fOptSet & OPTPROC_SHORTOPT) == 0) { res = longOptionFind( pOpts, pzArg+1, &os ); } else { - res = shortOptionFind( pOpts, pzArg[1], &os ); + res = shortOptionFind( pOpts, (tAoUC)pzArg[1], &os ); } break; } diff --git a/libopts/stack.c b/libopts/stack.c index bbea3342be..13137375ae 100644 --- a/libopts/stack.c +++ b/libopts/stack.c @@ -1,8 +1,8 @@ /* * stack.c - * $Id: stack.c,v 4.6 2006/03/25 19:24:56 bkorb Exp $ - * Time-stamp: "2005-02-20 16:33:20 bkorb" + * $Id: stack.c,v 4.8 2006/03/25 19:23:28 bkorb Exp $ + * Time-stamp: "2006-07-01 14:35:13 bkorb" * * This is a special option processing routine that will save the * argument to an option in a FIFO queue. @@ -82,6 +82,7 @@ optionUnstackArg( return; } +#ifdef WITH_LIBREGEX { regex_t re; int i, ct, dIdx; @@ -130,7 +131,45 @@ optionUnstackArg( regfree( &re ); } +#else /* not WITH_LIBREGEX */ + { + int i, ct, dIdx; + /* + * search the list for the entry(s) to remove. Entries that + * are removed are *not* copied into the result. The source + * index is incremented every time. The destination only when + * we are keeping a define. + */ + for (i = 0, dIdx = 0, ct = pAL->useCt; --ct >= 0; i++) { + tCC* pzSrc = pAL->apzArgs[ i ]; + char* pzEq = strchr( pzSrc, '=' ); + + if (pzEq != NULL) + *pzEq = NUL; + + if (strcmp( pzSrc, pOptDesc->pzLastArg ) == 0) { + /* + * Remove this entry by reducing the in-use count + * and *not* putting the string pointer back into + * the list. + */ + pAL->useCt--; + } else { + if (pzEq != NULL) + *pzEq = '='; + + /* + * IF we have dropped an entry + * THEN we have to move the current one. + */ + if (dIdx != i) + pAL->apzArgs[ dIdx ] = pzSrc; + dIdx++; + } + } + } +#endif /* WITH_LIBREGEX */ /* * IF we have unstacked everything, * THEN indicate that we don't have any of these options diff --git a/libopts/streqvcmp.c b/libopts/streqvcmp.c index 135e23563f..28b255a36b 100644 --- a/libopts/streqvcmp.c +++ b/libopts/streqvcmp.c @@ -1,6 +1,6 @@ /* - * $Id: streqvcmp.c,v 4.7 2006/03/25 19:24:56 bkorb Exp $ + * $Id: streqvcmp.c,v 4.9 2006/03/25 19:23:28 bkorb Exp $ * Time-stamp: "2005-10-29 14:05:07 bkorb" * * String Equivalence Comparison diff --git a/libopts/text_mmap.c b/libopts/text_mmap.c index 825cd900ef..a8d06b3a63 100644 --- a/libopts/text_mmap.c +++ b/libopts/text_mmap.c @@ -1,7 +1,7 @@ /* - * $Id: text_mmap.c,v 4.11 2006/02/01 17:18:00 bkorb Exp $ + * $Id: text_mmap.c,v 4.11 2006/06/24 23:34:51 bkorb Exp $ * - * Time-stamp: "2006-02-01 08:45:37 bkorb" + * Time-stamp: "2006-06-24 10:54:43 bkorb" */ #ifndef MAP_ANONYMOUS @@ -19,7 +19,7 @@ #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 diff --git a/libopts/tokenize.c b/libopts/tokenize.c index 074473ccaa..09b80f5854 100644 --- a/libopts/tokenize.c +++ b/libopts/tokenize.c @@ -1,6 +1,6 @@ /* * This file defines the string_tokenize interface - * Time-stamp: "2005-04-25 18:47:21 bkorb" + * Time-stamp: "2006-06-24 15:27:49 bkorb" * * string_tokenize copyright 2005 Bruce Korb * @@ -240,7 +240,7 @@ ao_string_tokenize( const char* str ) switch (ch) { case '"': - copy_cooked( &pzDest, (cc_t**)&str ); + copy_cooked( &pzDest, (cc_t**)(void*)&str ); if (str == NULL) { free(res); errno = EINVAL; @@ -251,7 +251,7 @@ ao_string_tokenize( const char* str ) break; case '\'': - copy_raw( &pzDest, (cc_t**)&str ); + copy_raw( &pzDest, (cc_t**)(void*)&str ); if (str == NULL) { free(res); errno = EINVAL; diff --git a/libopts/usage.c b/libopts/usage.c index 5d36ab91f6..8d06b31bc9 100644 --- a/libopts/usage.c +++ b/libopts/usage.c @@ -1,7 +1,7 @@ /* - * usage.c $Id: usage.c,v 4.11 2006/03/25 19:24:57 bkorb Exp $ - * Time-stamp: "2006-02-04 13:35:26 bkorb" + * usage.c $Id: usage.c,v 4.13 2006/06/24 23:34:51 bkorb Exp $ + * Time-stamp: "2006-07-01 12:41:02 bkorb" * * This module implements the default usage procedure for * Automated Options. It may be overridden, of course. @@ -76,10 +76,10 @@ printExtendedUsage( static void printInitList( - tCC** papz, - ag_bool* pInitIntro, - tCC* pzRc, - tCC* pzPN ); + tCC* const* papz, + ag_bool* pInitIntro, + tCC* pzRc, + tCC* pzPN ); static void printOneUsage( @@ -395,10 +395,10 @@ printExtendedUsage( */ static void printInitList( - tCC** papz, - ag_bool* pInitIntro, - tCC* pzRc, - tCC* pzPN ) + tCC* const* papz, + ag_bool* pInitIntro, + tCC* pzRc, + tCC* pzPN ) { char zPath[ MAXPATHLEN+1 ]; @@ -431,7 +431,7 @@ printInitList( */ if ( (stat( pzPath, &sb ) == 0) && S_ISDIR( sb.st_mode ) ) { - fputc( '/', option_usage_fp ); + fputc( DIRCH, option_usage_fp ); fputs( pzRc, option_usage_fp ); } } diff --git a/libopts/version.c b/libopts/version.c index ede91732db..290ee0fe0f 100644 --- a/libopts/version.c +++ b/libopts/version.c @@ -1,5 +1,5 @@ -/* $Id: version.c,v 4.7 2006/03/25 19:24:57 bkorb Exp $ +/* $Id: version.c,v 4.8 2006/03/25 19:23:28 bkorb Exp $ * Time-stamp: "2005-12-13 10:29:09 bkorb" * * This module implements the default usage procedure for diff --git a/sntp/libopts/Makefile.am b/sntp/libopts/Makefile.am index ca0f8a676d..6108426441 100644 --- a/sntp/libopts/Makefile.am +++ b/sntp/libopts/Makefile.am @@ -3,18 +3,18 @@ MAINTAINERCLEANFILES = Makefile.in lib_LTLIBRARIES = libopts.la libopts_la_SOURCES = libopts.c libopts_la_CPPFLAGS = -I$(top_srcdir) -libopts_la_LDFLAGS = -version-info 27:1:2 +libopts_la_LDFLAGS = -version-info 27:3:2 EXTRA_DIST = \ COPYING.lgpl COPYING.mbsd MakeDefs.inc \ README autoopts/options.h autoopts/usage-txt.h \ autoopts.c autoopts.h boolean.c \ compat/compat.h compat/pathfind.c compat/snprintf.c \ - compat/strdup.c configfile.c cook.c \ - enumeration.c environment.c genshell.c \ - genshell.h load.c m4/libopts.m4 \ - m4/liboptschk.m4 makeshell.c nested.c \ - numeric.c pgusage.c proto.h \ - putshell.c restore.c save.c \ - sort.c stack.c streqvcmp.c \ - text_mmap.c tokenize.c usage.c \ - version.c + compat/strdup.c compat/strchr.c configfile.c \ + cook.c enumeration.c environment.c \ + genshell.c genshell.h load.c \ + m4/libopts.m4 m4/liboptschk.m4 makeshell.c \ + nested.c numeric.c pgusage.c \ + proto.h putshell.c restore.c \ + save.c sort.c stack.c \ + streqvcmp.c text_mmap.c tokenize.c \ + usage.c version.c diff --git a/sntp/libopts/autoopts.c b/sntp/libopts/autoopts.c index 6d88967e48..806d71b9d2 100644 --- a/sntp/libopts/autoopts.c +++ b/sntp/libopts/autoopts.c @@ -1,7 +1,7 @@ /* - * $Id: autoopts.c,v 4.14 2006/03/25 19:24:56 bkorb Exp $ - * Time-stamp: "2005-10-29 13:19:36 bkorb" + * $Id: autoopts.c,v 4.20 2006/06/24 23:34:51 bkorb Exp $ + * Time-stamp: "2006-07-01 14:41:46 bkorb" * * This file contains all of the routines that must be linked into * an executable to use the generated option processing. The optional @@ -66,6 +66,10 @@ # endif #endif +#ifndef HAVE_STRCHR +# include "compat/strchr.c" +#endif + static const char zNil[] = ""; #define SKIP_RC_FILES(po) \ @@ -350,7 +354,7 @@ longOptionFind( tOptions* pOpts, char* pzOptName, tOptState* pOptState ) * Find the short option descriptor for the current option */ LOCAL tSuccess -shortOptionFind( tOptions* pOpts, tAoUC optValue, tOptState* pOptState ) +shortOptionFind( tOptions* pOpts, uint_t optValue, tOptState* pOptState ) { tOptDesc* pRes = pOpts->pOptDesc; int ct = pOpts->optCt; @@ -423,7 +427,7 @@ findOptDesc( tOptions* pOpts, tOptState* pOptState ) * OTHERWISE see if there is room to advance and then do so. */ if ((pOpts->pzCurOpt != NULL) && (*pOpts->pzCurOpt != NUL)) - return shortOptionFind( pOpts, *pOpts->pzCurOpt, pOptState ); + return shortOptionFind( pOpts, (tAoUC)*(pOpts->pzCurOpt), pOptState ); if (pOpts->curOptIdx >= pOpts->origArgCt) return PROBLEM; /* NORMAL COMPLETION */ @@ -493,7 +497,7 @@ findOptDesc( tOptions* pOpts, tOptState* pOptState ) * short (i.e. single character) option. */ if ((pOpts->fOptSet & OPTPROC_SHORTOPT) != 0) - return shortOptionFind( pOpts, *pOpts->pzCurOpt, pOptState ); + return shortOptionFind( pOpts, (tAoUC)*(pOpts->pzCurOpt), pOptState ); return longOptionFind( pOpts, pOpts->pzCurOpt, pOptState ); } diff --git a/sntp/libopts/autoopts.h b/sntp/libopts/autoopts.h index af01f07cad..675da5373c 100644 --- a/sntp/libopts/autoopts.h +++ b/sntp/libopts/autoopts.h @@ -1,8 +1,8 @@ /* - * Time-stamp: "2005-10-29 15:06:44 bkorb" + * Time-stamp: "2006-07-01 14:40:47 bkorb" * - * autoopts.h $Id: autoopts.h,v 4.17 2006/03/25 19:24:56 bkorb Exp $ + * autoopts.h $Id: autoopts.h,v 4.22 2006/06/24 23:34:51 bkorb Exp $ * Time-stamp: "2005-02-14 05:59:50 bkorb" * * This file defines all the global structures and special values @@ -76,6 +76,12 @@ #undef EXPORT #define EXPORT +#if defined(_WIN32) +# define DIRch '\\' +#else +# define DIRCH '/' +#endif + /* * Convert the number to a list usable in a printf call */ @@ -178,8 +184,8 @@ typedef struct { tCC* pzOptFmt; } arg_types_t; -# define AGALOC( c, w ) malloc( c ) -# define AGREALOC( p, c, w ) realloc( p, c ) +# 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 ) @@ -292,6 +298,11 @@ typedef struct { # endif #endif +#ifndef HAVE_STRCHR +extern char* strchr( const char *s, int c); +extern char* strrchr( const char *s, int c); +#endif + /* * Define and initialize all the user visible strings. * We do not do translations. If translations are to be done, then @@ -307,9 +318,6 @@ extern FILE* option_usage_fp; extern tOptProc optionPrintVersion, optionPagedUsage, optionLoadOpt; -#define LOCAL static -#include "proto.h" - #endif /* AUTOGEN_AUTOOPTS_H */ /* * Local Variables: diff --git a/sntp/libopts/boolean.c b/sntp/libopts/boolean.c index 30ccd0d5e2..d098330034 100644 --- a/sntp/libopts/boolean.c +++ b/sntp/libopts/boolean.c @@ -1,6 +1,6 @@ /* - * $Id: boolean.c,v 4.5 2006/03/25 19:24:56 bkorb Exp $ + * $Id: boolean.c,v 4.6 2006/03/25 19:23:28 bkorb Exp $ * Time-stamp: "2005-02-14 08:24:12 bkorb" * * Automated Options Paged Usage module. diff --git a/sntp/libopts/compat/compat.h b/sntp/libopts/compat/compat.h index 5c9e923016..b23790b46b 100644 --- a/sntp/libopts/compat/compat.h +++ b/sntp/libopts/compat/compat.h @@ -2,12 +2,12 @@ /* --- fake the preprocessor into handlng portability */ /* - * Time-stamp: "2005-09-21 20:56:13 bkorb" + * Time-stamp: "2006-06-24 10:57:22 bkorb" * * Author: Gary V Vaughan * Created: Mon Jun 30 15:54:46 1997 * - * $Id: compat.h,v 4.6 2005/10/02 16:34:30 bkorb Exp $ + * $Id: compat.h,v 4.8 2006/06/24 23:34:51 bkorb Exp $ */ #ifndef COMPAT_H #define COMPAT_H 1 @@ -214,6 +214,9 @@ #ifndef HAVE_UINT16_T typedef unsigned short uint16_t; #endif +#ifndef HAVE_UINT_T + typedef unsigned int uint_t; +#endif #ifndef HAVE_INT32_T # if SIZEOF_INT == 4 diff --git a/sntp/libopts/compat/pathfind.c b/sntp/libopts/compat/pathfind.c index 4da759f3ba..d827cf7d75 100644 --- a/sntp/libopts/compat/pathfind.c +++ b/sntp/libopts/compat/pathfind.c @@ -5,10 +5,10 @@ /* * Author: Gary V Vaughan * Created: Tue Jun 24 15:07:31 1997 - * Last Modified: $Date: 2005/07/27 17:26:32 $ + * Last Modified: $Date: 2005/09/04 21:13:39 $ * by: bkorb * - * $Id: pathfind.c,v 4.4 2005/07/27 17:26:32 bkorb Exp $ + * $Id: pathfind.c,v 4.4 2005/09/04 21:13:39 bkorb Exp $ */ /* Code: */ diff --git a/sntp/libopts/compat/strchr.c b/sntp/libopts/compat/strchr.c new file mode 100644 index 0000000000..fd6507f4ff --- /dev/null +++ b/sntp/libopts/compat/strchr.c @@ -0,0 +1,61 @@ +/* + SYNOPSIS + #include + + char *strchr(const char *s, int c); + + char *strrchr(const char *s, int c); + + DESCRIPTION + The strchr() function returns a pointer to the first occurrence of the + character c in the string s. + + The strrchr() function returns a pointer to the last occurrence of the + character c in the string s. + + Here "character" means "byte" - these functions do not work with wide + or multi-byte characters. + + RETURN VALUE + The strchr() and strrchr() functions return a pointer to the matched + character or NULL if the character is not found. + + CONFORMING TO + SVID 3, POSIX, BSD 4.3, ISO 9899 +*/ + +char* +strchr( const char *s, int c) +{ + do { + if ((unsigned)*s == (unsigned)c) + return s; + + } while (*(++s) != NUL); + + return NULL; +} + +char* +strrchr( const char *s, int c) +{ + const char *e = s + strlen(s); + + for (;;) { + if (--e < s) + break; + + if ((unsigned)*e == (unsigned)c) + return e; + } + return NULL; +} + +/* + * Local Variables: + * mode: C + * c-file-style: "stroustrup" + * tab-width: 4 + * indent-tabs-mode: nil + * End: + * end of compat/strsignal.c */ diff --git a/sntp/libopts/configfile.c b/sntp/libopts/configfile.c index 4a2155a48c..be228bc357 100644 --- a/sntp/libopts/configfile.c +++ b/sntp/libopts/configfile.c @@ -1,6 +1,6 @@ /* - * $Id: configfile.c,v 4.12 2006/03/25 19:24:56 bkorb Exp $ - * Time-stamp: "2005-10-16 15:16:32 bkorb" + * $Id: configfile.c,v 4.22 2006/06/24 23:34:51 bkorb Exp $ + * Time-stamp: "2006-07-01 12:46:31 bkorb" * * configuration/rc/ini file handling. */ @@ -640,7 +640,7 @@ handleDirective( if (isspace(*pzText)) { while (isspace(*pzText)) pzText++; - if ( (strneqvcmp( pzText, pOpts->pzProgName, name_len ) == 0) + if ( (strneqvcmp( pzText, pOpts->pzProgName, (int)name_len) == 0) && (pzText[name_len] == '>')) { pzText += name_len + 1; break; @@ -847,8 +847,8 @@ internalFileLoad( tOptions* pOpts ) continue; pz = zFileName + len; - if (pz[-1] != '/') - *(pz++) = '/'; + if (pz[-1] != DIRCH) + *(pz++) = DIRCH; strcpy( pz, pOpts->pzRcName ); } @@ -1249,7 +1249,7 @@ validateOptionsStruct( tOptions* pOpts, const char* pzProgram ) * and the set of equivalent characters. */ if (pOpts->pzProgName == NULL) { - const char* pz = strrchr( pzProgram, '/' ); + const char* pz = strrchr( pzProgram, DIRCH ); if (pz == NULL) pOpts->pzProgName = pzProgram; diff --git a/sntp/libopts/cook.c b/sntp/libopts/cook.c index 763f697da3..aecd4ec483 100644 --- a/sntp/libopts/cook.c +++ b/sntp/libopts/cook.c @@ -1,7 +1,7 @@ /* - * $Id: cook.c,v 4.3 2006/03/25 19:24:56 bkorb Exp $ - * Time-stamp: "2005-05-20 13:58:56 bkorb" + * $Id: cook.c,v 4.6 2006/06/24 23:34:51 bkorb Exp $ + * Time-stamp: "2006-06-24 11:29:58 bkorb" * * This file contains the routines that deal with processing quoted strings * into an internal format. @@ -60,7 +60,7 @@ * what: escape-process a string fragment * arg: + const char* + pzScan + points to character after the escape + * arg: + char* + pRes + Where to put the result byte + - * arg: + char + nl_ch + replacement char if scanned char is \n + + * arg: + u_int + nl_ch + replacement char if scanned char is \n + * * ret-type: unsigned int * ret-desc: The number of bytes consumed processing the escaped character. @@ -81,7 +81,7 @@ * err: @code{NULL} is returned if the string(s) is/are mal-formed. =*/ unsigned int -ao_string_cook_escape_char( const char* pzIn, char* pRes, char nl ) +ao_string_cook_escape_char( const char* pzIn, char* pRes, u_int nl ) { unsigned int res = 1; @@ -94,7 +94,7 @@ ao_string_cook_escape_char( const char* pzIn, char* pRes, char nl ) res++; /* FALLTHROUGH */ case '\n': /* NL - emit newline */ - *pRes = nl; + *pRes = (char)nl; return res; case 'a': *pRes = '\a'; break; @@ -325,7 +325,7 @@ ao_string_cook( char* pzScan, int* pLineCt ) * THEN we do the full escape character processing */ else if (q != '\'') { - int ct = ao_string_cook_escape_char( pzS, pzD-1, '\n' ); + int ct = ao_string_cook_escape_char( pzS, pzD-1, (u_int)'\n' ); if (ct == 0) return NULL; diff --git a/sntp/libopts/enumeration.c b/sntp/libopts/enumeration.c index 86f7cc0e05..0dbe566141 100644 --- a/sntp/libopts/enumeration.c +++ b/sntp/libopts/enumeration.c @@ -1,7 +1,7 @@ /* - * $Id: enumeration.c,v 4.9 2006/03/25 19:24:56 bkorb Exp $ - * Time-stamp: "2005-12-09 06:37:15 bkorb" + * $Id: enumeration.c,v 4.11 2006/06/24 23:34:51 bkorb Exp $ + * Time-stamp: "2006-06-24 10:46:02 bkorb" * * Automated Options Paged Usage module. * @@ -193,7 +193,7 @@ findName( if (res != name_ct) { pz_enum_err_fmt = zAmbigKey; option_usage_fp = stderr; - enumError( pOpts, pOD, paz_names, name_ct ); + enumError( pOpts, pOD, paz_names, (int)name_ct ); } res = idx; /* save partial match */ } @@ -205,7 +205,7 @@ findName( if (res == name_ct) { pz_enum_err_fmt = zNoKey; option_usage_fp = stderr; - enumError( pOpts, pOD, paz_names, name_ct ); + enumError( pOpts, pOD, paz_names, (int)name_ct ); } /* @@ -275,7 +275,7 @@ optionEnumerationVal( /* * print the list of enumeration names. */ - enumError( pOpts, pOD, paz_names, name_ct ); + enumError( pOpts, pOD, paz_names, (int)name_ct ); return (char*)0UL; case 1UL: @@ -341,7 +341,7 @@ optionSetMembers( /* * print the list of enumeration names. */ - enumError( pOpts, pOD, paz_names, name_ct ); + enumError( pOpts, pOD, paz_names, (int)name_ct ); return; case 1UL: @@ -433,7 +433,7 @@ optionSetMembers( if ((len == 3) && (strncmp( pzArg, zAll, 3 ) == 0)) { if (iv) res = 0; - else res = ~0; + else res = ~0UL; } else if ((len == 4) && (strncmp( pzArg, zNone, 4 ) == 0)) { if (! iv) @@ -449,7 +449,7 @@ optionSetMembers( if (*pz != NUL) { if (len >= AO_NAME_LIMIT) break; - strncpy( z, pzArg, len ); + strncpy( z, pzArg, (unsigned)len ); z[len] = NUL; p = z; } else { diff --git a/sntp/libopts/environment.c b/sntp/libopts/environment.c index 285b229a95..caaa712bac 100644 --- a/sntp/libopts/environment.c +++ b/sntp/libopts/environment.c @@ -1,6 +1,6 @@ /* - * $Id: environment.c,v 4.8 2006/03/25 19:24:56 bkorb Exp $ + * $Id: environment.c,v 4.10 2006/03/25 19:23:28 bkorb Exp $ * Time-stamp: "2005-10-29 13:23:59 bkorb" * * This file contains all of the routines that must be linked into diff --git a/sntp/libopts/libopts.c b/sntp/libopts/libopts.c index 960a492fbb..7222a8c134 100644 --- a/sntp/libopts/libopts.c +++ b/sntp/libopts/libopts.c @@ -1,6 +1,7 @@ #define AUTOOPTS_INTERNAL #include "compat/compat.h" #define HAVE_LIBSNPRINTFV +#define LOCAL static #include "autoopts/options.h" #include "autoopts/usage-txt.h" #include "genshell.h" diff --git a/sntp/libopts/load.c b/sntp/libopts/load.c index e5a2b8ff2a..19b446457a 100644 --- a/sntp/libopts/load.c +++ b/sntp/libopts/load.c @@ -1,7 +1,7 @@ /* - * $Id: load.c,v 4.18 2006/03/25 19:24:56 bkorb Exp $ - * Time-stamp: "2005-10-29 14:45:36 bkorb" + * $Id: load.c,v 4.22 2006/06/24 23:34:51 bkorb Exp $ + * Time-stamp: "2006-07-01 12:43:03 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 @@ -102,7 +102,7 @@ assembleArgValue( char* pzTxt, tOptionLoadMode mode ); * * Please note: both @code{$$} and @code{$NAME} must be at the start of the * @code{pzName} string and must either be the entire string or be followed - * by the @code{'/'} character. + * by the @code{'/'} (backslash on windows) character. * * err: @code{AG_FALSE} is returned if: * @* @@ -195,7 +195,7 @@ insertProgramPath( int skip = 2; switch (pzName[2]) { - case '/': + case DIRCH: skip = 3; case NUL: break; @@ -208,7 +208,7 @@ insertProgramPath( * If it is, we're done. Otherwise, we have to hunt * for the program using "pathfind". */ - if (strchr( pzProgPath, '/' ) != NULL) + if (strchr( pzProgPath, DIRCH ) != NULL) pzPath = pzProgPath; else { pzPath = pathfind( getenv( "PATH" ), (char*)pzProgPath, "rx" ); @@ -217,7 +217,7 @@ insertProgramPath( return AG_FALSE; } - pz = strrchr( pzPath, '/' ); + pz = strrchr( pzPath, DIRCH ); /* * IF we cannot find a directory name separator, @@ -235,7 +235,7 @@ insertProgramPath( if ((pz - pzPath)+1 + strlen(pzName) >= bufSize) return AG_FALSE; - memcpy( pzBuf, pzPath, (pz - pzPath)+1 ); + memcpy( pzBuf, pzPath, (unsigned)((pz - pzPath)+1) ); strcpy( pzBuf + (pz - pzPath) + 1, pzName ); /* diff --git a/sntp/libopts/m4/libopts.m4 b/sntp/libopts/m4/libopts.m4 index 085c776441..3e9c2432a5 100644 --- a/sntp/libopts/m4/libopts.m4 +++ b/sntp/libopts/m4/libopts.m4 @@ -2,7 +2,7 @@ dnl -*- buffer-read-only: t -*- vi: set ro: dnl dnl DO NOT EDIT THIS FILE (libopts.m4) dnl -dnl It has been AutoGen-ed Sunday April 9, 2006 at 11:49:18 AM PDT +dnl It has been AutoGen-ed Saturday July 1, 2006 at 02:52:02 PM PDT dnl From the definitions libopts.def dnl and the template file conftest.tpl dnl @@ -84,7 +84,7 @@ AC_DEFUN([INVOKE_LIBOPTS_MACROS_FIRST],[ # ---------------------------------------------------------------------- AC_CHECK_LIB(gen, pathfind) AC_FUNC_VPRINTF - AC_CHECK_FUNCS([mmap canonicalize_file_name snprintf strdup]) + AC_CHECK_FUNCS([mmap canonicalize_file_name snprintf strdup strchr strrchr]) [ INVOKE_LIBOPTS_MACROS_FIRST_done=yes fi]]) @@ -200,20 +200,13 @@ int main() { ]) # end of AC_CACHE_VAL for libopts_cv_with_libregex AC_MSG_RESULT([${libopts_cv_with_libregex}]) - if test "X${libopts_cv_with_libregex}" = Xno + if test "X${libopts_cv_with_libregex}" != Xno then + AC_DEFINE([WITH_LIBREGEX],[1], + [Define this if a working libregex can be found]) + else CPPFLAGS="${libopts_save_CPPFLAGS}" LIBS="${libopts_save_LIBS}" - cat >&2 <<'_EOF_' -I cannot detect POSIX compliant regcomp/regexec routines. -These are required for AutoGen to work correctly. If you have -such a library present on your system, you must specify it by -setting the LIBS environment variable, e.g., "LIBS='-lregex'". -If you do not have such a library on your system, then you should -download and install, for example, the one from: - ftp://ftp.gnu.org/gnu/rx/ -_EOF_ -AC_MSG_ERROR([Cannot find working POSIX regex library]) fi ]) # end of AC_DEFUN of LIBOPTS_WITHLIB_REGEX diff --git a/sntp/libopts/makeshell.c b/sntp/libopts/makeshell.c index 32bcaa3e9b..40ccedefec 100644 --- a/sntp/libopts/makeshell.c +++ b/sntp/libopts/makeshell.c @@ -1,7 +1,7 @@ /* - * $Id: makeshell.c,v 4.8 2006/03/25 19:24:56 bkorb Exp $ - * Time-stamp: "2005-10-29 13:23:33 bkorb" + * $Id: makeshell.c,v 4.11 2006/06/24 23:34:51 bkorb Exp $ + * Time-stamp: "2006-06-24 10:47:07 bkorb" * * This module will interpret the options set in the tOptions * structure and create a Bourne shell script capable of parsing them. @@ -930,8 +930,8 @@ openOutput( const char* pzFile ) struct stat stbf; do { - char* pzScan; - int sizeLeft; + char* pzScan; + uint32_t sizeLeft; /* * IF we cannot stat the file, @@ -949,10 +949,10 @@ openOutput( const char* pzFile ) exit( EXIT_FAILURE ); } - pzData = (char*)malloc( stbf.st_size + 1 ); + pzData = (char*)malloc( (unsigned)(stbf.st_size + 1) ); fp = fopen( pzFile, "r" FOPEN_BINARY_FLAG ); - sizeLeft = stbf.st_size; + sizeLeft = (unsigned)stbf.st_size; pzScan = pzData; /* @@ -1045,8 +1045,8 @@ genshelloptUsage( tOptions* pOpts, int exitCode ) default: { - int stat; - wait( &stat ); + int sts; + wait( &sts ); } } @@ -1082,8 +1082,8 @@ genshelloptUsage( tOptions* pOpts, int exitCode ) default: { - int stat; - wait( &stat ); + int sts; + wait( &sts ); } } diff --git a/sntp/libopts/nested.c b/sntp/libopts/nested.c index ef32f2845c..00b88691af 100644 --- a/sntp/libopts/nested.c +++ b/sntp/libopts/nested.c @@ -1,6 +1,6 @@ /* - * $Id: nested.c,v 4.4 2006/03/25 19:24:56 bkorb Exp $ + * $Id: nested.c,v 4.9 2006/03/25 19:23:28 bkorb Exp $ * Time-stamp: "2005-07-27 10:10:28 bkorb" * * Automated Options Nested Values module. diff --git a/sntp/libopts/numeric.c b/sntp/libopts/numeric.c index 54be7c10a5..26790df3c7 100644 --- a/sntp/libopts/numeric.c +++ b/sntp/libopts/numeric.c @@ -1,6 +1,6 @@ /* - * $Id: numeric.c,v 4.6 2006/03/25 19:24:56 bkorb Exp $ + * $Id: numeric.c,v 4.7 2006/03/25 19:23:28 bkorb Exp $ * Time-stamp: "2005-02-14 08:22:56 bkorb" */ diff --git a/sntp/libopts/pgusage.c b/sntp/libopts/pgusage.c index 9842a72313..353e0f2775 100644 --- a/sntp/libopts/pgusage.c +++ b/sntp/libopts/pgusage.c @@ -1,7 +1,7 @@ /* - * $Id: pgusage.c,v 4.7 2006/03/25 19:24:56 bkorb Exp $ - * Time-stamp: "2005-10-29 13:23:12 bkorb" + * $Id: pgusage.c,v 4.9 2006/06/24 23:34:51 bkorb Exp $ + * Time-stamp: "2006-06-24 10:48:00 bkorb" * * Automated Options Paged Usage module. * @@ -114,7 +114,7 @@ optionPagedUsage( tOptions* pOptions, tOptDesc* pOD ) case PAGER_STATE_READY: { tSCC zPage[] = "%1$s /tmp/use.%2$lu ; rm -f /tmp/use.%2$lu"; - char* pzPager = getenv( "PAGER" ); + tCC* pzPager = (tCC*)getenv( "PAGER" ); /* * Use the "more(1)" program if "PAGER" has not been defined diff --git a/sntp/libopts/proto.h b/sntp/libopts/proto.h index f15050179a..2779c5c671 100644 --- a/sntp/libopts/proto.h +++ b/sntp/libopts/proto.h @@ -1,7 +1,7 @@ /* -*- buffer-read-only: t -*- vi: set ro: * * Prototypes for autoopts - * Generated Sun Apr 9 11:50:00 PDT 2006 + * Generated Sat Jul 1 14:52:42 PDT 2006 */ #ifndef AUTOOPTS_PROTO_H_GUARD #define AUTOOPTS_PROTO_H_GUARD 1 @@ -21,7 +21,7 @@ LOCAL tSuccess longOptionFind( tOptions* pOpts, char* pzOptName, tOptState* pOptState ); LOCAL tSuccess -shortOptionFind( tOptions* pOpts, tAoUC optValue, tOptState* pOptState ); +shortOptionFind( tOptions* pOpts, uint_t optValue, tOptState* pOptState ); LOCAL tSuccess doImmediateOpts( tOptions* pOpts ); diff --git a/sntp/libopts/putshell.c b/sntp/libopts/putshell.c index feed57b3ae..a97574bb7b 100644 --- a/sntp/libopts/putshell.c +++ b/sntp/libopts/putshell.c @@ -1,7 +1,7 @@ /* - * $Id: putshell.c,v 4.9 2006/03/25 19:24:56 bkorb Exp $ - * Time-stamp: "2005-12-13 10:28:47 bkorb" + * $Id: putshell.c,v 4.11 2006/06/24 23:34:51 bkorb Exp $ + * Time-stamp: "2006-06-24 14:29:07 bkorb" * * This module will interpret the options set in the tOptions * structure and print them to standard out in a fashion that @@ -95,7 +95,7 @@ putQuotedStr( tCC* pzStr ) /* * Emit the string up to the single quote (apostrophe) we just found. */ - fwrite( pzStr, (pz - pzStr), 1, stdout ); + fwrite( pzStr, (unsigned)(pz - pzStr), 1, stdout ); fputc( '\'', stdout ); pzStr = pz; @@ -200,7 +200,7 @@ optionPutShell( tOptions* pOpts ) else if (ch == NUL) { pz--; goto name_done; } else fputc( '_', stdout ); } name_done:; - printf( "=%1$ld # 0x%1$lX\n", val ); + printf( "=%1$lu # 0x%1$lX\n", (unsigned long)val ); val <<= 1; } free( (void*)(pOD->pzLastArg) ); @@ -230,13 +230,13 @@ optionPutShell( tOptions* pOpts ) printf( zOptCookieCt, pOpts->pzPROGNAME, pOD->pz_NAME, ct ); while (--ct >= 0) { - tSCC zOptNumArg[] = "%s_%s_%d="; - tSCC zOptEnd[] = "\nexport %s_%s_%d\n"; + tSCC numarg_z[] = "%s_%s_%d="; + tSCC end_z[] = "\nexport %s_%s_%d\n"; - printf( zOptNumArg, pOpts->pzPROGNAME, pOD->pz_NAME, + printf( numarg_z, pOpts->pzPROGNAME, pOD->pz_NAME, pAL->useCt - ct ); putQuotedStr( *(ppz++) ); - printf( zOptEnd, pOpts->pzPROGNAME, pOD->pz_NAME, + printf( end_z, pOpts->pzPROGNAME, pOD->pz_NAME, pAL->useCt - ct ); } } diff --git a/sntp/libopts/restore.c b/sntp/libopts/restore.c index 959e0f9d62..ce788b3303 100644 --- a/sntp/libopts/restore.c +++ b/sntp/libopts/restore.c @@ -1,6 +1,6 @@ /* - * restore.c $Id: restore.c,v 4.6 2006/03/25 19:24:56 bkorb Exp $ + * restore.c $Id: restore.c,v 4.7 2006/03/25 19:23:28 bkorb Exp $ * Time-stamp: "2005-02-23 15:10:20 bkorb" * * This module's routines will save the current option state to memory diff --git a/sntp/libopts/save.c b/sntp/libopts/save.c index 51fa212f7f..938a4fd124 100644 --- a/sntp/libopts/save.c +++ b/sntp/libopts/save.c @@ -1,7 +1,7 @@ /* - * save.c $Id: save.c,v 4.12 2006/03/25 19:24:56 bkorb Exp $ - * Time-stamp: "2005-02-20 13:49:46 bkorb" + * save.c $Id: save.c,v 4.14 2006/06/24 23:34:51 bkorb Exp $ + * Time-stamp: "2006-07-01 12:41:27 bkorb" * * This module's routines will take the currently set options and * store them into an ".rc" file for re-interpretation the next @@ -100,7 +100,7 @@ findDirName( tOptions* pOpts, int* p_free ) return pzDir; { - tCC* pzEndDir = strchr( ++pzDir, '/' ); + tCC* pzEndDir = strchr( ++pzDir, DIRCH ); char* pzFileName; char* pzEnv; @@ -108,7 +108,7 @@ findDirName( tOptions* pOpts, int* p_free ) char z[ AO_NAME_SIZE ]; if ((pzEndDir - pzDir) > AO_NAME_LIMIT ) return NULL; - strncpy( z, pzDir, (pzEndDir - pzDir) ); + strncpy( z, pzDir, (unsigned)(pzEndDir - pzDir) ); z[ (pzEndDir - pzDir) ] = NUL; pzEnv = getenv( z ); } else { @@ -176,13 +176,13 @@ findFileName( tOptions* pOpts, int* p_free_name ) * Strip off the last component, stat the remaining string and * that string must name a directory */ - char* pzDirCh = strrchr( pzDir, '/' ); + char* pzDirCh = strrchr( pzDir, DIRCH ); if (pzDirCh == NULL) { stBuf.st_mode = S_IFREG; continue; /* bail out of error condition */ } - strncpy( z, pzDir, pzDirCh - pzDir ); + strncpy( z, pzDir, (unsigned)(pzDirCh - pzDir)); z[ pzDirCh - pzDir ] = NUL; if ( (stat( z, &stBuf ) == 0) @@ -308,7 +308,7 @@ printEntry( /* * Print the continuation and the text from the current line */ - fwrite( pzLA, pzNl - pzLA, 1, fp ); + fwrite( pzLA, (unsigned)(pzNl - pzLA), 1, fp ); pzLA = pzNl+1; /* advance the Last Arg pointer */ fputs( "\\\n", fp ); } diff --git a/sntp/libopts/sort.c b/sntp/libopts/sort.c index e7f29ed188..de0bd5634d 100644 --- a/sntp/libopts/sort.c +++ b/sntp/libopts/sort.c @@ -1,7 +1,7 @@ /* - * sort.c $Id: sort.c,v 4.7 2006/03/25 19:24:56 bkorb Exp $ - * Time-stamp: "2005-02-20 17:18:41 bkorb" + * 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. */ @@ -155,7 +155,7 @@ checkShortOpts( tOptions* pOpts, char* pzArg, tOptState* pOS, char** ppzOpts, int* pOptsIdx ) { while (*pzArg != NUL) { - if (FAILED( shortOptionFind( pOpts, *pzArg, pOS ))) + if (FAILED( shortOptionFind( pOpts, (tAoUC)*pzArg, pOS ))) return FAILURE; /* @@ -295,7 +295,7 @@ optionSort( tOptions* pOpts ) if ((pOpts->fOptSet & OPTPROC_SHORTOPT) == 0) { res = longOptionFind( pOpts, pzArg+1, &os ); } else { - res = shortOptionFind( pOpts, pzArg[1], &os ); + res = shortOptionFind( pOpts, (tAoUC)pzArg[1], &os ); } break; } diff --git a/sntp/libopts/stack.c b/sntp/libopts/stack.c index bbea3342be..13137375ae 100644 --- a/sntp/libopts/stack.c +++ b/sntp/libopts/stack.c @@ -1,8 +1,8 @@ /* * stack.c - * $Id: stack.c,v 4.6 2006/03/25 19:24:56 bkorb Exp $ - * Time-stamp: "2005-02-20 16:33:20 bkorb" + * $Id: stack.c,v 4.8 2006/03/25 19:23:28 bkorb Exp $ + * Time-stamp: "2006-07-01 14:35:13 bkorb" * * This is a special option processing routine that will save the * argument to an option in a FIFO queue. @@ -82,6 +82,7 @@ optionUnstackArg( return; } +#ifdef WITH_LIBREGEX { regex_t re; int i, ct, dIdx; @@ -130,7 +131,45 @@ optionUnstackArg( regfree( &re ); } +#else /* not WITH_LIBREGEX */ + { + int i, ct, dIdx; + /* + * search the list for the entry(s) to remove. Entries that + * are removed are *not* copied into the result. The source + * index is incremented every time. The destination only when + * we are keeping a define. + */ + for (i = 0, dIdx = 0, ct = pAL->useCt; --ct >= 0; i++) { + tCC* pzSrc = pAL->apzArgs[ i ]; + char* pzEq = strchr( pzSrc, '=' ); + + if (pzEq != NULL) + *pzEq = NUL; + + if (strcmp( pzSrc, pOptDesc->pzLastArg ) == 0) { + /* + * Remove this entry by reducing the in-use count + * and *not* putting the string pointer back into + * the list. + */ + pAL->useCt--; + } else { + if (pzEq != NULL) + *pzEq = '='; + + /* + * IF we have dropped an entry + * THEN we have to move the current one. + */ + if (dIdx != i) + pAL->apzArgs[ dIdx ] = pzSrc; + dIdx++; + } + } + } +#endif /* WITH_LIBREGEX */ /* * IF we have unstacked everything, * THEN indicate that we don't have any of these options diff --git a/sntp/libopts/streqvcmp.c b/sntp/libopts/streqvcmp.c index 135e23563f..28b255a36b 100644 --- a/sntp/libopts/streqvcmp.c +++ b/sntp/libopts/streqvcmp.c @@ -1,6 +1,6 @@ /* - * $Id: streqvcmp.c,v 4.7 2006/03/25 19:24:56 bkorb Exp $ + * $Id: streqvcmp.c,v 4.9 2006/03/25 19:23:28 bkorb Exp $ * Time-stamp: "2005-10-29 14:05:07 bkorb" * * String Equivalence Comparison diff --git a/sntp/libopts/text_mmap.c b/sntp/libopts/text_mmap.c index 825cd900ef..a8d06b3a63 100644 --- a/sntp/libopts/text_mmap.c +++ b/sntp/libopts/text_mmap.c @@ -1,7 +1,7 @@ /* - * $Id: text_mmap.c,v 4.11 2006/02/01 17:18:00 bkorb Exp $ + * $Id: text_mmap.c,v 4.11 2006/06/24 23:34:51 bkorb Exp $ * - * Time-stamp: "2006-02-01 08:45:37 bkorb" + * Time-stamp: "2006-06-24 10:54:43 bkorb" */ #ifndef MAP_ANONYMOUS @@ -19,7 +19,7 @@ #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 diff --git a/sntp/libopts/tokenize.c b/sntp/libopts/tokenize.c index 074473ccaa..09b80f5854 100644 --- a/sntp/libopts/tokenize.c +++ b/sntp/libopts/tokenize.c @@ -1,6 +1,6 @@ /* * This file defines the string_tokenize interface - * Time-stamp: "2005-04-25 18:47:21 bkorb" + * Time-stamp: "2006-06-24 15:27:49 bkorb" * * string_tokenize copyright 2005 Bruce Korb * @@ -240,7 +240,7 @@ ao_string_tokenize( const char* str ) switch (ch) { case '"': - copy_cooked( &pzDest, (cc_t**)&str ); + copy_cooked( &pzDest, (cc_t**)(void*)&str ); if (str == NULL) { free(res); errno = EINVAL; @@ -251,7 +251,7 @@ ao_string_tokenize( const char* str ) break; case '\'': - copy_raw( &pzDest, (cc_t**)&str ); + copy_raw( &pzDest, (cc_t**)(void*)&str ); if (str == NULL) { free(res); errno = EINVAL; diff --git a/sntp/libopts/usage.c b/sntp/libopts/usage.c index 5d36ab91f6..8d06b31bc9 100644 --- a/sntp/libopts/usage.c +++ b/sntp/libopts/usage.c @@ -1,7 +1,7 @@ /* - * usage.c $Id: usage.c,v 4.11 2006/03/25 19:24:57 bkorb Exp $ - * Time-stamp: "2006-02-04 13:35:26 bkorb" + * usage.c $Id: usage.c,v 4.13 2006/06/24 23:34:51 bkorb Exp $ + * Time-stamp: "2006-07-01 12:41:02 bkorb" * * This module implements the default usage procedure for * Automated Options. It may be overridden, of course. @@ -76,10 +76,10 @@ printExtendedUsage( static void printInitList( - tCC** papz, - ag_bool* pInitIntro, - tCC* pzRc, - tCC* pzPN ); + tCC* const* papz, + ag_bool* pInitIntro, + tCC* pzRc, + tCC* pzPN ); static void printOneUsage( @@ -395,10 +395,10 @@ printExtendedUsage( */ static void printInitList( - tCC** papz, - ag_bool* pInitIntro, - tCC* pzRc, - tCC* pzPN ) + tCC* const* papz, + ag_bool* pInitIntro, + tCC* pzRc, + tCC* pzPN ) { char zPath[ MAXPATHLEN+1 ]; @@ -431,7 +431,7 @@ printInitList( */ if ( (stat( pzPath, &sb ) == 0) && S_ISDIR( sb.st_mode ) ) { - fputc( '/', option_usage_fp ); + fputc( DIRCH, option_usage_fp ); fputs( pzRc, option_usage_fp ); } } diff --git a/sntp/libopts/version.c b/sntp/libopts/version.c index ede91732db..290ee0fe0f 100644 --- a/sntp/libopts/version.c +++ b/sntp/libopts/version.c @@ -1,5 +1,5 @@ -/* $Id: version.c,v 4.7 2006/03/25 19:24:57 bkorb Exp $ +/* $Id: version.c,v 4.8 2006/03/25 19:23:28 bkorb Exp $ * Time-stamp: "2005-12-13 10:29:09 bkorb" * * This module implements the default usage procedure for