summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore18
-rw-r--r--AUTHORS6
-rw-r--r--INSTALL370
-rw-r--r--Makefile.am28
-rw-r--r--acconfig.h83
-rw-r--r--aclocal.m41069
-rwxr-xr-x[-rw-r--r--]bootstrap2
-rw-r--r--builtins.c2
-rw-r--r--configure.ac19
-rw-r--r--develop.c303
-rw-r--r--develop.h4
-rw-r--r--edit-edit.c5
-rw-r--r--edit-editline.c5
-rw-r--r--edit-gnu.c87
-rw-r--r--edit-readline.c7
-rw-r--r--edit-vrl.c5
-rw-r--r--exec.c2
-rw-r--r--hash.c1
-rw-r--r--history.c2
-rw-r--r--input.c3
-rw-r--r--lex.c6
-rw-r--r--main.c5
-rw-r--r--open.c2
-rw-r--r--parse.c1117
-rw-r--r--parse.h37
-rw-r--r--parse.y19
-rw-r--r--rc.1162
-rw-r--r--signal.c5
-rw-r--r--trip.rc25
-rw-r--r--version.c.in2
-rw-r--r--walk.c5
31 files changed, 550 insertions, 2856 deletions
diff --git a/.gitignore b/.gitignore
index ad32267..eaa1bb5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,14 +1,28 @@
*~
-.deps/
-Makefile
+aclocal.m4
autom4te.cache/
+compile
config.h
+config.h.in
config.log
config.status
configure
depcomp
+.deps/
+INSTALL
+install-sh
+Makefile
+Makefile.in
missing
+mksignal
+mkstatval
+*.o
+parse.c
+parse.h
+rc
sigmsgs.c
sigmsgs.h
stamp-h1
statval.h
+tripping
+ylwrap
diff --git a/AUTHORS b/AUTHORS
index d231e38..ee7c64f 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -28,9 +28,9 @@ FTP or HTTP directory as the shell). Please read this paper bearing in
mind that it describes a program that was written at AT&T and that the
version of rc presented here differs in some respects.
-Toby would like to thank these people for their contributions since he
-took over maintenance of rc. Aharon Robbins, Arvid Requate, Bengt
-Kleberg, Brynjulv Hauksson, Byron Rakitzis, Callum Gibson, Chris
+Toby would like to thank these people for their contributions since he took
+over maintenance of rc. Aharon Robbins, Arvid Requate, Bengt Kleberg,
+Brynjulv Hauksson, Byron Rakitzis, Callum Gibson, Casper Ti. Vector, Chris
Siebenmann, Christian Neukirchen, Dale Scheetz, Dan Moniz, David Luyer,
David Swasey, Decklin Foster, Donn Cave, Erik Quanstrom, Gary Carvell,
Gerry Tomlinson, Gert-Jan Vons, Ian Lance Taylor, Jakub Wilk, Jeremy
diff --git a/INSTALL b/INSTALL
deleted file mode 100644
index 007e939..0000000
--- a/INSTALL
+++ /dev/null
@@ -1,370 +0,0 @@
-Installation Instructions
-*************************
-
-Copyright (C) 1994-1996, 1999-2002, 2004-2013 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 commands `./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.am b/Makefile.am
index 00c5dff..fac6214 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -19,21 +19,27 @@ else
SYSTEM = system.o
endif
+if AMC_DEVELOP
+DEVELOP = develop.o
+endif
+
bin_PROGRAMS = rc
noinst_PROGRAMS = mksignal mkstatval tripping $(HISTORY)
-rc_SOURCES = builtins.c except.c exec.c fn.c footobar.c getopt.c glob.c glom.c hash.c heredoc.c input.c lex.c list.c main.c match.c nalloc.c open.c parse.c print.c redir.c signal.c status.c tree.c utils.c var.c wait.c walk.c which.c
+rc_SOURCES = builtins.c except.c exec.c fn.c footobar.c getopt.c glob.c glom.c hash.c heredoc.c input.c lex.c list.c main.c match.c nalloc.c open.c parse.y print.c redir.c signal.c status.c tree.c utils.c var.c wait.c walk.c which.c
EXTRA_rc_SOURCES = addon.c edit-edit.c edit-editline.c edit-null.c edit-readline.c edit-vrl.c execve.c system.c system-bsd.c
-rc_DEPENDENCIES = sigmsgs.o $(ADDON) $(EDIT) $(EXECVE) $(SYSTEM)
-rc_LDADD = sigmsgs.o $(ADDON) $(EDIT) $(EXECVE) $(SYSTEM)
+rc_DEPENDENCIES = sigmsgs.o $(ADDON) $(DEVELOP) $(EDIT) $(EXECVE) $(SYSTEM)
+rc_LDADD = sigmsgs.o $(ADDON) $(DEVELOP) $(EDIT) $(EXECVE) $(SYSTEM)
noinst_HEADERS = edit.h getgroups.h input.h jbwrap.h parse.h proto.h rc.h rlimit.h stat.h wait.h
-BUILT_SOURCES = sigmsgs.c
+BUILT_SOURCES = parse.h sigmsgs.c
+
+EXTRA_DIST = EXAMPLES addon.c addon.h history.1 rc.1 trip.rc
-EXTRA_DIST = EXAMPLES addon.c addon.h history.1 parse.y rc.1 trip.rc
+AM_YFLAGS = -d
sigmsgs.c sigmsgs.h: mksignal
./mksignal
@@ -45,17 +51,7 @@ status.o: statval.h
statval.h: mkstatval
./mkstatval > statval.h
-DISTCLEANFILES = sigmsgs.c sigmsgs.h statval.h
-
-# Of course, parse.c and parse.h depend on parse.y. However, unless
-# you're hacking on rc's grammar, it's not useful to have this
-# dependency expressed, since the distributed parse.[ch] (generated with
-# byacc, and lightly edited to remove a couple of gcc warnings) are
-# portable (I hope).
-#parse.c parse.h: $(srcdir)/parse.y
-# $(YACC) -d $(srcdir)/parse.y
-# mv y.tab.c parse.c
-# mv y.tab.h parse.h
+DISTCLEANFILES = parse.c parse.h sigmsgs.c sigmsgs.h statval.h
check: trip
diff --git a/acconfig.h b/acconfig.h
deleted file mode 100644
index c5b9bcf..0000000
--- a/acconfig.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* Define to a suitable ssize_t. */
-#undef ssize_t
-
-/* Define to a suitable sig_atomic_t. */
-#undef sig_atomic_t
-
-/* Define if you want rc to hand off exec errors to (e.g.) /bin/sh. */
-#undef DEFAULTINTERP
-
-/* Define to the default path used if $PATH is empty when rc starts. */
-#undef DEFAULTPATH
-
-/* Define if your kernel has SysV special SIGCLD semantics. */
-#undef HAVE_SYSV_SIGCLD
-
-/* Define if your kernel supports `#!' magic numbers. */
-#undef HASH_BANG
-
-/* Define if you have /dev/fd. */
-#undef HAVE_DEV_FD
-
-/* Define if you have /proc/self/fd. */
-#undef HAVE_PROC_SELF_FD
-
-/* Define if you have named pipes. */
-#undef HAVE_FIFO
-
-/* Define if quad_t is a native type. */
-#undef HAVE_QUAD_T
-
-/* Define if you have rlim_t. */
-#undef HAVE_RLIM_T
-
-/* Define if you have sigsetjmp(). */
-#undef HAVE_SIGSETJMP
-
-/* Define in you have strerror(). */
-#undef HAVE_STRERROR
-
-/* Define if you want rc to encode strange characters in the environment. */
-#undef PROTECT_ENV
-
-/* Define if you have extra builtins. */
-#undef RC_ADDON
-
-/* Define if you want echo as a builtin. */
-#undef RC_ECHO
-
-/* Define if you want rc to support broken apps, like a job control shell. */
-#undef RC_JOB
-
-/* Define if you want to use editline. */
-#undef EDITLINE
-
-/* Define if you want to use GNU readline. */
-#undef READLINE
-
-/* Define if you have the older readline, with rl_deprep_terminal. */
-#undef READLINE_OLD
-
-/* Define if RLIMIT_foo defines need _KERNEL. */
-#undef RLIMIT_NEEDS_KERNEL
-
-/* Define if rlim_t is quad_t. */
-#undef RLIM_T_IS_QUAD_T
-
-/* Define to package name. */
-#undef PACKAGE
-
-/* Define to version. */
-#undef VERSION
-
-/* Define to release date. */
-#undef RELDATE
-
-/* Define if you have SA_INTERRUPT (and sigaction()). */
-#undef HAVE_SA_INTERRUPT
-
-/* Define if you have POSIX getgroups(). */
-#undef HAVE_POSIX_GETGROUPS
-
-/* Define if you have va_copy(). */
-#undef HAVE_VA_COPY
diff --git a/aclocal.m4 b/aclocal.m4
deleted file mode 100644
index 145230d..0000000
--- a/aclocal.m4
+++ /dev/null
@@ -1,1069 +0,0 @@
-# generated automatically by aclocal 1.13.4 -*- Autoconf -*-
-
-# Copyright (C) 1996-2013 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.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# 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'.])])
-
-# Copyright (C) 2002-2013 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_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.13'
-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.13.4], [],
- [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
-])
-
-# _AM_AUTOCONF_VERSION(VERSION)
-# -----------------------------
-# aclocal traces this macro to find the Autoconf version.
-# This is a private macro too. Using m4_define simplifies
-# the logic in aclocal, which can simply ignore this definition.
-m4_define([_AM_AUTOCONF_VERSION], [])
-
-# AM_SET_CURRENT_AUTOMAKE_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.13.4])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-2013 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.
-
-# 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/../..'.
-#
-# Of course, Automake must honor this variable whenever it calls a
-# tool from the auxiliary directory. The problem is that $srcdir (and
-# therefore $ac_aux_dir as well) can be either absolute or relative,
-# depending on how configure is run. This is pretty annoying, since
-# it makes $ac_aux_dir quite unusable in subdirectories: in the top
-# source directory, any form will work fine, but in subdirectories a
-# relative path needs to be adjusted first.
-#
-# $ac_aux_dir/missing
-# fails when called from a subdirectory if $ac_aux_dir is relative
-# $top_srcdir/$ac_aux_dir/missing
-# fails if $ac_aux_dir is absolute,
-# fails when called from a subdirectory in a VPATH build with
-# a relative $ac_aux_dir
-#
-# 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
-# start a VPATH build or use an absolute $srcdir.
-#
-# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
-# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
-# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
-# and then we would define $MISSING as
-# MISSING="\${SHELL} $am_aux_dir/missing"
-# This will work as long as MISSING is not called from configure, because
-# unfortunately $(top_srcdir) has no meaning in configure.
-# However there are other variables, like CC, which are often used in
-# configure, and could therefore not use this "fixed" $ac_aux_dir.
-#
-# Another solution, used here, is to always expand $ac_aux_dir to an
-# absolute PATH. The drawback is that using absolute paths prevent a
-# 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`
-])
-
-# AM_CONDITIONAL -*- Autoconf -*-
-
-# Copyright (C) 1997-2013 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_CONDITIONAL(NAME, SHELL-CONDITION)
-# -------------------------------------
-# Define a conditional.
-AC_DEFUN([AM_CONDITIONAL],
-[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
-_AM_SUBST_NOTMAKE([$1_FALSE])dnl
-m4_define([_AM_COND_VALUE_$1], [$2])dnl
-if $2; then
- $1_TRUE=
- $1_FALSE='#'
-else
- $1_TRUE='#'
- $1_FALSE=
-fi
-AC_CONFIG_COMMANDS_PRE(
-[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
- AC_MSG_ERROR([[conditional "$1" was never defined.
-Usually this means the macro was only invoked conditionally.]])
-fi])])
-
-# Copyright (C) 1999-2013 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.
-
-
-# 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
-# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
-
-
-# _AM_DEPENDENCIES(NAME)
-# ----------------------
-# See how the compiler implements dependency checking.
-# 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
-# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
-# dependency, and given that the user is not expected to run this macro,
-# just rely on AC_PROG_CC.
-AC_DEFUN([_AM_DEPENDENCIES],
-[AC_REQUIRE([AM_SET_DEPDIR])dnl
-AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
-AC_REQUIRE([AM_MAKE_INCLUDE])dnl
-AC_REQUIRE([AM_DEP_TRACK])dnl
-
-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],
-[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
- # 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".
- rm -rf conftest.dir
- mkdir conftest.dir
- # Copy depcomp to subdir because otherwise we won't find it if we're
- # using a relative directory.
- cp "$am_depcomp" conftest.dir
- cd conftest.dir
- # We will build objects and dependencies in a subdirectory because
- # it helps to detect inapplicable dependency modes. For instance
- # both Tru64's cc and ICC support -MD to output dependencies as a
- # side effect of compilation, but ICC will put the dependencies in
- # the current directory while Tru64 will put them in the object
- # directory.
- mkdir sub
-
- am_cv_$1_dependencies_compiler_type=none
- if test "$am_compiler_list" = ""; then
- am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
- fi
- am__universal=false
- m4_case([$1], [CC],
- [case " $depcc " in #(
- *\ -arch\ *\ -arch\ *) am__universal=true ;;
- esac],
- [CXX],
- [case " $depcc " in #(
- *\ -arch\ *\ -arch\ *) am__universal=true ;;
- esac])
-
- for depmode in $am_compiler_list; do
- # Setup a source with many dependencies, because some compilers
- # like to wrap large dependency lists on column 80 (with \), and
- # we should not choose a depcomp mode which is confused by this.
- #
- # We need to recreate these files for each test, as the compiler may
- # overwrite some of them when testing with obscure command lines.
- # This happens at least with the AIX C compiler.
- : > 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 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"
- # 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.
- am__obj=sub/conftest.${OBJEXT-o}
- am__minus_obj="-o $am__obj"
- case $depmode in
- gcc)
- # This depmode causes a compiler race in universal mode.
- test "$am__universal" = false || continue
- ;;
- nosideeffect)
- # 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
- break
- fi
- ;;
- msvc7 | msvc7msys | msvisualcpp | msvcmsys)
- # 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}
- am__minus_obj=
- ;;
- none) break ;;
- esac
- if depmode=$depmode \
- source=sub/conftest.c object=$am__obj \
- depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
- $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
- >/dev/null 2>conftest.err &&
- grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
- grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
- grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
- ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
- # icc doesn't choke on unknown options, it will just issue warnings
- # or remarks (even with -Werror). So we grep stderr for any message
- # that says an option was ignored or not supported.
- # When given -MP, icc 7.0 and 7.1 complain thusly:
- # icc: Command line warning: ignoring option '-M'; no argument required
- # The diagnosis changed in icc 8.0:
- # icc: Command line remark: option '-MP' not supported
- if (grep 'ignoring option' conftest.err ||
- grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
- am_cv_$1_dependencies_compiler_type=$depmode
- break
- fi
- fi
- done
-
- cd ..
- rm -rf conftest.dir
-else
- am_cv_$1_dependencies_compiler_type=none
-fi
-])
-AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
-AM_CONDITIONAL([am__fastdep$1], [
- test "x$enable_dependency_tracking" != xno \
- && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
-])
-
-
-# AM_SET_DEPDIR
-# -------------
-# Choose a directory name for dependency files.
-# 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
-])
-
-
-# AM_DEP_TRACK
-# ------------
-AC_DEFUN([AM_DEP_TRACK],
-[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='\'
- am__nodep='_no'
-fi
-AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
-AC_SUBST([AMDEPBACKSLASH])dnl
-_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
-AC_SUBST([am__nodep])dnl
-_AM_SUBST_NOTMAKE([am__nodep])dnl
-])
-
-# Generate code to set up dependency tracking. -*- Autoconf -*-
-
-# Copyright (C) 1999-2013 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_OUTPUT_DEPENDENCY_COMMANDS
-# ------------------------------
-AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
-[{
- # 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
- shift
- for 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
- # 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"`
- # 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'`; 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
- done
-}
-])# _AM_OUTPUT_DEPENDENCY_COMMANDS
-
-
-# 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.
-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"])
-])
-
-# Do all the work for Automake. -*- Autoconf -*-
-
-# Copyright (C) 1996-2013 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.
-
-# 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.
-
-# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
-# AM_INIT_AUTOMAKE([OPTIONS])
-# -----------------------------------------------
-# The call with PACKAGE and VERSION arguments is the old style
-# call (pre autoconf-2.50), which is being phased out. PACKAGE
-# and VERSION should now be passed to AC_INIT and removed from
-# the call to AM_INIT_AUTOMAKE.
-# We support both call styles for the transition. After
-# the next Automake release, Autoconf can make the AC_INIT
-# 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.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
-AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
-AC_REQUIRE([AC_PROG_INSTALL])dnl
-if test "`cd $srcdir && pwd`" != "`pwd`"; then
- # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
- # is not polluted with repeated "-I."
- AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
- # test to see if srcdir already configured
- if test -f $srcdir/config.status; then
- AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
- fi
-fi
-
-# test whether we have cygpath
-if test -z "$CYGPATH_W"; then
- if (cygpath --version) >/dev/null 2>/dev/null; then
- CYGPATH_W='cygpath -w'
- else
- CYGPATH_W=echo
- fi
-fi
-AC_SUBST([CYGPATH_W])
-
-# Define the identity of the package.
-dnl Distinguish between old-style and new-style calls.
-m4_ifval([$2],
-[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], [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
-
-# 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])
-AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
-AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
-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:
-# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
-# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
-AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
-# We need awk for the "check" target. The system "awk" is bad on
-# some platforms.
-AC_REQUIRE([AC_PROG_AWK])dnl
-AC_REQUIRE([AC_PROG_MAKE_SET])dnl
-AC_REQUIRE([AM_SET_LEADING_DOT])dnl
-_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
- [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
- [_AM_PROG_TAR([v7])])])
-_AM_IF_OPTION([no-dependencies],,
-[AC_PROVIDE_IFELSE([AC_PROG_CC],
- [_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])],
- [m4_define([AC_PROG_CXX],
- m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
-AC_PROVIDE_IFELSE([AC_PROG_OBJC],
- [_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
-])
-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
-])
-
-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.
-
-# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
-# loop where config.status creates the headers, so we can generate
-# our stamp files there.
-AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
-[# Compute $1's index in $config_headers.
-_am_arg=$1
-_am_stamp_count=1
-for _am_header in $config_headers :; do
- case $_am_header in
- $_am_arg | $_am_arg:* )
- break ;;
- * )
- _am_stamp_count=`expr $_am_stamp_count + 1` ;;
- esac
-done
-echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
-
-# Copyright (C) 2001-2013 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_SH
-# ------------------
-# Define $install_sh.
-AC_DEFUN([AM_PROG_INSTALL_SH],
-[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
-if test x"${install_sh}" != xset; then
- case $am_aux_dir in
- *\ * | *\ *)
- install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
- *)
- install_sh="\${SHELL} $am_aux_dir/install-sh"
- esac
-fi
-AC_SUBST([install_sh])])
-
-# Copyright (C) 2003-2013 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.
-
-# Check whether the underlying file-system supports filenames
-# with a leading dot. For instance MS-DOS doesn't.
-AC_DEFUN([AM_SET_LEADING_DOT],
-[rm -rf .tst 2>/dev/null
-mkdir .tst 2>/dev/null
-if test -d .tst; then
- am__leading_dot=.
-else
- am__leading_dot=_
-fi
-rmdir .tst 2>/dev/null
-AC_SUBST([am__leading_dot])])
-
-# Check to see how 'make' treats includes. -*- Autoconf -*-
-
-# Copyright (C) 2001-2013 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_MAKE_INCLUDE()
-# -----------------
-# Check to see how make treats includes.
-AC_DEFUN([AM_MAKE_INCLUDE],
-[am_make=${MAKE-make}
-cat > confinc << 'END'
-am__doit:
- @echo this is the am__doit target
-.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
-])
-
-# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
-
-# Copyright (C) 1997-2013 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_MISSING_PROG(NAME, PROGRAM)
-# ------------------------------
-AC_DEFUN([AM_MISSING_PROG],
-[AC_REQUIRE([AM_MISSING_HAS_RUN])
-$1=${$1-"${am_missing_run}$2"}
-AC_SUBST($1)])
-
-# AM_MISSING_HAS_RUN
-# ------------------
-# 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
-fi
-# Use eval to expand $SHELL
-if eval "$MISSING --is-lightweight"; then
- am_missing_run="$MISSING "
-else
- am_missing_run=
- AC_MSG_WARN(['missing' script is too old or missing])
-fi
-])
-
-# -*- Autoconf -*-
-# Obsolete and "removed" macros, that must however still report explicit
-# error messages when used, to smooth transition.
-#
-# Copyright (C) 1996-2013 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([AM_CONFIG_HEADER],
-[AC_DIAGNOSE([obsolete],
-['$0': this macro is obsolete.
-You should use the 'AC][_CONFIG_HEADERS' macro instead.])dnl
-AC_CONFIG_HEADERS($@)])
-
-AC_DEFUN([AM_PROG_CC_STDC],
-[AC_PROG_CC
-am_cv_prog_cc_stdc=$ac_cv_prog_cc_stdc
-AC_DIAGNOSE([obsolete],
-['$0': this macro is obsolete.
-You should simply use the 'AC][_PROG_CC' macro instead.
-Also, your code should no longer depend upon 'am_cv_prog_cc_stdc',
-but upon 'ac_cv_prog_cc_stdc'.])])
-
-AC_DEFUN([AM_C_PROTOTYPES],
- [AC_FATAL([automatic de-ANSI-fication support has been removed])])
-AU_DEFUN([fp_C_PROTOTYPES], [AM_C_PROTOTYPES])
-
-# Helper functions for option handling. -*- Autoconf -*-
-
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
-#
-# 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_MANGLE_OPTION(NAME)
-# -----------------------
-AC_DEFUN([_AM_MANGLE_OPTION],
-[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
-
-# _AM_SET_OPTION(NAME)
-# --------------------
-# 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])])
-
-# _AM_SET_OPTIONS(OPTIONS)
-# ------------------------
-# OPTIONS is a space-separated list of Automake options.
-AC_DEFUN([_AM_SET_OPTIONS],
-[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
-
-# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
-# -------------------------------------------
-# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
-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) 1996-2013 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])
-# Reject unsafe characters in $srcdir or the absolute working directory
-# name. Accept space and tab only in the latter.
-am_lf='
-'
-case `pwd` in
- *[[\\\"\#\$\&\'\`$am_lf]]*)
- AC_MSG_ERROR([unsafe absolute working directory name]);;
-esac
-case $srcdir in
- *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
- AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
-esac
-
-# 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 (
- 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
- # Ok.
- :
-else
- AC_MSG_ERROR([newly created file is older than distributed files!
-Check your system clock])
-fi
-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) 2009-2013 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_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-2013 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
-# 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
-# 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
-# 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'.
-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-2013 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_SUBST_NOTMAKE(VARIABLE)
-# ---------------------------
-# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
-# This macro is traced by Automake.
-AC_DEFUN([_AM_SUBST_NOTMAKE])
-
-# AM_SUBST_NOTMAKE(VARIABLE)
-# --------------------------
-# Public sister of _AM_SUBST_NOTMAKE.
-AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
-
-# Check how to create a tarball. -*- Autoconf -*-
-
-# Copyright (C) 2004-2013 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_TAR(FORMAT)
-# --------------------
-# Check how to create a tarball in format FORMAT.
-# 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
-# $tardir.
-# tardir=directory && $(am__tar) > result.tar
-#
-# 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}'])
-
-# 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'
-
-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
-
- # 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
-
- 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
-
-m4_include([acinclude.m4])
diff --git a/bootstrap b/bootstrap
index b499423..3f026c4 100644..100755
--- a/bootstrap
+++ b/bootstrap
@@ -1,2 +1,2 @@
-#! /bin/sh
+#!/bin/sh
autoreconf --force --install
diff --git a/builtins.c b/builtins.c
index 75ac9cf..a0f0ebe 100644
--- a/builtins.c
+++ b/builtins.c
@@ -236,7 +236,7 @@ static void b_shift(char **av) {
--shift;
}
if (s == NULL && shift != 0) {
- fprint(2, "cannot shift\n");
+ fprint(2, "rc: cannot shift\n");
set(FALSE);
} else {
varassign("*", append(dollarzero, s), FALSE);
diff --git a/configure.ac b/configure.ac
index e86bef6..23ebf8a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,8 +2,8 @@ dnl Our package name, version, ...
AC_INIT([rc], [1.7.4])
dnl ... and release date
-RELDATE=`date +%Y-%m-%d`
-AC_DEFINE_UNQUOTED(RELDATE, "$RELDATE", [Release date])
+DESCRIPTION=$(git describe || echo '(git description unavailable)')
+AC_DEFINE_UNQUOTED(DESCRIPTION, "$DESCRIPTION", [Release date])
dnl Get things going...
AC_CONFIG_SRCDIR([rc.h])
@@ -25,6 +25,7 @@ esac
AC_SYS_LARGEFILE
AC_PROG_CPP
+AC_PROG_YACC
AC_CHECK_PROGS(LN, ln cp)
AC_CHECK_HEADERS(sys/resource.h sys/time.h sys/types.h unistd.h)
@@ -144,6 +145,19 @@ yes) AC_CACHE_CHECK(extant directories for default path, rc_cv_def_path,[
;;
esac
+
+AC_ARG_ENABLE(develop,
+ [ --enable-develop Include extra code for developers],[
+ case "$enableval" in
+ yes)
+ rc_develop=true
+ AC_DEFINE([RC_DEVELOP], 1, [Enable developer options]) ;;
+ no) ;;
+ *) AC_MSG_ERROR([bad value $enableval for --enable-develop]) ;;
+ esac])
+AM_CONDITIONAL(AMC_DEVELOP, test "$rc_develop" = true)
+
+
AC_ARG_WITH(history,
[ --with-history Build history subprograms],[
case "$withval" in
@@ -244,4 +258,5 @@ dnl AM_CONDITIONAL(AMC_READLINE, test "${with_readline+set}" = set)
dnl For some reason CPPFLAGS doesn't get propagated.
dnl AC_SUBST(CPPFLAGS)
+
AC_OUTPUT(Makefile)
diff --git a/develop.c b/develop.c
new file mode 100644
index 0000000..0ebec7f
--- /dev/null
+++ b/develop.c
@@ -0,0 +1,303 @@
+#include "rc.h"
+
+#include "develop.h"
+
+void dump(Node *, int);
+
+/* dump a Node * as a tree */
+
+static void dump_1(char *p, Node *n, int indent) {
+ fprint(2, "%s:\n", p);
+ dump(n->u[0].p, indent + 1);
+}
+
+static void dump_2(char *p, Node *n, int indent) {
+ fprint(2, "%s:\n", p);
+ dump(n->u[0].p, indent + 1);
+ if (n->u[1].p != NULL)
+ dump(n->u[1].p, indent + 1);
+}
+
+static void dump_3(char *p, Node *n, int indent) {
+ fprint(2, "%s:\n", p);
+ dump(n->u[0].p, indent + 1);
+ if (n->u[1].p != NULL)
+ dump(n->u[1].p, indent + 1);
+ if (n->u[2].p != NULL)
+ dump(n->u[2].p, indent + 1);
+}
+
+static void dump_s(char *p, Node *n, int indent) {
+ fprint(2, "%s: %S\n", p, n->u[0].s);
+}
+
+static void dump_pipe(char *p, Node *n, int indent) {
+ int ifd = n->u[0].i, ofd = n->u[1].i;
+ fprint(2, "%s %d %d:\n", p, ifd, ofd);
+ dump(n->u[2].p, indent + 1);
+ dump(n->u[3].p, indent + 1);
+}
+
+static char *redir(int op) {
+ switch (op) {
+ case rCreate: return ">";
+ case rAppend: return ">>";
+ case rFrom: return "<";
+ case rHeredoc: return "<<";
+ case rHerestring: return "<<<";
+ default: return "?";
+ }
+}
+static void dump_dup(char *p, Node *n, int indent) {
+ fprint(2, "%s %s %d %d:\n", p, redir(n->u[0].i), n->u[1].i, n->u[2].i);
+}
+
+static void dump_redir(char *p, Node *n, int indent) {
+ fprint(2, "%s %s %d:\n", p, redir(n->u[0].i), n->u[1].i);
+ dump(n->u[2].p, indent + 1);
+}
+
+void dump(Node *n, int indent) {
+ int i;
+
+ if (n == NULL)
+ return;
+
+ for (i = 0; i < indent; ++i)
+ fprint(2, " ");
+
+ switch (n->type) {
+ case nAndalso:
+ dump_2("nAndalso", n, indent);
+ break;
+ case nArgs:
+ dump_2("nArgs", n, indent);
+ break;
+ case nAssign:
+ dump_2("nAassign", n, indent);
+ break;
+ case nBackq:
+ dump_1("nBackq", n, indent);
+ break;
+ case nBang:
+ dump_1("nBang", n, indent);
+ break;
+ case nBody:
+ dump_2("nBody", n, indent);
+ break;
+ case nBrace:
+ dump_1("nBrace", n, indent);
+ break;
+ case nCase:
+ dump_1("nCase", n, indent);
+ break;
+ case nCbody:
+ dump_2("nCbody", n, indent);
+ break;
+ case nConcat:
+ dump_2("nConcat", n, indent);
+ break;
+ case nCount:
+ dump_1("nCount", n, indent);
+ break;
+ case nDup:
+ dump_dup("nDup", n, indent);
+ break;
+ case nElse:
+ dump_2("nElse", n, indent);
+ break;
+ case nEpilog:
+ dump_2("nEpilog", n, indent);
+ break;
+ case nFlat:
+ dump_1("nFlat", n, indent);
+ break;
+ case nForin:
+ dump_3("nForin", n, indent);
+ break;
+ case nIf:
+ dump_2("nIf", n, indent);
+ break;
+ case nLappend:
+ dump_2("nLappend", n, indent);
+ break;
+ case nMatch:
+ dump_2("nMatch", n, indent);
+ break;
+ case nNewfn:
+ dump_2("nNewfn", n, indent);
+ break;
+ case nNmpipe:
+ dump_redir("nNowait", n, indent);
+ break;
+ case nNowait:
+ dump_1("nNowait", n, indent);
+ break;
+ case nOrelse:
+ dump_2("nNowait", n, indent);
+ break;
+ case nPipe:
+ dump_pipe("nPipe", n, indent);
+ break;
+ case nPre:
+ dump_2("nPre", n, indent);
+ break;
+ case nRedir:
+ dump_redir("nRedir", n, indent);
+ break;
+ case nRmfn:
+ dump_1("nRmfn", n, indent);
+ break;
+ case nSubshell:
+ dump_1("nSubshell", n, indent);
+ break;
+ case nSwitch:
+ dump_2("nSwitch", n, indent);
+ break;
+ case nVar:
+ dump_1("nVar", n, indent);
+ break;
+ case nVarsub:
+ dump_2("nVarsub", n, indent);
+ break;
+ case nWhile:
+ dump_2("nWhile", n, indent);
+ break;
+ case nWord:
+ dump_s("nWord", n, indent);
+ break;
+ default:
+ fprint(2, "unknown\n");
+ break;
+ }
+}
+
+void tree_dump(Node *f) {
+ dump(f, 0);
+}
+#if 0
+ bool dollar = f->flags & FMT_altform;
+ Node *n = va_arg(f->args, Node *);
+
+ if (n == NULL) {
+ fmtprint(f, "()");
+ return FALSE;
+ }
+ switch (n->type) {
+ case nBang: fmtprint(f, "!%X", n->u[0].p); break;
+ case nCase: fmtprint(f, "case %X", n->u[0].p); break;
+ case nNowait: fmtprint(f, "%X&", n->u[0].p); break;
+ case nRmfn: fmtprint(f, "fn %X", n->u[0].p); break;
+ case nSubshell: fmtprint(f, "@ %X", n->u[0].p); break;
+ case nAndalso: fmtprint(f, "%X&&%X", n->u[0].p, n->u[1].p); break;
+ case nAssign: fmtprint(f, "%X=%X", n->u[0].p, n->u[1].p); break;
+ case nConcat: fmtprint(f, "%X^%X", n->u[0].p, n->u[1].p); break;
+ case nElse: fmtprint(f, "{%X}else %X", n->u[0].p, n->u[1].p); break;
+ case nNewfn: fmtprint(f, "fn %X {%X}", n->u[0].p, n->u[1].p); break;
+ case nIf: fmtprint(f, "if(%X)%X", n->u[0].p, n->u[1].p); break;
+ case nOrelse: fmtprint(f, "%X||%X", n->u[0].p, n->u[1].p); break;
+ case nArgs: fmtprint(f, "nArgs: ");
+ Xconv(n->u[0].p, 4);
+ Xconv(n->u[1].p, 4); break;
+ case nSwitch: fmtprint(f, "switch(%X){%X}", n->u[0].p, n->u[1].p); break;
+ case nMatch: fmtprint(f, "~ %X %X", n->u[0].p, n->u[1].p); break;
+ case nWhile: fmtprint(f, "while(%X)%X", n->u[0].p, n->u[1].p); break;
+ case nForin: fmtprint(f, "for(%X in %X)%X", n->u[0].p, n->u[1].p, n->u[2].p); break;
+ case nVarsub: fmtprint(f, "$%X(%X)", n->u[0].p, n->u[1].p); break;
+ case nWord:
+ fmtprint(f, n->u[2].i && quotep(n->u[0].s, dollar) ?
+ "%#S" : "%S", n->u[0].s);
+ break;
+ case nLappend: {
+ static bool inlist;
+ if (!inlist) {
+ inlist = TRUE;
+ fmtprint(f, "(%X %X)", n->u[0].p, n->u[1].p);
+ inlist = FALSE;
+ } else {
+ fmtprint(f, "%X %X", n->u[0].p, n->u[1].p);
+ }
+ break;
+ }
+ case nCount: case nFlat: case nVar: {
+ char *lp = "", *rp = "";
+ Node *n0 = n->u[0].p;
+
+ if (n0->type != nWord)
+ lp = "(", rp = ")";
+
+ switch (n->type) {
+ default: panic("this can't happen"); break;
+ case nCount: fmtprint(f, "$#%s%#T%s", lp, n0, rp); break;
+ case nFlat: fmtprint(f, "$^%s%#T%s", lp, n0, rp); break;
+ case nVar: fmtprint(f, "$%s%#T%s", lp, n0, rp); break;
+ }
+ break;
+ }
+ case nDup:
+ if (n->u[2].i != -1)
+ fmtprint(f, "%D[%d=%d]", n->u[0].i, n->u[1].i, n->u[2].i);
+ else
+ fmtprint(f, "%D[%d=]", n->u[0].i, n->u[1].i);
+ break;
+ case nBackq: {
+ Node *n0 = n->u[0].p, *n00;
+ if (n0 != NULL && n0->type == nVar
+ && (n00 = n0->u[0].p) != NULL && n00->type == nWord && streq(n00->u[0].s, "ifs"))
+ fmtprint(f, "`");
+ else
+ fmtprint(f, "``%X", n0);
+ fmtprint(f, "{%X}", n->u[1].p);
+ break;
+ }
+ case nCbody:
+ case nBody: {
+ Node *n0 = n->u[0].p;
+ if (n0 != NULL)
+ fmtprint(f, "%X", n->u[0].p);
+ if (n->u[1].p != NULL) {
+ if (n0 != NULL && n0->type != nNowait)
+ fmtprint(f, ";");
+ fmtprint(f, "%X", n->u[1].p);
+ }
+ break;
+ }
+ case nBrace:
+ fmtprint(f, "{%X}", n->u[0].p);
+ if (n->u[1].p != NULL)
+ fmtprint(f, "%X", n->u[1].p);
+ break;
+ case nEpilog:
+ case nPre:
+ fmtprint(f, "%X", n->u[0].p);
+ if (n->u[1].p != NULL)
+ fmtprint(f, " %X", n->u[1].p);
+ break;
+ case nPipe: {
+ int ofd = n->u[0].i, ifd = n->u[1].i;
+ fmtprint(f, "%X|", n->u[2].p);
+ if (ifd != 0)
+ fmtprint(f, "[%d=%d]", ofd, ifd);
+ else if (ofd != 1)
+ fmtprint(f, "[%d]", ofd);
+ fmtprint(f, "%X", n->u[3].p);
+ break;
+ }
+ case nRedir: {
+ int op = n->u[0].i;
+ fmtprint(f, "%D", op);
+ fmtprint(f, "[%d]", n->u[1].i);
+ fmtprint(f, "%X", n->u[2].p);
+ break;
+ }
+ case nNmpipe: {
+ int op = n->u[0].i;
+ fmtprint(f, "%D", op);
+ fmtprint(f, "[%d]", n->u[1].i);
+ fmtprint(f, "{%X}", n->u[2].p);
+ break;
+ }
+ }
+ return FALSE;
+}
+#endif
diff --git a/develop.h b/develop.h
new file mode 100644
index 0000000..19dbea9
--- /dev/null
+++ b/develop.h
@@ -0,0 +1,4 @@
+void tree_dump(Node *);
+#ifndef RC_DEVELOP
+#define RC_DEVELOP 0
+#endif
diff --git a/edit-edit.c b/edit-edit.c
index c2a5260..7b2a9ab 100644
--- a/edit-edit.c
+++ b/edit-edit.c
@@ -37,7 +37,11 @@ void *edit_begin(int fd) {
}
+static void (*oldint)(int), (*oldquit)(int);
+
static void edit_catcher(int sig) {
+ sys_signal(SIGINT, oldint);
+ sys_signal(SIGQUIT, oldquit);
write(2, "\n", 1);
rc_raise(eError);
}
@@ -46,7 +50,6 @@ char *edit_alloc(void *cookie, size_t *count) {
const char *r;
HistEvent he;
struct cookie *c = cookie;
- void (*oldint)(int), (*oldquit)(int);
oldint = sys_signal(SIGINT, edit_catcher);
oldquit = sys_signal(SIGQUIT, edit_catcher);
diff --git a/edit-editline.c b/edit-editline.c
index 85e3f40..2069aef 100644
--- a/edit-editline.c
+++ b/edit-editline.c
@@ -29,7 +29,11 @@ void *edit_begin(int fd) {
}
/*
+static void (*oldint)(int), (*oldquit)(int);
+
static void edit_catcher(int sig) {
+ sys_signal(SIGINT, oldint);
+ sys_signal(SIGQUIT, oldquit);
write(2, "\n", 1);
rc_raise(eError);
}
@@ -42,7 +46,6 @@ char *edit_alloc(void *cookie, size_t *count) {
const char *r;
HistEvent he;
struct cookie *c = cookie;
- void (*oldint)(int), (*oldquit)(int);
oldint = sys_signal(SIGINT, edit_catcher);
oldquit = sys_signal(SIGQUIT, edit_catcher);
diff --git a/edit-gnu.c b/edit-gnu.c
deleted file mode 100644
index 6a997c5..0000000
--- a/edit-gnu.c
+++ /dev/null
@@ -1,87 +0,0 @@
-#include "rc.h"
-
-#include <errno.h>
-#include <stdio.h>
-#include <readline/readline.h>
-#include <readline/history.h>
-#include <readline/rltypedefs.h>
-
-#include "edit.h"
-
-bool editing = 1;
-
-struct cookie {
- char *buffer;
-};
-
-void *edit_begin(int fd) {
- List *hist;
- struct cookie *c;
-
- rl_catch_signals = 0;
- rl_completer_quote_characters = "'";
- rl_filename_quote_characters = "\t\n !#$&'()*;<=>?@[\\]^`{|}~";
-
- hist = varlookup("history");
- if (hist != NULL)
- if (read_history(hist->w) != 0 && errno != ENOENT) /* ignore if missing */
- uerror(hist->w);
-
- c = ealloc(sizeof *c);
- c->buffer = NULL;
- return c;
-}
-
-static void edit_catcher(int sig) {
- write(2, "\n", 1);
- rc_raise(eError);
-}
-
-static char *prompt;
-
-char *edit_alloc(void *cookie, size_t *count) {
- struct cookie *c = cookie;
- void (*oldint)(int), (*oldquit)(int);
-
- oldint = sys_signal(SIGINT, edit_catcher);
- oldquit = sys_signal(SIGQUIT, edit_catcher);
-
- c->buffer = readline(prompt);
-
- sys_signal(SIGINT, oldint);
- sys_signal(SIGQUIT, oldquit);
-
- if (c->buffer) {
- *count = strlen(c->buffer);
- if (*count)
- add_history(c->buffer);
- c->buffer[*count] = '\n';
- ++*count; /* include the \n */
- }
- return c->buffer;
-}
-
-void edit_prompt(void *cookie, char *pr) {
- prompt = pr;
-}
-
-void edit_free(void *cookie) {
- struct cookie *c = cookie;
-
- efree(c->buffer);
- /* Set c->buffer to NULL, allowing us to "overfree" it. This
- is a bit of a kludge, but it's otherwise hard to deal with
- the case where a signal causes an early return from
- readline. */
- c->buffer = NULL;
-}
-
-void edit_end(void *cookie) {
- struct cookie *c = cookie;
-
- efree(c);
-}
-
-void edit_reset(void *cookie) {
- rl_reset_terminal(NULL);
-}
diff --git a/edit-readline.c b/edit-readline.c
index 6a997c5..acf96aa 100644
--- a/edit-readline.c
+++ b/edit-readline.c
@@ -18,6 +18,7 @@ void *edit_begin(int fd) {
List *hist;
struct cookie *c;
+ rl_initialize();
rl_catch_signals = 0;
rl_completer_quote_characters = "'";
rl_filename_quote_characters = "\t\n !#$&'()*;<=>?@[\\]^`{|}~";
@@ -32,7 +33,11 @@ void *edit_begin(int fd) {
return c;
}
+static void (*oldint)(int), (*oldquit)(int);
+
static void edit_catcher(int sig) {
+ sys_signal(SIGINT, oldint);
+ sys_signal(SIGQUIT, oldquit);
write(2, "\n", 1);
rc_raise(eError);
}
@@ -41,11 +46,11 @@ static char *prompt;
char *edit_alloc(void *cookie, size_t *count) {
struct cookie *c = cookie;
- void (*oldint)(int), (*oldquit)(int);
oldint = sys_signal(SIGINT, edit_catcher);
oldquit = sys_signal(SIGQUIT, edit_catcher);
+ rl_reset_screen_size();
c->buffer = readline(prompt);
sys_signal(SIGINT, oldint);
diff --git a/edit-vrl.c b/edit-vrl.c
index 5c8ab5a..03c7e9e 100644
--- a/edit-vrl.c
+++ b/edit-vrl.c
@@ -32,7 +32,11 @@ void *edit_begin(int fd) {
}
/*
+static void (*oldint)(int), (*oldquit)(int);
+
static void edit_catcher(int sig) {
+ sys_signal(SIGINT, oldint);
+ sys_signal(SIGQUIT, oldquit);
write(2, "\n", 1);
rc_raise(eError);
}
@@ -45,7 +49,6 @@ char *edit_alloc(void *cookie, size_t *count) {
const char *r;
HistEvent he;
struct cookie *c = cookie;
- void (*oldint)(int), (*oldquit)(int);
oldint = sys_signal(SIGINT, edit_catcher);
oldquit = sys_signal(SIGQUIT, edit_catcher);
diff --git a/exec.c b/exec.c
index c9244c2..6e90263 100644
--- a/exec.c
+++ b/exec.c
@@ -30,7 +30,7 @@ extern void exec(List *s, bool parent) {
b = isbuiltin(*av);
/*
- a builtin applies only to the immmediately following
+ a builtin applies only to the immediately following
command, e.g., builtin exec echo hi
*/
saw_builtin = FALSE;
diff --git a/hash.c b/hash.c
index 5fafed2..6a176a4 100644
--- a/hash.c
+++ b/hash.c
@@ -195,6 +195,7 @@ extern void delete_var(char *s, bool stack) {
}
} else { /* needs to be removed from the hash table */
efree(v);
+ vp[h].p = NULL;
efree(vp[h].name);
if (vp[(h+1)&(vsize-1)].name == NULL) {
--vused;
diff --git a/history.c b/history.c
index 1f22f2e..42e1ba2 100644
--- a/history.c
+++ b/history.c
@@ -20,7 +20,7 @@
#include <stdio.h>
-static const char id[] = "$Release: @(#)" PACKAGE " " VERSION " " RELDATE " $";
+static const char id[] = "$Release: @(#)" PACKAGE " " VERSION " " DESCRIPTION " $";
#define CHUNKSIZE 65536
diff --git a/input.c b/input.c
index 5737375..7773ace 100644
--- a/input.c
+++ b/input.c
@@ -4,6 +4,7 @@
#include <errno.h>
+#include "develop.h"
#include "edit.h"
#include "input.h"
#include "jbwrap.h"
@@ -306,6 +307,8 @@ extern Node *doit(bool clobberexecit) {
rc_raise(eError);
eof = (lastchar == EOF); /* "lastchar" can be clobbered during a walk() */
if (parsetree != NULL) {
+ if (RC_DEVELOP)
+ tree_dump(parsetree);
if (execit)
walk(parsetree, TRUE);
else if (dashex && dashen)
diff --git a/lex.c b/lex.c
index 92732f8..195e8f6 100644
--- a/lex.c
+++ b/lex.c
@@ -178,9 +178,9 @@ top: while ((c = gchar()) == ' ' || c == '\t')
y->word.q = FALSE;
return WORD;
}
- if (c == '`' || c == '!' || c == '@' || c == '~' || c == '$' || c == '\'') {
+ if (c == '`' || c == '!' || c == '@' || c == '~' || c == '$' || c == '\'' || c == '=') {
checkfreecaret;
- if (c == '!' || c == '@' || c == '~')
+ if (c == '!' || c == '@' || c == '~' || c == '=')
w = KW;
}
switch (c) {
@@ -255,9 +255,9 @@ top: while ((c = gchar()) == ' ' || c == '\t')
case ';':
case '^':
case ')':
- case '=':
case '{': case '}':
w = NW;
+ case '=':
return c;
case '&':
w = NW;
diff --git a/main.c b/main.c
index 4da3014..9743a2c 100644
--- a/main.c
+++ b/main.c
@@ -84,7 +84,10 @@ quitopts:
#endif
assigndefault("pid", nprint("%d", rc_pid), (void *)0);
assigndefault("prompt", "; ", "", (void *)0);
- assigndefault("version", VERSION, "$Release: @(#)" PACKAGE " " VERSION " " RELDATE " $", (void *)0);
+ assigndefault("version",
+ VERSION,
+ "$Release: @(#)" PACKAGE " " VERSION " " DESCRIPTION " $",
+ (void *)0 );
initenv(envp);
initinput();
null[0] = NULL;
diff --git a/open.c b/open.c
index 60555b0..0772df0 100644
--- a/open.c
+++ b/open.c
@@ -25,7 +25,7 @@ extern int rc_open(const char *name, redirtype m) {
}
/* make a file descriptor blocking. return value indicates whether
-the desciptor was previously set to non-blocking. */
+the descriptor was previously set to non-blocking. */
extern bool makeblocking(int fd) {
int flags;
diff --git a/parse.c b/parse.c
deleted file mode 100644
index 1275ab5..0000000
--- a/parse.c
+++ /dev/null
@@ -1,1117 +0,0 @@
-#ifndef lint
-static char const
-yyrcsid[] = "$FreeBSD: src/usr.bin/yacc/skeleton.c,v 1.28 2000/01/17 02:04:06 bde Exp $";
-#endif
-#include "rc.h"
-#include <stdlib.h>
-#define YYBYACC 1
-#define YYMAJOR 1
-#define YYMINOR 9
-#define YYLEX yylex()
-#define YYEMPTY -1
-#define yyclearin (yychar=(YYEMPTY))
-#define yyerrok (yyerrflag=0)
-#define YYRECOVERING() (yyerrflag!=0)
-static int yygrowstack();
-#define YYPREFIX "yy"
-#line 8 "parse.y"
-
-static Node *star, *nolist;
-Node *parsetree; /* not using yylval because bison declares it as an auto */
-#line 26 "parse.y"
-typedef union {
- struct Node *node;
- struct Redir redir;
- struct Pipe pipe;
- struct Dup dup;
- struct Word word;
- char *keyword;
-} YYSTYPE;
-#line 31 "y.tab.c"
-#define YYERRCODE 256
-#define ANDAND 257
-#define BACKBACK 258
-#define BANG 259
-#define CASE 260
-#define COUNT 261
-#define DUP 262
-#define ELSE 263
-#define END 264
-#define FLAT 265
-#define FN 266
-#define FOR 267
-#define IF 268
-#define IN 269
-#define OROR 270
-#define PIPE 271
-#define REDIR 272
-#define SREDIR 273
-#define SUB 274
-#define SUBSHELL 275
-#define SWITCH 276
-#define TWIDDLE 277
-#define WHILE 278
-#define WORD 279
-#define HUH 280
-const short yylhs[] = { -1,
- 0, 0, 22, 22, 8, 8, 13, 13, 3, 3,
- 9, 9, 4, 15, 2, 11, 11, 16, 16, 16,
- 5, 5, 6, 6, 6, 19, 19, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 24, 24, 18, 18, 18,
- 12, 12, 17, 17, 20, 20, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 21, 21,
- 14, 14, 14, 23, 23,
-};
-const short yylen[] = { 2,
- 2, 2, 1, 1, 2, 2, 1, 2, 1, 2,
- 1, 2, 3, 3, 3, 0, 2, 1, 2, 2,
- 3, 3, 1, 2, 2, 1, 4, 0, 1, 2,
- 4, 8, 6, 4, 8, 4, 4, 4, 4, 2,
- 2, 3, 3, 3, 2, 0, 1, 1, 2, 2,
- 1, 3, 1, 1, 1, 3, 2, 5, 2, 2,
- 2, 2, 3, 3, 3, 2, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 0, 2,
- 0, 2, 2, 0, 2,
-};
-const short yydefred[] = { 0,
- 0, 0, 0, 0, 18, 0, 79, 0, 0, 0,
- 0, 0, 0, 0, 0, 67, 0, 0, 81, 0,
- 0, 0, 0, 0, 0, 51, 0, 0, 0, 0,
- 3, 4, 2, 77, 75, 74, 73, 68, 71, 69,
- 0, 78, 72, 76, 70, 54, 53, 55, 0, 47,
- 0, 59, 60, 0, 0, 0, 84, 66, 0, 0,
- 0, 0, 0, 84, 0, 0, 0, 11, 0, 0,
- 62, 61, 0, 0, 30, 0, 84, 84, 84, 5,
- 6, 8, 0, 0, 1, 0, 50, 0, 0, 63,
- 64, 0, 44, 0, 0, 0, 0, 0, 0, 0,
- 0, 79, 13, 12, 10, 65, 82, 0, 17, 0,
- 0, 0, 0, 52, 56, 79, 84, 14, 85, 0,
- 0, 31, 84, 0, 0, 0, 0, 0, 39, 0,
- 0, 84, 0, 58, 84, 0, 0, 0, 0, 0,
- 79, 0, 0, 0, 0, 0, 0, 24, 35, 25,
- 22, 21,
-};
-const short yydgoto[] = { 21,
- 46, 22, 66, 23, 142, 143, 67, 68, 69, 47,
- 75, 27, 28, 70, 57, 29, 48, 30, 122, 94,
- 54, 33, 97, 51,
-};
-const short yysindex[] = { 874,
- 24, 1001, -82, 1001, 0, 1001, 0, -27, -26, 900,
- 1001, -82, -20, -82, -26, 0, 1001, 1134, 0, 900,
- 0, 1134, -203, -30, 1134, 0, -55, 24, 1134, 826,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- -66, 0, 0, 0, 0, 0, 0, 0, 849, 0,
- 1134, 0, 0, 900, 1001, 1134, 0, 0, -52, -52,
- 1134, 1001, 1001, 0, -212, -58, 154, 0, 1134, 426,
- 0, 0, -196, 1001, 0, -203, 0, 0, 0, 0,
- 0, 0, 1001, 1001, 0, -196, 0, -52, 1001, 0,
- 0, -196, 0, -52, -38, 36, 502, -196, -36, -52,
- 502, 0, 0, 0, 0, 0, 0, -52, 0, 502,
- 502, 502, -52, 0, 0, 0, 0, 0, 0, -97,
- -234, 0, 0, 1001, -234, 922, -196, -196, 0, 944,
- 502, 0, -9, 0, 0, -234, 502, 967, 502, -234,
- 0, 967, -45, 154, 967, -234, 448, 0, 0, 0,
- 0, 0,
-};
-const short yyrindex[] = { 134,
- 0, 0, 356, 0, 0, 0, 0, 0, 0, 0,
- 0, 356, 0, 1024, 0, 0, 0, 571, 0, 0,
- 0, 487, 529, 54, 134, 0, 62, 0, 487, 548,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 487, 0, 0, 712, 0, 142, 0, 0, 14, 38,
- 487, 0, 0, 0, -10, 0, -32, 0, 744, 0,
- 0, 0, 749, 0, 0, 529, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 763, 0, 86, 0, 0,
- 0, 779, 0, 110, 0, 0, -34, 788, 0, 380,
- -34, 0, 0, 0, 0, 0, 0, 470, 0, -34,
- -34, -34, 404, 0, 0, 0, 0, 0, 0, 529,
- 6, 0, 0, 724, 30, 0, 805, 813, 0, 0,
- -34, 0, 0, 0, 0, 119, -34, 571, -34, 187,
- 0, 571, 0, -44, 571, 396, 0, 0, 0, 0,
- 0, 0,
-};
-const short yygindex[] = { 0,
- 0, 0, -23, 12, 0, -104, 1319, 2, -127, 1307,
- 7, 0, 57, 0, 70, -13, 84, 0, 0, 420,
- -81, 59, 369, 31,
-};
-#define YYTABLESIZE 1464
-const short yytable[] = { 57,
- 119, 25, 117, 28, 123, 83, 28, 81, 9, 76,
- 145, 50, 55, 56, 145, 26, 87, 145, 124, 62,
- 126, 58, 77, 19, 28, 57, 25, 57, 80, 57,
- 57, 71, 96, 32, 130, 78, 79, 148, 84, 34,
- 150, 89, 61, 26, 63, 105, 26, 20, 57, 19,
- 57, 19, 58, 19, 19, 89, 18, 89, 5, 147,
- 90, 102, 76, 7, 26, 93, 103, 34, 74, 11,
- 34, 48, 19, 20, 79, 20, 118, 20, 20, 149,
- 23, 82, 109, 57, 64, 57, 85, 52, 34, 53,
- 28, 0, 9, 0, 0, 49, 20, 48, 0, 48,
- 65, 48, 48, 72, 0, 0, 76, 0, 120, 19,
- 0, 0, 57, 138, 57, 0, 0, 0, 0, 80,
- 48, 49, 0, 49, 0, 49, 49, 0, 33, 0,
- 26, 0, 91, 20, 0, 0, 19, 0, 19, 0,
- 0, 0, 0, 28, 49, 80, 0, 80, 0, 80,
- 80, 28, 0, 0, 34, 0, 33, 48, 0, 33,
- 20, 0, 20, 104, 5, 132, 0, 114, 80, 0,
- 0, 28, 115, 0, 74, 11, 0, 33, 0, 28,
- 0, 49, 28, 0, 0, 0, 48, 0, 0, 0,
- 0, 81, 28, 0, 0, 0, 27, 0, 0, 0,
- 28, 0, 0, 0, 0, 80, 0, 0, 0, 0,
- 49, 0, 80, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 28, 0, 27, 0, 77, 27, 0, 28,
- 116, 0, 80, 0, 80, 28, 28, 0, 0, 78,
- 79, 0, 0, 33, 0, 27, 57, 57, 57, 57,
- 57, 57, 57, 57, 57, 57, 57, 57, 57, 57,
- 57, 57, 57, 0, 57, 57, 57, 57, 57, 26,
- 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 31, 19, 19,
- 19, 19, 19, 34, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 27, 20, 20, 20, 20, 20, 7, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 0, 48, 48, 48, 48,
- 48, 0, 49, 49, 49, 49, 49, 49, 49, 49,
- 49, 49, 49, 49, 49, 49, 49, 49, 49, 0,
- 49, 49, 49, 49, 49, 46, 80, 80, 80, 80,
- 80, 0, 80, 80, 80, 80, 80, 80, 80, 80,
- 80, 80, 33, 0, 80, 80, 80, 80, 80, 79,
- 28, 46, 0, 46, 0, 46, 46, 28, 28, 0,
- 0, 0, 0, 28, 28, 32, 0, 0, 0, 0,
- 77, 28, 28, 15, 46, 79, 0, 79, 0, 79,
- 79, 49, 0, 78, 79, 0, 0, 0, 0, 59,
- 60, 0, 101, 32, 0, 107, 32, 0, 79, 15,
- 0, 15, 0, 15, 15, 110, 111, 112, 0, 88,
- 27, 46, 0, 0, 32, 0, 0, 151, 0, 0,
- 0, 17, 15, 0, 0, 19, 106, 0, 0, 0,
- 0, 0, 0, 0, 95, 79, 0, 0, 46, 83,
- 46, 99, 100, 17, 0, 131, 0, 19, 0, 108,
- 0, 133, 0, 59, 0, 0, 28, 0, 0, 15,
- 137, 0, 113, 139, 79, 83, 152, 0, 0, 83,
- 83, 119, 0, 0, 0, 0, 0, 0, 0, 0,
- 32, 20, 0, 0, 28, 0, 15, 28, 15, 0,
- 0, 0, 0, 0, 0, 0, 0, 17, 16, 0,
- 0, 19, 0, 20, 0, 28, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 29, 0, 0,
- 0, 0, 0, 0, 0, 83, 16, 0, 0, 16,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 28, 0, 0, 0, 0, 29, 0, 16, 29, 0,
- 0, 0, 0, 0, 0, 0, 0, 20, 0, 0,
- 0, 0, 0, 0, 0, 0, 29, 0, 28, 0,
- 0, 28, 46, 46, 46, 0, 46, 46, 0, 46,
- 46, 46, 46, 46, 18, 46, 46, 46, 46, 28,
- 46, 46, 46, 46, 46, 0, 79, 79, 79, 79,
- 79, 0, 79, 79, 79, 79, 79, 79, 79, 79,
- 79, 79, 0, 16, 79, 79, 79, 79, 79, 32,
- 15, 15, 15, 0, 15, 15, 0, 15, 15, 15,
- 15, 15, 29, 15, 15, 15, 15, 0, 15, 15,
- 15, 15, 15, 2, 34, 35, 4, 0, 36, 0,
- 6, 37, 38, 39, 40, 28, 0, 41, 0, 0,
- 42, 43, 44, 45, 16, 2, 34, 35, 4, 0,
- 36, 0, 6, 37, 38, 39, 40, 0, 0, 41,
- 0, 45, 42, 43, 44, 45, 16, 83, 83, 83,
- 83, 0, 83, 36, 83, 83, 83, 83, 83, 0,
- 0, 83, 0, 28, 83, 83, 83, 83, 83, 45,
- 28, 0, 45, 28, 0, 0, 28, 28, 41, 2,
- 3, 36, 4, 5, 36, 0, 6, 7, 8, 9,
- 45, 0, 40, 10, 11, 0, 12, 13, 14, 15,
- 16, 28, 36, 0, 28, 16, 41, 0, 42, 41,
- 0, 0, 16, 0, 0, 0, 0, 43, 16, 16,
- 40, 0, 28, 40, 29, 0, 0, 41, 0, 0,
- 0, 29, 0, 0, 37, 0, 42, 29, 29, 42,
- 0, 40, 38, 0, 0, 43, 0, 28, 43, 0,
- 0, 0, 0, 0, 0, 0, 45, 42, 0, 0,
- 28, 28, 37, 0, 0, 37, 43, 0, 36, 0,
- 38, 0, 0, 38, 0, 0, 0, 0, 0, 0,
- 0, 17, 0, 37, 0, 19, 0, 0, 28, 0,
- 0, 38, 0, 41, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 17, 0, 0, 40, 19, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 42, 0, 0, 0, 0, 0, 17,
- 0, 0, 43, 19, 0, 0, 0, 0, 0, 0,
- 0, 20, 0, 0, 0, 0, 0, 0, 0, 37,
- 0, 0, 0, 0, 0, 17, 0, 38, 0, 19,
- 0, 0, 89, 0, 20, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 17, 0, 0,
- 0, 19, 134, 0, 0, 0, 0, 0, 45, 20,
- 0, 18, 0, 0, 0, 45, 0, 0, 0, 17,
- 36, 45, 45, 19, 135, 0, 0, 36, 0, 0,
- 0, 0, 0, 36, 36, 20, 18, 0, 0, 0,
- 28, 0, 17, 0, 0, 41, 19, 0, 0, 0,
- 0, 0, 41, 28, 28, 0, 0, 20, 41, 40,
- 0, 0, 18, 0, 0, 0, 40, 0, 0, 0,
- 0, 0, 40, 0, 0, 42, 17, 0, 0, 20,
- 19, 0, 42, 0, 43, 0, 0, 0, 42, 0,
- 0, 43, 0, 0, 0, 0, 0, 43, 0, 46,
- 0, 37, 20, 46, 0, 0, 0, 0, 37, 38,
- 0, 0, 0, 0, 37, 0, 38, 0, 0, 0,
- 0, 0, 38, 2, 34, 35, 4, 5, 36, 18,
- 6, 37, 38, 39, 40, 0, 20, 10, 11, 0,
- 42, 43, 44, 45, 16, 0, 2, 34, 35, 4,
- 0, 36, 0, 6, 37, 38, 39, 40, 0, 46,
- 41, 0, 0, 42, 43, 44, 45, 16, 0, 1,
- 0, 2, 3, 0, 4, 5, 0, 0, 6, 7,
- 8, 9, 0, 0, 0, 10, 11, 0, 12, 13,
- 14, 15, 16, 0, 0, 0, 0, 2, 34, 35,
- 4, 0, 36, 0, 6, 37, 38, 39, 40, 17,
- 0, 41, 0, 19, 42, 43, 44, 45, 16, 2,
- 34, 35, 4, 0, 36, 0, 6, 37, 38, 39,
- 40, 0, 0, 41, 0, 0, 42, 43, 44, 45,
- 16, 2, 34, 35, 4, 0, 36, 0, 6, 37,
- 38, 39, 40, 0, 0, 41, 0, 0, 42, 43,
- 44, 45, 16, 0, 2, 3, 141, 4, 5, 20,
- 0, 6, 7, 8, 9, 0, 0, 0, 10, 11,
- 0, 12, 13, 14, 15, 16, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 18, 0, 2, 34,
- 35, 4, 0, 36, 0, 6, 37, 38, 39, 40,
- 0, 0, 41, 0, 0, 42, 43, 44, 45, 16,
- 0, 46, 46, 46, 46, 0, 46, 0, 46, 46,
- 46, 46, 46, 0, 0, 46, 0, 0, 46, 46,
- 46, 46, 46, 0, 0, 0, 26, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 24, 0,
- 0, 0, 0, 0, 26, 0, 0, 0, 26, 0,
- 0, 26, 0, 0, 0, 26, 0, 0, 0, 0,
- 73, 0, 0, 24, 0, 0, 0, 86, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 26, 0, 0,
- 0, 0, 26, 0, 0, 0, 0, 26, 0, 92,
- 0, 0, 0, 0, 0, 26, 0, 0, 0, 98,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 2, 3, 0, 4, 5, 0, 0, 6, 7,
- 8, 9, 0, 26, 0, 10, 11, 26, 12, 13,
- 14, 15, 16, 0, 0, 121, 26, 26, 26, 125,
- 0, 0, 0, 0, 0, 0, 0, 0, 127, 128,
- 129, 0, 0, 0, 0, 0, 0, 26, 0, 0,
- 0, 0, 0, 26, 26, 26, 0, 0, 26, 136,
- 0, 26, 0, 0, 0, 140, 144, 146, 0, 0,
- 144, 0, 0, 144,
-};
-const short yycheck[] = { 10,
- 10, 0, 41, 38, 41, 61, 41, 38, 41, 23,
- 138, 94, 40, 40, 142, 10, 30, 145, 100, 40,
- 102, 10, 257, 10, 59, 36, 25, 38, 59, 40,
- 41, 20, 56, 10, 116, 270, 271, 142, 94, 10,
- 145, 94, 12, 38, 14, 69, 41, 10, 59, 36,
- 61, 38, 41, 40, 41, 94, 123, 94, 262, 141,
- 49, 274, 76, 10, 59, 54, 125, 38, 272, 273,
- 41, 10, 59, 36, 271, 38, 41, 40, 41, 125,
- 125, 25, 76, 94, 15, 96, 28, 4, 59, 6,
- 125, -1, 125, -1, -1, 10, 59, 36, -1, 38,
- 17, 40, 41, 20, -1, -1, 120, -1, 97, 96,
- -1, -1, 123, 123, 125, -1, -1, -1, -1, 10,
- 59, 36, -1, 38, -1, 40, 41, -1, 10, -1,
- 125, -1, 49, 96, -1, -1, 123, -1, 125, -1,
- -1, -1, -1, 10, 59, 36, -1, 38, -1, 40,
- 41, 10, -1, -1, 125, -1, 38, 96, -1, 41,
- 123, -1, 125, 10, 262, 263, -1, 84, 59, -1,
- -1, 38, 89, -1, 272, 273, -1, 59, -1, 38,
- -1, 96, 41, -1, -1, -1, 125, -1, -1, -1,
- -1, 38, 59, -1, -1, -1, 10, -1, -1, -1,
- 59, -1, -1, -1, -1, 96, -1, -1, -1, -1,
- 125, -1, 59, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 257, -1, 38, -1, 257, 41, -1, 264,
- 269, -1, 123, -1, 125, 270, 271, -1, -1, 270,
- 271, -1, -1, 125, -1, 59, 257, 258, 259, 260,
- 261, 262, 263, 264, 265, 266, 267, 268, 269, 270,
- 271, 272, 273, -1, 275, 276, 277, 278, 279, 264,
- 257, 258, 259, 260, 261, 262, 263, 264, 265, 266,
- 267, 268, 269, 270, 271, 272, 273, 264, 275, 276,
- 277, 278, 279, 264, 257, 258, 259, 260, 261, 262,
- 263, 264, 265, 266, 267, 268, 269, 270, 271, 272,
- 273, 125, 275, 276, 277, 278, 279, 264, 257, 258,
- 259, 260, 261, 262, 263, 264, 265, 266, 267, 268,
- 269, 270, 271, 272, 273, -1, 275, 276, 277, 278,
- 279, -1, 257, 258, 259, 260, 261, 262, 263, 264,
- 265, 266, 267, 268, 269, 270, 271, 272, 273, -1,
- 275, 276, 277, 278, 279, 10, 257, 258, 259, 260,
- 261, -1, 263, 264, 265, 266, 267, 268, 269, 270,
- 271, 272, 264, -1, 275, 276, 277, 278, 279, 10,
- 257, 36, -1, 38, -1, 40, 41, 264, 257, -1,
- -1, -1, -1, 270, 271, 10, -1, -1, -1, -1,
- 257, 270, 271, 10, 59, 36, -1, 38, -1, 40,
- 41, 2, -1, 270, 271, -1, -1, -1, -1, 10,
- 11, -1, 64, 38, -1, 10, 41, -1, 59, 36,
- -1, 38, -1, 40, 41, 77, 78, 79, -1, 30,
- 264, 96, -1, -1, 59, -1, -1, 10, -1, -1,
- -1, 36, 59, -1, -1, 40, 41, -1, -1, -1,
- -1, -1, -1, -1, 55, 96, -1, -1, 123, 10,
- 125, 62, 63, 36, -1, 117, -1, 40, -1, 70,
- -1, 123, -1, 74, -1, -1, 10, -1, -1, 96,
- 132, -1, 83, 135, 125, 36, 59, -1, -1, 40,
- 41, 10, -1, -1, -1, -1, -1, -1, -1, -1,
- 125, 96, -1, -1, 38, -1, 123, 41, 125, -1,
- -1, -1, -1, -1, -1, -1, -1, 36, 10, -1,
- -1, 40, -1, 96, -1, 59, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 10, -1, -1,
- -1, -1, -1, -1, -1, 96, 38, -1, -1, 41,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 10, -1, -1, -1, -1, 38, -1, 59, 41, -1,
- -1, -1, -1, -1, -1, -1, -1, 96, -1, -1,
- -1, -1, -1, -1, -1, -1, 59, -1, 38, -1,
- -1, 125, 257, 258, 259, -1, 261, 262, -1, 264,
- 265, 266, 267, 268, 123, 270, 271, 272, 273, 59,
- 275, 276, 277, 278, 279, -1, 257, 258, 259, 260,
- 261, -1, 263, 264, 265, 266, 267, 268, 269, 270,
- 271, 272, -1, 125, 275, 276, 277, 278, 279, 264,
- 257, 258, 259, -1, 261, 262, -1, 264, 265, 266,
- 267, 268, 125, 270, 271, 272, 273, -1, 275, 276,
- 277, 278, 279, 258, 259, 260, 261, -1, 263, -1,
- 265, 266, 267, 268, 269, 125, -1, 272, -1, -1,
- 275, 276, 277, 278, 279, 258, 259, 260, 261, -1,
- 263, -1, 265, 266, 267, 268, 269, -1, -1, 272,
- -1, 10, 275, 276, 277, 278, 279, 258, 259, 260,
- 261, -1, 263, 10, 265, 266, 267, 268, 269, -1,
- -1, 272, -1, 257, 275, 276, 277, 278, 279, 38,
- 264, -1, 41, 10, -1, -1, 270, 271, 10, 258,
- 259, 38, 261, 262, 41, -1, 265, 266, 267, 268,
- 59, -1, 10, 272, 273, -1, 275, 276, 277, 278,
- 279, 38, 59, -1, 41, 257, 38, -1, 10, 41,
- -1, -1, 264, -1, -1, -1, -1, 10, 270, 271,
- 38, -1, 59, 41, 257, -1, -1, 59, -1, -1,
- -1, 264, -1, -1, 10, -1, 38, 270, 271, 41,
- -1, 59, 10, -1, -1, 38, -1, 257, 41, -1,
- -1, -1, -1, -1, -1, -1, 125, 59, -1, -1,
- 270, 271, 38, -1, -1, 41, 59, -1, 125, -1,
- 38, -1, -1, 41, -1, -1, -1, -1, -1, -1,
- -1, 36, -1, 59, -1, 40, -1, -1, 125, -1,
- -1, 59, -1, 125, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 36, -1, -1, 125, 40, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 125, -1, -1, -1, -1, -1, 36,
- -1, -1, 125, 40, -1, -1, -1, -1, -1, -1,
- -1, 96, -1, -1, -1, -1, -1, -1, -1, 125,
- -1, -1, -1, -1, -1, 36, -1, 125, -1, 40,
- -1, -1, 94, -1, 96, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 36, -1, -1,
- -1, 40, 41, -1, -1, -1, -1, -1, 257, 96,
- -1, 123, -1, -1, -1, 264, -1, -1, -1, 36,
- 257, 270, 271, 40, 41, -1, -1, 264, -1, -1,
- -1, -1, -1, 270, 271, 96, 123, -1, -1, -1,
- 257, -1, 36, -1, -1, 257, 40, -1, -1, -1,
- -1, -1, 264, 270, 271, -1, -1, 96, 270, 257,
- -1, -1, 123, -1, -1, -1, 264, -1, -1, -1,
- -1, -1, 270, -1, -1, 257, 36, -1, -1, 96,
- 40, -1, 264, -1, 257, -1, -1, -1, 270, -1,
- -1, 264, -1, -1, -1, -1, -1, 270, -1, 36,
- -1, 257, 96, 40, -1, -1, -1, -1, 264, 257,
- -1, -1, -1, -1, 270, -1, 264, -1, -1, -1,
- -1, -1, 270, 258, 259, 260, 261, 262, 263, 123,
- 265, 266, 267, 268, 269, -1, 96, 272, 273, -1,
- 275, 276, 277, 278, 279, -1, 258, 259, 260, 261,
- -1, 263, -1, 265, 266, 267, 268, 269, -1, 96,
- 272, -1, -1, 275, 276, 277, 278, 279, -1, 256,
- -1, 258, 259, -1, 261, 262, -1, -1, 265, 266,
- 267, 268, -1, -1, -1, 272, 273, -1, 275, 276,
- 277, 278, 279, -1, -1, -1, -1, 258, 259, 260,
- 261, -1, 263, -1, 265, 266, 267, 268, 269, 36,
- -1, 272, -1, 40, 275, 276, 277, 278, 279, 258,
- 259, 260, 261, -1, 263, -1, 265, 266, 267, 268,
- 269, -1, -1, 272, -1, -1, 275, 276, 277, 278,
- 279, 258, 259, 260, 261, -1, 263, -1, 265, 266,
- 267, 268, 269, -1, -1, 272, -1, -1, 275, 276,
- 277, 278, 279, -1, 258, 259, 260, 261, 262, 96,
- -1, 265, 266, 267, 268, -1, -1, -1, 272, 273,
- -1, 275, 276, 277, 278, 279, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 123, -1, 258, 259,
- 260, 261, -1, 263, -1, 265, 266, 267, 268, 269,
- -1, -1, 272, -1, -1, 275, 276, 277, 278, 279,
- -1, 258, 259, 260, 261, -1, 263, -1, 265, 266,
- 267, 268, 269, -1, -1, 272, -1, -1, 275, 276,
- 277, 278, 279, -1, -1, -1, 0, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 0, -1,
- -1, -1, -1, -1, 18, -1, -1, -1, 22, -1,
- -1, 25, -1, -1, -1, 29, -1, -1, -1, -1,
- 22, -1, -1, 25, -1, -1, -1, 29, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 51, -1, -1,
- -1, -1, 56, -1, -1, -1, -1, 61, -1, 51,
- -1, -1, -1, -1, -1, 69, -1, -1, -1, 61,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 258, 259, -1, 261, 262, -1, -1, 265, 266,
- 267, 268, -1, 97, -1, 272, 273, 101, 275, 276,
- 277, 278, 279, -1, -1, 97, 110, 111, 112, 101,
- -1, -1, -1, -1, -1, -1, -1, -1, 110, 111,
- 112, -1, -1, -1, -1, -1, -1, 131, -1, -1,
- -1, -1, -1, 137, 138, 139, -1, -1, 142, 131,
- -1, 145, -1, -1, -1, 137, 138, 139, -1, -1,
- 142, -1, -1, 145,
-};
-#define YYFINAL 21
-#ifndef YYDEBUG
-#define YYDEBUG 0
-#endif
-#define YYMAXTOKEN 280
-#if YYDEBUG
-const char * const yyname[] = {
-"end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,"'$'",0,"'&'",0,"'('","')'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"';'",0,
-"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'^'",0,
-"'`'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'{'",0,"'}'",0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,"ANDAND","BACKBACK","BANG","CASE","COUNT","DUP","ELSE","END",
-"FLAT","FN","FOR","IF","IN","OROR","PIPE","REDIR","SREDIR","SUB","SUBSHELL",
-"SWITCH","TWIDDLE","WHILE","WORD","HUH",
-};
-const char * const yyrule[] = {
-"$accept : rc",
-"rc : line end",
-"rc : error end",
-"end : END",
-"end : '\\n'",
-"cmdsa : cmd ';'",
-"cmdsa : cmd '&'",
-"line : cmd",
-"line : cmdsa line",
-"body : cmd",
-"body : cmdsan body",
-"cmdsan : cmdsa",
-"cmdsan : cmd '\\n'",
-"brace : '{' body '}'",
-"paren : '(' body ')'",
-"assign : first '=' word",
-"epilog :",
-"epilog : redir epilog",
-"redir : DUP",
-"redir : REDIR word",
-"redir : SREDIR word",
-"case : CASE words ';'",
-"case : CASE words '\\n'",
-"cbody : cmd",
-"cbody : case cbody",
-"cbody : cmdsan cbody",
-"iftail : cmd",
-"iftail : brace ELSE optnl cmd",
-"cmd :",
-"cmd : simple",
-"cmd : brace epilog",
-"cmd : IF paren optnl iftail",
-"cmd : FOR '(' word IN words ')' optnl cmd",
-"cmd : FOR '(' word ')' optnl cmd",
-"cmd : WHILE paren optnl cmd",
-"cmd : SWITCH '(' word ')' optnl '{' cbody '}'",
-"cmd : TWIDDLE optcaret word words",
-"cmd : cmd ANDAND optnl cmd",
-"cmd : cmd OROR optnl cmd",
-"cmd : cmd PIPE optnl cmd",
-"cmd : redir cmd",
-"cmd : assign cmd",
-"cmd : BANG optcaret cmd",
-"cmd : SUBSHELL optcaret cmd",
-"cmd : FN words brace",
-"cmd : FN words",
-"optcaret :",
-"optcaret : '^'",
-"simple : first",
-"simple : simple word",
-"simple : simple redir",
-"first : comword",
-"first : first '^' sword",
-"sword : comword",
-"sword : keyword",
-"word : sword",
-"word : word '^' sword",
-"comword : '$' sword",
-"comword : '$' sword SUB words ')'",
-"comword : COUNT sword",
-"comword : FLAT sword",
-"comword : '`' sword",
-"comword : '`' brace",
-"comword : BACKBACK word brace",
-"comword : BACKBACK word sword",
-"comword : '(' nlwords ')'",
-"comword : REDIR brace",
-"comword : WORD",
-"keyword : FOR",
-"keyword : IN",
-"keyword : WHILE",
-"keyword : IF",
-"keyword : SWITCH",
-"keyword : FN",
-"keyword : ELSE",
-"keyword : CASE",
-"keyword : TWIDDLE",
-"keyword : BANG",
-"keyword : SUBSHELL",
-"words :",
-"words : words word",
-"nlwords :",
-"nlwords : nlwords '\\n'",
-"nlwords : nlwords word",
-"optnl :",
-"optnl : optnl '\\n'",
-};
-#endif
-#if YYDEBUG
-#include <stdio.h>
-#endif
-#ifdef YYSTACKSIZE
-#undef YYMAXDEPTH
-#define YYMAXDEPTH YYSTACKSIZE
-#else
-#ifdef YYMAXDEPTH
-#define YYSTACKSIZE YYMAXDEPTH
-#else
-#define YYSTACKSIZE 10000
-#define YYMAXDEPTH 10000
-#endif
-#endif
-#define YYINITSTACKSIZE 200
-int yydebug;
-int yynerrs;
-int yyerrflag;
-int yychar;
-short *yyssp;
-YYSTYPE *yyvsp;
-YYSTYPE yyval;
-YYSTYPE yylval;
-short *yyss;
-short *yysslim;
-YYSTYPE *yyvs;
-int yystacksize;
-#line 167 "parse.y"
-
-void initparse() {
- star = treecpy(mk(nVar, mk(nWord,"*", NULL, FALSE)), ealloc);
- nolist = treecpy(mk(nVar, mk(nWord,"ifs", NULL, FALSE)), ealloc);
-}
-
-#line 583 "y.tab.c"
-/* allocate initial stack or double stack size, up to YYMAXDEPTH */
-static int yygrowstack()
-{
- int newsize, i;
- short *newss;
- YYSTYPE *newvs;
-
- if ((newsize = yystacksize) == 0)
- newsize = YYINITSTACKSIZE;
- else if (newsize >= YYMAXDEPTH)
- return -1;
- else if ((newsize *= 2) > YYMAXDEPTH)
- newsize = YYMAXDEPTH;
- i = yyssp - yyss;
- newss = yyss ? (short *)realloc(yyss, newsize * sizeof *newss) :
- (short *)malloc(newsize * sizeof *newss);
- if (newss == NULL)
- return -1;
- yyss = newss;
- yyssp = newss + i;
- newvs = yyvs ? (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs) :
- (YYSTYPE *)malloc(newsize * sizeof *newvs);
- if (newvs == NULL)
- return -1;
- yyvs = newvs;
- yyvsp = newvs + i;
- yystacksize = newsize;
- yysslim = yyss + newsize - 1;
- return 0;
-}
-
-#define YYABORT goto yyabort
-#define YYREJECT goto yyabort
-#define YYACCEPT goto yyaccept
-#define YYERROR goto yyerrlab
-
-#ifndef YYPARSE_PARAM
-#if defined(__cplusplus) || __STDC__
-#define YYPARSE_PARAM_ARG void
-#define YYPARSE_PARAM_DECL
-#else /* ! ANSI-C/C++ */
-#define YYPARSE_PARAM_ARG
-#define YYPARSE_PARAM_DECL
-#endif /* ANSI-C/C++ */
-#else /* YYPARSE_PARAM */
-#ifndef YYPARSE_PARAM_TYPE
-#define YYPARSE_PARAM_TYPE void *
-#endif
-#if defined(__cplusplus) || __STDC__
-#define YYPARSE_PARAM_ARG YYPARSE_PARAM_TYPE YYPARSE_PARAM
-#define YYPARSE_PARAM_DECL
-#else /* ! ANSI-C/C++ */
-#define YYPARSE_PARAM_ARG YYPARSE_PARAM
-#define YYPARSE_PARAM_DECL YYPARSE_PARAM_TYPE YYPARSE_PARAM;
-#endif /* ANSI-C/C++ */
-#endif /* ! YYPARSE_PARAM */
-
-int
-yyparse (YYPARSE_PARAM_ARG)
- YYPARSE_PARAM_DECL
-{
- register int yym, yyn, yystate;
-#if YYDEBUG
- register const char *yys;
-
- if ((yys = getenv("YYDEBUG")))
- {
- yyn = *yys;
- if (yyn >= '0' && yyn <= '9')
- yydebug = yyn - '0';
- }
-#endif
-
- yynerrs = 0;
- yyerrflag = 0;
- yychar = (-1);
-
- if (yyss == NULL && yygrowstack()) goto yyoverflow;
- yyssp = yyss;
- yyvsp = yyvs;
- *yyssp = yystate = 0;
-
-yyloop:
- if ((yyn = yydefred[yystate])) goto yyreduce;
- if (yychar < 0)
- {
- if ((yychar = yylex()) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = 0;
- if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
- if (!yys) yys = "illegal-symbol";
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- }
- if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, shifting to state %d\n",
- YYPREFIX, yystate, yytable[yyn]);
-#endif
- if (yyssp >= yysslim && yygrowstack())
- {
- goto yyoverflow;
- }
- *++yyssp = yystate = yytable[yyn];
- *++yyvsp = yylval;
- yychar = (-1);
- if (yyerrflag > 0) --yyerrflag;
- goto yyloop;
- }
- if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
- yyn = yytable[yyn];
- goto yyreduce;
- }
- if (yyerrflag) goto yyinrecovery;
-#if defined(lint) || defined(__GNUC__)
- goto yynewerror;
-#endif
-yynewerror:
- yyerror("syntax error");
-#if defined(lint) || defined(__GNUC__)
- goto yyerrlab;
-#endif
-yyerrlab:
- ++yynerrs;
-yyinrecovery:
- if (yyerrflag < 3)
- {
- yyerrflag = 3;
- for (;;)
- {
- if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, error recovery shifting\
- to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
-#endif
- if (yyssp >= yysslim && yygrowstack())
- {
- goto yyoverflow;
- }
- *++yyssp = yystate = yytable[yyn];
- *++yyvsp = yylval;
- goto yyloop;
- }
- else
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: error recovery discarding state %d\n",
- YYPREFIX, *yyssp);
-#endif
- if (yyssp <= yyss) goto yyabort;
- --yyssp;
- --yyvsp;
- }
- }
- }
- else
- {
- if (yychar == 0) goto yyabort;
-#if YYDEBUG
- if (yydebug)
- {
- yys = 0;
- if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
- if (!yys) yys = "illegal-symbol";
- printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- yychar = (-1);
- goto yyloop;
- }
-yyreduce:
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, reducing by rule %d (%s)\n",
- YYPREFIX, yystate, yyn, yyrule[yyn]);
-#endif
- yym = yylen[yyn];
- yyval = yyvsp[1-yym];
- switch (yyn)
- {
-case 1:
-#line 47 "parse.y"
-{ parsetree = yyvsp[-1].node; YYACCEPT; }
-break;
-case 2:
-#line 48 "parse.y"
-{ yyerrok; parsetree = NULL; YYABORT; }
-break;
-case 3:
-#line 51 "parse.y"
-{ if (!heredoc(1)) YYABORT; }
-break;
-case 4:
-#line 52 "parse.y"
-{ if (!heredoc(0)) YYABORT; }
-break;
-case 6:
-#line 56 "parse.y"
-{ yyval.node = (yyvsp[-1].node != NULL ? mk(nNowait,yyvsp[-1].node) : yyvsp[-1].node); }
-break;
-case 8:
-#line 60 "parse.y"
-{ yyval.node = (yyvsp[-1].node != NULL ? mk(nBody,yyvsp[-1].node,yyvsp[0].node) : yyvsp[0].node); }
-break;
-case 10:
-#line 64 "parse.y"
-{ yyval.node = (yyvsp[-1].node == NULL ? yyvsp[0].node : yyvsp[0].node == NULL ? yyvsp[-1].node : mk(nBody,yyvsp[-1].node,yyvsp[0].node)); }
-break;
-case 12:
-#line 67 "parse.y"
-{ yyval.node = yyvsp[-1].node; if (!heredoc(0)) YYABORT; }
-break;
-case 13:
-#line 69 "parse.y"
-{ yyval.node = yyvsp[-1].node; }
-break;
-case 14:
-#line 71 "parse.y"
-{ yyval.node = yyvsp[-1].node; }
-break;
-case 15:
-#line 73 "parse.y"
-{ yyval.node = mk(nAssign,yyvsp[-2].node,yyvsp[0].node); }
-break;
-case 16:
-#line 75 "parse.y"
-{ yyval.node = NULL; }
-break;
-case 17:
-#line 76 "parse.y"
-{ yyval.node = mk(nEpilog,yyvsp[-1].node,yyvsp[0].node); }
-break;
-case 18:
-#line 79 "parse.y"
-{ yyval.node = mk(nDup,yyvsp[0].dup.type,yyvsp[0].dup.left,yyvsp[0].dup.right); }
-break;
-case 19:
-#line 80 "parse.y"
-{ yyval.node = mk(nRedir,yyvsp[-1].redir.type,yyvsp[-1].redir.fd,yyvsp[0].node);
- if (yyvsp[-1].redir.type == rHeredoc && !qdoc(yyvsp[0].node, yyval.node)) YYABORT; /* queue heredocs up */
- }
-break;
-case 20:
-#line 83 "parse.y"
-{ yyval.node = mk(nRedir,yyvsp[-1].redir.type,yyvsp[-1].redir.fd,yyvsp[0].node);
- if (yyvsp[-1].redir.type == rHeredoc && !qdoc(yyvsp[0].node, yyval.node)) YYABORT; /* queue heredocs up */
- }
-break;
-case 21:
-#line 87 "parse.y"
-{ yyval.node = mk(nCase, yyvsp[-1].node); }
-break;
-case 22:
-#line 88 "parse.y"
-{ yyval.node = mk(nCase, yyvsp[-1].node); }
-break;
-case 23:
-#line 90 "parse.y"
-{ yyval.node = mk(nCbody, yyvsp[0].node, NULL); }
-break;
-case 24:
-#line 91 "parse.y"
-{ yyval.node = mk(nCbody, yyvsp[-1].node, yyvsp[0].node); }
-break;
-case 25:
-#line 92 "parse.y"
-{ yyval.node = mk(nCbody, yyvsp[-1].node, yyvsp[0].node); }
-break;
-case 27:
-#line 95 "parse.y"
-{ yyval.node = mk(nElse,yyvsp[-3].node,yyvsp[0].node); }
-break;
-case 28:
-#line 97 "parse.y"
-{ yyval.node = NULL; }
-break;
-case 30:
-#line 99 "parse.y"
-{ yyval.node = mk(nBrace,yyvsp[-1].node,yyvsp[0].node); }
-break;
-case 31:
-#line 100 "parse.y"
-{ yyval.node = mk(nIf,yyvsp[-2].node,yyvsp[0].node); }
-break;
-case 32:
-#line 101 "parse.y"
-{ yyval.node = mk(nForin,yyvsp[-5].node,yyvsp[-3].node,yyvsp[0].node); }
-break;
-case 33:
-#line 102 "parse.y"
-{ yyval.node = mk(nForin,yyvsp[-3].node,star,yyvsp[0].node); }
-break;
-case 34:
-#line 103 "parse.y"
-{ yyval.node = mk(nWhile,yyvsp[-2].node,yyvsp[0].node); }
-break;
-case 35:
-#line 104 "parse.y"
-{ yyval.node = mk(nSwitch,yyvsp[-5].node,yyvsp[-1].node); }
-break;
-case 36:
-#line 105 "parse.y"
-{ yyval.node = mk(nMatch,yyvsp[-1].node,yyvsp[0].node); }
-break;
-case 37:
-#line 106 "parse.y"
-{ yyval.node = mk(nAndalso,yyvsp[-3].node,yyvsp[0].node); }
-break;
-case 38:
-#line 107 "parse.y"
-{ yyval.node = mk(nOrelse,yyvsp[-3].node,yyvsp[0].node); }
-break;
-case 39:
-#line 108 "parse.y"
-{ yyval.node = mk(nPipe,yyvsp[-2].pipe.left,yyvsp[-2].pipe.right,yyvsp[-3].node,yyvsp[0].node); }
-break;
-case 40:
-#line 109 "parse.y"
-{ yyval.node = (yyvsp[0].node != NULL ? mk(nPre,yyvsp[-1].node,yyvsp[0].node) : yyvsp[-1].node); }
-break;
-case 41:
-#line 110 "parse.y"
-{ yyval.node = (yyvsp[0].node != NULL ? mk(nPre,yyvsp[-1].node,yyvsp[0].node) : yyvsp[-1].node); }
-break;
-case 42:
-#line 111 "parse.y"
-{ yyval.node = mk(nBang,yyvsp[0].node); }
-break;
-case 43:
-#line 112 "parse.y"
-{ yyval.node = mk(nSubshell,yyvsp[0].node); }
-break;
-case 44:
-#line 113 "parse.y"
-{ yyval.node = mk(nNewfn,yyvsp[-1].node,yyvsp[0].node); }
-break;
-case 45:
-#line 114 "parse.y"
-{ yyval.node = mk(nRmfn,yyvsp[0].node); }
-break;
-case 49:
-#line 120 "parse.y"
-{ yyval.node = (yyvsp[0].node != NULL ? mk(nArgs,yyvsp[-1].node,yyvsp[0].node) : yyvsp[-1].node); }
-break;
-case 50:
-#line 121 "parse.y"
-{ yyval.node = mk(nArgs,yyvsp[-1].node,yyvsp[0].node); }
-break;
-case 52:
-#line 124 "parse.y"
-{ yyval.node = mk(nConcat,yyvsp[-2].node,yyvsp[0].node); }
-break;
-case 54:
-#line 127 "parse.y"
-{ yyval.node = mk(nWord, yyvsp[0].keyword, NULL, FALSE); }
-break;
-case 56:
-#line 130 "parse.y"
-{ yyval.node = mk(nConcat,yyvsp[-2].node,yyvsp[0].node); }
-break;
-case 57:
-#line 132 "parse.y"
-{ yyval.node = mk(nVar,yyvsp[0].node); }
-break;
-case 58:
-#line 133 "parse.y"
-{ yyval.node = mk(nVarsub,yyvsp[-3].node,yyvsp[-1].node); }
-break;
-case 59:
-#line 134 "parse.y"
-{ yyval.node = mk(nCount,yyvsp[0].node); }
-break;
-case 60:
-#line 135 "parse.y"
-{ yyval.node = mk(nFlat, yyvsp[0].node); }
-break;
-case 61:
-#line 136 "parse.y"
-{ yyval.node = mk(nBackq,nolist,yyvsp[0].node); }
-break;
-case 62:
-#line 137 "parse.y"
-{ yyval.node = mk(nBackq,nolist,yyvsp[0].node); }
-break;
-case 63:
-#line 138 "parse.y"
-{ yyval.node = mk(nBackq,yyvsp[-1].node,yyvsp[0].node); }
-break;
-case 64:
-#line 139 "parse.y"
-{ yyval.node = mk(nBackq,yyvsp[-1].node,yyvsp[0].node); }
-break;
-case 65:
-#line 140 "parse.y"
-{ yyval.node = yyvsp[-1].node; }
-break;
-case 66:
-#line 141 "parse.y"
-{ yyval.node = mk(nNmpipe,yyvsp[-1].redir.type,yyvsp[-1].redir.fd,yyvsp[0].node); }
-break;
-case 67:
-#line 142 "parse.y"
-{ yyval.node = mk(nWord, yyvsp[0].word.w, yyvsp[0].word.m, yyvsp[0].word.q); }
-break;
-case 68:
-#line 144 "parse.y"
-{ yyval.keyword = "for"; }
-break;
-case 69:
-#line 145 "parse.y"
-{ yyval.keyword = "in"; }
-break;
-case 70:
-#line 146 "parse.y"
-{ yyval.keyword = "while"; }
-break;
-case 71:
-#line 147 "parse.y"
-{ yyval.keyword = "if"; }
-break;
-case 72:
-#line 148 "parse.y"
-{ yyval.keyword = "switch"; }
-break;
-case 73:
-#line 149 "parse.y"
-{ yyval.keyword = "fn"; }
-break;
-case 74:
-#line 150 "parse.y"
-{ yyval.keyword = "else"; }
-break;
-case 75:
-#line 151 "parse.y"
-{ yyval.keyword = "case"; }
-break;
-case 76:
-#line 152 "parse.y"
-{ yyval.keyword = "~"; }
-break;
-case 77:
-#line 153 "parse.y"
-{ yyval.keyword = "!"; }
-break;
-case 78:
-#line 154 "parse.y"
-{ yyval.keyword = "@"; }
-break;
-case 79:
-#line 156 "parse.y"
-{ yyval.node = NULL; }
-break;
-case 80:
-#line 157 "parse.y"
-{ yyval.node = (yyvsp[-1].node != NULL ? (yyvsp[0].node != NULL ? mk(nLappend,yyvsp[-1].node,yyvsp[0].node) : yyvsp[-1].node) : yyvsp[0].node); }
-break;
-case 81:
-#line 159 "parse.y"
-{ yyval.node = NULL; }
-break;
-case 83:
-#line 161 "parse.y"
-{ yyval.node = (yyvsp[-1].node != NULL ? (yyvsp[0].node != NULL ? mk(nLappend,yyvsp[-1].node,yyvsp[0].node) : yyvsp[-1].node) : yyvsp[0].node); }
-break;
-#line 1062 "y.tab.c"
- }
- yyssp -= yym;
- yystate = *yyssp;
- yyvsp -= yym;
- yym = yylhs[yyn];
- if (yystate == 0 && yym == 0)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state 0 to\
- state %d\n", YYPREFIX, YYFINAL);
-#endif
- yystate = YYFINAL;
- *++yyssp = YYFINAL;
- *++yyvsp = yyval;
- if (yychar < 0)
- {
- if ((yychar = yylex()) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = 0;
- if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
- if (!yys) yys = "illegal-symbol";
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, YYFINAL, yychar, yys);
- }
-#endif
- }
- if (yychar == 0) goto yyaccept;
- goto yyloop;
- }
- if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
- yystate = yytable[yyn];
- else
- yystate = yydgoto[yym];
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state %d \
-to state %d\n", YYPREFIX, *yyssp, yystate);
-#endif
- if (yyssp >= yysslim && yygrowstack())
- {
- goto yyoverflow;
- }
- *++yyssp = yystate;
- *++yyvsp = yyval;
- goto yyloop;
-yyoverflow:
- yyerror("yacc stack overflow");
-yyabort:
- return (1);
-yyaccept:
- return (0);
-}
diff --git a/parse.h b/parse.h
deleted file mode 100644
index c193710..0000000
--- a/parse.h
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef YYERRCODE
-#define YYERRCODE 256
-#endif
-
-#define ANDAND 257
-#define BACKBACK 258
-#define BANG 259
-#define CASE 260
-#define COUNT 261
-#define DUP 262
-#define ELSE 263
-#define END 264
-#define FLAT 265
-#define FN 266
-#define FOR 267
-#define IF 268
-#define IN 269
-#define OROR 270
-#define PIPE 271
-#define REDIR 272
-#define SREDIR 273
-#define SUB 274
-#define SUBSHELL 275
-#define SWITCH 276
-#define TWIDDLE 277
-#define WHILE 278
-#define WORD 279
-#define HUH 280
-typedef union {
- struct Node *node;
- struct Redir redir;
- struct Pipe pipe;
- struct Dup dup;
- struct Word word;
- char *keyword;
-} YYSTYPE;
-extern YYSTYPE yylval;
diff --git a/parse.y b/parse.y
index 8be65bb..276961a 100644
--- a/parse.y
+++ b/parse.y
@@ -16,10 +16,12 @@ Node *parsetree; /* not using yylval because bison declares it as an auto */
%token ANDAND BACKBACK BANG CASE COUNT DUP ELSE END FLAT FN FOR IF IN
%token OROR PIPE REDIR SREDIR SUB SUBSHELL SWITCH TWIDDLE WHILE WORD HUH
+%left '^' '='
%left WHILE ')' ELSE
%left ANDAND OROR '\n'
%left BANG SUBSHELL
%left PIPE
+%left PREDIR /* fictitious */
%right '$'
%left SUB
/*
@@ -41,6 +43,7 @@ Node *parsetree; /* not using yylval because bison declares it as an auto */
%type <keyword> keyword
%type <node> assign body brace case cbody cmd cmdsa cmdsan comword epilog
first line nlwords paren redir sword simple iftail word words
+ arg args
%start rc
@@ -72,7 +75,7 @@ brace : '{' body '}' { $$ = $2; }
paren : '(' body ')' { $$ = $2; }
-assign : first '=' word { $$ = mk(nAssign,$1,$3); }
+assign : first optcaret '=' optcaret word { $$ = mk(nAssign,$1,$5); }
epilog : { $$ = NULL; }
| redir epilog { $$ = mk(nEpilog,$1,$2); }
@@ -108,19 +111,24 @@ cmd : /* empty */ %prec WHILE { $$ = NULL; }
| cmd ANDAND optnl cmd { $$ = mk(nAndalso,$1,$4); }
| cmd OROR optnl cmd { $$ = mk(nOrelse,$1,$4); }
| cmd PIPE optnl cmd { $$ = mk(nPipe,$2.left,$2.right,$1,$4); }
- | redir cmd %prec BANG { $$ = ($2 != NULL ? mk(nPre,$1,$2) : $1); }
+ | redir cmd %prec PREDIR { $$ = ($2 != NULL ? mk(nPre,$1,$2) : $1); }
| assign cmd %prec BANG { $$ = ($2 != NULL ? mk(nPre,$1,$2) : $1); }
| BANG optcaret cmd { $$ = mk(nBang,$3); }
| SUBSHELL optcaret cmd { $$ = mk(nSubshell,$3); }
| FN words brace { $$ = mk(nNewfn,$2,$3); }
| FN words { $$ = mk(nRmfn,$2); }
-optcaret : /* empty */
+optcaret : /* empty */ %prec '^'
| '^'
simple : first
- | simple word { $$ = ($2 != NULL ? mk(nArgs,$1,$2) : $1); }
- | simple redir { $$ = mk(nArgs,$1,$2); }
+ | first args { $$ = ($2 != NULL ? mk(nArgs,$1,$2) : $1); }
+
+args : arg
+ | args arg { $$ = ($2 != NULL ? mk(nArgs,$1,$2) : $1); }
+
+arg : word
+ | redir
first : comword
| first '^' sword { $$ = mk(nConcat,$1,$3); }
@@ -154,6 +162,7 @@ keyword : FOR { $$ = "for"; }
| TWIDDLE { $$ = "~"; }
| BANG { $$ = "!"; }
| SUBSHELL { $$ = "@"; }
+ | '=' { $$ = "="; }
words : { $$ = NULL; }
| words word { $$ = ($1 != NULL ? ($2 != NULL ? mk(nLappend,$1,$2) : $1) : $2); }
diff --git a/rc.1 b/rc.1
index 82ed3ef..b2e7c52 100644
--- a/rc.1
+++ b/rc.1
@@ -11,7 +11,7 @@
.\" man page must contain '\en'.)
.\"
.\" Evidently not all versions of nroff allow the omission of the
-.\" terminal " on a macro argument. Thus what could be written
+.\" terminal " on a macro argument. Thus what could be written
.\"
.\" .Cr "exec >[2] err.out
.\"
@@ -22,7 +22,7 @@
.\" instead.
.\"
.\" Use symbolic font names (e.g. R, I, B) instead of the standard
-.\" font positions 1, 2, 3. Note that for Xf to work the standard
+.\" font positions 1, 2, 3. Note that for Xf to work the standard
.\" font names must be single characters.
.\"
.\" Not all man macros have the RS and RE requests (I altered the Ds
@@ -31,9 +31,9 @@
.\" Thanks to Michael Haardt (u31b3hs@cip-s01.informatik.rwth-aachen.de)
.\" for pointing out these problems.
.\"
-.\" Note that sentences should end at the end of a line. nroff and
+.\" Note that sentences should end at the end of a line. nroff and
.\" troff will supply the correct inter-sentence spacing, but only if
-.\" the sentences end at the end of a line. Explicit spaces, if given,
+.\" the sentences end at the end of a line. Explicit spaces, if given,
.\" are apparently honored and the normal inter-sentence spacing is
.\" suppressed.
.\"
@@ -125,8 +125,8 @@
.\" with a new word made of the current word (\$3) and \$4
.\" rendered in the first font,
.\" and with the remaining args following \$4.
-.\" else We are done recursing. \$3 holds the desired output
-.\" word. We emit \$3, change to Roman font, and restore
+.\" else We are done recursing. \$3 holds the desired output
+.\" word. We emit \$3, change to Roman font, and restore
.\" the point size to the default.
.\" fi
.\"
@@ -136,7 +136,7 @@
.ds Xi
.\"-------
.\" I used to test for the italic font both by its font position
-.\" and its name. Now just test by its name.
+.\" and its name. Now just test by its name.
.\"
.\" .if "\\$1"2" .if !"\\$5"" .ds Xi \^
.\"-------
@@ -222,11 +222,17 @@ If the
.Cr \-e
flag is present, then
.I rc
-will exit if the exit status of a command is false (nonzero).
-.I rc
-will not exit, however, if a conditional fails, e.g., an
-.Cr if()
-command.
+will exit if any command fails (exits with non-zero status). However
+.I "rc -e"
+does not exit if a conditional fails. A conditional is the test of an
+.Cr "if ()"
+command, the test of a
+.Cr "while ()"
+command, or the left hand side of the
+.Cr ||
+or the
+.Cr &&
+operator.
.TP
.Cr \-i
If the
@@ -393,7 +399,7 @@ interprets several characters specially; special characters
automatically terminate words.
The following characters are special:
.Ds
-.Cr "# ; & | ^ $ = \` ' { } ( ) < >"
+.Cr "# ; & | ^ $ \` ' { } ( ) < >"
.De
.PP
The single quote
@@ -653,7 +659,7 @@ The following may be used for control flow in
.sp
.Ci "if (" test ") {"
.br
-.I " cmd"
+.I " cmd"
.br
.TP
.Ci "} else " cmd
@@ -823,22 +829,26 @@ command:
.Cr "~ subject pattern pattern ..."
.De
.PP
+The
.Cr ~
-sets
+command succeeds (sets
.Cr $status
-to zero if and only if a supplied pattern matches any
-single element of the subject list.
+to zero) if and only if one of the
+.Cr pattern s
+matches
+.Cr subject .
Thus
.Ds
.Cr "~ foo f*"
.De
.PP
-sets status to zero, while
+succeeds (sets status to zero), while
.Ds
-.Cr "~ (bar baz) f*"
+.Cr "~ bar f*"
.De
.PP
-sets status to one.
+fails (sets status to one).
+.PP
The null list is matched by the null list, so
.Ds
.Cr "~ $foo ()"
@@ -846,9 +856,30 @@ The null list is matched by the null list, so
.PP
checks to see whether
.Cr $foo
-is empty or not.
-This may also be achieved
-by the test
+is empty or not. Because
+.I rc
+does not have hierarchical lists, the test for emptiness cannot be
+combined with other tests. To test whether
+.Cr $foo
+is empty, or one of the strings
+.Cr nada
+or
+.Cr rien ,
+do
+.I not
+write
+.Ds
+.Cr "~ $x () nada rien # WRONG means the same as: ~ $x nada rien"
+.De
+.PP
+instead write
+.Ds
+.Cr "~ $x () || ~ $x nada rien"
+.De
+.PP
+Another way to test if
+.Cr $foo
+is empty is
.Ds
.Cr "~ $#foo 0"
.De
@@ -872,15 +903,16 @@ Thus, the command
.Cr "~ * ?"
.De
.PP
-returns true if any of the files in the current directory have a
+succeeds if any of the files in the current directory have a
single-character name.
+.PP
If the
.Cr ~
command is given a list as its first
argument, then a successful match against any of the elements of that
list will cause
.Cr ~
-to return true.
+to succeed.
For example:
.Ds
.Cr "~ (foo goo zoo) z*"
@@ -967,7 +999,7 @@ example, the above example could also be typed in as:
.De
.PP
.I rc
-takes care to insert a free-caret between the
+takes care to insert a free caret between the
.Rc `` \- ''
and
.Cr "$opts" ,
@@ -976,7 +1008,7 @@ as between
.Cr $files
and
.Cr ".c" .
-The rule for free carets is as follows: if
+The rule for free carets is as follows: if
a word or keyword is immediately
followed by another word, keyword, dollar-sign or
backquote, then
@@ -1281,12 +1313,12 @@ yet.
.Cr bqstatus " (no-export)"
The exit status of the
.I rc
-forked to execute the most recent backquote substitution. Note that, unlike
+forked to execute the most recent backquote substitution. Note that, unlike
.Cr $status ,
.Cr $bqstatus
is always a single element list (see
.BR "EXIT STATUS"
-below). For example:
+below). For example:
.Ds
.Cr "echo foo |grep bar; whatis status"
.De
@@ -1350,7 +1382,7 @@ has been started up as a login shell.
.TP
.Cr ifs " (default)"
The internal field separator, used for splitting up the output of
-backquote commands for digestion as a list. On startup,
+backquote commands for digestion as a list. On startup,
.I rc
assigns the list containing the characters space, tab, and newline to
.Cr $ifs .
@@ -1400,7 +1432,7 @@ prompt is simply ignored by
The null
.Cr $prompt(2)
also has its
-justification: an
+justification: an
.I rc
script, when typed interactively, will not leave
.Cr $prompt(2) 's
@@ -1841,9 +1873,9 @@ The
builtin only shifts
.Cr "$*" .
This function can shift any variable (except
-.Cr "$lshift" ).
+.Cr "$_lshift" ).
.Ds
-.Cr "fn lshift { lshift=$*; *=$$1; shift $lshift(2); $lshift(1)=$* }"
+.Cr "fn lshift { _lshift=$* *=$$1 { shift $_lshift(2); $_lshift(1)=$* } }"
.De
.PP
With this definition in place,
@@ -1899,6 +1931,45 @@ if every command in the pipeline did; otherwise it exits
can be made to exit with a particular status using the
.B exit
builtin.
+.SH "LINE EDITING"
+.I rc
+is typically built against a line editing library.
+On GNU/Linux systems this will usually be the GNU
+.I readline
+library.
+On *BSD systems it is more likely to be the BSD
+.I editline
+library.
+Please consult the appropriate library documentation for details of how to use
+and configure line editing.
+.SS "Tilde Expansion"
+Since
+.I rc
+does not support tilde expansion (converting
+.Cr ~foo
+to the home directory of user
+.Cr foo ),
+it is sometimes suggested by users as a
+possible enhancement.
+The authors and maintainers of
+.I rc
+have a proud history of resisting such feature requests.
+So it is worth noting here that GNU
+.I readline
+can expand tildes.
+Add this line to the file
+.Cr .inputrc
+in your home directory.
+.Ds
+.Cr "set expand-tilde on"
+.De
+.PP
+and then use the key sequence
+.Cr "M-~"
+to perform tilde expansion on the current word.
+See the
+.I readline
+documentation for further details.
.SH GRAMMAR
Here is
.IR rc 's
@@ -1908,6 +1979,7 @@ grammar, edited to remove semantic actions.
%term ANDAND BACKBACK BANG CASE COUNT DUP ELSE END FLAT FN FOR IF IN
%term OROR PIPE REDIR SUB SUBSHELL SWITCH TWIDDLE WHILE WORD HUH
+%left '^' '='
%left WHILE ')' ELSE
%left ANDAND OROR '\en'
%left BANG SUBSHELL
@@ -1936,7 +2008,7 @@ brace: '{' body '}'
paren: '(' body ')'
-assign: first '=' word
+assign: first optcaret '=' optcaret word
epilog: /* empty */ | redir epilog
@@ -1968,9 +2040,13 @@ cmd : /* empty */ %prec WHILE
| FN words brace
| FN words
-optcaret: /* empty */ | '^'
+optcaret: /* empty */ %prec '^' | '^'
+
+simple: first | first args
-simple: first | simple word | simple redir
+args: arg | args arg
+
+arg: word | redir
first: comword | first '^' sword
@@ -1990,7 +2066,7 @@ comword: '$' sword
| WORD
keyword: FOR | IN | WHILE | IF | SWITCH
- | FN | ELSE | CASE | TWIDDLE | BANG | SUBSHELL
+ | FN | ELSE | CASE | TWIDDLE | BANG | SUBSHELL | '='
words: /* empty */ | words word
@@ -2039,7 +2115,7 @@ If anybody can reproduce this problem, please let the maintainer know.)
.PP
The
.B echo
-command does not need to be a builtin. It is one for reasons of
+command does not need to be a builtin. It is one for reasons of
performance and portability (of
.I rc
scripts).
@@ -2140,12 +2216,12 @@ the
and
.Cr version
variables,
-the support for the GNU
-.IR readline (3)
-library,
-and the support for the
+the
.Cr prompt
-function.
+function,
+support for GNU
+.IR readline
+and other line editing libraries.
This
.I rc
also sets
diff --git a/signal.c b/signal.c
index 037be1d..68dcc27 100644
--- a/signal.c
+++ b/signal.c
@@ -15,8 +15,9 @@ void (*sys_signal(int signum, void (*handler)(int)))(int) {
new.sa_handler = handler;
new.sa_flags = 0; /* clear SA_RESTART */
sigfillset(&new.sa_mask);
- sigaction(signum, &new, &old);
- return old.sa_handler;
+ if (sigaction(signum, &new, &old) == 0)
+ return old.sa_handler;
+ return SIG_DFL;
}
#else
void (*sys_signal(int signum, void (*handler)(int)))(int) {
diff --git a/trip.rc b/trip.rc
index c811347..1189fb9 100644
--- a/trip.rc
+++ b/trip.rc
@@ -244,17 +244,17 @@ if (~ `{echo -n} ?)
if (!~ `` '' {echo --} $nl)
fail echo --
-pwd=`/bin/pwd cdpath=/ { # some local assignments
+pwd=`{/bin/pwd -P} cdpath=/ { # some local assignments
home=/tmp cd
- if (!~ `/bin/pwd `{sh -c 'cd /tmp; /bin/pwd'})
+ if (!~ `{/bin/pwd -P} `{sh -c 'cd /tmp; /bin/pwd -P'})
fail could not cd to '$home'
cdpath=/ cd tmp
- if (!~ `/bin/pwd `{sh -c 'cd /tmp; /bin/pwd'})
+ if (!~ `{/bin/pwd -P} `{sh -c 'cd /tmp; /bin/pwd -P'})
fail could not cd to /tmp
cd $pwd
- if (!~ `/bin/pwd `{sh -c 'cd $pwd; /bin/pwd'})
+ if (!~ `{/bin/pwd -P} `{sh -c 'cd $pwd; /bin/pwd -P'})
fail could not cd to current directory!
}
@@ -597,3 +597,20 @@ x=$tmpdir/qux*/foo
~ $x $tmpdir/qux/foo || { rm -rf $tmpdir/qux; fail broken symlink globbing }
rm -rf $tmpdir
+
+# test support for unquoted =
+submatch 'echo foo = bar' 'foo = bar' 'unquoted equals 2'
+submatch 'echo foo=bar' 'foo=bar' 'unquoted equals 2'
+submatch 'echo foo=' 'foo=' 'unquoted equals 3'
+submatch 'echo =bar; whatis -v echo' 'echo=bar' 'unquoted equals 4'
+
+# test for github issue #34
+X=`{ $rc -ec 'b=true; while($b){b=false}; echo YYY' }
+if (! ~ $X YYY) {
+ fail '"rc -e" exits when condition in the while statement fails in the second iteration'
+}
+
+# test for counter intuitive redirection parse
+A=``($nl){ $rc -c 'mkdir / >[2=1] | tr a-z A-Z' }
+B=``($nl){ $rc -c '>[2=1] mkdir / | tr a-z A-Z' }
+~ $A $B || fail counter intuitive redirection bug, $A '!=' $B
diff --git a/version.c.in b/version.c.in
index 967f0eb..691c9b0 100644
--- a/version.c.in
+++ b/version.c.in
@@ -1 +1 @@
-const char id[] = "@(#)@PACKAGE@ version @VERSION@, @RELDATE@.";
+const char id[] = "@(#)@PACKAGE@ version @VERSION@, @DESCRIPTION@.";
diff --git a/walk.c b/walk.c
index 984a68c..67fbb8e 100644
--- a/walk.c
+++ b/walk.c
@@ -110,6 +110,7 @@ top: sigchk();
cond = oldcond;
break;
}
+ cond = oldcond;
if (sigsetjmp(j.j, 1))
break;
jbreak.jb = &j;
@@ -117,12 +118,12 @@ top: sigchk();
do {
Edata block;
block.b = newblock();
- cond = oldcond;
except(eArena, block, &e2);
walk(n->u[1].p, TRUE);
+ cond = TRUE;
testtrue = walk(n->u[0].p, TRUE);
+ cond = oldcond;
unexcept(); /* eArena */
- cond = TRUE;
} while (testtrue);
cond = oldcond;
unexcept(); /* eBreak */