Browse Source

Import upstream version 4.3.1

Fred Klassen 5 years ago
parent
commit
6098e4c6ee
100 changed files with 11843 additions and 6785 deletions
  1. 42 27
      Makefile.in
  2. 122 30
      aclocal.m4
  3. 5 0
      autogen.sh
  4. 270 0
      config/ar-lib
  5. 1 1
      config/compile
  6. 108 66
      config/config.guess
  7. 46 20
      config/config.sub
  8. 1 1
      config/depcomp
  9. 175 201
      config/install-sh
  10. 3514 2019
      config/ltmain.sh
  11. 1 1
      config/missing
  12. 3269 1635
      configure
  13. 175 85
      configure.ac
  14. 45 1
      docs/CHANGELOG
  15. 5 1
      docs/CREDIT
  16. 25 11
      docs/Makefile.in
  17. 3 3
      docs/TODO
  18. 1 1
      doxygen.cfg.in
  19. 35 18
      lib/Makefile.in
  20. 1 1
      lib/strlcpy.h
  21. 1 1
      libopts/COPYING.gplv3
  22. 1 1
      libopts/COPYING.lgplv3
  23. 1 0
      libopts/COPYING.mbsd
  24. 6 6
      libopts/Makefile.am
  25. 49 32
      libopts/Makefile.in
  26. 1 1
      libopts/README
  27. 2 2
      libopts/ag-char-map.h
  28. 1 1
      libopts/alias.c
  29. 70 69
      libopts/ao-strs.c
  30. 73 71
      libopts/ao-strs.h
  31. 4 4
      libopts/autoopts.c
  32. 15 12
      libopts/autoopts.h
  33. 72 64
      libopts/autoopts/options.h
  34. 1 1
      libopts/autoopts/project.h
  35. 80 80
      libopts/autoopts/usage-txt.h
  36. 5 5
      libopts/boolean.c
  37. 1 1
      libopts/check.c
  38. 1 1
      libopts/compat/compat.h
  39. 12 12
      libopts/compat/pathfind.c
  40. 1 1
      libopts/compat/windows-config.h
  41. 65 57
      libopts/configfile.c
  42. 34 31
      libopts/cook.c
  43. 18 17
      libopts/enum.c
  44. 4 4
      libopts/env.c
  45. 6 6
      libopts/file.c
  46. 8 8
      libopts/find.c
  47. 93 93
      libopts/genshell.c
  48. 2 2
      libopts/genshell.h
  49. 7 3
      libopts/gettext.h
  50. 4 8
      libopts/init.c
  51. 134 44
      libopts/intprops.h
  52. 2 0
      libopts/libopts.c
  53. 31 21
      libopts/load.c
  54. 27 27
      libopts/m4/libopts.m4
  55. 1 1
      libopts/m4/liboptschk.m4
  56. 1 1
      libopts/m4/stdnoreturn.m4
  57. 19 14
      libopts/makeshell.c
  58. 50 39
      libopts/nested.c
  59. 12 10
      libopts/numeric.c
  60. 1 1
      libopts/option-value-type.c
  61. 1 1
      libopts/option-xat-attribute.c
  62. 3 3
      libopts/parse-duration.c
  63. 1 1
      libopts/parse-duration.h
  64. 5 5
      libopts/pgusage.c
  65. 2 2
      libopts/proto.h
  66. 19 12
      libopts/putshell.c
  67. 4 4
      libopts/reset.c
  68. 17 17
      libopts/restore.c
  69. 55 54
      libopts/save.c
  70. 5 5
      libopts/sort.c
  71. 15 15
      libopts/stack.c
  72. 1 1
      libopts/stdnoreturn.in.h
  73. 11 11
      libopts/streqvcmp.c
  74. 18 15
      libopts/text_mmap.c
  75. 9 7
      libopts/time.c
  76. 24 24
      libopts/tokenize.c
  77. 15 12
      libopts/usage.c
  78. 9 9
      libopts/version.c
  79. 592 0
      m4/libopts.m4
  80. 1456 1066
      m4/libtool.m4
  81. 90 37
      m4/ltoptions.m4
  82. 4 3
      m4/ltsugar.m4
  83. 6 6
      m4/ltversion.m4
  84. 4 3
      m4/lt~obsolete.m4
  85. 41 0
      m4/stdnoreturn.m4
  86. 25 11
      scripts/Makefile.in
  87. 23 23
      src/Makefile.am
  88. 92 44
      src/Makefile.in
  89. 5 4
      src/bridge.c
  90. 1 1
      src/bridge.h
  91. 1 1
      src/common.h
  92. 1 1
      src/common/Makefile.am
  93. 36 19
      src/common/Makefile.in
  94. 38 39
      src/common/cache.c
  95. 2 2
      src/common/cache.h
  96. 9 10
      src/common/cidr.c
  97. 1 1
      src/common/cidr.h
  98. 438 438
      src/common/dlt_names.c
  99. 4 4
      src/common/err.c
  100. 0 0
      src/common/err.h

+ 42 - 27
Makefile.in

@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -14,7 +14,17 @@
 
 @SET_MAKE@
 VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__is_gnu_make = { \
+  if test -z '$(MAKELEVEL)'; then \
+    false; \
+  elif test -n '$(MAKE_HOST)'; then \
+    true; \
+  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+    true; \
+  else \
+    false; \
+  fi; \
+}
 am__make_running_with_option = \
   case $${target_option-} in \
       ?) ;; \
@@ -79,24 +89,17 @@ build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
 subdir = .
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
-	$(top_srcdir)/configure $(am__configure_deps) \
-	$(srcdir)/doxygen.cfg.in INSTALL config/compile \
-	config/config.guess config/config.sub config/depcomp \
-	config/install-sh config/missing config/ltmain.sh \
-	$(top_srcdir)/config/compile $(top_srcdir)/config/config.guess \
-	$(top_srcdir)/config/config.sub \
-	$(top_srcdir)/config/install-sh $(top_srcdir)/config/ltmain.sh \
-	$(top_srcdir)/config/missing
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
-	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
-	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
-	$(top_srcdir)/libopts/m4/libopts.m4 \
-	$(top_srcdir)/libopts/m4/stdnoreturn.m4 \
-	$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/libopts.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/m4/lt~obsolete.m4 \
+	$(top_srcdir)/m4/stdnoreturn.m4 $(top_srcdir)/acinclude.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
+	$(am__configure_deps) $(am__DIST_COMMON)
 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
  configure.lineno config.status.lineno
 mkinstalldirs = $(install_sh) -d
@@ -158,6 +161,15 @@ am__define_uniq_tagged_files = \
 ETAGS = etags
 CTAGS = ctags
 CSCOPE = cscope
+am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/doxygen.cfg.in \
+	$(top_srcdir)/config/ar-lib $(top_srcdir)/config/compile \
+	$(top_srcdir)/config/config.guess \
+	$(top_srcdir)/config/config.sub \
+	$(top_srcdir)/config/install-sh $(top_srcdir)/config/ltmain.sh \
+	$(top_srcdir)/config/missing INSTALL config/ar-lib \
+	config/compile config/config.guess config/config.sub \
+	config/depcomp config/install-sh config/ltmain.sh \
+	config/missing
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 distdir = $(PACKAGE)-$(VERSION)
 top_distdir = $(distdir)
@@ -259,6 +271,7 @@ LN_S = @LN_S@
 LPCAPINC = @LPCAPINC@
 LPCAPLIB = @LPCAPLIB@
 LTLIBOBJS = @LTLIBOBJS@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
 MACOSX_SDK_PATH = @MACOSX_SDK_PATH@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
@@ -349,6 +362,7 @@ prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
 rmmod = @rmmod@
+runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
@@ -396,7 +410,6 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
 	$(am__cd) $(top_srcdir) && \
 	  $(AUTOMAKE) --foreign Makefile
-.PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
 	  *config.status*) \
@@ -617,15 +630,15 @@ dist-xz: distdir
 	$(am__post_remove_distdir)
 
 dist-tarZ: distdir
-	@echo WARNING: "Support for shar distribution archives is" \
-	               "deprecated." >&2
+	@echo WARNING: "Support for distribution archives compressed with" \
+		       "legacy program 'compress' is deprecated." >&2
 	@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
 	tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
 	$(am__post_remove_distdir)
 
 dist-shar: distdir
-	@echo WARNING: "Support for distribution archives compressed with" \
-		       "legacy program 'compress' is deprecated." >&2
+	@echo WARNING: "Support for shar distribution archives is" \
+	               "deprecated." >&2
 	@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
 	shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
 	$(am__post_remove_distdir)
@@ -661,17 +674,17 @@ distcheck: dist
 	esac
 	chmod -R a-w $(distdir)
 	chmod u+w $(distdir)
-	mkdir $(distdir)/_build $(distdir)/_inst
+	mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst
 	chmod a-w $(distdir)
 	test -d $(distdir)/_build || exit 0; \
 	dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
 	  && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
 	  && am__cwd=`pwd` \
-	  && $(am__cd) $(distdir)/_build \
-	  && ../configure \
+	  && $(am__cd) $(distdir)/_build/sub \
+	  && ../../configure \
 	    $(AM_DISTCHECK_CONFIGURE_FLAGS) \
 	    $(DISTCHECK_CONFIGURE_FLAGS) \
-	    --srcdir=.. --prefix="$$dc_install_base" \
+	    --srcdir=../.. --prefix="$$dc_install_base" \
 	  && $(MAKE) $(AM_MAKEFLAGS) \
 	  && $(MAKE) $(AM_MAKEFLAGS) dvi \
 	  && $(MAKE) $(AM_MAKEFLAGS) check \
@@ -851,6 +864,8 @@ uninstall-am:
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
 	tags tags-am uninstall uninstall-am
 
+.PRECIOUS: Makefile
+
 .PHONY: manpages docs test man2html
 
 dist-hook: version manpages

+ 122 - 30
aclocal.m4

@@ -1,6 +1,6 @@
-# generated automatically by aclocal 1.14.1 -*- Autoconf -*-
+# generated automatically by aclocal 1.15 -*- Autoconf -*-
 
-# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+# Copyright (C) 1996-2014 Free Software Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -20,7 +20,7 @@ You have another version of autoconf.  It may work, but is not guaranteed to.
 If you have problems, you may need to regenerate the build system entirely.
 To do so, use the procedure documented by the package, typically 'autoreconf'.])])
 
-# Copyright (C) 2002-2013 Free Software Foundation, Inc.
+# Copyright (C) 2002-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -32,10 +32,10 @@ To do so, use the procedure documented by the package, typically 'autoreconf'.])
 # generated from the m4 files accompanying Automake X.Y.
 # (This private macro should not be called outside this file.)
 AC_DEFUN([AM_AUTOMAKE_VERSION],
-[am__api_version='1.14'
+[am__api_version='1.15'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.14.1], [],
+m4_if([$1], [1.15], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -51,14 +51,74 @@ m4_define([_AM_AUTOCONF_VERSION], [])
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.14.1])dnl
+[AM_AUTOMAKE_VERSION([1.15])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 
+# Copyright (C) 2011-2014 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_AR([ACT-IF-FAIL])
+# -------------------------
+# Try to determine the archiver interface, and trigger the ar-lib wrapper
+# if it is needed.  If the detection of archiver interface fails, run
+# ACT-IF-FAIL (default is to abort configure with a proper error message).
+AC_DEFUN([AM_PROG_AR],
+[AC_BEFORE([$0], [LT_INIT])dnl
+AC_BEFORE([$0], [AC_PROG_LIBTOOL])dnl
+AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([ar-lib])dnl
+AC_CHECK_TOOLS([AR], [ar lib "link -lib"], [false])
+: ${AR=ar}
+
+AC_CACHE_CHECK([the archiver ($AR) interface], [am_cv_ar_interface],
+  [AC_LANG_PUSH([C])
+   am_cv_ar_interface=ar
+   AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int some_variable = 0;]])],
+     [am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&AS_MESSAGE_LOG_FD'
+      AC_TRY_EVAL([am_ar_try])
+      if test "$ac_status" -eq 0; then
+        am_cv_ar_interface=ar
+      else
+        am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&AS_MESSAGE_LOG_FD'
+        AC_TRY_EVAL([am_ar_try])
+        if test "$ac_status" -eq 0; then
+          am_cv_ar_interface=lib
+        else
+          am_cv_ar_interface=unknown
+        fi
+      fi
+      rm -f conftest.lib libconftest.a
+     ])
+   AC_LANG_POP([C])])
+
+case $am_cv_ar_interface in
+ar)
+  ;;
+lib)
+  # Microsoft lib, so override with the ar-lib wrapper script.
+  # FIXME: It is wrong to rewrite AR.
+  # But if we don't then we get into trouble of one sort or another.
+  # A longer-term fix would be to have automake use am__AR in this case,
+  # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something
+  # similar.
+  AR="$am_aux_dir/ar-lib $AR"
+  ;;
+unknown)
+  m4_default([$1],
+             [AC_MSG_ERROR([could not determine $AR interface])])
+  ;;
+esac
+AC_SUBST([AR])dnl
+])
+
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+# Copyright (C) 2001-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -110,7 +170,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd`
 
 # AM_CONDITIONAL                                            -*- Autoconf -*-
 
-# Copyright (C) 1997-2013 Free Software Foundation, Inc.
+# Copyright (C) 1997-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -141,7 +201,7 @@ AC_CONFIG_COMMANDS_PRE(
 Usually this means the macro was only invoked conditionally.]])
 fi])])
 
-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+# Copyright (C) 1999-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -332,7 +392,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
 
 # Generate code to set up dependency tracking.              -*- Autoconf -*-
 
-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+# Copyright (C) 1999-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -407,7 +467,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
 ])
 
 
-# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+# Copyright (C) 1996-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -431,7 +491,7 @@ fi], [AC_MSG_RESULT([no])])
 
 # Do all the work for Automake.                             -*- Autoconf -*-
 
-# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+# Copyright (C) 1996-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -521,8 +581,8 @@ AC_REQUIRE([AC_PROG_MKDIR_P])dnl
 # <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
 # <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
 AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
-# We need awk for the "check" target.  The system "awk" is bad on
-# some platforms.
+# We need awk for the "check" target (and possibly the TAP driver).  The
+# system "awk" is bad on some platforms.
 AC_REQUIRE([AC_PROG_AWK])dnl
 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
 AC_REQUIRE([AM_SET_LEADING_DOT])dnl
@@ -596,6 +656,9 @@ END
     AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
   fi
 fi
+dnl The trailing newline in this macro's definition is deliberate, for
+dnl backward compatibility and to allow trailing 'dnl'-style comments
+dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
 ])
 
 dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
@@ -625,7 +688,7 @@ for _am_header in $config_headers :; do
 done
 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
 
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+# Copyright (C) 2001-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -636,7 +699,7 @@ echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_co
 # Define $install_sh.
 AC_DEFUN([AM_PROG_INSTALL_SH],
 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
-if test x"${install_sh}" != xset; then
+if test x"${install_sh+set}" != xset; then
   case $am_aux_dir in
   *\ * | *\	*)
     install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
@@ -646,7 +709,7 @@ if test x"${install_sh}" != xset; then
 fi
 AC_SUBST([install_sh])])
 
-# Copyright (C) 2003-2013 Free Software Foundation, Inc.
+# Copyright (C) 2003-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -668,7 +731,7 @@ AC_SUBST([am__leading_dot])])
 # Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
 # From Jim Meyering
 
-# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+# Copyright (C) 1996-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -703,7 +766,7 @@ AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
 
 # Check to see how 'make' treats includes.	            -*- Autoconf -*-
 
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+# Copyright (C) 2001-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -753,7 +816,7 @@ rm -f confinc confmf
 
 # Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
 
-# Copyright (C) 1997-2013 Free Software Foundation, Inc.
+# Copyright (C) 1997-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -790,9 +853,38 @@ else
 fi
 ])
 
+#  -*- Autoconf -*-
+# Obsolete and "removed" macros, that must however still report explicit
+# error messages when used, to smooth transition.
+#
+# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([AM_CONFIG_HEADER],
+[AC_DIAGNOSE([obsolete],
+['$0': this macro is obsolete.
+You should use the 'AC][_CONFIG_HEADERS' macro instead.])dnl
+AC_CONFIG_HEADERS($@)])
+
+AC_DEFUN([AM_PROG_CC_STDC],
+[AC_PROG_CC
+am_cv_prog_cc_stdc=$ac_cv_prog_cc_stdc
+AC_DIAGNOSE([obsolete],
+['$0': this macro is obsolete.
+You should simply use the 'AC][_PROG_CC' macro instead.
+Also, your code should no longer depend upon 'am_cv_prog_cc_stdc',
+but upon 'ac_cv_prog_cc_stdc'.])])
+
+AC_DEFUN([AM_C_PROTOTYPES],
+         [AC_FATAL([automatic de-ANSI-fication support has been removed])])
+AU_DEFUN([fp_C_PROTOTYPES], [AM_C_PROTOTYPES])
+
 # Helper functions for option handling.                     -*- Autoconf -*-
 
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+# Copyright (C) 2001-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -821,7 +913,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
 AC_DEFUN([_AM_IF_OPTION],
 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
 
-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+# Copyright (C) 1999-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -868,7 +960,7 @@ AC_LANG_POP([C])])
 # For backward compatibility.
 AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
 
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+# Copyright (C) 2001-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -887,7 +979,7 @@ AC_DEFUN([AM_RUN_LOG],
 
 # Check to make sure that the build environment is sane.    -*- Autoconf -*-
 
-# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+# Copyright (C) 1996-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -968,7 +1060,7 @@ AC_CONFIG_COMMANDS_PRE(
 rm -f conftest.file
 ])
 
-# Copyright (C) 2009-2013 Free Software Foundation, Inc.
+# Copyright (C) 2009-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1028,7 +1120,7 @@ AC_SUBST([AM_BACKSLASH])dnl
 _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
 ])
 
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+# Copyright (C) 2001-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1056,7 +1148,7 @@ fi
 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 AC_SUBST([INSTALL_STRIP_PROGRAM])])
 
-# Copyright (C) 2006-2013 Free Software Foundation, Inc.
+# Copyright (C) 2006-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1075,7 +1167,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 # Check how to create a tarball.                            -*- Autoconf -*-
 
-# Copyright (C) 2004-2013 Free Software Foundation, Inc.
+# Copyright (C) 2004-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1206,11 +1298,11 @@ AC_SUBST([am__tar])
 AC_SUBST([am__untar])
 ]) # _AM_PROG_TAR
 
+m4_include([m4/libopts.m4])
 m4_include([m4/libtool.m4])
 m4_include([m4/ltoptions.m4])
 m4_include([m4/ltsugar.m4])
 m4_include([m4/ltversion.m4])
 m4_include([m4/lt~obsolete.m4])
-m4_include([libopts/m4/libopts.m4])
-m4_include([libopts/m4/stdnoreturn.m4])
+m4_include([m4/stdnoreturn.m4])
 m4_include([acinclude.m4])

+ 5 - 0
autogen.sh

@@ -1,4 +1,9 @@
 #!/bin/sh
+
+set -e
+
+cd $(dirname $0)
+
 rm -f config/config.guess config/config.sub config/ltmain.sh 2>/dev/null
 rm -f aclocal.m4 2>/dev/null
 aclocal  -I libopts/m4/

+ 270 - 0
config/ar-lib

@@ -0,0 +1,270 @@
+#! /bin/sh
+# Wrapper for Microsoft lib.exe
+
+me=ar-lib
+scriptversion=2012-03-01.08; # UTC
+
+# Copyright (C) 2010-2014 Free Software Foundation, Inc.
+# Written by Peter Rosin <peda@lysator.liu.se>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# This file is maintained in Automake, please report
+# bugs to <bug-automake@gnu.org> or send patches to
+# <automake-patches@gnu.org>.
+
+
+# func_error message
+func_error ()
+{
+  echo "$me: $1" 1>&2
+  exit 1
+}
+
+file_conv=
+
+# func_file_conv build_file
+# Convert a $build file to $host form and store it in $file
+# Currently only supports Windows hosts.
+func_file_conv ()
+{
+  file=$1
+  case $file in
+    / | /[!/]*) # absolute file, and not a UNC file
+      if test -z "$file_conv"; then
+	# lazily determine how to convert abs files
+	case `uname -s` in
+	  MINGW*)
+	    file_conv=mingw
+	    ;;
+	  CYGWIN*)
+	    file_conv=cygwin
+	    ;;
+	  *)
+	    file_conv=wine
+	    ;;
+	esac
+      fi
+      case $file_conv in
+	mingw)
+	  file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
+	  ;;
+	cygwin)
+	  file=`cygpath -m "$file" || echo "$file"`
+	  ;;
+	wine)
+	  file=`winepath -w "$file" || echo "$file"`
+	  ;;
+      esac
+      ;;
+  esac
+}
+
+# func_at_file at_file operation archive
+# Iterate over all members in AT_FILE performing OPERATION on ARCHIVE
+# for each of them.
+# When interpreting the content of the @FILE, do NOT use func_file_conv,
+# since the user would need to supply preconverted file names to
+# binutils ar, at least for MinGW.
+func_at_file ()
+{
+  operation=$2
+  archive=$3
+  at_file_contents=`cat "$1"`
+  eval set x "$at_file_contents"
+  shift
+
+  for member
+  do
+    $AR -NOLOGO $operation:"$member" "$archive" || exit $?
+  done
+}
+
+case $1 in
+  '')
+     func_error "no command.  Try '$0 --help' for more information."
+     ;;
+  -h | --h*)
+    cat <<EOF
+Usage: $me [--help] [--version] PROGRAM ACTION ARCHIVE [MEMBER...]
+
+Members may be specified in a file named with @FILE.
+EOF
+    exit $?
+    ;;
+  -v | --v*)
+    echo "$me, version $scriptversion"
+    exit $?
+    ;;
+esac
+
+if test $# -lt 3; then
+  func_error "you must specify a program, an action and an archive"
+fi
+
+AR=$1
+shift
+while :
+do
+  if test $# -lt 2; then
+    func_error "you must specify a program, an action and an archive"
+  fi
+  case $1 in
+    -lib | -LIB \
+    | -ltcg | -LTCG \
+    | -machine* | -MACHINE* \
+    | -subsystem* | -SUBSYSTEM* \
+    | -verbose | -VERBOSE \
+    | -wx* | -WX* )
+      AR="$AR $1"
+      shift
+      ;;
+    *)
+      action=$1
+      shift
+      break
+      ;;
+  esac
+done
+orig_archive=$1
+shift
+func_file_conv "$orig_archive"
+archive=$file
+
+# strip leading dash in $action
+action=${action#-}
+
+delete=
+extract=
+list=
+quick=
+replace=
+index=
+create=
+
+while test -n "$action"
+do
+  case $action in
+    d*) delete=yes  ;;
+    x*) extract=yes ;;
+    t*) list=yes    ;;
+    q*) quick=yes   ;;
+    r*) replace=yes ;;
+    s*) index=yes   ;;
+    S*)             ;; # the index is always updated implicitly
+    c*) create=yes  ;;
+    u*)             ;; # TODO: don't ignore the update modifier
+    v*)             ;; # TODO: don't ignore the verbose modifier
+    *)
+      func_error "unknown action specified"
+      ;;
+  esac
+  action=${action#?}
+done
+
+case $delete$extract$list$quick$replace,$index in
+  yes,* | ,yes)
+    ;;
+  yesyes*)
+    func_error "more than one action specified"
+    ;;
+  *)
+    func_error "no action specified"
+    ;;
+esac
+
+if test -n "$delete"; then
+  if test ! -f "$orig_archive"; then
+    func_error "archive not found"
+  fi
+  for member
+  do
+    case $1 in
+      @*)
+        func_at_file "${1#@}" -REMOVE "$archive"
+        ;;
+      *)
+        func_file_conv "$1"
+        $AR -NOLOGO -REMOVE:"$file" "$archive" || exit $?
+        ;;
+    esac
+  done
+
+elif test -n "$extract"; then
+  if test ! -f "$orig_archive"; then
+    func_error "archive not found"
+  fi
+  if test $# -gt 0; then
+    for member
+    do
+      case $1 in
+        @*)
+          func_at_file "${1#@}" -EXTRACT "$archive"
+          ;;
+        *)
+          func_file_conv "$1"
+          $AR -NOLOGO -EXTRACT:"$file" "$archive" || exit $?
+          ;;
+      esac
+    done
+  else
+    $AR -NOLOGO -LIST "$archive" | sed -e 's/\\/\\\\/g' | while read member
+    do
+      $AR -NOLOGO -EXTRACT:"$member" "$archive" || exit $?
+    done
+  fi
+
+elif test -n "$quick$replace"; then
+  if test ! -f "$orig_archive"; then
+    if test -z "$create"; then
+      echo "$me: creating $orig_archive"
+    fi
+    orig_archive=
+  else
+    orig_archive=$archive
+  fi
+
+  for member
+  do
+    case $1 in
+    @*)
+      func_file_conv "${1#@}"
+      set x "$@" "@$file"
+      ;;
+    *)
+      func_file_conv "$1"
+      set x "$@" "$file"
+      ;;
+    esac
+    shift
+    shift
+  done
+
+  if test -n "$orig_archive"; then
+    $AR -NOLOGO -OUT:"$archive" "$orig_archive" "$@" || exit $?
+  else
+    $AR -NOLOGO -OUT:"$archive" "$@" || exit $?
+  fi
+
+elif test -n "$list"; then
+  if test ! -f "$orig_archive"; then
+    func_error "archive not found"
+  fi
+  $AR -NOLOGO -LIST "$archive" || exit $?
+fi

+ 1 - 1
config/compile

@@ -3,7 +3,7 @@
 
 scriptversion=2012-10-14.11; # UTC
 
-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+# Copyright (C) 1999-2014 Free Software Foundation, Inc.
 # Written by Tom Tromey <tromey@cygnus.com>.
 #
 # This program is free software; you can redistribute it and/or modify

+ 108 - 66
config/config.guess

@@ -1,8 +1,8 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
-#   Copyright 1992-2014 Free Software Foundation, Inc.
+#   Copyright 1992-2016 Free Software Foundation, Inc.
 
-timestamp='2014-03-23'
+timestamp='2016-10-02'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -24,12 +24,12 @@ timestamp='2014-03-23'
 # program.  This Exception is an additional permission under section 7
 # of the GNU General Public License, version 3 ("GPLv3").
 #
-# Originally written by Per Bothner.
+# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
 #
 # You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
 #
-# Please send patches with a ChangeLog entry to config-patches@gnu.org.
+# Please send patches to <config-patches@gnu.org>.
 
 
 me=`echo "$0" | sed -e 's,.*/,,'`
@@ -50,7 +50,7 @@ version="\
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright 1992-2014 Free Software Foundation, Inc.
+Copyright 1992-2016 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -168,19 +168,29 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	# Note: NetBSD doesn't particularly care about the vendor
 	# portion of the name.  We always set it to "unknown".
 	sysctl="sysctl -n hw.machine_arch"
-	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
-	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
+	    /sbin/$sysctl 2>/dev/null || \
+	    /usr/sbin/$sysctl 2>/dev/null || \
+	    echo unknown)`
 	case "${UNAME_MACHINE_ARCH}" in
 	    armeb) machine=armeb-unknown ;;
 	    arm*) machine=arm-unknown ;;
 	    sh3el) machine=shl-unknown ;;
 	    sh3eb) machine=sh-unknown ;;
 	    sh5el) machine=sh5le-unknown ;;
+	    earmv*)
+		arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
+		endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'`
+		machine=${arch}${endian}-unknown
+		;;
 	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
 	esac
 	# The Operating System including object format, if it has switched
-	# to ELF recently, or will in the future.
+	# to ELF recently (or will in the future) and ABI.
 	case "${UNAME_MACHINE_ARCH}" in
+	    earm*)
+		os=netbsdelf
+		;;
 	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
 		eval $set_cc_for_build
 		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
@@ -197,6 +207,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 		os=netbsd
 		;;
 	esac
+	# Determine ABI tags.
+	case "${UNAME_MACHINE_ARCH}" in
+	    earm*)
+		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
+		abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"`
+		;;
+	esac
 	# The OS release
 	# Debian GNU/NetBSD machines have a different userland, and
 	# thus, need a distinct triplet. However, they do not need
@@ -207,13 +224,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 		release='-gnu'
 		;;
 	    *)
-		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+		release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2`
 		;;
 	esac
 	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
 	# contains redundant information, the shorter form:
 	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
-	echo "${machine}-${os}${release}"
+	echo "${machine}-${os}${release}${abi}"
 	exit ;;
     *:Bitrig:*:*)
 	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
@@ -223,6 +240,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
 	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
 	exit ;;
+    *:LibertyBSD:*:*)
+	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
+	echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE}
+	exit ;;
     *:ekkoBSD:*:*)
 	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
 	exit ;;
@@ -235,6 +256,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     *:MirBSD:*:*)
 	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
 	exit ;;
+    *:Sortix:*:*)
+	echo ${UNAME_MACHINE}-unknown-sortix
+	exit ;;
     alpha:OSF1:*:*)
 	case $UNAME_RELEASE in
 	*4.0)
@@ -251,42 +275,42 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
 	case "$ALPHA_CPU_TYPE" in
 	    "EV4 (21064)")
-		UNAME_MACHINE="alpha" ;;
+		UNAME_MACHINE=alpha ;;
 	    "EV4.5 (21064)")
-		UNAME_MACHINE="alpha" ;;
+		UNAME_MACHINE=alpha ;;
 	    "LCA4 (21066/21068)")
-		UNAME_MACHINE="alpha" ;;
+		UNAME_MACHINE=alpha ;;
 	    "EV5 (21164)")
-		UNAME_MACHINE="alphaev5" ;;
+		UNAME_MACHINE=alphaev5 ;;
 	    "EV5.6 (21164A)")
-		UNAME_MACHINE="alphaev56" ;;
+		UNAME_MACHINE=alphaev56 ;;
 	    "EV5.6 (21164PC)")
-		UNAME_MACHINE="alphapca56" ;;
+		UNAME_MACHINE=alphapca56 ;;
 	    "EV5.7 (21164PC)")
-		UNAME_MACHINE="alphapca57" ;;
+		UNAME_MACHINE=alphapca57 ;;
 	    "EV6 (21264)")
-		UNAME_MACHINE="alphaev6" ;;
+		UNAME_MACHINE=alphaev6 ;;
 	    "EV6.7 (21264A)")
-		UNAME_MACHINE="alphaev67" ;;
+		UNAME_MACHINE=alphaev67 ;;
 	    "EV6.8CB (21264C)")
-		UNAME_MACHINE="alphaev68" ;;
+		UNAME_MACHINE=alphaev68 ;;
 	    "EV6.8AL (21264B)")
-		UNAME_MACHINE="alphaev68" ;;
+		UNAME_MACHINE=alphaev68 ;;
 	    "EV6.8CX (21264D)")
-		UNAME_MACHINE="alphaev68" ;;
+		UNAME_MACHINE=alphaev68 ;;
 	    "EV6.9A (21264/EV69A)")
-		UNAME_MACHINE="alphaev69" ;;
+		UNAME_MACHINE=alphaev69 ;;
 	    "EV7 (21364)")
-		UNAME_MACHINE="alphaev7" ;;
+		UNAME_MACHINE=alphaev7 ;;
 	    "EV7.9 (21364A)")
-		UNAME_MACHINE="alphaev79" ;;
+		UNAME_MACHINE=alphaev79 ;;
 	esac
 	# A Pn.n version is a patched version.
 	# A Vn.n version is a released version.
 	# A Tn.n version is a released field test version.
 	# A Xn.n version is an unreleased experimental baselevel.
 	# 1.2 uses "1.2" for uname -r.
-	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
 	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
 	exitcode=$?
 	trap '' 0
@@ -359,16 +383,16 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	exit ;;
     i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
 	eval $set_cc_for_build
-	SUN_ARCH="i386"
+	SUN_ARCH=i386
 	# If there is a compiler, see if it is configured for 64-bit objects.
 	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
 	# This test works for both compilers.
-	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+	if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
 	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
-		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
 		grep IS_64BIT_ARCH >/dev/null
 	    then
-		SUN_ARCH="x86_64"
+		SUN_ARCH=x86_64
 	    fi
 	fi
 	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
@@ -393,7 +417,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	exit ;;
     sun*:*:4.2BSD:*)
 	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
-	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+	test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3
 	case "`/bin/arch`" in
 	    sun3)
 		echo m68k-sun-sunos${UNAME_RELEASE}
@@ -579,8 +603,9 @@ EOF
 	else
 		IBM_ARCH=powerpc
 	fi
-	if [ -x /usr/bin/oslevel ] ; then
-		IBM_REV=`/usr/bin/oslevel`
+	if [ -x /usr/bin/lslpp ] ; then
+		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
+			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
 	else
 		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
 	fi
@@ -617,13 +642,13 @@ EOF
 		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
 		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
 		    case "${sc_cpu_version}" in
-		      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
-		      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
+		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
 		      532)                      # CPU_PA_RISC2_0
 			case "${sc_kernel_bits}" in
-			  32) HP_ARCH="hppa2.0n" ;;
-			  64) HP_ARCH="hppa2.0w" ;;
-			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+			  32) HP_ARCH=hppa2.0n ;;
+			  64) HP_ARCH=hppa2.0w ;;
+			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
 			esac ;;
 		    esac
 		fi
@@ -662,11 +687,11 @@ EOF
 		    exit (0);
 		}
 EOF
-		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+		    (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
 		    test -z "$HP_ARCH" && HP_ARCH=hppa
 		fi ;;
 	esac
-	if [ ${HP_ARCH} = "hppa2.0w" ]
+	if [ ${HP_ARCH} = hppa2.0w ]
 	then
 	    eval $set_cc_for_build
 
@@ -679,12 +704,12 @@ EOF
 	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
 	    # => hppa64-hp-hpux11.23
 
-	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
 		grep -q __LP64__
 	    then
-		HP_ARCH="hppa2.0w"
+		HP_ARCH=hppa2.0w
 	    else
-		HP_ARCH="hppa64"
+		HP_ARCH=hppa64
 	    fi
 	fi
 	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
@@ -789,14 +814,14 @@ EOF
 	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
 	exit ;;
     F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
-	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
+	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
 	FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
 	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
 	exit ;;
     5000:UNIX_System_V:4.*:*)
-	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
-	FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
+	FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
 	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
 	exit ;;
     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
@@ -878,7 +903,7 @@ EOF
 	exit ;;
     *:GNU/*:*:*)
 	# other systems with GNU libc and userland
-	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
+	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
 	exit ;;
     i*86:Minix:*:*)
 	echo ${UNAME_MACHINE}-pc-minix
@@ -901,7 +926,7 @@ EOF
 	  EV68*) UNAME_MACHINE=alphaev68 ;;
 	esac
 	objdump --private-headers /bin/sh | grep -q ld.so.1
-	if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
+	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
 	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     arc:Linux:*:* | arceb:Linux:*:*)
@@ -932,6 +957,9 @@ EOF
     crisv32:Linux:*:*)
 	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
 	exit ;;
+    e2k:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
     frv:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
@@ -944,6 +972,9 @@ EOF
     ia64:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
+    k1om:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
     m32r*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
@@ -969,6 +1000,9 @@ EOF
 	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
 	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
 	;;
+    mips64el:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
     openrisc*:Linux:*:*)
 	echo or1k-unknown-linux-${LIBC}
 	exit ;;
@@ -1001,6 +1035,9 @@ EOF
     ppcle:Linux:*:*)
 	echo powerpcle-unknown-linux-${LIBC}
 	exit ;;
+    riscv32:Linux:*:* | riscv64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
     s390:Linux:*:* | s390x:Linux:*:*)
 	echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
 	exit ;;
@@ -1020,7 +1057,7 @@ EOF
 	echo ${UNAME_MACHINE}-dec-linux-${LIBC}
 	exit ;;
     x86_64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo ${UNAME_MACHINE}-pc-linux-${LIBC}
 	exit ;;
     xtensa*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
@@ -1099,7 +1136,7 @@ EOF
 	# uname -m prints for DJGPP always 'pc', but it prints nothing about
 	# the processor, so we play safe by assuming i586.
 	# Note: whatever this is, it MUST be the same as what config.sub
-	# prints for the "djgpp" host, or else GDB configury will decide that
+	# prints for the "djgpp" host, or else GDB configure will decide that
 	# this is a cross-build.
 	echo i586-pc-msdosdjgpp
 	exit ;;
@@ -1248,6 +1285,9 @@ EOF
     SX-8R:SUPER-UX:*:*)
 	echo sx8r-nec-superux${UNAME_RELEASE}
 	exit ;;
+    SX-ACE:SUPER-UX:*:*)
+	echo sxace-nec-superux${UNAME_RELEASE}
+	exit ;;
     Power*:Rhapsody:*:*)
 	echo powerpc-apple-rhapsody${UNAME_RELEASE}
 	exit ;;
@@ -1261,9 +1301,9 @@ EOF
 	    UNAME_PROCESSOR=powerpc
 	fi
 	if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
-	    if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+	    if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
 		if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
-		    (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+		    (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
 		    grep IS_64BIT_ARCH >/dev/null
 		then
 		    case $UNAME_PROCESSOR in
@@ -1285,7 +1325,7 @@ EOF
 	exit ;;
     *:procnto*:*:* | *:QNX:[0123456789]*:*)
 	UNAME_PROCESSOR=`uname -p`
-	if test "$UNAME_PROCESSOR" = "x86"; then
+	if test "$UNAME_PROCESSOR" = x86; then
 		UNAME_PROCESSOR=i386
 		UNAME_MACHINE=pc
 	fi
@@ -1316,7 +1356,7 @@ EOF
 	# "uname -m" is not consistent, so use $cputype instead. 386
 	# is converted to i386 for consistency with other x86
 	# operating systems.
-	if test "$cputype" = "386"; then
+	if test "$cputype" = 386; then
 	    UNAME_MACHINE=i386
 	else
 	    UNAME_MACHINE="$cputype"
@@ -1358,7 +1398,7 @@ EOF
 	echo i386-pc-xenix
 	exit ;;
     i*86:skyos:*:*)
-	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'`
 	exit ;;
     i*86:rdos:*:*)
 	echo ${UNAME_MACHINE}-pc-rdos
@@ -1369,23 +1409,25 @@ EOF
     x86_64:VMkernel:*:*)
 	echo ${UNAME_MACHINE}-unknown-esx
 	exit ;;
+    amd64:Isilon\ OneFS:*:*)
+	echo x86_64-unknown-onefs
+	exit ;;
 esac
 
 cat >&2 <<EOF
 $0: unable to guess system type
 
-This script, last modified $timestamp, has failed to recognize
-the operating system you are using. It is advised that you
-download the most up to date version of the config scripts from
+This script (version $timestamp), has failed to recognize the
+operating system you are using. If your script is old, overwrite
+config.guess and config.sub with the latest versions from:
 
-  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
 and
-  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
 
-If the version you run ($0) is already up to date, please
-send the following data and any information you think might be
-pertinent to <config-patches@gnu.org> in order to provide the needed
-information to handle your system.
+If $0 has already been updated, send the following data and any
+information you think might be pertinent to config-patches@gnu.org to
+provide the necessary information to handle your system.
 
 config.guess timestamp = $timestamp
 

+ 46 - 20
config/config.sub

@@ -1,8 +1,8 @@
 #! /bin/sh
 # Configuration validation subroutine script.
-#   Copyright 1992-2014 Free Software Foundation, Inc.
+#   Copyright 1992-2016 Free Software Foundation, Inc.
 
-timestamp='2014-09-11'
+timestamp='2016-11-04'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ timestamp='2014-09-11'
 # of the GNU General Public License, version 3 ("GPLv3").
 
 
-# Please send patches with a ChangeLog entry to config-patches@gnu.org.
+# Please send patches to <config-patches@gnu.org>.
 #
 # Configuration subroutine to validate and canonicalize a configuration type.
 # Supply the specified configuration type as an argument.
@@ -33,7 +33,7 @@ timestamp='2014-09-11'
 # Otherwise, we print the canonical config type on stdout and succeed.
 
 # You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
 
 # This file is supposed to be the same for all GNU packages
 # and recognize all the CPU types, system types and aliases
@@ -53,8 +53,7 @@ timestamp='2014-09-11'
 me=`echo "$0" | sed -e 's,.*/,,'`
 
 usage="\
-Usage: $0 [OPTION] CPU-MFR-OPSYS
-       $0 [OPTION] ALIAS
+Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
 
 Canonicalize a configuration name.
 
@@ -68,7 +67,7 @@ Report bugs and patches to <config-patches@gnu.org>."
 version="\
 GNU config.sub ($timestamp)
 
-Copyright 1992-2014 Free Software Foundation, Inc.
+Copyright 1992-2016 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -117,8 +116,8 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
   nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
   linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
-  knetbsd*-gnu* | netbsd*-gnu* | \
-  kopensolaris*-gnu* | \
+  knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
+  kopensolaris*-gnu* | cloudabi*-eabi* | \
   storm-chaos* | os2-emx* | rtmk-nova*)
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
@@ -255,12 +254,13 @@ case $basic_machine in
 	| arc | arceb \
 	| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
 	| avr | avr32 \
+	| ba \
 	| be32 | be64 \
 	| bfin \
 	| c4x | c8051 | clipper \
 	| d10v | d30v | dlx | dsp16xx \
-	| epiphany \
-	| fido | fr30 | frv \
+	| e2k | epiphany \
+	| fido | fr30 | frv | ft32 \
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
 	| hexagon \
 	| i370 | i860 | i960 | ia64 \
@@ -301,11 +301,12 @@ case $basic_machine in
 	| open8 | or1k | or1knd | or32 \
 	| pdp10 | pdp11 | pj | pjl \
 	| powerpc | powerpc64 | powerpc64le | powerpcle \
+	| pru \
 	| pyramid \
 	| riscv32 | riscv64 \
 	| rl78 | rx \
 	| score \
-	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
 	| sh64 | sh64le \
 	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
 	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
@@ -313,6 +314,7 @@ case $basic_machine in
 	| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
 	| ubicom32 \
 	| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
+	| visium \
 	| we32k \
 	| x86 | xc16x | xstormy16 | xtensa \
 	| z8k | z80)
@@ -327,6 +329,9 @@ case $basic_machine in
 	c6x)
 		basic_machine=tic6x-unknown
 		;;
+	leon|leon[3-9])
+		basic_machine=sparc-$basic_machine
+		;;
 	m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
 		basic_machine=$basic_machine-unknown
 		os=-none
@@ -372,12 +377,13 @@ case $basic_machine in
 	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
 	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
 	| avr-* | avr32-* \
+	| ba-* \
 	| be32-* | be64-* \
 	| bfin-* | bs2000-* \
 	| c[123]* | c30-* | [cjt]90-* | c4x-* \
 	| c8051-* | clipper-* | craynv-* | cydra-* \
 	| d10v-* | d30v-* | dlx-* \
-	| elxsi-* \
+	| e2k-* | elxsi-* \
 	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
 	| h8300-* | h8500-* \
 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
@@ -423,13 +429,15 @@ case $basic_machine in
 	| orion-* \
 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
 	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
+	| pru-* \
 	| pyramid-* \
+	| riscv32-* | riscv64-* \
 	| rl78-* | romp-* | rs6000-* | rx-* \
 	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
 	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
 	| sparclite-* \
-	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
+	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \
 	| tahoe-* \
 	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
 	| tile*-* \
@@ -437,6 +445,7 @@ case $basic_machine in
 	| ubicom32-* \
 	| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
 	| vax-* \
+	| visium-* \
 	| we32k-* \
 	| x86-* | x86_64-* | xc16x-* | xps100-* \
 	| xstormy16-* | xtensa*-* \
@@ -513,6 +522,9 @@ case $basic_machine in
 		basic_machine=i386-pc
 		os=-aros
 		;;
+	asmjs)
+		basic_machine=asmjs-unknown
+		;;
 	aux)
 		basic_machine=m68k-apple
 		os=-aux
@@ -633,6 +645,14 @@ case $basic_machine in
 		basic_machine=m68k-bull
 		os=-sysv3
 		;;
+	e500v[12])
+		basic_machine=powerpc-unknown
+		os=$os"spe"
+		;;
+	e500v[12]-*)
+		basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=$os"spe"
+		;;
 	ebmon29k)
 		basic_machine=a29k-amd
 		os=-ebmon
@@ -774,6 +794,9 @@ case $basic_machine in
 		basic_machine=m68k-isi
 		os=-sysv
 		;;
+	leon-*|leon[3-9]-*)
+		basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
+		;;
 	m68knommu)
 		basic_machine=m68k-unknown
 		os=-linux
@@ -1009,7 +1032,7 @@ case $basic_machine in
 	ppc-* | ppcbe-*)
 		basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
-	ppcle | powerpclittle | ppc-le | powerpc-little)
+	ppcle | powerpclittle)
 		basic_machine=powerpcle-unknown
 		;;
 	ppcle-* | powerpclittle-*)
@@ -1019,7 +1042,7 @@ case $basic_machine in
 		;;
 	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
-	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+	ppc64le | powerpc64little)
 		basic_machine=powerpc64le-unknown
 		;;
 	ppc64le-* | powerpc64little-*)
@@ -1365,18 +1388,18 @@ case $os in
 	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
 	      | -sym* | -kopensolaris* | -plan9* \
 	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
-	      | -aos* | -aros* \
+	      | -aos* | -aros* | -cloudabi* | -sortix* \
 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
 	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
-	      | -bitrig* | -openbsd* | -solidbsd* \
+	      | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \
 	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
 	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
 	      | -chorusos* | -chorusrdb* | -cegcc* \
 	      | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-	      | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
+	      | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
 	      | -linux-newlib* | -linux-musl* | -linux-uclibc* \
 	      | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
 	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
@@ -1385,7 +1408,8 @@ case $os in
 	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
 	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
 	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
-	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*)
+	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
+	      | -onefs* | -tirtos* | -phoenix* | -fuchsia*)
 	# Remember, each alternative MUST END IN *, to match a version number.
 		;;
 	-qnx*)
@@ -1517,6 +1541,8 @@ case $os in
 		;;
 	-nacl*)
 		;;
+	-ios)
+		;;
 	-none)
 		;;
 	*)

+ 1 - 1
config/depcomp

@@ -3,7 +3,7 @@
 
 scriptversion=2013-05-30.07; # UTC
 
-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+# Copyright (C) 1999-2014 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by

+ 175 - 201
config/install-sh

@@ -1,7 +1,7 @@
 #!/bin/sh
 # install - install a program, script, or datafile
 
-scriptversion=2011-11-20.07; # UTC
+scriptversion=2014-09-12.12; # UTC
 
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
@@ -41,19 +41,15 @@ scriptversion=2011-11-20.07; # UTC
 # This script is compatible with the BSD install script, but was written
 # from scratch.
 
+tab='	'
 nl='
 '
-IFS=" ""	$nl"
+IFS=" $tab$nl"
 
-# set DOITPROG to echo to test this script
+# Set DOITPROG to "echo" to test this script.
 
-# Don't use :- since 4.3BSD and earlier shells don't like it.
 doit=${DOITPROG-}
-if test -z "$doit"; then
-  doit_exec=exec
-else
-  doit_exec=$doit
-fi
+doit_exec=${doit:-exec}
 
 # Put in absolute file names if you don't have them in your path;
 # or use environment vars.
@@ -68,17 +64,6 @@ mvprog=${MVPROG-mv}
 rmprog=${RMPROG-rm}
 stripprog=${STRIPPROG-strip}
 
-posix_glob='?'
-initialize_posix_glob='
-  test "$posix_glob" != "?" || {
-    if (set -f) 2>/dev/null; then
-      posix_glob=
-    else
-      posix_glob=:
-    fi
-  }
-'
-
 posix_mkdir=
 
 # Desired mode of installed file.
@@ -97,7 +82,7 @@ dir_arg=
 dst_arg=
 
 copy_on_change=false
-no_target_directory=
+is_target_a_directory=possibly
 
 usage="\
 Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
@@ -137,46 +122,57 @@ while test $# -ne 0; do
     -d) dir_arg=true;;
 
     -g) chgrpcmd="$chgrpprog $2"
-	shift;;
+        shift;;
 
     --help) echo "$usage"; exit $?;;
 
     -m) mode=$2
-	case $mode in
-	  *' '* | *'	'* | *'
-'*	  | *'*'* | *'?'* | *'['*)
-	    echo "$0: invalid mode: $mode" >&2
-	    exit 1;;
-	esac
-	shift;;
+        case $mode in
+          *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
+            echo "$0: invalid mode: $mode" >&2
+            exit 1;;
+        esac
+        shift;;
 
     -o) chowncmd="$chownprog $2"
-	shift;;
+        shift;;
 
     -s) stripcmd=$stripprog;;
 
-    -t) dst_arg=$2
-	# Protect names problematic for 'test' and other utilities.
-	case $dst_arg in
-	  -* | [=\(\)!]) dst_arg=./$dst_arg;;
-	esac
-	shift;;
+    -t)
+        is_target_a_directory=always
+        dst_arg=$2
+        # Protect names problematic for 'test' and other utilities.
+        case $dst_arg in
+          -* | [=\(\)!]) dst_arg=./$dst_arg;;
+        esac
+        shift;;
 
-    -T) no_target_directory=true;;
+    -T) is_target_a_directory=never;;
 
     --version) echo "$0 $scriptversion"; exit $?;;
 
-    --)	shift
-	break;;
+    --) shift
+        break;;
 
-    -*)	echo "$0: invalid option: $1" >&2
-	exit 1;;
+    -*) echo "$0: invalid option: $1" >&2
+        exit 1;;
 
     *)  break;;
   esac
   shift
 done
 
+# We allow the use of options -d and -T together, by making -d
+# take the precedence; this is for compatibility with GNU install.
+
+if test -n "$dir_arg"; then
+  if test -n "$dst_arg"; then
+    echo "$0: target directory not allowed when installing a directory." >&2
+    exit 1
+  fi
+fi
+
 if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
   # When -d is used, all remaining arguments are directories to create.
   # When -t is used, the destination is already specified.
@@ -208,6 +204,15 @@ if test $# -eq 0; then
 fi
 
 if test -z "$dir_arg"; then
+  if test $# -gt 1 || test "$is_target_a_directory" = always; then
+    if test ! -d "$dst_arg"; then
+      echo "$0: $dst_arg: Is not a directory." >&2
+      exit 1
+    fi
+  fi
+fi
+
+if test -z "$dir_arg"; then
   do_exit='(exit $ret); exit $ret'
   trap "ret=129; $do_exit" 1
   trap "ret=130; $do_exit" 2
@@ -223,16 +228,16 @@ if test -z "$dir_arg"; then
 
     *[0-7])
       if test -z "$stripcmd"; then
-	u_plus_rw=
+        u_plus_rw=
       else
-	u_plus_rw='% 200'
+        u_plus_rw='% 200'
       fi
       cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
     *)
       if test -z "$stripcmd"; then
-	u_plus_rw=
+        u_plus_rw=
       else
-	u_plus_rw=,u+rw
+        u_plus_rw=,u+rw
       fi
       cp_umask=$mode$u_plus_rw;;
   esac
@@ -269,41 +274,15 @@ do
     # If destination is a directory, append the input filename; won't work
     # if double slashes aren't ignored.
     if test -d "$dst"; then
-      if test -n "$no_target_directory"; then
-	echo "$0: $dst_arg: Is a directory" >&2
-	exit 1
+      if test "$is_target_a_directory" = never; then
+        echo "$0: $dst_arg: Is a directory" >&2
+        exit 1
       fi
       dstdir=$dst
       dst=$dstdir/`basename "$src"`
       dstdir_status=0
     else
-      # Prefer dirname, but fall back on a substitute if dirname fails.
-      dstdir=`
-	(dirname "$dst") 2>/dev/null ||
-	expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	     X"$dst" : 'X\(//\)[^/]' \| \
-	     X"$dst" : 'X\(//\)$' \| \
-	     X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
-	echo X"$dst" |
-	    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-		   s//\1/
-		   q
-		 }
-		 /^X\(\/\/\)[^/].*/{
-		   s//\1/
-		   q
-		 }
-		 /^X\(\/\/\)$/{
-		   s//\1/
-		   q
-		 }
-		 /^X\(\/\).*/{
-		   s//\1/
-		   q
-		 }
-		 s/.*/./; q'
-      `
-
+      dstdir=`dirname "$dst"`
       test -d "$dstdir"
       dstdir_status=$?
     fi
@@ -314,81 +293,81 @@ do
   if test $dstdir_status != 0; then
     case $posix_mkdir in
       '')
-	# Create intermediate dirs using mode 755 as modified by the umask.
-	# This is like FreeBSD 'install' as of 1997-10-28.
-	umask=`umask`
-	case $stripcmd.$umask in
-	  # Optimize common cases.
-	  *[2367][2367]) mkdir_umask=$umask;;
-	  .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
-
-	  *[0-7])
-	    mkdir_umask=`expr $umask + 22 \
-	      - $umask % 100 % 40 + $umask % 20 \
-	      - $umask % 10 % 4 + $umask % 2
-	    `;;
-	  *) mkdir_umask=$umask,go-w;;
-	esac
-
-	# With -d, create the new directory with the user-specified mode.
-	# Otherwise, rely on $mkdir_umask.
-	if test -n "$dir_arg"; then
-	  mkdir_mode=-m$mode
-	else
-	  mkdir_mode=
-	fi
-
-	posix_mkdir=false
-	case $umask in
-	  *[123567][0-7][0-7])
-	    # POSIX mkdir -p sets u+wx bits regardless of umask, which
-	    # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
-	    ;;
-	  *)
+        # Create intermediate dirs using mode 755 as modified by the umask.
+        # This is like FreeBSD 'install' as of 1997-10-28.
+        umask=`umask`
+        case $stripcmd.$umask in
+          # Optimize common cases.
+          *[2367][2367]) mkdir_umask=$umask;;
+          .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
+
+          *[0-7])
+            mkdir_umask=`expr $umask + 22 \
+              - $umask % 100 % 40 + $umask % 20 \
+              - $umask % 10 % 4 + $umask % 2
+            `;;
+          *) mkdir_umask=$umask,go-w;;
+        esac
+
+        # With -d, create the new directory with the user-specified mode.
+        # Otherwise, rely on $mkdir_umask.
+        if test -n "$dir_arg"; then
+          mkdir_mode=-m$mode
+        else
+          mkdir_mode=
+        fi
+
+        posix_mkdir=false
+        case $umask in
+          *[123567][0-7][0-7])
+            # POSIX mkdir -p sets u+wx bits regardless of umask, which
+            # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
+            ;;
+          *)
             # $RANDOM is not portable (e.g. dash);  use it when possible to
             # lower collision chance
-	    tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
-	    trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0
-
-	     # As "mkdir -p" follows symlinks and we work in /tmp possibly;  so
-	     # create the $tmpdir first (and fail if unsuccessful) to make sure
-	     # that nobody tries to guess the $tmpdir name.
-	    if (umask $mkdir_umask &&
-		$mkdirprog $mkdir_mode "$tmpdir" &&
-		exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
-	    then
-	      if test -z "$dir_arg" || {
-		   # Check for POSIX incompatibilities with -m.
-		   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
-		   # other-writable bit of parent directory when it shouldn't.
-		   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
-		   test_tmpdir="$tmpdir/a"
-		   ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
-		   case $ls_ld_tmpdir in
-		     d????-?r-*) different_mode=700;;
-		     d????-?--*) different_mode=755;;
-		     *) false;;
-		   esac &&
-		   $mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
-		     ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
-		     test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
-		   }
-		 }
-	      then posix_mkdir=:
-	      fi
-	      rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
-	    else
-	      # Remove any dirs left behind by ancient mkdir implementations.
-	      rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
-	    fi
-	    trap '' 0;;
-	esac;;
+            tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+            trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0
+
+            # As "mkdir -p" follows symlinks and we work in /tmp possibly;  so
+            # create the $tmpdir first (and fail if unsuccessful) to make sure
+            # that nobody tries to guess the $tmpdir name.
+            if (umask $mkdir_umask &&
+                $mkdirprog $mkdir_mode "$tmpdir" &&
+                exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
+            then
+              if test -z "$dir_arg" || {
+                   # Check for POSIX incompatibilities with -m.
+                   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+                   # other-writable bit of parent directory when it shouldn't.
+                   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+                   test_tmpdir="$tmpdir/a"
+                   ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
+                   case $ls_ld_tmpdir in
+                     d????-?r-*) different_mode=700;;
+                     d????-?--*) different_mode=755;;
+                     *) false;;
+                   esac &&
+                   $mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
+                     ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
+                     test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+                   }
+                 }
+              then posix_mkdir=:
+              fi
+              rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
+            else
+              # Remove any dirs left behind by ancient mkdir implementations.
+              rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
+            fi
+            trap '' 0;;
+        esac;;
     esac
 
     if
       $posix_mkdir && (
-	umask $mkdir_umask &&
-	$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+        umask $mkdir_umask &&
+        $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
       )
     then :
     else
@@ -398,53 +377,51 @@ do
       # directory the slow way, step by step, checking for races as we go.
 
       case $dstdir in
-	/*) prefix='/';;
-	[-=\(\)!]*) prefix='./';;
-	*)  prefix='';;
+        /*) prefix='/';;
+        [-=\(\)!]*) prefix='./';;
+        *)  prefix='';;
       esac
 
-      eval "$initialize_posix_glob"
-
       oIFS=$IFS
       IFS=/
-      $posix_glob set -f
+      set -f
       set fnord $dstdir
       shift
-      $posix_glob set +f
+      set +f
       IFS=$oIFS
 
       prefixes=
 
       for d
       do
-	test X"$d" = X && continue
-
-	prefix=$prefix$d
-	if test -d "$prefix"; then
-	  prefixes=
-	else
-	  if $posix_mkdir; then
-	    (umask=$mkdir_umask &&
-	     $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
-	    # Don't fail if two instances are running concurrently.
-	    test -d "$prefix" || exit 1
-	  else
-	    case $prefix in
-	      *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
-	      *) qprefix=$prefix;;
-	    esac
-	    prefixes="$prefixes '$qprefix'"
-	  fi
-	fi
-	prefix=$prefix/
+        test X"$d" = X && continue
+
+        prefix=$prefix$d
+        if test -d "$prefix"; then
+          prefixes=
+        else
+          if $posix_mkdir; then
+            (umask=$mkdir_umask &&
+             $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+            # Don't fail if two instances are running concurrently.
+            test -d "$prefix" || exit 1
+          else
+            case $prefix in
+              *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+              *) qprefix=$prefix;;
+            esac
+            prefixes="$prefixes '$qprefix'"
+          fi
+        fi
+        prefix=$prefix/
       done
 
       if test -n "$prefixes"; then
-	# Don't fail if two instances are running concurrently.
-	(umask $mkdir_umask &&
-	 eval "\$doit_exec \$mkdirprog $prefixes") ||
-	  test -d "$dstdir" || exit 1
-	obsolete_mkdir_used=true
+        # Don't fail if two instances are running concurrently.
+        (umask $mkdir_umask &&
+         eval "\$doit_exec \$mkdirprog $prefixes") ||
+          test -d "$dstdir" || exit 1
+        obsolete_mkdir_used=true
       fi
     fi
   fi
@@ -479,15 +456,12 @@ do
 
     # If -C, don't bother to copy if it wouldn't change the file.
     if $copy_on_change &&
-       old=`LC_ALL=C ls -dlL "$dst"	2>/dev/null` &&
-       new=`LC_ALL=C ls -dlL "$dsttmp"	2>/dev/null` &&
-
-       eval "$initialize_posix_glob" &&
-       $posix_glob set -f &&
+       old=`LC_ALL=C ls -dlL "$dst"     2>/dev/null` &&
+       new=`LC_ALL=C ls -dlL "$dsttmp"  2>/dev/null` &&
+       set -f &&
        set X $old && old=:$2:$4:$5:$6 &&
        set X $new && new=:$2:$4:$5:$6 &&
-       $posix_glob set +f &&
-
+       set +f &&
        test "$old" = "$new" &&
        $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
     then
@@ -500,24 +474,24 @@ do
       # to itself, or perhaps because mv is so ancient that it does not
       # support -f.
       {
-	# Now remove or move aside any old file at destination location.
-	# We try this two ways since rm can't unlink itself on some
-	# systems and the destination file might be busy for other
-	# reasons.  In this case, the final cleanup might fail but the new
-	# file should still install successfully.
-	{
-	  test ! -f "$dst" ||
-	  $doit $rmcmd -f "$dst" 2>/dev/null ||
-	  { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
-	    { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
-	  } ||
-	  { echo "$0: cannot unlink or rename $dst" >&2
-	    (exit 1); exit 1
-	  }
-	} &&
-
-	# Now rename the file to the real destination.
-	$doit $mvcmd "$dsttmp" "$dst"
+        # Now remove or move aside any old file at destination location.
+        # We try this two ways since rm can't unlink itself on some
+        # systems and the destination file might be busy for other
+        # reasons.  In this case, the final cleanup might fail but the new
+        # file should still install successfully.
+        {
+          test ! -f "$dst" ||
+          $doit $rmcmd -f "$dst" 2>/dev/null ||
+          { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+            { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+          } ||
+          { echo "$0: cannot unlink or rename $dst" >&2
+            (exit 1); exit 1
+          }
+        } &&
+
+        # Now rename the file to the real destination.
+        $doit $mvcmd "$dsttmp" "$dst"
       }
     fi || exit 1
 

File diff suppressed because it is too large
+ 3514 - 2019
config/ltmain.sh


+ 1 - 1
config/missing

@@ -3,7 +3,7 @@
 
 scriptversion=2013-10-28.13; # UTC
 
-# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+# Copyright (C) 1996-2014 Free Software Foundation, Inc.
 # Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
 
 # This program is free software; you can redistribute it and/or modify

File diff suppressed because it is too large
+ 3269 - 1635
configure


+ 175 - 85
configure.ac

@@ -4,19 +4,20 @@ dnl $Id$
 AC_PREREQ([2.69])
 
 dnl Set version info here!
-AC_INIT([tcpreplay],[4.2.6],
+AC_INIT([tcpreplay],[4.3.1],
     [https://github.com/appneta/tcpreplay/issues],
     [tcpreplay],
     [http://tcpreplay.sourceforge.net/])
 AC_CONFIG_SRCDIR([src/tcpreplay.c])
-AC_CONFIG_HEADERS([src/config.h])
+AM_CONFIG_HEADER([src/config.h])
 AC_CONFIG_AUX_DIR(config)
-AM_MAINTAINER_MODE
+AM_MAINTAINER_MODE([enable])
 AM_WITH_DMALLOC
 
 dnl People building from GitHub need the same version of Autogen as I'm using
-dnl or specify --disable-local-libopts
-MAINTAINER_AUTOGEN_VERSION=5.18.4
+dnl or specify --disable-local-libopts to force using the locally-installed
+dnl copy of libopts rather than the source in the `./liopts/` directory.
+MAINTAINER_AUTOGEN_VERSION=5.18.12
 
 AC_CONFIG_MACRO_DIR([m4])
 
@@ -28,9 +29,6 @@ TCPREPLAY_RELEASE=1
 AC_SUBST(TCPREPLAY_VERSION)
 AC_SUBST(TCPREPLAY_RELEASE)
 
-USER_CFLAGS=$CFLAGS
-CFLAGS="-Wall -std=gnu99 ${CFLAGS}"
-
 dnl Determine OS
 AC_CANONICAL_BUILD
 AC_CANONICAL_HOST
@@ -146,13 +144,14 @@ else
 fi
 
 
-AM_INIT_AUTOMAKE([foreign])
-AM_SILENT_RULES([yes])
+AM_INIT_AUTOMAKE([foreign subdir-objects -Wall -Wno-override])
+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 
 dnl Checks for programs.
+AM_PROG_AR
 AC_PROG_INSTALL
 AC_PROG_LIBTOOL
-AM_PROG_CC_C_O
+AC_PROG_CC
 AC_PROG_CC_STDC
 AC_PROG_CXX
 AC_PROG_CPP
@@ -171,21 +170,44 @@ AC_PATH_PROG(depmod, depmod, /sbin/depmod, $PATH:/sbin)
 AC_PATH_PROG(insmod, insmod, /sbin/insmod, $PATH:/sbin)
 AC_PATH_PROG(rmmod, rmmod, /sbin/rmmod, $PATH:/sbin)
 
+
+dnl tcpreplay has (so far) been relying on leading-edge autogen.
+dnl Therefore, by default:
+dnl - use the version we ship with
+dnl - do not install it
+dnl - build a static copy (AC_DISABLE_SHARED - implicitly done earlier)
+case "${enable_local_libopts+set}" in
+ set) ;;
+ *) enable_local_libopts=yes ;;
+esac
+
+case "${enable_libopts_install+set}" in
+ set) ;;
+ *) enable_libopts_install=no ;;
+esac
+
 dnl check autogen version
 AUTOGEN_VERSION="unknown - man pages will not be built"
 if test -n "${AUTOGEN}" ; then
-    AC_MSG_CHECKING(for autogen version >= 5.18.x)
-    ${AUTOGEN} -v >autogen.version
-    AUTOGEN_VERSION=$(cat autogen.version | ${SED} 's|.* \([[0-9\.]]\{5,\}\).*|\1|')
+    AC_MSG_CHECKING(for autogen version >= ${MAINTAINER_AUTOGEN_VERSION})
+    AUTOGEN_VERSION=$(${AUTOGEN} -v | ${CUT} -d' ' -f 4)
     AUTOGEN_MAJOR=$(echo ${AUTOGEN_VERSION} | ${CUT} -d '.' -f 1)
     AUTOGEN_MINOR=$(echo ${AUTOGEN_VERSION} | ${CUT} -d '.' -f 2)
-    if ( test ${AUTOGEN_MAJOR} -eq 5 && test ${AUTOGEN_MINOR} -lt 18 ) || test ${AUTOGEN_MAJOR} -lt 5 ; then
+    AUTOGEN_BUILD=$(echo ${AUTOGEN_VERSION} | ${CUT} -d '.' -f 3)
+    if test -z "$AUTOGEN_BUILD"; then
+        AUTOGEN_BUILD=0
+    fi
+    if (test ${AUTOGEN_MAJOR} -eq 5 && test ${AUTOGEN_MINOR} -eq 18 && test ${AUTOGEN_BUILD} -lt 4) || 
+            (test ${AUTOGEN_MAJOR} -eq 5 && test ${AUTOGEN_MINOR} -lt 18) ||
+            test ${AUTOGEN_MAJOR} -lt 5 ; then
         AC_MSG_RESULT(no)
-        AC_MSG_WARN([${AUTOGEN} is too old (${AUTOGEN_VERSION}) for building from source code. Please upgrade to 5.18.4)])
+        if test "x$enable_local_libopts" == "xno"; then
+            AC_MSG_ERROR([${AUTOGEN} is too old (${AUTOGEN_VERSION}) for building from source code. Upgrade to 5.18.4 or higher])
+        fi
+        AUTOGEN_VERSION="${AUTOGEN_VERSION} - downlevel"
     else
         AC_MSG_RESULT(yes)
     fi
-    rm -f autogen.version
 
     dnl Compare the installed version with the maintainer version if building from GitHub and not using system libopts
     if test ! -f src/tcpreplay_opts.c && test "x$enable_local_libopts" = "xyes" ; then
@@ -195,7 +217,7 @@ if test -n "${AUTOGEN}" ; then
     fi
 else
     if test ! -f src/tcpreplay_opts.c ; then
-        AC_MSG_ERROR([Please install GNU autogen $MAINTAINER_AUTOGEN_VERSION if you are building from GitHub. To avoid this message download source from http://tcpreplay.appneta.com/wiki/installation.html])
+        AC_MSG_ERROR([Please install GNU autogen $MAINTAINER_AUTOGEN_VERSION or higher if you are building from GitHub. To avoid this message download source from http://tcpreplay.appneta.com/wiki/installation.html])
     fi
 fi
 AC_DEFINE([AUTOGEN_VERSION], [${AUTOGEN_VERSION}], [What version of autogen is installed on this system])
@@ -239,18 +261,26 @@ AC_CHECK_TYPE(u_int32_t, uint32_t)
 AC_CHECK_TYPE(u_int64_t, uint64_t)
 
 dnl OS X SDK 10.11 throws lots of unnecessary macro warnings
+wno_format=""
+wno_macro_redefined=""
 case $host in
     *-apple-darwin*)
         AC_MSG_CHECKING(for $CC -Wno-macro-redefined)
         OLD_CFLAGS=$CFLAGS
-        CFLAGS="$CFLAGS -Wno-macro-redefined"
-        wno_macro_redefined=""
+        CFLAGS="$CFLAGS -Wno-macro-redefined -Werror"
         AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdlib.h>
             int main(int argc, char *argv[]) { return(0); }]])],
             [ AC_MSG_RESULT(yes)
               wno_macro_redefined="-Wno-macro-redefined" ],
             [ AC_MSG_RESULT(no) ])
         CFLAGS="$OLD_CFLAGS $wno_macro_redefined"
+        CFLAGS="$CFLAGS -Wno-format -Werror"
+        AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdlib.h>
+            int main(int argc, char *argv[]) { return(0); }]])],
+        [ AC_MSG_RESULT(yes)
+          wno_format="-Wno-format" ],
+        [ AC_MSG_RESULT(no) ])
+        CFLAGS="$OLD_CFLAGS $wno_format"
     ;;
 esac
 
@@ -300,7 +330,11 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdlib.h>
 CFLAGS="$OLD_CFLAGS $wno_format_contains_nul"
 
 dnl Check for other header files
-AC_CHECK_HEADERS([fcntl.h stddef.h sys/socket.h  arpa/inet.h sys/time.h signal.h string.h strings.h sys/types.h stdint.h sys/select.h netinet/in.h netinet/in_systm.h poll.h sys/poll.h unistd.h sys/param.h inttypes.h libintl.h sys/file.h sys/ioctl.h sys/systeminfo.h])
+AC_CHECK_HEADERS([fcntl.h stddef.h sys/socket.h  arpa/inet.h sys/time.h])
+AC_CHECK_HEADERS([signal.h string.h strings.h sys/types.h stdint.h sys/select.h])
+AC_CHECK_HEADERS([netinet/in.h netinet/in_systm.h poll.h sys/poll.h unistd.h sys/param.h])
+AC_CHECK_HEADERS([inttypes.h libintl.h sys/file.h sys/ioctl.h sys/systeminfo.h])
+AC_CHECK_HEADERS([sys/io.h architecture/i386/pio.h sched.h])
 AC_HEADER_STDBOOL
 
 dnl OpenBSD has special requirements
@@ -334,7 +368,12 @@ AC_FUNC_MKTIME
 AC_FUNC_MMAP
 AC_FUNC_REALLOC
 AC_CHECK_MEMBERS([struct timeval.tv_sec])
-AC_CHECK_FUNCS([alarm atexit bzero dup2 gethostbyname getpagesize gettimeofday ctime inet_ntoa memmove memset munmap pow putenv realpath regcomp strdup select socket strcasecmp strchr strcspn strdup strerror strtol strncpy strtoull poll ntohll mmap snprintf vsnprintf strsignal strpbrk strrchr strspn strstr strtoul])
+AC_CHECK_FUNCS([alarm atexit bzero dup2 gethostbyname getpagesize gettimeofday])
+AC_CHECK_FUNCS([ctime inet_ntoa memmove memset munmap pow putenv realpath])
+AC_CHECK_FUNCS([regcomp strdup select socket strcasecmp strchr strcspn strdup])
+AC_CHECK_FUNCS([strerror strtol strncpy strtoull poll ntohll mmap snprintf])
+AC_CHECK_FUNCS([vsnprintf strsignal strpbrk strrchr strspn strstr strtoul])
+AC_CHECK_FUNCS([ioperm])
 
 dnl Look for strlcpy since some BSD's have it
 AC_CHECK_FUNCS([strlcpy],have_strlcpy=true,have_strlcpy=false)
@@ -343,7 +382,6 @@ AM_CONDITIONAL(SYSTEM_STRLCPY, [test x$have_strlcpy = xtrue])
 AC_C_BIGENDIAN
 AM_CONDITIONAL([WORDS_BIGENDIAN], [ test x$ac_cv_c_bigendian = xyes ])
 
-
 dnl Enable debugging in code/compiler options
 debug=no
 debug_flag=NDEBUG
@@ -352,7 +390,11 @@ AC_ARG_ENABLE(debug,
     AC_HELP_STRING([--enable-debug], [Enable debugging code and support for the -d option]),
     [ if test x$enableval = xyes; then
         debug=yes
-        CFLAGS="${USER_CFLAGS} -g -O0 -std=gnu99 -Wall $wextra $wfatal_errors $wno_variadic_macros $wno_format_contains_nul"
+        dnl replace '-0X' and add '-g' flags
+        changequote({,})
+        CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9s]*//g'`
+        changequote([,])
+        CFLAGS="${CFLAGS} -g -O0 -Wall $wextra $wfatal_errors $wno_variadic_macros $wno_format_contains_nul $wno_format"
 # We may also want to add:
 #         -Wformat-security -Wswitch-default -Wunused-paramter -Wpadded"
         debug_flag=DEBUG
@@ -380,10 +422,10 @@ AC_ARG_ENABLE(timestamp-trace,
     AC_HELP_STRING([--timestamp-trace], [Enable dumping of trace timestamps at the end of a test]),
     [ if test x$enableval = xyes; then
         timestamp_trace=yes
-        CFLAGS="${USER_CFLAGS} -DTIMESTAMP_TRACE"
-        AC_SUBST(timestamp_trace_flag)
+        CFLAGS="${CFLAGS} -DTIMESTAMP_TRACE"
         AC_DEFINE([TIMESTAMP_TRACE], [1], [Enable dumping of trace timestamps at the end of a test])
     fi])
+AC_SUBST(timestamp_trace_flag)
 
 
 AC_ARG_ENABLE(dmalloc,
@@ -510,6 +552,7 @@ AC_ARG_ENABLE(dynamic-link,
         AC_MSG_ERROR([Cannot specify both --enable-dynamic-link and --enable-static-link])
     fi
     ])
+
 if test $static_link = yes; then
     AC_DEFINE([ENABLE_STATIC_LINK], [1], [Use static libraries ( .a or .A.tbd )])
 else
@@ -553,10 +596,11 @@ AC_ARG_ENABLE([tuntap],
     linux*)
       AC_CHECK_HEADER([linux/if_tun.h], [have_tuntap=yes])
       ;;
-    freebsd*)
+    *)
       AC_CHECK_HEADER([net/if_tun.h], [have_tuntap=yes])
       ;;
   esac])
+
 if test $have_tuntap = yes ; then
     AC_DEFINE([HAVE_TUNTAP], [1],
             [Do we have TUNTAP device support?])
@@ -660,7 +704,7 @@ AC_ARG_WITH(libpcap,
     # and was created to address portability issues. Unfortunately, the script is not updated properly
     # outside of the base distribution. Examples: PF_RING requires 'pthreads', 'numa' and 'rt', but
     # this is not reflect that in the script. OS X Xcode 10.11 SDK creates its own very broken
-    # 'pcap-config' script that only occassionally works for dynamic defintions, and defintely
+    # 'pcap-config' script that only occasionally works for dynamic definitions, and defintely
     # does not work for static.
     #
     # The ability to enable this script exists for corner cases where libpcap distributions starts
@@ -847,6 +891,9 @@ AC_RUN_IFELSE([AC_LANG_PROGRAM([[
  * returns zero if version >= 0.9.6
  * or one otherwise
  */
+    if (strncmp(pcap_lib_version(), PCAP_TEST, 3) >= 0)
+        exit(0);
+
     if (strncmp(pcap_lib_version(), PCAP_TEST, 5) >= 0) {
         printf("%s ", pcap_lib_version());
         exit(0);
@@ -898,6 +945,8 @@ extern const char pcap_version[[]]; /* double up since autoconf escapes things *
  * returns zero if version >= 0.7.2
  * or one otherwise
  */
+    if (strncmp(pcap_lib_version(), PCAP_TEST, 3) >= 0)
+        exit(0);
 
     if (strncmp(pcap_version, PCAP_TEST, 5) >= 0)
             exit(0);
@@ -1257,7 +1306,6 @@ dnl ###########################################################
 if test "x$NETMAPINCDIR" != "x"; then
     OLDCPPFLAGS="$CPPFLAGS"
     CPPFLAGS="$CPPFLAGS -DNETMAP_WITH_LIBS -DND -I$NETMAPINCDIR"
-    AC_CHECK_HEADERS(stdio.h net/netmap_user.h)
 
     have_nm_open=no
     have_nm_nr_reg_mask=no
@@ -1395,6 +1443,14 @@ fi
 
 dnl ##################################################
 dnl # Check for libdnet, but only if not Cygwin!
+dnl #
+dnl # if your version of libdnet doesn't compile, try
+dnl # getting it from ...
+dnl # http://libdnet.sourceforge.net/
+dnl # ... or ...
+dnl # https://github.com/jncornett/libdnet
+dnl # ... or ...
+dnl # on Linux try 'apt-get install libdumbnet-dev'
 dnl ##################################################
 founddnet=no
 have_libdnet=no
@@ -1408,14 +1464,31 @@ if test $have_cygwin = no ; then
         AC_HELP_STRING([--with-libdnet=DIR], [Use libdnet in DIR]),
         [trydnetdir=$withval])
 
-    for testdir in $trydnetdir /usr/local /opt/local $MACOSX_SDK_PATH/usr /usr ; do
-        if test -x ${testdir}/bin/dnet-config -a $founddnet = no ; then
-            LDNETINC="$($testdir/bin/dnet-config --cflags)"
-            LDNETLIB="$($testdir/bin/dnet-config --libs)"
-            libdnet_version="$($testdir/bin/dnet-config --version)"
-            founddnet=$testdir
-        fi
-    done
+    case "$build_os" in
+    linux*)
+        dnl # Debian/Ubuntu already have a package called libdnet
+        dnl # so you the package you want to install libdumbnet-dev
+        for testdir in $trydnetdir /usr/local /opt/local /usr ; do
+            if test -x ${testdir}/bin/dumbnet-config -a $founddnet = no ; then
+                LDNETINC="$($testdir/bin/dumbnet-config --cflags)"
+                LDNETLIB="$($testdir/bin/dumbnet-config --libs)"
+                libdnet_version="$($testdir/bin/dumbnet-config --version) (libdumbnet)"
+                founddnet=$testdir
+            fi
+        done
+        ;;
+    esac
+
+    if test $founddnet = no ; then
+        for testdir in $trydnetdir /usr/local /opt/local $MACOSX_SDK_PATH/usr /usr ; do
+            if test -x ${testdir}/bin/dnet-config -a $founddnet = no ; then
+                LDNETINC="$($testdir/bin/dnet-config --cflags)"
+                LDNETLIB="$($testdir/bin/dnet-config --libs)"
+                libdnet_version="$($testdir/bin/dnet-config --version)"
+                founddnet=$testdir
+            fi
+        done
+    fi
 
     if test $founddnet = no ; then
         AC_MSG_RESULT(no)
@@ -1458,12 +1531,13 @@ dnl If doesn't exist, we'll define them in src/common/fakepcap.h
 AC_MSG_CHECKING(for DLT_LINUX_SLL in libpcap)
 AC_TRY_COMPILE([#include "$LPCAPINC"],
                [ int foo;
-                 foo = DLT_LINUX_SLL ],
-                [ AC_DEFINE([HAVE_DLT_LINUX_SLL], [1],
-                            [Does pcap.h include a header with DLT_LINUX_SLL?])
-                  AC_MSG_RESULT(yes)
-                ],
-                AC_MSG_RESULT(no)
+                 foo = DLT_LINUX_SLL
+               ],
+               [ AC_DEFINE([HAVE_DLT_LINUX_SLL], [1],
+                           [Does pcap.h include a header with DLT_LINUX_SLL?])
+                 AC_MSG_RESULT(yes)
+               ],
+               [AC_MSG_RESULT(no)]
                )
 
 AC_MSG_CHECKING(for DLT_C_HDLC in libpcap)
@@ -1513,22 +1587,29 @@ for testfile in $LPCAPINCDIR/pcap/bpf.h $LPCAPINCDIR/pcap-bpf.h ; do
                 AC_SUBST(PCAP_BPF_H_FILE)
                 AC_DEFINE([INCLUDE_PCAP_BPF_HEADER], [1],
                         [What is the path (if any) to the libpcap bpf header file?])
-                AC_MSG_RESULT($testfile)
-            ],
-            AC_MSG_RESULT(no)
+            ]
             )
     fi
 done
 
+if test $foundbpfheader != no; then
+    AC_MSG_RESULT($testfile)
+else
+    AC_MSG_RESULT(no)
+fi
+
 dnl ## Test for netmap-libpcap
 have_pcap_netmap=no
 if test $foundpcap != no ; then
+	AC_MSG_CHECKING(for netmap libpcap)
     PCAP_NETMAP_C_FILE="$LPCAPINCDIR/pcap-netmap.c"
     if test -f "${PCAP_NETMAP_C_FILE}" ; then
         AC_DEFINE([HAVE_LIBPCAP_NETMAP], [1],
                                    [Does this version of libpcap support netmap?])
-        AC_MSG_RESULT(yes)
         have_pcap_netmap=yes
+        AC_MSG_RESULT(yes)
+    else
+        AC_MSG_RESULT(no)
     fi
 fi
 
@@ -1697,7 +1778,7 @@ AM_CONDITIONAL([ENABLE_TCPDUMP], test "$tcpdump_path" != "no" -a x$have_pcap_dum
 if test x$tcpdump_path != xno -a x$have_pcap_dump_fopen = xyes ; then
     AC_DEFINE([ENABLE_VERBOSE], [1], [Do we have tcpdump and pcap_dump_fopen()?])
 else
-    AC_MSG_WARN([Your version of libpcap is too old for --verbose support])
+    AC_MSG_WARN([Your version of libpcap does not support --verbose])
 fi
 
 dnl No 'make test' when cross compile
@@ -1714,38 +1795,71 @@ AC_ARG_WITH(testnic,
       nic2=$withval
       AC_MSG_RESULT([Using --with-testnic=$withval])],
     [
+case $host in
+    *-*-linux*)
+    nic1=eth0
+    nic2=eth0
+    ;;
+
+    *-*-solaris*)
+    nic1=hme0
+    nic2=hme0
+    ;;
+
+    *-*-sunos*)
+    nic1=hme0
+    nic2=hme0
+    ;;
+
+    *-apple-darwin*)
+    nic1=en0
+    nic2=en0
+    ;;
+
+    *-*-openbsd*)
+    nic1=xl0
+    nic2=xl0
+    ;;
+
+    *-*-freebsd*)
+    nic1=em0
+    nic2=em0
+    ;;
+
+    *-*-cygwin)
+    nic1=%0
+    nic2=%0
+    ;;
+
+    *)
+    AC_MSG_RESULT([$host is unknown!  Using first non-loopback interface])
+    nic1=%0
+    nic2=%0
+    ;;
+esac])
 
 dnl There's a bug in OS X which causes pcap_findalldevs() to make the wifi NIC to disassociate
 dnl so under OSX we disable the interface list feature
 disable_pcap_findalldevs=no
-
 osx_frameworks=no
 dnl these need to be dynamic based on OS
 case $host in
     *-*-linux*)
-    nic1=eth0
-    nic2=eth0
     AC_DEFINE([HAVE_LINUX], [1], [Building Linux])
     AC_MSG_RESULT(Linux)
     ;;
 
     *-*-solaris*)
-    nic1=hme0
-    nic2=hme0
     AC_DEFINE([HAVE_SOLARIS], [1], [Building Solaris])
     AC_MSG_RESULT(Solaris)
     ;;
 
     *-*-sunos*)
-    nic1=hme0
-    nic2=hme0
     AC_DEFINE([HAVE_SUNOS], [1], [Building SunOS])
     AC_MSG_RESULT(SunOS)
     ;;
 
     *-apple-darwin*)
-    nic1=en0
-    nic2=en0
     if test x$libpcap_version_096 = xno ; then
         disable_pcap_findalldevs=yes
     fi
@@ -1755,33 +1869,24 @@ case $host in
     ;;
 
     *-*-openbsd*)
-    nic1=xl0
-    nic2=xl0
     AC_DEFINE([HAVE_OPENBSD], [1], [Building Open BSD])
     AC_MSG_RESULT(OpenBSD)
     ;;
 
     *-*-freebsd*)
-    nic1=em0
-    nic2=em0
     AC_DEFINE([HAVE_FREEBSD], [1], [Building Free BSD])
     AC_MSG_RESULT(FreeBSD)
     ;;
 
     *-*-cygwin)
     AC_MSG_RESULT(Win32/Cygwin)
-    nic1=%0
-    nic2=%0
     AC_DEFINE([HAVE_CYGWIN], [1], [Building Cygwin])
     ;;
 
     *)
-    AC_MSG_RESULT([$host is unknown!  Using first non-loopback interface])
-    nic1=%0
-    nic2=%0
+    AC_MSG_RESULT([$host is unknown!])
     ;;
-esac])
-
+esac
 AM_CONDITIONAL([ENABLE_OSX_FRAMEWORKS], test "$osx_frameworks" = "yes")
 
 AC_ARG_WITH(testnic2,
@@ -1802,21 +1907,6 @@ else
     AC_MSG_RESULT(no)
 fi
 
-dnl tcpreplay has (so far) been relying on leading-edge autogen.
-dnl Therefore, by default:
-dnl - use the version we ship with
-dnl - do not install it
-dnl - build a static copy (AC_DISABLE_SHARED - implicitly done earlier)
-case "${enable_local_libopts+set}" in
- set) ;;
- *) enable_local_libopts=yes ;;
-esac
-
-case "${enable_libopts_install+set}" in
- set) ;;
- *) enable_libopts_install=no ;;
-esac
-
 LIBOPTS_CHECK(libopts)
 
 
@@ -1836,7 +1926,7 @@ AC_CONFIG_FILES([Makefile
 AC_OUTPUT
 
 # Configuration results
-AC_MSG_RESULT(
+AC_MSG_RESULT([
 ##########################################################################
              TCPREPLAY Suite Configuration Results (${TCPREPLAY_VERSION})
 ##########################################################################
@@ -1864,7 +1954,7 @@ Tuntap device support:      ${have_tuntap}
 
 * In order of preference; see configure --help to override
 ** Required for tcpbridge
-)
+])
 
 
 case $host in

+ 45 - 1
docs/CHANGELOG

@@ -1,3 +1,47 @@
+12/27/2018 Version 4.3.1
+    - Fix checkspell detected typos (#531)
+    - Heap overflow packet2tree and get_l2len (#530)
+
+11/10/2018 Version 4.3.0
+    - Fix maxOS TOS checksum failure (#524)
+    - TCP sequence edits seeding (#514)
+    - Fix issues identifed by Codacy (#493)
+    - CVE-2018-18408 use-after-free in post_args (#489)
+    - CVE-2018-18407 heap-buffer-overflow csum_replace4 (#488)
+    - CVE-2018-17974 heap-buffer-overflow dlt_en10mb_encode (#486)
+    - CVE-2018-17580 heap-buffer-overflow fast_edit_packet (#485)
+    - CVE-2018-17582 heap-buffer-overflow in get_next_packet (#484)
+    - Out-of-tree build (#482)
+    - CVE-2018-13112 heap-buffer-overflow in get_l2len (#477 dup #408)
+    - Closing stdin on pipe (#479)
+    - Second pcap file hangs on multiplier option (#472)
+    - Jumbo frame support for fragroute option (#466)
+    - TCP sequence edit ACK corruption (#451)
+    - TCP sequence number edit initial SYN packet should have zero ACK (#450)
+    - Travis CI build fails due to new build images (#432)
+    - Upgrade libopts to 5.18.12 to address version build issues (#430)
+    - Add ability to change tcp SEQ/ACK numbers (#425)
+    - Hang using loop and netmap options (#424)
+    - tcpprep -S not working for large cache files (#423)
+    - Unable to tcprewrite range of ports with --portmap (#422)
+    - --maxsleep broken for values less than 1000 (#421)
+    - -T flag breaks traffic replay timing (#419)
+    - Respect 2nd packet timing (#418)
+    - Avoid non-blocking behaviour when using STDIN (#416)
+    - pcap containing >1020 packets produces invalid cache file (#415)
+    - manpage typos (#413)
+    - Fails to open tap0 on Zephyr (#411)
+    - Heap-buffer-overflow in get_l2protocol (#410)
+    - Heap-buffer-overflow in packet2tree (#409)
+    - Heap-buffer-overflow in get_l2len (#408)
+    - Heap-buffer-overflow in flow_decode (#407)
+    - Rewrite zero IP total length field to match the actual packet length (#406)
+    - Stack-buffer-overflow in tcpcapinfo (#405)
+    - tcpprep --include option does not exclude (#404)
+    - Negative-size-param memset in dlt_radiotap_get_80211 (#402)
+    - tcpeplay --verbose option not working (#398)
+    - Fix replay when using --with-testnic (#178)
+
 05/10/2017 Version 4.2.6
     - Test fails on sparc64 (#393)
 
@@ -33,7 +77,7 @@
     - Packet destortion --fuzz-seed option by Gabriel Ganne (#302)
     - Add --unique-ip-loops option to modify IPs every few loops (#296)
     - Netmap startup delay increase (#290)
-    - tcpcapinfo buffer overflow vulnerablily (#278)
+    - CVE-2017-6429 tcpcapinfo buffer overflow vulnerablily (#278)
     - Update git-clone instructions by Kyle McDonald (#277)
     - Allow fractions for --pps option (#270)
     - Print per-loop stats with --stats=0 (#269)

+ 5 - 1
docs/CREDIT

@@ -58,7 +58,7 @@ Bojan Smojver <bojan@rexursive.com>
 Stas Grabois <sagig@radware.com>
     - For his efforts to add IPv6 support to tcpprep and the tcpedit engine
     - For adding IPv6 support to fragroute
-    
+
 Fred Klassen <tcpreplay@appneta.com> - AppNeta 
     - New maintainer of Tcpreplay
     - Added netmap support for wire-rate performance on commodity hardware
@@ -78,3 +78,7 @@ Pedro Arthur Duarte [aka JEdi] <GitHub @pedroarthur>
 
 Gabriel Ganne <GitHub @GabrielGanne>
     - Data fuzz rewrite feature
+    - Out-of-tree build
+
+Mario D Santana <GitHUB @@mariodsantana>
+    - TCP seq/ack edit

+ 25 - 11
docs/Makefile.in

@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -14,7 +14,17 @@
 
 @SET_MAKE@
 VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__is_gnu_make = { \
+  if test -z '$(MAKELEVEL)'; then \
+    false; \
+  elif test -n '$(MAKE_HOST)'; then \
+    true; \
+  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+    true; \
+  else \
+    false; \
+  fi; \
+}
 am__make_running_with_option = \
   case $${target_option-} in \
       ?) ;; \
@@ -79,16 +89,16 @@ build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
 subdir = docs
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am INSTALL TODO
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
-	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
-	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
-	$(top_srcdir)/libopts/m4/libopts.m4 \
-	$(top_srcdir)/libopts/m4/stdnoreturn.m4 \
-	$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/libopts.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/m4/lt~obsolete.m4 \
+	$(top_srcdir)/m4/stdnoreturn.m4 $(top_srcdir)/acinclude.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/src/config.h
 CONFIG_CLEAN_FILES =
@@ -113,6 +123,7 @@ am__can_run_installinfo = \
     *) (install-info --version) >/dev/null 2>&1;; \
   esac
 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+am__DIST_COMMON = $(srcdir)/Makefile.in INSTALL TODO
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
@@ -173,6 +184,7 @@ LN_S = @LN_S@
 LPCAPINC = @LPCAPINC@
 LPCAPLIB = @LPCAPLIB@
 LTLIBOBJS = @LTLIBOBJS@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
 MACOSX_SDK_PATH = @MACOSX_SDK_PATH@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
@@ -263,6 +275,7 @@ prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
 rmmod = @rmmod@
+runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
@@ -295,7 +308,6 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign docs/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
 	  $(AUTOMAKE) --foreign docs/Makefile
-.PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
 	  *config.status*) \
@@ -473,6 +485,8 @@ uninstall-am:
 	mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \
 	uninstall-am
 
+.PRECIOUS: Makefile
+
 
 .PHONY: manpages
 

+ 3 - 3
docs/TODO

@@ -23,7 +23,7 @@ GENERAL:
 
 + Re-organize source tree
 
-+ tcpdump decoder should print packets syncronously w/ the main process
++ tcpdump decoder should print packets synchronously w/ the main process
 
 + Better use of GNU Autotools
 
@@ -37,7 +37,7 @@ GENERAL:
 - Detect system version of libopts b/c we need a recent version
 
 + Generalize packet editing and printing code so it can be shipped as a 
-  seperate library and plugged into tcpreplay/tcprewrite/flowreplay/etc
+  separate library and plugged into tcpreplay/tcprewrite/flowreplay/etc
 
 + See about removing libnet_init() from all binaries other then tcprewrite
   so we don't have to run as root:
@@ -101,7 +101,7 @@ TCPREWRITE:
   that tcpreplay can be more optimized
     ? perhaps use libnetdude?
     ? make into a library?
-    + definately put it into a seperate binary (tcprewrite)
+    + definitely put it into a separate binary (tcprewrite)
 
 - Add the ability to modify packet data via regex(es) in tcprewrite
   - Should support pcre

+ 1 - 1
doxygen.cfg.in

@@ -389,7 +389,7 @@ SHOW_DIRECTORIES       = YES
 # version control system). Doxygen will invoke the program by executing (via 
 # popen()) the command <command> <input-file>, where <command> is the value of 
 # the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file 
-# provided by doxygen. Whatever the progam writes to standard output 
+# provided by doxygen. Whatever the program writes to standard output
 # is used as the file version. See the manual for examples.
 
 FILE_VERSION_FILTER    = 

+ 35 - 18
lib/Makefile.in

@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -16,7 +16,17 @@
 
 
 VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__is_gnu_make = { \
+  if test -z '$(MAKELEVEL)'; then \
+    false; \
+  elif test -n '$(MAKE_HOST)'; then \
+    true; \
+  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+    true; \
+  else \
+    false; \
+  fi; \
+}
 am__make_running_with_option = \
   case $${target_option-} in \
       ?) ;; \
@@ -81,17 +91,17 @@ build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
 subdir = lib
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
-	$(top_srcdir)/config/depcomp $(noinst_HEADERS)
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
-	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
-	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
-	$(top_srcdir)/libopts/m4/libopts.m4 \
-	$(top_srcdir)/libopts/m4/stdnoreturn.m4 \
-	$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/libopts.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/m4/lt~obsolete.m4 \
+	$(top_srcdir)/m4/stdnoreturn.m4 $(top_srcdir)/acinclude.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \
+	$(am__DIST_COMMON)
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/src/config.h
 CONFIG_CLEAN_FILES =
@@ -173,6 +183,7 @@ am__define_uniq_tagged_files = \
   done | $(am__uniquify_input)`
 ETAGS = etags
 CTAGS = ctags
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
@@ -233,6 +244,7 @@ LN_S = @LN_S@
 LPCAPINC = @LPCAPINC@
 LPCAPLIB = @LPCAPLIB@
 LTLIBOBJS = @LTLIBOBJS@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
 MACOSX_SDK_PATH = @MACOSX_SDK_PATH@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
@@ -323,6 +335,7 @@ prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
 rmmod = @rmmod@
+runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
@@ -358,7 +371,6 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lib/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
 	  $(AUTOMAKE) --foreign lib/Makefile
-.PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
 	  *config.status*) \
@@ -395,22 +407,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strlcpy.Po@am__quote@
 
 .c.o:
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
 
 .c.obj:
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+@am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .c.lo:
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+@am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
@@ -626,6 +641,8 @@ uninstall-am:
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
 	tags tags-am uninstall uninstall-am
 
+.PRECIOUS: Makefile
+
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.

+ 1 - 1
lib/strlcpy.h

@@ -1,6 +1,6 @@
 /*
  *   Copyright (c) 2001-2010 Aaron Turner <aturner at synfin dot net>
- *   Copyright (c) 2013-2017 Fred Klassen <tcpreplay at appneta dot com> - AppNeta
+ *   Copyright (c) 2013-2018 Fred Klassen <tcpreplay at appneta dot com> - AppNeta
  *
  *   The Tcpreplay Suite of tools is free software: you can redistribute it 
  *   and/or modify it under the terms of the GNU General Public License as 

+ 1 - 1
libopts/COPYING.gplv3

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

+ 1 - 1
libopts/COPYING.lgplv3

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

+ 1 - 0
libopts/COPYING.mbsd

@@ -1,3 +1,4 @@
+Copyright (C) 1992-2015 by Bruce Korb - all rights reserved
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
 

+ 6 - 6
libopts/Makefile.am

@@ -7,7 +7,7 @@ noinst_LTLIBRARIES      = libopts.la
 endif
 libopts_la_SOURCES      = libopts.c
 libopts_la_CPPFLAGS     = -I$(srcdir)
-libopts_la_LDFLAGS      = -version-info  41:0:16
+libopts_la_LDFLAGS      = -version-info  41:1:16
 EXTRA_DIST		=
 BUILT_SOURCES		=
 MOSTLYCLEANFILES	=
@@ -40,11 +40,11 @@ EXTRA_DIST += \
     COPYING.gplv3           COPYING.lgplv3          COPYING.mbsd  \
     MakeDefs.inc            README                  ag-char-map.h  \
     alias.c                 ao-strs.c               ao-strs.h  \
-    autoopts/options.h      autoopts/project.h      autoopts/usage-txt.h  \
-    autoopts.c              autoopts.h              boolean.c  \
-    check.c                 compat/strdup.c         compat/snprintf.c  \
-    compat/compat.h         compat/_Noreturn.h      compat/pathfind.c  \
-    compat/windows-config.h compat/strchr.c         configfile.c  \
+    autoopts.c              autoopts.h              autoopts/options.h  \
+    autoopts/project.h      autoopts/usage-txt.h    boolean.c  \
+    check.c                 compat/_Noreturn.h      compat/compat.h  \
+    compat/pathfind.c       compat/snprintf.c       compat/strchr.c  \
+    compat/strdup.c         compat/windows-config.h configfile.c  \
     cook.c                  enum.c                  env.c  \
     file.c                  find.c                  genshell.c  \
     genshell.h              gettext.h               init.c  \

+ 49 - 32
libopts/Makefile.in

@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -15,7 +15,17 @@
 @SET_MAKE@
 
 VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__is_gnu_make = { \
+  if test -z '$(MAKELEVEL)'; then \
+    false; \
+  elif test -n '$(MAKE_HOST)'; then \
+    true; \
+  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+    true; \
+  else \
+    false; \
+  fi; \
+}
 am__make_running_with_option = \
   case $${target_option-} in \
       ?) ;; \
@@ -80,17 +90,16 @@ build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
 subdir = libopts
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
-	$(top_srcdir)/config/depcomp README
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
-	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
-	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
-	$(top_srcdir)/libopts/m4/libopts.m4 \
-	$(top_srcdir)/libopts/m4/stdnoreturn.m4 \
-	$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/libopts.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/m4/lt~obsolete.m4 \
+	$(top_srcdir)/m4/stdnoreturn.m4 $(top_srcdir)/acinclude.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/src/config.h
 CONFIG_CLEAN_FILES =
@@ -196,6 +205,8 @@ am__define_uniq_tagged_files = \
   done | $(am__uniquify_input)`
 ETAGS = etags
 CTAGS = ctags
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp \
+	README
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
@@ -256,6 +267,7 @@ LN_S = @LN_S@
 LPCAPINC = @LPCAPINC@
 LPCAPLIB = @LPCAPLIB@
 LTLIBOBJS = @LTLIBOBJS@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
 MACOSX_SDK_PATH = @MACOSX_SDK_PATH@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
@@ -346,6 +358,7 @@ prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
 rmmod = @rmmod@
+runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
@@ -365,22 +378,22 @@ MAINTAINERCLEANFILES = Makefile.in
 @INSTALL_LIBOPTS_FALSE@noinst_LTLIBRARIES = libopts.la
 libopts_la_SOURCES = libopts.c
 libopts_la_CPPFLAGS = -I$(srcdir)
-libopts_la_LDFLAGS = -version-info  41:0:16
+libopts_la_LDFLAGS = -version-info  41:1:16
 EXTRA_DIST = $(srcdir)/compat/_Noreturn.h stdnoreturn.in.h \
 	COPYING.gplv3 COPYING.lgplv3 COPYING.mbsd MakeDefs.inc README \
-	ag-char-map.h alias.c ao-strs.c ao-strs.h autoopts/options.h \
-	autoopts/project.h autoopts/usage-txt.h autoopts.c autoopts.h \
-	boolean.c check.c compat/strdup.c compat/snprintf.c \
-	compat/compat.h compat/_Noreturn.h compat/pathfind.c \
-	compat/windows-config.h compat/strchr.c configfile.c cook.c \
-	enum.c env.c file.c find.c genshell.c genshell.h gettext.h \
-	init.c intprops.h load.c m4/libopts.m4 m4/liboptschk.m4 \
-	m4/stdnoreturn.m4 makeshell.c nested.c numeric.c \
-	option-value-type.c option-value-type.h option-xat-attribute.c \
-	option-xat-attribute.h parse-duration.c parse-duration.h \
-	pgusage.c proto.h putshell.c reset.c restore.c save.c sort.c \
-	stack.c stdnoreturn.in.h streqvcmp.c text_mmap.c time.c \
-	tokenize.c usage.c version.c
+	ag-char-map.h alias.c ao-strs.c ao-strs.h autoopts.c \
+	autoopts.h autoopts/options.h autoopts/project.h \
+	autoopts/usage-txt.h boolean.c check.c compat/_Noreturn.h \
+	compat/compat.h compat/pathfind.c compat/snprintf.c \
+	compat/strchr.c compat/strdup.c compat/windows-config.h \
+	configfile.c cook.c enum.c env.c file.c find.c genshell.c \
+	genshell.h gettext.h init.c intprops.h load.c m4/libopts.m4 \
+	m4/liboptschk.m4 m4/stdnoreturn.m4 makeshell.c nested.c \
+	numeric.c option-value-type.c option-value-type.h \
+	option-xat-attribute.c option-xat-attribute.h parse-duration.c \
+	parse-duration.h pgusage.c proto.h putshell.c reset.c \
+	restore.c save.c sort.c stack.c stdnoreturn.in.h streqvcmp.c \
+	text_mmap.c time.c tokenize.c usage.c version.c
 BUILT_SOURCES = $(STDNORETURN_H)
 MOSTLYCLEANFILES = stdnoreturn.h stdnoreturn.h-t
 
@@ -404,7 +417,6 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign libopts/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
 	  $(AUTOMAKE) --foreign libopts/Makefile
-.PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
 	  *config.status*) \
@@ -481,22 +493,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libopts_la-libopts.Plo@am__quote@
 
 .c.o:
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
 
 .c.obj:
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+@am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .c.lo:
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+@am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
@@ -726,6 +741,8 @@ uninstall-am: uninstall-libLTLIBRARIES
 	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
 	uninstall-am uninstall-libLTLIBRARIES
 
+.PRECIOUS: Makefile
+
 
 libopts.c:		$(BUILT_SOURCES)
 	@: do-nothing rule to avoid default SCCS get

+ 1 - 1
libopts/README

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

+ 2 - 2
libopts/ag-char-map.h

@@ -1,6 +1,6 @@
 /*
  *  29 bits for 46 character classifications
- *  generated by char-mapper on 08/30/14 at 10:36:23
+ *  generated by char-mapper on 08/29/16 at 14:35: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-2014 by Bruce Korb - all rights reserved
+ *  AutoOpts is Copyright (C) 1992-2016 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

+ 1 - 1
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-2014 by Bruce Korb - all rights reserved
+ *  AutoOpts is Copyright (C) 1992-2016 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

+ 70 - 69
libopts/ao-strs.c

@@ -6,7 +6,7 @@
  * From the definitions    ao-strs.def
  * and the template file   strings
  *
- *  Copyright (C) 2011-2014 Bruce Korb, all rights reserved.
+ *  Copyright (C) 2011-2015 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,7 +38,7 @@
  */
 #include "ao-strs.h"
 
-char const ao_strs_strtable[6633] =
+char const ao_strs_strtable[6670] =
 /*     0 */ "-_^\0"
 /*     4 */ "  %s%s\n\0"
 /*    12 */ "auto-options\0"
@@ -118,79 +118,80 @@ char const ao_strs_strtable[6633] =
 /*   533 */ "%s_%s=\0"
 /*   540 */ " | \0"
 /*   544 */ "PAGER\0"
-/*   550 */ " + \0"
-/*   554 */ "  puts(_(%s));\n\0"
-/*   570 */ "\\'\0"
-/*   573 */ "'%s'\0"
-/*   578 */ " -- %s\0"
-/*   585 */ "%s_%s_TEXT='\0"
-/*   598 */ "#! %s\n\0"
-/*   605 */ "\n"
+/*   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"
             "env | grep '^%s_'\n\0"
-/*   625 */ "=%1$lu # 0x%1$lX\n\0"
-/*   643 */ "stdout\0"
-/*   650 */ "%A %B %e, %Y at %r %Z\0"
-/*   672 */ "%s/use-%u.XXXXXX\0"
-/*   689 */ "true\0"
-/*   694 */ "<%s type=%s>\0"
-/*   707 */ "VERSION\0"
-/*   715 */ "#x%02X;\0"
-/*   723 */ "OPT_ARG_NEEDED=YES\0"
-/*   742 */ "'\\''\0"
-/*   747 */ " '%s'\0"
-/*   753 */ "\n"
+/*   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"
             "OPTION_CT=0\n\0"
-/*   767 */ "set --\0"
-/*   774 */ "            ;;\n\n\0"
-/*   791 */ "        '%c' )\n\0"
-/*   807 */ "        '%s' )\n\0"
-/*   823 */ "        '%s' | \\\n\0"
-/*   841 */ "TMPDIR\0"
-/*   848 */ "/tmp\0"
-/*   853 */ "%1$s %2$s ; rm -f %2$s\0"
-/*   876 */ "<%1$s type=boolean>%2$s</%1$s>\n\0"
-/*   908 */ "#  From the %s option definitions\n"
+/*   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"
             "#\n\0"
-/*   945 */ "echo 'Warning:  Cannot load options files' >&2\0"
-/*   992 */ "echo 'Warning:  Cannot save options files' >&2\0"
-/*  1039 */ "echo 'Warning:  Cannot suppress the loading of options files' >&2\0"
-/*  1105 */ "<%1$s type=integer>0x%2$lX</%1$s>\n\0"
-/*  1140 */ "%1$s_%2$s_TEXT='no %2$s text'\n\0"
-/*  1171 */ "%1$s_%2$s_MODE='%3$s'\n"
+/*   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"
             "export %1$s_%2$s_MODE\n\0"
-/*  1216 */ "%1$s_%2$s='%3$s'\n"
+/*  1253 */ "%1$s_%2$s='%3$s'\n"
             "export %1$s_%2$s\n\0"
-/*  1251 */ "%1$s_%2$s_CT=%3$d\n"
+/*  1288 */ "%1$s_%2$s_CT=%3$d\n"
             "export %1$s_%2$s_CT\n\0"
-/*  1290 */ "OPTION_CT=%d\n"
+/*  1327 */ "OPTION_CT=%d\n"
             "export OPTION_CT\n\0"
-/*  1321 */ "%1$s_%2$s=%3$s\n"
+/*  1358 */ "%1$s_%2$s=%3$s\n"
             "export %1$s_%2$s\n\0"
-/*  1354 */ "%1$s_%2$s=%3$d # 0x%3$X\n"
+/*  1391 */ "%1$s_%2$s=%3$d # 0x%3$X\n"
             "export %1$s_%2$s\n\0"
-/*  1396 */ "        case \"${OPT_CODE}\" in\n\0"
-/*  1427 */ "            if [ $%1$s_%2$s_CT -gt %3$u ] ; then\n"
+/*  1433 */ "        case \"${OPT_CODE}\" in\n\0"
+/*  1464 */ "            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"
-/*  1618 */ "test ${%1$s_%2$s_CT-0} -ge %3$u || {\n"
+/*  1655 */ "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"
-/*  1710 */ "test -n \"$%1$s_%2$s\" || {\n"
+/*  1747 */ "test -n \"$%1$s_%2$s\" || {\n"
             "    echo %1$s_%2$s has not been set\n"
             "    exit 1\n"
             "} 1>&2\n\0"
-/*  1791 */ "            echo \"$%s_%s_TEXT\"\n"
+/*  1828 */ "            echo \"$%s_%s_TEXT\"\n"
             "            exit 0\n\0"
-/*  1842 */ "\n"
+/*  1879 */ "\n"
             "# # # # # # # # # #\n"
             "#\n"
             "#  END OF AUTOMATED OPTION PROCESSING\n"
             "#\n"
             "# # # # # # # # # # -- do not modify this marker --\n\0"
-/*  1958 */ "    if [ -n \"${OPT_ARG_VAL}\" ]\n"
+/*  1995 */ "    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"
@@ -205,15 +206,15 @@ char const ao_strs_strtable[6633] =
             "unset OPT_NAME    || :\n"
             "unset OPT_CODE    || :\n"
             "unset OPT_ARG_VAL || :\n\0"
-/*  2337 */ "        OPT_CODE=`echo \"X${OPT_ARG}\"|sed 's/^X-*//'`\n"
+/*  2374 */ "        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"
-/*  2588 */ "        OPT_CODE=`echo \"X${OPT_ARG}\" | sed 's/X-\\(.\\).*/\\1/'`\n"
+/*  2625 */ "        OPT_CODE=`echo \"X${OPT_ARG}\" | sed 's/X-\\(.\\).*/\\1/'`\n"
             "        OPT_ARG=` echo \"X${OPT_ARG}\" | sed 's/X-.//'`\n\0"
-/*  2705 */ "\n"
+/*  2742 */ "\n"
             "ARG_COUNT=$#\n"
             "OPT_PROCESS=true\n"
             "OPT_ARG=$1\n"
@@ -226,7 +227,7 @@ char const ao_strs_strtable[6633] =
             "        OPT_PROCESS=false\n"
             "        shift\n"
             "        ;;\n\0"
-/*  2912 */ "        case \"${OPT_ARG_NEEDED}\" in\n"
+/*  2949 */ "        case \"${OPT_ARG_NEEDED}\" in\n"
             "        NO )\n"
             "            OPT_ARG_VAL=''\n"
             "            ;;\n"
@@ -254,10 +255,10 @@ char const ao_strs_strtable[6633] =
             "            fi\n"
             "            ;;\n"
             "        esac\n\0"
-/*  3691 */ "            %1$s_%2$s_CT=`expr ${%1$s_%2$s_CT} + 1`\n"
+/*  3728 */ "            %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"
-/*  3815 */ "\n"
+/*  3852 */ "\n"
             "if test -z \"${%1$s_%2$s}\"\n"
             "then\n"
             "  %1$s_%2$s_CT=0\n"
@@ -267,16 +268,16 @@ char const ao_strs_strtable[6633] =
             "  %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"
-/*  3973 */ "    * )\n"
+/*  4010 */ "    * )\n"
             "         OPT_PROCESS=false\n"
             "         ;;\n"
             "    esac\n\0"
-/*  4030 */ "            %1$s_%2$s_CT=0\n"
+/*  4067 */ "            %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"
-/*  4171 */ "            if [ -n \"${%1$s_%2$s}\" ] && ${%1$s_%2$s_set} ; then\n"
+/*  4208 */ "            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"
@@ -285,7 +286,7 @@ char const ao_strs_strtable[6633] =
             "            %1$s_%2$s='%3$s'\n"
             "            export %1$s_%2$s\n"
             "            OPT_NAME='%2$s'\n\0"
-/*  4488 */ "\n"
+/*  4525 */ "\n"
             "ARG_COUNT=$#\n"
             "OPT_ARG=$1\n"
             "while [ $# -gt 0 ]\n"
@@ -293,7 +294,7 @@ char const ao_strs_strtable[6633] =
             "    OPT_ELEMENT=''\n"
             "    OPT_ARG_VAL=''\n"
             "    OPT_ARG=${1}\n\0"
-/*  4591 */ "        case \"${OPT_ARG_NEEDED}\" in\n"
+/*  4628 */ "        case \"${OPT_ARG_NEEDED}\" in\n"
             "        NO )\n"
             "            if [ -n \"${OPT_ARG}\" ]\n"
             "            then\n"
@@ -338,33 +339,33 @@ char const ao_strs_strtable[6633] =
             "            fi\n"
             "            ;;\n"
             "        esac\n\0"
-/*  5745 */ "            echo \"$%s_LONGUSAGE_TEXT\" | ${PAGER-more}\n"
+/*  5782 */ "            echo \"$%s_LONGUSAGE_TEXT\" | ${PAGER-more}\n"
             "            exit 0\n\0"
-/*  5819 */ "%s OF %s\n"
+/*  5856 */ "%s OF %s\n"
             "#\n"
             "#  From here to the next `-- do not modify this marker --',\n"
             "#  the text has been generated %s\n\0"
-/*  5925 */ "            eval %1$s_%2$s${OPT_ELEMENT}=true\n"
+/*  5962 */ "            eval %1$s_%2$s${OPT_ELEMENT}=true\n"
             "            export %1$s_%2$s${OPT_ELEMENT}\n\0"
-/*  6015 */ "            if [ -n \"${%1$s_%2$s}\" ] && ${%1$s_%2$s_set} ; then\n"
+/*  6052 */ "            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"
-/*  6274 */ "\n"
+/*  6311 */ "\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"
-/*  6343 */ "\n"
+/*  6380 */ "\n"
             "%1$s_%2$s=${%1$s_%2$s}\n"
             "%1$s_%2$s_set=false\n"
             "export %1$s_%2$s\n\0"
-/*  6405 */ "# # # # # # # # # # -- do not modify this marker --\n"
+/*  6442 */ "# # # # # # # # # # -- do not modify this marker --\n"
             "#\n"
             "#  DO NOT EDIT THIS SECTION\n\0"
-/*  6488 */ "        * )\n"
+/*  6525 */ "        * )\n"
             "            echo Unknown %s: \"${OPT_CODE}\" >&2\n"
             "            echo \"$%s_USAGE_TEXT\" >&2\n"
             "            exit 1\n"

+ 73 - 71
libopts/ao-strs.h

@@ -6,7 +6,7 @@
  * From the definitions    ao-strs.def
  * and the template file   strings
  *
- *  Copyright (C) 2011-2014 Bruce Korb, all rights reserved.
+ *  Copyright (C) 2011-2015 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,29 +39,29 @@
 #ifndef STRINGS_AO_STRS_H_GUARD
 #define STRINGS_AO_STRS_H_GUARD 1
 /*
- * 142 strings in ao_strs_strtable string table
+ * 143 strings in ao_strs_strtable string table
  */
 #define ARG_BREAK_STR         (ao_strs_strtable+261)
 #define ARG_BREAK_STR_LEN     5
 #define ARG_BY_NUM_FMT        (ao_strs_strtable+267)
 #define ARG_BY_NUM_FMT_LEN    9
-#define BOOL_ATR_FMT          (ao_strs_strtable+876)
+#define BOOL_ATR_FMT          (ao_strs_strtable+913)
 #define BOOL_ATR_FMT_LEN      31
-#define CHK_MAX_COUNT         (ao_strs_strtable+1427)
+#define CHK_MAX_COUNT         (ao_strs_strtable+1464)
 #define CHK_MAX_COUNT_LEN     190
-#define CHK_MIN_COUNT         (ao_strs_strtable+1618)
+#define CHK_MIN_COUNT         (ao_strs_strtable+1655)
 #define CHK_MIN_COUNT_LEN     91
-#define CHK_ONE_REQUIRED      (ao_strs_strtable+1710)
+#define CHK_ONE_REQUIRED      (ao_strs_strtable+1747)
 #define CHK_ONE_REQUIRED_LEN  80
-#define ECHO_N_EXIT           (ao_strs_strtable+1791)
+#define ECHO_N_EXIT           (ao_strs_strtable+1828)
 #define ECHO_N_EXIT_LEN       50
 #define EMPTY_ARG             (ao_strs_strtable+277)
 #define EMPTY_ARG_LEN         2
-#define END_MARK              (ao_strs_strtable+1842)
+#define END_MARK              (ao_strs_strtable+1879)
 #define END_MARK_LEN          115
 #define END_OPT_SEL_STR       (ao_strs_strtable+280)
 #define END_OPT_SEL_STR_LEN   12
-#define END_PRE_FMT           (ao_strs_strtable+908)
+#define END_PRE_FMT           (ao_strs_strtable+945)
 #define END_PRE_FMT_LEN       36
 #define END_SET_TEXT          (ao_strs_strtable+293)
 #define END_SET_TEXT_LEN      3
@@ -75,15 +75,15 @@
 #define EXPORT_ARG_FMT_LEN    17
 #define FALSE_STR             (ao_strs_strtable+335)
 #define FALSE_STR_LEN         5
-#define FINISH_LOOP           (ao_strs_strtable+1958)
+#define FINISH_LOOP           (ao_strs_strtable+1995)
 #define FINISH_LOOP_LEN       378
 #define FLAG_OPT_MARK         (ao_strs_strtable+341)
 #define FLAG_OPT_MARK_LEN     9
 #define FLAG_STR              (ao_strs_strtable+351)
 #define FLAG_STR_LEN          4
-#define INIT_LOPT_STR         (ao_strs_strtable+2337)
+#define INIT_LOPT_STR         (ao_strs_strtable+2374)
 #define INIT_LOPT_STR_LEN     250
-#define INIT_OPT_STR          (ao_strs_strtable+2588)
+#define INIT_OPT_STR          (ao_strs_strtable+2625)
 #define INIT_OPT_STR_LEN      116
 #define INVALID_FMT           (ao_strs_strtable+356)
 #define INVALID_FMT_LEN       10
@@ -97,9 +97,9 @@
 #define LONG_OPT_MARK_LEN     10
 #define LONG_USE_STR          (ao_strs_strtable+396)
 #define LONG_USE_STR_LEN      9
-#define LOOP_STR              (ao_strs_strtable+2705)
+#define LOOP_STR              (ao_strs_strtable+2742)
 #define LOOP_STR_LEN          206
-#define LOPT_ARG_FMT          (ao_strs_strtable+2912)
+#define LOPT_ARG_FMT          (ao_strs_strtable+2949)
 #define LOPT_ARG_FMT_LEN      778
 #define LVL3_CMD              (ao_strs_strtable+406)
 #define LVL3_CMD_LEN          15
@@ -107,9 +107,9 @@
 #define MK_STR_OCT_FMT_LEN    5
 #define MORE_STR              (ao_strs_strtable+428)
 #define MORE_STR_LEN          4
-#define MULTI_ARG_FMT         (ao_strs_strtable+3691)
+#define MULTI_ARG_FMT         (ao_strs_strtable+3728)
 #define MULTI_ARG_FMT_LEN     123
-#define MULTI_DEF_FMT         (ao_strs_strtable+3815)
+#define MULTI_DEF_FMT         (ao_strs_strtable+3852)
 #define MULTI_DEF_FMT_LEN     157
 #define NESTED_OPT_FMT        (ao_strs_strtable+433)
 #define NESTED_OPT_FMT_LEN    17
@@ -119,29 +119,29 @@
 #define NLSTR_SPACE_FMT_LEN   5
 #define NONE_STR              (ao_strs_strtable+91)
 #define NONE_STR_LEN          4
-#define NOT_FOUND_STR         (ao_strs_strtable+3973)
+#define NOT_FOUND_STR         (ao_strs_strtable+4010)
 #define NOT_FOUND_STR_LEN     56
 #define NO_ARG_NEEDED         (ao_strs_strtable+461)
 #define NO_ARG_NEEDED_LEN     17
-#define NO_LOAD_WARN          (ao_strs_strtable+945)
+#define NO_LOAD_WARN          (ao_strs_strtable+982)
 #define NO_LOAD_WARN_LEN      46
-#define NO_MULTI_ARG_FMT      (ao_strs_strtable+4030)
+#define NO_MULTI_ARG_FMT      (ao_strs_strtable+4067)
 #define NO_MULTI_ARG_FMT_LEN  140
-#define NO_SAVE_OPTS          (ao_strs_strtable+992)
+#define NO_SAVE_OPTS          (ao_strs_strtable+1029)
 #define NO_SAVE_OPTS_LEN      46
-#define NO_SGL_ARG_FMT        (ao_strs_strtable+4171)
+#define NO_SGL_ARG_FMT        (ao_strs_strtable+4208)
 #define NO_SGL_ARG_FMT_LEN    316
-#define NO_SUPPRESS_LOAD      (ao_strs_strtable+1039)
+#define NO_SUPPRESS_LOAD      (ao_strs_strtable+1076)
 #define NO_SUPPRESS_LOAD_LEN  65
 #define NULL_ATR_FMT          (ao_strs_strtable+479)
 #define NULL_ATR_FMT_LEN      6
-#define NUMB_ATR_FMT          (ao_strs_strtable+1105)
+#define NUMB_ATR_FMT          (ao_strs_strtable+1142)
 #define NUMB_ATR_FMT_LEN      34
 #define OK_NEED_OPT_ARG       (ao_strs_strtable+486)
 #define OK_NEED_OPT_ARG_LEN   17
 #define ONE_TAB_STR           (ao_strs_strtable+504)
 #define ONE_TAB_STR_LEN       1
-#define ONLY_OPTS_LOOP        (ao_strs_strtable+4488)
+#define ONLY_OPTS_LOOP        (ao_strs_strtable+4525)
 #define ONLY_OPTS_LOOP_LEN    102
 #define OPEN_CLOSE_FMT        (ao_strs_strtable+479)
 #define OPEN_CLOSE_FMT_LEN    6
@@ -149,7 +149,7 @@
 #define OPEN_XML_FMT_LEN      4
 #define OPTION_STR            (ao_strs_strtable+511)
 #define OPTION_STR_LEN        6
-#define OPT_ARG_FMT           (ao_strs_strtable+4591)
+#define OPT_ARG_FMT           (ao_strs_strtable+4628)
 #define OPT_ARG_FMT_LEN       1153
 #define OPT_END_FMT           (ao_strs_strtable+518)
 #define OPT_END_FMT_LEN       14
@@ -159,75 +159,77 @@
 #define OR_STR_LEN            3
 #define PAGER_NAME            (ao_strs_strtable+544)
 #define PAGER_NAME_LEN        5
-#define PAGE_USAGE_FMT        (ao_strs_strtable+853)
+#define PAGE_USAGE_FMT        (ao_strs_strtable+550)
 #define PAGE_USAGE_FMT_LEN    22
-#define PAGE_USAGE_TEXT       (ao_strs_strtable+5745)
+#define PAGE_USAGE_TEXT       (ao_strs_strtable+5782)
 #define PAGE_USAGE_TEXT_LEN   73
-#define PLUS_STR              (ao_strs_strtable+550)
+#define PLUS_STR              (ao_strs_strtable+573)
 #define PLUS_STR_LEN          3
-#define PREAMBLE_FMT          (ao_strs_strtable+5819)
+#define PREAMBLE_FMT          (ao_strs_strtable+5856)
 #define PREAMBLE_FMT_LEN      105
-#define PUTS_FMT              (ao_strs_strtable+554)
+#define PUTS_FMT              (ao_strs_strtable+577)
 #define PUTS_FMT_LEN          15
-#define QUOT_APOS             (ao_strs_strtable+570)
+#define QUOT_APOS             (ao_strs_strtable+593)
 #define QUOT_APOS_LEN         2
-#define QUOT_ARG_FMT          (ao_strs_strtable+573)
+#define QUOT_ARG_FMT          (ao_strs_strtable+596)
 #define QUOT_ARG_FMT_LEN      4
-#define SET_MULTI_ARG         (ao_strs_strtable+5925)
+#define SET_MULTI_ARG         (ao_strs_strtable+5962)
 #define SET_MULTI_ARG_LEN     89
-#define SET_NO_TEXT_FMT       (ao_strs_strtable+1140)
+#define SET_NO_TEXT_FMT       (ao_strs_strtable+1177)
 #define SET_NO_TEXT_FMT_LEN   30
-#define SET_OFF_FMT           (ao_strs_strtable+578)
+#define SET_OFF_FMT           (ao_strs_strtable+601)
 #define SET_OFF_FMT_LEN       6
-#define SET_TEXT_FMT          (ao_strs_strtable+585)
+#define SET_TEXT_FMT          (ao_strs_strtable+608)
 #define SET_TEXT_FMT_LEN      12
-#define SGL_ARG_FMT           (ao_strs_strtable+6015)
+#define SGL_ARG_FMT           (ao_strs_strtable+6052)
 #define SGL_ARG_FMT_LEN       258
-#define SGL_DEF_FMT           (ao_strs_strtable+6274)
+#define SGL_DEF_FMT           (ao_strs_strtable+6311)
 #define SGL_DEF_FMT_LEN       68
-#define SGL_NO_DEF_FMT        (ao_strs_strtable+6343)
+#define SGL_NO_DEF_FMT        (ao_strs_strtable+6380)
 #define SGL_NO_DEF_FMT_LEN    61
-#define SHELL_MAGIC           (ao_strs_strtable+598)
+#define SHELL_MAGIC           (ao_strs_strtable+621)
 #define SHELL_MAGIC_LEN       6
-#define SHOW_PROG_ENV         (ao_strs_strtable+605)
+#define SHOW_PROG_ENV         (ao_strs_strtable+628)
 #define SHOW_PROG_ENV_LEN     19
-#define SHOW_VAL_FMT          (ao_strs_strtable+625)
+#define SHOW_VAL_FMT          (ao_strs_strtable+648)
 #define SHOW_VAL_FMT_LEN      17
-#define START_MARK            (ao_strs_strtable+6405)
+#define START_MARK            (ao_strs_strtable+6442)
 #define START_MARK_LEN        82
-#define STDOUT                (ao_strs_strtable+643)
+#define STDOUT                (ao_strs_strtable+666)
 #define STDOUT_LEN            6
-#define TIME_FMT              (ao_strs_strtable+650)
+#define TIME_FMT              (ao_strs_strtable+673)
 #define TIME_FMT_LEN          21
-#define TMPDIR                (ao_strs_strtable+841)
+#define TMPDIR                (ao_strs_strtable+695)
 #define TMPDIR_LEN            6
-#define TMP_FILE_FMT          (ao_strs_strtable+672)
+#define TMP_FILE_FMT          (ao_strs_strtable+702)
 #define TMP_FILE_FMT_LEN      16
-#define TMP_USAGE_FMT         (ao_strs_strtable+672)
+#define TMP_USAGE_FMT         (ao_strs_strtable+702)
 #define TMP_USAGE_FMT_LEN     16
-#define TRUE_STR              (ao_strs_strtable+689)
+#define TRUE_STR              (ao_strs_strtable+719)
 #define TRUE_STR_LEN          4
 #define TWO_SPACES_STR        (ao_strs_strtable+254)
 #define TWO_SPACES_STR_LEN    2
-#define TYPE_ATR_FMT          (ao_strs_strtable+694)
+#define TYPE_ATR_FMT          (ao_strs_strtable+724)
 #define TYPE_ATR_FMT_LEN      12
-#define UNK_OPT_FMT           (ao_strs_strtable+6488)
+#define UNK_OPT_FMT           (ao_strs_strtable+6525)
 #define UNK_OPT_FMT_LEN       144
-#define VER_STR               (ao_strs_strtable+707)
+#define VER_STR               (ao_strs_strtable+737)
 #define VER_STR_LEN           7
-#define XML_HEX_BYTE_FMT      (ao_strs_strtable+715)
+#define XML_HEX_BYTE_FMT      (ao_strs_strtable+745)
 #define XML_HEX_BYTE_FMT_LEN  7
-#define YES_NEED_OPT_ARG      (ao_strs_strtable+723)
+#define YES_NEED_OPT_ARG      (ao_strs_strtable+753)
 #define YES_NEED_OPT_ARG_LEN  18
-#define apostrophe            (ao_strs_strtable+742)
+#define apostrophe            (ao_strs_strtable+772)
 #define apostrophe_LEN        4
-#define arg_fmt               (ao_strs_strtable+747)
+#define arg_fmt               (ao_strs_strtable+777)
 #define arg_fmt_LEN           5
-#define init_optct            (ao_strs_strtable+753)
+#define init_optct            (ao_strs_strtable+820)
 #define init_optct_LEN        13
-#define set_dash              (ao_strs_strtable+767)
+#define misguess_len          (ao_strs_strtable+783)
+#define misguess_len_LEN      36
+#define set_dash              (ao_strs_strtable+834)
 #define set_dash_LEN          6
-#define tmp_dir               (ao_strs_strtable+848)
+#define tmp_dir               (ao_strs_strtable+841)
 #define tmp_dir_LEN           4
 #define zAll                  (ao_strs_strtable+257)
 #define zAll_LEN              3
@@ -235,13 +237,13 @@
 #define zCfgAO_Flags_LEN      12
 #define zCfgProg              (ao_strs_strtable+25)
 #define zCfgProg_LEN          7
-#define zEquivMode            (ao_strs_strtable+1171)
+#define zEquivMode            (ao_strs_strtable+1208)
 #define zEquivMode_LEN        44
 #define zFiveSpaces           (ao_strs_strtable+244)
 #define zFiveSpaces_LEN       5
 #define zFmtFmt               (ao_strs_strtable+33)
 #define zFmtFmt_LEN           11
-#define zFullOptFmt           (ao_strs_strtable+1216)
+#define zFullOptFmt           (ao_strs_strtable+1253)
 #define zFullOptFmt_LEN       34
 #define zGnuBreak             (ao_strs_strtable+45)
 #define zGnuBreak_LEN         5
@@ -259,23 +261,23 @@
 #define zGnuTimeArg_LEN       4
 #define zNone                 (ao_strs_strtable+91)
 #define zNone_LEN             4
-#define zOptCookieCt          (ao_strs_strtable+1251)
+#define zOptCookieCt          (ao_strs_strtable+1288)
 #define zOptCookieCt_LEN      38
-#define zOptCtFmt             (ao_strs_strtable+1290)
+#define zOptCtFmt             (ao_strs_strtable+1327)
 #define zOptCtFmt_LEN         30
-#define zOptDisabl            (ao_strs_strtable+1321)
+#define zOptDisabl            (ao_strs_strtable+1358)
 #define zOptDisabl_LEN        32
-#define zOptNumFmt            (ao_strs_strtable+1354)
+#define zOptNumFmt            (ao_strs_strtable+1391)
 #define zOptNumFmt_LEN        41
-#define zOptionCase           (ao_strs_strtable+1396)
+#define zOptionCase           (ao_strs_strtable+1433)
 #define zOptionCase_LEN       30
-#define zOptionEndSelect      (ao_strs_strtable+774)
+#define zOptionEndSelect      (ao_strs_strtable+846)
 #define zOptionEndSelect_LEN  16
-#define zOptionFlag           (ao_strs_strtable+791)
+#define zOptionFlag           (ao_strs_strtable+863)
 #define zOptionFlag_LEN       15
-#define zOptionFullName       (ao_strs_strtable+807)
+#define zOptionFullName       (ao_strs_strtable+879)
 #define zOptionFullName_LEN   15
-#define zOptionPartName       (ao_strs_strtable+823)
+#define zOptionPartName       (ao_strs_strtable+895)
 #define zOptionPartName_LEN   17
 #define zPresetFile           (ao_strs_strtable+96)
 #define zPresetFile_LEN       37
@@ -325,6 +327,6 @@
 #define zTwoSpaces_LEN        2
 #define zambig_file           (ao_strs_strtable+4)
 #define zambig_file_LEN       7
-extern char const ao_strs_strtable[6633];
+extern char const ao_strs_strtable[6670];
 
 #endif /* STRINGS_AO_STRS_H_GUARD */

+ 4 - 4
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-2014 by Bruce Korb - all rights reserved
+ *  AutoOpts is Copyright (C) 1992-2016 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
@@ -299,9 +299,9 @@ regular_opts(tOptions * opts)
  *
  * what: this is the main option processing routine
  *
- * arg:  + tOptions* + opts  + program options descriptor +
- * arg:  + int       + a_ct  + program arg count  +
- * arg:  + char**    + a_v   + program arg vector +
+ * arg:  + tOptions * + opts  + program options descriptor +
+ * arg:  + int        + a_ct  + program arg count  +
+ * arg:  + char **    + a_v   + program arg vector +
  *
  * ret_type:  int
  * ret_desc:  the count of the arguments processed

+ 15 - 12
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-2014 by Bruce Korb - all rights reserved
+ *  AutoOpts is Copyright (C) 1992-2016 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,7 +41,10 @@
 #  ifdef PATH_MAX
 #    define AG_PATH_MAX         ((size_t)PATH_MAX)
 #  else
-#    define AG_PATH_MAX         4096
+#    ifdef __gnu_hurd__
+#      define size_t unsigned long
+#    endif
+#    define AG_PATH_MAX         ((size_t)4096)
 #  endif
 #else
 #  if defined(PATH_MAX) && (PATH_MAX > MAXPATHLEN)
@@ -107,7 +110,7 @@
  *  Coercive cast.  Compel an address to be interpreted as the type
  *  of the first argument.  No complaints, just do it.
  */
-#define C(_t,_p)  ((_t)(void *)(_p))
+#define C(_t,_p)  ((_t)VOIDP(_p))
 #endif
 
 /* The __attribute__((__warn_unused_result__)) feature
@@ -256,10 +259,10 @@ typedef struct {
     char const * pzTime;
 } arg_types_t;
 
-#define AGALOC(c, w)          ao_malloc((size_t)c)
-#define AGREALOC(p, c, w)     ao_realloc((void*)p, (size_t)c)
-#define AGFREE(_p)            free((void *)_p)
-#define AGDUPSTR(p, s, w)     (p = ao_strdup(s))
+#define AGALOC(_c, _w)        ao_malloc((size_t)_c)
+#define AGREALOC(_p, _c, _w)  ao_realloc(VOIDP(_p), (size_t)_c)
+#define AGFREE(_p)            free(VOIDP(_p))
+#define AGDUPSTR(_p, _s, _w)  (_p = ao_strdup(_s))
 
 static void *
 ao_malloc(size_t sz);
@@ -267,10 +270,10 @@ ao_malloc(size_t sz);
 static void *
 ao_realloc(void *p, size_t sz);
 
-#define ao_free(_p) free((void *)_p)
+#define ao_free(_p) free(VOIDP(_p))
 
 static char *
-ao_strdup(char const *str);
+ao_strdup(char const * str);
 
 /**
  *  DO option handling?
@@ -369,7 +372,7 @@ ao_strdup(char const *str);
 #endif
 
 #ifndef MAP_FAILED
-#  define  MAP_FAILED           ((void*)-1)
+#  define  MAP_FAILED           VOIDP(-1)
 #endif
 
 #ifndef  _SC_PAGESIZE
@@ -379,8 +382,8 @@ ao_strdup(char const *str);
 #endif
 
 #ifndef HAVE_STRCHR
-extern char* strchr(char const *s, int c);
-extern char* strrchr(char const *s, int c);
+extern char * strchr(char const * s, int c);
+extern char * strrchr(char const * s, int c);
 #endif
 
 /**

+ 72 - 64
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-2014 by Bruce Korb
+ *  Automated Options Copyright (C) 1992-2016 by Bruce Korb
  *
  *  This file is part of AutoOpts, a companion to AutoGen.
  *  AutoOpts is free software.
- *  AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
+ *  AutoOpts is Copyright (C) 1992-2016 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
@@ -82,6 +82,14 @@
  */
 #define AO_EXIT_REQ_USAGE 10064
 
+#undef  VOIDP
+/**
+ * Coerce a value into a void pointer with no const or volatile attributes.
+ * Somewhere along the line, the above set of includes need to set up
+ * the "uintptr_t" type.
+ */
+#define VOIDP(_a)  ((void *)(uintptr_t)(_a))
+
 /**
  *  PUBLIC DEFINES
  *
@@ -90,7 +98,7 @@
  *  to an option descriptor must be obtained.  There are two ways:
  *
  *  1. inside an option processing procedure, it is the second argument,
- *     conventionally "tOptDesc* pOD".
+ *     conventionally "tOptDesc * pOD".
  *
  *  2. Outside of an option procedure (or to reference a different option
  *     descriptor), use either "&DESC( opt_name )" or "&pfx_DESC( opt_name )".
@@ -101,15 +109,15 @@
  * @{
  */
 /// autoopts structure version
-#define OPTIONS_STRUCT_VERSION      167936
+#define OPTIONS_STRUCT_VERSION      167937
 /// autoopts structure version string
-#define OPTIONS_VERSION_STRING      "41:0:16"
+#define OPTIONS_VERSION_STRING      "41:1:16"
 /// 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.0"
+#define OPTIONS_DOTTED_VERSION      "41.1"
 /// convert a version/release number pair to an integer value
 #define OPTIONS_VER_TO_NUM(_v, _r)  (((_v) * 4096) + (_r))
 /// @}
@@ -147,7 +155,7 @@ typedef struct optionValue {
         unsigned int    boolVal;        ///< OPARG_TYPE_BOOLEAN
         unsigned long   setVal;         ///< OPARG_TYPE_MEMBERSHIP
         long            longVal;        ///< OPARG_TYPE_NUMERIC
-        void*           nestVal;        ///< OPARG_TYPE_HIERARCHY
+        void *          nestVal;        ///< OPARG_TYPE_HIERARCHY
     } v;
 } tOptionValue;
 
@@ -445,7 +453,7 @@ typedef tOptProc * tpOptProc;
  *  with the "exitCode" argument passed to it.
  */
 // coverity[+kill]
-typedef void (tUsageProc)(tOptions* pOpts, int exitCode);
+typedef void (tUsageProc)(tOptions * pOpts, int exitCode);
 
 /**
  * a pointer to a procedure that prints usage and exits.
@@ -690,7 +698,7 @@ struct options {
  */
 typedef struct {
     unsigned long   tkn_ct;      ///< number of tokens found
-    unsigned char*  tkn_list[1]; ///< array of pointers to tokens
+    unsigned char * tkn_list[1]; ///< array of pointers to tokens
 } token_list_t;
 
 /*
@@ -728,7 +736,7 @@ typedef struct {
 /**
  * mmap result wrapper that yields "true" when mmap has failed.
  */
-#define TEXT_MMAP_FAILED_ADDR(a)  ((void*)(a) ==  (void*)MAP_FAILED)
+#define TEXT_MMAP_FAILED_ADDR(a)  (VOIDP(a) == VOIDP(MAP_FAILED))
 
 #ifdef  __cplusplus
 #define CPLUSPLUS_OPENER extern "C" {
@@ -779,9 +787,9 @@ CPLUSPLUS_OPENER
  *
  * @param string       string to be tokenized
  *
- * @return token_list_t* - pointer to a structure that lists each token
+ * @return token_list_t * - pointer to a structure that lists each token
  */
-extern token_list_t* ao_string_tokenize(char const*);
+extern token_list_t * ao_string_tokenize(char const *);
 
 
 /**
@@ -797,9 +805,9 @@ extern token_list_t* ao_string_tokenize(char const*);
  *
  * @param fname        the file to load
  *
- * @return const tOptionValue* - An allocated, compound value structure
+ * @return const tOptionValue * - An allocated, compound value structure
  */
-extern const tOptionValue* configFileLoad(char const*);
+extern const tOptionValue * configFileLoad(char const *);
 
 
 /**
@@ -827,7 +835,7 @@ extern const tOptionValue* configFileLoad(char const*);
  *
  * @return int - 0 -> SUCCESS, -1 -> FAILURE
  */
-extern int optionFileLoad(tOptions*, char const*);
+extern int optionFileLoad(tOptions *, char const *);
 
 
 /**
@@ -842,9 +850,9 @@ extern int optionFileLoad(tOptions*, char const*);
  * @param name         name of value to find
  * @param value        the matching value
  *
- * @return const tOptionValue* - a compound value structure
+ * @return const tOptionValue * - a compound value structure
  */
-extern const tOptionValue* optionFindNextValue(const tOptDesc*, const tOptionValue*, char const*, char const*);
+extern const tOptionValue * optionFindNextValue(const tOptDesc *, const tOptionValue *, char const *, char const *);
 
 
 /**
@@ -857,9 +865,9 @@ extern const tOptionValue* optionFindNextValue(const tOptDesc*, const tOptionVal
  * @param name         name of value to find
  * @param val          the matching value
  *
- * @return const tOptionValue* - a compound value structure
+ * @return const tOptionValue * - a compound value structure
  */
-extern const tOptionValue* optionFindValue(const tOptDesc*, char const*, char const*);
+extern const tOptionValue * optionFindValue(const tOptDesc *, char const *, char const *);
 
 
 /**
@@ -870,7 +878,7 @@ extern const tOptionValue* optionFindValue(const tOptDesc*, char const*, char co
  *
  * @param pOpts        program options descriptor
  */
-extern void optionFree(tOptions*);
+extern void optionFree(tOptions *);
 
 
 /**
@@ -886,9 +894,9 @@ extern void optionFree(tOptions*);
  * @param pOptValue    a hierarchcal value
  * @param valueName    name of value to get
  *
- * @return const tOptionValue* - a compound value structure
+ * @return const tOptionValue * - a compound value structure
  */
-extern const tOptionValue* optionGetValue(const tOptionValue*, char const*);
+extern const tOptionValue * optionGetValue(const tOptionValue *, char const *);
 
 
 /**
@@ -911,7 +919,7 @@ extern const tOptionValue* optionGetValue(const tOptionValue*, char const*);
  * @param opts         program options descriptor
  * @param line         NUL-terminated text
  */
-extern void optionLoadLine(tOptions*, char const*);
+extern void optionLoadLine(tOptions *, char const *);
 
 
 /**
@@ -922,9 +930,9 @@ extern void optionLoadLine(tOptions*, char const*);
  *
  * @param od           the set membership option description
  *
- * @return char* - the names of the set bits
+ * @return char * - the names of the set bits
  */
-extern char* optionMemberList(tOptDesc *);
+extern char * optionMemberList(tOptDesc *);
 
 
 /**
@@ -939,9 +947,9 @@ extern char* optionMemberList(tOptDesc *);
  * @param pOptValue    a hierarchcal list value
  * @param pOldValue    a value from this list
  *
- * @return const tOptionValue* - a compound value structure
+ * @return const tOptionValue * - a compound value structure
  */
-extern const tOptionValue* optionNextValue(const tOptionValue*, const tOptionValue*);
+extern const tOptionValue * optionNextValue(const tOptionValue *, const tOptionValue *);
 
 
 /**
@@ -954,7 +962,7 @@ extern const tOptionValue* optionNextValue(const tOptionValue*, const tOptionVal
  * @param pOpts        program options descriptor
  * @param ex_code      exit code for calling exit(3)
  */
-extern void optionOnlyUsage(tOptions*, int);
+extern void optionOnlyUsage(tOptions *, int);
 
 
 /**
@@ -965,7 +973,7 @@ extern void optionOnlyUsage(tOptions*, int);
  * @param opts         program options descriptor
  * @param od           the descriptor for this arg
  */
-extern void optionPrintVersion(tOptions*, tOptDesc*);
+extern void optionPrintVersion(tOptions *, tOptDesc *);
 
 
 /**
@@ -979,7 +987,7 @@ extern void optionPrintVersion(tOptions*, tOptDesc*);
  * @param opts         program options descriptor
  * @param od           the descriptor for this arg
  */
-extern void optionPrintVersionAndReturn(tOptions*, tOptDesc*);
+extern void optionPrintVersionAndReturn(tOptions *, tOptDesc *);
 
 
 /**
@@ -1007,7 +1015,7 @@ extern void optionPrintVersionAndReturn(tOptions*, tOptDesc*);
  *
  * @return int - the count of the arguments processed
  */
-extern int optionProcess(tOptions*, int, char**);
+extern int optionProcess(tOptions *, int, char **);
 
 
 /**
@@ -1022,7 +1030,7 @@ extern int optionProcess(tOptions*, int, char**);
  *
  * @param pOpts        program options descriptor
  */
-extern void optionRestore(tOptions*);
+extern void optionRestore(tOptions *);
 
 
 /**
@@ -1045,7 +1053,7 @@ extern void optionRestore(tOptions*);
  *
  * @param opts         program options descriptor
  */
-extern void optionSaveFile(tOptions*);
+extern void optionSaveFile(tOptions *);
 
 
 /**
@@ -1065,7 +1073,7 @@ extern void optionSaveFile(tOptions*);
  *
  * @param pOpts        program options descriptor
  */
-extern void optionSaveState(tOptions*);
+extern void optionSaveState(tOptions *);
 
 
 /**
@@ -1086,9 +1094,9 @@ extern void optionUnloadNested(tOptionValue const *);
  *  Returns the full version string compiled into the library.
  *  The returned string cannot be modified.
  *
- * @return char const* - the version string in constant memory
+ * @return char const * - the version string in constant memory
  */
-extern char const* optionVersion(void);
+extern char const * optionVersion(void);
 
 
 /**
@@ -1101,7 +1109,7 @@ extern char const* optionVersion(void);
  *
  * @param ch_list      characters to equivalence
  */
-extern void strequate(char const*);
+extern void strequate(char const *);
 
 
 /**
@@ -1118,7 +1126,7 @@ extern void strequate(char const*);
  *
  * @return int - the difference between two differing characters
  */
-extern int streqvcmp(char const*, char const*);
+extern int streqvcmp(char const *, char const *);
 
 
 /**
@@ -1163,7 +1171,7 @@ extern void streqvmap(char, char, int);
  *
  * @return int - the difference between two differing characters
  */
-extern int strneqvcmp(char const*, char const*, int);
+extern int strneqvcmp(char const *, char const *, int);
 
 
 /**
@@ -1179,68 +1187,68 @@ extern int strneqvcmp(char const*, char const*, int);
  * @param dest         output string
  * @param src          input string
  */
-extern void strtransform(char*, char const*);
+extern void strtransform(char *, char const *);
 
 /*  AutoOpts PRIVATE FUNCTIONS:  */
 tOptProc optionStackArg, optionUnstackArg, optionBooleanVal, optionNumericVal;
 
-extern char* ao_string_cook(char*, int*);
+extern char * ao_string_cook(char *, int *);
 
-extern unsigned int ao_string_cook_escape_char(char const*, char*, unsigned int);
+extern unsigned int ao_string_cook_escape_char(char const *, char *, unsigned int);
 
-extern void genshelloptUsage(tOptions*, int);
+extern void genshelloptUsage(tOptions *, int);
 
 extern int optionAlias(tOptions *, tOptDesc *, unsigned int);
 
-extern void optionBooleanVal(tOptions*, tOptDesc*);
+extern void optionBooleanVal(tOptions *, tOptDesc *);
 
-extern uintptr_t optionEnumerationVal(tOptions*, tOptDesc*, char const * const *, unsigned int);
+extern uintptr_t optionEnumerationVal(tOptions *, tOptDesc *, char const * const *, unsigned int);
 
-extern void optionFileCheck(tOptions*, tOptDesc*, teOptFileType, tuFileMode);
+extern void optionFileCheck(tOptions *, tOptDesc *, teOptFileType, tuFileMode);
 
-extern char const * optionKeywordName(tOptDesc*, unsigned int);
+extern char const * optionKeywordName(tOptDesc *, unsigned int);
 
-extern void optionLoadOpt(tOptions*, tOptDesc*);
+extern void optionLoadOpt(tOptions *, tOptDesc *);
 
-extern bool optionMakePath(char*, int, char const*, char const*);
+extern bool optionMakePath(char *, int, char const *, char const *);
 
-extern void optionNestedVal(tOptions*, tOptDesc*);
+extern void optionNestedVal(tOptions *, tOptDesc *);
 
-extern void optionNumericVal(tOptions*, tOptDesc*);
+extern void optionNumericVal(tOptions *, tOptDesc *);
 
 extern void optionPagedUsage(tOptions *, tOptDesc *);
 
-extern void optionParseShell(tOptions*);
+extern void optionParseShell(tOptions *);
 
 extern void optionPrintParagraphs(char const *, bool, FILE *);
 
-extern void optionPutShell(tOptions*);
+extern void optionPutShell(tOptions *);
 
 extern char const * optionQuoteString(char const *, char const *);
 
-extern void optionResetOpt(tOptions*, tOptDesc*);
+extern void optionResetOpt(tOptions *, tOptDesc *);
 
-extern void optionSetMembers(tOptions*, tOptDesc*, char const * const *, unsigned int);
+extern void optionSetMembers(tOptions *, tOptDesc *, char const * const *, unsigned int);
 
-extern void optionShowRange(tOptions*, tOptDesc*, void *, int);
+extern void optionShowRange(tOptions *, tOptDesc *, void *, int);
 
-extern void optionStackArg(tOptions*, tOptDesc*);
+extern void optionStackArg(tOptions *, tOptDesc *);
 
-extern void optionTimeDate(tOptions*, tOptDesc*);
+extern void optionTimeDate(tOptions *, tOptDesc *);
 
-extern void optionTimeVal(tOptions*, tOptDesc*);
+extern void optionTimeVal(tOptions *, tOptDesc *);
 
-extern void optionUnstackArg(tOptions*, tOptDesc*);
+extern void optionUnstackArg(tOptions *, tOptDesc *);
 
-extern void optionUsage(tOptions*, int);
+extern void optionUsage(tOptions *, int);
 
 extern void optionVendorOption(tOptions *, tOptDesc *);
 
-extern void optionVersionStderr(tOptions*, tOptDesc*);
+extern void optionVersionStderr(tOptions *, tOptDesc *);
 
-extern void* text_mmap(char const*, int, int, tmap_info_t*);
+extern void * text_mmap(char const *, int, int, tmap_info_t *);
 
-extern int text_munmap(tmap_info_t*);
+extern int text_munmap(tmap_info_t *);
 
 CPLUSPLUS_CLOSER
 #endif /* AUTOOPTS_OPTIONS_H_GUARD */

+ 1 - 1
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-2014 by Bruce Korb - all rights reserved
+ *  AutoOpts is Copyright (C) 1992-2016 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

+ 80 - 80
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-2014 by Bruce Korb - all rights reserved
+ *  AutoOpts is Copyright (C) 1992-2015 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
@@ -368,33 +368,33 @@ static void dummy_func(void) {
   puts(_("allocation of %d bytes failed\n"));
 #line 53 "../init.c"
   puts(_("AutoOpts function called without option descriptor\n"));
-#line 90 "../init.c"
+#line 86 "../init.c"
   puts(_("\tThis exceeds the compiled library version:  "));
-#line 88 "../init.c"
+#line 84 "../init.c"
   puts(_("Automated Options Processing Error!\n"
        "\t%s called AutoOpts function with structure version %d:%d:%d.\n"));
 #line 80 "../autoopts.c"
   puts(_("realloc of %d bytes at 0x%p failed\n"));
-#line 92 "../init.c"
+#line 88 "../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 82 "../makeshell.c"
+#line 87 "../makeshell.c"
   puts(_("(AutoOpts bug):  %s.\n"));
 #line 90 "../reset.c"
   puts(_("optionResetOpt() called, but reset-option not configured"));
-#line 292 "../usage.c"
+#line 295 "../usage.c"
   puts(_("could not locate the 'help' option"));
 #line 336 "../autoopts.c"
   puts(_("optionProcess() was called with invalid data"));
-#line 748 "../usage.c"
+#line 751 "../usage.c"
   puts(_("invalid argument type specified"));
 #line 598 "../find.c"
   puts(_("defaulted to option with optional arg"));
 #line 76 "../alias.c"
   puts(_("aliasing option is out of range."));
-#line 234 "../enum.c"
+#line 235 "../enum.c"
   puts(_("%s error:  the keyword '%s' is ambiguous for %s\n"));
 #line 108 "../find.c"
   puts(_("  The following options match:\n"));
@@ -404,9 +404,9 @@ static void dummy_func(void) {
   puts(_("%s: Command line arguments required\n"));
 #line 43 "../alias.c"
   puts(_("%d %s%s options allowed\n"));
-#line 89 "../makeshell.c"
+#line 94 "../makeshell.c"
   puts(_("%s error %d (%s) calling %s for '%s'\n"));
-#line 301 "../makeshell.c"
+#line 306 "../makeshell.c"
   puts(_("interprocess pipe"));
 #line 168 "../version.c"
   puts(_("error: version option argument '%c' invalid.  Use:\n"
@@ -433,13 +433,13 @@ static void dummy_func(void) {
   puts(_("%s: illegal option -- %s\n"));
 #line 335 "../find.c"
   puts(_("%s: unknown vendor extension option -- %s\n"));
-#line 159 "../enum.c"
+#line 160 "../enum.c"
   puts(_("  or an integer from %d through %d\n"));
-#line 169 "../enum.c"
+#line 170 "../enum.c"
   puts(_("  or an integer from %d through %d\n"));
-#line 747 "../usage.c"
+#line 750 "../usage.c"
   puts(_("%s error:  invalid option descriptor for %s\n"));
-#line 1081 "../usage.c"
+#line 1084 "../usage.c"
   puts(_("%s error:  invalid option descriptor for %s\n"));
 #line 385 "../find.c"
   puts(_("%s: invalid option name: %s\n"));
@@ -454,65 +454,65 @@ static void dummy_func(void) {
   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 536 "../save.c"
   puts(_("error %d (%s) creating %s\n"));
-#line 234 "../enum.c"
+#line 235 "../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 184 "../save.c"
+#line 186 "../save.c"
   puts(_("error %d (%s) stat-ing %s\n"));
-#line 238 "../save.c"
+#line 239 "../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"
   puts(_("'%s' is not a command line option.\n"));
-#line 111 "../time.c"
+#line 113 "../time.c"
   puts(_("%s error:  '%s' is not a recognizable date/time.\n"));
-#line 132 "../save.c"
+#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 164 "../numeric.c"
+#line 165 "../numeric.c"
   puts(_("%s error:  '%s' is not a recognizable number.\n"));
-#line 200 "../enum.c"
+#line 201 "../enum.c"
   puts(_("%s error:  %s exceeds %s keyword count\n"));
-#line 330 "../usage.c"
+#line 333 "../usage.c"
   puts(_("Try '%s %s' for more information.\n"));
 #line 45 "../alias.c"
   puts(_("one %s%s option allowed\n"));
-#line 203 "../makeshell.c"
+#line 208 "../makeshell.c"
   puts(_("standard output"));
-#line 938 "../makeshell.c"
+#line 943 "../makeshell.c"
   puts(_("standard output"));
-#line 274 "../usage.c"
+#line 277 "../usage.c"
   puts(_("standard output"));
-#line 415 "../usage.c"
+#line 418 "../usage.c"
   puts(_("standard output"));
-#line 625 "../usage.c"
+#line 628 "../usage.c"
   puts(_("standard output"));
 #line 175 "../version.c"
   puts(_("standard output"));
-#line 274 "../usage.c"
+#line 277 "../usage.c"
   puts(_("standard error"));
-#line 415 "../usage.c"
+#line 418 "../usage.c"
   puts(_("standard error"));
-#line 625 "../usage.c"
+#line 628 "../usage.c"
   puts(_("standard error"));
 #line 175 "../version.c"
   puts(_("standard error"));
-#line 203 "../makeshell.c"
+#line 208 "../makeshell.c"
   puts(_("write"));
-#line 938 "../makeshell.c"
+#line 943 "../makeshell.c"
   puts(_("write"));
-#line 273 "../usage.c"
+#line 276 "../usage.c"
   puts(_("write"));
-#line 414 "../usage.c"
+#line 417 "../usage.c"
   puts(_("write"));
-#line 624 "../usage.c"
+#line 627 "../usage.c"
   puts(_("write"));
 #line 174 "../version.c"
   puts(_("write"));
@@ -520,78 +520,78 @@ static void dummy_func(void) {
   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 131 "../save.c"
+#line 130 "../save.c"
   puts(_("%s warning:  cannot save options - %s not regular file\n"));
-#line 183 "../save.c"
+#line 185 "../save.c"
   puts(_("%s warning:  cannot save options - %s not regular file\n"));
-#line 237 "../save.c"
+#line 238 "../save.c"
   puts(_("%s warning:  cannot save options - %s not regular file\n"));
-#line 256 "../save.c"
+#line 257 "../save.c"
   puts(_("%s warning:  cannot save options - %s not regular file\n"));
-#line 534 "../save.c"
+#line 535 "../save.c"
   puts(_("%s warning:  cannot save options - %s not regular file\n"));
   /* END-LIBOPTS-MESSAGES */
 
   /* USAGE-TEXT: */
-#line 873 "../usage.c"
+#line 876 "../usage.c"
   puts(_("\t\t\t\t- an alternate for '%s'\n"));
-#line 1148 "../usage.c"
+#line 1151 "../usage.c"
   puts(_("Version, usage and configuration options:"));
-#line 924 "../usage.c"
+#line 927 "../usage.c"
   puts(_("\t\t\t\t- default option for unnamed options\n"));
-#line 837 "../usage.c"
+#line 840 "../usage.c"
   puts(_("\t\t\t\t- disabled as '--%s'\n"));
-#line 1117 "../usage.c"
+#line 1120 "../usage.c"
   puts(_(" --- %-14s %s\n"));
-#line 1115 "../usage.c"
+#line 1118 "../usage.c"
   puts(_("This option has been disabled"));
-#line 864 "../usage.c"
+#line 867 "../usage.c"
   puts(_("\t\t\t\t- enabled by default\n"));
 #line 40 "../alias.c"
   puts(_("%s error:  only "));
-#line 1194 "../usage.c"
+#line 1197 "../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 383 "../usage.c"
   puts(_("Options are specified by doubled hyphens and their name or by a single\n"
        "hyphen and the flag character.\n"));
-#line 916 "../makeshell.c"
+#line 921 "../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 166 "../enum.c"
+#line 167 "../enum.c"
   puts(_("  or an integer mask with any of the lower %d bits set\n"));
-#line 897 "../usage.c"
+#line 900 "../usage.c"
   puts(_("\t\t\t\t- is a set membership option\n"));
-#line 918 "../usage.c"
+#line 921 "../usage.c"
   puts(_("\t\t\t\t- must appear between %d and %d times\n"));
-#line 382 "../usage.c"
+#line 385 "../usage.c"
   puts(_("Options are specified by single or double hyphens and their name.\n"));
-#line 904 "../usage.c"
+#line 907 "../usage.c"
   puts(_("\t\t\t\t- may appear multiple times\n"));
-#line 891 "../usage.c"
+#line 894 "../usage.c"
   puts(_("\t\t\t\t- may not be preset\n"));
-#line 1309 "../usage.c"
+#line 1312 "../usage.c"
   puts(_("   Arg Option-Name    Description\n"));
-#line 1245 "../usage.c"
+#line 1248 "../usage.c"
   puts(_("  Flg Arg Option-Name    Description\n"));
-#line 1303 "../usage.c"
+#line 1306 "../usage.c"
   puts(_("  Flg Arg Option-Name    Description\n"));
-#line 1304 "../usage.c"
+#line 1307 "../usage.c"
   puts(_(" %3s %s"));
-#line 1310 "../usage.c"
+#line 1313 "../usage.c"
   puts(_(" %3s %s"));
-#line 387 "../usage.c"
+#line 390 "../usage.c"
   puts(_("The '-#<number>' option may omit the hash char\n"));
-#line 383 "../usage.c"
+#line 386 "../usage.c"
   puts(_("All arguments are named options.\n"));
-#line 971 "../usage.c"
+#line 974 "../usage.c"
   puts(_(" - reading file %s"));
-#line 409 "../usage.c"
+#line 412 "../usage.c"
   puts(_("\n"
        "Please send bug reports to:  <%s>\n"));
 #line 100 "../version.c"
@@ -600,17 +600,17 @@ static void dummy_func(void) {
 #line 129 "../version.c"
   puts(_("\n"
        "Please send bug reports to:  <%s>\n"));
-#line 903 "../usage.c"
+#line 906 "../usage.c"
   puts(_("\t\t\t\t- may NOT appear - preset only\n"));
-#line 944 "../usage.c"
+#line 947 "../usage.c"
   puts(_("\n"
        "The following option preset mechanisms are supported:\n"));
-#line 1192 "../usage.c"
+#line 1195 "../usage.c"
   puts(_("\n"
        "The following option preset mechanisms are supported:\n"));
-#line 682 "../usage.c"
+#line 685 "../usage.c"
   puts(_("prohibits these options:\n"));
-#line 677 "../usage.c"
+#line 680 "../usage.c"
   puts(_("prohibits the option '%s'\n"));
 #line 81 "../numeric.c"
   puts(_("%s%ld to %ld"));
@@ -628,28 +628,28 @@ static void dummy_func(void) {
   puts(_("%sis scalable with a suffix: k/K/m/M/g/G/t/T\n"));
 #line 77 "../numeric.c"
   puts(_("%sless than or equal to %ld"));
-#line 390 "../usage.c"
+#line 393 "../usage.c"
   puts(_("Operands and options may be intermixed.  They will be reordered.\n"));
-#line 652 "../usage.c"
-  puts(_("requires the option '%s'\n"));
 #line 655 "../usage.c"
+  puts(_("requires the option '%s'\n"));
+#line 658 "../usage.c"
   puts(_("requires these options:\n"));
-#line 1321 "../usage.c"
+#line 1324 "../usage.c"
   puts(_("   Arg Option-Name   Req?  Description\n"));
-#line 1315 "../usage.c"
+#line 1318 "../usage.c"
   puts(_("  Flg Arg Option-Name   Req?  Description\n"));
-#line 167 "../enum.c"
+#line 168 "../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 913 "../usage.c"
   puts(_("\t\t\t\t- may appear up to %d times\n"));
 #line 77 "../enum.c"
   puts(_("The valid \"%s\" option keywords are:\n"));
-#line 1152 "../usage.c"
+#line 1155 "../usage.c"
   puts(_("The next option supports vendor supported extra options:"));
-#line 773 "../usage.c"
+#line 776 "../usage.c"
   puts(_("These additional options are:"));
   /* END-USAGE-TEXT */
 }

+ 5 - 5
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-2014 by Bruce Korb - all rights reserved
+ *  AutoOpts is Copyright (C) 1992-2016 by Bruce Korb - all rights reserved
  *
  *  AutoOpts is available under any one of two licenses.  The license
  *  in use must be one of these two and the choice is under the control
@@ -36,8 +36,8 @@
  * private:
  *
  * what:  Decipher a boolean value
- * arg:   + tOptions* + opts + program options descriptor +
- * arg:   + tOptDesc* + od  + the descriptor for this arg +
+ * arg:   + tOptions * + opts + program options descriptor +
+ * arg:   + tOptDesc * + od  + the descriptor for this arg +
  *
  * doc:
  *  Decipher a true or false value for a boolean valued option argument.
@@ -47,8 +47,8 @@
 void
 optionBooleanVal(tOptions * opts, tOptDesc * od)
 {
-    char* pz;
-    bool  res = true;
+    char * pz;
+    bool   res = true;
 
     if (INQUERY_CALL(opts, od))
         return;

+ 1 - 1
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-2014 by Bruce Korb - all rights reserved
+ *  AutoOpts is Copyright (C) 1992-2016 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

+ 1 - 1
libopts/compat/compat.h

@@ -3,7 +3,7 @@
  *  compat.h is free software.
  *  This file is part of AutoGen and AutoOpts.
  *
- *  AutoGen Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
+ *  AutoGen Copyright (C) 1992-2015 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

+ 12 - 12
libopts/compat/pathfind.c

@@ -23,9 +23,9 @@ pathfind( char const * path,
 }
 #else
 
-static char* make_absolute( char const *string, char const *dot_path );
-static char* canonicalize_pathname( char *path );
-static char* extract_colon_unit( char* dir, char const *string, int *p_index );
+static char * make_absolute(char const * string, char const * dot_path);
+static char * canonicalize_pathname(char * path);
+static char * extract_colon_unit(char * dir, char const * string, int * p_index);
 
 /**
  * local implementation of pathfind.
@@ -52,8 +52,8 @@ pathfind( char const * path,
      *  FOR each non-null entry in the colon-separated path, DO ...
      */
     for (;;) {
-        DIR*  dirP;
-        char* colon_unit = extract_colon_unit( zPath, path, &p_index );
+        DIR  * dirP;
+        char * colon_unit = extract_colon_unit( zPath, path, &p_index );
 
         if (colon_unit == NULL)
             break;
@@ -69,7 +69,7 @@ pathfind( char const * path,
         for (;;) {
             struct dirent *entP = readdir( dirP );
 
-            if (entP == (struct dirent*)NULL)
+            if (entP == (struct dirent *)NULL)
                 break;
 
             /*
@@ -107,10 +107,10 @@ pathfind( char const * path,
  * DOT_PATH contains the symbolic location of  `.'.  This always returns
  * a new string, even if STRING was an absolute pathname to begin with.
  */
-static char*
-make_absolute( char const *string, char const *dot_path )
+static char *
+make_absolute( char const * string, char const * dot_path )
 {
-    char *result;
+    char * result;
     int result_len;
 
     if (!dot_path || *string == '/') {
@@ -147,7 +147,7 @@ make_absolute( char const *string, char const *dot_path )
  *    Non-leading `../'s and trailing `..'s are handled by removing
  *                    portions of the path.
  */
-static char*
+static char *
 canonicalize_pathname( char *path )
 {
     int i, start;
@@ -231,8 +231,8 @@ canonicalize_pathname( char *path )
  * return the next one  pointed to by (P_INDEX), or NULL if there are no
  * more.  Advance (P_INDEX) to the character after the colon.
  */
-static char*
-extract_colon_unit( char* pzDir, char const *string, int *p_index )
+static char *
+extract_colon_unit(char * pzDir, char const * string, int * p_index)
 {
     char * pzDest = pzDir;
     int    ix     = *p_index;

+ 1 - 1
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-2014 by Bruce Korb - all rights reserved
+ *  AutoOpts is Copyright (C) 1992-2015 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

+ 65 - 57
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-2014 by Bruce Korb - all rights reserved
+ *  AutoOpts is Copyright (C) 1992-2016 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,7 +33,7 @@ static void
 file_preset(tOptions * opts, char const * fname, int dir);
 
 static char *
-handle_comment(char* txt);
+handle_comment(char * txt);
 
 static char *
 handle_cfg(tOptions * opts, tOptState * ost, char * txt, int dir);
@@ -87,9 +87,9 @@ skip_unkn(char const * txt)
 /*=export_func  configFileLoad
  *
  * what:  parse a configuration file
- * arg:   + char const*     + fname + the file to load +
+ * arg:   + char const * + fname + the file to load +
  *
- * ret_type:  const tOptionValue*
+ * ret_type:  const tOptionValue *
  * ret_desc:  An allocated, compound value structure
  *
  * doc:
@@ -146,11 +146,11 @@ configFileLoad(char const * fname)
 /*=export_func  optionFindValue
  *
  * what:  find a hierarcicaly valued option instance
- * arg:   + const tOptDesc* + odesc + an option with a nested arg type +
- * arg:   + char const*     + name  + name of value to find +
- * arg:   + char const*     + val   + the matching value    +
+ * arg:   + const tOptDesc * + odesc + an option with a nested arg type +
+ * arg:   + char const *     + name  + name of value to find +
+ * arg:   + char const *     + val   + the matching value    +
  *
- * ret_type:  const tOptionValue*
+ * ret_type:  const tOptionValue *
  * ret_desc:  a compound value structure
  *
  * doc:
@@ -182,9 +182,9 @@ optionFindValue(const tOptDesc * odesc, char const * name, char const * val)
     }
 
     else do {
-        tArgList* argl  = odesc->optCookie;
-        int       argct = argl->useCt;
-        void **   poptv = (void**)(argl->apzArgs);
+        tArgList * argl  = odesc->optCookie;
+        int        argct = argl->useCt;
+        void **    poptv = (void **)(argl->apzArgs);
 
         if (argct == 0) {
             errno = ENOENT;
@@ -192,7 +192,7 @@ optionFindValue(const tOptDesc * odesc, char const * name, char const * val)
         }
 
         if (name == NULL) {
-            res = (tOptionValue*)*poptv;
+            res = (tOptionValue *)*poptv;
             break;
         }
 
@@ -221,12 +221,12 @@ optionFindValue(const tOptDesc * odesc, char const * name, char const * val)
  * FIXME: the handling of 'pzName' and 'pzVal' is just wrong.
  *
  * what:  find a hierarcicaly valued option instance
- * arg:   + const tOptDesc* + odesc + an option with a nested arg type +
- * arg:   + const tOptionValue* + pPrevVal + the last entry +
- * arg:   + char const*     + name     + name of value to find +
- * arg:   + char const*     + value    + the matching value    +
+ * arg:   + const tOptDesc * + odesc + an option with a nested arg type +
+ * arg:   + const tOptionValue * + pPrevVal + the last entry +
+ * arg:   + char const *     + name     + name of value to find +
+ * arg:   + char const *     + value    + the matching value    +
  *
- * ret_type:  const tOptionValue*
+ * ret_type:  const tOptionValue *
  * ret_desc:  a compound value structure
  *
  * doc:
@@ -249,7 +249,7 @@ optionFindNextValue(const tOptDesc * odesc, const tOptionValue * pPrevVal,
                     char const * pzName, char const * pzVal)
 {
     bool old_found = false;
-    tOptionValue* res = NULL;
+    tOptionValue * res = NULL;
 
     (void)pzName;
     (void)pzVal;
@@ -264,12 +264,12 @@ optionFindNextValue(const tOptDesc * odesc, const tOptionValue * pPrevVal,
     }
 
     else do {
-        tArgList* argl = odesc->optCookie;
-        int    ct   = argl->useCt;
-        void** poptv = (void**)argl->apzArgs;
+        tArgList * argl = odesc->optCookie;
+        int        ct   = argl->useCt;
+        void **   poptv = (void **)argl->apzArgs;
 
         while (--ct >= 0) {
-            tOptionValue* pOV = *(poptv++);
+            tOptionValue * pOV = *(poptv++);
             if (old_found) {
                 res = pOV;
                 break;
@@ -288,10 +288,10 @@ optionFindNextValue(const tOptDesc * odesc, const tOptionValue * pPrevVal,
 /*=export_func  optionGetValue
  *
  * what:  get a specific value from a hierarcical list
- * arg:   + const tOptionValue* + pOptValue + a hierarchcal value +
- * arg:   + char const*   + valueName + name of value to get +
+ * arg:   + const tOptionValue * + pOptValue + a hierarchcal value +
+ * arg:   + char const *         + valueName + name of value to get +
  *
- * ret_type:  const tOptionValue*
+ * ret_type:  const tOptionValue *
  * ret_desc:  a compound value structure
  *
  * doc:
@@ -326,10 +326,10 @@ optionGetValue(tOptionValue const * oov, char const * vname)
 
     if (arg_list->useCt > 0) {
         int     ct     = arg_list->useCt;
-        void ** ovlist = (void**)(arg_list->apzArgs);
+        void ** ovlist = (void **)(arg_list->apzArgs);
 
         if (vname == NULL) {
-            res = (tOptionValue*)*ovlist;
+            res = (tOptionValue *)*ovlist;
 
         } else do {
             tOptionValue * opt_val = *(ovlist++);
@@ -347,10 +347,10 @@ optionGetValue(tOptionValue const * oov, char const * vname)
 /*=export_func  optionNextValue
  *
  * what:  get the next value from a hierarchical list
- * arg:   + const tOptionValue* + pOptValue + a hierarchcal list value +
- * arg:   + const tOptionValue* + pOldValue + a value from this list   +
+ * arg:   + const tOptionValue * + pOptValue + a hierarchcal list value +
+ * arg:   + const tOptionValue * + pOldValue + a value from this list   +
  *
- * ret_type:  const tOptionValue*
+ * ret_type:  const tOptionValue *
  * ret_desc:  a compound value structure
  *
  * doc:
@@ -385,7 +385,7 @@ optionNextValue(tOptionValue const * ov_list,tOptionValue const * oov )
     arg_list = ov_list->v.nestVal;
     {
         int     ct    = arg_list->useCt;
-        void ** o_list = (void**)(arg_list->apzArgs);
+        void ** o_list = (void **)(arg_list->apzArgs);
 
         while (ct-- > 0) {
             tOptionValue * nov = *(o_list++);
@@ -395,7 +395,7 @@ optionNextValue(tOptionValue const * ov_list,tOptionValue const * oov )
 
                 } else {
                     err = 0;
-                    res = (tOptionValue*)*o_list;
+                    res = (tOptionValue *)*o_list;
                 }
                 break;
             }
@@ -498,9 +498,9 @@ file_preset(tOptions * opts, char const * fname, int dir)
  *  but actually I don't care that much.  It ends with "-->".
  */
 static char *
-handle_comment(char* txt)
+handle_comment(char * txt)
 {
-    char* pz = strstr(txt, "-->");
+    char * pz = strstr(txt, "-->");
     if (pz != NULL)
         pz += 3;
     return pz;
@@ -515,8 +515,8 @@ handle_comment(char* txt)
 static char *
 handle_cfg(tOptions * opts, tOptState * ost, char * txt, int dir)
 {
-    char* pzName = txt++;
-    char* pzEnd  = strchr(txt, NL);
+    char * pzName = txt++;
+    char * pzEnd  = strchr(txt, NL);
 
     if (pzEnd == NULL)
         return txt + strlen(txt);
@@ -547,8 +547,8 @@ handle_cfg(tOptions * opts, tOptState * ost, char * txt, int dir)
      *  on to a newline *not* preceded by a backslash.
      */
     if (pzEnd[-1] == '\\') {
-        char* pcD = pzEnd-1;
-        char* pcS = pzEnd;
+        char * pcD = pzEnd-1;
+        char * pcS = pzEnd;
 
         for (;;) {
             char ch = *(pcS++);
@@ -719,6 +719,7 @@ program_directive(tOptions * opts, char * txt)
  *  "txt" points to a '[' character.
  *  The "traditional" [PROG_NAME] segmentation of the config file.
  *  Do not ever mix with the "<?program prog-name>" variation.
+ *  The templates reject program names over 16 characters.
  *
  *  @param[in,out] opts  program option descriptor
  *  @param[in]     txt   scanning pointer
@@ -736,8 +737,10 @@ handle_section(tOptions * opts, char * txt)
         return NULL;
 
     {
-        char z[24];
-        sprintf(z, "[%s]", opts->pzPROGNAME);
+        char z[24] = "[";
+        memcpy(z+1, opts->pzPROGNAME, len);
+        z[++len] = ']';
+        z[++len] = NUL;
         txt = strstr(txt, z);
     }
 
@@ -839,16 +842,22 @@ parse_xml_encoding(char ** ppz)
 static char *
 trim_xml_text(char * intxt, char const * pznm, tOptionLoadMode mode)
 {
-    static char const fmt[] = "</%s>";
-    size_t len = strlen(pznm) + sizeof(fmt) - 2 /* for %s */;
+    size_t nm_len = strlen(pznm);
     char * etext;
 
     {
         char z[64], *pz = z;
-        if (len >= sizeof(z))
-            pz = AGALOC(len, "scan name");
 
-        len = (size_t)sprintf(pz, fmt, pznm);
+        if (nm_len + 4 >= sizeof(z))
+            pz = AGALOC(nm_len + 4, "scan name");
+
+        pz[0] = '<';
+        pz[1] = '/';
+        memcpy(pz+2, pznm, nm_len);
+        nm_len  += 2;
+        pz[nm_len++] = '>';
+        pz[nm_len]   = NUL;
+
         *intxt = ' ';
         etext = strstr(intxt, pz);
         if (pz != z) AGFREE(pz);
@@ -858,7 +867,7 @@ trim_xml_text(char * intxt, char const * pznm, tOptionLoadMode mode)
         return etext;
 
     {
-        char * result = etext + len;
+        char * result = etext + nm_len;
 
         if (mode != OPTION_LOAD_UNCOOKED)
             etext = SPN_WHITESPACE_BACK(intxt, etext);
@@ -920,9 +929,9 @@ handle_struct(tOptions * opts, tOptState * ost, char * txt, int dir)
     tOptionLoadMode mode = option_load_mode;
     tOptionValue    valu;
 
-    char* pzName = ++txt;
-    char* pzData;
-    char* pcNulPoint;
+    char * pzName = ++txt;
+    char * pzData;
+    char * pcNulPoint;
 
     txt = SPN_VALUE_NAME_CHARS(txt);
     pcNulPoint = txt;
@@ -931,8 +940,8 @@ handle_struct(tOptions * opts, tOptState * ost, char * txt, int dir)
     switch (*txt) {
     case ' ':
     case '\t':
-        txt = (void *)parse_attrs(
-            opts, SPN_WHITESPACE_CHARS(txt), &mode, &valu);
+        txt = VOIDP(parse_attrs(
+            opts, SPN_WHITESPACE_CHARS(txt), &mode, &valu));
         if (txt == NULL)
             return txt;
         if (*txt == '>')
@@ -1096,8 +1105,8 @@ intern_file_load(tOptions * opts)
  *
  * what: Load the locatable config files, in order
  *
- * arg:  + tOptions*   + opts + program options descriptor +
- * arg:  + char const* + prog + program name +
+ * arg:  + tOptions *   + opts + program options descriptor +
+ * arg:  + char const * + prog + program name +
  *
  * ret_type:  int
  * ret_desc:  0 -> SUCCESS, -1 -> FAILURE
@@ -1137,8 +1146,7 @@ optionFileLoad(tOptions * opts, char const * prog)
      * of this pointer to point to writable memory.
      */
     {
-        char const ** pp =
-            (char const **)(void *)&(opts->pzProgName);
+        char const ** pp = VOIDP(&(opts->pzProgName));
         *pp = prog;
     }
 
@@ -1150,8 +1158,8 @@ optionFileLoad(tOptions * opts, char const * prog)
  * private:
  *
  * what:  Load an option rc/ini file
- * arg:   + tOptions* + opts  + program options descriptor +
- * arg:   + tOptDesc* + odesc + the descriptor for this arg +
+ * arg:   + tOptions * + opts  + program options descriptor +
+ * arg:   + tOptDesc * + odesc + the descriptor for this arg +
  *
  * doc:
  *  Processes the options found in the file named with

+ 34 - 31
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-2014 by Bruce Korb - all rights reserved
+ *  AutoOpts is Copyright (C) 1992-2016 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,6 +30,9 @@
  */
 
 /* = = = START-STATIC-FORWARD = = = */
+static char *
+nl_count(char * start, char * end, int * lnct_p);
+
 static bool
 contiguous_quote(char ** pps, char * pq, int * lnct_p);
 /* = = = END-STATIC-FORWARD = = = */
@@ -38,8 +41,8 @@ contiguous_quote(char ** pps, char * pq, int * lnct_p);
  * private:
  *
  * what:  escape-process a string fragment
- * arg:   + char const*  + pzScan  + points to character after the escape +
- * arg:   + char*        + pRes    + Where to put the result byte +
+ * arg:   + char const * + pzScan  + points to character after the escape +
+ * arg:   + char *       + pRes    + Where to put the result byte +
  * arg:   + unsigned int + nl_ch   + replacement char if scanned char is \n +
  *
  * ret-type: unsigned int
@@ -135,6 +138,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 +183,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,16 +211,20 @@ contiguous_quote(char ** pps, char * pq, int * lnct_p)
             return false;
         }
     }
+
+ fail_return:
+    *pps = NULL;
+    return false;
 }
 
 /*=export_func  ao_string_cook
  * private:
  *
  * what:  concatenate and escape-process strings
- * arg:   + char* + pzScan  + The *MODIFIABLE* input buffer +
- * arg:   + int*  + lnct_p  + The (possibly NULL) pointer to a line count +
+ * arg:   + char * + pzScan  + The *MODIFIABLE* input buffer +
+ * arg:   + int *  + lnct_p  + The (possibly NULL) pointer to a line count +
  *
- * ret-type: char*
+ * ret-type: char *
  * ret-desc: The address of the text following the processed strings.
  *           The return value is NULL if the strings are ill-formed.
  *
@@ -245,8 +248,8 @@ ao_string_cook(char * pzScan, int * lnct_p)
      *  It is a quoted string.  Process the escape sequence characters
      *  (in the set "abfnrtv") and make sure we find a closing quote.
      */
-    char* pzD = pzScan++;
-    char* pzS = pzScan;
+    char * pzD = pzScan++;
+    char * pzS = pzScan;
 
     if (lnct_p == NULL)
         lnct_p = &l;

+ 18 - 17
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-2014 by Bruce Korb - all rights reserved
+ *  AutoOpts is Copyright (C) 1992-2016 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
@@ -130,9 +130,10 @@ enum_err(tOptions * pOpts, tOptDesc * pOD,
      */
     else {
         unsigned int ent_no = 0;
-        char  zFmt[16];  /* format for all-but-last entries on a line */
+        char fmt[16];  /* format for all-but-last entries on a line */
 
-        sprintf(zFmt, ENUM_ERR_WIDTH, (int)max_len);
+        if (snprintf(fmt, 16, ENUM_ERR_WIDTH, (int)max_len) >= 16)
+            option_exits(EXIT_FAILURE);
         max_len = 78 / max_len; /* max_len is now max entries on a line */
         fputs(TWO_SPACES_STR, option_usage_fp);
 
@@ -150,7 +151,7 @@ enum_err(tOptions * pOpts, tOptDesc * pOD,
             }
 
             else
-                fprintf(option_usage_fp, zFmt, *(paz_names++) );
+                fprintf(option_usage_fp, fmt, *(paz_names++) );
         }
         fprintf(option_usage_fp, NLSTR_FMT, *paz_names);
     }
@@ -186,14 +187,14 @@ find_name(char const * name, tOptions * pOpts, tOptDesc * pOD,
 {
     /*
      *  Return the matching index as a pointer sized integer.
-     *  The result gets stashed in a char* pointer.
+     *  The result gets stashed in a char * pointer.
      */
     uintptr_t   res = name_ct;
-    size_t      len = strlen((char*)name);
+    size_t      len = strlen((char *)name);
     uintptr_t   idx;
 
     if (IS_DEC_DIGIT_CHAR(*name)) {
-        char * pz = (char *)(void *)name;
+        char * pz = VOIDP(name);
         unsigned long val = strtoul(pz, &pz, 0);
         if ((*pz == NUL) && (val < name_ct))
             return (uintptr_t)val;
@@ -215,7 +216,7 @@ find_name(char const * name, tOptions * pOpts, tOptDesc * pOD,
      *  Multiple partial matches means we have an ambiguous match.
      */
     for (idx = 0; idx < name_ct; idx++) {
-        if (strncmp((char*)paz_names[idx], (char*)name, len) == 0) {
+        if (strncmp((char *)paz_names[idx], (char *)name, len) == 0) {
             if (paz_names[idx][len] == NUL)
                 return idx;  /* full match */
 
@@ -242,7 +243,7 @@ find_name(char const * name, tOptions * pOpts, tOptDesc * pOD,
  * what:  Convert between enumeration values and strings
  * private:
  *
- * arg:   tOptDesc*,     pOD,       enumeration option description
+ * arg:   tOptDesc *,    pOD,       enumeration option description
  * arg:   unsigned int,  enum_val,  the enumeration value to map
  *
  * ret_type:  char const *
@@ -265,8 +266,8 @@ optionKeywordName(tOptDesc * pOD, unsigned int enum_val)
  * what:  Convert from a string to an enumeration value
  * private:
  *
- * arg:   tOptions*,     pOpts,     the program options descriptor
- * arg:   tOptDesc*,     pOD,       enumeration option description
+ * arg:   tOptions *,    pOpts,     the program options descriptor
+ * arg:   tOptDesc *,    pOD,       enumeration option description
  * arg:   char const * const *,  paz_names, list of enumeration names
  * arg:   unsigned int,  name_ct,   number of names in list
  *
@@ -509,7 +510,7 @@ find_member_bit(tOptions * opts, tOptDesc * od, char const * pz, int len,
  *
  * arg:   tOptDesc *,  od,   the set membership option description
  *
- * ret_type: char*
+ * ret_type: char *
  * ret_desc: the names of the set bits
  *
  * doc:   This converts the OPT_VALUE_name mask value to a allocated string.
@@ -521,7 +522,7 @@ optionMemberList(tOptDesc * od)
     uintptr_t    sv = od->optArg.argIntptr;
     char * res;
     (*(od->pOptProc))(OPTPROC_RETURN_VALNAME, od);
-    res = (void *)od->optArg.argString;
+    res = VOIDP(od->optArg.argString);
     od->optArg.argIntptr = sv;
     return res;
 }
@@ -530,8 +531,8 @@ optionMemberList(tOptDesc * od)
  * what:  Convert between bit flag values and strings
  * private:
  *
- * arg:   tOptions*,     opts,     the program options descriptor
- * arg:   tOptDesc*,     od,       the set membership option description
+ * arg:   tOptions *,     opts,     the program options descriptor
+ * arg:   tOptDesc *,     od,       the set membership option description
  * arg:   char const * const *,
  *                       nm_list,  list of enumeration names
  * arg:   unsigned int,  nm_ct,    number of names in list
@@ -634,12 +635,12 @@ optionSetMembers(tOptions * opts, tOptDesc * od,
         if (nm_ct < (8 * sizeof(uintptr_t)))
             res &= (1UL << nm_ct) - 1UL;
 
-        od->optCookie = (void *)res;
+        od->optCookie = VOIDP(res);
     }
     return;
 
 fail_return:
-    od->optCookie = (void *)0;
+    od->optCookie = VOIDP(0);
 }
 
 /** @}

+ 4 - 4
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-2014 by Bruce Korb - all rights reserved
+ *  AutoOpts is Copyright (C) 1992-2016 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
@@ -48,7 +48,7 @@ LOCAL void
 doPrognameEnv(tOptions * pOpts, teEnvPresetType type)
 {
     char const *        env_opts = getenv(pOpts->pzPROGNAME);
-    token_list_t*       pTL;
+    token_list_t *      pTL;
     int                 sv_argc;
     proc_state_mask_t   sv_flag;
     char **             sv_argv;
@@ -82,7 +82,7 @@ doPrognameEnv(tOptions * pOpts, teEnvPresetType type)
      */
     {
         uintptr_t v = (uintptr_t)(pTL->tkn_list);
-        pOpts->origArgVect = (void *)(v - sizeof(char *));
+        pOpts->origArgVect = VOIDP(v - sizeof(char *));
     }
     pOpts->origArgCt   = (unsigned int)pTL->tkn_ct   + 1;
     pOpts->fOptSet    &= ~OPTPROC_ERRSTOP;
@@ -192,7 +192,7 @@ env_presets(tOptions * pOpts, teEnvPresetType type)
 {
     int        ct;
     tOptState  st;
-    char*      pzFlagName;
+    char *     pzFlagName;
     size_t     spaceLeft;
     char       zEnvName[ AO_NAME_SIZE ];
 

+ 6 - 6
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-2014 by Bruce Korb - all rights reserved
+ *  AutoOpts is Copyright (C) 1992-2016 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
@@ -107,7 +107,7 @@ open_file_fd(tOptions * pOpts, tOptDesc * pOD, tuFileMode mode)
         /* NOTREACHED */
 
     if ((pOD->fOptState & OPTST_ALLOC_ARG) != 0)
-        pOD->optCookie = (void *)pOD->optArg.argString;
+        pOD->optCookie = VOIDP(pOD->optArg.argString);
     else
         AGDUPSTR(pOD->optCookie, pOD->optArg.argString, "file name");
 
@@ -131,7 +131,7 @@ fopen_file_fp(tOptions * pOpts, tOptDesc * pOD, tuFileMode mode)
         /* NOTREACHED */
 
     if ((pOD->fOptState & OPTST_ALLOC_ARG) != 0)
-        pOD->optCookie = (void *)pOD->optArg.argString;
+        pOD->optCookie = VOIDP(pOD->optArg.argString);
     else
         AGDUPSTR(pOD->optCookie, pOD->optArg.argString, "file name");
 
@@ -143,8 +143,8 @@ fopen_file_fp(tOptions * pOpts, tOptDesc * pOD, tuFileMode mode)
  * private:
  *
  * what:  Decipher a boolean value
- * arg:   + tOptions*     + pOpts    + program options descriptor  +
- * arg:   + tOptDesc*     + pOptDesc + the descriptor for this arg +
+ * arg:   + tOptions *    + pOpts    + program options descriptor  +
+ * arg:   + tOptDesc *    + pOptDesc + the descriptor for this arg +
  * arg:   + teOptFileType + ftype    + File handling type          +
  * arg:   + tuFileMode    + mode     + file open mode (if needed)  +
  *
@@ -153,7 +153,7 @@ fopen_file_fp(tOptions * pOpts, tOptDesc * pOD, tuFileMode mode)
  *   The mode specifies if the file must exist, must not exist or may
  *   (or may not) exist.  The mode may also specify opening the
  *   file: don't, open just the descriptor (fd), or open as a stream
- *   (FILE* pointer).
+ *   (FILE * pointer).
 =*/
 void
 optionFileCheck(tOptions * pOpts, tOptDesc * pOD,

+ 8 - 8
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-2014 by Bruce Korb - all rights reserved
+ *  AutoOpts is Copyright (C) 1992-2016 by Bruce Korb - all rights reserved
  *
  *  AutoOpts is available under any one of two licenses.  The license
  *  in use must be one of these two and the choice is under the control
@@ -58,7 +58,7 @@ static tSuccess
 get_opt_arg_may(tOptions * pOpts, tOptState * o_st);
 
 static tSuccess
-get_opt_arg_none(tOptions * pOpts, tOptState* o_st);
+get_opt_arg_none(tOptions * pOpts, tOptState * o_st);
 /* = = = END-STATIC-FORWARD = = = */
 
 /**
@@ -409,9 +409,9 @@ opt_find_long(tOptions * opts, char const * opt_name, tOptState * state)
  * @param pOptState  state about current option
  */
 LOCAL tSuccess
-opt_find_short(tOptions* pOpts, uint_t optValue, tOptState* pOptState)
+opt_find_short(tOptions * pOpts, uint_t optValue, tOptState * pOptState)
 {
-    tOptDesc*  pRes = pOpts->pOptDesc;
+    tOptDesc * pRes = pOpts->pOptDesc;
     int        ct   = pOpts->optCt;
 
     /*
@@ -554,7 +554,7 @@ get_opt_arg_may(tOptions * pOpts, tOptState * o_st)
         if (*++pOpts->pzCurOpt != NUL)
             o_st->pzOptArg = pOpts->pzCurOpt;
         else {
-            char* pzLA = pOpts->origArgVect[ pOpts->curOptIdx ];
+            char * pzLA = pOpts->origArgVect[ pOpts->curOptIdx ];
 
             /*
              *  BECAUSE it is optional, we must make sure
@@ -577,7 +577,7 @@ get_opt_arg_may(tOptions * pOpts, tOptState * o_st)
          */
         if (  (o_st->pzOptArg == NULL)
            && (! NAMED_OPTS(pOpts))) {
-            char* pzLA = pOpts->origArgVect[ pOpts->curOptIdx ];
+            char * pzLA = pOpts->origArgVect[ pOpts->curOptIdx ];
 
             /*
              *  BECAUSE it is optional, we must make sure
@@ -616,7 +616,7 @@ get_opt_arg_may(tOptions * pOpts, tOptState * o_st)
  *  @returns SUCCESS or FAILURE
  */
 static tSuccess
-get_opt_arg_none(tOptions * pOpts, tOptState* o_st)
+get_opt_arg_none(tOptions * pOpts, tOptState * o_st)
 {
     /*
      *  No option argument.  Make sure next time around we find
@@ -711,7 +711,7 @@ find_opt(tOptions * opts, tOptState * o_st)
          *  strip off the "const" quality of the "default_opt" field.
          */
         while (*(++pz) == '-')   ;
-        def_opt  = (void *)&(opts->specOptIdx.default_opt);
+        def_opt  = VOIDP(&(opts->specOptIdx.default_opt));
         def      = *def_opt;
         *def_opt = NO_EQUIVALENT;
         res      = opt_find_long(opts, pz, o_st);

+ 93 - 93
libopts/genshell.c

@@ -6,7 +6,7 @@
  *  From the definitions    genshell.def
  *  and the template file   options
  *
- * Generated from AutoOpts 41:0:16 templates.
+ * Generated from AutoOpts 41:1:16 templates.
  *
  *  AutoOpts is a copyrighted work.  This source file is not encumbered
  *  by AutoOpts licensing, but is provided under the licensing terms chosen
@@ -290,11 +290,11 @@ doUsageOpt(tOptions * opts, tOptDesc * od)
     ex_code = GENSHELLOPT_EXIT_SUCCESS;
     genshelloptUsage(&genshelloptOptions, ex_code);
     /* NOTREACHED */
-    exit(1);
+    exit(GENSHELLOPT_EXIT_FAILURE);
     (void)opts;
     (void)od;
 }
-/* extracted from optmain.tlib near line 1245 */
+/* extracted from optmain.tlib near line 1250 */
 
 /**
  * The directory containing the data associated with genshellopt.
@@ -406,11 +406,11 @@ AO_gettext(char const * pz)
     if (option_xlateable_txt.field_ct != 0) {
         res = dgettext("libopts", pz);
         if (res == pz)
-            res = (char *)(void *)_(pz);
+            res = (char *)VOIDP(_(pz));
     } else
-        res = (char *)(void *)_(pz);
+        res = (char *)VOIDP(_(pz));
 #else
-    res = (char *)(void *)_(pz);
+    res = (char *)VOIDP(_(pz));
 #endif
     if (res == pz)
         return res;
@@ -447,7 +447,7 @@ translate_option_strings(void)
          *  Do the translations.  The first pointer follows the field count
          *  field.  The field count field is the size of a pointer.
          */
-        char ** ppz = (char**)(void*)&(option_xlateable_txt);
+        char ** ppz = (char**)VOIDP(&(option_xlateable_txt));
         int     ix  = option_xlateable_txt.field_ct;
 
         do {
@@ -457,16 +457,16 @@ translate_option_strings(void)
         /* prevent re-translation and disable "libopts" domain lookup */
         option_xlateable_txt.field_ct = 0;
 
-        coerce_it((void*)&(opts->pzCopyright));
-        coerce_it((void*)&(opts->pzCopyNotice));
-        coerce_it((void*)&(opts->pzFullVersion));
-        coerce_it((void*)&(opts->pzUsageTitle));
-        coerce_it((void*)&(opts->pzExplain));
-        coerce_it((void*)&(opts->pzDetail));
+        coerce_it(VOIDP(&(opts->pzCopyright)));
+        coerce_it(VOIDP(&(opts->pzCopyNotice)));
+        coerce_it(VOIDP(&(opts->pzFullVersion)));
+        coerce_it(VOIDP(&(opts->pzUsageTitle)));
+        coerce_it(VOIDP(&(opts->pzExplain)));
+        coerce_it(VOIDP(&(opts->pzDetail)));
         {
             tOptDesc * od = opts->pOptDesc;
             for (ix = opts->optCt; ix > 0; ix--, od++)
-                coerce_it((void*)&(od->pzText));
+                coerce_it(VOIDP(&(od->pzText)));
         }
     }
 }
@@ -555,33 +555,33 @@ by the newly generated text.  The first '#!' line will be regenerated.\n"));
   puts(_("allocation of %d bytes failed\n"));
 #line 53 "../init.c"
   puts(_("AutoOpts function called without option descriptor\n"));
-#line 90 "../init.c"
+#line 86 "../init.c"
   puts(_("\tThis exceeds the compiled library version:  "));
-#line 88 "../init.c"
+#line 84 "../init.c"
   puts(_("Automated Options Processing Error!\n"
        "\t%s called AutoOpts function with structure version %d:%d:%d.\n"));
 #line 80 "../autoopts.c"
   puts(_("realloc of %d bytes at 0x%p failed\n"));
-#line 92 "../init.c"
+#line 88 "../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 82 "../makeshell.c"
+#line 87 "../makeshell.c"
   puts(_("(AutoOpts bug):  %s.\n"));
 #line 90 "../reset.c"
   puts(_("optionResetOpt() called, but reset-option not configured"));
-#line 292 "../usage.c"
+#line 295 "../usage.c"
   puts(_("could not locate the 'help' option"));
 #line 336 "../autoopts.c"
   puts(_("optionProcess() was called with invalid data"));
-#line 748 "../usage.c"
+#line 751 "../usage.c"
   puts(_("invalid argument type specified"));
 #line 598 "../find.c"
   puts(_("defaulted to option with optional arg"));
 #line 76 "../alias.c"
   puts(_("aliasing option is out of range."));
-#line 234 "../enum.c"
+#line 235 "../enum.c"
   puts(_("%s error:  the keyword '%s' is ambiguous for %s\n"));
 #line 108 "../find.c"
   puts(_("  The following options match:\n"));
@@ -591,9 +591,9 @@ by the newly generated text.  The first '#!' line will be regenerated.\n"));
   puts(_("%s: Command line arguments required\n"));
 #line 43 "../alias.c"
   puts(_("%d %s%s options allowed\n"));
-#line 89 "../makeshell.c"
+#line 94 "../makeshell.c"
   puts(_("%s error %d (%s) calling %s for '%s'\n"));
-#line 301 "../makeshell.c"
+#line 306 "../makeshell.c"
   puts(_("interprocess pipe"));
 #line 168 "../version.c"
   puts(_("error: version option argument '%c' invalid.  Use:\n"
@@ -620,13 +620,13 @@ by the newly generated text.  The first '#!' line will be regenerated.\n"));
   puts(_("%s: illegal option -- %s\n"));
 #line 335 "../find.c"
   puts(_("%s: unknown vendor extension option -- %s\n"));
-#line 159 "../enum.c"
+#line 160 "../enum.c"
   puts(_("  or an integer from %d through %d\n"));
-#line 169 "../enum.c"
+#line 170 "../enum.c"
   puts(_("  or an integer from %d through %d\n"));
-#line 747 "../usage.c"
+#line 750 "../usage.c"
   puts(_("%s error:  invalid option descriptor for %s\n"));
-#line 1081 "../usage.c"
+#line 1084 "../usage.c"
   puts(_("%s error:  invalid option descriptor for %s\n"));
 #line 385 "../find.c"
   puts(_("%s: invalid option name: %s\n"));
@@ -641,65 +641,65 @@ by the newly generated text.  The first '#!' line will be regenerated.\n"));
   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 536 "../save.c"
   puts(_("error %d (%s) creating %s\n"));
-#line 234 "../enum.c"
+#line 235 "../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 184 "../save.c"
+#line 186 "../save.c"
   puts(_("error %d (%s) stat-ing %s\n"));
-#line 238 "../save.c"
+#line 239 "../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"
   puts(_("'%s' is not a command line option.\n"));
-#line 111 "../time.c"
+#line 113 "../time.c"
   puts(_("%s error:  '%s' is not a recognizable date/time.\n"));
-#line 132 "../save.c"
+#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 164 "../numeric.c"
+#line 165 "../numeric.c"
   puts(_("%s error:  '%s' is not a recognizable number.\n"));
-#line 200 "../enum.c"
+#line 201 "../enum.c"
   puts(_("%s error:  %s exceeds %s keyword count\n"));
-#line 330 "../usage.c"
+#line 333 "../usage.c"
   puts(_("Try '%s %s' for more information.\n"));
 #line 45 "../alias.c"
   puts(_("one %s%s option allowed\n"));
-#line 203 "../makeshell.c"
+#line 208 "../makeshell.c"
   puts(_("standard output"));
-#line 938 "../makeshell.c"
+#line 943 "../makeshell.c"
   puts(_("standard output"));
-#line 274 "../usage.c"
+#line 277 "../usage.c"
   puts(_("standard output"));
-#line 415 "../usage.c"
+#line 418 "../usage.c"
   puts(_("standard output"));
-#line 625 "../usage.c"
+#line 628 "../usage.c"
   puts(_("standard output"));
 #line 175 "../version.c"
   puts(_("standard output"));
-#line 274 "../usage.c"
+#line 277 "../usage.c"
   puts(_("standard error"));
-#line 415 "../usage.c"
+#line 418 "../usage.c"
   puts(_("standard error"));
-#line 625 "../usage.c"
+#line 628 "../usage.c"
   puts(_("standard error"));
 #line 175 "../version.c"
   puts(_("standard error"));
-#line 203 "../makeshell.c"
+#line 208 "../makeshell.c"
   puts(_("write"));
-#line 938 "../makeshell.c"
+#line 943 "../makeshell.c"
   puts(_("write"));
-#line 273 "../usage.c"
+#line 276 "../usage.c"
   puts(_("write"));
-#line 414 "../usage.c"
+#line 417 "../usage.c"
   puts(_("write"));
-#line 624 "../usage.c"
+#line 627 "../usage.c"
   puts(_("write"));
 #line 174 "../version.c"
   puts(_("write"));
@@ -707,78 +707,78 @@ by the newly generated text.  The first '#!' line will be regenerated.\n"));
   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 131 "../save.c"
+#line 130 "../save.c"
   puts(_("%s warning:  cannot save options - %s not regular file\n"));
-#line 183 "../save.c"
+#line 185 "../save.c"
   puts(_("%s warning:  cannot save options - %s not regular file\n"));
-#line 237 "../save.c"
+#line 238 "../save.c"
   puts(_("%s warning:  cannot save options - %s not regular file\n"));
-#line 256 "../save.c"
+#line 257 "../save.c"
   puts(_("%s warning:  cannot save options - %s not regular file\n"));
-#line 534 "../save.c"
+#line 535 "../save.c"
   puts(_("%s warning:  cannot save options - %s not regular file\n"));
   /* END-LIBOPTS-MESSAGES */
 
   /* USAGE-TEXT: */
-#line 873 "../usage.c"
+#line 876 "../usage.c"
   puts(_("\t\t\t\t- an alternate for '%s'\n"));
-#line 1148 "../usage.c"
+#line 1151 "../usage.c"
   puts(_("Version, usage and configuration options:"));
-#line 924 "../usage.c"
+#line 927 "../usage.c"
   puts(_("\t\t\t\t- default option for unnamed options\n"));
-#line 837 "../usage.c"
+#line 840 "../usage.c"
   puts(_("\t\t\t\t- disabled as '--%s'\n"));
-#line 1117 "../usage.c"
+#line 1120 "../usage.c"
   puts(_(" --- %-14s %s\n"));
-#line 1115 "../usage.c"
+#line 1118 "../usage.c"
   puts(_("This option has been disabled"));
-#line 864 "../usage.c"
+#line 867 "../usage.c"
   puts(_("\t\t\t\t- enabled by default\n"));
 #line 40 "../alias.c"
   puts(_("%s error:  only "));
-#line 1194 "../usage.c"
+#line 1197 "../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 383 "../usage.c"
   puts(_("Options are specified by doubled hyphens and their name or by a single\n"
        "hyphen and the flag character.\n"));
-#line 916 "../makeshell.c"
+#line 921 "../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 166 "../enum.c"
+#line 167 "../enum.c"
   puts(_("  or an integer mask with any of the lower %d bits set\n"));
-#line 897 "../usage.c"
+#line 900 "../usage.c"
   puts(_("\t\t\t\t- is a set membership option\n"));
-#line 918 "../usage.c"
+#line 921 "../usage.c"
   puts(_("\t\t\t\t- must appear between %d and %d times\n"));
-#line 382 "../usage.c"
+#line 385 "../usage.c"
   puts(_("Options are specified by single or double hyphens and their name.\n"));
-#line 904 "../usage.c"
+#line 907 "../usage.c"
   puts(_("\t\t\t\t- may appear multiple times\n"));
-#line 891 "../usage.c"
+#line 894 "../usage.c"
   puts(_("\t\t\t\t- may not be preset\n"));
-#line 1309 "../usage.c"
+#line 1312 "../usage.c"
   puts(_("   Arg Option-Name    Description\n"));
-#line 1245 "../usage.c"
+#line 1248 "../usage.c"
   puts(_("  Flg Arg Option-Name    Description\n"));
-#line 1303 "../usage.c"
+#line 1306 "../usage.c"
   puts(_("  Flg Arg Option-Name    Description\n"));
-#line 1304 "../usage.c"
+#line 1307 "../usage.c"
   puts(_(" %3s %s"));
-#line 1310 "../usage.c"
+#line 1313 "../usage.c"
   puts(_(" %3s %s"));
-#line 387 "../usage.c"
+#line 390 "../usage.c"
   puts(_("The '-#<number>' option may omit the hash char\n"));
-#line 383 "../usage.c"
+#line 386 "../usage.c"
   puts(_("All arguments are named options.\n"));
-#line 971 "../usage.c"
+#line 974 "../usage.c"
   puts(_(" - reading file %s"));
-#line 409 "../usage.c"
+#line 412 "../usage.c"
   puts(_("\n"
        "Please send bug reports to:  <%s>\n"));
 #line 100 "../version.c"
@@ -787,17 +787,17 @@ by the newly generated text.  The first '#!' line will be regenerated.\n"));
 #line 129 "../version.c"
   puts(_("\n"
        "Please send bug reports to:  <%s>\n"));
-#line 903 "../usage.c"
+#line 906 "../usage.c"
   puts(_("\t\t\t\t- may NOT appear - preset only\n"));
-#line 944 "../usage.c"
+#line 947 "../usage.c"
   puts(_("\n"
        "The following option preset mechanisms are supported:\n"));
-#line 1192 "../usage.c"
+#line 1195 "../usage.c"
   puts(_("\n"
        "The following option preset mechanisms are supported:\n"));
-#line 682 "../usage.c"
+#line 685 "../usage.c"
   puts(_("prohibits these options:\n"));
-#line 677 "../usage.c"
+#line 680 "../usage.c"
   puts(_("prohibits the option '%s'\n"));
 #line 81 "../numeric.c"
   puts(_("%s%ld to %ld"));
@@ -815,28 +815,28 @@ by the newly generated text.  The first '#!' line will be regenerated.\n"));
   puts(_("%sis scalable with a suffix: k/K/m/M/g/G/t/T\n"));
 #line 77 "../numeric.c"
   puts(_("%sless than or equal to %ld"));
-#line 390 "../usage.c"
+#line 393 "../usage.c"
   puts(_("Operands and options may be intermixed.  They will be reordered.\n"));
-#line 652 "../usage.c"
-  puts(_("requires the option '%s'\n"));
 #line 655 "../usage.c"
+  puts(_("requires the option '%s'\n"));
+#line 658 "../usage.c"
   puts(_("requires these options:\n"));
-#line 1321 "../usage.c"
+#line 1324 "../usage.c"
   puts(_("   Arg Option-Name   Req?  Description\n"));
-#line 1315 "../usage.c"
+#line 1318 "../usage.c"
   puts(_("  Flg Arg Option-Name   Req?  Description\n"));
-#line 167 "../enum.c"
+#line 168 "../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 913 "../usage.c"
   puts(_("\t\t\t\t- may appear up to %d times\n"));
 #line 77 "../enum.c"
   puts(_("The valid \"%s\" option keywords are:\n"));
-#line 1152 "../usage.c"
+#line 1155 "../usage.c"
   puts(_("The next option supports vendor supported extra options:"));
-#line 773 "../usage.c"
+#line 776 "../usage.c"
   puts(_("These additional options are:"));
   /* END-USAGE-TEXT */
 }

+ 2 - 2
libopts/genshell.h

@@ -6,7 +6,7 @@
  *  From the definitions    genshell.def
  *  and the template file   options
  *
- * Generated from AutoOpts 41:0:16 templates.
+ * Generated from AutoOpts 41:1:16 templates.
  *
  *  AutoOpts is a copyrighted work.  This header file is not encumbered
  *  by AutoOpts licensing, but is provided under the licensing terms chosen
@@ -55,7 +55,7 @@
  *  tolerable version is at least as old as what was current when the header
  *  template was released.
  */
-#define AO_TEMPLATE_VERSION 167936
+#define AO_TEMPLATE_VERSION 167937
 #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
  || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
 # error option template version mismatches autoopts/options.h header

+ 7 - 3
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-2014 Free Software
+   Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2016 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
@@ -225,15 +225,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 +273,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);

+ 4 - 8
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-2014 by Bruce Korb - all rights reserved
+ *  AutoOpts is Copyright (C) 1992-2016 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
@@ -69,7 +69,7 @@ validate_struct(tOptions * opts, char const * pname)
          */
         if ((opts->fOptSet & OPTPROC_NO_XLAT_MASK) == OPTPROC_NXLAT_OPT)
             opts->fOptSet |= OPTPROC_NXLAT_OPT_CFG;
-        (*opts->pTransProc)();
+        opts->pTransProc();
     }
 
     /*
@@ -81,10 +81,6 @@ validate_struct(tOptions * opts, char const * pname)
        && (  (opts->structVersion > OPTIONS_STRUCT_VERSION  )
           || (opts->structVersion < OPTIONS_MINIMUM_VERSION )
        )  )  {
-
-        static char const ao_ver_string[] =
-            STR(AO_CURRENT)":"STR(AO_REVISION)":"STR(AO_AGE)"\n";
-
         fprintf(stderr, zwrong_ver, pname, NUM_TO_VER(opts->structVersion));
         if (opts->structVersion > OPTIONS_STRUCT_VERSION )
             fputs(ztoo_new, stderr);
@@ -111,9 +107,9 @@ validate_struct(tOptions * opts, char const * pname)
 
         pz = pathfind(getenv("PATH"), (char *)pname, "rx");
         if (pz != NULL)
-            pname = (void *)pz;
+            pname = VOIDP(pz);
 
-        pp  = (char const **)(void **)&(opts->pzProgPath);
+        pp  = (char const **)VOIDP(&(opts->pzProgPath));
         *pp = pname;
 
         /*

+ 134 - 44
libopts/intprops.h

@@ -1,10 +1,10 @@
 /* intprops.h -- properties of integer types
 
-   Copyright (C) 2001-2005, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2001-2016 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,8 +22,7 @@
 
 #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
@@ -37,37 +36,18 @@
    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 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                                                        \
@@ -76,18 +56,18 @@
 /* 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)
 
 
-/* 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__ \
      || (0x5110 <= __SUNPRO_C && !__STDC__))
@@ -263,22 +243,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 +274,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,
@@ -317,4 +307,104 @@
                       _GL_INT_MINIMUM (0 * (b) + (a)),          \
                       _GL_INT_MAXIMUM (0 * (b) + (a)))
 
+/* Compute A + B, A - B, A * B, respectively, storing the result 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)
+
+#ifndef __has_builtin
+# define __has_builtin(x) 0
+#endif
+
+/* 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 A <op> B into *R, where OP specifies the operation.
+   BUILTIN is the builtin operation, and OVERFLOW the overflow predicate.
+   See above for restrictions.  */
+#if 5 <= __GNUC__ || __has_builtin (__builtin_add_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 char, \
+                        signed char, SCHAR_MIN, SCHAR_MAX), \
+     short int: \
+       _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned short 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 char, \
+                       signed char, SCHAR_MIN, SCHAR_MAX) \
+    : sizeof *(r) == sizeof (short int) \
+    ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned short 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 extremal values TMIN and
+   TMAX.  T must be a signed integer type.  */
+#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, tmin, tmax), 1) \
+   : (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t, tmin, tmax), 0))
+
+/* Return A <op> B, where the operation is given by OP.  Use the
+   unsigned type UT for calculation to avoid overflow problems.
+   Convert the result to type T without overflow by subtracting TMIN
+   from large values before converting, and adding it afterwards.
+   Compilers can optimize all the operations except OP.  */
+#define _GL_INT_OP_WRAPV_VIA_UNSIGNED(a, b, op, ut, t, tmin, tmax) \
+  (((ut) (a) op (ut) (b)) <= (tmax) \
+   ? (t) ((ut) (a) op (ut) (b)) \
+   : ((t) (((ut) (a) op (ut) (b)) - (tmin)) + (tmin)))
+
 #endif /* _GL_INTPROPS_H */

+ 2 - 0
libopts/libopts.c

@@ -2,6 +2,8 @@
 #include "autoopts/project.h"
 #define  LOCAL static
 #include "ao-strs.h"
+static char const ao_ver_string[] =
+    "41:1:16\n";
 #include "autoopts/options.h"
 #include "autoopts/usage-txt.h"
 #include "genshell.h"

+ 31 - 21
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-2014 by Bruce Korb - all rights reserved
+ *  AutoOpts is Copyright (C) 1992-2016 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
@@ -94,10 +94,10 @@ get_realpath(char * buf, size_t b_sz)
  * private:
  *
  * what:  translate and construct a path
- * arg:   + char*       + p_buf     + The result buffer +
- * arg:   + int         + b_sz      + The size of this buffer +
- * arg:   + char const* + fname     + The input name +
- * arg:   + char const* + prg_path  + The full path of the current program +
+ * arg:   + char *       + p_buf     + The result buffer +
+ * arg:   + int          + b_sz      + The size of this buffer +
+ * arg:   + char const * + fname     + The input name +
+ * arg:   + char const * + prg_path  + The full path of the current program +
  *
  * ret-type: bool
  * ret-desc: true if the name was handled, otherwise false.
@@ -207,6 +207,8 @@ add_prog_path(char * buf, int b_sz, char const * fname, char const * prg_path)
     char const *   path;
     char const *   pz;
     int     skip = 2;
+    size_t  fname_len;
+    size_t  dir_len;  //!< length of the directory portion of the path to the exe
 
     switch (fname[2]) {
     case DIRCH:
@@ -225,7 +227,7 @@ add_prog_path(char * buf, int b_sz, char const * fname, char const * prg_path)
     if (strchr(prg_path, DIRCH) != NULL)
         path = prg_path;
     else {
-        path = pathfind(getenv("PATH"), (char*)prg_path, "rx");
+        path = pathfind(getenv("PATH"), (char *)prg_path, "rx");
 
         if (path == NULL)
             return false;
@@ -240,17 +242,19 @@ add_prog_path(char * buf, int b_sz, char const * fname, char const * prg_path)
     if (pz == NULL)
         return false;
 
-    fname += skip;
+    fname    += skip;
+    fname_len = strlen(fname) + 1; // + NUL byte
+    dir_len   = (pz - path) + 1;   // + dir sep character
 
     /*
      *  Concatenate the file name to the end of the executable path.
      *  The result may be either a file or a directory.
      */
-    if ((unsigned)(pz - path) + 1 + strlen(fname) >= (unsigned)b_sz)
+    if (dir_len + fname_len > (unsigned)b_sz)
         return false;
 
-    memcpy(buf, path, (size_t)((pz - path)+1));
-    strcpy(buf + (pz - path) + 1, fname);
+    memcpy(buf, path, dir_len);
+    memcpy(buf + dir_len, fname, fname_len);
 
     /*
      *  If the "path" path was gotten from "pathfind()", then it was
@@ -289,10 +293,16 @@ add_env_val(char * buf, int buf_sz, char const * name)
     if (dir_part == NULL)
         return false;
 
-    if (strlen(dir_part) + 1 + strlen(name) >= (unsigned)buf_sz)
-        return false;
+    {
+        size_t dir_len = strlen(dir_part);
+        size_t nm_len  = strlen(name) + 1;
+        
+        if (dir_len + nm_len >= (unsigned)buf_sz)
+            return false;
+        memcpy(buf, dir_part, dir_len);
+        memcpy(buf + dir_len, name, nm_len);
+    }
 
-    sprintf(buf, "%s%s", dir_part, name);
     return true;
 }
 
@@ -307,7 +317,7 @@ add_env_val(char * buf, int buf_sz, char const * name)
 LOCAL void
 munge_str(char * txt, tOptionLoadMode mode)
 {
-    char * pzE;
+    char * end;
 
     if (mode == OPTION_LOAD_KEEP)
         return;
@@ -316,13 +326,13 @@ munge_str(char * txt, tOptionLoadMode mode)
         char * src = SPN_WHITESPACE_CHARS(txt+1);
         size_t l   = strlen(src) + 1;
         memmove(txt, src, l);
-        pzE = txt + l - 1;
+        end = txt + l - 1;
 
     } else
-        pzE = txt + strlen(txt);
+        end = txt + strlen(txt);
 
-    pzE  = SPN_WHITESPACE_BACK(txt, pzE);
-    *pzE = NUL;
+    end  = SPN_WHITESPACE_BACK(txt, end);
+    *end = NUL;
 
     if (mode == OPTION_LOAD_UNCOOKED)
         return;
@@ -333,7 +343,7 @@ munge_str(char * txt, tOptionLoadMode mode)
     case '\'': break;
     }
 
-    switch (pzE[-1]) {
+    switch (end[-1]) {
     default: return;
     case '"':
     case '\'': break;
@@ -544,8 +554,8 @@ load_opt_line(tOptions * opts, tOptState * opt_state, char * line,
  *
  * what:  process a string for an option name and value
  *
- * arg:   tOptions*,   opts,  program options descriptor
- * arg:   char const*, line,  NUL-terminated text
+ * arg:   tOptions *,   opts,  program options descriptor
+ * arg:   char const *, line,  NUL-terminated text
  *
  * doc:
  *

+ 27 - 27
libopts/m4/libopts.m4

@@ -97,10 +97,10 @@ AC_DEFUN([INVOKE_LIBOPTS_MACROS_FIRST],[
   ])
   AC_CHECK_TYPES([int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t,
   intptr_t, uintptr_t, uint_t, pid_t, size_t, ptrdiff_t])
-  AC_CHECK_SIZEOF(char*, 8)
-  AC_CHECK_SIZEOF(int,   4)
-  AC_CHECK_SIZEOF(long,  8)
-  AC_CHECK_SIZEOF(short, 2)
+  AC_CHECK_SIZEOF(char *, 8)
+  AC_CHECK_SIZEOF(int,    4)
+  AC_CHECK_SIZEOF(long,   8)
+  AC_CHECK_SIZEOF(short,  2)
 
   # ------------
   # AC_CHECK_LIB
@@ -189,14 +189,14 @@ AC_DEFUN([LIBOPTS_WITHLIB_REGEX],[
   Xyes|Xno|X )
     case "X${libopts_cv_with_libregex_root}" in
     Xyes|Xno|X ) libopts_cv_with_libregex_cflags=no ;;
-    * )        libopts_cv_with_libregex_cflags=-I${libopts_cv_with_libregex_root}/include ;;
+    * ) libopts_cv_with_libregex_cflags=-I${libopts_cv_with_libregex_root}/include ;;
     esac
   esac
   case "X${libopts_cv_with_libregex_libs}" in
   Xyes|Xno|X )
     case "X${libopts_cv_with_libregex_root}" in
     Xyes|Xno|X ) libopts_cv_with_libregex_libs=no ;;
-    * )        libopts_cv_with_libregex_libs="-L${libopts_cv_with_libregex_root}/lib -lregex";;
+    * )        libopts_cv_with_libregex_libs="-L${libopts_cv_with_libregex_root}/lib -lregex" ;;
     esac
   esac
   libopts_save_CPPFLAGS="${CPPFLAGS}"
@@ -216,12 +216,12 @@ AC_DEFUN([LIBOPTS_WITHLIB_REGEX],[
   LIBREGEX_LIBS=""
   AC_MSG_CHECKING([whether libregex functions properly])
   AC_CACHE_VAL([libopts_cv_with_libregex],[
-  AC_RUN_IFELSE([@%:@include <stdio.h>
+  AC_RUN_IFELSE([AC_LANG_SOURCE([@%:@include <stdio.h>
 @%:@include <stdlib.h>
 @%:@include <sys/types.h>
 @%:@include REGEX_HEADER
 static regex_t re;
-void comp_re( char const* pzPat ) {
+void comp_re(char const * pzPat) {
   int res = regcomp( &re, pzPat, REG_EXTENDED|REG_ICASE|REG_NEWLINE );
   if (res == 0) return;
   exit( res ); }
@@ -235,7 +235,7 @@ 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 
   ]) # end of AC_CACHE_VAL for libopts_cv_with_libregex
@@ -260,12 +260,12 @@ libopts_cv_with_libregex=no
 AC_DEFUN([LIBOPTS_RUN_PATHFIND],[
   AC_MSG_CHECKING([whether pathfind(3) works])
   AC_CACHE_VAL([libopts_cv_run_pathfind],[
-  AC_RUN_IFELSE([@%:@include <string.h>
+  AC_RUN_IFELSE([AC_LANG_SOURCE([@%:@include <string.h>
 @%:@include <stdlib.h>
-int main (int argc, char** argv) {
-   char* pz = pathfind( getenv( "PATH" ), "sh", "x" );
+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
@@ -303,9 +303,9 @@ echo ${dzero}`
 AC_DEFUN([LIBOPTS_RUN_REALPATH],[
   AC_MSG_CHECKING([whether we have a functional realpath(3C)])
   AC_CACHE_VAL([libopts_cv_run_realpath],[
-  AC_RUN_IFELSE([@%:@include <limits.h>
+  AC_RUN_IFELSE([AC_LANG_SOURCE([@%:@include <limits.h>
 @%:@include <stdlib.h>
-int main (int argc, char** argv) {
+int main (int argc, char ** argv) {
 @%:@ifndef PATH_MAX
 choke me!!
 @%:@else
@@ -313,7 +313,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
@@ -330,7 +330,7 @@ choke me!!
 AC_DEFUN([LIBOPTS_RUN_STRFTIME],[
   AC_MSG_CHECKING([whether strftime() works])
   AC_CACHE_VAL([libopts_cv_run_strftime],[
-  AC_RUN_IFELSE([@%:@include <time.h>
+  AC_RUN_IFELSE([AC_LANG_SOURCE([@%:@include <time.h>
 @%:@include <string.h>
 char t_buf@<:@ 64 @:>@;
 int main() {
@@ -346,7 +346,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
@@ -363,10 +363,10 @@ int main() {
 AC_DEFUN([LIBOPTS_RUN_FOPEN_BINARY],[
   AC_MSG_CHECKING([whether fopen accepts "b" mode])
   AC_CACHE_VAL([libopts_cv_run_fopen_binary],[
-  AC_RUN_IFELSE([@%:@include <stdio.h>
-int main (int argc, char** argv) {
-FILE* fp = fopen("conftest.@S|@ac_ext", "rb");
-return (fp == NULL) ? 1 : fclose(fp); }],
+  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); }])],
     [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
@@ -386,10 +386,10 @@ return (fp == NULL) ? 1 : fclose(fp); }],
 AC_DEFUN([LIBOPTS_RUN_FOPEN_TEXT],[
   AC_MSG_CHECKING([whether fopen accepts "t" mode])
   AC_CACHE_VAL([libopts_cv_run_fopen_text],[
-  AC_RUN_IFELSE([@%:@include <stdio.h>
-int main (int argc, char** argv) {
-FILE* fp = fopen("conftest.@S|@ac_ext", "rt");
-return (fp == NULL) ? 1 : fclose(fp); }],
+  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); }])],
     [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 +461,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-2014 by Bruce Korb - all rights reserved
+dnl  AutoGen Copyright (C) 1992-2015 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

+ 1 - 1
libopts/m4/liboptschk.m4

@@ -1,5 +1,5 @@
 # liboptschk.m4 serial 2 (autogen - 5.11.4)
-dnl Copyright (C) 2005-2014 by Bruce Korb - all rights reserved
+dnl Copyright (C) 2005-2015 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,

+ 1 - 1
libopts/m4/stdnoreturn.m4

@@ -1,6 +1,6 @@
 # Check for stdnoreturn.h that conforms to C11.
 
-dnl Copyright 2012-2014 Free Software Foundation, Inc.
+dnl Copyright 2012-2016 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.

+ 19 - 14
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-2014 by Bruce Korb - all rights reserved
+ *  AutoOpts is Copyright (C) 1992-2016 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,6 +30,11 @@
  *  13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239  COPYING.mbsd
  */
 
+ static inline unsigned char to_uchar (char ch) { return ch; }
+
+#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);
@@ -101,7 +106,7 @@ fserr_exit(char const * prog, char const * op, char const * fname)
  * private:
  *
  * what:  Decipher a boolean value
- * arg:   + tOptions* + pOpts    + program options descriptor +
+ * arg:   + tOptions * + pOpts    + program options descriptor +
  *
  * doc:
  *  Emit a shell script that will parse the command line options.
@@ -400,9 +405,9 @@ emit_usage(tOptions * opts)
                 break;
         }
 
-        pp  = (char **)(void *)&(opts->pzProgPath);
+        pp  = VOIDP(&(opts->pzProgPath));
         *pp = tm_nm_buf;
-        pp  = (char **)(void *)&(opts->pzProgName);
+        pp  = VOIDP(&(opts->pzProgName));
         *pp = tm_nm_buf;
     }
 
@@ -410,8 +415,8 @@ emit_usage(tOptions * opts)
     text_to_var(opts, TT_USAGE,     NULL);
 
     {
-        tOptDesc* pOptDesc = opts->pOptDesc;
-        int       optionCt = opts->optCt;
+        tOptDesc * pOptDesc = opts->pOptDesc;
+        int        optionCt = opts->optCt;
 
         for (;;) {
             if (pOptDesc->pOptProc == optionPrintVersion) {
@@ -601,8 +606,8 @@ emit_inaction(tOptions * opts, tOptDesc * od)
 static void
 emit_flag(tOptions * opts)
 {
-    tOptDesc* od = opts->pOptDesc;
-    int       opt_ct = opts->optCt;
+    tOptDesc * od = opts->pOptDesc;
+    int        opt_ct = opts->optCt;
 
     fputs(zOptionCase, stdout);
 
@@ -653,7 +658,7 @@ emit_match_expr(char const * name, tOptDesc * cod, tOptions * opts)
              *  They must not be the same.  They cannot be, because it would
              *  not compile correctly if they were.
              */
-            while (toupper(od->pz_Name[match_ct]) == toupper(name[match_ct]))
+            while (UPPER(od->pz_Name[match_ct]) == UPPER(name[match_ct]))
                 match_ct++;
 
             if (match_ct > min_match_ct)
@@ -772,7 +777,7 @@ load_old_output(char const * fname, char const * pname)
      *  Read in all the data as fast as our OS will let us.
      */
     for (;;) {
-        size_t inct = fread((void*)scan, 1, (size_t)stbf.st_size, fp);
+        size_t inct = fread(VOIDP(scan), 1, (size_t)stbf.st_size, fp);
         if (inct == 0)
             break;
 
@@ -845,8 +850,8 @@ open_out(char const * fname, char const * pname)
  * private:
  * what: The usage function for the genshellopt generated program
  *
- * arg:  + tOptions* + opts    + program options descriptor +
- * arg:  + int       + exit_cd + usage text type to produce +
+ * arg:  + tOptions * + opts    + program options descriptor +
+ * arg:  + int        + exit_cd + usage text type to produce +
  *
  * doc:
  *  This function is used to create the usage strings for the option
@@ -901,11 +906,11 @@ genshelloptUsage(tOptions * opts, int exit_cd)
      */
     {
         char *  pz;
-        char ** pp = (char **)(void *)&(optionParseShellOptions->pzProgName);
+        char ** pp = VOIDP(&(optionParseShellOptions->pzProgName));
         AGDUPSTR(pz, optionParseShellOptions->pzPROGNAME, "prog name");
         *pp = pz;
         while (*pz != NUL) {
-            *pz = (char)tolower(*pz);
+            *pz = (char)LOWER(*pz);
             pz++;
         }
     }

+ 50 - 39
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-2014 by Bruce Korb - all rights reserved
+ *  AutoOpts is Copyright (C) 1992-2016 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
@@ -53,8 +53,8 @@ static xml_xlate_t const xml_xlate[] = {
 static void
 remove_continuation(char * src);
 
-static char const*
-scan_q_str(char const* pzTxt);
+static char const *
+scan_q_str(char const * pzTxt);
 
 static tOptionValue *
 add_string(void ** pp, char const * name, size_t nm_len,
@@ -64,11 +64,11 @@ static tOptionValue *
 add_bool(void ** pp, char const * name, size_t nm_len,
          char const * val, size_t d_len);
 
-static tOptionValue*
+static tOptionValue *
 add_number(void ** pp, char const * name, size_t nm_len,
            char const * val, size_t d_len);
 
-static tOptionValue*
+static tOptionValue *
 add_nested(void ** pp, char const * name, size_t nm_len,
            char * val, size_t d_len);
 
@@ -98,7 +98,7 @@ sort_list(tArgList * arg_list);
 static void
 remove_continuation(char * src)
 {
-    char* pzD;
+    char * pzD;
 
     do  {
         while (*src == NL)  src++;
@@ -133,8 +133,8 @@ remove_continuation(char * src)
 /**
  *  Find the end of a quoted string, skipping escaped quote characters.
  */
-static char const*
-scan_q_str(char const* pzTxt)
+static char const *
+scan_q_str(char const * pzTxt)
 {
     char q = *(pzTxt++); /* remember the type of quote */
 
@@ -182,7 +182,7 @@ static tOptionValue *
 add_string(void ** pp, char const * name, size_t nm_len,
            char const * val, size_t d_len)
 {
-    tOptionValue* pNV;
+    tOptionValue * pNV;
     size_t sz = nm_len + d_len + sizeof(*pNV);
 
     pNV = AGALOC(sz, "option name/str value pair");
@@ -254,7 +254,7 @@ add_bool(void ** pp, char const * name, size_t nm_len,
     else new_val->v.boolVal = ! IS_FALSE_TYPE_CHAR(*val);
 
     new_val->valType = OPARG_TYPE_BOOLEAN;
-    new_val->pzName = (char*)(new_val + 1);
+    new_val->pzName = (char *)(new_val + 1);
     memcpy(new_val->pzName, name, nm_len);
     new_val->pzName[ nm_len ] = NUL;
     addArgListEntry(pp, new_val);
@@ -272,7 +272,7 @@ add_bool(void ** pp, char const * name, size_t nm_len,
  *
  * @returns the new value structure
  */
-static tOptionValue*
+static tOptionValue *
 add_number(void ** pp, char const * name, size_t nm_len,
            char const * val, size_t d_len)
 {
@@ -291,7 +291,7 @@ add_number(void ** pp, char const * name, size_t nm_len,
         new_val->v.longVal = strtol(val, 0, 0);
 
     new_val->valType = OPARG_TYPE_NUMERIC;
-    new_val->pzName  = (char*)(new_val + 1);
+    new_val->pzName  = (char *)(new_val + 1);
     memcpy(new_val->pzName, name, nm_len);
     new_val->pzName[ nm_len ] = NUL;
     addArgListEntry(pp, new_val);
@@ -309,18 +309,18 @@ add_number(void ** pp, char const * name, size_t nm_len,
  *
  * @returns the new value structure
  */
-static tOptionValue*
+static tOptionValue *
 add_nested(void ** pp, char const * name, size_t nm_len,
            char * val, size_t d_len)
 {
-    tOptionValue* new_val;
+    tOptionValue * new_val;
 
     if (d_len == 0) {
         size_t sz = nm_len + sizeof(*new_val) + 1;
         new_val = AGALOC(sz, "empty nest");
         new_val->v.nestVal = NULL;
         new_val->valType = OPARG_TYPE_HIERARCHY;
-        new_val->pzName = (char*)(new_val + 1);
+        new_val->pzName = (char *)(new_val + 1);
         memcpy(new_val->pzName, name, nm_len);
         new_val->pzName[ nm_len ] = NUL;
 
@@ -341,11 +341,11 @@ add_nested(void ** pp, char const * name, size_t nm_len,
 static char const *
 scan_name(char const * name, tOptionValue * res)
 {
-    tOptionValue* new_val;
-    char const * pzScan;
-    char const * pzVal;
-    size_t       nm_len = 1;
-    size_t       d_len = 0;
+    tOptionValue * new_val;
+    char const *   pzScan = name+1; /* we know first char is a name char */
+    char const *   pzVal;
+    size_t         nm_len = 1;
+    size_t         d_len = 0;
 
     /*
      *  Scan over characters that name a value.  These names may not end
@@ -645,13 +645,13 @@ unload_arg_list(tArgList * arg_list)
     char const ** pnew_val = arg_list->apzArgs;
 
     while (ct-- > 0) {
-        tOptionValue* new_val = (tOptionValue*)(void*)*(pnew_val++);
+        tOptionValue * new_val = (tOptionValue *)VOIDP(*(pnew_val++));
         if (new_val->valType == OPARG_TYPE_HIERARCHY)
             unload_arg_list(new_val->v.nestVal);
         AGFREE(new_val);
     }
 
-    AGFREE((void*)arg_list);
+    AGFREE(arg_list);
 }
 
 /*=export_func  optionUnloadNested
@@ -675,7 +675,7 @@ optionUnloadNested(tOptionValue const * opt_val)
 
     unload_arg_list(opt_val->v.nestVal);
 
-    AGFREE((void*)opt_val);
+    AGFREE(opt_val);
 }
 
 /**
@@ -703,8 +703,8 @@ sort_list(tArgList * arg_list)
          *  "-1" entry.
          */
         while (strcmp(old_v->pzName, new_v->pzName) > 0) {
-            arg_list->apzArgs[iy+1] = (void*)old_v;
-            old_v = (tOptionValue*)(void*)(arg_list->apzArgs[--iy]);
+            arg_list->apzArgs[iy+1] = VOIDP(old_v);
+            old_v = (tOptionValue *)VOIDP(arg_list->apzArgs[--iy]);
             if (iy < 0)
                 break;
         }
@@ -713,7 +713,7 @@ sort_list(tArgList * arg_list)
          *  Always store the pointer.  Sometimes it is redundant,
          *  but the redundancy is cheaper than a test and branch sequence.
          */
-        arg_list->apzArgs[iy+1] = (void*)new_v;
+        arg_list->apzArgs[iy+1] = VOIDP(new_v);
     }
 }
 
@@ -725,7 +725,7 @@ sort_list(tArgList * arg_list)
  * arg:   + char const * + pzName + the name for the text +
  * arg:   + size_t       + nm_len + the length of "name"  +
  *
- * ret_type:  tOptionValue*
+ * ret_type:  tOptionValue *
  * ret_desc:  An allocated, compound value structure
  *
  * doc:
@@ -746,7 +746,7 @@ sort_list(tArgList * arg_list)
 LOCAL tOptionValue *
 optionLoadNested(char const * text, char const * name, size_t nm_len)
 {
-    tOptionValue* res_val;
+    tOptionValue * res_val;
 
     /*
      *  Make sure we have some data and we have space to put what we find.
@@ -762,7 +762,7 @@ optionLoadNested(char const * text, char const * name, size_t nm_len)
     }
     res_val = AGALOC(sizeof(*res_val) + nm_len + 1, "nest args");
     res_val->valType = OPARG_TYPE_HIERARCHY;
-    res_val->pzName  = (char*)(res_val + 1);
+    res_val->pzName  = (char *)(res_val + 1);
     memcpy(res_val->pzName, name, nm_len);
     res_val->pzName[nm_len] = NUL;
 
@@ -783,12 +783,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:;
 
@@ -814,8 +825,8 @@ optionLoadNested(char const * text, char const * name, size_t nm_len)
  * private:
  *
  * what:  parse a hierarchical option argument
- * arg:   + tOptions* + opts + program options descriptor +
- * arg:   + tOptDesc* + od   + the descriptor for this arg +
+ * arg:   + tOptions * + opts + program options descriptor +
+ * arg:   + tOptDesc * + od   + the descriptor for this arg +
  *
  * doc:
  *  Nested value was found on the command line
@@ -837,7 +848,7 @@ optionNestedVal(tOptions * opts, tOptDesc * od)
         av = arg_list->apzArgs;
 
         while (--ct >= 0) {
-            void * p = (void *)*(av++);
+            void * p = VOIDP(*(av++));
             optionUnloadNested((tOptionValue const *)p);
         }
 
@@ -848,7 +859,7 @@ optionNestedVal(tOptions * opts, tOptDesc * od)
             od->optArg.argString, od->pz_Name, strlen(od->pz_Name));
 
         if (opt_val != NULL)
-            addArgListEntry(&(od->optCookie), (void*)opt_val);
+            addArgListEntry(&(od->optCookie), VOIDP(opt_val));
     }
 }
 

+ 12 - 10
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-2014 by Bruce Korb - all rights reserved
+ *  AutoOpts is Copyright (C) 1992-2016 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,10 +33,10 @@
  * private:
  *
  * what:  Show info about range constraints
- * arg:   + tOptions* + pOpts     + program options descriptor  +
- * arg:   + tOptDesc* + pOptDesc  + the descriptor for this arg +
- * arg:   + void *    + rng_table + the value range tables      +
- * arg:   + int       + rng_count + the number of entries       +
+ * arg:   + tOptions * + pOpts     + program options descriptor  +
+ * arg:   + tOptDesc * + pOptDesc  + the descriptor for this arg +
+ * arg:   + void *     + rng_table + the value range tables      +
+ * arg:   + int        + rng_count + the number of entries       +
  *
  * doc:
  *   Show information about a numeric option with range constraints.
@@ -55,6 +55,7 @@ optionShowRange(tOptions * pOpts, tOptDesc * pOD, void * rng_table, int rng_ct)
     if (pOpts != OPTPROC_EMIT_USAGE) {
         if (pOpts <= OPTPROC_EMIT_LIMIT)
             return;
+        pz_indent = ONE_TAB_STR;
 
         fprintf(option_usage_fp, zRangeErr, pOpts->pzProgName,
                 pOD->pz_Name, pOD->optArg.argInt);
@@ -96,8 +97,8 @@ optionShowRange(tOptions * pOpts, tOptDesc * pOD, void * rng_table, int rng_ct)
  * private:
  *
  * what:  process an option with a numeric value.
- * arg:   + tOptions* + opts + program options descriptor +
- * arg:   + tOptDesc* + od   + the descriptor for this arg +
+ * arg:   + tOptions * + opts + program options descriptor +
+ * arg:   + tOptDesc * + od   + the descriptor for this arg +
  *
  * doc:
  *  Decipher a numeric value.
@@ -105,8 +106,8 @@ optionShowRange(tOptions * pOpts, tOptDesc * pOD, void * rng_table, int rng_ct)
 void
 optionNumericVal(tOptions * opts, tOptDesc * od)
 {
-    char* pz;
-    long  val;
+    char * pz;
+    long   val;
 
     /*
      *  Guard against all the different ways this procedure might get invoked
@@ -123,7 +124,8 @@ optionNumericVal(tOptions * opts, tOptDesc * od)
      */
     if (  (od == NULL)
        || (od->optArg.argString == NULL)
-       || ((od->fOptState & OPTST_RESET) != 0))
+       || ((od->fOptState & OPTST_RESET) != 0)
+       || (opts <= OPTPROC_EMIT_LIMIT))
         return;
 
     errno = 0;

+ 1 - 1
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.3 */
+/* ANSI-C code produced by gperf version 3.0.4 */
 /* Command-line: gperf option-value-type.gp  */
 /* Computed positions: -k'1' */
 

+ 1 - 1
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.3 */
+/* ANSI-C code produced by gperf version 3.0.4 */
 /* Command-line: gperf option-xat-attribute.gp  */
 /* Computed positions: -k'1' */
 

+ 3 - 3
libopts/parse-duration.c

@@ -1,5 +1,5 @@
 /* Parse a time duration and return a seconds count
-   Copyright (C) 2008-2014 Free Software Foundation, Inc.
+   Copyright (C) 2008-2016 Free Software Foundation, Inc.
    Written by Bruce Korb <bkorb@gnu.org>, 2008.
 
    This program is free software: you can redistribute it and/or modify
@@ -83,14 +83,14 @@ scale_n_add (time_t base, time_t val, int scale)
       return BAD_TIME;
     }
 
-  if (val >= MAX_DURATION / scale)
+  if (val > MAX_DURATION / scale)
     {
       errno = ERANGE;
       return BAD_TIME;
     }
 
   val *= scale;
-  if ((base + val) >= MAX_DURATION)
+  if (base > MAX_DURATION - val)
     {
       errno = ERANGE;
       return BAD_TIME;

+ 1 - 1
libopts/parse-duration.h

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

+ 5 - 5
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-2014 by Bruce Korb - all rights reserved
+ *  AutoOpts is Copyright (C) 1992-2016 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,7 +33,7 @@
  */
 
 #if defined(HAVE_WORKING_FORK)
-static FILE *
+static inline FILE *
 open_tmp_usage(char ** buf)
 {
     char * bf;
@@ -64,7 +64,7 @@ open_tmp_usage(char ** buf)
     }
 }
 
-static char *
+static inline char *
 mk_pager_cmd(char const * fname)
 {
     /*
@@ -85,10 +85,10 @@ mk_pager_cmd(char const * fname)
         if (pager == NULL)
             pager = MORE_STR;
 
-        bfsz = strlen(fname) + strlen(pager) + PAGE_USAGE_FMT_LEN;
+        bfsz = 2 * strlen(fname) + strlen(pager) + PAGE_USAGE_FMT_LEN;
         res  = AGALOC(bfsz, "more cmd");
         snprintf(res, bfsz, PAGE_USAGE_FMT, pager, fname);
-        AGFREE((void*)fname);
+        AGFREE(fname);
         return res;
     }
 }

+ 2 - 2
libopts/proto.h

@@ -1,7 +1,7 @@
 /* -*- buffer-read-only: t -*- vi: set ro:
  *
  * Prototypes for autoopts
- * Generated Sat Aug 30 10:36:38 PDT 2014
+ * Generated Mon Aug 29 14:35:37 PDT 2016
  */
 #ifndef AUTOOPTS_PROTO_H_GUARD
 #define AUTOOPTS_PROTO_H_GUARD 1
@@ -65,7 +65,7 @@ static tSuccess
 opt_find_long(tOptions * opts, char const * opt_name, tOptState * state);
 
 static tSuccess
-opt_find_short(tOptions* pOpts, uint_t optValue, tOptState* pOptState);
+opt_find_short(tOptions * pOpts, uint_t optValue, tOptState * pOptState);
 
 static tSuccess
 get_opt_arg(tOptions * opts, tOptState * o_st);

+ 19 - 12
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-2014 by Bruce Korb - all rights reserved
+ *  AutoOpts is Copyright (C) 1992-2016 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
@@ -129,8 +129,10 @@ char const *
 optionQuoteString(char const * text, char const * nl)
 {
     size_t   nl_len = strlen(nl);
+    size_t   out_sz = string_size(text, nl_len);
     char *   out;
-    char *   res = out = AGALOC(string_size(text, nl_len), "quot str");
+    char *   res    = out = AGALOC(out_sz, "quot str");
+
     *(out++) = '"';
 
     for (;;) {
@@ -179,16 +181,21 @@ optionQuoteString(char const * text, char const * nl)
              *  deallocate the text string.  Return the scan resumption point.
              */
             *(out++) = '"';
-            *out = NUL;
+            *(out++) = NUL;
+#ifndef NDEBUG
+            if ((size_t)(out - res) > out_sz) {
+                fputs(misguess_len, stderr);
+                option_exits(EXIT_FAILURE);
+            }
+#endif
             return res;
 
         default:
             /*
              *  sprintf is safe here, because we already computed
-             *  the amount of space we will be using.
+             *  the amount of space we will be using.  Assertion is above.
              */
-            sprintf(out, MK_STR_OCT_FMT, ch);
-            out += 4;
+            out += sprintf(out, MK_STR_OCT_FMT, ch);
         }
 
         text++;
@@ -296,7 +303,7 @@ print_membership(tOptions * pOpts, tOptDesc * pOD)
     uintptr_t val = 1;
     printf(zOptNumFmt, pOpts->pzPROGNAME, pOD->pz_NAME,
            (int)(uintptr_t)(pOD->optCookie));
-    pOD->optCookie = (void*)(uintptr_t)~0UL;
+    pOD->optCookie = VOIDP(~0UL);
     (*(pOD->pOptProc))(OPTPROC_RETURN_VALNAME, pOD);
 
     pz = pOD->optArg.argString;
@@ -323,7 +330,7 @@ print_membership(tOptions * pOpts, tOptDesc * pOD)
 static void
 print_stacked_arg(tOptions * pOpts, tOptDesc * pOD)
 {
-    tArgList*       pAL = (tArgList*)pOD->optCookie;
+    tArgList *      pAL = (tArgList *)pOD->optCookie;
     char const **   ppz = pAL->apzArgs;
     int             ct  = pAL->useCt;
 
@@ -363,19 +370,19 @@ print_reordering(tOptions * opts)
 /*=export_func  optionPutShell
  * what:  write a portable shell script to parse options
  * private:
- * arg:   tOptions*, pOpts, the program options descriptor
+ * arg:   tOptions *, pOpts, the program options descriptor
  * doc:   This routine will emit portable shell script text for parsing
  *        the options described in the option definitions.
 =*/
 void
-optionPutShell(tOptions* pOpts)
+optionPutShell(tOptions * pOpts)
 {
     int  optIx = 0;
 
     printf(zOptCtFmt, pOpts->curOptIdx-1);
 
     do  {
-        tOptDesc* pOD = pOpts->pOptDesc + optIx;
+        tOptDesc * pOD = pOpts->pOptDesc + optIx;
 
         if ((pOD->fOptState & OPTST_NO_OUTPUT_MASK) != 0)
             continue;
@@ -396,7 +403,7 @@ optionPutShell(tOptions* pOpts)
          *  but copy over the set-state bits.
          */
         if (pOD->optActualIndex != optIx) {
-            tOptDesc* p   = pOpts->pOptDesc + pOD->optActualIndex;
+            tOptDesc * p  = pOpts->pOptDesc + pOD->optActualIndex;
             p->optArg     = pOD->optArg;
             p->fOptState &= OPTST_PERSISTENT_MASK;
             p->fOptState |= pOD->fOptState & ~OPTST_PERSISTENT_MASK;

+ 4 - 4
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-2014 by Bruce Korb - all rights reserved
+ *  AutoOpts is Copyright (C) 1992-2016 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,7 +30,7 @@
  */
 
 static void
-optionReset( tOptions* pOpts, tOptDesc* pOD )
+optionReset(tOptions * pOpts, tOptDesc * pOD)
 {
     pOD->fOptState &= OPTST_PERSISTENT_MASK;
     pOD->fOptState |= OPTST_RESET;
@@ -63,8 +63,8 @@ optionResetEverything(tOptions * pOpts)
  * private:
  *
  * what:  Reset the value of an option
- * arg:   + tOptions* + pOpts    + program options descriptor  +
- * arg:   + tOptDesc* + pOptDesc + the descriptor for this arg +
+ * arg:   + tOptions * + pOpts    + program options descriptor  +
+ * arg:   + tOptDesc * + pOptDesc + the descriptor for this arg +
  *
  * doc:
  *  This code will cause another option to be reset to its initial state.

+ 17 - 17
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-2014 by Bruce Korb - all rights reserved
+ *  AutoOpts is Copyright (C) 1992-2016 by Bruce Korb - all rights reserved
  *
  *  AutoOpts is available under any one of two licenses.  The license
  *  in use must be one of these two and the choice is under the control
@@ -38,11 +38,11 @@
  *  have been marked as allocated though.
  */
 static void
-fixupSavedOptionArgs(tOptions* pOpts)
+fixupSavedOptionArgs(tOptions * pOpts)
 {
-    tOptions* p   = pOpts->pSavedState;
-    tOptDesc* pOD = pOpts->pOptDesc;
-    int       ct  = pOpts->optCt;
+    tOptions * p   = pOpts->pSavedState;
+    tOptDesc * pOD = pOpts->pOptDesc;
+    int        ct  = pOpts->optCt;
 
     /*
      *  Make sure that allocated stuff is only referenced in the
@@ -52,18 +52,18 @@ fixupSavedOptionArgs(tOptions* pOpts)
         switch (OPTST_GET_ARGTYPE(pOD->fOptState)) {
         case OPARG_TYPE_STRING:
             if (pOD->fOptState & OPTST_STACKED) {
-                tOptDesc* q = p->pOptDesc + (pOD - pOpts->pOptDesc);
+                tOptDesc * q = p->pOptDesc + (pOD - pOpts->pOptDesc);
                 q->optCookie = NULL;
             }
             if (pOD->fOptState & OPTST_ALLOC_ARG) {
-                tOptDesc* q = p->pOptDesc + (pOD - pOpts->pOptDesc);
+                tOptDesc * q = p->pOptDesc + (pOD - pOpts->pOptDesc);
                 AGDUPSTR(q->optArg.argString, pOD->optArg.argString, "arg");
             }
             break;
 
         case OPARG_TYPE_HIERARCHY:
         {
-            tOptDesc* q = p->pOptDesc + (pOD - pOpts->pOptDesc);
+            tOptDesc * q = p->pOptDesc + (pOD - pOpts->pOptDesc);
             q->optCookie = NULL;
         }
         }
@@ -73,7 +73,7 @@ fixupSavedOptionArgs(tOptions* pOpts)
 /*=export_func optionSaveState
  *
  * what:  saves the option state to memory
- * arg:   tOptions*, pOpts, program options descriptor
+ * arg:   tOptions *, pOpts, program options descriptor
  *
  * doc:
  *
@@ -96,7 +96,7 @@ fixupSavedOptionArgs(tOptions* pOpts)
 void
 optionSaveState(tOptions * pOpts)
 {
-    tOptions * p = (tOptions*)pOpts->pSavedState;
+    tOptions * p = (tOptions *)pOpts->pSavedState;
 
     if (p == NULL) {
         size_t sz = sizeof(*pOpts)
@@ -116,7 +116,7 @@ optionSaveState(tOptions * pOpts)
 /*=export_func optionRestore
  *
  * what:  restore option state from memory copy
- * arg:   tOptions*, pOpts, program options descriptor
+ * arg:   tOptions *, pOpts, program options descriptor
  *
  * doc:  Copy back the option state from saved memory.
  *       The allocated memory is left intact, so this routine can be
@@ -129,9 +129,9 @@ optionSaveState(tOptions * pOpts)
  *       printed to @code{stderr} and exit is called.
 =*/
 void
-optionRestore(tOptions* pOpts)
+optionRestore(tOptions * pOpts)
 {
-    tOptions* p = (tOptions*)pOpts->pSavedState;
+    tOptions * p = (tOptions *)pOpts->pSavedState;
 
     if (p == NULL) {
         char const * pzName = pOpts->pzProgName;
@@ -159,7 +159,7 @@ optionRestore(tOptions* pOpts)
 /*=export_func optionFree
  *
  * what:  free allocated option processing memory
- * arg:   tOptions*, pOpts, program options descriptor
+ * arg:   tOptions *, pOpts, program options descriptor
  *
  * doc:   AutoOpts sometimes allocates memory and puts pointers to it in the
  *        option state structures.  This routine deallocates all such memory.
@@ -168,11 +168,11 @@ optionRestore(tOptions* pOpts)
  *        this routine is always successful.
 =*/
 void
-optionFree(tOptions* pOpts)
+optionFree(tOptions * pOpts)
 {
  free_saved_state:
     {
-        tOptDesc* p = pOpts->pOptDesc;
+        tOptDesc * p = pOpts->pOptDesc;
         int ct = pOpts->optCt;
         do  {
             if (p->fOptState & OPTST_ALLOC_ARG) {
@@ -204,7 +204,7 @@ optionFree(tOptions* pOpts)
         } while (p++, --ct > 0);
     }
     if (pOpts->pSavedState != NULL) {
-        tOptions * p = (tOptions*)pOpts->pSavedState;
+        tOptions * p = (tOptions *)pOpts->pSavedState;
         memcpy(pOpts, p, sizeof(*p));
         memcpy(pOpts->pOptDesc, p+1, (size_t)p->optCt * sizeof(tOptDesc));
         AGFREE(pOpts->pSavedState);

+ 55 - 54
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-2014 by Bruce Korb - all rights reserved
+ *  AutoOpts is Copyright (C) 1992-2016 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
@@ -77,80 +77,82 @@ prt_file_arg(FILE * fp, tOptDesc * od, tOptions * opts);
 static char const *
 find_dir_name(tOptions * opts, int * p_free)
 {
-    char const * pzDir;
+    char const * dir;
 
     if (  (opts->specOptIdx.save_opts == NO_EQUIVALENT)
        || (opts->specOptIdx.save_opts == 0))
         return NULL;
 
-    pzDir = opts->pOptDesc[ opts->specOptIdx.save_opts ].optArg.argString;
-    if ((pzDir != NULL) && (*pzDir != NUL))
-        return pzDir;
+    dir = opts->pOptDesc[ opts->specOptIdx.save_opts ].optArg.argString;
+    if ((dir != NULL) && (*dir != NUL))
+        return dir;
 
     /*
      *  This function only works if there is a directory where
      *  we can stash the RC (INI) file.
      */
     {
-        char const * const* papz = opts->papzHomeList;
+        char const * const * papz = opts->papzHomeList;
         if (papz == NULL)
             return NULL;
 
         while (papz[1] != NULL) papz++;
-        pzDir = *papz;
+        dir = *papz;
     }
 
     /*
      *  IF it does not require deciphering an env value, then just copy it
      */
-    if (*pzDir != '$')
-        return pzDir;
+    if (*dir != '$')
+        return dir;
 
     {
-        char const * pzEndDir = strchr(++pzDir, DIRCH);
-        char * pzFileName;
-        char * pzEnv;
+        char const * end = strchr(++dir, DIRCH);
+        char * env;
 
-        if (pzEndDir != NULL) {
+        if (end != NULL) {
             char z[ AO_NAME_SIZE ];
-            if ((pzEndDir - pzDir) > AO_NAME_LIMIT )
+            if ((end - dir) > AO_NAME_LIMIT )
                 return NULL;
-            memcpy(z, pzDir, (size_t)(pzEndDir - pzDir));
-            z[pzEndDir - pzDir] = NUL;
-            pzEnv = getenv(z);
+            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)
              */
-            pzEnv = getenv(pzDir);
+            env = getenv(dir);
         }
 
-        if (pzEnv == NULL) {
+        if (env == NULL) {
             fprintf(stderr, zsave_warn, opts->pzProgName);
-            fprintf(stderr, zNotDef, pzDir);
+            fprintf(stderr, zNotDef, dir);
             return NULL;
         }
 
-        if (pzEndDir == NULL)
-            return pzEnv;
+        if (end == NULL)
+            return env;
+
+        /*
+         * we will be returning an allocated result
+         */
+        *p_free = 1;
 
         {
-            size_t sz = strlen(pzEnv) + strlen(pzEndDir) + 2;
-            pzFileName = (char *)AGALOC(sz, "dir name");
-        }
+            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");
 
-        if (pzFileName == NULL)
-            return NULL;
+            memcpy(p, env, env_len);
+            p += env_len;
+            *(p++) = '/';
+            memcpy(p, end, end_len + 1);
 
-        *p_free = 1;
-        /*
-         *  Glue together the full name into the allocated memory.
-         *  FIXME: We lose track of this memory.
-         */
-        sprintf(pzFileName, "%s/%s", pzEnv, pzEndDir);
-        return pzFileName;
+            return res;
+        }
     }
 }
 
@@ -183,7 +185,7 @@ find_file_name(tOptions * opts, int * p_free_name)
             fprintf(stderr, zsave_warn, opts->pzProgName);
             fprintf(stderr, zNoStat, errno, strerror(errno), pzDir);
             if (free_dir_name)
-                AGFREE((void*)pzDir);
+                AGFREE(pzDir);
             return NULL;
         }
 
@@ -213,17 +215,16 @@ 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;
 
         {
-            char * pzPath = (char*)AGALOC(sz, "file name");
-#ifdef HAVE_SNPRINTF
-            snprintf(pzPath, sz, "%s/%s", pzDir, opts->pzRcName);
-#else
-            sprintf(pzPath, "%s/%s", pzDir, opts->pzRcName);
-#endif
+            size_t sz = strlen(pzDir) + strlen(opts->pzRcName) + 2;
+            char * pzPath = (char *)AGALOC(sz, "file name");
+            if (   snprintf(pzPath, sz, "%s/%s", pzDir, opts->pzRcName)
+                >= (int)sz)
+                option_exits(EXIT_FAILURE);
+
             if (free_dir_name)
-                AGFREE((void*)pzDir);
+                AGFREE(pzDir);
             pzDir = pzPath;
             free_dir_name = 1;
         }
@@ -237,7 +238,7 @@ find_file_name(tOptions * opts, int * p_free_name)
                 fprintf(stderr, zsave_warn, opts->pzProgName);
                 fprintf(stderr, zNoStat, errno, strerror(errno),
                         pzDir);
-                AGFREE((void*)pzDir);
+                AGFREE(pzDir);
                 return NULL;
             }
 
@@ -255,7 +256,7 @@ find_file_name(tOptions * opts, int * p_free_name)
     if (! S_ISREG(stBuf.st_mode)) {
         fprintf(stderr, zsave_warn, opts->pzProgName, pzDir);
         if (free_dir_name)
-            AGFREE((void*)pzDir);
+            AGFREE(pzDir);
         return NULL;
     }
 
@@ -306,7 +307,7 @@ prt_entry(FILE * fp, tOptDesc * od, char const * l_arg)
      *  THEN the char pointer is really the number
      */
     if (OPTST_GET_ARGTYPE(od->fOptState) == OPARG_TYPE_NUMERIC)
-        fprintf(fp, "%d", (int)(t_word)l_arg);
+        fprintf(fp, "%d", (int)(intptr_t)l_arg);
 
     else {
         for (;;) {
@@ -377,7 +378,7 @@ prt_value(FILE * fp, int depth, tOptDesc * pOD, tOptionValue const * ovp)
                     /*
                      *  set membership strings get allocated
                      */
-                    AGFREE((void*)pOD->optArg.argString);
+                    AGFREE(pOD->optArg.argString);
                 }
             }
 
@@ -534,12 +535,12 @@ open_sv_file(tOptions * opts)
             fprintf(stderr, zsave_warn, opts->pzProgName);
             fprintf(stderr, zNoCreat, errno, strerror(errno), pzFName);
             if (free_name)
-                AGFREE((void*) pzFName );
+                AGFREE(pzFName);
             return fp;
         }
 
         if (free_name)
-            AGFREE((void*)pzFName);
+            AGFREE(pzFName);
     }
 
     fputs("#  ", fp);
@@ -560,7 +561,7 @@ open_sv_file(tOptions * opts)
          *  normally point to static data that is overwritten by each call.
          *  The test to detect allocated ctime, so we leak the memory.
          */
-        AGFREE((void*)time_str);
+        AGFREE(time_str);
 #endif
     }
 
@@ -596,7 +597,7 @@ static void
 prt_str_arg(FILE * fp, tOptDesc * pOD)
 {
     if (pOD->fOptState & OPTST_STACKED) {
-        tArgList * pAL = (tArgList*)pOD->optCookie;
+        tArgList * pAL = (tArgList *)pOD->optCookie;
         int        uct = pAL->useCt;
         char const ** ppz = pAL->apzArgs;
 
@@ -629,7 +630,7 @@ 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, (void*)(od->optArg.argString));
+    prt_entry(fp, od, VOIDP(od->optArg.argString));
 
     od->optArg.argEnum = val;
 }
@@ -689,7 +690,7 @@ prt_file_arg(FILE * fp, tOptDesc * od, tOptions * opts)
  *
  * what:  saves the option state to a file
  *
- * arg:   tOptions*,   opts,  program options descriptor
+ * arg:   tOptions *,   opts,  program options descriptor
  *
  * doc:
  *
@@ -765,7 +766,7 @@ optionSaveFile(tOptions * opts)
             break;
 
         case OPARG_TYPE_NUMERIC:
-            prt_entry(fp, p, (void*)(p->optArg.argInt));
+            prt_entry(fp, p, VOIDP(p->optArg.argInt));
             break;
 
         case OPARG_TYPE_STRING:

+ 5 - 5
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-2014 by Bruce Korb - all rights reserved
+ *  AutoOpts is Copyright (C) 1992-2016 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
@@ -198,11 +198,11 @@ optionSort(tOptions * opts)
     /*
      *  Make sure we can allocate two full-sized arg vectors.
      */
-    opt_txt = malloc(opts->origArgCt * sizeof(char*));
+    opt_txt = malloc(opts->origArgCt * sizeof(char *));
     if (opt_txt == NULL)
         goto exit_no_mem;
 
-    ppzOpds = malloc(opts->origArgCt * sizeof(char*));
+    ppzOpds = malloc(opts->origArgCt * sizeof(char *));
     if (ppzOpds == NULL) {
         free(opt_txt);
         goto exit_no_mem;
@@ -315,10 +315,10 @@ optionSort(tOptions * opts)
  joinLists:
     if (optsIdx > 0)
         memcpy(opts->origArgVect + 1, opt_txt,
-               (size_t)optsIdx * sizeof(char*));
+               (size_t)optsIdx * sizeof(char *));
     if (opdsIdx > 0)
         memcpy(opts->origArgVect + 1 + optsIdx, ppzOpds,
-               (size_t)opdsIdx * sizeof(char*));
+               (size_t)opdsIdx * sizeof(char *));
 
  freeTemps:
     free(opt_txt);

+ 15 - 15
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-2014 by Bruce Korb - all rights reserved
+ *  AutoOpts is Copyright (C) 1992-2016 by Bruce Korb - all rights reserved
  *
  *  AutoOpts is available under any one of two licenses.  The license
  *  in use must be one of these two and the choice is under the control
@@ -38,8 +38,8 @@
  * private:
  *
  * what:  Remove option args from a stack
- * arg:   + tOptions* + opts + program options descriptor +
- * arg:   + tOptDesc* + od   + the descriptor for this arg +
+ * arg:   + tOptions * + opts + program options descriptor +
+ * arg:   + tOptDesc * + od   + the descriptor for this arg +
  *
  * doc:
  *  Invoked for options that are equivalenced to stacked options.
@@ -52,7 +52,7 @@ optionUnstackArg(tOptions * opts, tOptDesc * od)
     if (INQUERY_CALL(opts, od))
         return;
 
-    arg_list = (tArgList*)od->optCookie;
+    arg_list = (tArgList *)od->optCookie;
 
     /*
      *  IF we don't have any stacked options,
@@ -165,7 +165,7 @@ optionUnstackArg(tOptions * opts, tOptDesc * od)
         od->fOptState &= OPTST_PERSISTENT_MASK;
         if ((od->fOptState & OPTST_INITENABLED) == 0)
             od->fOptState |= OPTST_DISABLED;
-        AGFREE((void *)arg_list);
+        AGFREE(arg_list);
         od->optCookie = NULL;
     }
 }
@@ -179,19 +179,19 @@ optionUnstackArg(tOptions * opts, tOptDesc * od)
 LOCAL void
 addArgListEntry(void ** ppAL, void * entry)
 {
-    tArgList* pAL = *(void**)ppAL;
+    tArgList * pAL = *(void **)ppAL;
 
     /*
      *  IF we have never allocated one of these,
      *  THEN allocate one now
      */
     if (pAL == NULL) {
-        pAL = (tArgList*)AGALOC(sizeof(*pAL), "new option arg stack");
+        pAL = (tArgList *)AGALOC(sizeof(*pAL), "new option arg stack");
         if (pAL == NULL)
             return;
         pAL->useCt   = 0;
         pAL->allocCt = MIN_ARG_ALLOC_CT;
-        *ppAL = (void*)pAL;
+        *ppAL = VOIDP(pAL);
     }
 
     /*
@@ -206,11 +206,11 @@ addArgListEntry(void ** ppAL, void * entry)
          *  The base structure contains space for MIN_ARG_ALLOC_CT
          *  pointers.  We subtract it off to find our augment size.
          */
-        sz += sizeof(char*) * ((size_t)pAL->allocCt - MIN_ARG_ALLOC_CT);
-        pAL = (tArgList*)AGREALOC((void*)pAL, sz, "expanded opt arg stack");
+        sz += sizeof(char *) * ((size_t)pAL->allocCt - MIN_ARG_ALLOC_CT);
+        pAL = (tArgList *)AGREALOC(VOIDP(pAL), sz, "expanded opt arg stack");
         if (pAL == NULL)
             return;
-        *ppAL = (void*)pAL;
+        *ppAL = VOIDP(pAL);
     }
 
     /*
@@ -224,8 +224,8 @@ addArgListEntry(void ** ppAL, void * entry)
  * private:
  *
  * what:  put option args on a stack
- * arg:   + tOptions* + opts + program options descriptor +
- * arg:   + tOptDesc* + od   + the descriptor for this arg +
+ * arg:   + tOptions * + opts + program options descriptor +
+ * arg:   + tOptDesc * + od   + the descriptor for this arg +
  *
  * doc:
  *  Keep an entry-ordered list of option arguments.
@@ -239,7 +239,7 @@ optionStackArg(tOptions * opts, tOptDesc * od)
         return;
 
     if ((od->fOptState & OPTST_RESET) != 0) {
-        tArgList * arg_list = (void*)od->optCookie;
+        tArgList * arg_list = od->optCookie;
         int ix;
         if (arg_list == NULL)
             return;
@@ -254,7 +254,7 @@ optionStackArg(tOptions * opts, tOptDesc * od)
             return;
 
         AGDUPSTR(pz, od->optArg.argString, "stack arg");
-        addArgListEntry(&(od->optCookie), (void*)pz);
+        addArgListEntry(&(od->optCookie), VOIDP(pz));
     }
 }
 /** @}

+ 1 - 1
libopts/stdnoreturn.in.h

@@ -1,6 +1,6 @@
 /* A substitute for ISO C11 <stdnoreturn.h>.
 
-   Copyright 2012-2014 Free Software Foundation, Inc.
+   Copyright 2012-2016 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

+ 11 - 11
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-2014 by Bruce Korb - all rights reserved
+ *  AutoOpts is Copyright (C) 1992-2016 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
@@ -81,9 +81,9 @@ static unsigned char charmap[] = {
  *
  * what: compare two strings with an equivalence mapping
  *
- * arg:  + char const* + str1 + first string +
- * arg:  + char const* + str2 + second string +
- * arg:  + int         + ct   + compare length +
+ * arg:  + char const * + str1 + first string +
+ * arg:  + char const * + str2 + second string +
+ * arg:  + int          + ct   + compare length +
  *
  * ret_type:  int
  * ret_desc:  the difference between two differing characters
@@ -129,8 +129,8 @@ strneqvcmp(char const * s1, char const * s2, int ct)
  *
  * what: compare two strings with an equivalence mapping
  *
- * arg:  + char const* + str1 + first string +
- * arg:  + char const* + str2 + second string +
+ * arg:  + char const * + str1 + first string +
+ * arg:  + char const * + str2 + second string +
  *
  * ret_type:  int
  * ret_desc:  the difference between two differing characters
@@ -226,7 +226,7 @@ streqvmap(char from, char to, int ct)
  *
  * what: map a list of characters to the same value
  *
- * arg:  + char const* + ch_list + characters to equivalence +
+ * arg:  + char const * + ch_list + characters to equivalence +
  *
  * doc:
  *
@@ -238,7 +238,7 @@ streqvmap(char from, char to, int ct)
  * err:  none.
 =*/
 void
-strequate(char const* s)
+strequate(char const * s)
 {
     if ((s != NULL) && (*s != NUL)) {
         unsigned char equiv = (unsigned char)*s;
@@ -252,8 +252,8 @@ strequate(char const* s)
  *
  * what: convert a string into its mapped-to value
  *
- * arg:  + char*       + dest + output string +
- * arg:  + char const* + src  + input string +
+ * arg:  + char *       + dest + output string +
+ * arg:  + char const * + src  + input string +
  *
  * doc:
  *
@@ -267,7 +267,7 @@ strequate(char const* s)
  * err:  none.
 =*/
 void
-strtransform(char* d, char const* s)
+strtransform(char * d, char const * s)
 {
     do  {
         *(d++) = (char)charmap[(unsigned char)*s];

+ 18 - 15
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-2014 by Bruce Korb - all rights reserved
+ *  AutoOpts is Copyright (C) 1992-2015 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
@@ -61,7 +61,7 @@
 #define FILE_WRITABLE(_prt,_flg) \
         (   (_prt & PROT_WRITE) \
          && ((_flg & (MAP_SHARED|MAP_PRIVATE)) == MAP_SHARED))
-#define MAP_FAILED_PTR ((void*)MAP_FAILED)
+#define MAP_FAILED_PTR (VOIDP(MAP_FAILED))
 
 /**
  * Load the contents of a text file.  There are two separate implementations,
@@ -93,7 +93,7 @@ load_text_file(tmap_info_t * mapinfo, char const * pzFile)
 
     {
         size_t sz = mapinfo->txt_size;
-        char*  pz = mapinfo->txt_data;
+        char * pz = mapinfo->txt_data;
 
         while (sz > 0) {
             ssize_t rdct = read(mapinfo->txt_fd, pz, sz);
@@ -185,7 +185,11 @@ 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_BINARY |
+#endif
+            ((FILE_WRITABLE(prot, flags)) ? O_RDWR : O_RDONLY);
 
         /*
          *  If you're not sharing the file and you are writing to it,
@@ -254,12 +258,12 @@ close_mmap_files(tmap_info_t * mi)
  *
  * what:  map a text file with terminating NUL
  *
- * arg:   char const*,  pzFile,  name of the file to map
- * arg:   int,          prot,    mmap protections (see mmap(2))
- * arg:   int,          flags,   mmap flags (see mmap(2))
- * arg:   tmap_info_t*, mapinfo, returned info about the mapping
+ * arg:   char const *,  pzFile,  name of the file to map
+ * arg:   int,           prot,    mmap protections (see mmap(2))
+ * arg:   int,           flags,   mmap flags (see mmap(2))
+ * arg:   tmap_info_t *, mapinfo, returned info about the mapping
  *
- * ret-type:   void*
+ * ret-type:   void *
  * ret-desc:   The mmaped data address
  *
  * doc:
@@ -296,7 +300,7 @@ close_mmap_files(tmap_info_t * mi)
  * #include <mylib.h>
  * tmap_info_t mi;
  * int no_nul;
- * void* data = text_mmap("file", PROT_WRITE, MAP_PRIVATE, &mi);
+ * void * data = text_mmap("file", PROT_WRITE, MAP_PRIVATE, &mi);
  * if (data == MAP_FAILED) return;
  * no_nul = (mi.txt_size == mi.txt_full_size);
  * << use the data >>
@@ -327,7 +331,7 @@ text_mmap(char const * pzFile, int prot, int flags, tmap_info_t * mi)
  *
  * what:  unmap the data mapped in by text_mmap
  *
- * arg:   tmap_info_t*, mapinfo, info about the mapping
+ * arg:   tmap_info_t *, mapinfo, info about the mapping
  *
  * ret-type:   int
  * ret-desc:   -1 or 0.  @code{errno} will have the error code.
@@ -349,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 */

+ 9 - 7
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-2014 by Bruce Korb - all rights reserved
+ *  AutoOpts is Copyright (C) 1992-2015 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,8 +31,8 @@
  * private:
  *
  * what:  process an option with a time duration.
- * arg:   + tOptions* + opts + program options descriptor +
- * arg:   + tOptDesc* + od   + the descriptor for this arg +
+ * arg:   + tOptions * + opts + program options descriptor +
+ * arg:   + tOptDesc * + od   + the descriptor for this arg +
  *
  * doc:
  *  Decipher a time duration value.
@@ -64,8 +64,8 @@ optionTimeVal(tOptions * opts, tOptDesc * od)
  * private:
  *
  * what:  process an option with a time and date.
- * arg:   + tOptions* + opts + program options descriptor +
- * arg:   + tOptDesc* + od   + the descriptor for this arg +
+ * arg:   + tOptions * + opts + program options descriptor +
+ * arg:   + tOptDesc * + od   + the descriptor for this arg +
  *
  * doc:
  *  Decipher a time and date value.
@@ -90,8 +90,10 @@ optionTimeDate(tOptions * opts, tOptDesc * od)
 
         if (envptr == NULL) {
             static char const fmt[] = "DATEMSK=%s/datemsk";
-            envptr = AGALOC(sizeof(fmt) + strlen(opts->pzPkgDataDir), fmt);
-            sprintf(envptr, fmt, opts->pzPkgDataDir);
+            size_t sz = sizeof(fmt) + strlen(opts->pzPkgDataDir);
+            envptr = AGALOC(sz, fmt);
+            if (snprintf(envptr, sz, fmt, opts->pzPkgDataDir) >= (int)sz)
+                option_exits(EXIT_FAILURE);
 
             putenv(envptr);
         }

+ 24 - 24
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-2014 by Bruce Korb - all rights reserved
+ *  AutoOpts is Copyright (C) 1992-2015 by Bruce Korb - all rights reserved
  *
  *  AutoOpts is available under any one of two licenses.  The license
  *  in use must be one of these two and the choice is under the control
@@ -36,20 +36,20 @@
 
 /* = = = START-STATIC-FORWARD = = = */
 static void
-copy_cooked(ch_t** ppDest, char const ** ppSrc);
+copy_cooked(ch_t ** ppDest, char const ** ppSrc);
 
 static void
-copy_raw(ch_t** ppDest, char const ** ppSrc);
+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)
+copy_cooked(ch_t ** ppDest, char const ** ppSrc)
 {
-    ch_t* pDest = (ch_t*)*ppDest;
-    const ch_t* pSrc  = (const ch_t*)(*ppSrc + 1);
+    ch_t * pDest = (ch_t *)*ppDest;
+    const ch_t * pSrc  = (const ch_t *)(*ppSrc + 1);
 
     for (;;) {
         ch_t ch = *(pSrc++);
@@ -57,7 +57,7 @@ copy_cooked(ch_t** ppDest, char const ** ppSrc)
         case NUL:   *ppSrc = NULL; return;
         case '"':   goto done;
         case '\\':
-            pSrc += ao_string_cook_escape_char((char*)pSrc, (char*)&ch, 0x7F);
+            pSrc += ao_string_cook_escape_char((char *)pSrc, (char *)&ch, 0x7F);
             if (ch == 0x7F)
                 break;
             /* FALLTHROUGH */
@@ -68,16 +68,16 @@ copy_cooked(ch_t** ppDest, char const ** ppSrc)
     }
 
  done:
-    *ppDest = (ch_t*)pDest; /* next spot for storing character */
+    *ppDest = (ch_t *)pDest; /* next spot for storing character */
     *ppSrc  = (char const *)pSrc;  /* char following closing quote    */
 }
 
 
 static void
-copy_raw(ch_t** ppDest, char const ** ppSrc)
+copy_raw(ch_t ** ppDest, char const ** ppSrc)
 {
-    ch_t* pDest = *ppDest;
-    cc_t* pSrc  = (cc_t*) (*ppSrc + 1);
+    ch_t * pDest = *ppDest;
+    cc_t * pSrc  = (cc_t *) (*ppSrc + 1);
 
     for (;;) {
         ch_t ch = *(pSrc++);
@@ -151,12 +151,12 @@ alloc_token_list(char const * str)
         } while (*pz != NUL);
 
         res = malloc(sizeof(*res) + (size_t)(pz - str)
-                     + ((size_t)max_token_ct * sizeof(ch_t*)));
+                     + ((size_t)max_token_ct * sizeof(ch_t *)));
     }
 
     if (res == NULL)
         errno = ENOMEM;
-    else res->tkn_list[0] = (ch_t*)(res->tkn_list + (max_token_ct - 1));
+    else res->tkn_list[0] = (ch_t *)(res->tkn_list + (max_token_ct - 1));
 
     return res;
 
@@ -170,9 +170,9 @@ alloc_token_list(char const * str)
  *
  * what: tokenize an input string
  *
- * arg:  + char const* + string + string to be tokenized +
+ * arg:  + char const * + string + string to be tokenized +
  *
- * ret_type:  token_list_t*
+ * ret_type:  token_list_t *
  * ret_desc:  pointer to a structure that lists each token
  *
  * doc:
@@ -213,7 +213,7 @@ alloc_token_list(char const * str)
  * @example
  *    #include <stdlib.h>
  *    int ix;
- *    token_list_t* ptl = ao_string_tokenize(some_string)
+ *    token_list_t * ptl = ao_string_tokenize(some_string)
  *    for (ix = 0; ix < ptl->tkn_ct; ix++)
  *       do_something_with_tkn(ptl->tkn_list[ix]);
  *    free(ptl);
@@ -231,11 +231,11 @@ alloc_token_list(char const * str)
  *  @code{ENOMEM} - There is not enough memory.
  *  @end itemize
 =*/
-token_list_t*
-ao_string_tokenize(char const* str)
+token_list_t *
+ao_string_tokenize(char const * str)
 {
-    token_list_t* res = alloc_token_list(str);
-    ch_t* pzDest;
+    token_list_t * res = alloc_token_list(str);
+    ch_t * pzDest;
 
     /*
      *  Now copy each token into the output buffer.
@@ -243,7 +243,7 @@ ao_string_tokenize(char const* str)
     if (res == NULL)
         return res;
 
-    pzDest = (ch_t*)(res->tkn_list[0]);
+    pzDest = (ch_t *)(res->tkn_list[0]);
     res->tkn_ct  = 0;
 
     do  {
@@ -304,15 +304,15 @@ ao_string_tokenize(char const* str)
 #include <string.h>
 
 int
-main(int argc, char** argv)
+main(int argc, char ** argv)
 {
     if (argc == 1) {
         printf("USAGE:  %s arg [ ... ]\n", *argv);
         return 1;
     }
     while (--argc > 0) {
-        char* arg = *(++argv);
-        token_list_t* p = ao_string_tokenize(arg);
+        char * arg = *(++argv);
+        token_list_t * p = ao_string_tokenize(arg);
         if (p == NULL) {
             printf("Parsing string ``%s'' failed:\n\terrno %d (%s)\n",
                    arg, errno, strerror(errno));

+ 15 - 12
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-2014 by Bruce Korb - all rights reserved
+ *  AutoOpts is Copyright (C) 1992-2015 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,6 +37,9 @@
  *  13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239  COPYING.mbsd
  */
 
+#define GRAPH_CH(_ch) \
+    ((((unsigned)_ch) <= 0x7E) && (((unsigned)_ch) > ' '))
+
 /* = = = START-STATIC-FORWARD = = = */
 static unsigned int
 parse_usage_flags(ao_flag_names_t const * fnt, char const * txt);
@@ -240,7 +243,7 @@ skip_misuse_usage(tOptions * pOpts)
 /*=export_func  optionOnlyUsage
  *
  * what:  Print usage text for just the options
- * arg:   + tOptions*   + pOpts    + program options descriptor +
+ * arg:   + tOptions *  + pOpts    + program options descriptor +
  * arg:   + int         + ex_code  + exit code for calling exit(3) +
  *
  * doc:
@@ -351,8 +354,8 @@ print_usage_details(tOptions * opts, int exit_code)
             flen = setGnuOptFmts(opts, &pOptTitle);
             sprintf(line_fmt_buf, zFmtFmt, flen);
             fputc(NL, option_usage_fp);
-        }
-        else {
+
+        } else {
             flen = setStdOptFmts(opts, &pOptTitle);
             sprintf(line_fmt_buf, zFmtFmt, flen);
 
@@ -435,7 +438,7 @@ print_one_paragraph(char const * text, bool plain, FILE * fp)
     else {
         char const * t = optionQuoteString(text, LINE_SPLICE);
         fprintf(fp, PUTS_FMT, t);
-        AGFREE((void *)t);
+        AGFREE(t);
     }
 }
  
@@ -546,15 +549,15 @@ optionPrintParagraphs(char const * text, bool plain, FILE * fp)
             buf = scan;
         }
     }
-    AGFREE((void *)text);
+    AGFREE(text);
 }
 
 /*=export_func  optionUsage
  * private:
  *
  * what:  Print usage text
- * arg:   + tOptions* + opts + program options descriptor +
- * arg:   + int       + exitCode + exit code for calling exit(3) +
+ * arg:   + tOptions * + opts + program options descriptor +
+ * arg:   + int        + exitCode + exit code for calling exit(3) +
  *
  * doc:
  *  This routine will print usage in both GNU-standard and AutoOpts-expanded
@@ -777,7 +780,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 +798,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 +1008,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 +1135,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;
 
         /*

+ 9 - 9
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-2014 by Bruce Korb - all rights reserved
+ *  AutoOpts is Copyright (C) 1992-2015 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,13 +32,13 @@
 /*=export_func  optionVersion
  *
  * what:     return the compiled AutoOpts version number
- * ret_type: char const*
+ * ret_type: char const *
  * ret_desc: the version string in constant memory
  * doc:
  *  Returns the full version string compiled into the library.
  *  The returned string cannot be modified.
 =*/
-char const*
+char const *
 optionVersion(void)
 {
     static char const ver[] = OPTIONS_DOTTED_VERSION;
@@ -181,8 +181,8 @@ print_ver(tOptions * opts, tOptDesc * od, FILE * fp, bool call_exit)
 /*=export_func  optionPrintVersion
  *
  * what:  Print the program version
- * arg:   + tOptions* + opts + program options descriptor +
- * arg:   + tOptDesc* + od   + the descriptor for this arg +
+ * arg:   + tOptions * + opts + program options descriptor +
+ * arg:   + tOptDesc * + od   + the descriptor for this arg +
  *
  * doc:
  *  This routine will print the version to stdout.
@@ -196,8 +196,8 @@ optionPrintVersion(tOptions * opts, tOptDesc * od)
 /*=export_func  optionPrintVersionAndReturn
  *
  * what:  Print the program version
- * arg:   + tOptions* + opts + program options descriptor +
- * arg:   + tOptDesc* + od   + the descriptor for this arg +
+ * arg:   + tOptions * + opts + program options descriptor +
+ * arg:   + tOptDesc * + od   + the descriptor for this arg +
  *
  * doc:
  *  This routine will print the version to stdout and return
@@ -215,8 +215,8 @@ optionPrintVersionAndReturn(tOptions * opts, tOptDesc * od)
  * private:
  *
  * what:  Print the program version to stderr
- * arg:   + tOptions* + opts + program options descriptor +
- * arg:   + tOptDesc* + od   + the descriptor for this arg +
+ * arg:   + tOptions * + opts + program options descriptor +
+ * arg:   + tOptDesc * + od   + the descriptor for this arg +
  *
  * doc:
  *  This routine will print the version to stderr.

+ 592 - 0
m4/libopts.m4

@@ -0,0 +1,592 @@
+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],[
+  AC_REQUIRE([AC_HEADER_STDC])
+  AC_HEADER_DIRENT
+
+  # =================
+  # AC_CHECK_HEADERS
+  # =================
+  AC_CHECK_HEADERS([ \
+      sys/mman.h    sys/param.h   sys/poll.h    sys/procset.h \
+      sys/select.h  sys/socket.h  sys/stropts.h sys/time.h \
+      sys/un.h      sys/wait.h    dlfcn.h       errno.h \
+      fcntl.h       libgen.h      libintl.h     memory.h \
+      netinet/in.h  setjmp.h      stdbool.h     sysexits.h \
+      unistd.h      utime.h])
+
+  AC_CHECK_HEADERS([stdarg.h     varargs.h],
+      [lo_have_arg_hdr=true;break],
+      [lo_have_arg_hdr=false])
+
+  AC_CHECK_HEADERS([string.h     strings.h],
+      [lo_have_str_hdr=true;break],
+      [lo_have_str_hdr=false])
+
+  AC_CHECK_HEADERS([limits.h     sys/limits.h  values.h],
+      [lo_have_lim_hdr=true;break],
+      [lo_have_lim_hdr=false])
+
+  AC_CHECK_HEADERS([inttypes.h   stdint.h],
+      [lo_have_typ_hdr=true;break],
+      [lo_have_typ_hdr=false])
+  gl_STDNORETURN_H
+
+  # ----------------------------------------------------------------------
+  # check for various programs used during the build.
+  # On OS/X, "wchar.h" needs "runetype.h" to work properly.
+  # ----------------------------------------------------------------------
+  AC_CHECK_HEADERS([runetype.h wchar.h], [], [],[
+  AC_INCLUDES_DEFAULT
+  #if HAVE_RUNETYPE_H
+  # include <runetype.h>
+  #endif
+  ])
+
+  AC_ARG_ENABLE([nls],
+  AS_HELP_STRING([--disable-nls],[disable nls support in libopts]))
+  AS_IF([test "x$enable_nls" != "xno" && \
+  test "X${ac_cv_header_libintl_h}" = Xyes], [
+  AC_DEFINE([ENABLE_NLS],[1],[nls support in libopts])])
+
+  # --------------------------------------------
+  # Verify certain entries from AC_CHECK_HEADERS
+  # --------------------------------------------
+  [${lo_have_arg_hdr} || \
+    ]AC_MSG_ERROR([you must have stdarg.h or varargs.h on your system])[
+
+  ${lo_have_str_hdr} || \
+    ]AC_MSG_ERROR([you must have string.h or strings.h on your system])[
+
+  ${lo_have_lim_hdr} || \
+    ]AC_MSG_ERROR(
+      [you must have one of limits.h, sys/limits.h or values.h])[
+
+  ${lo_have_typ_hdr} || \
+    ]AC_MSG_ERROR([you must have inttypes.h or stdint.h on your system])[
+
+  for f in sys_types sys_param sys_stat string errno stdlib memory setjmp
+  do eval as_ac_var=\${ac_cv_header_${f}_h}
+     test "X${as_ac_var}" = Xyes || {
+       ]AC_MSG_ERROR([you must have ${f}.h on your system])[
+     }
+  done
+  test "X${ac_cv_header_inttypes_h-no}" = Xyes || \
+    echo '#include <stdint.h>' > inttypes.h]
+
+  # ----------------------------------------------------------------------
+  # Checks for typedefs
+  # ----------------------------------------------------------------------
+  AC_CHECK_TYPES(wchar_t)
+  AC_CHECK_TYPES(wint_t, [], [], [
+    AC_INCLUDES_DEFAULT
+    #if HAVE_RUNETYPE_H
+    # include <runetype.h>
+    #endif
+    #if HAVE_WCHAR_H
+    # include <wchar.h>
+    #endif
+  ])
+  AC_CHECK_TYPES([int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t,
+  intptr_t, uintptr_t, uint_t, pid_t, size_t, ptrdiff_t])
+  AC_CHECK_SIZEOF(char *, 8)
+  AC_CHECK_SIZEOF(int,    4)
+  AC_CHECK_SIZEOF(long,   8)
+  AC_CHECK_SIZEOF(short,  2)
+
+  # ------------
+  # AC_CHECK_LIB
+  # ------------
+  AC_CHECK_LIB(gen, pathfind)
+  AC_CHECK_LIB(intl,gettext)
+  AC_FUNC_VPRINTF
+  AC_FUNC_FORK
+  AC_CHECK_FUNCS([mmap canonicalize_file_name snprintf strdup strchr \
+                 strrchr strsignal fchmod fstat chmod])
+  AC_PROG_SED
+  [while :
+  do
+      POSIX_SHELL=`which bash`
+      test -x "$POSIX_SHELL" && break
+      POSIX_SHELL=`which dash`
+      test -x "$POSIX_SHELL" && break
+      POSIX_SHELL=/usr/xpg4/bin/sh
+      test -x "$POSIX_SHELL" && break
+      POSIX_SHELL=`/bin/sh -c '
+          exec 2>/dev/null
+          if ! true ; then exit 1 ; fi
+          echo /bin/sh'`
+      test -x "$POSIX_SHELL" && break
+      ]AC_MSG_ERROR([cannot locate a working POSIX shell])[
+  done]
+  AC_DEFINE_UNQUOTED([POSIX_SHELL], ["${POSIX_SHELL}"],
+           [define to a working POSIX compliant shell])
+  AC_SUBST([POSIX_SHELL])
+])
+
+dnl
+dnl @synopsis  INVOKE_LIBOPTS_MACROS
+dnl
+dnl  This macro will invoke the AutoConf macros specified in libopts.def
+dnl  that have not been disabled with "omit-invocation".
+dnl
+AC_DEFUN([LIBOPTS_WITH_REGEX_HEADER],[
+  AC_ARG_WITH([regex-header],
+    AS_HELP_STRING([--with-regex-header], [a reg expr header is specified]),
+    [libopts_cv_with_regex_header=${with_regex_header}],
+    AC_CACHE_CHECK([whether a reg expr header is specified], libopts_cv_with_regex_header,
+      libopts_cv_with_regex_header=no)
+  ) # end of AC_ARG_WITH
+  if test "X${libopts_cv_with_regex_header}" != Xno
+  then
+    AC_DEFINE_UNQUOTED([REGEX_HEADER],[<${libopts_cv_with_regex_header}>])
+  else
+    AC_DEFINE([REGEX_HEADER],[<regex.h>],[name of regex header file])
+  fi
+
+]) # end of AC_DEFUN of LIBOPTS_WITH_REGEX_HEADER
+
+
+AC_DEFUN([LIBOPTS_WITHLIB_REGEX],[
+  AC_ARG_WITH([libregex],
+    AS_HELP_STRING([--with-libregex], [libregex installation prefix]),
+    [libopts_cv_with_libregex_root=${with_libregex}],
+    AC_CACHE_CHECK([whether with-libregex was specified], libopts_cv_with_libregex_root,
+      libopts_cv_with_libregex_root=no)
+  ) # end of AC_ARG_WITH libregex
+
+  if test "${with_libregex+set}" = set && \
+     test "X${withval}" = Xno
+  then ## disabled by request
+    libopts_cv_with_libregex_root=no
+    libopts_cv_with_libregex_cflags=no
+    libopts_cv_with_libregex_libs=no
+  else
+
+  AC_ARG_WITH([libregex-cflags],
+    AS_HELP_STRING([--with-libregex-cflags], [libregex compile flags]),
+    [libopts_cv_with_libregex_cflags=${with_libregex_cflags}],
+    AC_CACHE_CHECK([whether with-libregex-cflags was specified], libopts_cv_with_libregex_cflags,
+      libopts_cv_with_libregex_cflags=no)
+  ) # end of AC_ARG_WITH libregex-cflags
+
+  AC_ARG_WITH([libregex-libs],
+    AS_HELP_STRING([--with-libregex-libs], [libregex link command arguments]),
+    [libopts_cv_with_libregex_libs=${with_libregex_libs}],
+    AC_CACHE_CHECK([whether with-libregex-libs was specified], libopts_cv_with_libregex_libs,
+      libopts_cv_with_libregex_libs=no)
+  ) # end of AC_ARG_WITH libregex-libs
+
+  case "X${libopts_cv_with_libregex_cflags}" in
+  Xyes|Xno|X )
+    case "X${libopts_cv_with_libregex_root}" in
+    Xyes|Xno|X ) libopts_cv_with_libregex_cflags=no ;;
+    * ) libopts_cv_with_libregex_cflags=-I${libopts_cv_with_libregex_root}/include ;;
+    esac
+  esac
+  case "X${libopts_cv_with_libregex_libs}" in
+  Xyes|Xno|X )
+    case "X${libopts_cv_with_libregex_root}" in
+    Xyes|Xno|X ) libopts_cv_with_libregex_libs=no ;;
+    * )        libopts_cv_with_libregex_libs="-L${libopts_cv_with_libregex_root}/lib -lregex" ;;
+    esac
+  esac
+  libopts_save_CPPFLAGS="${CPPFLAGS}"
+  libopts_save_LIBS="${LIBS}"
+  case "X${libopts_cv_with_libregex_cflags}" in
+  Xyes|Xno|X )
+    libopts_cv_with_libregex_cflags="" ;;
+  * ) CPPFLAGS="${CPPFLAGS} ${libopts_cv_with_libregex_cflags}" ;;
+  esac
+  case "X${libopts_cv_with_libregex_libs}" in
+  Xyes|Xno|X )
+    libopts_cv_with_libregex_libs="" ;;
+  * )
+    LIBS="${LIBS} ${libopts_cv_with_libregex_libs}" ;;
+  esac
+  LIBREGEX_CFLAGS=""
+  LIBREGEX_LIBS=""
+  AC_MSG_CHECKING([whether libregex functions properly])
+  AC_CACHE_VAL([libopts_cv_with_libregex],[
+  AC_RUN_IFELSE([AC_LANG_SOURCE([@%:@include <stdio.h>
+@%:@include <stdlib.h>
+@%:@include <sys/types.h>
+@%:@include REGEX_HEADER
+static regex_t re;
+void comp_re(char const * pzPat) {
+  int res = regcomp( &re, pzPat, REG_EXTENDED|REG_ICASE|REG_NEWLINE );
+  if (res == 0) return;
+  exit( res ); }
+int main() {
+  regmatch_t m@<:@2@:>@;
+  comp_re( "^.*\@S|@"   );
+  comp_re( "()|no.*" );
+  comp_re( "."       );
+  if (regexec( &re, "X", 2, m, 0 ) != 0)  return 1;
+  if ((m@<:@0@:>@.rm_so != 0) || (m@<:@0@:>@.rm_eo != 1)) {
+    fputs( "error: regex -->.<-- did not match\n", stderr );
+    return 1;
+  }
+  return 0; }])],
+    [libopts_cv_with_libregex=yes], [libopts_cv_with_libregex=no],
+    [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}])
+  if test "X${libopts_cv_with_libregex}" != Xno
+  then
+    AC_DEFINE([WITH_LIBREGEX],[1],
+        [Define this if a working libregex can be found])
+  else
+    CPPFLAGS="${libopts_save_CPPFLAGS}"
+    LIBS="${libopts_save_LIBS}"
+    libopts_cv_with_libregex_root=no
+libopts_cv_with_libregex_cflags=no
+libopts_cv_with_libregex_libs=no
+libopts_cv_with_libregex=no
+  fi
+
+]) # end of AC_DEFUN of LIBOPTS_WITHLIB_REGEX
+
+
+AC_DEFUN([LIBOPTS_RUN_PATHFIND],[
+  AC_MSG_CHECKING([whether pathfind(3) works])
+  AC_CACHE_VAL([libopts_cv_run_pathfind],[
+  AC_RUN_IFELSE([AC_LANG_SOURCE([@%:@include <string.h>
+@%:@include <stdlib.h>
+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
+  AC_MSG_RESULT([${libopts_cv_run_pathfind}])
+  if test "X${libopts_cv_run_pathfind}" != Xno
+  then
+    AC_DEFINE([HAVE_PATHFIND],[1],
+        [Define this if pathfind(3) works])
+  fi
+
+]) # end of AC_DEFUN of LIBOPTS_RUN_PATHFIND
+
+
+AC_DEFUN([LIBOPTS_TEST_DEV_ZERO],[
+  AC_MSG_CHECKING([whether /dev/zero is readable device])
+  AC_CACHE_VAL([libopts_cv_test_dev_zero],[
+    libopts_cv_test_dev_zero=`exec 2> /dev/null
+dzero=\`ls -lL /dev/zero | egrep ^c......r\`
+test -z "${dzero}" && exit 1
+echo ${dzero}`
+    if test $? -ne 0 || test -z "$libopts_cv_test_dev_zero"
+    then libopts_cv_test_dev_zero=no
+    fi
+  ]) # end of CACHE_VAL of libopts_cv_test_dev_zero
+  AC_MSG_RESULT([${libopts_cv_test_dev_zero}])
+  if test "X${libopts_cv_test_dev_zero}" != Xno
+  then
+    AC_DEFINE([HAVE_DEV_ZERO],[1],
+        [Define this if /dev/zero is readable device])
+  fi
+
+]) # end of AC_DEFUN of LIBOPTS_TEST_DEV_ZERO
+
+
+AC_DEFUN([LIBOPTS_RUN_REALPATH],[
+  AC_MSG_CHECKING([whether we have a functional realpath(3C)])
+  AC_CACHE_VAL([libopts_cv_run_realpath],[
+  AC_RUN_IFELSE([AC_LANG_SOURCE([@%:@include <limits.h>
+@%:@include <stdlib.h>
+int main (int argc, char ** argv) {
+@%:@ifndef PATH_MAX
+choke me!!
+@%:@else
+   char zPath@<:@PATH_MAX+1@:>@;
+@%:@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
+  AC_MSG_RESULT([${libopts_cv_run_realpath}])
+  if test "X${libopts_cv_run_realpath}" != Xno
+  then
+    AC_DEFINE([HAVE_REALPATH],[1],
+        [Define this if we have a functional realpath(3C)])
+  fi
+
+]) # end of AC_DEFUN of LIBOPTS_RUN_REALPATH
+
+
+AC_DEFUN([LIBOPTS_RUN_STRFTIME],[
+  AC_MSG_CHECKING([whether strftime() works])
+  AC_CACHE_VAL([libopts_cv_run_strftime],[
+  AC_RUN_IFELSE([AC_LANG_SOURCE([@%:@include <time.h>
+@%:@include <string.h>
+char t_buf@<:@ 64 @:>@;
+int main() {
+  static char const z@<:@@:>@ = "Thursday Aug 28 240";
+  struct tm tm;
+  tm.tm_sec   = 36;  /* seconds after the minute @<:@0, 61@:>@  */
+  tm.tm_min   = 44;  /* minutes after the hour @<:@0, 59@:>@ */
+  tm.tm_hour  = 12;  /* hour since midnight @<:@0, 23@:>@ */
+  tm.tm_mday  = 28;  /* day of the month @<:@1, 31@:>@ */
+  tm.tm_mon   =  7;  /* months since January @<:@0, 11@:>@ */
+  tm.tm_year  = 86;  /* years since 1900 */
+  tm.tm_wday  =  4;  /* days since Sunday @<:@0, 6@:>@ */
+  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); }])],
+    [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
+  AC_MSG_RESULT([${libopts_cv_run_strftime}])
+  if test "X${libopts_cv_run_strftime}" != Xno
+  then
+    AC_DEFINE([HAVE_STRFTIME],[1],
+        [Define this if strftime() works])
+  fi
+
+]) # end of AC_DEFUN of LIBOPTS_RUN_STRFTIME
+
+
+AC_DEFUN([LIBOPTS_RUN_FOPEN_BINARY],[
+  AC_MSG_CHECKING([whether fopen accepts "b" mode])
+  AC_CACHE_VAL([libopts_cv_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); }])],
+    [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
+  AC_MSG_RESULT([${libopts_cv_run_fopen_binary}])
+  if test "X${libopts_cv_run_fopen_binary}" != Xno
+  then
+    AC_DEFINE([FOPEN_BINARY_FLAG],"b",
+	[fopen(3) accepts a 'b' in the mode flag])
+  else
+    AC_DEFINE([FOPEN_BINARY_FLAG],"",
+	[fopen(3) accepts a 'b' in the mode flag])
+  fi
+
+]) # end of AC_DEFUN of LIBOPTS_RUN_FOPEN_BINARY
+
+
+AC_DEFUN([LIBOPTS_RUN_FOPEN_TEXT],[
+  AC_MSG_CHECKING([whether fopen accepts "t" mode])
+  AC_CACHE_VAL([libopts_cv_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); }])],
+    [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
+  AC_MSG_RESULT([${libopts_cv_run_fopen_text}])
+  if test "X${libopts_cv_run_fopen_text}" != Xno
+  then
+    AC_DEFINE([FOPEN_TEXT_FLAG],"t",
+	[fopen(3) accepts a 't' in the mode flag])
+  else
+    AC_DEFINE([FOPEN_TEXT_FLAG],"",
+	[fopen(3) accepts a 't' in the mode flag])
+  fi
+
+]) # end of AC_DEFUN of LIBOPTS_RUN_FOPEN_TEXT
+
+
+AC_DEFUN([LIBOPTS_DISABLE_OPTIONAL_ARGS],[
+  AC_ARG_ENABLE([optional-args],
+    AS_HELP_STRING([--disable-optional-args], [not wanting optional option args]),
+    [libopts_cv_enable_optional_args=${enable_optional_args}],
+    AC_CACHE_CHECK([whether not wanting optional option args], libopts_cv_enable_optional_args,
+      libopts_cv_enable_optional_args=yes)
+  ) # end of AC_ARG_ENABLE
+  if test "X${libopts_cv_enable_optional_args}" = Xno
+  then
+    AC_DEFINE([NO_OPTIONAL_OPT_ARGS], [1],
+          [Define this if optional arguments are disallowed])
+  fi
+
+]) # end of AC_DEFUN of LIBOPTS_DISABLE_OPTIONAL_ARGS
+
+
+AC_DEFUN([INVOKE_LIBOPTS_MACROS],[
+  AC_REQUIRE([INVOKE_LIBOPTS_MACROS_FIRST])
+  # Check to see if a reg expr header is specified.
+  LIBOPTS_WITH_REGEX_HEADER
+
+  # Check to see if a working libregex can be found.
+  LIBOPTS_WITHLIB_REGEX
+
+  # Check to see if pathfind(3) works.
+  LIBOPTS_RUN_PATHFIND
+
+  # Check to see if /dev/zero is readable device.
+  LIBOPTS_TEST_DEV_ZERO
+
+  # Check to see if we have a functional realpath(3C).
+  LIBOPTS_RUN_REALPATH
+
+  # Check to see if strftime() works.
+  LIBOPTS_RUN_STRFTIME
+
+  # Check to see if fopen accepts "b" mode.
+  LIBOPTS_RUN_FOPEN_BINARY
+
+  # Check to see if fopen accepts "t" mode.
+  LIBOPTS_RUN_FOPEN_TEXT
+
+  # Check to see if not wanting optional option args.
+  LIBOPTS_DISABLE_OPTIONAL_ARGS
+
+]) # end AC_DEFUN of INVOKE_LIBOPTS_MACROS
+
+dnl @synopsis  LIBOPTS_CHECK
+dnl
+dnl If autoopts-config works, add the linking information to LIBS.
+dnl Otherwise, add ``libopts-${ao_rev}'' to SUBDIRS and run all
+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
+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
+dnl  Free Software Foundation, either version 3 of the License, or
+dnl  (at your option) any later version.
+dnl
+dnl  AutoGen is distributed in the hope that it will be useful, but
+dnl  WITHOUT ANY WARRANTY; without even the implied warranty of
+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 <http://www.gnu.org/licenses/>.
+dnl
+dnl Default to system libopts
+dnl
+AC_DEFUN([LIBOPTS_CHECK_COMMON],[
+  AC_REQUIRE([INVOKE_LIBOPTS_MACROS_FIRST])
+  [NEED_LIBOPTS_DIR='']
+  m4_pushdef([AO_Libopts_Dir],
+	    [ifelse($1, , [libopts], [$1])])
+  AC_ARG_ENABLE([local-libopts],
+    AC_HELP_STRING([--enable-local-libopts],
+       [Use the supplied libopts tearoff code]),[
+    if test x$enableval = xyes ; then
+       AC_MSG_NOTICE([Using supplied libopts tearoff])
+       LIBOPTS_CFLAGS='-I$(top_srcdir)/AO_Libopts_Dir'
+       NEED_LIBOPTS_DIR=true
+       LIBOPTS_LDADD='$(top_builddir)/AO_Libopts_Dir/libopts.la'
+    fi])
+
+  AC_ARG_ENABLE([libopts-install],
+    AC_HELP_STRING([--enable-libopts-install],
+       [Install libopts with client installation]))
+  AM_CONDITIONAL([INSTALL_LIBOPTS],[test "X${enable_libopts_install}" = Xyes])
+
+  [if test -z "${NEED_LIBOPTS_DIR}" ; then]
+     AC_MSG_CHECKING([whether autoopts-config can be found])
+     AC_ARG_WITH([autoopts-config],
+        AC_HELP_STRING([--with-autoopts-config],
+             [specify the config-info script]),
+        [lo_cv_with_autoopts_config=${with_autoopts_config}],
+        AC_CACHE_CHECK([whether autoopts-config is specified],
+             [lo_cv_with_autoopts_config],
+             [if autoopts-config --help 2>/dev/null 1>&2
+        then lo_cv_with_autoopts_config=autoopts-config
+        elif libopts-config --help 2>/dev/null 1>&2
+        then lo_cv_with_autoopts_config=libopts-config
+        else lo_cv_with_autoopts_config=no ; fi])
+     ) # end of AC_ARG_WITH
+
+     AC_CACHE_VAL([lo_cv_test_autoopts],[
+        if test -z "${lo_cv_with_autoopts_config}" \
+                -o X"${lo_cv_with_autoopts_config}" = Xno
+        then
+           if autoopts-config --help 2>/dev/null 1>&2
+           then lo_cv_with_autoopts_config=autoopts-config
+           elif libopts-config --help 2>/dev/null 1>&2
+           then lo_cv_with_autoopts_config=libopts-config
+           else lo_cv_with_autoopts_config=false ; fi
+        fi
+        lo_cv_test_autoopts=`
+            ${lo_cv_with_autoopts_config} --libs` 2> /dev/null
+        if test $? -ne 0 -o -z "${lo_cv_test_autoopts}"
+        then lo_cv_test_autoopts=no ; fi
+     ]) # end of CACHE_VAL
+     AC_MSG_RESULT([${lo_cv_test_autoopts}])
+
+     [if test "X${lo_cv_test_autoopts}" != Xno
+     then
+        LIBOPTS_LDADD="${lo_cv_test_autoopts}"
+        LIBOPTS_CFLAGS="`${lo_cv_with_autoopts_config} --cflags`"
+     else
+        LIBOPTS_LDADD='$(top_builddir)/]AO_Libopts_Dir[/libopts.la'
+        LIBOPTS_CFLAGS='-I$(top_srcdir)/]AO_Libopts_Dir['
+        NEED_LIBOPTS_DIR=true
+     fi
+  fi # end of if test -z "${NEED_LIBOPTS_DIR}"
+  if test -n "${LIBOPTS_BUILD_BLOCKED}" ; then
+    NEED_LIBOPTS_DIR=''
+  fi]
+  AM_CONDITIONAL([NEED_LIBOPTS], [test -n "${NEED_LIBOPTS_DIR}"])
+  AC_SUBST(LIBOPTS_LDADD)
+  AC_SUBST(LIBOPTS_CFLAGS)
+  AC_SUBST(LIBOPTS_DIR, AO_Libopts_Dir)
+  m4_popdef([AO_Libopts_Dir])
+[# end of AC_DEFUN of LIBOPTS_CHECK_COMMON]
+])
+dnl
+dnl AC_CONFIG_FILES conditionalization requires using AM_COND_IF, however
+dnl AM_COND_IF is new to Automake 1.11.  To use it on new Automake without
+dnl requiring same, a fallback implementation for older Automake is provided.
+dnl Note that disabling of AC_CONFIG_FILES requires Automake 1.11, this code
+dnl is correct only in terms of m4sh generated script.
+dnl
+m4_ifndef([AM_COND_IF],
+  [AC_DEFUN([AM_COND_IF], [
+    if test -z "$$1_TRUE"; then :
+      m4_n([$2])[]dnl
+      m4_ifval([$3],[
+    else
+      $3
+    ])dnl
+    fi[]dnl
+  ])dnl
+])
+dnl
+AC_DEFUN([LIBOPTS_CHECK_NOBUILD], [
+  m4_pushdef([AO_Libopts_Dir],
+	      [ifelse($1, , [libopts], [$1])])
+  LIBOPTS_BUILD_BLOCKED=true
+  LIBOPTS_CHECK_COMMON(AO_Libopts_Dir)
+  m4_popdef([AO_Libopts_Dir])dnl
+# end of AC_DEFUN of LIBOPTS_CHECK_NOBUILD
+])
+dnl
+AC_DEFUN([LIBOPTS_CHECK], [
+  m4_pushdef([AO_Libopts_Dir],
+	      [ifelse($1, , [libopts], [$1])])
+  LIBOPTS_BUILD_BLOCKED=''
+  LIBOPTS_CHECK_COMMON(AO_Libopts_Dir)
+  AM_COND_IF([NEED_LIBOPTS], [
+    INVOKE_LIBOPTS_MACROS
+  ])
+  AC_CONFIG_FILES(AO_Libopts_Dir/Makefile)
+  m4_popdef([AO_Libopts_Dir])dnl
+# end of AC_DEFUN of LIBOPTS_CHECK
+])

File diff suppressed because it is too large
+ 1456 - 1066
m4/libtool.m4


+ 90 - 37
m4/ltoptions.m4

@@ -1,14 +1,14 @@
 # Helper functions for option handling.                    -*- Autoconf -*-
 #
-#   Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
-#   Inc.
+#   Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software
+#   Foundation, Inc.
 #   Written by Gary V. Vaughan, 2004
 #
 # This file is free software; the Free Software Foundation gives
 # unlimited permission to copy and/or distribute it, with or without
 # modifications, as long as this notice is preserved.
 
-# serial 7 ltoptions.m4
+# serial 8 ltoptions.m4
 
 # This is to help aclocal find these macros, as it can't see m4_define.
 AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
@@ -29,7 +29,7 @@ m4_define([_LT_SET_OPTION],
 [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
 m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
         _LT_MANGLE_DEFUN([$1], [$2]),
-    [m4_warning([Unknown $1 option `$2'])])[]dnl
+    [m4_warning([Unknown $1 option '$2'])])[]dnl
 ])
 
 
@@ -75,13 +75,15 @@ m4_if([$1],[LT_INIT],[
   dnl
   dnl If no reference was made to various pairs of opposing options, then
   dnl we run the default mode handler for the pair.  For example, if neither
-  dnl `shared' nor `disable-shared' was passed, we enable building of shared
+  dnl 'shared' nor 'disable-shared' was passed, we enable building of shared
   dnl archives by default:
   _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
   _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
   _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
   _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
-  		   [_LT_ENABLE_FAST_INSTALL])
+		   [_LT_ENABLE_FAST_INSTALL])
+  _LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4],
+		   [_LT_WITH_AIX_SONAME([aix])])
   ])
 ])# _LT_SET_OPTIONS
 
@@ -112,7 +114,7 @@ AU_DEFUN([AC_LIBTOOL_DLOPEN],
 [_LT_SET_OPTION([LT_INIT], [dlopen])
 AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you
-put the `dlopen' option into LT_INIT's first parameter.])
+put the 'dlopen' option into LT_INIT's first parameter.])
 ])
 
 dnl aclocal-1.4 backwards compatibility:
@@ -148,7 +150,7 @@ AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
 _LT_SET_OPTION([LT_INIT], [win32-dll])
 AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you
-put the `win32-dll' option into LT_INIT's first parameter.])
+put the 'win32-dll' option into LT_INIT's first parameter.])
 ])
 
 dnl aclocal-1.4 backwards compatibility:
@@ -157,9 +159,9 @@ dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
 
 # _LT_ENABLE_SHARED([DEFAULT])
 # ----------------------------
-# implement the --enable-shared flag, and supports the `shared' and
-# `disable-shared' LT_INIT options.
-# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+# implement the --enable-shared flag, and supports the 'shared' and
+# 'disable-shared' LT_INIT options.
+# DEFAULT is either 'yes' or 'no'.  If omitted, it defaults to 'yes'.
 m4_define([_LT_ENABLE_SHARED],
 [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
 AC_ARG_ENABLE([shared],
@@ -172,14 +174,14 @@ AC_ARG_ENABLE([shared],
     *)
       enable_shared=no
       # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
       for pkg in $enableval; do
-	IFS="$lt_save_ifs"
+	IFS=$lt_save_ifs
 	if test "X$pkg" = "X$p"; then
 	  enable_shared=yes
 	fi
       done
-      IFS="$lt_save_ifs"
+      IFS=$lt_save_ifs
       ;;
     esac],
     [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
@@ -211,9 +213,9 @@ dnl AC_DEFUN([AM_DISABLE_SHARED], [])
 
 # _LT_ENABLE_STATIC([DEFAULT])
 # ----------------------------
-# implement the --enable-static flag, and support the `static' and
-# `disable-static' LT_INIT options.
-# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+# implement the --enable-static flag, and support the 'static' and
+# 'disable-static' LT_INIT options.
+# DEFAULT is either 'yes' or 'no'.  If omitted, it defaults to 'yes'.
 m4_define([_LT_ENABLE_STATIC],
 [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
 AC_ARG_ENABLE([static],
@@ -226,14 +228,14 @@ AC_ARG_ENABLE([static],
     *)
      enable_static=no
       # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
       for pkg in $enableval; do
-	IFS="$lt_save_ifs"
+	IFS=$lt_save_ifs
 	if test "X$pkg" = "X$p"; then
 	  enable_static=yes
 	fi
       done
-      IFS="$lt_save_ifs"
+      IFS=$lt_save_ifs
       ;;
     esac],
     [enable_static=]_LT_ENABLE_STATIC_DEFAULT)
@@ -265,9 +267,9 @@ dnl AC_DEFUN([AM_DISABLE_STATIC], [])
 
 # _LT_ENABLE_FAST_INSTALL([DEFAULT])
 # ----------------------------------
-# implement the --enable-fast-install flag, and support the `fast-install'
-# and `disable-fast-install' LT_INIT options.
-# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+# implement the --enable-fast-install flag, and support the 'fast-install'
+# and 'disable-fast-install' LT_INIT options.
+# DEFAULT is either 'yes' or 'no'.  If omitted, it defaults to 'yes'.
 m4_define([_LT_ENABLE_FAST_INSTALL],
 [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
 AC_ARG_ENABLE([fast-install],
@@ -280,14 +282,14 @@ AC_ARG_ENABLE([fast-install],
     *)
       enable_fast_install=no
       # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
       for pkg in $enableval; do
-	IFS="$lt_save_ifs"
+	IFS=$lt_save_ifs
 	if test "X$pkg" = "X$p"; then
 	  enable_fast_install=yes
 	fi
       done
-      IFS="$lt_save_ifs"
+      IFS=$lt_save_ifs
       ;;
     esac],
     [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
@@ -304,14 +306,14 @@ AU_DEFUN([AC_ENABLE_FAST_INSTALL],
 [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
 AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you put
-the `fast-install' option into LT_INIT's first parameter.])
+the 'fast-install' option into LT_INIT's first parameter.])
 ])
 
 AU_DEFUN([AC_DISABLE_FAST_INSTALL],
 [_LT_SET_OPTION([LT_INIT], [disable-fast-install])
 AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you put
-the `disable-fast-install' option into LT_INIT's first parameter.])
+the 'disable-fast-install' option into LT_INIT's first parameter.])
 ])
 
 dnl aclocal-1.4 backwards compatibility:
@@ -319,11 +321,64 @@ dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
 dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
 
 
+# _LT_WITH_AIX_SONAME([DEFAULT])
+# ----------------------------------
+# implement the --with-aix-soname flag, and support the `aix-soname=aix'
+# and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT
+# is either `aix', `both' or `svr4'.  If omitted, it defaults to `aix'.
+m4_define([_LT_WITH_AIX_SONAME],
+[m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl
+shared_archive_member_spec=
+case $host,$enable_shared in
+power*-*-aix[[5-9]]*,yes)
+  AC_MSG_CHECKING([which variant of shared library versioning to provide])
+  AC_ARG_WITH([aix-soname],
+    [AS_HELP_STRING([--with-aix-soname=aix|svr4|both],
+      [shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])],
+    [case $withval in
+    aix|svr4|both)
+      ;;
+    *)
+      AC_MSG_ERROR([Unknown argument to --with-aix-soname])
+      ;;
+    esac
+    lt_cv_with_aix_soname=$with_aix_soname],
+    [AC_CACHE_VAL([lt_cv_with_aix_soname],
+      [lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT)
+    with_aix_soname=$lt_cv_with_aix_soname])
+  AC_MSG_RESULT([$with_aix_soname])
+  if test aix != "$with_aix_soname"; then
+    # For the AIX way of multilib, we name the shared archive member
+    # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o',
+    # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File.
+    # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag,
+    # the AIX toolchain works better with OBJECT_MODE set (default 32).
+    if test 64 = "${OBJECT_MODE-32}"; then
+      shared_archive_member_spec=shr_64
+    else
+      shared_archive_member_spec=shr
+    fi
+  fi
+  ;;
+*)
+  with_aix_soname=aix
+  ;;
+esac
+
+_LT_DECL([], [shared_archive_member_spec], [0],
+    [Shared archive member basename, for filename based shared library versioning on AIX])dnl
+])# _LT_WITH_AIX_SONAME
+
+LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])])
+LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])])
+LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])])
+
+
 # _LT_WITH_PIC([MODE])
 # --------------------
-# implement the --with-pic flag, and support the `pic-only' and `no-pic'
+# implement the --with-pic flag, and support the 'pic-only' and 'no-pic'
 # LT_INIT options.
-# MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
+# MODE is either 'yes' or 'no'.  If omitted, it defaults to 'both'.
 m4_define([_LT_WITH_PIC],
 [AC_ARG_WITH([pic],
     [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
@@ -334,19 +389,17 @@ m4_define([_LT_WITH_PIC],
     *)
       pic_mode=default
       # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
       for lt_pkg in $withval; do
-	IFS="$lt_save_ifs"
+	IFS=$lt_save_ifs
 	if test "X$lt_pkg" = "X$lt_p"; then
 	  pic_mode=yes
 	fi
       done
-      IFS="$lt_save_ifs"
+      IFS=$lt_save_ifs
       ;;
     esac],
-    [pic_mode=default])
-
-test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
+    [pic_mode=m4_default([$1], [default])])
 
 _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
 ])# _LT_WITH_PIC
@@ -359,7 +412,7 @@ AU_DEFUN([AC_LIBTOOL_PICMODE],
 [_LT_SET_OPTION([LT_INIT], [pic-only])
 AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you
-put the `pic-only' option into LT_INIT's first parameter.])
+put the 'pic-only' option into LT_INIT's first parameter.])
 ])
 
 dnl aclocal-1.4 backwards compatibility:

+ 4 - 3
m4/ltsugar.m4

@@ -1,6 +1,7 @@
 # ltsugar.m4 -- libtool m4 base layer.                         -*-Autoconf-*-
 #
-# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+# Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software
+# Foundation, Inc.
 # Written by Gary V. Vaughan, 2004
 #
 # This file is free software; the Free Software Foundation gives
@@ -33,7 +34,7 @@ m4_define([_lt_join],
 # ------------
 # Manipulate m4 lists.
 # These macros are necessary as long as will still need to support
-# Autoconf-2.59 which quotes differently.
+# Autoconf-2.59, which quotes differently.
 m4_define([lt_car], [[$1]])
 m4_define([lt_cdr],
 [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
@@ -44,7 +45,7 @@ m4_define([lt_unquote], $1)
 
 # lt_append(MACRO-NAME, STRING, [SEPARATOR])
 # ------------------------------------------
-# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
+# Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'.
 # Note that neither SEPARATOR nor STRING are expanded; they are appended
 # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
 # No SEPARATOR is output if MACRO-NAME was previously undefined (different

+ 6 - 6
m4/ltversion.m4

@@ -1,6 +1,6 @@
 # ltversion.m4 -- version numbers			-*- Autoconf -*-
 #
-#   Copyright (C) 2004 Free Software Foundation, Inc.
+#   Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc.
 #   Written by Scott James Remnant, 2004
 #
 # This file is free software; the Free Software Foundation gives
@@ -9,15 +9,15 @@
 
 # @configure_input@
 
-# serial 3337 ltversion.m4
+# serial 4179 ltversion.m4
 # This file is part of GNU Libtool
 
-m4_define([LT_PACKAGE_VERSION], [2.4.2])
-m4_define([LT_PACKAGE_REVISION], [1.3337])
+m4_define([LT_PACKAGE_VERSION], [2.4.6])
+m4_define([LT_PACKAGE_REVISION], [2.4.6])
 
 AC_DEFUN([LTVERSION_VERSION],
-[macro_version='2.4.2'
-macro_revision='1.3337'
+[macro_version='2.4.6'
+macro_revision='2.4.6'
 _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
 _LT_DECL(, macro_revision, 0)
 ])

+ 4 - 3
m4/lt~obsolete.m4

@@ -1,6 +1,7 @@
 # lt~obsolete.m4 -- aclocal satisfying obsolete definitions.    -*-Autoconf-*-
 #
-#   Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
+#   Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software
+#   Foundation, Inc.
 #   Written by Scott James Remnant, 2004.
 #
 # This file is free software; the Free Software Foundation gives
@@ -11,7 +12,7 @@
 
 # These exist entirely to fool aclocal when bootstrapping libtool.
 #
-# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
+# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN),
 # which have later been changed to m4_define as they aren't part of the
 # exported API, or moved to Autoconf or Automake where they belong.
 #
@@ -25,7 +26,7 @@
 # included after everything else.  This provides aclocal with the
 # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
 # because those macros already exist, or will be overwritten later.
-# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. 
+# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
 #
 # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
 # Yes, that means every name once taken will need to remain here until

+ 41 - 0
m4/stdnoreturn.m4

@@ -0,0 +1,41 @@
+# Check for stdnoreturn.h that conforms to C11.
+
+dnl Copyright 2012-2016 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.
+
+# Prepare for substituting <stdnoreturn.h> if it is not supported.
+
+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_SUBST([STDNORETURN_H])
+  AM_CONDITIONAL([GL_GENERATE_STDNORETURN_H], [test -n "$STDNORETURN_H"])
+])

+ 25 - 11
scripts/Makefile.in

@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -14,7 +14,17 @@
 
 @SET_MAKE@
 VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__is_gnu_make = { \
+  if test -z '$(MAKELEVEL)'; then \
+    false; \
+  elif test -n '$(MAKE_HOST)'; then \
+    true; \
+  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+    true; \
+  else \
+    false; \
+  fi; \
+}
 am__make_running_with_option = \
   case $${target_option-} in \
       ?) ;; \
@@ -79,16 +89,16 @@ build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
 subdir = scripts
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
-	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
-	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
-	$(top_srcdir)/libopts/m4/libopts.m4 \
-	$(top_srcdir)/libopts/m4/stdnoreturn.m4 \
-	$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/libopts.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/m4/lt~obsolete.m4 \
+	$(top_srcdir)/m4/stdnoreturn.m4 $(top_srcdir)/acinclude.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/src/config.h
 CONFIG_CLEAN_FILES =
@@ -113,6 +123,7 @@ am__can_run_installinfo = \
     *) (install-info --version) >/dev/null 2>&1;; \
   esac
 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+am__DIST_COMMON = $(srcdir)/Makefile.in
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
@@ -173,6 +184,7 @@ LN_S = @LN_S@
 LPCAPINC = @LPCAPINC@
 LPCAPLIB = @LPCAPLIB@
 LTLIBOBJS = @LTLIBOBJS@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
 MACOSX_SDK_PATH = @MACOSX_SDK_PATH@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
@@ -263,6 +275,7 @@ prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
 rmmod = @rmmod@
+runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
@@ -294,7 +307,6 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign scripts/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
 	  $(AUTOMAKE) --foreign scripts/Makefile
-.PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
 	  *config.status*) \
@@ -470,6 +482,8 @@ uninstall-am:
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
 	tags-am uninstall uninstall-am
 
+.PRECIOUS: Makefile
+
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.

+ 23 - 23
src/Makefile.am

@@ -27,25 +27,25 @@ autoopts: tcpreplay_opts.c tcprewrite_opts.c tcpbridge_opts.c tcpliveplay_opts.c
 opts_list=-L tcpedit
 
 tcpprep.1: tcpprep_opts.def
-	@AUTOGEN@ -T agman-cmd.tpl $(opts_list) tcpprep_opts.def
+	@AUTOGEN@ -T agman-cmd.tpl $(opts_list) $<
 
 tcprewrite.1: tcprewrite_opts.def tcpedit/tcpedit_opts.def
-	@AUTOGEN@ -T agman-cmd.tpl $(opts_list) tcprewrite_opts.def
+	@AUTOGEN@ -T agman-cmd.tpl $(opts_list) $<
 
 tcpreplay-edit.1: tcpreplay_opts.def
-	@AUTOGEN@ -T agman-cmd.tpl $(opts_list) -DTCPREPLAY_EDIT -DTCPREPLAY_EDIT_MAN tcpreplay_opts.def
+	@AUTOGEN@ -T agman-cmd.tpl $(opts_list) -DTCPREPLAY_EDIT -DTCPREPLAY_EDIT_MAN $<
 
 tcpreplay.1: tcpreplay_opts.def
-	@AUTOGEN@ -T agman-cmd.tpl $(opts_list) tcpreplay_opts.def
+	@AUTOGEN@ -T agman-cmd.tpl $(opts_list) $<
 
 tcpbridge.1: tcpbridge_opts.def
-	@AUTOGEN@ -T agman-cmd.tpl $(opts_list) tcpbridge_opts.def
+	@AUTOGEN@ -T agman-cmd.tpl $(opts_list) $<
 
 tcpliveplay.1: tcpliveplay_opts.def 
-	@AUTOGEN@ -T agman-cmd.tpl $(opts_list) tcpliveplay_opts.def
+	@AUTOGEN@ -T agman-cmd.tpl $(opts_list) $<
 
 tcpcapinfo.1: tcpcapinfo_opts.def 
-	@AUTOGEN@ -T agman-cmd.tpl $(opts_list) tcpcapinfo_opts.def
+	@AUTOGEN@ -T agman-cmd.tpl $(opts_list) $<
 
 man_MANS = tcpreplay.1 tcpprep.1 tcprewrite.1 tcpreplay-edit.1 tcpcapinfo.1
 EXTRA_DIST = tcpreplay.1 tcpprep.1 tcprewrite.1 tcpbridge.1 tcpreplay-edit.1 \
@@ -62,32 +62,32 @@ bin_PROGRAMS += tcpliveplay
 man_MANS += tcpliveplay.1
 endif
 
-tcpreplay_edit_CFLAGS = $(LIBOPTS_CFLAGS) -I.. -Itcpedit $(LNAV_CFLAGS) @LDNETINC@ -DTCPREPLAY -DTCPREPLAY_EDIT -DHAVE_CACHEFILE_SUPPORT
+tcpreplay_edit_CFLAGS = $(LIBOPTS_CFLAGS) -I$(srcdir)/.. -I$(srcdir)/tcpedit $(LNAV_CFLAGS) @LDNETINC@ -DTCPREPLAY -DTCPREPLAY_EDIT -DHAVE_CACHEFILE_SUPPORT
 tcpreplay_edit_LDADD = ./tcpedit/libtcpedit.a ./common/libcommon.a $(LIBSTRL) @LPCAPLIB@ @LDNETLIB@ $(LIBOPTS_LDADD)
-tcpreplay_edit_SOURCES = tcpreplay_edit_opts.c send_packets.c signal_handler.c tcpreplay.c tcpreplay_api.c replay.c
+tcpreplay_edit_SOURCES = tcpreplay_edit_opts.c send_packets.c signal_handler.c tcpreplay.c tcpreplay_api.c sleep.c replay.c
 tcpreplay_edit_OBJECTS: tcpreplay_opts.h
 tcpreplay_edit_opts.h: tcpreplay_edit_opts.c
 
 BUILT_SOURCES += tcpreplay_edit_opts.h
 tcpreplay_edit_opts.c: tcpreplay_opts.def
-	@AUTOGEN@ $(opts_list)  @NETMAPFLAGS@ -DTCPREPLAY_EDIT -b tcpreplay_edit_opts tcpreplay_opts.def
+	@AUTOGEN@ $(opts_list)  @NETMAPFLAGS@ -DTCPREPLAY_EDIT -b tcpreplay_edit_opts $<
 
-tcpreplay_CFLAGS = $(LIBOPTS_CFLAGS) -I.. $(LNAV_CFLAGS) @LDNETINC@ -DTCPREPLAY
-tcpreplay_SOURCES = tcpreplay_opts.c send_packets.c signal_handler.c tcpreplay.c tcpreplay_api.c replay.c
+tcpreplay_CFLAGS = $(LIBOPTS_CFLAGS) -I$(srcdir)/.. $(LNAV_CFLAGS) @LDNETINC@ -DTCPREPLAY
+tcpreplay_SOURCES = tcpreplay_opts.c send_packets.c signal_handler.c tcpreplay.c tcpreplay_api.c sleep.c replay.c
 tcpreplay_LDADD = ./common/libcommon.a $(LIBSTRL) @LPCAPLIB@ @LDNETLIB@ $(LIBOPTS_LDADD)
 tcpreplay_OBJECTS: tcpreplay_opts.h
 tcpreplay_opts.h: tcpreplay_opts.c
 
 BUILT_SOURCES += tcpreplay_opts.h
 tcpreplay_opts.c: tcpreplay_opts.def
-	@AUTOGEN@ $(opts_list) @NETMAPFLAGS@ tcpreplay_opts.def
+	@AUTOGEN@ $(opts_list) @NETMAPFLAGS@ $<
 
 if ENABLE_OSX_FRAMEWORKS
 tcpreplay_LDFLAGS = -framework CoreServices -framework Carbon
 tcpreplay_edit_LDFLAGS = -framework CoreServices -framework Carbon
 endif
 
-tcpliveplay_CFLAGS = $(LIBOPTS_CFLAGS) -I.. $(LNAV_CFLAGS) -DTCPREPLAY -DTCPLIVEPLAY
+tcpliveplay_CFLAGS = $(LIBOPTS_CFLAGS) -I$(srcdir)/.. $(LNAV_CFLAGS) -DTCPREPLAY -DTCPLIVEPLAY
 tcpliveplay_SOURCES = tcpliveplay_opts.c tcpliveplay.c
 tcpliveplay_LDADD = ./common/libcommon.a $(LIBSTRL) @LPCAPLIB@ @LDNETLIB@ $(LIBOPTS_LDADD)
 tcpliveplay_OBJECTS: tcpliveplay_opts.h
@@ -95,10 +95,10 @@ tcpliveplay_opts.h: tcpliveplay_opts.c
 
 BUILT_SOURCES += tcpliveplay_opts.h
 tcpliveplay_opts.c: tcpliveplay_opts.def
-	@AUTOGEN@ $(opts_list) tcpliveplay_opts.def
+	@AUTOGEN@ $(opts_list) $<
 
 
-tcprewrite_CFLAGS = $(LIBOPTS_CFLAGS) -I.. -Itcpedit @LDNETINC@ $(LNAV_CFLAGS) -DTCPREWRITE -DHAVE_CACHEFILE_SUPPORT
+tcprewrite_CFLAGS = $(LIBOPTS_CFLAGS) -I$(srcdir)/.. -I$(srcdir)/tcpedit @LDNETINC@ $(LNAV_CFLAGS) -DTCPREWRITE -DHAVE_CACHEFILE_SUPPORT
 tcprewrite_LDADD = ./tcpedit/libtcpedit.a ./common/libcommon.a \
 	$(LIBSTRL) @LPCAPLIB@ $(LIBOPTS_LDADD) @DMALLOC_LIB@ \
 	$(LIBFRAGROUTE)
@@ -108,9 +108,9 @@ tcprewrite_opts.h: tcprewrite_opts.c
 
 BUILT_SOURCES += tcprewrite_opts.h
 tcprewrite_opts.c: tcprewrite_opts.def tcpedit/tcpedit_opts.def
-	@AUTOGEN@ $(opts_list) tcprewrite_opts.def
+	@AUTOGEN@ $(opts_list) $<
 
-tcpcapinfo_CFLAGS = $(LIBOPTS_CFLAGS) -I.. $(LNAV_CFLAGS) @LDNETINC@ -DTCPCAPINFO
+tcpcapinfo_CFLAGS = $(LIBOPTS_CFLAGS) -I$(srcdir)/.. $(LNAV_CFLAGS) @LDNETINC@ -DTCPCAPINFO
 tcpcapinfo_LDADD = ./common/libcommon.a \
     $(LIBSTRL) @LPCAPLIB@ $(LIBOPTS_LDADD) @DMALLOC_LIB@
 tcpcapinfo_SOURCES = tcpcapinfo_opts.c tcpcapinfo.c
@@ -119,9 +119,9 @@ tcpcapinfo_opts.h: tcpcapinfo_opts.c
 
 BUILT_SOURCES += tcpcapinfo_opts.h
 tcpcapinfo_opts.c: tcpcapinfo_opts.def
-	@AUTOGEN@ $(opts_list) tcpcapinfo_opts.def
+	@AUTOGEN@ $(opts_list) $<
 
-tcpprep_CFLAGS = $(LIBOPTS_CFLAGS) -I.. $(LNAV_CFLAGS) @LDNETINC@ -DTCPPREP
+tcpprep_CFLAGS = $(LIBOPTS_CFLAGS) -I$(srcdir)/.. $(LNAV_CFLAGS) @LDNETINC@ -DTCPPREP
 tcpprep_LDADD = ./common/libcommon.a \
     $(LIBSTRL) @LPCAPLIB@ $(LIBOPTS_LDADD) @DMALLOC_LIB@
 tcpprep_SOURCES = tcpprep_opts.c tcpprep.c tree.c tcpprep_api.c
@@ -130,9 +130,9 @@ tcpprep_opts.h: tcpprep_opts.c
 
 BUILT_SOURCES += tcpprep_opts.h
 tcpprep_opts.c: tcpprep_opts.def
-	@AUTOGEN@ tcpprep_opts.def
+	@AUTOGEN@ $<
 
-tcpbridge_CFLAGS = $(LIBOPTS_CFLAGS) -I.. -Itcpedit $(LNAV_CFLAGS) @LDNETINC@ -DTCPBRIDGE
+tcpbridge_CFLAGS = $(LIBOPTS_CFLAGS) -I$(srcdir)/.. -I$(srcdir)/tcpedit $(LNAV_CFLAGS) @LDNETINC@ -DTCPBRIDGE
 tcpbridge_LDADD = ./tcpedit/libtcpedit.a ./common/libcommon.a \
     $(LIBSTRL) @LPCAPLIB@ @LDNETLIB@ $(LIBOPTS_LDADD) @DMALLOC_LIB@
 if ENABLE_OSX_FRAMEWORKS
@@ -144,7 +144,7 @@ tcpbridge_opts.h: tcpbridge_opts.c
 
 BUILT_SOURCES += tcpbridge_opts.h
 tcpbridge_opts.c: tcpbridge_opts.def tcpedit/tcpedit_opts.def
-	@AUTOGEN@ $(opts_list) tcpbridge_opts.def
+	@AUTOGEN@ $(opts_list) $<
 
 noinst_HEADERS = tcpreplay.h tcpprep.h bridge.h defines.h tree.h tcpliveplay.h \
 		 send_packets.h signal_handler.h common.h tcpreplay_opts.h tcpliveplay_opts.h \

+ 92 - 44
src/Makefile.in

@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -16,7 +16,17 @@
 
 
 VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__is_gnu_make = { \
+  if test -z '$(MAKELEVEL)'; then \
+    false; \
+  elif test -n '$(MAKE_HOST)'; then \
+    true; \
+  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+    true; \
+  else \
+    false; \
+  fi; \
+}
 am__make_running_with_option = \
   case $${target_option-} in \
       ?) ;; \
@@ -88,18 +98,17 @@ bin_PROGRAMS = tcpreplay$(EXEEXT) tcpprep$(EXEEXT) tcprewrite$(EXEEXT) \
 @COMPILE_TCPLIVEPLAY_TRUE@am__append_3 = tcpliveplay 
 @COMPILE_TCPLIVEPLAY_TRUE@am__append_4 = tcpliveplay.1
 subdir = src
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
-	$(srcdir)/config.h.in $(srcdir)/defines.h.in \
-	$(top_srcdir)/config/depcomp $(noinst_HEADERS)
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
-	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
-	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
-	$(top_srcdir)/libopts/m4/libopts.m4 \
-	$(top_srcdir)/libopts/m4/stdnoreturn.m4 \
-	$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/libopts.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/m4/lt~obsolete.m4 \
+	$(top_srcdir)/m4/stdnoreturn.m4 $(top_srcdir)/acinclude.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \
+	$(am__DIST_COMMON)
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = config.h
 CONFIG_CLEAN_FILES = defines.h
@@ -151,7 +160,8 @@ am_tcpreplay_OBJECTS = tcpreplay-tcpreplay_opts.$(OBJEXT) \
 	tcpreplay-send_packets.$(OBJEXT) \
 	tcpreplay-signal_handler.$(OBJEXT) \
 	tcpreplay-tcpreplay.$(OBJEXT) \
-	tcpreplay-tcpreplay_api.$(OBJEXT) tcpreplay-replay.$(OBJEXT)
+	tcpreplay-tcpreplay_api.$(OBJEXT) tcpreplay-sleep.$(OBJEXT) \
+	tcpreplay-replay.$(OBJEXT)
 tcpreplay_OBJECTS = $(am_tcpreplay_OBJECTS)
 tcpreplay_DEPENDENCIES = ./common/libcommon.a $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_2)
@@ -164,7 +174,7 @@ am_tcpreplay_edit_OBJECTS =  \
 	tcpreplay_edit-signal_handler.$(OBJEXT) \
 	tcpreplay_edit-tcpreplay.$(OBJEXT) \
 	tcpreplay_edit-tcpreplay_api.$(OBJEXT) \
-	tcpreplay_edit-replay.$(OBJEXT)
+	tcpreplay_edit-sleep.$(OBJEXT) tcpreplay_edit-replay.$(OBJEXT)
 tcpreplay_edit_OBJECTS = $(am_tcpreplay_edit_OBJECTS)
 tcpreplay_edit_DEPENDENCIES = ./tcpedit/libtcpedit.a \
 	./common/libcommon.a $(am__DEPENDENCIES_1) \
@@ -297,6 +307,8 @@ am__define_uniq_tagged_files = \
 ETAGS = etags
 CTAGS = ctags
 DIST_SUBDIRS = common tcpedit fragroute
+am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \
+	$(srcdir)/defines.h.in $(top_srcdir)/config/depcomp
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 am__relativize = \
   dir0=`pwd`; \
@@ -382,6 +394,7 @@ LN_S = @LN_S@
 LPCAPINC = @LPCAPINC@
 LPCAPLIB = @LPCAPLIB@
 LTLIBOBJS = @LTLIBOBJS@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
 MACOSX_SDK_PATH = @MACOSX_SDK_PATH@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
@@ -472,6 +485,7 @@ prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
 rmmod = @rmmod@
+runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
@@ -506,34 +520,34 @@ man_MANS = tcpreplay.1 tcpprep.1 tcprewrite.1 tcpreplay-edit.1 \
 EXTRA_DIST = tcpreplay.1 tcpprep.1 tcprewrite.1 tcpbridge.1 tcpreplay-edit.1 \
 	tcpliveplay.1 tcpcapinfo.1
 
-tcpreplay_edit_CFLAGS = $(LIBOPTS_CFLAGS) -I.. -Itcpedit $(LNAV_CFLAGS) @LDNETINC@ -DTCPREPLAY -DTCPREPLAY_EDIT -DHAVE_CACHEFILE_SUPPORT
+tcpreplay_edit_CFLAGS = $(LIBOPTS_CFLAGS) -I$(srcdir)/.. -I$(srcdir)/tcpedit $(LNAV_CFLAGS) @LDNETINC@ -DTCPREPLAY -DTCPREPLAY_EDIT -DHAVE_CACHEFILE_SUPPORT
 tcpreplay_edit_LDADD = ./tcpedit/libtcpedit.a ./common/libcommon.a $(LIBSTRL) @LPCAPLIB@ @LDNETLIB@ $(LIBOPTS_LDADD)
-tcpreplay_edit_SOURCES = tcpreplay_edit_opts.c send_packets.c signal_handler.c tcpreplay.c tcpreplay_api.c replay.c
-tcpreplay_CFLAGS = $(LIBOPTS_CFLAGS) -I.. $(LNAV_CFLAGS) @LDNETINC@ -DTCPREPLAY
-tcpreplay_SOURCES = tcpreplay_opts.c send_packets.c signal_handler.c tcpreplay.c tcpreplay_api.c replay.c
+tcpreplay_edit_SOURCES = tcpreplay_edit_opts.c send_packets.c signal_handler.c tcpreplay.c tcpreplay_api.c sleep.c replay.c
+tcpreplay_CFLAGS = $(LIBOPTS_CFLAGS) -I$(srcdir)/.. $(LNAV_CFLAGS) @LDNETINC@ -DTCPREPLAY
+tcpreplay_SOURCES = tcpreplay_opts.c send_packets.c signal_handler.c tcpreplay.c tcpreplay_api.c sleep.c replay.c
 tcpreplay_LDADD = ./common/libcommon.a $(LIBSTRL) @LPCAPLIB@ @LDNETLIB@ $(LIBOPTS_LDADD)
 @ENABLE_OSX_FRAMEWORKS_TRUE@tcpreplay_LDFLAGS = -framework CoreServices -framework Carbon
 @ENABLE_OSX_FRAMEWORKS_TRUE@tcpreplay_edit_LDFLAGS = -framework CoreServices -framework Carbon
-tcpliveplay_CFLAGS = $(LIBOPTS_CFLAGS) -I.. $(LNAV_CFLAGS) -DTCPREPLAY -DTCPLIVEPLAY
+tcpliveplay_CFLAGS = $(LIBOPTS_CFLAGS) -I$(srcdir)/.. $(LNAV_CFLAGS) -DTCPREPLAY -DTCPLIVEPLAY
 tcpliveplay_SOURCES = tcpliveplay_opts.c tcpliveplay.c
 tcpliveplay_LDADD = ./common/libcommon.a $(LIBSTRL) @LPCAPLIB@ @LDNETLIB@ $(LIBOPTS_LDADD)
-tcprewrite_CFLAGS = $(LIBOPTS_CFLAGS) -I.. -Itcpedit @LDNETINC@ $(LNAV_CFLAGS) -DTCPREWRITE -DHAVE_CACHEFILE_SUPPORT
+tcprewrite_CFLAGS = $(LIBOPTS_CFLAGS) -I$(srcdir)/.. -I$(srcdir)/tcpedit @LDNETINC@ $(LNAV_CFLAGS) -DTCPREWRITE -DHAVE_CACHEFILE_SUPPORT
 tcprewrite_LDADD = ./tcpedit/libtcpedit.a ./common/libcommon.a \
 	$(LIBSTRL) @LPCAPLIB@ $(LIBOPTS_LDADD) @DMALLOC_LIB@ \
 	$(LIBFRAGROUTE)
 
 tcprewrite_SOURCES = tcprewrite_opts.c tcprewrite.c 
-tcpcapinfo_CFLAGS = $(LIBOPTS_CFLAGS) -I.. $(LNAV_CFLAGS) @LDNETINC@ -DTCPCAPINFO
+tcpcapinfo_CFLAGS = $(LIBOPTS_CFLAGS) -I$(srcdir)/.. $(LNAV_CFLAGS) @LDNETINC@ -DTCPCAPINFO
 tcpcapinfo_LDADD = ./common/libcommon.a \
     $(LIBSTRL) @LPCAPLIB@ $(LIBOPTS_LDADD) @DMALLOC_LIB@
 
 tcpcapinfo_SOURCES = tcpcapinfo_opts.c tcpcapinfo.c
-tcpprep_CFLAGS = $(LIBOPTS_CFLAGS) -I.. $(LNAV_CFLAGS) @LDNETINC@ -DTCPPREP
+tcpprep_CFLAGS = $(LIBOPTS_CFLAGS) -I$(srcdir)/.. $(LNAV_CFLAGS) @LDNETINC@ -DTCPPREP
 tcpprep_LDADD = ./common/libcommon.a \
     $(LIBSTRL) @LPCAPLIB@ $(LIBOPTS_LDADD) @DMALLOC_LIB@
 
 tcpprep_SOURCES = tcpprep_opts.c tcpprep.c tree.c tcpprep_api.c
-tcpbridge_CFLAGS = $(LIBOPTS_CFLAGS) -I.. -Itcpedit $(LNAV_CFLAGS) @LDNETINC@ -DTCPBRIDGE
+tcpbridge_CFLAGS = $(LIBOPTS_CFLAGS) -I$(srcdir)/.. -I$(srcdir)/tcpedit $(LNAV_CFLAGS) @LDNETINC@ -DTCPBRIDGE
 tcpbridge_LDADD = ./tcpedit/libtcpedit.a ./common/libcommon.a \
     $(LIBSTRL) @LPCAPLIB@ @LDNETLIB@ $(LIBOPTS_LDADD) @DMALLOC_LIB@
 
@@ -572,7 +586,6 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
 	  $(AUTOMAKE) --foreign src/Makefile
-.PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
 	  *config.status*) \
@@ -705,12 +718,14 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcpreplay-replay.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcpreplay-send_packets.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcpreplay-signal_handler.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcpreplay-sleep.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcpreplay-tcpreplay.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcpreplay-tcpreplay_api.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcpreplay-tcpreplay_opts.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcpreplay_edit-replay.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcpreplay_edit-send_packets.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcpreplay_edit-signal_handler.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcpreplay_edit-sleep.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcpreplay_edit-tcpreplay.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcpreplay_edit-tcpreplay_api.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcpreplay_edit-tcpreplay_edit_opts.Po@am__quote@
@@ -718,22 +733,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcprewrite-tcprewrite_opts.Po@am__quote@
 
 .c.o:
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
 
 .c.obj:
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+@am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .c.lo:
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+@am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
@@ -962,6 +980,20 @@ tcpreplay-tcpreplay_api.obj: tcpreplay_api.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tcpreplay_CFLAGS) $(CFLAGS) -c -o tcpreplay-tcpreplay_api.obj `if test -f 'tcpreplay_api.c'; then $(CYGPATH_W) 'tcpreplay_api.c'; else $(CYGPATH_W) '$(srcdir)/tcpreplay_api.c'; fi`
 
+tcpreplay-sleep.o: sleep.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tcpreplay_CFLAGS) $(CFLAGS) -MT tcpreplay-sleep.o -MD -MP -MF $(DEPDIR)/tcpreplay-sleep.Tpo -c -o tcpreplay-sleep.o `test -f 'sleep.c' || echo '$(srcdir)/'`sleep.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/tcpreplay-sleep.Tpo $(DEPDIR)/tcpreplay-sleep.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='sleep.c' object='tcpreplay-sleep.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tcpreplay_CFLAGS) $(CFLAGS) -c -o tcpreplay-sleep.o `test -f 'sleep.c' || echo '$(srcdir)/'`sleep.c
+
+tcpreplay-sleep.obj: sleep.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tcpreplay_CFLAGS) $(CFLAGS) -MT tcpreplay-sleep.obj -MD -MP -MF $(DEPDIR)/tcpreplay-sleep.Tpo -c -o tcpreplay-sleep.obj `if test -f 'sleep.c'; then $(CYGPATH_W) 'sleep.c'; else $(CYGPATH_W) '$(srcdir)/sleep.c'; fi`
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/tcpreplay-sleep.Tpo $(DEPDIR)/tcpreplay-sleep.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='sleep.c' object='tcpreplay-sleep.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tcpreplay_CFLAGS) $(CFLAGS) -c -o tcpreplay-sleep.obj `if test -f 'sleep.c'; then $(CYGPATH_W) 'sleep.c'; else $(CYGPATH_W) '$(srcdir)/sleep.c'; fi`
+
 tcpreplay-replay.o: replay.c
 @am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tcpreplay_CFLAGS) $(CFLAGS) -MT tcpreplay-replay.o -MD -MP -MF $(DEPDIR)/tcpreplay-replay.Tpo -c -o tcpreplay-replay.o `test -f 'replay.c' || echo '$(srcdir)/'`replay.c
 @am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/tcpreplay-replay.Tpo $(DEPDIR)/tcpreplay-replay.Po
@@ -1046,6 +1078,20 @@ tcpreplay_edit-tcpreplay_api.obj: tcpreplay_api.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tcpreplay_edit_CFLAGS) $(CFLAGS) -c -o tcpreplay_edit-tcpreplay_api.obj `if test -f 'tcpreplay_api.c'; then $(CYGPATH_W) 'tcpreplay_api.c'; else $(CYGPATH_W) '$(srcdir)/tcpreplay_api.c'; fi`
 
+tcpreplay_edit-sleep.o: sleep.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tcpreplay_edit_CFLAGS) $(CFLAGS) -MT tcpreplay_edit-sleep.o -MD -MP -MF $(DEPDIR)/tcpreplay_edit-sleep.Tpo -c -o tcpreplay_edit-sleep.o `test -f 'sleep.c' || echo '$(srcdir)/'`sleep.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/tcpreplay_edit-sleep.Tpo $(DEPDIR)/tcpreplay_edit-sleep.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='sleep.c' object='tcpreplay_edit-sleep.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tcpreplay_edit_CFLAGS) $(CFLAGS) -c -o tcpreplay_edit-sleep.o `test -f 'sleep.c' || echo '$(srcdir)/'`sleep.c
+
+tcpreplay_edit-sleep.obj: sleep.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tcpreplay_edit_CFLAGS) $(CFLAGS) -MT tcpreplay_edit-sleep.obj -MD -MP -MF $(DEPDIR)/tcpreplay_edit-sleep.Tpo -c -o tcpreplay_edit-sleep.obj `if test -f 'sleep.c'; then $(CYGPATH_W) 'sleep.c'; else $(CYGPATH_W) '$(srcdir)/sleep.c'; fi`
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/tcpreplay_edit-sleep.Tpo $(DEPDIR)/tcpreplay_edit-sleep.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='sleep.c' object='tcpreplay_edit-sleep.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tcpreplay_edit_CFLAGS) $(CFLAGS) -c -o tcpreplay_edit-sleep.obj `if test -f 'sleep.c'; then $(CYGPATH_W) 'sleep.c'; else $(CYGPATH_W) '$(srcdir)/sleep.c'; fi`
+
 tcpreplay_edit-replay.o: replay.c
 @am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tcpreplay_edit_CFLAGS) $(CFLAGS) -MT tcpreplay_edit-replay.o -MD -MP -MF $(DEPDIR)/tcpreplay_edit-replay.Tpo -c -o tcpreplay_edit-replay.o `test -f 'replay.c' || echo '$(srcdir)/'`replay.c
 @am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/tcpreplay_edit-replay.Tpo $(DEPDIR)/tcpreplay_edit-replay.Po
@@ -1425,6 +1471,8 @@ uninstall-man: uninstall-man1
 	pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \
 	uninstall-binPROGRAMS uninstall-man uninstall-man1
 
+.PRECIOUS: Makefile
+
 
 manpages: tcpprep.1 tcprewrite.1 tcpreplay.1 tcpbridge.1 tcpreplay-edit.1 tcpliveplay.1 tcpcapinfo.1
 
@@ -1432,53 +1480,53 @@ autoopts: tcpreplay_opts.c tcprewrite_opts.c tcpbridge_opts.c tcpliveplay_opts.c
 	manpages tcpreplay_edit_opts.c
 
 tcpprep.1: tcpprep_opts.def
-	@AUTOGEN@ -T agman-cmd.tpl $(opts_list) tcpprep_opts.def
+	@AUTOGEN@ -T agman-cmd.tpl $(opts_list) $<
 
 tcprewrite.1: tcprewrite_opts.def tcpedit/tcpedit_opts.def
-	@AUTOGEN@ -T agman-cmd.tpl $(opts_list) tcprewrite_opts.def
+	@AUTOGEN@ -T agman-cmd.tpl $(opts_list) $<
 
 tcpreplay-edit.1: tcpreplay_opts.def
-	@AUTOGEN@ -T agman-cmd.tpl $(opts_list) -DTCPREPLAY_EDIT -DTCPREPLAY_EDIT_MAN tcpreplay_opts.def
+	@AUTOGEN@ -T agman-cmd.tpl $(opts_list) -DTCPREPLAY_EDIT -DTCPREPLAY_EDIT_MAN $<
 
 tcpreplay.1: tcpreplay_opts.def
-	@AUTOGEN@ -T agman-cmd.tpl $(opts_list) tcpreplay_opts.def
+	@AUTOGEN@ -T agman-cmd.tpl $(opts_list) $<
 
 tcpbridge.1: tcpbridge_opts.def
-	@AUTOGEN@ -T agman-cmd.tpl $(opts_list) tcpbridge_opts.def
+	@AUTOGEN@ -T agman-cmd.tpl $(opts_list) $<
 
 tcpliveplay.1: tcpliveplay_opts.def 
-	@AUTOGEN@ -T agman-cmd.tpl $(opts_list) tcpliveplay_opts.def
+	@AUTOGEN@ -T agman-cmd.tpl $(opts_list) $<
 
 tcpcapinfo.1: tcpcapinfo_opts.def 
-	@AUTOGEN@ -T agman-cmd.tpl $(opts_list) tcpcapinfo_opts.def
+	@AUTOGEN@ -T agman-cmd.tpl $(opts_list) $<
 tcpreplay_edit_OBJECTS: tcpreplay_opts.h
 tcpreplay_edit_opts.h: tcpreplay_edit_opts.c
 tcpreplay_edit_opts.c: tcpreplay_opts.def
-	@AUTOGEN@ $(opts_list)  @NETMAPFLAGS@ -DTCPREPLAY_EDIT -b tcpreplay_edit_opts tcpreplay_opts.def
+	@AUTOGEN@ $(opts_list)  @NETMAPFLAGS@ -DTCPREPLAY_EDIT -b tcpreplay_edit_opts $<
 tcpreplay_OBJECTS: tcpreplay_opts.h
 tcpreplay_opts.h: tcpreplay_opts.c
 tcpreplay_opts.c: tcpreplay_opts.def
-	@AUTOGEN@ $(opts_list) @NETMAPFLAGS@ tcpreplay_opts.def
+	@AUTOGEN@ $(opts_list) @NETMAPFLAGS@ $<
 tcpliveplay_OBJECTS: tcpliveplay_opts.h
 tcpliveplay_opts.h: tcpliveplay_opts.c
 tcpliveplay_opts.c: tcpliveplay_opts.def
-	@AUTOGEN@ $(opts_list) tcpliveplay_opts.def
+	@AUTOGEN@ $(opts_list) $<
 tcprewrite_OBJECTS: tcprewrite_opts.h
 tcprewrite_opts.h: tcprewrite_opts.c
 tcprewrite_opts.c: tcprewrite_opts.def tcpedit/tcpedit_opts.def
-	@AUTOGEN@ $(opts_list) tcprewrite_opts.def
+	@AUTOGEN@ $(opts_list) $<
 tcpcapinfo_OBJECTS: tcpcapinfo_opts.h
 tcpcapinfo_opts.h: tcpcapinfo_opts.c
 tcpcapinfo_opts.c: tcpcapinfo_opts.def
-	@AUTOGEN@ $(opts_list) tcpcapinfo_opts.def
+	@AUTOGEN@ $(opts_list) $<
 tcpprep_OBJECTS: tcpprep_opts.h
 tcpprep_opts.h: tcpprep_opts.c
 tcpprep_opts.c: tcpprep_opts.def
-	@AUTOGEN@ tcpprep_opts.def
+	@AUTOGEN@ $<
 tcpbridge_OBJECTS: tcpbridge_opts.h
 tcpbridge_opts.h: tcpbridge_opts.c
 tcpbridge_opts.c: tcpbridge_opts.def tcpedit/tcpedit_opts.def
-	@AUTOGEN@ $(opts_list) tcpbridge_opts.def
+	@AUTOGEN@ $(opts_list) $<
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.

+ 5 - 4
src/bridge.c

@@ -2,7 +2,7 @@
 
 /*
  *   Copyright (c) 2001-2010 Aaron Turner <aturner at synfin dot net>
- *   Copyright (c) 2013-2017 Fred Klassen <tcpreplay at appneta dot com> - AppNeta
+ *   Copyright (c) 2013-2018 Fred Klassen <tcpreplay at appneta dot com> - AppNeta
  *
  *   The Tcpreplay Suite of tools is free software: you can redistribute it 
  *   and/or modify it under the terms of the GNU General Public License as 
@@ -114,7 +114,7 @@ do_bridge_unidirectional(tcpbridge_opt_t *options, tcpedit_t *tcpedit)
 
 /**
  * main loop for bridging in both directions.  Since we dealing with two handles
- * we need to poll() on them which isn't the most efficent
+ * we need to poll() on them which isn't the most efficient
  */
 static void
 do_bridge_bidirectional(tcpbridge_opt_t *options, tcpedit_t *tcpedit)
@@ -245,7 +245,7 @@ do_bridge(tcpbridge_opt_t *options, tcpedit_t *tcpedit)
 
 /**
  * This is the callback we use with pcap_dispatch to process
- * each packet recieved by libpcap on the two interfaces.
+ * each packet received by libpcap on the two interfaces.
  * Need to return > 0 to denote success
  */
 static int
@@ -339,7 +339,8 @@ live_callback(struct live_data_t *livedata, struct pcap_pkthdr *pkthdr,
 
         /* look for include or exclude CIDR match */
         if (livedata->options->xX.cidr != NULL) {
-            if (!process_xX_by_cidr_ipv4(livedata->options->xX.mode, livedata->options->xX.cidr, ip_hdr)) {
+            if (!ip_hdr ||
+                    !process_xX_by_cidr_ipv4(livedata->options->xX.mode, livedata->options->xX.cidr, ip_hdr)) {
                 dbg(2, "Skipping IPv4 packet due to CIDR match");
                 return (1);
             }

+ 1 - 1
src/bridge.h

@@ -2,7 +2,7 @@
 
 /*
  *   Copyright (c) 2001-2010 Aaron Turner <aturner at synfin dot net>
- *   Copyright (c) 2013-2017 Fred Klassen <tcpreplay at appneta dot com> - AppNeta
+ *   Copyright (c) 2013-2018 Fred Klassen <tcpreplay at appneta dot com> - AppNeta
  *
  *   The Tcpreplay Suite of tools is free software: you can redistribute it 
  *   and/or modify it under the terms of the GNU General Public License as 

+ 1 - 1
src/common.h

@@ -2,7 +2,7 @@
 
 /*
  *   Copyright (c) 2001-2010 Aaron Turner <aturner at synfin dot net>
- *   Copyright (c) 2013-2017 Fred Klassen <tcpreplay at appneta dot com> - AppNeta
+ *   Copyright (c) 2013-2018 Fred Klassen <tcpreplay at appneta dot com> - AppNeta
  *
  *   The Tcpreplay Suite of tools is free software: you can redistribute it 
  *   and/or modify it under the terms of the GNU General Public License as 

+ 1 - 1
src/common/Makefile.am

@@ -25,7 +25,7 @@ if COMPILE_NETMAP
 libcommon_a_SOURCES += netmap.c
 endif
 
-AM_CFLAGS = -I.. -I../.. $(LNAV_CFLAGS) @LDNETINC@
+AM_CFLAGS = -I$(srcdir)/.. -I$(srcdir)/../.. $(LNAV_CFLAGS) @LDNETINC@
 
 if ! SYSTEM_STRLCPY
 libcommon_a_LIBADD = ../../lib/libstrl.a

+ 36 - 19
src/common/Makefile.in

@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -16,7 +16,17 @@
 
 
 VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__is_gnu_make = { \
+  if test -z '$(MAKELEVEL)'; then \
+    false; \
+  elif test -n '$(MAKE_HOST)'; then \
+    true; \
+  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+    true; \
+  else \
+    false; \
+  fi; \
+}
 am__make_running_with_option = \
   case $${target_option-} in \
       ?) ;; \
@@ -83,17 +93,17 @@ target_triplet = @target@
 @ENABLE_TCPDUMP_TRUE@am__append_1 = tcpdump.c
 @COMPILE_NETMAP_TRUE@am__append_2 = netmap.c
 subdir = src/common
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
-	$(top_srcdir)/config/depcomp $(noinst_HEADERS)
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
-	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
-	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
-	$(top_srcdir)/libopts/m4/libopts.m4 \
-	$(top_srcdir)/libopts/m4/stdnoreturn.m4 \
-	$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/libopts.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/m4/lt~obsolete.m4 \
+	$(top_srcdir)/m4/stdnoreturn.m4 $(top_srcdir)/acinclude.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \
+	$(am__DIST_COMMON)
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/src/config.h
 CONFIG_CLEAN_FILES =
@@ -186,6 +196,7 @@ am__define_uniq_tagged_files = \
   done | $(am__uniquify_input)`
 ETAGS = etags
 CTAGS = ctags
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
@@ -246,6 +257,7 @@ LN_S = @LN_S@
 LPCAPINC = @LPCAPINC@
 LPCAPLIB = @LPCAPLIB@
 LTLIBOBJS = @LTLIBOBJS@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
 MACOSX_SDK_PATH = @MACOSX_SDK_PATH@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
@@ -336,6 +348,7 @@ prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
 rmmod = @rmmod@
+runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
@@ -358,7 +371,7 @@ libcommon_a_SOURCES = cidr.c err.c list.c cache.c services.c get.c \
 	fakepcap.c fakepcapnav.c fakepoll.c xX.c utils.c timer.c \
 	git_version.c sendpacket.c dlt_names.c mac.c interface.c \
 	git_version.c flows.c txring.c $(am__append_1) $(am__append_2)
-AM_CFLAGS = -I.. -I../.. $(LNAV_CFLAGS) @LDNETINC@
+AM_CFLAGS = -I$(srcdir)/.. -I$(srcdir)/../.. $(LNAV_CFLAGS) @LDNETINC@
 @SYSTEM_STRLCPY_FALSE@libcommon_a_LIBADD = ../../lib/libstrl.a
 noinst_HEADERS = cidr.h err.h list.h cache.h services.h get.h \
 		 fakepcap.h fakepcapnav.h fakepoll.h xX.h utils.h \
@@ -385,7 +398,6 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/common/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
 	  $(AUTOMAKE) --foreign src/common/Makefile
-.PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
 	  *config.status*) \
@@ -441,22 +453,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xX.Po@am__quote@
 
 .c.o:
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
 
 .c.obj:
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+@am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .c.lo:
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+@am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
@@ -675,6 +690,8 @@ uninstall-am:
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
 	tags tags-am uninstall uninstall-am
 
+.PRECIOUS: Makefile
+
 
 git_version.c:
 	$(ECHO) -n 'const char GIT_Version[] = "git:'   > git_version.c

+ 38 - 39
src/common/cache.c

@@ -2,7 +2,7 @@
 
 /*
  *   Copyright (c) 2001-2010 Aaron Turner <aturner at synfin dot net>
- *   Copyright (c) 2013-2017 Fred Klassen <tcpreplay at appneta dot com> - AppNeta
+ *   Copyright (c) 2013-2018 Fred Klassen <tcpreplay at appneta dot com> - AppNeta
  *
  *   The Tcpreplay Suite of tools is free software: you can redistribute it 
  *   and/or modify it under the terms of the GNU General Public License as 
@@ -196,37 +196,37 @@ write_cache(tcpr_cache_t * cachedata, const int out_file, COUNTER numpackets,
     }
 
     if (cachedata) {
-    	mycache = cachedata;
-
-    	while (!last) {
-    		/* increment total packets */
-    		packets += mycache->packets;
-
-    		/* calculate how many chars to write */
-    		chars = mycache->packets / CACHE_PACKETS_PER_BYTE;
-    		if (mycache->packets % CACHE_PACKETS_PER_BYTE) {
-    			chars++;
-    			dbgx(1, "Bumping up to the next byte: %d %% %d", mycache->packets,
-    					CACHE_PACKETS_PER_BYTE);
-    		}
-
-    		/* write to file, and verify it wrote properly */
-    		written = write(out_file, mycache->data, chars);
-    		dbgx(1, "Wrote %zu bytes of cache data", written);
-    		if (written != (ssize_t)chars)
-    			errx(-1, "Only wrote %zu of %i bytes to cache file!", written, chars);
-
-    		/*
-    		 * if that was the last, stop processing, otherwise wash,
-    		 * rinse, repeat
-    		 */
-    		if (mycache->next != NULL) {
-    			mycache = mycache->next;
-    		}
-    		else {
-    			last = 1;
-    		}
-    	}
+        mycache = cachedata;
+
+        while (!last) {
+            /* increment total packets */
+            packets += mycache->packets;
+
+            /* calculate how many chars to write */
+            chars = mycache->packets / CACHE_PACKETS_PER_BYTE;
+            if (mycache->packets % CACHE_PACKETS_PER_BYTE) {
+                chars++;
+                dbgx(1, "Bumping up to the next byte: %d %% %d", mycache->packets,
+                        CACHE_PACKETS_PER_BYTE);
+            }
+
+            /* write to file, and verify it wrote properly */
+            written = write(out_file, mycache->data, chars);
+            dbgx(1, "Wrote %zu bytes of cache data", written);
+            if (written != (ssize_t)chars)
+                errx(-1, "Only wrote %zu of %i bytes to cache file!", written, chars);
+
+            /*
+             * if that was the last, stop processing, otherwise wash,
+             * rinse, repeat
+             */
+            if (mycache->next != NULL) {
+                mycache = mycache->next;
+            }
+            else {
+                last = 1;
+            }
+        }
     }
     safe_free(cache_header);
     /* return number of packets written */
@@ -255,10 +255,7 @@ tcpr_dir_t
 add_cache(tcpr_cache_t ** cachedata, const int send, const tcpr_dir_t interface)
 {
     static tcpr_cache_t *lastcache = NULL;
-    u_char *byte = NULL;
-    uint32_t bit;
     tcpr_dir_t result = TCPR_DIR_ERROR;
-    COUNTER index;
 #ifdef DEBUG
     char bitstring[9] = EIGHT_ZEROS;
 #endif
@@ -266,12 +263,11 @@ add_cache(tcpr_cache_t ** cachedata, const int send, const tcpr_dir_t interface)
     assert(cachedata);
 
     /* first run?  malloc our first entry, set bit count to 0 */
-    if (*cachedata == NULL) {
+    if (*cachedata == NULL || lastcache == NULL) {
         *cachedata = new_cache();
         lastcache = *cachedata;
     }
     else {
-        lastcache = *cachedata;
         /* check to see if this is the last bit in this struct */
         if ((lastcache->packets + 1) > (CACHEDATASIZE * CACHE_PACKETS_PER_BYTE)) {
             /*
@@ -289,6 +285,10 @@ add_cache(tcpr_cache_t ** cachedata, const int send, const tcpr_dir_t interface)
 
     /* send packet ? */
     if (send == SEND) {
+        COUNTER index;
+        uint32_t bit;
+        u_char *byte;
+
         index = (lastcache->packets - 1) / (COUNTER)CACHE_PACKETS_PER_BYTE;
         bit = (((lastcache->packets - 1) % (COUNTER)CACHE_PACKETS_PER_BYTE) * 
                (COUNTER)CACHE_BITS_PER_PACKET) + 1;
@@ -319,8 +319,7 @@ add_cache(tcpr_cache_t ** cachedata, const int send, const tcpr_dir_t interface)
         dbgx(3, "Current cache byte: %c%c%c%c%c%c%c%c",
             BIT_STR(byte2bits(*byte, bitstring)));
 #endif
-    }
-    else {
+    } else {
         dbg(1, "not setting send bit");
         result = TCPR_DIR_NOSEND;
     }

+ 2 - 2
src/common/cache.h

@@ -2,7 +2,7 @@
 
 /*
  *   Copyright (c) 2001-2010 Aaron Turner <aturner at synfin dot net>
- *   Copyright (c) 2013-2017 Fred Klassen <tcpreplay at appneta dot com> - AppNeta
+ *   Copyright (c) 2013-2018 Fred Klassen <tcpreplay at appneta dot com> - AppNeta
  *
  *   The Tcpreplay Suite of tools is free software: you can redistribute it 
  *   and/or modify it under the terms of the GNU General Public License as 
@@ -32,7 +32,7 @@
 
 /* 
  * CACHEVERSION History:
- * 01 - Inital release.  1 bit of data/packet (primary or secondary nic)
+ * 01 - Initial release.  1 bit of data/packet (primary or secondary nic)
  * 02 - 2 bits of data/packet (drop/send & primary or secondary nic)
  * 03 - Write integers in network-byte order
  * 04 - Increase num_packets from 32 to 64 bit integer

+ 9 - 10
src/common/cidr.c

@@ -2,7 +2,7 @@
 
 /*
  *   Copyright (c) 2001-2010 Aaron Turner <aturner at synfin dot net>
- *   Copyright (c) 2013-2017 Fred Klassen <tcpreplay at appneta dot com> - AppNeta
+ *   Copyright (c) 2013-2018 Fred Klassen <tcpreplay at appneta dot com> - AppNeta
  *
  *   The Tcpreplay Suite of tools is free software: you can redistribute it 
  *   and/or modify it under the terms of the GNU General Public License as 
@@ -241,7 +241,7 @@ cidr2cidr(char *cidr)
             if (octets[count] > 255)
                 goto error;
 
-            snprintf(tempoctet, sizeof(octets[count]), "%d", octets[count]);
+            snprintf(tempoctet, sizeof(octets[count]), "%u", octets[count]);
             strcat(networkip, tempoctet);
             /* we don't want a '.' at the end of the last octet */
             if (count < 3)
@@ -275,9 +275,8 @@ error:
 static void 
 mask_cidr6(char **cidrin, char* delim)
 {
-    char *p;
-
     if (**cidrin == '[' && *delim == ':') {
+        char *p;
         ++*cidrin;
         /* make strtok happy */
         for (p = *cidrin; *p && *p != ']'; ++p) {
@@ -298,12 +297,12 @@ int
 parse_cidr(tcpr_cidr_t ** cidrdata, char *cidrin, char *delim)
 {
     tcpr_cidr_t *cidr_ptr;             /* ptr to current cidr record */
-    char *network = NULL;
+    char *network;
     char *token = NULL;
 
     mask_cidr6(&cidrin, delim);
 
-    /* first itteration of input using strtok */
+    /* first iteration of input using strtok */
     network = strtok_r(cidrin, delim, &token);
 
     *cidrdata = cidr2cidr(network);
@@ -408,8 +407,8 @@ int
 parse_cidr_map(tcpr_cidrmap_t **cidrmap, const char *optarg)
 {
     tcpr_cidr_t *cidr = NULL;
-    char *map = NULL;
-    char *token = NULL, *string = NULL;
+    char *map;
+    char *token = NULL, *string;
     tcpr_cidrmap_t *ptr;
     int res = 0;
     
@@ -529,7 +528,7 @@ ip6_in_cidr(const tcpr_cidr_t * mycidr, const struct tcpr_in6_addr *addr)
 #ifdef DEBUG
     char netstr[INET6_ADDRSTRLEN];
 #endif
-    int i, j, k;
+    uint32_t i, j, k;
 
     if (mycidr->family != AF_INET6)
         return 0;
@@ -552,7 +551,7 @@ ip6_in_cidr(const tcpr_cidr_t * mycidr, const struct tcpr_in6_addr *addr)
         goto out;
     }
 
-    k = ~0 << (8 - k);
+    k = (uint32_t)~0 << (8 - k);
     i = addr->tcpr_s6_addr[j] & k;
     j = mycidr->u.network6.tcpr_s6_addr[j] & k;
     ret = i == j;

+ 1 - 1
src/common/cidr.h

@@ -2,7 +2,7 @@
 
 /*
  *   Copyright (c) 2001-2010 Aaron Turner <aturner at synfin dot net>
- *   Copyright (c) 2013-2017 Fred Klassen <tcpreplay at appneta dot com> - AppNeta
+ *   Copyright (c) 2013-2018 Fred Klassen <tcpreplay at appneta dot com> - AppNeta
  *
  *   The Tcpreplay Suite of tools is free software: you can redistribute it 
  *   and/or modify it under the terms of the GNU General Public License as 

+ 438 - 438
src/common/dlt_names.c

@@ -64,448 +64,448 @@
 
 /* DLT to descriptions */
 char *dlt2desc[] = {
-		"BSD loopback encapsulation",
-		"Ethernet (10Mb)",
-		"Experimental Ethernet (3Mb)",
-		"Amateur Radio AX.25",
-		"Proteon ProNET Token Ring",
-		"Chaos",
-		"IEEE 802 Networks",
-		"ARCNET, with BSD-style header",
-		"Serial Line IP",
-		"Point-to-point Protocol",
-		"FDDI",
-		"LLC-encapsulated ATM",
-		"raw IP",
-		"BSD/OS Serial Line IP",
-		"BSD/OS Point-to-point Protocol",
-		"BSD/OS Serial Line IP",
-		"BSD/OS Point-to-point Protocol",
-		"",
-		"",
-		"Linux Classical-IP over ATM",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"PPP over serial with HDLC encapsulation",
-		"PPP over Ethernet",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Cisco HDLC",
-		"IEEE 802.11 wireless",
-		"Unknown",
-		"BSD/OS Frame Relay",
-		"OpenBSD Loopback",
-		"",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Linux Cooked Sockets",
-		"Apple LocalTalk",
-		"Acorn Econet",
-		"OpenBSD IPFilter",
-		"OpenBSD PF Log/SuSE 6.3 LANE 802.3",
-		"Cisco IOS",
-		"802.11 Prism Header",
-		"802.11 Aironet Header",
-		"Siemens HiPath HDLC",
-		"IP over Fibre Channel",
-		"Solaris+SunATM",
-		"RapidIO",
-		"PCI Express",
-		"Xilinx Aurora link layer",
-		"802.11 plus radiotap radio header",
-		"Tazmen Sniffer Protocol",
-		"ARCNET",
-		"",
-		"",
-		"",
-		"",
-		"",
-		"",
-		"",
-		"",
-		"",
-		"pseudo-header with various info, followed by MTP2",
-		"MTP2, without pseudo-header",
-		"MTP3, without pseudo-header or MTP2",
-		"SCCP, without pseudo-header or MTP2 or MTP3",
-		"",
-		"",
-		"",
-		"",
-		"",
-		"",
-		"",
-		"",
-		"",
-		"",
-		"",
-		"",
-		"",
-		"",
-		"",
-		"",
-		"",
-		"",
-		"",
-		"",
-		"802.11 plus AVS radio header",
-		"",
-		"",
-		"",
-		"",
-		"",
-		"GPRS LLC",
-		"GPF-T (ITU-T G.7041/Y.1303)",
-		"GPF-F (ITU-T G.7041/Y.1303)",
-		"",
-		"",
-		"",
-		"Ethernet",
-		"Packet-over-SONET",
-		"",
-		"",
-		"",
-		"",
-		NULL
+        "BSD loopback encapsulation",
+        "Ethernet (10Mb)",
+        "Experimental Ethernet (3Mb)",
+        "Amateur Radio AX.25",
+        "Proteon ProNET Token Ring",
+        "Chaos",
+        "IEEE 802 Networks",
+        "ARCNET, with BSD-style header",
+        "Serial Line IP",
+        "Point-to-point Protocol",
+        "FDDI",
+        "LLC-encapsulated ATM",
+        "raw IP",
+        "BSD/OS Serial Line IP",
+        "BSD/OS Point-to-point Protocol",
+        "BSD/OS Serial Line IP",
+        "BSD/OS Point-to-point Protocol",
+        "",
+        "",
+        "Linux Classical-IP over ATM",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "PPP over serial with HDLC encapsulation",
+        "PPP over Ethernet",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Cisco HDLC",
+        "IEEE 802.11 wireless",
+        "Unknown",
+        "BSD/OS Frame Relay",
+        "OpenBSD Loopback",
+        "",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Linux Cooked Sockets",
+        "Apple LocalTalk",
+        "Acorn Econet",
+        "OpenBSD IPFilter",
+        "OpenBSD PF Log/SuSE 6.3 LANE 802.3",
+        "Cisco IOS",
+        "802.11 Prism Header",
+        "802.11 Aironet Header",
+        "Siemens HiPath HDLC",
+        "IP over Fibre Channel",
+        "Solaris+SunATM",
+        "RapidIO",
+        "PCI Express",
+        "Xilinx Aurora link layer",
+        "802.11 plus radiotap radio header",
+        "Tazmen Sniffer Protocol",
+        "ARCNET",
+        "",
+        "",
+        "",
+        "",
+        "",
+        "",
+        "",
+        "",
+        "",
+        "pseudo-header with various info, followed by MTP2",
+        "MTP2, without pseudo-header",
+        "MTP3, without pseudo-header or MTP2",
+        "SCCP, without pseudo-header or MTP2 or MTP3",
+        "",
+        "",
+        "",
+        "",
+        "",
+        "",
+        "",
+        "",
+        "",
+        "",
+        "",
+        "",
+        "",
+        "",
+        "",
+        "",
+        "",
+        "",
+        "",
+        "",
+        "802.11 plus AVS radio header",
+        "",
+        "",
+        "",
+        "",
+        "",
+        "GPRS LLC",
+        "GPF-T (ITU-T G.7041/Y.1303)",
+        "GPF-F (ITU-T G.7041/Y.1303)",
+        "",
+        "",
+        "",
+        "Ethernet",
+        "Packet-over-SONET",
+        "",
+        "",
+        "",
+        "",
+        NULL
 };
 
 
 /* DLT to names */
 char *dlt2name[] = {
-		"DLT_NULL",
-		"DLT_EN10MB",
-		"DLT_EN3MB",
-		"DLT_AX25",
-		"DLT_PRONET",
-		"DLT_CHAOS",
-		"DLT_IEEE802",
-		"DLT_ARCNET",
-		"DLT_SLIP",
-		"DLT_PPP",
-		"DLT_FDDI",
-		"DLT_ATM_RFC1483",
-		"DLT_RAW",
-		"DLT_ENC",
-		"DLT_PPP_BSDOS",
-		"DLT_SLIP_BSDOS",
-		"DLT_PPP_BSDOS",
-		"DLT_OLD_PFLOG",
-		"DLT_PFSYNC",
-		"DLT_ATM_CLIP",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"DLT_REDBACK_SMARTEDGE",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"DLT_PPP_SERIAL",
-		"DLT_PPP_ETHER",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"DLT_SYMANTEC_FIREWALL",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"DLT_C_HDLC",
-		"DLT_IEEE802_11",
-		"Unknown",
-		"DLT_FRELAY",
-		"DLT_LOOP",
-		"DLT_ENC",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"DLT_LINUX_SLL",
-		"DLT_LTALK",
-		"DLT_ECONET",
-		"DLT_IPFILTER",
-		"DLT_PFLOG",
-		"DLT_CISCO_IOS",
-		"DLT_PRISM_HEADER",
-		"DLT_AIRONET_HEADER",
-		"DLT_HHDLC",
-		"DLT_IP_OVER_FC",
-		"DLT_SUNATM",
-		"DLT_RIO",
-		"DLT_PCI_EXP",
-		"DLT_AURORA",
-		"DLT_IEEE802_11_RADIO",
-		"DLT_TZSP",
-		"DLT_ARCNET_LINUX",
-		"DLT_JUNIPER_MLPPP",
-		"DLT_JUNIPER_MLFR",
-		"DLT_JUNIPER_ES",
-		"DLT_JUNIPER_GGSN",
-		"DLT_JUNIPER_MFR",
-		"DLT_JUNIPER_ATM2",
-		"DLT_JUNIPER_SERVICES",
-		"DLT_JUNIPER_ATM1",
-		"DLT_APPLE_IP_OVER_IEEE1394",
-		"DLT_MTP2_WITH_PHDR",
-		"DLT_MTP2",
-		"DLT_MTP3",
-		"DLT_SCCP",
-		"DLT_DOCSIS",
-		"DLT_LINUX_IRDA",
-		"DLT_IBM_SP",
-		"DLT_IBM_SN",
-		"DLT_USER0",
-		"DLT_USER1",
-		"DLT_USER2",
-		"DLT_USER3",
-		"DLT_USER4",
-		"DLT_USER5",
-		"DLT_USER6",
-		"DLT_USER7",
-		"DLT_USER8",
-		"DLT_USER9",
-		"DLT_USER10",
-		"DLT_USER11",
-		"DLT_USER12",
-		"DLT_USER13",
-		"DLT_USER14",
-		"DLT_USER15",
-		"DLT_IEEE802_11_RADIO_AVS",
-		"DLT_JUNIPER_MONITOR",
-		"DLT_BACNET_MS_TP",
-		"DLT_PPP_PPPD",
-		"DLT_JUNIPER_PPPOE",
-		"DLT_JUNIPER_PPPOE_ATM",
-		"DLT_GPRS_LLC",
-		"DLT_GPF_T",
-		"DLT_GPF_F",
-		"DLT_GCOM_T1E1",
-		"DLT_GCOM_SERIAL",
-		"DLT_JUNIPER_PIC_PEER",
-		"DLT_ERF_ETH",
-		"DLT_ERF_POS",
-		"DLT_LINUX_LAPD",
-		"DLT_JUNIPER_ETHER",
-		"DLT_JUNIPER_PPP",
-		"DLT_JUNIPER_FRELAY",
-		"DLT_JUNIPER_CHDLC",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		"Unknown",
-		NULL
+        "DLT_NULL",
+        "DLT_EN10MB",
+        "DLT_EN3MB",
+        "DLT_AX25",
+        "DLT_PRONET",
+        "DLT_CHAOS",
+        "DLT_IEEE802",
+        "DLT_ARCNET",
+        "DLT_SLIP",
+        "DLT_PPP",
+        "DLT_FDDI",
+        "DLT_ATM_RFC1483",
+        "DLT_RAW",
+        "DLT_ENC",
+        "DLT_PPP_BSDOS",
+        "DLT_SLIP_BSDOS",
+        "DLT_PPP_BSDOS",
+        "DLT_OLD_PFLOG",
+        "DLT_PFSYNC",
+        "DLT_ATM_CLIP",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "DLT_REDBACK_SMARTEDGE",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "DLT_PPP_SERIAL",
+        "DLT_PPP_ETHER",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "DLT_SYMANTEC_FIREWALL",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "DLT_C_HDLC",
+        "DLT_IEEE802_11",
+        "Unknown",
+        "DLT_FRELAY",
+        "DLT_LOOP",
+        "DLT_ENC",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "DLT_LINUX_SLL",
+        "DLT_LTALK",
+        "DLT_ECONET",
+        "DLT_IPFILTER",
+        "DLT_PFLOG",
+        "DLT_CISCO_IOS",
+        "DLT_PRISM_HEADER",
+        "DLT_AIRONET_HEADER",
+        "DLT_HHDLC",
+        "DLT_IP_OVER_FC",
+        "DLT_SUNATM",
+        "DLT_RIO",
+        "DLT_PCI_EXP",
+        "DLT_AURORA",
+        "DLT_IEEE802_11_RADIO",
+        "DLT_TZSP",
+        "DLT_ARCNET_LINUX",
+        "DLT_JUNIPER_MLPPP",
+        "DLT_JUNIPER_MLFR",
+        "DLT_JUNIPER_ES",
+        "DLT_JUNIPER_GGSN",
+        "DLT_JUNIPER_MFR",
+        "DLT_JUNIPER_ATM2",
+        "DLT_JUNIPER_SERVICES",
+        "DLT_JUNIPER_ATM1",
+        "DLT_APPLE_IP_OVER_IEEE1394",
+        "DLT_MTP2_WITH_PHDR",
+        "DLT_MTP2",
+        "DLT_MTP3",
+        "DLT_SCCP",
+        "DLT_DOCSIS",
+        "DLT_LINUX_IRDA",
+        "DLT_IBM_SP",
+        "DLT_IBM_SN",
+        "DLT_USER0",
+        "DLT_USER1",
+        "DLT_USER2",
+        "DLT_USER3",
+        "DLT_USER4",
+        "DLT_USER5",
+        "DLT_USER6",
+        "DLT_USER7",
+        "DLT_USER8",
+        "DLT_USER9",
+        "DLT_USER10",
+        "DLT_USER11",
+        "DLT_USER12",
+        "DLT_USER13",
+        "DLT_USER14",
+        "DLT_USER15",
+        "DLT_IEEE802_11_RADIO_AVS",
+        "DLT_JUNIPER_MONITOR",
+        "DLT_BACNET_MS_TP",
+        "DLT_PPP_PPPD",
+        "DLT_JUNIPER_PPPOE",
+        "DLT_JUNIPER_PPPOE_ATM",
+        "DLT_GPRS_LLC",
+        "DLT_GPF_T",
+        "DLT_GPF_F",
+        "DLT_GCOM_T1E1",
+        "DLT_GCOM_SERIAL",
+        "DLT_JUNIPER_PIC_PEER",
+        "DLT_ERF_ETH",
+        "DLT_ERF_POS",
+        "DLT_LINUX_LAPD",
+        "DLT_JUNIPER_ETHER",
+        "DLT_JUNIPER_PPP",
+        "DLT_JUNIPER_FRELAY",
+        "DLT_JUNIPER_CHDLC",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        "Unknown",
+        NULL
 };
 

+ 4 - 4
src/common/err.c

@@ -7,12 +7,12 @@
  *
  * Copyright (c) 2001-2010 Aaron Turner.
  *
- * Copyright (c) 2013-2017 Fred Klassen - AppNeta
+ * Copyright (c) 2013-2018 Fred Klassen - AppNeta
  *
  * Copyright (c) 2000 Dug Song <dugsong@monkey.org>
  *
  * Copyright (c) 1993
- *	The Regents of the University of California.  All rights reserved.
+ *    The Regents of the University of California.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -24,8 +24,8 @@
  *    documentation and/or other materials provided with the distribution.
  * 3. All advertising materials mentioning features or use of this software
  *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
+ *    This product includes software developed by the University of
+ *    California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.

+ 0 - 0
src/common/err.h


Some files were not shown because too many files changed in this diff