summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2019-10-11 14:44:39 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2019-10-30 10:39:11 +0100
commiteee623ff6463ad6ee837b43421a69965913d32e2 (patch)
treef41518e4e9c0c9904bbe8c8cebe7987bb8bda8cf /src
parentce8557344cbe9ac6f6326700e11673239a36129b (diff)
downloadgnutls-eee623ff6463ad6ee837b43421a69965913d32e2.tar.gz
updated to libopts 5.18.16
This fixes compilation in Fedora 30 which ships with this version of autogen. Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
Diffstat (limited to 'src')
-rw-r--r--src/libopts/_Noreturn.h10
-rw-r--r--src/libopts/ag-char-map.h4
-rw-r--r--src/libopts/alias.c4
-rw-r--r--src/libopts/ao-strs.c282
-rw-r--r--src/libopts/ao-strs.h296
-rw-r--r--src/libopts/autoopts.c22
-rw-r--r--src/libopts/autoopts.h12
-rw-r--r--src/libopts/autoopts/options.h16
-rw-r--r--src/libopts/autoopts/project.h6
-rw-r--r--src/libopts/autoopts/usage-txt.h500
-rw-r--r--src/libopts/boolean.c4
-rw-r--r--src/libopts/check.c4
-rw-r--r--src/libopts/compat/compat.h8
-rw-r--r--src/libopts/compat/pathfind.c2
-rw-r--r--src/libopts/compat/windows-config.h2
-rw-r--r--src/libopts/configfile.c97
-rw-r--r--src/libopts/cook.c53
-rw-r--r--src/libopts/enum.c27
-rw-r--r--src/libopts/env.c12
-rw-r--r--src/libopts/file.c2
-rw-r--r--src/libopts/find.c61
-rw-r--r--src/libopts/genshell.c233
-rw-r--r--src/libopts/genshell.h25
-rw-r--r--src/libopts/gettext.h18
-rw-r--r--src/libopts/init.c13
-rw-r--r--src/libopts/intprops.h265
-rw-r--r--src/libopts/libopts.c6
-rw-r--r--src/libopts/load.c30
-rw-r--r--src/libopts/m4/libopts.m428
-rw-r--r--src/libopts/m4/liboptschk.m42
-rw-r--r--src/libopts/m4/stdnoreturn.m466
-rw-r--r--src/libopts/makeshell.c64
-rw-r--r--src/libopts/nested.c77
-rw-r--r--src/libopts/numeric.c14
-rw-r--r--src/libopts/option-value-type.c10
-rw-r--r--src/libopts/option-xat-attribute.c10
-rw-r--r--src/libopts/parse-duration.c2
-rw-r--r--src/libopts/parse-duration.h4
-rw-r--r--src/libopts/pgusage.c2
-rw-r--r--src/libopts/proto.h508
-rw-r--r--src/libopts/putshell.c27
-rw-r--r--src/libopts/reset.c2
-rw-r--r--src/libopts/restore.c2
-rw-r--r--src/libopts/save-flags.c248
-rw-r--r--src/libopts/save-flags.h68
-rw-r--r--src/libopts/save.c519
-rw-r--r--src/libopts/sort.c18
-rw-r--r--src/libopts/stack.c4
-rw-r--r--src/libopts/stdnoreturn.in.h30
-rw-r--r--src/libopts/streqvcmp.c4
-rw-r--r--src/libopts/text_mmap.c15
-rw-r--r--src/libopts/time.c4
-rw-r--r--src/libopts/tokenize.c19
-rw-r--r--src/libopts/usage.c79
-rw-r--r--src/libopts/version.c11
55 files changed, 2322 insertions, 1529 deletions
diff --git a/src/libopts/_Noreturn.h b/src/libopts/_Noreturn.h
new file mode 100644
index 0000000000..c44ad89b7c
--- /dev/null
+++ b/src/libopts/_Noreturn.h
@@ -0,0 +1,10 @@
+#if !defined _Noreturn && __STDC_VERSION__ < 201112
+# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \
+ || 0x5110 <= __SUNPRO_C)
+# define _Noreturn __attribute__ ((__noreturn__))
+# elif 1200 <= _MSC_VER
+# define _Noreturn __declspec (noreturn)
+# else
+# define _Noreturn
+# endif
+#endif
diff --git a/src/libopts/ag-char-map.h b/src/libopts/ag-char-map.h
index d9961af222..cced2303ab 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 09/12/15 at 05:41:48
+ * generated by char-mapper on 08/26/18 at 10:44:22
*
* This file contains the character classifications
* used by AutoGen and AutoOpts for identifying tokens.
@@ -8,7 +8,7 @@
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2015 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2018 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
diff --git a/src/libopts/alias.c b/src/libopts/alias.c
index 49e1f1fdd1..231f275d50 100644
--- a/src/libopts/alias.c
+++ b/src/libopts/alias.c
@@ -12,7 +12,7 @@
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2015 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2018 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
@@ -31,7 +31,7 @@
* 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd
*/
-LOCAL tSuccess
+static tSuccess
too_many_occurrences(tOptions * opts, tOptDesc * od)
{
if ((opts->fOptSet & OPTPROC_ERRSTOP) != 0) {
diff --git a/src/libopts/ao-strs.c b/src/libopts/ao-strs.c
index 514eedc43d..7f59372601 100644
--- a/src/libopts/ao-strs.c
+++ b/src/libopts/ao-strs.c
@@ -6,7 +6,7 @@
* From the definitions ao-strs.def
* and the template file strings
*
- * Copyright (C) 2011-2015 Bruce Korb, all rights reserved.
+ * Copyright (C) 2011-2018 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
@@ -38,160 +38,164 @@
*/
#include "ao-strs.h"
-char const ao_strs_strtable[6670] =
+char const ao_strs_strtable[6714] =
/* 0 */ "-_^\0"
/* 4 */ " %s%s\n\0"
-/* 12 */ "auto-options\0"
-/* 25 */ "program\0"
-/* 33 */ "%%-%ds %%s\n\0"
-/* 45 */ "\n"
+/* 12 */ "<?auto-options\0"
+/* 27 */ "<?program\0"
+/* 37 */ "%%-%ds %%s\n\0"
+/* 49 */ "<?program %s>\n\0"
+/* 64 */ "\n"
"%s\n\n\0"
-/* 51 */ "=file\0"
-/* 57 */ "=Mbr\0"
-/* 62 */ "=Cplx\0"
-/* 68 */ "[=arg]\0"
-/* 75 */ "--%2$s%1$s\0"
-/* 86 */ "=Tim\0"
-/* 91 */ "none\0"
-/* 96 */ "# preset/initialization file\n"
+/* 70 */ "=file\0"
+/* 76 */ "=Mbr\0"
+/* 81 */ "=Cplx\0"
+/* 87 */ "[=arg]\0"
+/* 94 */ "--%2$s%1$s\0"
+/* 105 */ "=Tim\0"
+/* 110 */ "none\0"
+/* 115 */ "# preset/initialization file\n"
"# %s#\n\0"
-/* 134 */ " %3s %-14s %s\0"
-/* 148 */ "%s\0"
-/* 151 */ "T/F\0"
-/* 155 */ "\n"
+/* 153 */ " %3s %-14s %s\0"
+/* 167 */ "%s\0"
+/* 170 */ "T/F\0"
+/* 174 */ "\n"
"%s\n\n"
"%s\0"
-/* 163 */ "Fil\0"
-/* 167 */ "KWd\0"
-/* 171 */ "Mbr\0"
-/* 175 */ "Cpx\0"
-/* 179 */ "no \0"
-/* 183 */ "Num\0"
-/* 187 */ "opt\0"
-/* 191 */ "YES\0"
-/* 195 */ "Str\0"
-/* 199 */ "Tim\0"
-/* 203 */ "\t\t\t\t- \0"
-/* 210 */ "\t\t\t\t \0"
-/* 217 */ "\t\t\t\t-- and \0"
-/* 229 */ "\t\t\t\t%s\n\0"
-/* 237 */ " \0"
-/* 244 */ " \0"
-/* 250 */ " \0"
-/* 254 */ " \0"
-/* 257 */ "all\0"
-/* 261 */ " \t\n"
+/* 182 */ "Fil\0"
+/* 186 */ "KWd\0"
+/* 190 */ "Mbr\0"
+/* 194 */ "Cpx\0"
+/* 198 */ "no \0"
+/* 202 */ "Num\0"
+/* 206 */ "opt\0"
+/* 210 */ "YES\0"
+/* 214 */ "Str\0"
+/* 218 */ "Tim\0"
+/* 222 */ "\t\t\t\t- \0"
+/* 229 */ "\t\t\t\t \0"
+/* 236 */ "\t\t\t\t-- and \0"
+/* 248 */ "\t\t\t\t%s\n\0"
+/* 256 */ " \0"
+/* 263 */ " \0"
+/* 269 */ " \0"
+/* 273 */ " \0"
+/* 276 */ "all\0"
+/* 280 */ " \t\n"
":=\0"
-/* 267 */ "%s_%s_%d=\0"
-/* 277 */ "''\0"
-/* 280 */ " ;;\n\n\0"
-/* 293 */ "'\n\n\0"
-/* 297 */ "</%s>\n\0"
-/* 304 */ " %s\n\0"
-/* 310 */ "%%-%ds\0"
-/* 317 */ "\n"
+/* 286 */ "%s_%s_%d=\0"
+/* 296 */ "''\0"
+/* 299 */ " ;;\n\n\0"
+/* 312 */ "'\n\n\0"
+/* 316 */ "</%s>\n\0"
+/* 323 */ " %s\n\0"
+/* 329 */ "%%-%ds\0"
+/* 336 */ "\n"
"export %s_%s_%d\n\0"
-/* 335 */ "false\0"
-/* 341 */ " -* )\n\0"
-/* 351 */ "flag\0"
-/* 356 */ "INVALID-%d\0"
-/* 367 */ "*INVALID*\0"
-/* 377 */ "\\n\\\n\0"
-/* 382 */ " --* )\n\0"
-/* 393 */ "--\0"
-/* 396 */ "LONGUSAGE\0"
-/* 406 */ " %s\n\0"
-/* 422 */ "\\%03o\0"
-/* 428 */ "more\0"
-/* 433 */ "<%s type=nested>\n\0"
-/* 451 */ "%s\n\0"
-/* 455 */ "%s\n"
+/* 354 */ "false\0"
+/* 360 */ " -* )\n\0"
+/* 370 */ "flag\0"
+/* 375 */ "INVALID-%d\0"
+/* 386 */ "*INVALID*\0"
+/* 396 */ "\\n\\\n\0"
+/* 401 */ " --* )\n\0"
+/* 412 */ "--\0"
+/* 415 */ "LONGUSAGE\0"
+/* 425 */ " %s\n\0"
+/* 441 */ "\\%03o\0"
+/* 447 */ "more\0"
+/* 452 */ "<%s type=nested>\n\0"
+/* 470 */ "%s\n\0"
+/* 474 */ "%s\n"
" \0"
-/* 461 */ "OPT_ARG_NEEDED=NO\0"
-/* 479 */ "<%s/>\n\0"
-/* 486 */ "OPT_ARG_NEEDED=OK\0"
-/* 504 */ "\t\0"
-/* 506 */ "<%s>\0"
-/* 511 */ "option\0"
-/* 518 */ "\n"
+/* 480 */ "OPT_ARG_NEEDED=NO\0"
+/* 498 */ "<%s/>\n\0"
+/* 505 */ "OPT_ARG_NEEDED=OK\0"
+/* 523 */ "\t\0"
+/* 525 */ "<%s>\0"
+/* 530 */ "option\0"
+/* 537 */ "\n"
"export %s_%s\n\0"
-/* 533 */ "%s_%s=\0"
-/* 540 */ " | \0"
-/* 544 */ "PAGER\0"
-/* 550 */ "%1$s %2$s ; rm -f %2$s\0"
-/* 573 */ " + \0"
-/* 577 */ " puts(_(%s));\n\0"
-/* 593 */ "\\'\0"
-/* 596 */ "'%s'\0"
-/* 601 */ " -- %s\0"
-/* 608 */ "%s_%s_TEXT='\0"
-/* 621 */ "#! %s\n\0"
-/* 628 */ "\n"
+/* 552 */ "%s_%s=\0"
+/* 559 */ " | \0"
+/* 563 */ "PAGER\0"
+/* 569 */ "%1$s %2$s ; rm -f %2$s\0"
+/* 592 */ " + \0"
+/* 596 */ " puts(_(%s));\n\0"
+/* 612 */ "\\'\0"
+/* 615 */ "'%s'\0"
+/* 620 */ " -- %s\0"
+/* 627 */ "%s_%s_TEXT='\0"
+/* 640 */ "#! %s\n\0"
+/* 647 */ "\n"
"env | grep '^%s_'\n\0"
-/* 648 */ "=%1$lu # 0x%1$lX\n\0"
-/* 666 */ "stdout\0"
-/* 673 */ "%A %B %e, %Y at %r %Z\0"
-/* 695 */ "TMPDIR\0"
-/* 702 */ "%s/use-%u.XXXXXX\0"
-/* 719 */ "true\0"
-/* 724 */ "<%s type=%s>\0"
-/* 737 */ "VERSION\0"
-/* 745 */ "#x%02X;\0"
-/* 753 */ "OPT_ARG_NEEDED=YES\0"
-/* 772 */ "'\\''\0"
-/* 777 */ " '%s'\0"
-/* 783 */ "libopts misguessed length of string\n\0"
-/* 820 */ "\n"
+/* 667 */ "=%1$lu # 0x%1$lX\n\0"
+/* 685 */ "stdout\0"
+/* 692 */ "%A %B %e, %Y at %r %Z\0"
+/* 714 */ "TMPDIR\0"
+/* 721 */ "%s/use-%u.XXXXXX\0"
+/* 738 */ "true\0"
+/* 743 */ "<%s type=%s>\0"
+/* 756 */ "VERSION\0"
+/* 764 */ "#x%02X;\0"
+/* 772 */ "OPT_ARG_NEEDED=YES\0"
+/* 791 */ "\n"
+ "# %s -- %s\n\0"
+/* 804 */ "# DEFAULT: \0"
+/* 816 */ "'\\''\0"
+/* 821 */ " '%s'\0"
+/* 827 */ "libopts misguessed length of string\n\0"
+/* 864 */ "\n"
"OPTION_CT=0\n\0"
-/* 834 */ "set --\0"
-/* 841 */ "/tmp\0"
-/* 846 */ " ;;\n\n\0"
-/* 863 */ " '%c' )\n\0"
-/* 879 */ " '%s' )\n\0"
-/* 895 */ " '%s' | \\\n\0"
-/* 913 */ "<%1$s type=boolean>%2$s</%1$s>\n\0"
-/* 945 */ "# From the %s option definitions\n"
+/* 878 */ "set --\0"
+/* 885 */ "/tmp\0"
+/* 890 */ " ;;\n\n\0"
+/* 907 */ " '%c' )\n\0"
+/* 923 */ " '%s' )\n\0"
+/* 939 */ " '%s' | \\\n\0"
+/* 957 */ "<%1$s type=boolean>%2$s</%1$s>\n\0"
+/* 989 */ "# From the %s option definitions\n"
"#\n\0"
-/* 982 */ "echo 'Warning: Cannot load options files' >&2\0"
-/* 1029 */ "echo 'Warning: Cannot save options files' >&2\0"
-/* 1076 */ "echo 'Warning: Cannot suppress the loading of options files' >&2\0"
-/* 1142 */ "<%1$s type=integer>0x%2$lX</%1$s>\n\0"
-/* 1177 */ "%1$s_%2$s_TEXT='no %2$s text'\n\0"
-/* 1208 */ "%1$s_%2$s_MODE='%3$s'\n"
+/* 1026 */ "echo 'Warning: Cannot load options files' >&2\0"
+/* 1073 */ "echo 'Warning: Cannot save options files' >&2\0"
+/* 1120 */ "echo 'Warning: Cannot suppress the loading of options files' >&2\0"
+/* 1186 */ "<%1$s type=integer>0x%2$lX</%1$s>\n\0"
+/* 1221 */ "%1$s_%2$s_TEXT='no %2$s text'\n\0"
+/* 1252 */ "%1$s_%2$s_MODE='%3$s'\n"
"export %1$s_%2$s_MODE\n\0"
-/* 1253 */ "%1$s_%2$s='%3$s'\n"
+/* 1297 */ "%1$s_%2$s='%3$s'\n"
"export %1$s_%2$s\n\0"
-/* 1288 */ "%1$s_%2$s_CT=%3$d\n"
+/* 1332 */ "%1$s_%2$s_CT=%3$d\n"
"export %1$s_%2$s_CT\n\0"
-/* 1327 */ "OPTION_CT=%d\n"
+/* 1371 */ "OPTION_CT=%d\n"
"export OPTION_CT\n\0"
-/* 1358 */ "%1$s_%2$s=%3$s\n"
+/* 1402 */ "%1$s_%2$s=%3$s\n"
"export %1$s_%2$s\n\0"
-/* 1391 */ "%1$s_%2$s=%3$d # 0x%3$X\n"
+/* 1435 */ "%1$s_%2$s=%3$d # 0x%3$X\n"
"export %1$s_%2$s\n\0"
-/* 1433 */ " case \"${OPT_CODE}\" in\n\0"
-/* 1464 */ " if [ $%1$s_%2$s_CT -gt %3$u ] ; then\n"
+/* 1477 */ " case \"${OPT_CODE}\" in\n\0"
+/* 1508 */ " if [ $%1$s_%2$s_CT -gt %3$u ] ; then\n"
" echo 'Error: more than %3$d %2$s options'\n"
" echo \"$%1$s_USAGE_TEXT\"\n"
" exit 1\n"
" fi >&2\n\0"
-/* 1655 */ "test ${%1$s_%2$s_CT-0} -ge %3$u || {\n"
+/* 1699 */ "test ${%1$s_%2$s_CT-0} -ge %3$u || {\n"
" echo %1$s_%2$s has not been set\n"
" exit 1\n"
"} 1>&2\n\0"
-/* 1747 */ "test -n \"$%1$s_%2$s\" || {\n"
+/* 1791 */ "test -n \"$%1$s_%2$s\" || {\n"
" echo %1$s_%2$s has not been set\n"
" exit 1\n"
"} 1>&2\n\0"
-/* 1828 */ " echo \"$%s_%s_TEXT\"\n"
+/* 1872 */ " echo \"$%s_%s_TEXT\"\n"
" exit 0\n\0"
-/* 1879 */ "\n"
+/* 1923 */ "\n"
"# # # # # # # # # #\n"
"#\n"
"# END OF AUTOMATED OPTION PROCESSING\n"
"#\n"
"# # # # # # # # # # -- do not modify this marker --\n\0"
-/* 1995 */ " if [ -n \"${OPT_ARG_VAL}\" ]\n"
+/* 2039 */ " 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"
@@ -206,15 +210,15 @@ char const ao_strs_strtable[6670] =
"unset OPT_NAME || :\n"
"unset OPT_CODE || :\n"
"unset OPT_ARG_VAL || :\n\0"
-/* 2374 */ " OPT_CODE=`echo \"X${OPT_ARG}\"|sed 's/^X-*//'`\n"
+/* 2418 */ " 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"
-/* 2625 */ " OPT_CODE=`echo \"X${OPT_ARG}\" | sed 's/X-\\(.\\).*/\\1/'`\n"
+/* 2669 */ " OPT_CODE=`echo \"X${OPT_ARG}\" | sed 's/X-\\(.\\).*/\\1/'`\n"
" OPT_ARG=` echo \"X${OPT_ARG}\" | sed 's/X-.//'`\n\0"
-/* 2742 */ "\n"
+/* 2786 */ "\n"
"ARG_COUNT=$#\n"
"OPT_PROCESS=true\n"
"OPT_ARG=$1\n"
@@ -227,7 +231,7 @@ char const ao_strs_strtable[6670] =
" OPT_PROCESS=false\n"
" shift\n"
" ;;\n\0"
-/* 2949 */ " case \"${OPT_ARG_NEEDED}\" in\n"
+/* 2993 */ " case \"${OPT_ARG_NEEDED}\" in\n"
" NO )\n"
" OPT_ARG_VAL=''\n"
" ;;\n"
@@ -255,10 +259,10 @@ char const ao_strs_strtable[6670] =
" fi\n"
" ;;\n"
" esac\n\0"
-/* 3728 */ " %1$s_%2$s_CT=`expr ${%1$s_%2$s_CT} + 1`\n"
+/* 3772 */ " %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"
-/* 3852 */ "\n"
+/* 3896 */ "\n"
"if test -z \"${%1$s_%2$s}\"\n"
"then\n"
" %1$s_%2$s_CT=0\n"
@@ -268,16 +272,16 @@ char const ao_strs_strtable[6670] =
" %1$s_%2$s_1=${%1$s_%2$s}\n"
" export %1$s_%2$s_CT %1$s_%2$s_1\n"
"fi\n\0"
-/* 4010 */ " * )\n"
+/* 4054 */ " * )\n"
" OPT_PROCESS=false\n"
" ;;\n"
" esac\n\0"
-/* 4067 */ " %1$s_%2$s_CT=0\n"
+/* 4111 */ " %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"
-/* 4208 */ " if [ -n \"${%1$s_%2$s}\" ] && ${%1$s_%2$s_set} ; then\n"
+/* 4252 */ " if [ -n \"${%1$s_%2$s}\" ] && ${%1$s_%2$s_set} ; then\n"
" echo 'Error: duplicate %2$s option'\n"
" echo \"$%1$s_USAGE_TEXT\"\n"
" exit 1\n"
@@ -286,7 +290,7 @@ char const ao_strs_strtable[6670] =
" %1$s_%2$s='%3$s'\n"
" export %1$s_%2$s\n"
" OPT_NAME='%2$s'\n\0"
-/* 4525 */ "\n"
+/* 4569 */ "\n"
"ARG_COUNT=$#\n"
"OPT_ARG=$1\n"
"while [ $# -gt 0 ]\n"
@@ -294,7 +298,7 @@ char const ao_strs_strtable[6670] =
" OPT_ELEMENT=''\n"
" OPT_ARG_VAL=''\n"
" OPT_ARG=${1}\n\0"
-/* 4628 */ " case \"${OPT_ARG_NEEDED}\" in\n"
+/* 4672 */ " case \"${OPT_ARG_NEEDED}\" in\n"
" NO )\n"
" if [ -n \"${OPT_ARG}\" ]\n"
" then\n"
@@ -339,33 +343,33 @@ char const ao_strs_strtable[6670] =
" fi\n"
" ;;\n"
" esac\n\0"
-/* 5782 */ " echo \"$%s_LONGUSAGE_TEXT\" | ${PAGER-more}\n"
+/* 5826 */ " echo \"$%s_LONGUSAGE_TEXT\" | ${PAGER-more}\n"
" exit 0\n\0"
-/* 5856 */ "%s OF %s\n"
+/* 5900 */ "%s OF %s\n"
"#\n"
"# From here to the next `-- do not modify this marker --',\n"
"# the text has been generated %s\n\0"
-/* 5962 */ " eval %1$s_%2$s${OPT_ELEMENT}=true\n"
+/* 6006 */ " eval %1$s_%2$s${OPT_ELEMENT}=true\n"
" export %1$s_%2$s${OPT_ELEMENT}\n\0"
-/* 6052 */ " if [ -n \"${%1$s_%2$s}\" ] && ${%1$s_%2$s_set} ; then\n"
+/* 6096 */ " if [ -n \"${%1$s_%2$s}\" ] && ${%1$s_%2$s_set} ; then\n"
" echo 'Error: duplicate %2$s option'\n"
" echo \"$%1$s_USAGE_TEXT\"\n"
" exit 1\n"
" fi >&2\n"
" %1$s_%2$s_set=true\n"
" OPT_NAME='%2$s'\n\0"
-/* 6311 */ "\n"
+/* 6355 */ "\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\0"
-/* 6380 */ "\n"
+/* 6424 */ "\n"
"%1$s_%2$s=${%1$s_%2$s}\n"
"%1$s_%2$s_set=false\n"
"export %1$s_%2$s\n\0"
-/* 6442 */ "# # # # # # # # # # -- do not modify this marker --\n"
+/* 6486 */ "# # # # # # # # # # -- do not modify this marker --\n"
"#\n"
"# DO NOT EDIT THIS SECTION\n\0"
-/* 6525 */ " * )\n"
+/* 6569 */ " * )\n"
" echo Unknown %s: \"${OPT_CODE}\" >&2\n"
" echo \"$%s_USAGE_TEXT\" >&2\n"
" exit 1\n"
diff --git a/src/libopts/ao-strs.h b/src/libopts/ao-strs.h
index f9377e2853..95036ef726 100644
--- a/src/libopts/ao-strs.h
+++ b/src/libopts/ao-strs.h
@@ -6,7 +6,7 @@
* From the definitions ao-strs.def
* and the template file strings
*
- * Copyright (C) 2011-2015 Bruce Korb, all rights reserved.
+ * Copyright (C) 2011-2018 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
@@ -39,294 +39,300 @@
#ifndef STRINGS_AO_STRS_H_GUARD
#define STRINGS_AO_STRS_H_GUARD 1
/*
- * 143 strings in ao_strs_strtable string table
+ * 146 strings in ao_strs_strtable string table
*/
-#define ARG_BREAK_STR (ao_strs_strtable+261)
+#define ARG_BREAK_STR (ao_strs_strtable+280)
#define ARG_BREAK_STR_LEN 5
-#define ARG_BY_NUM_FMT (ao_strs_strtable+267)
+#define ARG_BY_NUM_FMT (ao_strs_strtable+286)
#define ARG_BY_NUM_FMT_LEN 9
-#define BOOL_ATR_FMT (ao_strs_strtable+913)
+#define BOOL_ATR_FMT (ao_strs_strtable+957)
#define BOOL_ATR_FMT_LEN 31
-#define CHK_MAX_COUNT (ao_strs_strtable+1464)
+#define CHK_MAX_COUNT (ao_strs_strtable+1508)
#define CHK_MAX_COUNT_LEN 190
-#define CHK_MIN_COUNT (ao_strs_strtable+1655)
+#define CHK_MIN_COUNT (ao_strs_strtable+1699)
#define CHK_MIN_COUNT_LEN 91
-#define CHK_ONE_REQUIRED (ao_strs_strtable+1747)
+#define CHK_ONE_REQUIRED (ao_strs_strtable+1791)
#define CHK_ONE_REQUIRED_LEN 80
-#define ECHO_N_EXIT (ao_strs_strtable+1828)
+#define ECHO_N_EXIT (ao_strs_strtable+1872)
#define ECHO_N_EXIT_LEN 50
-#define EMPTY_ARG (ao_strs_strtable+277)
+#define EMPTY_ARG (ao_strs_strtable+296)
#define EMPTY_ARG_LEN 2
-#define END_MARK (ao_strs_strtable+1879)
+#define END_MARK (ao_strs_strtable+1923)
#define END_MARK_LEN 115
-#define END_OPT_SEL_STR (ao_strs_strtable+280)
+#define END_OPT_SEL_STR (ao_strs_strtable+299)
#define END_OPT_SEL_STR_LEN 12
-#define END_PRE_FMT (ao_strs_strtable+945)
+#define END_PRE_FMT (ao_strs_strtable+989)
#define END_PRE_FMT_LEN 36
-#define END_SET_TEXT (ao_strs_strtable+293)
+#define END_SET_TEXT (ao_strs_strtable+312)
#define END_SET_TEXT_LEN 3
-#define END_XML_FMT (ao_strs_strtable+297)
+#define END_XML_FMT (ao_strs_strtable+316)
#define END_XML_FMT_LEN 6
-#define ENUM_ERR_LINE (ao_strs_strtable+304)
+#define ENUM_ERR_LINE (ao_strs_strtable+323)
#define ENUM_ERR_LINE_LEN 5
-#define ENUM_ERR_WIDTH (ao_strs_strtable+310)
+#define ENUM_ERR_WIDTH (ao_strs_strtable+329)
#define ENUM_ERR_WIDTH_LEN 6
-#define EXPORT_ARG_FMT (ao_strs_strtable+317)
+#define EXPORT_ARG_FMT (ao_strs_strtable+336)
#define EXPORT_ARG_FMT_LEN 17
-#define FALSE_STR (ao_strs_strtable+335)
+#define FALSE_STR (ao_strs_strtable+354)
#define FALSE_STR_LEN 5
-#define FINISH_LOOP (ao_strs_strtable+1995)
+#define FINISH_LOOP (ao_strs_strtable+2039)
#define FINISH_LOOP_LEN 378
-#define FLAG_OPT_MARK (ao_strs_strtable+341)
+#define FLAG_OPT_MARK (ao_strs_strtable+360)
#define FLAG_OPT_MARK_LEN 9
-#define FLAG_STR (ao_strs_strtable+351)
+#define FLAG_STR (ao_strs_strtable+370)
#define FLAG_STR_LEN 4
-#define INIT_LOPT_STR (ao_strs_strtable+2374)
+#define INIT_LOPT_STR (ao_strs_strtable+2418)
#define INIT_LOPT_STR_LEN 250
-#define INIT_OPT_STR (ao_strs_strtable+2625)
+#define INIT_OPT_STR (ao_strs_strtable+2669)
#define INIT_OPT_STR_LEN 116
-#define INVALID_FMT (ao_strs_strtable+356)
+#define INVALID_FMT (ao_strs_strtable+375)
#define INVALID_FMT_LEN 10
-#define INVALID_STR (ao_strs_strtable+367)
+#define INVALID_STR (ao_strs_strtable+386)
#define INVALID_STR_LEN 9
-#define LINE_SPLICE (ao_strs_strtable+377)
+#define LINE_SPLICE (ao_strs_strtable+396)
#define LINE_SPLICE_LEN 4
-#define LONG_OPT_MARK (ao_strs_strtable+382)
-#define LONG_OPT_MARKER (ao_strs_strtable+393)
+#define LONG_OPT_MARK (ao_strs_strtable+401)
+#define LONG_OPT_MARKER (ao_strs_strtable+412)
#define LONG_OPT_MARKER_LEN 2
#define LONG_OPT_MARK_LEN 10
-#define LONG_USE_STR (ao_strs_strtable+396)
+#define LONG_USE_STR (ao_strs_strtable+415)
#define LONG_USE_STR_LEN 9
-#define LOOP_STR (ao_strs_strtable+2742)
+#define LOOP_STR (ao_strs_strtable+2786)
#define LOOP_STR_LEN 206
-#define LOPT_ARG_FMT (ao_strs_strtable+2949)
+#define LOPT_ARG_FMT (ao_strs_strtable+2993)
#define LOPT_ARG_FMT_LEN 778
-#define LVL3_CMD (ao_strs_strtable+406)
+#define LVL3_CMD (ao_strs_strtable+425)
#define LVL3_CMD_LEN 15
-#define MK_STR_OCT_FMT (ao_strs_strtable+422)
+#define MK_STR_OCT_FMT (ao_strs_strtable+441)
#define MK_STR_OCT_FMT_LEN 5
-#define MORE_STR (ao_strs_strtable+428)
+#define MORE_STR (ao_strs_strtable+447)
#define MORE_STR_LEN 4
-#define MULTI_ARG_FMT (ao_strs_strtable+3728)
+#define MULTI_ARG_FMT (ao_strs_strtable+3772)
#define MULTI_ARG_FMT_LEN 123
-#define MULTI_DEF_FMT (ao_strs_strtable+3852)
+#define MULTI_DEF_FMT (ao_strs_strtable+3896)
#define MULTI_DEF_FMT_LEN 157
-#define NESTED_OPT_FMT (ao_strs_strtable+433)
+#define NESTED_OPT_FMT (ao_strs_strtable+452)
#define NESTED_OPT_FMT_LEN 17
-#define NLSTR_FMT (ao_strs_strtable+451)
+#define NLSTR_FMT (ao_strs_strtable+470)
#define NLSTR_FMT_LEN 3
-#define NLSTR_SPACE_FMT (ao_strs_strtable+455)
+#define NLSTR_SPACE_FMT (ao_strs_strtable+474)
#define NLSTR_SPACE_FMT_LEN 5
-#define NONE_STR (ao_strs_strtable+91)
+#define NONE_STR (ao_strs_strtable+110)
#define NONE_STR_LEN 4
-#define NOT_FOUND_STR (ao_strs_strtable+4010)
+#define NOT_FOUND_STR (ao_strs_strtable+4054)
#define NOT_FOUND_STR_LEN 56
-#define NO_ARG_NEEDED (ao_strs_strtable+461)
+#define NO_ARG_NEEDED (ao_strs_strtable+480)
#define NO_ARG_NEEDED_LEN 17
-#define NO_LOAD_WARN (ao_strs_strtable+982)
+#define NO_LOAD_WARN (ao_strs_strtable+1026)
#define NO_LOAD_WARN_LEN 46
-#define NO_MULTI_ARG_FMT (ao_strs_strtable+4067)
+#define NO_MULTI_ARG_FMT (ao_strs_strtable+4111)
#define NO_MULTI_ARG_FMT_LEN 140
-#define NO_SAVE_OPTS (ao_strs_strtable+1029)
+#define NO_SAVE_OPTS (ao_strs_strtable+1073)
#define NO_SAVE_OPTS_LEN 46
-#define NO_SGL_ARG_FMT (ao_strs_strtable+4208)
+#define NO_SGL_ARG_FMT (ao_strs_strtable+4252)
#define NO_SGL_ARG_FMT_LEN 316
-#define NO_SUPPRESS_LOAD (ao_strs_strtable+1076)
+#define NO_SUPPRESS_LOAD (ao_strs_strtable+1120)
#define NO_SUPPRESS_LOAD_LEN 65
-#define NULL_ATR_FMT (ao_strs_strtable+479)
+#define NULL_ATR_FMT (ao_strs_strtable+498)
#define NULL_ATR_FMT_LEN 6
-#define NUMB_ATR_FMT (ao_strs_strtable+1142)
+#define NUMB_ATR_FMT (ao_strs_strtable+1186)
#define NUMB_ATR_FMT_LEN 34
-#define OK_NEED_OPT_ARG (ao_strs_strtable+486)
+#define OK_NEED_OPT_ARG (ao_strs_strtable+505)
#define OK_NEED_OPT_ARG_LEN 17
-#define ONE_TAB_STR (ao_strs_strtable+504)
+#define ONE_TAB_STR (ao_strs_strtable+523)
#define ONE_TAB_STR_LEN 1
-#define ONLY_OPTS_LOOP (ao_strs_strtable+4525)
+#define ONLY_OPTS_LOOP (ao_strs_strtable+4569)
#define ONLY_OPTS_LOOP_LEN 102
-#define OPEN_CLOSE_FMT (ao_strs_strtable+479)
+#define OPEN_CLOSE_FMT (ao_strs_strtable+498)
#define OPEN_CLOSE_FMT_LEN 6
-#define OPEN_XML_FMT (ao_strs_strtable+506)
+#define OPEN_XML_FMT (ao_strs_strtable+525)
#define OPEN_XML_FMT_LEN 4
-#define OPTION_STR (ao_strs_strtable+511)
+#define OPTION_STR (ao_strs_strtable+530)
#define OPTION_STR_LEN 6
-#define OPT_ARG_FMT (ao_strs_strtable+4628)
+#define OPT_ARG_FMT (ao_strs_strtable+4672)
#define OPT_ARG_FMT_LEN 1153
-#define OPT_END_FMT (ao_strs_strtable+518)
+#define OPT_END_FMT (ao_strs_strtable+537)
#define OPT_END_FMT_LEN 14
-#define OPT_VAL_FMT (ao_strs_strtable+533)
+#define OPT_VAL_FMT (ao_strs_strtable+552)
#define OPT_VAL_FMT_LEN 6
-#define OR_STR (ao_strs_strtable+540)
+#define OR_STR (ao_strs_strtable+559)
#define OR_STR_LEN 3
-#define PAGER_NAME (ao_strs_strtable+544)
+#define PAGER_NAME (ao_strs_strtable+563)
#define PAGER_NAME_LEN 5
-#define PAGE_USAGE_FMT (ao_strs_strtable+550)
+#define PAGE_USAGE_FMT (ao_strs_strtable+569)
#define PAGE_USAGE_FMT_LEN 22
-#define PAGE_USAGE_TEXT (ao_strs_strtable+5782)
+#define PAGE_USAGE_TEXT (ao_strs_strtable+5826)
#define PAGE_USAGE_TEXT_LEN 73
-#define PLUS_STR (ao_strs_strtable+573)
+#define PLUS_STR (ao_strs_strtable+592)
#define PLUS_STR_LEN 3
-#define PREAMBLE_FMT (ao_strs_strtable+5856)
+#define PREAMBLE_FMT (ao_strs_strtable+5900)
#define PREAMBLE_FMT_LEN 105
-#define PUTS_FMT (ao_strs_strtable+577)
+#define PUTS_FMT (ao_strs_strtable+596)
#define PUTS_FMT_LEN 15
-#define QUOT_APOS (ao_strs_strtable+593)
+#define QUOT_APOS (ao_strs_strtable+612)
#define QUOT_APOS_LEN 2
-#define QUOT_ARG_FMT (ao_strs_strtable+596)
+#define QUOT_ARG_FMT (ao_strs_strtable+615)
#define QUOT_ARG_FMT_LEN 4
-#define SET_MULTI_ARG (ao_strs_strtable+5962)
+#define SET_MULTI_ARG (ao_strs_strtable+6006)
#define SET_MULTI_ARG_LEN 89
-#define SET_NO_TEXT_FMT (ao_strs_strtable+1177)
+#define SET_NO_TEXT_FMT (ao_strs_strtable+1221)
#define SET_NO_TEXT_FMT_LEN 30
-#define SET_OFF_FMT (ao_strs_strtable+601)
+#define SET_OFF_FMT (ao_strs_strtable+620)
#define SET_OFF_FMT_LEN 6
-#define SET_TEXT_FMT (ao_strs_strtable+608)
+#define SET_TEXT_FMT (ao_strs_strtable+627)
#define SET_TEXT_FMT_LEN 12
-#define SGL_ARG_FMT (ao_strs_strtable+6052)
+#define SGL_ARG_FMT (ao_strs_strtable+6096)
#define SGL_ARG_FMT_LEN 258
-#define SGL_DEF_FMT (ao_strs_strtable+6311)
+#define SGL_DEF_FMT (ao_strs_strtable+6355)
#define SGL_DEF_FMT_LEN 68
-#define SGL_NO_DEF_FMT (ao_strs_strtable+6380)
+#define SGL_NO_DEF_FMT (ao_strs_strtable+6424)
#define SGL_NO_DEF_FMT_LEN 61
-#define SHELL_MAGIC (ao_strs_strtable+621)
+#define SHELL_MAGIC (ao_strs_strtable+640)
#define SHELL_MAGIC_LEN 6
-#define SHOW_PROG_ENV (ao_strs_strtable+628)
+#define SHOW_PROG_ENV (ao_strs_strtable+647)
#define SHOW_PROG_ENV_LEN 19
-#define SHOW_VAL_FMT (ao_strs_strtable+648)
+#define SHOW_VAL_FMT (ao_strs_strtable+667)
#define SHOW_VAL_FMT_LEN 17
-#define START_MARK (ao_strs_strtable+6442)
+#define START_MARK (ao_strs_strtable+6486)
#define START_MARK_LEN 82
-#define STDOUT (ao_strs_strtable+666)
+#define STDOUT (ao_strs_strtable+685)
#define STDOUT_LEN 6
-#define TIME_FMT (ao_strs_strtable+673)
+#define TIME_FMT (ao_strs_strtable+692)
#define TIME_FMT_LEN 21
-#define TMPDIR (ao_strs_strtable+695)
+#define TMPDIR (ao_strs_strtable+714)
#define TMPDIR_LEN 6
-#define TMP_FILE_FMT (ao_strs_strtable+702)
+#define TMP_FILE_FMT (ao_strs_strtable+721)
#define TMP_FILE_FMT_LEN 16
-#define TMP_USAGE_FMT (ao_strs_strtable+702)
+#define TMP_USAGE_FMT (ao_strs_strtable+721)
#define TMP_USAGE_FMT_LEN 16
-#define TRUE_STR (ao_strs_strtable+719)
+#define TRUE_STR (ao_strs_strtable+738)
#define TRUE_STR_LEN 4
-#define TWO_SPACES_STR (ao_strs_strtable+254)
+#define TWO_SPACES_STR (ao_strs_strtable+273)
#define TWO_SPACES_STR_LEN 2
-#define TYPE_ATR_FMT (ao_strs_strtable+724)
+#define TYPE_ATR_FMT (ao_strs_strtable+743)
#define TYPE_ATR_FMT_LEN 12
-#define UNK_OPT_FMT (ao_strs_strtable+6525)
+#define UNK_OPT_FMT (ao_strs_strtable+6569)
#define UNK_OPT_FMT_LEN 144
-#define VER_STR (ao_strs_strtable+737)
+#define VER_STR (ao_strs_strtable+756)
#define VER_STR_LEN 7
-#define XML_HEX_BYTE_FMT (ao_strs_strtable+745)
+#define XML_HEX_BYTE_FMT (ao_strs_strtable+764)
#define XML_HEX_BYTE_FMT_LEN 7
-#define YES_NEED_OPT_ARG (ao_strs_strtable+753)
+#define YES_NEED_OPT_ARG (ao_strs_strtable+772)
#define YES_NEED_OPT_ARG_LEN 18
-#define apostrophe (ao_strs_strtable+772)
+#define ao_default_use (ao_strs_strtable+804)
+#define ao_default_use_LEN 11
+#define ao_name_use_fmt (ao_strs_strtable+791)
+#define ao_name_use_fmt_LEN 12
+#define apostrophe (ao_strs_strtable+816)
#define apostrophe_LEN 4
-#define arg_fmt (ao_strs_strtable+777)
+#define arg_fmt (ao_strs_strtable+821)
#define arg_fmt_LEN 5
-#define init_optct (ao_strs_strtable+820)
+#define init_optct (ao_strs_strtable+864)
#define init_optct_LEN 13
-#define misguess_len (ao_strs_strtable+783)
+#define misguess_len (ao_strs_strtable+827)
#define misguess_len_LEN 36
-#define set_dash (ao_strs_strtable+834)
+#define set_dash (ao_strs_strtable+878)
#define set_dash_LEN 6
-#define tmp_dir (ao_strs_strtable+841)
+#define tmp_dir (ao_strs_strtable+885)
#define tmp_dir_LEN 4
-#define zAll (ao_strs_strtable+257)
+#define zAll (ao_strs_strtable+276)
#define zAll_LEN 3
#define zCfgAO_Flags (ao_strs_strtable+12)
-#define zCfgAO_Flags_LEN 12
-#define zCfgProg (ao_strs_strtable+25)
-#define zCfgProg_LEN 7
-#define zEquivMode (ao_strs_strtable+1208)
+#define zCfgAO_Flags_LEN 14
+#define zCfgProg (ao_strs_strtable+27)
+#define zCfgProg_LEN 9
+#define zEquivMode (ao_strs_strtable+1252)
#define zEquivMode_LEN 44
-#define zFiveSpaces (ao_strs_strtable+244)
+#define zFiveSpaces (ao_strs_strtable+263)
#define zFiveSpaces_LEN 5
-#define zFmtFmt (ao_strs_strtable+33)
+#define zFmtFmt (ao_strs_strtable+37)
#define zFmtFmt_LEN 11
-#define zFullOptFmt (ao_strs_strtable+1253)
+#define zFmtProg (ao_strs_strtable+49)
+#define zFmtProg_LEN 14
+#define zFullOptFmt (ao_strs_strtable+1297)
#define zFullOptFmt_LEN 34
-#define zGnuBreak (ao_strs_strtable+45)
+#define zGnuBreak (ao_strs_strtable+64)
#define zGnuBreak_LEN 5
-#define zGnuFileArg (ao_strs_strtable+51)
+#define zGnuFileArg (ao_strs_strtable+70)
#define zGnuFileArg_LEN 5
-#define zGnuKeyLArg (ao_strs_strtable+57)
+#define zGnuKeyLArg (ao_strs_strtable+76)
#define zGnuKeyLArg_LEN 4
-#define zGnuNestArg (ao_strs_strtable+62)
+#define zGnuNestArg (ao_strs_strtable+81)
#define zGnuNestArg_LEN 5
-#define zGnuOptArg (ao_strs_strtable+68)
+#define zGnuOptArg (ao_strs_strtable+87)
#define zGnuOptArg_LEN 6
-#define zGnuOptFmt (ao_strs_strtable+75)
+#define zGnuOptFmt (ao_strs_strtable+94)
#define zGnuOptFmt_LEN 10
-#define zGnuTimeArg (ao_strs_strtable+86)
+#define zGnuTimeArg (ao_strs_strtable+105)
#define zGnuTimeArg_LEN 4
-#define zNone (ao_strs_strtable+91)
+#define zNone (ao_strs_strtable+110)
#define zNone_LEN 4
-#define zOptCookieCt (ao_strs_strtable+1288)
+#define zOptCookieCt (ao_strs_strtable+1332)
#define zOptCookieCt_LEN 38
-#define zOptCtFmt (ao_strs_strtable+1327)
+#define zOptCtFmt (ao_strs_strtable+1371)
#define zOptCtFmt_LEN 30
-#define zOptDisabl (ao_strs_strtable+1358)
+#define zOptDisabl (ao_strs_strtable+1402)
#define zOptDisabl_LEN 32
-#define zOptNumFmt (ao_strs_strtable+1391)
+#define zOptNumFmt (ao_strs_strtable+1435)
#define zOptNumFmt_LEN 41
-#define zOptionCase (ao_strs_strtable+1433)
+#define zOptionCase (ao_strs_strtable+1477)
#define zOptionCase_LEN 30
-#define zOptionEndSelect (ao_strs_strtable+846)
+#define zOptionEndSelect (ao_strs_strtable+890)
#define zOptionEndSelect_LEN 16
-#define zOptionFlag (ao_strs_strtable+863)
+#define zOptionFlag (ao_strs_strtable+907)
#define zOptionFlag_LEN 15
-#define zOptionFullName (ao_strs_strtable+879)
+#define zOptionFullName (ao_strs_strtable+923)
#define zOptionFullName_LEN 15
-#define zOptionPartName (ao_strs_strtable+895)
+#define zOptionPartName (ao_strs_strtable+939)
#define zOptionPartName_LEN 17
-#define zPresetFile (ao_strs_strtable+96)
+#define zPresetFile (ao_strs_strtable+115)
#define zPresetFile_LEN 37
-#define zReqOptFmt (ao_strs_strtable+134)
+#define zReqOptFmt (ao_strs_strtable+153)
#define zReqOptFmt_LEN 13
#define zSepChars (ao_strs_strtable+0)
#define zSepChars_LEN 3
-#define zShrtGnuOptFmt (ao_strs_strtable+148)
+#define zShrtGnuOptFmt (ao_strs_strtable+167)
#define zShrtGnuOptFmt_LEN 2
-#define zSixSpaces (ao_strs_strtable+237)
+#define zSixSpaces (ao_strs_strtable+256)
#define zSixSpaces_LEN 6
-#define zStdBoolArg (ao_strs_strtable+151)
+#define zStdBoolArg (ao_strs_strtable+170)
#define zStdBoolArg_LEN 3
-#define zStdBreak (ao_strs_strtable+155)
+#define zStdBreak (ao_strs_strtable+174)
#define zStdBreak_LEN 7
-#define zStdFileArg (ao_strs_strtable+163)
+#define zStdFileArg (ao_strs_strtable+182)
#define zStdFileArg_LEN 3
-#define zStdKeyArg (ao_strs_strtable+167)
+#define zStdKeyArg (ao_strs_strtable+186)
#define zStdKeyArg_LEN 3
-#define zStdKeyLArg (ao_strs_strtable+171)
+#define zStdKeyLArg (ao_strs_strtable+190)
#define zStdKeyLArg_LEN 3
-#define zStdNestArg (ao_strs_strtable+175)
+#define zStdNestArg (ao_strs_strtable+194)
#define zStdNestArg_LEN 3
-#define zStdNoArg (ao_strs_strtable+179)
+#define zStdNoArg (ao_strs_strtable+198)
#define zStdNoArg_LEN 3
-#define zStdNumArg (ao_strs_strtable+183)
+#define zStdNumArg (ao_strs_strtable+202)
#define zStdNumArg_LEN 3
-#define zStdOptArg (ao_strs_strtable+187)
+#define zStdOptArg (ao_strs_strtable+206)
#define zStdOptArg_LEN 3
-#define zStdReqArg (ao_strs_strtable+191)
+#define zStdReqArg (ao_strs_strtable+210)
#define zStdReqArg_LEN 3
-#define zStdStrArg (ao_strs_strtable+195)
+#define zStdStrArg (ao_strs_strtable+214)
#define zStdStrArg_LEN 3
-#define zStdTimeArg (ao_strs_strtable+199)
+#define zStdTimeArg (ao_strs_strtable+218)
#define zStdTimeArg_LEN 3
-#define zTabHyp (ao_strs_strtable+203)
-#define zTabHypAnd (ao_strs_strtable+217)
+#define zTabHyp (ao_strs_strtable+222)
+#define zTabHypAnd (ao_strs_strtable+236)
#define zTabHypAnd_LEN 11
#define zTabHyp_LEN 6
-#define zTabSpace (ao_strs_strtable+210)
+#define zTabSpace (ao_strs_strtable+229)
#define zTabSpace_LEN 6
-#define zTabout (ao_strs_strtable+229)
+#define zTabout (ao_strs_strtable+248)
#define zTabout_LEN 7
-#define zThreeSpaces (ao_strs_strtable+250)
+#define zThreeSpaces (ao_strs_strtable+269)
#define zThreeSpaces_LEN 3
-#define zTwoSpaces (ao_strs_strtable+254)
+#define zTwoSpaces (ao_strs_strtable+273)
#define zTwoSpaces_LEN 2
#define zambig_file (ao_strs_strtable+4)
#define zambig_file_LEN 7
-extern char const ao_strs_strtable[6670];
+extern char const ao_strs_strtable[6714];
#endif /* STRINGS_AO_STRS_H_GUARD */
diff --git a/src/libopts/autoopts.c b/src/libopts/autoopts.c
index 4b15acafbb..643d277239 100644
--- a/src/libopts/autoopts.c
+++ b/src/libopts/autoopts.c
@@ -13,7 +13,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2015 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2018 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
@@ -35,7 +35,7 @@
/**
* The number of tab characters to skip when printing continuation lines.
*/
-static unsigned int tab_skip_ct = 0;
+ static unsigned int tab_skip_ct = 0;
#ifndef HAVE_PATHFIND
# define pathfind(_p, _n, _m) option_pathfind(_p, _n, _m)
@@ -59,7 +59,7 @@ static unsigned int tab_skip_ct = 0;
# include "compat/strchr.c"
#endif
-LOCAL void *
+static void *
ao_malloc(size_t sz)
{
void * res = malloc(sz);
@@ -69,10 +69,8 @@ ao_malloc(size_t sz)
}
return res;
}
-#undef malloc
-#define malloc(_s) ao_malloc(_s)
-LOCAL void *
+static void *
ao_realloc(void *p, size_t sz)
{
void * res = (p == NULL) ? malloc(sz) : realloc(p, sz);
@@ -82,10 +80,8 @@ ao_realloc(void *p, size_t sz)
}
return res;
}
-#undef realloc
-#define realloc(_p,_s) ao_realloc(_p,_s)
-LOCAL char *
+static char *
ao_strdup(char const *str)
{
char * res = strdup(str);
@@ -95,8 +91,6 @@ ao_strdup(char const *str)
}
return res;
}
-#undef strdup
-#define strdup(_p) ao_strdup(_p)
/**
* handle an option.
@@ -104,7 +98,7 @@ ao_strdup(char const *str)
* This routine handles equivalencing, sets the option state flags and
* invokes the handler procedure, if any.
*/
-LOCAL tSuccess
+static tSuccess
handle_opt(tOptions * opts, tOptState * o_st)
{
/*
@@ -217,7 +211,7 @@ handle_opt(tOptions * opts, tOptState * o_st)
* @param opts the program option descriptor
* @param o_st the state of the next found option
*/
-LOCAL tSuccess
+static tSuccess
next_opt(tOptions * opts, tOptState * o_st)
{
{
@@ -244,7 +238,7 @@ next_opt(tOptions * opts, tOptState * o_st)
* @param[in,out] opts program options descriptor
* @returns SUCCESS or FAILURE
*/
-LOCAL tSuccess
+static tSuccess
regular_opts(tOptions * opts)
{
/* assert: opts->fOptSet & OPTPROC_IMMEDIATE == 0 */
diff --git a/src/libopts/autoopts.h b/src/libopts/autoopts.h
index 6f75f9e44e..36bb43f29d 100644
--- a/src/libopts/autoopts.h
+++ b/src/libopts/autoopts.h
@@ -11,7 +11,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2015 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2018 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
@@ -41,6 +41,9 @@
# ifdef PATH_MAX
# define AG_PATH_MAX ((size_t)PATH_MAX)
# else
+# ifdef __gnu_hurd__
+# define size_t unsigned long
+# endif
# define AG_PATH_MAX ((size_t)4096)
# endif
#else
@@ -460,6 +463,13 @@ static char const * program_pkgdatadir = pkgdatadir_default;
static tOptionLoadMode option_load_mode = OPTION_LOAD_UNCOOKED;
static tePagerState pagerState = PAGER_STATE_INITIAL;
+static noreturn void option_exits(int exit_code);
+static noreturn void fserr_exit(char const * prog, char const * op,
+ char const * fname);
+static void fserr_warn(char const * prog, char const * op,
+ char const * fname);
+static noreturn void ao_bug(char const * msg);
+
FILE * option_usage_fp = NULL;
static char const * pz_enum_err_fmt;
diff --git a/src/libopts/autoopts/options.h b/src/libopts/autoopts/options.h
index 0601d0fc57..08dc546214 100644
--- a/src/libopts/autoopts/options.h
+++ b/src/libopts/autoopts/options.h
@@ -9,11 +9,11 @@
* This file defines all the global structures and special values
* used in the automated option processing library.
*
- * Automated Options Copyright (C) 1992-2015 by Bruce Korb
+ * Automated Options Copyright (C) 1992-2018 by Bruce Korb
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2015 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2018 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
@@ -64,7 +64,7 @@
# if defined(HAVE_STDBOOL_H)
# include <stdbool.h>
-# else
+# elif ! defined(bool)
typedef enum { false = 0, true = 1 } _Bool;
# define bool _Bool
@@ -109,15 +109,15 @@
* @{
*/
/// autoopts structure version
-#define OPTIONS_STRUCT_VERSION 167937
+#define OPTIONS_STRUCT_VERSION 172033
/// autoopts structure version string
-#define OPTIONS_VERSION_STRING "41:1:16"
+#define OPTIONS_VERSION_STRING "42:1:17"
/// 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 "41.1"
+#define OPTIONS_DOTTED_VERSION "42.1"
/// convert a version/release number pair to an integer value
#define OPTIONS_VER_TO_NUM(_v, _r) (((_v) * 4096) + (_r))
/// @}
@@ -140,7 +140,8 @@ typedef enum {
OPARG_TYPE_FLOAT = 9, ///< opt arg is a floating point num
OPARG_TYPE_DOUBLE = 10, ///< opt arg is a double prec. float
OPARG_TYPE_LONG_DOUBLE = 11, ///< opt arg is a long double prec.
- OPARG_TYPE_LONG_LONG = 12 ///< opt arg is a long long int
+ OPARG_TYPE_LONG_LONG = 12, ///< opt arg is a long long int
+ OPARG_TYPE_STATIC = 13 ///<
} teOptArgType;
/**
@@ -641,6 +642,7 @@ struct options {
void * pSavedState;
/// The procedure to call to print usage text
+ /* __attribute__((__noreturn__)) */
// coverity[+kill]
tpUsageProc pUsageProc;
/// The procedure to call to translate translatable option messages
diff --git a/src/libopts/autoopts/project.h b/src/libopts/autoopts/project.h
index 1e7f156ec6..1f196efa0f 100644
--- a/src/libopts/autoopts/project.h
+++ b/src/libopts/autoopts/project.h
@@ -4,7 +4,7 @@
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2015 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2018 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
@@ -71,6 +71,10 @@ typedef int tSuccess;
# define MODE extern
#endif
+#undef NUL
+#define NUL '\0'
+
+#define MOD_LOCAL static
#define parse_duration option_parse_duration
#endif /* AUTOGEN_PROJECT_H */
diff --git a/src/libopts/autoopts/usage-txt.h b/src/libopts/autoopts/usage-txt.h
index 5f6cce18bd..e94337d69b 100644
--- a/src/libopts/autoopts/usage-txt.h
+++ b/src/libopts/autoopts/usage-txt.h
@@ -8,7 +8,7 @@
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2015 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2017 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
@@ -29,7 +29,7 @@
/** @file usage-txt.h
*
* This file handles all the bookkeeping required for tracking all the little
- * tiny strings used by the AutoOpts library. There are 108
+ * tiny strings used by the AutoOpts library. There are 107
* 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
@@ -47,7 +47,7 @@ typedef struct {
char * utpz_GnuKeyArg;
char * utpz_GnuNumArg;
char * utpz_GnuStrArg;
- char const * apz_str[104];
+ char const * apz_str[103];
} usage_text_t;
/*
@@ -55,7 +55,7 @@ typedef struct {
* strings and the text array containing untranslatable strings.
*/
extern usage_text_t option_xlateable_txt;
-extern char const option_lib_text[4285];
+extern char const option_lib_text[4267];
#if defined(AUTOOPTS_INTERNAL)
/*
@@ -110,67 +110,66 @@ extern char const option_lib_text[4285];
#define zNoState (option_xlateable_txt.apz_str[ 40])
#define zNotCmdOpt (option_xlateable_txt.apz_str[ 41])
#define zNotDate (option_xlateable_txt.apz_str[ 42])
-#define zNotDef (option_xlateable_txt.apz_str[ 43])
-#define zNotDuration (option_xlateable_txt.apz_str[ 44])
-#define zneed_more (option_xlateable_txt.apz_str[ 45])
-#define zNotNumber (option_xlateable_txt.apz_str[ 46])
-#define znum_too_large (option_xlateable_txt.apz_str[ 47])
-#define zoffer_usage_fmt (option_xlateable_txt.apz_str[ 48])
-#define zonly_one (option_xlateable_txt.apz_str[ 49])
-#define zstdout_name (option_xlateable_txt.apz_str[ 50])
-#define zstderr_name (option_xlateable_txt.apz_str[ 51])
-#define zwriting (option_xlateable_txt.apz_str[ 52])
-#define zRangeErr (option_xlateable_txt.apz_str[ 53])
-#define zneed_fmt (option_xlateable_txt.apz_str[ 54])
-#define zsave_warn (option_xlateable_txt.apz_str[ 55])
-#define zalt_opt (option_xlateable_txt.apz_str[ 56])
-#define zAuto (option_xlateable_txt.apz_str[ 57])
-#define zDefaultOpt (option_xlateable_txt.apz_str[ 58])
-#define zDis (option_xlateable_txt.apz_str[ 59])
-#define zDisabledOpt (option_xlateable_txt.apz_str[ 60])
-#define zDisabledWhy (option_xlateable_txt.apz_str[ 61])
-#define zEnab (option_xlateable_txt.apz_str[ 62])
-#define ztoo_often_fmt (option_xlateable_txt.apz_str[ 63])
-#define zExamineFmt (option_xlateable_txt.apz_str[ 64])
-#define zFileCannotExist (option_xlateable_txt.apz_str[ 65])
-#define zFileMustExist (option_xlateable_txt.apz_str[ 66])
-#define zFlagOkay (option_xlateable_txt.apz_str[ 67])
-#define zGenshell (option_xlateable_txt.apz_str[ 68])
-#define zLowerBits (option_xlateable_txt.apz_str[ 69])
-#define zMembers (option_xlateable_txt.apz_str[ 70])
-#define zMust (option_xlateable_txt.apz_str[ 71])
-#define zNoFlags (option_xlateable_txt.apz_str[ 72])
-#define zNoLim (option_xlateable_txt.apz_str[ 73])
-#define zNoPreset (option_xlateable_txt.apz_str[ 74])
-#define zNoRq_NoShrtTtl (option_xlateable_txt.apz_str[ 75])
-#define zNoRq_ShrtTtl (option_xlateable_txt.apz_str[ 76])
-#define zNrmOptFmt (option_xlateable_txt.apz_str[ 77])
-#define zNumberOpt (option_xlateable_txt.apz_str[ 78])
-#define zOptsOnly (option_xlateable_txt.apz_str[ 79])
-#define zPathFmt (option_xlateable_txt.apz_str[ 80])
-#define zPlsSendBugs (option_xlateable_txt.apz_str[ 81])
-#define zPreset (option_xlateable_txt.apz_str[ 82])
-#define zPresetIntro (option_xlateable_txt.apz_str[ 83])
-#define zProhib (option_xlateable_txt.apz_str[ 84])
-#define zProhibOne (option_xlateable_txt.apz_str[ 85])
-#define zRange (option_xlateable_txt.apz_str[ 86])
-#define zRangeAbove (option_xlateable_txt.apz_str[ 87])
-#define zRangeExact (option_xlateable_txt.apz_str[ 88])
-#define zRangeLie (option_xlateable_txt.apz_str[ 89])
-#define zRangeOnly (option_xlateable_txt.apz_str[ 90])
-#define zRangeOr (option_xlateable_txt.apz_str[ 91])
-#define zRangeScaled (option_xlateable_txt.apz_str[ 92])
-#define zRangeUpto (option_xlateable_txt.apz_str[ 93])
-#define zReorder (option_xlateable_txt.apz_str[ 94])
-#define zReqOne (option_xlateable_txt.apz_str[ 95])
-#define zReqThese (option_xlateable_txt.apz_str[ 96])
-#define zReq_NoShrtTtl (option_xlateable_txt.apz_str[ 97])
-#define zReq_ShrtTtl (option_xlateable_txt.apz_str[ 98])
-#define zSetMemberSettings (option_xlateable_txt.apz_str[ 99])
-#define zUpTo (option_xlateable_txt.apz_str[100])
-#define zValidKeys (option_xlateable_txt.apz_str[101])
-#define zVendIntro (option_xlateable_txt.apz_str[102])
-#define zVendOptsAre (option_xlateable_txt.apz_str[103])
+#define zNotDuration (option_xlateable_txt.apz_str[ 43])
+#define zneed_more (option_xlateable_txt.apz_str[ 44])
+#define zNotNumber (option_xlateable_txt.apz_str[ 45])
+#define znum_too_large (option_xlateable_txt.apz_str[ 46])
+#define zoffer_usage_fmt (option_xlateable_txt.apz_str[ 47])
+#define zonly_one (option_xlateable_txt.apz_str[ 48])
+#define zstdout_name (option_xlateable_txt.apz_str[ 49])
+#define zstderr_name (option_xlateable_txt.apz_str[ 50])
+#define zwriting (option_xlateable_txt.apz_str[ 51])
+#define zRangeErr (option_xlateable_txt.apz_str[ 52])
+#define zneed_fmt (option_xlateable_txt.apz_str[ 53])
+#define zsave_warn (option_xlateable_txt.apz_str[ 54])
+#define zalt_opt (option_xlateable_txt.apz_str[ 55])
+#define zAuto (option_xlateable_txt.apz_str[ 56])
+#define zDefaultOpt (option_xlateable_txt.apz_str[ 57])
+#define zDis (option_xlateable_txt.apz_str[ 58])
+#define zDisabledOpt (option_xlateable_txt.apz_str[ 59])
+#define zDisabledWhy (option_xlateable_txt.apz_str[ 60])
+#define zEnab (option_xlateable_txt.apz_str[ 61])
+#define ztoo_often_fmt (option_xlateable_txt.apz_str[ 62])
+#define zExamineFmt (option_xlateable_txt.apz_str[ 63])
+#define zFileCannotExist (option_xlateable_txt.apz_str[ 64])
+#define zFileMustExist (option_xlateable_txt.apz_str[ 65])
+#define zFlagOkay (option_xlateable_txt.apz_str[ 66])
+#define zGenshell (option_xlateable_txt.apz_str[ 67])
+#define zLowerBits (option_xlateable_txt.apz_str[ 68])
+#define zMembers (option_xlateable_txt.apz_str[ 69])
+#define zMust (option_xlateable_txt.apz_str[ 70])
+#define zNoFlags (option_xlateable_txt.apz_str[ 71])
+#define zNoLim (option_xlateable_txt.apz_str[ 72])
+#define zNoPreset (option_xlateable_txt.apz_str[ 73])
+#define zNoRq_NoShrtTtl (option_xlateable_txt.apz_str[ 74])
+#define zNoRq_ShrtTtl (option_xlateable_txt.apz_str[ 75])
+#define zNrmOptFmt (option_xlateable_txt.apz_str[ 76])
+#define zNumberOpt (option_xlateable_txt.apz_str[ 77])
+#define zOptsOnly (option_xlateable_txt.apz_str[ 78])
+#define zPathFmt (option_xlateable_txt.apz_str[ 79])
+#define zPlsSendBugs (option_xlateable_txt.apz_str[ 80])
+#define zPreset (option_xlateable_txt.apz_str[ 81])
+#define zPresetIntro (option_xlateable_txt.apz_str[ 82])
+#define zProhib (option_xlateable_txt.apz_str[ 83])
+#define zProhibOne (option_xlateable_txt.apz_str[ 84])
+#define zRange (option_xlateable_txt.apz_str[ 85])
+#define zRangeAbove (option_xlateable_txt.apz_str[ 86])
+#define zRangeExact (option_xlateable_txt.apz_str[ 87])
+#define zRangeLie (option_xlateable_txt.apz_str[ 88])
+#define zRangeOnly (option_xlateable_txt.apz_str[ 89])
+#define zRangeOr (option_xlateable_txt.apz_str[ 90])
+#define zRangeScaled (option_xlateable_txt.apz_str[ 91])
+#define zRangeUpto (option_xlateable_txt.apz_str[ 92])
+#define zReorder (option_xlateable_txt.apz_str[ 93])
+#define zReqOne (option_xlateable_txt.apz_str[ 94])
+#define zReqThese (option_xlateable_txt.apz_str[ 95])
+#define zReq_NoShrtTtl (option_xlateable_txt.apz_str[ 96])
+#define zReq_ShrtTtl (option_xlateable_txt.apz_str[ 97])
+#define zSetMemberSettings (option_xlateable_txt.apz_str[ 98])
+#define zUpTo (option_xlateable_txt.apz_str[ 99])
+#define zValidKeys (option_xlateable_txt.apz_str[100])
+#define zVendIntro (option_xlateable_txt.apz_str[101])
+#define zVendOptsAre (option_xlateable_txt.apz_str[102])
/*
* First, set up the strings. Some of these are writable. These are all in
@@ -181,7 +180,7 @@ static char eng_zGnuBoolArg[] = "=T/F";
static char eng_zGnuKeyArg[] = "=KWd";
static char eng_zGnuNumArg[] = "=num";
static char eng_zGnuStrArg[] = "=str";
-char const option_lib_text[4285] =
+char const option_lib_text[4267] =
/* 0 */ "allocation of %d bytes failed\n\0"
/* 31 */ "AutoOpts function called without option descriptor\n\0"
/* 83 */ "\tThis exceeds the compiled library version: \0"
@@ -190,7 +189,7 @@ char const option_lib_text[4285] =
/* 228 */ "realloc of %d bytes at 0x%p failed\n\0"
/* 264 */ "\tThis is less than the minimum library version: \0"
/* 314 */ "Automated Options version %s\n"
- "\tCopyright (C) 1999-2014 by Bruce Korb - all rights reserved\n\0"
+ "\tCopyright (C) 1999-2017 by Bruce Korb - all rights reserved\n\0"
/* 405 */ "(AutoOpts bug): %s.\n\0"
/* 427 */ "optionResetOpt() called, but reset-option not configured\0"
/* 484 */ "could not locate the 'help' option\0"
@@ -231,76 +230,75 @@ char const option_lib_text[4285] =
/* 1771 */ "%s error: no saved option state\n\0"
/* 1804 */ "'%s' is not a command line option.\n\0"
/* 1840 */ "%s error: '%s' is not a recognizable date/time.\n\0"
-/* 1890 */ "'%s' not defined\n\0"
-/* 1908 */ "%s error: '%s' is not a recognizable time duration.\n\0"
-/* 1962 */ "%s error: The %s option must appear %d times.\n\0"
-/* 2010 */ "%s error: '%s' is not a recognizable number.\n\0"
-/* 2057 */ "%s error: %s exceeds %s keyword count\n\0"
-/* 2097 */ "Try '%s %s' for more information.\n\0"
-/* 2132 */ "one %s%s option allowed\n\0"
-/* 2157 */ "standard output\0"
-/* 2173 */ "standard error\0"
-/* 2188 */ "write\0"
-/* 2194 */ "%s error: %s option value %ld is out of range.\n\0"
-/* 2243 */ "%s error: %s option requires the %s option\n\0"
-/* 2288 */ "%s warning: cannot save options - %s not regular file\n\0"
-/* 2344 */ "\t\t\t\t- an alternate for '%s'\n\0"
-/* 2373 */ "Version, usage and configuration options:\0"
-/* 2415 */ "\t\t\t\t- default option for unnamed options\n\0"
-/* 2457 */ "\t\t\t\t- disabled as '--%s'\n\0"
-/* 2483 */ " --- %-14s %s\n\0"
-/* 2498 */ "This option has been disabled\0"
-/* 2528 */ "\t\t\t\t- enabled by default\n\0"
-/* 2554 */ "%s error: only \0"
-/* 2571 */ " - examining environment variables named %s_*\n\0"
-/* 2618 */ "\t\t\t\t- file must not pre-exist\n\0"
-/* 2649 */ "\t\t\t\t- file must pre-exist\n\0"
-/* 2676 */ "Options are specified by doubled hyphens and their name or by a single\n"
+/* 1890 */ "%s error: '%s' is not a recognizable time duration.\n\0"
+/* 1944 */ "%s error: The %s option must appear %d times.\n\0"
+/* 1992 */ "%s error: '%s' is not a recognizable number.\n\0"
+/* 2039 */ "%s error: %s exceeds %s keyword count\n\0"
+/* 2079 */ "Try '%s %s' for more information.\n\0"
+/* 2114 */ "one %s%s option allowed\n\0"
+/* 2139 */ "standard output\0"
+/* 2155 */ "standard error\0"
+/* 2170 */ "write\0"
+/* 2176 */ "%s error: %s option value %ld is out of range.\n\0"
+/* 2225 */ "%s error: %s option requires the %s option\n\0"
+/* 2270 */ "%s warning: cannot save options - %s not regular file\n\0"
+/* 2326 */ "\t\t\t\t- an alternate for '%s'\n\0"
+/* 2355 */ "Version, usage and configuration options:\0"
+/* 2397 */ "\t\t\t\t- default option for unnamed options\n\0"
+/* 2439 */ "\t\t\t\t- disabled as '--%s'\n\0"
+/* 2465 */ " --- %-14s %s\n\0"
+/* 2480 */ "This option has been disabled\0"
+/* 2510 */ "\t\t\t\t- enabled by default\n\0"
+/* 2536 */ "%s error: only \0"
+/* 2553 */ " - examining environment variables named %s_*\n\0"
+/* 2600 */ "\t\t\t\t- file must not pre-exist\n\0"
+/* 2631 */ "\t\t\t\t- file must pre-exist\n\0"
+/* 2658 */ "Options are specified by doubled hyphens and their name or by a single\n"
"hyphen and the flag character.\n\0"
-/* 2779 */ "\n"
+/* 2761 */ "\n"
"= = = = = = = =\n\n"
"This incarnation of genshell will produce\n"
"a shell script to parse the options for %s:\n\n\0"
-/* 2885 */ " or an integer mask with any of the lower %d bits set\n\0"
-/* 2941 */ "\t\t\t\t- is a set membership option\n\0"
-/* 2975 */ "\t\t\t\t- must appear between %d and %d times\n\0"
-/* 3018 */ "Options are specified by single or double hyphens and their name.\n\0"
-/* 3085 */ "\t\t\t\t- may appear multiple times\n\0"
-/* 3118 */ "\t\t\t\t- may not be preset\n\0"
-/* 3143 */ " Arg Option-Name Description\n\0"
-/* 3178 */ " Flg Arg Option-Name Description\n\0"
-/* 3216 */ " %3s %s\0"
-/* 3224 */ "The '-#<number>' option may omit the hash char\n\0"
-/* 3272 */ "All arguments are named options.\n\0"
-/* 3306 */ " - reading file %s\0"
-/* 3325 */ "\n"
+/* 2867 */ " or an integer mask with any of the lower %d bits set\n\0"
+/* 2923 */ "\t\t\t\t- is a set membership option\n\0"
+/* 2957 */ "\t\t\t\t- must appear between %d and %d times\n\0"
+/* 3000 */ "Options are specified by single or double hyphens and their name.\n\0"
+/* 3067 */ "\t\t\t\t- may appear multiple times\n\0"
+/* 3100 */ "\t\t\t\t- may not be preset\n\0"
+/* 3125 */ " Arg Option-Name Description\n\0"
+/* 3160 */ " Flg Arg Option-Name Description\n\0"
+/* 3198 */ " %3s %s\0"
+/* 3206 */ "The '-#<number>' option may omit the hash char\n\0"
+/* 3254 */ "All arguments are named options.\n\0"
+/* 3288 */ " - reading file %s\0"
+/* 3307 */ "\n"
"Please send bug reports to: <%s>\n\0"
-/* 3361 */ "\t\t\t\t- may NOT appear - preset only\n\0"
-/* 3397 */ "\n"
+/* 3343 */ "\t\t\t\t- may NOT appear - preset only\n\0"
+/* 3379 */ "\n"
"The following option preset mechanisms are supported:\n\0"
-/* 3453 */ "prohibits these options:\n\0"
-/* 3479 */ "prohibits the option '%s'\n\0"
-/* 3506 */ "%s%ld to %ld\0"
-/* 3519 */ "%sgreater than or equal to %ld\0"
-/* 3550 */ "%s%ld exactly\0"
-/* 3564 */ "%sit must lie in one of the ranges:\n\0"
-/* 3601 */ "%sit must be in the range:\n\0"
-/* 3629 */ ", or\n\0"
-/* 3635 */ "%sis scalable with a suffix: k/K/m/M/g/G/t/T\n\0"
-/* 3681 */ "%sless than or equal to %ld\0"
-/* 3709 */ "Operands and options may be intermixed. They will be reordered.\n\0"
-/* 3775 */ "requires the option '%s'\n\0"
-/* 3801 */ "requires these options:\n\0"
-/* 3826 */ " Arg Option-Name Req? Description\n\0"
-/* 3866 */ " Flg Arg Option-Name Req? Description\n\0"
-/* 3909 */ "or you may use a numeric representation. Preceding these with a '!'\n"
+/* 3435 */ "prohibits these options:\n\0"
+/* 3461 */ "prohibits the option '%s'\n\0"
+/* 3488 */ "%s%ld to %ld\0"
+/* 3501 */ "%sgreater than or equal to %ld\0"
+/* 3532 */ "%s%ld exactly\0"
+/* 3546 */ "%sit must lie in one of the ranges:\n\0"
+/* 3583 */ "%sit must be in the range:\n\0"
+/* 3611 */ ", or\n\0"
+/* 3617 */ "%sis scalable with a suffix: k/K/m/M/g/G/t/T\n\0"
+/* 3663 */ "%sless than or equal to %ld\0"
+/* 3691 */ "Operands and options may be intermixed. They will be reordered.\n\0"
+/* 3757 */ "requires the option '%s'\n\0"
+/* 3783 */ "requires these options:\n\0"
+/* 3808 */ " Arg Option-Name Req? Description\n\0"
+/* 3848 */ " Flg Arg Option-Name Req? Description\n\0"
+/* 3891 */ "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\0"
-/* 4128 */ "\t\t\t\t- may appear up to %d times\n\0"
-/* 4161 */ "The valid \"%s\" option keywords are:\n\0"
-/* 4198 */ "The next option supports vendor supported extra options:\0"
-/* 4255 */ "These additional options are:";
+/* 4110 */ "\t\t\t\t- may appear up to %d times\n\0"
+/* 4143 */ "The valid \"%s\" option keywords are:\n\0"
+/* 4180 */ "The next option supports vendor supported extra options:\0"
+/* 4237 */ "These additional options are:";
/*
* Now, define (and initialize) the structure that contains
@@ -308,7 +306,7 @@ char const option_lib_text[4285] =
* Aren't you glad you don't maintain this by hand?
*/
usage_text_t option_xlateable_txt = {
- 108,
+ 107,
eng_zGnuBoolArg, eng_zGnuKeyArg, eng_zGnuNumArg, eng_zGnuStrArg,
{
option_lib_text + 0, option_lib_text + 31, option_lib_text + 83,
@@ -325,27 +323,27 @@ usage_text_t option_xlateable_txt = {
option_lib_text + 1490, option_lib_text + 1528, option_lib_text + 1574,
option_lib_text + 1619, option_lib_text + 1646, option_lib_text + 1695,
option_lib_text + 1744, option_lib_text + 1771, option_lib_text + 1804,
- option_lib_text + 1840, option_lib_text + 1890, option_lib_text + 1908,
- option_lib_text + 1962, option_lib_text + 2010, option_lib_text + 2057,
- option_lib_text + 2097, option_lib_text + 2132, option_lib_text + 2157,
- option_lib_text + 2173, option_lib_text + 2188, option_lib_text + 2194,
- option_lib_text + 2243, option_lib_text + 2288, option_lib_text + 2344,
- option_lib_text + 2373, option_lib_text + 2415, option_lib_text + 2457,
- option_lib_text + 2483, option_lib_text + 2498, option_lib_text + 2528,
- option_lib_text + 2554, option_lib_text + 2571, option_lib_text + 2618,
- option_lib_text + 2649, option_lib_text + 2676, option_lib_text + 2779,
- option_lib_text + 2885, option_lib_text + 2941, option_lib_text + 2975,
- option_lib_text + 3018, option_lib_text + 3085, option_lib_text + 3118,
- option_lib_text + 3143, option_lib_text + 3178, option_lib_text + 3216,
- option_lib_text + 3224, option_lib_text + 3272, option_lib_text + 3306,
- option_lib_text + 3325, option_lib_text + 3361, option_lib_text + 3397,
- option_lib_text + 3453, option_lib_text + 3479, option_lib_text + 3506,
- option_lib_text + 3519, option_lib_text + 3550, option_lib_text + 3564,
- option_lib_text + 3601, option_lib_text + 3629, option_lib_text + 3635,
- option_lib_text + 3681, option_lib_text + 3709, option_lib_text + 3775,
- option_lib_text + 3801, option_lib_text + 3826, option_lib_text + 3866,
- option_lib_text + 3909, option_lib_text + 4128, option_lib_text + 4161,
- option_lib_text + 4198, option_lib_text + 4255
+ option_lib_text + 1840, option_lib_text + 1890, option_lib_text + 1944,
+ option_lib_text + 1992, option_lib_text + 2039, option_lib_text + 2079,
+ option_lib_text + 2114, option_lib_text + 2139, option_lib_text + 2155,
+ option_lib_text + 2170, option_lib_text + 2176, option_lib_text + 2225,
+ option_lib_text + 2270, option_lib_text + 2326, option_lib_text + 2355,
+ option_lib_text + 2397, option_lib_text + 2439, option_lib_text + 2465,
+ option_lib_text + 2480, option_lib_text + 2510, option_lib_text + 2536,
+ option_lib_text + 2553, option_lib_text + 2600, option_lib_text + 2631,
+ option_lib_text + 2658, option_lib_text + 2761, option_lib_text + 2867,
+ option_lib_text + 2923, option_lib_text + 2957, option_lib_text + 3000,
+ option_lib_text + 3067, option_lib_text + 3100, option_lib_text + 3125,
+ option_lib_text + 3160, option_lib_text + 3198, option_lib_text + 3206,
+ option_lib_text + 3254, option_lib_text + 3288, option_lib_text + 3307,
+ option_lib_text + 3343, option_lib_text + 3379, option_lib_text + 3435,
+ option_lib_text + 3461, option_lib_text + 3488, option_lib_text + 3501,
+ option_lib_text + 3532, option_lib_text + 3546, option_lib_text + 3583,
+ option_lib_text + 3611, option_lib_text + 3617, option_lib_text + 3663,
+ option_lib_text + 3691, option_lib_text + 3757, option_lib_text + 3783,
+ option_lib_text + 3808, option_lib_text + 3848, option_lib_text + 3891,
+ option_lib_text + 4110, option_lib_text + 4143, option_lib_text + 4180,
+ option_lib_text + 4237
} };
#endif /* AUTOOPTS_INTERNAL */
@@ -364,234 +362,230 @@ static void dummy_func(void) {
/* LIBOPTS-MESSAGES: */
#line 67 "../autoopts.c"
puts(_("allocation of %d bytes failed\n"));
-#line 93 "../autoopts.c"
+#line 89 "../autoopts.c"
puts(_("allocation of %d bytes failed\n"));
-#line 53 "../init.c"
+#line 48 "../init.c"
puts(_("AutoOpts function called without option descriptor\n"));
-#line 86 "../init.c"
+#line 81 "../init.c"
puts(_("\tThis exceeds the compiled library version: "));
-#line 84 "../init.c"
+#line 79 "../init.c"
puts(_("Automated Options Processing Error!\n"
"\t%s called AutoOpts function with structure version %d:%d:%d.\n"));
-#line 80 "../autoopts.c"
+#line 78 "../autoopts.c"
puts(_("realloc of %d bytes at 0x%p failed\n"));
-#line 88 "../init.c"
+#line 83 "../init.c"
puts(_("\tThis is less than the minimum library version: "));
#line 121 "../version.c"
puts(_("Automated Options version %s\n"
- "\tCopyright (C) 1999-2014 by Bruce Korb - all rights reserved\n"));
-#line 87 "../makeshell.c"
+ "\tCopyright (C) 1999-2017 by Bruce Korb - all rights reserved\n"));
+#line 49 "../makeshell.c"
puts(_("(AutoOpts bug): %s.\n"));
#line 90 "../reset.c"
puts(_("optionResetOpt() called, but reset-option not configured"));
-#line 292 "../usage.c"
+#line 241 "../usage.c"
puts(_("could not locate the 'help' option"));
-#line 336 "../autoopts.c"
+#line 330 "../autoopts.c"
puts(_("optionProcess() was called with invalid data"));
-#line 748 "../usage.c"
+#line 697 "../usage.c"
puts(_("invalid argument type specified"));
-#line 598 "../find.c"
+#line 568 "../find.c"
puts(_("defaulted to option with optional arg"));
#line 76 "../alias.c"
puts(_("aliasing option is out of range."));
-#line 235 "../enum.c"
+#line 210 "../enum.c"
puts(_("%s error: the keyword '%s' is ambiguous for %s\n"));
-#line 108 "../find.c"
+#line 78 "../find.c"
puts(_(" The following options match:\n"));
-#line 293 "../find.c"
+#line 263 "../find.c"
puts(_("%s: ambiguous option name: %s (matches %d options)\n"));
#line 161 "../check.c"
puts(_("%s: Command line arguments required\n"));
#line 43 "../alias.c"
puts(_("%d %s%s options allowed\n"));
-#line 94 "../makeshell.c"
+#line 56 "../makeshell.c"
puts(_("%s error %d (%s) calling %s for '%s'\n"));
-#line 306 "../makeshell.c"
+#line 268 "../makeshell.c"
puts(_("interprocess pipe"));
-#line 168 "../version.c"
+#line 171 "../version.c"
puts(_("error: version option argument '%c' invalid. Use:\n"
"\t'v' - version only\n"
"\t'c' - version and copyright\n"
"\t'n' - version and full copyright notice\n"));
#line 58 "../check.c"
puts(_("%s error: the '%s' and '%s' options conflict\n"));
-#line 217 "../find.c"
+#line 187 "../find.c"
puts(_("%s: The '%s' option has been disabled."));
-#line 430 "../find.c"
+#line 400 "../find.c"
puts(_("%s: The '%s' option has been disabled."));
#line 38 "../alias.c"
puts(_("-equivalence"));
-#line 469 "../find.c"
+#line 439 "../find.c"
puts(_("%s: illegal option -- %c\n"));
#line 110 "../reset.c"
puts(_("%s: illegal option -- %c\n"));
-#line 271 "../find.c"
+#line 241 "../find.c"
puts(_("%s: illegal option -- %s\n"));
-#line 755 "../find.c"
+#line 740 "../find.c"
puts(_("%s: illegal option -- %s\n"));
#line 118 "../reset.c"
puts(_("%s: illegal option -- %s\n"));
-#line 335 "../find.c"
+#line 305 "../find.c"
puts(_("%s: unknown vendor extension option -- %s\n"));
-#line 160 "../enum.c"
+#line 135 "../enum.c"
puts(_(" or an integer from %d through %d\n"));
-#line 170 "../enum.c"
+#line 145 "../enum.c"
puts(_(" or an integer from %d through %d\n"));
-#line 747 "../usage.c"
+#line 696 "../usage.c"
puts(_("%s error: invalid option descriptor for %s\n"));
-#line 1081 "../usage.c"
+#line 1030 "../usage.c"
puts(_("%s error: invalid option descriptor for %s\n"));
-#line 385 "../find.c"
+#line 355 "../find.c"
puts(_("%s: invalid option name: %s\n"));
-#line 527 "../find.c"
+#line 497 "../find.c"
puts(_("%s: The '%s' option requires an argument.\n"));
-#line 156 "../autoopts.c"
+#line 150 "../autoopts.c"
puts(_("(AutoOpts bug): Equivalenced option '%s' was equivalenced to both\n"
"\t'%s' and '%s'."));
#line 94 "../check.c"
puts(_("%s error: The %s option is required\n"));
-#line 632 "../find.c"
+#line 602 "../find.c"
puts(_("%s: The '%s' option cannot have an argument.\n"));
#line 151 "../check.c"
puts(_("%s: Command line arguments are not allowed.\n"));
-#line 535 "../save.c"
+#line 568 "../save.c"
puts(_("error %d (%s) creating %s\n"));
-#line 235 "../enum.c"
+#line 210 "../enum.c"
puts(_("%s error: '%s' does not match any %s keywords.\n"));
#line 93 "../reset.c"
puts(_("%s error: The '%s' option requires an argument.\n"));
-#line 186 "../save.c"
+#line 122 "../save.c"
puts(_("error %d (%s) stat-ing %s\n"));
-#line 238 "../save.c"
+#line 175 "../save.c"
puts(_("error %d (%s) stat-ing %s\n"));
#line 143 "../restore.c"
puts(_("%s error: no saved option state\n"));
-#line 231 "../autoopts.c"
+#line 225 "../autoopts.c"
puts(_("'%s' is not a command line option.\n"));
#line 113 "../time.c"
puts(_("%s error: '%s' is not a recognizable date/time.\n"));
-#line 131 "../save.c"
- puts(_("'%s' not defined\n"));
#line 50 "../time.c"
puts(_("%s error: '%s' is not a recognizable time duration.\n"));
#line 92 "../check.c"
puts(_("%s error: The %s option must appear %d times.\n"));
#line 165 "../numeric.c"
puts(_("%s error: '%s' is not a recognizable number.\n"));
-#line 201 "../enum.c"
+#line 176 "../enum.c"
puts(_("%s error: %s exceeds %s keyword count\n"));
-#line 330 "../usage.c"
+#line 279 "../usage.c"
puts(_("Try '%s %s' for more information.\n"));
#line 45 "../alias.c"
puts(_("one %s%s option allowed\n"));
-#line 208 "../makeshell.c"
+#line 170 "../makeshell.c"
puts(_("standard output"));
-#line 943 "../makeshell.c"
+#line 905 "../makeshell.c"
puts(_("standard output"));
-#line 274 "../usage.c"
+#line 223 "../usage.c"
puts(_("standard output"));
-#line 415 "../usage.c"
+#line 364 "../usage.c"
puts(_("standard output"));
-#line 625 "../usage.c"
+#line 574 "../usage.c"
puts(_("standard output"));
-#line 175 "../version.c"
+#line 178 "../version.c"
puts(_("standard output"));
-#line 274 "../usage.c"
+#line 223 "../usage.c"
puts(_("standard error"));
-#line 415 "../usage.c"
+#line 364 "../usage.c"
puts(_("standard error"));
-#line 625 "../usage.c"
+#line 574 "../usage.c"
puts(_("standard error"));
-#line 175 "../version.c"
+#line 178 "../version.c"
puts(_("standard error"));
-#line 208 "../makeshell.c"
+#line 170 "../makeshell.c"
puts(_("write"));
-#line 943 "../makeshell.c"
+#line 905 "../makeshell.c"
puts(_("write"));
-#line 273 "../usage.c"
+#line 222 "../usage.c"
puts(_("write"));
-#line 414 "../usage.c"
+#line 363 "../usage.c"
puts(_("write"));
-#line 624 "../usage.c"
+#line 573 "../usage.c"
puts(_("write"));
-#line 174 "../version.c"
+#line 177 "../version.c"
puts(_("write"));
#line 60 "../numeric.c"
puts(_("%s error: %s option value %ld is out of range.\n"));
#line 44 "../check.c"
puts(_("%s error: %s option requires the %s option\n"));
-#line 130 "../save.c"
+#line 121 "../save.c"
puts(_("%s warning: cannot save options - %s not regular file\n"));
-#line 185 "../save.c"
+#line 174 "../save.c"
puts(_("%s warning: cannot save options - %s not regular file\n"));
-#line 237 "../save.c"
+#line 193 "../save.c"
puts(_("%s warning: cannot save options - %s not regular file\n"));
-#line 256 "../save.c"
- puts(_("%s warning: cannot save options - %s not regular file\n"));
-#line 534 "../save.c"
+#line 567 "../save.c"
puts(_("%s warning: cannot save options - %s not regular file\n"));
/* END-LIBOPTS-MESSAGES */
/* USAGE-TEXT: */
-#line 873 "../usage.c"
+#line 822 "../usage.c"
puts(_("\t\t\t\t- an alternate for '%s'\n"));
-#line 1148 "../usage.c"
+#line 1097 "../usage.c"
puts(_("Version, usage and configuration options:"));
-#line 924 "../usage.c"
+#line 873 "../usage.c"
puts(_("\t\t\t\t- default option for unnamed options\n"));
-#line 837 "../usage.c"
+#line 786 "../usage.c"
puts(_("\t\t\t\t- disabled as '--%s'\n"));
-#line 1117 "../usage.c"
+#line 1066 "../usage.c"
puts(_(" --- %-14s %s\n"));
-#line 1115 "../usage.c"
+#line 1064 "../usage.c"
puts(_("This option has been disabled"));
-#line 864 "../usage.c"
+#line 813 "../usage.c"
puts(_("\t\t\t\t- enabled by default\n"));
#line 40 "../alias.c"
puts(_("%s error: only "));
-#line 1194 "../usage.c"
+#line 1143 "../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 380 "../usage.c"
+#line 329 "../usage.c"
puts(_("Options are specified by doubled hyphens and their name or by a single\n"
"hyphen and the flag character.\n"));
-#line 921 "../makeshell.c"
+#line 882 "../makeshell.c"
puts(_("\n"
"= = = = = = = =\n\n"
"This incarnation of genshell will produce\n"
"a shell script to parse the options for %s:\n\n"));
-#line 167 "../enum.c"
+#line 142 "../enum.c"
puts(_(" or an integer mask with any of the lower %d bits set\n"));
-#line 897 "../usage.c"
+#line 846 "../usage.c"
puts(_("\t\t\t\t- is a set membership option\n"));
-#line 918 "../usage.c"
+#line 867 "../usage.c"
puts(_("\t\t\t\t- must appear between %d and %d times\n"));
-#line 382 "../usage.c"
+#line 331 "../usage.c"
puts(_("Options are specified by single or double hyphens and their name.\n"));
-#line 904 "../usage.c"
+#line 853 "../usage.c"
puts(_("\t\t\t\t- may appear multiple times\n"));
-#line 891 "../usage.c"
+#line 840 "../usage.c"
puts(_("\t\t\t\t- may not be preset\n"));
-#line 1309 "../usage.c"
+#line 1258 "../usage.c"
puts(_(" Arg Option-Name Description\n"));
-#line 1245 "../usage.c"
+#line 1194 "../usage.c"
puts(_(" Flg Arg Option-Name Description\n"));
-#line 1303 "../usage.c"
+#line 1252 "../usage.c"
puts(_(" Flg Arg Option-Name Description\n"));
-#line 1304 "../usage.c"
+#line 1253 "../usage.c"
puts(_(" %3s %s"));
-#line 1310 "../usage.c"
+#line 1259 "../usage.c"
puts(_(" %3s %s"));
-#line 387 "../usage.c"
+#line 336 "../usage.c"
puts(_("The '-#<number>' option may omit the hash char\n"));
-#line 383 "../usage.c"
+#line 332 "../usage.c"
puts(_("All arguments are named options.\n"));
-#line 971 "../usage.c"
+#line 920 "../usage.c"
puts(_(" - reading file %s"));
-#line 409 "../usage.c"
+#line 358 "../usage.c"
puts(_("\n"
"Please send bug reports to: <%s>\n"));
#line 100 "../version.c"
@@ -600,17 +594,17 @@ static void dummy_func(void) {
#line 129 "../version.c"
puts(_("\n"
"Please send bug reports to: <%s>\n"));
-#line 903 "../usage.c"
+#line 852 "../usage.c"
puts(_("\t\t\t\t- may NOT appear - preset only\n"));
-#line 944 "../usage.c"
+#line 893 "../usage.c"
puts(_("\n"
"The following option preset mechanisms are supported:\n"));
-#line 1192 "../usage.c"
+#line 1141 "../usage.c"
puts(_("\n"
"The following option preset mechanisms are supported:\n"));
-#line 682 "../usage.c"
+#line 631 "../usage.c"
puts(_("prohibits these options:\n"));
-#line 677 "../usage.c"
+#line 626 "../usage.c"
puts(_("prohibits the option '%s'\n"));
#line 81 "../numeric.c"
puts(_("%s%ld to %ld"));
@@ -628,28 +622,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 390 "../usage.c"
+#line 339 "../usage.c"
puts(_("Operands and options may be intermixed. They will be reordered.\n"));
-#line 652 "../usage.c"
+#line 601 "../usage.c"
puts(_("requires the option '%s'\n"));
-#line 655 "../usage.c"
+#line 604 "../usage.c"
puts(_("requires these options:\n"));
-#line 1321 "../usage.c"
+#line 1270 "../usage.c"
puts(_(" Arg Option-Name Req? Description\n"));
-#line 1315 "../usage.c"
+#line 1264 "../usage.c"
puts(_(" Flg Arg Option-Name Req? Description\n"));
-#line 168 "../enum.c"
+#line 143 "../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 910 "../usage.c"
+#line 859 "../usage.c"
puts(_("\t\t\t\t- may appear up to %d times\n"));
-#line 77 "../enum.c"
+#line 52 "../enum.c"
puts(_("The valid \"%s\" option keywords are:\n"));
-#line 1152 "../usage.c"
+#line 1101 "../usage.c"
puts(_("The next option supports vendor supported extra options:"));
-#line 773 "../usage.c"
+#line 722 "../usage.c"
puts(_("These additional options are:"));
/* END-USAGE-TEXT */
}
diff --git a/src/libopts/boolean.c b/src/libopts/boolean.c
index 2bea8e7f2a..80e0b0e97c 100644
--- a/src/libopts/boolean.c
+++ b/src/libopts/boolean.c
@@ -13,7 +13,7 @@
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2015 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2018 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
@@ -64,8 +64,8 @@ optionBooleanVal(tOptions * opts, tOptDesc * od)
long val = strtol(od->optArg.argString, &pz, 0);
if ((val != 0) || (*pz != NUL))
break;
- /* FALLTHROUGH */
}
+ /* FALLTHROUGH */
case 'N':
case 'n':
case 'F':
diff --git a/src/libopts/check.c b/src/libopts/check.c
index eff8ec0133..7e75e7eca6 100644
--- a/src/libopts/check.c
+++ b/src/libopts/check.c
@@ -9,7 +9,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2015 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2018 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
@@ -100,7 +100,7 @@ occurs_enough(tOptions * pOpts, tOptDesc * pOD)
*
* Make sure that the argument list passes our consistency tests.
*/
-LOCAL bool
+static bool
is_consistent(tOptions * pOpts)
{
tOptDesc * pOD = pOpts->pOptDesc;
diff --git a/src/libopts/compat/compat.h b/src/libopts/compat/compat.h
index 561d55db3c..70a5652a23 100644
--- a/src/libopts/compat/compat.h
+++ b/src/libopts/compat/compat.h
@@ -1,9 +1,9 @@
-/* -*- Mode: C -*-
+/* -*- Mode: C -*-
*
* compat.h is free software.
* This file is part of AutoGen and AutoOpts.
*
- * AutoGen Copyright (C) 1992-2015 by Bruce Korb - all rights reserved
+ * AutoGen Copyright (C) 1992-2018 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
@@ -182,9 +182,9 @@
# include <unistd.h>
#endif
-#ifdef HAVE_STDBOOL_H
+#if defined(HAVE_STDBOOL_H)
# include <stdbool.h>
-#else
+#elif ! defined(bool)
typedef enum { false = 0, true = 1 } _Bool;
# define bool _Bool
diff --git a/src/libopts/compat/pathfind.c b/src/libopts/compat/pathfind.c
index 5c477caf07..e188b72813 100644
--- a/src/libopts/compat/pathfind.c
+++ b/src/libopts/compat/pathfind.c
@@ -211,7 +211,7 @@ canonicalize_pathname( char *path )
(result[i + 2] == '/' || !result[i + 2])) {
while (--start > -1 && result[start] != '/')
;
- strcpy( result + start + 1, result + i + 2 );
+ memmove( result + start + 1, result + i + 2, strlen(result + i + 2) + 1 );
i = (start < 0) ? 0 : start;
continue;
}
diff --git a/src/libopts/compat/windows-config.h b/src/libopts/compat/windows-config.h
index fb4e048e64..7ce1636416 100644
--- a/src/libopts/compat/windows-config.h
+++ b/src/libopts/compat/windows-config.h
@@ -9,7 +9,7 @@
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2015 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2018 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
diff --git a/src/libopts/configfile.c b/src/libopts/configfile.c
index 6e7cd216b7..783a9d8acd 100644
--- a/src/libopts/configfile.c
+++ b/src/libopts/configfile.c
@@ -9,7 +9,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2015 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2018 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
@@ -28,50 +28,6 @@
* 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd
*/
-/* = = = START-STATIC-FORWARD = = = */
-static void
-file_preset(tOptions * opts, char const * fname, int dir);
-
-static char *
-handle_comment(char * txt);
-
-static char *
-handle_cfg(tOptions * opts, tOptState * ost, char * txt, int dir);
-
-static char *
-handle_directive(tOptions * opts, char * txt);
-
-static char *
-aoflags_directive(tOptions * opts, char * txt);
-
-static char *
-program_directive(tOptions * opts, char * txt);
-
-static char *
-handle_section(tOptions * opts, char * txt);
-
-static int
-parse_xml_encoding(char ** ppz);
-
-static char *
-trim_xml_text(char * intxt, char const * pznm, tOptionLoadMode mode);
-
-static void
-cook_xml_text(char * pzData);
-
-static char *
-handle_struct(tOptions * opts, tOptState * ost, char * txt, int dir);
-
-static char const *
-parse_keyword(tOptions * opts, char const * txt, tOptionValue * typ);
-
-static char const *
-parse_set_mem(tOptions * opts, char const * txt, tOptionValue * typ);
-
-static char const *
-parse_value(char const * txt, tOptionValue * typ);
-/* = = = END-STATIC-FORWARD = = = */
-
/**
* Skip over some unknown attribute
* @param[in] txt start of skpped text
@@ -466,6 +422,7 @@ file_preset(tOptions * opts, char const * fname, int dir)
ftext = strchr(ftext + 2, '>');
if (ftext++ != NULL)
break;
+ /* FALLTHROUGH */
default:
ftext = NULL;
@@ -626,9 +583,9 @@ handle_directive(tOptions * opts, char * txt)
for (ix = 0; ix < dir_ct; ix++) {
size_t len = strlen(dir_names[ix]);
- if ( (strncmp(txt + 2, dir_names[ix], len) == 0)
- && (! IS_VALUE_NAME_CHAR(txt[len+2])) )
- return dir_disp[ix](opts, txt + len + 2);
+ if ( (strncmp(txt, dir_names[ix], len) == 0)
+ && (! IS_VALUE_NAME_CHAR(txt[len])) )
+ return dir_disp[ix](opts, txt + len);
}
/*
@@ -681,38 +638,28 @@ aoflags_directive(tOptions * opts, char * txt)
static char *
program_directive(tOptions * opts, char * txt)
{
- static char const ttlfmt[] = "<?";
- size_t ttl_len = sizeof(ttlfmt) + strlen(zCfgProg);
- char * ttl = AGALOC(ttl_len, "prog title");
size_t name_len = strlen(opts->pzProgName);
- memcpy(ttl, ttlfmt, sizeof(ttlfmt) - 1);
- memcpy(ttl + sizeof(ttlfmt) - 1, zCfgProg, ttl_len - (sizeof(ttlfmt) - 1));
-
- do {
- txt = SPN_WHITESPACE_CHARS(txt+1);
+ for (;; txt += zCfgProg_LEN) {
+ txt = SPN_WHITESPACE_CHARS(txt);
if ( (strneqvcmp(txt, opts->pzProgName, (int)name_len) == 0)
- && (IS_END_XML_TOKEN_CHAR(txt[name_len])) ) {
- txt += name_len;
- break;
- }
+ && (IS_END_XML_TOKEN_CHAR(txt[name_len])) )
- txt = strstr(txt, ttl);
- } while (txt != NULL);
+ return txt + name_len;
- AGFREE(ttl);
- if (txt != NULL)
- for (;;) {
- if (*txt == NUL) {
- txt = NULL;
- break;
- }
- if (*(txt++) == '>')
- break;
- }
+ txt = strstr(txt, zCfgProg);
+ if (txt == NULL)
+ return txt;
+ }
- return txt;
+ for (;;) {
+ if (*txt == NUL)
+ return NULL;
+
+ if (*(txt++) == '>')
+ return txt;
+ }
}
/**
@@ -1006,7 +953,7 @@ handle_struct(tOptions * opts, tOptState * ost, char * txt, int dir)
* scanning the "homerc" list, or from a specific file request.
* (see "optionFileLoad()", the implementation for --load-opts)
*/
-LOCAL void
+static void
intern_file_load(tOptions * opts)
{
uint32_t svfl;
@@ -1207,7 +1154,7 @@ optionLoadOpt(tOptions * opts, tOptDesc * odesc)
*
* @returns NULL on failure, otherwise the scan point
*/
-LOCAL char const *
+static char const *
parse_attrs(tOptions * opts, char const * txt, tOptionLoadMode * pMode,
tOptionValue * pType)
{
diff --git a/src/libopts/cook.c b/src/libopts/cook.c
index 65260a2722..5240540f3a 100644
--- a/src/libopts/cook.c
+++ b/src/libopts/cook.c
@@ -10,7 +10,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2015 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2018 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
@@ -29,11 +29,6 @@
* 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd
*/
-/* = = = START-STATIC-FORWARD = = = */
-static bool
-contiguous_quote(char ** pps, char * pq, int * lnct_p);
-/* = = = END-STATIC-FORWARD = = = */
-
/*=export_func ao_string_cook_escape_char
* private:
*
@@ -135,6 +130,18 @@ ao_string_cook_escape_char(char const * pzIn, char * pRes, uint_t nl)
return res;
}
+/**
+ * count newlines between start and end
+ */
+static char *
+nl_count(char * start, char * end, int * lnct_p)
+{
+ while (start < end) {
+ if (*(start++) == NL)
+ (*lnct_p)++;
+ }
+ return end;
+}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
@@ -168,38 +175,22 @@ contiguous_quote(char ** pps, char * pq, int * lnct_p)
*/
switch (ps[1]) {
default:
- *pps = NULL;
- return false;
+ goto fail_return;
case '/':
/*
* Skip to end of line
*/
ps = strchr(ps, NL);
- if (ps == NULL) {
- *pps = NULL;
- return false;
- }
+ if (ps == NULL)
+ goto fail_return;
break;
case '*':
- {
- char * p = strstr( ps+2, "*/" );
- /*
- * Skip to terminating star slash
- */
- if (p == NULL) {
- *pps = NULL;
- return false;
- }
-
- while (ps < p) {
- if (*(ps++) == NL)
- (*lnct_p)++;
- }
-
- ps = p + 2;
- }
+ ps = nl_count(ps + 2, strstr(ps + 2, "*/"), lnct_p);
+ if (ps == NULL)
+ goto fail_return;
+ ps += 2;
}
continue;
@@ -212,6 +203,10 @@ contiguous_quote(char ** pps, char * pq, int * lnct_p)
return false;
}
}
+
+ fail_return:
+ *pps = NULL;
+ return false;
}
/*=export_func ao_string_cook
diff --git a/src/libopts/enum.c b/src/libopts/enum.c
index a08c9b1a50..7f92e0b022 100644
--- a/src/libopts/enum.c
+++ b/src/libopts/enum.c
@@ -14,7 +14,7 @@
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2015 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2018 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
@@ -33,31 +33,6 @@
* 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd
*/
-/* = = = START-STATIC-FORWARD = = = */
-static void
-enum_err(tOptions * pOpts, tOptDesc * pOD,
- char const * const * paz_names, int name_ct);
-
-static uintptr_t
-find_name(char const * name, tOptions * pOpts, tOptDesc * pOD,
- char const * const * paz_names, unsigned int name_ct);
-
-static void
-set_memb_shell(tOptions * pOpts, tOptDesc * pOD, char const * const * paz_names,
- unsigned int name_ct);
-
-static void
-set_memb_names(tOptions * opts, tOptDesc * od, char const * const * nm_list,
- unsigned int nm_ct);
-
-static uintptr_t
-check_membership_start(tOptDesc * od, char const ** argp, bool * invert);
-
-static uintptr_t
-find_member_bit(tOptions * opts, tOptDesc * od, char const * pz, int len,
- char const * const * nm_list, unsigned int nm_ct);
-/* = = = END-STATIC-FORWARD = = = */
-
static void
enum_err(tOptions * pOpts, tOptDesc * pOD,
char const * const * paz_names, int name_ct)
diff --git a/src/libopts/env.c b/src/libopts/env.c
index 36ae2e535a..16f0e9513d 100644
--- a/src/libopts/env.c
+++ b/src/libopts/env.c
@@ -13,7 +13,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2015 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2018 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
@@ -32,19 +32,13 @@
* 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd
*/
-/* = = = START-STATIC-FORWARD = = = */
-static void
-do_env_opt(tOptState * os, char * env_name,
- tOptions * pOpts, teEnvPresetType type);
-/* = = = END-STATIC-FORWARD = = = */
-
/*
* doPrognameEnv - check for preset values from the ${PROGNAME}
* environment variable. This is accomplished by parsing the text into
* tokens, temporarily replacing the arg vector and calling
* immediate_opts and/or regular_opts.
*/
-LOCAL void
+static void
doPrognameEnv(tOptions * pOpts, teEnvPresetType type)
{
char const * env_opts = getenv(pOpts->pzPROGNAME);
@@ -187,7 +181,7 @@ do_env_opt(tOptState * os, char * env_name,
* env_presets - check for preset values from the envrionment
* This routine should process in all, immediate or normal modes....
*/
-LOCAL void
+static void
env_presets(tOptions * pOpts, teEnvPresetType type)
{
int ct;
diff --git a/src/libopts/file.c b/src/libopts/file.c
index 7d92875d84..14efe8fe33 100644
--- a/src/libopts/file.c
+++ b/src/libopts/file.c
@@ -10,7 +10,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2015 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2018 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
diff --git a/src/libopts/find.c b/src/libopts/find.c
index 90591cc924..03ae103731 100644
--- a/src/libopts/find.c
+++ b/src/libopts/find.c
@@ -12,7 +12,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2015 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2018 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
@@ -31,36 +31,6 @@
* 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd
*/
-/* = = = START-STATIC-FORWARD = = = */
-static int
-parse_opt(char const ** nm_pp, char ** arg_pp, char * buf, size_t bufsz);
-
-static void
-opt_ambiguities(tOptions * opts, char const * name, int nm_len);
-
-static int
-opt_match_ct(tOptions * opts, char const * name, int nm_len,
- int * ixp, bool * disable);
-
-static tSuccess
-opt_set(tOptions * opts, char * arg, int idx, bool disable, tOptState * st);
-
-static tSuccess
-opt_unknown(tOptions * opts, char const * name, char * arg, tOptState * st);
-
-static tSuccess
-opt_ambiguous(tOptions * opts, char const * name, int match_ct);
-
-static tSuccess
-get_opt_arg_must(tOptions * opts, tOptState * o_st);
-
-static tSuccess
-get_opt_arg_may(tOptions * pOpts, tOptState * o_st);
-
-static tSuccess
-get_opt_arg_none(tOptions * pOpts, tOptState * o_st);
-/* = = = END-STATIC-FORWARD = = = */
-
/**
* find the name and name length we are looking for
*/
@@ -367,7 +337,7 @@ optionVendorOption(tOptions * pOpts, tOptDesc * pOD)
*
* @return success status
*/
-LOCAL tSuccess
+static tSuccess
opt_find_long(tOptions * opts, char const * opt_name, tOptState * state)
{
char name_buf[128];
@@ -408,7 +378,7 @@ opt_find_long(tOptions * opts, char const * opt_name, tOptState * state)
* @param optValue option flag character
* @param pOptState state about current option
*/
-LOCAL tSuccess
+static tSuccess
opt_find_short(tOptions * pOpts, uint_t optValue, tOptState * pOptState)
{
tOptDesc * pRes = pOpts->pOptDesc;
@@ -638,6 +608,7 @@ get_opt_arg_none(tOptions * pOpts, tOptState * o_st)
*/
else
pOpts->pzCurOpt = NULL;
+
return SUCCESS;
}
@@ -648,7 +619,7 @@ get_opt_arg_none(tOptions * pOpts, tOptState * o_st)
* @param[in,out] o_st the option processing state
* @returns SUCCESS or FAILURE
*/
-LOCAL tSuccess
+static tSuccess
get_opt_arg(tOptions * opts, tOptState * o_st)
{
o_st->flags |= (o_st->pOD->fOptState & OPTST_PERSISTENT_MASK);
@@ -658,10 +629,24 @@ get_opt_arg(tOptions * opts, tOptState * o_st)
* are handled with the "none" procedure. Otherwise, check the
* optional flag and call either the "may" or "must" function.
*/
- if ( ((o_st->flags & OPTST_DISABLED) != 0)
- || (OPTST_GET_ARGTYPE(o_st->flags) == OPARG_TYPE_NONE))
+ if ((o_st->flags & OPTST_DISABLED) != 0)
return get_opt_arg_none(opts, o_st);
-
+
+ switch (OPTST_GET_ARGTYPE(o_st->flags)) {
+ case OPARG_TYPE_STATIC:
+ {
+ /*
+ * Propagate the static arg
+ */
+ tSuccess res = get_opt_arg_none(opts, o_st);
+ o_st->pzOptArg = o_st->pOD->optArg.argString;
+ return res;
+ }
+
+ case OPARG_TYPE_NONE:
+ return get_opt_arg_none(opts, o_st);
+ }
+
if (o_st->flags & OPTST_ARG_OPTIONAL)
return get_opt_arg_may( opts, o_st);
@@ -675,7 +660,7 @@ get_opt_arg(tOptions * opts, tOptState * o_st)
* @param[in,out] o_st the option processing state
* @returns SUCCESS or FAILURE
*/
-LOCAL tSuccess
+static tSuccess
find_opt(tOptions * opts, tOptState * o_st)
{
/*
diff --git a/src/libopts/genshell.c b/src/libopts/genshell.c
index 020d54d77e..05182a6014 100644
--- a/src/libopts/genshell.c
+++ b/src/libopts/genshell.c
@@ -6,7 +6,7 @@
* From the definitions genshell.def
* and the template file options
*
- * Generated from AutoOpts 41:1:16 templates.
+ * Generated from AutoOpts 42:1:17 templates.
*
* AutoOpts is a copyrighted work. This source file is not encumbered
* by AutoOpts licensing, but is provided under the licensing terms chosen
@@ -19,10 +19,10 @@
* The genshellopt program is copyrighted and licensed
* under the following terms:
*
- * Copyright (C) 1999-2014 Bruce Korb, all rights reserved.
+ * Copyright (C) 1999-2018 Bruce Korb, all rights reserved.
* This is free software. It is licensed for use, modification and
* redistribution under the terms of the GNU Lesser General Public License,
- * version 2 or later <https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html>
+ * version 2 or later <http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html>
*
* The genshellopt library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public License as
@@ -36,17 +36,22 @@
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, see
- * <https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html>
+ * <http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html>
*/
#ifndef __doxygen__
#define OPTION_CODE_COMPILE 1
#include "genshell.h"
#include <sys/types.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <fcntl.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
#ifdef __cplusplus
extern "C" {
@@ -66,10 +71,10 @@ extern tUsageProc genshelloptUsage;
*/
static char const genshellopt_opt_strs[1769] =
/* 0 */ "genshellopt 1\n"
- "Copyright (C) 1999-2014 Bruce Korb, all rights reserved.\n"
+ "Copyright (C) 1999-2018 Bruce Korb, all rights reserved.\n"
"This is free software. It is licensed for use, modification and\n"
"redistribution under the terms of the GNU Lesser General Public License,\n"
- "version 2 or later <https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html>\n\0"
+ "version 2 or later <http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html>\n\0"
/* 285 */ "The genshellopt library is free software; you can redistribute it and/or\n"
"modify it under the terms of the GNU Library General Public License as\n"
"published by the Free Software Foundation; either version 2 of the License,\n"
@@ -80,7 +85,7 @@ static char const genshellopt_opt_strs[1769] =
"License for more details.\n\n"
"You should have received a copy of the GNU Library General Public License\n"
"along with this library; if not, see\n"
- "<https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html>\n\0"
+ "<http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html>\n\0"
/* 957 */ "Output Script File\0"
/* 976 */ "SCRIPT\0"
/* 983 */ "script\0"
@@ -258,7 +263,7 @@ static tOptDesc optDesc[GENSHELL_OPTION_CT] = {
#define zDetail (genshellopt_opt_strs+1534)
/** The full version string for genshellopt. */
#define zFullVersion (genshellopt_opt_strs+1755)
-/* extracted from optcode.tlib near line 364 */
+/* extracted from optcode.tlib near line 342 */
#if defined(ENABLE_NLS)
# define OPTPROC_BASE OPTPROC_TRANSLATE
@@ -481,22 +486,22 @@ static void bogus_function(void) {
extract the correct strings. These strings are actually referenced
by a field name in the genshelloptOptions structure noted in the
comments below. The literal text is defined in genshellopt_opt_strs.
-
+
NOTE: the strings below are segmented with respect to the source string
genshellopt_opt_strs. The strings above are handed off for translation
at run time a paragraph at a time. Consequently, they are presented here
for translation a paragraph at a time.
-
+
ALSO: often the description for an option will reference another option
by name. These are set off with apostrophe quotes (I hope). Do not
translate option names.
*/
/* referenced via genshelloptOptions.pzCopyright */
puts(_("genshellopt 1\n\
-Copyright (C) 1999-2014 Bruce Korb, all rights reserved.\n\
+Copyright (C) 1999-2018 Bruce Korb, all rights reserved.\n\
This is free software. It is licensed for use, modification and\n\
redistribution under the terms of the GNU Lesser General Public License,\n\
-version 2 or later <https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html>\n"));
+version 2 or later <http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html>\n"));
/* referenced via genshelloptOptions.pzCopyNotice */
puts(_("The genshellopt library is free software; you can redistribute it and/or\n\
@@ -509,7 +514,7 @@ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public\n\
License for more details.\n\n"));
puts(_("You should have received a copy of the GNU Library General Public License\n\
along with this library; if not, see\n\
-<https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html>\n"));
+<http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html>\n"));
/* referenced via genshelloptOptions.pOptDesc->pzText */
puts(_("Output Script File"));
@@ -551,234 +556,230 @@ by the newly generated text. The first '#!' line will be regenerated.\n"));
/* LIBOPTS-MESSAGES: */
#line 67 "../autoopts.c"
puts(_("allocation of %d bytes failed\n"));
-#line 93 "../autoopts.c"
+#line 89 "../autoopts.c"
puts(_("allocation of %d bytes failed\n"));
-#line 53 "../init.c"
+#line 48 "../init.c"
puts(_("AutoOpts function called without option descriptor\n"));
-#line 86 "../init.c"
+#line 81 "../init.c"
puts(_("\tThis exceeds the compiled library version: "));
-#line 84 "../init.c"
+#line 79 "../init.c"
puts(_("Automated Options Processing Error!\n"
"\t%s called AutoOpts function with structure version %d:%d:%d.\n"));
-#line 80 "../autoopts.c"
+#line 78 "../autoopts.c"
puts(_("realloc of %d bytes at 0x%p failed\n"));
-#line 88 "../init.c"
+#line 83 "../init.c"
puts(_("\tThis is less than the minimum library version: "));
#line 121 "../version.c"
puts(_("Automated Options version %s\n"
- "\tCopyright (C) 1999-2014 by Bruce Korb - all rights reserved\n"));
-#line 87 "../makeshell.c"
+ "\tCopyright (C) 1999-2017 by Bruce Korb - all rights reserved\n"));
+#line 49 "../makeshell.c"
puts(_("(AutoOpts bug): %s.\n"));
#line 90 "../reset.c"
puts(_("optionResetOpt() called, but reset-option not configured"));
-#line 292 "../usage.c"
+#line 241 "../usage.c"
puts(_("could not locate the 'help' option"));
-#line 336 "../autoopts.c"
+#line 330 "../autoopts.c"
puts(_("optionProcess() was called with invalid data"));
-#line 748 "../usage.c"
+#line 697 "../usage.c"
puts(_("invalid argument type specified"));
-#line 598 "../find.c"
+#line 568 "../find.c"
puts(_("defaulted to option with optional arg"));
#line 76 "../alias.c"
puts(_("aliasing option is out of range."));
-#line 235 "../enum.c"
+#line 210 "../enum.c"
puts(_("%s error: the keyword '%s' is ambiguous for %s\n"));
-#line 108 "../find.c"
+#line 78 "../find.c"
puts(_(" The following options match:\n"));
-#line 293 "../find.c"
+#line 263 "../find.c"
puts(_("%s: ambiguous option name: %s (matches %d options)\n"));
#line 161 "../check.c"
puts(_("%s: Command line arguments required\n"));
#line 43 "../alias.c"
puts(_("%d %s%s options allowed\n"));
-#line 94 "../makeshell.c"
+#line 56 "../makeshell.c"
puts(_("%s error %d (%s) calling %s for '%s'\n"));
-#line 306 "../makeshell.c"
+#line 268 "../makeshell.c"
puts(_("interprocess pipe"));
-#line 168 "../version.c"
+#line 171 "../version.c"
puts(_("error: version option argument '%c' invalid. Use:\n"
"\t'v' - version only\n"
"\t'c' - version and copyright\n"
"\t'n' - version and full copyright notice\n"));
#line 58 "../check.c"
puts(_("%s error: the '%s' and '%s' options conflict\n"));
-#line 217 "../find.c"
+#line 187 "../find.c"
puts(_("%s: The '%s' option has been disabled."));
-#line 430 "../find.c"
+#line 400 "../find.c"
puts(_("%s: The '%s' option has been disabled."));
#line 38 "../alias.c"
puts(_("-equivalence"));
-#line 469 "../find.c"
+#line 439 "../find.c"
puts(_("%s: illegal option -- %c\n"));
#line 110 "../reset.c"
puts(_("%s: illegal option -- %c\n"));
-#line 271 "../find.c"
+#line 241 "../find.c"
puts(_("%s: illegal option -- %s\n"));
-#line 755 "../find.c"
+#line 740 "../find.c"
puts(_("%s: illegal option -- %s\n"));
#line 118 "../reset.c"
puts(_("%s: illegal option -- %s\n"));
-#line 335 "../find.c"
+#line 305 "../find.c"
puts(_("%s: unknown vendor extension option -- %s\n"));
-#line 160 "../enum.c"
+#line 135 "../enum.c"
puts(_(" or an integer from %d through %d\n"));
-#line 170 "../enum.c"
+#line 145 "../enum.c"
puts(_(" or an integer from %d through %d\n"));
-#line 747 "../usage.c"
+#line 696 "../usage.c"
puts(_("%s error: invalid option descriptor for %s\n"));
-#line 1081 "../usage.c"
+#line 1030 "../usage.c"
puts(_("%s error: invalid option descriptor for %s\n"));
-#line 385 "../find.c"
+#line 355 "../find.c"
puts(_("%s: invalid option name: %s\n"));
-#line 527 "../find.c"
+#line 497 "../find.c"
puts(_("%s: The '%s' option requires an argument.\n"));
-#line 156 "../autoopts.c"
+#line 150 "../autoopts.c"
puts(_("(AutoOpts bug): Equivalenced option '%s' was equivalenced to both\n"
"\t'%s' and '%s'."));
#line 94 "../check.c"
puts(_("%s error: The %s option is required\n"));
-#line 632 "../find.c"
+#line 602 "../find.c"
puts(_("%s: The '%s' option cannot have an argument.\n"));
#line 151 "../check.c"
puts(_("%s: Command line arguments are not allowed.\n"));
-#line 535 "../save.c"
+#line 568 "../save.c"
puts(_("error %d (%s) creating %s\n"));
-#line 235 "../enum.c"
+#line 210 "../enum.c"
puts(_("%s error: '%s' does not match any %s keywords.\n"));
#line 93 "../reset.c"
puts(_("%s error: The '%s' option requires an argument.\n"));
-#line 186 "../save.c"
+#line 122 "../save.c"
puts(_("error %d (%s) stat-ing %s\n"));
-#line 238 "../save.c"
+#line 175 "../save.c"
puts(_("error %d (%s) stat-ing %s\n"));
#line 143 "../restore.c"
puts(_("%s error: no saved option state\n"));
-#line 231 "../autoopts.c"
+#line 225 "../autoopts.c"
puts(_("'%s' is not a command line option.\n"));
#line 113 "../time.c"
puts(_("%s error: '%s' is not a recognizable date/time.\n"));
-#line 131 "../save.c"
- puts(_("'%s' not defined\n"));
#line 50 "../time.c"
puts(_("%s error: '%s' is not a recognizable time duration.\n"));
#line 92 "../check.c"
puts(_("%s error: The %s option must appear %d times.\n"));
#line 165 "../numeric.c"
puts(_("%s error: '%s' is not a recognizable number.\n"));
-#line 201 "../enum.c"
+#line 176 "../enum.c"
puts(_("%s error: %s exceeds %s keyword count\n"));
-#line 330 "../usage.c"
+#line 279 "../usage.c"
puts(_("Try '%s %s' for more information.\n"));
#line 45 "../alias.c"
puts(_("one %s%s option allowed\n"));
-#line 208 "../makeshell.c"
+#line 170 "../makeshell.c"
puts(_("standard output"));
-#line 943 "../makeshell.c"
+#line 905 "../makeshell.c"
puts(_("standard output"));
-#line 274 "../usage.c"
+#line 223 "../usage.c"
puts(_("standard output"));
-#line 415 "../usage.c"
+#line 364 "../usage.c"
puts(_("standard output"));
-#line 625 "../usage.c"
+#line 574 "../usage.c"
puts(_("standard output"));
-#line 175 "../version.c"
+#line 178 "../version.c"
puts(_("standard output"));
-#line 274 "../usage.c"
+#line 223 "../usage.c"
puts(_("standard error"));
-#line 415 "../usage.c"
+#line 364 "../usage.c"
puts(_("standard error"));
-#line 625 "../usage.c"
+#line 574 "../usage.c"
puts(_("standard error"));
-#line 175 "../version.c"
+#line 178 "../version.c"
puts(_("standard error"));
-#line 208 "../makeshell.c"
+#line 170 "../makeshell.c"
puts(_("write"));
-#line 943 "../makeshell.c"
+#line 905 "../makeshell.c"
puts(_("write"));
-#line 273 "../usage.c"
+#line 222 "../usage.c"
puts(_("write"));
-#line 414 "../usage.c"
+#line 363 "../usage.c"
puts(_("write"));
-#line 624 "../usage.c"
+#line 573 "../usage.c"
puts(_("write"));
-#line 174 "../version.c"
+#line 177 "../version.c"
puts(_("write"));
#line 60 "../numeric.c"
puts(_("%s error: %s option value %ld is out of range.\n"));
#line 44 "../check.c"
puts(_("%s error: %s option requires the %s option\n"));
-#line 130 "../save.c"
- puts(_("%s warning: cannot save options - %s not regular file\n"));
-#line 185 "../save.c"
+#line 121 "../save.c"
puts(_("%s warning: cannot save options - %s not regular file\n"));
-#line 237 "../save.c"
+#line 174 "../save.c"
puts(_("%s warning: cannot save options - %s not regular file\n"));
-#line 256 "../save.c"
+#line 193 "../save.c"
puts(_("%s warning: cannot save options - %s not regular file\n"));
-#line 534 "../save.c"
+#line 567 "../save.c"
puts(_("%s warning: cannot save options - %s not regular file\n"));
/* END-LIBOPTS-MESSAGES */
/* USAGE-TEXT: */
-#line 873 "../usage.c"
+#line 822 "../usage.c"
puts(_("\t\t\t\t- an alternate for '%s'\n"));
-#line 1148 "../usage.c"
+#line 1097 "../usage.c"
puts(_("Version, usage and configuration options:"));
-#line 924 "../usage.c"
+#line 873 "../usage.c"
puts(_("\t\t\t\t- default option for unnamed options\n"));
-#line 837 "../usage.c"
+#line 786 "../usage.c"
puts(_("\t\t\t\t- disabled as '--%s'\n"));
-#line 1117 "../usage.c"
+#line 1066 "../usage.c"
puts(_(" --- %-14s %s\n"));
-#line 1115 "../usage.c"
+#line 1064 "../usage.c"
puts(_("This option has been disabled"));
-#line 864 "../usage.c"
+#line 813 "../usage.c"
puts(_("\t\t\t\t- enabled by default\n"));
#line 40 "../alias.c"
puts(_("%s error: only "));
-#line 1194 "../usage.c"
+#line 1143 "../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 380 "../usage.c"
+#line 329 "../usage.c"
puts(_("Options are specified by doubled hyphens and their name or by a single\n"
"hyphen and the flag character.\n"));
-#line 921 "../makeshell.c"
+#line 882 "../makeshell.c"
puts(_("\n"
"= = = = = = = =\n\n"
"This incarnation of genshell will produce\n"
"a shell script to parse the options for %s:\n\n"));
-#line 167 "../enum.c"
+#line 142 "../enum.c"
puts(_(" or an integer mask with any of the lower %d bits set\n"));
-#line 897 "../usage.c"
+#line 846 "../usage.c"
puts(_("\t\t\t\t- is a set membership option\n"));
-#line 918 "../usage.c"
+#line 867 "../usage.c"
puts(_("\t\t\t\t- must appear between %d and %d times\n"));
-#line 382 "../usage.c"
+#line 331 "../usage.c"
puts(_("Options are specified by single or double hyphens and their name.\n"));
-#line 904 "../usage.c"
+#line 853 "../usage.c"
puts(_("\t\t\t\t- may appear multiple times\n"));
-#line 891 "../usage.c"
+#line 840 "../usage.c"
puts(_("\t\t\t\t- may not be preset\n"));
-#line 1309 "../usage.c"
+#line 1258 "../usage.c"
puts(_(" Arg Option-Name Description\n"));
-#line 1245 "../usage.c"
+#line 1194 "../usage.c"
puts(_(" Flg Arg Option-Name Description\n"));
-#line 1303 "../usage.c"
+#line 1252 "../usage.c"
puts(_(" Flg Arg Option-Name Description\n"));
-#line 1304 "../usage.c"
+#line 1253 "../usage.c"
puts(_(" %3s %s"));
-#line 1310 "../usage.c"
+#line 1259 "../usage.c"
puts(_(" %3s %s"));
-#line 387 "../usage.c"
+#line 336 "../usage.c"
puts(_("The '-#<number>' option may omit the hash char\n"));
-#line 383 "../usage.c"
+#line 332 "../usage.c"
puts(_("All arguments are named options.\n"));
-#line 971 "../usage.c"
+#line 920 "../usage.c"
puts(_(" - reading file %s"));
-#line 409 "../usage.c"
+#line 358 "../usage.c"
puts(_("\n"
"Please send bug reports to: <%s>\n"));
#line 100 "../version.c"
@@ -787,17 +788,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 903 "../usage.c"
+#line 852 "../usage.c"
puts(_("\t\t\t\t- may NOT appear - preset only\n"));
-#line 944 "../usage.c"
+#line 893 "../usage.c"
puts(_("\n"
"The following option preset mechanisms are supported:\n"));
-#line 1192 "../usage.c"
+#line 1141 "../usage.c"
puts(_("\n"
"The following option preset mechanisms are supported:\n"));
-#line 682 "../usage.c"
+#line 631 "../usage.c"
puts(_("prohibits these options:\n"));
-#line 677 "../usage.c"
+#line 626 "../usage.c"
puts(_("prohibits the option '%s'\n"));
#line 81 "../numeric.c"
puts(_("%s%ld to %ld"));
@@ -815,28 +816,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 390 "../usage.c"
+#line 339 "../usage.c"
puts(_("Operands and options may be intermixed. They will be reordered.\n"));
-#line 652 "../usage.c"
+#line 601 "../usage.c"
puts(_("requires the option '%s'\n"));
-#line 655 "../usage.c"
+#line 604 "../usage.c"
puts(_("requires these options:\n"));
-#line 1321 "../usage.c"
+#line 1270 "../usage.c"
puts(_(" Arg Option-Name Req? Description\n"));
-#line 1315 "../usage.c"
+#line 1264 "../usage.c"
puts(_(" Flg Arg Option-Name Req? Description\n"));
-#line 168 "../enum.c"
+#line 143 "../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 910 "../usage.c"
+#line 859 "../usage.c"
puts(_("\t\t\t\t- may appear up to %d times\n"));
-#line 77 "../enum.c"
+#line 52 "../enum.c"
puts(_("The valid \"%s\" option keywords are:\n"));
-#line 1152 "../usage.c"
+#line 1101 "../usage.c"
puts(_("The next option supports vendor supported extra options:"));
-#line 773 "../usage.c"
+#line 722 "../usage.c"
puts(_("These additional options are:"));
/* END-USAGE-TEXT */
}
diff --git a/src/libopts/genshell.h b/src/libopts/genshell.h
index 1ea44de71a..994af16909 100644
--- a/src/libopts/genshell.h
+++ b/src/libopts/genshell.h
@@ -6,7 +6,7 @@
* From the definitions genshell.def
* and the template file options
*
- * Generated from AutoOpts 41:1:16 templates.
+ * Generated from AutoOpts 42:1:17 templates.
*
* AutoOpts is a copyrighted work. This header file is not encumbered
* by AutoOpts licensing, but is provided under the licensing terms chosen
@@ -19,10 +19,10 @@
* The genshellopt program is copyrighted and licensed
* under the following terms:
*
- * Copyright (C) 1999-2014 Bruce Korb, all rights reserved.
+ * Copyright (C) 1999-2018 Bruce Korb, all rights reserved.
* This is free software. It is licensed for use, modification and
* redistribution under the terms of the GNU Lesser General Public License,
- * version 2 or later <https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html>
+ * version 2 or later <http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html>
*
* The genshellopt library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public License as
@@ -36,7 +36,7 @@
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, see
- * <https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html>
+ * <http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html>
*/
/**
* This file contains the programmatic interface to the Automated
@@ -47,6 +47,8 @@
#ifndef AUTOOPTS_GENSHELL_H_GUARD
#define AUTOOPTS_GENSHELL_H_GUARD 1
#include <autoopts/options.h>
+#include <stdarg.h>
+#include <stdnoreturn.h>
/**
* Ensure that the library used for compiling this generated header is at
@@ -55,13 +57,19 @@
* tolerable version is at least as old as what was current when the header
* template was released.
*/
-#define AO_TEMPLATE_VERSION 167937
+#define AO_TEMPLATE_VERSION 172033
#if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
|| (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
# error option template version mismatches autoopts/options.h header
Choke Me.
#endif
+#if GCC_VERSION > 40400
+#define NOT_REACHED __builtin_unreachable();
+#else
+#define NOT_REACHED
+#endif
+
/**
* Enumeration of each option type for genshellopt
*/
@@ -150,6 +158,12 @@ typedef enum {
#ifdef __cplusplus
extern "C" {
#endif
+/*
+ * global exported definitions
+ */
+#define ch_t unsigned char
+#define cc_t const unsigned char
+#define cch_t char const
/* * * * * *
@@ -201,6 +215,7 @@ static inline char* aoGetsText(char const* pz) {
# endif
#endif /* ENABLE_NLS */
+
#ifdef __cplusplus
}
#endif
diff --git a/src/libopts/gettext.h b/src/libopts/gettext.h
index 2a6fe9e112..87ec81930d 100644
--- a/src/libopts/gettext.h
+++ b/src/libopts/gettext.h
@@ -1,5 +1,5 @@
/* Convenience header for conditional use of GNU <libintl.h>.
- Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2015 Free Software
+ Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2018 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
@@ -18,8 +18,9 @@
#ifndef _LIBGETTEXT_H
#define _LIBGETTEXT_H 1
-/* NLS can be disabled through the configure --disable-nls option. */
-#if ENABLE_NLS
+/* NLS can be disabled through the configure --disable-nls option
+ or through "#define ENABLE NLS 0" before including this file. */
+#if defined ENABLE_NLS && ENABLE_NLS
/* Get declarations of GNU message catalog functions. */
# include <libintl.h>
@@ -184,7 +185,8 @@ npgettext_aux (const char *domain,
#include <string.h>
#if (((__GNUC__ >= 3 || __GNUG__ >= 2) && !defined __STRICT_ANSI__) \
- /* || __STDC_VERSION__ >= 199901L */ )
+ /* || __STDC_VERSION__ == 199901L
+ || (__STDC_VERSION__ >= 201112L && !defined __STDC_NO_VLA__) */ )
# define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 1
#else
# define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 0
@@ -225,15 +227,17 @@ dcpgettext_expr (const char *domain,
if (msg_ctxt_id != NULL)
#endif
{
+ int found_translation;
memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
msg_ctxt_id[msgctxt_len - 1] = '\004';
memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
translation = dcgettext (domain, msg_ctxt_id, category);
+ found_translation = (translation != msg_ctxt_id);
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
if (msg_ctxt_id != buf)
free (msg_ctxt_id);
#endif
- if (translation != msg_ctxt_id)
+ if (found_translation)
return translation;
}
return msgid;
@@ -271,15 +275,17 @@ dcnpgettext_expr (const char *domain,
if (msg_ctxt_id != NULL)
#endif
{
+ int found_translation;
memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
msg_ctxt_id[msgctxt_len - 1] = '\004';
memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
+ found_translation = !(translation == msg_ctxt_id || translation == msgid_plural);
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
if (msg_ctxt_id != buf)
free (msg_ctxt_id);
#endif
- if (!(translation == msg_ctxt_id || translation == msgid_plural))
+ if (found_translation)
return translation;
}
return (n == 1 ? msgid : msgid_plural);
diff --git a/src/libopts/init.c b/src/libopts/init.c
index e02e1e1b9b..b65e593914 100644
--- a/src/libopts/init.c
+++ b/src/libopts/init.c
@@ -9,7 +9,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2015 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2018 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
@@ -28,11 +28,6 @@
* 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd
*/
-/* = = = START-STATIC-FORWARD = = = */
-static tSuccess
-do_presets(tOptions * opts);
-/* = = = END-STATIC-FORWARD = = = */
-
/**
* Make sure the option descriptor is there and that we understand it.
* This should be called from any user entry point where one needs to
@@ -46,7 +41,7 @@ do_presets(tOptions * opts);
* @param[in] pname name of program, from argv[]
* @returns SUCCESS or FAILURE
*/
-LOCAL tSuccess
+static tSuccess
validate_struct(tOptions * opts, char const * pname)
{
if (opts == NULL) {
@@ -142,7 +137,7 @@ validate_struct(tOptions * opts, char const * pname)
* @param pOpts program options descriptor
* @returns SUCCESS or FAILURE
*/
-LOCAL tSuccess
+static tSuccess
immediate_opts(tOptions * opts)
{
tSuccess res;
@@ -247,7 +242,7 @@ do_presets(tOptions * opts)
* @param[in] a_ct program argument count
* @param[in] a_v program argument vector
*/
-LOCAL bool
+static bool
ao_initialize(tOptions * opts, int a_ct, char ** a_v)
{
if ((opts->fOptSet & OPTPROC_INITDONE) != 0)
diff --git a/src/libopts/intprops.h b/src/libopts/intprops.h
index ee2ca969fb..af456ff589 100644
--- a/src/libopts/intprops.h
+++ b/src/libopts/intprops.h
@@ -1,10 +1,10 @@
/* intprops.h -- properties of integer types
- Copyright (C) 2001-2005, 2009-2015 Free Software Foundation, Inc.
+ Copyright (C) 2001-2018 Free Software Foundation, Inc.
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published
+ by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -22,12 +22,11 @@
#include <limits.h>
-/* Return an integer value, converted to the same type as the integer
- expression E after integer type promotion. V is the unconverted value. */
+/* Return a value with the common real type of E and V and the value of V. */
#define _GL_INT_CONVERT(e, v) (0 * (e) + (v))
/* Act like _GL_INT_CONVERT (E, -V) but work around a bug in IRIX 6.5 cc; see
- <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00406.html>. */
+ <https://lists.gnu.org/r/bug-gnulib/2011-05/msg00406.html>. */
#define _GL_INT_NEGATE_CONVERT(e, v) (0 * (e) - (v))
/* The extra casts in the following macros work around compiler bugs,
@@ -37,59 +36,55 @@
an integer. */
#define TYPE_IS_INTEGER(t) ((t) 1.5 == 1)
-/* True if negative values of the signed integer type T use two's
- complement, ones' complement, or signed magnitude representation,
- respectively. Much GNU code assumes two's complement, but some
- people like to be portable to all possible C hosts. */
-#define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1)
-#define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0)
-#define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1)
-
-/* True if the signed integer expression E uses two's complement. */
-#define _GL_INT_TWOS_COMPLEMENT(e) (~ _GL_INT_CONVERT (e, 0) == -1)
-
-/* True if the arithmetic type T is signed. */
+/* True if the real type T is signed. */
#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
-/* Return 1 if the integer expression E, after integer promotion, has
- a signed type. */
-#define _GL_INT_SIGNED(e) (_GL_INT_NEGATE_CONVERT (e, 1) < 0)
+/* Return 1 if the real expression E, after promotion, has a
+ signed or floating type. */
+#define EXPR_SIGNED(e) (_GL_INT_NEGATE_CONVERT (e, 1) < 0)
-/* Minimum and maximum values for integer types and expressions. These
- macros have undefined behavior if T is signed and has padding bits.
- If this is a problem for you, please let us know how to fix it for
- your host. */
+/* Minimum and maximum values for integer types and expressions. */
+
+/* The width in bits of the integer type or expression T.
+ Padding bits are not supported; this is checked at compile-time below. */
+#define TYPE_WIDTH(t) (sizeof (t) * CHAR_BIT)
/* The maximum and minimum values for the integer type T. */
-#define TYPE_MINIMUM(t) \
- ((t) (! TYPE_SIGNED (t) \
- ? (t) 0 \
- : TYPE_SIGNED_MAGNITUDE (t) \
- ? ~ (t) 0 \
- : ~ TYPE_MAXIMUM (t)))
+#define TYPE_MINIMUM(t) ((t) ~ TYPE_MAXIMUM (t))
#define TYPE_MAXIMUM(t) \
((t) (! TYPE_SIGNED (t) \
? (t) -1 \
- : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1)))
+ : ((((t) 1 << (TYPE_WIDTH (t) - 2)) - 1) * 2 + 1)))
/* The maximum and minimum values for the type of the expression E,
after integer promotion. E should not have side effects. */
#define _GL_INT_MINIMUM(e) \
- (_GL_INT_SIGNED (e) \
- ? - _GL_INT_TWOS_COMPLEMENT (e) - _GL_SIGNED_INT_MAXIMUM (e) \
+ (EXPR_SIGNED (e) \
+ ? ~ _GL_SIGNED_INT_MAXIMUM (e) \
: _GL_INT_CONVERT (e, 0))
#define _GL_INT_MAXIMUM(e) \
- (_GL_INT_SIGNED (e) \
+ (EXPR_SIGNED (e) \
? _GL_SIGNED_INT_MAXIMUM (e) \
: _GL_INT_NEGATE_CONVERT (e, 1))
#define _GL_SIGNED_INT_MAXIMUM(e) \
- (((_GL_INT_CONVERT (e, 1) << (sizeof ((e) + 0) * CHAR_BIT - 2)) - 1) * 2 + 1)
+ (((_GL_INT_CONVERT (e, 1) << (TYPE_WIDTH ((e) + 0) - 2)) - 1) * 2 + 1)
+/* Work around OpenVMS incompatibility with C99. */
+#if !defined LLONG_MAX && defined __INT64_MAX
+# define LLONG_MAX __INT64_MAX
+# define LLONG_MIN __INT64_MIN
+#endif
+
+/* This include file assumes that signed types are two's complement without
+ padding bits; the above macros have undefined behavior otherwise.
+ If this is a problem for you, please let us know how to fix it for your host.
+ This assumption is tested by the intprops-tests module. */
-/* Return 1 if the __typeof__ keyword works. This could be done by
+/* Does the __typeof__ keyword work? This could be done by
'configure', but for now it's easier to do it by hand. */
-#if (2 <= __GNUC__ || defined __IBM__TYPEOF__ \
+#if (2 <= __GNUC__ \
+ || (1210 <= __IBMC__ && defined __IBM__TYPEOF__) \
|| (0x5110 <= __SUNPRO_C && !__STDC__))
# define _GL_HAVE___TYPEOF__ 1
#else
@@ -118,8 +113,7 @@
signed, this macro may overestimate the true bound by one byte when
applied to unsigned types of size 2, 4, 16, ... bytes. */
#define INT_STRLEN_BOUND(t) \
- (INT_BITS_STRLEN_BOUND (sizeof (t) * CHAR_BIT \
- - _GL_SIGNED_TYPE_OR_EXPR (t)) \
+ (INT_BITS_STRLEN_BOUND (TYPE_WIDTH (t) - _GL_SIGNED_TYPE_OR_EXPR (t)) \
+ _GL_SIGNED_TYPE_OR_EXPR (t))
/* Bound on buffer size needed to represent an integer type or expression T,
@@ -185,7 +179,7 @@
/* Return 1 if A * B would overflow in [MIN,MAX] arithmetic.
See above for restrictions. Avoid && and || as they tickle
bugs in Sun C 5.11 2010/08/13 and other compilers; see
- <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00401.html>. */
+ <https://lists.gnu.org/r/bug-gnulib/2011-05/msg00401.html>. */
#define INT_MULTIPLY_RANGE_OVERFLOW(a, b, min, max) \
((b) < 0 \
? ((a) < 0 \
@@ -224,24 +218,42 @@
? (a) < (min) >> (b) \
: (max) >> (b) < (a))
+/* True if __builtin_add_overflow (A, B, P) works when P is non-null. */
+#if 5 <= __GNUC__ && !defined __ICC
+# define _GL_HAS_BUILTIN_OVERFLOW 1
+#else
+# define _GL_HAS_BUILTIN_OVERFLOW 0
+#endif
+
+/* True if __builtin_add_overflow_p (A, B, C) works. */
+#define _GL_HAS_BUILTIN_OVERFLOW_P (7 <= __GNUC__)
/* The _GL*_OVERFLOW macros have the same restrictions as the
*_RANGE_OVERFLOW macros, except that they do not assume that operands
(e.g., A and B) have the same type as MIN and MAX. Instead, they assume
that the result (e.g., A + B) has that type. */
-#define _GL_ADD_OVERFLOW(a, b, min, max) \
- ((min) < 0 ? INT_ADD_RANGE_OVERFLOW (a, b, min, max) \
- : (a) < 0 ? (b) <= (a) + (b) \
- : (b) < 0 ? (a) <= (a) + (b) \
- : (a) + (b) < (b))
-#define _GL_SUBTRACT_OVERFLOW(a, b, min, max) \
- ((min) < 0 ? INT_SUBTRACT_RANGE_OVERFLOW (a, b, min, max) \
- : (a) < 0 ? 1 \
- : (b) < 0 ? (a) - (b) <= (a) \
- : (a) < (b))
-#define _GL_MULTIPLY_OVERFLOW(a, b, min, max) \
- (((min) == 0 && (((a) < 0 && 0 < (b)) || ((b) < 0 && 0 < (a)))) \
- || INT_MULTIPLY_RANGE_OVERFLOW (a, b, min, max))
+#if _GL_HAS_BUILTIN_OVERFLOW_P
+# define _GL_ADD_OVERFLOW(a, b, min, max) \
+ __builtin_add_overflow_p (a, b, (__typeof__ ((a) + (b))) 0)
+# define _GL_SUBTRACT_OVERFLOW(a, b, min, max) \
+ __builtin_sub_overflow_p (a, b, (__typeof__ ((a) - (b))) 0)
+# define _GL_MULTIPLY_OVERFLOW(a, b, min, max) \
+ __builtin_mul_overflow_p (a, b, (__typeof__ ((a) * (b))) 0)
+#else
+# define _GL_ADD_OVERFLOW(a, b, min, max) \
+ ((min) < 0 ? INT_ADD_RANGE_OVERFLOW (a, b, min, max) \
+ : (a) < 0 ? (b) <= (a) + (b) \
+ : (b) < 0 ? (a) <= (a) + (b) \
+ : (a) + (b) < (b))
+# define _GL_SUBTRACT_OVERFLOW(a, b, min, max) \
+ ((min) < 0 ? INT_SUBTRACT_RANGE_OVERFLOW (a, b, min, max) \
+ : (a) < 0 ? 1 \
+ : (b) < 0 ? (a) - (b) <= (a) \
+ : (a) < (b))
+# define _GL_MULTIPLY_OVERFLOW(a, b, min, max) \
+ (((min) == 0 && (((a) < 0 && 0 < (b)) || ((b) < 0 && 0 < (a)))) \
+ || INT_MULTIPLY_RANGE_OVERFLOW (a, b, min, max))
+#endif
#define _GL_DIVIDE_OVERFLOW(a, b, min, max) \
((min) < 0 ? (b) == _GL_INT_NEGATE_CONVERT (min, 1) && (a) < - (max) \
: (a) < 0 ? (b) <= (a) + (b) - 1 \
@@ -263,22 +275,29 @@
: (a) % - (b)) \
== 0)
-
-/* Integer overflow checks.
+/* Check for integer overflow, and report low order bits of answer.
The INT_<op>_OVERFLOW macros return 1 if the corresponding C operators
might not yield numerically correct answers due to arithmetic overflow.
- They work correctly on all known practical hosts, and do not rely
+ The INT_<op>_WRAPV macros also store the low-order bits of the answer.
+ These macros work correctly on all known practical hosts, and do not rely
on undefined behavior due to signed arithmetic overflow.
- Example usage:
+ Example usage, assuming A and B are long int:
- long int i = ...;
- long int j = ...;
- if (INT_MULTIPLY_OVERFLOW (i, j))
- printf ("multiply would overflow");
+ if (INT_MULTIPLY_OVERFLOW (a, b))
+ printf ("result would overflow\n");
else
- printf ("product is %ld", i * j);
+ printf ("result is %ld (no overflow)\n", a * b);
+
+ Example usage with WRAPV flavor:
+
+ long int result;
+ bool overflow = INT_MULTIPLY_WRAPV (a, b, &result);
+ printf ("result is %ld (%s)\n", result,
+ overflow ? "after overflow" : "no overflow");
+
+ Restrictions on these macros:
These macros do not check for all possible numerical problems or
undefined or unspecified behavior: they do not check for division
@@ -287,6 +306,9 @@
These macros may evaluate their arguments zero or multiple times, so the
arguments should not have side effects.
+ The WRAPV macros are not constant expressions. They support only
+ +, binary -, and *. The result type must be signed.
+
These macros are tuned for their last argument being a constant.
Return 1 if the integer expressions A * B, A - B, -A, A * B, A / B,
@@ -296,8 +318,12 @@
_GL_BINARY_OP_OVERFLOW (a, b, _GL_ADD_OVERFLOW)
#define INT_SUBTRACT_OVERFLOW(a, b) \
_GL_BINARY_OP_OVERFLOW (a, b, _GL_SUBTRACT_OVERFLOW)
-#define INT_NEGATE_OVERFLOW(a) \
- INT_NEGATE_RANGE_OVERFLOW (a, _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a))
+#if _GL_HAS_BUILTIN_OVERFLOW_P
+# define INT_NEGATE_OVERFLOW(a) INT_SUBTRACT_OVERFLOW (0, a)
+#else
+# define INT_NEGATE_OVERFLOW(a) \
+ INT_NEGATE_RANGE_OVERFLOW (a, _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a))
+#endif
#define INT_MULTIPLY_OVERFLOW(a, b) \
_GL_BINARY_OP_OVERFLOW (a, b, _GL_MULTIPLY_OVERFLOW)
#define INT_DIVIDE_OVERFLOW(a, b) \
@@ -317,4 +343,111 @@
_GL_INT_MINIMUM (0 * (b) + (a)), \
_GL_INT_MAXIMUM (0 * (b) + (a)))
+/* Store the low-order bits of A + B, A - B, A * B, respectively, into *R.
+ Return 1 if the result overflows. See above for restrictions. */
+#define INT_ADD_WRAPV(a, b, r) \
+ _GL_INT_OP_WRAPV (a, b, r, +, __builtin_add_overflow, INT_ADD_OVERFLOW)
+#define INT_SUBTRACT_WRAPV(a, b, r) \
+ _GL_INT_OP_WRAPV (a, b, r, -, __builtin_sub_overflow, INT_SUBTRACT_OVERFLOW)
+#define INT_MULTIPLY_WRAPV(a, b, r) \
+ _GL_INT_OP_WRAPV (a, b, r, *, __builtin_mul_overflow, INT_MULTIPLY_OVERFLOW)
+
+/* Nonzero if this compiler has GCC bug 68193 or Clang bug 25390. See:
+ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68193
+ https://llvm.org/bugs/show_bug.cgi?id=25390
+ For now, assume all versions of GCC-like compilers generate bogus
+ warnings for _Generic. This matters only for older compilers that
+ lack __builtin_add_overflow. */
+#if __GNUC__
+# define _GL__GENERIC_BOGUS 1
+#else
+# define _GL__GENERIC_BOGUS 0
+#endif
+
+/* Store the low-order bits of A <op> B into *R, where OP specifies
+ the operation. BUILTIN is the builtin operation, and OVERFLOW the
+ overflow predicate. Return 1 if the result overflows. See above
+ for restrictions. */
+#if _GL_HAS_BUILTIN_OVERFLOW
+# define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) builtin (a, b, r)
+#elif 201112 <= __STDC_VERSION__ && !_GL__GENERIC_BOGUS
+# define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) \
+ (_Generic \
+ (*(r), \
+ signed char: \
+ _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
+ signed char, SCHAR_MIN, SCHAR_MAX), \
+ short int: \
+ _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
+ short int, SHRT_MIN, SHRT_MAX), \
+ int: \
+ _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
+ int, INT_MIN, INT_MAX), \
+ long int: \
+ _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \
+ long int, LONG_MIN, LONG_MAX), \
+ long long int: \
+ _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \
+ long long int, LLONG_MIN, LLONG_MAX)))
+#else
+# define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) \
+ (sizeof *(r) == sizeof (signed char) \
+ ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
+ signed char, SCHAR_MIN, SCHAR_MAX) \
+ : sizeof *(r) == sizeof (short int) \
+ ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
+ short int, SHRT_MIN, SHRT_MAX) \
+ : sizeof *(r) == sizeof (int) \
+ ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
+ int, INT_MIN, INT_MAX) \
+ : _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow))
+# ifdef LLONG_MAX
+# define _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow) \
+ (sizeof *(r) == sizeof (long int) \
+ ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \
+ long int, LONG_MIN, LONG_MAX) \
+ : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \
+ long long int, LLONG_MIN, LLONG_MAX))
+# else
+# define _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow) \
+ _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \
+ long int, LONG_MIN, LONG_MAX)
+# endif
+#endif
+
+/* Store the low-order bits of A <op> B into *R, where the operation
+ is given by OP. Use the unsigned type UT for calculation to avoid
+ overflow problems. *R's type is T, with extrema TMIN and TMAX.
+ T must be a signed integer type. Return 1 if the result overflows. */
+#define _GL_INT_OP_CALC(a, b, r, op, overflow, ut, t, tmin, tmax) \
+ (sizeof ((a) op (b)) < sizeof (t) \
+ ? _GL_INT_OP_CALC1 ((t) (a), (t) (b), r, op, overflow, ut, t, tmin, tmax) \
+ : _GL_INT_OP_CALC1 (a, b, r, op, overflow, ut, t, tmin, tmax))
+#define _GL_INT_OP_CALC1(a, b, r, op, overflow, ut, t, tmin, tmax) \
+ ((overflow (a, b) \
+ || (EXPR_SIGNED ((a) op (b)) && ((a) op (b)) < (tmin)) \
+ || (tmax) < ((a) op (b))) \
+ ? (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t), 1) \
+ : (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t), 0))
+
+/* Return the low-order bits of A <op> B, where the operation is given
+ by OP. Use the unsigned type UT for calculation to avoid undefined
+ behavior on signed integer overflow, and convert the result to type T.
+ UT is at least as wide as T and is no narrower than unsigned int,
+ T is two's complement, and there is no padding or trap representations.
+ Assume that converting UT to T yields the low-order bits, as is
+ done in all known two's-complement C compilers. E.g., see:
+ https://gcc.gnu.org/onlinedocs/gcc/Integers-implementation.html
+
+ According to the C standard, converting UT to T yields an
+ implementation-defined result or signal for values outside T's
+ range. However, code that works around this theoretical problem
+ runs afoul of a compiler bug in Oracle Studio 12.3 x86. See:
+ https://lists.gnu.org/r/bug-gnulib/2017-04/msg00049.html
+ As the compiler bug is real, don't try to work around the
+ theoretical problem. */
+
+#define _GL_INT_OP_WRAPV_VIA_UNSIGNED(a, b, op, ut, t) \
+ ((t) ((ut) (a) op (ut) (b)))
+
#endif /* _GL_INTPROPS_H */
diff --git a/src/libopts/libopts.c b/src/libopts/libopts.c
index a26c9248ae..457edc433a 100644
--- a/src/libopts/libopts.c
+++ b/src/libopts/libopts.c
@@ -1,9 +1,9 @@
#define AUTOOPTS_INTERNAL 1
#include "autoopts/project.h"
-#define LOCAL static
+
#include "ao-strs.h"
static char const ao_ver_string[] =
- "41:1:16\n";
+ "42:1:17\n";
#include "autoopts/options.h"
#include "autoopts/usage-txt.h"
#include "genshell.h"
@@ -11,12 +11,14 @@ static char const ao_ver_string[] =
#include "option-value-type.h"
#include "ao-strs.h"
#include "ag-char-map.h"
+#include "save-flags.h"
#include "autoopts.h"
#include "proto.h"
#include "parse-duration.c"
#include "ao-strs.c"
#include "option-value-type.c"
#include "option-xat-attribute.c"
+#include "save-flags.c"
#include "autoopts.c"
#include "alias.c"
#include "boolean.c"
diff --git a/src/libopts/load.c b/src/libopts/load.c
index 5c82e120ba..59d124ebd4 100644
--- a/src/libopts/load.c
+++ b/src/libopts/load.c
@@ -12,7 +12,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2015 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2018 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
@@ -31,26 +31,6 @@
* 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd
*/
-/* = = = START-STATIC-FORWARD = = = */
-static bool
-get_realpath(char * buf, size_t b_sz);
-
-static bool
-add_prog_path(char * buf, int b_sz, char const * fname, char const * prg_path);
-
-static bool
-add_env_val(char * buf, int buf_sz, char const * name);
-
-static char *
-assemble_arg_val(char * txt, tOptionLoadMode mode);
-
-static char *
-trim_quotes(char * arg);
-
-static bool
-direction_ok(opt_state_mask_t f, int dir);
-/* = = = END-STATIC-FORWARD = = = */
-
static bool
get_realpath(char * buf, size_t b_sz)
{
@@ -314,7 +294,7 @@ add_env_val(char * buf, int buf_sz, char const * name)
* @param[in,out] txt the input and output string
* @param[in] mode the handling mode (cooking method)
*/
-LOCAL void
+static void
munge_str(char * txt, tOptionLoadMode mode)
{
char * end;
@@ -445,7 +425,7 @@ direction_ok(opt_state_mask_t f, int dir)
if (PRESETTING(dir)) {
/*
* We are in the presetting direction with an option we handle
- * immediately for disablement, but normally for disablement.
+ * immediately for disablement, but normally for handling.
* Therefore, skip if NOT disabled.
*/
if ((f & OPTST_DISABLED) != 0)
@@ -453,7 +433,7 @@ direction_ok(opt_state_mask_t f, int dir)
} else {
/*
* We are in the processing direction with an option we handle
- * immediately for disablement, but normally for disablement.
+ * immediately for disablement, but normally for handling.
* Therefore, skip if disabled.
*/
if ((f & OPTST_DISABLED) == 0)
@@ -486,7 +466,7 @@ direction_ok(opt_state_mask_t f, int dir)
* @param[in] direction current processing direction (preset or not)
* @param[in] load_mode option loading mode (OPTION_LOAD_*)
*/
-LOCAL void
+static void
load_opt_line(tOptions * opts, tOptState * opt_state, char * line,
tDirection direction, tOptionLoadMode load_mode )
{
diff --git a/src/libopts/m4/libopts.m4 b/src/libopts/m4/libopts.m4
index c6ad73848f..23738cab47 100644
--- a/src/libopts/m4/libopts.m4
+++ b/src/libopts/m4/libopts.m4
@@ -1,11 +1,4 @@
-dnl -*- buffer-read-only: t -*- vi: set ro:
-dnl
-dnl DO NOT EDIT THIS FILE (libopts.m4)
-dnl
-dnl It has been AutoGen-ed
-dnl From the definitions libopts.def
-dnl and the template file conftest.tpl
-dnl
+
dnl do always before generated macros:
dnl
AC_DEFUN([INVOKE_LIBOPTS_MACROS_FIRST],[
@@ -114,6 +107,7 @@ AC_DEFUN([INVOKE_LIBOPTS_MACROS_FIRST],[
AC_PROG_SED
[while :
do
+ test -x "$POSIX_SHELL" && break
POSIX_SHELL=`which bash`
test -x "$POSIX_SHELL" && break
POSIX_SHELL=`which dash`
@@ -235,9 +229,9 @@ int main() {
fputs( "error: regex -->.<-- did not match\n", stderr );
return 1;
}
- return 0; }])],
+ return 0; }] )],
[libopts_cv_with_libregex=yes], [libopts_cv_with_libregex=no],
- [libopts_cv_with_libregex=no]) # end of AC_RUN_IFELSE
+ [libopts_cv_with_libregex=no]) # end of AC_RUN_IFELSE
]) # end of AC_CACHE_VAL for libopts_cv_with_libregex
fi ## disabled by request
AC_MSG_RESULT([${libopts_cv_with_libregex}])
@@ -265,7 +259,7 @@ AC_DEFUN([LIBOPTS_RUN_PATHFIND],[
int main (int argc, char ** argv) {
char * pz = pathfind( getenv( "PATH" ), "sh", "x" );
return (pz == 0) ? 1 : 0;
-}])],
+}] )],
[libopts_cv_run_pathfind=yes],[libopts_cv_run_pathfind=no],[libopts_cv_run_pathfind=no]
) # end of RUN_IFELSE
]) # end of AC_CACHE_VAL for libopts_cv_run_pathfind
@@ -313,7 +307,7 @@ choke me!!
@%:@endif
char *pz = realpath(argv@<:@0@:>@, zPath);
return (pz == zPath) ? 0 : 1;
-}])],
+}] )],
[libopts_cv_run_realpath=yes],[libopts_cv_run_realpath=no],[libopts_cv_run_realpath=no]
) # end of RUN_IFELSE
]) # end of AC_CACHE_VAL for libopts_cv_run_realpath
@@ -346,7 +340,7 @@ int main() {
tm.tm_yday = 239; /* days since January 1 @<:@0, 365@:>@ */
tm.tm_isdst = 1; /* flag for daylight savings time */
strftime( t_buf, sizeof( t_buf ), "%A %b %d %j", &tm );
- return (strcmp( t_buf, z ) != 0); }])],
+ return (strcmp( t_buf, z ) != 0); }] )],
[libopts_cv_run_strftime=yes],[libopts_cv_run_strftime=no],[libopts_cv_run_strftime=no]
) # end of RUN_IFELSE
]) # end of AC_CACHE_VAL for libopts_cv_run_strftime
@@ -366,7 +360,7 @@ AC_DEFUN([LIBOPTS_RUN_FOPEN_BINARY],[
AC_RUN_IFELSE([AC_LANG_SOURCE([@%:@include <stdio.h>
int main (int argc, char ** argv) {
FILE * fp = fopen("conftest.@S|@ac_ext", "rb");
-return (fp == NULL) ? 1 : fclose(fp); }])],
+return (fp == NULL) ? 1 : fclose(fp); }] )],
[libopts_cv_run_fopen_binary=yes],[libopts_cv_run_fopen_binary=no],[libopts_cv_run_fopen_binary=no]
) # end of RUN_IFELSE
]) # end of AC_CACHE_VAL for libopts_cv_run_fopen_binary
@@ -389,7 +383,7 @@ AC_DEFUN([LIBOPTS_RUN_FOPEN_TEXT],[
AC_RUN_IFELSE([AC_LANG_SOURCE([@%:@include <stdio.h>
int main (int argc, char ** argv) {
FILE * fp = fopen("conftest.@S|@ac_ext", "rt");
-return (fp == NULL) ? 1 : fclose(fp); }])],
+return (fp == NULL) ? 1 : fclose(fp); }] )],
[libopts_cv_run_fopen_text=yes],[libopts_cv_run_fopen_text=no],[libopts_cv_run_fopen_text=no]
) # end of RUN_IFELSE
]) # end of AC_CACHE_VAL for libopts_cv_run_fopen_text
@@ -461,7 +455,7 @@ dnl the config tests that the library needs. Invoke the
dnl "INVOKE_LIBOPTS_MACROS" macro iff we are building libopts.
dnl
dnl This file is part of AutoGen.
-dnl AutoGen Copyright (C) 1992-2015 by Bruce Korb - all rights reserved
+dnl AutoGen Copyright (C) 1992-2018 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
@@ -474,7 +468,7 @@ dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
dnl See the GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License along
-dnl with this program. If not, see <https://www.gnu.org/licenses/>.
+dnl with this program. If not, see <http://www.gnu.org/licenses/>.
dnl
dnl Default to system libopts
dnl
diff --git a/src/libopts/m4/liboptschk.m4 b/src/libopts/m4/liboptschk.m4
index 34d5658c2f..9d107d6962 100644
--- a/src/libopts/m4/liboptschk.m4
+++ b/src/libopts/m4/liboptschk.m4
@@ -1,5 +1,5 @@
# liboptschk.m4 serial 2 (autogen - 5.11.4)
-dnl Copyright (C) 2005-2015 by Bruce Korb - all rights reserved
+dnl Copyright (C) 2005-2018 by Bruce Korb - all rights reserved
dnl
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
diff --git a/src/libopts/m4/stdnoreturn.m4 b/src/libopts/m4/stdnoreturn.m4
index 003941164f..a7ce376428 100644
--- a/src/libopts/m4/stdnoreturn.m4
+++ b/src/libopts/m4/stdnoreturn.m4
@@ -1,6 +1,6 @@
# Check for stdnoreturn.h that conforms to C11.
-dnl Copyright 2012-2015 Free Software Foundation, Inc.
+dnl Copyright 2012-2018 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -9,33 +9,43 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_STDNORETURN_H],
[
- AC_CACHE_CHECK([for working stdnoreturn.h],
- [gl_cv_header_working_stdnoreturn_h],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[#include <stdlib.h>
- #include <stdnoreturn.h>
- /* Do not check for 'noreturn' after the return type.
- C11 allows it, but it's rarely done that way
- and circa-2012 bleeding-edge GCC rejects it when given
- -Werror=old-style-declaration. */
- noreturn void foo1 (void) { exit (0); }
- _Noreturn void foo2 (void) { exit (0); }
- int testit (int argc, char **argv) {
- if (argc & 1)
- return 0;
- (argv[0][0] ? foo1 : foo2) ();
- }
- ]])],
- [gl_cv_header_working_stdnoreturn_h=yes],
- [gl_cv_header_working_stdnoreturn_h=no])])
-
- if test $gl_cv_header_working_stdnoreturn_h = yes; then
- STDNORETURN_H=''
- else
- STDNORETURN_H='stdnoreturn.h'
- fi
-
+ AC_REQUIRE([AC_CANONICAL_HOST])
+ case "$host_os" in
+ cygwin*)
+ dnl Regardless whether a working <stdnoreturn.h> exists or not,
+ dnl we need our own <stdnoreturn.h>, because of the definition
+ dnl of _Noreturn done by gnulib-common.m4.
+ STDNORETURN_H='stdnoreturn.h'
+ ;;
+ *)
+ AC_CACHE_CHECK([for working stdnoreturn.h],
+ [gl_cv_header_working_stdnoreturn_h],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <stdlib.h>
+ #include <stdnoreturn.h>
+ /* Do not check for 'noreturn' after the return type.
+ C11 allows it, but it's rarely done that way
+ and circa-2012 bleeding-edge GCC rejects it when given
+ -Werror=old-style-declaration. */
+ noreturn void foo1 (void) { exit (0); }
+ _Noreturn void foo2 (void) { exit (0); }
+ int testit (int argc, char **argv)
+ {
+ if (argc & 1)
+ return 0;
+ (argv[0][0] ? foo1 : foo2) ();
+ }
+ ]])],
+ [gl_cv_header_working_stdnoreturn_h=yes],
+ [gl_cv_header_working_stdnoreturn_h=no])])
+ if test $gl_cv_header_working_stdnoreturn_h = yes; then
+ STDNORETURN_H=''
+ else
+ STDNORETURN_H='stdnoreturn.h'
+ fi
+ ;;
+ esac
AC_SUBST([STDNORETURN_H])
AM_CONDITIONAL([GL_GENERATE_STDNORETURN_H], [test -n "$STDNORETURN_H"])
])
diff --git a/src/libopts/makeshell.c b/src/libopts/makeshell.c
index a61df422c8..10ed12005a 100644
--- a/src/libopts/makeshell.c
+++ b/src/libopts/makeshell.c
@@ -11,7 +11,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2015 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2018 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
@@ -35,45 +35,7 @@
#define UPPER(_c) (toupper(to_uchar(_c)))
#define LOWER(_c) (tolower(to_uchar(_c)))
-/* = = = START-STATIC-FORWARD = = = */
-static void
-emit_var_text(char const * prog, char const * var, int fdin);
-
-static void
-text_to_var(tOptions * opts, teTextTo which, tOptDesc * od);
-
-static void
-emit_usage(tOptions * opts);
-
-static void
-emit_wrapup(tOptions * opts);
-
-static void
-emit_setup(tOptions * opts);
-
-static void
-emit_action(tOptions * opts, tOptDesc * od);
-
-static void
-emit_inaction(tOptions * opts, tOptDesc * od);
-
-static void
-emit_flag(tOptions * opts);
-
-static void
-emit_match_expr(char const * name, tOptDesc * cod, tOptions * opts);
-
-static void
-emit_long(tOptions * opts);
-
-static char *
-load_old_output(char const * fname, char const * pname);
-
-static void
-open_out(char const * fname, char const * pname);
-/* = = = END-STATIC-FORWARD = = = */
-
-LOCAL noreturn void
+noreturn static void
option_exits(int exit_code)
{
if (print_exit)
@@ -81,21 +43,21 @@ option_exits(int exit_code)
exit(exit_code);
}
-LOCAL noreturn void
+noreturn static void
ao_bug(char const * msg)
{
fprintf(stderr, zao_bug_msg, msg);
option_exits(EX_SOFTWARE);
}
-LOCAL void
+static void
fserr_warn(char const * prog, char const * op, char const * fname)
{
fprintf(stderr, zfserr_fmt, prog, errno, strerror(errno),
op, fname);
}
-LOCAL noreturn void
+noreturn static void
fserr_exit(char const * prog, char const * op, char const * fname)
{
fserr_warn(prog, op, fname);
@@ -322,11 +284,11 @@ text_to_var(tOptions * opts, teTextTo which, tOptDesc * od)
switch (which) {
case TT_LONGUSAGE:
(*(opts->pUsageProc))(opts, EXIT_SUCCESS);
- /* NOTREACHED */
+ /* FALLTHROUGH */ /* NOTREACHED */
case TT_USAGE:
(*(opts->pUsageProc))(opts, EXIT_FAILURE);
- /* NOTREACHED */
+ /* FALLTHROUGH */ /* NOTREACHED */
case TT_VERSION:
if (od->fOptState & OPTST_ALLOC_ARG) {
@@ -335,13 +297,13 @@ text_to_var(tOptions * opts, teTextTo which, tOptDesc * od)
}
od->optArg.argString = "c";
optionPrintVersion(opts, od);
- /* NOTREACHED */
+ /* FALLTHROUGH */ /* NOTREACHED */
default:
option_exits(EXIT_FAILURE);
- /* NOTREACHED */
+ /* FALLTHROUGH */ /* NOTREACHED */
}
- /* NOTREACHED */
+ /* FALLTHROUGH */ /* NOTREACHED */
default:
close(fdpair[1]);
@@ -885,13 +847,12 @@ genshelloptUsage(tOptions * opts, int exit_cd)
switch (fork()) {
case -1:
optionUsage(opts, EXIT_FAILURE);
- /* NOTREACHED */
+ /* FALLTHROUGH */ /* NOTREACHED */
case 0:
pagerState = PAGER_STATE_CHILD;
optionUsage(opts, EXIT_SUCCESS);
- /* NOTREACHED */
- _exit(EXIT_FAILURE);
+ /* FALLTHROUGH */ /* NOTREACHED */
default:
{
@@ -930,6 +891,7 @@ genshelloptUsage(tOptions * opts, int exit_cd)
/*FALLTHROUGH*/
case -1:
optionUsage(optionParseShellOptions, EXIT_FAILURE);
+ /* FALLTHROUGH */ /* NOTREACHED */
default:
{
diff --git a/src/libopts/nested.c b/src/libopts/nested.c
index f4fb226209..e760450678 100644
--- a/src/libopts/nested.c
+++ b/src/libopts/nested.c
@@ -12,7 +12,7 @@
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2015 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2018 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
@@ -37,7 +37,7 @@ typedef struct {
char xml_txt[8];
} xml_xlate_t;
-static xml_xlate_t const xml_xlate[] = {
+ static xml_xlate_t const xml_xlate[] = {
{ '&', 4, "amp;" },
{ '<', 3, "lt;" },
{ '>', 3, "gt;" },
@@ -49,48 +49,6 @@ static xml_xlate_t const xml_xlate[] = {
#define ENOMSG ENOENT
#endif
-/* = = = START-STATIC-FORWARD = = = */
-static void
-remove_continuation(char * src);
-
-static char const *
-scan_q_str(char const * pzTxt);
-
-static tOptionValue *
-add_string(void ** pp, char const * name, size_t nm_len,
- char const * val, size_t d_len);
-
-static tOptionValue *
-add_bool(void ** pp, char const * name, size_t nm_len,
- char const * val, size_t d_len);
-
-static tOptionValue *
-add_number(void ** pp, char const * name, size_t nm_len,
- char const * val, size_t d_len);
-
-static tOptionValue *
-add_nested(void ** pp, char const * name, size_t nm_len,
- char * val, size_t d_len);
-
-static char const *
-scan_name(char const * name, tOptionValue * res);
-
-static char const *
-unnamed_xml(char const * txt);
-
-static char const *
-scan_xml_name(char const * name, size_t * nm_len, tOptionValue * val);
-
-static char const *
-find_end_xml(char const * src, size_t nm_len, char const * val, size_t * len);
-
-static char const *
-scan_xml(char const * xml_name, tOptionValue * res_val);
-
-static void
-sort_list(tArgList * arg_list);
-/* = = = END-STATIC-FORWARD = = = */
-
/**
* Backslashes are used for line continuations. We keep the newline
* characters, but trim out the backslash:
@@ -638,7 +596,7 @@ bail_scan_xml:
* an internal call, so it is not validated. The caller is responsible for
* knowing what they are doing.
*/
-LOCAL void
+static void
unload_arg_list(tArgList * arg_list)
{
int ct = arg_list->useCt;
@@ -743,7 +701,7 @@ sort_list(tArgList * arg_list)
* @code{ENOMSG} no configuration values were found
* @end itemize
=*/
-LOCAL tOptionValue *
+static tOptionValue *
optionLoadNested(char const * text, char const * name, size_t nm_len)
{
tOptionValue * res_val;
@@ -783,12 +741,23 @@ optionLoadNested(char const * text, char const * name, size_t nm_len)
text = scan_name(text, res_val);
else switch (*text) {
- case NUL: goto scan_done;
- case '<': text = scan_xml(text, res_val);
- if (text == NULL) goto woops;
- if (*text == ',') text++; break;
- case '#': text = strchr(text, NL); break;
- default: goto woops;
+ case NUL:
+ goto scan_done;
+
+ case '<':
+ text = scan_xml(text, res_val);
+ if (text == NULL)
+ goto woops;
+ if (*text == ',')
+ text++;
+ break;
+
+ case '#':
+ text = strchr(text, NL);
+ break;
+
+ default:
+ goto woops;
}
} while (text != NULL); scan_done:;
@@ -855,7 +824,7 @@ optionNestedVal(tOptions * opts, tOptDesc * od)
/**
* get_special_char
*/
-LOCAL int
+static int
get_special_char(char const ** ppz, int * ct)
{
char const * pz = *ppz;
@@ -907,7 +876,7 @@ get_special_char(char const ** ppz, int * ct)
/**
* emit_special_char
*/
-LOCAL void
+static void
emit_special_char(FILE * fp, int ch)
{
int ctr = sizeof(xml_xlate) / sizeof(xml_xlate[0]);
diff --git a/src/libopts/numeric.c b/src/libopts/numeric.c
index 66af1508d4..bbb43ccdcd 100644
--- a/src/libopts/numeric.c
+++ b/src/libopts/numeric.c
@@ -10,7 +10,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2015 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2018 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
@@ -136,14 +136,14 @@ optionNumericVal(tOptions * opts, tOptDesc * od)
if ((od->fOptState & OPTST_SCALED_NUM) != 0)
switch (*(pz++)) {
case NUL: pz--; break;
- case 't': val *= 1000;
- case 'g': val *= 1000;
- case 'm': val *= 1000;
+ case 't': val *= 1000; /* FALLTHROUGH */
+ case 'g': val *= 1000; /* FALLTHROUGH */
+ case 'm': val *= 1000; /* FALLTHROUGH */
case 'k': val *= 1000; break;
- case 'T': val *= 1024;
- case 'G': val *= 1024;
- case 'M': val *= 1024;
+ case 'T': val *= 1024; /* FALLTHROUGH */
+ case 'G': val *= 1024; /* FALLTHROUGH */
+ case 'M': val *= 1024; /* FALLTHROUGH */
case 'K': val *= 1024; break;
default: goto bad_number;
diff --git a/src/libopts/option-value-type.c b/src/libopts/option-value-type.c
index 5f676408ae..2bc8642809 100644
--- a/src/libopts/option-value-type.c
+++ b/src/libopts/option-value-type.c
@@ -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.1 */
/* Command-line: gperf option-value-type.gp */
/* Computed positions: -k'1' */
@@ -64,7 +64,7 @@ typedef struct {
/* maximum key range = 15, duplicates = 0 */
static unsigned int
-option_value_type_hash (register const char *str, register unsigned int len)
+option_value_type_hash (register const char *str, register size_t len)
{
static const unsigned char asso_values[] =
{
@@ -119,13 +119,13 @@ static const option_value_type_map_t option_value_type_table[] =
};
static inline const option_value_type_map_t *
-find_option_value_type_name (register const char *str, register unsigned int len)
+find_option_value_type_name (register const char *str, register size_t len)
{
if (len <= 14 && len >= 3)
{
- register int key = (int)option_value_type_hash (str, len);
+ register unsigned int key = (int)option_value_type_hash (str, len);
- if (key <= 17 && key >= 0)
+ if (key <= 17)
{
register const char *s = option_value_type_table[key].vtp_name;
diff --git a/src/libopts/option-xat-attribute.c b/src/libopts/option-xat-attribute.c
index be86041fd8..a34ab1b5b2 100644
--- a/src/libopts/option-xat-attribute.c
+++ b/src/libopts/option-xat-attribute.c
@@ -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.1 */
/* Command-line: gperf option-xat-attribute.gp */
/* Computed positions: -k'1' */
@@ -64,7 +64,7 @@ typedef struct {
/* maximum key range = 6, duplicates = 0 */
static unsigned int
-option_xat_attribute_hash (register const char *str, register unsigned int len)
+option_xat_attribute_hash (register const char *str, register size_t len)
{
static const unsigned char asso_values[] =
{
@@ -111,13 +111,13 @@ static const option_xat_attribute_map_t option_xat_attribute_table[] =
};
static inline const option_xat_attribute_map_t *
-find_option_xat_attribute_name (register const char *str, register unsigned int len)
+find_option_xat_attribute_name (register const char *str, register size_t len)
{
if (len <= 8 && len >= 4)
{
- register int key = (int)option_xat_attribute_hash (str, len);
+ register unsigned int key = (int)option_xat_attribute_hash (str, len);
- if (key <= 9 && key >= 0)
+ if (key <= 9)
{
register const char *s = option_xat_attribute_table[key].xat_name;
diff --git a/src/libopts/parse-duration.c b/src/libopts/parse-duration.c
index 514cdea1f7..0f4a05634b 100644
--- a/src/libopts/parse-duration.c
+++ b/src/libopts/parse-duration.c
@@ -1,5 +1,5 @@
/* Parse a time duration and return a seconds count
- Copyright (C) 2008-2015 Free Software Foundation, Inc.
+ Copyright (C) 2008-2018 Free Software Foundation, Inc.
Written by Bruce Korb <bkorb@gnu.org>, 2008.
This program is free software: you can redistribute it and/or modify
diff --git a/src/libopts/parse-duration.h b/src/libopts/parse-duration.h
index bac1d84f6b..9a7bcd5e10 100644
--- a/src/libopts/parse-duration.h
+++ b/src/libopts/parse-duration.h
@@ -1,5 +1,5 @@
/* Parse a time duration and return a seconds count
- Copyright (C) 2008-2015 Free Software Foundation, Inc.
+ Copyright (C) 2008-2018 Free Software Foundation, Inc.
Written by Bruce Korb <bkorb@gnu.org>, 2008.
This program is free software: you can redistribute it and/or modify
@@ -22,7 +22,7 @@
At the time of writing, this worked:
- http://en.wikipedia.org/wiki/ISO_8601#Durations
+ https://en.wikipedia.org/wiki/ISO_8601#Durations
The string must start with a 'P', 'T' or a digit.
diff --git a/src/libopts/pgusage.c b/src/libopts/pgusage.c
index 3d229c18d0..f895b3bb56 100644
--- a/src/libopts/pgusage.c
+++ b/src/libopts/pgusage.c
@@ -13,7 +13,7 @@
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2015 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2018 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
diff --git a/src/libopts/proto.h b/src/libopts/proto.h
index 7e3475d93b..437e81ed9b 100644
--- a/src/libopts/proto.h
+++ b/src/libopts/proto.h
@@ -1,19 +1,20 @@
/* -*- buffer-read-only: t -*- vi: set ro:
*
* Prototypes for autoopts
- * Generated Sat Sep 12 05:42:03 PDT 2015
+ * Generated Sun Aug 26 10:44:39 PDT 2018
*/
#ifndef AUTOOPTS_PROTO_H_GUARD
#define AUTOOPTS_PROTO_H_GUARD 1
+
/*
- * Extracted from alias.c
+ * Static declarations from alias.c
*/
static tSuccess
too_many_occurrences(tOptions * opts, tOptDesc * od);
/*
- * Extracted from autoopts.c
+ * Static declarations from autoopts.c
*/
static void *
ao_malloc(size_t sz);
@@ -34,33 +35,151 @@ static tSuccess
regular_opts(tOptions * opts);
/*
- * Extracted from check.c
+ * Static declarations from check.c
*/
static bool
+has_conflict(tOptions * pOpts, tOptDesc * od);
+
+static bool
+occurs_enough(tOptions * pOpts, tOptDesc * pOD);
+
+static bool
is_consistent(tOptions * pOpts);
/*
- * Extracted from configfile.c
+ * Static declarations from configfile.c
*/
static void
+file_preset(tOptions * opts, char const * fname, int dir);
+
+static char *
+handle_comment(char * txt);
+
+static char *
+handle_cfg(tOptions * opts, tOptState * ost, char * txt, int dir);
+
+static char *
+handle_directive(tOptions * opts, char * txt);
+
+static char *
+aoflags_directive(tOptions * opts, char * txt);
+
+static char *
+program_directive(tOptions * opts, char * txt);
+
+static char *
+handle_section(tOptions * opts, char * txt);
+
+static int
+parse_xml_encoding(char ** ppz);
+
+static char *
+trim_xml_text(char * intxt, char const * pznm, tOptionLoadMode mode);
+
+static void
+cook_xml_text(char * pzData);
+
+static char *
+handle_struct(tOptions * opts, tOptState * ost, char * txt, int dir);
+
+static void
intern_file_load(tOptions * opts);
static char const *
parse_attrs(tOptions * opts, char const * txt, tOptionLoadMode * pMode,
tOptionValue * pType);
+static char const *
+parse_keyword(tOptions * opts, char const * txt, tOptionValue * typ);
+
+static char const *
+parse_set_mem(tOptions * opts, char const * txt, tOptionValue * typ);
+
+static char const *
+parse_value(char const * txt, tOptionValue * typ);
+
+/*
+ * Static declarations from cook.c
+ */
+static char *
+nl_count(char * start, char * end, int * lnct_p);
+
+static bool
+contiguous_quote(char ** pps, char * pq, int * lnct_p);
+
+/*
+ * Static declarations from enum.c
+ */
+static void
+enum_err(tOptions * pOpts, tOptDesc * pOD,
+ char const * const * paz_names, int name_ct);
+
+static uintptr_t
+find_name(char const * name, tOptions * pOpts, tOptDesc * pOD,
+ char const * const * paz_names, unsigned int name_ct);
+
+static void
+set_memb_shell(tOptions * pOpts, tOptDesc * pOD, char const * const * paz_names,
+ unsigned int name_ct);
+
+static void
+set_memb_names(tOptions * opts, tOptDesc * od, char const * const * nm_list,
+ unsigned int nm_ct);
+
+static uintptr_t
+check_membership_start(tOptDesc * od, char const ** argp, bool * invert);
+
+static uintptr_t
+find_member_bit(tOptions * opts, tOptDesc * od, char const * pz, int len,
+ char const * const * nm_list, unsigned int nm_ct);
+
/*
- * Extracted from env.c
+ * Static declarations from env.c
*/
static void
doPrognameEnv(tOptions * pOpts, teEnvPresetType type);
static void
+do_env_opt(tOptState * os, char * env_name,
+ tOptions * pOpts, teEnvPresetType type);
+
+static void
env_presets(tOptions * pOpts, teEnvPresetType type);
/*
- * Extracted from find.c
+ * Static declarations from file.c
*/
+static void
+check_existence(teOptFileType ftype, tOptions * pOpts, tOptDesc * pOD);
+
+static void
+open_file_fd(tOptions * pOpts, tOptDesc * pOD, tuFileMode mode);
+
+static void
+fopen_file_fp(tOptions * pOpts, tOptDesc * pOD, tuFileMode mode);
+
+/*
+ * Static declarations from find.c
+ */
+static int
+parse_opt(char const ** nm_pp, char ** arg_pp, char * buf, size_t bufsz);
+
+static void
+opt_ambiguities(tOptions * opts, char const * name, int nm_len);
+
+static int
+opt_match_ct(tOptions * opts, char const * name, int nm_len,
+ int * ixp, bool * disable);
+
+static tSuccess
+opt_set(tOptions * opts, char * arg, int idx, bool disable, tOptState * st);
+
+static tSuccess
+opt_unknown(tOptions * opts, char const * name, char * arg, tOptState * st);
+
+static tSuccess
+opt_ambiguous(tOptions * opts, char const * name, int match_ct);
+
static tSuccess
opt_find_long(tOptions * opts, char const * opt_name, tOptState * state);
@@ -68,13 +187,22 @@ static tSuccess
opt_find_short(tOptions * pOpts, uint_t optValue, tOptState * pOptState);
static tSuccess
+get_opt_arg_must(tOptions * opts, tOptState * o_st);
+
+static tSuccess
+get_opt_arg_may(tOptions * pOpts, tOptState * o_st);
+
+static tSuccess
+get_opt_arg_none(tOptions * pOpts, tOptState * o_st);
+
+static tSuccess
get_opt_arg(tOptions * opts, tOptState * o_st);
static tSuccess
find_opt(tOptions * opts, tOptState * o_st);
/*
- * Extracted from init.c
+ * Static declarations from init.c
*/
static tSuccess
validate_struct(tOptions * opts, char const * pname);
@@ -82,40 +210,137 @@ validate_struct(tOptions * opts, char const * pname);
static tSuccess
immediate_opts(tOptions * opts);
+static tSuccess
+do_presets(tOptions * opts);
+
static bool
ao_initialize(tOptions * opts, int a_ct, char ** a_v);
/*
- * Extracted from load.c
+ * Static declarations from load.c
*/
+static bool
+get_realpath(char * buf, size_t b_sz);
+
+static bool
+add_prog_path(char * buf, int b_sz, char const * fname, char const * prg_path);
+
+static bool
+add_env_val(char * buf, int buf_sz, char const * name);
+
static void
munge_str(char * txt, tOptionLoadMode mode);
+static char *
+assemble_arg_val(char * txt, tOptionLoadMode mode);
+
+static char *
+trim_quotes(char * arg);
+
+static bool
+direction_ok(opt_state_mask_t f, int dir);
+
static void
load_opt_line(tOptions * opts, tOptState * opt_state, char * line,
tDirection direction, tOptionLoadMode load_mode );
/*
- * Extracted from makeshell.c
+ * Static declarations from makeshell.c
*/
-static noreturn void
+noreturn static void
option_exits(int exit_code);
-static noreturn void
+noreturn static void
ao_bug(char const * msg);
static void
fserr_warn(char const * prog, char const * op, char const * fname);
-static noreturn void
+noreturn static void
fserr_exit(char const * prog, char const * op, char const * fname);
+static void
+emit_var_text(char const * prog, char const * var, int fdin);
+
+static void
+text_to_var(tOptions * opts, teTextTo which, tOptDesc * od);
+
+static void
+emit_usage(tOptions * opts);
+
+static void
+emit_wrapup(tOptions * opts);
+
+static void
+emit_setup(tOptions * opts);
+
+static void
+emit_action(tOptions * opts, tOptDesc * od);
+
+static void
+emit_inaction(tOptions * opts, tOptDesc * od);
+
+static void
+emit_flag(tOptions * opts);
+
+static void
+emit_match_expr(char const * name, tOptDesc * cod, tOptions * opts);
+
+static void
+emit_long(tOptions * opts);
+
+static char *
+load_old_output(char const * fname, char const * pname);
+
+static void
+open_out(char const * fname, char const * pname);
+
/*
- * Extracted from nested.c
+ * Static declarations from nested.c
*/
static void
+remove_continuation(char * src);
+
+static char const *
+scan_q_str(char const * pzTxt);
+
+static tOptionValue *
+add_string(void ** pp, char const * name, size_t nm_len,
+ char const * val, size_t d_len);
+
+static tOptionValue *
+add_bool(void ** pp, char const * name, size_t nm_len,
+ char const * val, size_t d_len);
+
+static tOptionValue *
+add_number(void ** pp, char const * name, size_t nm_len,
+ char const * val, size_t d_len);
+
+static tOptionValue *
+add_nested(void ** pp, char const * name, size_t nm_len,
+ char * val, size_t d_len);
+
+static char const *
+scan_name(char const * name, tOptionValue * res);
+
+static char const *
+unnamed_xml(char const * txt);
+
+static char const *
+scan_xml_name(char const * name, size_t * nm_len, tOptionValue * val);
+
+static char const *
+find_end_xml(char const * src, size_t nm_len, char const * val, size_t * len);
+
+static char const *
+scan_xml(char const * xml_name, tOptionValue * res_val);
+
+static void
unload_arg_list(tArgList * arg_list);
+static void
+sort_list(tArgList * arg_list);
+
static tOptionValue *
optionLoadNested(char const * text, char const * name, size_t nm_len);
@@ -126,21 +351,270 @@ static void
emit_special_char(FILE * fp, int ch);
/*
- * Extracted from sort.c
+ * Static declarations from parse-duration.c
*/
+static unsigned long
+str_const_to_ul (cch_t * str, cch_t ** ppz, int base);
+
+static long
+str_const_to_l (cch_t * str, cch_t ** ppz, int base);
+
+static time_t
+scale_n_add (time_t base, time_t val, int scale);
+
+static time_t
+parse_hr_min_sec (time_t start, cch_t * pz);
+
+static time_t
+parse_scaled_value (time_t base, cch_t ** ppz, cch_t * endp, int scale);
+
+static time_t
+parse_year_month_day (cch_t * pz, cch_t * ps);
+
+static time_t
+parse_yearmonthday (cch_t * in_pz);
+
+static time_t
+parse_YMWD (cch_t * pz);
+
+static time_t
+parse_hour_minute_second (cch_t * pz, cch_t * ps);
+
+static time_t
+parse_hourminutesecond (cch_t * in_pz);
+
+static time_t
+parse_HMS (cch_t * pz);
+
+static time_t
+parse_time (cch_t * pz);
+
+static char *
+trim (char * pz);
+
+static time_t
+parse_period (cch_t * in_pz);
+
+static time_t
+parse_non_iso8601 (cch_t * pz);
+
+/*
+ * Static declarations from pgusage.c
+ */
+static inline FILE *
+open_tmp_usage(char ** buf);
+
+static inline char *
+mk_pager_cmd(char const * fname);
+
+/*
+ * Static declarations from putshell.c
+ */
+static size_t
+string_size(char const * scan, size_t nl_len);
+
+static char const *
+print_quoted_apostrophes(char const * str);
+
+static void
+print_quot_str(char const * str);
+
+static void
+print_enumeration(tOptions * pOpts, tOptDesc * pOD);
+
+static void
+print_membership(tOptions * pOpts, tOptDesc * pOD);
+
+static void
+print_stacked_arg(tOptions * pOpts, tOptDesc * pOD);
+
+static void
+print_reordering(tOptions * opts);
+
+/*
+ * Static declarations from reset.c
+ */
+static void
+optionReset(tOptions * pOpts, tOptDesc * pOD);
+
+static void
+optionResetEverything(tOptions * pOpts);
+
+/*
+ * Static declarations from restore.c
+ */
+static void
+fixupSavedOptionArgs(tOptions * pOpts);
+
+/*
+ * Static declarations from save.c
+ */
+static char const *
+find_dir_name(tOptions * opts, int * p_free);
+
+static char const *
+find_file_name(tOptions * opts, int * p_free_name);
+
+static void
+prt_entry(FILE * fp, tOptDesc * od, char const * l_arg, save_flags_mask_t save_fl);
+
+static void
+prt_value(FILE * fp, int depth, tOptDesc * od, tOptionValue const * ovp);
+
+static void
+prt_string(FILE * fp, char const * name, char const * pz);
+
+static void
+prt_val_list(FILE * fp, char const * name, tArgList * al);
+
+static void
+prt_nested(FILE * fp, tOptDesc * od, save_flags_mask_t save_fl);
+
+static void
+remove_settings(tOptions * opts, char const * fname);
+
+static FILE *
+open_sv_file(tOptions * opts, save_flags_mask_t save_fl);
+
+static void
+prt_no_arg_opt(FILE * fp, tOptDesc * vod, tOptDesc * pod, save_flags_mask_t save_fl);
+
+static void
+prt_str_arg(FILE * fp, tOptDesc * od, save_flags_mask_t save_fl);
+
+static void
+prt_enum_arg(FILE * fp, tOptDesc * od, save_flags_mask_t save_fl);
+
+static void
+prt_set_arg(FILE * fp, tOptDesc * od, save_flags_mask_t save_fl);
+
+static void
+prt_file_arg(FILE * fp, tOptDesc * od, tOptions * opts, save_flags_mask_t save_fl);
+
+/*
+ * Static declarations from sort.c
+ */
+static tSuccess
+must_arg(tOptions * opts, char * arg_txt, tOptState * pOS,
+ char ** opt_txt, uint32_t * opt_idx);
+
+static tSuccess
+maybe_arg(tOptions * opts, char * arg_txt, tOptState * pOS,
+ char ** opt_txt, uint32_t * opt_idx);
+
+static tSuccess
+short_opt_ck(tOptions * opts, char * arg_txt, tOptState * pOS,
+ char ** opt_txt, uint32_t * opt_idx);
+
static void
optionSort(tOptions * opts);
/*
- * Extracted from stack.c
+ * Static declarations from stack.c
*/
static void
addArgListEntry(void ** ppAL, void * entry);
/*
- * Extracted from usage.c
+ * Static declarations from text_mmap.c
*/
static void
+load_text_file(tmap_info_t * mapinfo, char const * pzFile);
+
+static void
+validate_mmap(char const * fname, int prot, int flags, tmap_info_t * mapinfo);
+
+static void
+close_mmap_files(tmap_info_t * mi);
+
+/*
+ * Static declarations from tokenize.c
+ */
+static void
+copy_cooked(ch_t ** ppDest, char const ** ppSrc);
+
+static void
+copy_raw(ch_t ** ppDest, char const ** ppSrc);
+
+static token_list_t *
+alloc_token_list(char const * str);
+
+/*
+ * Static declarations from usage.c
+ */
+static unsigned int
+parse_usage_flags(ao_flag_names_t const * fnt, char const * txt);
+
+static void
set_usage_flags(tOptions * opts, char const * flg_txt);
+static inline bool
+do_gnu_usage(tOptions * pOpts);
+
+static inline bool
+skip_misuse_usage(tOptions * pOpts);
+
+static void
+print_offer_usage(tOptions * opts);
+
+static void
+print_usage_details(tOptions * opts, int exit_code);
+
+static void
+print_one_paragraph(char const * text, bool plain, FILE * fp);
+
+static void
+prt_conflicts(tOptions * opts, tOptDesc * od);
+
+static void
+prt_one_vendor(tOptions * opts, tOptDesc * od,
+ arg_types_t * argtp, char const * usefmt);
+
+static void
+prt_vendor_opts(tOptions * opts, char const * title);
+
+static void
+prt_extd_usage(tOptions * opts, tOptDesc * od, char const * title);
+
+static void
+prt_ini_list(char const * const * papz, char const * ini_file,
+ char const * path_nm);
+
+static void
+prt_preamble(tOptions * opts, tOptDesc * od, arg_types_t * at);
+
+static void
+prt_one_usage(tOptions * opts, tOptDesc * od, arg_types_t * at);
+
+static void
+prt_opt_usage(tOptions * opts, int ex_code, char const * title);
+
+static void
+prt_prog_detail(tOptions * opts);
+
+static int
+setGnuOptFmts(tOptions * opts, char const ** ptxt);
+
+static int
+setStdOptFmts(tOptions * opts, char const ** ptxt);
+
+/*
+ * Static declarations from version.c
+ */
+static void
+emit_first_line(
+ FILE * fp, char const * alt1, char const * alt2, char const * alt3);
+
+static void
+emit_simple_ver(tOptions * o, FILE * fp);
+
+static void
+emit_copy_full(tOptions * o, FILE * fp);
+
+static void
+emit_copy_note(tOptions * opts, FILE * fp);
+
+static void
+print_ver(tOptions * opts, tOptDesc * od, FILE * fp, bool call_exit);
+
#endif /* AUTOOPTS_PROTO_H_GUARD */
diff --git a/src/libopts/putshell.c b/src/libopts/putshell.c
index f26dbe84a5..84463dd40b 100644
--- a/src/libopts/putshell.c
+++ b/src/libopts/putshell.c
@@ -12,7 +12,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2015 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2018 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
@@ -31,29 +31,6 @@
* 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd
*/
-/* = = = START-STATIC-FORWARD = = = */
-static size_t
-string_size(char const * scan, size_t nl_len);
-
-static char const *
-print_quoted_apostrophes(char const * str);
-
-static void
-print_quot_str(char const * str);
-
-static void
-print_enumeration(tOptions * pOpts, tOptDesc * pOD);
-
-static void
-print_membership(tOptions * pOpts, tOptDesc * pOD);
-
-static void
-print_stacked_arg(tOptions * pOpts, tOptDesc * pOD);
-
-static void
-print_reordering(tOptions * opts);
-/* = = = END-STATIC-FORWARD = = = */
-
/**
* Count the number of bytes required to represent a string as a
* compilable string.
@@ -183,7 +160,7 @@ optionQuoteString(char const * text, char const * nl)
*(out++) = '"';
*(out++) = NUL;
#ifndef NDEBUG
- if ((out - res) > out_sz) {
+ if ((size_t)(out - res) > out_sz) {
fputs(misguess_len, stderr);
option_exits(EXIT_FAILURE);
}
diff --git a/src/libopts/reset.c b/src/libopts/reset.c
index 6ca2c05229..f7b58e8d1a 100644
--- a/src/libopts/reset.c
+++ b/src/libopts/reset.c
@@ -10,7 +10,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2015 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2018 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
diff --git a/src/libopts/restore.c b/src/libopts/restore.c
index 02ef14aeba..36ebbce1a7 100644
--- a/src/libopts/restore.c
+++ b/src/libopts/restore.c
@@ -12,7 +12,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2015 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2018 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
diff --git a/src/libopts/save-flags.c b/src/libopts/save-flags.c
new file mode 100644
index 0000000000..d295170edb
--- /dev/null
+++ b/src/libopts/save-flags.c
@@ -0,0 +1,248 @@
+/* -*- buffer-read-only: t -*- vi: set ro:
+ *
+ * DO NOT EDIT THIS FILE (save-flags.c)
+ *
+ * It has been AutoGen-ed
+ * From the definitions /tmp/.ag-ufBbQe/save-flags.def
+ * and the template file str2enum
+ *
+ * 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.
+ *
+ * str2enum 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 "save-flags.h"
+#include <sys/types.h>
+#ifndef MISSING_INTTYPES_H
+# include <inttypes.h>
+#endif
+
+typedef enum {
+ SVFL_BNM_DEFAULT = 0,
+ SVFL_BNM_USAGE = 1,
+ SVFL_BNM_UPDATE = 2,
+ SVFL_COUNT_BNM
+} save_flags_enum_t;
+
+static save_flags_enum_t
+find_save_flags_bnm(char const * str, size_t len);
+
+
+#include <sys/types.h>
+#include <string.h>
+#ifndef NUL
+#define NUL '\0'
+#endif
+
+/* ANSI-C code produced by gperf version 3.1 */
+/* Command-line: gperf save-flags.gp */
+/* Computed positions: -k'' */
+
+
+# if 0 /* gperf build options: */
+// %struct-type
+// %language=ANSI-C
+// %includes
+// %global-table
+// %omit-struct-type
+// %readonly-tables
+// %compare-strncmp
+//
+// %define slot-name svfl_name
+// %define hash-function-name save_flags_hash
+// %define lookup-function-name find_save_flags_name
+// %define word-array-name save_flags_table
+// %define initializer-suffix ,SVFL_COUNT_BNM
+//
+# endif
+
+#include "save-flags.h"
+typedef struct {
+ char const * svfl_name;
+ save_flags_enum_t svfl_id;
+} save_flags_map_t;
+#include <string.h>
+
+/* maximum key range = 3, duplicates = 0 */
+
+static unsigned int
+save_flags_hash (register const char *str, register size_t len)
+{
+ (void)str;
+ (void)len;
+ return len;
+}
+
+static const save_flags_map_t save_flags_table[] =
+ {
+ {"",SVFL_COUNT_BNM}, {"",SVFL_COUNT_BNM},
+ {"",SVFL_COUNT_BNM}, {"",SVFL_COUNT_BNM},
+ {"",SVFL_COUNT_BNM},
+ {"usage", SVFL_BNM_USAGE},
+ {"update", SVFL_BNM_UPDATE},
+ {"default", SVFL_BNM_DEFAULT}
+ };
+
+static inline const save_flags_map_t *
+find_save_flags_name (register const char *str, register size_t len)
+{
+ if (len <= 7 && len >= 5)
+ {
+ register unsigned int key = (int)save_flags_hash (str, len);
+
+ if (key <= 7)
+ {
+ register const char *s = save_flags_table[key].svfl_name;
+
+ if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
+ return &save_flags_table[key];
+ }
+ }
+ return 0;
+}
+
+/**
+ * Convert a command (keyword) to a save_flags_enum_t enumeration value.
+ *
+ * @param[in] str a string that should start with a known key word.
+ * @param[in] len the provided length of the keyword at \a str.
+ * @returns the enumeration value.
+ * If not found, that value is SVFL_COUNT_BNM.
+ */
+static save_flags_enum_t
+find_save_flags_bnm(char const * str, size_t len)
+{
+ save_flags_map_t const * map;
+
+ map = find_save_flags_name(str, (unsigned int)len);
+ if (map != NULL)
+ return map->svfl_id;
+ /* Check for a partial match */
+ {
+ /*
+ * Indexes of valid save_flags_table entries in sorted order:
+ */
+ static unsigned int const ix_map[] = {
+ 7, 6, 5 };
+ save_flags_enum_t res = SVFL_COUNT_BNM;
+ static int const HI = (sizeof(ix_map) / sizeof(ix_map[0])) - 1;
+ int lo = 0;
+ int hi = HI;
+ int av;
+ int cmp;
+
+ for (;;) {
+ av = (hi + lo) / 2;
+ map = save_flags_table + ix_map[av];
+ cmp = strncmp(map->svfl_name, str, len);
+ if (cmp == 0) break;
+ if (cmp > 0)
+ hi = av - 1;
+ else lo = av + 1;
+ if (lo > hi)
+ return SVFL_COUNT_BNM;
+ }
+ res = map->svfl_id;
+ /*
+ * If we have an exact match, accept it.
+ */
+ if (map->svfl_name[len] == NUL)
+ return res;
+ /*
+ * Check for a duplicate partial match (a partial match
+ * with a higher or lower index than "av".
+ */
+ if (av < HI) {
+ map = save_flags_table + ix_map[av + 1];
+ if (strncmp(map->svfl_name, str, len) == 0)
+ return SVFL_COUNT_BNM;
+ }
+ if (av > 0) {
+ map = save_flags_table + ix_map[av - 1];
+ if (strncmp(map->svfl_name, str, len) == 0)
+ return SVFL_COUNT_BNM;
+ }
+ return res;
+ }
+}
+
+/**
+ * Convert a string to a save_flags_mask_t mask.
+ * Bit names prefixed with a hyphen have the bit removed from the mask.
+ * If the string starts with a '-', '+' or '|' character, then
+ * the old value is used as a base, otherwise the result mask
+ * is initialized to zero. Separating bit names with '+' or '|'
+ * characters is optional. By default, the bits are "or"-ed into the
+ * result.
+ *
+ * @param[in] str string with a list of bit names
+ * @param[in] old previous value, used if \a str starts with a '+' or '-'.
+ *
+ * @returns an unsigned integer with the bits set.
+ */
+save_flags_mask_t
+save_flags_str2mask(char const * str, save_flags_mask_t old)
+{
+ static char const white[] = ", \t\f";
+ static char const name_chars[] =
+ "adefglpstu"
+ "ADEFGLPSTU";
+
+ save_flags_mask_t res = 0;
+ int have_data = 0;
+
+ for (;;) {
+ save_flags_enum_t val;
+ unsigned int val_len;
+ unsigned int invert = 0;
+
+ str += strspn(str, white);
+ switch (*str) {
+ case NUL: return res;
+ case '-': case '~':
+ invert = 1;
+ /* FALLTHROUGH */
+
+ case '+': case '|':
+ if (have_data == 0)
+ res = old;
+
+ str += 1 + strspn(str + 1, white);
+ if (*str == NUL)
+ return 0;
+ }
+
+ val_len = strspn(str, name_chars);
+ if (val_len == 0)
+ return 0;
+ val = find_save_flags_bnm(str, val_len);
+ if (val == SVFL_COUNT_BNM)
+ return 0;
+ if (invert)
+ res &= ~((save_flags_mask_t)1 << val);
+ else
+ res |= (save_flags_mask_t)1 << val;
+ have_data = 1;
+ str += val_len;
+ }
+}
+/* end of save-flags.c */
diff --git a/src/libopts/save-flags.h b/src/libopts/save-flags.h
new file mode 100644
index 0000000000..dcfe0c9ae5
--- /dev/null
+++ b/src/libopts/save-flags.h
@@ -0,0 +1,68 @@
+/* -*- buffer-read-only: t -*- vi: set ro:
+ *
+ * DO NOT EDIT THIS FILE (save-flags.h)
+ *
+ * It has been AutoGen-ed
+ * From the definitions /tmp/.ag-ufBbQe/save-flags.def
+ * and the template file str2enum
+ *
+ * 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.
+ *
+ * str2enum 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.
+ *
+ * Command/Keyword Dispatcher
+ */
+#ifndef STR2ENUM_SAVE_FLAGS_H_GUARD
+#define STR2ENUM_SAVE_FLAGS_H_GUARD 1
+#include <sys/types.h>
+#include <inttypes.h>
+
+/** integral type for holding save_flags masks */
+typedef uint32_t save_flags_mask_t;
+
+/** bits defined for save_flags_mask_t */
+/** include default values in commentary */
+#define SVFL_DEFAULT 0x0001U
+/** include usage text in commentary */
+#define SVFL_USAGE 0x0002U
+/** replace or append state */
+#define SVFL_UPDATE 0x0004U
+
+/** bits in USAGE_DEFAULT mask:
+ * usage default */
+#define SVFL_USAGE_DEFAULT_MASK 0x0003U
+
+/** all bits in save_flags_mask_t masks */
+#define SVFL_MASK_ALL 0x0007U
+
+/** no bits in save_flags_mask_t */
+#define SVFL_NONE 0x0000U
+
+/** buffer size needed to hold all bit names for save_flags_mask_t masks */
+#define MAX_SAVE_FLAGS_NAME_SIZE 21
+
+extern save_flags_mask_t
+save_flags_str2mask(char const * str, save_flags_mask_t old);
+
+#endif /* STR2ENUM_SAVE_FLAGS_H_GUARD */
+/* end of save-flags.h */
diff --git a/src/libopts/save.c b/src/libopts/save.c
index 2f532b8388..8b1fba9d62 100644
--- a/src/libopts/save.c
+++ b/src/libopts/save.c
@@ -12,7 +12,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2015 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2018 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
@@ -30,49 +30,13 @@
* 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3
* 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd
*/
-
-/* = = = START-STATIC-FORWARD = = = */
-static char const *
-find_dir_name(tOptions * opts, int * p_free);
-
-static char const *
-find_file_name(tOptions * opts, int * p_free_name);
-
-static void
-prt_entry(FILE * fp, tOptDesc * od, char const * l_arg);
-
-static void
-prt_value(FILE * fp, int depth, tOptDesc * pOD, tOptionValue const * ovp);
-
-static void
-prt_string(FILE * fp, char const * name, char const * pz);
-
-static void
-prt_val_list(FILE * fp, char const * name, tArgList * al);
-
-static void
-prt_nested(FILE * fp, tOptDesc * p);
-
-static FILE *
-open_sv_file(tOptions * opts);
-
-static void
-prt_no_arg_opt(FILE * fp, tOptDesc * p, tOptDesc * pOD);
-
-static void
-prt_str_arg(FILE * fp, tOptDesc * pOD);
-
-static void
-prt_enum_arg(FILE * fp, tOptDesc * od);
-
-static void
-prt_set_arg(FILE * fp, tOptDesc * od);
-
-static void
-prt_file_arg(FILE * fp, tOptDesc * od, tOptions * opts);
-/* = = = END-STATIC-FORWARD = = = */
+#include "save-flags.h"
/**
+ * find the config file directory name
+ *
+ * @param opts the options descriptor
+ * @param p_free tell caller if name was allocated or not
*/
static char const *
find_dir_name(tOptions * opts, int * p_free)
@@ -84,79 +48,51 @@ find_dir_name(tOptions * opts, int * p_free)
return NULL;
dir = opts->pOptDesc[ opts->specOptIdx.save_opts ].optArg.argString;
- if ((dir != NULL) && (*dir != NUL))
- return dir;
+ if ((dir != NULL) && (*dir != NUL)) {
+ char const * pz = strchr(dir, '>');
+ if (pz == NULL)
+ return dir;
+ while (*(++pz) == '>') ;
+ pz += strspn(pz, " \t");
+ dir = pz;
+ if (*dir != NUL)
+ return dir;
+ }
+
+ if (opts->papzHomeList == NULL)
+ return NULL;
/*
* This function only works if there is a directory where
* we can stash the RC (INI) file.
*/
- {
- char const * const * papz = opts->papzHomeList;
- if (papz == NULL)
- return NULL;
-
- while (papz[1] != NULL) papz++;
- dir = *papz;
- }
-
- /*
- * IF it does not require deciphering an env value, then just copy it
- */
- if (*dir != '$')
- return dir;
-
- {
- char const * end = strchr(++dir, DIRCH);
- char * env;
+ for (int idx = 0;; idx++) {
+ char f_name[ AG_PATH_MAX+1 ];
- if (end != NULL) {
- char z[ AO_NAME_SIZE ];
- if ((end - dir) > AO_NAME_LIMIT )
- return NULL;
- memcpy(z, dir, (size_t)(end - dir));
- z[end - dir] = NUL;
- env = getenv(z);
- } else {
-
- /*
- * Make sure we can get the env value (after stripping off
- * any trailing directory or file names)
- */
- env = getenv(dir);
- }
+ dir = opts->papzHomeList[idx];
- if (env == NULL) {
- fprintf(stderr, zsave_warn, opts->pzProgName);
- fprintf(stderr, zNotDef, dir);
- return NULL;
+ switch (*dir) {
+ case '$':
+ break;
+ case NUL:
+ continue;
+ default:
+ return dir;
}
-
- if (end == NULL)
- return env;
-
- /*
- * we will be returning an allocated result
- */
- *p_free = 1;
-
- {
- size_t env_len = strlen(env);
- size_t end_len = strlen(end);
- char * p;
- char * res = p = (char *)AGALOC(env_len + end_len + 2, "dir name");
-
- memcpy(p, env, env_len);
- p += env_len;
- *(p++) = '/';
- memcpy(p, end, end_len + 1);
-
- return res;
+ if (optionMakePath(f_name, (int)sizeof(f_name), dir, opts->pzProgPath)) {
+ *p_free = true;
+ AGDUPSTR(dir, f_name, "homerc");
+ return dir;
}
}
+ return NULL;
}
/**
+ * Find the name of the save-the-options file
+ *
+ * @param opts the options descriptor
+ * @param p_free_name tell caller if name was allocated or not
*/
static char const *
find_file_name(tOptions * opts, int * p_free_name)
@@ -164,15 +100,15 @@ find_file_name(tOptions * opts, int * p_free_name)
struct stat stBuf;
int free_dir_name = 0;
- char const * pzDir = find_dir_name(opts, &free_dir_name);
- if (pzDir == NULL)
- return NULL;
+ char const * res = find_dir_name(opts, &free_dir_name);
+ if (res == NULL)
+ return res;
/*
* See if we can find the specified directory. We use a once-only loop
* structure so we can bail out early.
*/
- if (stat(pzDir, &stBuf) != 0) do {
+ if (stat(res, &stBuf) != 0) do {
char z[AG_PATH_MAX];
char * dirchp;
@@ -182,10 +118,10 @@ find_file_name(tOptions * opts, int * p_free_name)
*/
if (errno != ENOENT) {
bogus_name:
- fprintf(stderr, zsave_warn, opts->pzProgName);
- fprintf(stderr, zNoStat, errno, strerror(errno), pzDir);
+ fprintf(stderr, zsave_warn, opts->pzProgName, res);
+ fprintf(stderr, zNoStat, errno, strerror(errno), res);
if (free_dir_name)
- AGFREE(pzDir);
+ AGFREE(res);
return NULL;
}
@@ -193,17 +129,17 @@ find_file_name(tOptions * opts, int * p_free_name)
* Strip off the last component, stat the remaining string and
* that string must name a directory
*/
- dirchp = strrchr(pzDir, DIRCH);
+ dirchp = strrchr(res, DIRCH);
if (dirchp == NULL) {
stBuf.st_mode = S_IFREG;
break; /* found directory -- viz., "." */
}
- if ((size_t)(dirchp - pzDir) >= sizeof(z))
+ if ((size_t)(dirchp - res) >= sizeof(z))
goto bogus_name;
- memcpy(z, pzDir, (size_t)(dirchp - pzDir));
- z[dirchp - pzDir] = NUL;
+ memcpy(z, res, (size_t)(dirchp - res));
+ z[dirchp - res] = NUL;
if ((stat(z, &stBuf) != 0) || ! S_ISDIR(stBuf.st_mode))
goto bogus_name;
@@ -215,16 +151,17 @@ find_file_name(tOptions * opts, int * p_free_name)
* THEN tack on the config file name
*/
if (S_ISDIR(stBuf.st_mode)) {
- size_t sz = strlen(pzDir) + strlen(opts->pzRcName) + 2;
{
+ size_t sz = strlen(res) + strlen(opts->pzRcName) + 2;
char * pzPath = (char *)AGALOC(sz, "file name");
- if (snprintf(pzPath, sz, "%s/%s", pzDir, opts->pzRcName) >= sz)
+ if ( snprintf(pzPath, sz, "%s/%s", res, opts->pzRcName)
+ >= (int)sz)
option_exits(EXIT_FAILURE);
if (free_dir_name)
- AGFREE(pzDir);
- pzDir = pzPath;
+ AGFREE(res);
+ res = pzPath;
free_dir_name = 1;
}
@@ -232,12 +169,12 @@ find_file_name(tOptions * opts, int * p_free_name)
* IF we cannot stat the object for any reason other than
* it does not exist, then we bail out
*/
- if (stat(pzDir, &stBuf) != 0) {
+ if (stat(res, &stBuf) != 0) {
if (errno != ENOENT) {
- fprintf(stderr, zsave_warn, opts->pzProgName);
+ fprintf(stderr, zsave_warn, opts->pzProgName, res);
fprintf(stderr, zNoStat, errno, strerror(errno),
- pzDir);
- AGFREE(pzDir);
+ res);
+ AGFREE(res);
return NULL;
}
@@ -253,32 +190,37 @@ find_file_name(tOptions * opts, int * p_free_name)
* or will soon be a file.
*/
if (! S_ISREG(stBuf.st_mode)) {
- fprintf(stderr, zsave_warn, opts->pzProgName, pzDir);
+ fprintf(stderr, zsave_warn, opts->pzProgName, res);
if (free_dir_name)
- AGFREE(pzDir);
+ AGFREE(res);
return NULL;
}
/*
* Get rid of the old file
*/
- unlink(pzDir);
*p_free_name = free_dir_name;
- return pzDir;
+ return res;
}
/**
* print one option entry to the save file.
*
- * @param[in] fp the file pointer for the save file
- * @param[in] od the option descriptor to print
- * @param[in] l_arg the last argument for the option
+ * @param[in] fp the file pointer for the save file
+ * @param[in] od the option descriptor to print
+ * @param[in] l_arg the last argument for the option
+ * @param[in] save_fl include usage in comments
*/
static void
-prt_entry(FILE * fp, tOptDesc * od, char const * l_arg)
+prt_entry(FILE * fp, tOptDesc * od, char const * l_arg, save_flags_mask_t save_fl)
{
int space_ct;
+ if (save_fl & SVFL_USAGE)
+ fprintf(fp, ao_name_use_fmt, od->pz_Name, od->pzText);
+ if (UNUSED_OPT(od) && (save_fl & SVFL_DEFAULT))
+ fputs(ao_default_use, fp);
+
/*
* There is an argument. Pad the name so values line up.
* Not disabled *OR* this got equivalenced to another opt,
@@ -287,9 +229,14 @@ prt_entry(FILE * fp, tOptDesc * od, char const * l_arg)
*/
{
char const * pz =
- (! DISABLED_OPT(od) || (od->optEquivIndex != NO_EQUIVALENT))
+ (od->pz_DisableName == NULL)
? od->pz_Name
- : od->pz_DisableName;
+ : (DISABLED_OPT(od)
+ ? od->pz_DisableName
+ : ((od->optEquivIndex == NO_EQUIVALENT)
+ ? od->pz_Name : od->pz_DisableName)
+ );
+
space_ct = 17 - strlen(pz);
fputs(pz, fp);
}
@@ -338,9 +285,13 @@ end_entry:
}
/**
+ * print an option's value
+ *
+ * @param[in] fp the file pointer for the save file
+ * @param[in] od the option descriptor to print
*/
static void
-prt_value(FILE * fp, int depth, tOptDesc * pOD, tOptionValue const * ovp)
+prt_value(FILE * fp, int depth, tOptDesc * od, tOptionValue const * ovp)
{
while (--depth >= 0)
putc(' ', fp), putc(' ', fp);
@@ -357,9 +308,9 @@ prt_value(FILE * fp, int depth, tOptDesc * pOD, tOptionValue const * ovp)
case OPARG_TYPE_ENUMERATION:
case OPARG_TYPE_MEMBERSHIP:
- if (pOD != NULL) {
- uint32_t opt_state = pOD->fOptState;
- uintptr_t val = pOD->optArg.argEnum;
+ if (od != NULL) {
+ uint32_t opt_state = od->fOptState;
+ uintptr_t val = od->optArg.argEnum;
char const * typ = (ovp->valType == OPARG_TYPE_ENUMERATION)
? "keyword" : "set-membership";
@@ -369,20 +320,20 @@ prt_value(FILE * fp, int depth, tOptDesc * pOD, tOptionValue const * ovp)
* This is a magic incantation that will convert the
* bit flag values back into a string suitable for printing.
*/
- (*(pOD->pOptProc))(OPTPROC_RETURN_VALNAME, pOD );
- if (pOD->optArg.argString != NULL) {
- fputs(pOD->optArg.argString, fp);
+ (*(od->pOptProc))(OPTPROC_RETURN_VALNAME, od );
+ if (od->optArg.argString != NULL) {
+ fputs(od->optArg.argString, fp);
if (ovp->valType != OPARG_TYPE_ENUMERATION) {
/*
* set membership strings get allocated
*/
- AGFREE(pOD->optArg.argString);
+ AGFREE(od->optArg.argString);
}
}
- pOD->optArg.argEnum = val;
- pOD->fOptState = opt_state;
+ od->optArg.argEnum = val;
+ od->fOptState = opt_state;
fprintf(fp, END_XML_FMT, ovp->pzName);
break;
}
@@ -404,6 +355,9 @@ prt_value(FILE * fp, int depth, tOptDesc * pOD, tOptionValue const * ovp)
}
/**
+ * Print a string value in XML format
+ *
+ * @param[in] fp the file pointer for the save file
*/
static void
prt_string(FILE * fp, char const * name, char const * pz)
@@ -440,6 +394,9 @@ prt_string(FILE * fp, char const * name, char const * pz)
}
/**
+ * Print an option that can have multiple values in XML format
+ *
+ * @param[in] fp file pointer
*/
static void
prt_val_list(FILE * fp, char const * name, tArgList * al)
@@ -476,15 +433,26 @@ prt_val_list(FILE * fp, char const * name, tArgList * al)
}
/**
+ * printed a nested/hierarchical value
+ *
+ * @param[in] fp file pointer
+ * @param[in] od option descriptor
+ * @param[in] save_fl include usage in comments
*/
static void
-prt_nested(FILE * fp, tOptDesc * p)
+prt_nested(FILE * fp, tOptDesc * od, save_flags_mask_t save_fl)
{
int opt_ct;
- tArgList * al = p->optCookie;
+ tArgList * al = od->optCookie;
void ** opt_list;
- if (al == NULL)
+ if (save_fl & SVFL_USAGE)
+ fprintf(fp, ao_name_use_fmt, od->pz_Name, od->pzText);
+
+ /*
+ * Never show a default value if a hierarchical value is empty.
+ */
+ if (UNUSED_OPT(od) || (al == NULL))
return;
opt_ct = al->useCt;
@@ -500,48 +468,128 @@ prt_nested(FILE * fp, tOptDesc * p)
if (ovp == NULL)
continue;
- fprintf(fp, NESTED_OPT_FMT, p->pz_Name);
+ fprintf(fp, NESTED_OPT_FMT, od->pz_Name);
do {
- prt_value(fp, 1, p, ovp);
+ prt_value(fp, 1, od, ovp);
} while (ovp = optionNextValue(base, ovp),
ovp != NULL);
- fprintf(fp, "</%s>\n", p->pz_Name);
+ fprintf(fp, "</%s>\n", od->pz_Name);
} while (--opt_ct > 0);
}
/**
- * open the file for saving option state.
+ * remove the current program settings
*
* @param[in] opts the program options structure
+ * @param[in] fname the save file name
+ */
+static void
+remove_settings(tOptions * opts, char const * fname)
+{
+ size_t const name_len = strlen(opts->pzProgName);
+ tmap_info_t map_info;
+ char * text = text_mmap(fname, PROT_READ|PROT_WRITE, MAP_PRIVATE, &map_info);
+ char * scan = text;
+
+ for (;;) {
+ char * next = scan = strstr(scan, zCfgProg);
+ if (scan == NULL)
+ goto leave;
+
+ scan = SPN_WHITESPACE_CHARS(scan + zCfgProg_LEN);
+ if ( (strneqvcmp(scan, opts->pzProgName, (int)name_len) == 0)
+ && (IS_END_XML_TOKEN_CHAR(scan[name_len])) ) {
+
+ scan = next;
+ break;
+ }
+ }
+
+ /*
+ * If not NULL, "scan" points to the "<?program" string introducing
+ * the program segment we are to remove. See if another segment follows.
+ * If so, copy text. If not se trim off this segment.
+ */
+ {
+ char * next = strstr(scan + zCfgProg_LEN, zCfgProg);
+ size_t new_sz;
+
+ if (next == NULL)
+ new_sz = map_info.txt_size - strlen(scan);
+ else {
+ int fd = open(fname, O_RDWR);
+ if (fd < 0) return;
+ if (lseek(fd, (scan - text), SEEK_SET) < 0)
+ scan = next;
+ else if (write(fd, next, strlen(next)) < 0)
+ scan = next;
+ if (close(fd) < 0)
+ scan = next;
+ new_sz = map_info.txt_size - (next - scan);
+ }
+ if (new_sz != map_info.txt_size)
+ if (truncate(fname, new_sz) < 0)
+ scan = next; // we removed it, so shorten file
+ }
+
+ leave:
+ text_munmap(&map_info);
+}
+
+/**
+ * open the file for saving option state.
+ *
+ * @param[in] opts the program options structure
+ * @param[in] save_fl flags for saving data
* @returns the open file pointer. It may be NULL.
*/
static FILE *
-open_sv_file(tOptions * opts)
+open_sv_file(tOptions * opts, save_flags_mask_t save_fl)
{
FILE * fp;
{
int free_name = 0;
- char const * pzFName = find_file_name(opts, &free_name);
- if (pzFName == NULL)
+ char const * fname = find_file_name(opts, &free_name);
+ if (fname == NULL)
return NULL;
- fp = fopen(pzFName, "w" FOPEN_BINARY_FLAG);
+ if (save_fl == 0)
+ unlink(fname);
+ else
+ remove_settings(opts, fname);
+
+ fp = fopen(fname, "a" FOPEN_BINARY_FLAG);
if (fp == NULL) {
- fprintf(stderr, zsave_warn, opts->pzProgName);
- fprintf(stderr, zNoCreat, errno, strerror(errno), pzFName);
+ fprintf(stderr, zsave_warn, opts->pzProgName, fname);
+ fprintf(stderr, zNoCreat, errno, strerror(errno), fname);
if (free_name)
- AGFREE(pzFName);
+ AGFREE(fname);
return fp;
}
if (free_name)
- AGFREE(pzFName);
+ AGFREE(fname);
}
+ do {
+ struct stat sbuf;
+ if (fstat(fileno(fp), &sbuf) < 0)
+ break;
+
+ if (sbuf.st_size > zPresetFile_LEN) {
+ /* non-zero size implies save_fl is non-zero */
+ fprintf(fp, zFmtProg, opts->pzProgName);
+ return fp;
+ }
+ } while (false);
+
+ /*
+ * We have a new file. Insert a header
+ */
fputs("# ", fp);
{
char const * e = strchr(opts->pzUsageTitle, NL);
@@ -563,40 +611,63 @@ open_sv_file(tOptions * opts)
AGFREE(time_str);
#endif
}
-
+ if (save_fl != 0)
+ fprintf(fp, zFmtProg, opts->pzProgName);
return fp;
}
/**
+ * print option without an arg
+ *
+ * @param[in] fp file pointer
+ * @param[in] vod value option descriptor
+ * @param[in] pod primary option descriptor
+ * @param[in] save_fl include usage in comments
*/
static void
-prt_no_arg_opt(FILE * fp, tOptDesc * p, tOptDesc * pOD)
+prt_no_arg_opt(FILE * fp, tOptDesc * vod, tOptDesc * pod, save_flags_mask_t save_fl)
{
/*
* The aliased to argument indicates whether or not the option
* is "disabled". However, the original option has the name
- * string, so we get that there, not with "p".
+ * string, so we get that there, not with "vod".
*/
char const * pznm =
- (DISABLED_OPT(p)) ? pOD->pz_DisableName : pOD->pz_Name;
+ (DISABLED_OPT(vod)) ? pod->pz_DisableName : pod->pz_Name;
/*
* If the option was disabled and the disablement name is NULL,
* then the disablement was caused by aliasing.
* Use the name as the string to emit.
*/
if (pznm == NULL)
- pznm = pOD->pz_Name;
+ pznm = pod->pz_Name;
+
+ if (save_fl & SVFL_USAGE)
+ fprintf(fp, ao_name_use_fmt, pod->pz_Name, pod->pzText);
+ if (UNUSED_OPT(pod) && (save_fl & SVFL_DEFAULT))
+ fputs(ao_default_use, fp);
fprintf(fp, "%s\n", pznm);
}
/**
+ * print the string valued argument(s).
+ *
+ * @param[in] fp file pointer
+ * @param[in] od value option descriptor
+ * @param[in] save_fl include usage in comments
*/
static void
-prt_str_arg(FILE * fp, tOptDesc * pOD)
+prt_str_arg(FILE * fp, tOptDesc * od, save_flags_mask_t save_fl)
{
- if (pOD->fOptState & OPTST_STACKED) {
- tArgList * pAL = (tArgList *)pOD->optCookie;
+ if (UNUSED_OPT(od) || ((od->fOptState & OPTST_STACKED) == 0)) {
+ char const * arg = od->optArg.argString;
+ if (arg == NULL)
+ arg = "''";
+ prt_entry(fp, od, arg, save_fl);
+
+ } else {
+ tArgList * pAL = (tArgList *)od->optCookie;
int uct = pAL->useCt;
char const ** ppz = pAL->apzArgs;
@@ -604,23 +675,24 @@ prt_str_arg(FILE * fp, tOptDesc * pOD)
* un-disable multiple copies of disabled options.
*/
if (uct > 1)
- pOD->fOptState &= ~OPTST_DISABLED;
+ od->fOptState &= ~OPTST_DISABLED;
- while (uct-- > 0)
- prt_entry(fp, pOD, *(ppz++));
- } else {
- prt_entry(fp, pOD, pOD->optArg.argString);
+ while (uct-- > 0) {
+ prt_entry(fp, od, *(ppz++), save_fl);
+ save_fl &= ~SVFL_USAGE;
+ }
}
}
/**
* print the string value of an enumeration.
*
- * @param[in] fp the file pointer to write to
- * @param[in] od the option descriptor with the enumerated value
+ * @param[in] fp the file pointer to write to
+ * @param[in] od the option descriptor with the enumerated value
+ * @param[in] save_fl include usage in comments
*/
static void
-prt_enum_arg(FILE * fp, tOptDesc * od)
+prt_enum_arg(FILE * fp, tOptDesc * od, save_flags_mask_t save_fl)
{
uintptr_t val = od->optArg.argEnum;
@@ -629,29 +701,31 @@ prt_enum_arg(FILE * fp, tOptDesc * od)
* bit flag values back into a string suitable for printing.
*/
(*(od->pOptProc))(OPTPROC_RETURN_VALNAME, od);
- prt_entry(fp, od, VOIDP(od->optArg.argString));
+ prt_entry(fp, od, VOIDP(od->optArg.argString), save_fl);
od->optArg.argEnum = val;
}
/**
* Print the bits set in a bit mask option.
+ *
* We call the option handling function with a magic value for
* the options pointer and it allocates and fills in the string.
* We print that with a call to prt_entry().
*
- * @param[in] fp the file pointer to write to
- * @param[in] od the option descriptor with a bit mask value type
+ * @param[in] fp the file pointer to write to
+ * @param[in] od the option descriptor with a bit mask value type
+ * @param[in] save_fl include usage in comments
*/
static void
-prt_set_arg(FILE * fp, tOptDesc * od)
+prt_set_arg(FILE * fp, tOptDesc * od, save_flags_mask_t save_fl)
{
char * list = optionMemberList(od);
size_t len = strlen(list);
char * buf = (char *)AGALOC(len + 3, "dir name");
*buf= '=';
memcpy(buf+1, list, len + 1);
- prt_entry(fp, od, buf);
+ prt_entry(fp, od, buf, save_fl);
AGFREE(buf);
AGFREE(list);
}
@@ -660,29 +734,35 @@ prt_set_arg(FILE * fp, tOptDesc * od)
* figure out what the option file name argument is.
* If one can be found, call prt_entry() to emit it.
*
- * @param[in] fp the file pointer to write to.
- * @param[in] od the option descriptor with a bit mask value type
- * @param[in] opts the program options descriptor
+ * @param[in] fp the file pointer to write to.
+ * @param[in] od the option descriptor with a bit mask value type
+ * @param[in] opts the program options descriptor
+ * @param[in] save_fl include usage in comments
*/
static void
-prt_file_arg(FILE * fp, tOptDesc * od, tOptions * opts)
+prt_file_arg(FILE * fp, tOptDesc * od, tOptions * opts, save_flags_mask_t save_fl)
{
/*
* If the cookie is not NULL, then it has the file name, period.
* Otherwise, if we have a non-NULL string argument, then....
*/
if (od->optCookie != NULL)
- prt_entry(fp, od, od->optCookie);
+ prt_entry(fp, od, od->optCookie, save_fl);
else if (HAS_originalOptArgArray(opts)) {
char const * orig =
opts->originalOptArgArray[od->optIndex].argString;
- if (od->optArg.argString == orig)
+ if (od->optArg.argString == orig) {
+ if (save_fl)
+ fprintf(fp, ao_name_use_fmt, od->pz_Name, od->pzText);
return;
+ }
- prt_entry(fp, od, od->optArg.argString);
- }
+ prt_entry(fp, od, od->optArg.argString, save_fl);
+
+ } else if (save_fl)
+ fprintf(fp, ao_name_use_fmt, od->pz_Name, od->pzText);
}
/*=export_func optionSaveFile
@@ -719,8 +799,32 @@ optionSaveFile(tOptions * opts)
{
tOptDesc * od;
int ct;
- FILE * fp = open_sv_file(opts);
+ FILE * fp;
+ save_flags_mask_t save_flags = SVFL_NONE;
+
+ do {
+ char * temp_str;
+ char const * dir = opts->pOptDesc[ opts->specOptIdx.save_opts ].optArg.argString;
+ size_t flen;
+ if (dir == NULL)
+ break;
+ temp_str = strchr(dir, '>');
+ if (temp_str == NULL)
+ break;
+ if (temp_str[1] == '>')
+ save_flags = SVFL_UPDATE;
+ flen = (temp_str - dir);
+ if (flen == 0)
+ break;
+ temp_str = AGALOC(flen + 1, "flag search str");
+ memcpy(temp_str, dir, flen);
+ temp_str[flen] = NUL;
+ save_flags |= save_flags_str2mask(temp_str, SVFL_NONE);
+ AGFREE(temp_str);
+ } while (false);
+
+ fp = open_sv_file(opts, save_flags & SVFL_UPDATE);
if (fp == NULL)
return;
@@ -730,20 +834,20 @@ optionSaveFile(tOptions * opts)
ct = opts->presetOptCt;
od = opts->pOptDesc;
do {
- tOptDesc * p;
+ tOptDesc * vod;
/*
- * IF the option has not been defined
- * OR it does not take an initialization value
- * OR it is equivalenced to another option
- * THEN continue (ignore it)
- *
* Equivalenced options get picked up when the equivalenced-to
- * option is processed.
+ * option is processed. And do not save options with any state
+ * bits in the DO_NOT_SAVE collection
+ *
+ * ** option cannot be preset
+ * #define OPTST_NO_INIT 0x0000100U
+ * ** disable from cmd line
+ * #define OPTST_NO_COMMAND 0x2000000U
+ * ** alias for other option
+ * #define OPTST_ALIAS 0x8000000U
*/
- if (UNUSED_OPT(od))
- continue;
-
if ((od->fOptState & OPTST_DO_NOT_SAVE_MASK) != 0)
continue;
@@ -751,45 +855,48 @@ optionSaveFile(tOptions * opts)
&& (od->optEquivIndex != od->optIndex))
continue;
+ if (UNUSED_OPT(od) && ((save_flags & SVFL_USAGE_DEFAULT_MASK) == SVFL_NONE))
+ continue;
+
/*
* The option argument data are found at the equivalenced-to option,
* but the actual option argument type comes from the original
* option descriptor. Be careful!
*/
- p = ((od->fOptState & OPTST_EQUIVALENCE) != 0)
- ? (opts->pOptDesc + od->optActualIndex) : od;
+ vod = ((od->fOptState & OPTST_EQUIVALENCE) != 0)
+ ? (opts->pOptDesc + od->optActualIndex) : od;
switch (OPTST_GET_ARGTYPE(od->fOptState)) {
case OPARG_TYPE_NONE:
- prt_no_arg_opt(fp, p, od);
+ prt_no_arg_opt(fp, vod, od, save_flags);
break;
case OPARG_TYPE_NUMERIC:
- prt_entry(fp, p, VOIDP(p->optArg.argInt));
+ prt_entry(fp, vod, VOIDP(vod->optArg.argInt), save_flags);
break;
case OPARG_TYPE_STRING:
- prt_str_arg(fp, p);
+ prt_str_arg(fp, vod, save_flags);
break;
case OPARG_TYPE_ENUMERATION:
- prt_enum_arg(fp, p);
+ prt_enum_arg(fp, vod, save_flags);
break;
case OPARG_TYPE_MEMBERSHIP:
- prt_set_arg(fp, p);
+ prt_set_arg(fp, vod, save_flags);
break;
case OPARG_TYPE_BOOLEAN:
- prt_entry(fp, p, p->optArg.argBool ? "true" : "false");
+ prt_entry(fp, vod, vod->optArg.argBool ? "true" : "false", save_flags);
break;
case OPARG_TYPE_HIERARCHY:
- prt_nested(fp, p);
+ prt_nested(fp, vod, save_flags);
break;
case OPARG_TYPE_FILE:
- prt_file_arg(fp, p, opts);
+ prt_file_arg(fp, vod, opts, save_flags);
break;
default:
diff --git a/src/libopts/sort.c b/src/libopts/sort.c
index da0033431a..b4bd5cb7e2 100644
--- a/src/libopts/sort.c
+++ b/src/libopts/sort.c
@@ -10,7 +10,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2015 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2018 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
@@ -29,20 +29,6 @@
* 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd
*/
-/* = = = START-STATIC-FORWARD = = = */
-static tSuccess
-must_arg(tOptions * opts, char * arg_txt, tOptState * pOS,
- char ** opt_txt, uint32_t * opt_idx);
-
-static tSuccess
-maybe_arg(tOptions * opts, char * arg_txt, tOptState * pOS,
- char ** opt_txt, uint32_t * opt_idx);
-
-static tSuccess
-short_opt_ck(tOptions * opts, char * arg_txt, tOptState * pOS,
- char ** opt_txt, uint32_t * opt_idx);
-/* = = = END-STATIC-FORWARD = = = */
-
/*
* "must_arg" and "maybe_arg" are really similar. The biggest
* difference is that "may" will consume the next argument only if it
@@ -178,7 +164,7 @@ short_opt_ck(tOptions * opts, char * arg_txt, tOptState * pOS,
* If the program wants sorted options (separated operands and options),
* then this routine will to the trick.
*/
-LOCAL void
+static void
optionSort(tOptions * opts)
{
char ** opt_txt;
diff --git a/src/libopts/stack.c b/src/libopts/stack.c
index affe6b661f..39a328a85b 100644
--- a/src/libopts/stack.c
+++ b/src/libopts/stack.c
@@ -11,7 +11,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2015 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2018 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
@@ -176,7 +176,7 @@ optionUnstackArg(tOptions * opts, tOptDesc * od)
* a pointer to the argument list structure. It gets passed around
* as an opaque address.
*/
-LOCAL void
+static void
addArgListEntry(void ** ppAL, void * entry)
{
tArgList * pAL = *(void **)ppAL;
diff --git a/src/libopts/stdnoreturn.in.h b/src/libopts/stdnoreturn.in.h
index 0e9c9e8425..bf46c0883e 100644
--- a/src/libopts/stdnoreturn.in.h
+++ b/src/libopts/stdnoreturn.in.h
@@ -1,6 +1,6 @@
/* A substitute for ISO C11 <stdnoreturn.h>.
- Copyright 2012-2015 Free Software Foundation, Inc.
+ Copyright 2012-2018 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
@@ -28,15 +28,25 @@
/* The definition of _Noreturn is copied here. */
-#if 1200 <= _MSC_VER
-/* Standard include files on this platform contain declarations like
- "__declspec (noreturn) void abort (void);". "#define noreturn
- _Noreturn" would cause this declaration to be rewritten to the
- invalid "__declspec (__declspec (noreturn)) void abort (void);".
- Instead, define noreturn to empty, so that such declarations are
- rewritten to "__declspec () void abort (void);", which is
- equivalent to "void abort (void);"; this gives up on noreturn's
- advice to the compiler but at least it is valid code. */
+#if 1200 <= _MSC_VER || defined __CYGWIN__
+/* On MSVC, standard include files contain declarations like
+ __declspec (noreturn) void abort (void);
+ "#define noreturn _Noreturn" would cause this declaration to be rewritten
+ to the invalid
+ __declspec (__declspec (noreturn)) void abort (void);
+
+ Similarly, on Cygwin, standard include files contain declarations like
+ void __cdecl abort (void) __attribute__ ((noreturn));
+ "#define noreturn _Noreturn" would cause this declaration to be rewritten
+ to the invalid
+ void __cdecl abort (void) __attribute__ ((__attribute__ ((__noreturn__))));
+
+ Instead, define noreturn to empty, so that such declarations are rewritten to
+ __declspec () void abort (void);
+ or
+ void __cdecl abort (void) __attribute__ (());
+ respectively. This gives up on noreturn's advice to the compiler but at
+ least it is valid code. */
# define noreturn /*empty*/
#else
# define noreturn _Noreturn
diff --git a/src/libopts/streqvcmp.c b/src/libopts/streqvcmp.c
index e87a232d19..53477d65f9 100644
--- a/src/libopts/streqvcmp.c
+++ b/src/libopts/streqvcmp.c
@@ -15,7 +15,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2015 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2018 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
@@ -37,7 +37,7 @@
* together for a case independent comparison. The mappings are
* based upon ascii character sequences.
*/
-static unsigned char charmap[] = {
+ static unsigned char charmap[] = {
NUL, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, '\a',
'\b', '\t', NL, '\v', '\f', '\r', 0x0E, 0x0F,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
diff --git a/src/libopts/text_mmap.c b/src/libopts/text_mmap.c
index d5e074fa97..11093082e3 100644
--- a/src/libopts/text_mmap.c
+++ b/src/libopts/text_mmap.c
@@ -9,7 +9,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2015 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2018 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
@@ -185,10 +185,12 @@ validate_mmap(char const * fname, int prot, int flags, tmap_info_t * mapinfo)
* then our updates will show in the file, so we must open with
* write access.
*/
- int o_flag = FILE_WRITABLE(prot, flags) ? O_RDWR : O_RDONLY;
+ int o_flag =
#ifdef _WIN32
- o_flag |= O_BINARY;
+ O_BINARY |
#endif
+ FILE_WRITABLE(prot, flags) ? O_RDWR : O_RDONLY;
+
/*
* If you're not sharing the file and you are writing to it,
* then don't let anyone else have access to the file.
@@ -351,16 +353,15 @@ text_munmap(tmap_info_t * mi)
#ifdef HAVE_MMAP
(void)munmap(mi->txt_data, mi->txt_full_size);
-#else /* don't HAVE_MMAP */
+#else // don't HAVE_MMAP
/*
* IF the memory is writable *AND* it is not private (copy-on-write)
* *AND* the memory is "sharable" (seen by other processes)
* THEN rewrite the data. Emulate mmap visibility.
*/
- if ( FILE_WRITABLE(mi->txt_prot, mi->txt_flags)
- && (lseek(mi->txt_fd, 0, SEEK_SET) >= 0) ) {
+ if ( FILE_WRITABLE(mi->txt_prot, mi->txt_flags)
+ && (lseek(mi->txt_fd, 0, SEEK_SET) >= 0) )
write(mi->txt_fd, mi->txt_data, mi->txt_size);
- }
free(mi->txt_data);
#endif /* HAVE_MMAP */
diff --git a/src/libopts/time.c b/src/libopts/time.c
index 9743dc168b..debaa7aed3 100644
--- a/src/libopts/time.c
+++ b/src/libopts/time.c
@@ -8,7 +8,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2015 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2018 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
@@ -92,7 +92,7 @@ optionTimeDate(tOptions * opts, tOptDesc * od)
static char const fmt[] = "DATEMSK=%s/datemsk";
size_t sz = sizeof(fmt) + strlen(opts->pzPkgDataDir);
envptr = AGALOC(sz, fmt);
- if (snprintf(envptr, sz, fmt, opts->pzPkgDataDir) >= sz)
+ if (snprintf(envptr, sz, fmt, opts->pzPkgDataDir) >= (int)sz)
option_exits(EXIT_FAILURE);
putenv(envptr);
diff --git a/src/libopts/tokenize.c b/src/libopts/tokenize.c
index cbff7fba47..7489e3d526 100644
--- a/src/libopts/tokenize.c
+++ b/src/libopts/tokenize.c
@@ -9,7 +9,7 @@
* This file defines the string_tokenize interface
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2015 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2018 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
@@ -28,23 +28,6 @@
* 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd
*/
-#include <errno.h>
-#include <stdlib.h>
-
-#define cc_t const unsigned char
-#define ch_t unsigned char
-
-/* = = = START-STATIC-FORWARD = = = */
-static void
-copy_cooked(ch_t ** ppDest, char const ** ppSrc);
-
-static void
-copy_raw(ch_t ** ppDest, char const ** ppSrc);
-
-static token_list_t *
-alloc_token_list(char const * str);
-/* = = = END-STATIC-FORWARD = = = */
-
static void
copy_cooked(ch_t ** ppDest, char const ** ppSrc)
{
diff --git a/src/libopts/usage.c b/src/libopts/usage.c
index 01c5f346b7..8df3591e66 100644
--- a/src/libopts/usage.c
+++ b/src/libopts/usage.c
@@ -18,7 +18,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2015 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2018 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
@@ -37,60 +37,8 @@
* 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd
*/
-/* = = = START-STATIC-FORWARD = = = */
-static unsigned int
-parse_usage_flags(ao_flag_names_t const * fnt, char const * txt);
-
-static inline bool
-do_gnu_usage(tOptions * pOpts);
-
-static inline bool
-skip_misuse_usage(tOptions * pOpts);
-
-static void
-print_offer_usage(tOptions * opts);
-
-static void
-print_usage_details(tOptions * opts, int exit_code);
-
-static void
-print_one_paragraph(char const * text, bool plain, FILE * fp);
-
-static void
-prt_conflicts(tOptions * opts, tOptDesc * od);
-
-static void
-prt_one_vendor(tOptions * opts, tOptDesc * od,
- arg_types_t * argtp, char const * usefmt);
-
-static void
-prt_vendor_opts(tOptions * opts, char const * title);
-
-static void
-prt_extd_usage(tOptions * opts, tOptDesc * od, char const * title);
-
-static void
-prt_ini_list(char const * const * papz, char const * ini_file,
- char const * path_nm);
-
-static void
-prt_preamble(tOptions * opts, tOptDesc * od, arg_types_t * at);
-
-static void
-prt_one_usage(tOptions * opts, tOptDesc * od, arg_types_t * at);
-
-static void
-prt_opt_usage(tOptions * opts, int ex_code, char const * title);
-
-static void
-prt_prog_detail(tOptions * opts);
-
-static int
-setGnuOptFmts(tOptions * opts, char const ** ptxt);
-
-static int
-setStdOptFmts(tOptions * opts, char const ** ptxt);
-/* = = = END-STATIC-FORWARD = = = */
+#define GRAPH_CH(_ch) \
+ ((((unsigned)_ch) <= 0x7E) && (((unsigned)_ch) > ' '))
/**
* Parse the option usage flags string. Any parsing problems yield
@@ -151,6 +99,7 @@ parse_usage_flags(ao_flag_names_t const * fnt, char const * txt)
case ',':
txt = SPN_WHITESPACE_CHARS(txt + 1);
/* Something must follow the comma */
+ /* FALLTHROUGH */
default:
continue;
@@ -167,7 +116,7 @@ parse_usage_flags(ao_flag_names_t const * fnt, char const * txt)
* environment variable is parsed.
* @param[in,out] opts the program option descriptor
*/
-LOCAL void
+static void
set_usage_flags(tOptions * opts, char const * flg_txt)
{
# define _aof_(_n, _f) { sizeof(#_n)-1, _f, #_n },
@@ -304,7 +253,7 @@ print_offer_usage(tOptions * opts)
help[0] = help[1] = '-';
strncpy(help + 2, od->pz_Name, 20);
break;
-
+
case 0:
strncpy(help, od->pz_Name, 20);
break;
@@ -320,7 +269,7 @@ print_offer_usage(tOptions * opts)
case (OPTPROC_LONGOPT | OPTPROC_SHORTOPT):
strcpy(help, "--help");
break;
-
+
case 0:
strcpy(help, "help");
break;
@@ -438,7 +387,7 @@ print_one_paragraph(char const * text, bool plain, FILE * fp)
AGFREE(t);
}
}
-
+
/*=export_func optionPrintParagraphs
* private:
*
@@ -565,7 +514,7 @@ optionPrintParagraphs(char const * text, bool plain, FILE * fp)
* If "exitCode" is "AO_EXIT_REQ_USAGE" (normally 64), then output will to
* to stdout and the actual exit code will be "EXIT_SUCCESS".
=*/
-void
+noreturn void
optionUsage(tOptions * opts, int usage_exit_code)
{
int exit_code = (usage_exit_code == AO_EXIT_REQ_USAGE)
@@ -617,7 +566,7 @@ optionUsage(tOptions * opts, int usage_exit_code)
print_usage_details(opts, usage_exit_code);
else
print_offer_usage(opts);
-
+
flush_and_exit:
fflush(option_usage_fp);
if (ferror(option_usage_fp) != 0)
@@ -777,7 +726,7 @@ prt_vendor_opts(tOptions * opts, char const * title)
do {
size_t l;
if ( ((od->fOptState & not_vended_mask) != 0)
- || IS_GRAPHIC_CHAR(od->optValue))
+ || GRAPH_CH(od->optValue))
continue;
l = strlen(od->pz_Name);
@@ -795,7 +744,7 @@ prt_vendor_opts(tOptions * opts, char const * title)
do {
if ( ((od->fOptState & not_vended_mask) != 0)
- || IS_GRAPHIC_CHAR(od->optValue))
+ || GRAPH_CH(od->optValue))
continue;
prt_one_vendor(opts, od, &argTypes, vfmt);
@@ -1005,7 +954,7 @@ prt_preamble(tOptions * opts, tOptDesc * od, arg_types_t * at)
if ((opts->fOptSet & OPTPROC_SHORTOPT) == 0)
fputs(at->pzSpc, option_usage_fp);
- else if (! IS_GRAPHIC_CHAR(od->optValue)) {
+ else if (! GRAPH_CH(od->optValue)) {
if ( (opts->fOptSet & (OPTPROC_GNUUSAGE|OPTPROC_LONGOPT))
== (OPTPROC_GNUUSAGE|OPTPROC_LONGOPT))
fputc(' ', option_usage_fp);
@@ -1132,7 +1081,7 @@ prt_opt_usage(tOptions * opts, int ex_code, char const * title)
/* Skip name only options when we have a vendor option */
if ( ((opts->fOptSet & OPTPROC_VENDOR_OPT) != 0)
- && (! IS_GRAPHIC_CHAR(od->optValue)))
+ && (! GRAPH_CH(od->optValue)))
continue;
/*
diff --git a/src/libopts/version.c b/src/libopts/version.c
index 8a8de75dbe..cd46be3a4d 100644
--- a/src/libopts/version.c
+++ b/src/libopts/version.c
@@ -10,7 +10,7 @@
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2015 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2018 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
@@ -90,7 +90,7 @@ emit_copy_full(tOptions * o, FILE * fp)
else
emit_first_line(fp, o->pzUsageTitle, NULL, NULL);
-
+
if (HAS_pzPkgDataDir(o) && (o->pzPackager != NULL)) {
fputc(NL, fp);
fputs(o->pzPackager, fp);
@@ -119,7 +119,7 @@ emit_copy_note(tOptions * opts, FILE * fp)
fputc(NL, fp);
fprintf(fp, zao_ver_fmt, optionVersion());
-
+
if (HAS_pzPkgDataDir(opts) && (opts->pzPackager != NULL)) {
fputc(NL, fp);
fputs(opts->pzPackager, fp);
@@ -153,7 +153,10 @@ print_ver(tOptions * opts, tOptDesc * od, FILE * fp, bool call_exit)
ch = od->optArg.argString[0];
- else {
+ else if (OPTST_GET_ARGTYPE(od->fOptState) == OPARG_TYPE_STATIC) {
+ ch = od->optArg.argString[0];
+
+ } else {
set_usage_flags(opts, NULL);
ch = (opts->fOptSet & OPTPROC_GNUUSAGE) ? 'c' : 'v';
}