+* Upgrade to autogen-5.15.
(4.2.7p260) 2012/02/24 Released by Harlan Stenn <stenn@ntp.org>
* Fix the check-scm-rev invocation in several Makefile.am's.
(4.2.7p259) 2012/02/22 Released by Harlan Stenn <stenn@ntp.org>
-#assert (version-compare >= autogen-version "5.14")
+#assert (version-compare >= autogen-version "5.15")
guard-option-names;
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
- Copyright (c) 1992-2011 by Bruce Korb - all rights reserved
+ Copyright (c) 1992-2012 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.
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
- Copyright (c) 1992-2011 by Bruce Korb - all rights reserved
+ Copyright (c) 1992-2012 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.
endif
libopts_la_SOURCES = libopts.c
libopts_la_CPPFLAGS = -I$(top_srcdir)
-libopts_la_LDFLAGS = -version-info 36:1:11
+libopts_la_LDFLAGS = -version-info 36:3:11
EXTRA_DIST = \
COPYING.gplv3 COPYING.lgplv3 COPYING.mbsd \
MakeDefs.inc README ag-char-map.h \
+ alias.c ao-strs.c ao-strs.h \
autoopts/options.h autoopts/usage-txt.h autoopts/project.h \
autoopts.c autoopts.h boolean.c \
- check.c compat/pathfind.c compat/compat.h \
- compat/strdup.c compat/snprintf.c compat/strchr.c \
+ check.c compat/compat.h compat/strdup.c \
+ compat/strchr.c compat/pathfind.c compat/snprintf.c \
compat/windows-config.h configfile.c cook.c \
enum.c env.c file.c \
find.c genshell.c genshell.h \
- load.c m4/libopts.m4 m4/liboptschk.m4 \
+ load.c m4/liboptschk.m4 m4/libopts.m4 \
makeshell.c nested.c numeric.c \
parse-duration.c parse-duration.h pgusage.c \
proto.h putshell.c reset.c \
LICENSING:
-This material is Copyright (c) 1992-2011 by Bruce Korb. You are
+This material is Copyright (c) 1992-2012 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
/*
- * Character mapping generated 12/29/11 12:02:33
+ * Character mapping generated 02/26/12 11:08:40
*
* This file contains the character classifications
* used by AutoGen and AutoOpts for identifying tokens.
+ * The table is static scope, so %guard is empty.
+ *
* This file is part of AutoGen.
- * Copyright (c) 1992-2011 Bruce Korb - all rights reserved
+ * Copyright (c) 1992-2012 Bruce Korb - all rights reserved
+ *
* AutoGen is free software: you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
+ *
* AutoGen is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
# if defined(HAVE_INTTYPES_H)
-# include <inttypes.h>
-# elif defined(HAVE_STDINT_H)
-# include <stdint.h>
-
-# else
-# ifndef HAVE_INT8_T
- typedef signed char int8_t;
-# endif
-# ifndef HAVE_UINT8_T
- typedef unsigned char uint8_t;
-# endif
-# ifndef HAVE_INT16_T
- typedef signed short int16_t;
-# endif
-# ifndef HAVE_UINT16_T
- typedef unsigned short uint16_t;
-# endif
-# ifndef HAVE_UINT_T
- typedef unsigned int uint_t;
-# endif
+# include <inttypes.h>
-# ifndef HAVE_INT32_T
-# if SIZEOF_INT == 4
- typedef signed int int32_t;
-# elif SIZEOF_LONG == 4
- typedef signed long int32_t;
-# endif
-# endif
+# elif defined(HAVE_STDINT_H)
+# include <stdint.h>
-# ifndef HAVE_UINT32_T
-# if SIZEOF_INT == 4
- typedef unsigned int uint32_t;
-# elif SIZEOF_LONG == 4
- typedef unsigned long uint32_t;
-# endif
+# elif !defined(HAVE_UINT32_T)
+# if SIZEOF_INT == 4
+ typedef unsigned int uint32_t;
+# elif SIZEOF_LONG == 4
+ typedef unsigned long uint32_t;
# endif
# endif /* HAVE_*INT*_H header */
#else /* not HAVE_CONFIG_H -- */
-# ifdef __sun
-# include <inttypes.h>
-# else
-# include <stdint.h>
-# endif
+# include <inttypes.h>
#endif /* HAVE_CONFIG_H */
#if 0 /* mapping specification source (from autogen.map) */
//
-// %guard autoopts_internal
+// %guard
// %file ag-char-map.h
-// %static-table option-char-category
-//
-// %comment
-// This file contains the character classifications
-// used by AutoGen and AutoOpts for identifying tokens.
-//
-// This file is part of AutoGen.
-// Copyright (c) 1992-2011 Bruce Korb - all rights reserved
-//
-// AutoGen is free software: you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the Free Software
-// Foundation, either version 3 of the License, or (at your option) any later
-// version.
//
-// AutoGen is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-// A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program. If not, see <http://www.gnu.org/licenses/>.
+// %comment -- see above
// %
//
// lower-case "a-z"
// option-name "^-" +variable-name
// value-name ":" +option-name
// horiz-white "\t "
-// compound-name "[.]" +value-name +horiz-white
+// name-sep "[.]"
+// compound-name +value-name +name-sep +horiz-white
// whitespace "\v\f\r\n\b" +horiz-white
// unquotable "!-~" -"\"#(),;<=>[\\]`{}?*'"
// end-xml-token "/>" +whitespace
// file-name "/" +suffix
// end-token "\x00" +whitespace
// end-list-entry "," +end-token
+// set-separator "|+" +end-list-entry
//
#endif /* 0 -- mapping spec. source */
-typedef uint32_t option_char_category_mask_t;
-static option_char_category_mask_t const option_char_category[128];
-static inline int is_option_char_category_char(char ch, option_char_category_mask_t mask) {
- unsigned int ix = (unsigned char)ch;
- return ((ix < 128) && ((option_char_category[ix] & mask) != 0)); }
+typedef uint32_t ag_char_map_mask_t;
-#define IS_LOWER_CASE_CHAR(_c) is_option_char_category_char((_c), 0x000001)
-#define IS_UPPER_CASE_CHAR(_c) is_option_char_category_char((_c), 0x000002)
-#define IS_ALPHABETIC_CHAR(_c) is_option_char_category_char((_c), 0x000003)
-#define IS_OCT_DIGIT_CHAR(_c) is_option_char_category_char((_c), 0x000004)
-#define IS_DEC_DIGIT_CHAR(_c) is_option_char_category_char((_c), 0x00000C)
-#define IS_HEX_DIGIT_CHAR(_c) is_option_char_category_char((_c), 0x00001C)
-#define IS_ALPHANUMERIC_CHAR(_c) is_option_char_category_char((_c), 0x00000F)
-#define IS_VAR_FIRST_CHAR(_c) is_option_char_category_char((_c), 0x000023)
-#define IS_VARIABLE_NAME_CHAR(_c) is_option_char_category_char((_c), 0x00002F)
-#define IS_OPTION_NAME_CHAR(_c) is_option_char_category_char((_c), 0x00006F)
-#define IS_VALUE_NAME_CHAR(_c) is_option_char_category_char((_c), 0x0000EF)
-#define IS_HORIZ_WHITE_CHAR(_c) is_option_char_category_char((_c), 0x000100)
-#define IS_COMPOUND_NAME_CHAR(_c) is_option_char_category_char((_c), 0x0003EF)
-#define IS_WHITESPACE_CHAR(_c) is_option_char_category_char((_c), 0x000500)
-#define IS_UNQUOTABLE_CHAR(_c) is_option_char_category_char((_c), 0x000800)
-#define IS_END_XML_TOKEN_CHAR(_c) is_option_char_category_char((_c), 0x001500)
-#define IS_GRAPHIC_CHAR(_c) is_option_char_category_char((_c), 0x002000)
-#define IS_PLUS_N_SPACE_CHAR(_c) is_option_char_category_char((_c), 0x004500)
-#define IS_PUNCTUATION_CHAR(_c) is_option_char_category_char((_c), 0x008000)
-#define IS_SUFFIX_CHAR(_c) is_option_char_category_char((_c), 0x01000F)
-#define IS_SUFFIX_FMT_CHAR(_c) is_option_char_category_char((_c), 0x03000F)
-#define IS_FALSE_TYPE_CHAR(_c) is_option_char_category_char((_c), 0x040000)
-#define IS_FILE_NAME_CHAR(_c) is_option_char_category_char((_c), 0x09000F)
-#define IS_END_TOKEN_CHAR(_c) is_option_char_category_char((_c), 0x100500)
-#define IS_END_LIST_ENTRY_CHAR(_c) is_option_char_category_char((_c), 0x300500)
+#define IS_LOWER_CASE_CHAR( _c) is_ag_char_map_char((char)( _c), 0x000001)
+#define SPN_LOWER_CASE_CHARS(_s) spn_ag_char_map_chars((char *)_s, 0x000001)
+#define BRK_LOWER_CASE_CHARS(_s) brk_ag_char_map_chars((char *)_s, 0x000001)
+#define IS_UPPER_CASE_CHAR( _c) is_ag_char_map_char((char)( _c), 0x000002)
+#define SPN_UPPER_CASE_CHARS(_s) spn_ag_char_map_chars((char *)_s, 0x000002)
+#define BRK_UPPER_CASE_CHARS(_s) brk_ag_char_map_chars((char *)_s, 0x000002)
+#define IS_ALPHABETIC_CHAR( _c) is_ag_char_map_char((char)( _c), 0x000003)
+#define SPN_ALPHABETIC_CHARS(_s) spn_ag_char_map_chars((char *)_s, 0x000003)
+#define BRK_ALPHABETIC_CHARS(_s) brk_ag_char_map_chars((char *)_s, 0x000003)
+#define IS_OCT_DIGIT_CHAR( _c) is_ag_char_map_char((char)( _c), 0x000004)
+#define SPN_OCT_DIGIT_CHARS(_s) spn_ag_char_map_chars((char *)_s, 0x000004)
+#define BRK_OCT_DIGIT_CHARS(_s) brk_ag_char_map_chars((char *)_s, 0x000004)
+#define IS_DEC_DIGIT_CHAR( _c) is_ag_char_map_char((char)( _c), 0x00000C)
+#define SPN_DEC_DIGIT_CHARS(_s) spn_ag_char_map_chars((char *)_s, 0x00000C)
+#define BRK_DEC_DIGIT_CHARS(_s) brk_ag_char_map_chars((char *)_s, 0x00000C)
+#define IS_HEX_DIGIT_CHAR( _c) is_ag_char_map_char((char)( _c), 0x00001C)
+#define SPN_HEX_DIGIT_CHARS(_s) spn_ag_char_map_chars((char *)_s, 0x00001C)
+#define BRK_HEX_DIGIT_CHARS(_s) brk_ag_char_map_chars((char *)_s, 0x00001C)
+#define IS_ALPHANUMERIC_CHAR( _c) is_ag_char_map_char((char)( _c), 0x00000F)
+#define SPN_ALPHANUMERIC_CHARS(_s) spn_ag_char_map_chars((char *)_s, 0x00000F)
+#define BRK_ALPHANUMERIC_CHARS(_s) brk_ag_char_map_chars((char *)_s, 0x00000F)
+#define IS_VAR_FIRST_CHAR( _c) is_ag_char_map_char((char)( _c), 0x000023)
+#define SPN_VAR_FIRST_CHARS(_s) spn_ag_char_map_chars((char *)_s, 0x000023)
+#define BRK_VAR_FIRST_CHARS(_s) brk_ag_char_map_chars((char *)_s, 0x000023)
+#define IS_VARIABLE_NAME_CHAR( _c) is_ag_char_map_char((char)( _c), 0x00002F)
+#define SPN_VARIABLE_NAME_CHARS(_s) spn_ag_char_map_chars((char *)_s, 0x00002F)
+#define BRK_VARIABLE_NAME_CHARS(_s) brk_ag_char_map_chars((char *)_s, 0x00002F)
+#define IS_OPTION_NAME_CHAR( _c) is_ag_char_map_char((char)( _c), 0x00006F)
+#define SPN_OPTION_NAME_CHARS(_s) spn_ag_char_map_chars((char *)_s, 0x00006F)
+#define BRK_OPTION_NAME_CHARS(_s) brk_ag_char_map_chars((char *)_s, 0x00006F)
+#define IS_VALUE_NAME_CHAR( _c) is_ag_char_map_char((char)( _c), 0x0000EF)
+#define SPN_VALUE_NAME_CHARS(_s) spn_ag_char_map_chars((char *)_s, 0x0000EF)
+#define BRK_VALUE_NAME_CHARS(_s) brk_ag_char_map_chars((char *)_s, 0x0000EF)
+#define IS_HORIZ_WHITE_CHAR( _c) is_ag_char_map_char((char)( _c), 0x000100)
+#define SPN_HORIZ_WHITE_CHARS(_s) spn_ag_char_map_chars((char *)_s, 0x000100)
+#define BRK_HORIZ_WHITE_CHARS(_s) brk_ag_char_map_chars((char *)_s, 0x000100)
+#define IS_NAME_SEP_CHAR( _c) is_ag_char_map_char((char)( _c), 0x000200)
+#define SPN_NAME_SEP_CHARS(_s) spn_ag_char_map_chars((char *)_s, 0x000200)
+#define BRK_NAME_SEP_CHARS(_s) brk_ag_char_map_chars((char *)_s, 0x000200)
+#define IS_COMPOUND_NAME_CHAR( _c) is_ag_char_map_char((char)( _c), 0x0003EF)
+#define SPN_COMPOUND_NAME_CHARS(_s) spn_ag_char_map_chars((char *)_s, 0x0003EF)
+#define BRK_COMPOUND_NAME_CHARS(_s) brk_ag_char_map_chars((char *)_s, 0x0003EF)
+#define IS_WHITESPACE_CHAR( _c) is_ag_char_map_char((char)( _c), 0x000500)
+#define SPN_WHITESPACE_CHARS(_s) spn_ag_char_map_chars((char *)_s, 0x000500)
+#define BRK_WHITESPACE_CHARS(_s) brk_ag_char_map_chars((char *)_s, 0x000500)
+#define IS_UNQUOTABLE_CHAR( _c) is_ag_char_map_char((char)( _c), 0x000800)
+#define SPN_UNQUOTABLE_CHARS(_s) spn_ag_char_map_chars((char *)_s, 0x000800)
+#define BRK_UNQUOTABLE_CHARS(_s) brk_ag_char_map_chars((char *)_s, 0x000800)
+#define IS_END_XML_TOKEN_CHAR( _c) is_ag_char_map_char((char)( _c), 0x001500)
+#define SPN_END_XML_TOKEN_CHARS(_s) spn_ag_char_map_chars((char *)_s, 0x001500)
+#define BRK_END_XML_TOKEN_CHARS(_s) brk_ag_char_map_chars((char *)_s, 0x001500)
+#define IS_GRAPHIC_CHAR( _c) is_ag_char_map_char((char)( _c), 0x002000)
+#define SPN_GRAPHIC_CHARS(_s) spn_ag_char_map_chars((char *)_s, 0x002000)
+#define BRK_GRAPHIC_CHARS(_s) brk_ag_char_map_chars((char *)_s, 0x002000)
+#define IS_PLUS_N_SPACE_CHAR( _c) is_ag_char_map_char((char)( _c), 0x004500)
+#define SPN_PLUS_N_SPACE_CHARS(_s) spn_ag_char_map_chars((char *)_s, 0x004500)
+#define BRK_PLUS_N_SPACE_CHARS(_s) brk_ag_char_map_chars((char *)_s, 0x004500)
+#define IS_PUNCTUATION_CHAR( _c) is_ag_char_map_char((char)( _c), 0x008000)
+#define SPN_PUNCTUATION_CHARS(_s) spn_ag_char_map_chars((char *)_s, 0x008000)
+#define BRK_PUNCTUATION_CHARS(_s) brk_ag_char_map_chars((char *)_s, 0x008000)
+#define IS_SUFFIX_CHAR( _c) is_ag_char_map_char((char)( _c), 0x01000F)
+#define SPN_SUFFIX_CHARS(_s) spn_ag_char_map_chars((char *)_s, 0x01000F)
+#define BRK_SUFFIX_CHARS(_s) brk_ag_char_map_chars((char *)_s, 0x01000F)
+#define IS_SUFFIX_FMT_CHAR( _c) is_ag_char_map_char((char)( _c), 0x03000F)
+#define SPN_SUFFIX_FMT_CHARS(_s) spn_ag_char_map_chars((char *)_s, 0x03000F)
+#define BRK_SUFFIX_FMT_CHARS(_s) brk_ag_char_map_chars((char *)_s, 0x03000F)
+#define IS_FALSE_TYPE_CHAR( _c) is_ag_char_map_char((char)( _c), 0x040000)
+#define SPN_FALSE_TYPE_CHARS(_s) spn_ag_char_map_chars((char *)_s, 0x040000)
+#define BRK_FALSE_TYPE_CHARS(_s) brk_ag_char_map_chars((char *)_s, 0x040000)
+#define IS_FILE_NAME_CHAR( _c) is_ag_char_map_char((char)( _c), 0x09000F)
+#define SPN_FILE_NAME_CHARS(_s) spn_ag_char_map_chars((char *)_s, 0x09000F)
+#define BRK_FILE_NAME_CHARS(_s) brk_ag_char_map_chars((char *)_s, 0x09000F)
+#define IS_END_TOKEN_CHAR( _c) is_ag_char_map_char((char)( _c), 0x100500)
+#define SPN_END_TOKEN_CHARS(_s) spn_ag_char_map_chars((char *)_s, 0x100500)
+#define BRK_END_TOKEN_CHARS(_s) brk_ag_char_map_chars((char *)_s, 0x100500)
+#define IS_END_LIST_ENTRY_CHAR( _c) is_ag_char_map_char((char)( _c), 0x300500)
+#define SPN_END_LIST_ENTRY_CHARS(_s) spn_ag_char_map_chars((char *)_s, 0x300500)
+#define BRK_END_LIST_ENTRY_CHARS(_s) brk_ag_char_map_chars((char *)_s, 0x300500)
+#define IS_SET_SEPARATOR_CHAR( _c) is_ag_char_map_char((char)( _c), 0x700500)
+#define SPN_SET_SEPARATOR_CHARS(_s) spn_ag_char_map_chars((char *)_s, 0x700500)
+#define BRK_SET_SEPARATOR_CHARS(_s) brk_ag_char_map_chars((char *)_s, 0x700500)
-#if 1 /* def AUTOOPTS_INTERNAL */
-static option_char_category_mask_t const option_char_category[128] = {
- /*x00*/ 0x140000, /*x01*/ 0x000000, /*x02*/ 0x000000, /*x03*/ 0x000000,
- /*x04*/ 0x000000, /*x05*/ 0x000000, /*x06*/ 0x000000, /*\a */ 0x000000,
- /*\b */ 0x000400, /*\t */ 0x000100, /*\n */ 0x000400, /*\v */ 0x000400,
- /*\f */ 0x000400, /*\r */ 0x000400, /*x0E*/ 0x000000, /*x0F*/ 0x000000,
+static ag_char_map_mask_t const ag_char_map_table[128] = {
+ /*NUL*/ 0x140000, /*x01*/ 0x000000, /*x02*/ 0x000000, /*x03*/ 0x000000,
+ /*x04*/ 0x000000, /*x05*/ 0x000000, /*x06*/ 0x000000, /*BEL*/ 0x000000,
+ /* BS*/ 0x000400, /* HT*/ 0x000100, /* NL*/ 0x000400, /* VT*/ 0x000400,
+ /* FF*/ 0x000400, /* CR*/ 0x000400, /*x0E*/ 0x000000, /*x0F*/ 0x000000,
/*x10*/ 0x000000, /*x11*/ 0x000000, /*x12*/ 0x000000, /*x13*/ 0x000000,
/*x14*/ 0x000000, /*x15*/ 0x000000, /*x16*/ 0x000000, /*x17*/ 0x000000,
- /*x18*/ 0x000000, /*x19*/ 0x000000, /*x1A*/ 0x000000, /*x1B*/ 0x000000,
+ /*x18*/ 0x000000, /*x19*/ 0x000000, /*x1A*/ 0x000000, /*ESC*/ 0x000000,
/*x1C*/ 0x000000, /*x1D*/ 0x000000, /*x1E*/ 0x000000, /*x1F*/ 0x000000,
/* */ 0x000100, /* ! */ 0x00A800, /* " */ 0x00A000, /* # */ 0x00A000,
/* $ */ 0x00A800, /* % */ 0x02A800, /* & */ 0x00A800, /* ' */ 0x00A000,
- /* ( */ 0x00A000, /* ) */ 0x00A000, /* * */ 0x00A000, /* + */ 0x00E800,
+ /* ( */ 0x00A000, /* ) */ 0x00A000, /* * */ 0x00A000, /* + */ 0x40E800,
/* , */ 0x20A000, /* - */ 0x01A840, /* . */ 0x01AA00, /* / */ 0x0AB800,
/* 0 */ 0x042804, /* 1 */ 0x002804, /* 2 */ 0x002804, /* 3 */ 0x002804,
/* 4 */ 0x002804, /* 5 */ 0x002804, /* 6 */ 0x002804, /* 7 */ 0x002804,
/* p */ 0x002801, /* q */ 0x002801, /* r */ 0x002801, /* s */ 0x002801,
/* t */ 0x002801, /* u */ 0x002801, /* v */ 0x002801, /* w */ 0x002801,
/* x */ 0x002801, /* y */ 0x002801, /* z */ 0x002801, /* { */ 0x00A000,
- /* | */ 0x00A800, /* } */ 0x00A000, /* ~ */ 0x00A800, /*x7F*/ 0x000000
+ /* | */ 0x40A800, /* } */ 0x00A000, /* ~ */ 0x00A800, /*x7F*/ 0x000000
};
-#endif /* AUTOOPTS_INTERNAL */
+static inline int
+is_ag_char_map_char(char ch, ag_char_map_mask_t mask)
+{
+ unsigned int ix = (unsigned char)ch;
+ return ((ix < 128) && ((ag_char_map_table[ix] & mask) != 0));
+}
+
+static inline char *
+spn_ag_char_map_chars(char * p, ag_char_map_mask_t mask)
+{
+ while ((*p != '\0') && is_ag_char_map_char(*p, mask)) p++;
+ return p;
+}
+
+static inline char *
+brk_ag_char_map_chars(char * p, ag_char_map_mask_t mask)
+{
+ while ((*p != '\0') && (! is_ag_char_map_char(*p, mask))) p++;
+ return p;
+}
#endif /* AG_CHAR_MAP_H_GUARD */
--- /dev/null
+
+/**
+ * \file alias.c
+ *
+ * Time-stamp: "2012-02-12 09:41:42 bkorb"
+ *
+ * Automated Options Paged Usage module.
+ *
+ * This routine will forward an option alias to the correct option code.
+ *
+ * This file is part of AutoOpts, a companion to AutoGen.
+ * AutoOpts is free software.
+ * AutoOpts is Copyright (c) 1992-2012 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
+ * of the user of the license.
+ *
+ * The GNU Lesser General Public License, version 3 or later
+ * See the files "COPYING.lgplv3" and "COPYING.gplv3"
+ *
+ * The Modified Berkeley Software Distribution License
+ * See the file "COPYING.mbsd"
+ *
+ * These files have the following md5sums:
+ *
+ * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+ * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+ * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+ */
+
+/*=export_func optionAlias
+ * private:
+ *
+ * what: relay an option to its alias
+ * arg: + tOptions* + pOpts + program options descriptor +
+ * arg: + tOptDesc* + pOptDesc + the descriptor for this arg +
+ * arg: + unsigned int + alias + the aliased-to option index +
+ * ret-type: int
+ *
+ * doc:
+ * Handle one option as if it had been specified as another. Exactly.
+ * Returns "-1" if the aliased-to option has appeared too many times.
+=*/
+int
+optionAlias(tOptions * pOpts, tOptDesc * pOldOD, unsigned int alias)
+{
+ tOptDesc * pOD;
+
+ if (pOpts == OPTPROC_EMIT_USAGE)
+ return 0;
+
+ pOD = pOpts->pOptDesc + alias;
+ if ((unsigned)pOpts->optCt <= alias) {
+ fwrite(zAliasRange, strlen (zAliasRange), 1, stderr);
+ exit(EXIT_FAILURE);
+ }
+
+ /*
+ * Copy over the option instance flags
+ */
+ pOD->fOptState &= OPTST_PERSISTENT_MASK;
+ pOD->fOptState |= (pOldOD->fOptState & ~OPTST_PERSISTENT_MASK);
+ pOD->optArg.argString = pOldOD->optArg.argString;
+
+ /*
+ * Keep track of count only for DEFINED (command line) options.
+ * IF we have too many, build up an error message and bail.
+ */
+ if ( (pOD->fOptState & OPTST_DEFINED)
+ && (++pOD->optOccCt > pOD->optMaxCt) ) {
+
+ if ((pOpts->fOptSet & OPTPROC_ERRSTOP) != 0) {
+ char const * pzEqv =
+ (pOD->optEquivIndex != NO_EQUIVALENT) ? zEquiv : zNil;
+
+ fputs(zErrOnly, stderr);
+
+ if (pOD->optMaxCt > 1)
+ fprintf(stderr, zAtMost, pOD->optMaxCt, pOD->pz_Name, pzEqv);
+ else
+ fprintf(stderr, zOnlyOne, pOD->pz_Name, pzEqv);
+ }
+
+ return -1;
+ }
+
+ /*
+ * Clear the state bits and counters
+ */
+ pOldOD->fOptState &= OPTST_PERSISTENT_MASK;
+ pOldOD->optOccCt = 0;
+
+ /*
+ * If there is a procedure to call, call it
+ */
+ if (pOD->pOptProc != NULL)
+ (*pOD->pOptProc)(pOpts, pOD);
+ return 0;
+}
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of autoopts/alias.c */
--- /dev/null
+/* -*- buffer-read-only: t -*- vi: set ro:
+ *
+ * DO NOT EDIT THIS FILE (ao-strs.c)
+ *
+ * It has been AutoGen-ed February 26, 2012 at 11:08:40 AM by AutoGen 5.15pre14
+ * From the definitions ao-strs.def
+ * and the template file strings
+ *
+ * Copyright (C) 2011-2012 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
+ * <http://www.xfree86.org/3.3.6/COPYRIGHT2.html>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name ``Bruce Korb'' nor the name of any other
+ * contributor may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * strings IS PROVIDED BY Bruce Korb ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL Bruce Korb OR ANY OTHER CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "ao-strs.h"
+
+char const ao_strs_strtable[6266] =
+/* 0 */ " \t\n"
+ ":=\0"
+/* 6 */ "INVALID-%d\0"
+/* 17 */ "*INVALID*\0"
+/* 27 */ "none\0"
+/* 32 */ " + \0"
+/* 36 */ " | \0"
+/* 40 */ "%s\n\0"
+/* 44 */ "PAGER\0"
+/* 50 */ "/tmp/use.%lu\0"
+/* 63 */ "more\0"
+/* 68 */ " --* )\n\0"
+/* 79 */ "%s\n"
+ " \0"
+/* 85 */ " \0"
+/* 88 */ " -* )\n\0"
+/* 98 */ " ;;\n\n\0"
+/* 111 */ "stdout\0"
+/* 118 */ "%A %B %e, %Y at %r %Z\0"
+/* 140 */ "#! %s\n\0"
+/* 147 */ "%s_%s=\0"
+/* 154 */ "\n"
+ "export %s_%s\n\0"
+/* 169 */ "''\0"
+/* 172 */ "\\'\0"
+/* 175 */ "'%s'\0"
+/* 180 */ "%s_%s_%d=\0"
+/* 190 */ "\n"
+ "export %s_%s_%d\n\0"
+/* 208 */ "set --\0"
+/* 215 */ " '%s'\0"
+/* 221 */ "'\\''\0"
+/* 226 */ "\n"
+ "OPTION_CT=0\n\0"
+/* 240 */ "=%1$lu # 0x%1$lX\n\0"
+/* 258 */ "true\0"
+/* 263 */ "false\0"
+/* 269 */ "VERSION\0"
+/* 277 */ "OPT_ARG_NEEDED=OK\0"
+/* 295 */ "OPT_ARG_NEEDED=NO\0"
+/* 313 */ "OPT_ARG_NEEDED=YES\0"
+/* 332 */ "LONGUSAGE\0"
+/* 342 */ "flag\0"
+/* 347 */ "%s_%s_TEXT='\0"
+/* 360 */ "'\n\n\0"
+/* 364 */ "option\0"
+/* 371 */ "\n"
+ "env | grep '^%s_'\n\0"
+/* 391 */ " -- %s\0"
+/* 398 */ "--\0"
+/* 401 */ "\t\t\t\t- \0"
+/* 408 */ "\t\t\t\t \0"
+/* 415 */ "\t\0"
+/* 417 */ " * )\n"
+ " OPT_PROCESS=false\n"
+ " ;;\n"
+ " esac\n\0"
+/* 474 */ " %s\n\0"
+/* 480 */ "%%-%ds\0"
+/* 487 */ "%1$s /tmp/use.%2$lu ; rm -f /tmp/use.%2$lu\0"
+/* 530 */ "# # # # # # # # # # -- do not modify this marker --\n"
+ "#\n"
+ "# DO NOT EDIT THIS SECTION\n\0"
+/* 613 */ "%s OF %s\n"
+ "#\n"
+ "# From here to the next `-- do not modify this marker --',\n"
+ "# the text has been generated %s\n\0"
+/* 719 */ "# From the %s option definitions\n"
+ "#\n\0"
+/* 756 */ "\n"
+ "if test -z \"${%1$s_%2$s}\"\n"
+ "then\n"
+ " %1$s_%2$s_CT=0\n"
+ "else\n"
+ " %1$s_%2$s_CT=1\n"
+ " %1$s_%2$s_1=${%1$s_%2$s}\n"
+ "fi\n"
+ "export %1$s_%2$s_CT\0"
+/* 877 */ "\n"
+ "%1$s_%2$s=${%1$s_%2$s-'%3$s'}\n"
+ "%1$s_%2$s_set=false\n"
+ "export %1$s_%2$s\0"
+/* 945 */ "\n"
+ "%1$s_%2$s=${%1$s_%2$s}\n"
+ "%1$s_%2$s_set=false\n"
+ "export %1$s_%2$s\n\0"
+/* 1007 */ "\n"
+ "OPT_PROCESS=true\n"
+ "OPT_ARG=$1\n"
+ "while ${OPT_PROCESS} && [ $# -gt 0 ]\n"
+ "do\n"
+ " OPT_ELEMENT=''\n"
+ " OPT_ARG_VAL=''\n\n"
+ " case \"${OPT_ARG}\" in\n"
+ " -- )\n"
+ " OPT_PROCESS=false\n"
+ " shift\n"
+ " ;;\n\0"
+/* 1201 */ "\n"
+ "OPT_ARG=$1\n"
+ "while [ $# -gt 0 ]\n"
+ "do\n"
+ " OPT_ELEMENT=''\n"
+ " OPT_ARG_VAL=''\n"
+ " OPT_ARG=${1}\n\0"
+/* 1291 */ " if [ -n \"${OPT_ARG_VAL}\" ]\n"
+ " then\n"
+ " eval %1$s_${OPT_NAME}${OPT_ELEMENT}=\"'${OPT_ARG_VAL}'\"\n"
+ " export %1$s_${OPT_NAME}${OPT_ELEMENT}\n"
+ " fi\n"
+ "done\n"
+ "unset OPT_PROCESS || :\n"
+ "unset OPT_ELEMENT || :\n"
+ "unset OPT_ARG || :\n"
+ "unset OPT_ARG_NEEDED || :\n"
+ "unset OPT_NAME || :\n"
+ "unset OPT_CODE || :\n"
+ "unset OPT_ARG_VAL || :\n"
+ "%2$s\0"
+/* 1621 */ "\n"
+ "# # # # # # # # # #\n"
+ "#\n"
+ "# END OF AUTOMATED OPTION PROCESSING\n"
+ "#\n"
+ "# # # # # # # # # # -- do not modify this marker --\n\0"
+/* 1737 */ " case \"${OPT_CODE}\" in\n\0"
+/* 1768 */ " '%s' | \\\n\0"
+/* 1786 */ " '%s' )\n\0"
+/* 1802 */ " '%c' )\n\0"
+/* 1818 */ " ;;\n\n\0"
+/* 1835 */ " * )\n"
+ " echo Unknown %s: \"${OPT_CODE}\" >&2\n"
+ " echo \"$%s_USAGE_TEXT\"\n"
+ " exit 1\n"
+ " ;;\n"
+ " esac\n\n\0"
+/* 1977 */ " echo \"$%s_%s_TEXT\"\n"
+ " exit 0\n\0"
+/* 2028 */ " echo \"$%s_LONGUSAGE_TEXT\" | ${PAGER-more}\n"
+ " exit 0\n\0"
+/* 2102 */ " %s\n\0"
+/* 2118 */ " if [ $%1$s_%2$s_CT -ge %3$d ] ; then\n"
+ " echo Error: more than %3$d %2$s options >&2\n"
+ " echo \"$%1$s_USAGE_TEXT\"\n"
+ " exit 1 ; fi\n\0"
+/* 2297 */ " %1$s_%2$s_CT=`expr ${%1$s_%2$s_CT} + 1`\n"
+ " OPT_ELEMENT=\"_${%1$s_%2$s_CT}\"\n"
+ " OPT_NAME='%2$s'\n\0"
+/* 2421 */ " if [ -n \"${%1$s_%2$s}\" ] && ${%1$s_%2$s_set} ; then\n"
+ " echo Error: duplicate %2$s option >&2\n"
+ " echo \"$%1$s_USAGE_TEXT\"\n"
+ " exit 1 ; fi\n"
+ " %1$s_%2$s_set=true\n"
+ " OPT_NAME='%2$s'\n\0"
+/* 2668 */ " %1$s_%2$s_CT=0\n"
+ " OPT_ELEMENT=''\n"
+ " %1$s_%2$s='%3$s'\n"
+ " export %1$s_%2$s\n"
+ " OPT_NAME='%2$s'\n\0"
+/* 2809 */ " if [ -n \"${%1$s_%2$s}\" ] && ${%1$s_%2$s_set} ; then\n"
+ " echo 'Error: duplicate %2$s option' >&2\n"
+ " echo \"$%1$s_USAGE_TEXT\"\n"
+ " exit 1 ; fi\n"
+ " %1$s_%2$s_set=true\n"
+ " %1$s_%2$s='%3$s'\n"
+ " export %1$s_%2$s\n"
+ " OPT_NAME='%2$s'\n\0"
+/* 3116 */ " eval %1$s_%2$s${OPT_ELEMENT}=true\n"
+ " export %1$s_%2$s${OPT_ELEMENT}\n"
+ " OPT_ARG_NEEDED=OK\n\0"
+/* 3236 */ " OPT_ARG_NEEDED=YES\n\0"
+/* 3268 */ " eval %1$s_%2$s${OPT_ELEMENT}=true\n"
+ " export %1$s_%2$s${OPT_ELEMENT}\n"
+ " OPT_ARG_NEEDED=NO\n\0"
+/* 3388 */ " OPT_CODE=`echo \"X${OPT_ARG}\"|sed 's/^X-*//'`\n"
+ " shift\n"
+ " OPT_ARG=$1\n"
+ " case \"${OPT_CODE}\" in *=* )\n"
+ " OPT_ARG_VAL=`echo \"${OPT_CODE}\"|sed 's/^[^=]*=//'`\n"
+ " OPT_CODE=`echo \"${OPT_CODE}\"|sed 's/=.*$//'` ;; esac\n\0"
+/* 3639 */ " case \"${OPT_ARG_NEEDED}\" in\n"
+ " NO )\n"
+ " OPT_ARG_VAL=''\n"
+ " ;;\n"
+ " YES )\n"
+ " if [ -z \"${OPT_ARG_VAL}\" ]\n"
+ " then\n"
+ " if [ $# -eq 0 ]\n"
+ " then\n"
+ " echo No argument provided for ${OPT_NAME} option >&2\n"
+ " echo \"$%s_USAGE_TEXT\"\n"
+ " exit 1\n"
+ " fi\n"
+ " OPT_ARG_VAL=${OPT_ARG}\n"
+ " shift\n"
+ " OPT_ARG=$1\n"
+ " fi\n"
+ " ;;\n"
+ " OK )\n"
+ " if [ -z \"${OPT_ARG_VAL}\" ] && [ $# -gt 0 ]\n"
+ " then\n"
+ " case \"${OPT_ARG}\" in -* ) ;; * )\n"
+ " OPT_ARG_VAL=${OPT_ARG}\n"
+ " shift\n"
+ " OPT_ARG=$1 ;; esac\n"
+ " fi\n"
+ " ;;\n"
+ " esac\n\0"
+/* 4418 */ " OPT_CODE=`echo \"X${OPT_ARG}\" | sed 's/X-\\(.\\).*/\\1/'`\n"
+ " OPT_ARG=` echo \"X${OPT_ARG}\" | sed 's/X-.//'`\n\0"
+/* 4535 */ " case \"${OPT_ARG_NEEDED}\" in\n"
+ " NO )\n"
+ " if [ -n \"${OPT_ARG}\" ]\n"
+ " then\n"
+ " OPT_ARG=-${OPT_ARG}\n"
+ " else\n"
+ " shift\n"
+ " OPT_ARG=$1\n"
+ " fi\n"
+ " ;;\n"
+ " YES )\n"
+ " if [ -n \"${OPT_ARG}\" ]\n"
+ " then\n"
+ " OPT_ARG_VAL=${OPT_ARG}\n"
+ " else\n"
+ " if [ $# -eq 0 ]\n"
+ " then\n"
+ " echo No argument provided for ${OPT_NAME} option >&2\n"
+ " echo \"$%s_USAGE_TEXT\"\n"
+ " exit 1\n"
+ " fi\n"
+ " shift\n"
+ " OPT_ARG_VAL=$1\n"
+ " fi\n"
+ " shift\n"
+ " OPT_ARG=$1\n"
+ " ;;\n"
+ " OK )\n"
+ " if [ -n \"${OPT_ARG}\" ]\n"
+ " then\n"
+ " OPT_ARG_VAL=${OPT_ARG}\n"
+ " shift\n"
+ " OPT_ARG=$1\n"
+ " else\n"
+ " shift\n"
+ " if [ $# -gt 0 ]\n"
+ " then\n"
+ " case \"$1\" in -* ) ;; * )\n"
+ " OPT_ARG_VAL=$1\n"
+ " shift ;; esac\n"
+ " OPT_ARG=$1\n"
+ " fi\n"
+ " fi\n"
+ " ;;\n"
+ " esac\n\0"
+/* 5689 */ "%1$s_%2$s=%3$d # 0x%3$X\n"
+ "export %1$s_%2$s\n\0"
+/* 5731 */ "%1$s_%2$s_CT=%3$d\n"
+ "export %1$s_%2$s_CT\n\0"
+/* 5770 */ "OPTION_CT=%d\n"
+ "export OPTION_CT\n\0"
+/* 5801 */ "%1$s_%2$s=%3$s\n"
+ "export %1$s_%2$s\n\0"
+/* 5834 */ "%1$s_%2$s='%3$s'\n"
+ "export %1$s_%2$s\n\0"
+/* 5869 */ "%1$s_%2$s_MODE='%3$s'\n"
+ "export %1$s_%2$s_MODE\n\0"
+/* 5914 */ "echo 'Warning: Cannot load options files' >&2\0"
+/* 5961 */ "echo 'Warning: Cannot save options files' >&2\0"
+/* 6008 */ "echo 'Warning: Cannot suppress the loading of options files' >&2\0"
+/* 6074 */ "%1$s_%2$s_TEXT='no %2$s text'\n\0"
+/* 6105 */ "%s WARNING: cannot save options - \0"
+/* 6141 */ "<%s/>\n\0"
+/* 6148 */ "<%s>\0"
+/* 6153 */ "</%s>\n\0"
+/* 6160 */ "<%s type=%s>\0"
+/* 6173 */ "<%s type=nested>\n\0"
+/* 6191 */ "#x%02X;\0"
+/* 6199 */ "<%1$s type=boolean>%2$s</%1$s>\n\0"
+/* 6231 */ "<%1$s type=integer>0x%2$lX</%1$s>\n";
+
+/* end of ao-strs.c */
/**
* \file autoopts.c
*
- * Time-stamp: "2011-08-07 14:31:49 bkorb"
+ * Time-stamp: "2012-01-29 09:58:30 bkorb"
*
* This file contains all of the routines that must be linked into
* an executable to use the generated option processing. The optional
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (c) 1992-2012 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
static char const zNil[] = "";
static arg_types_t argTypes = { NULL };
-static char zOptFmtLine[32] = { NUL };
+static char line_fmt_buf[32];
static ag_bool displayEnum = AG_FALSE;
static char const pkgdatadir_default[] = PKGDATADIR;
static char const * program_pkgdatadir = pkgdatadir_default;
* are marked for immediate processing.
*/
for (;;) {
- tOptState optState = OPTSTATE_INITIALIZER(PRESET);
+ tOptState opt_st = OPTSTATE_INITIALIZER(PRESET);
- res = next_opt(pOpts, &optState);
+ res = next_opt(pOpts, &opt_st);
switch (res) {
case FAILURE: goto failed_option;
case PROBLEM: res = SUCCESS; goto leave;
/*
* IF this is an immediate-attribute option, then do it.
*/
- if (! DO_IMMEDIATELY(optState.flags))
+ if (! DO_IMMEDIATELY(opt_st.flags))
continue;
- if (! SUCCESSFUL(handle_opt(pOpts, &optState)))
+ if (! SUCCESSFUL(handle_opt(pOpts, &opt_st)))
break;
} failed_option:;
{
/* assert: pOpts->fOptSet & OPTPROC_IMMEDIATE == 0 */
for (;;) {
- tOptState optState = OPTSTATE_INITIALIZER(DEFINED);
+ tOptState opt_st = OPTSTATE_INITIALIZER(DEFINED);
- switch (next_opt(pOpts, &optState)) {
+ switch (next_opt(pOpts, &opt_st)) {
case FAILURE: goto failed_option;
case PROBLEM: return SUCCESS; /* no more args */
case SUCCESS: break;
* IF this is an immediate action option,
* THEN skip it (unless we are supposed to do it a second time).
*/
- if (! DO_NORMALLY(optState.flags)) {
- if (! DO_SECOND_TIME(optState.flags))
+ if (! DO_NORMALLY(opt_st.flags)) {
+ if (! DO_SECOND_TIME(opt_st.flags))
continue;
- optState.pOD->optOccCt--; /* don't count this repetition */
+ opt_st.pOD->optOccCt--; /* don't count this repetition */
}
- if (! SUCCESSFUL(handle_opt(pOpts, &optState)))
+ if (! SUCCESSFUL(handle_opt(pOpts, &opt_st)))
break;
} failed_option:;
* and do all the presetting the first time thru only.
*/
if ((pOpts->fOptSet & OPTPROC_INITDONE) == 0) {
- pOpts->origArgCt = argCt;
+ pOpts->origArgCt = (unsigned int)argCt;
pOpts->origArgVect = argVect;
pOpts->fOptSet |= OPTPROC_INITDONE;
if (HAS_pzPkgDataDir(pOpts))
/*
* \file autoopts.h
*
- * Time-stamp: "2011-03-25 17:51:34 bkorb"
+ * Time-stamp: "2012-02-12 09:04:40 bkorb"
*
* This file defines all the global structures and special values
* used in the automated option processing library.
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (c) 1992-2012 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
# define EX_CONFIG 78
#endif
+#define NL '\n'
+
/*
* Convert the number to a list usable in a printf call
*/
#define NAMED_OPTS(po) \
(((po)->fOptSet & (OPTPROC_SHORTOPT | OPTPROC_LONGOPT)) == 0)
-#define SKIP_OPT(p) (((p)->fOptState & (OPTST_DOCUMENT|OPTST_OMITTED)) != 0)
+#define SKIP_OPT(p) (((p)->fOptState & OPTST_IMMUTABLE_MASK) != 0)
typedef int tDirection;
#define DIRECTION_PRESET -1
*
* DO NOT EDIT THIS FILE (options.h)
*
- * It has been AutoGen-ed December 29, 2011 at 12:02:36 PM by AutoGen 5.14
+ * It has been AutoGen-ed February 26, 2012 at 11:08:44 AM by AutoGen 5.15pre14
* 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-2011 by Bruce Korb
+ * Automated Options Copyright (C) 1992-2012 by Bruce Korb
*
* * AutoOpts is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* See the relevant generated header file to determine which and what
* values for "opt_name" are available.
*/
-#define OPTIONS_STRUCT_VERSION 147457
-#define OPTIONS_VERSION_STRING "36:1:11"
+#define OPTIONS_STRUCT_VERSION 147459
+#define OPTIONS_VERSION_STRING "36:3:11"
#define OPTIONS_MINIMUM_VERSION 102400
#define OPTIONS_MIN_VER_STRING "25:0:0"
#define OPTIONS_VER_TO_NUM(_v, _r) (((_v) * 4096) + (_r))
OPTST_DISABLE_TWICE_ID = 23, /* process disabled option twice */
OPTST_SCALED_NUM_ID = 24, /* scaled integer value */
OPTST_NO_COMMAND_ID = 25, /* disable from cmd line */
- OPTST_DEPRECATED_ID = 26 /* support is being removed */
+ OPTST_DEPRECATED_ID = 26, /* support is being removed */
+ OPTST_ALIAS_ID = 27 /* alias for other option */
} opt_state_enum_t;
#define OPTST_INIT 0U
#define OPTST_SCALED_NUM (1U << OPTST_SCALED_NUM_ID)
#define OPTST_NO_COMMAND (1U << OPTST_NO_COMMAND_ID)
#define OPTST_DEPRECATED (1U << OPTST_DEPRECATED_ID)
-#define OPT_STATE_MASK 0x07FFFF7FU
+#define OPTST_ALIAS (1U << OPTST_ALIAS_ID)
+#define OPT_STATE_MASK 0x0FFFFF7FU
#define OPTST_SET_MASK ( \
OPTST_DEFINED | OPTST_PRESET | OPTST_RESET | \
OPTST_ARG_TYPE_4 \
/* 0x0000F000U */ )
+#define OPTST_NO_USAGE_MASK ( \
+ OPTST_DEPRECATED | OPTST_NO_COMMAND | OPTST_OMITTED \
+ /* 0x06080000U */ )
+
+#define OPTST_IMMUTABLE_MASK ( \
+ OPTST_DOCUMENT | OPTST_OMITTED \
+ /* 0x00280000U */ )
+
#define OPTST_DO_NOT_SAVE_MASK ( \
OPTST_DOCUMENT | OPTST_NO_INIT | OPTST_OMITTED \
/* 0x00280100U */ )
-#define OPTST_NO_USAGE_MASK ( \
- OPTST_DEPRECATED | OPTST_NO_COMMAND | OPTST_OMITTED \
- /* 0x06080000U */ )
+#define OPTST_NO_OUTPUT_MASK ( \
+ OPTST_ALIAS | OPTST_DOCUMENT | OPTST_OMITTED \
+ /* 0x08280000U */ )
#ifdef NO_OPTIONAL_OPT_ARGS
# undef OPTST_ARG_OPTIONAL
*/
// coverity[+kill]
typedef void (tUsageProc)(tOptions* pOpts, int exitCode);
-typedef tUsageProc* tpUsageProc;
+typedef tUsageProc * tpUsageProc;
/*
* Special definitions. "NOLIMIT" is the 'max' value to use when
*/
struct options {
int const structVersion;
- int origArgCt;
+ unsigned int origArgCt;
char** origArgVect;
unsigned int fOptSet;
unsigned int curOptIdx;
extern const tOptionValue* configFileLoad(char const*);
-/* From: configfile.c line 1057
+/* From: configfile.c line 1059
*
* optionFileLoad - Load the locatable config files, in order
*
extern int optionFileLoad(tOptions*, char const*);
-/* From: configfile.c line 209
+/* From: configfile.c line 211
*
* optionFindNextValue - find a hierarcicaly valued option instance
*
extern const tOptionValue* optionFindNextValue(const tOptDesc*, const tOptionValue*, char const*, char const*);
-/* From: configfile.c line 135
+/* From: configfile.c line 137
*
* optionFindValue - find a hierarcicaly valued option instance
*
extern void optionFree(tOptions*);
-/* From: configfile.c line 278
+/* From: configfile.c line 280
*
* optionGetValue - get a specific value from a hierarcical list
*
extern const tOptionValue* optionGetValue(const tOptionValue*, char const*);
-/* From: load.c line 477
+/* From: load.c line 476
*
* optionLoadLine - process a string for an option name and value
*
extern void optionLoadLine(tOptions*, char const*);
-/* From: configfile.c line 338
+/* From: configfile.c line 340
*
* optionNextValue - get the next value from a hierarchical list
*
extern void optionRestore(tOptions*);
-/* From: save.c line 664
+/* From: save.c line 648
*
* optionSaveFile - saves the option state to a file
*
extern void optionSaveState(tOptions*);
-/* From: nested.c line 551
+/* From: nested.c line 562
*
* optionUnloadNested - Deallocate the memory for a nested value
*
extern void genshelloptUsage(tOptions*, int);
+extern int optionAlias(tOptions*, tOptDesc*, unsigned int);
+
extern void optionBooleanVal(tOptions*, tOptDesc*);
extern uintptr_t optionEnumerationVal(tOptions*, tOptDesc*, char const * const *, unsigned int);
*
* DO NOT EDIT THIS FILE (usage-txt.h)
*
- * It has been AutoGen-ed December 29, 2011 at 12:02:34 PM by AutoGen 5.14
+ * It has been AutoGen-ed February 26, 2012 at 11:08:42 AM by AutoGen 5.15pre14
* From the definitions usage-txt.def
* and the template file usage-txt.tpl
*
* This file handles all the bookkeeping required for tracking all the little
- * tiny strings used by the AutoOpts library. There are 145
+ * tiny strings used by the AutoOpts library. There are 144
* of them. This is not versioned because it is entirely internal to the
* library and accessed by client code only in a very well-controlled way:
* they may substitute translated strings using a procedure that steps through
* all the string pointers.
*
- * Copyright (C) 1992-2011 Bruce Korb, all rights reserved.
+ * Copyright (C) 1992-2012 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 3 or later
char* utpz_GnuTimeArg;
char* utpz_GnuNumArg;
char* utpz_GnuStrArg;
- cch_t* apz_str[ 138 ];
+ cch_t* apz_str[ 137 ];
} usage_text_t;
/*
#define zMust (option_usage_text.apz_str[ 63])
#define zNeedOne (option_usage_text.apz_str[ 64])
#define zNoArg (option_usage_text.apz_str[ 65])
-#define zNoArgv (option_usage_text.apz_str[ 66])
-#define zNoArgs (option_usage_text.apz_str[ 67])
-#define zNoCreat (option_usage_text.apz_str[ 68])
-#define zNoFlags (option_usage_text.apz_str[ 69])
-#define zNoKey (option_usage_text.apz_str[ 70])
-#define zNoLim (option_usage_text.apz_str[ 71])
-#define zNoPreset (option_usage_text.apz_str[ 72])
-#define zNoResetArg (option_usage_text.apz_str[ 73])
-#define zNoRq_NoShrtTtl (option_usage_text.apz_str[ 74])
-#define zNoRq_ShrtTtl (option_usage_text.apz_str[ 75])
-#define zNoStat (option_usage_text.apz_str[ 76])
-#define zNoState (option_usage_text.apz_str[ 77])
-#define zNone (option_usage_text.apz_str[ 78])
-#define zNotDef (option_usage_text.apz_str[ 79])
-#define zNotCmdOpt (option_usage_text.apz_str[ 80])
-#define zNotEnough (option_usage_text.apz_str[ 81])
-#define zNotFile (option_usage_text.apz_str[ 82])
-#define zNotNumber (option_usage_text.apz_str[ 83])
-#define zNotDate (option_usage_text.apz_str[ 84])
-#define zNotDuration (option_usage_text.apz_str[ 85])
-#define zNrmOptFmt (option_usage_text.apz_str[ 86])
-#define zNumberOpt (option_usage_text.apz_str[ 87])
-#define zOnlyOne (option_usage_text.apz_str[ 88])
-#define zOptsOnly (option_usage_text.apz_str[ 89])
-#define zOutputFail (option_usage_text.apz_str[ 90])
-#define zPathFmt (option_usage_text.apz_str[ 91])
-#define zPlsSendBugs (option_usage_text.apz_str[ 92])
-#define zPreset (option_usage_text.apz_str[ 93])
-#define zPresetFile (option_usage_text.apz_str[ 94])
-#define zPresetIntro (option_usage_text.apz_str[ 95])
-#define zProhib (option_usage_text.apz_str[ 96])
-#define zReorder (option_usage_text.apz_str[ 97])
-#define zRange (option_usage_text.apz_str[ 98])
-#define zRangeAbove (option_usage_text.apz_str[ 99])
-#define zRangeLie (option_usage_text.apz_str[100])
-#define zRangeOnly (option_usage_text.apz_str[101])
-#define zRangeOr (option_usage_text.apz_str[102])
-#define zRangeErr (option_usage_text.apz_str[103])
-#define zRangeExact (option_usage_text.apz_str[104])
-#define zRangeScaled (option_usage_text.apz_str[105])
-#define zRangeUpto (option_usage_text.apz_str[106])
-#define zResetNotConfig (option_usage_text.apz_str[107])
-#define zReqFmt (option_usage_text.apz_str[108])
-#define zReqOptFmt (option_usage_text.apz_str[109])
-#define zReqThese (option_usage_text.apz_str[110])
-#define zReq_NoShrtTtl (option_usage_text.apz_str[111])
-#define zReq_ShrtTtl (option_usage_text.apz_str[112])
-#define zSepChars (option_usage_text.apz_str[113])
-#define zSetMemberSettings (option_usage_text.apz_str[114])
-#define zShrtGnuOptFmt (option_usage_text.apz_str[115])
-#define zSixSpaces (option_usage_text.apz_str[116])
-#define zStdBoolArg (option_usage_text.apz_str[117])
-#define zStdBreak (option_usage_text.apz_str[118])
-#define zStdFileArg (option_usage_text.apz_str[119])
-#define zStdKeyArg (option_usage_text.apz_str[120])
-#define zStdKeyLArg (option_usage_text.apz_str[121])
-#define zStdTimeArg (option_usage_text.apz_str[122])
-#define zStdNestArg (option_usage_text.apz_str[123])
-#define zStdNoArg (option_usage_text.apz_str[124])
-#define zStdNumArg (option_usage_text.apz_str[125])
-#define zStdOptArg (option_usage_text.apz_str[126])
-#define zStdReqArg (option_usage_text.apz_str[127])
-#define zStdStrArg (option_usage_text.apz_str[128])
-#define zTabHyp (option_usage_text.apz_str[129])
-#define zTabHypAnd (option_usage_text.apz_str[130])
-#define zTabout (option_usage_text.apz_str[131])
-#define zThreeSpaces (option_usage_text.apz_str[132])
-#define zTwoSpaces (option_usage_text.apz_str[133])
-#define zUpTo (option_usage_text.apz_str[134])
-#define zValidKeys (option_usage_text.apz_str[135])
-#define zVendOptsAre (option_usage_text.apz_str[136])
-#define zVendIntro (option_usage_text.apz_str[137])
+#define zNoArgs (option_usage_text.apz_str[ 66])
+#define zNoCreat (option_usage_text.apz_str[ 67])
+#define zNoFlags (option_usage_text.apz_str[ 68])
+#define zNoKey (option_usage_text.apz_str[ 69])
+#define zNoLim (option_usage_text.apz_str[ 70])
+#define zNoPreset (option_usage_text.apz_str[ 71])
+#define zNoResetArg (option_usage_text.apz_str[ 72])
+#define zNoRq_NoShrtTtl (option_usage_text.apz_str[ 73])
+#define zNoRq_ShrtTtl (option_usage_text.apz_str[ 74])
+#define zNoStat (option_usage_text.apz_str[ 75])
+#define zNoState (option_usage_text.apz_str[ 76])
+#define zNone (option_usage_text.apz_str[ 77])
+#define zNotDef (option_usage_text.apz_str[ 78])
+#define zNotCmdOpt (option_usage_text.apz_str[ 79])
+#define zNotEnough (option_usage_text.apz_str[ 80])
+#define zNotFile (option_usage_text.apz_str[ 81])
+#define zNotNumber (option_usage_text.apz_str[ 82])
+#define zNotDate (option_usage_text.apz_str[ 83])
+#define zNotDuration (option_usage_text.apz_str[ 84])
+#define zNrmOptFmt (option_usage_text.apz_str[ 85])
+#define zNumberOpt (option_usage_text.apz_str[ 86])
+#define zOnlyOne (option_usage_text.apz_str[ 87])
+#define zOptsOnly (option_usage_text.apz_str[ 88])
+#define zOutputFail (option_usage_text.apz_str[ 89])
+#define zPathFmt (option_usage_text.apz_str[ 90])
+#define zPlsSendBugs (option_usage_text.apz_str[ 91])
+#define zPreset (option_usage_text.apz_str[ 92])
+#define zPresetFile (option_usage_text.apz_str[ 93])
+#define zPresetIntro (option_usage_text.apz_str[ 94])
+#define zProhib (option_usage_text.apz_str[ 95])
+#define zReorder (option_usage_text.apz_str[ 96])
+#define zRange (option_usage_text.apz_str[ 97])
+#define zRangeAbove (option_usage_text.apz_str[ 98])
+#define zRangeLie (option_usage_text.apz_str[ 99])
+#define zRangeOnly (option_usage_text.apz_str[100])
+#define zRangeOr (option_usage_text.apz_str[101])
+#define zRangeErr (option_usage_text.apz_str[102])
+#define zRangeExact (option_usage_text.apz_str[103])
+#define zRangeScaled (option_usage_text.apz_str[104])
+#define zRangeUpto (option_usage_text.apz_str[105])
+#define zResetNotConfig (option_usage_text.apz_str[106])
+#define zReqFmt (option_usage_text.apz_str[107])
+#define zReqOptFmt (option_usage_text.apz_str[108])
+#define zReqThese (option_usage_text.apz_str[109])
+#define zReq_NoShrtTtl (option_usage_text.apz_str[110])
+#define zReq_ShrtTtl (option_usage_text.apz_str[111])
+#define zSepChars (option_usage_text.apz_str[112])
+#define zSetMemberSettings (option_usage_text.apz_str[113])
+#define zShrtGnuOptFmt (option_usage_text.apz_str[114])
+#define zSixSpaces (option_usage_text.apz_str[115])
+#define zStdBoolArg (option_usage_text.apz_str[116])
+#define zStdBreak (option_usage_text.apz_str[117])
+#define zStdFileArg (option_usage_text.apz_str[118])
+#define zStdKeyArg (option_usage_text.apz_str[119])
+#define zStdKeyLArg (option_usage_text.apz_str[120])
+#define zStdTimeArg (option_usage_text.apz_str[121])
+#define zStdNestArg (option_usage_text.apz_str[122])
+#define zStdNoArg (option_usage_text.apz_str[123])
+#define zStdNumArg (option_usage_text.apz_str[124])
+#define zStdOptArg (option_usage_text.apz_str[125])
+#define zStdReqArg (option_usage_text.apz_str[126])
+#define zStdStrArg (option_usage_text.apz_str[127])
+#define zTabHyp (option_usage_text.apz_str[128])
+#define zTabHypAnd (option_usage_text.apz_str[129])
+#define zTabout (option_usage_text.apz_str[130])
+#define zThreeSpaces (option_usage_text.apz_str[131])
+#define zTwoSpaces (option_usage_text.apz_str[132])
+#define zUpTo (option_usage_text.apz_str[133])
+#define zValidKeys (option_usage_text.apz_str[134])
+#define zVendOptsAre (option_usage_text.apz_str[135])
+#define zVendIntro (option_usage_text.apz_str[136])
/*
* First, set up the strings. Some of these are writable. These are all in
static char eng_zGnuTimeArg[] = "=Tim";
static char eng_zGnuNumArg[] = "=num";
static char eng_zGnuStrArg[] = "=str";
-static char const usage_txt[4619] =
+static char const usage_txt[4575] =
/* 0 */ "malloc of %d bytes failed\n\0"
/* 27 */ "AutoOpts function called without option descriptor\n\0"
/* 79 */ "\tThis exceeds the compiled library version: \0"
/* 260 */ "\tThis is less than the minimum library version: \0"
/* 310 */ "strdup of %d byte string failed\n\0"
/* 343 */ "Automated Options version %s\n"
- "\tcopyright (c) 1999-2011 by Bruce Korb - all rights reserved\n\0"
+ "\tcopyright (c) 1999-2012 by Bruce Korb - all rights reserved\n\0"
/* 434 */ "AutoOpts lib error: defaulted to option with optional arg\n\0"
/* 493 */ "(AutoOpts bug): Aliasing option is out of range.\0"
/* 543 */ "all\0"
/* 2359 */ "\t\t\t\t- must appear between %d and %d times\n\0"
/* 2402 */ "ERROR: The %s option is required\n\0"
/* 2437 */ "%s: option `%s' cannot have an argument\n\0"
-/* 2478 */ "%s: cannot allocate new argument vector\n\0"
-/* 2519 */ "%s: Command line arguments not allowed\n\0"
-/* 2559 */ "error %d (%s) creating %s\n\0"
-/* 2586 */ "Options are specified by single or double hyphens and their name.\n\0"
-/* 2653 */ "%s error: `%s' does not match any %s keywords\n\0"
-/* 2701 */ "\t\t\t\t- may appear multiple times\n\0"
-/* 2734 */ "\t\t\t\t- may not be preset\n\0"
-/* 2759 */ "The 'reset-option' option requires an argument\n\0"
-/* 2807 */ " Arg Option-Name Description\n\0"
-/* 2842 */ " Flg Arg Option-Name Description\n\0"
-/* 2880 */ "error %d (%s) stat-ing %s\n\0"
-/* 2907 */ "%s(optionRestore): error: no saved option state\n\0"
-/* 2956 */ "none\0"
-/* 2961 */ "'%s' not defined\n\0"
-/* 2979 */ "'%s' is not a command line option\n\0"
-/* 3014 */ "ERROR: The %s option must appear %d times\n\0"
-/* 3058 */ "error: cannot load options from non-regular file %s\n\0"
-/* 3112 */ "%s error: `%s' is not a recognizable number\n\0"
-/* 3158 */ "%s error: `%s' is not a recognizable date/time\n\0"
-/* 3207 */ "%s error: `%s' is not a recognizable time duration\n\0"
-/* 3260 */ " %3s %s\0"
-/* 3268 */ "The '-#<number>' option may omit the hash char\n\0"
-/* 3316 */ "one %s%s option allowed\n\0"
-/* 3341 */ "All arguments are named options.\n\0"
-/* 3375 */ "Write failure to output file\0"
-/* 3404 */ " - reading file %s\0"
-/* 3423 */ "\n"
+/* 2478 */ "%s: Command line arguments not allowed\n\0"
+/* 2518 */ "error %d (%s) creating %s\n\0"
+/* 2545 */ "Options are specified by single or double hyphens and their name.\n\0"
+/* 2612 */ "%s error: `%s' does not match any %s keywords\n\0"
+/* 2660 */ "\t\t\t\t- may appear multiple times\n\0"
+/* 2693 */ "\t\t\t\t- may not be preset\n\0"
+/* 2718 */ "The 'reset-option' option requires an argument\n\0"
+/* 2766 */ " Arg Option-Name Description\n\0"
+/* 2801 */ " Flg Arg Option-Name Description\n\0"
+/* 2839 */ "error %d (%s) stat-ing %s\n\0"
+/* 2866 */ "%s(optionRestore): error: no saved option state\n\0"
+/* 2915 */ "none\0"
+/* 2920 */ "'%s' not defined\n\0"
+/* 2938 */ "'%s' is not a command line option\n\0"
+/* 2973 */ "ERROR: The %s option must appear %d times\n\0"
+/* 3017 */ "error: cannot load options from non-regular file %s\n\0"
+/* 3071 */ "%s error: `%s' is not a recognizable number\n\0"
+/* 3117 */ "%s error: `%s' is not a recognizable date/time\n\0"
+/* 3166 */ "%s error: `%s' is not a recognizable time duration\n\0"
+/* 3219 */ " %3s %s\0"
+/* 3227 */ "The '-#<number>' option may omit the hash char\n\0"
+/* 3275 */ "one %s%s option allowed\n\0"
+/* 3300 */ "All arguments are named options.\n\0"
+/* 3334 */ "Write failure to output file\0"
+/* 3363 */ " - reading file %s\0"
+/* 3382 */ "\n"
"please send bug reports to: %s\n\0"
-/* 3457 */ "\t\t\t\t- may NOT appear - preset only\n\0"
-/* 3493 */ "# preset/initialization file\n"
+/* 3416 */ "\t\t\t\t- may NOT appear - preset only\n\0"
+/* 3452 */ "# preset/initialization file\n"
"# %s#\n\0"
-/* 3531 */ "\n"
+/* 3490 */ "\n"
"The following option preset mechanisms are supported:\n\0"
-/* 3587 */ "prohibits these options:\n\0"
-/* 3613 */ "Operands and options may be intermixed. They will be reordered.\n\0"
-/* 3679 */ "%s%ld to %ld\0"
-/* 3692 */ "%sgreater than or equal to %ld\0"
-/* 3723 */ "%sIt must lie in one of the ranges:\n\0"
-/* 3760 */ "%sIt must be in the range:\n\0"
-/* 3788 */ ", or\n\0"
-/* 3794 */ "%s error: %s option value ``%s'' is out of range.\n\0"
-/* 3846 */ "%s%ld exactly\0"
-/* 3860 */ "%sis scalable with a suffix: k/K/m/M/g/G/t/T\n\0"
-/* 3906 */ "%sless than or equal to %ld\0"
-/* 3934 */ "The --reset-option has not been configured.\n\0"
-/* 3979 */ "ERROR: %s option requires the %s option\n\0"
-/* 4021 */ " %3s %-14s %s\0"
-/* 4035 */ "requires these options:\n\0"
-/* 4060 */ " Arg Option-Name Req? Description\n\0"
-/* 4100 */ " Flg Arg Option-Name Req? Description\n\0"
-/* 4143 */ "-_^\0"
-/* 4147 */ "or you may use a numeric representation. Preceding these with a '!' will\n"
+/* 3546 */ "prohibits these options:\n\0"
+/* 3572 */ "Operands and options may be intermixed. They will be reordered.\n\0"
+/* 3638 */ "%s%ld to %ld\0"
+/* 3651 */ "%sgreater than or equal to %ld\0"
+/* 3682 */ "%sIt must lie in one of the ranges:\n\0"
+/* 3719 */ "%sIt must be in the range:\n\0"
+/* 3747 */ ", or\n\0"
+/* 3753 */ "%s error: %s option value %ld is out of range.\n\0"
+/* 3802 */ "%s%ld exactly\0"
+/* 3816 */ "%sis scalable with a suffix: k/K/m/M/g/G/t/T\n\0"
+/* 3862 */ "%sless than or equal to %ld\0"
+/* 3890 */ "The --reset-option has not been configured.\n\0"
+/* 3935 */ "ERROR: %s option requires the %s option\n\0"
+/* 3977 */ " %3s %-14s %s\0"
+/* 3991 */ "requires these options:\n\0"
+/* 4016 */ " Arg Option-Name Req? Description\n\0"
+/* 4056 */ " Flg Arg Option-Name Req? Description\n\0"
+/* 4099 */ "-_^\0"
+/* 4103 */ "or you may use a numeric representation. Preceding these with a '!' will\n"
"clear the bits, specifying 'none' will clear all bits, and 'all' will set them\n"
"all. Multiple entries may be passed as an option argument list.\n\0"
-/* 4366 */ "%s\0"
-/* 4369 */ " \0"
-/* 4376 */ "T/F\0"
-/* 4380 */ "\n"
+/* 4322 */ "%s\0"
+/* 4325 */ " \0"
+/* 4332 */ "T/F\0"
+/* 4336 */ "\n"
"%s\n\n"
"%s\0"
-/* 4388 */ "Fil\0"
-/* 4392 */ "KWd\0"
-/* 4396 */ "Mbr\0"
-/* 4400 */ "Tim\0"
-/* 4404 */ "Cpx\0"
-/* 4408 */ "no \0"
-/* 4412 */ "Num\0"
-/* 4416 */ "opt\0"
-/* 4420 */ "YES\0"
-/* 4424 */ "Str\0"
-/* 4428 */ "\t\t\t\t- \0"
-/* 4435 */ "\t\t\t\t-- and \0"
-/* 4447 */ "\t\t\t\t%s\n\0"
-/* 4455 */ " \0"
-/* 4459 */ " \0"
-/* 4462 */ "\t\t\t\t- may appear up to %d times\n\0"
-/* 4495 */ "The valid \"%s\" option keywords are:\n\0"
-/* 4532 */ "These additional options are:\0"
-/* 4562 */ "The next option supports vendor supported extra options:";
+/* 4344 */ "Fil\0"
+/* 4348 */ "KWd\0"
+/* 4352 */ "Mbr\0"
+/* 4356 */ "Tim\0"
+/* 4360 */ "Cpx\0"
+/* 4364 */ "no \0"
+/* 4368 */ "Num\0"
+/* 4372 */ "opt\0"
+/* 4376 */ "YES\0"
+/* 4380 */ "Str\0"
+/* 4384 */ "\t\t\t\t- \0"
+/* 4391 */ "\t\t\t\t-- and \0"
+/* 4403 */ "\t\t\t\t%s\n\0"
+/* 4411 */ " \0"
+/* 4415 */ " \0"
+/* 4418 */ "\t\t\t\t- may appear up to %d times\n\0"
+/* 4451 */ "The valid \"%s\" option keywords are:\n\0"
+/* 4488 */ "These additional options are:\0"
+/* 4518 */ "The next option supports vendor supported extra options:";
/*
* Aren't you glad you don't maintain this by hand?
*/
usage_text_t option_usage_text = {
- 145,
+ 144,
eng_zGnuBoolArg, eng_zGnuKeyArg, eng_zGnuFileArg, eng_zGnuKeyLArg,
eng_zGnuTimeArg, eng_zGnuNumArg, eng_zGnuStrArg,
{
usage_txt +1966, usage_txt +1973, usage_txt +1984, usage_txt +2010,
usage_txt +2036, usage_txt +2079, usage_txt +2115, usage_txt +2166,
usage_txt +2222, usage_txt +2256, usage_txt +2294, usage_txt +2359,
- usage_txt +2402, usage_txt +2437, usage_txt +2478, usage_txt +2519,
- usage_txt +2559, usage_txt +2586, usage_txt +2653, usage_txt +2701,
- usage_txt +2734, usage_txt +2759, usage_txt +2807, usage_txt +2842,
- usage_txt +2880, usage_txt +2907, usage_txt +2956, usage_txt +2961,
- usage_txt +2979, usage_txt +3014, usage_txt +3058, usage_txt +3112,
- usage_txt +3158, usage_txt +3207, usage_txt +3260, usage_txt +3268,
- usage_txt +3316, usage_txt +3341, usage_txt +3375, usage_txt +3404,
- usage_txt +3423, usage_txt +3457, usage_txt +3493, usage_txt +3531,
- usage_txt +3587, usage_txt +3613, usage_txt +3679, usage_txt +3692,
- usage_txt +3723, usage_txt +3760, usage_txt +3788, usage_txt +3794,
- usage_txt +3846, usage_txt +3860, usage_txt +3906, usage_txt +3934,
- usage_txt +3979, usage_txt +4021, usage_txt +4035, usage_txt +4060,
- usage_txt +4100, usage_txt +4143, usage_txt +4147, usage_txt +4366,
- usage_txt +4369, usage_txt +4376, usage_txt +4380, usage_txt +4388,
- usage_txt +4392, usage_txt +4396, usage_txt +4400, usage_txt +4404,
- usage_txt +4408, usage_txt +4412, usage_txt +4416, usage_txt +4420,
- usage_txt +4424, usage_txt +4428, usage_txt +4435, usage_txt +4447,
- usage_txt +4455, usage_txt +4459, usage_txt +4462, usage_txt +4495,
- usage_txt +4532, usage_txt +4562
+ usage_txt +2402, usage_txt +2437, usage_txt +2478, usage_txt +2518,
+ usage_txt +2545, usage_txt +2612, usage_txt +2660, usage_txt +2693,
+ usage_txt +2718, usage_txt +2766, usage_txt +2801, usage_txt +2839,
+ usage_txt +2866, usage_txt +2915, usage_txt +2920, usage_txt +2938,
+ usage_txt +2973, usage_txt +3017, usage_txt +3071, usage_txt +3117,
+ usage_txt +3166, usage_txt +3219, usage_txt +3227, usage_txt +3275,
+ usage_txt +3300, usage_txt +3334, usage_txt +3363, usage_txt +3382,
+ usage_txt +3416, usage_txt +3452, usage_txt +3490, usage_txt +3546,
+ usage_txt +3572, usage_txt +3638, usage_txt +3651, usage_txt +3682,
+ usage_txt +3719, usage_txt +3747, usage_txt +3753, usage_txt +3802,
+ usage_txt +3816, usage_txt +3862, usage_txt +3890, usage_txt +3935,
+ usage_txt +3977, usage_txt +3991, usage_txt +4016, usage_txt +4056,
+ usage_txt +4099, usage_txt +4103, usage_txt +4322, usage_txt +4325,
+ usage_txt +4332, usage_txt +4336, usage_txt +4344, usage_txt +4348,
+ usage_txt +4352, usage_txt +4356, usage_txt +4360, usage_txt +4364,
+ usage_txt +4368, usage_txt +4372, usage_txt +4376, usage_txt +4380,
+ usage_txt +4384, usage_txt +4391, usage_txt +4403, usage_txt +4411,
+ usage_txt +4415, usage_txt +4418, usage_txt +4451, usage_txt +4488,
+ usage_txt +4518
}
};
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (c) 1992-2012 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
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (c) 1992-2012 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
/**
* \file compat.h --- fake the preprocessor into handlng portability
*
- * Time-stamp: "2010-07-16 15:11:57 bkorb"
+ * Time-stamp: "2012-02-12 09:00:09 bkorb"
*
* compat.h is free software.
* This file is part of AutoGen.
*
- * AutoGen Copyright (c) 1992-2011 by Bruce Korb - all rights reserved
+ * AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
*
* AutoGen is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
# include <sys/procset.h>
#endif
#include <sys/stat.h>
-#include <sys/wait.h>
+#ifdef HAVE_SYS_WAIT_H
+# include <sys/wait.h>
+#endif
#if defined( HAVE_SOLARIS_SYSINFO )
# include <sys/systeminfo.h>
*
* This file is part of AutoGen.
*
- * AutoGen Copyright (c) 1992-2011 by Bruce Korb - all rights reserved
+ * AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
*
* AutoGen is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
/**
* \file configfile.c
*
- * Time-stamp: "2011-12-17 12:51:30 bkorb"
+ * Time-stamp: "2012-02-25 12:54:32 bkorb"
*
* configuration/rc/ini file handling.
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (c) 1992-2012 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
* @code{mmap(2)} or other file system calls, or it may be:
* @itemize @bullet
* @item
- * @code{ENOENT} - the file was empty.
+ * @code{ENOENT} - the file was not found.
+ * @item
+ * @code{ENOMSG} - the file was empty.
* @item
* @code{EINVAL} - the file contents are invalid -- not properly formed.
* @item
break;
case '#':
- ftext = strchr(ftext + 1, '\n');
+ ftext = strchr(ftext + 1, NL);
break;
default:
handle_cfg(tOptions * pOpts, tOptState * pOS, char * pzText, int dir)
{
char* pzName = pzText++;
- char* pzEnd = strchr(pzText, '\n');
+ char* pzEnd = strchr(pzText, NL);
if (pzEnd == NULL)
return pzText + strlen(pzText);
case NUL:
pcS = NULL;
- case '\n':
+ case NL:
*pcD = NUL;
pzEnd = pcS;
goto copy_done;
case '\\':
- if (*pcS == '\n') {
+ if (*pcS == NL) {
ch = *(pcS++);
}
/* FALLTHROUGH */
size_t len = strlen(pOpts->pzPROGNAME);
if ( (strncmp(pzText+1, pOpts->pzPROGNAME, len) == 0)
&& (pzText[len+1] == ']'))
- return strchr(pzText + len + 2, '\n');
+ return strchr(pzText + len + 2, NL);
if (len > 16)
return NULL;
}
if (pzText != NULL)
- pzText = strchr(pzText, '\n');
+ pzText = strchr(pzText, NL);
return pzText;
}
_xmlNm_(cr, '\r') \
_xmlNm_(vt, '\v') \
_xmlNm_(bel, '\a') \
- _xmlNm_(nl, '\n') \
+ _xmlNm_(nl, NL) \
_xmlNm_(space, ' ') \
_xmlNm_(quot, '"') \
_xmlNm_(apos, '\'')
return;
case '&':
- *(pzd++) = \
- ch = parse_xml_encoding(&pzs);
+ ch = parse_xml_encoding(&pzs);
+ *(pzd++) = (char)ch;
if (ch == NUL)
return;
break;
/* FALLTHROUGH */
default:
- *(pzd++) = ch;
+ *(pzd++) = (char)ch;
}
}
}
|| (pOpts->structVersion < OPTIONS_MINIMUM_VERSION )
) ) {
static char const aover[] =
- __STR(AO_CURRENT)":"__STR(AO_REVISION)":"__STR(AO_AGE)"\n";
+ STR(AO_CURRENT)":"STR(AO_REVISION)":"STR(AO_AGE)"\n";
fprintf(stderr, zAO_Err, pzProgram, NUM_TO_VER(pOpts->structVersion));
if (pOpts->structVersion > OPTIONS_STRUCT_VERSION )
/**
* \file cook.c
*
- * Time-stamp: "2011-03-12 15:05:26 bkorb"
+ * Time-stamp: "2012-02-12 09:00:47 bkorb"
*
* This file contains the routines that deal with processing quoted strings
* into an internal format.
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (c) 1992-2012 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
* err: @code{NULL} is returned if the string is mal-formed.
=*/
unsigned int
-ao_string_cook_escape_char( char const* pzIn, char* pRes, u_int nl )
+ao_string_cook_escape_char(char const* pzIn, char* pRes, uint_t nl)
{
unsigned int res = 1;
case NUL: /* NUL - end of input string */
return 0;
case '\r':
- if (*pzIn != '\n')
+ if (*pzIn != NL)
return 1;
res++;
/* FALLTHROUGH */
- case '\n': /* NL - emit newline */
+ case NL: /* NL - emit newline */
*pRes = (char)nl;
return res;
case 'a': *pRes = '\a'; break;
case 'b': *pRes = '\b'; break;
case 'f': *pRes = '\f'; break;
- case 'n': *pRes = '\n'; break;
+ case 'n': *pRes = NL; break;
case 'r': *pRes = '\r'; break;
case 't': *pRes = '\t'; break;
case 'v': *pRes = '\v'; break;
for (;;) {
while (IS_WHITESPACE_CHAR(*ps))
- if (*(ps++) == '\n')
+ if (*(ps++) == NL)
(*lnct_p)++;
/*
/*
* Skip to end of line
*/
- ps = strchr(ps, '\n');
+ ps = strchr(ps, NL);
if (ps == NULL) {
*pps = NULL;
return AG_FALSE;
}
while (ps < p) {
- if (*(ps++) == '\n')
+ if (*(ps++) == NL)
(*lnct_p)++;
}
case NUL:
return NULL;
- case '\n':
+ case NL:
(*lnct_p)++;
break;
* THEN drop both the escape and the newline from
* the result string.
*/
- if (*pzS == '\n') {
+ if (*pzS == NL) {
pzS++;
pzD--;
(*lnct_p)++;
* THEN we do the full escape character processing
*/
else if (q != '\'') {
- int ct = ao_string_cook_escape_char( pzS, pzD-1, (u_int)'\n' );
+ int ct = ao_string_cook_escape_char(pzS, pzD-1, (uint_t)NL);
if (ct == 0)
return NULL;
/**
* \file enumeration.c
*
- * Time-stamp: "2011-04-06 10:48:22 bkorb"
+ * Time-stamp: "2012-01-29 19:07:59 bkorb"
*
* Automated Options Paged Usage module.
*
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (c) 1992-2012 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
*/
if (max_len > 35) {
do {
- fprintf(option_usage_fp, " %s\n", *(paz_names++));
+ fprintf(option_usage_fp, ENUM_ERR_SEP_LINE_FMT, *(paz_names++));
} while (--ct_down > 0);
}
fputc(' ', option_usage_fp);
fputs(*(paz_names++), option_usage_fp);
} while (--ct_down > 0);
- fputc('\n', option_usage_fp);
+ fputc(NL, option_usage_fp);
}
/*
* Otherwise, columnize the output
*/
else {
- int ent_no = 0;
+ unsigned int ent_no = 0;
char zFmt[16]; /* format for all-but-last entries on a line */
- sprintf(zFmt, "%%-%ds", (int)max_len);
+ sprintf(zFmt, ENUM_ERR_STR_WIDTH_FMT, (int)max_len);
max_len = 78 / max_len; /* max_len is now max entries on a line */
- fputs(" ", option_usage_fp);
+ fputs(TWO_SPACES_STR, option_usage_fp);
/*
* Loop through all but the last entry
/*
* Last entry on a line. Start next line, too.
*/
- fprintf(option_usage_fp, "%s\n ", *(paz_names++));
+ fprintf(option_usage_fp, NLSTR_SPACE_FMT, *(paz_names++));
ent_no = 0;
}
else
fprintf(option_usage_fp, zFmt, *(paz_names++) );
}
- fprintf(option_usage_fp, "%s\n", *paz_names);
+ fprintf(option_usage_fp, NLSTR_FMT, *paz_names);
}
if (pOpts > OPTPROC_EMIT_LIMIT) {
* print the name string.
*/
if (ix >= name_ct)
- printf("INVALID-%d", ix);
+ printf(INVALID_FMT, ix);
else
fputs(paz_names[ ix ], stdout);
case (uintptr_t)OPTPROC_RETURN_VALNAME:
{
- tSCC zInval[] = "*INVALID*";
unsigned int ix = pOD->optArg.argEnum;
/*
* Replace the enumeration value with the name string.
*/
if (ix >= name_ct)
- return (uintptr_t)zInval;
+ return (uintptr_t)INVALID_STR;
pOD->optArg.argString = paz_names[ix];
break;
/*
* print the name string.
*/
- int ix = 0;
- uintptr_t bits = (uintptr_t)pOD->optCookie;
- size_t len = 0;
+ unsigned int ix = 0;
+ uintptr_t bits = (uintptr_t)pOD->optCookie;
+ size_t len = 0;
bits &= ((uintptr_t)1 << (uintptr_t)name_ct) - (uintptr_t)1;
while (bits != 0) {
if (bits & 1) {
- if (len++ > 0) fputs(" | ", stdout);
+ if (len++ > 0) fputs(OR_STR, stdout);
fputs(paz_names[ix], stdout);
}
if (++ix >= name_ct) break;
set_memb_names(tOptions * pOpts, tOptDesc * pOD, char const * const * paz_names,
unsigned int name_ct)
{
- static char const none[] = "none";
- static char const plus[3] = " + ";
-
- char * pz;
- uintptr_t bits = (uintptr_t)pOD->optCookie;
- int ix = 0;
- size_t len = sizeof(none);
+ char * pz;
+ uintptr_t bits = (uintptr_t)pOD->optCookie;
+ unsigned int ix = 0;
+ size_t len = NONE_STR_LEN + 1;
bits &= ((uintptr_t)1 << (uintptr_t)name_ct) - (uintptr_t)1;
*/
while (bits != 0) {
if (bits & 1)
- len += strlen(paz_names[ix]) + sizeof(plus);
+ len += strlen(paz_names[ix]) + PLUS_STR_LEN + 1;
if (++ix >= name_ct) break;
bits >>= 1;
}
- pOD->optArg.argString = pz = AGALOC(len, "enum name");
+ pOD->optArg.argString = pz = AGALOC(len, "enum");
/*
* Start by clearing all the bits. We want to turn off any defaults
* because we will be restoring to current state, not adding to
* the default set of bits.
*/
- memcpy(pz, none, sizeof(none)-1);
- pz += sizeof(none)-1;
+ memcpy(pz, NONE_STR, NONE_STR_LEN);
+ pz += NONE_STR_LEN;
bits = (uintptr_t)pOD->optCookie;
bits &= ((uintptr_t)1 << (uintptr_t)name_ct) - (uintptr_t)1;
ix = 0;
while (bits != 0) {
if (bits & 1) {
size_t nln = strlen(paz_names[ix]);
- memcpy(pz, plus, sizeof(plus));
- memcpy(pz+sizeof(plus), paz_names[ix], nln);
- pz += strlen(paz_names[ix]) + 3;
+ memcpy(pz, PLUS_STR, PLUS_STR_LEN);
+ memcpy(pz+PLUS_STR_LEN, paz_names[ix], nln);
+ pz += nln + PLUS_STR_LEN;
}
if (++ix >= name_ct) break;
bits >>= 1;
return;
{
- char const* pzArg = pOD->optArg.argString;
+ char const * pzArg = pOD->optArg.argString;
uintptr_t res;
if ((pzArg == NULL) || (*pzArg == NUL)) {
pOD->optCookie = (void*)0;
res = (uintptr_t)pOD->optCookie;
for (;;) {
- tSCC zSpn[] = " ,|+\t\r\f\n";
int iv, len;
- pzArg += strspn(pzArg, zSpn);
+ pzArg = SPN_SET_SEPARATOR_CHARS(pzArg);
iv = (*pzArg == '!');
if (iv)
- pzArg += strspn(pzArg+1, zSpn) + 1;
+ pzArg = SPN_WHITESPACE_CHARS(pzArg+1);
- len = strcspn(pzArg, zSpn);
+ len = BRK_SET_SEPARATOR_CHARS(pzArg) - pzArg;
if (len == 0)
break;
if (pz != pzArg + len) {
char z[ AO_NAME_SIZE ];
char const* p;
- int shift_ct;
+ unsigned int shift_ct;
if (*pz != NUL) {
if (len >= AO_NAME_LIMIT)
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (c) 1992-2012 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
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (c) 1992-2012 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
*
* @brief Hunt for options in the option descriptor list
*
- * Time-stamp: "2011-08-07 13:15:45 bkorb"
+ * Time-stamp: "2012-01-29 19:07:30 bkorb"
*
* This file contains the routines that deal with processing quoted strings
* into an internal format.
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (c) 1992-2012 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
case NUL: return res;
case '=':
- if (res >= bufsz)
+ if (res >= (int)bufsz)
return -1;
memcpy(buf, *nm_pp, res);
opt_ambiguities(tOptions * opts, char const * name, int nm_len)
{
char const * const hyph =
- NAMED_OPTS(opts) ? "" : "--";
+ NAMED_OPTS(opts) ? "" : LONG_OPT_MARKER;
tOptDesc * pOD = opts->pOptDesc;
int idx = 0;
fprintf(stderr, zDisabledErr, opts->pzProgName, pOD->pz_Name);
if (pOD->pzText != NULL)
- fprintf(stderr, " -- %s", pOD->pzText);
- fputc('\n', stderr);
+ fprintf(stderr, SET_OFF_FMT, pOD->pzText);
+ fputc(NL, stderr);
(*opts->pUsageProc)(opts, EXIT_FAILURE);
/* NOTREACHED */
_exit(EXIT_FAILURE); /* to be certain */
optionVendorOption(tOptions * pOpts, tOptDesc * pOD)
{
tOptState opt_st = OPTSTATE_INITIALIZER(PRESET);
- unsigned long st_flags = opt_st.flags;
- tSuccess res;
char const * vopt_str = pOD->optArg.argString;
- if ((pOpts->fOptSet & OPTPROC_VENDOR_OPT) == 0)
- goto illegal;
-
if ((pOD->fOptState & OPTPROC_IMMEDIATE) == 0)
- st_flags = OPTST_DEFINED;
- res = opt_find_long(pOpts, vopt_str, &opt_st);
+ opt_st.flags = OPTST_DEFINED;
- switch (res) {
- case FAILURE:
- case PROBLEM:
- illegal:
+ if ( ((pOpts->fOptSet & OPTPROC_VENDOR_OPT) == 0)
+ || ! SUCCESSFUL(opt_find_long(pOpts, vopt_str, &opt_st))
+ || ! SUCCESSFUL(get_opt_arg(pOpts, &opt_st)) )
+ {
fprintf(stderr, zIllVendOptStr, vopt_str);
(*pOpts->pUsageProc)(pOpts, EXIT_FAILURE);
/* NOTREACHED */
+ }
- case SUCCESS:
- if (! SUCCESSFUL(get_opt_arg(pOpts, &opt_st)))
- goto illegal;
-
+ /*
+ * See if we are in immediate handling state.
+ */
+ if (pOpts->fOptSet & OPTPROC_IMMEDIATE) {
/*
- * See if we are in immediate handling state.
+ * See if the enclosed option is okay with that state.
*/
- if (pOpts->fOptSet & OPTPROC_IMMEDIATE) {
- /*
- * See if the enclosed option is okay with that state.
- */
- if (DO_IMMEDIATELY(opt_st.flags))
- (void)handle_opt(pOpts, &opt_st);
+ if (DO_IMMEDIATELY(opt_st.flags))
+ (void)handle_opt(pOpts, &opt_st);
- } else {
- /*
- * non-immediate direction.
- * See if the enclosed option is okay with that state.
- */
- if (DO_NORMALLY(opt_st.flags) || DO_SECOND_TIME(opt_st.flags))
- (void)handle_opt(pOpts, &opt_st);
- }
+ } else {
+ /*
+ * non-immediate direction.
+ * See if the enclosed option is okay with that state.
+ */
+ if (DO_NORMALLY(opt_st.flags) || DO_SECOND_TIME(opt_st.flags))
+ (void)handle_opt(pOpts, &opt_st);
}
}
&& (pRes->pz_Name != NULL)) {
fprintf(stderr, zDisabledErr, pOpts->pzProgPath, pRes->pz_Name);
if (pRes->pzText != NULL)
- fprintf(stderr, " -- %s", pRes->pzText);
- fputc('\n', stderr);
+ fprintf(stderr, SET_OFF_FMT, pRes->pzText);
+ fputc(NL, stderr);
(*pOpts->pUsageProc)(pOpts, EXIT_FAILURE);
/* NOTREACHED */
_exit(EXIT_FAILURE); /* to be certain */
return opt_find_long(pOpts, pOpts->pzCurOpt, pOptState);
}
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of autoopts/find.c */
*
* DO NOT EDIT THIS FILE (genshell.c)
*
- * It has been AutoGen-ed January 18, 2012 at 05:16:53 AM by AutoGen 5.14
+ * It has been AutoGen-ed February 26, 2012 at 11:08:41 AM by AutoGen 5.15pre14
* From the definitions genshell.def
* and the template file options
*
- * Generated from AutoOpts 36:0:11 templates.
+ * Generated from AutoOpts 36:3:11 templates.
*
* AutoOpts is a copyrighted work. This source file is not encumbered
* by AutoOpts licensing, but is provided under the licensing terms chosen
* The genshellopt program is copyrighted and licensed
* under the following terms:
*
- * Copyright (C) 1999-2011 Bruce Korb, all rights reserved.
+ * Copyright (C) 1999-2012 Bruce Korb, all rights reserved.
* This is free software. It is licensed for use, modification and
* redistribution under the terms of the
* GNU General Public License, version 3 or later
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#define OPTION_CODE_COMPILE 1
+#include "genshell.h"
#include <sys/types.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
-#define OPTION_CODE_COMPILE 1
-#include "genshell.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* genshellopt option static const strings
*/
-static char const genshellopt_opt_strs[1690] =
+static char const genshellopt_opt_strs[1691] =
/* 0 */ "genshellopt 1\n"
- "Copyright (C) 1999-2011 Bruce Korb, all rights reserved.\n"
+ "Copyright (C) 1999-2012 Bruce Korb, all rights reserved.\n"
"This is free software. It is licensed for use, modification and\n"
"redistribution under the terms of the\n"
"GNU General Public License, version 3 or later\n"
" <http://gnu.org/licenses/gpl.html>\n\0"
/* 260 */ "genshellopt is free software: you can redistribute it and/or modify it\n"
- "under the terms of the GNU General Public License as published by the Free\n"
- "Software Foundation, either version 3 of the License, or (at your option)\n"
- "any later version.\n\n"
+ "under the terms of the GNU General Public License as published by the\n"
+ "Free Software Foundation, either version 3 of the License, or (at your\n"
+ "option) any later version.\n\n"
"genshellopt is distributed in the hope that it will be useful, but WITHOUT\n"
"ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n"
- "FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for\n"
- "more details.\n\n"
+ "FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\n"
+ "for more details.\n\n"
"You should have received a copy of the GNU General Public License along\n"
"with this program. If not, see <http://www.gnu.org/licenses/>.\n\0"
/* 871 */ "Output Script File\0"
/* 1235 */ "autogen-users@lists.sourceforge.net\0"
/* 1271 */ "\n"
"Note that ``shell'' is only useful if the output file does not already\n"
- "exist. If it does, then the shell name and optional first argument will be\n"
- "extracted from the script file.\n\0"
+ "exist. If it does, then the shell name and optional first argument will\n"
+ "be extracted from the script file.\n\0"
/* 1452 */ "\n"
"If the script file already exists and contains Automated Option Processing\n"
"text, the second line of the file through the ending tag will be replaced\n"
- "by the newly generated text. The first ``#!'' line will be regenerated.\n\0"
-/* 1676 */ "genshellopt 1";
+ "by the newly generated text. The first ``#!'' line will be regenerated.\n\0"
+/* 1677 */ "genshellopt 1";
/*
* script option description:
#define zBugsAddr (genshellopt_opt_strs+1235)
#define zExplain (genshellopt_opt_strs+1271)
#define zDetail (genshellopt_opt_strs+1452)
-#define zFullVersion (genshellopt_opt_strs+1676)
-/* extracted from optcode.tlib near line 315 */
+#define zFullVersion (genshellopt_opt_strs+1677)
+/* extracted from optcode.tlib near line 349 */
#if defined(ENABLE_NLS)
# define OPTPROC_BASE OPTPROC_TRANSLATE
/*
* Create the static procedure(s) declared above.
*/
+/**
+ * The callout function that invokes the GENSHELL_USAGE() macro.
+ *
+ * @param pOptions the AutoOpts option description structure
+ * @param pOptDesc the descriptor for the "help" (usage) option.
+ */
static void
doUsageOpt(tOptions * pOptions, tOptDesc * pOptDesc)
{
(void)pOptions;
GENSHELL_USAGE(GENSHELLOPT_EXIT_SUCCESS);
}
-/* extracted from optmain.tlib near line 1148 */
+/* extracted from optmain.tlib near line 1093 */
#ifndef PKGDATADIR
# define PKGDATADIR ""
*
* DO NOT EDIT THIS FILE (genshell.h)
*
- * It has been AutoGen-ed January 18, 2012 at 05:16:53 AM by AutoGen 5.14
+ * It has been AutoGen-ed February 26, 2012 at 11:08:41 AM by AutoGen 5.15pre14
* From the definitions genshell.def
* and the template file options
*
- * Generated from AutoOpts 36:0:11 templates.
+ * Generated from AutoOpts 36:3:11 templates.
*
* AutoOpts is a copyrighted work. This header file is not encumbered
* by AutoOpts licensing, but is provided under the licensing terms chosen
* The genshellopt program is copyrighted and licensed
* under the following terms:
*
- * Copyright (C) 1999-2011 Bruce Korb, all rights reserved.
+ * Copyright (C) 1999-2012 Bruce Korb, all rights reserved.
* This is free software. It is licensed for use, modification and
* redistribution under the terms of the
* GNU General Public License, version 3 or later
* tolerable version is at least as old as what was current when the header
* template was released.
*/
-#define AO_TEMPLATE_VERSION 147456
+#define AO_TEMPLATE_VERSION 147459
#if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
|| (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
# error option template version mismatches autoopts/options.h header
#define AUTOOPTS_INTERNAL 1
#include "compat/compat.h"
#define LOCAL static
+#include "ao-strs.h"
#include "autoopts/options.h"
#include "autoopts/usage-txt.h"
#include "genshell.h"
#include "xat-attribute.h"
#include "value-type.h"
+#include "ao-strs.h"
#include "ag-char-map.h"
#include "autoopts.h"
-#include "proto.h"
#include "parse-duration.h"
+#include "proto.h"
#include "parse-duration.c"
+#include "ao-strs.c"
#include "value-type.c"
#include "xat-attribute.c"
#include "autoopts.c"
+#include "alias.c"
#include "boolean.c"
+#include "check.c"
#include "configfile.c"
#include "cook.c"
-#include "check.c"
#include "enum.c"
#include "env.c"
#include "file.c"
#include "stack.c"
#include "streqvcmp.c"
#include "text_mmap.c"
-#include "tokenize.c"
#include "time.c"
+#include "tokenize.c"
#include "usage.c"
#include "version.c"
/**
* \file load.c
- * Time-stamp: "2011-12-17 12:53:04 bkorb"
+ * Time-stamp: "2012-01-29 19:37:15 bkorb"
*
* This file contains the routines that deal with processing text strings
* for options, either from a NUL-terminated string passed in or from an
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (c) 1992-2012 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
add_env_val(char * pzBuf, int bufSize, char const * pzName,
char const * pzProgPath);
-static char*
-assemble_arg_val(char* pzTxt, tOptionLoadMode mode);
+static char *
+assemble_arg_val(char * pzTxt, tOptionLoadMode mode);
/* = = = END-STATIC-FORWARD = = = */
/*=export_func optionMakePath
{
size_t name_len = strlen(pzName);
- if ((bufSize <= name_len) || (name_len == 0))
+ if (((size_t)bufSize <= name_len) || (name_len == 0))
return AG_FALSE;
/*
* Concatenate the file name to the end of the executable path.
* The result may be either a file or a directory.
*/
- if ((pz - pzPath)+1 + strlen(pzName) >= bufSize)
+ if ((pz - pzPath)+1 + strlen(pzName) >= (unsigned)bufSize)
return AG_FALSE;
memcpy(pzBuf, pzPath, (size_t)((pz - pzPath)+1));
if (pzDir == NULL)
return AG_FALSE;
- if (strlen(pzDir) + 1 + strlen(pzName) >= bufSize)
+ if (strlen(pzDir) + 1 + strlen(pzName) >= (unsigned)bufSize)
return AG_FALSE;
sprintf(pzBuf, "%s%s", pzDir, pzName);
}
-static char*
-assemble_arg_val(char* pzTxt, tOptionLoadMode mode)
+static char *
+assemble_arg_val(char * pzTxt, tOptionLoadMode mode)
{
- static char const zBrk[] = " \t\n:=";
- char* pzEnd = strpbrk(pzTxt, zBrk);
+ char* pzEnd = strpbrk(pzTxt, ARG_BREAK_STR);
int space_break;
/*
dnl
dnl DO NOT EDIT THIS FILE (libopts.m4)
dnl
-dnl It has been AutoGen-ed December 29, 2011 at 12:02:31 PM by AutoGen 5.14
+dnl It has been AutoGen-ed February 26, 2012 at 11:08:37 AM by AutoGen 5.15pre14
dnl From the definitions libopts.def
dnl and the template file conftest.tpl
dnl
# ----------------------------------------------------------------------
AC_CHECK_TYPES(wchar_t)
AC_CHECK_TYPES(wint_t, [], [], [
- AC_INCLUDES_DEFAULT
- #if HAVE_RUNETYPE_H
- # include <runetype.h>
- #endif
- #if HAVE_WCHAR_H
- # include <wchar.h>
- #endif
+ AC_INCLUDES_DEFAULT
+ #if HAVE_RUNETYPE_H
+ # include <runetype.h>
+ #endif
+ #if HAVE_WCHAR_H
+ # include <wchar.h>
+ #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])
-
- # =====
- # sizes
- # =====
+ intptr_t, uintptr_t, uint_t, pid_t, size_t])
AC_CHECK_SIZEOF(char*, 8)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(long, 8)
) # end of AC_ARG_WITH libregex
if test "${with_libregex+set}" = set && \
- test "${withval}" = no
+ test "X${withval}" = Xno
then ## disabled by request
libopts_cv_with_libregex_root=no
libopts_cv_with_libregex_cflags=no
AC_ARG_WITH([libregex-cflags],
AS_HELP_STRING([--with-libregex-cflags], [libregex compile flags]),
- [libopts_cv_with_libregex_cflags=${with_regex_cflags}],
+ [libopts_cv_with_libregex_cflags=${with_libregex_cflags}],
AC_CACHE_CHECK([whether with-libregex-cflags was specified], libopts_cv_with_libregex_cflags,
libopts_cv_with_libregex_cflags=no)
) # end of AC_ARG_WITH libregex-cflags
AC_ARG_WITH([libregex-libs],
AS_HELP_STRING([--with-libregex-libs], [libregex link command arguments]),
- [libopts_cv_with_libregex_libs=${with_regex_libs}],
+ [libopts_cv_with_libregex_libs=${with_libregex_libs}],
AC_CACHE_CHECK([whether with-libregex-libs was specified], libopts_cv_with_libregex_libs,
libopts_cv_with_libregex_libs=no)
) # end of AC_ARG_WITH libregex-libs
dnl @synopsis LIBOPTS_CHECK
dnl
-dnl Time-stamp: "2011-12-13 21:26:37 bkorb"
+dnl Time-stamp: "2012-02-25 12:54:32 bkorb"
dnl
dnl If autoopts-config works, add the linking information to LIBS.
dnl Otherwise, add ``libopts-${ao_rev}'' to SUBDIRS and run all
dnl "INVOKE_LIBOPTS_MACROS" macro iff we are building libopts.
dnl
dnl This file is part of AutoGen.
-dnl AutoGen Copyright (c) 1992-2011 by Bruce Korb - all rights reserved
+dnl AutoGen Copyright (c) 1992-2012 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
fi])
AC_ARG_ENABLE([libopts-install],
- AC_HELP_STRING([--disable-libopts-install],
- [Do not install libopts with client installation]))
- AM_CONDITIONAL([INSTALL_LIBOPTS],[test "X${enable_libopts_install}" != Xno])
+ AC_HELP_STRING([--enable-libopts-install],
+ [Install libopts with client installation]))
+ AM_CONDITIONAL([INSTALL_LIBOPTS],[test "X${enable_libopts_install}" = Xyes])
[if test -z "${NEED_LIBOPTS_DIR}" ; then]
AC_MSG_CHECKING([whether autoopts-config can be found])
m4_popdef([AO_Libopts_Dir])
[# end of AC_DEFUN of LIBOPTS_CHECK_COMMON]
])
+dnl
dnl AC_CONFIG_FILES conditionalization requires using AM_COND_IF, however
dnl AM_COND_IF is new to Automake 1.11. To use it on new Automake without
dnl requiring same, a fallback implementation for older Automake is provided.
dnl Note that disabling of AC_CONFIG_FILES requires Automake 1.11, this code
dnl is correct only in terms of m4sh generated script.
-m4_ifndef([AM_COND_IF], [AC_DEFUN([AM_COND_IF], [
-if test -z "$$1_TRUE"; then :
- m4_n([$2])[]dnl
-m4_ifval([$3],
-[else
- $3
-])dnl
-fi[]dnl
-])])
+dnl
+m4_ifndef([AM_COND_IF],
+ [AC_DEFUN([AM_COND_IF], [
+ if test -z "$$1_TRUE"; then :
+ m4_n([$2])[]dnl
+ m4_ifval([$3],[
+ else
+ $3
+ ])dnl
+ fi[]dnl
+ ])dnl
+])
dnl
AC_DEFUN([LIBOPTS_CHECK_NOBUILD], [
m4_pushdef([AO_Libopts_Dir],
# liboptschk.m4 serial 2 (autogen - 5.11.4)
-dnl Copyright (c) 2005-2011 by Bruce Korb - all rights reserved
+dnl Copyright (c) 2005-2012 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,
/**
* \file makeshell.c
*
- * Time-stamp: "2011-04-20 11:06:57 bkorb"
+ * Time-stamp: "2012-01-29 19:01:07 bkorb"
*
* This module will interpret the options set in the tOptions
* structure and create a Bourne shell script capable of parsing them.
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (c) 1992-2012 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
tOptions * optionParseShellOptions = NULL;
-/* * * * * * * * * * * * * * * * * * * * *
- *
- * Setup Format Strings
- */
-static char const zStartMarker[] =
-"# # # # # # # # # # -- do not modify this marker --\n#\n"
-"# DO NOT EDIT THIS SECTION";
-
-static char const zPreamble[] =
-"%s OF %s\n#\n"
-"# From here to the next `-- do not modify this marker --',\n"
-"# the text has been generated %s\n";
-
-static char const zEndPreamble[] =
-"# From the %s option definitions\n#\n";
-
-static char const zMultiDef[] = "\n"
-"if test -z \"${%1$s_%2$s}\"\n"
-"then\n"
-" %1$s_%2$s_CT=0\n"
-"else\n"
-" %1$s_%2$s_CT=1\n"
-" %1$s_%2$s_1=\"${%1$s_%2$s}\"\n"
-"fi\n"
-"export %1$s_%2$s_CT";
-
-static char const zSingleDef[] = "\n"
-"%1$s_%2$s=\"${%1$s_%2$s-'%3$s'}\"\n"
-"%1$s_%2$s_set=false\n"
-"export %1$s_%2$s\n";
-
-static char const zSingleNoDef[] = "\n"
-"%1$s_%2$s=\"${%1$s_%2$s}\"\n"
-"%1$s_%2$s_set=false\n"
-"export %1$s_%2$s\n";
-
-/* * * * * * * * * * * * * * * * * * * * *
- *
- * LOOP START
- *
- * The loop may run in either of two modes:
- * all options are named options (loop only)
- * regular, marked option processing.
- */
-static char const zLoopCase[] = "\n"
-"OPT_PROCESS=true\n"
-"OPT_ARG=\"$1\"\n\n"
-"while ${OPT_PROCESS} && [ $# -gt 0 ]\ndo\n"
-" OPT_ELEMENT=''\n"
-" OPT_ARG_VAL=''\n\n"
- /*
- * 'OPT_ARG' may or may not match the current $1
- */
-" case \"${OPT_ARG}\" in\n"
-" -- )\n"
-" OPT_PROCESS=false\n"
-" shift\n"
-" ;;\n\n";
-
-static char const zLoopOnly[] = "\n"
-"OPT_ARG=\"$1\"\n\n"
-"while [ $# -gt 0 ]\ndo\n"
-" OPT_ELEMENT=''\n"
-" OPT_ARG_VAL=''\n\n"
-" OPT_ARG=\"${1}\"\n";
-
-/* * * * * * * * * * * * * * * *
- *
- * CASE SELECTORS
- *
- * If the loop runs as a regular option loop,
- * then we must have selectors for each acceptable option
- * type (long option, flag character and non-option)
- */
-static char const zLongSelection[] =
-" --* )\n";
-
-static char const zFlagSelection[] =
-" -* )\n";
-
-static char const zEndSelection[] =
-" ;;\n\n";
-
-static char const zNoSelection[] =
-" * )\n"
-" OPT_PROCESS=false\n"
-" ;;\n"
-" esac\n\n";
-
-/* * * * * * * * * * * * * * * *
- *
- * LOOP END
- */
-static char const zLoopEnd[] =
-" if [ -n \"${OPT_ARG_VAL}\" ]\n"
-" then\n"
-" eval %1$s_${OPT_NAME}${OPT_ELEMENT}=\"'${OPT_ARG_VAL}'\"\n"
-" export %1$s_${OPT_NAME}${OPT_ELEMENT}\n"
-" fi\n"
-"done\n\n"
-"unset OPT_PROCESS || :\n"
-"unset OPT_ELEMENT || :\n"
-"unset OPT_ARG || :\n"
-"unset OPT_ARG_NEEDED || :\n"
-"unset OPT_NAME || :\n"
-"unset OPT_CODE || :\n"
-"unset OPT_ARG_VAL || :\n%2$s";
-
-static char const zTrailerMarker[] = "\n"
-"# # # # # # # # # #\n#\n"
-"# END OF AUTOMATED OPTION PROCESSING\n"
-"#\n# # # # # # # # # # -- do not modify this marker --\n";
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- *
- * OPTION SELECTION
- */
-static char const zOptionCase[] =
-" case \"${OPT_CODE}\" in\n";
-
-static char const zOptionPartName[] =
-" '%s' | \\\n";
-
-static char const zOptionFullName[] =
-" '%s' )\n";
-
-static char const zOptionFlag[] =
-" '%c' )\n";
-
-static char const zOptionEndSelect[] =
-" ;;\n\n";
-
-static char const zOptionUnknown[] =
-" * )\n"
-" echo Unknown %s: \"${OPT_CODE}\" >&2\n"
-" echo \"$%s_USAGE_TEXT\"\n"
-" exit 1\n"
-" ;;\n"
-" esac\n\n";
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- *
- * OPTION PROCESSING
- *
- * Formats for emitting the text for handling particular options
- */
-static char const zTextExit[] =
-" echo \"$%s_%s_TEXT\"\n"
-" exit 0\n";
-
-static char const zPagedUsageExit[] =
-" echo \"$%s_LONGUSAGE_TEXT\" | ${PAGER-more}\n"
-" exit 0\n";
-
-static char const zCmdFmt[] =
-" %s\n";
-
-static char const zCountTest[] =
-" if [ $%1$s_%2$s_CT -ge %3$d ] ; then\n"
-" echo Error: more than %3$d %2$s options >&2\n"
-" echo \"$%1$s_USAGE_TEXT\"\n"
-" exit 1 ; fi\n";
-
-static char const zMultiArg[] =
-" %1$s_%2$s_CT=`expr ${%1$s_%2$s_CT} + 1`\n"
-" OPT_ELEMENT=\"_${%1$s_%2$s_CT}\"\n"
-" OPT_NAME='%2$s'\n";
-
-static char const zSingleArg[] =
-" if [ -n \"${%1$s_%2$s}\" ] && ${%1$s_%2$s_set} ; then\n"
-" echo Error: duplicate %2$s option >&2\n"
-" echo \"$%1$s_USAGE_TEXT\"\n"
-" exit 1 ; fi\n"
-" %1$s_%2$s_set=true\n"
-" OPT_NAME='%2$s'\n";
-
-static char const zNoMultiArg[] =
-" %1$s_%2$s_CT=0\n"
-" OPT_ELEMENT=''\n"
-" %1$s_%2$s='%3$s'\n"
-" export %1$s_%2$s\n"
-" OPT_NAME='%2$s'\n";
-
-static char const zNoSingleArg[] =
-" if [ -n \"${%1$s_%2$s}\" ] && ${%1$s_%2$s_set} ; then\n"
-" echo Error: duplicate %2$s option >&2\n"
-" echo \"$%1$s_USAGE_TEXT\"\n"
-" exit 1 ; fi\n"
-" %1$s_%2$s_set=true\n"
-" %1$s_%2$s='%3$s'\n"
-" export %1$s_%2$s\n"
-" OPT_NAME='%2$s'\n";
-
-static char const zMayArg[] =
-" eval %1$s_%2$s${OPT_ELEMENT}=true\n"
-" export %1$s_%2$s${OPT_ELEMENT}\n"
-" OPT_ARG_NEEDED=OK\n";
-
-static char const zMustArg[] =
-" OPT_ARG_NEEDED=YES\n";
-
-static char const zCantArg[] =
-" eval %1$s_%2$s${OPT_ELEMENT}=true\n"
-" export %1$s_%2$s${OPT_ELEMENT}\n"
-" OPT_ARG_NEEDED=NO\n";
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- *
- * LONG OPTION PROCESSING
- *
- * Formats for emitting the text for handling long option types
- */
-static char const zLongOptInit[] =
-" OPT_CODE=`echo \"X${OPT_ARG}\"|sed 's/^X-*//'`\n"
-" shift\n"
-" OPT_ARG=\"$1\"\n\n"
-" case \"${OPT_CODE}\" in *=* )\n"
-" OPT_ARG_VAL=`echo \"${OPT_CODE}\"|sed 's/^[^=]*=//'`\n"
-" OPT_CODE=`echo \"${OPT_CODE}\"|sed 's/=.*$//'` ;; esac\n\n";
-
-static char const zLongOptArg[] =
-" case \"${OPT_ARG_NEEDED}\" in\n"
-" NO )\n"
-" OPT_ARG_VAL=''\n"
-" ;;\n\n"
-" YES )\n"
-" if [ -z \"${OPT_ARG_VAL}\" ]\n"
-" then\n"
-" if [ $# -eq 0 ]\n"
-" then\n"
-" echo No argument provided for ${OPT_NAME} option >&2\n"
-" echo \"$%s_USAGE_TEXT\"\n"
-" exit 1\n"
-" fi\n\n"
-" OPT_ARG_VAL=\"${OPT_ARG}\"\n"
-" shift\n"
-" OPT_ARG=\"$1\"\n"
-" fi\n"
-" ;;\n\n"
-" OK )\n"
-" if [ -z \"${OPT_ARG_VAL}\" ] && [ $# -gt 0 ]\n"
-" then\n"
-" case \"${OPT_ARG}\" in -* ) ;; * )\n"
-" OPT_ARG_VAL=\"${OPT_ARG}\"\n"
-" shift\n"
-" OPT_ARG=\"$1\" ;; esac\n"
-" fi\n"
-" ;;\n"
-" esac\n";
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- *
- * FLAG OPTION PROCESSING
- *
- * Formats for emitting the text for handling flag option types
- */
-static char const zFlagOptInit[] =
-" OPT_CODE=`echo \"X${OPT_ARG}\" | sed 's/X-\\(.\\).*/\\1/'`\n"
-" OPT_ARG=` echo \"X${OPT_ARG}\" | sed 's/X-.//'`\n\n";
-
-static char const zFlagOptArg[] =
-" case \"${OPT_ARG_NEEDED}\" in\n"
-" NO )\n"
-" if [ -n \"${OPT_ARG}\" ]\n"
-" then\n"
-" OPT_ARG=-\"${OPT_ARG}\"\n"
-" else\n"
-" shift\n"
-" OPT_ARG=\"$1\"\n"
-" fi\n"
-" ;;\n\n"
-" YES )\n"
-" if [ -n \"${OPT_ARG}\" ]\n"
-" then\n"
-" OPT_ARG_VAL=\"${OPT_ARG}\"\n\n"
-" else\n"
-" if [ $# -eq 0 ]\n"
-" then\n"
-" echo No argument provided for ${OPT_NAME} option >&2\n"
-" echo \"$%s_USAGE_TEXT\"\n"
-" exit 1\n"
-" fi\n"
-" shift\n"
-" OPT_ARG_VAL=\"$1\"\n"
-" fi\n\n"
-" shift\n"
-" OPT_ARG=\"$1\"\n"
-" ;;\n\n"
-" OK )\n"
-" if [ -n \"${OPT_ARG}\" ]\n"
-" then\n"
-" OPT_ARG_VAL=\"${OPT_ARG}\"\n"
-" shift\n"
-" OPT_ARG=\"$1\"\n\n"
-" else\n"
-" shift\n"
-" if [ $# -gt 0 ]\n"
-" then\n"
-" case \"$1\" in -* ) ;; * )\n"
-" OPT_ARG_VAL=\"$1\"\n"
-" shift ;; esac\n"
-" OPT_ARG=\"$1\"\n"
-" fi\n"
-" fi\n"
-" ;;\n"
-" esac\n";
-
-tSCC* pzShell = NULL;
-static char* pzLeader = NULL;
-static char* pzTrailer = NULL;
+static char const * shell_prog = NULL;
+static char * script_leader = NULL;
+static char * script_trailer = NULL;
/* = = = START-STATIC-FORWARD = = = */
static void
emit_var_text(char const * prog, char const * var, int fdin);
static void
-textToVariable(tOptions * pOpts, teTextTo whichVar, tOptDesc * pOD);
+text_to_var(tOptions * pOpts, teTextTo whichVar, tOptDesc * pOD);
static void
-emitUsage(tOptions* pOpts);
+emit_usage(tOptions * pOpts);
static void
-emitSetup(tOptions* pOpts);
+emit_setup(tOptions * pOpts);
static void
-printOptionAction(tOptions* pOpts, tOptDesc* pOptDesc);
+emit_action(tOptions * pOpts, tOptDesc* pOptDesc);
static void
-printOptionInaction(tOptions* pOpts, tOptDesc* pOptDesc);
+emit_inaction(tOptions * pOpts, tOptDesc* pOptDesc);
static void
-emitFlag(tOptions* pOpts);
+emit_flag(tOptions * pOpts);
static void
-emitMatchExpr(tCC* pzMatchName, tOptDesc* pCurOpt, tOptions* pOpts);
+emit_match_expr(char const * pzMatchName, tOptDesc* pCurOpt, tOptions* pOpts);
static void
-emitLong(tOptions* pOpts);
+emitLong(tOptions * pOpts);
static void
-openOutput(char const* pzFile);
+open_out(char const * pzFile);
/* = = = END-STATIC-FORWARD = = = */
/*=export_func optionParseShell
* Emit a shell script that will parse the command line options.
=*/
void
-optionParseShell(tOptions* pOpts)
+optionParseShell(tOptions * pOpts)
{
/*
* Check for our SHELL option now.
* it will override anything we do here.
*/
if (HAVE_GENSHELL_OPT(SHELL))
- pzShell = GENSHELL_OPT_ARG(SHELL);
+ shell_prog = GENSHELL_OPT_ARG(SHELL);
else if (! ENABLED_GENSHELL_OPT(SHELL))
- pzShell = NULL;
+ shell_prog = NULL;
- else if ((pzShell = getenv("SHELL")),
- pzShell == NULL)
+ else if ((shell_prog = getenv("SHELL")),
+ shell_prog == NULL)
- pzShell = POSIX_SHELL;
+ shell_prog = POSIX_SHELL;
/*
* Check for a specified output file
*/
if (HAVE_GENSHELL_OPT(SCRIPT))
- openOutput(GENSHELL_OPT_ARG(SCRIPT));
+ open_out(GENSHELL_OPT_ARG(SCRIPT));
- emitUsage(pOpts);
- emitSetup(pOpts);
+ emit_usage(pOpts);
+ emit_setup(pOpts);
/*
* There are four modes of option processing.
*/
switch (pOpts->fOptSet & (OPTPROC_LONGOPT|OPTPROC_SHORTOPT)) {
case OPTPROC_LONGOPT:
- fputs(zLoopCase, stdout);
+ fputs(LOOP_STR, stdout);
- fputs(zLongSelection, stdout);
- fputs(zLongOptInit, stdout);
+ fputs(LONG_OPT_MARK, stdout);
+ fputs(INIT_LOPT_STR, stdout);
emitLong(pOpts);
- printf(zLongOptArg, pOpts->pzPROGNAME);
- fputs(zEndSelection, stdout);
+ printf(LOPT_ARG_FMT, pOpts->pzPROGNAME);
+ fputs(END_OPT_SEL_STR, stdout);
- fputs(zNoSelection, stdout);
+ fputs(NOT_FOUND_STR, stdout);
break;
case 0:
- fputs(zLoopOnly, stdout);
- fputs(zLongOptInit, stdout);
+ fputs(ONLY_OPTS_LOOP, stdout);
+ fputs(INIT_LOPT_STR, stdout);
emitLong(pOpts);
- printf(zLongOptArg, pOpts->pzPROGNAME);
+ printf(LOPT_ARG_FMT, pOpts->pzPROGNAME);
break;
case OPTPROC_SHORTOPT:
- fputs(zLoopCase, stdout);
+ fputs(LOOP_STR, stdout);
- fputs(zFlagSelection, stdout);
- fputs(zFlagOptInit, stdout);
- emitFlag(pOpts);
- printf(zFlagOptArg, pOpts->pzPROGNAME);
- fputs(zEndSelection, stdout);
+ fputs(FLAG_OPT_MARK, stdout);
+ fputs(INIT_OPT_STR, stdout);
+ emit_flag(pOpts);
+ printf(OPT_ARG_FMT, pOpts->pzPROGNAME);
+ fputs(END_OPT_SEL_STR, stdout);
- fputs(zNoSelection, stdout);
+ fputs(NOT_FOUND_STR, stdout);
break;
case OPTPROC_LONGOPT|OPTPROC_SHORTOPT:
- fputs(zLoopCase, stdout);
+ fputs(LOOP_STR, stdout);
- fputs(zLongSelection, stdout);
- fputs(zLongOptInit, stdout);
+ fputs(LONG_OPT_MARK, stdout);
+ fputs(INIT_LOPT_STR, stdout);
emitLong(pOpts);
- printf(zLongOptArg, pOpts->pzPROGNAME);
- fputs(zEndSelection, stdout);
+ printf(LOPT_ARG_FMT, pOpts->pzPROGNAME);
+ fputs(END_OPT_SEL_STR, stdout);
- fputs(zFlagSelection, stdout);
- fputs(zFlagOptInit, stdout);
- emitFlag(pOpts);
- printf(zFlagOptArg, pOpts->pzPROGNAME);
- fputs(zEndSelection, stdout);
+ fputs(FLAG_OPT_MARK, stdout);
+ fputs(INIT_OPT_STR, stdout);
+ emit_flag(pOpts);
+ printf(OPT_ARG_FMT, pOpts->pzPROGNAME);
+ fputs(END_OPT_SEL_STR, stdout);
- fputs(zNoSelection, stdout);
+ fputs(NOT_FOUND_STR, stdout);
break;
}
- printf(zLoopEnd, pOpts->pzPROGNAME, zTrailerMarker);
- if ((pzTrailer != NULL) && (*pzTrailer != '\0'))
- fputs(pzTrailer, stdout);
+ printf(zLoopEnd, pOpts->pzPROGNAME, END_MARK);
+ if ((script_trailer != NULL) && (*script_trailer != NUL))
+ fputs(script_trailer, stdout);
else if (ENABLED_GENSHELL_OPT(SHELL))
- printf("\nenv | grep '^%s_'\n", pOpts->pzPROGNAME);
+ printf(SHOW_PROG_ENV, pOpts->pzPROGNAME);
fflush(stdout);
fchmod(STDOUT_FILENO, 0755);
FILE * fp = fdopen(fdin, "r" FOPEN_BINARY_FLAG);
int nlct = 0; /* defer newlines and skip trailing ones */
- printf("%s_%s_TEXT='", prog, var);
+ printf(SET_TEXT_FMT, prog, var);
if (fp == NULL)
goto skip_text;
int ch = fgetc(fp);
switch (ch) {
- case '\n':
+ case NL:
nlct++;
break;
case '\'':
while (nlct > 0) {
- fputc('\n', stdout);
+ fputc(NL, stdout);
nlct--;
}
- fputs("'\\''", stdout);
+ fputs(apostrophy, stdout);
break;
case EOF:
default:
while (nlct > 0) {
- fputc('\n', stdout);
+ fputc(NL, stdout);
nlct--;
}
fputc(ch, stdout);
skip_text:
- fputs("'\n\n", stdout);
+ fputs(END_SET_TEXT, stdout);
}
#endif
* capture the output in the parent process.
*/
static void
-textToVariable(tOptions * pOpts, teTextTo whichVar, tOptDesc * pOD)
+text_to_var(tOptions * pOpts, teTextTo whichVar, tOptDesc * pOD)
{
# define _TT_(n) static char const z ## n [] = #n;
TEXTTO_TABLE
# undef _TT_
#if ! defined(HAVE_WORKING_FORK)
- printf("%1$s_%2$s_TEXT='no %2$s text'\n",
- pOpts->pzPROGNAME, apzTTNames[ whichVar ]);
+ printf(SET_NO_TEXT_FMT, pOpts->pzPROGNAME, apzTTNames[ whichVar]);
#else
int pipeFd[2];
static void
-emitUsage(tOptions* pOpts)
+emit_usage(tOptions * pOpts)
{
char zTimeBuf[AO_NAME_SIZE];
* by the definitions (rather than the current
* executable name). Down case the upper cased name.
*/
- if (pzLeader != NULL)
- fputs(pzLeader, stdout);
+ if (script_leader != NULL)
+ fputs(script_leader, stdout);
{
- tSCC zStdout[] = "stdout";
- tCC* pzOutName;
+ char const * out_nm;
{
- time_t curTime = time(NULL);
- struct tm* pTime = localtime(&curTime);
- strftime(zTimeBuf, AO_NAME_SIZE, "%A %B %e, %Y at %r %Z", pTime );
+ time_t c_tim = time(NULL);
+ struct tm * ptm = localtime(&c_tim);
+ strftime(zTimeBuf, AO_NAME_SIZE, TIME_FMT, ptm );
}
if (HAVE_GENSHELL_OPT(SCRIPT))
- pzOutName = GENSHELL_OPT_ARG(SCRIPT);
- else pzOutName = zStdout;
+ out_nm = GENSHELL_OPT_ARG(SCRIPT);
+ else out_nm = STDOUT;
- if ((pzLeader == NULL) && (pzShell != NULL))
- printf("#! %s\n", pzShell);
+ if ((script_leader == NULL) && (shell_prog != NULL))
+ printf(SHELL_MAGIC, shell_prog);
- printf(zPreamble, zStartMarker, pzOutName, zTimeBuf);
+ printf(PREAMBLE_FMT, START_MARK, out_nm, zTimeBuf);
}
- printf(zEndPreamble, pOpts->pzPROGNAME);
+ printf(END_PRE_FMT, pOpts->pzPROGNAME);
/*
* Get a copy of the original program name in lower case and
char ** pp;
for (;;) {
- if ((*pzPN++ = tolower(*pz++)) == '\0')
+ if ((*pzPN++ = (char)tolower(*pz++)) == NUL)
break;
}
*pp = zTimeBuf;
}
- textToVariable(pOpts, TT_LONGUSAGE, NULL);
- textToVariable(pOpts, TT_USAGE, NULL);
+ text_to_var(pOpts, TT_LONGUSAGE, NULL);
+ text_to_var(pOpts, TT_USAGE, NULL);
{
tOptDesc* pOptDesc = pOpts->pOptDesc;
for (;;) {
if (pOptDesc->pOptProc == optionPrintVersion) {
- textToVariable(pOpts, TT_VERSION, pOptDesc);
+ text_to_var(pOpts, TT_VERSION, pOptDesc);
break;
}
static void
-emitSetup(tOptions* pOpts)
+emit_setup(tOptions * pOpts)
{
- tOptDesc* pOptDesc = pOpts->pOptDesc;
- int optionCt = pOpts->presetOptCt;
- char const* pzFmt;
- char const* pzDefault;
+ tOptDesc * pOptDesc = pOpts->pOptDesc;
+ int optionCt = pOpts->presetOptCt;
+ char const * pzFmt;
+ char const * pzDefault;
for (;optionCt > 0; pOptDesc++, --optionCt) {
- char zVal[16];
+ char zVal[32];
/*
* Options that are either usage documentation or are compiled out
continue;
if (pOptDesc->optMaxCt > 1)
- pzFmt = zMultiDef;
- else pzFmt = zSingleDef;
+ pzFmt = MULTI_DEF_FMT;
+ else pzFmt = SGL_DEF_FMT;
/*
* IF this is an enumeration/bitmask option, then convert the value
break;
case OPARG_TYPE_BOOLEAN:
- pzDefault = (pOptDesc->optArg.argBool) ? "true" : "false";
+ pzDefault = (pOptDesc->optArg.argBool) ? TRUE_STR : FALSE_STR;
break;
default:
if (pOptDesc->optArg.argString == NULL) {
- if (pzFmt == zSingleDef)
- pzFmt = zSingleNoDef;
+ if (pzFmt == SGL_DEF_FMT)
+ pzFmt = SGL_NO_DEF_FMT;
pzDefault = NULL;
}
else
}
}
-
static void
-printOptionAction(tOptions* pOpts, tOptDesc* pOptDesc)
+emit_action(tOptions * pOpts, tOptDesc* pOptDesc)
{
if (pOptDesc->pOptProc == optionPrintVersion)
- printf(zTextExit, pOpts->pzPROGNAME, "VERSION");
+ printf(zTextExit, pOpts->pzPROGNAME, VER_STR);
else if (pOptDesc->pOptProc == optionPagedUsage)
printf(zPagedUsageExit, pOpts->pzPROGNAME);
else if (pOptDesc->pOptProc == optionLoadOpt) {
- printf(zCmdFmt, "echo 'Warning: Cannot load options files' >&2");
- printf(zCmdFmt, "OPT_ARG_NEEDED=YES");
+ printf(zCmdFmt, NO_LOAD_WARN);
+ printf(zCmdFmt, YES_NEED_OPT_ARG);
} else if (pOptDesc->pz_NAME == NULL) {
if (pOptDesc->pOptProc == NULL) {
- printf(zCmdFmt, "echo 'Warning: Cannot save options files' "
- ">&2");
- printf(zCmdFmt, "OPT_ARG_NEEDED=OK");
+ printf(zCmdFmt, NO_SAVE_OPTS);
+ printf(zCmdFmt, OK_NEED_OPT_ARG);
} else
- printf(zTextExit, pOpts->pzPROGNAME, "LONGUSAGE");
+ printf(zTextExit, pOpts->pzPROGNAME, LONG_USE_STR);
} else {
if (pOptDesc->optMaxCt == 1)
- printf(zSingleArg, pOpts->pzPROGNAME, pOptDesc->pz_NAME);
+ printf(SGL_ARG_FMT, pOpts->pzPROGNAME, pOptDesc->pz_NAME);
else {
if ((unsigned)pOptDesc->optMaxCt < NOLIMIT)
printf(zCountTest, pOpts->pzPROGNAME,
pOptDesc->pz_NAME, pOptDesc->optMaxCt);
- printf(zMultiArg, pOpts->pzPROGNAME, pOptDesc->pz_NAME);
+ printf(MULTI_ARG_FMT, pOpts->pzPROGNAME, pOptDesc->pz_NAME);
}
/*
static void
-printOptionInaction(tOptions* pOpts, tOptDesc* pOptDesc)
+emit_inaction(tOptions * pOpts, tOptDesc* pOptDesc)
{
if (pOptDesc->pOptProc == optionLoadOpt) {
- printf(zCmdFmt, "echo 'Warning: Cannot suppress the loading of "
- "options files' >&2");
+ printf(zCmdFmt, NO_SUPPRESS_LOAD);
} else if (pOptDesc->optMaxCt == 1)
- printf(zNoSingleArg, pOpts->pzPROGNAME,
+ printf(NO_SGL_ARG_FMT, pOpts->pzPROGNAME,
pOptDesc->pz_NAME, pOptDesc->pz_DisablePfx);
else
- printf(zNoMultiArg, pOpts->pzPROGNAME,
+ printf(NO_MULTI_ARG_FMT, pOpts->pzPROGNAME,
pOptDesc->pz_NAME, pOptDesc->pz_DisablePfx);
- printf(zCmdFmt, "OPT_ARG_NEEDED=NO");
+ printf(zCmdFmt, NO_ARG_NEEDED);
fputs(zOptionEndSelect, stdout);
}
static void
-emitFlag(tOptions* pOpts)
+emit_flag(tOptions * pOpts)
{
tOptDesc* pOptDesc = pOpts->pOptDesc;
int optionCt = pOpts->optCt;
if (IS_GRAPHIC_CHAR(pOptDesc->optValue)) {
printf(zOptionFlag, pOptDesc->optValue);
- printOptionAction(pOpts, pOptDesc);
+ emit_action(pOpts, pOptDesc);
}
}
- printf(zOptionUnknown, "flag", pOpts->pzPROGNAME);
+ printf(UNK_OPT_FMT, FLAG_STR, pOpts->pzPROGNAME);
}
* Emit the match text for a long option
*/
static void
-emitMatchExpr(tCC* pzMatchName, tOptDesc* pCurOpt, tOptions* pOpts)
+emit_match_expr(char const * pzMatchName, tOptDesc* pCurOpt, tOptions* pOpts)
{
tOptDesc* pOD = pOpts->pOptDesc;
int oCt = pOpts->optCt;
* Emit GNU-standard long option handling code
*/
static void
-emitLong(tOptions* pOpts)
+emitLong(tOptions * pOpts)
{
tOptDesc* pOD = pOpts->pOptDesc;
int ct = pOpts->optCt;
if (SKIP_OPT(pOD))
continue;
- emitMatchExpr(pOD->pz_Name, pOD, pOpts);
- printOptionAction(pOpts, pOD);
+ emit_match_expr(pOD->pz_Name, pOD, pOpts);
+ emit_action(pOpts, pOD);
/*
* Now, do the same thing for the disablement version of the option.
*/
if (pOD->pz_DisableName != NULL) {
- emitMatchExpr(pOD->pz_DisableName, pOD, pOpts);
- printOptionInaction(pOpts, pOD);
+ emit_match_expr(pOD->pz_DisableName, pOD, pOpts);
+ emit_inaction(pOpts, pOD);
}
} while (pOD++, --ct > 0);
- printf(zOptionUnknown, "option", pOpts->pzPROGNAME);
+ printf(UNK_OPT_FMT, OPTION_STR, pOpts->pzPROGNAME);
}
static void
-openOutput(char const* pzFile)
+open_out(char const * pzFile)
{
FILE* fp;
char* pzData = NULL;
exit(EXIT_FAILURE);
}
- pzData = AGALOC(stbf.st_size + 1, "file data");
+ pzData = AGALOC(stbf.st_size + 1, "f data");
fp = fopen(pzFile, "r" FOPEN_BINARY_FLAG);
sizeLeft = (unsigned)stbf.st_size;
/*
* NUL-terminate the leader and look for the trailer
*/
- *pzScan = '\0';
+ *pzScan = NUL;
fclose(fp);
- pzScan = strstr(pzData, zStartMarker);
+ pzScan = strstr(pzData, START_MARK);
if (pzScan == NULL) {
- pzTrailer = pzData;
+ script_trailer = pzData;
break;
}
*(pzScan++) = NUL;
- pzScan = strstr(pzScan, zTrailerMarker);
+ pzScan = strstr(pzScan, END_MARK);
if (pzScan == NULL) {
- pzTrailer = pzData;
+ script_trailer = pzData;
break;
}
* Check to see if the data contains our marker.
* If it does, then we will skip over it
*/
- pzTrailer = pzScan + sizeof(zTrailerMarker) - 1;
- pzLeader = pzData;
+ script_trailer = pzScan + END_MARK_LEN;
+ script_leader = pzData;
} while (AG_FALSE);
if (freopen(pzFile, "w" FOPEN_BINARY_FLAG, stdout) != stdout) {
{
char * pz;
char ** pp = (char **)(void *)&(optionParseShellOptions->pzProgName);
- AGDUPSTR(pz, optionParseShellOptions->pzPROGNAME, "program name");
+ AGDUPSTR(pz, optionParseShellOptions->pzPROGNAME, "prog name");
*pp = pz;
while (*pz != NUL) {
*pz = tolower(*pz);
/**
* \file nested.c
*
- * Time-stamp: "2010-08-22 11:17:56 bkorb"
+ * Time-stamp: "2012-01-29 07:00:04 bkorb"
*
* Automated Options Nested Values module.
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (c) 1992-2012 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
{ '\'',5, "apos;" }
};
+#ifndef ENOMSG
+#define ENOMSG ENOENT
+#endif
+
/* = = = START-STATIC-FORWARD = = = */
static void
remove_continuation(char* pzSrc);
static char const*
scan_q_str(char const* pzTxt);
-static tOptionValue*
-add_string(void** pp, char const* pzName, size_t nameLen,
- char const* pzValue, size_t dataLen);
+static tOptionValue *
+add_string(void ** pp, char const * pzName, size_t nameLen,
+ char const* pzValue, size_t dataLen);
-static tOptionValue*
-add_bool(void** pp, char const* pzName, size_t nameLen,
+static tOptionValue *
+add_bool(void ** pp, char const * pzName, size_t nameLen,
char const* pzValue, size_t dataLen);
static tOptionValue*
char* pzD;
do {
- while (*pzSrc == '\n') pzSrc++;
- pzD = strchr(pzSrc, '\n');
+ while (*pzSrc == NL) pzSrc++;
+ pzD = strchr(pzSrc, NL);
if (pzD == NULL)
return;
switch (ch) {
case NUL: return;
case '\\':
- if (*pzSrc == '\n')
+ if (*pzSrc == NL)
--pzD; /* rewrite on next iteration */
}
}
/**
* Associate a name with either a string or no value.
*/
-static tOptionValue*
-add_string(void** pp, char const* pzName, size_t nameLen,
- char const* pzValue, size_t dataLen)
+static tOptionValue *
+add_string(void ** pp, char const * pzName, size_t nameLen,
+ char const* pzValue, size_t dataLen)
{
tOptionValue* pNV;
size_t sz = nameLen + dataLen + sizeof(*pNV);
if (ch == NUL) goto data_copy_done;
if (ch == '&')
ch = get_special_char(&pzSrc, &ct);
- *(pzDst++) = ch;
+ *(pzDst++) = (char)ch;
} while (--ct > 0);
data_copy_done:
*pzDst = NUL;
/**
* Associate a name with either a string or no value.
*/
-static tOptionValue*
-add_bool(void** pp, char const* pzName, size_t nameLen,
+static tOptionValue *
+add_bool(void ** pp, char const * pzName, size_t nameLen,
char const* pzValue, size_t dataLen)
{
- tOptionValue* pNV;
- size_t sz = nameLen + sizeof(*pNV) + 1;
+ tOptionValue * pNV;
- pNV = AGALOC(sz, "option name/bool value pair");
- if (pNV == NULL)
- return NULL;
- while (IS_WHITESPACE_CHAR(*pzValue) && (dataLen > 0)) {
- dataLen--; pzValue++;
+ {
+ size_t sz = nameLen + sizeof(tOptionValue) + 1;
+ pNV = AGALOC(sz, "name/bool value");
}
+
+ {
+ char * p = SPN_WHITESPACE_CHARS(pzValue);
+ dataLen -= p - pzValue;
+ pzValue = p;
+ }
+
if (dataLen == 0)
pNV->v.boolVal = 0;
* Scan over characters that name a value. These names may not end
* with a colon, but they may contain colons.
*/
- while (IS_VALUE_NAME_CHAR(*pzScan)) { pzScan++; nameLen++; }
- if (pzScan[-1] == ':') { pzScan--; nameLen--; }
- while (IS_HORIZ_WHITE_CHAR(*pzScan)) pzScan++;
+ pzScan = SPN_VALUE_NAME_CHARS(pzName + 1);
+ if (pzScan[-1] == ':')
+ pzScan--;
+ nameLen = pzScan - pzName;
+
+ pzScan = SPN_HORIZ_WHITE_CHARS(pzScan);
re_switch:
switch (*pzScan) {
case '=':
case ':':
- while (IS_HORIZ_WHITE_CHAR((int)*++pzScan)) ;
+ pzScan = SPN_HORIZ_WHITE_CHARS(pzScan + 1);
if ((*pzScan == '=') || (*pzScan == ':'))
goto default_char;
goto re_switch;
- case '\n':
+ case NL:
case ',':
pzScan++;
/* FALLTHROUGH */
pzScan = scan_q_str(pzScan);
dataLen = pzScan - pzVal;
pNV = add_string(&(pRes->v.nestVal), pzName, nameLen, pzVal,
- dataLen);
+ dataLen);
if ((pNV != NULL) && (option_load_mode == OPTION_LOAD_COOKED))
ao_string_cook(pNV->v.strVal, NULL);
break;
goto string_done;
/* FALLTHROUGH */
- case '\n':
+ case NL:
if ( (pzScan > pzVal + 2)
&& (pzScan[-2] == '\\')
&& (pzScan[ 0] != NUL))
}
}
-/* optionLoadNested
+/*=
* private:
*
* what: parse a hierarchical option argument
* A block of text represents a series of values. It may be an
* entire configuration file, or it may be an argument to an
* option that takes a hierarchical value.
- */
+ *
+ * If NULL is returned, errno will be set:
+ * @itemize @bullet
+ * @item
+ * @code{EINVAL} the input text was NULL.
+ * @item
+ * @code{ENOMEM} the storage structures could not be allocated
+ * @item
+ * @code{ENOMSG} no configuration values were found
+ * @end itemize
+=*/
LOCAL tOptionValue*
optionLoadNested(char const* pzTxt, char const* pzName, size_t nameLen)
{
errno = EINVAL;
return NULL;
}
- while (IS_WHITESPACE_CHAR(*pzTxt)) pzTxt++;
+ pzTxt = SPN_WHITESPACE_CHARS(pzTxt);
if (*pzTxt == NUL) {
- errno = ENOENT;
+ errno = ENOMSG;
return NULL;
}
pRes = AGALOC(sizeof(*pRes) + nameLen + 1, "nested args");
* Scan until we hit a NUL.
*/
do {
- while (IS_WHITESPACE_CHAR((int)*pzTxt)) pzTxt++;
- if (IS_VAR_FIRST_CHAR((int)*pzTxt)) {
+ pzTxt = SPN_WHITESPACE_CHARS(pzTxt);
+ if (IS_VAR_FIRST_CHAR(*pzTxt))
pzTxt = scan_name(pzTxt, pRes);
- }
+
else switch (*pzTxt) {
case NUL: goto scan_done;
case '<': pzTxt = scan_xml(pzTxt, pRes);
if (pzTxt == NULL) goto woops;
if (*pzTxt == ',') pzTxt++; break;
- case '#': pzTxt = strchr(pzTxt, '\n'); break;
+ case '#': pzTxt = strchr(pzTxt, NL); break;
default: goto woops;
}
} while (pzTxt != NULL); scan_done:;
{
tArgList * al = pRes->v.nestVal;
- if (al->useCt != 0)
+ if (al->useCt == 0) {
+ errno = ENOMSG;
+ goto woops;
+ }
+ if (al->useCt > 1)
sort_list(al);
}
break;
xlatp++;
}
- fprintf(fp, "#x%02X;", (ch & 0xFF));
+ fprintf(fp, XML_HEX_BYTE_FMT, (ch & 0xFF));
}
/*
/**
* \file numeric.c
*
- * Time-stamp: "2011-03-25 16:26:10 bkorb"
+ * Time-stamp: "2012-02-25 12:54:32 bkorb"
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (c) 1992-2012 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
* Show information about a numeric option with range constraints.
=*/
void
-optionShowRange(tOptions* pOpts, tOptDesc* pOD, void * rng_table, int rng_ct)
+optionShowRange(tOptions * pOpts, tOptDesc * pOD, void * rng_table, int rng_ct)
{
- static char const bullet[] = "\t\t\t\t- ";
- static char const deepin[] = "\t\t\t\t ";
- static char const onetab[] = "\t";
-
const struct {long const rmin, rmax;} * rng = rng_table;
- char const * pz_indent = bullet;
+ char const * pz_indent = BULLET_STR;
/*
* The range is shown only for full usage requests and an error
if (pOpts != OPTPROC_EMIT_USAGE) {
if (pOpts <= OPTPROC_EMIT_LIMIT)
return;
- pz_indent = onetab;
+ pz_indent = ONE_TAB_STR;
fprintf(option_usage_fp, zRangeErr, pOpts->pzProgName,
- pOD->pz_Name, pOD->optArg.argString);
+ pOD->pz_Name, pOD->optArg.argInt);
pz_indent = "";
}
fprintf(option_usage_fp, zRangeScaled, pz_indent);
fprintf(option_usage_fp, (rng_ct > 1) ? zRangeLie : zRangeOnly, pz_indent);
- pz_indent = (pOpts != OPTPROC_EMIT_USAGE) ? onetab : deepin;
+ pz_indent = (pOpts != OPTPROC_EMIT_USAGE) ? ONE_TAB_STR : DEEP_INDENT_STR;
for (;;) {
if (rng->rmax == LONG_MIN)
rng->rmax);
if (--rng_ct <= 0) {
- fputc('\n', option_usage_fp);
+ fputc(NL, option_usage_fp);
break;
}
fputs(zRangeOr, option_usage_fp);
if ((pOD->fOptState & OPTST_SCALED_NUM) != 0)
switch (*(pz++)) {
- case '\0': pz--; break;
+ case NUL: pz--; break;
case 't': val *= 1000;
case 'g': val *= 1000;
case 'm': val *= 1000;
/* Parse a time duration and return a seconds count
- Copyright (C) 2008-2011 Free Software Foundation, Inc.
+ Copyright (C) 2008-2012 Free Software Foundation, Inc.
Written by Bruce Korb <bkorb@gnu.org>, 2008.
This program is free software: you can redistribute it and/or modify
/* Parse a time duration and return a seconds count
- Copyright (C) 2008-2011 Free Software Foundation, Inc.
+ Copyright (C) 2008-2012 Free Software Foundation, Inc.
Written by Bruce Korb <bkorb@gnu.org>, 2008.
This program is free software: you can redistribute it and/or modify
the string may contain: NNN Y NNN M NNN W NNN d NNN h NNN m NNN s
This represents NNN years, NNN months, NNN weeks, NNN days, NNN hours,
NNN minutes and NNN seconds.
- The embeded white space is optional.
+ The embedded white space is optional.
These terms must appear in this order.
Case is significant: 'M' is months and 'm' is minutes.
The final "s" is optional.
/**
* \file pgusage.c
*
- * Time-stamp: "2011-03-25 17:54:41 bkorb"
+ * Time-stamp: "2012-01-29 16:09:14 bkorb"
*
* Automated Options Paged Usage module.
*
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (c) 1992-2012 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
my_pid = getpid();
#ifdef HAVE_SNPRINTF
- snprintf(zPageUsage, sizeof(zPageUsage), "/tmp/use.%lu", (tAoUL)my_pid);
+ snprintf(zPageUsage, sizeof(zPageUsage), TMP_USAGE_FMT, (tAoUL)my_pid);
#else
- sprintf(zPageUsage, "/tmp/use.%lu", (tAoUL)my_pid);
+ sprintf(zPageUsage, TMP_USAGE_FMT, (tAoUL)my_pid);
#endif
unlink(zPageUsage);
case PAGER_STATE_READY:
{
- tSCC zPage[] = "%1$s /tmp/use.%2$lu ; rm -f /tmp/use.%2$lu";
- tCC* pzPager = (tCC*)getenv("PAGER");
+ tCC* pzPager = (tCC*)getenv(PAGER_NAME);
/*
* Use the "more(1)" program if "PAGER" has not been defined
*/
if (pzPager == NULL)
- pzPager = "more";
+ pzPager = MORE_STR;
/*
* Page the file and remove it when done.
*/
#ifdef HAVE_SNPRINTF
- snprintf(zPageUsage, sizeof(zPageUsage), zPage, pzPager, (tAoUL)my_pid);
+ snprintf(zPageUsage, sizeof(zPageUsage), PAGE_USAGE_FMT, pzPager, (tAoUL)my_pid);
#else
- sprintf(zPageUsage, zPage, pzPager, (tAoUL)my_pid);
+ sprintf(zPageUsage, PAGE_USAGE_FMT, pzPager, (tAoUL)my_pid);
#endif
fclose(stderr);
dup2(STDOUT_FILENO, STDERR_FILENO);
/* -*- buffer-read-only: t -*- vi: set ro:
*
* Prototypes for autoopts
- * Generated Thu Dec 29 12:02:41 PST 2011
+ * Generated Sun Feb 26 11:08:49 PST 2012
*/
#ifndef AUTOOPTS_PROTO_H_GUARD
#define AUTOOPTS_PROTO_H_GUARD 1
/**
* \file putshell.c
*
- * Time-stamp: "2010-09-05 06:10:56 bkorb"
+ * Time-stamp: "2012-02-12 09:14:49 bkorb"
*
* This module will interpret the options set in the tOptions
* structure and print them to standard out in a fashion that
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (c) 1992-2012 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
* 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
* 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
*/
-static char const zOptValFmt[] = "%s_%s=";
-static char const zOptEnd[] = "\nexport %s_%s\n";
-static char const zOptNumFmt[] = "%1$s_%2$s=%3$d # 0x%3$X\nexport %1$s_%2$s\n";
/* = = = START-STATIC-FORWARD = = = */
static void
-print_quot_str(tCC* pzStr);
+print_quot_str(char const * pzStr);
static void
print_enumeration(tOptions * pOpts, tOptDesc * pOD);
* been emitted and the closing quote will be upon return.
*/
static void
-print_quot_str(tCC* pzStr)
+print_quot_str(char const * pzStr)
{
/*
* Handle empty strings to make the rest of the logic simpler.
*/
if ((pzStr == NULL) || (*pzStr == NUL)) {
- fputs("''", stdout);
+ fputs(EMPTY_ARG, stdout);
return;
}
* bail if that is all we need to do.
*/
while (*pzStr == '\'') {
- fputs("\\'", stdout);
+ fputs(QUOT_APOS, stdout);
pzStr++;
}
if (*pzStr == NUL)
*/
fputc('\'', stdout);
for (;;) {
- tCC* pz = strchr(pzStr, '\'');
+ char const * pz = strchr(pzStr, '\'');
if (pz == NULL)
break;
print_enumeration(tOptions * pOpts, tOptDesc * pOD)
{
uintptr_t e_val = pOD->optArg.argEnum;
- printf(zOptValFmt, pOpts->pzPROGNAME, pOD->pz_NAME);
+ printf(OPT_VAL_FMT, pOpts->pzPROGNAME, pOD->pz_NAME);
/*
* Convert value to string, print that and restore numeric value.
*/
(*(pOD->pOptProc))(OPTPROC_RETURN_VALNAME, pOD);
- printf("'%s'", pOD->optArg.argString);
+ printf(QUOT_ARG_FMT, pOD->optArg.argString);
if (pOD->fOptState & OPTST_ALLOC_ARG)
AGFREE(pOD->optArg.argString);
pOD->optArg.argEnum = e_val;
- printf(zOptEnd, pOpts->pzPROGNAME, pOD->pz_NAME);
+ printf(OPT_END_FMT, pOpts->pzPROGNAME, pOD->pz_NAME);
}
static void
else if (ch == NUL) { pz--; goto name_done; }
else fputc('_', stdout);
} name_done:;
- printf("=%1$lu # 0x%1$lX\n", (unsigned long)val);
+ printf(SHOW_VAL_FMT, (unsigned long)val);
val <<= 1;
}
static void
print_stacked_arg(tOptions * pOpts, tOptDesc * pOD)
{
- tSCC zOptCookieCt[] = "%1$s_%2$s_CT=%3$d\nexport %1$s_%2$s_CT\n";
-
tArgList* pAL = (tArgList*)pOD->optCookie;
tCC** ppz = pAL->apzArgs;
int ct = pAL->useCt;
printf(zOptCookieCt, pOpts->pzPROGNAME, pOD->pz_NAME, ct);
while (--ct >= 0) {
- tSCC numarg_z[] = "%s_%s_%d=";
- tSCC end_z[] = "\nexport %s_%s_%d\n";
-
- printf(numarg_z, pOpts->pzPROGNAME, pOD->pz_NAME,
+ printf(ARG_BY_NUM_FMT, pOpts->pzPROGNAME, pOD->pz_NAME,
pAL->useCt - ct);
print_quot_str(*(ppz++));
- printf(end_z, pOpts->pzPROGNAME, pOD->pz_NAME,
+ printf(EXPORT_ARG_FMT, pOpts->pzPROGNAME, pOD->pz_NAME,
pAL->useCt - ct);
}
}
{
int optIx;
- fputs("set --", stdout);
+ fputs(set_dash, stdout);
for (optIx = pOpts->curOptIdx; optIx < pOpts->origArgCt; optIx++) {
char* pzArg = pOpts->origArgVect[ optIx ];
if (strchr(pzArg, '\'') == NULL)
- printf(" '%s'", pzArg);
+ printf(arg_fmt, pzArg);
else {
fputs(" '", stdout);
for (;;) {
char ch = *(pzArg++);
switch (ch) {
- case '\'': fputs("'\\''", stdout); break;
+ case '\'': fputs(apostrophy, stdout); break;
case NUL: goto arg_done;
default: fputc(ch, stdout); break;
}
fputc('\'', stdout);
}
}
- fputs("\nOPTION_CT=0\n", stdout);
+ fputs(init_optct, stdout);
}
/*=export_func optionPutShell
optionPutShell(tOptions* pOpts)
{
int optIx = 0;
- tSCC zOptCtFmt[] = "OPTION_CT=%d\nexport OPTION_CT\n";
- tSCC zOptDisabl[] = "%1$s_%2$s=%3$s\nexport %1$s_%2$s\n";
- tSCC zFullOptFmt[]= "%1$s_%2$s='%3$s'\nexport %1$s_%2$s\n";
- tSCC zEquivMode[] = "%1$s_%2$s_MODE='%3$s'\nexport %1$s_%2$s_MODE\n";
printf(zOptCtFmt, pOpts->curOptIdx-1);
do {
tOptDesc* pOD = pOpts->pOptDesc + optIx;
- if (SKIP_OPT(pOD))
+ if ((pOD->fOptState & OPTST_NO_OUTPUT_MASK) != 0)
continue;
/*
* The idea is that if someone defines an option to initialize
* enabled, we should tell our shell script that it is enabled.
*/
- if (UNUSED_OPT(pOD) && DISABLED_OPT(pOD)) {
+ if (UNUSED_OPT(pOD) && DISABLED_OPT(pOD))
continue;
- }
/*
* Handle stacked arguments
/*
* This option has a text value
*/
- printf(zOptValFmt, pOpts->pzPROGNAME, pOD->pz_NAME);
+ printf(OPT_VAL_FMT, pOpts->pzPROGNAME, pOD->pz_NAME);
print_quot_str(pOD->optArg.argString);
- printf(zOptEnd, pOpts->pzPROGNAME, pOD->pz_NAME);
+ printf(OPT_END_FMT, pOpts->pzPROGNAME, pOD->pz_NAME);
} while (++optIx < pOpts->presetOptCt );
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (c) 1992-2012 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
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (c) 1992-2012 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
/*
* \file save.c
*
- * Time-stamp: "2011-04-06 09:21:44 bkorb"
+ * Time-stamp: "2012-01-29 19:30:39 bkorb"
*
* This module's routines will take the currently set options and
* store them into an ".rc" file for re-interpretation the next
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (c) 1992-2012 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
* 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
*/
-static char const zWarn[] = "%s WARNING: cannot save options - ";
-static char const close_xml[] = "</%s>\n";
-
/* = = = START-STATIC-FORWARD = = = */
-static tCC*
-findDirName(tOptions* pOpts, int* p_free);
+static char const *
+find_dir_name(tOptions * pOpts, int * p_free);
static char const *
-findFileName(tOptions * pOpts, int * p_free_name);
+find_file_name(tOptions * pOpts, int * p_free_name);
static void
-printEntry(
- FILE * fp,
- tOptDesc * p,
- tCC* pzLA );
+prt_entry(FILE * fp, tOptDesc * p, char const * pzLA);
static void
-print_a_value(FILE * fp, int depth, tOptDesc * pOD, tOptionValue const * ovp);
+prt_value(FILE * fp, int depth, tOptDesc * pOD, tOptionValue const * ovp);
static void
-print_a_string(FILE * fp, char const * name, char const * pz);
+prt_string(FILE * fp, char const * name, char const * pz);
static void
-printValueList(FILE * fp, char const * name, tArgList * al);
+prt_val_list(FILE * fp, char const * name, tArgList * al);
static void
-printHierarchy(FILE * fp, tOptDesc * p);
+prt_nested(FILE * fp, tOptDesc * p);
static FILE *
-openSaveFile(tOptions* pOpts);
+open_sv_file(tOptions* pOpts);
static void
-printNoArgOpt(FILE * fp, tOptDesc * p, tOptDesc * pOD);
+prt_no_arg_opt(FILE * fp, tOptDesc * p, tOptDesc * pOD);
static void
-printStringArg(FILE * fp, tOptDesc * pOD);
+prt_str_arg(FILE * fp, tOptDesc * pOD);
static void
-printEnumArg(FILE * fp, tOptDesc * pOD);
+prt_enum_arg(FILE * fp, tOptDesc * pOD);
static void
-printSetMemberArg(FILE * fp, tOptDesc * pOD);
+prt_set_arg(FILE * fp, tOptDesc * pOD);
static void
-printFileArg(FILE * fp, tOptDesc * pOD, tOptions* pOpts);
+prt_file_arg(FILE * fp, tOptDesc * pOD, tOptions* pOpts);
/* = = = END-STATIC-FORWARD = = = */
-static tCC*
-findDirName(tOptions* pOpts, int* p_free)
+static char const *
+find_dir_name(tOptions * pOpts, int * p_free)
{
- tCC* pzDir;
+ char const * pzDir;
if ( (pOpts->specOptIdx.save_opts == NO_EQUIVALENT)
|| (pOpts->specOptIdx.save_opts == 0))
* we can stash the RC (INI) file.
*/
{
- tCC* const* papz = pOpts->papzHomeList;
+ char const * const* papz = pOpts->papzHomeList;
if (papz == NULL)
return NULL;
return pzDir;
{
- tCC* pzEndDir = strchr(++pzDir, DIRCH);
- char* pzFileName;
- char* pzEnv;
+ char const * pzEndDir = strchr(++pzDir, DIRCH);
+ char * pzFileName;
+ char * pzEnv;
if (pzEndDir != NULL) {
char z[ AO_NAME_SIZE ];
}
if (pzEnv == NULL) {
- fprintf(stderr, zWarn, pOpts->pzProgName);
+ fprintf(stderr, SAVE_WARN, pOpts->pzProgName);
fprintf(stderr, zNotDef, pzDir);
return NULL;
}
static char const *
-findFileName(tOptions * pOpts, int * p_free_name)
+find_file_name(tOptions * pOpts, int * p_free_name)
{
struct stat stBuf;
int free_dir_name = 0;
- char const * pzDir = findDirName(pOpts, &free_dir_name);
+ char const * pzDir = find_dir_name(pOpts, &free_dir_name);
if (pzDir == NULL)
return NULL;
*/
if (errno != ENOENT) {
bogus_name:
- fprintf(stderr, zWarn, pOpts->pzProgName);
+ fprintf(stderr, SAVE_WARN, pOpts->pzProgName);
fprintf(stderr, zNoStat, errno, strerror(errno), pzDir);
if (free_dir_name)
AGFREE((void*)pzDir);
size_t sz = strlen(pzDir) + strlen(pOpts->pzRcName) + 2;
{
- char* pzPath = (char*)AGALOC(sz, "file name");
+ char * pzPath = (char*)AGALOC(sz, "file name");
#ifdef HAVE_SNPRINTF
snprintf(pzPath, sz, "%s/%s", pzDir, pOpts->pzRcName);
#else
*/
if (stat(pzDir, &stBuf) != 0) {
if (errno != ENOENT) {
- fprintf(stderr, zWarn, pOpts->pzProgName);
+ fprintf(stderr, SAVE_WARN, pOpts->pzProgName);
fprintf(stderr, zNoStat, errno, strerror(errno),
pzDir);
AGFREE((void*)pzDir);
* or will soon be a file.
*/
if (! S_ISREG(stBuf.st_mode)) {
- fprintf(stderr, zWarn, pOpts->pzProgName);
+ fprintf(stderr, SAVE_WARN, pOpts->pzProgName);
fprintf(stderr, zNotFile, pzDir);
if (free_dir_name)
AGFREE((void*)pzDir);
static void
-printEntry(
- FILE * fp,
- tOptDesc * p,
- tCC* pzLA )
+prt_entry(FILE * fp, tOptDesc * p, char const * pzLA)
{
/*
* There is an argument. Pad the name so values line up.
* OTHERWISE, FOR each line of the value text, ...
*/
else if (pzLA == NULL)
- fputc('\n', fp);
+ fputc(NL, fp);
else {
fputc(' ', fp); fputc(' ', fp);
for (;;) {
- tCC* pzNl = strchr(pzLA, '\n');
+ char const * pzNl = strchr(pzLA, NL);
/*
* IF this is the last line
* Terminate the entry
*/
fputs(pzLA, fp);
- fputc('\n', fp);
+ fputc(NL, fp);
}
}
static void
-print_a_value(FILE * fp, int depth, tOptDesc * pOD, tOptionValue const * ovp)
+prt_value(FILE * fp, int depth, tOptDesc * pOD, tOptionValue const * ovp)
{
- static char const bool_atr[] = "<%1$s type=boolean>%2$s</%1$s>\n";
- static char const numb_atr[] = "<%1$s type=integer>0x%2$lX</%1$s>\n";
- static char const type_atr[] = "<%s type=%s>";
- static char const null_atr[] = "<%s/>\n";
-
while (--depth >= 0)
putc(' ', fp), putc(' ', fp);
switch (ovp->valType) {
default:
case OPARG_TYPE_NONE:
- fprintf(fp, null_atr, ovp->pzName);
+ fprintf(fp, NULL_ATR_FMT, ovp->pzName);
break;
case OPARG_TYPE_STRING:
- print_a_string(fp, ovp->pzName, ovp->v.strVal);
+ prt_string(fp, ovp->pzName, ovp->v.strVal);
break;
case OPARG_TYPE_ENUMERATION:
char const * typ = (ovp->valType == OPARG_TYPE_ENUMERATION)
? "keyword" : "set-membership";
- fprintf(fp, type_atr, ovp->pzName, typ);
+ fprintf(fp, TYPE_ATR_FMT, ovp->pzName, typ);
/*
* This is a magic incantation that will convert the
pOD->optArg.argEnum = val;
pOD->fOptState = opt_state;
- fprintf(fp, close_xml, ovp->pzName);
+ fprintf(fp, END_XML_FMT, ovp->pzName);
break;
}
/* FALLTHROUGH */
case OPARG_TYPE_NUMERIC:
- fprintf(fp, numb_atr, ovp->pzName, ovp->v.longVal);
+ fprintf(fp, NUMB_ATR_FMT, ovp->pzName, ovp->v.longVal);
break;
case OPARG_TYPE_BOOLEAN:
- fprintf(fp, bool_atr, ovp->pzName,
+ fprintf(fp, BOOL_ATR_FMT, ovp->pzName,
ovp->v.boolVal ? "true" : "false");
break;
case OPARG_TYPE_HIERARCHY:
- printValueList(fp, ovp->pzName, ovp->v.nestVal);
+ prt_val_list(fp, ovp->pzName, ovp->v.nestVal);
break;
}
}
static void
-print_a_string(FILE * fp, char const * name, char const * pz)
+prt_string(FILE * fp, char const * name, char const * pz)
{
- static char const open_atr[] = "<%s>";
-
- fprintf(fp, open_atr, name);
+ fprintf(fp, OPEN_XML_FMT, name);
for (;;) {
int ch = ((int)*(pz++)) & 0xFF;
putc(ch, fp);
}
} string_done:;
- fprintf(fp, close_xml, name);
+ fprintf(fp, END_XML_FMT, name);
}
static void
-printValueList(FILE * fp, char const * name, tArgList * al)
+prt_val_list(FILE * fp, char const * name, tArgList * al)
{
static int depth = 1;
opt_list = (void **)al->apzArgs;
if (opt_ct <= 0) {
- fprintf(fp, "<%s/>\n", name);
+ fprintf(fp, OPEN_CLOSE_FMT, name);
return;
}
- fprintf(fp, "<%s type=nested>\n", name);
+ fprintf(fp, NESTED_OPT_FMT, name);
depth++;
while (--opt_ct >= 0) {
tOptionValue const * ovp = *(opt_list++);
- print_a_value(fp, depth, NULL, ovp);
+ prt_value(fp, depth, NULL, ovp);
}
depth--;
static void
-printHierarchy(FILE * fp, tOptDesc * p)
+prt_nested(FILE * fp, tOptDesc * p)
{
int opt_ct;
tArgList * al = p->optCookie;
if (ovp == NULL)
continue;
- fprintf(fp, "<%s type=nested>\n", p->pz_Name);
+ fprintf(fp, NESTED_OPT_FMT, p->pz_Name);
do {
- print_a_value(fp, 1, p, ovp);
+ prt_value(fp, 1, p, ovp);
} while (ovp = optionNextValue(base, ovp),
ovp != NULL);
static FILE *
-openSaveFile(tOptions* pOpts)
+open_sv_file(tOptions* pOpts)
{
- FILE* fp;
+ FILE * fp;
{
int free_name = 0;
- tCC* pzFName = findFileName(pOpts, &free_name);
+ char const * pzFName = find_file_name(pOpts, &free_name);
if (pzFName == NULL)
return NULL;
fp = fopen(pzFName, "w" FOPEN_BINARY_FLAG);
if (fp == NULL) {
- fprintf(stderr, zWarn, pOpts->pzProgName);
+ fprintf(stderr, SAVE_WARN, pOpts->pzProgName);
fprintf(stderr, zNoCreat, errno, strerror(errno), pzFName);
if (free_name)
AGFREE((void*) pzFName );
}
{
- char const* pz = pOpts->pzUsageTitle;
+ char const * pz = pOpts->pzUsageTitle;
fputs("# ", fp);
- do { fputc(*pz, fp); } while (*(pz++) != '\n');
+ do { fputc(*pz, fp); } while (*(pz++) != NL);
}
{
time_t timeVal = time(NULL);
- char* pzTime = ctime(&timeVal);
+ char * pzTime = ctime(&timeVal);
fprintf(fp, zPresetFile, pzTime);
#ifdef HAVE_ALLOCATED_CTIME
}
static void
-printNoArgOpt(FILE * fp, tOptDesc * p, tOptDesc * pOD)
+prt_no_arg_opt(FILE * fp, tOptDesc * p, tOptDesc * pOD)
{
/*
* The aliased to argument indicates whether or not the option
}
static void
-printStringArg(FILE * fp, tOptDesc * pOD)
+prt_str_arg(FILE * fp, tOptDesc * pOD)
{
if (pOD->fOptState & OPTST_STACKED) {
- tArgList* pAL = (tArgList*)pOD->optCookie;
+ tArgList * pAL = (tArgList*)pOD->optCookie;
int uct = pAL->useCt;
- tCC** ppz = pAL->apzArgs;
+ char const ** ppz = pAL->apzArgs;
/*
* un-disable multiple copies of disabled options.
pOD->fOptState &= ~OPTST_DISABLED;
while (uct-- > 0)
- printEntry(fp, pOD, *(ppz++));
+ prt_entry(fp, pOD, *(ppz++));
} else {
- printEntry(fp, pOD, pOD->optArg.argString);
+ prt_entry(fp, pOD, pOD->optArg.argString);
}
}
static void
-printEnumArg(FILE * fp, tOptDesc * pOD)
+prt_enum_arg(FILE * fp, tOptDesc * pOD)
{
uintptr_t val = pOD->optArg.argEnum;
* bit flag values back into a string suitable for printing.
*/
(*(pOD->pOptProc))(OPTPROC_RETURN_VALNAME, pOD);
- printEntry(fp, pOD, (void*)(pOD->optArg.argString));
+ prt_entry(fp, pOD, (void*)(pOD->optArg.argString));
pOD->optArg.argEnum = val;
}
static void
-printSetMemberArg(FILE * fp, tOptDesc * pOD)
+prt_set_arg(FILE * fp, tOptDesc * pOD)
{
uintptr_t val = pOD->optArg.argEnum;
* bit flag values back into a string suitable for printing.
*/
(*(pOD->pOptProc))(OPTPROC_RETURN_VALNAME, pOD);
- printEntry(fp, pOD, (void*)(pOD->optArg.argString));
+ prt_entry(fp, pOD, (void*)(pOD->optArg.argString));
if (pOD->optArg.argString != NULL) {
/*
}
static void
-printFileArg(FILE * fp, tOptDesc * pOD, tOptions* pOpts)
+prt_file_arg(FILE * fp, tOptDesc * pOD, tOptions* pOpts)
{
/*
* If the cookie is not NULL, then it has the file name, period.
* Otherwise, if we have a non-NULL string argument, then....
*/
if (pOD->optCookie != NULL)
- printEntry(fp, pOD, pOD->optCookie);
+ prt_entry(fp, pOD, pOD->optCookie);
else if (HAS_originalOptArgArray(pOpts)) {
char const * orig =
if (pOD->optArg.argString == orig)
return;
- printEntry(fp, pOD, pOD->optArg.argString);
+ prt_entry(fp, pOD, pOD->optArg.argString);
}
}
{
tOptDesc* pOD;
int ct;
- FILE* fp = openSaveFile(pOpts);
+ FILE * fp = open_sv_file(pOpts);
if (fp == NULL)
return;
ct = pOpts->presetOptCt;
pOD = pOpts->pOptDesc;
do {
- tOptDesc* p;
+ tOptDesc * p;
/*
* IF the option has not been defined
switch (OPTST_GET_ARGTYPE(pOD->fOptState)) {
case OPARG_TYPE_NONE:
- printNoArgOpt(fp, p, pOD);
+ prt_no_arg_opt(fp, p, pOD);
break;
case OPARG_TYPE_NUMERIC:
- printEntry(fp, p, (void*)(p->optArg.argInt));
+ prt_entry(fp, p, (void*)(p->optArg.argInt));
break;
case OPARG_TYPE_STRING:
- printStringArg(fp, p);
+ prt_str_arg(fp, p);
break;
case OPARG_TYPE_ENUMERATION:
- printEnumArg(fp, p);
+ prt_enum_arg(fp, p);
break;
case OPARG_TYPE_MEMBERSHIP:
- printSetMemberArg(fp, p);
+ prt_set_arg(fp, p);
break;
case OPARG_TYPE_BOOLEAN:
- printEntry(fp, p, p->optArg.argBool ? "true" : "false");
+ prt_entry(fp, p, p->optArg.argBool ? "true" : "false");
break;
case OPARG_TYPE_HIERARCHY:
- printHierarchy(fp, p);
+ prt_nested(fp, p);
break;
case OPARG_TYPE_FILE:
- printFileArg(fp, p, pOpts);
+ prt_file_arg(fp, p, pOpts);
break;
default:
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (c) 1992-2012 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
/**
* \file stack.c
*
- * Time-stamp: "2010-07-17 10:42:27 bkorb"
+ * Time-stamp: "2012-01-29 09:42:12 bkorb"
*
* This is a special option processing routine that will save the
* argument to an option in a FIFO queue.
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (c) 1992-2012 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
tOptions* pOpts,
tOptDesc* pOptDesc )
{
- int res;
-
tArgList* pAL;
if ((pOptDesc->fOptState & OPTST_RESET) != 0)
* we are keeping a define.
*/
for (i = 0, dIdx = 0, ct = pAL->useCt; --ct >= 0; i++) {
- tCC* pzSrc = pAL->apzArgs[ i ];
- char* pzEq = strchr(pzSrc, '=');
+ char const * pzSrc = pAL->apzArgs[ i ];
+ char * pzEq = strchr(pzSrc, '=');
+ int res;
+
if (pzEq != NULL)
*pzEq = NUL;
/**
* \file streqvcmp.c
*
- * Time-stamp: "2010-07-17 10:16:24 bkorb"
+ * Time-stamp: "2012-01-29 19:03:24 bkorb"
*
* String Equivalence Comparison
*
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (c) 1992-2012 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
* based upon ascii character sequences.
*/
static unsigned char charmap[] = {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, '\a',
- '\b', '\t', '\n', '\v', '\f', '\r', 0x0E, 0x0F,
+ NUL, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, '\a',
+ '\b', '\t', NL, '\v', '\f', '\r', 0x0E, 0x0F,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
if (ct == 0) {
ct = sizeof(charmap) - 1;
do {
- charmap[ ct ] = ct;
+ charmap[ct] = (unsigned char)ct;
} while (--ct >= 0);
}
int chFrom = (int)From & 0xFF;
do {
- charmap[ chFrom ] = (unsigned)chTo;
+ charmap[chFrom] = (unsigned char)chTo;
chFrom++;
chTo++;
if ((chFrom >= sizeof(charmap)) || (chTo >= sizeof(charmap)))
*
* Map a text file, ensuring the text always has an ending NUL byte.
*
- * Time-stamp: "2011-06-25 11:42:22 bkorb"
+ * Time-stamp: "2012-01-29 09:40:21 bkorb"
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (c) 1992-2012 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
/**
* \file time.c
*
- * Time-stamp: "2011-03-06 11:52:23 bkorb"
+ * Time-stamp: "2012-01-29 12:52:31 bkorb"
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (c) 1992-2012 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
pOD->fOptState &= ~OPTST_ALLOC_ARG;
}
- pOD->optArg.argInt = val;
+ pOD->optArg.argInt = (unsigned long)val;
}
/*=export_func optionTimeDate
/*
* This file defines the string_tokenize interface
- * Time-stamp: "2010-07-17 10:40:26 bkorb"
+ * Time-stamp: "2012-01-29 19:02:51 bkorb"
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (c) 1992-2012 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
switch (*pSrc) {
case NUL: *ppSrc = NULL; return;
case '\r':
- if (*(++pSrc) == '\n')
+ if (*(++pSrc) == NL)
++pSrc;
continue;
- case '\n':
+ case NL:
++pSrc;
continue;
default:
str++;
- *(pzDest++) = ch;
+ *(pzDest++) = (unsigned char)ch;
}
} copy_done:;
/*
* \file usage.c
*
- * Time-stamp: "2011-11-22 11:41:18 bkorb"
+ * Time-stamp: "2012-01-29 09:57:43 bkorb"
*
* This module implements the default usage procedure for
* Automated Options. It may be overridden, of course.
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (c) 1992-2012 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
*/
if (do_gnu_usage(opts)) {
int flen = setGnuOptFmts(opts, &pOptTitle);
- sprintf(zOptFmtLine, zFmtFmt, flen);
- fputc('\n', option_usage_fp);
+ sprintf(line_fmt_buf, zFmtFmt, flen);
+ fputc(NL, option_usage_fp);
}
else {
int flen = setStdOptFmts(opts, &pOptTitle);
- sprintf(zOptFmtLine, zFmtFmt, flen);
+ sprintf(line_fmt_buf, zFmtFmt, flen);
/*
* When we exit with EXIT_SUCCESS and the first option is a doc
}
}
- fputc('\n', option_usage_fp);
+ fputc(NL, option_usage_fp);
}
}
snprintf(z, sizeof(z), pAT->pzOptFmt, pzArgType, pOD->pz_Name,
(pOD->optMinCt != 0) ? pAT->pzReq : pAT->pzOpt);
- fprintf(option_usage_fp, zOptFmtLine, z, pOD->pzText);
+ fprintf(option_usage_fp, line_fmt_buf, z, pOD->pzText);
switch (OPTST_GET_ARGTYPE(pOD->fOptState)) {
case OPARG_TYPE_ENUMERATION:
} while (pOD++, optNo++, (--ct > 0));
- fputc('\n', option_usage_fp);
+ fputc(NL, option_usage_fp);
}
int optNo = 0;
tOptDesc* pOD = pOptions->pOptDesc;
- fputc('\n', option_usage_fp);
+ fputc(NL, option_usage_fp);
fflush(option_usage_fp);
do {
switch (OPTST_GET_ARGTYPE(pOD->fOptState)) {
/*
- * Generated header for gperf generated source Thu Dec 29 12:02:33 PST 2011
+ * Generated header for gperf generated source Sun Feb 26 11:08:41 PST 2012
* This file enumerates the list of names and declares the
* procedure for mapping string names to the enum value.
*/
/*
- * Time-stamp: "2011-05-02 12:04:47 bkorb"
+ * Time-stamp: "2012-01-29 19:44:24 bkorb"
*
* This module implements the default usage procedure for
* Automated Options. It may be overridden, of course.
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2011 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (c) 1992-2012 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
return zVersion;
}
+/**
+ * Select among various ways to emit version information.
+ *
+ * @param pOpts the option descriptor
+ * @param fp the output stream
+ */
static void
emit_simple_ver(tOptions * pOpts, FILE * fp)
{
+ /*
+ * Use the supplied string
+ */
if (pOpts->pzFullVersion != NULL)
fputs(pOpts->pzFullVersion, fp);
+ /*
+ * Extract the interesting part of the copyright string
+ */
else if (pOpts->pzCopyright != NULL) {
- char const * pe = strchr(pOpts->pzCopyright, '\n');
+ char const * pe = strchr(pOpts->pzCopyright, NL);
if (pe == NULL)
pe = pOpts->pzCopyright + strlen(pOpts->pzCopyright);
fwrite(pOpts->pzCopyright, 1, pe - pOpts->pzCopyright, fp);
}
+ /*
+ * Extract the interesting part of the usage title string
+ */
else {
- char const * pe = strchr(pOpts->pzUsageTitle, '\n');
+ char const * pe = strchr(pOpts->pzUsageTitle, NL);
if (pe == NULL)
pe = pOpts->pzUsageTitle + strlen(pOpts->pzUsageTitle);
- fwrite(pOpts->pzUsageTitle, 1, pe - pOpts->pzCopyright, fp);
+ fwrite(pOpts->pzUsageTitle, 1, pe - pOpts->pzUsageTitle, fp);
}
- fputc('\n', fp);
+ fputc(NL, fp);
}
static void
fputs(pOpts->pzFullVersion, fp);
else {
- char const * pe = strchr(pOpts->pzUsageTitle, '\n');
+ char const * pe = strchr(pOpts->pzUsageTitle, NL);
if (pe == NULL)
pe = pOpts->pzUsageTitle + strlen(pOpts->pzUsageTitle);
fwrite(pOpts->pzUsageTitle, 1, pe - pOpts->pzCopyright, fp);
}
- fputc('\n', fp);
+ fputc(NL, fp);
if (HAS_pzPkgDataDir(pOpts) && (pOpts->pzPackager != NULL))
fputs(pOpts->pzPackager, fp);
{
if (pOpts->pzCopyright != NULL) {
fputs(pOpts->pzCopyright, fp);
- fputc('\n', fp);
+ fputc(NL, fp);
}
if (pOpts->pzCopyNotice != NULL) {
fputs(pOpts->pzCopyNotice, fp);
- fputc('\n', fp);
+ fputc(NL, fp);
}
fprintf(fp, zAO_Ver, optionVersion());
/*
- * Generated header for gperf generated source Thu Dec 29 12:02:33 PST 2011
+ * Generated header for gperf generated source Sun Feb 26 11:08:41 PST 2012
* This file enumerates the list of names and declares the
* procedure for mapping string names to the enum value.
*/