diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2014-07-29 22:21:36 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2014-07-29 22:21:36 +0200 |
commit | 3d1a66d4f2716c72b146c6ec1feb2d886e2ef3b3 (patch) | |
tree | 674af7618e1a648d0ababe47ab2259032697140b /src/libopts | |
parent | d294543ea086a8075363274a6e73780f28474a0c (diff) | |
download | gnutls-3d1a66d4f2716c72b146c6ec1feb2d886e2ef3b3.tar.gz |
updated to libopts 5.18.3
Diffstat (limited to 'src/libopts')
52 files changed, 272 insertions, 240 deletions
diff --git a/src/libopts/COPYING.gplv3 b/src/libopts/COPYING.gplv3 index e9bf0ffd15..065b7a6c55 100644 --- a/src/libopts/COPYING.gplv3 +++ b/src/libopts/COPYING.gplv3 @@ -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. diff --git a/src/libopts/COPYING.lgplv3 b/src/libopts/COPYING.lgplv3 index b8a3768e33..3deaacb08b 100644 --- a/src/libopts/COPYING.lgplv3 +++ b/src/libopts/COPYING.lgplv3 @@ -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. diff --git a/src/libopts/README b/src/libopts/README index 184473d85a..4bf758d8c2 100644 --- a/src/libopts/README +++ b/src/libopts/README @@ -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 diff --git a/src/libopts/ag-char-map.h b/src/libopts/ag-char-map.h index 7a5e3322d6..45235b9fe4 100644 --- a/src/libopts/ag-char-map.h +++ b/src/libopts/ag-char-map.h @@ -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 diff --git a/src/libopts/alias.c b/src/libopts/alias.c index 2fa16fd11c..be8c6c6cb4 100644 --- a/src/libopts/alias.c +++ b/src/libopts/alias.c @@ -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 diff --git a/src/libopts/ao-strs.c b/src/libopts/ao-strs.c index 8706d5aada..c4c5fe3b56 100644 --- a/src/libopts/ao-strs.c +++ b/src/libopts/ao-strs.c @@ -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 diff --git a/src/libopts/ao-strs.h b/src/libopts/ao-strs.h index 9dd924dc9a..e7bbc0aa75 100644 --- a/src/libopts/ao-strs.h +++ b/src/libopts/ao-strs.h @@ -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 diff --git a/src/libopts/autoopts.c b/src/libopts/autoopts.c index 966ea45a85..a5193186a7 100644 --- a/src/libopts/autoopts.c +++ b/src/libopts/autoopts.c @@ -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 diff --git a/src/libopts/autoopts.h b/src/libopts/autoopts.h index 7bb85a19bd..27a907c35c 100644 --- a/src/libopts/autoopts.h +++ b/src/libopts/autoopts.h @@ -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) @@ -383,6 +384,16 @@ 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 * the client will provide a callback for that purpose. diff --git a/src/libopts/autoopts/options.h b/src/libopts/autoopts/options.h index 92e9be4b0e..3418b7ea4f 100644 --- a/src/libopts/autoopts/options.h +++ b/src/libopts/autoopts/options.h @@ -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)) /// @} diff --git a/src/libopts/autoopts/project.h b/src/libopts/autoopts/project.h index fe97e66683..c61a6ca785 100644 --- a/src/libopts/autoopts/project.h +++ b/src/libopts/autoopts/project.h @@ -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 diff --git a/src/libopts/autoopts/usage-txt.h b/src/libopts/autoopts/usage-txt.h index be2d6fd007..9ef5d7f079 100644 --- a/src/libopts/autoopts/usage-txt.h +++ b/src/libopts/autoopts/usage-txt.h @@ -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")); diff --git a/src/libopts/boolean.c b/src/libopts/boolean.c index e2dff14cdf..e83e518c00 100644 --- a/src/libopts/boolean.c +++ b/src/libopts/boolean.c @@ -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) - return; - - if ((pOD->fOptState & OPTST_RESET) != 0) + if (INQUERY_CALL(opts, od)) 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; } /** @} * diff --git a/src/libopts/check.c b/src/libopts/check.c index 3196b00093..9b221a1ef9 100644 --- a/src/libopts/check.c +++ b/src/libopts/check.c @@ -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 diff --git a/src/libopts/compat/compat.h b/src/libopts/compat/compat.h index ebb3157b83..69206a3c14 100644 --- a/src/libopts/compat/compat.h +++ b/src/libopts/compat/compat.h @@ -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 diff --git a/src/libopts/compat/windows-config.h b/src/libopts/compat/windows-config.h index 194d2280eb..78f3202b94 100644 --- a/src/libopts/compat/windows-config.h +++ b/src/libopts/compat/windows-config.h @@ -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 diff --git a/src/libopts/configfile.c b/src/libopts/configfile.c index d96d71cd7a..d4bc4fea28 100644 --- a/src/libopts/configfile.c +++ b/src/libopts/configfile.c @@ -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 diff --git a/src/libopts/cook.c b/src/libopts/cook.c index 7c08b87dd4..952aac9506 100644 --- a/src/libopts/cook.c +++ b/src/libopts/cook.c @@ -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 diff --git a/src/libopts/enum.c b/src/libopts/enum.c index 4d52aa7361..299ffb12e1 100644 --- a/src/libopts/enum.c +++ b/src/libopts/enum.c @@ -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 diff --git a/src/libopts/env.c b/src/libopts/env.c index dacb55121c..7b6615e5e9 100644 --- a/src/libopts/env.c +++ b/src/libopts/env.c @@ -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 diff --git a/src/libopts/file.c b/src/libopts/file.c index 9218b5f43a..ec740c5d30 100644 --- a/src/libopts/file.c +++ b/src/libopts/file.c @@ -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 diff --git a/src/libopts/find.c b/src/libopts/find.c index 1ba504ebc3..1ec02e5f6d 100644 --- a/src/libopts/find.c +++ b/src/libopts/find.c @@ -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 diff --git a/src/libopts/genshell.c b/src/libopts/genshell.c index 37b22abc07..79bb5a9ffc 100644 --- a/src/libopts/genshell.c +++ b/src/libopts/genshell.c @@ -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")); diff --git a/src/libopts/genshell.h b/src/libopts/genshell.h index 9ae53720d6..3a24e46f8f 100644 --- a/src/libopts/genshell.h +++ b/src/libopts/genshell.h @@ -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); diff --git a/src/libopts/gettext.h b/src/libopts/gettext.h index e059b20991..9b7416ded2 100644 --- a/src/libopts/gettext.h +++ b/src/libopts/gettext.h @@ -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 diff --git a/src/libopts/init.c b/src/libopts/init.c index f41d737e41..e038ed74e2 100644 --- a/src/libopts/init.c +++ b/src/libopts/init.c @@ -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 diff --git a/src/libopts/load.c b/src/libopts/load.c index 71e57ecb0d..5c29d96ecc 100644 --- a/src/libopts/load.c +++ b/src/libopts/load.c @@ -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 diff --git a/src/libopts/m4/libopts.m4 b/src/libopts/m4/libopts.m4 index 70fc4a66dd..7f2a9bb877 100644 --- a/src/libopts/m4/libopts.m4 +++ b/src/libopts/m4/libopts.m4 @@ -2,7 +2,7 @@ dnl -*- buffer-read-only: t -*- vi: set ro: dnl dnl DO NOT EDIT THIS FILE (libopts.m4) dnl -dnl It has been AutoGen-ed 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 diff --git a/src/libopts/m4/liboptschk.m4 b/src/libopts/m4/liboptschk.m4 index b607191bec..c71ae10357 100644 --- a/src/libopts/m4/liboptschk.m4 +++ b/src/libopts/m4/liboptschk.m4 @@ -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, diff --git a/src/libopts/makeshell.c b/src/libopts/makeshell.c index d65a8b372e..a0bfcacca6 100644 --- a/src/libopts/makeshell.c +++ b/src/libopts/makeshell.c @@ -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); diff --git a/src/libopts/nested.c b/src/libopts/nested.c index bf55f6f18a..0ec8f08806 100644 --- a/src/libopts/nested.c +++ b/src/libopts/nested.c @@ -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; - new_val = AGALOC(sz, "name/bool value"); - } + size_t sz = nm_len + sizeof(tOptionValue) + 1; + tOptionValue * new_val = AGALOC(sz, "bool val"); - { - 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); diff --git a/src/libopts/numeric.c b/src/libopts/numeric.c index 260f539c75..9baba65e7b 100644 --- a/src/libopts/numeric.c +++ b/src/libopts/numeric.c @@ -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 @@ -110,6 +110,13 @@ optionNumericVal(tOptions * opts, tOptDesc * od) 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 * emitted by passing a NULL od pointer. Also bail out diff --git a/src/libopts/option-value-type.c b/src/libopts/option-value-type.c index 458584dc40..68370da9bc 100644 --- a/src/libopts/option-value-type.c +++ b/src/libopts/option-value-type.c @@ -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 * diff --git a/src/libopts/option-value-type.h b/src/libopts/option-value-type.h index 8a16a0fa6f..4688f7a55b 100644 --- a/src/libopts/option-value-type.h +++ b/src/libopts/option-value-type.h @@ -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 * diff --git a/src/libopts/option-xat-attribute.c b/src/libopts/option-xat-attribute.c index c8ef1e0a6a..c97bf5edc4 100644 --- a/src/libopts/option-xat-attribute.c +++ b/src/libopts/option-xat-attribute.c @@ -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 * diff --git a/src/libopts/option-xat-attribute.h b/src/libopts/option-xat-attribute.h index 5b7166a54e..b260c7bf87 100644 --- a/src/libopts/option-xat-attribute.h +++ b/src/libopts/option-xat-attribute.h @@ -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 * diff --git a/src/libopts/parse-duration.c b/src/libopts/parse-duration.c index 5f4496dbcc..9efd881f62 100644 --- a/src/libopts/parse-duration.c +++ b/src/libopts/parse-duration.c @@ -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 diff --git a/src/libopts/parse-duration.h b/src/libopts/parse-duration.h index cbe31b87ff..da7301e1ce 100644 --- a/src/libopts/parse-duration.h +++ b/src/libopts/parse-duration.h @@ -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 diff --git a/src/libopts/pgusage.c b/src/libopts/pgusage.c index 18a00100e1..80a89a713d 100644 --- a/src/libopts/pgusage.c +++ b/src/libopts/pgusage.c @@ -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 diff --git a/src/libopts/proto.h b/src/libopts/proto.h index 7b1837f8b2..8745b3c5f8 100644 --- a/src/libopts/proto.h +++ b/src/libopts/proto.h @@ -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 diff --git a/src/libopts/putshell.c b/src/libopts/putshell.c index a96bc37336..4b0fa10a13 100644 --- a/src/libopts/putshell.c +++ b/src/libopts/putshell.c @@ -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 diff --git a/src/libopts/reset.c b/src/libopts/reset.c index 2abe7ccf91..df81cd718a 100644 --- a/src/libopts/reset.c +++ b/src/libopts/reset.c @@ -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 diff --git a/src/libopts/restore.c b/src/libopts/restore.c index d3beb14050..f711cb3adf 100644 --- a/src/libopts/restore.c +++ b/src/libopts/restore.c @@ -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 diff --git a/src/libopts/save.c b/src/libopts/save.c index 404a478e20..19c4c5b840 100644 --- a/src/libopts/save.c +++ b/src/libopts/save.c @@ -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 diff --git a/src/libopts/sort.c b/src/libopts/sort.c index 0d70e341a1..894d0ecf58 100644 --- a/src/libopts/sort.c +++ b/src/libopts/sort.c @@ -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 diff --git a/src/libopts/stack.c b/src/libopts/stack.c index 62069b561f..d2ce165adb 100644 --- a/src/libopts/stack.c +++ b/src/libopts/stack.c @@ -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) - return; - - if ((pOptDesc->fOptState & OPTST_RESET) != 0) + if (INQUERY_CALL(opts, od)) 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); } } /** @} diff --git a/src/libopts/streqvcmp.c b/src/libopts/streqvcmp.c index 08cb637105..371d7f4f0c 100644 --- a/src/libopts/streqvcmp.c +++ b/src/libopts/streqvcmp.c @@ -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 diff --git a/src/libopts/text_mmap.c b/src/libopts/text_mmap.c index fac0c6414f..f30e71c6c9 100644 --- a/src/libopts/text_mmap.c +++ b/src/libopts/text_mmap.c @@ -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 diff --git a/src/libopts/time.c b/src/libopts/time.c index 6cf7faad89..517d5b199a 100644 --- a/src/libopts/time.c +++ b/src/libopts/time.c @@ -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); } /** @} * diff --git a/src/libopts/tokenize.c b/src/libopts/tokenize.c index 15e7cb956f..34abf83601 100644 --- a/src/libopts/tokenize.c +++ b/src/libopts/tokenize.c @@ -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 diff --git a/src/libopts/usage.c b/src/libopts/usage.c index c7c9cd0f15..206235d7af 100644 --- a/src/libopts/usage.c +++ b/src/libopts/usage.c @@ -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 diff --git a/src/libopts/version.c b/src/libopts/version.c index 08d8696db4..3aaa288297 100644 --- a/src/libopts/version.c +++ b/src/libopts/version.c @@ -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 |