MAINTAINERCLEANFILES = Makefile.in
lib_LTLIBRARIES = libopts.la
libopts_la_SOURCES = libopts.c
-libopts_la_LDFLAGS = -version-info 23:0:14
+libopts_la_LDFLAGS = -version-info 23:1:14
EXTRA_DIST = COPYING.lgpl COPYING.mbsd compat \
autoopts.c autoopts.h boolean.c enumeration.c environment.c \
genshell.c genshell.h libopts.c load.c makeshell.c \
/*
- * $Id: autoopts.c,v 2.74 2004/10/15 01:54:16 bkorb Exp $
+ * $Id: autoopts.c,v 4.1 2005/01/01 00:12:40 bkorb Exp $
*
* This file contains all of the routines that must be linked into
* an executable to use the generated option processing. The optional
/*
* IF we are presetting options, then we will ignore any un-presettable
- * options. They are the ones either marked as such, or equivalenced to
- * a different option.
+ * options. They are the ones either marked as such.
*/
if ( ((pOpts->fOptSet & OPTPROC_PRESETTING) != 0)
- && ( ((pOD->fOptState & OPTST_NO_INIT) != 0)
- || (pOD->optEquivIndex != NO_EQUIVALENT)
- ) )
+ && ((pOD->fOptState & OPTST_NO_INIT) != 0)
+ )
return PROBLEM;
/*
if (pOD->optEquivIndex != NO_EQUIVALENT) {
tOptDesc* p = pOpts->pOptDesc + pOD->optEquivIndex;
- if (p->optActualIndex == NO_EQUIVALENT) {
+ /*
+ * IF the current option state has not been defined (set on the
+ * command line), THEN we will allow continued resetting of
+ * the value. Once "defined", then it must not change.
+ */
+ if ((pOD->fOptState & OPTST_DEFINED) != 0) {
+ /*
+ * The equivalenced-to option has been found on the command
+ * line before. Make sure new occurrences are the same type.
+ *
+ * IF this option has been previously equivalenced and
+ * it was not the same equivalenced-to option,
+ * THEN we have a usage problem.
+ */
+ if (p->optActualIndex != pOD->optIndex) {
+ fprintf( stderr, (char*)zMultiEquiv, p->pz_Name, pOD->pz_Name,
+ (pOpts->pOptDesc + p->optActualIndex)->pz_Name);
+ return FAILURE;
+ }
+ } else {
+ /*
+ * Set the equivalenced-to actual option index to no-equivalent
+ * so that we set all the entries below. This option may either
+ * never have been selected before, or else it was selected by
+ * some sort of "presetting" mechanism.
+ */
+ p->optActualIndex = NO_EQUIVALENT;
+ }
+
+ if (p->optActualIndex != pOD->optIndex) {
/*
* First time through, copy over the state
* and add in the equivalence flag
*/
p->optActualValue = pOD->optValue;
p->optActualIndex = pOD->optIndex;
- p->optCookie = pOD->optCookie;
pOptState->flags |= OPTST_EQUIVALENCE;
}
- else if (p->optActualIndex != pOD->optIndex) {
- /*
- * IF this option has been previously equivalenced and
- * it was not the same equivalenced-to option,
- * THEN we have a usage problem.
- */
- fprintf( stderr, (char*)zMultiEquiv, p->pz_Name, pOD->pz_Name,
- (pOpts->pOptDesc + p->optActualIndex)->pz_Name);
- return FAILURE;
- }
-
/*
- * Copy the most recent option argument
+ * Copy the most recent option argument. set membership state
+ * is kept in ``p->optCookie''. Do not overwrite.
*/
p->pzLastArg = pOD->pzLastArg;
pOD = p;
/*
* Time-stamp: "2004-08-30 19:09:50 bkorb"
*
- * autoopts.h $Id: autoopts.h,v 2.50 2004/10/02 21:37:46 bkorb Exp $
+ * autoopts.h $Id: autoopts.h,v 4.1 2005/01/01 00:12:40 bkorb Exp $
*
* This file defines all the global structures and special values
* used in the automated option processing library.
/*
- * $Id: boolean.c,v 2.11 2004/02/02 03:31:50 bkorb Exp $
+ * $Id: boolean.c,v 4.1 2005/01/01 00:12:40 bkorb Exp $
*
* Automated Options Paged Usage module.
*
* Author: Gary V Vaughan <gvaughan@oranda.demon.co.uk>
* Created: Mon Jun 30 15:54:46 1997
*
- * $Id: compat.h,v 2.20 2004/10/15 01:54:16 bkorb Exp $
+ * $Id: compat.h,v 4.1 2005/01/01 00:12:37 bkorb Exp $
*/
#ifndef COMPAT_H
#define COMPAT_H 1
/*
* Author: Gary V Vaughan <gvaughan@oranda.demon.co.uk>
* Created: Tue Jun 24 15:07:31 1997
- * Last Modified: $Date: 2004/10/24 19:36:23 $
+ * Last Modified: $Date: 2005/01/01 00:12:37 $
* by: bkorb
*
- * $Id: pathfind.c,v 2.4 2004/10/24 19:36:23 bkorb Exp $
+ * $Id: pathfind.c,v 4.1 2005/01/01 00:12:37 bkorb Exp $
*/
/* Code: */
/*
- * $Id: enumeration.c,v 2.33 2004/10/02 21:37:46 bkorb Exp $
+ * $Id: enumeration.c,v 4.1 2005/01/01 00:12:40 bkorb Exp $
*
* Automated Options Paged Usage module.
*
/*
- * $Id: environment.c,v 1.1 2004/10/02 22:47:01 bkorb Exp $
+ * $Id: environment.c,v 4.1 2005/01/01 00:12:40 bkorb Exp $
*
* This file contains all of the routines that must be linked into
* an executable to use the generated option processing. The optional
*
* DO NOT EDIT THIS FILE (genshell.c)
*
- * It has been AutoGen-ed Sunday October 24, 2004 at 12:40:14 PM PDT
+ * It has been AutoGen-ed Friday December 31, 2004 at 08:18:58 PM PST
* From the definitions genshell.def
* and the template file options
*/
*
* DO NOT EDIT THIS FILE (genshell.h)
*
- * It has been AutoGen-ed Sunday October 24, 2004 at 12:40:14 PM PDT
+ * It has been AutoGen-ed Friday December 31, 2004 at 08:18:58 PM PST
* From the definitions genshell.def
* and the template file options
*/
dnl
dnl EDIT THIS FILE WITH CAUTION (libopts.m4)
dnl
-dnl It has been AutoGen-ed Saturday October 30, 2004 at 05:47:01 AM EDT
+dnl It has been AutoGen-ed Sunday January 9, 2005 at 06:06:21 AM EST
dnl From the definitions stdin
dnl and the template file conftest.tpl
dnl
]) # end of AC_DEFUN of LIBOPTS_WITHLIB_REGEX
-AC_DEFUN([LIBOPTS_RUN_ALLOCATED_CTIME],[
- AC_MSG_CHECKING([whether ctime() allocates memory for its result])
- AC_CACHE_VAL([libopts_cv_run_allocated_ctime],[
- AC_TRY_RUN([@%:@include <time.h>
-int main (int argc, char** argv) {
- time_t timeVal = time( (time_t*)NULL );
- char* pzTime = ctime( &timeVal );
- free( (void*)pzTime );
- return 0; }],
- [libopts_cv_run_allocated_ctime=yes],[libopts_cv_run_allocated_ctime=no],[libopts_cv_run_allocated_ctime=no]
- ) # end of TRY_RUN
- ]) # end of AC_CACHE_VAL for libopts_cv_run_allocated_ctime
- AC_MSG_RESULT([${libopts_cv_run_allocated_ctime}])
-
- if test "X${libopts_cv_run_allocated_ctime}" != Xno
- then
- AC_DEFINE([HAVE_ALLOCATED_CTIME],[1],
- [Define this if ctime() allocates memory for its result])
- fi
-
-]) # end of AC_DEFUN of LIBOPTS_RUN_ALLOCATED_CTIME
-
-
AC_DEFUN([LIBOPTS_RUN_PATHFIND],[
AC_MSG_CHECKING([whether pathfind(3) works])
AC_CACHE_VAL([libopts_cv_run_pathfind],[
# Check to see if a working libregex can be found.
LIBOPTS_WITHLIB_REGEX
- # Check to see if ctime() allocates memory for its result.
- LIBOPTS_RUN_ALLOCATED_CTIME
-
# Check to see if pathfind(3) works.
LIBOPTS_RUN_PATHFIND
dnl @synopsis LIBOPTS_CHECK
dnl
dnl If autoopts-config works, add the linking information to LIBS.
-dnl Otherwise, add ``libopts-23.0.14''
+dnl Otherwise, add ``libopts-23.1.14''
dnl to SUBDIRS and run all the config tests that the library needs.
dnl
AC_DEFUN([LIBOPTS_CHECK],[
# AC_CHECK_LIB for SVR4 libgen, and use it if it defines pathfind.
# ----------------------------------------------------------------------
AC_CHECK_LIB(gen, pathfind)
-
AC_MSG_CHECKING([whether autoopts-config can be found])
AC_ARG_WITH([autoopts-config],
AC_HELP_STRING([--with-autoopts-config],
/*
- * $Id: load.c,v 1.5 2004/10/24 19:36:23 bkorb Exp $
+ * $Id: load.c,v 4.1 2005/01/01 00:12:40 bkorb Exp $
*
* This file contains the routines that deal with processing text strings
* for options, either from a NUL-terminated string passed in or from an
* allocated and we need to deallocate it.
*/
if (pzPath != pzProgPath)
- free( pzPath );
+ free( (void*)pzPath );
}
/*
/*
- * $Id: makeshell.c,v 2.51 2004/02/16 22:12:50 bkorb Exp $
+ * $Id: makeshell.c,v 4.1 2005/01/01 00:12:40 bkorb Exp $
*
* This module will interpret the options set in the tOptions
* structure and create a Bourne shell script capable of parsing them.
/*
- * $Id: numeric.c,v 2.14 2004/02/02 03:31:50 bkorb Exp $
+ * $Id: numeric.c,v 4.1 2005/01/01 00:12:41 bkorb Exp $
*
* Automated Options Paged Usage module.
*
*
* DO NOT EDIT THIS FILE (options.h)
*
- * It has been AutoGen-ed Sunday October 24, 2004 at 12:40:15 PM PDT
+ * It has been AutoGen-ed Friday December 31, 2004 at 08:18:58 PM PST
* From the definitions funcs.def
* and the template file options_h
*
};
#define OPTIONS_STRUCT_VERSION 94222
-#define OPTIONS_VERSION_STRING "23:0:14"
+#define OPTIONS_VERSION_STRING "23:1:14"
#define OPTIONS_MINIMUM_VERSION 36864
#define OPTIONS_MIN_VER_STRING "9:0:0"
extern void optionLoadLine( tOptions*, const char* );
-/* From: autoopts.c line 1032
+/* From: autoopts.c line 1048
*
* optionProcess - this is the main option processing routine
*
/*
- * $Id: pgusage.c,v 2.19 2004/02/02 03:31:51 bkorb Exp $
+ * $Id: pgusage.c,v 4.1 2005/01/01 00:12:42 bkorb Exp $
*
* Automated Options Paged Usage module.
*
/*
- * $Id: putshell.c,v 2.26 2004/07/22 02:46:22 bkorb Exp $
+ * $Id: putshell.c,v 4.1 2005/01/01 00:12:42 bkorb Exp $
*
* This module will interpret the options set in the tOptions
* structure and print them to standard out in a fashion that
/*
- * restore.c $Id: restore.c,v 2.11 2004/02/02 03:31:51 bkorb Exp $
+ * restore.c $Id: restore.c,v 4.1 2005/01/01 00:12:42 bkorb Exp $
*
* This module's routines will save the current option state to memory
* and restore it. If saved prior to the initial optionProcess call,
/*
- * save.c $Id: save.c,v 2.31 2004/07/22 02:46:23 bkorb Exp $
+ * save.c $Id: save.c,v 4.2 2005/01/01 04:18:03 bkorb Exp $
*
* This module's routines will take the currently set options and
* store them into an ".rc" file for re-interpretation the next
/*
* The return values for ctime(), localtime(), and gmtime()
* normally point to static data that is overwritten by each call.
+ * The test to detect allocated ctime, so we leak the memory.
*/
- free( (void*)pzTime );
+ free( pzTime );
#endif
}
/*
* bit flag strings get allocated
*/
- free( (void*)p->pzLastArg );
+ free( (char*)p->pzLastArg );
p->pzLastArg = val;
break;
}
/*
- * sort.c $Id: sort.c,v 2.8 2004/02/02 03:31:51 bkorb Exp $
+ * sort.c $Id: sort.c,v 4.1 2005/01/01 00:12:42 bkorb Exp $
*
* This module implements argument sorting.
*/
/*
* stack.c
- * $Id: stack.c,v 2.22 2004/02/02 03:31:51 bkorb Exp $
+ * $Id: stack.c,v 4.1 2005/01/01 00:12:42 bkorb Exp $
* This is a special option processing routine that will save the
* argument to an option in a FIFO queue.
*/
if (pOptDesc->optActualIndex != pOptDesc->optIndex)
pOptDesc = pOpts->pOptDesc + pOptDesc->optActualIndex;
- /*
- * Being called is the most authoritative way to be sure an
- * option wants to have its argument values stacked...
- */
- pOptDesc->fOptState |= OPTST_STACKED;
-
/*
* IF this is a negated ('+'-marked) option
* THEN we unstack the argument
/*
- * $Id: streqv.h,v 2.15 2004/10/02 21:37:46 bkorb Exp $
+ * $Id: streqv.h,v 4.1 2005/01/01 00:12:42 bkorb Exp $
*
* String Equivalence
*
/*
- * $Id: streqvcmp.c,v 2.24 2004/02/02 03:31:51 bkorb Exp $
+ * $Id: streqvcmp.c,v 4.1 2005/01/01 00:12:42 bkorb Exp $
*
* String Equivalence Comparison
*
*
* DO NOT EDIT THIS FILE (usage-txt.h)
*
- * It has been AutoGen-ed Sunday October 24, 2004 at 12:40:14 PM PDT
+ * It has been AutoGen-ed Friday December 31, 2004 at 08:18:58 PM PST
* From the definitions usage-txt.def
* and the template file usage-txt.tpl
*
/*
- * usage.c $Id: usage.c,v 2.47 2004/02/02 03:31:51 bkorb Exp $
+ * usage.c $Id: usage.c,v 4.1 2005/01/01 00:12:42 bkorb Exp $
*
* This module implements the default usage procedure for
* Automated Options. It may be overridden, of course.
-/* $Id: version.c,v 2.19 2004/02/02 03:31:51 bkorb Exp $
+/* $Id: version.c,v 4.1 2005/01/01 00:12:42 bkorb Exp $
*
* This module implements the default usage procedure for
* Automated Options. It may be overridden, of course.
dnl
dnl EDIT THIS FILE WITH CAUTION (libopts.m4)
dnl
-dnl It has been AutoGen-ed Saturday October 30, 2004 at 05:47:01 AM EDT
+dnl It has been AutoGen-ed Sunday January 9, 2005 at 06:06:21 AM EST
dnl From the definitions stdin
dnl and the template file conftest.tpl
dnl
]) # end of AC_DEFUN of LIBOPTS_WITHLIB_REGEX
-AC_DEFUN([LIBOPTS_RUN_ALLOCATED_CTIME],[
- AC_MSG_CHECKING([whether ctime() allocates memory for its result])
- AC_CACHE_VAL([libopts_cv_run_allocated_ctime],[
- AC_TRY_RUN([@%:@include <time.h>
-int main (int argc, char** argv) {
- time_t timeVal = time( (time_t*)NULL );
- char* pzTime = ctime( &timeVal );
- free( (void*)pzTime );
- return 0; }],
- [libopts_cv_run_allocated_ctime=yes],[libopts_cv_run_allocated_ctime=no],[libopts_cv_run_allocated_ctime=no]
- ) # end of TRY_RUN
- ]) # end of AC_CACHE_VAL for libopts_cv_run_allocated_ctime
- AC_MSG_RESULT([${libopts_cv_run_allocated_ctime}])
-
- if test "X${libopts_cv_run_allocated_ctime}" != Xno
- then
- AC_DEFINE([HAVE_ALLOCATED_CTIME],[1],
- [Define this if ctime() allocates memory for its result])
- fi
-
-]) # end of AC_DEFUN of LIBOPTS_RUN_ALLOCATED_CTIME
-
-
AC_DEFUN([LIBOPTS_RUN_PATHFIND],[
AC_MSG_CHECKING([whether pathfind(3) works])
AC_CACHE_VAL([libopts_cv_run_pathfind],[
# Check to see if a working libregex can be found.
LIBOPTS_WITHLIB_REGEX
- # Check to see if ctime() allocates memory for its result.
- LIBOPTS_RUN_ALLOCATED_CTIME
-
# Check to see if pathfind(3) works.
LIBOPTS_RUN_PATHFIND
dnl @synopsis LIBOPTS_CHECK
dnl
dnl If autoopts-config works, add the linking information to LIBS.
-dnl Otherwise, add ``libopts-23.0.14''
+dnl Otherwise, add ``libopts-23.1.14''
dnl to SUBDIRS and run all the config tests that the library needs.
dnl
AC_DEFUN([LIBOPTS_CHECK],[
# AC_CHECK_LIB for SVR4 libgen, and use it if it defines pathfind.
# ----------------------------------------------------------------------
AC_CHECK_LIB(gen, pathfind)
-
AC_MSG_CHECKING([whether autoopts-config can be found])
AC_ARG_WITH([autoopts-config],
AC_HELP_STRING([--with-autoopts-config],