updated libopts to 5.18.3

This commit is contained in:
Nikos Mavrogiannopoulos
2014-07-29 22:19:17 +02:00
parent 60dcb9d62f
commit a988dc11dc
52 changed files with 272 additions and 240 deletions

View File

@@ -1,7 +1,7 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

View File

@@ -1,7 +1,7 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

View File

@@ -115,7 +115,7 @@ These macros work as follows:
LICENSING:
This material is Copyright (C) 1992-2013 by Bruce Korb. You are
This material is Copyright (C) 1992-2014 by Bruce Korb. You are
licensed to use this under the terms of either the GNU Lesser General
Public License (see: COPYING.lgpl), or, at your option, the modified
Berkeley Software Distribution License (see: COPYING.mbsd). Both of

View File

@@ -1,6 +1,6 @@
/*
* 29 bits for 46 character classifications
* generated by char-mapper on 10/16/13 at 13:46:13
* generated by char-mapper on 05/17/14 at 07:49:44
*
* This file contains the character classifications
* used by AutoGen and AutoOpts for identifying tokens.
@@ -8,7 +8,7 @@
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
* AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
* AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control

View File

@@ -12,7 +12,7 @@
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
* AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
* AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control

View File

@@ -2,11 +2,11 @@
*
* DO NOT EDIT THIS FILE (ao-strs.c)
*
* It has been AutoGen-ed October 16, 2013 at 01:46:13 PM by AutoGen 5.18.2
* It has been AutoGen-ed May 17, 2014 at 07:49:44 AM by AutoGen 5.18.3
* From the definitions ao-strs.def
* and the template file strings
*
* Copyright (C) 2011-2013 Bruce Korb, all rights reserved.
* Copyright (C) 2011-2014 Bruce Korb, all rights reserved.
* This is free software. It is licensed for use, modification and
* redistribution under the terms of the
* Modified (3 clause) Berkeley Software Distribution License

View File

@@ -2,11 +2,11 @@
*
* DO NOT EDIT THIS FILE (ao-strs.h)
*
* It has been AutoGen-ed October 16, 2013 at 01:46:13 PM by AutoGen 5.18.2
* It has been AutoGen-ed May 17, 2014 at 07:49:44 AM by AutoGen 5.18.3
* From the definitions ao-strs.def
* and the template file strings
*
* Copyright (C) 2011-2013 Bruce Korb, all rights reserved.
* Copyright (C) 2011-2014 Bruce Korb, all rights reserved.
* This is free software. It is licensed for use, modification and
* redistribution under the terms of the
* Modified (3 clause) Berkeley Software Distribution License

View File

@@ -13,7 +13,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
* AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
* AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control

View File

@@ -11,7 +11,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
* AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
* AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
@@ -32,6 +32,7 @@
#ifndef AUTOGEN_AUTOOPTS_H
#define AUTOGEN_AUTOOPTS_H
#include <stdnoreturn.h>
#define AO_NAME_LIMIT 127
#define AO_NAME_SIZE ((size_t)(AO_NAME_LIMIT + 1))
@@ -40,7 +41,7 @@
# ifdef PATH_MAX
# define AG_PATH_MAX ((size_t)PATH_MAX)
# else
# define AG_PATH_MAX ((size_t)4096)
# define AG_PATH_MAX 4096
# endif
#else
# if defined(PATH_MAX) && (PATH_MAX > MAXPATHLEN)
@@ -382,6 +383,16 @@ extern char* strchr(char const *s, int c);
extern char* strrchr(char const *s, int c);
#endif
/**
* INQUERY_CALL() tests whether the option handling function has been
* called by an inquery (help text needed, or option being reset),
* or called by a set-the-option operation.
*/
#define INQUERY_CALL(_o, _d) ( \
((_o) <= OPTPROC_EMIT_LIMIT) \
|| ((_d) == NULL) \
|| (((_d)->fOptState & OPTST_RESET) != 0) )
/**
* Define and initialize all the user visible strings.
* We do not do translations. If translations are to be done, then

View File

@@ -2,18 +2,18 @@
*
* DO NOT EDIT THIS FILE (options.h)
*
* It has been AutoGen-ed October 16, 2013 at 01:46:20 PM by AutoGen 5.18.2
* It has been AutoGen-ed May 17, 2014 at 07:49:51 AM by AutoGen 5.18.3
* From the definitions funcs.def
* and the template file options_h
*
* This file defines all the global structures and special values
* used in the automated option processing library.
*
* Automated Options Copyright (C) 1992-2013 by Bruce Korb
* Automated Options Copyright (C) 1992-2014 by Bruce Korb
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
* AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
* AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
@@ -101,15 +101,15 @@
* @{
*/
/// autoopts structure version
#define OPTIONS_STRUCT_VERSION 163841
#define OPTIONS_STRUCT_VERSION 163842
/// autoopts structure version string
#define OPTIONS_VERSION_STRING "40:1:15"
#define OPTIONS_VERSION_STRING "40:2:15"
/// minimum version the autoopts library supports
#define OPTIONS_MINIMUM_VERSION 102400
/// minimum version the autoopts library supports as a string
#define OPTIONS_MIN_VER_STRING "25:0:0"
/// the display version of the autoopts library, as a string
#define OPTIONS_DOTTED_VERSION "40.1"
#define OPTIONS_DOTTED_VERSION "40.2"
/// convert a version/release number pair to an integer value
#define OPTIONS_VER_TO_NUM(_v, _r) (((_v) * 4096) + (_r))
/// @}

View File

@@ -4,7 +4,7 @@
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
* AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
* AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control

View File

@@ -2,13 +2,13 @@
*
* DO NOT EDIT THIS FILE (usage-txt.h)
*
* It has been AutoGen-ed October 16, 2013 at 01:46:18 PM by AutoGen 5.18.2
* It has been AutoGen-ed May 17, 2014 at 07:49:49 AM by AutoGen 5.18.3
* From the definitions usage-txt.def
* and the template file usage-txt.tpl
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
* AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
* AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
@@ -190,7 +190,7 @@ char const option_lib_text[4285] =
/* 228 */ "realloc of %d bytes at 0x%p failed\n\0"
/* 264 */ "\tThis is less than the minimum library version: \0"
/* 314 */ "Automated Options version %s\n"
"\tCopyright (C) 1999-2013 by Bruce Korb - all rights reserved\n\0"
"\tCopyright (C) 1999-2014 by Bruce Korb - all rights reserved\n\0"
/* 405 */ "(AutoOpts bug): %s.\n\0"
/* 427 */ "optionResetOpt() called, but reset-option not configured\0"
/* 484 */ "could not locate the 'help' option\0"
@@ -379,7 +379,7 @@ static void dummy_func(void) {
puts(_("\tThis is less than the minimum library version: "));
#line 121 "../version.c"
puts(_("Automated Options version %s\n"
"\tCopyright (C) 1999-2013 by Bruce Korb - all rights reserved\n"));
"\tCopyright (C) 1999-2014 by Bruce Korb - all rights reserved\n"));
#line 82 "../makeshell.c"
puts(_("(AutoOpts bug): %s.\n"));
#line 90 "../reset.c"
@@ -468,15 +468,15 @@ static void dummy_func(void) {
puts(_("%s error: no saved option state\n"));
#line 231 "../autoopts.c"
puts(_("'%s' is not a command line option.\n"));
#line 114 "../time.c"
#line 111 "../time.c"
puts(_("%s error: '%s' is not a recognizable date/time.\n"));
#line 132 "../save.c"
puts(_("'%s' not defined\n"));
#line 53 "../time.c"
#line 50 "../time.c"
puts(_("%s error: '%s' is not a recognizable time duration.\n"));
#line 92 "../check.c"
puts(_("%s error: The %s option must appear %d times.\n"));
#line 157 "../numeric.c"
#line 164 "../numeric.c"
puts(_("%s error: '%s' is not a recognizable number.\n"));
#line 200 "../enum.c"
puts(_("%s error: %s exceeds %s keyword count\n"));

View File

@@ -13,7 +13,7 @@
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
* AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
* AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
@@ -36,8 +36,8 @@
* private:
*
* what: Decipher a boolean value
* arg: + tOptions* + pOpts + program options descriptor +
* arg: + tOptDesc* + pOptDesc + the descriptor for this arg +
* arg: + tOptions* + opts + program options descriptor +
* arg: + tOptDesc* + od + the descriptor for this arg +
*
* doc:
* Decipher a true or false value for a boolean valued option argument.
@@ -45,28 +45,23 @@
* it is an empty string or it is a number that evaluates to zero.
=*/
void
optionBooleanVal(tOptions * pOpts, tOptDesc * pOD )
optionBooleanVal(tOptions * opts, tOptDesc * od)
{
char* pz;
bool res = true;
(void)pOpts;
if (pOpts <= OPTPROC_EMIT_LIMIT)
if (INQUERY_CALL(opts, od))
return;
if ((pOD->fOptState & OPTST_RESET) != 0)
return;
if (pOD->optArg.argString == NULL) {
pOD->optArg.argBool = false;
if (od->optArg.argString == NULL) {
od->optArg.argBool = false;
return;
}
switch (*(pOD->optArg.argString)) {
switch (*(od->optArg.argString)) {
case '0':
{
long val = strtol( pOD->optArg.argString, &pz, 0 );
long val = strtol(od->optArg.argString, &pz, 0);
if ((val != 0) || (*pz != NUL))
break;
/* FALLTHROUGH */
@@ -79,16 +74,16 @@ optionBooleanVal(tOptions * pOpts, tOptDesc * pOD )
res = false;
break;
case '#':
if (pOD->optArg.argString[1] != 'f')
if (od->optArg.argString[1] != 'f')
break;
res = false;
}
if (pOD->fOptState & OPTST_ALLOC_ARG) {
AGFREE(pOD->optArg.argString);
pOD->fOptState &= ~OPTST_ALLOC_ARG;
if (od->fOptState & OPTST_ALLOC_ARG) {
AGFREE(od->optArg.argString);
od->fOptState &= ~OPTST_ALLOC_ARG;
}
pOD->optArg.argBool = res;
od->optArg.argBool = res;
}
/** @}
*

View File

@@ -9,7 +9,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
* AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
* AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control

View File

@@ -3,7 +3,7 @@
* compat.h is free software.
* This file is part of AutoGen and AutoOpts.
*
* AutoGen Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
* AutoGen Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control

View File

@@ -9,7 +9,7 @@
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
* AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
* AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control

View File

@@ -9,7 +9,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
* AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
* AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control

View File

@@ -10,7 +10,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
* AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
* AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control

View File

@@ -14,7 +14,7 @@
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
* AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
* AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control

View File

@@ -13,7 +13,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
* AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
* AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control

View File

@@ -10,7 +10,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
* AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
* AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control

View File

@@ -12,7 +12,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
* AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
* AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control

View File

@@ -2,11 +2,11 @@
*
* DO NOT EDIT THIS FILE (genshell.c)
*
* It has been AutoGen-ed October 16, 2013 at 01:46:16 PM by AutoGen 5.18.2
* It has been AutoGen-ed May 17, 2014 at 07:49:48 AM by AutoGen 5.18.3
* From the definitions genshell.def
* and the template file options
*
* Generated from AutoOpts 40:1:15 templates.
* Generated from AutoOpts 40:2:15 templates.
*
* AutoOpts is a copyrighted work. This source file is not encumbered
* by AutoOpts licensing, but is provided under the licensing terms chosen
@@ -19,7 +19,7 @@
* The genshellopt program is copyrighted and licensed
* under the following terms:
*
* Copyright (C) 1999-2013 Bruce Korb, all rights reserved.
* Copyright (C) 1999-2014 Bruce Korb, all rights reserved.
* This is free software. It is licensed for use, modification and
* redistribution under the terms of the GNU Lesser General Public License,
* version 2 or later <http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html>
@@ -66,7 +66,7 @@ extern tUsageProc genshelloptUsage;
*/
static char const genshellopt_opt_strs[1769] =
/* 0 */ "genshellopt 1\n"
"Copyright (C) 1999-2013 Bruce Korb, all rights reserved.\n"
"Copyright (C) 1999-2014 Bruce Korb, all rights reserved.\n"
"This is free software. It is licensed for use, modification and\n"
"redistribution under the terms of the GNU Lesser General Public License,\n"
"version 2 or later <http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html>\n\0"
@@ -493,7 +493,7 @@ static void bogus_function(void) {
*/
/* referenced via genshelloptOptions.pzCopyright */
puts(_("genshellopt 1\n\
Copyright (C) 1999-2013 Bruce Korb, all rights reserved.\n\
Copyright (C) 1999-2014 Bruce Korb, all rights reserved.\n\
This is free software. It is licensed for use, modification and\n\
redistribution under the terms of the GNU Lesser General Public License,\n\
version 2 or later <http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html>\n"));
@@ -566,7 +566,7 @@ by the newly generated text. The first '#!' line will be regenerated.\n"));
puts(_("\tThis is less than the minimum library version: "));
#line 121 "../version.c"
puts(_("Automated Options version %s\n"
"\tCopyright (C) 1999-2013 by Bruce Korb - all rights reserved\n"));
"\tCopyright (C) 1999-2014 by Bruce Korb - all rights reserved\n"));
#line 82 "../makeshell.c"
puts(_("(AutoOpts bug): %s.\n"));
#line 90 "../reset.c"
@@ -655,15 +655,15 @@ by the newly generated text. The first '#!' line will be regenerated.\n"));
puts(_("%s error: no saved option state\n"));
#line 231 "../autoopts.c"
puts(_("'%s' is not a command line option.\n"));
#line 114 "../time.c"
#line 111 "../time.c"
puts(_("%s error: '%s' is not a recognizable date/time.\n"));
#line 132 "../save.c"
puts(_("'%s' not defined\n"));
#line 53 "../time.c"
#line 50 "../time.c"
puts(_("%s error: '%s' is not a recognizable time duration.\n"));
#line 92 "../check.c"
puts(_("%s error: The %s option must appear %d times.\n"));
#line 157 "../numeric.c"
#line 164 "../numeric.c"
puts(_("%s error: '%s' is not a recognizable number.\n"));
#line 200 "../enum.c"
puts(_("%s error: %s exceeds %s keyword count\n"));

View File

@@ -2,11 +2,11 @@
*
* DO NOT EDIT THIS FILE (genshell.h)
*
* It has been AutoGen-ed October 16, 2013 at 01:46:16 PM by AutoGen 5.18.2
* It has been AutoGen-ed May 17, 2014 at 07:49:48 AM by AutoGen 5.18.3
* From the definitions genshell.def
* and the template file options
*
* Generated from AutoOpts 40:1:15 templates.
* Generated from AutoOpts 40:2:15 templates.
*
* AutoOpts is a copyrighted work. This header file is not encumbered
* by AutoOpts licensing, but is provided under the licensing terms chosen
@@ -19,7 +19,7 @@
* The genshellopt program is copyrighted and licensed
* under the following terms:
*
* Copyright (C) 1999-2013 Bruce Korb, all rights reserved.
* Copyright (C) 1999-2014 Bruce Korb, all rights reserved.
* This is free software. It is licensed for use, modification and
* redistribution under the terms of the GNU Lesser General Public License,
* version 2 or later <http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html>
@@ -55,7 +55,7 @@
* tolerable version is at least as old as what was current when the header
* template was released.
*/
#define AO_TEMPLATE_VERSION 163841
#define AO_TEMPLATE_VERSION 163842
#if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
|| (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
# error option template version mismatches autoopts/options.h header
@@ -130,11 +130,11 @@ typedef enum {
*/
#define VALUE_GENSHELL_OPT_SCRIPT 'o'
#define VALUE_GENSHELL_OPT_SHELL 's'
/** option flag (value) for " (get "val-name") " option */
/** option flag (value) for help-value option */
#define VALUE_GENSHELL_OPT_HELP '?'
/** option flag (value) for " (get "val-name") " option */
/** option flag (value) for more-help-value option */
#define VALUE_GENSHELL_OPT_MORE_HELP '!'
/** option flag (value) for " (get "val-name") " option */
/** option flag (value) for version-value option */
#define VALUE_GENSHELL_OPT_VERSION 'v'
/*
* Interface defines not associated with particular options
@@ -167,6 +167,11 @@ extern tOptions genshelloptOptions;
# include <libintl.h>
# endif
# ifndef ATTRIBUTE_FORMAT_ARG
# define ATTRIBUTE_FORMAT_ARG(_a)
# endif
static inline char* aoGetsText(char const* pz) ATTRIBUTE_FORMAT_ARG(1);
static inline char* aoGetsText(char const* pz) {
if (pz == NULL) return NULL;
return (char*)gettext(pz);

View File

@@ -1,5 +1,5 @@
/* Convenience header for conditional use of GNU <libintl.h>.
Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2013 Free Software
Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2014 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify

View File

@@ -9,7 +9,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
* AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
* AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control

View File

@@ -12,7 +12,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
* AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
* AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control

View File

@@ -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 October 16, 2013 at 01:46:09 PM by AutoGen 5.18.2
dnl It has been AutoGen-ed May 17, 2014 at 07:49:39 AM by AutoGen 5.18.3
dnl From the definitions libopts.def
dnl and the template file conftest.tpl
dnl
@@ -95,7 +95,7 @@ AC_DEFUN([INVOKE_LIBOPTS_MACROS_FIRST],[
#endif
])
AC_CHECK_TYPES([int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t,
intptr_t, uintptr_t, uint_t, pid_t, size_t])
intptr_t, uintptr_t, uint_t, pid_t, size_t, ptrdiff_t])
AC_CHECK_SIZEOF(char*, 8)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(long, 8)
@@ -460,7 +460,7 @@ dnl the config tests that the library needs. Invoke the
dnl "INVOKE_LIBOPTS_MACROS" macro iff we are building libopts.
dnl
dnl This file is part of AutoGen.
dnl AutoGen Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
dnl AutoGen Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
dnl
dnl AutoGen is free software: you can redistribute it and/or modify it
dnl under the terms of the GNU General Public License as published by the
@@ -584,8 +584,7 @@ AC_DEFUN([LIBOPTS_CHECK], [
LIBOPTS_CHECK_COMMON(AO_Libopts_Dir)
AM_COND_IF([NEED_LIBOPTS], [
INVOKE_LIBOPTS_MACROS
])dnl
])
AC_CONFIG_FILES(AO_Libopts_Dir/Makefile)
m4_popdef([AO_Libopts_Dir])dnl
# end of AC_DEFUN of LIBOPTS_CHECK

View File

@@ -1,5 +1,5 @@
# liboptschk.m4 serial 2 (autogen - 5.11.4)
dnl Copyright (C) 2005-2013 by Bruce Korb - all rights reserved
dnl Copyright (C) 2005-2014 by Bruce Korb - all rights reserved
dnl
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,

View File

@@ -11,7 +11,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
* AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
* AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
@@ -68,7 +68,7 @@ static void
open_out(char const * fname, char const * pname);
/* = = = END-STATIC-FORWARD = = = */
LOCAL void
LOCAL noreturn void
option_exits(int exit_code)
{
if (print_exit)
@@ -76,7 +76,7 @@ option_exits(int exit_code)
exit(exit_code);
}
LOCAL void
LOCAL noreturn void
ao_bug(char const * msg)
{
fprintf(stderr, zao_bug_msg, msg);
@@ -90,7 +90,7 @@ fserr_warn(char const * prog, char const * op, char const * fname)
op, fname);
}
LOCAL void
LOCAL noreturn void
fserr_exit(char const * prog, char const * op, char const * fname)
{
fserr_warn(prog, op, fname);

View File

@@ -12,7 +12,7 @@
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
* AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
* AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
@@ -58,22 +58,22 @@ scan_q_str(char const* pzTxt);
static tOptionValue *
add_string(void ** pp, char const * name, size_t nm_len,
char const* pzValue, size_t dataLen);
char const * val, size_t d_len);
static tOptionValue *
add_bool(void ** pp, char const * name, size_t nm_len,
char const * val, size_t d_len);
static tOptionValue*
add_number(void** pp, char const* pzName, size_t nm_len,
char const* val, size_t d_len);
add_number(void ** pp, char const * name, size_t nm_len,
char const * val, size_t d_len);
static tOptionValue*
add_nested(void** pp, char const* pzName, size_t nm_len,
char* val, size_t d_len);
add_nested(void ** pp, char const * name, size_t nm_len,
char * val, size_t d_len);
static char const *
scan_name(char const* pzName, tOptionValue* pRes);
scan_name(char const * name, tOptionValue * res);
static char const *
unnamed_xml(char const * txt);
@@ -169,28 +169,34 @@ scan_q_str(char const* pzTxt)
/**
* Associate a name with either a string or no value.
*
* @param[in,out] pp argument list to add to
* @param[in] name the name of the "suboption"
* @param[in] nm_len the length of the name
* @param[in] val the string value for the suboption
* @param[in] d_len the length of the value
*
* @returns the new value structure
*/
static tOptionValue *
add_string(void ** pp, char const * name, size_t nm_len,
char const* pzValue, size_t dataLen)
char const * val, size_t d_len)
{
tOptionValue* pNV;
size_t sz = nm_len + dataLen + sizeof(*pNV);
size_t sz = nm_len + d_len + sizeof(*pNV);
pNV = AGALOC(sz, "option name/str value pair");
if (pNV == NULL)
return NULL;
if (pzValue == NULL) {
if (val == NULL) {
pNV->valType = OPARG_TYPE_NONE;
pNV->pzName = pNV->v.strVal;
} else {
pNV->valType = OPARG_TYPE_STRING;
if (dataLen > 0) {
char const * src = pzValue;
if (d_len > 0) {
char const * src = val;
char * pzDst = pNV->v.strVal;
int ct = (int)dataLen;
int ct = (int)d_len;
do {
int ch = *(src++) & 0xFF;
if (ch == NUL) goto data_copy_done;
@@ -205,7 +211,7 @@ add_string(void ** pp, char const * name, size_t nm_len,
pNV->v.strVal[0] = NUL;
}
pNV->pzName = pNV->v.strVal + dataLen + 1;
pNV->pzName = pNV->v.strVal + d_len + 1;
}
memcpy(pNV->pzName, name, nm_len);
@@ -215,23 +221,28 @@ add_string(void ** pp, char const * name, size_t nm_len,
}
/**
* Associate a name with either a string or no value.
* Associate a name with a boolean value
*
* @param[in,out] pp argument list to add to
* @param[in] name the name of the "suboption"
* @param[in] nm_len the length of the name
* @param[in] val the boolean value for the suboption
* @param[in] d_len the length of the value
*
* @returns the new value structure
*/
static tOptionValue *
add_bool(void ** pp, char const * name, size_t nm_len,
char const * val, size_t d_len)
{
tOptionValue * new_val;
size_t sz = nm_len + sizeof(tOptionValue) + 1;
tOptionValue * new_val = AGALOC(sz, "bool val");
{
size_t sz = nm_len + sizeof(tOptionValue) + 1;
new_val = AGALOC(sz, "name/bool value");
}
{
char * p = SPN_WHITESPACE_CHARS(val);
d_len -= (unsigned long)(p - val);
val = p;
/*
* Scan over whitespace is constrained by "d_len"
*/
while (IS_WHITESPACE_CHAR(*val) && (d_len > 0)) {
d_len--; val++;
}
if (d_len == 0)
@@ -251,18 +262,26 @@ add_bool(void ** pp, char const * name, size_t nm_len,
}
/**
* Associate a name with either a string or no value.
* Associate a name with strtol() value, defaulting to zero.
*
* @param[in,out] pp argument list to add to
* @param[in] name the name of the "suboption"
* @param[in] nm_len the length of the name
* @param[in] val the numeric value for the suboption
* @param[in] d_len the length of the value
*
* @returns the new value structure
*/
static tOptionValue*
add_number(void** pp, char const* pzName, size_t nm_len,
char const* val, size_t d_len)
add_number(void ** pp, char const * name, size_t nm_len,
char const * val, size_t d_len)
{
tOptionValue* new_val;
size_t sz = nm_len + sizeof(*new_val) + 1;
size_t sz = nm_len + sizeof(tOptionValue) + 1;
tOptionValue * new_val = AGALOC(sz, "int val");
new_val = AGALOC(sz, "bool val");
if (new_val == NULL)
return NULL;
/*
* Scan over whitespace is constrained by "d_len"
*/
while (IS_WHITESPACE_CHAR(*val) && (d_len > 0)) {
d_len--; val++;
}
@@ -273,34 +292,40 @@ add_number(void** pp, char const* pzName, size_t nm_len,
new_val->valType = OPARG_TYPE_NUMERIC;
new_val->pzName = (char*)(new_val + 1);
memcpy(new_val->pzName, pzName, nm_len);
memcpy(new_val->pzName, name, nm_len);
new_val->pzName[ nm_len ] = NUL;
addArgListEntry(pp, new_val);
return new_val;
}
/**
* Associate a name with either a string or no value.
* Associate a name with a nested/hierarchical value.
*
* @param[in,out] pp argument list to add to
* @param[in] name the name of the "suboption"
* @param[in] nm_len the length of the name
* @param[in] val the nested values for the suboption
* @param[in] d_len the length of the value
*
* @returns the new value structure
*/
static tOptionValue*
add_nested(void** pp, char const* pzName, size_t nm_len,
char* val, size_t d_len)
add_nested(void ** pp, char const * name, size_t nm_len,
char * val, size_t d_len)
{
tOptionValue* new_val;
if (d_len == 0) {
size_t sz = nm_len + sizeof(*new_val) + 1;
new_val = AGALOC(sz, "empty nest");
if (new_val == NULL)
return NULL;
new_val->v.nestVal = NULL;
new_val->valType = OPARG_TYPE_HIERARCHY;
new_val->pzName = (char*)(new_val + 1);
memcpy(new_val->pzName, pzName, nm_len);
memcpy(new_val->pzName, name, nm_len);
new_val->pzName[ nm_len ] = NUL;
} else {
new_val = optionLoadNested(val, pzName, nm_len);
new_val = optionLoadNested(val, name, nm_len);
}
if (new_val != NULL)
@@ -314,10 +339,10 @@ add_nested(void** pp, char const* pzName, size_t nm_len,
* (if called for) and create the name/value association.
*/
static char const *
scan_name(char const* pzName, tOptionValue* pRes)
scan_name(char const * name, tOptionValue * res)
{
tOptionValue* new_val;
char const * pzScan = pzName+1; /* we know first char is a name char */
char const * pzScan = name+1; /* we know first char is a name char */
char const * pzVal;
size_t nm_len = 1;
size_t d_len = 0;
@@ -326,10 +351,10 @@ scan_name(char const* pzName, tOptionValue* pRes)
* Scan over characters that name a value. These names may not end
* with a colon, but they may contain colons.
*/
pzScan = SPN_VALUE_NAME_CHARS(pzName + 1);
pzScan = SPN_VALUE_NAME_CHARS(name + 1);
if (pzScan[-1] == ':')
pzScan--;
nm_len = (size_t)(pzScan - pzName);
nm_len = (size_t)(pzScan - name);
pzScan = SPN_HORIZ_WHITE_CHARS(pzScan);
@@ -349,7 +374,7 @@ scan_name(char const* pzName, tOptionValue* pRes)
/* FALLTHROUGH */
case NUL:
add_string(&(pRes->v.nestVal), pzName, nm_len, NULL, (size_t)0);
add_string(&(res->v.nestVal), name, nm_len, NULL, (size_t)0);
break;
case '"':
@@ -357,7 +382,7 @@ scan_name(char const* pzName, tOptionValue* pRes)
pzVal = pzScan;
pzScan = scan_q_str(pzScan);
d_len = (size_t)(pzScan - pzVal);
new_val = add_string(&(pRes->v.nestVal), pzName, nm_len, pzVal,
new_val = add_string(&(res->v.nestVal), name, nm_len, pzVal,
d_len);
if ((new_val != NULL) && (option_load_mode == OPTION_LOAD_COOKED))
ao_string_cook(new_val->v.strVal, NULL);
@@ -389,7 +414,7 @@ scan_name(char const* pzName, tOptionValue* pRes)
case ',':
d_len = (size_t)(pzScan - pzVal) - 1;
string_done:
new_val = add_string(&(pRes->v.nestVal), pzName, nm_len,
new_val = add_string(&(res->v.nestVal), name, nm_len,
pzVal, d_len);
if (new_val != NULL)
remove_continuation(new_val->v.strVal);
@@ -585,8 +610,6 @@ scan_xml(char const * xml_name, tOptionValue * res_val)
case OPARG_TYPE_HIERARCHY:
{
char * pz = AGALOC(v_len+1, "h scan");
if (pz == NULL)
break;
memcpy(pz, val_str, v_len);
pz[v_len] = NUL;
add_nested(&(res_val->v.nestVal), xml_name, nm_len, pz, v_len);

View File

@@ -10,7 +10,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
* AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
* AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
@@ -109,6 +109,13 @@ optionNumericVal(tOptions * opts, tOptDesc * od)
char* pz;
long val;
/*
* Guard against all the different ways this procedure might get invoked
* when there is no string argument provided.
*/
if (INQUERY_CALL(opts, od) || (od->optArg.argString == NULL))
return;
/*
* Numeric options may have a range associated with it.
* If it does, the usage procedure requests that it be

View File

@@ -2,7 +2,7 @@
*
* DO NOT EDIT THIS FILE (stdin.c)
*
* It has been AutoGen-ed October 16, 2013 at 01:46:15 PM by AutoGen 5.18.2
* It has been AutoGen-ed May 17, 2014 at 07:49:46 AM by AutoGen 5.18.3
* From the definitions stdin
* and the template file str2enum
*

View File

@@ -2,7 +2,7 @@
*
* DO NOT EDIT THIS FILE (stdin.h)
*
* It has been AutoGen-ed October 16, 2013 at 01:46:15 PM by AutoGen 5.18.2
* It has been AutoGen-ed May 17, 2014 at 07:49:46 AM by AutoGen 5.18.3
* From the definitions stdin
* and the template file str2enum
*

View File

@@ -2,7 +2,7 @@
*
* DO NOT EDIT THIS FILE (stdin.c)
*
* It has been AutoGen-ed October 16, 2013 at 01:46:14 PM by AutoGen 5.18.2
* It has been AutoGen-ed May 17, 2014 at 07:49:45 AM by AutoGen 5.18.3
* From the definitions stdin
* and the template file str2enum
*

View File

@@ -2,7 +2,7 @@
*
* DO NOT EDIT THIS FILE (stdin.h)
*
* It has been AutoGen-ed October 16, 2013 at 01:46:14 PM by AutoGen 5.18.2
* It has been AutoGen-ed May 17, 2014 at 07:49:45 AM by AutoGen 5.18.3
* From the definitions stdin
* and the template file str2enum
*

View File

@@ -1,5 +1,5 @@
/* Parse a time duration and return a seconds count
Copyright (C) 2008-2013 Free Software Foundation, Inc.
Copyright (C) 2008-2014 Free Software Foundation, Inc.
Written by Bruce Korb <bkorb@gnu.org>, 2008.
This program is free software: you can redistribute it and/or modify

View File

@@ -1,5 +1,5 @@
/* Parse a time duration and return a seconds count
Copyright (C) 2008-2013 Free Software Foundation, Inc.
Copyright (C) 2008-2014 Free Software Foundation, Inc.
Written by Bruce Korb <bkorb@gnu.org>, 2008.
This program is free software: you can redistribute it and/or modify

View File

@@ -13,7 +13,7 @@
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
* AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
* AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control

View File

@@ -1,7 +1,7 @@
/* -*- buffer-read-only: t -*- vi: set ro:
*
* Prototypes for autoopts
* Generated Wed Oct 16 13:46:27 PDT 2013
* Generated Sat May 17 07:49:59 PDT 2014
*/
#ifndef AUTOOPTS_PROTO_H_GUARD
#define AUTOOPTS_PROTO_H_GUARD 1
@@ -98,16 +98,16 @@ load_opt_line(tOptions * opts, tOptState * opt_state, char * line,
/*
* Extracted from makeshell.c
*/
static void
static noreturn void
option_exits(int exit_code);
static void
static noreturn void
ao_bug(char const * msg);
static void
fserr_warn(char const * prog, char const * op, char const * fname);
static void
static noreturn void
fserr_exit(char const * prog, char const * op, char const * fname);
/*
@@ -135,7 +135,7 @@ optionSort(tOptions * opts);
* Extracted from stack.c
*/
static void
addArgListEntry(void** ppAL, void* entry);
addArgListEntry(void ** ppAL, void * entry);
/*
* Extracted from usage.c

View File

@@ -12,7 +12,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
* AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
* AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control

View File

@@ -10,7 +10,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
* AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
* AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control

View File

@@ -12,7 +12,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
* AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
* AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control

View File

@@ -12,7 +12,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
* AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
* AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control

View File

@@ -10,7 +10,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
* AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
* AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control

View File

@@ -11,7 +11,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
* AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
* AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
@@ -38,35 +38,30 @@
* private:
*
* what: Remove option args from a stack
* arg: + tOptions* + pOpts + program options descriptor +
* arg: + tOptDesc* + pOptDesc + the descriptor for this arg +
* arg: + tOptions* + opts + program options descriptor +
* arg: + tOptDesc* + od + the descriptor for this arg +
*
* doc:
* Invoked for options that are equivalenced to stacked options.
=*/
void
optionUnstackArg(tOptions * pOpts, tOptDesc * pOptDesc)
optionUnstackArg(tOptions * opts, tOptDesc * od)
{
tArgList * pAL;
tArgList * arg_list;
(void)pOpts;
if (pOpts <= OPTPROC_EMIT_LIMIT)
if (INQUERY_CALL(opts, od))
return;
if ((pOptDesc->fOptState & OPTST_RESET) != 0)
return;
pAL = (tArgList*)pOptDesc->optCookie;
arg_list = (tArgList*)od->optCookie;
/*
* IF we don't have any stacked options,
* THEN indicate that we don't have any of these options
*/
if (pAL == NULL) {
pOptDesc->fOptState &= OPTST_PERSISTENT_MASK;
if ((pOptDesc->fOptState & OPTST_INITENABLED) == 0)
pOptDesc->fOptState |= OPTST_DISABLED;
if (arg_list == NULL) {
od->fOptState &= OPTST_PERSISTENT_MASK;
if ((od->fOptState & OPTST_INITENABLED) == 0)
od->fOptState |= OPTST_DISABLED;
return;
}
@@ -75,7 +70,7 @@ optionUnstackArg(tOptions * pOpts, tOptDesc * pOptDesc)
regex_t re;
int i, ct, dIdx;
if (regcomp(&re, pOptDesc->optArg.argString, REG_NOSUB) != 0)
if (regcomp(&re, od->optArg.argString, REG_NOSUB) != 0)
return;
/*
@@ -84,8 +79,8 @@ optionUnstackArg(tOptions * pOpts, tOptDesc * pOptDesc)
* 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++) {
char const * pzSrc = pAL->apzArgs[ i ];
for (i = 0, dIdx = 0, ct = arg_list->useCt; --ct >= 0; i++) {
char const * pzSrc = arg_list->apzArgs[ i ];
char * pzEq = strchr(pzSrc, '=');
int res;
@@ -102,7 +97,7 @@ optionUnstackArg(tOptions * pOpts, tOptDesc * pOptDesc)
* the list.
*/
AGFREE(pzSrc);
pAL->useCt--;
arg_list->useCt--;
break;
default:
@@ -115,7 +110,7 @@ optionUnstackArg(tOptions * pOpts, tOptDesc * pOptDesc)
* THEN we have to move the current one.
*/
if (dIdx != i)
pAL->apzArgs[ dIdx ] = pzSrc;
arg_list->apzArgs[ dIdx ] = pzSrc;
dIdx++;
}
}
@@ -132,21 +127,21 @@ optionUnstackArg(tOptions * pOpts, tOptDesc * pOptDesc)
* 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++) {
const char * pzSrc = pAL->apzArgs[ i ];
for (i = 0, dIdx = 0, ct = arg_list->useCt; --ct >= 0; i++) {
const char * pzSrc = arg_list->apzArgs[ i ];
char * pzEq = strchr(pzSrc, '=');
if (pzEq != NULL)
*pzEq = NUL;
if (strcmp(pzSrc, pOptDesc->optArg.argString) == 0) {
if (strcmp(pzSrc, od->optArg.argString) == 0) {
/*
* Remove this entry by reducing the in-use count
* and *not* putting the string pointer back into
* the list.
*/
AGFREE(pzSrc);
pAL->useCt--;
arg_list->useCt--;
} else {
if (pzEq != NULL)
*pzEq = '=';
@@ -156,7 +151,7 @@ optionUnstackArg(tOptions * pOpts, tOptDesc * pOptDesc)
* THEN we have to move the current one.
*/
if (dIdx != i)
pAL->apzArgs[ dIdx ] = pzSrc;
arg_list->apzArgs[ dIdx ] = pzSrc;
dIdx++;
}
}
@@ -166,12 +161,12 @@ optionUnstackArg(tOptions * pOpts, tOptDesc * pOptDesc)
* IF we have unstacked everything,
* THEN indicate that we don't have any of these options
*/
if (pAL->useCt == 0) {
pOptDesc->fOptState &= OPTST_PERSISTENT_MASK;
if ((pOptDesc->fOptState & OPTST_INITENABLED) == 0)
pOptDesc->fOptState |= OPTST_DISABLED;
AGFREE((void*)pAL);
pOptDesc->optCookie = NULL;
if (arg_list->useCt == 0) {
od->fOptState &= OPTST_PERSISTENT_MASK;
if ((od->fOptState & OPTST_INITENABLED) == 0)
od->fOptState |= OPTST_DISABLED;
AGFREE((void *)arg_list);
od->optCookie = NULL;
}
}
@@ -182,7 +177,7 @@ optionUnstackArg(tOptions * pOpts, tOptDesc * pOptDesc)
* as an opaque address.
*/
LOCAL void
addArgListEntry(void** ppAL, void* entry)
addArgListEntry(void ** ppAL, void * entry)
{
tArgList* pAL = *(void**)ppAL;
@@ -229,37 +224,37 @@ addArgListEntry(void** ppAL, void* entry)
* private:
*
* what: put option args on a stack
* arg: + tOptions* + pOpts + program options descriptor +
* arg: + tOptDesc* + pOptDesc + the descriptor for this arg +
* arg: + tOptions* + opts + program options descriptor +
* arg: + tOptDesc* + od + the descriptor for this arg +
*
* doc:
* Keep an entry-ordered list of option arguments.
=*/
void
optionStackArg(tOptions * pOpts, tOptDesc * pOD)
optionStackArg(tOptions * opts, tOptDesc * od)
{
char * pz;
if (pOpts <= OPTPROC_EMIT_LIMIT)
if (INQUERY_CALL(opts, od))
return;
if ((pOD->fOptState & OPTST_RESET) != 0) {
tArgList* pAL = (void*)pOD->optCookie;
if ((od->fOptState & OPTST_RESET) != 0) {
tArgList * arg_list = (void*)od->optCookie;
int ix;
if (pAL == NULL)
if (arg_list == NULL)
return;
ix = pAL->useCt;
ix = arg_list->useCt;
while (--ix >= 0)
AGFREE(pAL->apzArgs[ix]);
AGFREE(pAL);
AGFREE(arg_list->apzArgs[ix]);
AGFREE(arg_list);
} else {
if (pOD->optArg.argString == NULL)
if (od->optArg.argString == NULL)
return;
AGDUPSTR(pz, pOD->optArg.argString, "stack arg");
addArgListEntry(&(pOD->optCookie), (void*)pz);
AGDUPSTR(pz, od->optArg.argString, "stack arg");
addArgListEntry(&(od->optCookie), (void*)pz);
}
}
/** @}

View File

@@ -15,7 +15,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
* AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
* AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control

View File

@@ -9,7 +9,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
* AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
* AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control

View File

@@ -8,7 +8,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
* AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
* AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
@@ -31,56 +31,53 @@
* private:
*
* what: process an option with a time duration.
* arg: + tOptions* + pOpts + program options descriptor +
* arg: + tOptDesc* + pOptDesc + the descriptor for this arg +
* arg: + tOptions* + opts + program options descriptor +
* arg: + tOptDesc* + od + the descriptor for this arg +
*
* doc:
* Decipher a time duration value.
=*/
void
optionTimeVal(tOptions * pOpts, tOptDesc * pOD)
optionTimeVal(tOptions * opts, tOptDesc * od)
{
time_t val;
if (pOpts <= OPTPROC_EMIT_LIMIT)
if (INQUERY_CALL(opts, od))
return;
if ((pOD->fOptState & OPTST_RESET) != 0)
return;
val = parse_duration(pOD->optArg.argString);
val = parse_duration(od->optArg.argString);
if (val == BAD_TIME) {
fprintf(stderr, zNotDuration, pOpts->pzProgName, pOD->optArg.argString);
if ((pOpts->fOptSet & OPTPROC_ERRSTOP) != 0)
(*(pOpts->pUsageProc))(pOpts, EXIT_FAILURE);
fprintf(stderr, zNotDuration, opts->pzProgName, od->optArg.argString);
if ((opts->fOptSet & OPTPROC_ERRSTOP) != 0)
(*(opts->pUsageProc))(opts, EXIT_FAILURE);
}
if (pOD->fOptState & OPTST_ALLOC_ARG) {
AGFREE(pOD->optArg.argString);
pOD->fOptState &= ~OPTST_ALLOC_ARG;
if (od->fOptState & OPTST_ALLOC_ARG) {
AGFREE(od->optArg.argString);
od->fOptState &= ~OPTST_ALLOC_ARG;
}
pOD->optArg.argInt = (long)val;
od->optArg.argInt = (long)val;
}
/*=export_func optionTimeDate
* private:
*
* what: process an option with a time and date.
* arg: + tOptions* + pOpts + program options descriptor +
* arg: + tOptDesc* + pOptDesc + the descriptor for this arg +
* arg: + tOptions* + opts + program options descriptor +
* arg: + tOptDesc* + od + the descriptor for this arg +
*
* doc:
* Decipher a time and date value.
=*/
void
optionTimeDate(tOptions * pOpts, tOptDesc * pOD)
optionTimeDate(tOptions * opts, tOptDesc * od)
{
#if defined(HAVE_GETDATE_R) && defined(HAVE_PUTENV)
if (pOpts <= OPTPROC_EMIT_LIMIT)
if (INQUERY_CALL(opts, od))
return;
if ((! HAS_pzPkgDataDir(pOpts)) || (pOpts->pzPkgDataDir == NULL))
if ((! HAS_pzPkgDataDir(opts)) || (opts->pzPkgDataDir == NULL))
goto default_action;
/*
@@ -93,8 +90,8 @@ optionTimeDate(tOptions * pOpts, tOptDesc * pOD)
if (envptr == NULL) {
static char const fmt[] = "DATEMSK=%s/datemsk";
envptr = AGALOC(sizeof(fmt) + strlen(pOpts->pzPkgDataDir), fmt);
sprintf(envptr, fmt, pOpts->pzPkgDataDir);
envptr = AGALOC(sizeof(fmt) + strlen(opts->pzPkgDataDir), fmt);
sprintf(envptr, fmt, opts->pzPkgDataDir);
putenv(envptr);
}
@@ -110,31 +107,31 @@ optionTimeDate(tOptions * pOpts, tOptDesc * pOD)
struct tm stm;
time_t tm;
if (getdate_r(pOD->optArg.argString, &stm) != 0) {
fprintf(stderr, zNotDate, pOpts->pzProgName,
pOD->optArg.argString);
if ((pOpts->fOptSet & OPTPROC_ERRSTOP) != 0)
(*(pOpts->pUsageProc))(pOpts, EXIT_FAILURE);
if (getdate_r(od->optArg.argString, &stm) != 0) {
fprintf(stderr, zNotDate, opts->pzProgName,
od->optArg.argString);
if ((opts->fOptSet & OPTPROC_ERRSTOP) != 0)
(*(opts->pUsageProc))(opts, EXIT_FAILURE);
return;
}
tm = mktime(&stm);
if (pOD->fOptState & OPTST_ALLOC_ARG) {
AGFREE(pOD->optArg.argString);
pOD->fOptState &= ~OPTST_ALLOC_ARG;
if (od->fOptState & OPTST_ALLOC_ARG) {
AGFREE(od->optArg.argString);
od->fOptState &= ~OPTST_ALLOC_ARG;
}
pOD->optArg.argInt = tm;
od->optArg.argInt = tm;
}
return;
default_action:
#endif
optionTimeVal(pOpts, pOD);
if (pOD->optArg.argInt != BAD_TIME)
pOD->optArg.argInt += (long)time(NULL);
optionTimeVal(opts, od);
if (od->optArg.argInt != BAD_TIME)
od->optArg.argInt += (long)time(NULL);
}
/** @}
*

View File

@@ -9,7 +9,7 @@
* This file defines the string_tokenize interface
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
* AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
* AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control

View File

@@ -18,7 +18,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
* AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
* AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control

View File

@@ -10,7 +10,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
* AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
* AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control