diff --git a/INSTALL b/INSTALL
new file mode 100644
index 0000000000000000000000000000000000000000..8865734f81b136629e961c230380423899c75794
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,368 @@
+Installation Instructions
+*************************
+
+   Copyright (C) 1994-1996, 1999-2002, 2004-2016 Free Software
+Foundation, Inc.
+
+   Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.  This file is offered as-is,
+without warranty of any kind.
+
+Basic Installation
+==================
+
+   Briefly, the shell command './configure && make && make install'
+should configure, build, and install this package.  The following
+more-detailed instructions are generic; see the 'README' file for
+instructions specific to this package.  Some packages provide this
+'INSTALL' file but do not implement all of the features documented
+below.  The lack of an optional feature in a given package is not
+necessarily a bug.  More recommendations for GNU packages can be found
+in *note Makefile Conventions: (standards)Makefile Conventions.
+
+   The 'configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation.  It uses
+those values to create a 'Makefile' in each directory of the package.
+It may also create one or more '.h' files containing system-dependent
+definitions.  Finally, it creates a shell script 'config.status' that
+you can run in the future to recreate the current configuration, and a
+file 'config.log' containing compiler output (useful mainly for
+debugging 'configure').
+
+   It can also use an optional file (typically called 'config.cache' and
+enabled with '--cache-file=config.cache' or simply '-C') that saves the
+results of its tests to speed up reconfiguring.  Caching is disabled by
+default to prevent problems with accidental use of stale cache files.
+
+   If you need to do unusual things to compile the package, please try
+to figure out how 'configure' could check whether to do them, and mail
+diffs or instructions to the address given in the 'README' so they can
+be considered for the next release.  If you are using the cache, and at
+some point 'config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+   The file 'configure.ac' (or 'configure.in') is used to create
+'configure' by a program called 'autoconf'.  You need 'configure.ac' if
+you want to change it or regenerate 'configure' using a newer version of
+'autoconf'.
+
+   The simplest way to compile this package is:
+
+  1. 'cd' to the directory containing the package's source code and type
+     './configure' to configure the package for your system.
+
+     Running 'configure' might take a while.  While running, it prints
+     some messages telling which features it is checking for.
+
+  2. Type 'make' to compile the package.
+
+  3. Optionally, type 'make check' to run any self-tests that come with
+     the package, generally using the just-built uninstalled binaries.
+
+  4. Type 'make install' to install the programs and any data files and
+     documentation.  When installing into a prefix owned by root, it is
+     recommended that the package be configured and built as a regular
+     user, and only the 'make install' phase executed with root
+     privileges.
+
+  5. Optionally, type 'make installcheck' to repeat any self-tests, but
+     this time using the binaries in their final installed location.
+     This target does not install anything.  Running this target as a
+     regular user, particularly if the prior 'make install' required
+     root privileges, verifies that the installation completed
+     correctly.
+
+  6. You can remove the program binaries and object files from the
+     source code directory by typing 'make clean'.  To also remove the
+     files that 'configure' created (so you can compile the package for
+     a different kind of computer), type 'make distclean'.  There is
+     also a 'make maintainer-clean' target, but that is intended mainly
+     for the package's developers.  If you use it, you may have to get
+     all sorts of other programs in order to regenerate files that came
+     with the distribution.
+
+  7. Often, you can also type 'make uninstall' to remove the installed
+     files again.  In practice, not all packages have tested that
+     uninstallation works correctly, even though it is required by the
+     GNU Coding Standards.
+
+  8. Some packages, particularly those that use Automake, provide 'make
+     distcheck', which can by used by developers to test that all other
+     targets like 'make install' and 'make uninstall' work correctly.
+     This target is generally not run by end users.
+
+Compilers and Options
+=====================
+
+   Some systems require unusual options for compilation or linking that
+the 'configure' script does not know about.  Run './configure --help'
+for details on some of the pertinent environment variables.
+
+   You can give 'configure' initial values for configuration parameters
+by setting variables in the command line or in the environment.  Here is
+an example:
+
+     ./configure CC=c99 CFLAGS=-g LIBS=-lposix
+
+   *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+   You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory.  To do this, you can use GNU 'make'.  'cd' to the
+directory where you want the object files and executables to go and run
+the 'configure' script.  'configure' automatically checks for the source
+code in the directory that 'configure' is in and in '..'.  This is known
+as a "VPATH" build.
+
+   With a non-GNU 'make', it is safer to compile the package for one
+architecture at a time in the source code directory.  After you have
+installed the package for one architecture, use 'make distclean' before
+reconfiguring for another architecture.
+
+   On MacOS X 10.5 and later systems, you can create libraries and
+executables that work on multiple system types--known as "fat" or
+"universal" binaries--by specifying multiple '-arch' options to the
+compiler but only a single '-arch' option to the preprocessor.  Like
+this:
+
+     ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+                 CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+                 CPP="gcc -E" CXXCPP="g++ -E"
+
+   This is not guaranteed to produce working output in all cases, you
+may have to build one architecture at a time and combine the results
+using the 'lipo' tool if you have problems.
+
+Installation Names
+==================
+
+   By default, 'make install' installs the package's commands under
+'/usr/local/bin', include files under '/usr/local/include', etc.  You
+can specify an installation prefix other than '/usr/local' by giving
+'configure' the option '--prefix=PREFIX', where PREFIX must be an
+absolute file name.
+
+   You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files.  If you
+pass the option '--exec-prefix=PREFIX' to 'configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
+
+   In addition, if you use an unusual directory layout you can give
+options like '--bindir=DIR' to specify different values for particular
+kinds of files.  Run 'configure --help' for a list of the directories
+you can set and what kinds of files go in them.  In general, the default
+for these options is expressed in terms of '${prefix}', so that
+specifying just '--prefix' will affect all of the other directory
+specifications that were not explicitly provided.
+
+   The most portable way to affect installation locations is to pass the
+correct locations to 'configure'; however, many packages provide one or
+both of the following shortcuts of passing variable assignments to the
+'make install' command line to change installation locations without
+having to reconfigure or recompile.
+
+   The first method involves providing an override variable for each
+affected directory.  For example, 'make install
+prefix=/alternate/directory' will choose an alternate location for all
+directory configuration variables that were expressed in terms of
+'${prefix}'.  Any directories that were specified during 'configure',
+but not in terms of '${prefix}', must each be overridden at install time
+for the entire installation to be relocated.  The approach of makefile
+variable overrides for each directory variable is required by the GNU
+Coding Standards, and ideally causes no recompilation.  However, some
+platforms have known limitations with the semantics of shared libraries
+that end up requiring recompilation when using this method, particularly
+noticeable in packages that use GNU Libtool.
+
+   The second method involves providing the 'DESTDIR' variable.  For
+example, 'make install DESTDIR=/alternate/directory' will prepend
+'/alternate/directory' before all installation names.  The approach of
+'DESTDIR' overrides is not required by the GNU Coding Standards, and
+does not work on platforms that have drive letters.  On the other hand,
+it does better at avoiding recompilation issues, and works well even
+when some directory options were not specified in terms of '${prefix}'
+at 'configure' time.
+
+Optional Features
+=================
+
+   If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving 'configure' the
+option '--program-prefix=PREFIX' or '--program-suffix=SUFFIX'.
+
+   Some packages pay attention to '--enable-FEATURE' options to
+'configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to '--with-PACKAGE' options, where PACKAGE
+is something like 'gnu-as' or 'x' (for the X Window System).  The
+'README' should mention any '--enable-' and '--with-' options that the
+package recognizes.
+
+   For packages that use the X Window System, 'configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the 'configure' options '--x-includes=DIR' and
+'--x-libraries=DIR' to specify their locations.
+
+   Some packages offer the ability to configure how verbose the
+execution of 'make' will be.  For these packages, running './configure
+--enable-silent-rules' sets the default to minimal output, which can be
+overridden with 'make V=1'; while running './configure
+--disable-silent-rules' sets the default to verbose, which can be
+overridden with 'make V=0'.
+
+Particular systems
+==================
+
+   On HP-UX, the default C compiler is not ANSI C compatible.  If GNU CC
+is not installed, it is recommended to use the following options in
+order to use an ANSI C compiler:
+
+     ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
+
+and if that doesn't work, install pre-built binaries of GCC for HP-UX.
+
+   HP-UX 'make' updates targets which have the same time stamps as their
+prerequisites, which makes it generally unusable when shipped generated
+files such as 'configure' are involved.  Use GNU 'make' instead.
+
+   On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
+parse its '<wchar.h>' header file.  The option '-nodtk' can be used as a
+workaround.  If GNU CC is not installed, it is therefore recommended to
+try
+
+     ./configure CC="cc"
+
+and if that doesn't work, try
+
+     ./configure CC="cc -nodtk"
+
+   On Solaris, don't put '/usr/ucb' early in your 'PATH'.  This
+directory contains several dysfunctional programs; working variants of
+these programs are available in '/usr/bin'.  So, if you need '/usr/ucb'
+in your 'PATH', put it _after_ '/usr/bin'.
+
+   On Haiku, software installed for all users goes in '/boot/common',
+not '/usr/local'.  It is recommended to use the following options:
+
+     ./configure --prefix=/boot/common
+
+Specifying the System Type
+==========================
+
+   There may be some features 'configure' cannot figure out
+automatically, but needs to determine by the type of machine the package
+will run on.  Usually, assuming the package is built to be run on the
+_same_ architectures, 'configure' can figure that out, but if it prints
+a message saying it cannot guess the machine type, give it the
+'--build=TYPE' option.  TYPE can either be a short name for the system
+type, such as 'sun4', or a canonical name which has the form:
+
+     CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+     OS
+     KERNEL-OS
+
+   See the file 'config.sub' for the possible values of each field.  If
+'config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+   If you are _building_ compiler tools for cross-compiling, you should
+use the option '--target=TYPE' to select the type of system they will
+produce code for.
+
+   If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with '--host=TYPE'.
+
+Sharing Defaults
+================
+
+   If you want to set default values for 'configure' scripts to share,
+you can create a site shell script called 'config.site' that gives
+default values for variables like 'CC', 'cache_file', and 'prefix'.
+'configure' looks for 'PREFIX/share/config.site' if it exists, then
+'PREFIX/etc/config.site' if it exists.  Or, you can set the
+'CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all 'configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+   Variables not defined in a site shell script can be set in the
+environment passed to 'configure'.  However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost.  In order to avoid this problem, you should set
+them in the 'configure' command line, using 'VAR=value'.  For example:
+
+     ./configure CC=/usr/local2/bin/gcc
+
+causes the specified 'gcc' to be used as the C compiler (unless it is
+overridden in the site shell script).
+
+Unfortunately, this technique does not work for 'CONFIG_SHELL' due to an
+Autoconf limitation.  Until the limitation is lifted, you can use this
+workaround:
+
+     CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+'configure' Invocation
+======================
+
+   'configure' recognizes the following options to control how it
+operates.
+
+'--help'
+'-h'
+     Print a summary of all of the options to 'configure', and exit.
+
+'--help=short'
+'--help=recursive'
+     Print a summary of the options unique to this package's
+     'configure', and exit.  The 'short' variant lists options used only
+     in the top level, while the 'recursive' variant lists options also
+     present in any nested packages.
+
+'--version'
+'-V'
+     Print the version of Autoconf used to generate the 'configure'
+     script, and exit.
+
+'--cache-file=FILE'
+     Enable the cache: use and save the results of the tests in FILE,
+     traditionally 'config.cache'.  FILE defaults to '/dev/null' to
+     disable caching.
+
+'--config-cache'
+'-C'
+     Alias for '--cache-file=config.cache'.
+
+'--quiet'
+'--silent'
+'-q'
+     Do not print messages saying which checks are being made.  To
+     suppress all normal output, redirect it to '/dev/null' (any error
+     messages will still be shown).
+
+'--srcdir=DIR'
+     Look for the package's source code in directory DIR.  Usually
+     'configure' can determine that directory automatically.
+
+'--prefix=DIR'
+     Use DIR as the installation prefix.  *note Installation Names:: for
+     more details, including other options available for fine-tuning the
+     installation locations.
+
+'--no-create'
+'-n'
+     Run the configure checks, but stop before creating any output
+     files.
+
+'configure' also accepts some other, not widely useful, options.  Run
+'configure --help' for more details.
diff --git a/Makefile.in b/Makefile.in
index cba0b587891865c7d6e994226e4b309756ff2e12..902bfe181de51694fd7fa22d716ba325fe8e5095 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.16.3 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1994-2020 Free Software Foundation, Inc.
+
 # This Makefile.in 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.
@@ -15,23 +14,61 @@
 
 @SET_MAKE@
 VPATH = @srcdir@
-am__make_dryrun = \
-  { \
-    am__dry=no; \
+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 \
+      ?) ;; \
+      *) echo "am__make_running_with_option: internal error: invalid" \
+              "target option '$${target_option-}' specified" >&2; \
+         exit 1;; \
+  esac; \
+  has_opt=no; \
+  sane_makeflags=$$MAKEFLAGS; \
+  if $(am__is_gnu_make); then \
+    sane_makeflags=$$MFLAGS; \
+  else \
     case $$MAKEFLAGS in \
       *\\[\ \	]*) \
-        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
-          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
-      *) \
-        for am__flg in $$MAKEFLAGS; do \
-          case $$am__flg in \
-            *=*|--*) ;; \
-            *n*) am__dry=yes; break;; \
-          esac; \
-        done;; \
+        bs=\\; \
+        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+          | sed "s/$$bs$$bs[$$bs $$bs	]*//g"`;; \
+    esac; \
+  fi; \
+  skip_next=no; \
+  strip_trailopt () \
+  { \
+    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+  }; \
+  for flg in $$sane_makeflags; do \
+    test $$skip_next = yes && { skip_next=no; continue; }; \
+    case $$flg in \
+      *=*|--*) continue;; \
+        -*I) strip_trailopt 'I'; skip_next=yes;; \
+      -*I?*) strip_trailopt 'I';; \
+        -*O) strip_trailopt 'O'; skip_next=yes;; \
+      -*O?*) strip_trailopt 'O';; \
+        -*l) strip_trailopt 'l'; skip_next=yes;; \
+      -*l?*) strip_trailopt 'l';; \
+      -[dEDm]) skip_next=yes;; \
+      -[JT]) skip_next=yes;; \
     esac; \
-    test $$am__dry = yes; \
-  }
+    case $$flg in \
+      *$$target_option*) has_opt=yes; break;; \
+    esac; \
+  done; \
+  test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -49,29 +86,40 @@ NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
 subdir = .
-DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \
-	$(srcdir)/Makefile.in $(srcdir)/config.h.in \
-	$(top_srcdir)/configure COPYING ChangeLog depcomp install-sh \
-	missing
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(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
 CONFIG_HEADER = config.h
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo "  GEN     " $@;
+am__v_GEN_1 = 
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 = 
 SOURCES =
 DIST_SOURCES =
-RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
-	html-recursive info-recursive install-data-recursive \
-	install-dvi-recursive install-exec-recursive \
-	install-html-recursive install-info-recursive \
-	install-pdf-recursive install-ps-recursive install-recursive \
-	installcheck-recursive installdirs-recursive pdf-recursive \
-	ps-recursive uninstall-recursive
+RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
+	ctags-recursive dvi-recursive html-recursive info-recursive \
+	install-data-recursive install-dvi-recursive \
+	install-exec-recursive install-html-recursive \
+	install-info-recursive install-pdf-recursive \
+	install-ps-recursive install-recursive installcheck-recursive \
+	installdirs-recursive pdf-recursive ps-recursive \
+	tags-recursive uninstall-recursive
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
@@ -79,12 +127,36 @@ am__can_run_installinfo = \
   esac
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
   distclean-recursive maintainer-clean-recursive
-AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
-	$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
-	distdir dist dist-all distcheck
+am__recursive_targets = \
+  $(RECURSIVE_TARGETS) \
+  $(RECURSIVE_CLEAN_TARGETS) \
+  $(am__extra_recursive_targets)
+AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
+	cscope distdir distdir-am dist dist-all distcheck
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \
+	config.h.in
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates.  Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+  BEGIN { nonempty = 0; } \
+  { items[$$0] = 1; nonempty = 1; } \
+  END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique.  This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+  list='$(am__tagged_files)'; \
+  unique=`for i in $$list; do \
+    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+  done | $(am__uniquify_input)`
 ETAGS = etags
 CTAGS = ctags
+CSCOPE = cscope
 DIST_SUBDIRS = $(SUBDIRS)
+am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in COPYING \
+	ChangeLog INSTALL compile depcomp install-sh missing
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 distdir = $(PACKAGE)-$(VERSION)
 top_distdir = $(distdir)
@@ -94,6 +166,7 @@ am__remove_distdir = \
       && rm -rf "$(distdir)" \
       || { sleep 5 && rm -rf "$(distdir)"; }; \
   else :; fi
+am__post_remove_distdir = $(am__remove_distdir)
 am__relativize = \
   dir0=`pwd`; \
   sed_first='s,^\([^/]*\)/.*$$,\1,'; \
@@ -121,12 +194,16 @@ am__relativize = \
   reldir="$$dir2"
 DIST_ARCHIVES = $(distdir).tar.gz
 GZIP_ENV = --best
+DIST_TARGETS = dist-gzip
+# Exists only to be overridden by the user if desired.
+AM_DISTCHECK_DVI_TARGET = dvi
 distuninstallcheck_listfiles = find . -type f -print
 am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
   | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
 distcleancheck_listfiles = find . -type f -print
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
@@ -170,8 +247,6 @@ SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
 VERSION = @VERSION@
-YACC = @YACC@
-YFLAGS = @YFLAGS@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
@@ -206,6 +281,7 @@ pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
+runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
@@ -234,15 +310,14 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	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*) \
 	    echo ' $(SHELL) ./config.status'; \
 	    $(SHELL) ./config.status;; \
 	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \
 	esac;
 
 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@@ -255,8 +330,8 @@ $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 $(am__aclocal_m4_deps):
 
 config.h: stamp-h1
-	@if test ! -f $@; then rm -f stamp-h1; else :; fi
-	@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi
+	@test -f $@ || rm -f stamp-h1
+	@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1
 
 stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
 	@rm -f stamp-h1
@@ -270,22 +345,25 @@ distclean-hdr:
 	-rm -f config.h stamp-h1
 
 # This directory's subdirectories are mostly independent; you can cd
-# into them and run `make' without going through this Makefile.
-# To change the values of `make' variables: instead of editing Makefiles,
-# (1) if the variable is set in `config.status', edit `config.status'
-#     (which will cause the Makefiles to be regenerated when you run `make');
-# (2) otherwise, pass the desired values on the `make' command line.
-$(RECURSIVE_TARGETS):
-	@fail= failcom='exit 1'; \
-	for f in x $$MAKEFLAGS; do \
-	  case $$f in \
-	    *=* | --[!k]*);; \
-	    *k*) failcom='fail=yes';; \
-	  esac; \
-	done; \
+# into them and run 'make' without going through this Makefile.
+# To change the values of 'make' variables: instead of editing Makefiles,
+# (1) if the variable is set in 'config.status', edit 'config.status'
+#     (which will cause the Makefiles to be regenerated when you run 'make');
+# (2) otherwise, pass the desired values on the 'make' command line.
+$(am__recursive_targets):
+	@fail=; \
+	if $(am__make_keepgoing); then \
+	  failcom='fail=yes'; \
+	else \
+	  failcom='exit 1'; \
+	fi; \
 	dot_seen=no; \
 	target=`echo $@ | sed s/-recursive//`; \
-	list='$(SUBDIRS)'; for subdir in $$list; do \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	for subdir in $$list; do \
 	  echo "Making $$target in $$subdir"; \
 	  if test "$$subdir" = "."; then \
 	    dot_seen=yes; \
@@ -300,57 +378,12 @@ $(RECURSIVE_TARGETS):
 	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
 	fi; test -z "$$fail"
 
-$(RECURSIVE_CLEAN_TARGETS):
-	@fail= failcom='exit 1'; \
-	for f in x $$MAKEFLAGS; do \
-	  case $$f in \
-	    *=* | --[!k]*);; \
-	    *k*) failcom='fail=yes';; \
-	  esac; \
-	done; \
-	dot_seen=no; \
-	case "$@" in \
-	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
-	  *) list='$(SUBDIRS)' ;; \
-	esac; \
-	rev=''; for subdir in $$list; do \
-	  if test "$$subdir" = "."; then :; else \
-	    rev="$$subdir $$rev"; \
-	  fi; \
-	done; \
-	rev="$$rev ."; \
-	target=`echo $@ | sed s/-recursive//`; \
-	for subdir in $$rev; do \
-	  echo "Making $$target in $$subdir"; \
-	  if test "$$subdir" = "."; then \
-	    local_target="$$target-am"; \
-	  else \
-	    local_target="$$target"; \
-	  fi; \
-	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-	  || eval $$failcom; \
-	done && test -z "$$fail"
-tags-recursive:
-	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
-	done
-ctags-recursive:
-	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
-	done
+ID: $(am__tagged_files)
+	$(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-recursive
+TAGS: tags
 
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
-	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	mkid -fID $$unique
-tags: TAGS
-
-TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
 	set x; \
 	here=`pwd`; \
 	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
@@ -366,12 +399,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
 	      set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
 	  fi; \
 	done; \
-	list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	$(am__define_uniq_tagged_files); \
 	shift; \
 	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
@@ -383,15 +411,11 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
 	      $$unique; \
 	  fi; \
 	fi
-ctags: CTAGS
-CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+ctags: ctags-recursive
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+	$(am__define_uniq_tagged_files); \
 	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$unique
@@ -400,11 +424,36 @@ GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
 	  && $(am__cd) $(top_srcdir) \
 	  && gtags -i $(GTAGS_ARGS) "$$here"
+cscope: cscope.files
+	test ! -s cscope.files \
+	  || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
+clean-cscope:
+	-rm -f cscope.files
+cscope.files: clean-cscope cscopelist
+cscopelist: cscopelist-recursive
+
+cscopelist-am: $(am__tagged_files)
+	list='$(am__tagged_files)'; \
+	case "$(srcdir)" in \
+	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+	  *) sdir=$(subdir)/$(srcdir) ;; \
+	esac; \
+	for i in $$list; do \
+	  if test -f "$$i"; then \
+	    echo "$(subdir)/$$i"; \
+	  else \
+	    echo "$$sdir/$$i"; \
+	  fi; \
+	done >> $(top_builddir)/cscope.files
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+	-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
+
+distdir: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) distdir-am
 
-distdir: $(DISTFILES)
+distdir-am: $(DISTFILES)
 	$(am__remove_distdir)
 	test -d "$(distdir)" || mkdir "$(distdir)"
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
@@ -469,41 +518,47 @@ distdir: $(DISTFILES)
 	  ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
 	|| chmod -R a+r "$(distdir)"
 dist-gzip: distdir
-	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
-	$(am__remove_distdir)
+	tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
+	$(am__post_remove_distdir)
 
 dist-bzip2: distdir
 	tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
-	$(am__remove_distdir)
+	$(am__post_remove_distdir)
 
 dist-lzip: distdir
 	tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
-	$(am__remove_distdir)
-
-dist-lzma: distdir
-	tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
-	$(am__remove_distdir)
+	$(am__post_remove_distdir)
 
 dist-xz: distdir
 	tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
-	$(am__remove_distdir)
+	$(am__post_remove_distdir)
+
+dist-zstd: distdir
+	tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst
+	$(am__post_remove_distdir)
 
 dist-tarZ: distdir
+	@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__remove_distdir)
+	$(am__post_remove_distdir)
 
 dist-shar: distdir
-	shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
-	$(am__remove_distdir)
+	@echo WARNING: "Support for shar distribution archives is" \
+	               "deprecated." >&2
+	@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
+	shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
+	$(am__post_remove_distdir)
 
 dist-zip: distdir
 	-rm -f $(distdir).zip
 	zip -rq $(distdir).zip $(distdir)
-	$(am__remove_distdir)
+	$(am__post_remove_distdir)
 
-dist dist-all: distdir
-	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
-	$(am__remove_distdir)
+dist dist-all:
+	$(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
+	$(am__post_remove_distdir)
 
 # This target untars the dist file and tries a VPATH configuration.  Then
 # it guarantees that the distribution is self-contained by making another
@@ -511,11 +566,9 @@ dist dist-all: distdir
 distcheck: dist
 	case '$(DIST_ARCHIVES)' in \
 	*.tar.gz*) \
-	  GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
+	  eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
 	*.tar.bz2*) \
 	  bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
-	*.tar.lzma*) \
-	  lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
 	*.tar.lz*) \
 	  lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
 	*.tar.xz*) \
@@ -523,24 +576,27 @@ distcheck: dist
 	*.tar.Z*) \
 	  uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
 	*.shar.gz*) \
-	  GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
+	  eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
 	*.zip*) \
 	  unzip $(distdir).zip ;;\
+	*.tar.zst*) \
+	  zstd -dc $(distdir).tar.zst | $(am__untar) ;;\
 	esac
-	chmod -R a-w $(distdir); chmod u+w $(distdir)
-	mkdir $(distdir)/_build
-	mkdir $(distdir)/_inst
+	chmod -R a-w $(distdir)
+	chmod u+w $(distdir)
+	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 --srcdir=.. --prefix="$$dc_install_base" \
+	  && $(am__cd) $(distdir)/_build/sub \
+	  && ../../configure \
 	    $(AM_DISTCHECK_CONFIGURE_FLAGS) \
 	    $(DISTCHECK_CONFIGURE_FLAGS) \
+	    --srcdir=../.. --prefix="$$dc_install_base" \
 	  && $(MAKE) $(AM_MAKEFLAGS) \
-	  && $(MAKE) $(AM_MAKEFLAGS) dvi \
+	  && $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \
 	  && $(MAKE) $(AM_MAKEFLAGS) check \
 	  && $(MAKE) $(AM_MAKEFLAGS) install \
 	  && $(MAKE) $(AM_MAKEFLAGS) installcheck \
@@ -561,7 +617,7 @@ distcheck: dist
 	  && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
 	  && cd "$$am__cwd" \
 	  || exit 1
-	$(am__remove_distdir)
+	$(am__post_remove_distdir)
 	@(echo "$(distdir) archives ready for distribution: "; \
 	  list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
 	  sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
@@ -695,14 +751,13 @@ ps-am:
 
 uninstall-am:
 
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \
-	ctags-recursive install-am install-strip tags-recursive
+.MAKE: $(am__recursive_targets) all install-am install-strip
 
-.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
-	all all-am am--refresh check check-am clean clean-generic \
-	ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
-	dist-lzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \
-	distcheck distclean distclean-generic distclean-hdr \
+.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
+	am--refresh check check-am clean clean-cscope clean-generic \
+	cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \
+	dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \
+	dist-zstd distcheck distclean distclean-generic distclean-hdr \
 	distclean-tags distcleancheck distdir distuninstallcheck dvi \
 	dvi-am html html-am info info-am install install-am \
 	install-data install-data-am install-dvi install-dvi-am \
@@ -711,8 +766,10 @@ uninstall-am:
 	install-pdf-am install-ps install-ps-am install-strip \
 	installcheck installcheck-am installdirs installdirs-am \
 	maintainer-clean maintainer-clean-generic mostlyclean \
-	mostlyclean-generic pdf pdf-am ps ps-am tags tags-recursive \
-	uninstall uninstall-am
+	mostlyclean-generic 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.
diff --git a/aclocal.m4 b/aclocal.m4
index 30941788d63d739cdc6488936a54f4015d4c76e9..6715ee0ea7d3b03ddfebd3c44fc2bf06a0d0f5ab 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,8 +1,7 @@
-# generated automatically by aclocal 1.11.6 -*- Autoconf -*-
+# generated automatically by aclocal 1.16.3 -*- Autoconf -*-
+
+# Copyright (C) 1996-2020 Free Software Foundation, Inc.
 
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2007, 2008, 2009, 2010, 2011 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.
@@ -12,33 +11,31 @@
 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 # PARTICULAR PURPOSE.
 
+m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
 [m4_warning([this file was generated for autoconf 2.69.
 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'.])])
+To do so, use the procedure documented by the package, typically 'autoreconf'.])])
 
-# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 2002-2020 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.
 
-# serial 1
-
 # AM_AUTOMAKE_VERSION(VERSION)
 # ----------------------------
 # Automake X.Y traces this macro to ensure aclocal.m4 has been
 # 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.11'
+[am__api_version='1.16'
 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.11.6], [],
+m4_if([$1], [1.16.3], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -54,24 +51,22 @@ 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.11.6])dnl
+[AM_AUTOMAKE_VERSION([1.16.3])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
-# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2001-2020 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.
 
-# serial 1
-
 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
-# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
-# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
+# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
 #
 # Of course, Automake must honor this variable whenever it calls a
 # tool from the auxiliary directory.  The problem is that $srcdir (and
@@ -90,7 +85,7 @@ _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 #
 # The reason of the latter failure is that $top_srcdir and $ac_aux_dir
 # are both prefixed by $srcdir.  In an in-source build this is usually
-# harmless because $srcdir is `.', but things will broke when you
+# harmless because $srcdir is '.', but things will broke when you
 # start a VPATH build or use an absolute $srcdir.
 #
 # So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
@@ -108,30 +103,26 @@ _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 # configured tree to be moved without reconfiguration.
 
 AC_DEFUN([AM_AUX_DIR_EXPAND],
-[dnl Rely on autoconf to set up CDPATH properly.
-AC_PREREQ([2.50])dnl
-# expand $ac_aux_dir to an absolute path
-am_aux_dir=`cd $ac_aux_dir && pwd`
+[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
+# Expand $ac_aux_dir to an absolute path.
+am_aux_dir=`cd "$ac_aux_dir" && pwd`
 ])
 
 # AM_CONDITIONAL                                            -*- Autoconf -*-
 
-# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
-# Free Software Foundation, Inc.
+# Copyright (C) 1997-2020 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.
 
-# serial 9
-
 # AM_CONDITIONAL(NAME, SHELL-CONDITION)
 # -------------------------------------
 # Define a conditional.
 AC_DEFUN([AM_CONDITIONAL],
-[AC_PREREQ(2.52)dnl
- ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
-	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+[AC_PREREQ([2.52])dnl
+ m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
+       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
 AC_SUBST([$1_TRUE])dnl
 AC_SUBST([$1_FALSE])dnl
 _AM_SUBST_NOTMAKE([$1_TRUE])dnl
@@ -150,16 +141,14 @@ AC_CONFIG_COMMANDS_PRE(
 Usually this means the macro was only invoked conditionally.]])
 fi])])
 
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009,
-# 2010, 2011 Free Software Foundation, Inc.
+# Copyright (C) 1999-2020 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.
 
-# serial 12
 
-# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
 # written in clear, in which case automake, when reading aclocal.m4,
 # will think it sees a *use*, and therefore will trigger all it's
 # C support machinery.  Also note that it means that autoscan, seeing
@@ -169,7 +158,7 @@ fi])])
 # _AM_DEPENDENCIES(NAME)
 # ----------------------
 # See how the compiler implements dependency checking.
-# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
 # We try a few techniques and use that to set a single cache variable.
 #
 # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
@@ -182,12 +171,13 @@ AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
 AC_REQUIRE([AM_MAKE_INCLUDE])dnl
 AC_REQUIRE([AM_DEP_TRACK])dnl
 
-ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
-       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
-       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
-       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
-       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
-                   [depcc="$$1"   am_compiler_list=])
+m4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
+      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
+      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
+      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
+      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
+                    [depcc="$$1"   am_compiler_list=])
 
 AC_CACHE_CHECK([dependency style of $depcc],
                [am_cv_$1_dependencies_compiler_type],
@@ -195,8 +185,8 @@ AC_CACHE_CHECK([dependency style of $depcc],
   # We make a subdir and do the tests there.  Otherwise we can end up
   # making bogus files that we don't know about and never remove.  For
   # instance it was reported that on HP-UX the gcc test will end up
-  # making a dummy file named `D' -- because `-MD' means `put the output
-  # in D'.
+  # making a dummy file named 'D' -- because '-MD' means "put the output
+  # in D".
   rm -rf conftest.dir
   mkdir conftest.dir
   # Copy depcomp to subdir because otherwise we won't find it if we're
@@ -236,16 +226,16 @@ AC_CACHE_CHECK([dependency style of $depcc],
     : > sub/conftest.c
     for i in 1 2 3 4 5 6; do
       echo '#include "conftst'$i'.h"' >> sub/conftest.c
-      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
-      # Solaris 8's {/usr,}/bin/sh.
-      touch sub/conftst$i.h
+      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
+      # Solaris 10 /bin/sh.
+      echo '/* dummy */' > sub/conftst$i.h
     done
     echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
 
-    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # We check with '-c' and '-o' for the sake of the "dashmstdout"
     # mode.  It turns out that the SunPro C++ compiler does not properly
-    # handle `-M -o', and we need to detect this.  Also, some Intel
-    # versions had trouble with output in subdirs
+    # handle '-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs.
     am__obj=sub/conftest.${OBJEXT-o}
     am__minus_obj="-o $am__obj"
     case $depmode in
@@ -254,8 +244,8 @@ AC_CACHE_CHECK([dependency style of $depcc],
       test "$am__universal" = false || continue
       ;;
     nosideeffect)
-      # after this tag, mechanisms are not by side-effect, so they'll
-      # only be used when explicitly requested
+      # After this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested.
       if test "x$enable_dependency_tracking" = xyes; then
 	continue
       else
@@ -263,7 +253,7 @@ AC_CACHE_CHECK([dependency style of $depcc],
       fi
       ;;
     msvc7 | msvc7msys | msvisualcpp | msvcmsys)
-      # This compiler won't grok `-c -o', but also, the minuso test has
+      # This compiler won't grok '-c -o', but also, the minuso test has
       # not run yet.  These depmodes are late enough in the game, and
       # so weak that their functioning should not be impacted.
       am__obj=conftest.${OBJEXT-o}
@@ -311,7 +301,7 @@ AM_CONDITIONAL([am__fastdep$1], [
 # AM_SET_DEPDIR
 # -------------
 # Choose a directory name for dependency files.
-# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
 AC_DEFUN([AM_SET_DEPDIR],
 [AC_REQUIRE([AM_SET_LEADING_DOT])dnl
 AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
@@ -321,9 +311,13 @@ AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
 # AM_DEP_TRACK
 # ------------
 AC_DEFUN([AM_DEP_TRACK],
-[AC_ARG_ENABLE(dependency-tracking,
-[  --disable-dependency-tracking  speeds up one-time build
-  --enable-dependency-tracking   do not reject slow dependency extractors])
+[AC_ARG_ENABLE([dependency-tracking], [dnl
+AS_HELP_STRING(
+  [--enable-dependency-tracking],
+  [do not reject slow dependency extractors])
+AS_HELP_STRING(
+  [--disable-dependency-tracking],
+  [speeds up one-time build])])
 if test "x$enable_dependency_tracking" != xno; then
   am_depcomp="$ac_aux_dir/depcomp"
   AMDEPBACKSLASH='\'
@@ -338,67 +332,56 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
 
 # Generate code to set up dependency tracking.              -*- Autoconf -*-
 
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
-# Free Software Foundation, Inc.
+# Copyright (C) 1999-2020 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.
 
-#serial 5
-
 # _AM_OUTPUT_DEPENDENCY_COMMANDS
 # ------------------------------
 AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
 [{
-  # Autoconf 2.62 quotes --file arguments for eval, but not when files
+  # Older Autoconf quotes --file arguments for eval, but not when files
   # are listed without --file.  Let's play safe and only enable the eval
   # if we detect the quoting.
-  case $CONFIG_FILES in
-  *\'*) eval set x "$CONFIG_FILES" ;;
-  *)   set x $CONFIG_FILES ;;
-  esac
+  # TODO: see whether this extra hack can be removed once we start
+  # requiring Autoconf 2.70 or later.
+  AS_CASE([$CONFIG_FILES],
+          [*\'*], [eval set x "$CONFIG_FILES"],
+          [*], [set x $CONFIG_FILES])
   shift
-  for mf
+  # Used to flag and report bootstrapping failures.
+  am_rc=0
+  for am_mf
   do
     # Strip MF so we end up with the name of the file.
-    mf=`echo "$mf" | sed -e 's/:.*$//'`
-    # Check whether this is an Automake generated Makefile or not.
-    # We used to match only the files named `Makefile.in', but
-    # some people rename them; so instead we look at the file content.
-    # Grep'ing the first line is not enough: some people post-process
-    # each Makefile.in and add a new line on top of each file to say so.
-    # Grep'ing the whole file is not good either: AIX grep has a line
+    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
+    # Check whether this is an Automake generated Makefile which includes
+    # dependency-tracking related rules and includes.
+    # Grep'ing the whole file directly is not great: AIX grep has a line
     # limit of 2048, but all sed's we know have understand at least 4000.
-    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
-      dirpart=`AS_DIRNAME("$mf")`
-    else
-      continue
-    fi
-    # Extract the definition of DEPDIR, am__include, and am__quote
-    # from the Makefile without running `make'.
-    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
-    test -z "$DEPDIR" && continue
-    am__include=`sed -n 's/^am__include = //p' < "$mf"`
-    test -z "am__include" && continue
-    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
-    # When using ansi2knr, U may be empty or an underscore; expand it
-    U=`sed -n 's/^U = //p' < "$mf"`
-    # Find all dependency output files, they are included files with
-    # $(DEPDIR) in their names.  We invoke sed twice because it is the
-    # simplest approach to changing $(DEPDIR) to its actual value in the
-    # expansion.
-    for file in `sed -n "
-      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
-	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
-      # Make sure the directory exists.
-      test -f "$dirpart/$file" && continue
-      fdir=`AS_DIRNAME(["$file"])`
-      AS_MKDIR_P([$dirpart/$fdir])
-      # echo "creating $dirpart/$file"
-      echo '# dummy' > "$dirpart/$file"
-    done
+    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
+      || continue
+    am_dirpart=`AS_DIRNAME(["$am_mf"])`
+    am_filepart=`AS_BASENAME(["$am_mf"])`
+    AM_RUN_LOG([cd "$am_dirpart" \
+      && sed -e '/# am--include-marker/d' "$am_filepart" \
+        | $MAKE -f - am--depfiles]) || am_rc=$?
   done
+  if test $am_rc -ne 0; then
+    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
+    for automatic dependency tracking.  If GNU make was not used, consider
+    re-running the configure script with MAKE="gmake" (or whatever is
+    necessary).  You can also try re-running configure with the
+    '--disable-dependency-tracking' option to at least be able to build
+    the package (albeit without support for automatic dependency tracking).])
+  fi
+  AS_UNSET([am_dirpart])
+  AS_UNSET([am_filepart])
+  AS_UNSET([am_mf])
+  AS_UNSET([am_rc])
+  rm -f conftest-deps.mk
 }
 ])# _AM_OUTPUT_DEPENDENCY_COMMANDS
 
@@ -407,29 +390,31 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
 # -----------------------------
 # This macro should only be invoked once -- use via AC_REQUIRE.
 #
-# This code is only required when automatic dependency tracking
-# is enabled.  FIXME.  This creates each `.P' file that we will
-# need in order to bootstrap the dependency handling code.
+# This code is only required when automatic dependency tracking is enabled.
+# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
+# order to bootstrap the dependency handling code.
 AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
 [AC_CONFIG_COMMANDS([depfiles],
      [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
-     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
-])
+     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
 
 # Do all the work for Automake.                             -*- Autoconf -*-
 
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
+# Copyright (C) 1996-2020 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.
 
-# serial 16
-
 # This macro actually does too much.  Some checks are only needed if
 # your package does certain things.  But this isn't really a big deal.
 
+dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
+m4_define([AC_PROG_CC],
+m4_defn([AC_PROG_CC])
+[_AM_PROG_CC_C_O
+])
+
 # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
 # AM_INIT_AUTOMAKE([OPTIONS])
 # -----------------------------------------------
@@ -442,7 +427,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
 # arguments mandatory, and then we can depend on a new Autoconf
 # release and drop the old call support.
 AC_DEFUN([AM_INIT_AUTOMAKE],
-[AC_PREREQ([2.62])dnl
+[AC_PREREQ([2.65])dnl
 dnl Autoconf wants to disallow AM_ names.  We explicitly allow
 dnl the ones we care about.
 m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
@@ -471,33 +456,42 @@ AC_SUBST([CYGPATH_W])
 # Define the identity of the package.
 dnl Distinguish between old-style and new-style calls.
 m4_ifval([$2],
-[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+[AC_DIAGNOSE([obsolete],
+             [$0: two- and three-arguments forms are deprecated.])
+m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
  AC_SUBST([PACKAGE], [$1])dnl
  AC_SUBST([VERSION], [$2])],
 [_AM_SET_OPTIONS([$1])dnl
 dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
-m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
+m4_if(
+  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
+  [ok:ok],,
   [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
  AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
  AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
 
 _AM_IF_OPTION([no-define],,
-[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
- AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
+ AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
 
 # Some tools Automake needs.
 AC_REQUIRE([AM_SANITY_CHECK])dnl
 AC_REQUIRE([AC_ARG_PROGRAM])dnl
-AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
-AM_MISSING_PROG(AUTOCONF, autoconf)
-AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
-AM_MISSING_PROG(AUTOHEADER, autoheader)
-AM_MISSING_PROG(MAKEINFO, makeinfo)
+AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
+AM_MISSING_PROG([AUTOCONF], [autoconf])
+AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
+AM_MISSING_PROG([AUTOHEADER], [autoheader])
+AM_MISSING_PROG([MAKEINFO], [makeinfo])
 AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
 AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
-AC_REQUIRE([AM_PROG_MKDIR_P])dnl
-# We need awk for the "check" target.  The system "awk" is bad on
-# some platforms.
+AC_REQUIRE([AC_PROG_MKDIR_P])dnl
+# For better backward compatibility.  To be removed once Automake 1.9.x
+# dies out for good.  For more background, see:
+# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
+# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
+AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
+# 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
@@ -506,34 +500,82 @@ _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
 			     [_AM_PROG_TAR([v7])])])
 _AM_IF_OPTION([no-dependencies],,
 [AC_PROVIDE_IFELSE([AC_PROG_CC],
-		  [_AM_DEPENDENCIES(CC)],
-		  [define([AC_PROG_CC],
-			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+		  [_AM_DEPENDENCIES([CC])],
+		  [m4_define([AC_PROG_CC],
+			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
 AC_PROVIDE_IFELSE([AC_PROG_CXX],
-		  [_AM_DEPENDENCIES(CXX)],
-		  [define([AC_PROG_CXX],
-			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+		  [_AM_DEPENDENCIES([CXX])],
+		  [m4_define([AC_PROG_CXX],
+			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
 AC_PROVIDE_IFELSE([AC_PROG_OBJC],
-		  [_AM_DEPENDENCIES(OBJC)],
-		  [define([AC_PROG_OBJC],
-			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
+		  [_AM_DEPENDENCIES([OBJC])],
+		  [m4_define([AC_PROG_OBJC],
+			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
+		  [_AM_DEPENDENCIES([OBJCXX])],
+		  [m4_define([AC_PROG_OBJCXX],
+			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
 ])
-_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
-dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
-dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
-dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
+AC_REQUIRE([AM_SILENT_RULES])dnl
+dnl The testsuite driver may need to know about EXEEXT, so add the
+dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
+dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
 AC_CONFIG_COMMANDS_PRE(dnl
 [m4_provide_if([_AM_COMPILER_EXEEXT],
   [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
+
+# POSIX will say in a future version that running "rm -f" with no argument
+# is OK; and we want to be able to make that assumption in our Makefile
+# recipes.  So use an aggressive probe to check that the usage we want is
+# actually supported "in the wild" to an acceptable degree.
+# See automake bug#10828.
+# To make any issue more visible, cause the running configure to be aborted
+# by default if the 'rm' program in use doesn't match our expectations; the
+# user can still override this though.
+if rm -f && rm -fr && rm -rf; then : OK; else
+  cat >&2 <<'END'
+Oops!
+
+Your 'rm' program seems unable to run without file operands specified
+on the command line, even when the '-f' option is present.  This is contrary
+to the behaviour of most rm programs out there, and not conforming with
+the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
+
+Please tell bug-automake@gnu.org about your system, including the value
+of your $PATH and any error possibly output before this message.  This
+can help us improve future automake versions.
+
+END
+  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
+    echo 'Configuration will proceed anyway, since you have set the' >&2
+    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
+    echo >&2
+  else
+    cat >&2 <<'END'
+Aborting the configuration process, to ensure you take notice of the issue.
+
+You can download and install GNU coreutils to get an 'rm' implementation
+that behaves properly: <https://www.gnu.org/software/coreutils/>.
+
+If you want to complete the configuration process using your problematic
+'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
+to "yes", and re-run configure.
+
+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
+dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
 dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
 dnl mangled by Autoconf and run in a shell conditional statement.
 m4_define([_AC_COMPILER_EXEEXT],
 m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
 
-
 # When config.status generates a header, we must update the stamp-h file.
 # This file resides in the same directory as the config header
 # that is generated.  The stamp files are numbered to have different names.
@@ -555,21 +597,18 @@ 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, 2003, 2005, 2008, 2011 Free Software Foundation,
-# Inc.
+# Copyright (C) 2001-2020 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.
 
-# serial 1
-
 # AM_PROG_INSTALL_SH
 # ------------------
 # 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'" ;;
@@ -577,16 +616,14 @@ if test x"${install_sh}" != xset; then
     install_sh="\${SHELL} $am_aux_dir/install-sh"
   esac
 fi
-AC_SUBST(install_sh)])
+AC_SUBST([install_sh])])
 
-# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
+# Copyright (C) 2003-2020 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.
 
-# serial 2
-
 # Check whether the underlying file-system supports filenames
 # with a leading dot.  For instance MS-DOS doesn't.
 AC_DEFUN([AM_SET_LEADING_DOT],
@@ -602,67 +639,55 @@ AC_SUBST([am__leading_dot])])
 
 # Check to see how 'make' treats includes.	            -*- Autoconf -*-
 
-# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
+# Copyright (C) 2001-2020 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.
 
-# serial 4
-
 # AM_MAKE_INCLUDE()
 # -----------------
-# Check to see how make treats includes.
+# Check whether make has an 'include' directive that can support all
+# the idioms we need for our automatic dependency tracking code.
 AC_DEFUN([AM_MAKE_INCLUDE],
-[am_make=${MAKE-make}
-cat > confinc << 'END'
+[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
+cat > confinc.mk << 'END'
 am__doit:
-	@echo this is the am__doit target
+	@echo this is the am__doit target >confinc.out
 .PHONY: am__doit
 END
-# If we don't find an include directive, just comment out the code.
-AC_MSG_CHECKING([for style of include used by $am_make])
 am__include="#"
 am__quote=
-_am_result=none
-# First try GNU make style include.
-echo "include confinc" > confmf
-# Ignore all kinds of additional output from `make'.
-case `$am_make -s -f confmf 2> /dev/null` in #(
-*the\ am__doit\ target*)
-  am__include=include
-  am__quote=
-  _am_result=GNU
-  ;;
-esac
-# Now try BSD make style include.
-if test "$am__include" = "#"; then
-   echo '.include "confinc"' > confmf
-   case `$am_make -s -f confmf 2> /dev/null` in #(
-   *the\ am__doit\ target*)
-     am__include=.include
-     am__quote="\""
-     _am_result=BSD
-     ;;
-   esac
-fi
-AC_SUBST([am__include])
-AC_SUBST([am__quote])
-AC_MSG_RESULT([$_am_result])
-rm -f confinc confmf
-])
+# BSD make does it like this.
+echo '.include "confinc.mk" # ignored' > confmf.BSD
+# Other make implementations (GNU, Solaris 10, AIX) do it like this.
+echo 'include confinc.mk # ignored' > confmf.GNU
+_am_result=no
+for s in GNU BSD; do
+  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
+  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
+      ['0:this is the am__doit target'],
+      [AS_CASE([$s],
+          [BSD], [am__include='.include' am__quote='"'],
+          [am__include='include' am__quote=''])])
+  if test "$am__include" != "#"; then
+    _am_result="yes ($s style)"
+    break
+  fi
+done
+rm -f confinc.* confmf.*
+AC_MSG_RESULT([${_am_result}])
+AC_SUBST([am__include])])
+AC_SUBST([am__quote])])
 
 # Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
 
-# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
-# Free Software Foundation, Inc.
+# Copyright (C) 1997-2020 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.
 
-# serial 6
-
 # AM_MISSING_PROG(NAME, PROGRAM)
 # ------------------------------
 AC_DEFUN([AM_MISSING_PROG],
@@ -670,71 +695,33 @@ AC_DEFUN([AM_MISSING_PROG],
 $1=${$1-"${am_missing_run}$2"}
 AC_SUBST($1)])
 
-
 # AM_MISSING_HAS_RUN
 # ------------------
-# Define MISSING if not defined so far and test if it supports --run.
-# If it does, set am_missing_run to use it, otherwise, to nothing.
+# Define MISSING if not defined so far and test if it is modern enough.
+# If it is, set am_missing_run to use it, otherwise, to nothing.
 AC_DEFUN([AM_MISSING_HAS_RUN],
 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
 AC_REQUIRE_AUX_FILE([missing])dnl
 if test x"${MISSING+set}" != xset; then
-  case $am_aux_dir in
-  *\ * | *\	*)
-    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
-  *)
-    MISSING="\${SHELL} $am_aux_dir/missing" ;;
-  esac
+  MISSING="\${SHELL} '$am_aux_dir/missing'"
 fi
 # Use eval to expand $SHELL
-if eval "$MISSING --run true"; then
-  am_missing_run="$MISSING --run "
+if eval "$MISSING --is-lightweight"; then
+  am_missing_run="$MISSING "
 else
   am_missing_run=
-  AC_MSG_WARN([`missing' script is too old or missing])
+  AC_MSG_WARN(['missing' script is too old or missing])
 fi
 ])
 
-# Copyright (C) 2003, 2004, 2005, 2006, 2011 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.
-
-# serial 1
-
-# AM_PROG_MKDIR_P
-# ---------------
-# Check for `mkdir -p'.
-AC_DEFUN([AM_PROG_MKDIR_P],
-[AC_PREREQ([2.60])dnl
-AC_REQUIRE([AC_PROG_MKDIR_P])dnl
-dnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
-dnl while keeping a definition of mkdir_p for backward compatibility.
-dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
-dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
-dnl Makefile.ins that do not define MKDIR_P, so we do our own
-dnl adjustment using top_builddir (which is defined more often than
-dnl MKDIR_P).
-AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
-case $mkdir_p in
-  [[\\/$]]* | ?:[[\\/]]*) ;;
-  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
-esac
-])
-
 # Helper functions for option handling.                     -*- Autoconf -*-
 
-# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software
-# Foundation, Inc.
+# Copyright (C) 2001-2020 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.
 
-# serial 5
-
 # _AM_MANGLE_OPTION(NAME)
 # -----------------------
 AC_DEFUN([_AM_MANGLE_OPTION],
@@ -744,7 +731,7 @@ AC_DEFUN([_AM_MANGLE_OPTION],
 # --------------------
 # Set option NAME.  Presently that only means defining a flag for this option.
 AC_DEFUN([_AM_SET_OPTION],
-[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
 
 # _AM_SET_OPTIONS(OPTIONS)
 # ------------------------
@@ -758,24 +745,82 @@ AC_DEFUN([_AM_SET_OPTIONS],
 AC_DEFUN([_AM_IF_OPTION],
 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
 
-# Check to make sure that the build environment is sane.    -*- Autoconf -*-
+# Copyright (C) 1999-2020 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_CC_C_O
+# ---------------
+# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
+# to automatically call this.
+AC_DEFUN([_AM_PROG_CC_C_O],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([compile])dnl
+AC_LANG_PUSH([C])dnl
+AC_CACHE_CHECK(
+  [whether $CC understands -c and -o together],
+  [am_cv_prog_cc_c_o],
+  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
+  # Make sure it works both with $CC and with simple cc.
+  # Following AC_PROG_CC_C_O, we do the test twice because some
+  # compilers refuse to overwrite an existing .o file with -o,
+  # though they will create one.
+  am_cv_prog_cc_c_o=yes
+  for am_i in 1 2; do
+    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
+         && test -f conftest2.$ac_objext; then
+      : OK
+    else
+      am_cv_prog_cc_c_o=no
+      break
+    fi
+  done
+  rm -f core conftest*
+  unset am_i])
+if test "$am_cv_prog_cc_c_o" != yes; then
+   # Losing compiler, so override with the script.
+   # FIXME: It is wrong to rewrite CC.
+   # 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__CC in this case,
+   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+   CC="$am_aux_dir/compile $CC"
+fi
+AC_LANG_POP([C])])
 
-# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
-# Free Software Foundation, Inc.
+# For backward compatibility.
+AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
+
+# Copyright (C) 2001-2020 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.
 
-# serial 5
+# AM_RUN_LOG(COMMAND)
+# -------------------
+# Run COMMAND, save the exit status in ac_status, and log it.
+# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
+AC_DEFUN([AM_RUN_LOG],
+[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
+   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   (exit $ac_status); }])
+
+# Check to make sure that the build environment is sane.    -*- Autoconf -*-
+
+# Copyright (C) 1996-2020 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_SANITY_CHECK
 # ---------------
 AC_DEFUN([AM_SANITY_CHECK],
 [AC_MSG_CHECKING([whether build environment is sane])
-# Just in case
-sleep 1
-echo timestamp > conftest.file
 # Reject unsafe characters in $srcdir or the absolute working directory
 # name.  Accept space and tab only in the latter.
 am_lf='
@@ -786,32 +831,40 @@ case `pwd` in
 esac
 case $srcdir in
   *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
-    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
+    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
 esac
 
-# Do `set' in a subshell so we don't clobber the current shell's
+# Do 'set' in a subshell so we don't clobber the current shell's
 # arguments.  Must try -L first in case configure is actually a
 # symlink; some systems play weird games with the mod time of symlinks
 # (eg FreeBSD returns the mod time of the symlink's containing
 # directory).
 if (
-   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
-   if test "$[*]" = "X"; then
-      # -L didn't work.
-      set X `ls -t "$srcdir/configure" conftest.file`
-   fi
-   rm -f conftest.file
-   if test "$[*]" != "X $srcdir/configure conftest.file" \
-      && test "$[*]" != "X conftest.file $srcdir/configure"; then
-
-      # If neither matched, then we have a broken ls.  This can happen
-      # if, for instance, CONFIG_SHELL is bash and it inherits a
-      # broken ls alias from the environment.  This has actually
-      # happened.  Such a system could not be considered "sane".
-      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
-alias in your environment])
-   fi
-
+   am_has_slept=no
+   for am_try in 1 2; do
+     echo "timestamp, slept: $am_has_slept" > conftest.file
+     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+     if test "$[*]" = "X"; then
+	# -L didn't work.
+	set X `ls -t "$srcdir/configure" conftest.file`
+     fi
+     if test "$[*]" != "X $srcdir/configure conftest.file" \
+	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+	# If neither matched, then we have a broken ls.  This can happen
+	# if, for instance, CONFIG_SHELL is bash and it inherits a
+	# broken ls alias from the environment.  This has actually
+	# happened.  Such a system could not be considered "sane".
+	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
+  alias in your environment])
+     fi
+     if test "$[2]" = conftest.file || test $am_try -eq 2; then
+       break
+     fi
+     # Just in case.
+     sleep 1
+     am_has_slept=yes
+   done
    test "$[2]" = conftest.file
    )
 then
@@ -821,46 +874,118 @@ else
    AC_MSG_ERROR([newly created file is older than distributed files!
 Check your system clock])
 fi
-AC_MSG_RESULT(yes)])
+AC_MSG_RESULT([yes])
+# If we didn't sleep, we still need to ensure time stamps of config.status and
+# generated files are strictly newer.
+am_sleep_pid=
+if grep 'slept: no' conftest.file >/dev/null 2>&1; then
+  ( sleep 1 ) &
+  am_sleep_pid=$!
+fi
+AC_CONFIG_COMMANDS_PRE(
+  [AC_MSG_CHECKING([that generated files are newer than configure])
+   if test -n "$am_sleep_pid"; then
+     # Hide warnings about reused PIDs.
+     wait $am_sleep_pid 2>/dev/null
+   fi
+   AC_MSG_RESULT([done])])
+rm -f conftest.file
+])
 
-# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2009-2020 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.
 
-# serial 1
+# AM_SILENT_RULES([DEFAULT])
+# --------------------------
+# Enable less verbose build rules; with the default set to DEFAULT
+# ("yes" being less verbose, "no" or empty being verbose).
+AC_DEFUN([AM_SILENT_RULES],
+[AC_ARG_ENABLE([silent-rules], [dnl
+AS_HELP_STRING(
+  [--enable-silent-rules],
+  [less verbose build output (undo: "make V=1")])
+AS_HELP_STRING(
+  [--disable-silent-rules],
+  [verbose build output (undo: "make V=0")])dnl
+])
+case $enable_silent_rules in @%:@ (((
+  yes) AM_DEFAULT_VERBOSITY=0;;
+   no) AM_DEFAULT_VERBOSITY=1;;
+    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
+esac
+dnl
+dnl A few 'make' implementations (e.g., NonStop OS and NextStep)
+dnl do not support nested variable expansions.
+dnl See automake bug#9928 and bug#10237.
+am_make=${MAKE-make}
+AC_CACHE_CHECK([whether $am_make supports nested variables],
+   [am_cv_make_support_nested_variables],
+   [if AS_ECHO([['TRUE=$(BAR$(V))
+BAR0=false
+BAR1=true
+V=1
+am__doit:
+	@$(TRUE)
+.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
+  am_cv_make_support_nested_variables=yes
+else
+  am_cv_make_support_nested_variables=no
+fi])
+if test $am_cv_make_support_nested_variables = yes; then
+  dnl Using '$V' instead of '$(V)' breaks IRIX make.
+  AM_V='$(V)'
+  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
+else
+  AM_V=$AM_DEFAULT_VERBOSITY
+  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
+fi
+AC_SUBST([AM_V])dnl
+AM_SUBST_NOTMAKE([AM_V])dnl
+AC_SUBST([AM_DEFAULT_V])dnl
+AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
+AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
+AM_BACKSLASH='\'
+AC_SUBST([AM_BACKSLASH])dnl
+_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
+])
+
+# Copyright (C) 2001-2020 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_INSTALL_STRIP
 # ---------------------
-# One issue with vendor `install' (even GNU) is that you can't
+# One issue with vendor 'install' (even GNU) is that you can't
 # specify the program used to strip binaries.  This is especially
 # annoying in cross-compiling environments, where the build's strip
 # is unlikely to handle the host's binaries.
 # Fortunately install-sh will honor a STRIPPROG variable, so we
-# always use install-sh in `make install-strip', and initialize
+# always use install-sh in "make install-strip", and initialize
 # STRIPPROG with the value of the STRIP variable (set by the user).
 AC_DEFUN([AM_PROG_INSTALL_STRIP],
 [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
-# Installed binaries are usually stripped using `strip' when the user
-# run `make install-strip'.  However `strip' might not be the right
+# Installed binaries are usually stripped using 'strip' when the user
+# run "make install-strip".  However 'strip' might not be the right
 # tool to use in cross-compilation environments, therefore Automake
-# will honor the `STRIP' environment variable to overrule this program.
-dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+# will honor the 'STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
 if test "$cross_compiling" != no; then
   AC_CHECK_TOOL([STRIP], [strip], :)
 fi
 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 AC_SUBST([INSTALL_STRIP_PROGRAM])])
 
-# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2006-2020 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.
 
-# serial 3
-
 # _AM_SUBST_NOTMAKE(VARIABLE)
 # ---------------------------
 # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
@@ -874,18 +999,16 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 # Check how to create a tarball.                            -*- Autoconf -*-
 
-# Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc.
+# Copyright (C) 2004-2020 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.
 
-# serial 2
-
 # _AM_PROG_TAR(FORMAT)
 # --------------------
 # Check how to create a tarball in format FORMAT.
-# FORMAT should be one of `v7', `ustar', or `pax'.
+# FORMAT should be one of 'v7', 'ustar', or 'pax'.
 #
 # Substitute a variable $(am__tar) that is a command
 # writing to stdout a FORMAT-tarball containing the directory
@@ -895,76 +1018,114 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 # Substitute a variable $(am__untar) that extract such
 # a tarball read from stdin.
 #     $(am__untar) < result.tar
+#
 AC_DEFUN([_AM_PROG_TAR],
 [# Always define AMTAR for backward compatibility.  Yes, it's still used
 # in the wild :-(  We should find a proper way to deprecate it ...
 AC_SUBST([AMTAR], ['$${TAR-tar}'])
-m4_if([$1], [v7],
-     [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
-     [m4_case([$1], [ustar],, [pax],,
-              [m4_fatal([Unknown tar format])])
-AC_MSG_CHECKING([how to create a $1 tar archive])
-# Loop over all known methods to create a tar archive until one works.
+
+# We'll loop over all known methods to create a tar archive until one works.
 _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
-_am_tools=${am_cv_prog_tar_$1-$_am_tools}
-# Do not fold the above two line into one, because Tru64 sh and
-# Solaris sh will not grok spaces in the rhs of `-'.
-for _am_tool in $_am_tools
-do
-  case $_am_tool in
-  gnutar)
-    for _am_tar in tar gnutar gtar;
-    do
-      AM_RUN_LOG([$_am_tar --version]) && break
-    done
-    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
-    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
-    am__untar="$_am_tar -xf -"
-    ;;
-  plaintar)
-    # Must skip GNU tar: if it does not support --format= it doesn't create
-    # ustar tarball either.
-    (tar --version) >/dev/null 2>&1 && continue
-    am__tar='tar chf - "$$tardir"'
-    am__tar_='tar chf - "$tardir"'
-    am__untar='tar xf -'
-    ;;
-  pax)
-    am__tar='pax -L -x $1 -w "$$tardir"'
-    am__tar_='pax -L -x $1 -w "$tardir"'
-    am__untar='pax -r'
-    ;;
-  cpio)
-    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
-    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
-    am__untar='cpio -i -H $1 -d'
-    ;;
-  none)
-    am__tar=false
-    am__tar_=false
-    am__untar=false
-    ;;
-  esac
 
-  # If the value was cached, stop now.  We just wanted to have am__tar
-  # and am__untar set.
-  test -n "${am_cv_prog_tar_$1}" && break
+m4_if([$1], [v7],
+  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
+
+  [m4_case([$1],
+    [ustar],
+     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
+      # There is notably a 21 bits limit for the UID and the GID.  In fact,
+      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
+      # and bug#13588).
+      am_max_uid=2097151 # 2^21 - 1
+      am_max_gid=$am_max_uid
+      # The $UID and $GID variables are not portable, so we need to resort
+      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
+      # below are definitely unexpected, so allow the users to see them
+      # (that is, avoid stderr redirection).
+      am_uid=`id -u || echo unknown`
+      am_gid=`id -g || echo unknown`
+      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
+      if test $am_uid -le $am_max_uid; then
+         AC_MSG_RESULT([yes])
+      else
+         AC_MSG_RESULT([no])
+         _am_tools=none
+      fi
+      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
+      if test $am_gid -le $am_max_gid; then
+         AC_MSG_RESULT([yes])
+      else
+        AC_MSG_RESULT([no])
+        _am_tools=none
+      fi],
+
+  [pax],
+    [],
+
+  [m4_fatal([Unknown tar format])])
+
+  AC_MSG_CHECKING([how to create a $1 tar archive])
+
+  # Go ahead even if we have the value already cached.  We do so because we
+  # need to set the values for the 'am__tar' and 'am__untar' variables.
+  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
+
+  for _am_tool in $_am_tools; do
+    case $_am_tool in
+    gnutar)
+      for _am_tar in tar gnutar gtar; do
+        AM_RUN_LOG([$_am_tar --version]) && break
+      done
+      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+      am__untar="$_am_tar -xf -"
+      ;;
+    plaintar)
+      # Must skip GNU tar: if it does not support --format= it doesn't create
+      # ustar tarball either.
+      (tar --version) >/dev/null 2>&1 && continue
+      am__tar='tar chf - "$$tardir"'
+      am__tar_='tar chf - "$tardir"'
+      am__untar='tar xf -'
+      ;;
+    pax)
+      am__tar='pax -L -x $1 -w "$$tardir"'
+      am__tar_='pax -L -x $1 -w "$tardir"'
+      am__untar='pax -r'
+      ;;
+    cpio)
+      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+      am__untar='cpio -i -H $1 -d'
+      ;;
+    none)
+      am__tar=false
+      am__tar_=false
+      am__untar=false
+      ;;
+    esac
 
-  # tar/untar a dummy directory, and stop if the command works
-  rm -rf conftest.dir
-  mkdir conftest.dir
-  echo GrepMe > conftest.dir/file
-  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+    # If the value was cached, stop now.  We just wanted to have am__tar
+    # and am__untar set.
+    test -n "${am_cv_prog_tar_$1}" && break
+
+    # tar/untar a dummy directory, and stop if the command works.
+    rm -rf conftest.dir
+    mkdir conftest.dir
+    echo GrepMe > conftest.dir/file
+    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+    rm -rf conftest.dir
+    if test -s conftest.tar; then
+      AM_RUN_LOG([$am__untar <conftest.tar])
+      AM_RUN_LOG([cat conftest.dir/file])
+      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+    fi
+  done
   rm -rf conftest.dir
-  if test -s conftest.tar; then
-    AM_RUN_LOG([$am__untar <conftest.tar])
-    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
-  fi
-done
-rm -rf conftest.dir
 
-AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
-AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+
 AC_SUBST([am__tar])
 AC_SUBST([am__untar])
 ]) # _AM_PROG_TAR
diff --git a/compile b/compile
new file mode 100755
index 0000000000000000000000000000000000000000..23fcba011321a3a2b3b94a8abb13201dbdd1faa5
--- /dev/null
+++ b/compile
@@ -0,0 +1,348 @@
+#! /bin/sh
+# Wrapper for compilers which do not understand '-c -o'.
+
+scriptversion=2018-03-07.03; # UTC
+
+# Copyright (C) 1999-2020 Free Software Foundation, Inc.
+# Written by Tom Tromey <tromey@cygnus.com>.
+#
+# 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 <https://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>.
+
+nl='
+'
+
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent tools from complaining about whitespace usage.
+IFS=" ""	$nl"
+
+file_conv=
+
+# func_file_conv build_file lazy
+# Convert a $build file to $host form and store it in $file
+# Currently only supports Windows hosts. If the determined conversion
+# type is listed in (the comma separated) LAZY, no conversion will
+# take place.
+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* | MSYS*)
+	    file_conv=cygwin
+	    ;;
+	  *)
+	    file_conv=wine
+	    ;;
+	esac
+      fi
+      case $file_conv/,$2, in
+	*,$file_conv,*)
+	  ;;
+	mingw/*)
+	  file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
+	  ;;
+	cygwin/* | msys/*)
+	  file=`cygpath -m "$file" || echo "$file"`
+	  ;;
+	wine/*)
+	  file=`winepath -w "$file" || echo "$file"`
+	  ;;
+      esac
+      ;;
+  esac
+}
+
+# func_cl_dashL linkdir
+# Make cl look for libraries in LINKDIR
+func_cl_dashL ()
+{
+  func_file_conv "$1"
+  if test -z "$lib_path"; then
+    lib_path=$file
+  else
+    lib_path="$lib_path;$file"
+  fi
+  linker_opts="$linker_opts -LIBPATH:$file"
+}
+
+# func_cl_dashl library
+# Do a library search-path lookup for cl
+func_cl_dashl ()
+{
+  lib=$1
+  found=no
+  save_IFS=$IFS
+  IFS=';'
+  for dir in $lib_path $LIB
+  do
+    IFS=$save_IFS
+    if $shared && test -f "$dir/$lib.dll.lib"; then
+      found=yes
+      lib=$dir/$lib.dll.lib
+      break
+    fi
+    if test -f "$dir/$lib.lib"; then
+      found=yes
+      lib=$dir/$lib.lib
+      break
+    fi
+    if test -f "$dir/lib$lib.a"; then
+      found=yes
+      lib=$dir/lib$lib.a
+      break
+    fi
+  done
+  IFS=$save_IFS
+
+  if test "$found" != yes; then
+    lib=$lib.lib
+  fi
+}
+
+# func_cl_wrapper cl arg...
+# Adjust compile command to suit cl
+func_cl_wrapper ()
+{
+  # Assume a capable shell
+  lib_path=
+  shared=:
+  linker_opts=
+  for arg
+  do
+    if test -n "$eat"; then
+      eat=
+    else
+      case $1 in
+	-o)
+	  # configure might choose to run compile as 'compile cc -o foo foo.c'.
+	  eat=1
+	  case $2 in
+	    *.o | *.[oO][bB][jJ])
+	      func_file_conv "$2"
+	      set x "$@" -Fo"$file"
+	      shift
+	      ;;
+	    *)
+	      func_file_conv "$2"
+	      set x "$@" -Fe"$file"
+	      shift
+	      ;;
+	  esac
+	  ;;
+	-I)
+	  eat=1
+	  func_file_conv "$2" mingw
+	  set x "$@" -I"$file"
+	  shift
+	  ;;
+	-I*)
+	  func_file_conv "${1#-I}" mingw
+	  set x "$@" -I"$file"
+	  shift
+	  ;;
+	-l)
+	  eat=1
+	  func_cl_dashl "$2"
+	  set x "$@" "$lib"
+	  shift
+	  ;;
+	-l*)
+	  func_cl_dashl "${1#-l}"
+	  set x "$@" "$lib"
+	  shift
+	  ;;
+	-L)
+	  eat=1
+	  func_cl_dashL "$2"
+	  ;;
+	-L*)
+	  func_cl_dashL "${1#-L}"
+	  ;;
+	-static)
+	  shared=false
+	  ;;
+	-Wl,*)
+	  arg=${1#-Wl,}
+	  save_ifs="$IFS"; IFS=','
+	  for flag in $arg; do
+	    IFS="$save_ifs"
+	    linker_opts="$linker_opts $flag"
+	  done
+	  IFS="$save_ifs"
+	  ;;
+	-Xlinker)
+	  eat=1
+	  linker_opts="$linker_opts $2"
+	  ;;
+	-*)
+	  set x "$@" "$1"
+	  shift
+	  ;;
+	*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
+	  func_file_conv "$1"
+	  set x "$@" -Tp"$file"
+	  shift
+	  ;;
+	*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
+	  func_file_conv "$1" mingw
+	  set x "$@" "$file"
+	  shift
+	  ;;
+	*)
+	  set x "$@" "$1"
+	  shift
+	  ;;
+      esac
+    fi
+    shift
+  done
+  if test -n "$linker_opts"; then
+    linker_opts="-link$linker_opts"
+  fi
+  exec "$@" $linker_opts
+  exit 1
+}
+
+eat=
+
+case $1 in
+  '')
+     echo "$0: No command.  Try '$0 --help' for more information." 1>&2
+     exit 1;
+     ;;
+  -h | --h*)
+    cat <<\EOF
+Usage: compile [--help] [--version] PROGRAM [ARGS]
+
+Wrapper for compilers which do not understand '-c -o'.
+Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
+arguments, and rename the output as expected.
+
+If you are trying to build a whole package this is not the
+right script to run: please start by reading the file 'INSTALL'.
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+    exit $?
+    ;;
+  -v | --v*)
+    echo "compile $scriptversion"
+    exit $?
+    ;;
+  cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
+  icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
+    func_cl_wrapper "$@"      # Doesn't return...
+    ;;
+esac
+
+ofile=
+cfile=
+
+for arg
+do
+  if test -n "$eat"; then
+    eat=
+  else
+    case $1 in
+      -o)
+	# configure might choose to run compile as 'compile cc -o foo foo.c'.
+	# So we strip '-o arg' only if arg is an object.
+	eat=1
+	case $2 in
+	  *.o | *.obj)
+	    ofile=$2
+	    ;;
+	  *)
+	    set x "$@" -o "$2"
+	    shift
+	    ;;
+	esac
+	;;
+      *.c)
+	cfile=$1
+	set x "$@" "$1"
+	shift
+	;;
+      *)
+	set x "$@" "$1"
+	shift
+	;;
+    esac
+  fi
+  shift
+done
+
+if test -z "$ofile" || test -z "$cfile"; then
+  # If no '-o' option was seen then we might have been invoked from a
+  # pattern rule where we don't need one.  That is ok -- this is a
+  # normal compilation that the losing compiler can handle.  If no
+  # '.c' file was seen then we are probably linking.  That is also
+  # ok.
+  exec "$@"
+fi
+
+# Name of file we expect compiler to create.
+cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
+
+# Create the lock directory.
+# Note: use '[/\\:.-]' here to ensure that we don't use the same name
+# that we are using for the .o file.  Also, base the name on the expected
+# object file name, since that is what matters with a parallel build.
+lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
+while true; do
+  if mkdir "$lockdir" >/dev/null 2>&1; then
+    break
+  fi
+  sleep 1
+done
+# FIXME: race condition here if user kills between mkdir and trap.
+trap "rmdir '$lockdir'; exit 1" 1 2 15
+
+# Run the compile.
+"$@"
+ret=$?
+
+if test -f "$cofile"; then
+  test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
+elif test -f "${cofile}bj"; then
+  test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
+fi
+
+rmdir "$lockdir"
+exit $ret
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'before-save-hook 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC0"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/config.h.in b/config.h.in
index 38274d2a4f38361f508d8cdcf69573bb8630fca6..4dc360c5f09342c5215aec74b518a61fb26a284f 100644
--- a/config.h.in
+++ b/config.h.in
@@ -180,15 +180,30 @@
 /* Define to 1 if you need to in order for `stat' and other things to work. */
 #undef _POSIX_SOURCE
 
+/* 64-bit operations are the same as 32-bit */
+#undef dirent64
+
 /* 64-bit operations are the same as 32-bit */
 #undef fstat64
 
+/* 64-bit operations are the same as 32-bit */
+#undef glob64
+
+/* 64-bit operations are the same as 32-bit */
+#undef glob64_t
+
+/* 64-bit operations are the same as 32-bit */
+#undef globfree64
+
 /* 64-bit operations are the same as 32-bit */
 #undef lstat64
 
 /* 64-bit operations are the same as 32-bit */
 #undef open64
 
+/* 64-bit operations are the same as 32-bit */
+#undef readdir64
+
 /* klibc has bsd_signal instead of signal */
 #undef signal
 
diff --git a/configure b/configure
index cfff0f90fd6675daf4f6d32d6e6cfbd998d72db3..e995ec9ebab22847fc68b1856952cfe27fbf230d 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for dash 0.5.10.2.
+# Generated by GNU Autoconf 2.69 for dash 0.5.12.
 #
 #
 # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -577,8 +577,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='dash'
 PACKAGE_TARNAME='dash'
-PACKAGE_VERSION='0.5.10.2'
-PACKAGE_STRING='dash 0.5.10.2'
+PACKAGE_VERSION='0.5.12'
+PACKAGE_STRING='dash 0.5.12'
 PACKAGE_BUGREPORT=''
 PACKAGE_URL=''
 
@@ -624,8 +624,6 @@ am__EXEEXT_TRUE
 LTLIBOBJS
 LIBOBJS
 CC_FOR_BUILD
-YFLAGS
-YACC
 EGREP
 GREP
 CPP
@@ -636,7 +634,6 @@ am__nodep
 AMDEPBACKSLASH
 AMDEP_FALSE
 AMDEP_TRUE
-am__quote
 am__include
 DEPDIR
 OBJEXT
@@ -646,6 +643,10 @@ CPPFLAGS
 LDFLAGS
 CFLAGS
 CC
+AM_BACKSLASH
+AM_DEFAULT_VERBOSITY
+AM_DEFAULT_V
+AM_V
 am__untar
 am__tar
 AMTAR
@@ -688,6 +689,7 @@ infodir
 docdir
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -706,10 +708,12 @@ PACKAGE_VERSION
 PACKAGE_TARNAME
 PACKAGE_NAME
 PATH_SEPARATOR
-SHELL'
+SHELL
+am__quote'
 ac_subst_files=''
 ac_user_opts='
 enable_option_checking
+enable_silent_rules
 enable_dependency_tracking
 enable_static
 enable_fnmatch
@@ -726,9 +730,7 @@ CFLAGS
 LDFLAGS
 LIBS
 CPPFLAGS
-CPP
-YACC
-YFLAGS'
+CPP'
 
 
 # Initialize some variables set by options.
@@ -767,6 +769,7 @@ datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1019,6 +1022,15 @@ do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
+  -runstatedir | --runstatedir | --runstatedi | --runstated \
+  | --runstate | --runstat | --runsta | --runst | --runs \
+  | --run | --ru | --r)
+    ac_prev=runstatedir ;;
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+  | --run=* | --ru=* | --r=*)
+    runstatedir=$ac_optarg ;;
+
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1156,7 +1168,7 @@ fi
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir
+		libdir localedir mandir runstatedir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1269,7 +1281,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures dash 0.5.10.2 to adapt to many kinds of systems.
+\`configure' configures dash 0.5.12 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1309,6 +1321,7 @@ Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
@@ -1335,7 +1348,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of dash 0.5.10.2:";;
+     short | recursive ) echo "Configuration of dash 0.5.12:";;
    esac
   cat <<\_ACEOF
 
@@ -1343,10 +1356,14 @@ Optional Features:
   --disable-option-checking  ignore unrecognized --enable/--with options
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
-  --disable-dependency-tracking  speeds up one-time build
-  --enable-dependency-tracking   do not reject slow dependency extractors
+  --enable-silent-rules   less verbose build output (undo: "make V=1")
+  --disable-silent-rules  verbose build output (undo: "make V=0")
+  --enable-dependency-tracking
+                          do not reject slow dependency extractors
+  --disable-dependency-tracking
+                          speeds up one-time build
   --enable-static         Build statical linked program
-  --enable-fnmatch        Use fnmatch(3) from libc
+  --disable-fnmatch       Do not use fnmatch(3) from libc
   --enable-glob           Use glob(3) from libc
   --enable-test-workaround
                           Guard against faccessat(2) that tells root all files
@@ -1367,12 +1384,6 @@ Some influential environment variables:
   CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
               you have headers in a nonstandard directory <include dir>
   CPP         C preprocessor
-  YACC        The `Yet Another Compiler Compiler' implementation to use.
-              Defaults to the first program found out of: `bison -y', `byacc',
-              `yacc'.
-  YFLAGS      The list of arguments that will be passed by default to $YACC.
-              This script will default YFLAGS to the empty string to avoid a
-              default value of `-d' given by some make applications.
 
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
@@ -1440,7 +1451,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-dash configure 0.5.10.2
+dash configure 0.5.12
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2034,7 +2045,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by dash $as_me 0.5.10.2, which was
+It was created by dash $as_me 0.5.12, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2382,7 +2393,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
-am__api_version='1.11'
+am__api_version='1.16'
 
 ac_aux_dir=
 for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
@@ -2508,9 +2519,6 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
 $as_echo_n "checking whether build environment is sane... " >&6; }
-# Just in case
-sleep 1
-echo timestamp > conftest.file
 # Reject unsafe characters in $srcdir or the absolute working directory
 # name.  Accept space and tab only in the latter.
 am_lf='
@@ -2521,32 +2529,40 @@ case `pwd` in
 esac
 case $srcdir in
   *[\\\"\#\$\&\'\`$am_lf\ \	]*)
-    as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;;
+    as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;;
 esac
 
-# Do `set' in a subshell so we don't clobber the current shell's
+# Do 'set' in a subshell so we don't clobber the current shell's
 # arguments.  Must try -L first in case configure is actually a
 # symlink; some systems play weird games with the mod time of symlinks
 # (eg FreeBSD returns the mod time of the symlink's containing
 # directory).
 if (
-   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
-   if test "$*" = "X"; then
-      # -L didn't work.
-      set X `ls -t "$srcdir/configure" conftest.file`
-   fi
-   rm -f conftest.file
-   if test "$*" != "X $srcdir/configure conftest.file" \
-      && test "$*" != "X conftest.file $srcdir/configure"; then
-
-      # If neither matched, then we have a broken ls.  This can happen
-      # if, for instance, CONFIG_SHELL is bash and it inherits a
-      # broken ls alias from the environment.  This has actually
-      # happened.  Such a system could not be considered "sane".
-      as_fn_error $? "ls -t appears to fail.  Make sure there is not a broken
-alias in your environment" "$LINENO" 5
-   fi
-
+   am_has_slept=no
+   for am_try in 1 2; do
+     echo "timestamp, slept: $am_has_slept" > conftest.file
+     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+     if test "$*" = "X"; then
+	# -L didn't work.
+	set X `ls -t "$srcdir/configure" conftest.file`
+     fi
+     if test "$*" != "X $srcdir/configure conftest.file" \
+	&& test "$*" != "X conftest.file $srcdir/configure"; then
+
+	# If neither matched, then we have a broken ls.  This can happen
+	# if, for instance, CONFIG_SHELL is bash and it inherits a
+	# broken ls alias from the environment.  This has actually
+	# happened.  Such a system could not be considered "sane".
+	as_fn_error $? "ls -t appears to fail.  Make sure there is not a broken
+  alias in your environment" "$LINENO" 5
+     fi
+     if test "$2" = conftest.file || test $am_try -eq 2; then
+       break
+     fi
+     # Just in case.
+     sleep 1
+     am_has_slept=yes
+   done
    test "$2" = conftest.file
    )
 then
@@ -2558,6 +2574,16 @@ Check your system clock" "$LINENO" 5
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
+# If we didn't sleep, we still need to ensure time stamps of config.status and
+# generated files are strictly newer.
+am_sleep_pid=
+if grep 'slept: no' conftest.file >/dev/null 2>&1; then
+  ( sleep 1 ) &
+  am_sleep_pid=$!
+fi
+
+rm -f conftest.file
+
 test "$program_prefix" != NONE &&
   program_transform_name="s&^&$program_prefix&;$program_transform_name"
 # Use a double $ so make ignores it.
@@ -2568,27 +2594,22 @@ test "$program_suffix" != NONE &&
 ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
 program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
 
-# expand $ac_aux_dir to an absolute path
-am_aux_dir=`cd $ac_aux_dir && pwd`
+# Expand $ac_aux_dir to an absolute path.
+am_aux_dir=`cd "$ac_aux_dir" && pwd`
 
 if test x"${MISSING+set}" != xset; then
-  case $am_aux_dir in
-  *\ * | *\	*)
-    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
-  *)
-    MISSING="\${SHELL} $am_aux_dir/missing" ;;
-  esac
+  MISSING="\${SHELL} '$am_aux_dir/missing'"
 fi
 # Use eval to expand $SHELL
-if eval "$MISSING --run true"; then
-  am_missing_run="$MISSING --run "
+if eval "$MISSING --is-lightweight"; then
+  am_missing_run="$MISSING "
 else
   am_missing_run=
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5
-$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5
+$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;}
 fi
 
-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'" ;;
@@ -2597,10 +2618,10 @@ if test x"${install_sh}" != xset; then
   esac
 fi
 
-# Installed binaries are usually stripped using `strip' when the user
-# run `make install-strip'.  However `strip' might not be the right
+# Installed binaries are usually stripped using 'strip' when the user
+# run "make install-strip".  However 'strip' might not be the right
 # tool to use in cross-compilation environments, therefore Automake
-# will honor the `STRIP' environment variable to overrule this program.
+# will honor the 'STRIP' environment variable to overrule this program.
 if test "$cross_compiling" != no; then
   if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
@@ -2739,12 +2760,6 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
 $as_echo "$MKDIR_P" >&6; }
 
-mkdir_p="$MKDIR_P"
-case $mkdir_p in
-  [\\/$]* | ?:[\\/]*) ;;
-  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
-esac
-
 for ac_prog in gawk mawk nawk awk
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
@@ -2827,6 +2842,45 @@ else
 fi
 rmdir .tst 2>/dev/null
 
+# Check whether --enable-silent-rules was given.
+if test "${enable_silent_rules+set}" = set; then :
+  enableval=$enable_silent_rules;
+fi
+
+case $enable_silent_rules in # (((
+  yes) AM_DEFAULT_VERBOSITY=0;;
+   no) AM_DEFAULT_VERBOSITY=1;;
+    *) AM_DEFAULT_VERBOSITY=1;;
+esac
+am_make=${MAKE-make}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5
+$as_echo_n "checking whether $am_make supports nested variables... " >&6; }
+if ${am_cv_make_support_nested_variables+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if $as_echo 'TRUE=$(BAR$(V))
+BAR0=false
+BAR1=true
+V=1
+am__doit:
+	@$(TRUE)
+.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then
+  am_cv_make_support_nested_variables=yes
+else
+  am_cv_make_support_nested_variables=no
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5
+$as_echo "$am_cv_make_support_nested_variables" >&6; }
+if test $am_cv_make_support_nested_variables = yes; then
+    AM_V='$(V)'
+  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
+else
+  AM_V=$AM_DEFAULT_VERBOSITY
+  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
+fi
+AM_BACKSLASH='\'
+
 if test "`cd $srcdir && pwd`" != "`pwd`"; then
   # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
   # is not polluted with repeated "-I."
@@ -2849,7 +2903,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='dash'
- VERSION='0.5.10.2'
+ VERSION='0.5.12'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -2877,12 +2931,22 @@ AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
 
 MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
 
-# We need awk for the "check" target.  The system "awk" is bad on
-# some platforms.
+# For better backward compatibility.  To be removed once Automake 1.9.x
+# dies out for good.  For more background, see:
+# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
+# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
+mkdir_p='$(MKDIR_P)'
+
+# We need awk for the "check" target (and possibly the TAP driver).  The
+# system "awk" is bad on some platforms.
 # Always define AMTAR for backward compatibility.  Yes, it's still used
 # in the wild :-(  We should find a proper way to deprecate it ...
 AMTAR='$${TAR-tar}'
 
+
+# We'll loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar  pax cpio none'
+
 am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'
 
 
@@ -2890,10 +2954,93 @@ am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'
 
 
 
+# POSIX will say in a future version that running "rm -f" with no argument
+# is OK; and we want to be able to make that assumption in our Makefile
+# recipes.  So use an aggressive probe to check that the usage we want is
+# actually supported "in the wild" to an acceptable degree.
+# See automake bug#10828.
+# To make any issue more visible, cause the running configure to be aborted
+# by default if the 'rm' program in use doesn't match our expectations; the
+# user can still override this though.
+if rm -f && rm -fr && rm -rf; then : OK; else
+  cat >&2 <<'END'
+Oops!
+
+Your 'rm' program seems unable to run without file operands specified
+on the command line, even when the '-f' option is present.  This is contrary
+to the behaviour of most rm programs out there, and not conforming with
+the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
+
+Please tell bug-automake@gnu.org about your system, including the value
+of your $PATH and any error possibly output before this message.  This
+can help us improve future automake versions.
+
+END
+  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
+    echo 'Configuration will proceed anyway, since you have set the' >&2
+    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
+    echo >&2
+  else
+    cat >&2 <<'END'
+Aborting the configuration process, to ensure you take notice of the issue.
+
+You can download and install GNU coreutils to get an 'rm' implementation
+that behaves properly: <https://www.gnu.org/software/coreutils/>.
+
+If you want to complete the configuration process using your problematic
+'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
+to "yes", and re-run configure.
+
+END
+    as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5
+  fi
+fi
+
+
 
 ac_config_headers="$ac_config_headers config.h"
 
 
+# Check whether --enable-silent-rules was given.
+if test "${enable_silent_rules+set}" = set; then :
+  enableval=$enable_silent_rules;
+fi
+
+case $enable_silent_rules in # (((
+  yes) AM_DEFAULT_VERBOSITY=0;;
+   no) AM_DEFAULT_VERBOSITY=1;;
+    *) AM_DEFAULT_VERBOSITY=0;;
+esac
+am_make=${MAKE-make}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5
+$as_echo_n "checking whether $am_make supports nested variables... " >&6; }
+if ${am_cv_make_support_nested_variables+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if $as_echo 'TRUE=$(BAR$(V))
+BAR0=false
+BAR1=true
+V=1
+am__doit:
+	@$(TRUE)
+.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then
+  am_cv_make_support_nested_variables=yes
+else
+  am_cv_make_support_nested_variables=no
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5
+$as_echo "$am_cv_make_support_nested_variables" >&6; }
+if test $am_cv_make_support_nested_variables = yes; then
+    AM_V='$(V)'
+  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
+else
+  AM_V=$AM_DEFAULT_VERBOSITY
+  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
+fi
+AM_BACKSLASH='\'
+
+
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -3682,49 +3829,108 @@ ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5
+$as_echo_n "checking whether $CC understands -c and -o together... " >&6; }
+if ${am_cv_prog_cc_c_o+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+  # Make sure it works both with $CC and with simple cc.
+  # Following AC_PROG_CC_C_O, we do the test twice because some
+  # compilers refuse to overwrite an existing .o file with -o,
+  # though they will create one.
+  am_cv_prog_cc_c_o=yes
+  for am_i in 1 2; do
+    if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5
+   ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   (exit $ac_status); } \
+         && test -f conftest2.$ac_objext; then
+      : OK
+    else
+      am_cv_prog_cc_c_o=no
+      break
+    fi
+  done
+  rm -f core conftest*
+  unset am_i
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5
+$as_echo "$am_cv_prog_cc_c_o" >&6; }
+if test "$am_cv_prog_cc_c_o" != yes; then
+   # Losing compiler, so override with the script.
+   # FIXME: It is wrong to rewrite CC.
+   # 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__CC in this case,
+   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+   CC="$am_aux_dir/compile $CC"
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
 DEPDIR="${am__leading_dot}deps"
 
 ac_config_commands="$ac_config_commands depfiles"
 
-
-am_make=${MAKE-make}
-cat > confinc << 'END'
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5
+$as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; }
+cat > confinc.mk << 'END'
 am__doit:
-	@echo this is the am__doit target
+	@echo this is the am__doit target >confinc.out
 .PHONY: am__doit
 END
-# If we don't find an include directive, just comment out the code.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5
-$as_echo_n "checking for style of include used by $am_make... " >&6; }
 am__include="#"
 am__quote=
-_am_result=none
-# First try GNU make style include.
-echo "include confinc" > confmf
-# Ignore all kinds of additional output from `make'.
-case `$am_make -s -f confmf 2> /dev/null` in #(
-*the\ am__doit\ target*)
-  am__include=include
-  am__quote=
-  _am_result=GNU
-  ;;
-esac
-# Now try BSD make style include.
-if test "$am__include" = "#"; then
-   echo '.include "confinc"' > confmf
-   case `$am_make -s -f confmf 2> /dev/null` in #(
-   *the\ am__doit\ target*)
-     am__include=.include
-     am__quote="\""
-     _am_result=BSD
+# BSD make does it like this.
+echo '.include "confinc.mk" # ignored' > confmf.BSD
+# Other make implementations (GNU, Solaris 10, AIX) do it like this.
+echo 'include confinc.mk # ignored' > confmf.GNU
+_am_result=no
+for s in GNU BSD; do
+  { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5
+   (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   (exit $ac_status); }
+  case $?:`cat confinc.out 2>/dev/null` in #(
+  '0:this is the am__doit target') :
+    case $s in #(
+  BSD) :
+    am__include='.include' am__quote='"' ;; #(
+  *) :
+    am__include='include' am__quote='' ;;
+esac ;; #(
+  *) :
      ;;
-   esac
-fi
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5
-$as_echo "$_am_result" >&6; }
-rm -f confinc confmf
+esac
+  if test "$am__include" != "#"; then
+    _am_result="yes ($s style)"
+    break
+  fi
+done
+rm -f confinc.* confmf.*
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5
+$as_echo "${_am_result}" >&6; }
 
 # Check whether --enable-dependency-tracking was given.
 if test "${enable_dependency_tracking+set}" = set; then :
@@ -3757,8 +3963,8 @@ else
   # We make a subdir and do the tests there.  Otherwise we can end up
   # making bogus files that we don't know about and never remove.  For
   # instance it was reported that on HP-UX the gcc test will end up
-  # making a dummy file named `D' -- because `-MD' means `put the output
-  # in D'.
+  # making a dummy file named 'D' -- because '-MD' means "put the output
+  # in D".
   rm -rf conftest.dir
   mkdir conftest.dir
   # Copy depcomp to subdir because otherwise we won't find it if we're
@@ -3793,16 +3999,16 @@ else
     : > sub/conftest.c
     for i in 1 2 3 4 5 6; do
       echo '#include "conftst'$i'.h"' >> sub/conftest.c
-      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
-      # Solaris 8's {/usr,}/bin/sh.
-      touch sub/conftst$i.h
+      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
+      # Solaris 10 /bin/sh.
+      echo '/* dummy */' > sub/conftst$i.h
     done
     echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
 
-    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # We check with '-c' and '-o' for the sake of the "dashmstdout"
     # mode.  It turns out that the SunPro C++ compiler does not properly
-    # handle `-M -o', and we need to detect this.  Also, some Intel
-    # versions had trouble with output in subdirs
+    # handle '-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs.
     am__obj=sub/conftest.${OBJEXT-o}
     am__minus_obj="-o $am__obj"
     case $depmode in
@@ -3811,8 +4017,8 @@ else
       test "$am__universal" = false || continue
       ;;
     nosideeffect)
-      # after this tag, mechanisms are not by side-effect, so they'll
-      # only be used when explicitly requested
+      # After this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested.
       if test "x$enable_dependency_tracking" = xyes; then
 	continue
       else
@@ -3820,7 +4026,7 @@ else
       fi
       ;;
     msvc7 | msvc7msys | msvisualcpp | msvcmsys)
-      # This compiler won't grok `-c -o', but also, the minuso test has
+      # This compiler won't grok '-c -o', but also, the minuso test has
       # not run yet.  These depmodes are late enough in the game, and
       # so weak that their functioning should not be impacted.
       am__obj=conftest.${OBJEXT-o}
@@ -4334,50 +4540,6 @@ $as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
 
 
 
-for ac_prog in 'bison -y' byacc
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_YACC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$YACC"; then
-  ac_cv_prog_YACC="$YACC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_YACC="$ac_prog"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-YACC=$ac_cv_prog_YACC
-if test -n "$YACC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $YACC" >&5
-$as_echo "$YACC" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  test -n "$YACC" && break
-done
-test -n "$YACC" || YACC="yacc"
-
-
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for build system compiler" >&5
 $as_echo_n "checking for build system compiler... " >&6; }
 if test "$cross_compiling" = yes; then
@@ -4641,7 +4803,7 @@ $as_echo "#define HAVE_TRADITIONAL_FACCESSAT 1" >>confdefs.h
 
 fi
 
-if test "$enable_fnmatch" = yes; then
+if test "$enable_fnmatch" != no; then
 	use_fnmatch=
 	for ac_func in fnmatch
 do :
@@ -4685,11 +4847,16 @@ fi
 
 fi
 
-ac_fn_c_check_func "$LINENO" "stat64" "ac_cv_func_stat64"
+ac_fn_c_check_decl "$LINENO" "stat64" "ac_cv_have_decl_stat64" "$ac_includes_default"
+if test "x$ac_cv_have_decl_stat64" = xyes; then :
+  ac_fn_c_check_func "$LINENO" "stat64" "ac_cv_func_stat64"
 if test "x$ac_cv_func_stat64" = xyes; then :
 
-else
+fi
+
+fi
 
+if test "$ac_cv_func_stat64" != yes; then
 
 $as_echo "#define fstat64 fstat" >>confdefs.h
 
@@ -4699,6 +4866,22 @@ $as_echo "#define lstat64 lstat" >>confdefs.h
 
 $as_echo "#define stat64 stat" >>confdefs.h
 
+fi
+
+ac_fn_c_check_func "$LINENO" "glob64" "ac_cv_func_glob64"
+if test "x$ac_cv_func_glob64" = xyes; then :
+
+else
+
+
+$as_echo "#define glob64_t glob_t" >>confdefs.h
+
+
+$as_echo "#define glob64 glob" >>confdefs.h
+
+
+$as_echo "#define globfree64 globfree" >>confdefs.h
+
 
 fi
 
@@ -4712,6 +4895,12 @@ else
 $as_echo "#define open64 open" >>confdefs.h
 
 
+$as_echo "#define readdir64 readdir" >>confdefs.h
+
+
+$as_echo "#define dirent64 dirent" >>confdefs.h
+
+
 fi
 
 
@@ -4798,6 +4987,9 @@ else
 fi
 
 
+else
+
+		as_fn_error $? "Can't find libedit." "$LINENO" 5
 fi
 
 fi
@@ -4929,6 +5121,14 @@ LIBOBJS=$ac_libobjs
 LTLIBOBJS=$ac_ltlibobjs
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5
+$as_echo_n "checking that generated files are newer than configure... " >&6; }
+   if test -n "$am_sleep_pid"; then
+     # Hide warnings about reused PIDs.
+     wait $am_sleep_pid 2>/dev/null
+   fi
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5
+$as_echo "done" >&6; }
  if test -n "$EXEEXT"; then
   am__EXEEXT_TRUE=
   am__EXEEXT_FALSE='#'
@@ -5342,7 +5542,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by dash $as_me 0.5.10.2, which was
+This file was extended by dash $as_me 0.5.12, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -5408,7 +5608,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-dash config.status 0.5.10.2
+dash config.status 0.5.12
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
@@ -5527,7 +5727,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 #
 # INIT-COMMANDS
 #
-AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"
 
 _ACEOF
 
@@ -6137,32 +6337,38 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
 
   case $ac_file$ac_mode in
     "depfiles":C) test x"$AMDEP_TRUE" != x"" || {
-  # Autoconf 2.62 quotes --file arguments for eval, but not when files
+  # Older Autoconf quotes --file arguments for eval, but not when files
   # are listed without --file.  Let's play safe and only enable the eval
   # if we detect the quoting.
-  case $CONFIG_FILES in
-  *\'*) eval set x "$CONFIG_FILES" ;;
-  *)   set x $CONFIG_FILES ;;
-  esac
+  # TODO: see whether this extra hack can be removed once we start
+  # requiring Autoconf 2.70 or later.
+  case $CONFIG_FILES in #(
+  *\'*) :
+    eval set x "$CONFIG_FILES" ;; #(
+  *) :
+    set x $CONFIG_FILES ;; #(
+  *) :
+     ;;
+esac
   shift
-  for mf
+  # Used to flag and report bootstrapping failures.
+  am_rc=0
+  for am_mf
   do
     # Strip MF so we end up with the name of the file.
-    mf=`echo "$mf" | sed -e 's/:.*$//'`
-    # Check whether this is an Automake generated Makefile or not.
-    # We used to match only the files named `Makefile.in', but
-    # some people rename them; so instead we look at the file content.
-    # Grep'ing the first line is not enough: some people post-process
-    # each Makefile.in and add a new line on top of each file to say so.
-    # Grep'ing the whole file is not good either: AIX grep has a line
+    am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'`
+    # Check whether this is an Automake generated Makefile which includes
+    # dependency-tracking related rules and includes.
+    # Grep'ing the whole file directly is not great: AIX grep has a line
     # limit of 2048, but all sed's we know have understand at least 4000.
-    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
-      dirpart=`$as_dirname -- "$mf" ||
-$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	 X"$mf" : 'X\(//\)[^/]' \| \
-	 X"$mf" : 'X\(//\)$' \| \
-	 X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$mf" |
+    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
+      || continue
+    am_dirpart=`$as_dirname -- "$am_mf" ||
+$as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$am_mf" : 'X\(//\)[^/]' \| \
+	 X"$am_mf" : 'X\(//\)$' \| \
+	 X"$am_mf" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$am_mf" |
     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
 	    s//\1/
 	    q
@@ -6180,55 +6386,50 @@ $as_echo X"$mf" |
 	    q
 	  }
 	  s/.*/./; q'`
-    else
-      continue
-    fi
-    # Extract the definition of DEPDIR, am__include, and am__quote
-    # from the Makefile without running `make'.
-    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
-    test -z "$DEPDIR" && continue
-    am__include=`sed -n 's/^am__include = //p' < "$mf"`
-    test -z "am__include" && continue
-    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
-    # When using ansi2knr, U may be empty or an underscore; expand it
-    U=`sed -n 's/^U = //p' < "$mf"`
-    # Find all dependency output files, they are included files with
-    # $(DEPDIR) in their names.  We invoke sed twice because it is the
-    # simplest approach to changing $(DEPDIR) to its actual value in the
-    # expansion.
-    for file in `sed -n "
-      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
-	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
-      # Make sure the directory exists.
-      test -f "$dirpart/$file" && continue
-      fdir=`$as_dirname -- "$file" ||
-$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	 X"$file" : 'X\(//\)[^/]' \| \
-	 X"$file" : 'X\(//\)$' \| \
-	 X"$file" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$file" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)[^/].*/{
+    am_filepart=`$as_basename -- "$am_mf" ||
+$as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \
+	 X"$am_mf" : 'X\(//\)$' \| \
+	 X"$am_mf" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$am_mf" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
 	    s//\1/
 	    q
 	  }
-	  /^X\(\/\/\)$/{
+	  /^X\/\(\/\/\)$/{
 	    s//\1/
 	    q
 	  }
-	  /^X\(\/\).*/{
+	  /^X\/\(\/\).*/{
 	    s//\1/
 	    q
 	  }
 	  s/.*/./; q'`
-      as_dir=$dirpart/$fdir; as_fn_mkdir_p
-      # echo "creating $dirpart/$file"
-      echo '# dummy' > "$dirpart/$file"
-    done
+    { echo "$as_me:$LINENO: cd "$am_dirpart" \
+      && sed -e '/# am--include-marker/d' "$am_filepart" \
+        | $MAKE -f - am--depfiles" >&5
+   (cd "$am_dirpart" \
+      && sed -e '/# am--include-marker/d' "$am_filepart" \
+        | $MAKE -f - am--depfiles) >&5 2>&5
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   (exit $ac_status); } || am_rc=$?
   done
+  if test $am_rc -ne 0; then
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "Something went wrong bootstrapping makefile fragments
+    for automatic dependency tracking.  If GNU make was not used, consider
+    re-running the configure script with MAKE=\"gmake\" (or whatever is
+    necessary).  You can also try re-running configure with the
+    '--disable-dependency-tracking' option to at least be able to build
+    the package (albeit without support for automatic dependency tracking).
+See \`config.log' for more details" "$LINENO" 5; }
+  fi
+  { am_dirpart=; unset am_dirpart;}
+  { am_filepart=; unset am_filepart;}
+  { am_mf=; unset am_mf;}
+  { am_rc=; unset am_rc;}
+  rm -f conftest-deps.mk
 }
  ;;
 
diff --git a/configure.ac b/configure.ac
index 4829288e837acc1465c2fd77951da6c45a1132c1..52aa429a86d15780b6261947e254cba58eac3800 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,13 +1,14 @@
-AC_INIT(dash, 0.5.10.2)
+AC_INIT([dash],[0.5.12])
 AM_INIT_AUTOMAKE([foreign subdir-objects])
 AC_CONFIG_SRCDIR([src/main.c])
 
 AC_CONFIG_HEADERS(config.h)
 
+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)])
+
 dnl Checks for programs.
 AC_PROG_CC
-AC_GNU_SOURCE
-AC_PROG_YACC
+AC_USE_SYSTEM_EXTENSIONS
 
 AC_MSG_CHECKING([for build system compiler])
 if test "$cross_compiling" = yes; then
@@ -36,8 +37,8 @@ if test "$enable_static" = "yes"; then
 	export LDFLAGS="-static -Wl,--fatal-warnings"
 fi
 
-AC_ARG_ENABLE(fnmatch, AS_HELP_STRING(--enable-fnmatch, \
-				      [Use fnmatch(3) from libc]))
+AC_ARG_ENABLE(fnmatch, AS_HELP_STRING(--disable-fnmatch, \
+				      [Do not use fnmatch(3) from libc]))
 AC_ARG_ENABLE(glob, AS_HELP_STRING(--enable-glob, [Use glob(3) from libc]))
 
 dnl Checks for libraries.
@@ -121,7 +122,7 @@ if test "$enable_test_workaround" = "yes"; then
 		[Define if your faccessat tells root all files are executable])
 fi
 
-if test "$enable_fnmatch" = yes; then
+if test "$enable_fnmatch" != no; then
 	use_fnmatch=
 	AC_CHECK_FUNCS(fnmatch, use_fnmatch=yes)
 fi
@@ -139,14 +140,27 @@ if test "$ac_cv_func_signal" != yes; then
 fi
 
 dnl Check for stat64 (dietlibc/klibc).
-AC_CHECK_FUNC(stat64,, [
+AC_CHECK_DECL(stat64, AC_CHECK_FUNC(stat64))
+if test "$ac_cv_func_stat64" != yes; then
 	AC_DEFINE(fstat64, fstat, [64-bit operations are the same as 32-bit])
 	AC_DEFINE(lstat64, lstat, [64-bit operations are the same as 32-bit])
 	AC_DEFINE(stat64, stat, [64-bit operations are the same as 32-bit])
+fi
+
+AC_CHECK_FUNC(glob64,, [
+	AC_DEFINE(glob64_t, glob_t, [64-bit operations are the same as 32-bit])
+	AC_DEFINE(glob64, glob, [64-bit operations are the same as 32-bit])
+	AC_DEFINE(globfree64, globfree,
+		  [64-bit operations are the same as 32-bit])
 ])
 
+dnl OS X apparently has stat64 but not open64.
 AC_CHECK_FUNC(open64,, [
 	AC_DEFINE(open64, open, [64-bit operations are the same as 32-bit])
+	AC_DEFINE(readdir64, readdir,
+		  [64-bit operations are the same as 32-bit])
+	AC_DEFINE(dirent64, dirent,
+		  [64-bit operations are the same as 32-bit])
 ])
 
 dnl Check if struct stat has st_mtim.
@@ -169,7 +183,8 @@ if test "$with_libedit" = "yes"; then
 	AC_CHECK_LIB(edit, history_init, [
 		AC_CHECK_HEADER([histedit.h], [use_libedit="yes"],
 				AC_MSG_ERROR(
-					[Can't find required header files.]))])
+					[Can't find required header files.]))], [
+		AC_MSG_ERROR([Can't find libedit.])])
 fi
 if test "$use_libedit" != "yes"; then
 	AC_DEFINE([SMALL], 1, [Define if you build with -DSMALL])
diff --git a/debian/apertis/copyright b/debian/apertis/copyright
index 260edbe141679a4e18df386caf5cacebb55d4cb9..ab32f0cc9c2f5a023e133b391c83bfed6a86459b 100644
--- a/debian/apertis/copyright
+++ b/debian/apertis/copyright
@@ -1,16 +1,25 @@
 Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
 
 Files: *
-Copyright: 1992, 1996, 1997, 1999, 2000, 2002-2012, Free Software Foundation, Inc.
-License: GPL-2+
+Copyright: 1997-2005, Herbert Xu <herbert@gondor.apana.org.au>.
+ 1997, Christos Zoulas.
+ 1989-1994, The Regents of the University of California.
+License: BSD-3-clause and/or GPL-2+
+
+Files: INSTALL
+Copyright: 1994-1996, 1999-2002, 2004-2016, Free Software
+License: FSFAP
 
 Files: Makefile.in
-Copyright: 1994-2011, Free Software
+ aclocal.m4
+Copyright: 1994-2020, Free Software Foundation, Inc.
 License: FSFULLR
 
-Files: aclocal.m4
-Copyright: 1996-2011, Free Software Foundation
-License: FSFULLR
+Files: compile
+ depcomp
+ missing
+Copyright: 1996-2020, Free Software Foundation, Inc.
+License: GPL-2+ with Autoconf-data exception
 
 Files: configure
  configure.ac
@@ -19,72 +28,27 @@ License: FSFUL
 
 Files: debian/*
 Copyright: 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, Herbert Xu <herbert@debian.org>
-2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2014, Gerrit Pape <pape@smarden.org>
-2009, Luk Claes <luk@debian.org>
-2010, 2011, Jonathan Nieder <jrnieder@gmail.com>
-2010, Adam D. Barratt <adam@adam-barratt.org.uk>
-2010, Christian Perrier <bubulle@debian.org>
-2013, Michael Gilbert <mgilbert@debian.org>
-2016, Helmut Grohne <helmut@subdivi.de>
-2016, Mattia Rizzolo <mattia@debian.org>
-2016, Niels Thykier <niels@thykier.net>
-2017, Adam Borowski <kilobyte@angband.pl>
-2017, Ximin Luo <infinity0@debian.org>
-2018, 2019, Andrej Shadura <andrewsh@debian.org>
-License: BSD-3-clause
-
-Files: debian/po/bg.po
- debian/po/eu.po
- debian/po/templates.pot
- debian/po/tr.po
-Copyright: YEAR THE PACKAGES COPYRIGHT HOLDER
-License: BSD-3-clause
-
-Files: debian/po/da.po
-Copyright: 2010, Dash & nedenstående oversættere.
-License: BSD-3-clause
-
-Files: debian/po/de.po
-Copyright: Helge Kreutzmann <debian@helgefjell.de>, 2006-2009.
-License: BSD-3-clause
-
-Files: debian/po/es.po
-Copyright: 2008, 2009, Software in the Public Interest
-License: BSD-3-clause
-
-Files: debian/po/fr.po
-Copyright: 2009, Debian French l10n team <debian-l10n-french@lists.debian.org>
-License: BSD-3-clause
-
-Files: debian/po/nl.po
-Copyright: 2008-2010, THE PACKAGES COPYRIGHT HOLDER
-License: BSD-3-clause
-
-Files: debian/po/pt.po
-Copyright: 2007, the package copyright holder
-License: BSD-3-clause
-
-Files: debian/po/pt_BR.po
- debian/po/sk.po
-Copyright: 2008, 2011, THE dashS COPYRIGHT HOLDER
-License: BSD-3-clause
-
-Files: debian/po/ro.po
- debian/po/sr.po
-Copyright: 2008, 2011, This file is distributed under the same license as the dash package.
-License: BSD-3-clause
-
-Files: debian/po/sv.po
-Copyright: 2009, Martin Bagge <brother@bsnet.se>
-License: BSD-3-clause
-
-Files: debian/po/vi.po
-Copyright: 2010, Free Software Foundation, Inc.
-License: BSD-3-clause
+ 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2014, Gerrit Pape <pape@smarden.org>
+ 2009, Luk Claes <luk@debian.org>
+ 2010, 2011, Jonathan Nieder <jrnieder@gmail.com>
+ 2010, Adam D. Barratt <adam@adam-barratt.org.uk>
+ 2010, Christian Perrier <bubulle@debian.org>
+ 2013, Michael Gilbert <mgilbert@debian.org>
+ 2016, Helmut Grohne <helmut@subdivi.de>
+ 2016, Mattia Rizzolo <mattia@debian.org>
+ 2016, Niels Thykier <niels@thykier.net>
+ 2017, Adam Borowski <kilobyte@angband.pl>
+ 2017, Ximin Luo <infinity0@debian.org>
+ 2018, 2019, Andrej Shadura <andrewsh@debian.org>
+License: BSD-3-clause
+
+Files: debian/tests/mmdebstrap
+Copyright: 2022, Johannes Schauer Marin Rodrigues <josch@debian.org>
+License: Expat
 
 Files: install-sh
 Copyright: 1994, X Consortium
-License: Expat
+License: X11
 
 Files: src/*
 Copyright: 1997-2005, 2007, Herbert Xu <herbert@gondor.apana.org.au>.
@@ -92,7 +56,7 @@ Copyright: 1997-2005, 2007, Herbert Xu <herbert@gondor.apana.org.au>.
 License: BSD-3-clause
 
 Files: src/Makefile.in
-Copyright: 1994-2011, Free Software
+Copyright: 1994-2020, Free Software Foundation, Inc.
 License: FSFULLR
 
 Files: src/arith_yylex.c
@@ -114,11 +78,10 @@ Copyright: 1997-2005, Herbert Xu <herbert@gondor.apana.org.au>.
 License: BSD-3-clause
 
 Files: src/mksignames.c
-Copyright: 1992, 1996, 1997, 1999, 2000, 2002-2012, Free Software Foundation, Inc.
+Copyright: 1992, Free Software Foundation, Inc.
 License: GPL-2+
 
 Files: src/system.c
  src/system.h
 Copyright: 2004, Herbert Xu <herbert@gondor.apana.org.au>.
 License: BSD-3-clause
-
diff --git a/debian/changelog b/debian/changelog
index ae21f2735340e3a99d040d410458286bed03f1aa..8f142351921ec7ed497f45173b8eca373b249e78 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,223 @@
+dash (0.5.12-2+apertis3+apertis0) downstream; urgency=medium
+
+  * Sync from apertis/v2025pre.
+
+ -- Apertis CI <devel@lists.apertis.org>  Thu, 17 Oct 2024 14:07:23 +0000
+
+dash (0.5.12-2+apertis3) apertis; urgency=medium
+
+  [ Apertis CI ]
+  * Revert "Enable bootstrap test"
+
+ -- Walter Lozano <walter.lozano@collabora.com>  Thu, 15 Feb 2024 10:50:44 -0300
+
+dash (0.5.12-2+apertis2) apertis; urgency=medium
+
+  [ Apertis CI ]
+  * Enable bootstrap test
+
+ -- Walter Lozano <walter.lozano@collabora.com>  Fri, 21 Jul 2023 16:09:13 -0300
+
+dash (0.5.12-2+apertis1) apertis; urgency=medium
+
+  * debian/apertis/copyright: Drop trailing empty line to make CI happy
+
+ -- Emanuele Aina <emanuele.aina@collabora.com>  Fri, 14 Jul 2023 23:34:58 +0000
+
+dash (0.5.12-2+apertis0) apertis; urgency=medium
+
+  * Sync from debian/bookworm.
+
+ -- Apertis CI <devel@lists.apertis.org>  Fri, 24 Mar 2023 21:52:42 +0000
+
+dash (0.5.12-2) unstable; urgency=medium
+
+  * Fix the changelog entry.
+
+ -- Andrej Shadura <andrewsh@debian.org>  Thu, 05 Jan 2023 14:20:48 +0100
+
+dash (0.5.12-1) unstable; urgency=medium
+
+  * New upstream release (Closes: #1017531, #1024635).
+  * Refresh patches.
+  * Apply upstream patches for hash, ulimit and manpages
+    (Closes: #558607, #819829, #975325, #975326).
+
+ -- Andrej Shadura <andrewsh@debian.org>  Thu, 05 Jan 2023 14:06:02 +0100
+
+dash (0.5.11+git20210903+057cd650a4ed-9) unstable; urgency=medium
+
+  [ Johannes Schauer Marin Rodrigues ]
+  * debian/tests/mmdebstrap: create chroot with the same apt sources as
+    autopkgtest (Closes: #1016554).
+
+ -- Andrej Shadura <andrewsh@debian.org>  Thu, 01 Sep 2022 16:11:54 +0200
+
+dash (0.5.11+git20210903+057cd650a4ed-8) unstable; urgency=medium
+
+  * Remove the remnants of the debconf shell question
+    (Closes: #1007093, #1007241).
+
+ -- Andrej Shadura <andrewsh@debian.org>  Mon, 14 Mar 2022 15:11:00 +0100
+
+dash (0.5.11+git20210903+057cd650a4ed-7) unstable; urgency=medium
+
+  [ Johannes Schauer Marin Rodrigues ]
+  * debian/tests/mmdebstrap: fix running on debci and add more comments.
+
+ -- Andrej Shadura <andrewsh@debian.org>  Sat, 05 Mar 2022 11:32:15 +0100
+
+dash (0.5.11+git20210903+057cd650a4ed-6) unstable; urgency=medium
+
+  [ Johannes Schauer Marin Rodrigues ]
+  * debian/dash.postinst: fix missing ].
+  * Add autopkgtest installing dash into a fresh chroot.
+
+ -- Andrej Shadura <andrewsh@debian.org>  Fri, 04 Mar 2022 22:19:03 +0100
+
+dash (0.5.11+git20210903+057cd650a4ed-5) unstable; urgency=medium
+
+  [ Johannes Schauer Marin Rodrigues ]
+  * dpkg-realpath has a /bin/sh shebang and can thus not be used when /bin/sh is temporarily not available.
+  * debian/dash.postinst: restore DPKG_ROOT support.
+  * debian/dash.postinst: Move check if dfile exists further up.
+  * Closes: #1006771
+
+ -- Andrej Shadura <andrewsh@debian.org>  Fri, 04 Mar 2022 18:34:16 +0100
+
+dash (0.5.11+git20210903+057cd650a4ed-4) unstable; urgency=medium
+
+  [ Andrej Shadura ]
+  * Stop using debconf to select the default /bin/sh.
+  * Don’t use external fnmatch/glob.
+  * Apply upstream patch to check executable bit when searching path
+    (Closes: #874264)
+  * Drop po files from debian/copyright.
+  * Sort debian/copyright.
+  * Update copyright years.
+
+  [ Johannes Schauer Marin Rodrigues ]
+  * Replace add-shell/remove-shell with declarative shells.d trigger
+    (Closes: #1004172)
+  * Allow downgrades to dash versions before it started using update-shells.
+  * debian/dash.postinst: reproducible symlink mtime using symlink target
+    mtime.
+
+ -- Andrej Shadura <andrewsh@debian.org>  Thu, 03 Mar 2022 17:40:59 +0100
+
+dash (0.5.11+git20210903+057cd650a4ed-3) unstable; urgency=medium
+
+  * Revert "Enable libedit".
+  * Revert "Re-enable LINENO support".
+
+ -- Andrej Shadura <andrewsh@debian.org>  Wed, 03 Nov 2021 11:51:39 +0100
+
+dash (0.5.11+git20210903+057cd650a4ed-2) unstable; urgency=medium
+
+  * Re-enable LINENO support (Closes: #842242)/
+  * Enable libedit (Closes: #524839, #561663).
+
+ -- Andrej Shadura <andrewsh@debian.org>  Tue, 02 Nov 2021 12:58:31 +0100
+
+dash (0.5.11+git20210903+057cd650a4ed-1) unstable; urgency=medium
+
+  * New upstream snapshot.
+
+ -- Andrej Shadura <andrewsh@debian.org>  Fri, 29 Oct 2021 09:21:09 +0200
+
+dash (0.5.11+git20210120+802ebd4-2) unstable; urgency=medium
+
+  [ Johannes Schauer Marin Rodrigues ]
+  * Support DPKG_ROOT.
+
+ -- Andrej Shadura <andrewsh@debian.org>  Sat, 23 Oct 2021 11:44:50 +0200
+
+dash (0.5.11+git20210120+802ebd4-1) unstable; urgency=medium
+
+  * New upstream snapshot.
+  * Drop a patch applied upstream.
+
+ -- Andrej Shadura <andrewsh@debian.org>  Thu, 04 Mar 2021 10:22:32 +0100
+
+dash (0.5.11+git20200708+dd9ef66-5apertis1) apertis; urgency=medium
+
+  [ Walter Lozano ]
+  * Refresh the automatically detected licensing information
+
+ -- Walter Lozano <walter.lozano@collabora.com>  Fri, 30 Sep 2022 11:38:29 -0300
+
+dash (0.5.11+git20200708+dd9ef66-5apertis0) apertis; urgency=medium
+
+  * Sync from Debian debian/bullseye.
+
+ -- Apertis CI <devel@lists.apertis.org>  Thu, 11 Mar 2021 08:28:16 +0000
+
+dash (0.5.11+git20200708+dd9ef66-5) unstable; urgency=medium
+
+  * Actually set PATH_MAX for Hurd.
+
+ -- Andrej Shadura <andrewsh@debian.org>  Thu, 10 Dec 2020 14:23:19 +0100
+
+dash (0.5.11+git20200708+dd9ef66-4) unstable; urgency=medium
+
+  * Define PATH_MAX=4096 on Hurd.
+
+ -- Andrej Shadura <andrewsh@debian.org>  Thu, 10 Dec 2020 10:55:18 +0100
+
+dash (0.5.11+git20200708+dd9ef66-3) unstable; urgency=medium
+
+  [ Johannes 'josch' Schauer ]
+  * Don’t rely on /usr/share/man/man1/ existing (Closes: #974825).
+
+  [ Andrej Shadura ]
+  * Disable libc glob support (Closes: #974900, #976685).
+  * Apply upstream patch:
+    - jobs: Only block in waitcmd on first run (Closes: #974705, #975010).
+
+ -- Andrej Shadura <andrewsh@debian.org>  Thu, 10 Dec 2020 10:07:56 +0100
+
+dash (0.5.11+git20200708+dd9ef66-2) unstable; urgency=medium
+
+  * Upload to unstable.
+
+ -- Andrej Shadura <andrewsh@debian.org>  Thu, 12 Nov 2020 08:58:00 +0100
+
+dash (0.5.11+git20200708+dd9ef66-1) experimental; urgency=medium
+
+  * New upstream snapshot
+    (Closes: #541544, #541642, #692611, #930805).
+  * Drop patches applied upstream.
+
+ -- Andrej Shadura <andrewsh@debian.org>  Sat, 08 Aug 2020 15:13:49 +0200
+
+dash (0.5.10.2-7) unstable; urgency=medium
+
+  * Provide machine-readable copyright file.
+  * Use debhelper-compat instead of debian/compat.
+  * Use dh 12.
+  * Drop nostrip handling, it is build into dh_strip.
+  * Wrap and sort Build-Depends.
+  * Change the privmode long option name to privileged to match bash.
+
+ -- Andrej Shadura <andrewsh@debian.org>  Mon, 30 Mar 2020 11:45:13 +0200
+
+dash (0.5.10.2-6) unstable; urgency=medium
+
+  * Apply patch from Chris Lamb:
+    - dash: Fix stack overflow from infinite recursion in script
+      (Closes: #579815)
+  * Apply upstream patches:
+    - shell: Don't include config.h for native helpers
+    - system: Disable glibc warning on sigsetmask
+  * Apply patches proposed upstream:
+    - options: Do not set commandname in procargs
+    - histedit: Fix infinite loop when using 'fc -s'
+      (Closes: #928072)
+  * Update the CI pipeline (thanks to Iñaki Malerba).
+  * Enable hardening for helpers.
+
+ -- Andrej Shadura <andrewsh@debian.org>  Thu, 18 Jul 2019 15:15:27 -0300
+
 dash (0.5.10.2-5co2) apertis; urgency=medium
 
   [ Andrej Shadura ]
@@ -2075,4 +2295,3 @@ ash (0.3-1) unstable; urgency=low
   * Initial Release.
 
  -- Herbert Xu <herbert@debian.org>  Thu, 19 Jun 1997 19:29:16 +1000
-
diff --git a/debian/compat b/debian/compat
deleted file mode 100644
index f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2..0000000000000000000000000000000000000000
--- a/debian/compat
+++ /dev/null
@@ -1 +0,0 @@
-10
diff --git a/debian/control b/debian/control
index 4b6f7d767ceae3b1e6251c72845d67256726f33c..58fd8c5e003c3ea0498e44eebce59190e2e3e4af 100644
--- a/debian/control
+++ b/debian/control
@@ -3,7 +3,10 @@ Section: shells
 Priority: optional
 Maintainer: Andrej Shadura <andrewsh@debian.org>
 Uploaders: Gerrit Pape <pape@smarden.org>
-Build-Depends: po-debconf, dpkg-dev (>= 1.16.1), debhelper (>= 10)
+Build-Depends:
+ debhelper-compat (= 12),
+ dpkg-dev (>= 1.16.1),
+ po-debconf
 Standards-Version: 4.2.1
 Homepage: http://gondor.apana.org.au/~herbert/dash/
 Vcs-Git: https://salsa.debian.org/debian/dash.git
@@ -16,7 +19,7 @@ Essential: yes
 Priority: required
 Pre-Depends: ${shlibs:Depends}
 Depends:
- debianutils (>= 2.15),
+ debianutils (>= 5.6-0.1),
  dpkg (>= 1.19.1),
  ${misc:Depends},
 Description: POSIX-compliant shell
diff --git a/debian/copyright b/debian/copyright
index cf5e4a5f41d90df2be510b9aa78a649d58e35af6..8177a8c2ac9932944dee817525e8b7a12e088201 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -1,70 +1,83 @@
-This package was debianized by Mark W. Eichin eichin@kitten.gen.ma.us on
-Mon, 24 Feb 1997 16:00:16 -0500.
-
-This package was re-ported from NetBSD and debianized by
-Herbert Xu herbert@debian.org on Thu, 19 Jun 1997 19:29:16 +1000.
-
-This package was adopted by Gerrit Pape <pape@smarden.org> on
-Fri, 28 May 2004 18:38:18 +0000.
-
-It was downloaded from http://gondor.apana.org.au/~herbert/dash/files/
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: dash
+Upstream-Contact: dash@vger.kernel.org
+Source: http://gondor.apana.org.au/~herbert/dash/
 
+Files: *
 Copyright:
-
-Copyright (c) 1989-1994
-	The Regents of the University of California.  All rights reserved.
-Copyright (c) 1997 Christos Zoulas.  All rights reserved.
-Copyright (c) 1997-2005
-	Herbert Xu <herbert@gondor.apana.org.au>.  All rights reserved.
-
-This code is derived from software contributed to Berkeley by Kenneth Almquist.
-
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
-   notice, this list of conditions and the following disclaimer in the
-   documentation and/or other materials provided with the distribution.
-3. Neither the name 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.
-
-THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
-mksignames.c:
-
-This file is not directly linked with dash.  However, its output is.
-
-Copyright (C) 1992 Free Software Foundation, Inc.
-
-This file is part of GNU Bash, the Bourne Again SHell.
-
-Bash 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.
-
-Bash 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 with
-your Debian GNU/Linux system, in /usr/share/common-licenses/GPL, or with the
-Debian GNU/Linux hello source package as the file COPYING.  If not,
-write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
-Boston, MA 02111 USA.
-
+ 1989-1994 The Regents of the University of California.  All rights reserved.
+ 1997 Christos Zoulas.  All rights reserved.
+ 1997-2021 Herbert Xu <herbert@gondor.apana.org.au>.  All rights reserved.
+Comment:
+ This code is derived from software contributed to Berkeley by Kenneth Almquist.
+License: BSD-3-Clause
+
+Files: src/bltin/test.c
+Copyright: Erik Baalbergen, Eric Gisin, Arnold Robbins, J.T. Conklin
+License: public-domain
+ This program is in the Public Domain.
+
+Files: src/mksignames.c
+Copyright: 1992, 1996, 1997, 1999, 2000, 2002-2012, Free Software Foundation, Inc.
+Comment: This file is not directly linked with dash.  However, its output is.
+License: GPL-2+
+
+Files: debian/*
+Copyright:
+ 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, Herbert Xu <herbert@debian.org>
+ 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2014, Gerrit Pape <pape@smarden.org>
+ 2009, Luk Claes <luk@debian.org>
+ 2010, 2011, Jonathan Nieder <jrnieder@gmail.com>
+ 2010, Adam D. Barratt <adam@adam-barratt.org.uk>
+ 2010, Christian Perrier <bubulle@debian.org>
+ 2013, Michael Gilbert <mgilbert@debian.org>
+ 2016, Helmut Grohne <helmut@subdivi.de>
+ 2016, Mattia Rizzolo <mattia@debian.org>
+ 2016, Niels Thykier <niels@thykier.net>
+ 2017, Adam Borowski <kilobyte@angband.pl>
+ 2017, Ximin Luo <infinity0@debian.org>
+ 2018—2021, Andrej Shadura <andrewsh@debian.org>
+License: BSD-3-clause
+
+License: BSD-3-clause
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+ 3. Neither the name 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.
+ .
+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+
+License: GPL-2+
+ 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, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ .
+ On Debian systems, the complete text of the GNU General Public License
+ version 2 can be found in ‘/usr/share/common-licenses/GPL-2’.
diff --git a/debian/dash.config b/debian/dash.config
deleted file mode 100644
index b000f2d965dfff7d4e8fb245eb109bee0969b849..0000000000000000000000000000000000000000
--- a/debian/dash.config
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/bin/sh
-#
-# debconf script for the Debian GNU/Linux ash package
-#
-# $Id: dash.config,v 1.1 2002/09/14 06:17:50 herbert Exp $
-
-set -e
-
-. /usr/share/debconf/confmodule
-
-db_version 2.0
-
-if [ "$1" = configure ] && [ -z "$2" ]; then
-	set +e
-	db_fget ash/sh seen
-	err=$?
-	set -e
-
-	case $err in
-	0)
-		if [ "$RET" = true ]; then
-			db_fset dash/sh seen true
-			db_get ash/sh
-			db_set dash/sh "$RET"
-			exit
-		fi
-		;;
-	10)
-		# ash/sh does not exist
-		;;
-	*)
-		echo "db_fget exited with $err" >&2
-		exit $err
-		;;
-	esac
-fi
-
-# if "configuring and for the first time and bash is already installed"
-if [ "$1" = configure ] && [ -z "$2" ] && dpkg-query -W bash >/dev/null; then
-	# bash is pulling in dash
-	db_input high dash/sh || true
-else
-	db_input low dash/sh || true
-fi
-db_go
diff --git a/debian/dash.install b/debian/dash.install
index 12aaac20ec94af62bf1701148e6c5c5bd6539060..f000b8104ca97a750ff98f68038e4c38a724ea0a 100644
--- a/debian/dash.install
+++ b/debian/dash.install
@@ -1,2 +1,3 @@
 /usr/bin/dash  /bin
 /usr/share
+debian/shells.d/dash /usr/share/debianutils/shells.d
diff --git a/debian/dash.postinst b/debian/dash.postinst
index 958b6edfbdbb26c6128c921bf184c6248c44fc2e..e2f0b327982f9d94b5a54f16fcaa3a3d34f34a43 100644
--- a/debian/dash.postinst
+++ b/debian/dash.postinst
@@ -3,8 +3,9 @@ set -e
 
 # $1: dfile, $2: link target, $3: distrib
 replace_with_link() {
-	dfile=$1; ltarget=$2; distrib=$3
-	temp=$dfile.tmp
+	dfile="$1"; ltarget=$2; distrib="$DPKG_ROOT$3"
+	temp="$dfile.tmp"
+	[ -e "$DPKG_ROOT$dfile" ] || [ -L "$DPKG_ROOT$dfile" ] && dfile_exists=yes
 	# Safely create a symlink to $ltarget at $dfile, first
 	# making a backup of $dfile (the file being diverted)
 	# in $distrib (if specified).
@@ -12,12 +13,19 @@ replace_with_link() {
 	# The cp / ln -s / mv dance avoids having to live without
 	# $dfile (think: /bin/sh) for even a moment, so applications
 	# running in parallel can continue without trouble.
-	# See dash.preinst for details.
-	if [ -n "$distrib" ] && [ -e "$dfile" ]; then
-		cp -dp "$dfile" "$distrib"
+	if [ -n "$distrib" ] && [ -e "$DPKG_ROOT$dfile" ]; then
+		cp -dp "$DPKG_ROOT$dfile" "$distrib"
+	fi
+	ln -sf "$ltarget" "$DPKG_ROOT$temp"
+	mv -f "$DPKG_ROOT$temp" "$DPKG_ROOT$dfile"
+	# Since man-db stores symlink modification times in its index.db we
+	# need to set a reproducible mtime. We only do that for new symlinks
+	# (if dfile doesn't exist yet) to avoid changing to a lower mtime
+	# which breaks backup tools.
+	targetrealpath="$DPKG_ROOT$(dpkg-realpath "$dfile")"
+	if [ -e "$targetrealpath" ] && [ "$dfile_exists" != "yes" ]; then
+		touch --no-dereference --reference="$targetrealpath" "$DPKG_ROOT$dfile"
 	fi
-	ln -sf "$ltarget" "$temp"
-	mv -f "$temp" "$dfile"
 }
 
 claim_binsh() {
@@ -47,8 +55,8 @@ claim_binsh() {
 	dpkg-divert --package bash --no-rename --remove $dfile
 	dpkg-divert --package dash --no-rename --divert $distrib --add $dfile
 	# remove the old equivalent of $distrib, if it existed.
-	if [ -n "$truename" ]; then
-	       rm -f "$truename"
+	if [ -n "$DPKG_ROOT$truename" ]; then
+	       rm -f "$DPKG_ROOT$truename"
 	fi
 	replace_with_link $dfile $ltarget $distrib
 }
@@ -104,41 +112,17 @@ initial_binsh_setup() {
 	fi
 }
 
-add_shell() {
-	if ! type add-shell > /dev/null 2>&1; then
-		return
-	fi
-
-	add-shell /bin/dash
-}
-
-debconf=
-if [ -f /usr/share/debconf/confmodule ]; then
-	. /usr/share/debconf/confmodule
-	debconf=yes
-fi
-
 if [ "$1" = configure ] && [ -z "$2" ]; then
 	initial_binsh_setup /bin/sh dash '' /bin/ash
 	initial_binsh_setup /usr/share/man/man1/sh.1.gz dash.1.gz \
 		/usr/share/man/man1/sh.distrib.1.gz \
 		/usr/share/man/man1/ash.1.gz
-	add_shell
-elif [ "$1" = configure ] && dpkg --compare-versions "$2" lt 0.4.18; then
-	add_shell
 fi
 
-if [ $debconf ]; then
-	db_get dash/sh
-	if [ "$RET" = true ]; then
-		claim_binsh /bin/sh dash
-		claim_binsh /usr/share/man/man1/sh.1.gz dash.1.gz \
-			/usr/share/man/man1/sh.distrib.1.gz
-	else
-		unclaim_binsh /bin/sh dash
-		unclaim_binsh /usr/share/man/man1/sh.1.gz dash.1.gz \
-			/usr/share/man/man1/sh.distrib.1.gz
-	fi
+claim_binsh /bin/sh dash
+if [ -d "$DPKG_ROOT/usr/share/man/man1/" ]; then
+    claim_binsh /usr/share/man/man1/sh.1.gz dash.1.gz \
+        /usr/share/man/man1/sh.distrib.1.gz
 fi
 
 #DEBHELPER#
diff --git a/debian/dash.postrm b/debian/dash.postrm
new file mode 100644
index 0000000000000000000000000000000000000000..60c7d762abd4748ac7ca224678001669a388a64f
--- /dev/null
+++ b/debian/dash.postrm
@@ -0,0 +1,33 @@
+#!/bin/sh
+#
+# This is to allow downgrades to version 0.5.11+git20210903+057cd650a4ed-3 and
+# earlier which do not use the update-shells trigger of debianutils to manage
+# /etc/shells.
+#
+# update-shells will be called at the end of the downgrade because a trigger of
+# debianutils on the removal of /usr/share/debianutils/shells.d/dash will be
+# activated when downgrading to a version of dash that doesn't ship that file.
+# But a non-existing /usr/share/debianutils/shells.d/dash tells update-shells
+# to remove dash from /etc/shells.
+#
+# To prevent this from happening, remove /usr/share/debianutils/shells.d/dash
+# which will be removed by the downgrade anyways, then run update-shells which
+# will remove dash from /etc/shells and then add it again by running add-shell.
+# Subsequent calls to update-shells in the debianutils trigger will now not
+# remove dash from /etc/shells anymore because the update-shells call in this
+# script updated /var/lib/shells.state with the information that it doesn't
+# manage dash via update-shells anymore.
+
+set -e
+
+if [ "$1" = upgrade ] \
+	&& dpkg --compare-versions "$2" le 0.5.11+git20210903+057cd650a4ed-3 \
+	&& [ -e /usr/share/debianutils/shells.d/dash ] \
+	&& [ -x "$(command -v update-shells 2>/dev/null)" ] \
+	&& [ -x "$(command -v add-shell 2>/dev/null)" ]; then
+	rm /usr/share/debianutils/shells.d/dash
+	update-shells
+	add-shell /bin/dash
+fi
+
+#DEBHELPER#
diff --git a/debian/dash.prerm b/debian/dash.prerm
index 7afa7cb55c6ee41922e381d5a90f9fdebfe38d48..6d4030472751844fccae4992ad22327b13fe3dae 100644
--- a/debian/dash.prerm
+++ b/debian/dash.prerm
@@ -13,21 +13,9 @@ remove_divert() {
 	fi
 }
 
-remove_shell() {
-	if ! type remove-shell > /dev/null 2>&1; then
-		return
-	fi
-
-	remove-shell /bin/dash
-}
-
 if [ "$1" = remove ] || [ "$1" = deconfigure ]; then
 	remove_divert /bin/sh
 	remove_divert /usr/share/man/man1/sh.1.gz
 fi
 
-if [ "$1" = remove ]; then
-	remove_shell
-fi
-
 #DEBHELPER#
diff --git a/debian/dash.templates.in b/debian/dash.templates.in
deleted file mode 100644
index dfaf25db8174be1b1e8c9bac0e670734a76ac422..0000000000000000000000000000000000000000
--- a/debian/dash.templates.in
+++ /dev/null
@@ -1,23 +0,0 @@
-# These templates have been reviewed by the debian-l10n-english
-# team
-#
-# If modifications/additions/rewording are needed, please ask
-# debian-l10n-english@lists.debian.org for advice.
-#
-# Even minor modifications require translation updates and such
-# changes should be coordinated with translators and reviewers.
-Template: dash/sh
-Type: boolean
-Default: true
-_Description: Use dash as the default system shell (/bin/sh)?
- The system shell is the default command interpreter for shell scripts.
- .
- Using dash as the system shell will improve the system's overall
- performance. It does not alter the shell presented to interactive
- users.
-# _Description: Install dash as /bin/sh?
-#  The default /bin/sh shell on Debian and Debian-based systems is bash.
-#  .
-#  However, since the default shell is required to be POSIX-compliant,
-#  any shell that conforms to POSIX, such as dash, can serve as /bin/sh.
-#  You may wish to do this because dash is faster and smaller than bash.
diff --git a/debian/fill.copyright.blanks.yml b/debian/fill.copyright.blanks.yml
new file mode 100644
index 0000000000000000000000000000000000000000..47d7e3beb6f224c6c3f6f9cefb9867e089668b3e
--- /dev/null
+++ b/debian/fill.copyright.blanks.yml
@@ -0,0 +1,18 @@
+"debian/":
+  "copyright": |2-
+
+     1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, Herbert Xu <herbert@debian.org>
+     2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2014, Gerrit Pape <pape@smarden.org>
+     2009, Luk Claes <luk@debian.org>
+     2010, 2011, Jonathan Nieder <jrnieder@gmail.com>
+     2010, Adam D. Barratt <adam@adam-barratt.org.uk>
+     2010, Christian Perrier <bubulle@debian.org>
+     2013, Michael Gilbert <mgilbert@debian.org>
+     2016, Helmut Grohne <helmut@subdivi.de>
+     2016, Mattia Rizzolo <mattia@debian.org>
+     2016, Niels Thykier <niels@thykier.net>
+     2017, Adam Borowski <kilobyte@angband.pl>
+     2017, Ximin Luo <infinity0@debian.org>
+     2018—2021, Andrej Shadura <andrewsh@debian.org>
+  "license": |-
+    BSD-3-clause
diff --git a/debian/gbp.conf b/debian/gbp.conf
index d6b9ab0dc195f9e1de9c11310acf8fd49eec2c70..e3460bde0a1559c2c2c5f683bcef8b4e728a691f 100644
--- a/debian/gbp.conf
+++ b/debian/gbp.conf
@@ -1,3 +1,4 @@
 [DEFAULT]
-debian-branch=debian/master
+debian-branch=debian/unstable
 upstream-branch=upstream/latest
+upstream-vcs-tag=v%(version)s
diff --git a/debian/gitlab-ci.yml b/debian/gitlab-ci.yml
index a48660a9b3f7b3576d86268f6a8e4e9da1452a9a..892f3cd2be815819a02e598dd22372bcc9af7f6c 100644
--- a/debian/gitlab-ci.yml
+++ b/debian/gitlab-ci.yml
@@ -1,17 +1,3 @@
-include: https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml
-
-build:
-  extends: .build-unstable
-
-reprotest:
-  extends: .test-reprotest
-
-lintian:
-  extends: .test-lintian
-
-autopkgtest:
-  extends: .test-autopkgtest
-
-piuparts:
-  extends: .test-piuparts
-
+include:
+ - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml
+ - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml
diff --git a/debian/patches/0001-SHELL-print-n-upon-EOF-CTRL-D-when-run-interactively.diff b/debian/patches/0001-SHELL-print-n-upon-EOF-CTRL-D-when-run-interactively.diff
deleted file mode 100644
index 9fade1673f0b3a15f01b54aa64369e62720e5035..0000000000000000000000000000000000000000
--- a/debian/patches/0001-SHELL-print-n-upon-EOF-CTRL-D-when-run-interactively.diff
+++ /dev/null
@@ -1,53 +0,0 @@
-Applied-Upstream: 0.5.10.2+, 413c6dc
-From 413c6dcc3ca3891825ae8239251140882d7c6c6c Mon Sep 17 00:00:00 2001
-From: Gerrit Pape <pape@smarden.org>
-Date: Fri, 7 Sep 2018 10:34:14 +0200
-Subject: [PATCH] main: Print \n upon EOF (CTRL-D) when run interactively
-
-Exiting dash via a ^D instead of with "exit" causes dash to forget to
-print a newline.
-
-    sh-3.1$ sh
-    sh-3.1$ ^D
-    sh-3.1$ dash
-    $ sh-3.1$
-
-It is more neat and tidy to send a newline similarly to what bash does,
-so it doesn't make the next prompt of the parent shell look ugly.
-
-Suggested by jidanni.
-
-Signed-off-by: Gerrit Pape <pape@smarden.org>
-Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
-[reworded the patch description]
-Signed-off-by: Andrej Shadura <andrew.shadura@collabora.co.uk>
-Bug-Debian: http://bugs.debian.org/476422
-Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
----
- src/main.c | 9 ++++++++-
- 1 file changed, 8 insertions(+), 1 deletion(-)
-
-diff --git a/src/main.c b/src/main.c
-index e8e4256..6d53e00 100644
---- a/src/main.c
-+++ b/src/main.c
-@@ -221,8 +221,15 @@ cmdloop(int top)
- 			if (!top || numeof >= 50)
- 				break;
- 			if (!stoppedjobs()) {
--				if (!Iflag)
-+				if (!Iflag) {
-+					if (iflag) {
-+						out2c('\n');
-+#ifdef FLUSHERR
-+						flushout(out2);
-+#endif
-+					}
- 					break;
-+				}
- 				out2str("\nUse \"exit\" to leave shell.\n");
- 			}
- 			numeof++;
--- 
-2.19.1
-
diff --git a/debian/patches/0004-SHELL-Disable-sh-c-command-sh-c-exec-command-optimiza.diff b/debian/patches/0004-SHELL-Disable-sh-c-command-sh-c-exec-command-optimiza.diff
index 39210de4aef207ca43f840a14cc9216fcc04deae..bc992a6b73014abb9c20fa51737e2b1babccfc1f 100644
--- a/debian/patches/0004-SHELL-Disable-sh-c-command-sh-c-exec-command-optimiza.diff
+++ b/debian/patches/0004-SHELL-Disable-sh-c-command-sh-c-exec-command-optimiza.diff
@@ -1,8 +1,6 @@
-From dc3e43ef32309782d0ef5ce72d0b0c89efd1c70f Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?St=C3=A9phane=20Glondu?= <glondu@debian.org>
+From: Stéphane Glondu <glondu@debian.org>
 Date: Sun, 25 Sep 2011 19:28:27 +0200
-Subject: [PATCH 4/6] [SHELL] Disable sh -c "command" -> sh -c "exec command"
- optimization
+Subject: shell: Disable sh -c "command" -> sh -c "exec command" optimization
 
 Bugs #642706 (bin-prot FTBFS) and #642835 (sexplib310 FTBFS) can be
 fixed by reverting the patch submitted at [1]. I don't understand why.
@@ -20,10 +18,10 @@ Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/src/main.c b/src/main.c
-index efd7da8..e1418a9 100644
+index 5c49fdc..70df726 100644
 --- a/src/main.c
 +++ b/src/main.c
-@@ -167,7 +167,7 @@ state2:
+@@ -169,7 +169,7 @@ state2:
  state3:
  	state = 4;
  	if (minusc)
@@ -32,6 +30,3 @@ index efd7da8..e1418a9 100644
  
  	if (sflag || minusc == NULL) {
  state4:	/* XXX ??? - why isn't this before the "if" statement */
--- 
-2.1.0
-
diff --git a/debian/patches/0005-jobs-Replace-some-uses-of-fmtstr-with-stpcpy-stpncpy.patch b/debian/patches/0005-jobs-Replace-some-uses-of-fmtstr-with-stpcpy-stpncpy.patch
deleted file mode 100644
index 2af20c0a38f460040468ac3dc5c8030a6281aeed..0000000000000000000000000000000000000000
--- a/debian/patches/0005-jobs-Replace-some-uses-of-fmtstr-with-stpcpy-stpncpy.patch
+++ /dev/null
@@ -1,65 +0,0 @@
-Applied-Upstream: 0.5.10.2+, 15a60c2
-From 15a60c2357f772ccf953772859e8f9fc124442e2 Mon Sep 17 00:00:00 2001
-From: Herbert Xu <herbert@gondor.apana.org.au>
-Date: Sat, 19 May 2018 02:39:45 +0800
-Subject: [PATCH] jobs: Replace some uses of fmtstr with stpcpy/stpncpy
-
-Some uses of fmtstr, particularly the ones without a format string,
-can be replaced with stpcpy or stpncpy.  This patch does that so
-we don't have to introduce unnecessary format strings in order to
-silence compiler warnings.
-
-Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
----
- src/jobs.c | 15 +++++++--------
- 1 file changed, 7 insertions(+), 8 deletions(-)
-
-diff --git a/src/jobs.c b/src/jobs.c
-index 79a087e..601232d 100644
---- a/src/jobs.c
-+++ b/src/jobs.c
-@@ -407,12 +407,11 @@ out:
- #endif
- 
- STATIC int
--sprint_status(char *s, int status, int sigonly)
-+sprint_status(char *os, int status, int sigonly)
- {
--	int col;
-+	char *s = os;
- 	int st;
- 
--	col = 0;
- 	st = WEXITSTATUS(status);
- 	if (!WIFEXITED(status)) {
- #if JOBS
-@@ -428,21 +427,21 @@ sprint_status(char *s, int status, int sigonly)
- 				goto out;
- #endif
- 		}
--		col = fmtstr(s, 32, strsignal(st));
-+		s = stpncpy(s, strsignal(st), 32);
- #ifdef WCOREDUMP
- 		if (WCOREDUMP(status)) {
--			col += fmtstr(s + col, 16, " (core dumped)");
-+			s = stpcpy(s, " (core dumped)");
- 		}
- #endif
- 	} else if (!sigonly) {
- 		if (st)
--			col = fmtstr(s, 16, "Done(%d)", st);
-+			s += fmtstr(s, 16, "Done(%d)", st);
- 		else
--			col = fmtstr(s, 16, "Done");
-+			s = stpcpy(s, "Done");
- 	}
- 
- out:
--	return col;
-+	return s - os;
- }
- 
- static void
--- 
-2.17.0
-
diff --git a/debian/patches/0006-EVAL-Report-I-O-error-on-stdout.diff b/debian/patches/0006-EVAL-Report-I-O-error-on-stdout.diff
deleted file mode 100644
index 0e9ca21f021ff3f209b9ccc7059dbf0507d1efe1..0000000000000000000000000000000000000000
--- a/debian/patches/0006-EVAL-Report-I-O-error-on-stdout.diff
+++ /dev/null
@@ -1,51 +0,0 @@
-Applied-Upstream: 0.5.10.2+, 8e43729
-From 8e43729547b57ab15842dab23215336a353b2ded Mon Sep 17 00:00:00 2001
-From: Gerrit Pape <pape@smarden.org>
-Date: Fri, 7 Sep 2018 10:34:13 +0200
-Subject: [PATCH] eval: Report I/O error on stdout
-
-ENOSPC as a result of an echo builting failing gives no diagnostic.
-Just as other shells, dash sets $? to 1, but aside from terminating
-the script, this does not inform the user what the problem is:
-
-zsh:
-    % echo foo > /dev/full
-    echo: write error: no space left on device
-
-bash:
-    $ echo foo > /dev/full
-    bash: echo: write error: No space left on device
-
-dash:
-    $ echo foo > /dev/full
-    [nothing]
-
-Print an error to stderr like the other shells.
-
-Suggested by Roger Leigh.
-
-Signed-off-by: Gerrit Pape <pape@smarden.org>
-[reworded the patch description with information from the bug]
-Signed-off-by: Andrej Shadura <andrew.shadura@collabora.co.uk>
-Bug-Debian: http://bugs.debian.org/690473
-Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
----
- src/eval.c | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/src/eval.c b/src/eval.c
-index 6185db4..546ee1b 100644
---- a/src/eval.c
-+++ b/src/eval.c
-@@ -952,6 +952,8 @@ evalbltin(const struct builtincmd *cmd, int argc, char **argv, int flags)
- 	else
- 		status = (*cmd->builtin)(argc, argv);
- 	flushall();
-+	if (outerr(out1))
-+		sh_warnx("%s: I/O error", commandname);
- 	status |= outerr(out1);
- 	exitstatus = status;
- cmddone:
--- 
-2.19.1
-
diff --git a/debian/patches/0007-Don-t-execute-binary-files-if-execve-returned-ENOEXE.diff b/debian/patches/0007-Don-t-execute-binary-files-if-execve-returned-ENOEXE.diff
index dbedff9abd7f08e7a56e9f0482175862fae97a51..5bd59b64e41c6cdb18677cef328d9e2967a6d30c 100644
--- a/debian/patches/0007-Don-t-execute-binary-files-if-execve-returned-ENOEXE.diff
+++ b/debian/patches/0007-Don-t-execute-binary-files-if-execve-returned-ENOEXE.diff
@@ -1,7 +1,6 @@
-From 2eea480dc2e1628f3b3a520c4f229d649f4ef77d Mon Sep 17 00:00:00 2001
 From: Adam Borowski <kilobyte@angband.pl>
 Date: Tue, 24 Jan 2017 05:11:38 +0100
-Subject: [PATCH 1/2] Don't execute binary files if execve() returned ENOEXEC.
+Subject: Don't execute binary files if execve() returned ENOEXEC
 
 Both "dash -c foo" and "./foo" are supposed to be able to run hashbang-less
 scripts, but attempts to execute common binary files tend to be nasty:
@@ -21,7 +20,7 @@ Signed-off-by: Adam Borowski <kilobyte@angband.pl>
  1 file changed, 32 insertions(+)
 
 diff --git a/src/exec.c b/src/exec.c
-index ec0eadd..19ae752 100644
+index 87354d4..b0c1d0f 100644
 --- a/src/exec.c
 +++ b/src/exec.c
 @@ -148,6 +148,36 @@ shellexec(char **argv, const char *path, int idx)
@@ -70,6 +69,3 @@ index ec0eadd..19ae752 100644
  		*argv-- = cmd;
  		*argv = cmd = path_bshell;
  		goto repeat;
--- 
-2.11.0
-
diff --git a/debian/patches/0008-Support-e-in-echo-and-printf-builtins.diff b/debian/patches/0008-Support-e-in-echo-and-printf-builtins.diff
index ebd58cb2a979c06bade2553c01ad32c64ca300b0..621dafee8a55f35d7b1650fa5c56801932ff5731 100644
--- a/debian/patches/0008-Support-e-in-echo-and-printf-builtins.diff
+++ b/debian/patches/0008-Support-e-in-echo-and-printf-builtins.diff
@@ -1,7 +1,6 @@
-From 95e564ee5fddf0d36e510572daca927f9e139411 Mon Sep 17 00:00:00 2001
 From: Adam Borowski <kilobyte@angband.pl>
 Date: Sat, 28 Jun 2014 06:29:56 +0200
-Subject: [PATCH 2/2] Support \e in "echo" and "printf" builtins.
+Subject: Support \e in "echo" and "printf" builtins
 
 Signed-off-by: Adam Borowski <kilobyte@angband.pl>
 ---
@@ -10,7 +9,7 @@ Signed-off-by: Adam Borowski <kilobyte@angband.pl>
  2 files changed, 5 insertions(+)
 
 diff --git a/src/bltin/printf.c b/src/bltin/printf.c
-index a626cee..c34bf66 100644
+index 7785735..9b878da 100644
 --- a/src/bltin/printf.c
 +++ b/src/bltin/printf.c
 @@ -340,6 +340,7 @@ conv_escape(char *str, int *conv_ch)
@@ -22,10 +21,10 @@ index a626cee..c34bf66 100644
  	case 'n':	value = '\n';	break;	/* newline */
  	case 'r':	value = '\r';	break;	/* carriage-return */
 diff --git a/src/dash.1 b/src/dash.1
-index 8b8026d..c6f83a5 100644
+index ff02237..169d5df 100644
 --- a/src/dash.1
 +++ b/src/dash.1
-@@ -1201,6 +1201,8 @@ Subsequent output is suppressed.  This is normally used at the end of the
+@@ -1204,6 +1204,8 @@ This is normally used at the end of the
  last argument to suppress the trailing newline that
  .Ic echo
  would otherwise output.
@@ -34,7 +33,7 @@ index 8b8026d..c6f83a5 100644
  .It Li \ef
  Output a form feed.
  .It Li \en
-@@ -1570,6 +1572,8 @@ The characters and their meanings are as follows:
+@@ -1574,6 +1576,8 @@ The characters and their meanings are as follows:
  Write a \*[Lt]bell\*[Gt] character.
  .It Cm \eb
  Write a \*[Lt]backspace\*[Gt] character.
@@ -43,6 +42,3 @@ index 8b8026d..c6f83a5 100644
  .It Cm \ef
  Write a \*[Lt]form-feed\*[Gt] character.
  .It Cm \en
--- 
-2.11.0
-
diff --git a/debian/patches/0009-dash-Fix-stack-overflow-from-infinite-recursion-in-s.patch b/debian/patches/0009-dash-Fix-stack-overflow-from-infinite-recursion-in-s.patch
new file mode 100644
index 0000000000000000000000000000000000000000..94aee21f3274dea3bd9830ba3bdb4861d019d356
--- /dev/null
+++ b/debian/patches/0009-dash-Fix-stack-overflow-from-infinite-recursion-in-s.patch
@@ -0,0 +1,51 @@
+From: Chris Lamb <lamby@debian.org>
+Date: Thu, 15 Feb 2018 20:28:25 +0000
+Subject: dash: Fix stack overflow from infinite recursion in script
+
+Bug-Debian: https://bugs.debian.org/579815
+Signed-off-by: Chris Lamb <lamby@debian.org>
+Signed-off-by: Andrej Shadura <andrew.shadura@collabora.co.uk>
+---
+ src/eval.c | 8 +++++++-
+ src/eval.h | 2 ++
+ 2 files changed, 9 insertions(+), 1 deletion(-)
+
+diff --git a/src/eval.c b/src/eval.c
+index fa43b68..fc291ba 100644
+--- a/src/eval.c
++++ b/src/eval.c
+@@ -71,6 +71,7 @@ int evalskip;			/* set if we are skipping commands */
+ STATIC int skipcount;		/* number of levels to skip */
+ MKINIT int loopnest;		/* current loop nesting level */
+ static int funcline;		/* starting line number of current function, or 0 if not in a function */
++static int evalcount;		/* number of nested evalfun calls */
+ 
+ 
+ char *commandname;
+@@ -914,7 +915,12 @@ raise:
+ 		break;
+ 
+ 	case CMDFUNCTION:
+-		if (evalfun(cmdentry.u.func, argc, argv, flags))
++		if (evalcount++ >= MAX_RECURSION)
++			sh_error("Maximum function recursion depth (%d) reached",
++			         MAX_RECURSION);
++		int i = evalfun(cmdentry.u.func, argc, argv, flags);
++		evalcount--;
++		if (i)
+ 			goto raise;
+ 		break;
+ 	}
+diff --git a/src/eval.h b/src/eval.h
+index 63e7d86..38dffbd 100644
+--- a/src/eval.h
++++ b/src/eval.h
+@@ -51,6 +51,8 @@ struct backcmd {		/* result of evalbackcmd */
+ #define EV_EXIT 01		/* exit after evaluating tree */
+ #define EV_TESTED 02		/* exit status is checked; ignore -e flag */
+ 
++#define MAX_RECURSION 1000	/* maximum recursion level */
++
+ int evalstring(char *, int);
+ union node;	/* BLETCH for ansi C */
+ int evaltree(union node *, int);
diff --git a/debian/patches/0010-Hardcode-mktemp.diff b/debian/patches/0010-Hardcode-mktemp.diff
deleted file mode 100644
index e356e4f197a71b3b9dfd10074626107b491db6bd..0000000000000000000000000000000000000000
--- a/debian/patches/0010-Hardcode-mktemp.diff
+++ /dev/null
@@ -1,31 +0,0 @@
-Applied-Upstream: 0.5.10.2+, ad07264
-From ad072645af04c31300c84d2840fcf1a8d48588ec Mon Sep 17 00:00:00 2001
-From: Andrej Shadura <andrew.shadura@collabora.co.uk>
-Date: Fri, 7 Sep 2018 10:34:11 +0200
-Subject: [PATCH] builtin: Default to mktemp, not tempfile
-
-Don't use tempfile, as it currently runs tempnam(), which is insecure
-and fails under pseudo(1).
-
-Signed-off-by: Andrej Shadura <andrew.shadura@collabora.co.uk>
-Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
----
- src/mkbuiltins | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/mkbuiltins b/src/mkbuiltins
-index b4d6f4e..f1f2593 100644
---- a/src/mkbuiltins
-+++ b/src/mkbuiltins
-@@ -35,7 +35,7 @@
- #
- #	@(#)mkbuiltins	8.2 (Berkeley) 5/4/95
- 
--tempfile=tempfile
-+tempfile=mktemp
- if ! type tempfile > /dev/null 2>&1 && ! type mktemp > /dev/null 2>&1; then
- 	_my_tempfile()
- 	{
--- 
-2.19.1
-
diff --git a/debian/patches/0010-exec-Check-executable-bit-when-searching-path.patch b/debian/patches/0010-exec-Check-executable-bit-when-searching-path.patch
new file mode 100644
index 0000000000000000000000000000000000000000..889f9b1340098efcf7e343537ba07d4625e5de27
--- /dev/null
+++ b/debian/patches/0010-exec-Check-executable-bit-when-searching-path.patch
@@ -0,0 +1,116 @@
+From: Herbert Xu <herbert@gondor.apana.org.au>
+Date: Wed, 10 Nov 2021 07:53:03 +0100
+Subject: exec: Check executable bit when searching path
+
+This is inherited from NetBSD.  There is even a commented-out
+block of code that tried to fix this.
+
+Anyway, we now have faccessat so we can simply use it.
+
+Reported-by: Norman Ramsey <nr@cs.tufts.edu>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+
+Bug-Debian: https://bugs.debian.org/874264
+---
+ src/bltin/test.c | 10 +++-------
+ src/exec.c       | 20 +++++++-------------
+ src/exec.h       |  5 +++++
+ 3 files changed, 15 insertions(+), 20 deletions(-)
+
+diff --git a/src/bltin/test.c b/src/bltin/test.c
+index c7fc479..fd8a43b 100644
+--- a/src/bltin/test.c
++++ b/src/bltin/test.c
+@@ -18,6 +18,7 @@
+ #include <unistd.h>
+ #include <stdarg.h>
+ #include "bltin.h"
++#include "../exec.h"
+ 
+ /* test(1) accepts the following grammar:
+ 	oexpr	::= aexpr | aexpr "-o" oexpr ;
+@@ -148,11 +149,6 @@ static int isoperand(char **);
+ static int newerf(const char *, const char *);
+ static int olderf(const char *, const char *);
+ static int equalf(const char *, const char *);
+-#ifdef HAVE_FACCESSAT
+-static int test_file_access(const char *, int);
+-#else
+-static int test_access(const struct stat64 *, int);
+-#endif
+ 
+ #ifdef HAVE_FACCESSAT
+ # ifdef HAVE_TRADITIONAL_FACCESSAT
+@@ -527,7 +523,7 @@ static int has_exec_bit_set(const char *path)
+ 	return st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH);
+ }
+ 
+-static int test_file_access(const char *path, int mode)
++int test_file_access(const char *path, int mode)
+ {
+ 	if (faccessat_confused_about_superuser() &&
+ 	    mode == X_OK && geteuid() == 0 && !has_exec_bit_set(path))
+@@ -657,7 +653,7 @@ static int test_file_access(const char *path, int mode)
+  * (euid==uid&&egid==gid), but uses st_mode for '-x' iff running as root.
+  * i.e. it does strictly conform to 1003.1-2001 (and presumably 1003.2b).
+  */
+-static int test_access(const struct stat64 *sp, int stmode)
++int test_access(const struct stat64 *sp, int stmode)
+ {
+ 	gid_t *groups;
+ 	register int n;
+diff --git a/src/exec.c b/src/exec.c
+index b0c1d0f..93424b2 100644
+--- a/src/exec.c
++++ b/src/exec.c
+@@ -490,20 +490,14 @@ loop:
+ 			stunalloc(fullname);
+ 			goto success;
+ 		}
+-#ifdef notdef
+-		/* XXX this code stops root executing stuff, and is buggy
+-		   if you need a group from the group list. */
+-		if (statb.st_uid == geteuid()) {
+-			if ((statb.st_mode & 0100) == 0)
+-				goto loop;
+-		} else if (statb.st_gid == getegid()) {
+-			if ((statb.st_mode & 010) == 0)
+-				goto loop;
+-		} else {
+-			if ((statb.st_mode & 01) == 0)
+-				goto loop;
+-		}
++		if ((statb.st_mode & 0111) != 0111 &&
++#ifdef HAVE_FACCESSAT
++		    !test_file_access(fullname, X_OK)
++#else
++		    !test_access(&statb, X_OK)
+ #endif
++		   )
++			continue;
+ 		TRACE(("searchexec \"%s\" returns \"%s\"\n", name, fullname));
+ 		if (!updatetbl) {
+ 			entry->cmdtype = CMDNORMAL;
+diff --git a/src/exec.h b/src/exec.h
+index 423b07e..8707d36 100644
+--- a/src/exec.h
++++ b/src/exec.h
+@@ -62,6 +62,8 @@ union node;
+ 
+ extern const char *pathopt;	/* set by padvance */
+ 
++struct stat64;
++
+ void shellexec(char **, const char *, int)
+     __attribute__((__noreturn__));
+ int padvance_magic(const char **path, const char *name, int magic);
+@@ -78,6 +80,9 @@ void unsetfunc(const char *);
+ int typecmd(int, char **);
+ int commandcmd(int, char **);
+ 
++int test_file_access(const char *path, int mode);
++int test_access(const struct stat64 *sp, int stmode);
++
+ static inline int padvance(const char **path, const char *name)
+ {
+ 	return padvance_magic(path, name, 1);
diff --git a/debian/patches/0011-Avoid-crash-when-redirecting-to-file-descriptor-in-e.diff b/debian/patches/0011-Avoid-crash-when-redirecting-to-file-descriptor-in-e.diff
deleted file mode 100644
index 01f707d06507da55c40a09475cd91b4f1f63059f..0000000000000000000000000000000000000000
--- a/debian/patches/0011-Avoid-crash-when-redirecting-to-file-descriptor-in-e.diff
+++ /dev/null
@@ -1,34 +0,0 @@
-From 98c530c23d9a7f86c996b028cadc2f685ec1b339 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Bernhard=20=C3=9Cbelacker?= <bernhardu@mailbox.org>
-Date: Sat, 6 May 2017 10:40:37 +0200
-Subject: Avoid crash when redirecting to file descriptor in expredir.
-
-https://bugs.debian.org/861354
----
- src/eval.c | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/src/eval.c b/src/eval.c
-index 3c47b59..61440e1 100644
---- a/src/eval.c
-+++ b/src/eval.c
-@@ -493,6 +493,7 @@ expredir(union node *n)
- 
- 	for (redir = n ; redir ; redir = redir->nfile.next) {
- 		struct arglist fn;
-+		fn.list = NULL;
- 		fn.lastp = &fn.list;
- 		switch (redir->type) {
- 		case NFROMTO:
-@@ -507,6 +508,8 @@ expredir(union node *n)
- 		case NTOFD:
- 			if (redir->ndup.vname) {
- 				expandarg(redir->ndup.vname, &fn, EXP_FULL | EXP_TILDE);
-+				if (!fn.list)
-+					sh_error("ambiguous redirect");
- 				fixredir(redir, fn.list->text, 1);
- 			}
- 			break;
--- 
-2.11.0
-
diff --git a/debian/patches/0012-enable-large-file-support-when-available.patch b/debian/patches/0012-enable-large-file-support-when-available.patch
index 3eafef49df16f2f62e09f89d74f5c50d72b1ac4f..a8e319971b98e8bd2f3643c8ab0fab58cf9d71cb 100644
--- a/debian/patches/0012-enable-large-file-support-when-available.patch
+++ b/debian/patches/0012-enable-large-file-support-when-available.patch
@@ -1,25 +1,21 @@
-From f0471fb96dfe5e8768a72984a76a3c585d4d477b Mon Sep 17 00:00:00 2001
 From: You-Sheng Yang <vicamo@gmail.com>
 Date: Wed, 12 Dec 2018 14:02:40 +0800
-Subject: [PATCH] enable large file support when available
+Subject: enable large file support when available
 
 ---
  configure.ac | 2 ++
  1 file changed, 2 insertions(+)
 
 diff --git a/configure.ac b/configure.ac
-index 4829288..205b2eb 100644
+index 52aa429..648f3d4 100644
 --- a/configure.ac
 +++ b/configure.ac
-@@ -9,6 +9,8 @@ AC_PROG_CC
- AC_GNU_SOURCE
- AC_PROG_YACC
+@@ -10,6 +10,8 @@ dnl Checks for programs.
+ AC_PROG_CC
+ AC_USE_SYSTEM_EXTENSIONS
  
 +AC_SYS_LARGEFILE
 +
  AC_MSG_CHECKING([for build system compiler])
  if test "$cross_compiling" = yes; then
  	CC_FOR_BUILD=${CC_FOR_BUILD-cc}
--- 
-2.20.0.rc2
-
diff --git a/debian/patches/0013-enable-hardening-for-helpers.patch b/debian/patches/0013-enable-hardening-for-helpers.patch
new file mode 100644
index 0000000000000000000000000000000000000000..10d2c6c90f70fd67924d641fa36a4835dcbc92a4
--- /dev/null
+++ b/debian/patches/0013-enable-hardening-for-helpers.patch
@@ -0,0 +1,20 @@
+From: Andrej Shadura <andrewsh@debian.org>
+Date: Thu, 18 Jul 2019 13:00:01 -0300
+Subject: Add $(CPPFLAGS), $(CFLAGS) and $(LDFLAGS) to $(COMPILE_FOR_BUILD) so that helpers are built with hardening
+
+---
+ src/Makefile.am | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/Makefile.am b/src/Makefile.am
+index 1732465..2c437bb 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -12,6 +12,7 @@ AM_CPPFLAGS_FOR_BUILD = $(COMMON_CPPFLAGS)
+ COMPILE_FOR_BUILD = \
+ 	$(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(AM_CPPFLAGS_FOR_BUILD) \
+ 	$(CPPFLAGS_FOR_BUILD) \
++	$(CPPFLAGS) $(CFLAGS) $(LDFLAGS) \
+ 	$(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) 
+ 
+ bin_PROGRAMS = dash
diff --git a/debian/patches/0017-histedit-Fix-infinite-loop-when-using-fc--s.patch b/debian/patches/0017-histedit-Fix-infinite-loop-when-using-fc--s.patch
new file mode 100644
index 0000000000000000000000000000000000000000..5365ac781a2604d673f1193a700d257151595360
--- /dev/null
+++ b/debian/patches/0017-histedit-Fix-infinite-loop-when-using-fc--s.patch
@@ -0,0 +1,26 @@
+From: 宇砂ワシ <usawashi16@yahoo.co.jp>
+Date: Sat, 27 Apr 2019 22:46:34 +0900
+Subject: histedit: Fix infinite loop when using 'fc -s'
+
+When compiling with libedit, he.num may somehow overrun last, causing
+an infinite loop when using fc -s.
+This mild change to the check plugs it.
+
+Bug-Debian: https://bugs.debian.org/928072
+---
+ src/histedit.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/histedit.c b/src/histedit.c
+index f5c90ab..aaac1c2 100644
+--- a/src/histedit.c
++++ b/src/histedit.c
+@@ -388,7 +388,7 @@ histcmd(int argc, char **argv)
+ 		 * At end?  (if we were to lose last, we'd sure be
+ 		 * messed up).
+ 		 */
+-		if (he.num == last)
++		if (he.num >= last)
+ 			break;
+ 	}
+ 	if (editor) {
diff --git a/debian/patches/0018-builtin-Don-t-early-exit-when-first-hash-r-is-found.patch b/debian/patches/0018-builtin-Don-t-early-exit-when-first-hash-r-is-found.patch
new file mode 100644
index 0000000000000000000000000000000000000000..442ddd2e4cc95d8f4c2644ce498c248a660f8726
--- /dev/null
+++ b/debian/patches/0018-builtin-Don-t-early-exit-when-first-hash-r-is-found.patch
@@ -0,0 +1,69 @@
+From: наб <nabijaczleweli@nabijaczleweli.xyz>
+Date: Wed, 14 Dec 2022 03:51:13 +0100
+Subject: builtin: Don't early-exit when first hash -r is found
+
+This fixes incorrectly-accepted "hash -rv" being equivalent to hash -r
+(well, hash -r[literally anything] being equivalent to hash -r)
+
+Also remove -v from the manual, it doesn't appear to have ever existed
+
+Bug-Debian: https://bugs.debian.org/819829
+---
+ src/dash.1 | 6 ++----
+ src/exec.c | 8 +++++++-
+ 2 files changed, 9 insertions(+), 5 deletions(-)
+
+diff --git a/src/dash.1 b/src/dash.1
+index 169d5df..4bb348a 100644
+--- a/src/dash.1
++++ b/src/dash.1
+@@ -1443,7 +1443,8 @@ cmd \-a \-c arg file file
+ cmd \-carg -a file file
+ cmd \-a \-carg \-\- file file
+ .Ed
+-.It hash Fl rv Ar command ...
++.It hash Op Ar command ...
++.It hash Fl r
+ The shell maintains a hash table which remembers the
+ locations of commands.
+ With no arguments whatsoever,
+@@ -1459,9 +1460,6 @@ With arguments, the
+ .Ic hash
+ command removes the specified commands from the hash table (unless
+ they are functions) and then locates them.
+-With the
+-.Fl v
+-option, hash prints the locations of the commands as it finds them.
+ The
+ .Fl r
+ option causes the hash command to delete all the entries in the hash table
+diff --git a/src/exec.c b/src/exec.c
+index 93424b2..67fa529 100644
+--- a/src/exec.c
++++ b/src/exec.c
+@@ -36,6 +36,7 @@
+ #include <sys/stat.h>
+ #include <unistd.h>
+ #include <fcntl.h>
++#include <stdbool.h>
+ #include <stdlib.h>
+ #ifdef HAVE_PATHS_H
+ #include <paths.h>
+@@ -303,11 +304,16 @@ hashcmd(int argc, char **argv)
+ 	int c;
+ 	struct cmdentry entry;
+ 	char *name;
++	bool clear;
+ 
+-	while ((c = nextopt("r")) != '\0') {
++	clear = false;
++	while ((c = nextopt("r")) != '\0')
++		clear = true;
++	if(clear) {
+ 		clearcmdentry();
+ 		return 0;
+ 	}
++
+ 	if (*argptr == NULL) {
+ 		for (pp = cmdtable ; pp < &cmdtable[CMDTABLESIZE] ; pp++) {
+ 			for (cmdp = *pp ; cmdp ; cmdp = cmdp->next) {
diff --git a/debian/patches/0019-builtin-Actually-accept-ulimit-r.patch b/debian/patches/0019-builtin-Actually-accept-ulimit-r.patch
new file mode 100644
index 0000000000000000000000000000000000000000..9fca99d6d7b0091317b8abb7c4d420c4e5e66b37
--- /dev/null
+++ b/debian/patches/0019-builtin-Actually-accept-ulimit-r.patch
@@ -0,0 +1,28 @@
+From: Vincent Lefevre <vincent@vinc17.net>
+Date: Fri, 16 Dec 2022 18:20:19 +0100
+Subject: builtin: Actually accept ulimit -r
+
+The original commit that added it supposes this works, but it only adds
+it to the ulimit -a listing and the manual, but doesn't allow it as an
+option.
+
+Fixes: 46abc8c6d8a5 ("[BUILTIN] Add support for ulimit -r")
+Bug-Debian: https://bugs.debian.org/975326
+---
+ src/miscbltin.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/src/miscbltin.c b/src/miscbltin.c
+index 5ccbbcb..e553f9e 100644
+--- a/src/miscbltin.c
++++ b/src/miscbltin.c
+@@ -440,6 +440,9 @@ ulimitcmd(int argc, char **argv)
+ #endif
+ #ifdef RLIMIT_LOCKS
+ 			       "w"
++#endif
++#ifdef RLIMIT_RTPRIO
++			       "r"
+ #endif
+ 	)) != '\0')
+ 		switch (optc) {
diff --git a/debian/patches/0020-Update-manpages.patch b/debian/patches/0020-Update-manpages.patch
new file mode 100644
index 0000000000000000000000000000000000000000..c5fe788cea1841bfa1b152d6f2f65669902e648c
--- /dev/null
+++ b/debian/patches/0020-Update-manpages.patch
@@ -0,0 +1,253 @@
+From: наб <nabijaczleweli@nabijaczleweli.xyz>
+Date: Wed, 14 Dec 2022 17:52:04 +0100
+Subject: Update manpages
+
+man: Fix getopts documentation
+
+  The explicit arguments were missing, also exchange expr subst for
+  arithmetic and fix the spacing around Bell Labs
+
+man: Document jobs builtin
+
+man: Note chdir being the same builtin as cd
+
+man: Document kill builtin
+
+The manual now contains all built-ins
+
+man: Reword to avoid confusion v/v printf Ar argument[s]/arguments
+
+  The current wording says that given
+    printf a b c d
+  a is the format, c and d are processed as noted,
+  but b is unspecified
+
+man: printf 'X, X is a byte under dash
+
+  Multiple issues:
+    * the encoding is not always ASCII
+    * what ASCII code is assigned to я
+    * dash isn't internationalised
+      (this is nonconformant but out of scope),
+      and uses the next /byte/; in a UTF-8 locale:
+        $ printf %d\\n \'Ä…
+        196
+        $ printf %d\\n \'я
+        196
+      this is in contrast to POSIX (and bash), which says:
+        > If the leading character is a single-quote or double-quote,
+        > the value shall be the numeric value in the underlying codeset
+        > of the character following the single-quote or double-quote.
+      (i.e. mbrtowc(&val, argv[n], ...))
+
+man: Document false built-in
+
+  Only true was documented, add false just below it
+  (out of order, but so is true, and the grouping makes much more sense).
+
+man: Document ulimit -w
+
+Bug-Debian: https://bugs.debian.org/558607
+Bug-Debian: https://bugs.debian.org/850202
+---
+ src/dash.1    | 97 +++++++++++++++++++++++++++++++++++++++++++----------------
+ src/options.c |  2 +-
+ 2 files changed, 72 insertions(+), 27 deletions(-)
+
+diff --git a/src/dash.1 b/src/dash.1
+index 4bb348a..39cec2f 100644
+--- a/src/dash.1
++++ b/src/dash.1
+@@ -1095,6 +1095,8 @@ etc).
+ .It :
+ .It true
+ A null command that returns a 0 (true) exit value.
++.It false
++A null command that returns a 1 (false) exit value.
+ .It \&. file
+ The commands in the specified file are read and executed by the shell.
+ .It alias Op Ar name Ns Op Ar "=string ..."
+@@ -1143,8 +1145,8 @@ Do not execute the command but
+ search for the command and print the absolute pathname
+ of utilities, the name for builtins or the expansion of aliases.
+ .El
+-.It cd Ar -
+-.It Xo cd Op Fl LP
++.It cd|chdir Ar -
++.It Xo cd|chdir Op Fl LP
+ .Op Ar directory
+ .Xc
+ Switch to the specified directory (default
+@@ -1344,13 +1346,12 @@ The number of previous commands that are accessible.
+ .El
+ .It fg Op Ar job
+ Move the specified job or the current job to the foreground.
+-.It getopts Ar optstring var
++.It getopts Ar optstring var Op Ar arg ...
+ The
+ .Tn POSIX
+ .Ic getopts
+ command, not to be confused with the
+-.Em Bell Labs
+--derived
++.Em Bell Labs Ns -derived
+ .Xr getopt 1 .
+ .Pp
+ The first argument should be a series of letters, each of which may be
+@@ -1388,6 +1389,12 @@ then
+ .Ev OPTARG
+ will be unset.
+ .Pp
++By default, the variables
++.Va $1 , ... , $n
++are inspected; if
++.Ar arg Ns s
++are specified, they'll be parsed instead.
++.Pp
+ .Va optstring
+ is a string of recognized option letters (see
+ .Xr getopt 3 ) .
+@@ -1432,7 +1439,7 @@ do
+ 	\\?)	echo $USAGE; exit 1;;
+ 	esac
+ done
+-shift `expr $OPTIND - 1`
++shift $((OPTIND - 1))
+ .Ed
+ .Pp
+ This code will accept any of the following as equivalent:
+@@ -1464,6 +1471,47 @@ The
+ .Fl r
+ option causes the hash command to delete all the entries in the hash table
+ except for functions.
++.It jobs Oo Fl lp Oc Op Ar job ...
++Display the status of all, or just the specified,
++.Ar job Ns s :
++.Bl -tag -compact -offset 5n -width "By default"
++.It By default
++display the job number, currency
++.Pq Sy +-
++status, if any, the job state, and its shell command.
++.It Fl l
++also output the PID of the group leader, and just the PID and shell commands
++of other members of the job.
++.It Fl p
++Display only leader PIDs, one per line.
++.El
++.It kill Oo Fl s Ar sigspec | Fl Ns Ar signum | Fl Ns Ar sigspec Oc Op Ar pid | job ...
++Equivalent to
++.Xr kill 1 ,
++but a
++.Ar job
++spec may also be specified.
++Signals can be either case-insensitive names without
++.Dv SIG
++prefixes or decimal numbers; the default is
++.Dv TERM .
++.It kill Fl l Op Ar signum | exitstatus
++List available signal names without the
++.Dv SIG
++prefix
++.Pq Ar sigspec Ns s .
++If
++.Ar signum
++specified, display just the
++.Ar sigspec
++for that signal.
++If
++.Ar exitstatus
++specified
++.Pq > Sy 128 ,
++display just the
++.Ar sigspec
++that caused it.
+ .It pwd Op Fl LP
+ builtin command remembers what the current directory
+ is rather than recomputing it each time.
+@@ -1528,41 +1576,36 @@ With the
+ option specified the output will be formatted suitably for non-interactive use.
+ .\".Pp
+ .It Xo printf Ar format
+-.Op Ar arguments  ...
++.Oo Ar value Oc Ns ...
+ .Xc
+ .Ic printf
+-formats and prints its arguments, after the first, under control
+-of the
+-.Ar format  .
+-The
+-.Ar format
+-is a character string which contains three types of objects: plain characters,
++formats and prints its arguments according to
++.Ar format ,
++a character string which contains three types of objects: plain characters,
+ which are simply copied to standard output, character escape sequences which
+ are converted and copied to the standard output, and format specifications,
+ each of which causes printing of the next successive
+-.Ar argument  .
++.Ar value .
+ .Pp
+-The
+-.Ar arguments
+-after the first are treated as strings if the corresponding format is
++Each
++.Ar value
++is treated as a string if the corresponding format specification is
+ either
+ .Cm b ,
+-.Cm c
++.Cm c ,
+ or
+ .Cm s ;
+-otherwise it is evaluated as a C constant, with the following extensions:
+-.Pp
++otherwise it is evaluated as a C constant, with the following additions:
+ .Bl -bullet -offset indent -compact
+ .It
+ A leading plus or minus sign is allowed.
+ .It
+-If the leading character is a single or double quote, the value is the
+-.Tn ASCII
+-code of the next character.
++If the leading character is a single or double quote, the value of the next byte.
+ .El
+ .Pp
+-The format string is reused as often as necessary to satisfy the
+-.Ar arguments  .
++The format string is reused as often as necessary until all
++.Ar value Ns s
++are consumed.
+ Any extra format specifications are evaluated with zero or the null
+ string.
+ .Pp
+@@ -2123,7 +2166,7 @@ printed; for commands and tracked aliases the complete pathname of the
+ command is printed.
+ .It ulimit Xo
+ .Op Fl H \*(Ba Fl S
+-.Op Fl a \*(Ba Fl tfdscmlpnv Op Ar value
++.Op Fl a \*(Ba Fl tfdscmlpnvwr Op Ar value
+ .Xc
+ Inquire about or set the hard or soft limits on processes or set new
+ limits.
+@@ -2176,6 +2219,8 @@ show or set the limit on the number files a process can have open at once
+ .It Fl v
+ show or set the limit on the total virtual memory that can be
+ in use by a process (in kilobytes)
++.It Fl w
++show or set the limit on the total number of locks held by a process
+ .It Fl r
+ show or set the limit on the real-time scheduling priority of a process
+ .El
+diff --git a/src/options.c b/src/options.c
+index a46c23b..3158498 100644
+--- a/src/options.c
++++ b/src/options.c
+@@ -410,7 +410,7 @@ getoptscmd(int argc, char **argv)
+ 	char **optbase;
+ 
+ 	if (argc < 3)
+-		sh_error("Usage: getopts optstring var [arg]");
++		sh_error("Usage: getopts optstring var [arg...]");
+ 	else if (argc == 3) {
+ 		optbase = shellparam.p;
+ 		if ((unsigned)shellparam.optind > shellparam.nparam + 1) {
diff --git a/debian/patches/9001-Add-privmode-Part-1.diff b/debian/patches/9001-Add-privmode-Part-1.diff
index e368d22061d6c1f312bd54f12524f585e2f75da7..bd164564339ad7a52e28cd331ea6879e9326696d 100644
--- a/debian/patches/9001-Add-privmode-Part-1.diff
+++ b/debian/patches/9001-Add-privmode-Part-1.diff
@@ -1,7 +1,19 @@
-Description: Implement privmode, part 1
 From: Tavis Ormandy <taviso@google.com>
+Date: Thu, 22 Aug 2013 10:59:36 -0700
+Subject: Implement privmode, part 1
+
 Origin: http://article.gmane.org/gmane.comp.security.oss.general/10969
+---
+ src/dash.1    | 16 ++++++++++------
+ src/main.c    | 17 +++++++++++++++++
+ src/options.c |  2 ++
+ src/options.h |  7 ++++---
+ src/var.c     | 29 +++++++++++++++++++++++------
+ src/var.h     |  1 +
+ 6 files changed, 57 insertions(+), 15 deletions(-)
 
+diff --git a/src/dash.1 b/src/dash.1
+index 169d5df..9c502fe 100644
 --- a/src/dash.1
 +++ b/src/dash.1
 @@ -41,8 +41,8 @@
@@ -37,7 +49,7 @@ Origin: http://article.gmane.org/gmane.comp.security.oss.general/10969
  .Ek
  .Bk -words
  .Op Fl o Ar option_name
-@@ -257,6 +257,10 @@
+@@ -257,6 +257,10 @@ if it has been set).
  .It Fl b Em notify
  Enable asynchronous notification of background job completion.
  (UNIMPLEMENTED for 4.4alpha)
@@ -48,10 +60,12 @@ Origin: http://article.gmane.org/gmane.comp.security.oss.general/10969
  .El
  .Ss Lexical Structure
  The shell reads input in terms of lines from a file and breaks it up into
+diff --git a/src/main.c b/src/main.c
+index 70df726..07124c7 100644
 --- a/src/main.c
 +++ b/src/main.c
-@@ -93,11 +93,16 @@
- 	struct jmploc jmploc;
+@@ -93,11 +93,16 @@ main(int argc, char **argv)
+ 	volatile int state;
  	struct stackmark smark;
  	int login;
 +	uid_t uid;
@@ -67,7 +81,7 @@ Origin: http://article.gmane.org/gmane.comp.security.oss.general/10969
  #if PROFILE
  	monitor(4, etext, profile_buf, sizeof profile_buf, 50);
  #endif
-@@ -144,6 +149,18 @@
+@@ -146,6 +151,18 @@ main(int argc, char **argv)
  	init();
  	setstackmark(&smark);
  	login = procargs(argc, argv);
@@ -86,9 +100,11 @@ Origin: http://article.gmane.org/gmane.comp.security.oss.general/10969
  	if (login) {
  		state = 1;
  		read_profile("/etc/profile");
+diff --git a/src/options.c b/src/options.c
+index a46c23b..48502bb 100644
 --- a/src/options.c
 +++ b/src/options.c
-@@ -79,6 +79,7 @@
+@@ -79,6 +79,7 @@ static const char *const optnames[NOPTS] = {
  	"allexport",
  	"notify",
  	"nounset",
@@ -96,7 +112,7 @@ Origin: http://article.gmane.org/gmane.comp.security.oss.general/10969
  	"nolog",
  	"debug",
  };
-@@ -99,6 +100,7 @@
+@@ -99,6 +100,7 @@ const char optletters[NOPTS] = {
  	'a',
  	'b',
  	'u',
@@ -104,9 +120,11 @@ Origin: http://article.gmane.org/gmane.comp.security.oss.general/10969
  	0,
  	0,
  };
+diff --git a/src/options.h b/src/options.h
+index 975fe33..9e90947 100644
 --- a/src/options.h
 +++ b/src/options.h
-@@ -59,10 +59,11 @@
+@@ -59,10 +59,11 @@ struct shparam {
  #define	aflag optlist[12]
  #define	bflag optlist[13]
  #define	uflag optlist[14]
@@ -121,9 +139,11 @@ Origin: http://article.gmane.org/gmane.comp.security.oss.general/10969
  
  extern const char optletters[NOPTS];
  extern char optlist[NOPTS];
+diff --git a/src/var.c b/src/var.c
+index ef9c2bd..4de2122 100644
 --- a/src/var.c
 +++ b/src/var.c
-@@ -85,6 +85,9 @@
+@@ -81,6 +81,9 @@ MKINIT char defoptindvar[] = "OPTIND=1";
  int lineno;
  char linenovar[sizeof("LINENO=")+sizeof(int)*CHAR_BIT/3+1] = "LINENO=";
  
@@ -133,7 +153,7 @@ Origin: http://article.gmane.org/gmane.comp.security.oss.general/10969
  /* Some macros in var.h depend on the order, add new variables to the end. */
  struct var varinit[] = {
  #if ATTY
-@@ -98,7 +101,7 @@
+@@ -90,7 +93,7 @@ struct var varinit[] = {
  	{ 0,	VSTRFIXED|VTEXTFIXED|VUNSET,	"MAIL\0",	changemail },
  	{ 0,	VSTRFIXED|VTEXTFIXED|VUNSET,	"MAILPATH\0",	changemail },
  	{ 0,	VSTRFIXED|VTEXTFIXED,		defpathvar,	changepath },
@@ -142,7 +162,7 @@ Origin: http://article.gmane.org/gmane.comp.security.oss.general/10969
  	{ 0,	VSTRFIXED|VTEXTFIXED,		"PS2=> ",	0 },
  	{ 0,	VSTRFIXED|VTEXTFIXED,		"PS4=+ ",	0 },
  	{ 0,	VSTRFIXED|VTEXTFIXED,		defoptindvar,	getoptsreset },
-@@ -181,11 +184,25 @@
+@@ -174,11 +177,25 @@ initvar(void)
  		vp->next = *vpp;
  		*vpp = vp;
  	} while (++vp < end);
@@ -173,9 +193,11 @@ Origin: http://article.gmane.org/gmane.comp.security.oss.general/10969
  }
  
  /*
+diff --git a/src/var.h b/src/var.h
+index aa7575a..4be3db1 100644
 --- a/src/var.h
 +++ b/src/var.h
-@@ -139,6 +139,7 @@
+@@ -135,6 +135,7 @@ extern char linenovar[];
  #define mpathset()	((vmpath.flags & VUNSET) == 0)
  
  void initvar(void);
diff --git a/debian/patches/9002-Add-privmode-Part-2.diff b/debian/patches/9002-Add-privmode-Part-2.diff
index 8f4f103e10b7a1d4b4a9e3ff6469c8798cb5369a..7e543d03dd4128678ae7f9e23d9377bc10965af5 100644
--- a/debian/patches/9002-Add-privmode-Part-2.diff
+++ b/debian/patches/9002-Add-privmode-Part-2.diff
@@ -1,18 +1,48 @@
-Description: Implement privmode, part 2
 From: Harald van Dijk <harald@gigawatt.nl>
+Date: Thu, 22 Aug 2013 21:59:36 +0200
+Subject: Implement privmode, part 2
+
 Origin: http://article.gmane.org/gmane.comp.security.oss.general/10972
+---
+ src/Makefile.am |  2 +-
+ src/dash.1      |  2 +-
+ src/main.c      | 14 +-------------
+ src/options.c   |  4 +++-
+ src/priv.c      | 27 +++++++++++++++++++++++++++
+ src/priv.h      |  6 ++++++
+ src/var.c       |  3 ---
+ 7 files changed, 39 insertions(+), 19 deletions(-)
+ create mode 100644 src/priv.c
+ create mode 100644 src/priv.h
 
+diff --git a/src/Makefile.am b/src/Makefile.am
+index 2c437bb..50d5a5b 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -20,7 +20,7 @@ bin_PROGRAMS = dash
+ dash_CFILES = \
+ 	alias.c arith_yacc.c arith_yylex.c cd.c error.c eval.c exec.c expand.c \
+ 	histedit.c input.c jobs.c mail.c main.c memalloc.c miscbltin.c \
+-	mystring.c options.c parser.c redir.c show.c trap.c output.c \
++	mystring.c options.c parser.c priv.c redir.c show.c trap.c output.c \
+ 	bltin/printf.c system.c bltin/test.c bltin/times.c var.c
+ dash_SOURCES = \
+ 	$(dash_CFILES) \
+diff --git a/src/dash.1 b/src/dash.1
+index 9c502fe..81f8359 100644
 --- a/src/dash.1
 +++ b/src/dash.1
-@@ -257,7 +257,7 @@
+@@ -257,7 +257,7 @@ if it has been set).
  .It Fl b Em notify
  Enable asynchronous notification of background job completion.
  (UNIMPLEMENTED for 4.4alpha)
 -.It Fl p Em nopriv
-+.It Fl p Em priv
++.It Fl p Em priviliged
  Do not attempt to reset effective uid if it does not match uid. This is not set
  by default to help avoid incorrect usage by setuid root programs via system(3) or
  popen(3).
+diff --git a/src/main.c b/src/main.c
+index 07124c7..0001ea6 100644
 --- a/src/main.c
 +++ b/src/main.c
 @@ -50,6 +50,7 @@
@@ -23,8 +53,8 @@ Origin: http://article.gmane.org/gmane.comp.security.oss.general/10972
  #include "trap.h"
  #include "var.h"
  #include "show.h"
-@@ -93,8 +94,6 @@
- 	struct jmploc jmploc;
+@@ -93,8 +94,6 @@ main(int argc, char **argv)
+ 	volatile int state;
  	struct stackmark smark;
  	int login;
 -	uid_t uid;
@@ -32,7 +62,7 @@ Origin: http://article.gmane.org/gmane.comp.security.oss.general/10972
  
  #ifdef __GLIBC__
  	dash_errno = __errno_location();
-@@ -150,17 +149,6 @@
+@@ -152,17 +151,6 @@ main(int argc, char **argv)
  	setstackmark(&smark);
  	login = procargs(argc, argv);
  
@@ -50,54 +80,8 @@ Origin: http://article.gmane.org/gmane.comp.security.oss.general/10972
  	if (login) {
  		state = 1;
  		read_profile("/etc/profile");
---- a/src/Makefile.am
-+++ b/src/Makefile.am
-@@ -21,7 +21,7 @@
- dash_CFILES = \
- 	alias.c arith_yacc.c arith_yylex.c cd.c error.c eval.c exec.c expand.c \
- 	histedit.c input.c jobs.c mail.c main.c memalloc.c miscbltin.c \
--	mystring.c options.c parser.c redir.c show.c trap.c output.c \
-+	mystring.c options.c parser.c priv.c redir.c show.c trap.c output.c \
- 	bltin/printf.c system.c bltin/test.c bltin/times.c var.c
- dash_SOURCES = \
- 	$(dash_CFILES) \
---- a/src/Makefile.in
-+++ b/src/Makefile.in
-@@ -69,7 +69,7 @@
- 	histedit.$(OBJEXT) input.$(OBJEXT) jobs.$(OBJEXT) \
- 	mail.$(OBJEXT) main.$(OBJEXT) memalloc.$(OBJEXT) \
- 	miscbltin.$(OBJEXT) mystring.$(OBJEXT) options.$(OBJEXT) \
--	parser.$(OBJEXT) redir.$(OBJEXT) show.$(OBJEXT) trap.$(OBJEXT) \
-+	parser.$(OBJEXT) priv.$(OBJEXT) redir.$(OBJEXT) show.$(OBJEXT) trap.$(OBJEXT) \
- 	output.$(OBJEXT) bltin/printf.$(OBJEXT) system.$(OBJEXT) \
- 	bltin/test.$(OBJEXT) bltin/times.$(OBJEXT) var.$(OBJEXT)
- am_dash_OBJECTS = $(am__objects_1)
-@@ -231,7 +231,7 @@
- dash_CFILES = \
- 	alias.c arith_yacc.c arith_yylex.c cd.c error.c eval.c exec.c expand.c \
- 	histedit.c input.c jobs.c mail.c main.c memalloc.c miscbltin.c \
--	mystring.c options.c parser.c redir.c show.c trap.c output.c \
-+	mystring.c options.c parser.c priv.c redir.c show.c trap.c output.c \
- 	bltin/printf.c system.c bltin/test.c bltin/times.c var.c
- 
- dash_SOURCES = \
-@@ -239,7 +239,7 @@
- 	alias.h arith_yacc.h bltin/bltin.h cd.h error.h eval.h exec.h \
- 	expand.h \
- 	init.h input.h jobs.h machdep.h mail.h main.h memalloc.h miscbltin.h \
--	myhistedit.h mystring.h options.h output.h parser.h redir.h shell.h \
-+	myhistedit.h mystring.h options.h output.h parser.h priv.h redir.h shell.h \
- 	show.h system.h trap.h var.h
- 
- dash_LDADD = builtins.o init.o nodes.o signames.o syntax.o
-@@ -374,6 +374,7 @@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/options.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/output.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parser.Po@am__quote@
-+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/priv.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/redir.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/show.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/system.Po@am__quote@
+diff --git a/src/options.c b/src/options.c
+index 48502bb..f37f30a 100644
 --- a/src/options.c
 +++ b/src/options.c
 @@ -45,6 +45,7 @@
@@ -108,16 +92,16 @@ Origin: http://article.gmane.org/gmane.comp.security.oss.general/10972
  #include "trap.h"
  #include "var.h"
  #include "memalloc.h"
-@@ -79,7 +80,7 @@
+@@ -79,7 +80,7 @@ static const char *const optnames[NOPTS] = {
  	"allexport",
  	"notify",
  	"nounset",
 -	"nopriv",
-+	"priv",
++	"privileged",
  	"nolog",
  	"debug",
  };
-@@ -184,6 +185,7 @@
+@@ -183,6 +184,7 @@ optschanged(void)
  #ifdef DEBUG
  	opentrace();
  #endif
@@ -125,6 +109,9 @@ Origin: http://article.gmane.org/gmane.comp.security.oss.general/10972
  	setinteractive(iflag);
  #ifndef SMALL
  	histedit();
+diff --git a/src/priv.c b/src/priv.c
+new file mode 100644
+index 0000000..26346c0
 --- /dev/null
 +++ b/src/priv.c
 @@ -0,0 +1,27 @@
@@ -155,6 +142,9 @@ Origin: http://article.gmane.org/gmane.comp.security.oss.general/10972
 +		choose_ps1();
 +	}
 +}
+diff --git a/src/priv.h b/src/priv.h
+new file mode 100644
+index 0000000..31b380b
 --- /dev/null
 +++ b/src/priv.h
 @@ -0,0 +1,6 @@
@@ -164,9 +154,11 @@ Origin: http://article.gmane.org/gmane.comp.security.oss.general/10972
 +extern gid_t gid;
 +
 +void setprivileged(int on);
+diff --git a/src/var.c b/src/var.c
+index 4de2122..5326a80 100644
 --- a/src/var.c
 +++ b/src/var.c
-@@ -195,9 +195,6 @@
+@@ -188,9 +188,6 @@ initvar(void)
  void
  choose_ps1(void)
  {
diff --git a/debian/patches/series b/debian/patches/series
index 2f693fb7b74d3e8ec5b501c046e8b25565bbe774..9f7d21b70a13e2f5bbdef993a46131b600ac7f1a 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,11 +1,13 @@
-0001-SHELL-print-n-upon-EOF-CTRL-D-when-run-interactively.diff
 0004-SHELL-Disable-sh-c-command-sh-c-exec-command-optimiza.diff
-0005-jobs-Replace-some-uses-of-fmtstr-with-stpcpy-stpncpy.patch
-0006-EVAL-Report-I-O-error-on-stdout.diff
 0007-Don-t-execute-binary-files-if-execve-returned-ENOEXE.diff
 0008-Support-e-in-echo-and-printf-builtins.diff
-0010-Hardcode-mktemp.diff
-0011-Avoid-crash-when-redirecting-to-file-descriptor-in-e.diff
+0009-dash-Fix-stack-overflow-from-infinite-recursion-in-s.patch
+0010-exec-Check-executable-bit-when-searching-path.patch
 0012-enable-large-file-support-when-available.patch
+0013-enable-hardening-for-helpers.patch
+0017-histedit-Fix-infinite-loop-when-using-fc--s.patch
+0018-builtin-Don-t-early-exit-when-first-hash-r-is-found.patch
+0019-builtin-Actually-accept-ulimit-r.patch
+0020-Update-manpages.patch
 9001-Add-privmode-Part-1.diff
 9002-Add-privmode-Part-2.diff
diff --git a/debian/po/POTFILES.in b/debian/po/POTFILES.in
deleted file mode 100644
index c59834c92c681c00b7af7d3a87645dd50a30a340..0000000000000000000000000000000000000000
--- a/debian/po/POTFILES.in
+++ /dev/null
@@ -1 +0,0 @@
-[type: gettext/rfc822deb] dash.templates.in
diff --git a/debian/po/bg.po b/debian/po/bg.po
deleted file mode 100644
index ee38389a8ee46c85e86eafe43ada2f4f75ab4006..0000000000000000000000000000000000000000
--- a/debian/po/bg.po
+++ /dev/null
@@ -1,59 +0,0 @@
-# translation of bg.po to Bulgarian
-# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-#
-# Damyan Ivanov <dmn@debian.org>, 2008, 2009.
-msgid ""
-msgstr ""
-"Project-Id-Version: PACKAGE VERSION\n"
-"Report-Msgid-Bugs-To: dash@packages.debian.org\n"
-"POT-Creation-Date: 2009-07-27 12:43+0000\n"
-"PO-Revision-Date: 2009-12-28 15:02+0200\n"
-"Last-Translator: Damyan Ivanov <dmn@debian.org>\n"
-"Language-Team: Bulgarian <dict@fsa-bg.org>\n"
-"Language: bg\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"X-Generator: KBabel 1.11.4\n"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "Use dash as the default system shell (/bin/sh)?"
-msgstr "Използване на dash като системна обвивка (/bin/sh)?"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "The system shell is the default command interpreter for shell scripts."
-msgstr ""
-"Системната обвивка се използва по подразбиране от скриптовете на обвивката."
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid ""
-"Using dash as the system shell will improve the system's overall "
-"performance. It does not alter the shell presented to interactive users."
-msgstr ""
-"Използването на dash като системна обвивка ще подобри бързодействието на "
-"системата като цяло. Тази настройка не променя обвивката на интерактивните "
-"потребители."
-
-#~ msgid "Install dash as /bin/sh?"
-#~ msgstr "Инсталиране на dash като /bin/sh?"
-
-#~ msgid ""
-#~ "The default /bin/sh shell on Debian and Debian-based systems is bash."
-#~ msgstr "Обвивката по подразбиране (/bin/sh) е bash."
-
-#~ msgid ""
-#~ "However, since the default shell is required to be POSIX-compliant, any "
-#~ "shell that conforms to POSIX, such as dash, can serve as /bin/sh. You may "
-#~ "wish to do this because dash is faster and smaller than bash."
-#~ msgstr ""
-#~ "Тъй като изискването към обвивката по подразбиране е единствено да бъде "
-#~ "съвместима с POSIX, всяко обвивка, която отговаря на това условие, като "
-#~ "например dash, може да изпълнява тази роля. Възможна причина да "
-#~ "предпочетете dash пред bash е, че е по-малка и по-бърза."
diff --git a/debian/po/cs.po b/debian/po/cs.po
deleted file mode 100644
index 0fd2d205452d2ab49891dd88242e575710ee7811..0000000000000000000000000000000000000000
--- a/debian/po/cs.po
+++ /dev/null
@@ -1,59 +0,0 @@
-# Czech translation of dash templates
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: dash\n"
-"Report-Msgid-Bugs-To: dash@packages.debian.org\n"
-"POT-Creation-Date: 2009-07-27 12:43+0000\n"
-"PO-Revision-Date: 2010-04-21 20:18+0200\n"
-"Last-Translator: Miroslav Kure <kurem@debian.cz>\n"
-"Language-Team: Czech <debian-l10n-czech@lists.debian.org>\n"
-"Language: cs\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "Use dash as the default system shell (/bin/sh)?"
-msgstr "Použít dash jako výchozí systémový shell (/bin/sh)?"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "The system shell is the default command interpreter for shell scripts."
-msgstr "Systémový shell je výchozí příkazový interpret shellových skriptů."
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid ""
-"Using dash as the system shell will improve the system's overall "
-"performance. It does not alter the shell presented to interactive users."
-msgstr ""
-"Použití dash jako systémového shellu celkově zlepší výkon systému. Toto "
-"nastavení nijak neovlivní interaktivní shell jednotlivých uživatelů."
-
-#~ msgid "Install dash as /bin/sh?"
-#~ msgstr "Nainstalovat dash jako /bin/sh?"
-
-#~ msgid ""
-#~ "The default /bin/sh shell on Debian and Debian-based systems is bash."
-#~ msgstr ""
-#~ "Výchozím shellem /bin/sh je v Debianu a systémech z něj odvozených bash."
-
-#~| msgid ""
-#~| "However, since the distribution policy requires all shell scripts using /"
-#~| "bin/sh to be POSIX compliant, any shell that conforms to POSIX, such as "
-#~| "dash, can serve as /bin/sh. You may wish to do this because dash is "
-#~| "faster and smaller than bash."
-#~ msgid ""
-#~ "However, since the default shell is required to be POSIX-compliant, any "
-#~ "shell that conforms to POSIX, such as dash, can serve as /bin/sh. You may "
-#~ "wish to do this because dash is faster and smaller than bash."
-#~ msgstr ""
-#~ "Protože však politika distribuce vyžaduje, aby byly všechny shellové "
-#~ "skripty využívající /bin/sh kompatibilní s POSIXem, můžete jako /bin/sh "
-#~ "použít jakýkoliv shell splňující normu POSIX, například shell dash. "
-#~ "Určitě to stojí za vyzkoušení, protože dash je rychlejší a menší než bash."
diff --git a/debian/po/da.po b/debian/po/da.po
deleted file mode 100644
index 5dc54330a7d33e8fe53874199aeff40b6c5b2717..0000000000000000000000000000000000000000
--- a/debian/po/da.po
+++ /dev/null
@@ -1,41 +0,0 @@
-# Danish translation Dash.
-# Copyright (C) 2010 Dash & nedenstående oversættere.
-# This file is distributed under the same license as the Dash package.
-# Claus Hindsgaul <claus_h@image.dk>, 2004.
-# Claus Hindsgaul <claus.hindsgaul@gmail.com>, 2006.
-# Joe Hansen <joedalton2@yahoo.dk>, 2010.
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: dash\n"
-"Report-Msgid-Bugs-To: dash@packages.debian.org\n"
-"POT-Creation-Date: 2009-07-27 12:43+0000\n"
-"PO-Revision-Date: 2010-06-03 17:30+01:00\n"
-"Last-Translator: Joe Hansen <joedalton2@yahoo.dk>\n"
-"Language-Team: Danish <debian-l10n-danish@lists.debian.org> \n"
-"Language: \n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "Use dash as the default system shell (/bin/sh)?"
-msgstr "Brug dash som standardsystemskal (/bin/sh)?"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "The system shell is the default command interpreter for shell scripts."
-msgstr "Systemskallen er standardkommandofortolkeren til skalskript."
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid ""
-"Using dash as the system shell will improve the system's overall "
-"performance. It does not alter the shell presented to interactive users."
-msgstr ""
-"Brug af dash som systemskal vil forbedre systemets generelle ydeevne. Den "
-"ændrer ikke på skallen vist til interaktive brugere."
diff --git a/debian/po/de.po b/debian/po/de.po
deleted file mode 100644
index c3dffb328a1ef0c81a50b7206fd42e2fba41a1d0..0000000000000000000000000000000000000000
--- a/debian/po/de.po
+++ /dev/null
@@ -1,57 +0,0 @@
-# Translation of dash debconf templates to German
-# Copyright (C) Helge Kreutzmann <debian@helgefjell.de>, 2006-2009.
-# This file is distributed under the same license as the dash package.
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: dash 0.5.5.1-2.3\n"
-"Report-Msgid-Bugs-To: dash@packages.debian.org\n"
-"POT-Creation-Date: 2009-07-27 12:43+0000\n"
-"PO-Revision-Date: 2009-08-03 20:33+0200\n"
-"Last-Translator: Helge Kreutzmann <debian@helgefjell.de>\n"
-"Language-Team: de <debian-l10n-german@lists.debian.org>\n"
-"Language: \n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=ISO-8859-15\n"
-"Content-Transfer-Encoding: 8bit\n"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "Use dash as the default system shell (/bin/sh)?"
-msgstr "Dash als Standard-Systemshell (/bin/sh) verwenden?"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "The system shell is the default command interpreter for shell scripts."
-msgstr ""
-"Die Systemshell ist der Standard-Kommandointerpreter für Shell-Skripte."
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid ""
-"Using dash as the system shell will improve the system's overall "
-"performance. It does not alter the shell presented to interactive users."
-msgstr ""
-"Dash als Systemshell zu verwenden verbessert die Gesamtleistung des Systems. "
-"Dies verändert nicht die interaktiven Benutzern präsentierte Shell."
-
-#~ msgid "Install dash as /bin/sh?"
-#~ msgstr "Dash als /bin/sh installieren?"
-
-#~ msgid ""
-#~ "The default /bin/sh shell on Debian and Debian-based systems is bash."
-#~ msgstr ""
-#~ "Standardmäßig ist bash als /bin/sh in Debian und auf Debian-basierten "
-#~ "Systemen installiert."
-
-#~ msgid ""
-#~ "However, since the default shell is required to be POSIX-compliant, any "
-#~ "shell that conforms to POSIX, such as dash, can serve as /bin/sh. You may "
-#~ "wish to do this because dash is faster and smaller than bash."
-#~ msgstr ""
-#~ "Da die Standardshell allerdings POSIX-konform sein muss, kann jede Shell, "
-#~ "die (wie Dash) POSIX-konform ist als /bin/sh dienen. Eventuell wollen Sie "
-#~ "Dash verwenden, da Dash schneller und kleiner als Bash ist."
diff --git a/debian/po/es.po b/debian/po/es.po
deleted file mode 100644
index 98881e98886ac02d4e4c5127ce004e3ffcb7bb60..0000000000000000000000000000000000000000
--- a/debian/po/es.po
+++ /dev/null
@@ -1,87 +0,0 @@
-# dash po-debconf translation to Spanish
-# Copyright (C) 2008, 2009 Software in the Public Interest
-# This file is distributed under the same license as the dash package.
-#
-# Changes:
-#   - Initial translation
-#       Fernando Cerezal López <kryptos21@gmail.com>, 2008
-#
-#   - Updates
-#       Francisco Javier Cuadrado <fcocuadrado@gmail.com>, 2009
-#
-# Traductores, si no conocen el formato PO, merece la pena leer la
-# documentación de gettext, especialmente las secciones dedicadas a este
-# formato, por ejemplo ejecutando:
-#       info -n '(gettext)PO Files'
-#       info -n '(gettext)Header Entry'
-#
-# Equipo de traducción al español, por favor lean antes de traducir
-# los siguientes documentos:
-#
-#   - El proyecto de traducción de Debian al español
-#     http://www.debian.org/intl/spanish/
-#     especialmente las notas de traducción en
-#     http://www.debian.org/intl/spanish/notas
-#
-#   - La guía de traducción de po's de debconf:
-#     /usr/share/doc/po-debconf/README-trans
-#     o http://www.debian.org/intl/l10n/po-debconf/README-trans
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: dash 0.5.5.1-2.3\n"
-"Report-Msgid-Bugs-To: dash@packages.debian.org\n"
-"POT-Creation-Date: 2009-07-27 12:43+0000\n"
-"PO-Revision-Date: 2009-08-02 17:21+0100\n"
-"Last-Translator: Francisco Javier Cuadrado <fcocuadrado@gmail.com>\n"
-"Language-Team: Debian l10n Spanish <debian-l10n-spanish@lists.debian.org>\n"
-"Language: \n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "Use dash as the default system shell (/bin/sh)?"
-msgstr ""
-"¿Desea utilizar dash como el intérprete de órdenes predeterminado del "
-"sistema (/bin/sh)?"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "The system shell is the default command interpreter for shell scripts."
-msgstr ""
-"El intérprete de órdenes del sistema es el que se utiliza de forma "
-"predeterminada para todos los programas y scripts."
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid ""
-"Using dash as the system shell will improve the system's overall "
-"performance. It does not alter the shell presented to interactive users."
-msgstr ""
-"El uso de dash como el intérprete de órdenes del sistema mejorará el "
-"rendimiento general de éste. Esto no altera el intérprete de órdenes que "
-"utilizan los usuarios interactivos."
-
-#~ msgid "Install dash as /bin/sh?"
-#~ msgstr "¿Desea instalar dash como «/bin/sh»?"
-
-#~ msgid ""
-#~ "The default /bin/sh shell on Debian and Debian-based systems is bash."
-#~ msgstr ""
-#~ "Bash es el intérprete de órdenes «/bin/sh» predeterminado de los sistemas "
-#~ "Debian y basados en Debian."
-
-#~ msgid ""
-#~ "However, since the default shell is required to be POSIX-compliant, any "
-#~ "shell that conforms to POSIX, such as dash, can serve as /bin/sh. You may "
-#~ "wish to do this because dash is faster and smaller than bash."
-#~ msgstr ""
-#~ "Sin embargo, dado que el intérprete de órdenes tiene que cumplir las "
-#~ "normas POSIX, cualquier intérprete compatible con POSIX, como dash, puede "
-#~ "servir como «/bin/sh». Puede que lo prefiera porque dash es más rápido y "
-#~ "más pequeño que bash."
diff --git a/debian/po/eu.po b/debian/po/eu.po
deleted file mode 100644
index 95b6771ed455313f0b26cb8894ec6d0ecb20271a..0000000000000000000000000000000000000000
--- a/debian/po/eu.po
+++ /dev/null
@@ -1,65 +0,0 @@
-# translation of dash_0.5.5.1-3._eu.po to Basque
-# translation of dash debconf template to Basque
-# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-#
-# Xabier Bilbao <xabidu@gmail.com>, 2008.
-# Iñaki Larrañaga Murgoitio <dooteo@euskalgnu.org>, 2008, 2010.
-msgid ""
-msgstr ""
-"Project-Id-Version: dash_0.5.5.1-3._eu\n"
-"Report-Msgid-Bugs-To: dash@packages.debian.org\n"
-"POT-Creation-Date: 2009-07-27 12:43+0000\n"
-"PO-Revision-Date: 2010-04-12 12:28+0200\n"
-"Last-Translator: Iñaki Larrañaga Murgoitio <dooteo@euskalgnu.org>\n"
-"Language-Team: Basque <itzulpena@euskalgnu.org>\n"
-"Language: eu\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"X-Generator: KBabel 1.11.4\n"
-"Plural-Forms: nplurals=2; plural=(n != 1);\n"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "Use dash as the default system shell (/bin/sh)?"
-msgstr "Erabili dash sistemako shell lehenetsi gisa (/bin/sh)?"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "The system shell is the default command interpreter for shell scripts."
-msgstr ""
-"Sistemako shell-a komandoen interpretatzaile lehenetsia da shell-eko script-"
-"entzako."
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid ""
-"Using dash as the system shell will improve the system's overall "
-"performance. It does not alter the shell presented to interactive users."
-msgstr ""
-"Dash erabiltzean (sistemako shell lehenetsi gisa) sistemako errendimendu "
-"orokorra hobetzen da. Honek ez du aldatzen erabiltzaileekin elkarreragiteko "
-"aurkezten den shell-a."
-
-#~ msgid "Install dash as /bin/sh?"
-#~ msgstr "Dash instalatu /bin/sh gisa?"
-
-#~ msgid ""
-#~ "The default /bin/sh shell on Debian and Debian-based systems is bash."
-#~ msgstr ""
-#~ "Debian banaketan, eta Debian-en oinarriturikoetan, bash da lehenetsitako /"
-#~ "bin/sh shell-a."
-
-#~ msgid ""
-#~ "However, since the default shell is required to be POSIX-compliant, any "
-#~ "shell that conforms to POSIX, such as dash, can serve as /bin/sh. You may "
-#~ "wish to do this because dash is faster and smaller than bash."
-#~ msgstr ""
-#~ "Alabaina, lehenetsitako shell-ak POSIX-ekin bateragarria izan behar "
-#~ "duenez, POSIX-ekin bat datorren edozein shell, hala nola dash, /bin/sh "
-#~ "gisa ezar daiteke. Aldaketa hau egitea nahi izan dezakezu, dash "
-#~ "bizkorragoa eta txikiagoa baita bash baino."
diff --git a/debian/po/fi.po b/debian/po/fi.po
deleted file mode 100644
index ac6e1c49947b9d3b19829e78879979d7ad296546..0000000000000000000000000000000000000000
--- a/debian/po/fi.po
+++ /dev/null
@@ -1,40 +0,0 @@
-# Esko Arajärvi <edu@iki.fi>, 2010.
-msgid ""
-msgstr ""
-"Project-Id-Version: dash 0.5.4-8\n"
-"Report-Msgid-Bugs-To: dash@packages.debian.org\n"
-"POT-Creation-Date: 2009-07-27 12:43+0000\n"
-"PO-Revision-Date: 2010-10-17 21:53+0300\n"
-"Last-Translator: Esko Arajärvi <edu@iki.fi>\n"
-"Language-Team: Finnish <debian-l10n-finnish@lists.debian.org>\n"
-"Language: fi\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"X-Poedit-Language: Finnish\n"
-"X-Poedit-Country: FINLAND\n"
-"X-Generator: Lokalize 1.0\n"
-"Plural-Forms: nplurals=2; plural=(n != 1);\n"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "Use dash as the default system shell (/bin/sh)?"
-msgstr "Käytetäänkö dashia järjestelmän oletuskomentotulkkina (/bin/sh)?"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "The system shell is the default command interpreter for shell scripts."
-msgstr "Komentosarjat ajetaan oletuksena järjestelmän komentotulkilla."
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid ""
-"Using dash as the system shell will improve the system's overall "
-"performance. It does not alter the shell presented to interactive users."
-msgstr ""
-"Järjestelmän suorituskykyä voidaan parantaa käyttämällä dashia järjestelmän "
-"oletuskomentotulkkina. Tämä ei vaikuta käyttäjille näytettäviin "
-"komentotulkkeihin."
diff --git a/debian/po/fr.po b/debian/po/fr.po
deleted file mode 100644
index 82ef3c1960ee0ff85fe88dda2a9a54a3f95b0208..0000000000000000000000000000000000000000
--- a/debian/po/fr.po
+++ /dev/null
@@ -1,45 +0,0 @@
-# Translation of dash debconf templates to French
-# Copyright (C) 2009 Debian French l10n team <debian-l10n-french@lists.debian.org>
-# This file is distributed under the same license as the dash package.
-#
-# Translator:
-# Julien Patriarca <patriarcaj@gmail.com>, 2009.
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: dash 0.5.5.1-2.3\n"
-"Report-Msgid-Bugs-To: dash@packages.debian.org\n"
-"POT-Creation-Date: 2009-07-27 12:43+0000\n"
-"PO-Revision-Date: 2009-08-02 13:30+0100\n"
-"Last-Translator: Julien Patriarca <patriarcaj@gmail.com>\n"
-"Language-Team: French <debian-l10n-french@lists.debian.org>\n"
-"Language: fr\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=utf-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "Use dash as the default system shell (/bin/sh)?"
-msgstr ""
-"Utiliser Dash comme interpréteur de ligne de commande par défaut pour le "
-"système (/bin/sh)?"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "The system shell is the default command interpreter for shell scripts."
-msgstr ""
-"Le shell système est l'interpréteur de commandes utilisé par le système."
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid ""
-"Using dash as the system shell will improve the system's overall "
-"performance. It does not alter the shell presented to interactive users."
-msgstr ""
-"Utiliser Dash comme interpréteur de ligne de commande du système améliorera "
-"les performances globales. Cela ne change pas l'interpréteur utilisé "
-"interactivement par les utilisateurs."
diff --git a/debian/po/gl.po b/debian/po/gl.po
deleted file mode 100644
index 7dc78233c76fb3c4e58e85022a269ab527fa70a8..0000000000000000000000000000000000000000
--- a/debian/po/gl.po
+++ /dev/null
@@ -1,55 +0,0 @@
-# Galician translation of dash's debconf templates
-# This file is distributed under the same license as the dash package.
-# Jacobo Tarrio <jtarrio@debian.org>, 2007, 2008.
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: dash\n"
-"Report-Msgid-Bugs-To: dash@packages.debian.org\n"
-"POT-Creation-Date: 2009-07-27 12:43+0000\n"
-"PO-Revision-Date: 2008-05-13 00:31+0100\n"
-"Last-Translator: Jacobo Tarrio <jtarrio@debian.org>\n"
-"Language-Team: Galician <proxecto@trasno.net>\n"
-"Language: gl\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "Use dash as the default system shell (/bin/sh)?"
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "The system shell is the default command interpreter for shell scripts."
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid ""
-"Using dash as the system shell will improve the system's overall "
-"performance. It does not alter the shell presented to interactive users."
-msgstr ""
-
-#~ msgid "Install dash as /bin/sh?"
-#~ msgstr "¿Instalar dash coma /bin/sh?"
-
-#~ msgid ""
-#~ "The default /bin/sh shell on Debian and Debian-based systems is bash."
-#~ msgstr ""
-#~ "O intérprete de ordes /bin/sh por defecto dos sistemas Debian e baseados "
-#~ "en Debian é bash."
-
-#~ msgid ""
-#~ "However, since the default shell is required to be POSIX-compliant, any "
-#~ "shell that conforms to POSIX, such as dash, can serve as /bin/sh. You may "
-#~ "wish to do this because dash is faster and smaller than bash."
-#~ msgstr ""
-#~ "Nembargantes, como o intérprete de ordes por defecto ten que ser "
-#~ "compatible con POSIX, calquera shell que siga POSIX, coma dash, pode "
-#~ "servir coma /bin/sh. Pode ser unha boa idea facelo, xa que dash é máis "
-#~ "rápido e máis pequeno que bash."
diff --git a/debian/po/id.po b/debian/po/id.po
deleted file mode 100644
index f041967617ec1d347c72a268c9970bebbf206ede..0000000000000000000000000000000000000000
--- a/debian/po/id.po
+++ /dev/null
@@ -1,41 +0,0 @@
-# Translation of dash debconf templates to Indonesian
-# This file is distributed under the same license as the dash package.
-# Mahyuddin Susanto <udienz@ubuntu.com>, 2012.
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: dash 0.5.7-2\n"
-"Report-Msgid-Bugs-To: dash@packages.debian.org\n"
-"POT-Creation-Date: 2009-07-27 12:43+0000\n"
-"PO-Revision-Date: 2012-01-24 11:46+0700\n"
-"Last-Translator: Mahyuddin Susanto <udienz@ubuntu.com>\n"
-"Language-Team: Debian Indonesia Translator <debian-l10n-indonesian@lists."
-"debian.org>\n"
-"Language: \n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"X-Poedit-Language: Indonesian\n"
-"X-Poedit-Country: INDONESIA\n"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "Use dash as the default system shell (/bin/sh)?"
-msgstr "Gunakan dash sebagai sistem shell bawaan (/bin/sh)?"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "The system shell is the default command interpreter for shell scripts."
-msgstr "Sistem shell adalah perintah intepreter bawaan untuk skrip shell"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid ""
-"Using dash as the system shell will improve the system's overall "
-"performance. It does not alter the shell presented to interactive users."
-msgstr ""
-"Menggunakan dash sebagai sistem shell akan meningkatkan performa keseluruhan "
-"sistem. Ini tidak mengubah shell yang disajikan ke pengguna interaktif"
diff --git a/debian/po/it.po b/debian/po/it.po
deleted file mode 100644
index b7881ebfd11bd006dc4e3cb283b3437da9fc233b..0000000000000000000000000000000000000000
--- a/debian/po/it.po
+++ /dev/null
@@ -1,41 +0,0 @@
-# dash -- Italian debconf messages
-# This file is distributed under the same license as the dash package.
-# Andrea Bolognani <eof@kiyuko.org>, 2006.
-# Luca Monducci <luca.mo@tiscali.it>, 2007 - 2009.
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: dash 0.5.5.1 italian debconf templates\n"
-"Report-Msgid-Bugs-To: dash@packages.debian.org\n"
-"POT-Creation-Date: 2009-07-27 12:43+0000\n"
-"PO-Revision-Date: 2009-08-09 10:51+0200\n"
-"Last-Translator: Luca Monducci <luca.mo@tiscali.it>\n"
-"Language-Team: Italian <debian-l10n-italian@lists.debian.org>\n"
-"Language: it\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "Use dash as the default system shell (/bin/sh)?"
-msgstr "Usare dash come shell di sistema (/bin/sh)?"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "The system shell is the default command interpreter for shell scripts."
-msgstr ""
-"La shell di sistema è l'interprete dei comandi predefinito negli script "
-"della shell."
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid ""
-"Using dash as the system shell will improve the system's overall "
-"performance. It does not alter the shell presented to interactive users."
-msgstr ""
-"Usando dash come shell di sistema miglioreranno le prestazioni generali del "
-"sistema. Non verrà cambiata la shell presentata agli utenti interattivi."
diff --git a/debian/po/ja.po b/debian/po/ja.po
deleted file mode 100644
index dcc5962063de725ee047ab45421a8c025535e6c2..0000000000000000000000000000000000000000
--- a/debian/po/ja.po
+++ /dev/null
@@ -1,48 +0,0 @@
-# 
-#    Translators, if you are not familiar with the PO format, gettext
-#    documentation is worth reading, especially sections dedicated to
-#    this format, e.g. by running:
-#         info -n '(gettext)PO Files'
-#         info -n '(gettext)Header Entry'
-# 
-#    Some information specific to po-debconf are available at
-#            /usr/share/doc/po-debconf/README-trans
-#         or http://www.debian.org/intl/l10n/po-debconf/README-trans
-# 
-#    Developers do not need to manually edit POT or PO files.
-# 
-msgid ""
-msgstr ""
-"Project-Id-Version: dash 0.5.5.1-3\n"
-"Report-Msgid-Bugs-To: dash@packages.debian.org\n"
-"POT-Creation-Date: 2009-07-27 12:43+0000\n"
-"PO-Revision-Date: 2010-01-09 11:21+0200\n"
-"Last-Translator: Hideki Yamane (Debian-JP) <henrich@debian.or.jp>\n"
-"Language-Team: Japanese <debian-japanese@lists.debian.org>\n"
-"Language: ja\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "Use dash as the default system shell (/bin/sh)?"
-msgstr "dash をデフォルトのシステムシェル (/bin/sh) として使いますか?"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "The system shell is the default command interpreter for shell scripts."
-msgstr ""
-"システムシェルはシェルスクリプト用のデフォルトのコマンドインタプリタです。"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid ""
-"Using dash as the system shell will improve the system's overall "
-"performance. It does not alter the shell presented to interactive users."
-msgstr ""
-"dash をシステムシェルとして使うことは、システム全体のパフォーマンスを改善しま"
-"す。対話的に利用しているユーザのシェルについては、変更しません。"
diff --git a/debian/po/ko.po b/debian/po/ko.po
deleted file mode 100644
index 34a1480180fb224a2bb7f03fb2ec48520b1d9f7b..0000000000000000000000000000000000000000
--- a/debian/po/ko.po
+++ /dev/null
@@ -1,54 +0,0 @@
-# Korean translations for dash package
-# dash 패키지에 대한 한국어 번역문.
-# Sunjae Park <darehanl@gmail.com>, 2007 - 2008.
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: dash\n"
-"Report-Msgid-Bugs-To: dash@packages.debian.org\n"
-"POT-Creation-Date: 2009-07-27 12:43+0000\n"
-"PO-Revision-Date: 2008-06-24 18:27-0400\n"
-"Last-Translator: Sunjae Park <darehanl@gmail.com>\n"
-"Language-Team: Korean <debian-l10n-korean@lists.debian.org>\n"
-"Language: ko\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms: nplurals=1; plural=0;\n"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "Use dash as the default system shell (/bin/sh)?"
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "The system shell is the default command interpreter for shell scripts."
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid ""
-"Using dash as the system shell will improve the system's overall "
-"performance. It does not alter the shell presented to interactive users."
-msgstr ""
-
-#~ msgid "Install dash as /bin/sh?"
-#~ msgstr "dash를 /bin/sh로 설치할까요?"
-
-#~ msgid ""
-#~ "The default /bin/sh shell on Debian and Debian-based systems is bash."
-#~ msgstr ""
-#~ "데비안과 데비안 기반 시스템은 모두 bash를 기본 /bin/sh용 셸로 사용합니다."
-
-#~ msgid ""
-#~ "However, since the default shell is required to be POSIX-compliant, any "
-#~ "shell that conforms to POSIX, such as dash, can serve as /bin/sh. You may "
-#~ "wish to do this because dash is faster and smaller than bash."
-#~ msgstr ""
-#~ "하지만 기본 셸은 모두 POSIX 호환이어야 하므로, dash와 같이 POSIX 호환 셸이"
-#~ "기만 하면 /bin/sh로 사용할 수 있습니다. dash는 bash보다 작고 빠르기 때문"
-#~ "에 dash를 사용하길 원하실 수 있습니다."
diff --git a/debian/po/nl.po b/debian/po/nl.po
deleted file mode 100644
index d6d4ecbdf1ecf21e1d452704f69bbf9894f2b5ae..0000000000000000000000000000000000000000
--- a/debian/po/nl.po
+++ /dev/null
@@ -1,41 +0,0 @@
-# Dutch translation of dash debconf templates.
-# Copyright (C) 2008-2010 THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the dash package.
-# Thijs Kinkhorst <thijs@debian.org>, 2008.
-# Eric Spreen <erispre@gmail.com>, 2010.
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: dash_0.5.5.1\n"
-"Report-Msgid-Bugs-To: dash@packages.debian.org\n"
-"POT-Creation-Date: 2009-07-27 12:43+0000\n"
-"PO-Revision-Date: 2011-04-26 09:15+0200\n"
-"Last-Translator: Eric Spreen <erispre@gmail.com>\n"
-"Language-Team: Debian l10n Dutch <debian-l10n-dutch@lists.debian.org>\n"
-"Language: \n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "Use dash as the default system shell (/bin/sh)?"
-msgstr "Wilt u dash gebruiken als de standaard systeemshell (/bin/sh)?"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "The system shell is the default command interpreter for shell scripts."
-msgstr "De systeemshell is de standaard commandovertolker voor shell scripts."
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid ""
-"Using dash as the system shell will improve the system's overall "
-"performance. It does not alter the shell presented to interactive users."
-msgstr ""
-"Als u dash als de systeemshell gebruikt, zal dit de prestaties van het "
-"systeem ten goede komen. Het verandert niets aan de shell die interactieve "
-"gebruikers te zien krijgen."
diff --git a/debian/po/pl.po b/debian/po/pl.po
deleted file mode 100644
index cd3a55490cfd3a8173ca226b776d58faae0f18f6..0000000000000000000000000000000000000000
--- a/debian/po/pl.po
+++ /dev/null
@@ -1,42 +0,0 @@
-# Translation of dash debconf templates to Polish.
-# This file is distributed under the same license as the dash package.
-#
-# Michał Kułach <michal.kulach@gmail.com>, 2012.
-msgid ""
-msgstr ""
-"Project-Id-Version: \n"
-"Report-Msgid-Bugs-To: dash@packages.debian.org\n"
-"POT-Creation-Date: 2009-07-27 12:43+0000\n"
-"PO-Revision-Date: 2012-01-31 22:24+0100\n"
-"Last-Translator: Michał Kułach <michal.kulach@gmail.com>\n"
-"Language-Team: Polish <debian-l10n-polish@lists.debian.org>\n"
-"Language: pl\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"X-Generator: Lokalize 1.2\n"
-"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
-"|| n%100>=20) ? 1 : 2);\n"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "Use dash as the default system shell (/bin/sh)?"
-msgstr "Użyć dasha jako domyślnej powłoki systemowej (/bin/sh)?"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "The system shell is the default command interpreter for shell scripts."
-msgstr ""
-"Powłoka systemowa jest domyślnym interpreterem poleceń dla skryptów powłoki"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid ""
-"Using dash as the system shell will improve the system's overall "
-"performance. It does not alter the shell presented to interactive users."
-msgstr ""
-"Użycie programu dash jako powłoki systemowej poprawi ogólną wydajność "
-"systemu. Wybranie tej opcji nie zmieni powłoki zwykłych użytkowników."
diff --git a/debian/po/pt.po b/debian/po/pt.po
deleted file mode 100644
index 544950f1d21d92eb4358a9a59feb8f91addb650f..0000000000000000000000000000000000000000
--- a/debian/po/pt.po
+++ /dev/null
@@ -1,61 +0,0 @@
-# Portuguese translation of dash's debconf messages.
-# Copyright (C) 2007 the package copyright holder
-# This file is distributed under the same license as the dash package.
-# Ricardo Silva <ardoric@gmail.com>, 2007.
-# Miguel Figueiredo <elmig@debianpt.org>, 2010.
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: dash 0.5.4-9\n"
-"Report-Msgid-Bugs-To: dash@packages.debian.org\n"
-"POT-Creation-Date: 2009-07-27 12:43+0000\n"
-"PO-Revision-Date: 2010-04-16 22:37+0100\n"
-"Last-Translator: Miguel Figueiredo <elmig@debianpt.org>\n"
-"Language-Team: Portuguese <traduz@debianpt.org>\n"
-"Language: pt\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "Use dash as the default system shell (/bin/sh)?"
-msgstr "Utilizar o dash como shell predefinida do sistema (/bin/sh)?"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "The system shell is the default command interpreter for shell scripts."
-msgstr ""
-"A shell do sistema é o interpretador de comandos predefinido para scripts da "
-"shell."
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid ""
-"Using dash as the system shell will improve the system's overall "
-"performance. It does not alter the shell presented to interactive users."
-msgstr ""
-"Utilizar o dash como shell do sistema irá melhorar a performance em geral do "
-"sistema. Não altera a shell apresentada aos utilizadores interactivos."
-
-#~ msgid "Install dash as /bin/sh?"
-#~ msgstr "Instalar dash como /bin/sh?"
-
-#~ msgid ""
-#~ "The default /bin/sh shell on Debian and Debian-based systems is bash."
-#~ msgstr ""
-#~ "A shell em /bin/sh por omissão em sistemas Debian e baseados em Debian é "
-#~ "a bash."
-
-#~ msgid ""
-#~ "However, since the default shell is required to be POSIX-compliant, any "
-#~ "shell that conforms to POSIX, such as dash, can serve as /bin/sh. You may "
-#~ "wish to do this because dash is faster and smaller than bash."
-#~ msgstr ""
-#~ "No entanto, uma vez que a shell por omissão tem de ser compatível com "
-#~ "POSIX, qualquer shell que o seja, tal como a dash, pode servir como /bin/"
-#~ "sh. Você pode querer fazer isto uma vez que a dash é mais pequena e "
-#~ "rápida que a bash."
diff --git a/debian/po/pt_BR.po b/debian/po/pt_BR.po
deleted file mode 100644
index a07cb723e359ceca72544f3895586a1543c0dd27..0000000000000000000000000000000000000000
--- a/debian/po/pt_BR.po
+++ /dev/null
@@ -1,68 +0,0 @@
-# dash Brazilian Portuguese translation
-# Copyright (C) 2008 THE dash'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the dash package.
-# André Luís Lopes <andrelop@debian.org>, 2008.
-# Adriano Rafael Gomes <adrianorg@gmail.com>, 2008-2010.
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: dash 0.5.5.1-3\n"
-"Report-Msgid-Bugs-To: dash@packages.debian.org\n"
-"POT-Creation-Date: 2009-07-27 12:43+0000\n"
-"PO-Revision-Date: 2010-05-16 22:18-0300\n"
-"Last-Translator: Adriano Rafael Gomes <adrianorg@gmail.com>\n"
-"Language-Team: Brazilian Portuguese <debian-l10n-portuguese@lists.debian."
-"org>\n"
-"Language: pt_BR\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"pt_BR utf-8\n"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "Use dash as the default system shell (/bin/sh)?"
-msgstr "Usar o dash como shell padrão do sistema (/bin/sh)?"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "The system shell is the default command interpreter for shell scripts."
-msgstr ""
-"O shell do sistema é o interpretador de comandos padrão para shell scripts."
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid ""
-"Using dash as the system shell will improve the system's overall "
-"performance. It does not alter the shell presented to interactive users."
-msgstr ""
-"Usar o dash como shell do sistema irá melhorar o desempenho geral do "
-"sistema. Isso não altera o shell apresentado para usuários interativos."
-
-#~ msgid "Install dash as /bin/sh?"
-#~ msgstr "Instalar o dash como /bin/sh?"
-
-#~ msgid ""
-#~ "The default /bin/sh shell on Debian and Debian-based systems is bash."
-#~ msgstr ""
-#~ "O shell /bin/sh padrão no Debian e em sistemas baseados no Debian é o "
-#~ "bash."
-
-#~| msgid ""
-#~| "Bash is the default /bin/sh on a Debian system.  However, since the "
-#~| "Debian policy requires all shell scripts using /bin/sh to be POSIX "
-#~| "compliant, any shell that conforms to POSIX can serve as /bin/sh.  Since "
-#~| "dash is POSIX compliant, it can be used as /bin/sh.  You may wish to do "
-#~| "this because dash is faster and smaller than bash."
-#~ msgid ""
-#~ "However, since the default shell is required to be POSIX-compliant, any "
-#~ "shell that conforms to POSIX, such as dash, can serve as /bin/sh. You may "
-#~ "wish to do this because dash is faster and smaller than bash."
-#~ msgstr ""
-#~ "Contudo, como é requerido que o shell padrão seja compatível com o padrão "
-#~ "POSIX, qualquer shell que esteja em conformidade com o padrão POSIX, tal "
-#~ "como o dash, pode servir como /bin/sh. Você pode desejar fazer isto "
-#~ "porque o dash é mais rápido e menor que o bash."
diff --git a/debian/po/ro.po b/debian/po/ro.po
deleted file mode 100644
index 306e71c79fadb0153bbdd6546235705dc201f5ea..0000000000000000000000000000000000000000
--- a/debian/po/ro.po
+++ /dev/null
@@ -1,68 +0,0 @@
-# translation of ro.po to Romanian
-# Romanian translations for dash package
-# Traducerea în limba română pentru pachetul dash.
-# Copyright (C) 2008
-# This file is distributed under the same license as the dash package.
-#
-# Eddy Petrisor <eddy.petrisor@gmail.com>, 2008.
-# Eddy Petrișor <eddy.petrisor@gmail.com>, 2008.
-# Andrei Popescu <andreimpopescu@gmail.com, 2012.
-msgid ""
-msgstr ""
-"Project-Id-Version: ro\n"
-"Report-Msgid-Bugs-To: dash@packages.debian.org\n"
-"POT-Creation-Date: 2009-07-27 12:43+0000\n"
-"PO-Revision-Date: 2012-02-20 11:03+0200\n"
-"Last-Translator: Andrei POPESCU <andreimpopescu@gmail.com>\n"
-"Language-Team: Romanian <debian-l10n-romanian@lists.debian.org>\n"
-"Language: ro\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms:  nplurals=3; plural=n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 < "
-"20)) ? 1 : 2;\n"
-"X-Generator: KBabel 1.11.4\n"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "Use dash as the default system shell (/bin/sh)?"
-msgstr "Se folosește dash ca shell implicit pentru sistem (/bin/sh)?"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "The system shell is the default command interpreter for shell scripts."
-msgstr ""
-"Un shell de sistem este interpretorul de comenzi implicit pentru scripturi "
-"shell."
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid ""
-"Using dash as the system shell will improve the system's overall "
-"performance. It does not alter the shell presented to interactive users."
-msgstr ""
-"Folosind dash ca shell pentru sistem va îmbunătăți performanța generală a "
-"sistemului. Această schimbare nu va afecta ce shell este folosit pentru "
-"utilizatorii interactivi."
-
-#~ msgid "Install dash as /bin/sh?"
-#~ msgstr "Se instalează dash ca /bin/sh?"
-
-#~ msgid ""
-#~ "The default /bin/sh shell on Debian and Debian-based systems is bash."
-#~ msgstr ""
-#~ "Shell-ul implicit /bin/sh pe sistemele Debian și bazate pe Debian este "
-#~ "bash."
-
-#~ msgid ""
-#~ "However, since the default shell is required to be POSIX-compliant, any "
-#~ "shell that conforms to POSIX, such as dash, can serve as /bin/sh. You may "
-#~ "wish to do this because dash is faster and smaller than bash."
-#~ msgstr ""
-#~ "Totuși, deoarece shell-ul implicit trebuie să respecte standardul POSIX, "
-#~ "orice alt shell conform cu POSIX, precum dash, poate fi folosit ca /bin/"
-#~ "sh. Ați putea dori acest lucru deoarece dash este mai rapid și mai mic "
-#~ "decât bash."
diff --git a/debian/po/ru.po b/debian/po/ru.po
deleted file mode 100644
index 8fb3bc87d92efca7c8dfde08f2b87565873d2248..0000000000000000000000000000000000000000
--- a/debian/po/ru.po
+++ /dev/null
@@ -1,56 +0,0 @@
-# translation of ru.po to Russian
-#
-#    Translators, if you are not familiar with the PO format, gettext
-#    documentation is worth reading, especially sections dedicated to
-#    this format, e.g. by running:
-#         info -n '(gettext)PO Files'
-#         info -n '(gettext)Header Entry'
-#    Some information specific to po-debconf are available at
-#            /usr/share/doc/po-debconf/README-trans
-#         or http://www.debian.org/intl/l10n/po-debconf/README-trans#
-#    Developers do not need to manually edit POT or PO files.
-#
-# Ilgiz Kalmetev <translator@ilgiz.pp.ru>, 2003.
-# Yuri Kozlov <kozlov.y@gmail.com>, 2007, 2008.
-# Yuri Kozlov <yuray@komyakino.ru>, 2009.
-msgid ""
-msgstr ""
-"Project-Id-Version: dash 0.5.5.1-2.3\n"
-"Report-Msgid-Bugs-To: dash@packages.debian.org\n"
-"POT-Creation-Date: 2009-07-27 12:43+0000\n"
-"PO-Revision-Date: 2009-07-29 21:06+0400\n"
-"Last-Translator: Yuri Kozlov <yuray@komyakino.ru>\n"
-"Language-Team: Russian <debian-l10n-russian@lists.debian.org>\n"
-"Language: ru\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"X-Generator: KBabel 1.11.4\n"
-"Plural-Forms:  nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
-"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "Use dash as the default system shell (/bin/sh)?"
-msgstr ""
-"Использовать dash в качестве системной оболочки по умолчанию (/bin/sh)?"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "The system shell is the default command interpreter for shell scripts."
-msgstr ""
-"Системная оболочка -- это командный интерпретатор для сценариев оболочки "
-"командной строки."
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid ""
-"Using dash as the system shell will improve the system's overall "
-"performance. It does not alter the shell presented to interactive users."
-msgstr ""
-"Использование dash в качестве системной оболочки улучшит общую "
-"производительность системы. Это не изменит оболочки командной строки, "
-"используемые пользователями."
diff --git a/debian/po/sk.po b/debian/po/sk.po
deleted file mode 100644
index d6cfea0aa6de1a74c63fd44604e5d32b63f290ef..0000000000000000000000000000000000000000
--- a/debian/po/sk.po
+++ /dev/null
@@ -1,42 +0,0 @@
-# Slovak translations for dash package
-# Slovenské preklady pre balík dash.
-# Copyright (C) 2011 THE dash'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the dash package.
-# Automatically generated, 2011.
-# Slavko <linux@slavino.sk>, 2011.
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: dash 0.5.5.1-7.4\n"
-"Report-Msgid-Bugs-To: dash@packages.debian.org\n"
-"POT-Creation-Date: 2009-07-27 12:43+0000\n"
-"PO-Revision-Date: 2011-01-30 18:26+0100\n"
-"Last-Translator: Slavko <linux@slavino.sk>\n"
-"Language-Team: Slovak <nomail>\n"
-"Language: sk\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "Use dash as the default system shell (/bin/sh)?"
-msgstr "Použiť dash ako východzí systémový shell (/bin/sh)?"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "The system shell is the default command interpreter for shell scripts."
-msgstr "Systémový shell je východzí príkazový interpret shellových skriptov."
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid ""
-"Using dash as the system shell will improve the system's overall "
-"performance. It does not alter the shell presented to interactive users."
-msgstr ""
-"Použitie dash ako systémového shellu celkovo zlepší výkon systému. Toto "
-"nastavenie nijako neovplyvní interaktívny shell jednotlivých používateľov."
diff --git a/debian/po/sr.po b/debian/po/sr.po
deleted file mode 100644
index 938cbf4e7ba1f0f56bfb7577b66129126aa62728..0000000000000000000000000000000000000000
--- a/debian/po/sr.po
+++ /dev/null
@@ -1,39 +0,0 @@
-# SOME DESCRIPTIVE TITLE.
-# Copyright (C) 2011
-# This file is distributed under the same license as the dash package.
-# Zlatan Todoric <zlatan.todoric@gmail.com>, 2011.
-#
-#, fuzzy
-msgid ""
-msgstr ""
-"Project-Id-Version: PACKAGE VERSION\n"
-"Report-Msgid-Bugs-To: dash@packages.debian.org\n"
-"POT-Creation-Date: 2009-07-27 12:43+0000\n"
-"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
-"Last-Translator: Zlatan Todoric <zlatan.todoric@gmail.com>\n"
-"Language-Team: LANGUAGE <LL@li.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "Use dash as the default system shell (/bin/sh)?"
-msgstr "Користити (dash) као подразумијевани систем (shell) (/bin/sh)?"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "The system shell is the default command interpreter for shell scripts."
-msgstr "Системски (shell) је подразумијавани тумач за (shell) скрипте."
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid ""
-"Using dash as the system shell will improve the system's overall "
-"performance. It does not alter the shell presented to interactive users."
-msgstr ""
-"Кориштењем (dash) повећавају се свеукупне систмеске перформансе. Не мијења"
-"(shell) представљен интерактивним корисницима."
diff --git a/debian/po/sv.po b/debian/po/sv.po
deleted file mode 100644
index 535fb055ba83fc9da1707149292692c9b87c5f63..0000000000000000000000000000000000000000
--- a/debian/po/sv.po
+++ /dev/null
@@ -1,63 +0,0 @@
-# Translation of Dash debconf template to Swedish
-# Copyright (C) 2009 Martin Bagge <brother@bsnet.se>
-# This file is distributed under the same license as the Dash package.
-#
-# Martin Bagge <brother@bsnet.se>, 2009
-# Martin Ã…gren <martin.agren@gmail.com>, 2008.
-msgid ""
-msgstr ""
-"Project-Id-Version: dash_0.5.4-11_sv\n"
-"Report-Msgid-Bugs-To: dash@packages.debian.org\n"
-"POT-Creation-Date: 2009-07-27 12:43+0000\n"
-"PO-Revision-Date: 2009-07-28 22:49+0100\n"
-"Last-Translator: Martin Bagge <brother@bsnet.se>\n"
-"Language-Team: Swedish <debian-l10n-swedish@lists.debian.org>\n"
-"Language: sv\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=utf-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"X-Generator: KBabel 1.11.4\n"
-"Plural-Forms: nplurals=2; plural=(n != 1);\n"
-"X-Poedit-Language: Swedish\n"
-"X-Poedit-Country: Sweden\n"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "Use dash as the default system shell (/bin/sh)?"
-msgstr "Ska dash användas som standardskal (/bin/sh)?"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "The system shell is the default command interpreter for shell scripts."
-msgstr "Systemskalet är kommandotolken för skript skrivna för skalet."
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid ""
-"Using dash as the system shell will improve the system's overall "
-"performance. It does not alter the shell presented to interactive users."
-msgstr ""
-"Att använda dash som systemskal kommer att inverka positivt på "
-"drifthastigheten av hela systemet. Det kommer inte innebära att användarnas "
-"skal byts ut."
-
-#~ msgid "Install dash as /bin/sh?"
-#~ msgstr "Installera dash som /bin/sh?"
-
-#~ msgid ""
-#~ "The default /bin/sh shell on Debian and Debian-based systems is bash."
-#~ msgstr ""
-#~ "Standardvalet för skalet /bin/sh på Debian och Debianbaserade system är "
-#~ "bash."
-
-#~ msgid ""
-#~ "However, since the default shell is required to be POSIX-compliant, any "
-#~ "shell that conforms to POSIX, such as dash, can serve as /bin/sh. You may "
-#~ "wish to do this because dash is faster and smaller than bash."
-#~ msgstr ""
-#~ "Eftersom standardskalet måste vara POSIX-kompatibelt, kan dock vilket "
-#~ "POSIX-kompatibelt skal som helst, såsom dash, tjänstgöra som /bin/sh. Du "
-#~ "kanske önskar detta eftersom dash är snabbare och mindre än bash."
diff --git a/debian/po/templates.pot b/debian/po/templates.pot
deleted file mode 100644
index 14844144b92056e2d7ae574cff1153eecc8c118d..0000000000000000000000000000000000000000
--- a/debian/po/templates.pot
+++ /dev/null
@@ -1,37 +0,0 @@
-# SOME DESCRIPTIVE TITLE.
-# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
-#
-#, fuzzy
-msgid ""
-msgstr ""
-"Project-Id-Version: PACKAGE VERSION\n"
-"Report-Msgid-Bugs-To: dash@packages.debian.org\n"
-"POT-Creation-Date: 2009-07-27 12:43+0000\n"
-"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
-"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
-"Language-Team: LANGUAGE <LL@li.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=CHARSET\n"
-"Content-Transfer-Encoding: 8bit\n"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "Use dash as the default system shell (/bin/sh)?"
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "The system shell is the default command interpreter for shell scripts."
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid ""
-"Using dash as the system shell will improve the system's overall "
-"performance. It does not alter the shell presented to interactive users."
-msgstr ""
diff --git a/debian/po/tr.po b/debian/po/tr.po
deleted file mode 100644
index 3b1102b6aef8943bcd25d39ccb54a028cefcc69c..0000000000000000000000000000000000000000
--- a/debian/po/tr.po
+++ /dev/null
@@ -1,59 +0,0 @@
-# SOME DESCRIPTIVE TITLE.
-# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# Mert Dirik <mertdirik@gmail.com>, 2008, 2011.
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: dash\n"
-"Report-Msgid-Bugs-To: dash@packages.debian.org\n"
-"POT-Creation-Date: 2009-07-27 12:43+0000\n"
-"PO-Revision-Date: 2012-02-20 22:57+0200\n"
-"Last-Translator: Mert Dirik <mertdirik@gmail.com>\n"
-"Language-Team: Debian L10n Turkish <debian-l10n-turkish@lists.debian.org>\n"
-"Language: \n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"X-Poedit-Language: Turkish\n"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "Use dash as the default system shell (/bin/sh)?"
-msgstr "'dash' öntanımlı sistem kabuğu (/bin/sh) olarak kullanılsın mı?"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "The system shell is the default command interpreter for shell scripts."
-msgstr ""
-"Sistem kabuğu, kabuk betiklerinin kullandığı öntanımlı komut "
-"yorumlayıcısıdır."
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid ""
-"Using dash as the system shell will improve the system's overall "
-"performance. It does not alter the shell presented to interactive users."
-msgstr ""
-"dash'i sistem kabuğu olarak kullanmak sistemin başarımını artırır. "
-"Etkileşimli kullanıcıların kabukları bu değişiklikten etkilenmez."
-
-#~ msgid "Install dash as /bin/sh?"
-#~ msgstr "dash /bin/sh olarak kurulsun mu?"
-
-#~ msgid ""
-#~ "The default /bin/sh shell on Debian and Debian-based systems is bash."
-#~ msgstr "Debian tabanlı sistemlerdeki öntanımlı /bin/sh kabuğu bash'tir."
-
-#~ msgid ""
-#~ "However, since the default shell is required to be POSIX-compliant, any "
-#~ "shell that conforms to POSIX, such as dash, can serve as /bin/sh. You may "
-#~ "wish to do this because dash is faster and smaller than bash."
-#~ msgstr ""
-#~ "Ama, öntanımlı kabuğun POSIX uyumlu olması gerektiğinden, POSIX "
-#~ "standartlarına uyan herhangi bir kabuk, örneğin dash, /bin/sh olarak "
-#~ "kullanılabilir. dash bash'ten daha küçük ve daha hızlı olduğundan dash'i /"
-#~ "bin/sh olarak kullanmak isteyebilirsiniz."
diff --git a/debian/po/vi.po b/debian/po/vi.po
deleted file mode 100644
index ff70022864d0b772dbaf6b7277b262cae7dbfd8f..0000000000000000000000000000000000000000
--- a/debian/po/vi.po
+++ /dev/null
@@ -1,42 +0,0 @@
-# Vietnamese translation for Dash.
-# Copyright © 2010 Free Software Foundation, Inc.
-# Clytie Siddall <clytie@riverland.net.au>, 2005-2010.
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: dash 0.5.5.1-3.1\n"
-"Report-Msgid-Bugs-To: dash@packages.debian.org\n"
-"POT-Creation-Date: 2009-07-27 12:43+0000\n"
-"PO-Revision-Date: 2010-04-10 16:54+0930\n"
-"Last-Translator: Clytie Siddall <clytie@riverland.net.au>\n"
-"Language-Team: Vietnamese <vi-VN@googlegroups.com>\n"
-"Language: vi\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms: nplurals=1; plural=0;\n"
-"X-Generator: LocFactoryEditor 1.8\n"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "Use dash as the default system shell (/bin/sh)?"
-msgstr "Dùng dash làm trình bao hệ thống mặc định (/bin/sh) ?"
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid "The system shell is the default command interpreter for shell scripts."
-msgstr ""
-"Trình bao hệ thống là bộ thông thích lệnh mặc định cho văn lệnh trình bao."
-
-#. Type: boolean
-#. Description
-#: ../dash.templates.in:1001
-msgid ""
-"Using dash as the system shell will improve the system's overall "
-"performance. It does not alter the shell presented to interactive users."
-msgstr ""
-"Dùng dash làm trình bao hệ thống thì tăng cường hiệu suất toàn cục của hệ "
-"thống. Nó không sửa đổi trình bao được hiển thị cho người dùng tương tác (v."
-"d. bash, tcsh)."
diff --git a/debian/rules b/debian/rules
index 171e02446e8a4669648bb84d74223bd0fe80e244..64f8a568c2ddb5d75d63232bc8ece1863775df58 100755
--- a/debian/rules
+++ b/debian/rules
@@ -5,9 +5,14 @@
 
 DEB_BUILD_MAINT_OPTIONS =hardening=+all
 
-# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
+include /usr/share/dpkg/architecture.mk
+
+ifeq ($(DEB_HOST_ARCH_OS),hurd)
+DEB_CPPFLAGS_MAINT_APPEND = -DPATH_MAX=4096
+endif
+
 DPKG_EXPORT_BUILDFLAGS = 1
-include /usr/share/dpkg/default.mk
+include /usr/share/dpkg/buildflags.mk
 
 ifneq (,$(findstring diet,$(DEB_BUILD_OPTIONS)))
   CC =diet -v -Os gcc
@@ -15,21 +20,14 @@ ifneq (,$(findstring diet,$(DEB_BUILD_OPTIONS)))
   CPPFLAGS =
   LDFLAGS =
 endif
-ifneq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
-  STRIP =: strip
-endif
 
 %:
 	dh $@
 
 override_dh_auto_configure:
-	dh_auto_configure -- --enable-fnmatch --disable-lineno
-
-override_dh_auto_build: po-templates
-	dh_auto_build
-
-po-templates:
-	po2debconf debian/dash.templates.in >debian/dash.templates
+	dh_auto_configure -- \
+		--disable-fnmatch \
+		--disable-lineno \
+		--disable-glob
 
-.PHONY: po-templates  \
-	  override_dh_auto_configure override_dh_auto_build
+.PHONY: override_dh_auto_configure
diff --git a/debian/shells.d/dash b/debian/shells.d/dash
new file mode 100644
index 0000000000000000000000000000000000000000..166e5212477c985605a7cb2c29e7d425885fb113
--- /dev/null
+++ b/debian/shells.d/dash
@@ -0,0 +1 @@
+/bin/dash
diff --git a/debian/tests/control b/debian/tests/control
index dbed742899c887dbec5b58dc945d86de4ac573dc..5653969ef76d24b81a674d9f00d350845161a77d 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -1,3 +1,7 @@
 Tests: smoke
 Depends: dash, perl
 Restrictions: allow-stderr
+
+Tests: mmdebstrap
+Depends: mmdebstrap, fakechroot, fakeroot
+Restrictions: allow-stderr
diff --git a/debian/tests/mmdebstrap b/debian/tests/mmdebstrap
new file mode 100755
index 0000000000000000000000000000000000000000..bd33919798ec86fe095d1b64e2a5f9a9e209dc65
--- /dev/null
+++ b/debian/tests/mmdebstrap
@@ -0,0 +1,45 @@
+#!/bin/sh
+#
+# Copyright 2022 Johannes Schauer Marin Rodrigues <josch@debian.org>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in all
+# copies or substantial portions of the Software.
+
+set -eux
+
+# This test is to prevent bugs like https://bugs.debian.org/1006771
+
+VERSION="$(dpkg-parsechangelog -SVersion)"
+apt-cache show "dash=$VERSION" >/dev/null || exit 1
+
+DIST="$(dpkg-parsechangelog -SDistribution)"
+if [ "$DIST" = "UNRELEASED" ]; then
+    # take Distribution from the previous entry instead
+    DIST="$(dpkg-parsechangelog -o1 -c1 -SDistribution)" || DIST="unstable"
+    echo "WARN: Using Distribution: $DIST instead of UNRELEASED" >&2
+fi
+
+# we need to install the chroot using the same apt sources as used by
+# the autopkgtest chroot so that the packages to be tested are
+# available
+aptsources=
+[ -e /etc/apt/sources.list ] && aptsources="/etc/apt/sources.list"
+for f in /etc/apt/sources.list.d/*.list /etc/apt/sources.list.d/*.sources; do
+	[ -e "$f" ] || continue
+	aptsources="$aptsources $f"
+done
+
+# We cannot use debootstrap because debootstrap cannot install from multiple
+# mirrors. Since dash is Essential:yes it does not test the right thing if we
+# first install with dash from unstable and then upgrade to dash from salsaci.
+mmdebstrap --verbose --variant=essential \
+	--hook-dir=/usr/share/mmdebstrap/hooks/file-mirror-automount \
+	--customize-hook='chroot "$1" dpkg-query --showformat "\${Status} \${Version}\n" --show dash | grep "^install ok installed '"$VERSION"'"' \
+	$DIST /dev/null $aptsources
diff --git a/debian/watch b/debian/watch
index 08460aa40e7859a4b7dcb393647719d9a6883930..3e0f3d84fc5686fe95abd7619e00b4486a4e6616 100644
--- a/debian/watch
+++ b/debian/watch
@@ -1,2 +1,7 @@
-version=3
+version=4
+
 http://gondor.apana.org.au/~herbert/dash/files/dash-([\d.]+)\.tar\.gz
+
+opts="mode=git, pgpmode=none, pretty=0.5.11+git%cd+%h, repack, compression=xz" \
+ https://git.kernel.org/pub/scm/utils/dash/dash.git \
+ HEAD
diff --git a/depcomp b/depcomp
index 25a39e6cd5c82d7276f6ccc62ef5e7ba1cc9776f..6b391623c4bf023255fdbc8eceb7acf110e5fa79 100755
--- a/depcomp
+++ b/depcomp
@@ -1,10 +1,9 @@
 #! /bin/sh
 # depcomp - compile a program generating dependencies as side-effects
 
-scriptversion=2012-03-27.16; # UTC
+scriptversion=2018-03-07.03; # UTC
 
-# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010,
-# 2011, 2012 Free Software Foundation, Inc.
+# Copyright (C) 1999-2020 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
@@ -17,7 +16,7 @@ scriptversion=2012-03-27.16; # UTC
 # 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/>.
+# along with this program.  If not, see <https://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
@@ -28,9 +27,9 @@ scriptversion=2012-03-27.16; # UTC
 
 case $1 in
   '')
-     echo "$0: No command.  Try '$0 --help' for more information." 1>&2
-     exit 1;
-     ;;
+    echo "$0: No command.  Try '$0 --help' for more information." 1>&2
+    exit 1;
+    ;;
   -h | --h*)
     cat <<\EOF
 Usage: depcomp [--help] [--version] PROGRAM [ARGS]
@@ -57,11 +56,65 @@ EOF
     ;;
 esac
 
+# Get the directory component of the given path, and save it in the
+# global variables '$dir'.  Note that this directory component will
+# be either empty or ending with a '/' character.  This is deliberate.
+set_dir_from ()
+{
+  case $1 in
+    */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
+      *) dir=;;
+  esac
+}
+
+# Get the suffix-stripped basename of the given path, and save it the
+# global variable '$base'.
+set_base_from ()
+{
+  base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
+}
+
+# If no dependency file was actually created by the compiler invocation,
+# we still have to create a dummy depfile, to avoid errors with the
+# Makefile "include basename.Plo" scheme.
+make_dummy_depfile ()
+{
+  echo "#dummy" > "$depfile"
+}
+
+# Factor out some common post-processing of the generated depfile.
+# Requires the auxiliary global variable '$tmpdepfile' to be set.
+aix_post_process_depfile ()
+{
+  # If the compiler actually managed to produce a dependency file,
+  # post-process it.
+  if test -f "$tmpdepfile"; then
+    # Each line is of the form 'foo.o: dependency.h'.
+    # Do two passes, one to just change these to
+    #   $object: dependency.h
+    # and one to simply output
+    #   dependency.h:
+    # which is needed to avoid the deleted-header problem.
+    { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
+      sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
+    } > "$depfile"
+    rm -f "$tmpdepfile"
+  else
+    make_dummy_depfile
+  fi
+}
+
 # A tabulation character.
 tab='	'
 # A newline character.
 nl='
 '
+# Character ranges might be problematic outside the C locale.
+# These definitions help.
+upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
+lower=abcdefghijklmnopqrstuvwxyz
+digits=0123456789
+alpha=${upper}${lower}
 
 if test -z "$depmode" || test -z "$source" || test -z "$object"; then
   echo "depcomp: Variables source, object and depmode must be set" 1>&2
@@ -75,6 +128,9 @@ tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
 
 rm -f "$tmpdepfile"
 
+# Avoid interferences from the environment.
+gccflag= dashmflag=
+
 # Some modes work just like other modes, but use different flags.  We
 # parameterize here, but still list the modes in the big case below,
 # to make depend.m4 easier to write.  Note that we *cannot* use a case
@@ -86,32 +142,32 @@ if test "$depmode" = hp; then
 fi
 
 if test "$depmode" = dashXmstdout; then
-   # This is just like dashmstdout with a different argument.
-   dashmflag=-xM
-   depmode=dashmstdout
+  # This is just like dashmstdout with a different argument.
+  dashmflag=-xM
+  depmode=dashmstdout
 fi
 
 cygpath_u="cygpath -u -f -"
 if test "$depmode" = msvcmsys; then
-   # This is just like msvisualcpp but w/o cygpath translation.
-   # Just convert the backslash-escaped backslashes to single forward
-   # slashes to satisfy depend.m4
-   cygpath_u='sed s,\\\\,/,g'
-   depmode=msvisualcpp
+  # This is just like msvisualcpp but w/o cygpath translation.
+  # Just convert the backslash-escaped backslashes to single forward
+  # slashes to satisfy depend.m4
+  cygpath_u='sed s,\\\\,/,g'
+  depmode=msvisualcpp
 fi
 
 if test "$depmode" = msvc7msys; then
-   # This is just like msvc7 but w/o cygpath translation.
-   # Just convert the backslash-escaped backslashes to single forward
-   # slashes to satisfy depend.m4
-   cygpath_u='sed s,\\\\,/,g'
-   depmode=msvc7
+  # This is just like msvc7 but w/o cygpath translation.
+  # Just convert the backslash-escaped backslashes to single forward
+  # slashes to satisfy depend.m4
+  cygpath_u='sed s,\\\\,/,g'
+  depmode=msvc7
 fi
 
 if test "$depmode" = xlc; then
-   # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations.
-   gccflag=-qmakedep=gcc,-MF
-   depmode=gcc
+  # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
+  gccflag=-qmakedep=gcc,-MF
+  depmode=gcc
 fi
 
 case "$depmode" in
@@ -134,8 +190,7 @@ gcc3)
   done
   "$@"
   stat=$?
-  if test $stat -eq 0; then :
-  else
+  if test $stat -ne 0; then
     rm -f "$tmpdepfile"
     exit $stat
   fi
@@ -143,13 +198,17 @@ gcc3)
   ;;
 
 gcc)
+## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
+## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
+## (see the conditional assignment to $gccflag above).
 ## There are various ways to get dependency output from gcc.  Here's
 ## why we pick this rather obscure method:
 ## - Don't want to use -MD because we'd like the dependencies to end
 ##   up in a subdir.  Having to rename by hand is ugly.
 ##   (We might end up doing this anyway to support other compilers.)
 ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
-##   -MM, not -M (despite what the docs say).
+##   -MM, not -M (despite what the docs say).  Also, it might not be
+##   supported by the other compilers which use the 'gcc' depmode.
 ## - Using -M directly means running the compiler twice (even worse
 ##   than renaming).
   if test -z "$gccflag"; then
@@ -157,15 +216,14 @@ gcc)
   fi
   "$@" -Wp,"$gccflag$tmpdepfile"
   stat=$?
-  if test $stat -eq 0; then :
-  else
+  if test $stat -ne 0; then
     rm -f "$tmpdepfile"
     exit $stat
   fi
   rm -f "$depfile"
   echo "$object : \\" > "$depfile"
-  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
-## The second -e expression handles DOS-style file names with drive letters.
+  # The second -e expression handles DOS-style file names with drive
+  # letters.
   sed -e 's/^[^:]*: / /' \
       -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
 ## This next piece of magic avoids the "deleted header file" problem.
@@ -174,15 +232,15 @@ gcc)
 ## typically no way to rebuild the header).  We avoid this by adding
 ## dummy dependencies for each header file.  Too bad gcc doesn't do
 ## this for us directly.
-  tr ' ' "$nl" < "$tmpdepfile" |
 ## Some versions of gcc put a space before the ':'.  On the theory
 ## that the space means something, we add a space to the output as
 ## well.  hp depmode also adds that space, but also prefixes the VPATH
 ## to the object.  Take care to not repeat it in the output.
 ## Some versions of the HPUX 10.20 sed can't process this invocation
 ## correctly.  Breaking it into two sed invocations is a workaround.
-    sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
-      | sed -e 's/$/ :/' >> "$depfile"
+  tr ' ' "$nl" < "$tmpdepfile" \
+    | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
+    | sed -e 's/$/ :/' >> "$depfile"
   rm -f "$tmpdepfile"
   ;;
 
@@ -200,8 +258,7 @@ sgi)
     "$@" -MDupdate "$tmpdepfile"
   fi
   stat=$?
-  if test $stat -eq 0; then :
-  else
+  if test $stat -ne 0; then
     rm -f "$tmpdepfile"
     exit $stat
   fi
@@ -209,7 +266,6 @@ sgi)
 
   if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
     echo "$object : \\" > "$depfile"
-
     # Clip off the initial element (the dependent).  Don't try to be
     # clever and replace this with sed code, as IRIX sed won't handle
     # lines with more than a fixed number of characters (4096 in
@@ -217,19 +273,15 @@ sgi)
     # the IRIX cc adds comments like '#:fec' to the end of the
     # dependency line.
     tr ' ' "$nl" < "$tmpdepfile" \
-    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
-    tr "$nl" ' ' >> "$depfile"
+      | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
+      | tr "$nl" ' ' >> "$depfile"
     echo >> "$depfile"
-
     # The second pass generates a dummy entry for each header file.
     tr ' ' "$nl" < "$tmpdepfile" \
-   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
-   >> "$depfile"
+      | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+      >> "$depfile"
   else
-    # The sourcefile does not contain any dependencies, so just
-    # store a dummy comment line, to avoid errors with the Makefile
-    # "include basename.Plo" scheme.
-    echo "#dummy" > "$depfile"
+    make_dummy_depfile
   fi
   rm -f "$tmpdepfile"
   ;;
@@ -247,9 +299,8 @@ aix)
   # current directory.  Also, the AIX compiler puts '$object:' at the
   # start of each line; $object doesn't have directory information.
   # Version 6 uses the directory in both cases.
-  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
-  test "x$dir" = "x$object" && dir=
-  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+  set_dir_from "$object"
+  set_base_from "$object"
   if test "$libtool" = yes; then
     tmpdepfile1=$dir$base.u
     tmpdepfile2=$base.u
@@ -262,9 +313,7 @@ aix)
     "$@" -M
   fi
   stat=$?
-
-  if test $stat -eq 0; then :
-  else
+  if test $stat -ne 0; then
     rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
     exit $stat
   fi
@@ -273,65 +322,113 @@ aix)
   do
     test -f "$tmpdepfile" && break
   done
-  if test -f "$tmpdepfile"; then
-    # Each line is of the form 'foo.o: dependent.h'.
-    # Do two passes, one to just change these to
-    # '$object: dependent.h' and one to simply 'dependent.h:'.
-    sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
-    sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
-  else
-    # The sourcefile does not contain any dependencies, so just
-    # store a dummy comment line, to avoid errors with the Makefile
-    # "include basename.Plo" scheme.
-    echo "#dummy" > "$depfile"
+  aix_post_process_depfile
+  ;;
+
+tcc)
+  # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
+  # FIXME: That version still under development at the moment of writing.
+  #        Make that this statement remains true also for stable, released
+  #        versions.
+  # It will wrap lines (doesn't matter whether long or short) with a
+  # trailing '\', as in:
+  #
+  #   foo.o : \
+  #    foo.c \
+  #    foo.h \
+  #
+  # It will put a trailing '\' even on the last line, and will use leading
+  # spaces rather than leading tabs (at least since its commit 0394caf7
+  # "Emit spaces for -MD").
+  "$@" -MD -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -ne 0; then
+    rm -f "$tmpdepfile"
+    exit $stat
   fi
+  rm -f "$depfile"
+  # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
+  # We have to change lines of the first kind to '$object: \'.
+  sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
+  # And for each line of the second kind, we have to emit a 'dep.h:'
+  # dummy dependency, to avoid the deleted-header problem.
+  sed -n -e 's|^  *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
   rm -f "$tmpdepfile"
   ;;
 
-icc)
-  # Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'.
-  # However on
-  #    $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c
-  # ICC 7.0 will fill foo.d with something like
-  #    foo.o: sub/foo.c
-  #    foo.o: sub/foo.h
-  # which is wrong.  We want
-  #    sub/foo.o: sub/foo.c
-  #    sub/foo.o: sub/foo.h
-  #    sub/foo.c:
-  #    sub/foo.h:
-  # ICC 7.1 will output
+## The order of this option in the case statement is important, since the
+## shell code in configure will try each of these formats in the order
+## listed in this file.  A plain '-MD' option would be understood by many
+## compilers, so we must ensure this comes after the gcc and icc options.
+pgcc)
+  # Portland's C compiler understands '-MD'.
+  # Will always output deps to 'file.d' where file is the root name of the
+  # source file under compilation, even if file resides in a subdirectory.
+  # The object file name does not affect the name of the '.d' file.
+  # pgcc 10.2 will output
   #    foo.o: sub/foo.c sub/foo.h
-  # and will wrap long lines using '\':
+  # and will wrap long lines using '\' :
   #    foo.o: sub/foo.c ... \
   #     sub/foo.h ... \
   #     ...
-  # tcc 0.9.26 (FIXME still under development at the moment of writing)
-  # will emit a similar output, but also prepend the continuation lines
-  # with horizontal tabulation characters.
-  "$@" -MD -MF "$tmpdepfile"
-  stat=$?
-  if test $stat -eq 0; then :
-  else
+  set_dir_from "$object"
+  # Use the source, not the object, to determine the base name, since
+  # that's sadly what pgcc will do too.
+  set_base_from "$source"
+  tmpdepfile=$base.d
+
+  # For projects that build the same source file twice into different object
+  # files, the pgcc approach of using the *source* file root name can cause
+  # problems in parallel builds.  Use a locking strategy to avoid stomping on
+  # the same $tmpdepfile.
+  lockdir=$base.d-lock
+  trap "
+    echo '$0: caught signal, cleaning up...' >&2
+    rmdir '$lockdir'
+    exit 1
+  " 1 2 13 15
+  numtries=100
+  i=$numtries
+  while test $i -gt 0; do
+    # mkdir is a portable test-and-set.
+    if mkdir "$lockdir" 2>/dev/null; then
+      # This process acquired the lock.
+      "$@" -MD
+      stat=$?
+      # Release the lock.
+      rmdir "$lockdir"
+      break
+    else
+      # If the lock is being held by a different process, wait
+      # until the winning process is done or we timeout.
+      while test -d "$lockdir" && test $i -gt 0; do
+        sleep 1
+        i=`expr $i - 1`
+      done
+    fi
+    i=`expr $i - 1`
+  done
+  trap - 1 2 13 15
+  if test $i -le 0; then
+    echo "$0: failed to acquire lock after $numtries attempts" >&2
+    echo "$0: check lockdir '$lockdir'" >&2
+    exit 1
+  fi
+
+  if test $stat -ne 0; then
     rm -f "$tmpdepfile"
     exit $stat
   fi
   rm -f "$depfile"
-  # Each line is of the form 'foo.o: dependent.h',
-  # or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'.
+  # Each line is of the form `foo.o: dependent.h',
+  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
   # Do two passes, one to just change these to
-  # '$object: dependent.h' and one to simply 'dependent.h:'.
-  sed -e "s/^[ $tab][ $tab]*/  /" -e "s,^[^:]*:,$object :," \
-    < "$tmpdepfile" > "$depfile"
-  sed '
-    s/[ '"$tab"'][ '"$tab"']*/ /g
-    s/^ *//
-    s/ *\\*$//
-    s/^[^:]*: *//
-    /^$/d
-    /:$/d
-    s/$/ :/
-  ' < "$tmpdepfile" >> "$depfile"
+  # `$object: dependent.h' and one to simply `dependent.h:'.
+  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
+  # Some versions of the HPUX 10.20 sed can't process this invocation
+  # correctly.  Breaking it into two sed invocations is a workaround.
+  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
+    | sed -e 's/$/ :/' >> "$depfile"
   rm -f "$tmpdepfile"
   ;;
 
@@ -342,9 +439,8 @@ hp2)
   # 'foo.d', which lands next to the object file, wherever that
   # happens to be.
   # Much of this is similar to the tru64 case; see comments there.
-  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
-  test "x$dir" = "x$object" && dir=
-  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+  set_dir_from  "$object"
+  set_base_from "$object"
   if test "$libtool" = yes; then
     tmpdepfile1=$dir$base.d
     tmpdepfile2=$dir.libs/$base.d
@@ -355,8 +451,7 @@ hp2)
     "$@" +Maked
   fi
   stat=$?
-  if test $stat -eq 0; then :
-  else
+  if test $stat -ne 0; then
      rm -f "$tmpdepfile1" "$tmpdepfile2"
      exit $stat
   fi
@@ -366,76 +461,61 @@ hp2)
     test -f "$tmpdepfile" && break
   done
   if test -f "$tmpdepfile"; then
-    sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
+    sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
     # Add 'dependent.h:' lines.
     sed -ne '2,${
-	       s/^ *//
-	       s/ \\*$//
-	       s/$/:/
-	       p
-	     }' "$tmpdepfile" >> "$depfile"
+               s/^ *//
+               s/ \\*$//
+               s/$/:/
+               p
+             }' "$tmpdepfile" >> "$depfile"
   else
-    echo "#dummy" > "$depfile"
+    make_dummy_depfile
   fi
   rm -f "$tmpdepfile" "$tmpdepfile2"
   ;;
 
 tru64)
-   # The Tru64 compiler uses -MD to generate dependencies as a side
-   # effect.  'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
-   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
-   # dependencies in 'foo.d' instead, so we check for that too.
-   # Subdirectories are respected.
-   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
-   test "x$dir" = "x$object" && dir=
-   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
-
-   if test "$libtool" = yes; then
-      # With Tru64 cc, shared objects can also be used to make a
-      # static library.  This mechanism is used in libtool 1.4 series to
-      # handle both shared and static libraries in a single compilation.
-      # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
-      #
-      # With libtool 1.5 this exception was removed, and libtool now
-      # generates 2 separate objects for the 2 libraries.  These two
-      # compilations output dependencies in $dir.libs/$base.o.d and
-      # in $dir$base.o.d.  We have to check for both files, because
-      # one of the two compilations can be disabled.  We should prefer
-      # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
-      # automatically cleaned when .libs/ is deleted, while ignoring
-      # the former would cause a distcleancheck panic.
-      tmpdepfile1=$dir.libs/$base.lo.d   # libtool 1.4
-      tmpdepfile2=$dir$base.o.d          # libtool 1.5
-      tmpdepfile3=$dir.libs/$base.o.d    # libtool 1.5
-      tmpdepfile4=$dir.libs/$base.d      # Compaq CCC V6.2-504
-      "$@" -Wc,-MD
-   else
-      tmpdepfile1=$dir$base.o.d
-      tmpdepfile2=$dir$base.d
-      tmpdepfile3=$dir$base.d
-      tmpdepfile4=$dir$base.d
-      "$@" -MD
-   fi
-
-   stat=$?
-   if test $stat -eq 0; then :
-   else
-      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
-      exit $stat
-   fi
-
-   for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
-   do
-     test -f "$tmpdepfile" && break
-   done
-   if test -f "$tmpdepfile"; then
-      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
-      sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
-   else
-      echo "#dummy" > "$depfile"
-   fi
-   rm -f "$tmpdepfile"
-   ;;
+  # The Tru64 compiler uses -MD to generate dependencies as a side
+  # effect.  'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
+  # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+  # dependencies in 'foo.d' instead, so we check for that too.
+  # Subdirectories are respected.
+  set_dir_from  "$object"
+  set_base_from "$object"
+
+  if test "$libtool" = yes; then
+    # Libtool generates 2 separate objects for the 2 libraries.  These
+    # two compilations output dependencies in $dir.libs/$base.o.d and
+    # in $dir$base.o.d.  We have to check for both files, because
+    # one of the two compilations can be disabled.  We should prefer
+    # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+    # automatically cleaned when .libs/ is deleted, while ignoring
+    # the former would cause a distcleancheck panic.
+    tmpdepfile1=$dir$base.o.d          # libtool 1.5
+    tmpdepfile2=$dir.libs/$base.o.d    # Likewise.
+    tmpdepfile3=$dir.libs/$base.d      # Compaq CCC V6.2-504
+    "$@" -Wc,-MD
+  else
+    tmpdepfile1=$dir$base.d
+    tmpdepfile2=$dir$base.d
+    tmpdepfile3=$dir$base.d
+    "$@" -MD
+  fi
+
+  stat=$?
+  if test $stat -ne 0; then
+    rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+    exit $stat
+  fi
+
+  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+  do
+    test -f "$tmpdepfile" && break
+  done
+  # Same post-processing that is required for AIX mode.
+  aix_post_process_depfile
+  ;;
 
 msvc7)
   if test "$libtool" = yes; then
@@ -446,8 +526,7 @@ msvc7)
   "$@" $showIncludes > "$tmpdepfile"
   stat=$?
   grep -v '^Note: including file: ' "$tmpdepfile"
-  if test "$stat" = 0; then :
-  else
+  if test $stat -ne 0; then
     rm -f "$tmpdepfile"
     exit $stat
   fi
@@ -473,6 +552,7 @@ $ {
   G
   p
 }' >> "$depfile"
+  echo >> "$depfile" # make sure the fragment doesn't end with a backslash
   rm -f "$tmpdepfile"
   ;;
 
@@ -524,13 +604,14 @@ dashmstdout)
   # in the target name.  This is to cope with DOS-style filenames:
   # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
   "$@" $dashmflag |
-    sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile"
+    sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
   rm -f "$depfile"
   cat < "$tmpdepfile" > "$depfile"
-  tr ' ' "$nl" < "$tmpdepfile" | \
-## Some versions of the HPUX 10.20 sed can't process this invocation
-## correctly.  Breaking it into two sed invocations is a workaround.
-    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  # Some versions of the HPUX 10.20 sed can't process this sed invocation
+  # correctly.  Breaking it into two sed invocations is a workaround.
+  tr ' ' "$nl" < "$tmpdepfile" \
+    | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
+    | sed -e 's/$/ :/' >> "$depfile"
   rm -f "$tmpdepfile"
   ;;
 
@@ -583,10 +664,12 @@ makedepend)
   # makedepend may prepend the VPATH from the source file name to the object.
   # No need to regex-escape $object, excess matching of '.' is harmless.
   sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
-  sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \
-## Some versions of the HPUX 10.20 sed can't process this invocation
-## correctly.  Breaking it into two sed invocations is a workaround.
-    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  # Some versions of the HPUX 10.20 sed can't process the last invocation
+  # correctly.  Breaking it into two sed invocations is a workaround.
+  sed '1,2d' "$tmpdepfile" \
+    | tr ' ' "$nl" \
+    | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
+    | sed -e 's/$/ :/' >> "$depfile"
   rm -f "$tmpdepfile" "$tmpdepfile".bak
   ;;
 
@@ -622,10 +705,10 @@ cpp)
     esac
   done
 
-  "$@" -E |
-    sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-       -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
-    sed '$ s: \\$::' > "$tmpdepfile"
+  "$@" -E \
+    | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+             -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+    | sed '$ s: \\$::' > "$tmpdepfile"
   rm -f "$depfile"
   echo "$object : \\" > "$depfile"
   cat < "$tmpdepfile" >> "$depfile"
@@ -657,15 +740,15 @@ msvisualcpp)
       shift
       ;;
     "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
-	set fnord "$@"
-	shift
-	shift
-	;;
+        set fnord "$@"
+        shift
+        shift
+        ;;
     *)
-	set fnord "$@" "$arg"
-	shift
-	shift
-	;;
+        set fnord "$@" "$arg"
+        shift
+        shift
+        ;;
     esac
   done
   "$@" -E 2>/dev/null |
@@ -700,9 +783,9 @@ exit 0
 # Local Variables:
 # mode: shell-script
 # sh-indentation: 2
-# eval: (add-hook 'write-file-hooks 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
+# time-stamp-time-zone: "UTC0"
 # time-stamp-end: "; # UTC"
 # End:
diff --git a/install-sh b/install-sh
index a9244eb0786534553fdd9eb0050bb4b172bad0a3..ec298b53740270ce82b326c4c2deaa5dcdec4596 100755
--- a/install-sh
+++ b/install-sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 # install - install a program, script, or datafile
 
-scriptversion=2011-01-19.21; # UTC
+scriptversion=2020-11-14.01; # UTC
 
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
@@ -35,25 +35,21 @@ scriptversion=2011-01-19.21; # UTC
 # FSF changes to this file are in the public domain.
 #
 # Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
+# 'make' implicit rules from creating a file called install from it
 # when there is no Makefile.
 #
 # 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,22 +64,16 @@ 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.
 mode=0755
 
+# Create dirs (including intermediate dirs) using mode 755.
+# This is like GNU 'install' as of coreutils 8.32 (2020).
+mkdir_umask=22
+
+backupsuffix=
 chgrpcmd=
 chmodcmd=$chmodprog
 chowncmd=
@@ -97,7 +87,7 @@ dir_arg=
 dst_arg=
 
 copy_on_change=false
-no_target_directory=
+is_target_a_directory=possibly
 
 usage="\
 Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
@@ -114,18 +104,28 @@ Options:
      --version  display version info and exit.
 
   -c            (ignored)
-  -C            install only if different (preserve the last data modification time)
+  -C            install only if different (preserve data modification time)
   -d            create directories instead of installing files.
   -g GROUP      $chgrpprog installed files to GROUP.
   -m MODE       $chmodprog installed files to MODE.
   -o USER       $chownprog installed files to USER.
+  -p            pass -p to $cpprog.
   -s            $stripprog installed files.
+  -S SUFFIX     attempt to back up existing files, with suffix SUFFIX.
   -t DIRECTORY  install into DIRECTORY.
   -T            report an error if DSTFILE is a directory.
 
 Environment variables override the default commands:
   CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
   RMPROG STRIPPROG
+
+By default, rm is invoked with -f; when overridden with RMPROG,
+it's up to you to specify -f if you want it.
+
+If -S is not specified, no backups are attempted.
+
+Email bug reports to bug-automake@gnu.org.
+Automake home page: https://www.gnu.org/software/automake/
 "
 
 while test $# -ne 0; do
@@ -137,46 +137,62 @@ 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;;
+
+    -p) cpprog="$cpprog -p";;
 
     -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;;
+    -S) backupsuffix="$2"
+        shift;;
 
-    -T) no_target_directory=true;;
+    -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) 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.
@@ -190,7 +206,7 @@ if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
     fi
     shift # arg
     dst_arg=$arg
-    # Protect names problematic for `test' and other utilities.
+    # Protect names problematic for 'test' and other utilities.
     case $dst_arg in
       -* | [=\(\)!]) dst_arg=./$dst_arg;;
     esac
@@ -202,11 +218,20 @@ if test $# -eq 0; then
     echo "$0: no input file specified." >&2
     exit 1
   fi
-  # It's OK to call `install-sh -d' without argument.
+  # It's OK to call 'install-sh -d' without argument.
   # This can happen when creating conditional directories.
   exit 0
 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
@@ -223,16 +248,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
@@ -240,7 +265,7 @@ fi
 
 for src
 do
-  # Protect names problematic for `test' and other utilities.
+  # Protect names problematic for 'test' and other utilities.
   case $src in
     -* | [=\(\)!]) src=./$src;;
   esac
@@ -250,6 +275,10 @@ do
     dstdir=$dst
     test -d "$dstdir"
     dstdir_status=$?
+    # Don't chown directories that already exist.
+    if test $dstdir_status = 0; then
+      chowncmd=""
+    fi
   else
 
     # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
@@ -266,178 +295,148 @@ do
     fi
     dst=$dst_arg
 
-    # If destination is a directory, append the input filename; won't work
-    # if double slashes aren't ignored.
+    # If destination is a directory, append the input filename.
     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"`
+      dstbase=`basename "$src"`
+      case $dst in
+	*/) dst=$dst$dstbase;;
+	*)  dst=$dst/$dstbase;;
+      esac
       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
   fi
 
+  case $dstdir in
+    */) dstdirslash=$dstdir;;
+    *)  dstdirslash=$dstdir/;;
+  esac
+
   obsolete_mkdir_used=false
 
   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
+        # 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
+	# The $RANDOM variable is not portable (e.g., dash).  Use it
+	# here however when possible just to lower collision chance.
+	tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+
+	trap '
+	  ret=$?
+	  rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null
+	  exit $ret
+	' 0
+
+	# Because "mkdir -p" follows existing symlinks and we likely work
+	# directly in world-writeable /tmp, make sure that the '$tmpdir'
+	# directory is successfully created first before we actually test
+	# 'mkdir -p'.
+	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
-	  mkdir_mode=
+	  # Remove any dirs left behind by ancient mkdir implementations.
+	  rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
 	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.
-	    ;;
-	  *)
-	    tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
-	    trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
-
-	    if (umask $mkdir_umask &&
-		exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/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-writeable bit of parent directory when it shouldn't.
-		   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
-		   ls_ld_tmpdir=`ls -ld "$tmpdir"`
-		   case $ls_ld_tmpdir in
-		     d????-?r-*) different_mode=700;;
-		     d????-?--*) different_mode=755;;
-		     *) false;;
-		   esac &&
-		   $mkdirprog -m$different_mode -p -- "$tmpdir" && {
-		     ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
-		     test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
-		   }
-		 }
-	      then posix_mkdir=:
-	      fi
-	      rmdir "$tmpdir/d" "$tmpdir"
-	    else
-	      # Remove any dirs left behind by ancient mkdir implementations.
-	      rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
-	    fi
-	    trap '' 0;;
-	esac;;
+	trap '' 0;;
     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
 
-      # The umask is ridiculous, or mkdir does not conform to POSIX,
+      # mkdir does not conform to POSIX,
       # or it failed possibly due to a race condition.  Create the
       # 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
@@ -450,14 +449,25 @@ do
   else
 
     # Make a couple of temp file names in the proper directory.
-    dsttmp=$dstdir/_inst.$$_
-    rmtmp=$dstdir/_rm.$$_
+    dsttmp=${dstdirslash}_inst.$$_
+    rmtmp=${dstdirslash}_rm.$$_
 
     # Trap to clean up those temp files at exit.
     trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
 
     # Copy the file name to the temp name.
-    (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
+    (umask $cp_umask &&
+     { test -z "$stripcmd" || {
+	 # Create $dsttmp read-write so that cp doesn't create it read-only,
+	 # which would cause strip to fail.
+	 if test -z "$doit"; then
+	   : >"$dsttmp" # No need to fork-exec 'touch'.
+	 else
+	   $doit touch "$dsttmp"
+	 fi
+       }
+     } &&
+     $doit_exec $cpprog "$src" "$dsttmp") &&
 
     # and set any options; do chmod last to preserve setuid bits.
     #
@@ -472,20 +482,24 @@ 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
       rm -f "$dsttmp"
     else
+      # If $backupsuffix is set, and the file being installed
+      # already exists, attempt a backup.  Don't worry if it fails,
+      # e.g., if mv doesn't support -f.
+      if test -n "$backupsuffix" && test -f "$dst"; then
+        $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null
+      fi
+
       # Rename the file to the real destination.
       $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
 
@@ -493,24 +507,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 "$dst" 2>/dev/null ||
+          { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+            { $doit $rmcmd "$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
 
@@ -519,9 +533,9 @@ do
 done
 
 # Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
+# time-stamp-time-zone: "UTC0"
 # time-stamp-end: "; # UTC"
 # End:
diff --git a/missing b/missing
index 86a8fc31e3c2aa268688a5be47d161c586772e78..8d0eaad250fc1ea8f3728338c1b016596cedfc60 100755
--- a/missing
+++ b/missing
@@ -1,11 +1,10 @@
 #! /bin/sh
-# Common stub for a few missing GNU programs while installing.
+# Common wrapper for a few potentially missing GNU programs.
 
-scriptversion=2012-01-06.13; # UTC
+scriptversion=2018-03-07.03; # UTC
 
-# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
-# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
-# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
+# Copyright (C) 1996-2020 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
 # it under the terms of the GNU General Public License as published by
@@ -18,7 +17,7 @@ scriptversion=2012-01-06.13; # UTC
 # 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/>.
+# along with this program.  If not, see <https://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
@@ -26,68 +25,40 @@ scriptversion=2012-01-06.13; # UTC
 # the same distribution terms that you use for the rest of that program.
 
 if test $# -eq 0; then
-  echo 1>&2 "Try \`$0 --help' for more information"
+  echo 1>&2 "Try '$0 --help' for more information"
   exit 1
 fi
 
-run=:
-sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
-sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
-
-# In the cases where this matters, `missing' is being run in the
-# srcdir already.
-if test -f configure.ac; then
-  configure_ac=configure.ac
-else
-  configure_ac=configure.in
-fi
+case $1 in
 
-msg="missing on your system"
+  --is-lightweight)
+    # Used by our autoconf macros to check whether the available missing
+    # script is modern enough.
+    exit 0
+    ;;
 
-case $1 in
---run)
-  # Try to run requested program, and just exit if it succeeds.
-  run=
-  shift
-  "$@" && exit 0
-  # Exit code 63 means version mismatch.  This often happens
-  # when the user try to use an ancient version of a tool on
-  # a file that requires a minimum version.  In this case we
-  # we should proceed has if the program had been absent, or
-  # if --run hadn't been passed.
-  if test $? = 63; then
-    run=:
-    msg="probably too old"
-  fi
-  ;;
+  --run)
+    # Back-compat with the calling convention used by older automake.
+    shift
+    ;;
 
   -h|--h|--he|--hel|--help)
     echo "\
 $0 [OPTION]... PROGRAM [ARGUMENT]...
 
-Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
-error status if there is no known handling for PROGRAM.
+Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
+to PROGRAM being missing or too old.
 
 Options:
   -h, --help      display this help and exit
   -v, --version   output version information and exit
-  --run           try to run the given command, and emulate it if it fails
 
 Supported PROGRAM values:
-  aclocal      touch file \`aclocal.m4'
-  autoconf     touch file \`configure'
-  autoheader   touch file \`config.h.in'
-  autom4te     touch the output file, or create a stub one
-  automake     touch all \`Makefile.in' files
-  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
-  flex         create \`lex.yy.c', if possible, from existing .c
-  help2man     touch the output file
-  lex          create \`lex.yy.c', if possible, from existing .c
-  makeinfo     touch the output file
-  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
+  aclocal   autoconf  autoheader   autom4te  automake  makeinfo
+  bison     yacc      flex         lex       help2man
 
-Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
-\`g' are ignored when checking the name.
+Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
+'g' are ignored when checking the name.
 
 Send bug reports to <bug-automake@gnu.org>."
     exit $?
@@ -99,233 +70,146 @@ Send bug reports to <bug-automake@gnu.org>."
     ;;
 
   -*)
-    echo 1>&2 "$0: Unknown \`$1' option"
-    echo 1>&2 "Try \`$0 --help' for more information"
+    echo 1>&2 "$0: unknown '$1' option"
+    echo 1>&2 "Try '$0 --help' for more information"
     exit 1
     ;;
 
 esac
 
-# normalize program name to check for.
-program=`echo "$1" | sed '
-  s/^gnu-//; t
-  s/^gnu//; t
-  s/^g//; t'`
-
-# Now exit if we have it, but it failed.  Also exit now if we
-# don't have it and --version was passed (most likely to detect
-# the program).  This is about non-GNU programs, so use $1 not
-# $program.
-case $1 in
-  lex*|yacc*)
-    # Not GNU programs, they don't have --version.
-    ;;
-
-  *)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
-       # Could not run --version or --help.  This is probably someone
-       # running `$TOOL --version' or `$TOOL --help' to check whether
-       # $TOOL exists and not knowing $TOOL uses missing.
-       exit 1
-    fi
-    ;;
-esac
-
-# If it does not exist, or fails to run (possibly an outdated version),
-# try to emulate it.
-case $program in
-  aclocal*)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
-         to install the \`Automake' and \`Perl' packages.  Grab them from
-         any GNU archive site."
-    touch aclocal.m4
-    ;;
-
-  autoconf*)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified \`${configure_ac}'.  You might want to install the
-         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
-         archive site."
-    touch configure
-    ;;
-
-  autoheader*)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
-         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
-         from any GNU archive site."
-    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
-    test -z "$files" && files="config.h"
-    touch_files=
-    for f in $files; do
-      case $f in
-      *:*) touch_files="$touch_files "`echo "$f" |
-				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
-      *) touch_files="$touch_files $f.in";;
-      esac
-    done
-    touch $touch_files
-    ;;
-
-  automake*)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
-         You might want to install the \`Automake' and \`Perl' packages.
-         Grab them from any GNU archive site."
-    find . -type f -name Makefile.am -print |
-	   sed 's/\.am$/.in/' |
-	   while read f; do touch "$f"; done
-    ;;
-
-  autom4te*)
-    echo 1>&2 "\
-WARNING: \`$1' is needed, but is $msg.
-         You might have modified some files without having the
-         proper tools for further handling them.
-         You can get \`$1' as part of \`Autoconf' from any GNU
-         archive site."
-
-    file=`echo "$*" | sed -n "$sed_output"`
-    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
-    if test -f "$file"; then
-	touch $file
-    else
-	test -z "$file" || exec >$file
-	echo "#! /bin/sh"
-	echo "# Created by GNU Automake missing as a replacement of"
-	echo "#  $ $@"
-	echo "exit 0"
-	chmod +x $file
-	exit 1
-    fi
-    ;;
-
-  bison*|yacc*)
-    echo 1>&2 "\
-WARNING: \`$1' $msg.  You should only need it if
-         you modified a \`.y' file.  You may need the \`Bison' package
-         in order for those modifications to take effect.  You can get
-         \`Bison' from any GNU archive site."
-    rm -f y.tab.c y.tab.h
-    if test $# -ne 1; then
-        eval LASTARG=\${$#}
-	case $LASTARG in
-	*.y)
-	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
-	    if test -f "$SRCFILE"; then
-	         cp "$SRCFILE" y.tab.c
-	    fi
-	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
-	    if test -f "$SRCFILE"; then
-	         cp "$SRCFILE" y.tab.h
-	    fi
-	  ;;
-	esac
-    fi
-    if test ! -f y.tab.h; then
-	echo >y.tab.h
-    fi
-    if test ! -f y.tab.c; then
-	echo 'main() { return 0; }' >y.tab.c
-    fi
-    ;;
-
-  lex*|flex*)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified a \`.l' file.  You may need the \`Flex' package
-         in order for those modifications to take effect.  You can get
-         \`Flex' from any GNU archive site."
-    rm -f lex.yy.c
-    if test $# -ne 1; then
-        eval LASTARG=\${$#}
-	case $LASTARG in
-	*.l)
-	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
-	    if test -f "$SRCFILE"; then
-	         cp "$SRCFILE" lex.yy.c
-	    fi
-	  ;;
-	esac
-    fi
-    if test ! -f lex.yy.c; then
-	echo 'main() { return 0; }' >lex.yy.c
-    fi
-    ;;
-
-  help2man*)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-	 you modified a dependency of a manual page.  You may need the
-	 \`Help2man' package in order for those modifications to take
-	 effect.  You can get \`Help2man' from any GNU archive site."
-
-    file=`echo "$*" | sed -n "$sed_output"`
-    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
-    if test -f "$file"; then
-	touch $file
-    else
-	test -z "$file" || exec >$file
-	echo ".ab help2man is required to generate this page"
-	exit $?
-    fi
-    ;;
-
-  makeinfo*)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified a \`.texi' or \`.texinfo' file, or any other file
-         indirectly affecting the aspect of the manual.  The spurious
-         call might also be the consequence of using a buggy \`make' (AIX,
-         DU, IRIX).  You might want to install the \`Texinfo' package or
-         the \`GNU make' package.  Grab either from any GNU archive site."
-    # The file to touch is that specified with -o ...
-    file=`echo "$*" | sed -n "$sed_output"`
-    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
-    if test -z "$file"; then
-      # ... or it is the one specified with @setfilename ...
-      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
-      file=`sed -n '
-	/^@setfilename/{
-	  s/.* \([^ ]*\) *$/\1/
-	  p
-	  q
-	}' $infile`
-      # ... or it is derived from the source name (dir/f.texi becomes f.info)
-      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
-    fi
-    # If the file does not exist, the user really needs makeinfo;
-    # let's fail without touching anything.
-    test -f $file || exit 1
-    touch $file
-    ;;
+# Run the given program, remember its exit status.
+"$@"; st=$?
+
+# If it succeeded, we are done.
+test $st -eq 0 && exit 0
+
+# Also exit now if we it failed (or wasn't found), and '--version' was
+# passed; such an option is passed most likely to detect whether the
+# program is present and works.
+case $2 in --version|--help) exit $st;; esac
+
+# Exit code 63 means version mismatch.  This often happens when the user
+# tries to use an ancient version of a tool on a file that requires a
+# minimum version.
+if test $st -eq 63; then
+  msg="probably too old"
+elif test $st -eq 127; then
+  # Program was missing.
+  msg="missing on your system"
+else
+  # Program was found and executed, but failed.  Give up.
+  exit $st
+fi
 
-  *)
-    echo 1>&2 "\
-WARNING: \`$1' is needed, and is $msg.
-         You might have modified some files without having the
-         proper tools for further handling them.  Check the \`README' file,
-         it often tells you about the needed prerequisites for installing
-         this package.  You may also peek at any GNU archive site, in case
-         some other package would contain this missing \`$1' program."
-    exit 1
+perl_URL=https://www.perl.org/
+flex_URL=https://github.com/westes/flex
+gnu_software_URL=https://www.gnu.org/software
+
+program_details ()
+{
+  case $1 in
+    aclocal|automake)
+      echo "The '$1' program is part of the GNU Automake package:"
+      echo "<$gnu_software_URL/automake>"
+      echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
+      echo "<$gnu_software_URL/autoconf>"
+      echo "<$gnu_software_URL/m4/>"
+      echo "<$perl_URL>"
+      ;;
+    autoconf|autom4te|autoheader)
+      echo "The '$1' program is part of the GNU Autoconf package:"
+      echo "<$gnu_software_URL/autoconf/>"
+      echo "It also requires GNU m4 and Perl in order to run:"
+      echo "<$gnu_software_URL/m4/>"
+      echo "<$perl_URL>"
+      ;;
+  esac
+}
+
+give_advice ()
+{
+  # Normalize program name to check for.
+  normalized_program=`echo "$1" | sed '
+    s/^gnu-//; t
+    s/^gnu//; t
+    s/^g//; t'`
+
+  printf '%s\n' "'$1' is $msg."
+
+  configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
+  case $normalized_program in
+    autoconf*)
+      echo "You should only need it if you modified 'configure.ac',"
+      echo "or m4 files included by it."
+      program_details 'autoconf'
+      ;;
+    autoheader*)
+      echo "You should only need it if you modified 'acconfig.h' or"
+      echo "$configure_deps."
+      program_details 'autoheader'
+      ;;
+    automake*)
+      echo "You should only need it if you modified 'Makefile.am' or"
+      echo "$configure_deps."
+      program_details 'automake'
+      ;;
+    aclocal*)
+      echo "You should only need it if you modified 'acinclude.m4' or"
+      echo "$configure_deps."
+      program_details 'aclocal'
+      ;;
+   autom4te*)
+      echo "You might have modified some maintainer files that require"
+      echo "the 'autom4te' program to be rebuilt."
+      program_details 'autom4te'
+      ;;
+    bison*|yacc*)
+      echo "You should only need it if you modified a '.y' file."
+      echo "You may want to install the GNU Bison package:"
+      echo "<$gnu_software_URL/bison/>"
+      ;;
+    lex*|flex*)
+      echo "You should only need it if you modified a '.l' file."
+      echo "You may want to install the Fast Lexical Analyzer package:"
+      echo "<$flex_URL>"
+      ;;
+    help2man*)
+      echo "You should only need it if you modified a dependency" \
+           "of a man page."
+      echo "You may want to install the GNU Help2man package:"
+      echo "<$gnu_software_URL/help2man/>"
     ;;
-esac
-
-exit 0
+    makeinfo*)
+      echo "You should only need it if you modified a '.texi' file, or"
+      echo "any other file indirectly affecting the aspect of the manual."
+      echo "You might want to install the Texinfo package:"
+      echo "<$gnu_software_URL/texinfo/>"
+      echo "The spurious makeinfo call might also be the consequence of"
+      echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
+      echo "want to install GNU make:"
+      echo "<$gnu_software_URL/make/>"
+      ;;
+    *)
+      echo "You might have modified some files without having the proper"
+      echo "tools for further handling them.  Check the 'README' file, it"
+      echo "often tells you about the needed prerequisites for installing"
+      echo "this package.  You may also peek at any GNU archive site, in"
+      echo "case some other package contains this missing '$1' program."
+      ;;
+  esac
+}
+
+give_advice "$1" | sed -e '1s/^/WARNING: /' \
+                       -e '2,$s/^/         /' >&2
+
+# Propagate the correct exit status (expected to be 127 for a program
+# not found, 63 for a program that failed due to version mismatch).
+exit $st
 
 # Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
+# time-stamp-time-zone: "UTC0"
 # time-stamp-end: "; # UTC"
 # End:
diff --git a/src/Makefile.am b/src/Makefile.am
index 139355e5b7e9d3a067e6366b49d9807a383bcf42..173246535de4c8058a5f61ffbc3df569a44ec556 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2,12 +2,10 @@ AM_YFLAGS = -d
 
 COMMON_CFLAGS = -Wall
 COMMON_CPPFLAGS = \
-	-include $(top_builddir)/config.h \
-	-DBSD=1 -DSHELL \
-	-DIFS_BROKEN
+	-DBSD=1 -DSHELL
 
 AM_CFLAGS = $(COMMON_CFLAGS)
-AM_CPPFLAGS = $(COMMON_CPPFLAGS)
+AM_CPPFLAGS = -include $(top_builddir)/config.h $(COMMON_CPPFLAGS)
 AM_CFLAGS_FOR_BUILD = -g -O2 $(COMMON_CFLAGS) 
 AM_CPPFLAGS_FOR_BUILD = $(COMMON_CPPFLAGS)
 
@@ -46,27 +44,27 @@ EXTRA_DIST = \
 	mknodes.c nodetypes nodes.c.pat mksyntax.c mksignames.c
 
 token.h token_vars.h: mktokens
-	$(SHELL) $^
+	$(AM_V_GEN)$(SHELL) $^
 
 builtins.def: builtins.def.in $(top_builddir)/config.h
-	$(COMPILE) -E -x c -o $@ $<
+	$(AM_V_CC)$(COMPILE) -E -x c -o $@ $<
 
 builtins.c builtins.h: mkbuiltins builtins.def
-	$(SHELL) $^
+	$(AM_V_GEN)$(SHELL) $^
 
 init.c: mkinit $(dash_CFILES)
-	./$^
+	$(AM_V_GEN)./$^
 
 nodes.c nodes.h: mknodes nodetypes nodes.c.pat
-	./$^
+	$(AM_V_GEN)./$^
 
 syntax.c syntax.h: mksyntax
-	./$^
+	$(AM_V_GEN)./$^
 
 signames.c: mksignames
-	./$^
+	$(AM_V_GEN)./$^
 
 mksyntax: token.h
 
 $(HELPERS): %: %.c
-	$(COMPILE_FOR_BUILD) -o $@ $<
+	$(AM_V_CC)$(COMPILE_FOR_BUILD) -o $@ $<
diff --git a/src/Makefile.in b/src/Makefile.in
index 059c6e11c25938699ac08732faa8214ba30c41f6..967b2751c8d5757fee1ffbaa63d5ca6f5ca521fc 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.16.3 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1994-2020 Free Software Foundation, Inc.
+
 # This Makefile.in 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.
@@ -16,23 +15,61 @@
 @SET_MAKE@
 
 VPATH = @srcdir@
-am__make_dryrun = \
-  { \
-    am__dry=no; \
+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 \
+      ?) ;; \
+      *) echo "am__make_running_with_option: internal error: invalid" \
+              "target option '$${target_option-}' specified" >&2; \
+         exit 1;; \
+  esac; \
+  has_opt=no; \
+  sane_makeflags=$$MAKEFLAGS; \
+  if $(am__is_gnu_make); then \
+    sane_makeflags=$$MFLAGS; \
+  else \
     case $$MAKEFLAGS in \
       *\\[\ \	]*) \
-        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
-          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
-      *) \
-        for am__flg in $$MAKEFLAGS; do \
-          case $$am__flg in \
-            *=*|--*) ;; \
-            *n*) am__dry=yes; break;; \
-          esac; \
-        done;; \
+        bs=\\; \
+        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+          | sed "s/$$bs$$bs[$$bs $$bs	]*//g"`;; \
     esac; \
-    test $$am__dry = yes; \
-  }
+  fi; \
+  skip_next=no; \
+  strip_trailopt () \
+  { \
+    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+  }; \
+  for flg in $$sane_makeflags; do \
+    test $$skip_next = yes && { skip_next=no; continue; }; \
+    case $$flg in \
+      *=*|--*) continue;; \
+        -*I) strip_trailopt 'I'; skip_next=yes;; \
+      -*I?*) strip_trailopt 'I';; \
+        -*O) strip_trailopt 'O'; skip_next=yes;; \
+      -*O?*) strip_trailopt 'O';; \
+        -*l) strip_trailopt 'l'; skip_next=yes;; \
+      -*l?*) strip_trailopt 'l';; \
+      -[dEDm]) skip_next=yes;; \
+      -[JT]) skip_next=yes;; \
+    esac; \
+    case $$flg in \
+      *$$target_option*) has_opt=yes; break;; \
+    esac; \
+  done; \
+  test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -51,11 +88,11 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 bin_PROGRAMS = dash$(EXEEXT)
 subdir = src
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(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)/config.h
 CONFIG_CLEAN_FILES =
@@ -75,14 +112,46 @@ am__objects_1 = alias.$(OBJEXT) arith_yacc.$(OBJEXT) \
 am_dash_OBJECTS = $(am__objects_1)
 dash_OBJECTS = $(am_dash_OBJECTS)
 dash_DEPENDENCIES = builtins.o init.o nodes.o signames.o syntax.o
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo "  GEN     " $@;
+am__v_GEN_1 = 
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 = 
 DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
+am__maybe_remake_depfiles = depfiles
+am__depfiles_remade = ./$(DEPDIR)/alias.Po ./$(DEPDIR)/arith_yacc.Po \
+	./$(DEPDIR)/arith_yylex.Po ./$(DEPDIR)/cd.Po \
+	./$(DEPDIR)/error.Po ./$(DEPDIR)/eval.Po ./$(DEPDIR)/exec.Po \
+	./$(DEPDIR)/expand.Po ./$(DEPDIR)/histedit.Po \
+	./$(DEPDIR)/input.Po ./$(DEPDIR)/jobs.Po ./$(DEPDIR)/mail.Po \
+	./$(DEPDIR)/main.Po ./$(DEPDIR)/memalloc.Po \
+	./$(DEPDIR)/miscbltin.Po ./$(DEPDIR)/mystring.Po \
+	./$(DEPDIR)/options.Po ./$(DEPDIR)/output.Po \
+	./$(DEPDIR)/parser.Po ./$(DEPDIR)/redir.Po ./$(DEPDIR)/show.Po \
+	./$(DEPDIR)/system.Po ./$(DEPDIR)/trap.Po ./$(DEPDIR)/var.Po \
+	bltin/$(DEPDIR)/printf.Po bltin/$(DEPDIR)/test.Po \
+	bltin/$(DEPDIR)/times.Po
 am__mv = mv -f
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo "  CC      " $@;
+am__v_CC_1 = 
 CCLD = $(CC)
 LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo "  CCLD    " $@;
+am__v_CCLD_1 = 
 SOURCES = $(dash_SOURCES)
 DIST_SOURCES = $(dash_SOURCES)
 am__can_run_installinfo = \
@@ -120,11 +189,30 @@ am__uninstall_files_from_dir = { \
 man1dir = $(mandir)/man1
 NROFF = nroff
 MANS = $(man_MANS)
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates.  Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+  BEGIN { nonempty = 0; } \
+  { items[$$0] = 1; nonempty = 1; } \
+  END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique.  This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+  list='$(am__tagged_files)'; \
+  unique=`for i in $$list; do \
+    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+  done | $(am__uniquify_input)`
 ETAGS = etags
 CTAGS = ctags
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
@@ -168,8 +256,6 @@ SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
 VERSION = @VERSION@
-YACC = @YACC@
-YFLAGS = @YFLAGS@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
@@ -204,6 +290,7 @@ pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
+runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
@@ -215,12 +302,10 @@ top_srcdir = @top_srcdir@
 AM_YFLAGS = -d
 COMMON_CFLAGS = -Wall
 COMMON_CPPFLAGS = \
-	-include $(top_builddir)/config.h \
-	-DBSD=1 -DSHELL \
-	-DIFS_BROKEN
+	-DBSD=1 -DSHELL
 
 AM_CFLAGS = $(COMMON_CFLAGS)
-AM_CPPFLAGS = $(COMMON_CPPFLAGS)
+AM_CPPFLAGS = -include $(top_builddir)/config.h $(COMMON_CPPFLAGS)
 AM_CFLAGS_FOR_BUILD = -g -O2 $(COMMON_CFLAGS) 
 AM_CPPFLAGS_FOR_BUILD = $(COMMON_CPPFLAGS)
 COMPILE_FOR_BUILD = \
@@ -272,14 +357,13 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	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*) \
 	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
 	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
 	esac;
 
 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@@ -299,10 +383,11 @@ install-binPROGRAMS: $(bin_PROGRAMS)
 	fi; \
 	for p in $$list; do echo "$$p $$p"; done | \
 	sed 's/$(EXEEXT)$$//' | \
-	while read p p1; do if test -f $$p; \
-	  then echo "$$p"; echo "$$p"; else :; fi; \
+	while read p p1; do if test -f $$p \
+	  ; then echo "$$p"; echo "$$p"; else :; fi; \
 	done | \
-	sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+	sed -e 'p;s,.*/,,;n;h' \
+	    -e 's|.*|.|' \
 	    -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
 	sed 'N;N;N;s,\n, ,g' | \
 	$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
@@ -323,7 +408,8 @@ uninstall-binPROGRAMS:
 	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
 	files=`for p in $$list; do echo "$$p"; done | \
 	  sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
-	      -e 's/$$/$(EXEEXT)/' `; \
+	      -e 's/$$/$(EXEEXT)/' \
+	`; \
 	test -n "$$list" || exit 0; \
 	echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
 	cd "$(DESTDIR)$(bindir)" && rm -f $$files
@@ -342,62 +428,67 @@ bltin/test.$(OBJEXT): bltin/$(am__dirstamp) \
 	bltin/$(DEPDIR)/$(am__dirstamp)
 bltin/times.$(OBJEXT): bltin/$(am__dirstamp) \
 	bltin/$(DEPDIR)/$(am__dirstamp)
+
 dash$(EXEEXT): $(dash_OBJECTS) $(dash_DEPENDENCIES) $(EXTRA_dash_DEPENDENCIES) 
 	@rm -f dash$(EXEEXT)
-	$(LINK) $(dash_OBJECTS) $(dash_LDADD) $(LIBS)
+	$(AM_V_CCLD)$(LINK) $(dash_OBJECTS) $(dash_LDADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
-	-rm -f bltin/printf.$(OBJEXT)
-	-rm -f bltin/test.$(OBJEXT)
-	-rm -f bltin/times.$(OBJEXT)
+	-rm -f bltin/*.$(OBJEXT)
 
 distclean-compile:
 	-rm -f *.tab.c
 
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alias.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arith_yacc.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arith_yylex.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cd.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eval.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exec.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/expand.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/histedit.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/input.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jobs.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mail.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memalloc.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/miscbltin.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mystring.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/options.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/output.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parser.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/redir.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/show.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/system.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trap.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/var.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@bltin/$(DEPDIR)/printf.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@bltin/$(DEPDIR)/test.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@bltin/$(DEPDIR)/times.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alias.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arith_yacc.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arith_yylex.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cd.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eval.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exec.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/expand.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/histedit.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/input.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jobs.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mail.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memalloc.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/miscbltin.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mystring.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/options.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/output.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parser.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/redir.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/show.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/system.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trap.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/var.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@bltin/$(DEPDIR)/printf.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@bltin/$(DEPDIR)/test.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@bltin/$(DEPDIR)/times.Po@am__quote@ # am--include-marker
+
+$(am__depfiles_remade):
+	@$(MKDIR_P) $(@D)
+	@echo '# dummy' >$@-t && $(am__mv) $@-t $@
+
+am--depfiles: $(am__depfiles_remade)
 
 .c.o:
-@am__fastdepCC_TRUE@	depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+@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@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@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@	$(COMPILE) -c -o $@ $<
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
 
 .c.obj:
-@am__fastdepCC_TRUE@	depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+@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@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@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@	$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 install-man1: $(man_MANS)
 	@$(NORMAL_INSTALL)
 	@list1=''; \
@@ -442,26 +533,15 @@ uninstall-man1:
 	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
 	dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir)
 
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
-	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	mkid -fID $$unique
-tags: TAGS
-
-TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
+ID: $(am__tagged_files)
+	$(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
 	set x; \
 	here=`pwd`; \
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	$(am__define_uniq_tagged_files); \
 	shift; \
 	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
@@ -473,15 +553,11 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	      $$unique; \
 	  fi; \
 	fi
-ctags: CTAGS
-CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+	$(am__define_uniq_tagged_files); \
 	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$unique
@@ -490,24 +566,29 @@ GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
 	  && $(am__cd) $(top_srcdir) \
 	  && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+	list='$(am__tagged_files)'; \
+	case "$(srcdir)" in \
+	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+	  *) sdir=$(subdir)/$(srcdir) ;; \
+	esac; \
+	for i in $$list; do \
+	  if test -f "$$i"; then \
+	    echo "$(subdir)/$$i"; \
+	  else \
+	    echo "$$sdir/$$i"; \
+	  fi; \
+	done >> $(top_builddir)/cscope.files
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 
-distdir: $(DISTFILES)
-	@list='$(MANS)'; if test -n "$$list"; then \
-	  list=`for p in $$list; do \
-	    if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
-	    if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \
-	  if test -n "$$list" && \
-	    grep 'ab help2man is required to generate this page' $$list >/dev/null; then \
-	    echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \
-	    grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/         /' >&2; \
-	    echo "       to fix them, install help2man, remove and regenerate the man pages;" >&2; \
-	    echo "       typically \`make maintainer-clean' will remove them" >&2; \
-	    exit 1; \
-	  else :; fi; \
-	else :; fi
+distdir: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \
@@ -547,7 +628,8 @@ installdirs:
 	done
 install: $(BUILT_SOURCES)
 	$(MAKE) $(AM_MAKEFLAGS) install-am
-install-exec: install-exec-am
+install-exec: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) install-exec-am
 install-data: install-data-am
 uninstall: uninstall-am
 
@@ -585,7 +667,33 @@ clean: clean-am
 clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
 
 distclean: distclean-am
-	-rm -rf ./$(DEPDIR) bltin/$(DEPDIR)
+		-rm -f ./$(DEPDIR)/alias.Po
+	-rm -f ./$(DEPDIR)/arith_yacc.Po
+	-rm -f ./$(DEPDIR)/arith_yylex.Po
+	-rm -f ./$(DEPDIR)/cd.Po
+	-rm -f ./$(DEPDIR)/error.Po
+	-rm -f ./$(DEPDIR)/eval.Po
+	-rm -f ./$(DEPDIR)/exec.Po
+	-rm -f ./$(DEPDIR)/expand.Po
+	-rm -f ./$(DEPDIR)/histedit.Po
+	-rm -f ./$(DEPDIR)/input.Po
+	-rm -f ./$(DEPDIR)/jobs.Po
+	-rm -f ./$(DEPDIR)/mail.Po
+	-rm -f ./$(DEPDIR)/main.Po
+	-rm -f ./$(DEPDIR)/memalloc.Po
+	-rm -f ./$(DEPDIR)/miscbltin.Po
+	-rm -f ./$(DEPDIR)/mystring.Po
+	-rm -f ./$(DEPDIR)/options.Po
+	-rm -f ./$(DEPDIR)/output.Po
+	-rm -f ./$(DEPDIR)/parser.Po
+	-rm -f ./$(DEPDIR)/redir.Po
+	-rm -f ./$(DEPDIR)/show.Po
+	-rm -f ./$(DEPDIR)/system.Po
+	-rm -f ./$(DEPDIR)/trap.Po
+	-rm -f ./$(DEPDIR)/var.Po
+	-rm -f bltin/$(DEPDIR)/printf.Po
+	-rm -f bltin/$(DEPDIR)/test.Po
+	-rm -f bltin/$(DEPDIR)/times.Po
 	-rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
 	distclean-tags
@@ -631,7 +739,33 @@ install-ps-am:
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
-	-rm -rf ./$(DEPDIR) bltin/$(DEPDIR)
+		-rm -f ./$(DEPDIR)/alias.Po
+	-rm -f ./$(DEPDIR)/arith_yacc.Po
+	-rm -f ./$(DEPDIR)/arith_yylex.Po
+	-rm -f ./$(DEPDIR)/cd.Po
+	-rm -f ./$(DEPDIR)/error.Po
+	-rm -f ./$(DEPDIR)/eval.Po
+	-rm -f ./$(DEPDIR)/exec.Po
+	-rm -f ./$(DEPDIR)/expand.Po
+	-rm -f ./$(DEPDIR)/histedit.Po
+	-rm -f ./$(DEPDIR)/input.Po
+	-rm -f ./$(DEPDIR)/jobs.Po
+	-rm -f ./$(DEPDIR)/mail.Po
+	-rm -f ./$(DEPDIR)/main.Po
+	-rm -f ./$(DEPDIR)/memalloc.Po
+	-rm -f ./$(DEPDIR)/miscbltin.Po
+	-rm -f ./$(DEPDIR)/mystring.Po
+	-rm -f ./$(DEPDIR)/options.Po
+	-rm -f ./$(DEPDIR)/output.Po
+	-rm -f ./$(DEPDIR)/parser.Po
+	-rm -f ./$(DEPDIR)/redir.Po
+	-rm -f ./$(DEPDIR)/show.Po
+	-rm -f ./$(DEPDIR)/system.Po
+	-rm -f ./$(DEPDIR)/trap.Po
+	-rm -f ./$(DEPDIR)/var.Po
+	-rm -f bltin/$(DEPDIR)/printf.Po
+	-rm -f bltin/$(DEPDIR)/test.Po
+	-rm -f bltin/$(DEPDIR)/times.Po
 	-rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
@@ -651,48 +785,50 @@ uninstall-am: uninstall-binPROGRAMS uninstall-man
 
 uninstall-man: uninstall-man1
 
-.MAKE: all check install install-am install-strip
+.MAKE: all check install install-am install-exec install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
+	clean-binPROGRAMS clean-generic cscopelist-am ctags ctags-am \
+	distclean distclean-compile distclean-generic distclean-tags \
+	distdir dvi dvi-am html html-am info info-am install \
+	install-am install-binPROGRAMS install-data install-data-am \
+	install-dvi install-dvi-am install-exec install-exec-am \
+	install-html install-html-am install-info install-info-am \
+	install-man install-man1 install-pdf install-pdf-am install-ps \
+	install-ps-am install-strip installcheck installcheck-am \
+	installdirs maintainer-clean maintainer-clean-generic \
+	mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \
+	ps ps-am tags tags-am uninstall uninstall-am \
+	uninstall-binPROGRAMS uninstall-man uninstall-man1
 
-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
-	clean-generic ctags distclean distclean-compile \
-	distclean-generic distclean-tags distdir dvi dvi-am html \
-	html-am info info-am install install-am install-binPROGRAMS \
-	install-data install-data-am install-dvi install-dvi-am \
-	install-exec install-exec-am install-html install-html-am \
-	install-info install-info-am install-man install-man1 \
-	install-pdf install-pdf-am install-ps install-ps-am \
-	install-strip installcheck installcheck-am installdirs \
-	maintainer-clean maintainer-clean-generic mostlyclean \
-	mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
-	tags uninstall uninstall-am uninstall-binPROGRAMS \
-	uninstall-man uninstall-man1
+.PRECIOUS: Makefile
 
 
 token.h token_vars.h: mktokens
-	$(SHELL) $^
+	$(AM_V_GEN)$(SHELL) $^
 
 builtins.def: builtins.def.in $(top_builddir)/config.h
-	$(COMPILE) -E -x c -o $@ $<
+	$(AM_V_CC)$(COMPILE) -E -x c -o $@ $<
 
 builtins.c builtins.h: mkbuiltins builtins.def
-	$(SHELL) $^
+	$(AM_V_GEN)$(SHELL) $^
 
 init.c: mkinit $(dash_CFILES)
-	./$^
+	$(AM_V_GEN)./$^
 
 nodes.c nodes.h: mknodes nodetypes nodes.c.pat
-	./$^
+	$(AM_V_GEN)./$^
 
 syntax.c syntax.h: mksyntax
-	./$^
+	$(AM_V_GEN)./$^
 
 signames.c: mksignames
-	./$^
+	$(AM_V_GEN)./$^
 
 mksyntax: token.h
 
 $(HELPERS): %: %.c
-	$(COMPILE_FOR_BUILD) -o $@ $<
+	$(AM_V_CC)$(COMPILE_FOR_BUILD) -o $@ $<
 
 # 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.
diff --git a/src/bltin/test.c b/src/bltin/test.c
index d1458df34d26c752f1aa4223a0297ffe5ac0c01b..c7fc479d62adfa609b975eb60e8b303b523c2b8f 100644
--- a/src/bltin/test.c
+++ b/src/bltin/test.c
@@ -151,8 +151,7 @@ static int equalf(const char *, const char *);
 #ifdef HAVE_FACCESSAT
 static int test_file_access(const char *, int);
 #else
-static int test_st_mode(const struct stat64 *, int);
-static int bash_group_member(gid_t);
+static int test_access(const struct stat64 *, int);
 #endif
 
 #ifdef HAVE_FACCESSAT
@@ -397,11 +396,11 @@ filstat(char *nm, enum token mode)
 	switch (mode) {
 #ifndef HAVE_FACCESSAT
 	case FILRD:
-		return test_st_mode(&s, R_OK);
+		return test_access(&s, R_OK);
 	case FILWR:
-		return test_st_mode(&s, W_OK);
+		return test_access(&s, W_OK);
 	case FILEX:
-		return test_st_mode(&s, X_OK);
+		return test_access(&s, X_OK);
 #endif
 	case FILEXIST:
 		return 1;
@@ -474,17 +473,17 @@ static int isoperand(char **tp)
 static int
 newerf (const char *f1, const char *f2)
 {
-	struct stat b1, b2;
+	struct stat64 b1, b2;
 
 #ifdef HAVE_ST_MTIM
-	return (stat (f1, &b1) == 0 &&
-		stat (f2, &b2) == 0 &&
+	return (stat64(f1, &b1) == 0 &&
+		stat64(f2, &b2) == 0 &&
 		( b1.st_mtim.tv_sec > b2.st_mtim.tv_sec ||
 		 (b1.st_mtim.tv_sec == b2.st_mtim.tv_sec && (b1.st_mtim.tv_nsec > b2.st_mtim.tv_nsec )))
 	);
 #else
-	return (stat (f1, &b1) == 0 &&
-		stat (f2, &b2) == 0 &&
+	return (stat64(f1, &b1) == 0 &&
+		stat64(f2, &b2) == 0 &&
 		b1.st_mtime > b2.st_mtime);
 #endif
 }
@@ -492,17 +491,17 @@ newerf (const char *f1, const char *f2)
 static int
 olderf (const char *f1, const char *f2)
 {
-	struct stat b1, b2;
+	struct stat64 b1, b2;
 
 #ifdef HAVE_ST_MTIM
-	return (stat (f1, &b1) == 0 &&
-		stat (f2, &b2) == 0 &&
+	return (stat64(f1, &b1) == 0 &&
+		stat64(f2, &b2) == 0 &&
 		(b1.st_mtim.tv_sec < b2.st_mtim.tv_sec ||
 		 (b1.st_mtim.tv_sec == b2.st_mtim.tv_sec && (b1.st_mtim.tv_nsec < b2.st_mtim.tv_nsec )))
 	);
 #else
-	return (stat (f1, &b1) == 0 &&
-		stat (f2, &b2) == 0 &&
+	return (stat64(f1, &b1) == 0 &&
+		stat64(f2, &b2) == 0 &&
 		b1.st_mtime < b2.st_mtime);
 #endif
 }
@@ -510,10 +509,10 @@ olderf (const char *f1, const char *f2)
 static int
 equalf (const char *f1, const char *f2)
 {
-	struct stat b1, b2;
+	struct stat64 b1, b2;
 
-	return (stat (f1, &b1) == 0 &&
-		stat (f2, &b2) == 0 &&
+	return (stat64(f1, &b1) == 0 &&
+		stat64(f2, &b2) == 0 &&
 		b1.st_dev == b2.st_dev &&
 		b1.st_ino == b2.st_ino);
 }
@@ -537,53 +536,165 @@ static int test_file_access(const char *path, int mode)
 }
 #else	/* HAVE_FACCESSAT */
 /*
- * Similar to what access(2) does, but uses the effective uid and gid.
- * Doesn't make the mistake of telling root that any file is executable.
- * Returns non-zero if the file is accessible.
+ * The manual, and IEEE POSIX 1003.2, suggests this should check the mode bits,
+ * not use access():
+ *
+ *	True shall indicate only that the write flag is on.  The file is not
+ *	writable on a read-only file system even if this test indicates true.
+ *
+ * Unfortunately IEEE POSIX 1003.1-2001, as quoted in SuSv3, says only:
+ *
+ *	True shall indicate that permission to read from file will be granted,
+ *	as defined in "File Read, Write, and Creation".
+ *
+ * and that section says:
+ *
+ *	When a file is to be read or written, the file shall be opened with an
+ *	access mode corresponding to the operation to be performed.  If file
+ *	access permissions deny access, the requested operation shall fail.
+ *
+ * and of course access permissions are described as one might expect:
+ *
+ *     * If a process has the appropriate privilege:
+ *
+ *        * If read, write, or directory search permission is requested,
+ *          access shall be granted.
+ *
+ *        * If execute permission is requested, access shall be granted if
+ *          execute permission is granted to at least one user by the file
+ *          permission bits or by an alternate access control mechanism;
+ *          otherwise, access shall be denied.
+ *
+ *   * Otherwise:
+ *
+ *        * The file permission bits of a file contain read, write, and
+ *          execute/search permissions for the file owner class, file group
+ *          class, and file other class.
+ *
+ *        * Access shall be granted if an alternate access control mechanism
+ *          is not enabled and the requested access permission bit is set for
+ *          the class (file owner class, file group class, or file other class)
+ *          to which the process belongs, or if an alternate access control
+ *          mechanism is enabled and it allows the requested access; otherwise,
+ *          access shall be denied.
+ *
+ * and when I first read this I thought:  surely we can't go about using
+ * open(O_WRONLY) to try this test!  However the POSIX 1003.1-2001 Rationale
+ * section for test does in fact say:
+ *
+ *	On historical BSD systems, test -w directory always returned false
+ *	because test tried to open the directory for writing, which always
+ *	fails.
+ *
+ * and indeed this is in fact true for Seventh Edition UNIX, UNIX 32V, and UNIX
+ * System III, and thus presumably also for BSD up to and including 4.3.
+ *
+ * Secondly I remembered why using open() and/or access() are bogus.  They
+ * don't work right for detecting read and write permissions bits when called
+ * by root.
+ *
+ * Interestingly the 'test' in 4.4BSD was closer to correct (as per
+ * 1003.2-1992) and it was implemented efficiently with stat() instead of
+ * open().
+ *
+ * This was apparently broken in NetBSD around about 1994/06/30 when the old
+ * 4.4BSD implementation was replaced with a (arguably much better coded)
+ * implementation derived from pdksh.
+ *
+ * Note that modern pdksh is yet different again, but still not correct, at
+ * least not w.r.t. 1003.2-1992.
+ *
+ * As I think more about it and read more of the related IEEE docs I don't like
+ * that wording about 'test -r' and 'test -w' in 1003.1-2001 at all.  I very
+ * much prefer the original wording in 1003.2-1992.  It is much more useful,
+ * and so that's what I've implemented.
+ *
+ * (Note that a strictly conforming implementation of 1003.1-2001 is in fact
+ * totally useless for the case in question since its 'test -w' and 'test -r'
+ * can never fail for root for any existing files, i.e. files for which 'test
+ * -e' succeeds.)
+ *
+ * The rationale for 1003.1-2001 suggests that the wording was "clarified" in
+ * 1003.1-2001 to align with the 1003.2b draft.  1003.2b Draft 12 (July 1999),
+ * which is the latest copy I have, does carry the same suggested wording as is
+ * in 1003.1-2001, with its rationale saying:
+ *
+ * 	This change is a clarification and is the result of interpretation
+ * 	request PASC 1003.2-92 #23 submitted for IEEE Std 1003.2-1992.
+ *
+ * That interpretation can be found here:
+ *
+ *   http://www.pasc.org/interps/unofficial/db/p1003.2/pasc-1003.2-23.html
+ *
+ * Not terribly helpful, unfortunately.  I wonder who that fence sitter was.
+ *
+ * Worse, IMVNSHO, I think the authors of 1003.2b-D12 have mis-interpreted the
+ * PASC interpretation and appear to be gone against at least one widely used
+ * implementation (namely 4.4BSD).  The problem is that for file access by root
+ * this means that if test '-r' and '-w' are to behave as if open() were called
+ * then there's no way for a shell script running as root to check if a file
+ * has certain access bits set other than by the grotty means of interpreting
+ * the output of 'ls -l'.  This was widely considered to be a bug in V7's
+ * "test" and is, I believe, one of the reasons why direct use of access() was
+ * avoided in some more recent implementations!
+ *
+ * I have always interpreted '-r' to match '-w' and '-x' as per the original
+ * wording in 1003.2-1992, not the other way around.  I think 1003.2b goes much
+ * too far the wrong way without any valid rationale and that it's best if we
+ * stick with 1003.2-1992 and test the flags, and not mimic the behaviour of
+ * open() since we already know very well how it will work -- existance of the
+ * file is all that matters to open() for root.
+ *
+ * Unfortunately the SVID is no help at all (which is, I guess, partly why
+ * we're in this mess in the first place :-).
+ *
+ * The SysV implementation (at least in the 'test' builtin in /bin/sh) does use
+ * access(name, 2) even though it also goes to much greater lengths for '-x'
+ * matching the 1003.2-1992 definition (which is no doubt where that definition
+ * came from).
+ *
+ * The ksh93 implementation uses access() for '-r' and '-w' if
+ * (euid==uid&&egid==gid), but uses st_mode for '-x' iff running as root.
+ * i.e. it does strictly conform to 1003.1-2001 (and presumably 1003.2b).
  */
-static int
-test_st_mode(const struct stat64 *st, int mode)
+static int test_access(const struct stat64 *sp, int stmode)
 {
-	int euid = geteuid();
+	gid_t *groups;
+	register int n;
+	uid_t euid;
+	int maxgroups;
 
+	/*
+	 * I suppose we could use access() if not running as root and if we are
+	 * running with ((euid == uid) && (egid == gid)), but we've already
+	 * done the stat() so we might as well just test the permissions
+	 * directly instead of asking the kernel to do it....
+	 */
+	euid = geteuid();
 	if (euid == 0) {
-		/* Root can read or write any file. */
-		if (mode != X_OK)
+		if (stmode != X_OK)
 			return 1;
 
-		/* Root can execute any file that has any one of the execute
-		   bits set. */
-		mode = S_IXUSR | S_IXGRP | S_IXOTH;
-	} else if (st->st_uid == euid)
-		mode <<= 6;
-	else if (bash_group_member(st->st_gid))
-		mode <<= 3;
-
-	return st->st_mode & mode;
-}
-
-/* Return non-zero if GID is one that we have in our groups list. */
-static int
-bash_group_member(gid_t gid)
-{
-	register int i;
-	gid_t *group_array;
-	int ngroups;
-
-	/* Short-circuit if possible, maybe saving a call to getgroups(). */
-	if (gid == getgid() || gid == getegid())
-		return (1);
-
-	ngroups = getgroups(0, NULL);
-	group_array = stalloc(ngroups * sizeof(gid_t));
-	if ((getgroups(ngroups, group_array)) != ngroups)
-		return (0);
-
-	/* Search through the list looking for GID. */
-	for (i = 0; i < ngroups; i++)
-		if (gid == group_array[i])
-			return (1);
+		/* any bit is good enough */
+		stmode = (stmode << 6) | (stmode << 3) | stmode;
+	} else if (sp->st_uid == euid)
+		stmode <<= 6;
+	else if (sp->st_gid == getegid())
+		stmode <<= 3;
+	else {
+		/* XXX stolen almost verbatim from ksh93.... */
+		/* on some systems you can be in several groups */
+		maxgroups = getgroups(0, NULL);
+		groups = stalloc(maxgroups * sizeof(*groups));
+		n = getgroups(maxgroups, groups);
+		while (--n >= 0) {
+			if (groups[n] == sp->st_gid) {
+				stmode <<= 3;
+				break;
+			}
+		}
+	}
 
-	return (0);
+	return sp->st_mode & stmode;
 }
 #endif	/* HAVE_FACCESSAT */
diff --git a/src/bltin/times.c b/src/bltin/times.c
index 8eabc1fede84e0bd814e34bb7150db5decdb6a5c..1166a68e7b87dfb9325f1a8617882d28802749b3 100644
--- a/src/bltin/times.c
+++ b/src/bltin/times.c
@@ -15,16 +15,28 @@
 int timescmd() {
 	struct tms buf;
 	long int clk_tck = sysconf(_SC_CLK_TCK);
+	int mutime, mstime, mcutime, mcstime;
+	double utime, stime, cutime, cstime;
 
 	times(&buf);
-	printf("%dm%fs %dm%fs\n%dm%fs %dm%fs\n",
-	       (int) (buf.tms_utime / clk_tck / 60),
-	       ((double) buf.tms_utime) / clk_tck,
-	       (int) (buf.tms_stime / clk_tck / 60),
-	       ((double) buf.tms_stime) / clk_tck,
-	       (int) (buf.tms_cutime / clk_tck / 60),
-	       ((double) buf.tms_cutime) / clk_tck,
-	       (int) (buf.tms_cstime / clk_tck / 60),
-	       ((double) buf.tms_cstime) / clk_tck);
+
+	utime = (double)buf.tms_utime / clk_tck;
+	mutime = utime / 60;
+	utime -= mutime * 60.0;
+
+	stime = (double)buf.tms_stime / clk_tck;
+	mstime = stime / 60;
+	stime -= mstime * 60.0;
+
+	cutime = (double)buf.tms_cutime / clk_tck;
+	mcutime = cutime / 60;
+	cutime -= mcutime * 60.0;
+
+	cstime = (double)buf.tms_cstime / clk_tck;
+	mcstime = cstime / 60;
+	cstime -= mcstime * 60.0;
+
+	printf("%dm%fs %dm%fs\n%dm%fs %dm%fs\n", mutime, utime, mstime, stime,
+	       mcutime, cutime, mcstime, cstime);
 	return 0;
 }
diff --git a/src/builtins.def.in b/src/builtins.def.in
index 4441fe41545e222824dd05f9b8044b83666d392f..95e420cc12b26d92671aca650d52f68098cbf56b 100644
--- a/src/builtins.def.in
+++ b/src/builtins.def.in
@@ -69,11 +69,11 @@ exitcmd		-s exit
 exportcmd	-as export -as readonly
 falsecmd	-u false
 getoptscmd	-u getopts
-hashcmd		hash
+hashcmd		-u hash
 jobscmd		-u jobs
 localcmd	-as local
 printfcmd	printf
-pwdcmd		pwd
+pwdcmd		-u pwd
 readcmd		-u read
 returncmd	-s return
 setcmd		-s set
@@ -81,14 +81,14 @@ shiftcmd	-s shift
 timescmd	-s times
 trapcmd		-s trap
 truecmd		-s : -u true
-typecmd		type
+typecmd		-u type
 umaskcmd	-u umask
 unaliascmd	-u unalias
 unsetcmd	-s unset
 waitcmd		-u wait
 aliascmd	-au alias
 #ifdef HAVE_GETRLIMIT
-ulimitcmd	ulimit
+ulimitcmd	-u ulimit
 #endif
 testcmd		test [
 killcmd		-u kill
diff --git a/src/cd.c b/src/cd.c
index a4e024d84e36515b331dd4c7838b0edb096f02da..1ef1dc563ef980ada3db01d0752faedd1e37c278 100644
--- a/src/cd.c
+++ b/src/cd.c
@@ -96,8 +96,9 @@ cdcmd(int argc, char **argv)
 	const char *path;
 	const char *p;
 	char c;
-	struct stat statb;
+	struct stat64 statb;
 	int flags;
+	int len;
 
 	flags = cdopt();
 	dest = *argptr;
@@ -127,10 +128,11 @@ dotdot:
 	if (!*dest)
 		dest = ".";
 	path = bltinlookup("CDPATH");
-	while (path) {
-		c = *path;
-		p = padvance(&path, dest);
-		if (stat(p, &statb) >= 0 && S_ISDIR(statb.st_mode)) {
+	while (p = path, (len = padvance_magic(&path, dest, 0)) >= 0) {
+		c = *p;
+		p = stalloc(len);
+
+		if (stat64(p, &statb) >= 0 && S_ISDIR(statb.st_mode)) {
 			if (c && c != ':')
 				flags |= CD_PRINT;
 docd:
diff --git a/src/dash.1 b/src/dash.1
index c452c3f479dd788c4bc70f6283e2a83206c084d9..ff022371c3533b1c604fe72648637eaf870d1017 100644
--- a/src/dash.1
+++ b/src/dash.1
@@ -33,8 +33,8 @@
 .\"	@(#)sh.1	8.6 (Berkeley) 5/4/95
 .\"
 .Dd January 19, 2003
-.Os
 .Dt DASH 1
+.Os
 .Sh NAME
 .Nm dash
 .Nd command interpreter (shell)
@@ -439,7 +439,7 @@ instead of
 then leading tabs in the here-doc-text are stripped.
 .Ss Search and Execution
 There are three types of commands: shell functions, builtin commands, and
-normal programs -- and the command is searched for (by name) in that order.
+normal programs \(en and the command is searched for (by name) in that order.
 They each are executed in a different way.
 .Pp
 When a shell function is executed, all of the shell positional parameters
@@ -578,11 +578,11 @@ the preceding AND-OR-list.
 .Pp
 Note that unlike some other shells, each process in the pipeline is a
 child of the invoking shell (unless it is a shell builtin, in which case
-it executes in the current shell -- but any effect it has on the
+it executes in the current shell \(en but any effect it has on the
 environment is wiped).
-.Ss Background Commands -- &
+.Ss Background Commands \(en &
 If a command is terminated by the control operator ampersand (&), the
-shell executes the command asynchronously -- that is, the shell does not
+shell executes the command asynchronously \(en that is, the shell does not
 wait for the command to finish before executing the next command.
 .Pp
 The format for running a command in background is:
@@ -592,7 +592,7 @@ The format for running a command in background is:
 If the shell is not interactive, the standard input of an asynchronous
 command is set to
 .Pa /dev/null .
-.Ss Lists -- Generally Speaking
+.Ss Lists \(en Generally Speaking
 A list is a sequence of zero or more commands separated by newlines,
 semicolons, or ampersands, and optionally terminated by one of these three
 characters.
@@ -615,7 +615,7 @@ of the first command is nonzero.
 and
 .Dq ||
 both have the same priority.
-.Ss Flow-Control Constructs -- if, while, for, case
+.Ss Flow-Control Constructs \(en if, while, for, case
 The syntax of the if command is
 .Bd -literal -offset indent
 if list
@@ -694,7 +694,7 @@ Builtin commands grouped into a (list) will not affect the current shell.
 The second form does not fork another shell so is slightly more efficient.
 Grouping commands together this way allows you to redirect
 their output as though they were one program:
-.Pp
+.\".Pp
 .Bd -literal -offset indent
 { printf \*q hello \*q ; printf \*q world\\n" ; } \*[Gt] greeting
 .Ed
@@ -1177,13 +1177,14 @@ mechanism was used or because the argument is a single dash.
 The
 .Fl P
 option causes the physical directory structure to be used, that is, all
-symbolic links are resolved to their respective values.  The
+symbolic links are resolved to their respective values.
+The
 .Fl L
 option turns off the effect of any preceding
 .Fl P
 options.
 .It Xo echo Op Fl n
-.Ar args... 
+.Ar args...
 .Xc
 Print the arguments on the standard output, separated by spaces.
 Unless the
@@ -1191,13 +1192,15 @@ Unless the
 option is present, a newline is output following the arguments.
 .Pp
 If any of the following sequences of characters is encountered during
-output, the sequence is not output.  Instead, the specified action is
+output, the sequence is not output.
+Instead, the specified action is
 performed:
 .Bl -tag -width indent
 .It Li \eb
 A backspace character is output.
 .It Li \ec
-Subsequent output is suppressed.  This is normally used at the end of the
+Subsequent output is suppressed.
+This is normally used at the end of the
 last argument to suppress the trailing newline that
 .Ic echo
 would otherwise output.
@@ -1417,7 +1420,7 @@ and
 and the option
 .Op c ,
 which requires an argument.
-.Pp
+.\".Pp
 .Bd -literal -offset indent
 while getopts abc: f
 do
@@ -1431,7 +1434,7 @@ shift `expr $OPTIND - 1`
 .Ed
 .Pp
 This code will accept any of the following as equivalent:
-.Pp
+.\".Pp
 .Bd -literal -offset indent
 cmd \-acarg file file
 cmd \-a \-c arg file file
@@ -1471,7 +1474,8 @@ will continue to print the old name for the directory.
 The
 .Fl P
 option causes the physical value of the current working directory to be shown,
-that is, all symbolic links are resolved to their respective values.  The
+that is, all symbolic links are resolved to their respective values.
+The
 .Fl L
 option turns off the effect of any preceding
 .Fl P
@@ -1522,7 +1526,7 @@ variables.
 With the
 .Fl p
 option specified the output will be formatted suitably for non-interactive use.
-.Pp
+.\".Pp
 .It Xo printf Ar format
 .Op Ar arguments  ...
 .Xc
@@ -1780,9 +1784,11 @@ If options are given, it sets the specified option
 flags, or clears them as described in the section called
 .Sx Argument List Processing .
 As a special case, if the option is -o or +o and no argument is
-supplied, the shell prints the settings of all its options.  If the
-option is -o, the settings are printed in a human-readable format; if
-the option is +o, the settings are printed in a format suitable for
+supplied, the shell prints the settings of all its options.
+If the option is -o,
+the settings are printed in a human-readable format;
+if the option is +o,
+the settings are printed in a format suitable for
 reinput to the shell to affect the same option settings.
 .Pp
 The third use of the set command is to set the values of the shell's
@@ -1814,7 +1820,7 @@ If n is greater than the number of positional parameters,
 .Ic shift
 will issue an error message, and exit with return status 2.
 .It test Ar expression
-.It \&[ Ar expression Cm ]
+.It \&[ Ar expression Cm \&]
 The
 .Ic test
 utility evaluates the expression and, if it evaluates
@@ -2058,7 +2064,8 @@ operator has higher precedence than the
 operator.
 .It times
 Print the accumulated user and system times for the shell and for processes
-run from the shell.  The return status is 0.
+run from the shell.
+The return status is 0.
 .It Xo trap
 .Op Ar action Ar signal ...
 .Xc
@@ -2179,7 +2186,7 @@ the current limit is displayed.
 Limits of an arbitrary process can be displayed or set using the
 .Xr sysctl 8
 utility.
-.Pp
+.\".Pp
 .It umask Op Ar mask
 Set the value of umask (see
 .Xr umask 2 )
@@ -2308,11 +2315,13 @@ children of the shell, and is used in the history editing modes.
 .It Ev HISTSIZE
 The number of lines in the history buffer for the shell.
 .It Ev PWD
-The logical value of the current working directory.  This is set by the
+The logical value of the current working directory.
+This is set by the
 .Ic cd
 command.
 .It Ev OLDPWD
-The previous logical value of the current working directory.  This is set by
+The previous logical value of the current working directory.
+This is set by
 the
 .Ic cd
 command.
@@ -2320,7 +2329,7 @@ command.
 The process ID of the parent process of the shell.
 .El
 .Sh FILES
-.Bl -item -width HOMEprofilexxxx
+.Bl -item
 .It
 .Pa $HOME/.profile
 .It
diff --git a/src/error.c b/src/error.c
index f9ea91985dd3fcaf7a77b81499d2179d4f9a9cf8..728ff885fe819a20a7c7a7e171d36e8ace3ca21f 100644
--- a/src/error.c
+++ b/src/error.c
@@ -43,6 +43,7 @@
 #include <stdio.h>
 #include <string.h>
 
+#include "jobs.h"
 #include "shell.h"
 #include "main.h"
 #include "options.h"
@@ -81,6 +82,10 @@ exraise(int e)
 	if (handler == NULL)
 		abort();
 #endif
+
+	if (vforked)
+		_exit(exitstatus);
+
 	INTOFF;
 
 	exception = e;
diff --git a/src/error.h b/src/error.h
index 9630b56d1422d69b233916191f87e2b8b21849a3..661a8a09863eccbfe366da2929aed47144b6be74 100644
--- a/src/error.h
+++ b/src/error.h
@@ -66,7 +66,8 @@ extern int exception;
 /* exceptions */
 #define EXINT 0		/* SIGINT received */
 #define EXERROR 1	/* a generic error */
-#define EXEXIT 4	/* exit the shell */
+#define EXEND 3		/* exit the shell */
+#define EXEXIT 4	/* exit the shell via exitcmd */
 
 
 /*
@@ -115,11 +116,7 @@ void __inton(void);
 #define int_pending() intpending
 
 void exraise(int) __attribute__((__noreturn__));
-#ifdef USE_NORETURN
 void onint(void) __attribute__((__noreturn__));
-#else
-void onint(void);
-#endif
 extern int errlinno;
 void sh_error(const char *, ...) __attribute__((__noreturn__));
 void exerror(int, const char *, ...) __attribute__((__noreturn__));
diff --git a/src/eval.c b/src/eval.c
index 39c4e411e0c1c2bb264085b14eb4a3d81dc1b237..fa43b68581e61644534b69562c1af3b2f251d1fc 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -41,6 +41,8 @@
  * Evaluate a command.
  */
 
+#include "init.h"
+#include "main.h"
 #include "shell.h"
 #include "nodes.h"
 #include "syntax.h"
@@ -76,6 +78,9 @@ int exitstatus;			/* exit status of last command */
 int back_exitstatus;		/* exit status of backquoted command */
 int savestatus = -1;		/* exit status of last command outside traps */
 
+/* Prevent PS4 nesting. */
+MKINIT int inps4;
+
 
 #if !defined(__alpha__) || (defined(__GNUC__) && __GNUC__ >= 3)
 STATIC
@@ -100,8 +105,9 @@ STATIC int bltincmd(int, char **);
 
 
 STATIC const struct builtincmd bltin = {
-	name: nullstr,
-	builtin: bltincmd
+	.name = nullstr,
+	.builtin = bltincmd,
+	.flags = BUILTIN_REGULAR,
 };
 
 
@@ -112,13 +118,15 @@ STATIC const struct builtincmd bltin = {
 #ifdef mkinit
 INCLUDE "eval.h"
 
-RESET {
-	evalskip = 0;
-	loopnest = 0;
+EXITRESET {
 	if (savestatus >= 0) {
-		exitstatus = savestatus;
+		if (exception == EXEXIT || evalskip == SKIPFUNCDEF)
+			exitstatus = savestatus;
 		savestatus = -1;
 	}
+	evalskip = 0;
+	loopnest = 0;
+	inps4 = 0;
 }
 #endif
 
@@ -199,8 +207,15 @@ evaltree(union node *n, int flags)
 {
 	int checkexit = 0;
 	int (*evalfn)(union node *, int);
+	struct stackmark smark;
 	unsigned isor;
 	int status = 0;
+
+	setstackmark(&smark);
+
+	if (nflag)
+		goto out;
+
 	if (n == NULL) {
 		TRACE(("evaltree(NULL) called\n"));
 		goto out;
@@ -223,32 +238,29 @@ evaltree(union node *n, int flags)
 		break;
 #endif
 	case NNOT:
-		status = !evaltree(n->nnot.com, EV_TESTED);
-		goto setstatus;
+		status = evaltree(n->nnot.com, EV_TESTED);
+		if (!evalskip)
+			status = !status;
+		break;
 	case NREDIR:
 		errlinno = lineno = n->nredir.linno;
 		if (funcline)
 			lineno -= funcline - 1;
 		expredir(n->nredir.redirect);
 		pushredir(n->nredir.redirect);
-		status = redirectsafe(n->nredir.redirect, REDIR_PUSH) ?:
-			 evaltree(n->nredir.n, flags & EV_TESTED);
+		status = redirectsafe(n->nredir.redirect, REDIR_PUSH);
+		if (status)
+			checkexit = EV_TESTED;
+		else
+			status = evaltree(n->nredir.n, flags & EV_TESTED);
 		if (n->nredir.redirect)
 			popredir(0);
-		goto setstatus;
+		break;
 	case NCMD:
-#ifdef notyet
-		if (eflag && !(flags & EV_TESTED))
-			checkexit = ~0;
-		status = evalcommand(n, flags, (struct backcmd *)NULL);
-		goto setstatus;
-#else
 		evalfn = evalcommand;
 checkexit:
-		if (eflag && !(flags & EV_TESTED))
-			checkexit = ~0;
+		checkexit = EV_TESTED;
 		goto calleval;
-#endif
 	case NFOR:
 		evalfn = evalfor;
 		goto calleval;
@@ -278,14 +290,14 @@ checkexit:
 		isor = n->type - NAND;
 		status = evaltree(n->nbinary.ch1,
 				  (flags | ((isor >> 1) - 1)) & EV_TESTED);
-		if (!status == isor || evalskip)
+		if ((!status) == isor || evalskip)
 			break;
 		n = n->nbinary.ch2;
 evaln:
 		evalfn = evaltree;
 calleval:
 		status = evalfn(n, flags);
-		goto setstatus;
+		break;
 	case NIF:
 		status = evaltree(n->nif.test, EV_TESTED);
 		if (evalskip)
@@ -298,24 +310,27 @@ calleval:
 			goto evaln;
 		}
 		status = 0;
-		goto setstatus;
+		break;
 	case NDEFUN:
 		defun(n);
-setstatus:
-		exitstatus = status;
 		break;
 	}
-out:
-	if (checkexit & status)
-		goto exexit;
 
+	exitstatus = status;
+
+out:
 	dotrap();
 
+	if (eflag && (~flags & checkexit) && status)
+		goto exexit;
+
 	if (flags & EV_EXIT) {
 exexit:
-		exraise(EXEXIT);
+		exraise(EXEND);
 	}
 
+	popstackmark(&smark);
+
 	return exitstatus;
 }
 
@@ -395,14 +410,12 @@ evalfor(union node *n, int flags)
 	struct arglist arglist;
 	union node *argp;
 	struct strlist *sp;
-	struct stackmark smark;
 	int status;
 
 	errlinno = lineno = n->nfor.linno;
 	if (funcline)
 		lineno -= funcline - 1;
 
-	setstackmark(&smark);
 	arglist.lastp = &arglist.list;
 	for (argp = n->nfor.args ; argp ; argp = argp->narg.next) {
 		expandarg(argp, &arglist, EXP_FULL | EXP_TILDE);
@@ -419,7 +432,6 @@ evalfor(union node *n, int flags)
 			break;
 	}
 	loopnest--;
-	popstackmark(&smark);
 
 	return status;
 }
@@ -432,14 +444,12 @@ evalcase(union node *n, int flags)
 	union node *cp;
 	union node *patp;
 	struct arglist arglist;
-	struct stackmark smark;
 	int status = 0;
 
 	errlinno = lineno = n->ncase.linno;
 	if (funcline)
 		lineno -= funcline - 1;
 
-	setstackmark(&smark);
 	arglist.lastp = &arglist.list;
 	expandarg(n->ncase.expr, &arglist, EXP_TILDE);
 	for (cp = n->ncase.cases ; cp && evalskip == 0 ; cp = cp->nclist.next) {
@@ -458,8 +468,6 @@ evalcase(union node *n, int flags)
 		}
 	}
 out:
-	popstackmark(&smark);
-
 	return status;
 }
 
@@ -481,16 +489,18 @@ evalsubshell(union node *n, int flags)
 		lineno -= funcline - 1;
 
 	expredir(n->nredir.redirect);
-	if (!backgnd && flags & EV_EXIT && !have_traps())
-		goto nofork;
 	INTOFF;
+	if (!backgnd && flags & EV_EXIT && !have_traps()) {
+		forkreset();
+		goto nofork;
+	}
 	jp = makejob(n, 1);
 	if (forkshell(jp, n, backgnd) == 0) {
-		INTON;
 		flags |= EV_EXIT;
 		if (backgnd)
 			flags &=~ EV_TESTED;
 nofork:
+		INTON;
 		redirect(n->nredir.redirect, 0);
 		evaltreenr(n->nredir.n, flags);
 		/* never returns */
@@ -528,7 +538,7 @@ expredir(union node *n)
 		case NFROMFD:
 		case NTOFD:
 			if (redir->ndup.vname) {
-				expandarg(redir->ndup.vname, &fn, EXP_FULL | EXP_TILDE);
+				expandarg(redir->ndup.vname, &fn, EXP_TILDE | EXP_REDIR);
 				fixredir(redir, fn.list->text, 1);
 			}
 			break;
@@ -648,22 +658,42 @@ out:
 		result->fd, result->buf, result->nleft, result->jp));
 }
 
-static char **
-parse_command_args(char **argv, const char **path)
+static struct strlist *fill_arglist(struct arglist *arglist,
+				    union node **argpp)
+{
+	struct strlist **lastp = arglist->lastp;
+	union node *argp;
+
+	while ((argp = *argpp)) {
+		expandarg(argp, arglist, EXP_FULL | EXP_TILDE);
+		*argpp = argp->narg.next;
+		if (*lastp)
+			break;
+	}
+
+	return *lastp;
+}
+
+static int parse_command_args(struct arglist *arglist, union node **argpp,
+			      const char **path)
 {
+	struct strlist *sp = arglist->list;
 	char *cp, c;
 
 	for (;;) {
-		cp = *++argv;
-		if (!cp)
+		sp = unlikely(sp->next) ? sp->next :
+					  fill_arglist(arglist, argpp);
+		if (!sp)
 			return 0;
+		cp = sp->text;
 		if (*cp++ != '-')
 			break;
 		if (!(c = *cp++))
 			break;
 		if (c == '-' && !*cp) {
-			if (!*++argv)
+			if (likely(!sp->next) && !fill_arglist(arglist, argpp))
 				return 0;
+			sp = sp->next;
 			break;
 		}
 		do {
@@ -677,10 +707,10 @@ parse_command_args(char **argv, const char **path)
 			}
 		} while ((c = *cp++));
 	}
-	return argv;
-}
-
 
+	arglist->list = sp;
+	return DO_NOFUNC;
+}
 
 /*
  * Execute a simple command.
@@ -696,12 +726,12 @@ evalcommand(union node *cmd, int flags)
 	struct localvar_list *localvar_stop;
 	struct parsefile *file_stop;
 	struct redirtab *redir_stop;
-	struct stackmark smark;
 	union node *argp;
 	struct arglist arglist;
 	struct arglist varlist;
 	char **argv;
 	int argc;
+	struct strlist *osp;
 	struct strlist *sp;
 #ifdef notyet
 	int pip[2];
@@ -711,9 +741,12 @@ evalcommand(union node *cmd, int flags)
 	char *lastarg;
 	const char *path;
 	int spclbltin;
+	int cmd_flag;
 	int execcmd;
 	int status;
 	char **nargv;
+	int vflags;
+	int vlocal;
 
 	errlinno = lineno = cmd->ncmd.linno;
 	if (funcline)
@@ -721,8 +754,6 @@ evalcommand(union node *cmd, int flags)
 
 	/* First expand the arguments. */
 	TRACE(("evalcommand(0x%lx, %d) called\n", (long)cmd, flags));
-	setstackmark(&smark);
-	localvar_stop = pushlocalvars();
 	file_stop = parsefile;
 	back_exitstatus = 0;
 
@@ -733,16 +764,60 @@ evalcommand(union node *cmd, int flags)
 	arglist.lastp = &arglist.list;
 	*arglist.lastp = NULL;
 
+	cmd_flag = 0;
+	execcmd = 0;
+	spclbltin = -1;
+	vflags = 0;
+	vlocal = 0;
+	path = NULL;
+
 	argc = 0;
-	for (argp = cmd->ncmd.args; argp; argp = argp->narg.next) {
-		struct strlist **spp;
+	argp = cmd->ncmd.args;
+	if ((osp = fill_arglist(&arglist, &argp))) {
+		int pseudovarflag = 0;
 
-		spp = arglist.lastp;
-		expandarg(argp, &arglist, EXP_FULL | EXP_TILDE);
-		for (sp = *spp; sp; sp = sp->next)
+		for (;;) {
+			find_command(arglist.list->text, &cmdentry,
+				     cmd_flag | DO_REGBLTIN, pathval());
+
+			vlocal++;
+
+			/* implement bltin and command here */
+			if (cmdentry.cmdtype != CMDBUILTIN)
+				break;
+
+			pseudovarflag = cmdentry.u.cmd->flags & BUILTIN_ASSIGN;
+			if (likely(spclbltin < 0)) {
+				spclbltin =
+					cmdentry.u.cmd->flags &
+					BUILTIN_SPECIAL
+				;
+				vlocal = spclbltin ^ BUILTIN_SPECIAL;
+			}
+			execcmd = cmdentry.u.cmd == EXECCMD;
+			if (likely(cmdentry.u.cmd != COMMANDCMD))
+				break;
+
+			cmd_flag = parse_command_args(&arglist, &argp, &path);
+			if (!cmd_flag)
+				break;
+		}
+
+		for (; argp; argp = argp->narg.next)
+			expandarg(argp, &arglist,
+				  pseudovarflag &&
+				  isassignment(argp->narg.text) ?
+				  EXP_VARTILDE : EXP_FULL | EXP_TILDE);
+
+		for (sp = arglist.list; sp; sp = sp->next)
 			argc++;
+
+		if (execcmd && argc > 1)
+			vflags = VEXPORT;
 	}
 
+	localvar_stop = pushlocalvars(vlocal);
+
 	/* Reserve one extra spot at the front for shellexec. */
 	nargv = stalloc(sizeof (char *) * (argc + 2));
 	argv = ++nargv;
@@ -761,118 +836,76 @@ evalcommand(union node *cmd, int flags)
 	redir_stop = pushredir(cmd->ncmd.redirect);
 	status = redirectsafe(cmd->ncmd.redirect, REDIR_PUSH|REDIR_SAVEFD2);
 
-	path = vpath.text;
+	if (unlikely(status)) {
+bail:
+		exitstatus = status;
+
+		/* We have a redirection error. */
+		if (spclbltin > 0)
+			exraise(EXERROR);
+
+		goto out;
+	}
+
 	for (argp = cmd->ncmd.assign; argp; argp = argp->narg.next) {
 		struct strlist **spp;
-		char *p;
 
 		spp = varlist.lastp;
 		expandarg(argp, &varlist, EXP_VARTILDE);
 
-		mklocal((*spp)->text);
-
-		/*
-		 * Modify the command lookup path, if a PATH= assignment
-		 * is present
-		 */
-		p = (*spp)->text;
-		if (varequal(p, path))
-			path = p;
+		if (vlocal)
+			mklocal((*spp)->text, VEXPORT);
+		else
+			setvareq((*spp)->text, vflags);
 	}
 
 	/* Print the command if xflag is set. */
-	if (xflag) {
+	if (xflag && !inps4) {
 		struct output *out;
 		int sep;
 
 		out = &preverrout;
+		inps4 = 1;
 		outstr(expandstr(ps4val()), out);
+		inps4 = 0;
 		sep = 0;
 		sep = eprintlist(out, varlist.list, sep);
-		eprintlist(out, arglist.list, sep);
+		eprintlist(out, osp, sep);
 		outcslow('\n', out);
 #ifdef FLUSHERR
 		flushout(out);
 #endif
 	}
 
-	execcmd = 0;
-	spclbltin = -1;
-
 	/* Now locate the command. */
-	if (argc) {
-		const char *oldpath;
-		int cmd_flag = DO_ERR;
-
-		path += 5;
-		oldpath = path;
-		for (;;) {
-			find_command(argv[0], &cmdentry, cmd_flag, path);
-			if (cmdentry.cmdtype == CMDUNKNOWN) {
-				status = 127;
-#ifdef FLUSHERR
-				flushout(&errout);
-#endif
-				goto bail;
-			}
-
-			/* implement bltin and command here */
-			if (cmdentry.cmdtype != CMDBUILTIN)
-				break;
-			if (spclbltin < 0)
-				spclbltin = 
-					cmdentry.u.cmd->flags &
-					BUILTIN_SPECIAL
-				;
-			if (cmdentry.u.cmd == EXECCMD)
-				execcmd++;
-			if (cmdentry.u.cmd != COMMANDCMD)
-				break;
-
-			path = oldpath;
-			nargv = parse_command_args(argv, &path);
-			if (!nargv)
-				break;
-			argc -= nargv - argv;
-			argv = nargv;
-			cmd_flag |= DO_NOFUNC;
-		}
-	}
-
-	if (status) {
-bail:
-		exitstatus = status;
-
-		/* We have a redirection error. */
-		if (spclbltin > 0)
-			exraise(EXERROR);
-
-		goto out;
+	if (cmdentry.cmdtype != CMDBUILTIN ||
+	    !(cmdentry.u.cmd->flags & BUILTIN_REGULAR)) {
+		path = unlikely(path) ? path : pathval();
+		find_command(argv[0], &cmdentry, cmd_flag | DO_ERR, path);
 	}
 
 	jp = NULL;
 
 	/* Execute the command. */
 	switch (cmdentry.cmdtype) {
+	case CMDUNKNOWN:
+		status = 127;
+#ifdef FLUSHERR
+		flushout(&errout);
+#endif
+		goto bail;
+
 	default:
 		/* Fork off a child process if necessary. */
 		if (!(flags & EV_EXIT) || have_traps()) {
 			INTOFF;
-			jp = makejob(cmd, 1);
-			if (forkshell(jp, cmd, FORK_FG) != 0)
-				break;
-			FORCEINTON;
+			jp = vforkexec(cmd, argv, path, cmdentry.u.index);
+			break;
 		}
-		listsetvar(varlist.list, VEXPORT|VSTACK);
 		shellexec(argv, path, cmdentry.u.index);
 		/* NOTREACHED */
 
 	case CMDBUILTIN:
-		if (spclbltin > 0 || argc == 0) {
-			poplocalvars(1);
-			if (execcmd && argc > 1)
-				listsetvar(varlist.list, VEXPORT);
-		}
 		if (evalbltin(cmdentry.u.cmd, argc, argv, flags) &&
 		    !(exception == EXERROR && spclbltin <= 0)) {
 raise:
@@ -901,7 +934,6 @@ out:
 		 * However I implemented that within libedit itself.
 		 */
 		setvar("_", lastarg, 0);
-	popstackmark(&smark);
 
 	return status;
 }
@@ -928,6 +960,8 @@ evalbltin(const struct builtincmd *cmd, int argc, char **argv, int flags)
 	else
 		status = (*cmd->builtin)(argc, argv);
 	flushall();
+	if (outerr(out1))
+		sh_warnx("%s: I/O error", commandname);
 	status |= outerr(out1);
 	exitstatus = status;
 cmddone:
@@ -1109,7 +1143,8 @@ eprintlist(struct output *out, struct strlist *sp, int sep)
 	while (sp) {
 		const char *p;
 
-		p = " %s" + (1 - sep);
+		p = " %s";
+		p += (1 - sep);
 		sep |= 1;
 		outfmt(out, p, sp->text);
 		sp = sp->next;
diff --git a/src/exec.c b/src/exec.c
index e9e29b7e676af821e6f67635d0127c3f0273d394..87354d495aaf2eae2461eb246812e08d514b7cf2 100644
--- a/src/exec.c
+++ b/src/exec.c
@@ -92,7 +92,7 @@ STATIC int builtinloc = -1;		/* index in path of %builtin, or -1 */
 
 STATIC void tryexec(char *, char **, char **);
 STATIC void printentry(struct tblentry *);
-STATIC void clearcmdentry(int);
+STATIC void clearcmdentry(void);
 STATIC struct tblentry *cmdlookup(const char *, int);
 STATIC void delete_cmd_entry(void);
 STATIC void addcmdentry(char *, struct cmdentry *);
@@ -118,32 +118,32 @@ shellexec(char **argv, const char *path, int idx)
 		e = errno;
 	} else {
 		e = ENOENT;
-		while ((cmdname = padvance(&path, argv[0])) != NULL) {
+		while (padvance(&path, argv[0]) >= 0) {
+			cmdname = stackblock();
 			if (--idx < 0 && pathopt == NULL) {
 				tryexec(cmdname, argv, envp);
 				if (errno != ENOENT && errno != ENOTDIR)
 					e = errno;
 			}
-			stunalloc(cmdname);
 		}
 	}
 
 	/* Map to POSIX errors */
 	switch (e) {
-	case EACCES:
+	default:
 		exerrno = 126;
 		break;
+	case ELOOP:
+	case ENAMETOOLONG:
 	case ENOENT:
+	case ENOTDIR:
 		exerrno = 127;
 		break;
-	default:
-		exerrno = 2;
-		break;
 	}
 	exitstatus = exerrno;
 	TRACE(("shellexec failed for %s, errno %d, suppressint %d\n",
 		argv[0], e, suppressint ));
-	exerror(EXEXIT, "%s: %s", argv[0], errmsg(e, E_EXEC));
+	exerror(EXEND, "%s: %s", argv[0], errmsg(e, E_EXEC));
 	/* NOTREACHED */
 }
 
@@ -168,7 +168,27 @@ repeat:
 	}
 }
 
+static const char *legal_pathopt(const char *opt, const char *term, int magic)
+{
+	switch (magic) {
+	case 0:
+		opt = NULL;
+		break;
+
+	case 1:
+		opt = prefix(opt, "builtin") ?: prefix(opt, "func");
+		break;
+
+	default:
+		opt += strcspn(opt, term);
+		break;
+	}
+
+	if (opt && *opt == '%')
+		opt++;
 
+	return opt;
+}
 
 /*
  * Do a path search.  The variable path (passed by reference) should be
@@ -178,42 +198,64 @@ repeat:
  * a percent sign) appears in the path entry then the global variable
  * pathopt will be set to point to it; otherwise pathopt will be set to
  * NULL.
+ *
+ * If magic is 0 then pathopt recognition will be disabled.  If magic is
+ * 1 we shall recognise %builtin/%func.  Otherwise we shall accept any
+ * pathopt.
  */
 
 const char *pathopt;
 
-char *
-padvance(const char **path, const char *name)
+int padvance_magic(const char **path, const char *name, int magic)
 {
+	const char *term = "%:";
+	const char *lpathopt;
 	const char *p;
 	char *q;
 	const char *start;
+	size_t qlen;
 	size_t len;
 
 	if (*path == NULL)
-		return NULL;
+		return -1;
+
+	lpathopt = NULL;
 	start = *path;
-	for (p = start ; *p && *p != ':' && *p != '%' ; p++);
-	len = p - start + strlen(name) + 2;	/* "2" is for '/' and '\0' */
-	while (stackblocksize() < len)
-		growstackblock();
-	q = stackblock();
-	if (p != start) {
-		memcpy(q, start, p - start);
-		q += p - start;
-		*q++ = '/';
+
+	if (*start == '%' && (p = legal_pathopt(start + 1, term, magic))) {
+		lpathopt = start + 1;
+		start = p;
+		term = ":";
 	}
-	strcpy(q, name);
-	pathopt = NULL;
+
+	len = strcspn(start, term);
+	p = start + len;
+
 	if (*p == '%') {
-		pathopt = ++p;
-		while (*p && *p != ':')  p++;
+		size_t extra = strchrnul(p, ':') - p;
+
+		if (legal_pathopt(p + 1, term, magic))
+			lpathopt = p + 1;
+		else
+			len += extra;
+
+		p += extra;
+	}
+
+	pathopt = lpathopt;
+	*path = *p == ':' ? p + 1 : NULL;
+
+	/* "2" is for '/' and '\0' */
+	qlen = len + strlen(name) + 2;
+	q = growstackto(qlen);
+
+	if (likely(len)) {
+		q = mempcpy(q, start, len);
+		*q++ = '/';
 	}
-	if (*p == ':')
-		*path = p + 1;
-	else
-		*path = NULL;
-	return stalloc(len);
+	strcpy(q, name);
+
+	return qlen;
 }
 
 
@@ -231,7 +273,7 @@ hashcmd(int argc, char **argv)
 	char *name;
 
 	while ((c = nextopt("r")) != '\0') {
-		clearcmdentry(0);
+		clearcmdentry();
 		return 0;
 	}
 	if (*argptr == NULL) {
@@ -245,9 +287,11 @@ hashcmd(int argc, char **argv)
 	}
 	c = 0;
 	while ((name = *argptr) != NULL) {
-		if ((cmdp = cmdlookup(name, 0)) != NULL
-		 && (cmdp->cmdtype == CMDNORMAL
-		     || (cmdp->cmdtype == CMDBUILTIN && builtinloc >= 0)))
+		if ((cmdp = cmdlookup(name, 0)) &&
+		    (cmdp->cmdtype == CMDNORMAL ||
+		     (cmdp->cmdtype == CMDBUILTIN &&
+		      !(cmdp->param.cmd->flags & BUILTIN_REGULAR) &&
+		      builtinloc > 0)))
 			delete_cmd_entry();
 		find_command(name, &entry, DO_ERR, pathval());
 		if (entry.cmdtype == CMDUNKNOWN)
@@ -268,9 +312,9 @@ printentry(struct tblentry *cmdp)
 	idx = cmdp->param.index;
 	path = pathval();
 	do {
-		name = padvance(&path, cmdp->cmdname);
-		stunalloc(name);
+		padvance(&path, cmdp->cmdname);
 	} while (--idx >= 0);
+	name = stackblock();
 	out1str(name);
 	out1fmt(snlfmt, cmdp->rehash ? "*" : nullstr);
 }
@@ -293,6 +337,7 @@ find_command(char *name, struct cmdentry *entry, int act, const char *path)
 	int e;
 	int updatetbl;
 	struct builtincmd *bcmd;
+	int len;
 
 	/* If name contains a slash, don't use PATH or hash table */
 	if (strchr(name, '/') != NULL) {
@@ -312,11 +357,8 @@ find_command(char *name, struct cmdentry *entry, int act, const char *path)
 	}
 
 	updatetbl = (path == pathval());
-	if (!updatetbl) {
+	if (!updatetbl)
 		act |= DO_ALTPATH;
-		if (strstr(path, "%builtin") != NULL)
-			act |= DO_ALTBLTIN;
-	}
 
 	/* If name is in the table, check answer will be ok */
 	if ((cmdp = cmdlookup(name, 0)) != NULL) {
@@ -328,16 +370,20 @@ find_command(char *name, struct cmdentry *entry, int act, const char *path)
 			abort();
 #endif
 		case CMDNORMAL:
-			bit = DO_ALTPATH;
+			bit = DO_ALTPATH | DO_REGBLTIN;
 			break;
 		case CMDFUNCTION:
 			bit = DO_NOFUNC;
 			break;
 		case CMDBUILTIN:
-			bit = DO_ALTBLTIN;
+			bit = cmdp->param.cmd->flags & BUILTIN_REGULAR ?
+			      0 : DO_REGBLTIN;
 			break;
 		}
 		if (act & bit) {
+			if (act & bit & DO_REGBLTIN)
+				goto fail;
+
 			updatetbl = 0;
 			cmdp = NULL;
 		} else if (cmdp->rehash == 0)
@@ -347,11 +393,13 @@ find_command(char *name, struct cmdentry *entry, int act, const char *path)
 
 	/* If %builtin not in path, check for builtin next */
 	bcmd = find_builtin(name);
-	if (bcmd && (bcmd->flags & BUILTIN_REGULAR || (
-		act & DO_ALTPATH ? !(act & DO_ALTBLTIN) : builtinloc <= 0
-	)))
+	if (bcmd && ((bcmd->flags & BUILTIN_REGULAR) | (act & DO_ALTPATH) |
+		     (builtinloc <= 0)))
 		goto builtin_success;
 
+	if (act & DO_REGBLTIN)
+		goto fail;
+
 	/* We have to search path. */
 	prev = -1;		/* where to start */
 	if (cmdp && cmdp->rehash) {	/* doing a rehash */
@@ -364,16 +412,17 @@ find_command(char *name, struct cmdentry *entry, int act, const char *path)
 	e = ENOENT;
 	idx = -1;
 loop:
-	while ((fullname = padvance(&path, name)) != NULL) {
-		stunalloc(fullname);
+	while ((len = padvance(&path, name)) >= 0) {
+		const char *lpathopt = pathopt;
+
+		fullname = stackblock();
 		idx++;
-		if (pathopt) {
-			if (prefix(pathopt, "builtin")) {
+		if (lpathopt) {
+			if (*lpathopt == 'b') {
 				if (bcmd)
 					goto builtin_success;
 				continue;
-			} else if (!(act & DO_NOFUNC) &&
-				   prefix(pathopt, "func")) {
+			} else if (!(act & DO_NOFUNC)) {
 				/* handled below */
 			} else {
 				/* ignore unimplemented options */
@@ -399,8 +448,8 @@ loop:
 		e = EACCES;	/* if we fail, this will be the error */
 		if (!S_ISREG(statb.st_mode))
 			continue;
-		if (pathopt) {		/* this is a %func directory */
-			stalloc(strlen(fullname) + 1);
+		if (lpathopt) {		/* this is a %func directory */
+			stalloc(len);
 			readcmdfile(fullname);
 			if ((cmdp = cmdlookup(name, 0)) == NULL ||
 			    cmdp->cmdtype != CMDFUNCTION)
@@ -442,6 +491,7 @@ loop:
 		delete_cmd_entry();
 	if (act & DO_ERR)
 		sh_warnx("%s: %s", name, errmsg(e, E_EXEC));
+fail:
 	entry->cmdtype = CMDUNKNOWN;
 	return;
 
@@ -517,39 +567,26 @@ hashcd(void)
 void
 changepath(const char *newval)
 {
-	const char *old, *new;
+	const char *new;
 	int idx;
-	int firstchange;
 	int bltin;
 
-	old = pathval();
 	new = newval;
-	firstchange = 9999;	/* assume no change */
 	idx = 0;
 	bltin = -1;
 	for (;;) {
-		if (*old != *new) {
-			firstchange = idx;
-			if ((*old == '\0' && *new == ':')
-			 || (*old == ':' && *new == '\0'))
-				firstchange++;
-			old = new;	/* ignore subsequent differences */
-		}
-		if (*new == '\0')
-			break;
-		if (*new == '%' && bltin < 0 && prefix(new + 1, "builtin"))
+		if (*new == '%' && prefix(new + 1, "builtin")) {
 			bltin = idx;
-		if (*new == ':') {
-			idx++;
+			break;
 		}
-		new++, old++;
+		new = strchr(new, ':');
+		if (!new)
+			break;
+		idx++;
+		new++;
 	}
-	if (builtinloc < 0 && bltin >= 0)
-		builtinloc = bltin;		/* zap builtins */
-	if (builtinloc >= 0 && bltin < 0)
-		firstchange = 0;
-	clearcmdentry(firstchange);
 	builtinloc = bltin;
+	clearcmdentry();
 }
 
 
@@ -559,7 +596,7 @@ changepath(const char *newval)
  */
 
 STATIC void
-clearcmdentry(int firstchange)
+clearcmdentry(void)
 {
 	struct tblentry **tblp;
 	struct tblentry **pp;
@@ -569,10 +606,10 @@ clearcmdentry(int firstchange)
 	for (tblp = cmdtable ; tblp < &cmdtable[CMDTABLESIZE] ; tblp++) {
 		pp = tblp;
 		while ((cmdp = *pp) != NULL) {
-			if ((cmdp->cmdtype == CMDNORMAL &&
-			     cmdp->param.index >= firstchange)
-			 || (cmdp->cmdtype == CMDBUILTIN &&
-			     builtinloc >= firstchange)) {
+			if (cmdp->cmdtype == CMDNORMAL ||
+			    (cmdp->cmdtype == CMDBUILTIN &&
+			     !(cmdp->param.cmd->flags & BUILTIN_REGULAR) &&
+			     builtinloc > 0)) {
 				*pp = cmdp->next;
 				ckfree(cmdp);
 			} else {
@@ -791,9 +828,9 @@ describe_command(out, command, path, verbose)
 			p = command;
 		} else {
 			do {
-				p = padvance(&path, command);
-				stunalloc(p);
+				padvance(&path, command);
 			} while (--j >= 0);
+			p = stackblock();
 		}
 		if (verbose) {
 			outfmt(
diff --git a/src/exec.h b/src/exec.h
index 9ccb305fef8067ef83d84bea3aec95e45889678e..423b07e6d01d0ac95c27265dbc7bf8bd63970575 100644
--- a/src/exec.h
+++ b/src/exec.h
@@ -56,13 +56,15 @@ struct cmdentry {
 #define DO_ABS		0x02	/* checks absolute paths */
 #define DO_NOFUNC	0x04	/* don't return shell functions, for command */
 #define DO_ALTPATH	0x08	/* using alternate path */
-#define DO_ALTBLTIN	0x20	/* %builtin in alt. path */
+#define DO_REGBLTIN	0x10	/* regular built-ins and functions only */
+
+union node;
 
 extern const char *pathopt;	/* set by padvance */
 
 void shellexec(char **, const char *, int)
     __attribute__((__noreturn__));
-char *padvance(const char **, const char *);
+int padvance_magic(const char **path, const char *name, int magic);
 int hashcmd(int, char **);
 void find_command(char *, struct cmdentry *, int, const char *);
 struct builtincmd *find_builtin(const char *);
@@ -75,3 +77,8 @@ void defun(union node *);
 void unsetfunc(const char *);
 int typecmd(int, char **);
 int commandcmd(int, char **);
+
+static inline int padvance(const char **path, const char *name)
+{
+	return padvance_magic(path, name, 1);
+}
diff --git a/src/expand.c b/src/expand.c
index 7ed259a28ba89db503718e1f13e47811c00459ff..2ed02d6e9532904abd3698a00afb48652878134b 100644
--- a/src/expand.c
+++ b/src/expand.c
@@ -86,8 +86,6 @@
 
 /* Add CTLESC when necessary. */
 #define QUOTES_ESC	(EXP_FULL | EXP_CASE)
-/* Do not skip NUL characters. */
-#define QUOTES_KEEPNUL	EXP_TILDE
 
 /*
  * Structure specifying which parts of the string should be searched
@@ -112,17 +110,17 @@ static struct ifsregion *ifslastp;
 /* holds expanded arg list */
 static struct arglist exparg;
 
-STATIC void argstr(char *, int);
-STATIC char *exptilde(char *, char *, int);
+static char *argstr(char *p, int flag);
+static char *exptilde(char *startp, int flag);
+static char *expari(char *start, int flag);
 STATIC void expbackq(union node *, int);
-STATIC const char *subevalvar(char *, char *, int, int, int, int, int);
 STATIC char *evalvar(char *, int);
-STATIC size_t strtodest(const char *, const char *, int);
-STATIC void memtodest(const char *, size_t, const char *, int);
+static size_t strtodest(const char *p, int flags);
+static size_t memtodest(const char *p, size_t len, int flags);
 STATIC ssize_t varvalue(char *, int, int, int);
-STATIC void expandmeta(struct strlist *, int);
+STATIC void expandmeta(struct strlist *);
 #ifdef HAVE_GLOB
-STATIC void addglob(const glob_t *);
+static void addglob(const glob64_t *);
 #else
 STATIC void expmeta(char *, unsigned, unsigned);
 STATIC struct strlist *expsort(struct strlist *);
@@ -135,10 +133,8 @@ STATIC int pmatch(const char *, const char *);
 #else
 #define pmatch(a, b) !fnmatch((a), (b), 0)
 #endif
-STATIC int cvtnum(intmax_t);
+static size_t cvtnum(intmax_t num, int flags);
 STATIC size_t esclen(const char *, const char *);
-STATIC char *scanleft(char *, char *, char *, char *, int, int);
-STATIC char *scanright(char *, char *, char *, char *, int, int);
 STATIC void varunset(const char *, const char *, const char *, int)
 	__attribute__((__noreturn__));
 
@@ -194,13 +190,11 @@ expandarg(union node *arg, struct arglist *arglist, int flag)
 	argbackq = arg->narg.backquote;
 	STARTSTACKSTR(expdest);
 	argstr(arg->narg.text, flag);
-	p = _STPUTC('\0', expdest);
-	expdest = p - 1;
 	if (arglist == NULL) {
 		/* here document expanded */
 		goto out;
 	}
-	p = grabstackstr(p);
+	p = grabstackstr(expdest);
 	exparg.lastp = &exparg.list;
 	/*
 	 * TODO - EXP_REDIR
@@ -209,7 +203,7 @@ expandarg(union node *arg, struct arglist *arglist, int flag)
 		ifsbreakup(p, -1, &exparg);
 		*exparg.lastp = NULL;
 		exparg.lastp = &exparg.list;
-		expandmeta(exparg.list, flag);
+		expandmeta(exparg.list);
 	} else {
 		sp = (struct strlist *)stalloc(sizeof (struct strlist));
 		sp->text = p;
@@ -234,8 +228,7 @@ out:
  * $@ like $* since no splitting will be performed.
  */
 
-STATIC void
-argstr(char *p, int flag)
+static char *argstr(char *p, int flag)
 {
 	static const char spclchars[] = {
 		'=',
@@ -245,6 +238,7 @@ argstr(char *p, int flag)
 		CTLESC,
 		CTLVAR,
 		CTLBACKQ,
+		CTLARI,
 		CTLENDARI,
 		0
 	};
@@ -255,35 +249,41 @@ argstr(char *p, int flag)
 	size_t length;
 	int startloc;
 
-	if (!(flag & EXP_VARTILDE)) {
-		reject += 2;
-	} else if (flag & EXP_VARTILDE2) {
-		reject++;
-	}
+	reject += !!(flag & EXP_VARTILDE2);
+	reject += flag & EXP_VARTILDE ? 0 : 2;
 	inquotes = 0;
 	length = 0;
 	if (flag & EXP_TILDE) {
-		char *q;
-
 		flag &= ~EXP_TILDE;
 tilde:
-		q = p;
-		if (*q == '~')
-			p = exptilde(p, q, flag);
+		if (*p == '~')
+			p = exptilde(p, flag);
 	}
 start:
 	startloc = expdest - (char *)stackblock();
 	for (;;) {
+		int end;
+
 		length += strcspn(p + length, reject);
+		end = 0;
 		c = (signed char)p[length];
-		if (c && (!(c & 0x80) || c == CTLENDARI)) {
-			/* c == '=' || c == ':' || c == CTLENDARI */
+		if (!(c & 0x80) || c == CTLENDARI || c == CTLENDVAR) {
+			/*
+			 * c == '=' || c == ':' || c == '\0' ||
+			 * c == CTLENDARI || c == CTLENDVAR
+			 */
 			length++;
+			/* c == '\0' || c == CTLENDARI || c == CTLENDVAR */
+			end = !!((c - 1) & 0x80);
 		}
-		if (length > 0) {
+		if (length > 0 && !(flag & EXP_DISCARD)) {
 			int newloc;
-			expdest = stnputs(p, length, expdest);
-			newloc = expdest - (char *)stackblock();
+			char *q;
+
+			q = stnputs(p, length, expdest);
+			q[-1] &= end - 1;
+			expdest = q - (flag & EXP_WORD ? end : 0);
+			newloc = q - (char *)stackblock() - end;
 			if (breakall && !inquotes && newloc > startloc) {
 				recordregion(startloc, newloc, 0);
 			}
@@ -292,14 +292,11 @@ start:
 		p += length + 1;
 		length = 0;
 
+		if (end)
+			break;
+
 		switch (c) {
-		case '\0':
-			goto breakloop;
 		case '=':
-			if (flag & EXP_VARTILDE2) {
-				p--;
-				continue;
-			}
 			flag |= EXP_VARTILDE2;
 			reject++;
 			/* fall through */
@@ -312,11 +309,6 @@ start:
 				goto tilde;
 			}
 			continue;
-		}
-
-		switch (c) {
-		case CTLENDVAR: /* ??? */
-			goto breakloop;
 		case CTLQUOTEMARK:
 			/* "$@" syntax adherence hack */
 			if (!inquotes && !memcmp(p, dolatstr + 1,
@@ -341,26 +333,23 @@ addquote:
 			goto start;
 		case CTLBACKQ:
 			expbackq(argbackq->n, flag | inquotes);
-			argbackq = argbackq->next;
 			goto start;
-		case CTLENDARI:
-			p--;
-			expari(flag | inquotes);
+		case CTLARI:
+			p = expari(p, flag | inquotes);
 			goto start;
 		}
 	}
-breakloop:
-	;
+	return p - 1;
 }
 
-STATIC char *
-exptilde(char *startp, char *p, int flag)
+static char *exptilde(char *startp, int flag)
 {
 	signed char c;
 	char *name;
 	const char *home;
-	int quotes = flag & QUOTES_ESC;
+	char *p;
 
+	p = startp;
 	name = p + 1;
 
 	while ((c = *++p) != '\0') {
@@ -379,19 +368,21 @@ exptilde(char *startp, char *p, int flag)
 		}
 	}
 done:
+	if (flag & EXP_DISCARD)
+		goto out;
 	*p = '\0';
 	if (*name == '\0') {
 		home = lookupvar(homestr);
 	} else {
 		home = getpwhome(name);
 	}
-	if (!home || !*home)
-		goto lose;
 	*p = c;
-	strtodest(home, SQSYNTAX, quotes);
+	if (!home)
+		goto lose;
+	strtodest(home, flag | EXP_QUOTED);
+out:
 	return (p);
 lose:
-	*p = c;
 	return (startp);
 }
 
@@ -440,63 +431,43 @@ removerecordregions(int endoff)
  * Expand arithmetic expression.  Backup to start of expression,
  * evaluate, place result in (backed up) result, adjust string position.
  */
-void
-expari(int flag)
+static char *expari(char *start, int flag)
 {
 	struct stackmark sm;
-	char *p, *start;
 	int begoff;
+	int endoff;
 	int len;
 	intmax_t result;
+	char *p;
 
-	/*	ifsfree(); */
-
-	/*
-	 * This routine is slightly over-complicated for
-	 * efficiency.  Next we scan backwards looking for the
-	 * start of arithmetic.
-	 */
-	start = stackblock();
-	p = expdest;
-	pushstackmark(&sm, p - start);
-	*--p = '\0';
-	p--;
-	do {
-		int esc;
-
-		while (*p != (char)CTLARI) {
-			p--;
-#ifdef DEBUG
-			if (p < start) {
-				sh_error("missing CTLARI (shouldn't happen)");
-			}
-#endif
-		}
-
-		esc = esclen(start, p);
-		if (!(esc % 2)) {
-			break;
-		}
+	p = stackblock();
+	begoff = expdest - p;
+	p = argstr(start, flag & EXP_DISCARD);
 
-		p -= esc + 1;
-	} while (1);
+	if (flag & EXP_DISCARD)
+		goto out;
 
-	begoff = p - start;
+	start = stackblock();
+	endoff = expdest - start;
+	start += begoff;
+	STADJUST(start - expdest, expdest);
 
 	removerecordregions(begoff);
 
-	expdest = p;
-
 	if (likely(flag & QUOTES_ESC))
-		rmescapes(p + 1);
+		rmescapes(start);
 
-	result = arith(p + 1);
+	pushstackmark(&sm, endoff);
+	result = arith(start);
 	popstackmark(&sm);
 
-	len = cvtnum(result);
+	len = cvtnum(result, flag);
 
 	if (likely(!(flag & EXP_QUOTED)))
 		recordregion(begoff, begoff + len, 0);
+
+out:
+	return p;
 }
 
 
@@ -513,9 +484,11 @@ expbackq(union node *cmd, int flag)
 	char *p;
 	char *dest;
 	int startloc;
-	char const *syntax = flag & EXP_QUOTED ? DQSYNTAX : BASESYNTAX;
 	struct stackmark smark;
 
+	if (flag & EXP_DISCARD)
+		goto out;
+
 	INTOFF;
 	startloc = expdest - (char *)stackblock();
 	pushstackmark(&smark, startloc);
@@ -527,7 +500,7 @@ expbackq(union node *cmd, int flag)
 	if (i == 0)
 		goto read;
 	for (;;) {
-		memtodest(p, i, syntax, flag & QUOTES_ESC);
+		memtodest(p, i, flag);
 read:
 		if (in.fd < 0)
 			break;
@@ -550,7 +523,7 @@ read:
 
 	/* Eat all trailing newlines */
 	dest = expdest;
-	for (; dest > (char *)stackblock() && dest[-1] == '\n';)
+	for (; dest > ((char *)stackblock() + startloc) && dest[-1] == '\n';)
 		STUNPUTC(dest);
 	expdest = dest;
 
@@ -560,13 +533,14 @@ read:
 		(dest - (char *)stackblock()) - startloc,
 		(dest - (char *)stackblock()) - startloc,
 		stackblock() + startloc));
+
+out:
+	argbackq = argbackq->next;
 }
 
 
-STATIC char *
-scanleft(
-	char *startp, char *rmesc, char *rmescend, char *str, int quotes,
-	int zero
+static char *scanleft(char *startp, char *endp, char *rmesc, char *rmescend,
+		      char *str, int quotes, int zero
 ) {
 	char *loc;
 	char *loc2;
@@ -595,16 +569,14 @@ scanleft(
 }
 
 
-STATIC char *
-scanright(
-	char *startp, char *rmesc, char *rmescend, char *str, int quotes,
-	int zero
+static char *scanright(char *startp, char *endp, char *rmesc, char *rmescend,
+		       char *str, int quotes, int zero
 ) {
 	int esc = 0;
 	char *loc;
 	char *loc2;
 
-	for (loc = str - 1, loc2 = rmescend; loc >= startp; loc2--) {
+	for (loc = endp, loc2 = rmescend; loc >= startp; loc2--) {
 		int match;
 		char c = *loc2;
 		const char *s = loc2;
@@ -630,33 +602,37 @@ scanright(
 	return 0;
 }
 
-STATIC const char *
-subevalvar(char *p, char *str, int strloc, int subtype, int startloc, int varflags, int flag)
+static char *subevalvar(char *start, char *str, int strloc, int startloc,
+			int varflags, int flag)
 {
+	int subtype = varflags & VSTYPE;
 	int quotes = flag & QUOTES_ESC;
 	char *startp;
 	char *loc;
-	struct nodelist *saveargbackq = argbackq;
-	int amount;
+	long amount;
 	char *rmesc, *rmescend;
 	int zero;
-	char *(*scan)(char *, char *, char *, char *, int , int);
+	char *(*scan)(char *, char *, char *, char *, char *, int , int);
+	int nstrloc = strloc;
+	char *endp;
+	char *p;
+
+	p = argstr(start, (flag & EXP_DISCARD) | EXP_TILDE |
+			  (str ?  0 : EXP_CASE));
+	if (flag & EXP_DISCARD)
+		return p;
 
-	argstr(p, EXP_TILDE | (subtype != VSASSIGN && subtype != VSQUESTION ?
-			       EXP_CASE : 0));
-	STPUTC('\0', expdest);
-	argbackq = saveargbackq;
 	startp = stackblock() + startloc;
 
 	switch (subtype) {
 	case VSASSIGN:
 		setvar(str, startp, 0);
-		amount = startp - expdest;
-		STADJUST(amount, expdest);
-		return startp;
+
+		loc = startp;
+		goto out;
 
 	case VSQUESTION:
-		varunset(p, str, startp, varflags);
+		varunset(start, str, startp, varflags);
 		/* NOTREACHED */
 	}
 
@@ -666,35 +642,49 @@ subevalvar(char *p, char *str, int strloc, int subtype, int startloc, int varfla
 		abort();
 #endif
 
-	rmesc = startp;
 	rmescend = stackblock() + strloc;
+	str = preglob(rmescend, FNMATCH_IS_ENABLED ?
+				RMESCAPE_ALLOC | RMESCAPE_GROW : 0);
+	if (FNMATCH_IS_ENABLED) {
+		startp = stackblock() + startloc;
+		rmescend = stackblock() + strloc;
+		nstrloc = str - (char *)stackblock();
+	}
+
+	rmesc = startp;
 	if (quotes) {
 		rmesc = _rmescapes(startp, RMESCAPE_ALLOC | RMESCAPE_GROW);
-		if (rmesc != startp) {
+		if (rmesc != startp)
 			rmescend = expdest;
-			startp = stackblock() + startloc;
-		}
+		startp = stackblock() + startloc;
+		str = stackblock() + nstrloc;
 	}
 	rmescend--;
-	str = stackblock() + strloc;
-	preglob(str, 0);
 
 	/* zero = subtype == VSTRIMLEFT || subtype == VSTRIMLEFTMAX */
 	zero = subtype >> 1;
 	/* VSTRIMLEFT/VSTRIMRIGHTMAX -> scanleft */
 	scan = (subtype & 1) ^ zero ? scanleft : scanright;
 
-	loc = scan(startp, rmesc, rmescend, str, quotes, zero);
+	endp = stackblock() + strloc - 1;
+	loc = scan(startp, endp, rmesc, rmescend, str, quotes, zero);
 	if (loc) {
 		if (zero) {
-			memmove(startp, loc, str - loc);
-			loc = startp + (str - loc) - 1;
+			memmove(startp, loc, endp - loc);
+			loc = startp + (endp - loc);
 		}
 		*loc = '\0';
-		amount = loc - expdest;
-		STADJUST(amount, expdest);
-	}
-	return loc;
+	} else
+		loc = endp;
+
+out:
+	amount = loc - expdest;
+	STADJUST(amount, expdest);
+
+	/* Remove any recorded regions beyond start of variable */
+	removerecordregions(startloc);
+
+	return p;
 }
 
 
@@ -709,17 +699,14 @@ evalvar(char *p, int flag)
 	int varflags;
 	char *var;
 	int patloc;
-	int c;
 	int startloc;
 	ssize_t varlen;
+	int discard;
 	int quoted;
 
-	varflags = *p++;
+	varflags = *p++ & ~VSBIT;
 	subtype = varflags & VSTYPE;
 
-	if (!subtype)
-		sh_error("Bad substitution");
-
 	quoted = flag & EXP_QUOTED;
 	var = p;
 	startloc = expdest - (char *)stackblock();
@@ -730,53 +717,46 @@ again:
 	if (varflags & VSNUL)
 		varlen--;
 
-	if (subtype == VSPLUS) {
-		varlen = -1 - varlen;
-		goto vsplus;
-	}
+	discard = varlen < 0 ? EXP_DISCARD : 0;
 
-	if (subtype == VSMINUS) {
-vsplus:
-		if (varlen < 0) {
-			argstr(p, flag | EXP_TILDE | EXP_WORD);
-			goto end;
-		}
+	switch (subtype) {
+	case VSPLUS:
+		discard ^= EXP_DISCARD;
+		/* fall through */
+
+	case 0:
+	case VSMINUS:
+		p = argstr(p, flag | EXP_TILDE | EXP_WORD |
+			      (discard ^ EXP_DISCARD));
 		goto record;
-	}
 
-	if (subtype == VSASSIGN || subtype == VSQUESTION) {
-		if (varlen >= 0)
+	case VSASSIGN:
+	case VSQUESTION:
+		p = subevalvar(p, var, 0, startloc, varflags,
+			       (flag & ~QUOTES_ESC) |
+			       (discard ^ EXP_DISCARD));
+
+		if ((flag | ~discard) & EXP_DISCARD)
 			goto record;
 
-		subevalvar(p, var, 0, subtype, startloc, varflags,
-			   flag & ~QUOTES_ESC);
 		varflags &= ~VSNUL;
-		/* 
-		 * Remove any recorded regions beyond 
-		 * start of variable 
-		 */
-		removerecordregions(startloc);
+		subtype = VSNORMAL;
 		goto again;
 	}
 
-	if (varlen < 0 && uflag)
+	if ((discard & ~flag) && uflag)
 		varunset(p, var, 0, 0);
 
 	if (subtype == VSLENGTH) {
-		cvtnum(varlen > 0 ? varlen : 0);
-		goto record;
+		p++;
+		if (flag & EXP_DISCARD)
+			return p;
+		cvtnum(varlen > 0 ? varlen : 0, flag);
+		goto really_record;
 	}
 
-	if (subtype == VSNORMAL) {
-record:
-		if (quoted) {
-			quoted = *var == '@' && shellparam.nparam;
-			if (!quoted)
-				goto end;
-		}
-		recordregion(startloc, expdest - (char *)stackblock(), quoted);
-		goto end;
-	}
+	if (subtype == VSNORMAL)
+		goto record;
 
 #ifdef DEBUG
 	switch (subtype) {
@@ -790,43 +770,29 @@ record:
 	}
 #endif
 
-	if (varlen >= 0) {
+	flag |= discard;
+	if (!(flag & EXP_DISCARD)) {
 		/*
 		 * Terminate the string and start recording the pattern
 		 * right after it
 		 */
 		STPUTC('\0', expdest);
-		patloc = expdest - (char *)stackblock();
-		if (subevalvar(p, NULL, patloc, subtype,
-			       startloc, varflags, flag) == 0) {
-			int amount = expdest - (
-				(char *)stackblock() + patloc - 1
-			);
-			STADJUST(-amount, expdest);
-		}
-		/* Remove any recorded regions beyond start of variable */
-		removerecordregions(startloc);
-		goto record;
 	}
 
-end:
-	if (subtype != VSNORMAL) {	/* skip to end of alternative */
-		int nesting = 1;
-		for (;;) {
-			if ((c = (signed char)*p++) == CTLESC)
-				p++;
-			else if (c == CTLBACKQ) {
-				if (varlen >= 0)
-					argbackq = argbackq->next;
-			} else if (c == CTLVAR) {
-				if ((*p++ & VSTYPE) != VSNORMAL)
-					nesting++;
-			} else if (c == CTLENDVAR) {
-				if (--nesting == 0)
-					break;
-			}
-		}
+	patloc = expdest - (char *)stackblock();
+	p = subevalvar(p, NULL, patloc, startloc, varflags, flag);
+
+record:
+	if ((flag | discard) & EXP_DISCARD)
+		return p;
+
+really_record:
+	if (quoted) {
+		quoted = *var == '@' && shellparam.nparam;
+		if (!quoted)
+			return p;
 	}
+	recordregion(startloc, expdest - (char *)stackblock(), quoted);
 	return p;
 }
 
@@ -835,39 +801,39 @@ end:
  * Put a string on the stack.
  */
 
-STATIC void
-memtodest(const char *p, size_t len, const char *syntax, int quotes) {
+static size_t memtodest(const char *p, size_t len, int flags)
+{
+	const char *syntax = flags & EXP_QUOTED ? DQSYNTAX : BASESYNTAX;
 	char *q;
+	char *s;
 
 	if (unlikely(!len))
-		return;
+		return 0;
 
 	q = makestrspace(len * 2, expdest);
+	s = q;
 
 	do {
 		int c = (signed char)*p++;
 		if (c) {
-			if ((quotes & QUOTES_ESC) &&
+			if ((flags & QUOTES_ESC) &&
 			    ((syntax[c] == CCTL) ||
-			     (syntax != BASESYNTAX && syntax[c] == CBACK)))
+			     (flags & EXP_QUOTED && syntax[c] == CBACK)))
 				USTPUTC(CTLESC, q);
-		} else if (!(quotes & QUOTES_KEEPNUL))
+		} else if (!(flags & EXP_KEEPNUL))
 			continue;
 		USTPUTC(c, q);
 	} while (--len);
 
 	expdest = q;
+	return q - s;
 }
 
 
-STATIC size_t
-strtodest(p, syntax, quotes)
-	const char *p;
-	const char *syntax;
-	int quotes;
+static size_t strtodest(const char *p, int flags)
 {
 	size_t len = strlen(p);
-	memtodest(p, len, syntax, quotes);
+	memtodest(p, len, flags);
 	return len;
 }
 
@@ -886,15 +852,22 @@ varvalue(char *name, int varflags, int flags, int quoted)
 	int sep;
 	char sepc;
 	char **ap;
-	char const *syntax;
 	int subtype = varflags & VSTYPE;
-	int discard = subtype == VSPLUS || subtype == VSLENGTH;
-	int quotes = (discard ? 0 : (flags & QUOTES_ESC)) | QUOTES_KEEPNUL;
+	int discard = (subtype == VSPLUS || subtype == VSLENGTH) |
+		      (flags & EXP_DISCARD);
 	ssize_t len = 0;
 	char c;
 
+	if (!subtype) {
+		if (discard)
+			return -1;
+
+		sh_error("Bad substitution");
+	}
+
+	flags |= EXP_KEEPNUL;
+	flags &= discard ? ~QUOTES_ESC : ~0;
 	sep = (flags & EXP_FULL) << CHAR_BIT;
-	syntax = quoted ? DQSYNTAX : BASESYNTAX;
 
 	switch (*name) {
 	case '$':
@@ -911,7 +884,7 @@ varvalue(char *name, int varflags, int flags, int quoted)
 		if (num == 0)
 			return -1;
 numvar:
-		len = cvtnum(num);
+		len = cvtnum(num, flags);
 		break;
 	case '-':
 		p = makestrspace(NOPTS, expdest);
@@ -950,11 +923,11 @@ param:
 		if (!(ap = shellparam.p))
 			return -1;
 		while ((p = *ap++)) {
-			len += strtodest(p, syntax, quotes);
+			len += strtodest(p, flags);
 
 			if (*ap && sep) {
 				len++;
-				memtodest(&sepc, 1, syntax, quotes);
+				memtodest(&sepc, 1, flags);
 			}
 		}
 		break;
@@ -979,12 +952,13 @@ value:
 		if (!p)
 			return -1;
 
-		len = strtodest(p, syntax, quotes);
+		len = strtodest(p, flags);
 		break;
 	}
 
 	if (discard)
 		STADJUST(-len, expdest);
+
 	return len;
 }
 
@@ -1183,23 +1157,44 @@ out:
  */
 
 #ifdef HAVE_GLOB
+#ifdef __GLIBC__
+void *opendir_interruptible(const char *pathname)
+{
+	if (int_pending()) {
+		suppressint = 0;
+		onint();
+	}
+
+	return opendir(pathname);
+}
+#else
+#define GLOB_ALTDIRFUNC 0
+#endif
+
 STATIC void
-expandmeta(str, flag)
-	struct strlist *str;
-	int flag;
+expandmeta(struct strlist *str)
 {
 	/* TODO - EXP_REDIR */
 
 	while (str) {
 		const char *p;
-		glob_t pglob;
+		glob64_t pglob;
 		int i;
 
 		if (fflag)
 			goto nometa;
+
+#ifdef __GLIBC__
+		pglob.gl_closedir = (void *)closedir;
+		pglob.gl_readdir = (void *)readdir64;
+		pglob.gl_opendir = opendir_interruptible;
+		pglob.gl_lstat = lstat64;
+		pglob.gl_stat = stat64;
+#endif
+
 		INTOFF;
 		p = preglob(str->text, RMESCAPE_ALLOC | RMESCAPE_HEAP);
-		i = glob(p, GLOB_NOMAGIC, 0, &pglob);
+		i = glob64(p, GLOB_ALTDIRFUNC | GLOB_NOMAGIC, 0, &pglob);
 		if (p != str->text)
 			ckfree(p);
 		switch (i) {
@@ -1208,12 +1203,12 @@ expandmeta(str, flag)
 			    (GLOB_NOMAGIC | GLOB_NOCHECK))
 				goto nometa2;
 			addglob(&pglob);
-			globfree(&pglob);
+			globfree64(&pglob);
 			INTON;
 			break;
 		case GLOB_NOMATCH:
 nometa2:
-			globfree(&pglob);
+			globfree64(&pglob);
 			INTON;
 nometa:
 			*exparg.lastp = str;
@@ -1232,9 +1227,7 @@ nometa:
  * Add the result of glob(3) to the list.
  */
 
-STATIC void
-addglob(pglob)
-	const glob_t *pglob;
+static void addglob(const glob64_t *pglob)
 {
 	char **p = pglob->gl_pathv;
 
@@ -1250,7 +1243,7 @@ STATIC unsigned expdir_max;
 
 
 STATIC void
-expandmeta(struct strlist *str, int flag)
+expandmeta(struct strlist *str)
 {
 	static const char metachars[] = {
 		'*', '?', '[', 0
@@ -1315,7 +1308,7 @@ expmeta(char *name, unsigned name_len, unsigned expdir_len)
 	int metaflag;
 	struct stat64 statb;
 	DIR *dirp;
-	struct dirent *dp;
+	struct dirent64 *dp;
 	int atend;
 	int matchdot;
 	int esc;
@@ -1392,7 +1385,7 @@ expmeta(char *name, unsigned name_len, unsigned expdir_len)
 		p++;
 	if (*p == '.')
 		matchdot++;
-	while (! int_pending() && (dp = readdir(dirp)) != NULL) {
+	while (! int_pending() && (dp = readdir64(dirp)) != NULL) {
 		if (dp->d_name[0] == '.' && ! matchdot)
 			continue;
 		if (pmatch(start, dp->d_name)) {
@@ -1511,7 +1504,9 @@ msort(struct strlist *list, int len)
 STATIC inline int
 patmatch(char *pattern, const char *string)
 {
-	return pmatch(preglob(pattern, 0), string);
+	return pmatch(preglob(pattern, FNMATCH_IS_ENABLED ?
+				       RMESCAPE_ALLOC | RMESCAPE_GROW : 0),
+		      string);
 }
 
 
@@ -1664,15 +1659,22 @@ _rmescapes(char *str, int flag)
 	int notescaped;
 	int globbing;
 
-	p = strpbrk(str, qchars);
+	p = strpbrk(str, cqchars);
 	if (!p) {
 		return str;
 	}
 	q = p;
 	r = str;
+	globbing = flag & RMESCAPE_GLOB;
+
 	if (flag & RMESCAPE_ALLOC) {
 		size_t len = p - str;
-		size_t fulllen = len + strlen(p) + 1;
+		size_t fulllen = strlen(p);
+
+		if (FNMATCH_IS_ENABLED && globbing)
+			fulllen *= 2;
+
+		fulllen += len + 1;
 
 		if (flag & RMESCAPE_GROW) {
 			int strloc = str - (char *)stackblock();
@@ -1690,7 +1692,6 @@ _rmescapes(char *str, int flag)
 			q = mempcpy(q, str, len);
 		}
 	}
-	globbing = flag & RMESCAPE_GLOB;
 	notescaped = globbing;
 	while (*p) {
 		if (*p == (char)CTLQUOTEMARK) {
@@ -1703,8 +1704,11 @@ _rmescapes(char *str, int flag)
 			notescaped = 0;
 			goto copy;
 		}
+		if (FNMATCH_IS_ENABLED && *p == '^')
+			goto add_escape;
 		if (*p == (char)CTLESC) {
 			p++;
+add_escape:
 			if (notescaped)
 				*q++ = '\\';
 		}
@@ -1736,7 +1740,6 @@ casematch(union node *pattern, char *val)
 	argbackq = pattern->narg.backquote;
 	STARTSTACKSTR(expdest);
 	argstr(pattern->narg.text, EXP_TILDE | EXP_CASE);
-	STACKSTRNUL(expdest);
 	ifsfree();
 	result = patmatch(stackblock(), val);
 	popstackmark(&smark);
@@ -1747,15 +1750,13 @@ casematch(union node *pattern, char *val)
  * Our own itoa().
  */
 
-STATIC int
-cvtnum(intmax_t num)
+static size_t cvtnum(intmax_t num, int flags)
 {
 	int len = max_int_length(sizeof(num));
+	char buf[len];
 
-	expdest = makestrspace(len, expdest);
-	len = fmtstr(expdest, len, "%" PRIdMAX, num);
-	STADJUST(len, expdest);
-	return len;
+	len = fmtstr(buf, len, "%" PRIdMAX, num);
+	return memtodest(buf, len, flags);
 }
 
 STATIC void
@@ -1776,11 +1777,21 @@ varunset(const char *end, const char *var, const char *umsg, int varflags)
 	sh_error("%.*s: %s%s", end - var - 1, var, msg, tail);
 }
 
+void restore_handler_expandarg(struct jmploc *savehandler, int err)
+{
+	handler = savehandler;
+	if (err) {
+		if (exception != EXERROR)
+			longjmp(handler->loc, 1);
+		ifsfree();
+	}
+}
+
 #ifdef mkinit
 
 INCLUDE "expand.h"
 
-RESET {
+EXITRESET {
 	ifsfree();
 }
 
diff --git a/src/expand.h b/src/expand.h
index 90f53283e4f2a6f57d9d267a6f70a09ad26f1ae4..49a18f94bd207a323ed5f44479045827abdcc820 100644
--- a/src/expand.h
+++ b/src/expand.h
@@ -58,11 +58,14 @@ struct arglist {
 #define EXP_VARTILDE2	0x40	/* expand tildes after colons only */
 #define EXP_WORD	0x80	/* expand word in parameter expansion */
 #define EXP_QUOTED	0x100	/* expand word in double quotes */
+#define EXP_KEEPNUL	0x200	/* do not skip NUL characters */
+#define EXP_DISCARD	0x400	/* discard result of expansion */
 
 
+struct jmploc;
 union node;
+
 void expandarg(union node *, struct arglist *, int);
-void expari(int);
 #define rmescapes(p) _rmescapes((p), 0)
 char *_rmescapes(char *, int);
 int casematch(union node *, char *);
@@ -70,6 +73,7 @@ void recordregion(int, int, int);
 void removerecordregions(int); 
 void ifsbreakup(char *, int, struct arglist *);
 void ifsfree(void);
+void restore_handler_expandarg(struct jmploc *savehandler, int err);
 
 /* From arith.y */
 intmax_t arith(const char *);
diff --git a/src/init.h b/src/init.h
index e026e86862fed4edf5d3c98885461261948888ad..d56fb28e5f1881ad6315a64e085b549556e10930 100644
--- a/src/init.h
+++ b/src/init.h
@@ -35,5 +35,6 @@
  */
 
 void init(void);
+void exitreset(void);
+void forkreset(void);
 void reset(void);
-void initshellproc(void);
diff --git a/src/input.c b/src/input.c
index ae0c4c809817ab9878a725b5c56a119b3e0addcf..ec075f5b6f3cb07eb8946ea5321610958a7d0b1f 100644
--- a/src/input.c
+++ b/src/input.c
@@ -58,7 +58,6 @@
 #include "myhistedit.h"
 #endif
 
-#define EOF_NLEFT -99		/* value of parsenleft when EOF pushed back */
 #define IBUFSIZ (BUFSIZ + 1)
 
 
@@ -67,17 +66,15 @@ MKINIT char basebuf[IBUFSIZ];	/* buffer for top level input file */
 struct parsefile *parsefile = &basepf;	/* current input file */
 int whichprompt;		/* 1 == PS1, 2 == PS2 */
 
-#ifndef SMALL
-EditLine *el;			/* cookie for editline package */
-#endif
-
 STATIC void pushfile(void);
+static void popstring(void);
 static int preadfd(void);
 static void setinputfd(int fd, int push);
 static int preadbuffer(void);
 
 #ifdef mkinit
 INCLUDE <stdio.h>
+INCLUDE <unistd.h>
 INCLUDE "input.h"
 INCLUDE "error.h"
 
@@ -89,18 +86,46 @@ INIT {
 RESET {
 	/* clear input buffer */
 	basepf.lleft = basepf.nleft = 0;
+	basepf.unget = 0;
 	popallfiles();
 }
+
+FORKRESET {
+	popallfiles();
+	if (parsefile->fd > 0) {
+		close(parsefile->fd);
+		parsefile->fd = 0;
+	}
+}
 #endif
 
 
-/*
- * Read a character from the script, returning PEOF on end of file.
- * Nul characters in the input are silently discarded.
- */
+static void freestrings(struct strpush *sp)
+{
+	INTOFF;
+	do {
+		struct strpush *psp;
 
-int
-pgetc(void)
+		if (sp->ap) {
+			sp->ap->flag &= ~ALIASINUSE;
+			if (sp->ap->flag & ALIASDEAD) {
+				unalias(sp->ap->name);
+			}
+		}
+
+		psp = sp;
+		sp = sp->spfree;
+
+		if (psp != &(parsefile->basestrpush))
+			ckfree(psp);
+	} while (sp);
+
+	parsefile->spfree = NULL;
+	INTON;
+}
+
+
+static int __pgetc(void)
 {
 	int c;
 
@@ -120,17 +145,18 @@ pgetc(void)
 
 
 /*
- * Same as pgetc(), but ignores PEOA.
+ * Read a character from the script, returning PEOF on end of file.
+ * Nul characters in the input are silently discarded.
  */
 
-int
-pgetc2()
+int pgetc(void)
 {
-	int c;
-	do {
-		c = pgetc();
-	} while (c == PEOA);
-	return c;
+	struct strpush *sp = parsefile->spfree;
+
+	if (unlikely(sp))
+		freestrings(sp);
+
+	return __pgetc();
 }
 
 
@@ -193,9 +219,8 @@ retry:
  * Refill the input buffer and return the next input character:
  *
  * 1) If a string was pushed back on the input, pop it;
- * 2) If an EOF was pushed back (parsenleft == EOF_NLEFT) or we are reading
- *    from a string so we can't refill the buffer, return EOF.
- * 3) If the is more stuff in this buffer, use it else call read to fill it.
+ * 2) If we are reading from a string we can't refill the buffer, return EOF.
+ * 3) If there is more stuff in this buffer, use it else call read to fill it.
  * 4) Process input up to the next newline, deleting nul characters.
  */
 
@@ -209,19 +234,10 @@ static int preadbuffer(void)
 	char savec;
 
 	if (unlikely(parsefile->strpush)) {
-		if (
-			parsefile->nleft == -1 &&
-			parsefile->strpush->ap &&
-			parsefile->nextc[-1] != ' ' &&
-			parsefile->nextc[-1] != '\t'
-		) {
-			return PEOA;
-		}
 		popstring();
-		return pgetc();
+		return __pgetc();
 	}
-	if (unlikely(parsefile->nleft == EOF_NLEFT ||
-		     parsefile->buf == NULL))
+	if (parsefile->buf == NULL)
 		return PEOF;
 	flushall();
 
@@ -229,7 +245,7 @@ static int preadbuffer(void)
 	if (more <= 0) {
 again:
 		if ((more = preadfd()) <= 0) {
-			parsefile->lleft = parsefile->nleft = EOF_NLEFT;
+			parsefile->lleft = parsefile->nleft = 0;
 			return PEOF;
 		}
 	}
@@ -326,7 +342,8 @@ pushstring(char *s, void *ap)
 	len = strlen(s);
 	INTOFF;
 /*dprintf("*** calling pushstring: %s, %d\n", s, len);*/
-	if (parsefile->strpush) {
+	if ((unsigned long)parsefile->strpush |
+	    (unsigned long)parsefile->spfree) {
 		sp = ckmalloc(sizeof (struct strpush));
 		sp->prev = parsefile->strpush;
 		parsefile->strpush = sp;
@@ -335,6 +352,7 @@ pushstring(char *s, void *ap)
 	sp->prevstring = parsefile->nextc;
 	sp->prevnleft = parsefile->nleft;
 	sp->unget = parsefile->unget;
+	sp->spfree = parsefile->spfree;
 	memcpy(sp->lastc, parsefile->lastc, sizeof(sp->lastc));
 	sp->ap = (struct alias *)ap;
 	if (ap) {
@@ -344,11 +362,11 @@ pushstring(char *s, void *ap)
 	parsefile->nextc = s;
 	parsefile->nleft = len;
 	parsefile->unget = 0;
+	parsefile->spfree = NULL;
 	INTON;
 }
 
-void
-popstring(void)
+static void popstring(void)
 {
 	struct strpush *sp = parsefile->strpush;
 
@@ -361,10 +379,6 @@ popstring(void)
 		if (sp->string != sp->ap->val) {
 			ckfree(sp->string);
 		}
-		sp->ap->flag &= ~ALIASINUSE;
-		if (sp->ap->flag & ALIASDEAD) {
-			unalias(sp->ap->name);
-		}
 	}
 	parsefile->nextc = sp->prevstring;
 	parsefile->nleft = sp->prevnleft;
@@ -372,8 +386,7 @@ popstring(void)
 	memcpy(parsefile->lastc, sp->lastc, sizeof(sp->lastc));
 /*dprintf("*** calling popstring: restoring to '%s'\n", parsenextc);*/
 	parsefile->strpush = sp->prev;
-	if (sp != &(parsefile->basestrpush))
-		ckfree(sp);
+	parsefile->spfree = sp;
 	INTON;
 }
 
@@ -388,12 +401,9 @@ setinputfile(const char *fname, int flags)
 	int fd;
 
 	INTOFF;
-	if ((fd = open(fname, O_RDONLY)) < 0) {
-		if (flags & INPUT_NOFILE_OK)
-			goto out;
-		exitstatus = 127;
-		exerror(EXERROR, "Can't open %s", fname);
-	}
+	fd = sh_open(fname, O_RDONLY, flags & INPUT_NOFILE_OK);
+	if (fd < 0)
+		goto out;
 	if (fd < 10)
 		fd = savefd(fd, fd);
 	setinputfd(fd, flags & INPUT_PUSH_FILE);
@@ -455,6 +465,7 @@ pushfile(void)
 	pf->prev = parsefile;
 	pf->fd = -1;
 	pf->strpush = NULL;
+	pf->spfree = NULL;
 	pf->basestrpush.prev = NULL;
 	pf->unget = 0;
 	parsefile = pf;
@@ -471,8 +482,12 @@ popfile(void)
 		close(pf->fd);
 	if (pf->buf)
 		ckfree(pf->buf);
-	while (pf->strpush)
+	if (parsefile->spfree)
+		freestrings(parsefile->spfree);
+	while (pf->strpush) {
 		popstring();
+		freestrings(parsefile->spfree);
+	}
 	parsefile = pf->prev;
 	ckfree(pf);
 	INTON;
@@ -495,20 +510,3 @@ popallfiles(void)
 {
 	unwindfiles(&basepf);
 }
-
-
-
-/*
- * Close the file(s) that the shell is reading commands from.  Called
- * after a fork is done.
- */
-
-void
-closescript(void)
-{
-	popallfiles();
-	if (parsefile->fd > 0) {
-		close(parsefile->fd);
-		parsefile->fd = 0;
-	}
-}
diff --git a/src/input.h b/src/input.h
index a9c051743b0f5d48493ca0c9fecce262aba0bc1e..8c39f33c6be3f0efa3e4d8db78539c5695c5664b 100644
--- a/src/input.h
+++ b/src/input.h
@@ -50,6 +50,9 @@ struct strpush {
 	struct alias *ap;	/* if push was associated with an alias */
 	char *string;		/* remember the string since it may change */
 
+	/* Delay freeing so we can stop nested aliases. */
+	struct strpush *spfree;
+
 	/* Remember last two characters for pungetc. */
 	int lastc[2];
 
@@ -73,6 +76,9 @@ struct parsefile {
 	struct strpush *strpush; /* for pushing strings at this level */
 	struct strpush basestrpush; /* so pushing one is fast */
 
+	/* Delay freeing so we can stop nested aliases. */
+	struct strpush *spfree;
+
 	/* Remember last two characters for pungetc. */
 	int lastc[2];
 
@@ -93,10 +99,8 @@ int pgetc(void);
 int pgetc2(void);
 void pungetc(void);
 void pushstring(char *, void *);
-void popstring(void);
 int setinputfile(const char *, int);
 void setinputstring(char *);
 void popfile(void);
 void unwindfiles(struct parsefile *);
 void popallfiles(void);
-void closescript(void);
diff --git a/src/jobs.c b/src/jobs.c
index 606d60325293abfa418a7df5f56ee85d1097c2a1..f3b9ffc28535ef3ef4ecd2e3be05d9a834f24a86 100644
--- a/src/jobs.c
+++ b/src/jobs.c
@@ -53,7 +53,9 @@
 #include <termios.h>
 #undef CEOF			/* syntax.h redefines this */
 #endif
+#include "exec.h"
 #include "eval.h"
+#include "init.h"
 #include "redir.h"
 #include "show.h"
 #include "main.h"
@@ -76,9 +78,10 @@
 #define CUR_STOPPED 0
 
 /* mode flags for dowait */
-#define DOWAIT_NORMAL 0
+#define DOWAIT_NONBLOCK 0
 #define DOWAIT_BLOCK 1
 #define DOWAIT_WAITCMD 2
+#define DOWAIT_WAITCMD_ALL 4
 
 /* array of jobs */
 static struct job *jobtab;
@@ -96,8 +99,9 @@ static int ttyfd = -1;
 
 /* current job */
 static struct job *curjob;
-/* number of presumed living untracked jobs */
-static int jobless;
+
+/* Set if we are in the vforked child */
+int vforked;
 
 STATIC void set_curjob(struct job *, unsigned);
 STATIC int jobno(const struct job *);
@@ -193,7 +197,7 @@ setjobctl(int on)
 		return;
 	if (on) {
 		int ofd;
-		ofd = fd = open(_PATH_TTY, O_RDWR);
+		ofd = fd = sh_open(_PATH_TTY, O_RDWR, 1);
 		if (fd < 0) {
 			fd += 3;
 			while (!isatty(fd))
@@ -407,12 +411,11 @@ out:
 #endif
 
 STATIC int
-sprint_status(char *s, int status, int sigonly)
+sprint_status(char *os, int status, int sigonly)
 {
-	int col;
+	char *s = os;
 	int st;
 
-	col = 0;
 	st = WEXITSTATUS(status);
 	if (!WIFEXITED(status)) {
 #if JOBS
@@ -428,21 +431,21 @@ sprint_status(char *s, int status, int sigonly)
 				goto out;
 #endif
 		}
-		col = fmtstr(s, 32, strsignal(st));
+		s = stpncpy(s, strsignal(st), 32);
 #ifdef WCOREDUMP
 		if (WCOREDUMP(status)) {
-			col += fmtstr(s + col, 16, " (core dumped)");
+			s = stpcpy(s, " (core dumped)");
 		}
 #endif
 	} else if (!sigonly) {
 		if (st)
-			col = fmtstr(s, 16, "Done(%d)", st);
+			s += fmtstr(s, 16, "Done(%d)", st);
 		else
-			col = fmtstr(s, 16, "Done");
+			s = stpcpy(s, "Done");
 	}
 
 out:
-	return col;
+	return s - os;
 }
 
 static void
@@ -555,9 +558,8 @@ showjobs(struct output *out, int mode)
 
 	TRACE(("showjobs(%x) called\n", mode));
 
-	/* If not even one one job changed, there is nothing to do */
-	while (dowait(DOWAIT_NORMAL, NULL) > 0)
-		continue;
+	/* If not even one job changed, there is nothing to do */
+	dowait(DOWAIT_NONBLOCK, NULL);
 
 	for (jp = curjob; jp; jp = jp->prev_job) {
 		if (!(mode & SHOW_CHANGED) || jp->changed)
@@ -614,7 +616,7 @@ waitcmd(int argc, char **argv)
 				jp->waited = 1;
 				jp = jp->prev_job;
 			}
-			if (dowait(DOWAIT_WAITCMD, 0) <= 0)
+			if (!dowait(DOWAIT_WAITCMD_ALL, 0))
 				goto sigout;
 		}
 	}
@@ -636,9 +638,8 @@ start:
 		} else
 			job = getjob(*argv, 0);
 		/* loop until process terminated or stopped */
-		while (job->state == JOBRUNNING)
-			if (dowait(DOWAIT_WAITCMD, 0) <= 0)
-				goto sigout;
+		if (!dowait(DOWAIT_WAITCMD, job))
+			goto sigout;
 		job->waited = 1;
 		retval = getstatus(job);
 repeat:
@@ -845,20 +846,28 @@ growjobtab(void)
  * Called with interrupts off.
  */
 
-STATIC inline void
-forkchild(struct job *jp, union node *n, int mode)
+static void forkchild(struct job *jp, union node *n, int mode)
 {
+	int lvforked;
 	int oldlvl;
 
 	TRACE(("Child shell %d\n", getpid()));
+
 	oldlvl = shlvl;
-	shlvl++;
+	lvforked = vforked;
+
+	if (!lvforked) {
+		shlvl++;
+
+		forkreset();
+
+#if JOBS
+		/* do job control only in root shell */
+		jobctl = 0;
+#endif
+	}
 
-	closescript();
-	clear_traps();
 #if JOBS
-	/* do job control only in root shell */
-	jobctl = 0;
 	if (mode != FORK_NOJOB && jp->jobctl && !oldlvl) {
 		pid_t pgrp;
 
@@ -879,8 +888,7 @@ forkchild(struct job *jp, union node *n, int mode)
 		ignoresig(SIGQUIT);
 		if (jp->nprocs == 0) {
 			close(0);
-			if (open(_PATH_DEVNULL, O_RDONLY) != 0)
-				sh_error("Can't open %s", _PATH_DEVNULL);
+			sh_open(_PATH_DEVNULL, O_RDONLY, 0);
 		}
 	}
 	if (!oldlvl && iflag) {
@@ -888,20 +896,27 @@ forkchild(struct job *jp, union node *n, int mode)
 		setsignal(SIGQUIT);
 		setsignal(SIGTERM);
 	}
+
+	if (lvforked)
+		return;
+
 	for (jp = curjob; jp; jp = jp->prev_job)
 		freejob(jp);
-	jobless = 0;
 }
 
-STATIC inline void
-forkparent(struct job *jp, union node *n, int mode, pid_t pid)
+static void forkparent(struct job *jp, union node *n, int mode, pid_t pid)
 {
+	if (pid < 0) {
+		TRACE(("Fork failed, errno=%d", errno));
+		if (jp)
+			freejob(jp);
+		sh_error("Cannot fork");
+		/* NOTREACHED */
+	}
+
 	TRACE(("In parent shell:  child = %d\n", pid));
-	if (!jp) {
-		while (jobless && dowait(DOWAIT_NORMAL, 0) > 0);
-		jobless++;
+	if (!jp)
 		return;
-	}
 #if JOBS
 	if (mode != FORK_NOJOB && jp->jobctl) {
 		int pgrp;
@@ -935,19 +950,40 @@ forkshell(struct job *jp, union node *n, int mode)
 
 	TRACE(("forkshell(%%%d, %p, %d) called\n", jobno(jp), n, mode));
 	pid = fork();
-	if (pid < 0) {
-		TRACE(("Fork failed, errno=%d", errno));
-		if (jp)
-			freejob(jp);
-		sh_error("Cannot fork");
-	}
 	if (pid == 0)
 		forkchild(jp, n, mode);
 	else
 		forkparent(jp, n, mode, pid);
+
 	return pid;
 }
 
+struct job *vforkexec(union node *n, char **argv, const char *path, int idx)
+{
+	struct job *jp;
+	int pid;
+
+	jp = makejob(n, 1);
+
+	sigblockall(NULL);
+	vforked++;
+
+	pid = vfork();
+
+	if (!pid) {
+		forkchild(jp, n, FORK_FG);
+		sigclearmask();
+		shellexec(argv, path, idx);
+		/* NOTREACHED */
+	}
+
+	vforked = 0;
+	sigclearmask();
+	forkparent(jp, n, FORK_FG, pid);
+
+	return jp;
+}
+
 /*
  * Wait for job to finish.
  *
@@ -975,17 +1011,10 @@ waitforjob(struct job *jp)
 	int st;
 
 	TRACE(("waitforjob(%%%d) called\n", jp ? jobno(jp) : 0));
-	if (!jp) {
-		int pid = gotsigchld;
-
-		while (pid > 0)
-			pid = dowait(DOWAIT_NORMAL, NULL);
-
+	dowait(jp ? DOWAIT_BLOCK : DOWAIT_NONBLOCK, jp);
+	if (!jp)
 		return exitstatus;
-	}
 
-	while (jp->state == JOBRUNNING)
-		dowait(DOWAIT_BLOCK, jp);
 	st = getstatus(jp);
 #if JOBS
 	if (jp->jobctl) {
@@ -1013,8 +1042,7 @@ waitforjob(struct job *jp)
  * Wait for a process to terminate.
  */
 
-STATIC int
-dowait(int block, struct job *job)
+static int waitone(int block, struct job *job)
 {
 	int pid;
 	int status;
@@ -1057,8 +1085,6 @@ dowait(int block, struct job *job)
 		if (thisjob)
 			goto gotjob;
 	}
-	if (!JOBS || !WIFSTOPPED(status))
-		jobless--;
 	goto out;
 
 gotjob:
@@ -1093,50 +1119,52 @@ out:
 	return pid;
 }
 
+static int dowait(int block, struct job *jp)
+{
+	int gotchld = *(volatile int *)&gotsigchld;
+	int rpid;
+	int pid;
+
+	if (jp && jp->state != JOBRUNNING)
+		block = DOWAIT_NONBLOCK;
+
+	if (block == DOWAIT_NONBLOCK && !gotchld)
+		return 1;
 
+	rpid = 1;
+
+	do {
+		pid = waitone(block, jp);
+		rpid &= !!pid;
+
+		block &= ~DOWAIT_WAITCMD_ALL;
+		if (!pid || (jp && jp->state != JOBRUNNING))
+			block = DOWAIT_NONBLOCK;
+	} while (pid >= 0);
+
+	return rpid;
+}
 
 /*
- * Do a wait system call.  If job control is compiled in, we accept
- * stopped processes.  If block is zero, we return a value of zero
- * rather than blocking.
+ * Do a wait system call.  If block is zero, we return -1 rather than
+ * blocking.  If block is DOWAIT_WAITCMD, we return 0 when a signal
+ * other than SIGCHLD interrupted the wait.
  *
- * System V doesn't have a non-blocking wait system call.  It does
- * have a SIGCLD signal that is sent to a process when one of it's
- * children dies.  The obvious way to use SIGCLD would be to install
- * a handler for SIGCLD which simply bumped a counter when a SIGCLD
- * was received, and have waitproc bump another counter when it got
- * the status of a process.  Waitproc would then know that a wait
- * system call would not block if the two counters were different.
- * This approach doesn't work because if a process has children that
- * have not been waited for, System V will send it a SIGCLD when it
- * installs a signal handler for SIGCLD.  What this means is that when
- * a child exits, the shell will be sent SIGCLD signals continuously
- * until is runs out of stack space, unless it does a wait call before
- * restoring the signal handler.  The code below takes advantage of
- * this (mis)feature by installing a signal handler for SIGCLD and
- * then checking to see whether it was called.  If there are any
- * children to be waited for, it will be.
+ * We use sigsuspend in conjunction with a non-blocking wait3 in
+ * order to ensure that waitcmd exits promptly upon the reception
+ * of a signal.
  *
- * If neither SYSV nor BSD is defined, we don't implement nonblocking
- * waits at all.  In this case, the user will not be informed when
- * a background process until the next time she runs a real program
- * (as opposed to running a builtin command or just typing return),
- * and the jobs command may give out of date information.
+ * For code paths other than waitcmd we either use a blocking wait3
+ * or a non-blocking wait3.  For the latter case the caller of dowait
+ * must ensure that it is called over and over again until all dead
+ * children have been reaped.  Otherwise zombies may linger.
  */
 
-#ifdef SYSV
-STATIC int gotsigchild;
-
-STATIC int onsigchild() {
-	gotsigchild = 1;
-}
-#endif
-
 
 STATIC int
 waitproc(int block, int *status)
 {
-	sigset_t mask, oldmask;
+	sigset_t oldmask;
 	int flags = block == DOWAIT_BLOCK ? 0 : WNOHANG;
 	int err;
 
@@ -1147,14 +1175,14 @@ waitproc(int block, int *status)
 
 	do {
 		gotsigchld = 0;
-		err = wait3(status, flags, NULL);
-		if (err || !block)
-			break;
+		do
+			err = wait3(status, flags, NULL);
+		while (err < 0 && errno == EINTR);
 
-		block = 0;
+		if (err || (err = -!block))
+			break;
 
-		sigfillset(&mask);
-		sigprocmask(SIG_SETMASK, &mask, &oldmask);
+		sigblockall(&oldmask);
 
 		while (!gotsigchld && !pending_sig)
 			sigsuspend(&oldmask);
@@ -1406,7 +1434,8 @@ cmdputs(const char *s)
 				str = "${";
 			goto dostr;
 		case CTLENDVAR:
-			str = "\"}" + !(quoted & 1);
+			str = "\"}";
+			str += !(quoted & 1);
 			quoted >>= 1;
 			subtype = 0;
 			goto dostr;
@@ -1481,7 +1510,13 @@ showpipe(struct job *jp, struct output *out)
 STATIC void
 xtcsetpgrp(int fd, pid_t pgrp)
 {
-	if (tcsetpgrp(fd, pgrp))
+	int err;
+
+	sigblockall(NULL);
+	err = tcsetpgrp(fd, pgrp);
+	sigclearmask();
+
+	if (err)
 		sh_error("Cannot set tty process group (%s)", strerror(errno));
 }
 #endif
diff --git a/src/jobs.h b/src/jobs.h
index 953ee87127b11350d822d7f9881b6b451b49fdb5..6ac6c56da10b2cc8158a032d63e665464a9de136 100644
--- a/src/jobs.h
+++ b/src/jobs.h
@@ -83,6 +83,8 @@ struct job {
 	struct job *prev_job;	/* previous job */
 };
 
+union node;
+
 extern pid_t backgndpid;	/* pid of last background process */
 extern int job_warning;		/* user was warned about stopped jobs */
 #if JOBS
@@ -90,6 +92,7 @@ extern int jobctl;		/* true if doing job control */
 #else
 #define jobctl 0
 #endif
+extern int vforked;		/* Set if we are in the vforked child */
 
 void setjobctl(int);
 int killcmd(int, char **);
@@ -101,6 +104,7 @@ void showjobs(struct output *, int);
 int waitcmd(int, char **);
 struct job *makejob(union node *, int);
 int forkshell(struct job *, union node *, int);
+struct job *vforkexec(union node *n, char **argv, const char *path, int idx);
 int waitforjob(struct job *);
 int stoppedjobs(void);
 
diff --git a/src/mail.c b/src/mail.c
index 02e07f777add178e2ee61c63ee3ba23c352ec0a2..8eacb2d0578e899a0031a23426d4b9a4499a4398 100644
--- a/src/mail.c
+++ b/src/mail.c
@@ -77,9 +77,12 @@ chkmail(void)
 	setstackmark(&smark);
 	mpath = mpathset() ? mpathval() : mailval();
 	for (mtp = mailtime; mtp < mailtime + MAXMBOXES; mtp++) {
-		p = padvance(&mpath, nullstr);
-		if (p == NULL)
+		int len;
+
+		len = padvance_magic(&mpath, nullstr, 2);
+		if (!len)
 			break;
+		p = stackblock();
 		if (*p == '\0')
 			continue;
 		for (q = p ; *q ; q++);
diff --git a/src/main.c b/src/main.c
index fcd3e7d2081815d2921ea98f02cf8f9ddae68b2d..5c49fdc9a6d77e42e469e99847a636ceefa14509 100644
--- a/src/main.c
+++ b/src/main.c
@@ -71,6 +71,7 @@ int *dash_errno;
 short profile_buf[16384];
 extern int etext();
 #endif
+MKINIT struct jmploc main_handler;
 
 STATIC void read_profile(const char *);
 STATIC char *find_dot_file(char *);
@@ -90,7 +91,6 @@ main(int argc, char **argv)
 {
 	char *shinit;
 	volatile int state;
-	struct jmploc jmploc;
 	struct stackmark smark;
 	int login;
 
@@ -102,18 +102,20 @@ main(int argc, char **argv)
 	monitor(4, etext, profile_buf, sizeof profile_buf, 50);
 #endif
 	state = 0;
-	if (unlikely(setjmp(jmploc.loc))) {
+	if (unlikely(setjmp(main_handler.loc))) {
 		int e;
 		int s;
 
-		reset();
+		exitreset();
 
 		e = exception;
 
 		s = state;
-		if (e == EXEXIT || s == 0 || iflag == 0 || shlvl)
+		if (e == EXEND || e == EXEXIT || s == 0 || iflag == 0 || shlvl)
 			exitshell();
 
+		reset();
+
 		if (e == EXINT
 #if ATTY
 		 && (! attyset() || equal(termval(), "emacs"))
@@ -135,7 +137,7 @@ main(int argc, char **argv)
 		else
 			goto state4;
 	}
-	handler = &jmploc;
+	handler = &main_handler;
 #ifdef DEBUG
 	opentrace();
 	trputs("Shell args:  ");  trargs(argv);
@@ -219,12 +221,19 @@ cmdloop(int top)
 			if (!top || numeof >= 50)
 				break;
 			if (!stoppedjobs()) {
-				if (!Iflag)
+				if (!Iflag) {
+					if (iflag) {
+						out2c('\n');
+#ifdef FLUSHERR
+						flushout(out2);
+#endif
+					}
 					break;
+				}
 				out2str("\nUse \"exit\" to leave shell.\n");
 			}
 			numeof++;
-		} else if (nflag == 0) {
+		} else {
 			int i;
 
 			job_warning = (job_warning == 2) ? 1 : 0;
@@ -289,21 +298,20 @@ find_dot_file(char *basename)
 {
 	char *fullname;
 	const char *path = pathval();
-	struct stat statb;
+	struct stat64 statb;
+	int len;
 
 	/* don't try this for absolute or relative paths */
 	if (strchr(basename, '/'))
 		return basename;
 
-	while ((fullname = padvance(&path, basename)) != NULL) {
-		if ((stat(fullname, &statb) == 0) && S_ISREG(statb.st_mode)) {
-			/*
-			 * Don't bother freeing here, since it will
-			 * be freed by the caller.
-			 */
-			return fullname;
+	while ((len = padvance(&path, basename)) >= 0) {
+		fullname = stackblock();
+		if ((!pathopt || *pathopt == 'f') &&
+		    !stat64(fullname, &statb) && S_ISREG(statb.st_mode)) {
+			/* This will be freed by the caller. */
+			return stalloc(len);
 		}
-		stunalloc(fullname);
 	}
 
 	/* not found in the PATH */
@@ -339,14 +347,17 @@ exitcmd(int argc, char **argv)
 	if (stoppedjobs())
 		return 0;
 
-	if (argc > 1) {
-		int status = number(argv[1]);
-
-		exitstatus = status;
-		if (savestatus >= 0)
-			savestatus = status;
-	}
+	if (argc > 1)
+		savestatus = number(argv[1]);
 
 	exraise(EXEXIT);
 	/* NOTREACHED */
 }
+
+#ifdef mkinit
+INCLUDE "error.h"
+
+FORKRESET {
+	handler = &main_handler;
+}
+#endif
diff --git a/src/memalloc.c b/src/memalloc.c
index d8e4413d69dae418f113ec1f33ee46717a41d000..60637da154cbf18794980c7fc765b020d27824a7 100644
--- a/src/memalloc.c
+++ b/src/memalloc.c
@@ -201,16 +201,16 @@ popstackmark(struct stackmark *mark)
  * part of the block that has been used.
  */
 
-void
-growstackblock(void)
+static void growstackblock(size_t min)
 {
 	size_t newlen;
 
 	newlen = stacknleft * 2;
 	if (newlen < stacknleft)
 		sh_error("Out of space");
-	if (newlen < 128)
-		newlen += 128;
+	min = SHELL_ALIGN(min | 128);
+	if (newlen < min)
+		newlen += min;
 
 	if (stacknxt == stackp->space && stackp != &stackbase) {
 		struct stack_block *sp;
@@ -261,10 +261,18 @@ void *
 growstackstr(void)
 {
 	size_t len = stackblocksize();
-	growstackblock();
+
+	growstackblock(0);
 	return stackblock() + len;
 }
 
+char *growstackto(size_t len)
+{
+	if (stackblocksize() < len)
+		growstackblock(len);
+	return stackblock();
+}
+
 /*
  * Called from CHECKSTRSPACE.
  */
@@ -273,18 +281,8 @@ char *
 makestrspace(size_t newlen, char *p)
 {
 	size_t len = p - stacknxt;
-	size_t size;
-
-	for (;;) {
-		size_t nleft;
 
-		size = stackblocksize();
-		nleft = size - len;
-		if (nleft >= newlen)
-			break;
-		growstackblock();
-	}
-	return stackblock() + len;
+	return growstackto(len + newlen) + len;
 }
 
 char *
diff --git a/src/memalloc.h b/src/memalloc.h
index 4b5be46cb0941d3a4509621840903b3dd4fede77..b9adf7644c2dc3df618bd9489a99924c8ccfe4e9 100644
--- a/src/memalloc.h
+++ b/src/memalloc.h
@@ -35,6 +35,7 @@
  */
 
 #include <stddef.h>
+#include <stdlib.h>
 
 struct stackmark {
 	struct stack_block *stackp;
@@ -55,8 +56,8 @@ void stunalloc(pointer);
 void pushstackmark(struct stackmark *mark, size_t len);
 void setstackmark(struct stackmark *);
 void popstackmark(struct stackmark *);
-void growstackblock(void);
 void *growstackstr(void);
+char *growstackto(size_t len);
 char *makestrspace(size_t, char *);
 char *stnputs(const char *, size_t, char *);
 char *stputs(const char *, char *);
diff --git a/src/mkbuiltins b/src/mkbuiltins
index b4d6f4ec5501c89297bc518e9e9a501e353e0184..f1f259329996a0b45a49cb334a3c5a4c187fd3c9 100644
--- a/src/mkbuiltins
+++ b/src/mkbuiltins
@@ -35,7 +35,7 @@
 #
 #	@(#)mkbuiltins	8.2 (Berkeley) 5/4/95
 
-tempfile=tempfile
+tempfile=mktemp
 if ! type tempfile > /dev/null 2>&1 && ! type mktemp > /dev/null 2>&1; then
 	_my_tempfile()
 	{
diff --git a/src/mkinit.c b/src/mkinit.c
index 9714bee0659de35a6541ac54aafa8951b7f1f938..9025862eca87f76aa60d081d648a2b76d06c9b70 100644
--- a/src/mkinit.c
+++ b/src/mkinit.c
@@ -106,6 +106,18 @@ char init[] = "\
  * Initialization code.\n\
  */\n";
 
+char exitreset[] = "\
+/*\n\
+ * This routine is called when an error or an interrupt occurs in an\n\
+ * interactive shell and control is returned to the main command loop\n\
+ * but prior to exitshell. \n\
+ */\n";
+
+char forkreset[] = "\
+/*\n\
+ * This routine is called when we enter a subshell.\n\
+ */\n";
+
 char reset[] = "\
 /*\n\
  * This routine is called when an error or an interrupt occurs in an\n\
@@ -115,6 +127,8 @@ char reset[] = "\
 
 struct event event[] = {
 	{"INIT", "init", init},
+	{"EXITRESET", "exitreset", exitreset},
+	{"FORKRESET", "forkreset", forkreset},
 	{"RESET", "reset", reset},
 	{NULL, NULL}
 };
diff --git a/src/mksyntax.c b/src/mksyntax.c
index a23c18caebb1b24443564092f35d73f81aae6f3c..da18f5d28d2ef69765ade1f979c9fc4e6421d389 100644
--- a/src/mksyntax.c
+++ b/src/mksyntax.c
@@ -64,7 +64,6 @@ struct synclass synclass[] = {
 	{ "CEOF",	"end of file" },
 	{ "CCTL",	"like CWORD, except it must be escaped" },
 	{ "CSPCL",	"these terminate a word" },
-	{ "CIGN",	"character should be ignored" },
 	{ NULL,		NULL }
 };
 
@@ -145,9 +144,8 @@ main(int argc, char **argv)
 		fprintf(hfile, "/* %s */\n", is_entry[i].comment);
 	}
 	putc('\n', hfile);
-	fprintf(hfile, "#define SYNBASE %d\n", 130);
-	fprintf(hfile, "#define PEOF %d\n\n", -130);
-	fprintf(hfile, "#define PEOA %d\n\n", -129);
+	fprintf(hfile, "#define SYNBASE %d\n", 129);
+	fprintf(hfile, "#define PEOF %d\n\n", -129);
 	putc('\n', hfile);
 	fputs("#define BASESYNTAX (basesyntax + SYNBASE)\n", hfile);
 	fputs("#define DQSYNTAX (dqsyntax + SYNBASE)\n", hfile);
@@ -170,7 +168,6 @@ main(int argc, char **argv)
 	add("$", "CVAR");
 	add("}", "CENDVAR");
 	add("<>();&| \t", "CSPCL");
-	syntax[1] = "CSPCL";
 	print("basesyntax");
 	init();
 	fputs("\n/* syntax table used when in double quotes */\n", cfile);
@@ -223,7 +220,7 @@ filltable(char *dftval)
 {
 	int i;
 
-	for (i = 0 ; i < 258; i++)
+	for (i = 0 ; i < 257; i++)
 		syntax[i] = dftval;
 }
 
@@ -239,9 +236,8 @@ init(void)
 
 	filltable("CWORD");
 	syntax[0] = "CEOF";
-	syntax[1] = "CIGN";
 	for (ctl = CTL_FIRST; ctl <= CTL_LAST; ctl++ )
-		syntax[130 + ctl] = "CCTL";
+		syntax[129 + ctl] = "CCTL";
 }
 
 
@@ -253,7 +249,7 @@ static void
 add(char *p, char *type)
 {
 	while (*p)
-		syntax[(signed char)*p++ + 130] = type;
+		syntax[(signed char)*p++ + 129] = type;
 }
 
 
@@ -271,7 +267,7 @@ print(char *name)
 	fprintf(hfile, "extern const char %s[];\n", name);
 	fprintf(cfile, "const char %s[] = {\n", name);
 	col = 0;
-	for (i = 0 ; i < 258; i++) {
+	for (i = 0 ; i < 257; i++) {
 		if (i == 0) {
 			fputs("      ", cfile);
 		} else if ((i & 03) == 0) {
diff --git a/src/mktokens b/src/mktokens
index cd52241a630eec6cdf4eeddaedb49cefd30df3cc..78055be886b18d3cc3c6238fe463e98247ec92b7 100644
--- a/src/mktokens
+++ b/src/mktokens
@@ -37,7 +37,9 @@
 # token marks the end of a list.  The third column is the name to print in
 # error messages.
 
-cat > /tmp/ka$$ <<\!
+: "${TMPDIR:=/tmp}"
+
+cat > "${TMPDIR}"/ka$$ <<\!
 TEOF	1	end of file
 TNL	0	newline
 TSEMI	0	";"
@@ -68,28 +70,28 @@ TWHILE	0	"while"
 TBEGIN	0	"{"
 TEND	1	"}"
 !
-nl=`wc -l /tmp/ka$$`
+nl=`wc -l "${TMPDIR}"/ka$$`
 exec > token.h
-awk '{print "#define " $1 " " NR-1}' /tmp/ka$$
+awk '{print "#define " $1 " " NR-1}' "${TMPDIR}"/ka$$
 
 exec > token_vars.h
 
 echo '
 /* Array indicating which tokens mark the end of a list */
 static const char tokendlist[] = {'
-awk '{print "\t" $2 ","}' /tmp/ka$$
+awk '{print "\t" $2 ","}' "${TMPDIR}"/ka$$
 echo '};
 
 static const char *const tokname[] = {'
 sed -e 's/"/\\"/g' \
     -e 's/[^	 ]*[	 ][	 ]*[^	 ]*[	 ][	 ]*\(.*\)/	"\1",/' \
-    /tmp/ka$$
+    "${TMPDIR}"/ka$$
 echo '};
 '
-sed 's/"//g' /tmp/ka$$ | awk '
+sed 's/"//g' "${TMPDIR}"/ka$$ | awk '
 /TNOT/{print "#define KWDOFFSET " NR-1; print ""; 
       print "static const char *const parsekwd[] = {"}
 /TNOT/,/neverfound/{if (last) print "	\"" last "\","; last = $3}
 END{print "	\"" last "\"\n};"}'
 
-rm /tmp/ka$$
+rm "${TMPDIR}"/ka$$
diff --git a/src/mystring.c b/src/mystring.c
index de624b8917914d344a323071c2af7594c191931a..f6515210e35627849a2436764bcc059b987b5dd9 100644
--- a/src/mystring.c
+++ b/src/mystring.c
@@ -60,9 +60,14 @@
 char nullstr[1];		/* zero length string */
 const char spcstr[] = " ";
 const char snlfmt[] = "%s\n";
-const char dolatstr[] = { CTLQUOTEMARK, CTLVAR, VSNORMAL, '@', '=',
+const char dolatstr[] = { CTLQUOTEMARK, CTLVAR, VSNORMAL | VSBIT, '@', '=',
 			  CTLQUOTEMARK, '\0' };
-const char qchars[] = { CTLESC, CTLQUOTEMARK, 0 };
+const char cqchars[] = {
+#ifdef HAVE_FNMATCH
+	'^',
+#endif
+	CTLESC, CTLQUOTEMARK, 0
+};
 const char illnum[] = "Illegal number: %s";
 const char homestr[] = "HOME";
 
diff --git a/src/mystring.h b/src/mystring.h
index 083ea98cff7e0ba8771a3f5948edbd1ce284f72e..564b911861a5a7cb53f30fcf5c95fcaf61cb4d39 100644
--- a/src/mystring.h
+++ b/src/mystring.h
@@ -37,11 +37,18 @@
 #include <inttypes.h>
 #include <string.h>
 
+#ifdef HAVE_FNMATCH
+#define FNMATCH_IS_ENABLED 1
+#else
+#define FNMATCH_IS_ENABLED 0
+#endif
+
 extern const char snlfmt[];
 extern const char spcstr[];
 extern const char dolatstr[];
 #define DOLATSTRLEN 6
-extern const char qchars[];
+extern const char cqchars[];
+#define qchars (cqchars + FNMATCH_IS_ENABLED)
 extern const char illnum[];
 extern const char homestr[];
 
diff --git a/src/options.c b/src/options.c
index 6f381e610058d4f2de7e2fb135d7e53e7fae28a0..a46c23b9fb03e7022aea1f602edd9179dce9d01e 100644
--- a/src/options.c
+++ b/src/options.c
@@ -159,7 +159,6 @@ procargs(int argc, char **argv)
 		setinputfile(*xargv, 0);
 setarg0:
 		arg0 = *xargv++;
-		commandname = arg0;
 	}
 
 	shellparam.p = xargv;
diff --git a/src/output.c b/src/output.c
index 4d3b4c279dfba414d6c921898a2aac8bef3539fb..e9ee9b4d7ad8a68647b733885574743642111238 100644
--- a/src/output.c
+++ b/src/output.c
@@ -71,27 +71,27 @@
 
 #ifdef USE_GLIBC_STDIO
 struct output output = {
-	stream: 0, nextc: 0, end: 0, buf: 0, bufsize: 0, fd: 1, flags: 0
+	.stream = 0, .nextc = 0, .end = 0, .buf = 0, .bufsize = 0, .fd = 1, .flags = 0
 };
 struct output errout = {
-	stream: 0, nextc: 0, end: 0, buf: 0, bufsize: 0, fd: 2, flags: 0
+	.stream = 0, .nextc = 0, .end = 0, .buf = 0, .bufsize = 0, .fd = 2, .flags = 0
 }
 #ifdef notyet
 struct output memout = {
-	stream: 0, nextc: 0, end: 0, buf: 0, bufsize: 0, fd: MEM_OUT, flags: 0
+	.stream = 0, .nextc = 0, .end = 0, .buf = 0, .bufsize = 0, .fd = MEM_OUT, .flags = 0
 };
 #endif
 #else
 struct output output = {
-	nextc: 0, end: 0, buf: 0, bufsize: OUTBUFSIZ, fd: 1, flags: 0
+	.nextc = 0, .end = 0, .buf = 0, .bufsize = OUTBUFSIZ, .fd = 1, .flags = 0
 };
 struct output errout = {
-	nextc: 0, end: 0, buf: 0, bufsize: 0, fd: 2, flags: 0
+	.nextc = 0, .end = 0, .buf = 0, .bufsize = 0, .fd = 2, .flags = 0
 };
 struct output preverrout;
 #ifdef notyet
 struct output memout = {
-	nextc: 0, end: 0, buf: 0, bufsize: 0, fd: MEM_OUT, flags: 0
+	.nextc = 0, .end = 0, .buf = 0, .bufsize = 0, .fd = MEM_OUT, .flags = 0
 };
 #endif
 #endif
@@ -286,7 +286,7 @@ fmtstr(char *outbuf, size_t length, const char *fmt, ...)
 	va_start(ap, fmt);
 	ret = xvsnprintf(outbuf, length, fmt, ap);
 	va_end(ap);
-	return ret;
+	return ret > (int)length ? length : ret;
 }
 
 
diff --git a/src/parser.c b/src/parser.c
index 8bd3db44ff3d0a5ec568c6126f66c650cc005861..a552c477e99cd979d0f4838b974dcf3162fbc82d 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -115,7 +115,6 @@ STATIC union node *simplecmd(void);
 STATIC union node *makename(void);
 STATIC void parsefname(void);
 STATIC void parseheredoc(void);
-STATIC int peektoken(void);
 STATIC int readtoken(void);
 STATIC int xxreadtoken(void);
 STATIC int pgetc_eatbnl();
@@ -125,8 +124,7 @@ STATIC void synerror(const char *) __attribute__((__noreturn__));
 STATIC void setprompt(int);
 
 
-static inline int
-isassignment(const char *p)
+int isassignment(const char *p)
 {
 	const char *q = endofname(p);
 	if (p == q)
@@ -162,27 +160,31 @@ parsecmd(int interact)
 STATIC union node *
 list(int nlflag)
 {
+	int chknl = nlflag & 1 ? 0 : CHKNL;
 	union node *n1, *n2, *n3;
 	int tok;
 
 	n1 = NULL;
 	for (;;) {
-		switch (peektoken()) {
+		checkkwd = chknl | CHKKWD | CHKALIAS;
+		tok = readtoken();
+		switch (tok) {
 		case TNL:
-			if (!(nlflag & 1))
-				break;
 			parseheredoc();
 			return n1;
 
 		case TEOF:
-			if (!n1 && (nlflag & 1))
+			if (!n1 && !chknl)
 				n1 = NEOF;
+out_eof:
 			parseheredoc();
+			tokpushback++;
+			lasttoken = TEOF;
 			return n1;
 		}
 
-		checkkwd = CHKNL | CHKKWD | CHKALIAS;
-		if (nlflag == 2 && tokendlist[peektoken()])
+		tokpushback++;
+		if (nlflag == 2 && tokendlist[tok])
 			return n1;
 		nlflag |= 2;
 
@@ -212,15 +214,16 @@ list(int nlflag)
 			n1 = n3;
 		}
 		switch (tok) {
-		case TNL:
 		case TEOF:
+			goto out_eof;
+		case TNL:
 			tokpushback++;
 			/* fall through */
 		case TBACKGND:
 		case TSEMI:
 			break;
 		default:
-			if ((nlflag & 1))
+			if (!chknl)
 				synexpect(-1);
 			tokpushback++;
 			return n1;
@@ -683,16 +686,6 @@ parseheredoc(void)
 	}
 }
 
-STATIC int
-peektoken(void)
-{
-	int t;
-
-	t = readtoken();
-	tokpushback++;
-	return (t);
-}
-
 STATIC int
 readtoken(void)
 {
@@ -711,10 +704,14 @@ top:
 	if (kwd & CHKNL) {
 		while (t == TNL) {
 			parseheredoc();
+			checkkwd = 0;
 			t = xxreadtoken();
 		}
 	}
 
+	kwd |= checkkwd;
+	checkkwd = 0;
+
 	if (t != TWORD || quoteflag) {
 		goto out;
 	}
@@ -732,7 +729,7 @@ top:
 		}
 	}
 
-	if (checkkwd & CHKALIAS) {
+	if (kwd & CHKALIAS) {
 		struct alias *ap;
 		if ((ap = lookupalias(wordtext, 1)) != NULL) {
 			if (*ap->val) {
@@ -742,7 +739,6 @@ top:
 		}
 	}
 out:
-	checkkwd = 0;
 #ifdef DEBUG
 	if (!alreadyseen)
 	    TRACE(("token %s %s\n", tokname[t], t == TWORD ? wordtext : ""));
@@ -800,7 +796,6 @@ xxreadtoken(void)
 		c = pgetc_eatbnl();
 		switch (c) {
 		case ' ': case '\t':
-		case PEOA:
 			continue;
 		case '#':
 			while ((c = pgetc()) != '\n' && c != PEOF);
@@ -842,7 +837,7 @@ static int pgetc_eatbnl(void)
 	int c;
 
 	while ((c = pgetc()) == '\\') {
-		if (pgetc2() != '\n') {
+		if (pgetc() != '\n') {
 			pungetc();
 			break;
 		}
@@ -947,7 +942,7 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs)
 				break;
 			/* backslash */
 			case CBACK:
-				c = pgetc2();
+				c = pgetc();
 				if (c == PEOF) {
 					USTPUTC(CTLESC, out);
 					USTPUTC('\\', out);
@@ -1052,14 +1047,10 @@ toggledq:
 				break;
 			case CEOF:
 				goto endword;		/* exit outer loop */
-			case CIGN:
-				break;
 			default:
 				if (synstack->varnest == 0)
 					goto endword;	/* exit outer loop */
-				if (c != PEOA) {
-					USTPUTC(c, out);
-				}
+				USTPUTC(c, out);
 			}
 			c = pgetc_top(synstack);
 		}
@@ -1107,13 +1098,9 @@ checkend: {
 		int markloc;
 		char *p;
 
-		if (c == PEOA) {
-			c = pgetc2();
-		}
 		if (striptabs) {
-			while (c == '\t') {
-				c = pgetc2();
-			}
+			while (c == '\t')
+				c = pgetc();
 		}
 
 		markloc = out - (char *)stackblock();
@@ -1121,7 +1108,7 @@ checkend: {
 			if (c != *p)
 				goto more_heredoc;
 
-			c = pgetc2();
+			c = pgetc();
 		}
 
 		if (c == '\n' || c == PEOF) {
@@ -1233,7 +1220,6 @@ parsesub: {
 	c = pgetc_eatbnl();
 	if (
 		(checkkwd & CHKEOFMARK) ||
-		c <= PEOA  ||
 		(c != '(' && c != '{' && !is_name(c) && !is_special(c))
 	) {
 		USTPUTC('$', out);
@@ -1266,7 +1252,8 @@ varname:
 			do {
 				STPUTC(c, out);
 				c = pgetc_eatbnl();
-			} while (is_digit(c));
+			} while ((subtype <= 0 || subtype >= VSLENGTH) &&
+				 is_digit(c));
 		} else if (c != '}') {
 			int cc = c;
 
@@ -1326,6 +1313,8 @@ varname:
 				break;
 			}
 		} else {
+			if (subtype == VSLENGTH && c != '}')
+				subtype = 0;
 badsub:
 			pungetc();
 		}
@@ -1344,7 +1333,7 @@ badsub:
 			synstack->dblquote = newsyn != BASESYNTAX;
 		}
 
-		*((char *)stackblock() + typeloc) = subtype;
+		*((char *)stackblock() + typeloc) = subtype | VSBIT;
 		if (subtype != VSNORMAL) {
 			synstack->varnest++;
 			if (synstack->dblquote)
@@ -1368,6 +1357,7 @@ parsebackq: {
 	union node *n;
 	char *str;
 	size_t savelen;
+	struct heredoc *saveheredoclist;
 	int uninitialized_var(saveprompt);
 
 	str = NULL;
@@ -1396,17 +1386,13 @@ parsebackq: {
 				goto done;
 
 			case '\\':
-                                pc = pgetc_eatbnl();
+                                pc = pgetc();
                                 if (pc != '\\' && pc != '`' && pc != '$'
                                     && (!synstack->dblquote || pc != '"'))
                                         STPUTC('\\', pout);
-				if (pc > PEOA) {
-					break;
-				}
-				/* fall through */
+				break;
 
 			case PEOF:
-			case PEOA:
 				synerror("EOF in backquote substitution");
 
 			case '\n':
@@ -1432,6 +1418,9 @@ done:
 	*nlpp = (struct nodelist *)stalloc(sizeof (struct nodelist));
 	(*nlpp)->next = NULL;
 
+	saveheredoclist = heredoclist;
+	heredoclist = NULL;
+
 	if (oldstyle) {
 		saveprompt = doprompt;
 		doprompt = 0;
@@ -1444,20 +1433,19 @@ done:
 	else {
 		if (readtoken() != TRP)
 			synexpect(TRP);
+		setinputstring(nullstr);
 	}
 
+	parseheredoc();
+	heredoclist = saveheredoclist;
+
 	(*nlpp)->n = n;
-        if (oldstyle) {
-		/*
-		 * Start reading from old file again, ignoring any pushed back
-		 * tokens left from the backquote parsing
-		 */
-                popfile();
+	/* Start reading from old file again. */
+	popfile();
+	/* Ignore any pushed back tokens left from the backquote parsing. */
+	if (oldstyle)
 		tokpushback = 0;
-	}
-	while (stackblocksize() <= savelen)
-		growstackblock();
-	STARTSTACKSTR(out);
+	out = growstackto(savelen + 1);
 	if (str) {
 		memcpy(out, str, savelen);
 		STADJUST(savelen, out);
@@ -1566,28 +1554,48 @@ setprompt(int which)
 const char *
 expandstr(const char *ps)
 {
-	union node n;
+	struct parsefile *file_stop;
+	struct jmploc *volatile savehandler;
+	struct heredoc *saveheredoclist;
+	const char *result;
 	int saveprompt;
+	struct jmploc jmploc;
+	union node n;
+	int err;
+
+	file_stop = parsefile;
 
 	/* XXX Fix (char *) cast. */
 	setinputstring((char *)ps);
 
+	saveheredoclist = heredoclist;
+	heredoclist = NULL;
 	saveprompt = doprompt;
 	doprompt = 0;
+	result = ps;
+	savehandler = handler;
+	if (unlikely(err = setjmp(jmploc.loc)))
+		goto out;
+	handler = &jmploc;
 
 	readtoken1(pgetc_eatbnl(), DQSYNTAX, FAKEEOFMARK, 0);
 
-	doprompt = saveprompt;
-
-	popfile();
-
 	n.narg.type = NARG;
 	n.narg.next = NULL;
 	n.narg.text = wordtext;
 	n.narg.backquote = backquotelist;
 
 	expandarg(&n, NULL, EXP_QUOTED);
-	return stackblock();
+	result = stackblock();
+
+out:
+	restore_handler_expandarg(savehandler, err);
+
+	doprompt = saveprompt;
+	unwindfiles(file_stop);
+	heredoclist = saveheredoclist;
+
+	return result;
 }
 
 /*
diff --git a/src/parser.h b/src/parser.h
index 2875cce6d42419265f6152b31f1bef1973245e27..729c15c3cd757745801471307968449b4ecc9b90 100644
--- a/src/parser.h
+++ b/src/parser.h
@@ -50,6 +50,7 @@
 /* variable substitution byte (follows CTLVAR) */
 #define VSTYPE	0x0f		/* type of variable substitution */
 #define VSNUL	0x10		/* colon--treat the empty string as unset */
+#define VSBIT	0x20		/* Ensure subtype is not zero */
 
 /* values of VSTYPE field */
 #define VSNORMAL	0x1		/* normal variable:  $var or ${var} */
@@ -62,6 +63,7 @@
 #define VSTRIMLEFT	0x8		/* ${var#pattern} */
 #define VSTRIMLEFTMAX	0x9		/* ${var##pattern} */
 #define VSLENGTH	0xa		/* ${#var} */
+/* VSLENGTH must come last. */
 
 /* values of checkkwd variable */
 #define CHKALIAS	0x1
@@ -82,6 +84,7 @@ extern int whichprompt;		/* 1 == PS1, 2 == PS2 */
 extern int checkkwd;
 
 
+int isassignment(const char *p);
 union node *parsecmd(int);
 void fixredir(union node *, const char *, int);
 const char *getprompt(void *);
diff --git a/src/redir.c b/src/redir.c
index 71b0f77412bf4f7f9b1c247d0c8beb1606472ba6..5a5835c4f0d6a16b10d672beeb625cf41032fa41 100644
--- a/src/redir.c
+++ b/src/redir.c
@@ -55,9 +55,9 @@
 #include "output.h"
 #include "memalloc.h"
 #include "error.h"
+#include "trap.h"
 
 
-#define REALLY_CLOSED -3	/* fd that was closed and still is */
 #define EMPTY -2		/* marks an unused slot in redirtab */
 #define CLOSED -1		/* fd opened for redir needs to be closed */
 
@@ -77,6 +77,9 @@ struct redirtab {
 
 MKINIT struct redirtab *redirlist;
 
+/* Bit map of currently closed file descriptors. */
+static unsigned closed_redirs;
+
 STATIC int openredirect(union node *);
 #ifdef notyet
 STATIC void dupredirect(union node *, int, char[10]);
@@ -86,6 +89,20 @@ STATIC void dupredirect(union node *, int);
 STATIC int openhere(union node *);
 
 
+static unsigned update_closed_redirs(int fd, int nfd)
+{
+	unsigned val = closed_redirs;
+	unsigned bit = 1 << fd;
+
+	if (nfd >= 0)
+		closed_redirs &= ~bit;
+	else
+		closed_redirs |= bit;
+
+	return val & bit;
+}
+
+
 /*
  * Process a list of redirection commands.  If the REDIR_PUSH flag is set,
  * old file descriptors are stashed away so that the redirection can be
@@ -125,21 +142,21 @@ redirect(union node *redir, int flags)
 		fd = n->nfile.fd;
 
 		if (sv) {
+			int closed;
+
 			p = &sv->renamed[fd];
 			i = *p;
 
+			closed = update_closed_redirs(fd, newfd);
+
 			if (likely(i == EMPTY)) {
 				i = CLOSED;
-				if (fd != newfd) {
+				if (fd != newfd && !closed) {
 					i = savefd(fd, fd);
 					fd = -1;
 				}
 			}
 
-			if (i == newfd)
-				/* Can only happen if i == newfd == CLOSED */
-				i = REALLY_CLOSED;
-
 			*p = i;
 		}
 
@@ -164,56 +181,83 @@ redirect(union node *redir, int flags)
 }
 
 
+static int sh_open_fail(const char *, int, int) __attribute__((__noreturn__));
+static int sh_open_fail(const char *pathname, int flags, int e)
+{
+	const char *word;
+	int action;
+
+	word = "open";
+	action = E_OPEN;
+	if (flags & O_CREAT) {
+		word = "create";
+		action = E_CREAT;
+	}
+
+	sh_error("cannot %s %s: %s", word, pathname, errmsg(e, action));
+}
+
+
+int sh_open(const char *pathname, int flags, int mayfail)
+{
+	int fd;
+	int e;
+
+	do {
+		fd = open64(pathname, flags, 0666);
+		e = errno;
+	} while (fd < 0 && e == EINTR && !pending_sig);
+
+	if (mayfail || fd >= 0)
+		return fd;
+
+	sh_open_fail(pathname, flags, e);
+}
+
+
 STATIC int
 openredirect(union node *redir)
 {
 	struct stat64 sb;
 	char *fname;
+	int flags;
 	int f;
 
 	switch (redir->nfile.type) {
 	case NFROM:
-		fname = redir->nfile.expfname;
-		if ((f = open64(fname, O_RDONLY)) < 0)
-			goto eopen;
+		flags = O_RDONLY;
+do_open:
+		f = sh_open(redir->nfile.expfname, flags, 0);
 		break;
 	case NFROMTO:
-		fname = redir->nfile.expfname;
-		if ((f = open64(fname, O_RDWR|O_CREAT, 0666)) < 0)
-			goto ecreate;
-		break;
+		flags = O_RDWR|O_CREAT;
+		goto do_open;
 	case NTO:
 		/* Take care of noclobber mode. */
 		if (Cflag) {
 			fname = redir->nfile.expfname;
 			if (stat64(fname, &sb) < 0) {
-				if ((f = open64(fname, O_WRONLY|O_CREAT|O_EXCL, 0666)) < 0)
-					goto ecreate;
-			} else if (!S_ISREG(sb.st_mode)) {
-				if ((f = open64(fname, O_WRONLY, 0666)) < 0)
-					goto ecreate;
-				if (!fstat64(f, &sb) && S_ISREG(sb.st_mode)) {
-					close(f);
-					errno = EEXIST;
-					goto ecreate;
-				}
-			} else {
-				errno = EEXIST;
+				flags = O_WRONLY|O_CREAT|O_EXCL;
+				goto do_open;
+			}
+
+			if (S_ISREG(sb.st_mode))
+				goto ecreate;
+
+			f = sh_open(fname, O_WRONLY, 0);
+			if (!fstat64(f, &sb) && S_ISREG(sb.st_mode)) {
+				close(f);
 				goto ecreate;
 			}
 			break;
 		}
 		/* FALLTHROUGH */
 	case NCLOBBER:
-		fname = redir->nfile.expfname;
-		if ((f = open64(fname, O_WRONLY|O_CREAT|O_TRUNC, 0666)) < 0)
-			goto ecreate;
-		break;
+		flags = O_WRONLY|O_CREAT|O_TRUNC;
+		goto do_open;
 	case NAPPEND:
-		fname = redir->nfile.expfname;
-		if ((f = open64(fname, O_WRONLY|O_CREAT|O_APPEND, 0666)) < 0)
-			goto ecreate;
-		break;
+		flags = O_WRONLY|O_CREAT|O_APPEND;
+		goto do_open;
 	case NTOFD:
 	case NFROMFD:
 		f = redir->ndup.dupfd;
@@ -233,9 +277,7 @@ openredirect(union node *redir)
 
 	return f;
 ecreate:
-	sh_error("cannot create %s: %s", fname, errmsg(errno, E_CREAT));
-eopen:
-	sh_error("cannot open %s: %s", fname, errmsg(errno, E_OPEN));
+	sh_open_fail(fname, O_CREAT, EEXIST);
 }
 
 
@@ -346,14 +388,18 @@ popredir(int drop)
 	INTOFF;
 	rp = redirlist;
 	for (i = 0 ; i < 10 ; i++) {
+		int closed;
+
+		if (rp->renamed[i] == EMPTY)
+			continue;
+
+		closed = drop ? 1 : update_closed_redirs(i, rp->renamed[i]);
+
 		switch (rp->renamed[i]) {
 		case CLOSED:
-			if (!drop)
+			if (!closed)
 				close(i);
 			break;
-		case EMPTY:
-		case REALLY_CLOSED:
-			break;
 		default:
 			if (!drop)
 				dup2(rp->renamed[i], i);
@@ -374,13 +420,17 @@ popredir(int drop)
 
 INCLUDE "redir.h"
 
-RESET {
+EXITRESET {
 	/*
 	 * Discard all saved file descriptors.
 	 */
 	unwindredir(0);
 }
 
+FORKRESET {
+	redirlist = NULL;
+}
+
 #endif
 
 
@@ -423,9 +473,7 @@ redirectsafe(union node *redir, int flags)
 		handler = &jmploc;
 		redirect(redir, flags);
 	}
-	handler = savehandler;
-	if (err && exception != EXERROR)
-		longjmp(handler->loc, 1);
+	restore_handler_expandarg(savehandler, err);
 	RESTOREINT(saveint);
 	return err;
 }
diff --git a/src/redir.h b/src/redir.h
index 8e56995f04e107b900c85b015f92e7554e8ae6e5..16f5c204624072a9241db40ad16530ec1e18c1d4 100644
--- a/src/redir.h
+++ b/src/redir.h
@@ -45,9 +45,9 @@ struct redirtab;
 union node;
 void redirect(union node *, int);
 void popredir(int);
-void clearredir(void);
 int savefd(int, int);
 int redirectsafe(union node *, int);
 void unwindredir(struct redirtab *stop);
 struct redirtab *pushredir(union node *redir);
+int sh_open(const char *pathname, int flags, int mayfail);
 
diff --git a/src/system.h b/src/system.h
index a8d09b382a81caaa1e99271992631f47a7e3df6c..007952c5443ce230a4b669ffd85d5a5c85889c1c 100644
--- a/src/system.h
+++ b/src/system.h
@@ -36,8 +36,17 @@
 
 static inline void sigclearmask(void)
 {
-#ifdef HAVE_SIGSETMASK
+#if defined(HAVE_SIGSETMASK) && \
+    (!defined(__GLIBC__) || \
+     (defined(__GNUC__) && (__GNUC__ * 1000 + __GNUC_MINOR__) >= 4006))
+#ifdef __GLIBC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
 	sigsetmask(0);
+#ifdef __GLIBC__
+#pragma GCC diagnostic pop
+#endif
 #else
 	sigset_t set;
 	sigemptyset(&set);
diff --git a/src/trap.c b/src/trap.c
index 69eb8ab210075400b1d93b3dfd53eeed16c379c2..cd84814fa08fd8ace3788b4cbd39953d85f7634a 100644
--- a/src/trap.c
+++ b/src/trap.c
@@ -41,6 +41,7 @@
 #include "main.h"
 #include "nodes.h"	/* for other headers */
 #include "eval.h"
+#include "init.h"
 #include "jobs.h"
 #include "show.h"
 #include "options.h"
@@ -65,7 +66,7 @@
 
 
 /* trap handler commands */
-static char *trap[NSIG];
+MKINIT char *trap[NSIG];
 /* number of non-null traps */
 int trapcnt;
 /* current value of signal */
@@ -75,18 +76,36 @@ static char gotsig[NSIG - 1];
 /* last pending signal */
 volatile sig_atomic_t pending_sig;
 /* received SIGCHLD */
-int gotsigchld;
+volatile sig_atomic_t gotsigchld;
 
 extern char *signal_names[];
 
 static int decode_signum(const char *);
 
 #ifdef mkinit
+INCLUDE "memalloc.h"
 INCLUDE "trap.h"
+
 INIT {
 	sigmode[SIGCHLD - 1] = S_DFL;
 	setsignal(SIGCHLD);
 }
+
+FORKRESET {
+	char **tp;
+
+	INTOFF;
+	for (tp = trap ; tp < &trap[NSIG] ; tp++) {
+		if (*tp && **tp) {	/* trap not NULL or SIG_IGN */
+			ckfree(*tp);
+			*tp = NULL;
+			if (tp != &trap[0])
+				setsignal(tp - trap);
+		}
+	}
+	trapcnt = 0;
+	INTON;
+}
 #endif
 
 /*
@@ -149,30 +168,6 @@ trapcmd(int argc, char **argv)
 
 
 
-/*
- * Clear traps on a fork.
- */
-
-void
-clear_traps(void)
-{
-	char **tp;
-
-	INTOFF;
-	for (tp = trap ; tp < &trap[NSIG] ; tp++) {
-		if (*tp && **tp) {	/* trap not NULL or SIG_IGN */
-			ckfree(*tp);
-			*tp = NULL;
-			if (tp != &trap[0])
-				setsignal(tp - trap);
-		}
-	}
-	trapcnt = 0;
-	INTON;
-}
-
-
-
 /*
  * Set the signal handler for the specified signal.  The routine figures
  * out what it should be set to.
@@ -182,16 +177,19 @@ void
 setsignal(int signo)
 {
 	int action;
+	int lvforked;
 	char *t, tsig;
 	struct sigaction act;
 
+	lvforked = vforked;
+
 	if ((t = trap[signo]) == NULL)
 		action = S_DFL;
 	else if (*t != '\0')
 		action = S_CATCH;
 	else
 		action = S_IGN;
-	if (rootshell && action == S_DFL) {
+	if (rootshell && action == S_DFL && !lvforked) {
 		switch (signo) {
 		case SIGINT:
 			if (iflag || minusc || sflag == 0)
@@ -256,7 +254,8 @@ setsignal(int signo)
 	default:
 		act.sa_handler = SIG_DFL;
 	}
-	*t = action;
+	if (!lvforked)
+		*t = action;
 	act.sa_flags = 0;
 	sigfillset(&act.sa_mask);
 	sigaction(signo, &act, 0);
@@ -272,7 +271,8 @@ ignoresig(int signo)
 	if (sigmode[signo - 1] != S_IGN && sigmode[signo - 1] != S_HARD_IGN) {
 		signal(signo, SIG_IGN);
 	}
-	sigmode[signo - 1] = S_HARD_IGN;
+	if (!vforked)
+		sigmode[signo - 1] = S_HARD_IGN;
 }
 
 
@@ -284,6 +284,9 @@ ignoresig(int signo)
 void
 onsig(int signo)
 {
+	if (vforked)
+		return;
+
 	if (signo == SIGCHLD) {
 		gotsigchld = 1;
 		if (!trap[SIGCHLD])
@@ -389,8 +392,10 @@ exitshell(void)
 		trap[0] = NULL;
 		evalskip = 0;
 		evalstring(p, 0);
+		evalskip = SKIPFUNCDEF;
 	}
 out:
+	exitreset();
 	/*
 	 * Disable job control so that whoever had the foreground before we
 	 * started can get it back.
@@ -398,7 +403,7 @@ out:
 	if (likely(!setjmp(loc.loc)))
 		setjobctl(0);
 	flushall();
-	_exit(savestatus);
+	_exit(exitstatus);
 	/* NOTREACHED */
 }
 
@@ -431,3 +436,11 @@ int decode_signal(const char *string, int minsig)
 
 	return -1;
 }
+
+void sigblockall(sigset_t *oldmask)
+{
+	sigset_t mask;
+
+	sigfillset(&mask);
+	sigprocmask(SIG_SETMASK, &mask, oldmask);
+}
diff --git a/src/trap.h b/src/trap.h
index b9dfcf2071fe101a848227ace025bf589cb5d467..beaf66052ca19e155e28cdb35f60c995edff61f1 100644
--- a/src/trap.h
+++ b/src/trap.h
@@ -39,10 +39,9 @@
 extern int trapcnt;
 extern char sigmode[];
 extern volatile sig_atomic_t pending_sig;
-extern int gotsigchld;
+extern volatile sig_atomic_t gotsigchld;
 
 int trapcmd(int, char **);
-void clear_traps(void);
 void setsignal(int);
 void ignoresig(int);
 void onsig(int);
@@ -50,6 +49,7 @@ void dotrap(void);
 void setinteractive(int);
 void exitshell(void) __attribute__((__noreturn__));
 int decode_signal(const char *, int);
+void sigblockall(sigset_t *oldmask);
 
 static inline int have_traps(void)
 {
diff --git a/src/var.c b/src/var.c
index cc6f7f2a910a9959aafb24ace6c651beb941fedf..ef9c2bde8643aad8cac1b97b5d71f2ed40d03e9c 100644
--- a/src/var.c
+++ b/src/var.c
@@ -75,11 +75,7 @@ MKINIT struct localvar_list *localvar_stack;
 
 const char defpathvar[] =
 	"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin";
-#ifdef IFS_BROKEN
-const char defifsvar[] = "IFS= \t\n";
-#else
-const char defifs[] = " \t\n";
-#endif
+char defifsvar[] = "IFS= \t\n";
 MKINIT char defoptindvar[] = "OPTIND=1";
 
 int lineno;
@@ -90,11 +86,7 @@ struct var varinit[] = {
 #if ATTY
 	{ 0,	VSTRFIXED|VTEXTFIXED|VUNSET,	"ATTY\0",	0 },
 #endif
-#ifdef IFS_BROKEN
 	{ 0,	VSTRFIXED|VTEXTFIXED,		defifsvar,	0 },
-#else
-	{ 0,	VSTRFIXED|VTEXTFIXED|VUNSET,	"IFS\0",	0 },
-#endif
 	{ 0,	VSTRFIXED|VTEXTFIXED|VUNSET,	"MAIL\0",	changemail },
 	{ 0,	VSTRFIXED|VTEXTFIXED|VUNSET,	"MAILPATH\0",	changemail },
 	{ 0,	VSTRFIXED|VTEXTFIXED,		defpathvar,	changepath },
@@ -133,7 +125,7 @@ INIT {
 	char **envp;
 	static char ppid[32] = "PPID=";
 	const char *p;
-	struct stat st1, st2;
+	struct stat64 st1, st2;
 
 	initvar();
 	for (envp = environ ; *envp ; envp++) {
@@ -143,6 +135,7 @@ INIT {
 		}
 	}
 
+	setvareq(defifsvar, VTEXTFIXED);
 	setvareq(defoptindvar, VTEXTFIXED);
 
 	fmtstr(ppid + 5, sizeof(ppid) - 5, "%ld", (long) getppid());
@@ -150,7 +143,7 @@ INIT {
 
 	p = lookupvar("PWD");
 	if (p)
-		if (*p != '/' || stat(p, &st1) || stat(".", &st2) ||
+		if (*p != '/' || stat64(p, &st1) || stat64(".", &st2) ||
 		    st1.st_dev != st2.st_dev || st1.st_ino != st2.st_ino)
 			p = 0;
 	setpwd(p, 0);
@@ -309,28 +302,6 @@ out:
 	return vp;
 }
 
-
-
-/*
- * Process a linked list of variable assignments.
- */
-
-void
-listsetvar(struct strlist *list, int flags)
-{
-	struct strlist *lp;
-
-	lp = list;
-	if (!lp)
-		return;
-	INTOFF;
-	do {
-		setvareq(lp->text, flags);
-	} while ((lp = lp->next));
-	INTON;
-}
-
-
 /*
  * Find the value of a variable.  Returns NULL if not set.
  */
@@ -475,7 +446,7 @@ localcmd(int argc, char **argv)
 
 	argv = argptr;
 	while ((name = *argv++) != NULL) {
-		mklocal(name);
+		mklocal(name, 0);
 	}
 	return 0;
 }
@@ -488,7 +459,7 @@ localcmd(int argc, char **argv)
  * "-" as a special case.
  */
 
-void mklocal(char *name)
+void mklocal(char *name, int flags)
 {
 	struct localvar *lvp;
 	struct var **vpp;
@@ -509,16 +480,16 @@ void mklocal(char *name)
 		eq = strchr(name, '=');
 		if (vp == NULL) {
 			if (eq)
-				vp = setvareq(name, VSTRFIXED);
+				vp = setvareq(name, VSTRFIXED | flags);
 			else
-				vp = setvar(name, NULL, VSTRFIXED);
+				vp = setvar(name, NULL, VSTRFIXED | flags);
 			lvp->flags = VUNSET;
 		} else {
 			lvp->text = vp->text;
 			lvp->flags = vp->flags;
 			vp->flags |= VSTRFIXED|VTEXTFIXED;
 			if (eq)
-				setvareq(name, 0);
+				setvareq(name, flags);
 		}
 	}
 	lvp->vp = vp;
@@ -533,8 +504,8 @@ void mklocal(char *name)
  * Interrupts must be off.
  */
 
-void
-poplocalvars(int keep)
+static void
+poplocalvars(void)
 {
 	struct localvar_list *ll;
 	struct localvar *lvp, *next;
@@ -551,23 +522,7 @@ poplocalvars(int keep)
 		next = lvp->next;
 		vp = lvp->vp;
 		TRACE(("poplocalvar %s\n", vp ? vp->text : "-"));
-		if (keep) {
-			int bits = VSTRFIXED;
-
-			if (lvp->flags != VUNSET) {
-				if (vp->text == lvp->text)
-					bits |= VTEXTFIXED;
-				else if (!(lvp->flags & (VTEXTFIXED|VSTACK)))
-					ckfree(lvp->text);
-			}
-
-			vp->flags &= ~bits;
-			vp->flags |= (lvp->flags & bits);
-
-			if ((vp->flags &
-			     (VEXPORT|VREADONLY|VSTRFIXED|VUNSET)) == VUNSET)
-				unsetvar(vp->text);
-		} else if (vp == NULL) {	/* $- saved */
+		if (vp == NULL) {	/* $- saved */
 			memcpy(optlist, lvp->text, sizeof(optlist));
 			ckfree(lvp->text);
 			optschanged();
@@ -591,25 +546,31 @@ poplocalvars(int keep)
 /*
  * Create a new localvar environment.
  */
-struct localvar_list *pushlocalvars(void)
+struct localvar_list *pushlocalvars(int push)
 {
 	struct localvar_list *ll;
+	struct localvar_list *top;
+
+	top = localvar_stack;
+	if (!push)
+		goto out;
 
 	INTOFF;
 	ll = ckmalloc(sizeof(*ll));
 	ll->lv = NULL;
-	ll->next = localvar_stack;
+	ll->next = top;
 	localvar_stack = ll;
 	INTON;
 
-	return ll->next;
+out:
+	return top;
 }
 
 
 void unwindlocalvars(struct localvar_list *stop)
 {
 	while (localvar_stack != stop)
-		poplocalvars(0);
+		poplocalvars();
 }
 
 
diff --git a/src/var.h b/src/var.h
index 872e2dbb71033fe65772fc35267a39133ba0b144..aa7575a78f5b8c4cbc6ac38cf54755ae5fc15431 100644
--- a/src/var.h
+++ b/src/var.h
@@ -100,12 +100,8 @@ extern struct var varinit[];
 #define vhistsize (&vterm)[1]
 #endif
 
-#ifdef IFS_BROKEN
-extern const char defifsvar[];
+extern char defifsvar[];
 #define defifs (defifsvar + 4)
-#else
-extern const char defifs[];
-#endif
 extern const char defpathvar[];
 #define defpath (defpathvar + 36)
 
@@ -143,7 +139,6 @@ struct var *setvar(const char *name, const char *val, int flags);
 intmax_t setvarint(const char *, intmax_t, int);
 struct var *setvareq(char *s, int flags);
 struct strlist;
-void listsetvar(struct strlist *, int);
 char *lookupvar(const char *);
 intmax_t lookupvarint(const char *);
 char **listvars(int, int, char ***);
@@ -151,9 +146,8 @@ char **listvars(int, int, char ***);
 int showvars(const char *, int, int);
 int exportcmd(int, char **);
 int localcmd(int, char **);
-void mklocal(char *);
-struct localvar_list *pushlocalvars(void);
-void poplocalvars(int);
+void mklocal(char *name, int flags);
+struct localvar_list *pushlocalvars(int push);
 void unwindlocalvars(struct localvar_list *stop);
 int unsetcmd(int, char **);
 void unsetvar(const char *);