summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2013-11-05 23:29:16 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2013-11-05 23:29:16 +0100
commit4911ddf32d466272365989e0f267f9cf1cc6ed69 (patch)
treeefb006361159ceac8c9d9fb4a3a1d99d34db11ce /src
parent1ea470df9072434c1a9f0ff7b3d149cf61da7c1a (diff)
downloadgnutls-4911ddf32d466272365989e0f267f9cf1cc6ed69.tar.gz
updated to libopts 5.18.2
Diffstat (limited to 'src')
-rw-r--r--src/libopts/ag-char-map.h13
-rw-r--r--src/libopts/ao-strs.c2
-rw-r--r--src/libopts/ao-strs.h2
-rw-r--r--src/libopts/autoopts/options.h108
-rw-r--r--src/libopts/autoopts/usage-txt.h94
-rw-r--r--src/libopts/compat/compat.h2
-rw-r--r--src/libopts/compat/strchr.c4
-rw-r--r--src/libopts/configfile.c7
-rw-r--r--src/libopts/genshell.c99
-rw-r--r--src/libopts/genshell.h6
-rw-r--r--src/libopts/m4/libopts.m43
-rw-r--r--src/libopts/option-value-type.c4
-rw-r--r--src/libopts/option-value-type.h2
-rw-r--r--src/libopts/option-xat-attribute.c4
-rw-r--r--src/libopts/option-xat-attribute.h2
-rw-r--r--src/libopts/pgusage.c4
-rw-r--r--src/libopts/proto.h2
-rw-r--r--src/libopts/streqvcmp.c4
-rw-r--r--src/libopts/text_mmap.c43
-rw-r--r--src/libopts/usage.c1
20 files changed, 212 insertions, 194 deletions
diff --git a/src/libopts/ag-char-map.h b/src/libopts/ag-char-map.h
index 58154d978e..7a5e3322d6 100644
--- a/src/libopts/ag-char-map.h
+++ b/src/libopts/ag-char-map.h
@@ -1,6 +1,6 @@
/*
* 29 bits for 46 character classifications
- * generated by char-mapper on 07/14/13 at 17:37:05
+ * generated by char-mapper on 10/16/13 at 13:46:13
*
* This file contains the character classifications
* used by AutoGen and AutoOpts for identifying tokens.
@@ -441,8 +441,7 @@ static ag_char_map_mask_t const ag_char_map_masks[46] = {
0x00000101, /* MAKE_SCRIPT */
0x00000600, /* LOAD_LINE_SKIP */
};
-
-#undef LOCK_SPANNER_TABLES
+#undef LOCK_SPANNER_TABLES
static unsigned char const *
calc_ag_char_map_spanners(unsigned int mask_ix)
@@ -489,7 +488,7 @@ spn_ag_char_map_chars(char const * p, unsigned int mask_ix)
unsigned char const * v = ag_char_map_spanners[mask_ix];
if (v == NULL)
v = calc_ag_char_map_spanners(mask_ix);
- while (v[(unsigned)*p]) p++;
+ while (v[(unsigned char)*p]) p++;
return (char *)(uintptr_t)p;
}
@@ -499,7 +498,7 @@ brk_ag_char_map_chars(char const * p, unsigned int mask_ix)
unsigned char const * v = ag_char_map_spanners[mask_ix];
if (v == NULL)
v = calc_ag_char_map_spanners(mask_ix);
- while ((*p != '\0') && (! v[(unsigned)*p])) p++;
+ while ((*p != '\0') && (! v[(unsigned char)*p])) p++;
return (char *)(uintptr_t)p;
}
@@ -510,7 +509,7 @@ spn_ag_char_map_back(char const * s, char const * e, unsigned int mask_ix)
if (v == NULL)
v = calc_ag_char_map_spanners(mask_ix);
if (s >= e) e = s + strlen(s);
- while ((e > s) && v[(unsigned)e[-1]]) e--;
+ while ((e > s) && v[(unsigned char)e[-1]]) e--;
return (char *)(uintptr_t)e;
}
@@ -521,7 +520,7 @@ brk_ag_char_map_back(char const * s, char const * e, unsigned int mask_ix)
if (v == NULL)
v = calc_ag_char_map_spanners(mask_ix);
if (s == e) e += strlen(e);
- while ((e > s) && (! v[(unsigned)e[-1]])) e--;
+ while ((e > s) && (! v[(unsigned char)e[-1]])) e--;
return (char *)(uintptr_t)e;
}
#endif /* AG_CHAR_MAP_H_GUARD */
diff --git a/src/libopts/ao-strs.c b/src/libopts/ao-strs.c
index fa37136d9d..8706d5aada 100644
--- a/src/libopts/ao-strs.c
+++ b/src/libopts/ao-strs.c
@@ -2,7 +2,7 @@
*
* DO NOT EDIT THIS FILE (ao-strs.c)
*
- * It has been AutoGen-ed July 14, 2013 at 05:37:05 PM by AutoGen 5.18
+ * It has been AutoGen-ed October 16, 2013 at 01:46:13 PM by AutoGen 5.18.2
* From the definitions ao-strs.def
* and the template file strings
*
diff --git a/src/libopts/ao-strs.h b/src/libopts/ao-strs.h
index ca3eafc9b0..9dd924dc9a 100644
--- a/src/libopts/ao-strs.h
+++ b/src/libopts/ao-strs.h
@@ -2,7 +2,7 @@
*
* DO NOT EDIT THIS FILE (ao-strs.h)
*
- * It has been AutoGen-ed July 14, 2013 at 05:37:05 PM by AutoGen 5.18
+ * It has been AutoGen-ed October 16, 2013 at 01:46:13 PM by AutoGen 5.18.2
* From the definitions ao-strs.def
* and the template file strings
*
diff --git a/src/libopts/autoopts/options.h b/src/libopts/autoopts/options.h
index fcf7739ca2..92e9be4b0e 100644
--- a/src/libopts/autoopts/options.h
+++ b/src/libopts/autoopts/options.h
@@ -2,7 +2,7 @@
*
* DO NOT EDIT THIS FILE (options.h)
*
- * It has been AutoGen-ed July 14, 2013 at 05:37:12 PM by AutoGen 5.18
+ * It has been AutoGen-ed October 16, 2013 at 01:46:20 PM by AutoGen 5.18.2
* From the definitions funcs.def
* and the template file options_h
*
@@ -101,15 +101,15 @@
* @{
*/
/// autoopts structure version
-#define OPTIONS_STRUCT_VERSION 163840
+#define OPTIONS_STRUCT_VERSION 163841
/// autoopts structure version string
-#define OPTIONS_VERSION_STRING "40:0:15"
+#define OPTIONS_VERSION_STRING "40:1:15"
/// minimum version the autoopts library supports
#define OPTIONS_MINIMUM_VERSION 102400
/// minimum version the autoopts library supports as a string
#define OPTIONS_MIN_VER_STRING "25:0:0"
/// the display version of the autoopts library, as a string
-#define OPTIONS_DOTTED_VERSION "40.0"
+#define OPTIONS_DOTTED_VERSION "40.1"
/// convert a version/release number pair to an integer value
#define OPTIONS_VER_TO_NUM(_v, _r) (((_v) * 4096) + (_r))
/// @}
@@ -201,59 +201,59 @@ typedef uint32_t opt_state_mask_t;
#define OPTST_ARG_TYPE_SHIFT 12
/** bits defined for opt_state_mask_t */
-/** opt_state_mask_t - Set via the "SET_OPT()" macro */
+/** Set via the "SET_OPT()" macro */
#define OPTST_SET 0x0000001U
-/** opt_state_mask_t - Set via an RC/INI file */
+/** Set via an RC/INI file */
#define OPTST_PRESET 0x0000002U
-/** opt_state_mask_t - Set via a command line option */
+/** Set via a command line option */
#define OPTST_DEFINED 0x0000004U
-/** opt_state_mask_t - Reset via command line option */
+/** Reset via command line option */
#define OPTST_RESET 0x0000008U
-/** opt_state_mask_t - selected by equiv'ed option */
+/** selected by equiv'ed option */
#define OPTST_EQUIVALENCE 0x0000010U
-/** opt_state_mask_t - option is in disabled state */
+/** option is in disabled state */
#define OPTST_DISABLED 0x0000020U
-/** opt_state_mask_t - pzOptArg was allocated */
+/** pzOptArg was allocated */
#define OPTST_ALLOC_ARG 0x0000040U
-/** opt_state_mask_t - option cannot be preset */
+/** option cannot be preset */
#define OPTST_NO_INIT 0x0000100U
-/** opt_state_mask_t - opt value (flag) is any digit */
+/** opt value (flag) is any digit */
#define OPTST_NUMBER_OPT 0x0000200U
-/** opt_state_mask_t - opt uses optionStackArg proc */
+/** opt uses optionStackArg proc */
#define OPTST_STACKED 0x0000400U
-/** opt_state_mask_t - option defaults to enabled */
+/** option defaults to enabled */
#define OPTST_INITENABLED 0x0000800U
-/** opt_state_mask_t - bit 1 of arg type enum */
+/** bit 1 of arg type enum */
#define OPTST_ARG_TYPE_1 0x0001000U
-/** opt_state_mask_t - bit 2 of arg type enum */
+/** bit 2 of arg type enum */
#define OPTST_ARG_TYPE_2 0x0002000U
-/** opt_state_mask_t - bit 3 of arg type enum */
+/** bit 3 of arg type enum */
#define OPTST_ARG_TYPE_3 0x0004000U
-/** opt_state_mask_t - bit 4 of arg type enum */
+/** bit 4 of arg type enum */
#define OPTST_ARG_TYPE_4 0x0008000U
-/** opt_state_mask_t - the option arg not required */
+/** the option arg not required */
#define OPTST_ARG_OPTIONAL 0x0010000U
-/** opt_state_mask_t - process opt on first pass */
+/** process opt on first pass */
#define OPTST_IMM 0x0020000U
-/** opt_state_mask_t - process disablement immed. */
+/** process disablement immed. */
#define OPTST_DISABLE_IMM 0x0040000U
-/** opt_state_mask_t - compiled out of program */
+/** compiled out of program */
#define OPTST_OMITTED 0x0080000U
-/** opt_state_mask_t - must be set or pre-set */
+/** must be set or pre-set */
#define OPTST_MUST_SET 0x0100000U
-/** opt_state_mask_t - opt is for doc only */
+/** opt is for doc only */
#define OPTST_DOCUMENT 0x0200000U
-/** opt_state_mask_t - process opt twice - imm + reg */
+/** process opt twice - imm + reg */
#define OPTST_TWICE 0x0400000U
-/** opt_state_mask_t - process disabled option twice */
+/** process disabled option twice */
#define OPTST_DISABLE_TWICE 0x0800000U
-/** opt_state_mask_t - scaled integer value */
+/** scaled integer value */
#define OPTST_SCALED_NUM 0x1000000U
-/** opt_state_mask_t - disable from cmd line */
+/** disable from cmd line */
#define OPTST_NO_COMMAND 0x2000000U
-/** opt_state_mask_t - support is being removed */
+/** support is being removed */
#define OPTST_DEPRECATED 0x4000000U
-/** opt_state_mask_t - alias for other option */
+/** alias for other option */
#define OPTST_ALIAS 0x8000000U
/** bits in SET mask:
@@ -333,50 +333,50 @@ typedef uint32_t opt_state_mask_t;
typedef uint32_t proc_state_mask_t;
/** bits defined for proc_state_mask_t */
-/** proc_state_mask_t - Process long style options */
+/** Process long style options */
#define OPTPROC_LONGOPT 0x000001U
-/** proc_state_mask_t - Process short style "flags" */
+/** Process short style "flags" */
#define OPTPROC_SHORTOPT 0x000002U
-/** proc_state_mask_t - Stop on argument errors */
+/** Stop on argument errors */
#define OPTPROC_ERRSTOP 0x000004U
-/** proc_state_mask_t - Current option is disabled */
+/** Current option is disabled */
#define OPTPROC_DISABLEDOPT 0x000008U
-/** proc_state_mask_t - no options are required */
+/** no options are required */
#define OPTPROC_NO_REQ_OPT 0x000010U
-/** proc_state_mask_t - there is a number option */
+/** there is a number option */
#define OPTPROC_NUM_OPT 0x000020U
-/** proc_state_mask_t - have inits been done? */
+/** have inits been done? */
#define OPTPROC_INITDONE 0x000040U
-/** proc_state_mask_t - any negation options? */
+/** any negation options? */
#define OPTPROC_NEGATIONS 0x000080U
-/** proc_state_mask_t - check environment? */
+/** check environment? */
#define OPTPROC_ENVIRON 0x000100U
-/** proc_state_mask_t - Disallow remaining arguments */
+/** Disallow remaining arguments */
#define OPTPROC_NO_ARGS 0x000200U
-/** proc_state_mask_t - Require args after options */
+/** Require args after options */
#define OPTPROC_ARGS_REQ 0x000400U
-/** proc_state_mask_t - reorder operands after opts */
+/** reorder operands after opts */
#define OPTPROC_REORDER 0x000800U
-/** proc_state_mask_t - emit usage in GNU style */
+/** emit usage in GNU style */
#define OPTPROC_GNUUSAGE 0x001000U
-/** proc_state_mask_t - Translate strings in tOptions */
+/** Translate strings in tOptions */
#define OPTPROC_TRANSLATE 0x002000U
-/** proc_state_mask_t - no usage on usage error */
+/** no usage on usage error */
#define OPTPROC_MISUSE 0x004000U
-/** proc_state_mask_t - immediate options active */
+/** immediate options active */
#define OPTPROC_IMMEDIATE 0x008000U
-/** proc_state_mask_t - suppress for config only */
+/** suppress for config only */
#define OPTPROC_NXLAT_OPT_CFG 0x010000U
-/** proc_state_mask_t - suppress xlation always */
+/** suppress xlation always */
#define OPTPROC_NXLAT_OPT 0x020000U
-/** proc_state_mask_t - vendor options active */
+/** vendor options active */
#define OPTPROC_VENDOR_OPT 0x040000U
-/** proc_state_mask_t - opt processing in preset state */
+/** opt processing in preset state */
#define OPTPROC_PRESETTING 0x080000U
-/** proc_state_mask_t - Ignore pzFullUsage, compute usage text */
+/** Ignore pzFullUsage, compute usage text */
#define OPTPROC_COMPUTE 0x100000U
-/** proc_state_mask_t - Program outputs digested option state for shell scripts.
-Usage text always written to stderr */
+/** Program outputs digested option state for shell scripts. Usage text
+ * always written to stderr */
#define OPTPROC_SHELL_OUTPUT 0x200000U
/** bits in NO_XLAT mask:
diff --git a/src/libopts/autoopts/usage-txt.h b/src/libopts/autoopts/usage-txt.h
index 83fa23ca10..be2d6fd007 100644
--- a/src/libopts/autoopts/usage-txt.h
+++ b/src/libopts/autoopts/usage-txt.h
@@ -2,7 +2,7 @@
*
* DO NOT EDIT THIS FILE (usage-txt.h)
*
- * It has been AutoGen-ed July 14, 2013 at 05:37:10 PM by AutoGen 5.18
+ * It has been AutoGen-ed October 16, 2013 at 01:46:18 PM by AutoGen 5.18.2
* From the definitions usage-txt.def
* and the template file usage-txt.tpl
*
@@ -388,7 +388,7 @@ static void dummy_func(void) {
puts(_("could not locate the 'help' option"));
#line 336 "../autoopts.c"
puts(_("optionProcess() was called with invalid data"));
-#line 747 "../usage.c"
+#line 748 "../usage.c"
puts(_("invalid argument type specified"));
#line 598 "../find.c"
puts(_("defaulted to option with optional arg"));
@@ -437,9 +437,9 @@ static void dummy_func(void) {
puts(_(" or an integer from %d through %d\n"));
#line 169 "../enum.c"
puts(_(" or an integer from %d through %d\n"));
-#line 746 "../usage.c"
+#line 747 "../usage.c"
puts(_("%s error: invalid option descriptor for %s\n"));
-#line 1080 "../usage.c"
+#line 1081 "../usage.c"
puts(_("%s error: invalid option descriptor for %s\n"));
#line 385 "../find.c"
puts(_("%s: invalid option name: %s\n"));
@@ -480,7 +480,7 @@ static void dummy_func(void) {
puts(_("%s error: '%s' is not a recognizable number.\n"));
#line 200 "../enum.c"
puts(_("%s error: %s exceeds %s keyword count\n"));
-#line 329 "../usage.c"
+#line 330 "../usage.c"
puts(_("Try '%s %s' for more information.\n"));
#line 45 "../alias.c"
puts(_("one %s%s option allowed\n"));
@@ -490,17 +490,17 @@ static void dummy_func(void) {
puts(_("standard output"));
#line 274 "../usage.c"
puts(_("standard output"));
-#line 414 "../usage.c"
+#line 415 "../usage.c"
puts(_("standard output"));
-#line 624 "../usage.c"
+#line 625 "../usage.c"
puts(_("standard output"));
#line 175 "../version.c"
puts(_("standard output"));
#line 274 "../usage.c"
puts(_("standard error"));
-#line 414 "../usage.c"
+#line 415 "../usage.c"
puts(_("standard error"));
-#line 624 "../usage.c"
+#line 625 "../usage.c"
puts(_("standard error"));
#line 175 "../version.c"
puts(_("standard error"));
@@ -510,9 +510,9 @@ static void dummy_func(void) {
puts(_("write"));
#line 273 "../usage.c"
puts(_("write"));
-#line 413 "../usage.c"
+#line 414 "../usage.c"
puts(_("write"));
-#line 623 "../usage.c"
+#line 624 "../usage.c"
puts(_("write"));
#line 174 "../version.c"
puts(_("write"));
@@ -533,29 +533,29 @@ static void dummy_func(void) {
/* END-LIBOPTS-MESSAGES */
/* USAGE-TEXT: */
-#line 872 "../usage.c"
+#line 873 "../usage.c"
puts(_("\t\t\t\t- an alternate for '%s'\n"));
-#line 1147 "../usage.c"
+#line 1148 "../usage.c"
puts(_("Version, usage and configuration options:"));
-#line 923 "../usage.c"
+#line 924 "../usage.c"
puts(_("\t\t\t\t- default option for unnamed options\n"));
-#line 836 "../usage.c"
+#line 837 "../usage.c"
puts(_("\t\t\t\t- disabled as '--%s'\n"));
-#line 1116 "../usage.c"
+#line 1117 "../usage.c"
puts(_(" --- %-14s %s\n"));
-#line 1114 "../usage.c"
+#line 1115 "../usage.c"
puts(_("This option has been disabled"));
-#line 863 "../usage.c"
+#line 864 "../usage.c"
puts(_("\t\t\t\t- enabled by default\n"));
#line 40 "../alias.c"
puts(_("%s error: only "));
-#line 1193 "../usage.c"
+#line 1194 "../usage.c"
puts(_(" - examining environment variables named %s_*\n"));
#line 168 "../file.c"
puts(_("\t\t\t\t- file must not pre-exist\n"));
#line 172 "../file.c"
puts(_("\t\t\t\t- file must pre-exist\n"));
-#line 379 "../usage.c"
+#line 380 "../usage.c"
puts(_("Options are specified by doubled hyphens and their name or by a single\n"
"hyphen and the flag character.\n"));
#line 916 "../makeshell.c"
@@ -565,33 +565,33 @@ static void dummy_func(void) {
"a shell script to parse the options for %s:\n\n"));
#line 166 "../enum.c"
puts(_(" or an integer mask with any of the lower %d bits set\n"));
-#line 896 "../usage.c"
+#line 897 "../usage.c"
puts(_("\t\t\t\t- is a set membership option\n"));
-#line 917 "../usage.c"
+#line 918 "../usage.c"
puts(_("\t\t\t\t- must appear between %d and %d times\n"));
-#line 381 "../usage.c"
+#line 382 "../usage.c"
puts(_("Options are specified by single or double hyphens and their name.\n"));
-#line 903 "../usage.c"
+#line 904 "../usage.c"
puts(_("\t\t\t\t- may appear multiple times\n"));
-#line 890 "../usage.c"
+#line 891 "../usage.c"
puts(_("\t\t\t\t- may not be preset\n"));
-#line 1308 "../usage.c"
+#line 1309 "../usage.c"
puts(_(" Arg Option-Name Description\n"));
-#line 1244 "../usage.c"
- puts(_(" Flg Arg Option-Name Description\n"));
-#line 1302 "../usage.c"
+#line 1245 "../usage.c"
puts(_(" Flg Arg Option-Name Description\n"));
#line 1303 "../usage.c"
+ puts(_(" Flg Arg Option-Name Description\n"));
+#line 1304 "../usage.c"
puts(_(" %3s %s"));
-#line 1309 "../usage.c"
+#line 1310 "../usage.c"
puts(_(" %3s %s"));
-#line 386 "../usage.c"
+#line 387 "../usage.c"
puts(_("The '-#<number>' option may omit the hash char\n"));
-#line 382 "../usage.c"
+#line 383 "../usage.c"
puts(_("All arguments are named options.\n"));
-#line 970 "../usage.c"
+#line 971 "../usage.c"
puts(_(" - reading file %s"));
-#line 408 "../usage.c"
+#line 409 "../usage.c"
puts(_("\n"
"Please send bug reports to: <%s>\n"));
#line 100 "../version.c"
@@ -600,17 +600,17 @@ static void dummy_func(void) {
#line 129 "../version.c"
puts(_("\n"
"Please send bug reports to: <%s>\n"));
-#line 902 "../usage.c"
+#line 903 "../usage.c"
puts(_("\t\t\t\t- may NOT appear - preset only\n"));
-#line 943 "../usage.c"
+#line 944 "../usage.c"
puts(_("\n"
"The following option preset mechanisms are supported:\n"));
-#line 1191 "../usage.c"
+#line 1192 "../usage.c"
puts(_("\n"
"The following option preset mechanisms are supported:\n"));
-#line 681 "../usage.c"
+#line 682 "../usage.c"
puts(_("prohibits these options:\n"));
-#line 676 "../usage.c"
+#line 677 "../usage.c"
puts(_("prohibits the option '%s'\n"));
#line 81 "../numeric.c"
puts(_("%s%ld to %ld"));
@@ -628,28 +628,28 @@ static void dummy_func(void) {
puts(_("%sis scalable with a suffix: k/K/m/M/g/G/t/T\n"));
#line 77 "../numeric.c"
puts(_("%sless than or equal to %ld"));
-#line 389 "../usage.c"
+#line 390 "../usage.c"
puts(_("Operands and options may be intermixed. They will be reordered.\n"));
-#line 651 "../usage.c"
+#line 652 "../usage.c"
puts(_("requires the option '%s'\n"));
-#line 654 "../usage.c"
+#line 655 "../usage.c"
puts(_("requires these options:\n"));
-#line 1320 "../usage.c"
+#line 1321 "../usage.c"
puts(_(" Arg Option-Name Req? Description\n"));
-#line 1314 "../usage.c"
+#line 1315 "../usage.c"
puts(_(" Flg Arg Option-Name Req? Description\n"));
#line 167 "../enum.c"
puts(_("or you may use a numeric representation. Preceding these with a '!'\n"
"will clear the bits, specifying 'none' will clear all bits, and 'all'\n"
"will set them all. Multiple entries may be passed as an option\n"
"argument list.\n"));
-#line 909 "../usage.c"
+#line 910 "../usage.c"
puts(_("\t\t\t\t- may appear up to %d times\n"));
#line 77 "../enum.c"
puts(_("The valid \"%s\" option keywords are:\n"));
-#line 1151 "../usage.c"
+#line 1152 "../usage.c"
puts(_("The next option supports vendor supported extra options:"));
-#line 772 "../usage.c"
+#line 773 "../usage.c"
puts(_("These additional options are:"));
/* END-USAGE-TEXT */
}
diff --git a/src/libopts/compat/compat.h b/src/libopts/compat/compat.h
index e7b30ea3ab..ebb3157b83 100644
--- a/src/libopts/compat/compat.h
+++ b/src/libopts/compat/compat.h
@@ -237,7 +237,7 @@
#endif
#if !defined (MAXPATHLEN)
-# define MAXPATHLEN ((size_t)4096)
+# define MAXPATHLEN 4096
#endif /* MAXPATHLEN */
#define AG_PATH_MAX ((size_t)MAXPATHLEN)
diff --git a/src/libopts/compat/strchr.c b/src/libopts/compat/strchr.c
index 0def700f86..f40938707b 100644
--- a/src/libopts/compat/strchr.c
+++ b/src/libopts/compat/strchr.c
@@ -34,7 +34,7 @@ static char *
strchr(char const *s, int c)
{
do {
- if ((unsigned)*s == (unsigned)c)
+ if ((unsigned char)*s == (unsigned char)c)
return s;
} while (*(++s) != NUL);
@@ -51,7 +51,7 @@ strrchr(char const *s, int c)
if (--e < s)
break;
- if ((unsigned)*e == (unsigned)c)
+ if ((unsigned char)*e == (unsigned char)c)
return e;
}
return NULL;
diff --git a/src/libopts/configfile.c b/src/libopts/configfile.c
index 3b90cdc57a..d96d71cd7a 100644
--- a/src/libopts/configfile.c
+++ b/src/libopts/configfile.c
@@ -415,12 +415,18 @@ file_preset(tOptions * opts, char const * fname, int dir)
tmap_info_t cfgfile;
tOptState optst = OPTSTATE_INITIALIZER(PRESET);
opt_state_mask_t st_flags = optst.flags;
+ opt_state_mask_t fl_save = opts->fOptSet;
char * ftext =
text_mmap(fname, PROT_READ|PROT_WRITE, MAP_PRIVATE, &cfgfile);
if (TEXT_MMAP_FAILED_ADDR(ftext))
return;
+ /*
+ * While processing config files, we ignore errors.
+ */
+ opts->fOptSet &= ~OPTPROC_ERRSTOP;
+
if (dir == DIRECTION_CALLED) {
st_flags = OPTST_DEFINED;
dir = DIRECTION_PROCESS;
@@ -483,6 +489,7 @@ file_preset(tOptions * opts, char const * fname, int dir)
all_done:
text_munmap(&cfgfile);
+ opts->fOptSet = fl_save;
}
/**
diff --git a/src/libopts/genshell.c b/src/libopts/genshell.c
index 173704ee03..37b22abc07 100644
--- a/src/libopts/genshell.c
+++ b/src/libopts/genshell.c
@@ -2,11 +2,11 @@
*
* DO NOT EDIT THIS FILE (genshell.c)
*
- * It has been AutoGen-ed July 14, 2013 at 05:37:09 PM by AutoGen 5.18
+ * It has been AutoGen-ed October 16, 2013 at 01:46:16 PM by AutoGen 5.18.2
* From the definitions genshell.def
* and the template file options
*
- * Generated from AutoOpts 40:0:15 templates.
+ * Generated from AutoOpts 40:1:15 templates.
*
* AutoOpts is a copyrighted work. This source file is not encumbered
* by AutoOpts licensing, but is provided under the licensing terms chosen
@@ -290,10 +290,11 @@ doUsageOpt(tOptions * opts, tOptDesc * od)
ex_code = GENSHELLOPT_EXIT_SUCCESS;
genshelloptUsage(&genshelloptOptions, ex_code);
/* NOTREACHED */
+ exit(1);
(void)opts;
(void)od;
}
-/* extracted from optmain.tlib near line 1266 */
+/* extracted from optmain.tlib near line 1245 */
/**
* The directory containing the data associated with genshellopt.
@@ -574,7 +575,7 @@ by the newly generated text. The first '#!' line will be regenerated.\n"));
puts(_("could not locate the 'help' option"));
#line 336 "../autoopts.c"
puts(_("optionProcess() was called with invalid data"));
-#line 747 "../usage.c"
+#line 748 "../usage.c"
puts(_("invalid argument type specified"));
#line 598 "../find.c"
puts(_("defaulted to option with optional arg"));
@@ -623,9 +624,9 @@ by the newly generated text. The first '#!' line will be regenerated.\n"));
puts(_(" or an integer from %d through %d\n"));
#line 169 "../enum.c"
puts(_(" or an integer from %d through %d\n"));
-#line 746 "../usage.c"
+#line 747 "../usage.c"
puts(_("%s error: invalid option descriptor for %s\n"));
-#line 1080 "../usage.c"
+#line 1081 "../usage.c"
puts(_("%s error: invalid option descriptor for %s\n"));
#line 385 "../find.c"
puts(_("%s: invalid option name: %s\n"));
@@ -666,7 +667,7 @@ by the newly generated text. The first '#!' line will be regenerated.\n"));
puts(_("%s error: '%s' is not a recognizable number.\n"));
#line 200 "../enum.c"
puts(_("%s error: %s exceeds %s keyword count\n"));
-#line 329 "../usage.c"
+#line 330 "../usage.c"
puts(_("Try '%s %s' for more information.\n"));
#line 45 "../alias.c"
puts(_("one %s%s option allowed\n"));
@@ -676,17 +677,17 @@ by the newly generated text. The first '#!' line will be regenerated.\n"));
puts(_("standard output"));
#line 274 "../usage.c"
puts(_("standard output"));
-#line 414 "../usage.c"
+#line 415 "../usage.c"
puts(_("standard output"));
-#line 624 "../usage.c"
+#line 625 "../usage.c"
puts(_("standard output"));
#line 175 "../version.c"
puts(_("standard output"));
#line 274 "../usage.c"
puts(_("standard error"));
-#line 414 "../usage.c"
+#line 415 "../usage.c"
puts(_("standard error"));
-#line 624 "../usage.c"
+#line 625 "../usage.c"
puts(_("standard error"));
#line 175 "../version.c"
puts(_("standard error"));
@@ -696,9 +697,9 @@ by the newly generated text. The first '#!' line will be regenerated.\n"));
puts(_("write"));
#line 273 "../usage.c"
puts(_("write"));
-#line 413 "../usage.c"
+#line 414 "../usage.c"
puts(_("write"));
-#line 623 "../usage.c"
+#line 624 "../usage.c"
puts(_("write"));
#line 174 "../version.c"
puts(_("write"));
@@ -719,29 +720,29 @@ by the newly generated text. The first '#!' line will be regenerated.\n"));
/* END-LIBOPTS-MESSAGES */
/* USAGE-TEXT: */
-#line 872 "../usage.c"
+#line 873 "../usage.c"
puts(_("\t\t\t\t- an alternate for '%s'\n"));
-#line 1147 "../usage.c"
+#line 1148 "../usage.c"
puts(_("Version, usage and configuration options:"));
-#line 923 "../usage.c"
+#line 924 "../usage.c"
puts(_("\t\t\t\t- default option for unnamed options\n"));
-#line 836 "../usage.c"
+#line 837 "../usage.c"
puts(_("\t\t\t\t- disabled as '--%s'\n"));
-#line 1116 "../usage.c"
+#line 1117 "../usage.c"
puts(_(" --- %-14s %s\n"));
-#line 1114 "../usage.c"
+#line 1115 "../usage.c"
puts(_("This option has been disabled"));
-#line 863 "../usage.c"
+#line 864 "../usage.c"
puts(_("\t\t\t\t- enabled by default\n"));
#line 40 "../alias.c"
puts(_("%s error: only "));
-#line 1193 "../usage.c"
+#line 1194 "../usage.c"
puts(_(" - examining environment variables named %s_*\n"));
#line 168 "../file.c"
puts(_("\t\t\t\t- file must not pre-exist\n"));
#line 172 "../file.c"
puts(_("\t\t\t\t- file must pre-exist\n"));
-#line 379 "../usage.c"
+#line 380 "../usage.c"
puts(_("Options are specified by doubled hyphens and their name or by a single\n"
"hyphen and the flag character.\n"));
#line 916 "../makeshell.c"
@@ -751,33 +752,33 @@ by the newly generated text. The first '#!' line will be regenerated.\n"));
"a shell script to parse the options for %s:\n\n"));
#line 166 "../enum.c"
puts(_(" or an integer mask with any of the lower %d bits set\n"));
-#line 896 "../usage.c"
+#line 897 "../usage.c"
puts(_("\t\t\t\t- is a set membership option\n"));
-#line 917 "../usage.c"
+#line 918 "../usage.c"
puts(_("\t\t\t\t- must appear between %d and %d times\n"));
-#line 381 "../usage.c"
+#line 382 "../usage.c"
puts(_("Options are specified by single or double hyphens and their name.\n"));
-#line 903 "../usage.c"
+#line 904 "../usage.c"
puts(_("\t\t\t\t- may appear multiple times\n"));
-#line 890 "../usage.c"
+#line 891 "../usage.c"
puts(_("\t\t\t\t- may not be preset\n"));
-#line 1308 "../usage.c"
+#line 1309 "../usage.c"
puts(_(" Arg Option-Name Description\n"));
-#line 1244 "../usage.c"
- puts(_(" Flg Arg Option-Name Description\n"));
-#line 1302 "../usage.c"
+#line 1245 "../usage.c"
puts(_(" Flg Arg Option-Name Description\n"));
#line 1303 "../usage.c"
+ puts(_(" Flg Arg Option-Name Description\n"));
+#line 1304 "../usage.c"
puts(_(" %3s %s"));
-#line 1309 "../usage.c"
+#line 1310 "../usage.c"
puts(_(" %3s %s"));
-#line 386 "../usage.c"
+#line 387 "../usage.c"
puts(_("The '-#<number>' option may omit the hash char\n"));
-#line 382 "../usage.c"
+#line 383 "../usage.c"
puts(_("All arguments are named options.\n"));
-#line 970 "../usage.c"
+#line 971 "../usage.c"
puts(_(" - reading file %s"));
-#line 408 "../usage.c"
+#line 409 "../usage.c"
puts(_("\n"
"Please send bug reports to: <%s>\n"));
#line 100 "../version.c"
@@ -786,17 +787,17 @@ by the newly generated text. The first '#!' line will be regenerated.\n"));
#line 129 "../version.c"
puts(_("\n"
"Please send bug reports to: <%s>\n"));
-#line 902 "../usage.c"
+#line 903 "../usage.c"
puts(_("\t\t\t\t- may NOT appear - preset only\n"));
-#line 943 "../usage.c"
+#line 944 "../usage.c"
puts(_("\n"
"The following option preset mechanisms are supported:\n"));
-#line 1191 "../usage.c"
+#line 1192 "../usage.c"
puts(_("\n"
"The following option preset mechanisms are supported:\n"));
-#line 681 "../usage.c"
+#line 682 "../usage.c"
puts(_("prohibits these options:\n"));
-#line 676 "../usage.c"
+#line 677 "../usage.c"
puts(_("prohibits the option '%s'\n"));
#line 81 "../numeric.c"
puts(_("%s%ld to %ld"));
@@ -814,28 +815,28 @@ by the newly generated text. The first '#!' line will be regenerated.\n"));
puts(_("%sis scalable with a suffix: k/K/m/M/g/G/t/T\n"));
#line 77 "../numeric.c"
puts(_("%sless than or equal to %ld"));
-#line 389 "../usage.c"
+#line 390 "../usage.c"
puts(_("Operands and options may be intermixed. They will be reordered.\n"));
-#line 651 "../usage.c"
+#line 652 "../usage.c"
puts(_("requires the option '%s'\n"));
-#line 654 "../usage.c"
+#line 655 "../usage.c"
puts(_("requires these options:\n"));
-#line 1320 "../usage.c"
+#line 1321 "../usage.c"
puts(_(" Arg Option-Name Req? Description\n"));
-#line 1314 "../usage.c"
+#line 1315 "../usage.c"
puts(_(" Flg Arg Option-Name Req? Description\n"));
#line 167 "../enum.c"
puts(_("or you may use a numeric representation. Preceding these with a '!'\n"
"will clear the bits, specifying 'none' will clear all bits, and 'all'\n"
"will set them all. Multiple entries may be passed as an option\n"
"argument list.\n"));
-#line 909 "../usage.c"
+#line 910 "../usage.c"
puts(_("\t\t\t\t- may appear up to %d times\n"));
#line 77 "../enum.c"
puts(_("The valid \"%s\" option keywords are:\n"));
-#line 1151 "../usage.c"
+#line 1152 "../usage.c"
puts(_("The next option supports vendor supported extra options:"));
-#line 772 "../usage.c"
+#line 773 "../usage.c"
puts(_("These additional options are:"));
/* END-USAGE-TEXT */
}
diff --git a/src/libopts/genshell.h b/src/libopts/genshell.h
index dd5b75426b..9ae53720d6 100644
--- a/src/libopts/genshell.h
+++ b/src/libopts/genshell.h
@@ -2,11 +2,11 @@
*
* DO NOT EDIT THIS FILE (genshell.h)
*
- * It has been AutoGen-ed July 14, 2013 at 05:37:09 PM by AutoGen 5.18
+ * It has been AutoGen-ed October 16, 2013 at 01:46:16 PM by AutoGen 5.18.2
* From the definitions genshell.def
* and the template file options
*
- * Generated from AutoOpts 40:0:15 templates.
+ * Generated from AutoOpts 40:1:15 templates.
*
* AutoOpts is a copyrighted work. This header file is not encumbered
* by AutoOpts licensing, but is provided under the licensing terms chosen
@@ -55,7 +55,7 @@
* tolerable version is at least as old as what was current when the header
* template was released.
*/
-#define AO_TEMPLATE_VERSION 163840
+#define AO_TEMPLATE_VERSION 163841
#if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
|| (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
# error option template version mismatches autoopts/options.h header
diff --git a/src/libopts/m4/libopts.m4 b/src/libopts/m4/libopts.m4
index 961ea1ddcd..e6b54061a1 100644
--- a/src/libopts/m4/libopts.m4
+++ b/src/libopts/m4/libopts.m4
@@ -2,7 +2,7 @@ dnl -*- buffer-read-only: t -*- vi: set ro:
dnl
dnl DO NOT EDIT THIS FILE (libopts.m4)
dnl
-dnl It has been AutoGen-ed July 14, 2013 at 05:37:02 PM by AutoGen 5.18
+dnl It has been AutoGen-ed October 16, 2013 at 01:46:09 PM by AutoGen 5.18.2
dnl From the definitions libopts.def
dnl and the template file conftest.tpl
dnl
@@ -589,4 +589,3 @@ AC_DEFUN([LIBOPTS_CHECK], [
m4_popdef([AO_Libopts_Dir])dnl
# end of AC_DEFUN of LIBOPTS_CHECK
])
-
diff --git a/src/libopts/option-value-type.c b/src/libopts/option-value-type.c
index 0cf3394c32..458584dc40 100644
--- a/src/libopts/option-value-type.c
+++ b/src/libopts/option-value-type.c
@@ -2,7 +2,7 @@
*
* DO NOT EDIT THIS FILE (stdin.c)
*
- * It has been AutoGen-ed July 14, 2013 at 05:37:08 PM by AutoGen 5.18
+ * It has been AutoGen-ed October 16, 2013 at 01:46:15 PM by AutoGen 5.18.2
* From the definitions stdin
* and the template file str2enum
*
@@ -31,7 +31,7 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "option-value-type.h"
-/* ANSI-C code produced by gperf version 3.0.4 */
+/* ANSI-C code produced by gperf version 3.0.3 */
/* Command-line: gperf option-value-type.gp */
/* Computed positions: -k'1' */
diff --git a/src/libopts/option-value-type.h b/src/libopts/option-value-type.h
index 192e71b925..8a16a0fa6f 100644
--- a/src/libopts/option-value-type.h
+++ b/src/libopts/option-value-type.h
@@ -2,7 +2,7 @@
*
* DO NOT EDIT THIS FILE (stdin.h)
*
- * It has been AutoGen-ed July 14, 2013 at 05:37:08 PM by AutoGen 5.18
+ * It has been AutoGen-ed October 16, 2013 at 01:46:15 PM by AutoGen 5.18.2
* From the definitions stdin
* and the template file str2enum
*
diff --git a/src/libopts/option-xat-attribute.c b/src/libopts/option-xat-attribute.c
index 10ff870c7c..c8ef1e0a6a 100644
--- a/src/libopts/option-xat-attribute.c
+++ b/src/libopts/option-xat-attribute.c
@@ -2,7 +2,7 @@
*
* DO NOT EDIT THIS FILE (stdin.c)
*
- * It has been AutoGen-ed July 14, 2013 at 05:37:07 PM by AutoGen 5.18
+ * It has been AutoGen-ed October 16, 2013 at 01:46:14 PM by AutoGen 5.18.2
* From the definitions stdin
* and the template file str2enum
*
@@ -31,7 +31,7 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "option-xat-attribute.h"
-/* ANSI-C code produced by gperf version 3.0.4 */
+/* ANSI-C code produced by gperf version 3.0.3 */
/* Command-line: gperf option-xat-attribute.gp */
/* Computed positions: -k'1' */
diff --git a/src/libopts/option-xat-attribute.h b/src/libopts/option-xat-attribute.h
index 7d6386e729..5b7166a54e 100644
--- a/src/libopts/option-xat-attribute.h
+++ b/src/libopts/option-xat-attribute.h
@@ -2,7 +2,7 @@
*
* DO NOT EDIT THIS FILE (stdin.h)
*
- * It has been AutoGen-ed July 14, 2013 at 05:37:07 PM by AutoGen 5.18
+ * It has been AutoGen-ed October 16, 2013 at 01:46:14 PM by AutoGen 5.18.2
* From the definitions stdin
* and the template file str2enum
*
diff --git a/src/libopts/pgusage.c b/src/libopts/pgusage.c
index 5154410239..18a00100e1 100644
--- a/src/libopts/pgusage.c
+++ b/src/libopts/pgusage.c
@@ -50,7 +50,11 @@ open_tmp_usage(char ** buf)
}
{
+ static mode_t const cmask = S_IRWXO | S_IRWXG;
+ mode_t svmsk = umask(cmask);
int fd = mkstemp(bf);
+ (void)umask(svmsk);
+
if (fd < 0) {
AGFREE(bf);
return NULL;
diff --git a/src/libopts/proto.h b/src/libopts/proto.h
index 686879efb9..7b1837f8b2 100644
--- a/src/libopts/proto.h
+++ b/src/libopts/proto.h
@@ -1,7 +1,7 @@
/* -*- buffer-read-only: t -*- vi: set ro:
*
* Prototypes for autoopts
- * Generated Sun Jul 14 17:37:20 PDT 2013
+ * Generated Wed Oct 16 13:46:27 PDT 2013
*/
#ifndef AUTOOPTS_PROTO_H_GUARD
#define AUTOOPTS_PROTO_H_GUARD 1
diff --git a/src/libopts/streqvcmp.c b/src/libopts/streqvcmp.c
index 8fae58fac2..08cb637105 100644
--- a/src/libopts/streqvcmp.c
+++ b/src/libopts/streqvcmp.c
@@ -243,7 +243,7 @@ strequate(char const* s)
if ((s != NULL) && (*s != NUL)) {
unsigned char equiv = (unsigned char)*s;
while (*s != NUL)
- charmap[ (unsigned)*(s++) ] = equiv;
+ charmap[(unsigned char)*(s++)] = equiv;
}
}
@@ -270,7 +270,7 @@ void
strtransform(char* d, char const* s)
{
do {
- *(d++) = (char)charmap[ (unsigned)*s ];
+ *(d++) = (char)charmap[(unsigned char)*s];
} while (*(s++) != NUL);
}
diff --git a/src/libopts/text_mmap.c b/src/libopts/text_mmap.c
index 7085f3eb06..fac0c6414f 100644
--- a/src/libopts/text_mmap.c
+++ b/src/libopts/text_mmap.c
@@ -176,24 +176,6 @@ validate_mmap(char const * fname, int prot, int flags, tmap_info_t * mapinfo)
mapinfo->txt_flags = flags;
/*
- * Make sure we can stat the regular file. Save the file size.
- */
- {
- struct stat sb;
- if (stat(fname, &sb) != 0) {
- mapinfo->txt_errno = errno;
- return;
- }
-
- if (! S_ISREG(sb.st_mode)) {
- mapinfo->txt_errno = errno = EINVAL;
- return;
- }
-
- mapinfo->txt_size = (size_t)sb.st_size;
- }
-
- /*
* Map mmap flags and protections into open flags and do the open.
*/
{
@@ -213,6 +195,31 @@ validate_mmap(char const * fname, int prot, int flags, tmap_info_t * mapinfo)
o_flag |= O_EXCL;
mapinfo->txt_fd = open(fname, o_flag);
+ if (mapinfo->txt_fd < 0) {
+ mapinfo->txt_errno = errno;
+ mapinfo->txt_fd = AO_INVALID_FD;
+ return;
+ }
+ }
+
+ /*
+ * Make sure we can stat the regular file. Save the file size.
+ */
+ {
+ struct stat sb;
+ if (fstat(mapinfo->txt_fd, &sb) != 0) {
+ mapinfo->txt_errno = errno;
+ close(mapinfo->txt_fd);
+ return;
+ }
+
+ if (! S_ISREG(sb.st_mode)) {
+ mapinfo->txt_errno = errno = EINVAL;
+ close(mapinfo->txt_fd);
+ return;
+ }
+
+ mapinfo->txt_size = (size_t)sb.st_size;
}
if (mapinfo->txt_fd == AO_INVALID_FD)
diff --git a/src/libopts/usage.c b/src/libopts/usage.c
index da77c61b99..c7c9cd0f15 100644
--- a/src/libopts/usage.c
+++ b/src/libopts/usage.c
@@ -319,6 +319,7 @@ print_offer_usage(tOptions * opts)
case OPTPROC_LONGOPT:
case (OPTPROC_LONGOPT | OPTPROC_SHORTOPT):
strcpy(help, "--help");
+ break;
case 0:
strcpy(help, "help");