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
/*
- * $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
# endif
#endif
+#ifndef HAVE_STRCHR
+# include "compat/strchr.c"
+#endif
+
static const char zNil[] = "";
#define SKIP_RC_FILES(po) \
* 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;
* 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 */
* 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 );
}
/*
- * 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
#undef EXPORT
#define EXPORT
+#if defined(_WIN32)
+# define DIRch '\\'
+#else
+# define DIRCH '/'
+#endif
+
/*
* Convert the number to a list usable in a printf call
*/
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 )
# 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
extern tOptProc optionPrintVersion, optionPagedUsage, optionLoadOpt;
-#define LOCAL static
-#include "proto.h"
-
#endif /* AUTOGEN_AUTOOPTS_H */
/*
* Local Variables:
/*
- * $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.
/* --- 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 <gvaughan@oranda.demon.co.uk>
* 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
#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
/*
* Author: Gary V Vaughan <gvaughan@oranda.demon.co.uk>
* 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: */
--- /dev/null
+/*
+ SYNOPSIS
+ #include <string.h>
+
+ 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 */
/*
- * $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.
*/
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;
continue;
pz = zFileName + len;
- if (pz[-1] != '/')
- *(pz++) = '/';
+ if (pz[-1] != DIRCH)
+ *(pz++) = DIRCH;
strcpy( pz, pOpts->pzRcName );
}
* 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;
/*
- * $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.
* 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.
* 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;
res++;
/* FALLTHROUGH */
case '\n': /* NL - emit newline */
- *pRes = nl;
+ *pRes = (char)nl;
return res;
case 'a': *pRes = '\a'; break;
* 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;
/*
- * $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.
*
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 */
}
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 );
}
/*
/*
* 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:
/*
* print the list of enumeration names.
*/
- enumError( pOpts, pOD, paz_names, name_ct );
+ enumError( pOpts, pOD, paz_names, (int)name_ct );
return;
case 1UL:
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)
if (*pz != NUL) {
if (len >= AO_NAME_LIMIT)
break;
- strncpy( z, pzArg, len );
+ strncpy( z, pzArg, (unsigned)len );
z[len] = NUL;
p = z;
} else {
/*
- * $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
#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"
/*
- * $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
*
* 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:
* @*
int skip = 2;
switch (pzName[2]) {
- case '/':
+ case DIRCH:
skip = 3;
case NUL:
break;
* 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" );
return AG_FALSE;
}
- pz = strrchr( pzPath, '/' );
+ pz = strrchr( pzPath, DIRCH );
/*
* IF we cannot find a directory name separator,
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 );
/*
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
# ----------------------------------------------------------------------
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]])
]) # 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
/*
- * $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.
struct stat stbf;
do {
- char* pzScan;
- int sizeLeft;
+ char* pzScan;
+ uint32_t sizeLeft;
/*
* IF we cannot stat the file,
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;
/*
default:
{
- int stat;
- wait( &stat );
+ int sts;
+ wait( &sts );
}
}
default:
{
- int stat;
- wait( &stat );
+ int sts;
+ wait( &sts );
}
}
/*
- * $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.
/*
- * $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"
*/
/*
- * $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.
*
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
/* -*- 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
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 );
/*
- * $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
/*
* 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;
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) );
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 );
}
}
/*
- * 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
/*
- * 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
return pzDir;
{
- tCC* pzEndDir = strchr( ++pzDir, '/' );
+ tCC* pzEndDir = strchr( ++pzDir, DIRCH );
char* pzFileName;
char* pzEnv;
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 {
* 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)
/*
* 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 );
}
/*
- * 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.
*/
char** ppzOpts, int* pOptsIdx )
{
while (*pzArg != NUL) {
- if (FAILED( shortOptionFind( pOpts, *pzArg, pOS )))
+ if (FAILED( shortOptionFind( pOpts, (tAoUC)*pzArg, pOS )))
return FAILURE;
/*
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;
}
/*
* 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.
return;
}
+#ifdef WITH_LIBREGEX
{
regex_t re;
int i, ct, dIdx;
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
/*
- * $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
/*
- * $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
#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
/*
* 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
*
switch (ch) {
case '"':
- copy_cooked( &pzDest, (cc_t**)&str );
+ copy_cooked( &pzDest, (cc_t**)(void*)&str );
if (str == NULL) {
free(res);
errno = EINVAL;
break;
case '\'':
- copy_raw( &pzDest, (cc_t**)&str );
+ copy_raw( &pzDest, (cc_t**)(void*)&str );
if (str == NULL) {
free(res);
errno = EINVAL;
/*
- * 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.
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(
*/
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 ];
*/
if ( (stat( pzPath, &sb ) == 0)
&& S_ISDIR( sb.st_mode ) ) {
- fputc( '/', option_usage_fp );
+ fputc( DIRCH, option_usage_fp );
fputs( pzRc, option_usage_fp );
}
}
-/* $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
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
/*
- * $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
# endif
#endif
+#ifndef HAVE_STRCHR
+# include "compat/strchr.c"
+#endif
+
static const char zNil[] = "";
#define SKIP_RC_FILES(po) \
* 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;
* 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 */
* 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 );
}
/*
- * 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
#undef EXPORT
#define EXPORT
+#if defined(_WIN32)
+# define DIRch '\\'
+#else
+# define DIRCH '/'
+#endif
+
/*
* Convert the number to a list usable in a printf call
*/
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 )
# 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
extern tOptProc optionPrintVersion, optionPagedUsage, optionLoadOpt;
-#define LOCAL static
-#include "proto.h"
-
#endif /* AUTOGEN_AUTOOPTS_H */
/*
* Local Variables:
/*
- * $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.
/* --- 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 <gvaughan@oranda.demon.co.uk>
* 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
#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
/*
* Author: Gary V Vaughan <gvaughan@oranda.demon.co.uk>
* 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: */
--- /dev/null
+/*
+ SYNOPSIS
+ #include <string.h>
+
+ 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 */
/*
- * $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.
*/
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;
continue;
pz = zFileName + len;
- if (pz[-1] != '/')
- *(pz++) = '/';
+ if (pz[-1] != DIRCH)
+ *(pz++) = DIRCH;
strcpy( pz, pOpts->pzRcName );
}
* 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;
/*
- * $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.
* 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.
* 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;
res++;
/* FALLTHROUGH */
case '\n': /* NL - emit newline */
- *pRes = nl;
+ *pRes = (char)nl;
return res;
case 'a': *pRes = '\a'; break;
* 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;
/*
- * $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.
*
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 */
}
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 );
}
/*
/*
* 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:
/*
* print the list of enumeration names.
*/
- enumError( pOpts, pOD, paz_names, name_ct );
+ enumError( pOpts, pOD, paz_names, (int)name_ct );
return;
case 1UL:
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)
if (*pz != NUL) {
if (len >= AO_NAME_LIMIT)
break;
- strncpy( z, pzArg, len );
+ strncpy( z, pzArg, (unsigned)len );
z[len] = NUL;
p = z;
} else {
/*
- * $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
#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"
/*
- * $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
*
* 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:
* @*
int skip = 2;
switch (pzName[2]) {
- case '/':
+ case DIRCH:
skip = 3;
case NUL:
break;
* 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" );
return AG_FALSE;
}
- pz = strrchr( pzPath, '/' );
+ pz = strrchr( pzPath, DIRCH );
/*
* IF we cannot find a directory name separator,
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 );
/*
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
# ----------------------------------------------------------------------
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]])
]) # 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
/*
- * $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.
struct stat stbf;
do {
- char* pzScan;
- int sizeLeft;
+ char* pzScan;
+ uint32_t sizeLeft;
/*
* IF we cannot stat the file,
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;
/*
default:
{
- int stat;
- wait( &stat );
+ int sts;
+ wait( &sts );
}
}
default:
{
- int stat;
- wait( &stat );
+ int sts;
+ wait( &sts );
}
}
/*
- * $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.
/*
- * $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"
*/
/*
- * $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.
*
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
/* -*- 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
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 );
/*
- * $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
/*
* 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;
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) );
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 );
}
}
/*
- * 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
/*
- * 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
return pzDir;
{
- tCC* pzEndDir = strchr( ++pzDir, '/' );
+ tCC* pzEndDir = strchr( ++pzDir, DIRCH );
char* pzFileName;
char* pzEnv;
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 {
* 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)
/*
* 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 );
}
/*
- * 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.
*/
char** ppzOpts, int* pOptsIdx )
{
while (*pzArg != NUL) {
- if (FAILED( shortOptionFind( pOpts, *pzArg, pOS )))
+ if (FAILED( shortOptionFind( pOpts, (tAoUC)*pzArg, pOS )))
return FAILURE;
/*
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;
}
/*
* 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.
return;
}
+#ifdef WITH_LIBREGEX
{
regex_t re;
int i, ct, dIdx;
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
/*
- * $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
/*
- * $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
#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
/*
* 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
*
switch (ch) {
case '"':
- copy_cooked( &pzDest, (cc_t**)&str );
+ copy_cooked( &pzDest, (cc_t**)(void*)&str );
if (str == NULL) {
free(res);
errno = EINVAL;
break;
case '\'':
- copy_raw( &pzDest, (cc_t**)&str );
+ copy_raw( &pzDest, (cc_t**)(void*)&str );
if (str == NULL) {
free(res);
errno = EINVAL;
/*
- * 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.
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(
*/
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 ];
*/
if ( (stat( pzPath, &sb ) == 0)
&& S_ISDIR( sb.st_mode ) ) {
- fputc( '/', option_usage_fp );
+ fputc( DIRCH, option_usage_fp );
fputs( pzRc, option_usage_fp );
}
}
-/* $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