mirror of
https://salsa.debian.org/debian/dash.git
synced 2026-01-27 01:44:22 +00:00
New upstream version 0.5.12+git20240518+f47009f9a76e
This commit is contained in:
commit
f8aaaafca8
42
.gitignore
vendored
Normal file
42
.gitignore
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
# .gitignore for dash
|
||||
|
||||
# generated by autogen.sh
|
||||
Makefile.in
|
||||
/aclocal.m4
|
||||
/autom4te.cache/
|
||||
/compile
|
||||
/config.h.in
|
||||
/configure
|
||||
/depcomp
|
||||
/install-sh
|
||||
/missing
|
||||
|
||||
# generated by configure
|
||||
Makefile
|
||||
.deps
|
||||
.dirstamp
|
||||
/config.cache
|
||||
/config.h
|
||||
/config.log
|
||||
/config.status
|
||||
/stamp-h1
|
||||
|
||||
# generated by make
|
||||
/src/token_vars.h
|
||||
|
||||
# Apple debug symbol bundles
|
||||
*.dSYM/
|
||||
|
||||
# backups and patch artefacts
|
||||
*~
|
||||
*.bak
|
||||
*.orig
|
||||
*.rej
|
||||
|
||||
# OS generated files
|
||||
.DS_Store
|
||||
.DS_Store?
|
||||
._*
|
||||
.Spotlight*
|
||||
.Trash*
|
||||
*[Tt]humbs.db
|
||||
1023
ChangeLog.O
Normal file
1023
ChangeLog.O
Normal file
File diff suppressed because it is too large
Load Diff
368
INSTALL
368
INSTALL
@ -1,368 +0,0 @@
|
||||
Installation Instructions
|
||||
*************************
|
||||
|
||||
Copyright (C) 1994-1996, 1999-2002, 2004-2016 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. This file is offered as-is,
|
||||
without warranty of any kind.
|
||||
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
Briefly, the shell command './configure && make && make install'
|
||||
should configure, build, and install this package. The following
|
||||
more-detailed instructions are generic; see the 'README' file for
|
||||
instructions specific to this package. Some packages provide this
|
||||
'INSTALL' file but do not implement all of the features documented
|
||||
below. The lack of an optional feature in a given package is not
|
||||
necessarily a bug. More recommendations for GNU packages can be found
|
||||
in *note Makefile Conventions: (standards)Makefile Conventions.
|
||||
|
||||
The 'configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a 'Makefile' in each directory of the package.
|
||||
It may also create one or more '.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script 'config.status' that
|
||||
you can run in the future to recreate the current configuration, and a
|
||||
file 'config.log' containing compiler output (useful mainly for
|
||||
debugging 'configure').
|
||||
|
||||
It can also use an optional file (typically called 'config.cache' and
|
||||
enabled with '--cache-file=config.cache' or simply '-C') that saves the
|
||||
results of its tests to speed up reconfiguring. Caching is disabled by
|
||||
default to prevent problems with accidental use of stale cache files.
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how 'configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the 'README' so they can
|
||||
be considered for the next release. If you are using the cache, and at
|
||||
some point 'config.cache' contains results you don't want to keep, you
|
||||
may remove or edit it.
|
||||
|
||||
The file 'configure.ac' (or 'configure.in') is used to create
|
||||
'configure' by a program called 'autoconf'. You need 'configure.ac' if
|
||||
you want to change it or regenerate 'configure' using a newer version of
|
||||
'autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. 'cd' to the directory containing the package's source code and type
|
||||
'./configure' to configure the package for your system.
|
||||
|
||||
Running 'configure' might take a while. While running, it prints
|
||||
some messages telling which features it is checking for.
|
||||
|
||||
2. Type 'make' to compile the package.
|
||||
|
||||
3. Optionally, type 'make check' to run any self-tests that come with
|
||||
the package, generally using the just-built uninstalled binaries.
|
||||
|
||||
4. Type 'make install' to install the programs and any data files and
|
||||
documentation. When installing into a prefix owned by root, it is
|
||||
recommended that the package be configured and built as a regular
|
||||
user, and only the 'make install' phase executed with root
|
||||
privileges.
|
||||
|
||||
5. Optionally, type 'make installcheck' to repeat any self-tests, but
|
||||
this time using the binaries in their final installed location.
|
||||
This target does not install anything. Running this target as a
|
||||
regular user, particularly if the prior 'make install' required
|
||||
root privileges, verifies that the installation completed
|
||||
correctly.
|
||||
|
||||
6. You can remove the program binaries and object files from the
|
||||
source code directory by typing 'make clean'. To also remove the
|
||||
files that 'configure' created (so you can compile the package for
|
||||
a different kind of computer), type 'make distclean'. There is
|
||||
also a 'make maintainer-clean' target, but that is intended mainly
|
||||
for the package's developers. If you use it, you may have to get
|
||||
all sorts of other programs in order to regenerate files that came
|
||||
with the distribution.
|
||||
|
||||
7. Often, you can also type 'make uninstall' to remove the installed
|
||||
files again. In practice, not all packages have tested that
|
||||
uninstallation works correctly, even though it is required by the
|
||||
GNU Coding Standards.
|
||||
|
||||
8. Some packages, particularly those that use Automake, provide 'make
|
||||
distcheck', which can by used by developers to test that all other
|
||||
targets like 'make install' and 'make uninstall' work correctly.
|
||||
This target is generally not run by end users.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the 'configure' script does not know about. Run './configure --help'
|
||||
for details on some of the pertinent environment variables.
|
||||
|
||||
You can give 'configure' initial values for configuration parameters
|
||||
by setting variables in the command line or in the environment. Here is
|
||||
an example:
|
||||
|
||||
./configure CC=c99 CFLAGS=-g LIBS=-lposix
|
||||
|
||||
*Note Defining Variables::, for more details.
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you can use GNU 'make'. 'cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the 'configure' script. 'configure' automatically checks for the source
|
||||
code in the directory that 'configure' is in and in '..'. This is known
|
||||
as a "VPATH" build.
|
||||
|
||||
With a non-GNU 'make', it is safer to compile the package for one
|
||||
architecture at a time in the source code directory. After you have
|
||||
installed the package for one architecture, use 'make distclean' before
|
||||
reconfiguring for another architecture.
|
||||
|
||||
On MacOS X 10.5 and later systems, you can create libraries and
|
||||
executables that work on multiple system types--known as "fat" or
|
||||
"universal" binaries--by specifying multiple '-arch' options to the
|
||||
compiler but only a single '-arch' option to the preprocessor. Like
|
||||
this:
|
||||
|
||||
./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
||||
CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
||||
CPP="gcc -E" CXXCPP="g++ -E"
|
||||
|
||||
This is not guaranteed to produce working output in all cases, you
|
||||
may have to build one architecture at a time and combine the results
|
||||
using the 'lipo' tool if you have problems.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, 'make install' installs the package's commands under
|
||||
'/usr/local/bin', include files under '/usr/local/include', etc. You
|
||||
can specify an installation prefix other than '/usr/local' by giving
|
||||
'configure' the option '--prefix=PREFIX', where PREFIX must be an
|
||||
absolute file name.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
pass the option '--exec-prefix=PREFIX' to 'configure', the package uses
|
||||
PREFIX as the prefix for installing programs and libraries.
|
||||
Documentation and other data files still use the regular prefix.
|
||||
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like '--bindir=DIR' to specify different values for particular
|
||||
kinds of files. Run 'configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them. In general, the default
|
||||
for these options is expressed in terms of '${prefix}', so that
|
||||
specifying just '--prefix' will affect all of the other directory
|
||||
specifications that were not explicitly provided.
|
||||
|
||||
The most portable way to affect installation locations is to pass the
|
||||
correct locations to 'configure'; however, many packages provide one or
|
||||
both of the following shortcuts of passing variable assignments to the
|
||||
'make install' command line to change installation locations without
|
||||
having to reconfigure or recompile.
|
||||
|
||||
The first method involves providing an override variable for each
|
||||
affected directory. For example, 'make install
|
||||
prefix=/alternate/directory' will choose an alternate location for all
|
||||
directory configuration variables that were expressed in terms of
|
||||
'${prefix}'. Any directories that were specified during 'configure',
|
||||
but not in terms of '${prefix}', must each be overridden at install time
|
||||
for the entire installation to be relocated. The approach of makefile
|
||||
variable overrides for each directory variable is required by the GNU
|
||||
Coding Standards, and ideally causes no recompilation. However, some
|
||||
platforms have known limitations with the semantics of shared libraries
|
||||
that end up requiring recompilation when using this method, particularly
|
||||
noticeable in packages that use GNU Libtool.
|
||||
|
||||
The second method involves providing the 'DESTDIR' variable. For
|
||||
example, 'make install DESTDIR=/alternate/directory' will prepend
|
||||
'/alternate/directory' before all installation names. The approach of
|
||||
'DESTDIR' overrides is not required by the GNU Coding Standards, and
|
||||
does not work on platforms that have drive letters. On the other hand,
|
||||
it does better at avoiding recompilation issues, and works well even
|
||||
when some directory options were not specified in terms of '${prefix}'
|
||||
at 'configure' time.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving 'configure' the
|
||||
option '--program-prefix=PREFIX' or '--program-suffix=SUFFIX'.
|
||||
|
||||
Some packages pay attention to '--enable-FEATURE' options to
|
||||
'configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to '--with-PACKAGE' options, where PACKAGE
|
||||
is something like 'gnu-as' or 'x' (for the X Window System). The
|
||||
'README' should mention any '--enable-' and '--with-' options that the
|
||||
package recognizes.
|
||||
|
||||
For packages that use the X Window System, 'configure' can usually
|
||||
find the X include and library files automatically, but if it doesn't,
|
||||
you can use the 'configure' options '--x-includes=DIR' and
|
||||
'--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Some packages offer the ability to configure how verbose the
|
||||
execution of 'make' will be. For these packages, running './configure
|
||||
--enable-silent-rules' sets the default to minimal output, which can be
|
||||
overridden with 'make V=1'; while running './configure
|
||||
--disable-silent-rules' sets the default to verbose, which can be
|
||||
overridden with 'make V=0'.
|
||||
|
||||
Particular systems
|
||||
==================
|
||||
|
||||
On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC
|
||||
is not installed, it is recommended to use the following options in
|
||||
order to use an ANSI C compiler:
|
||||
|
||||
./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
|
||||
|
||||
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
|
||||
|
||||
HP-UX 'make' updates targets which have the same time stamps as their
|
||||
prerequisites, which makes it generally unusable when shipped generated
|
||||
files such as 'configure' are involved. Use GNU 'make' instead.
|
||||
|
||||
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
|
||||
parse its '<wchar.h>' header file. The option '-nodtk' can be used as a
|
||||
workaround. If GNU CC is not installed, it is therefore recommended to
|
||||
try
|
||||
|
||||
./configure CC="cc"
|
||||
|
||||
and if that doesn't work, try
|
||||
|
||||
./configure CC="cc -nodtk"
|
||||
|
||||
On Solaris, don't put '/usr/ucb' early in your 'PATH'. This
|
||||
directory contains several dysfunctional programs; working variants of
|
||||
these programs are available in '/usr/bin'. So, if you need '/usr/ucb'
|
||||
in your 'PATH', put it _after_ '/usr/bin'.
|
||||
|
||||
On Haiku, software installed for all users goes in '/boot/common',
|
||||
not '/usr/local'. It is recommended to use the following options:
|
||||
|
||||
./configure --prefix=/boot/common
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features 'configure' cannot figure out
|
||||
automatically, but needs to determine by the type of machine the package
|
||||
will run on. Usually, assuming the package is built to be run on the
|
||||
_same_ architectures, 'configure' can figure that out, but if it prints
|
||||
a message saying it cannot guess the machine type, give it the
|
||||
'--build=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as 'sun4', or a canonical name which has the form:
|
||||
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
where SYSTEM can have one of these forms:
|
||||
|
||||
OS
|
||||
KERNEL-OS
|
||||
|
||||
See the file 'config.sub' for the possible values of each field. If
|
||||
'config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the machine type.
|
||||
|
||||
If you are _building_ compiler tools for cross-compiling, you should
|
||||
use the option '--target=TYPE' to select the type of system they will
|
||||
produce code for.
|
||||
|
||||
If you want to _use_ a cross compiler, that generates code for a
|
||||
platform different from the build platform, you should specify the
|
||||
"host" platform (i.e., that on which the generated programs will
|
||||
eventually be run) with '--host=TYPE'.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for 'configure' scripts to share,
|
||||
you can create a site shell script called 'config.site' that gives
|
||||
default values for variables like 'CC', 'cache_file', and 'prefix'.
|
||||
'configure' looks for 'PREFIX/share/config.site' if it exists, then
|
||||
'PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
'CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all 'configure' scripts look for a site script.
|
||||
|
||||
Defining Variables
|
||||
==================
|
||||
|
||||
Variables not defined in a site shell script can be set in the
|
||||
environment passed to 'configure'. However, some packages may run
|
||||
configure again during the build, and the customized values of these
|
||||
variables may be lost. In order to avoid this problem, you should set
|
||||
them in the 'configure' command line, using 'VAR=value'. For example:
|
||||
|
||||
./configure CC=/usr/local2/bin/gcc
|
||||
|
||||
causes the specified 'gcc' to be used as the C compiler (unless it is
|
||||
overridden in the site shell script).
|
||||
|
||||
Unfortunately, this technique does not work for 'CONFIG_SHELL' due to an
|
||||
Autoconf limitation. Until the limitation is lifted, you can use this
|
||||
workaround:
|
||||
|
||||
CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
|
||||
|
||||
'configure' Invocation
|
||||
======================
|
||||
|
||||
'configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
'--help'
|
||||
'-h'
|
||||
Print a summary of all of the options to 'configure', and exit.
|
||||
|
||||
'--help=short'
|
||||
'--help=recursive'
|
||||
Print a summary of the options unique to this package's
|
||||
'configure', and exit. The 'short' variant lists options used only
|
||||
in the top level, while the 'recursive' variant lists options also
|
||||
present in any nested packages.
|
||||
|
||||
'--version'
|
||||
'-V'
|
||||
Print the version of Autoconf used to generate the 'configure'
|
||||
script, and exit.
|
||||
|
||||
'--cache-file=FILE'
|
||||
Enable the cache: use and save the results of the tests in FILE,
|
||||
traditionally 'config.cache'. FILE defaults to '/dev/null' to
|
||||
disable caching.
|
||||
|
||||
'--config-cache'
|
||||
'-C'
|
||||
Alias for '--cache-file=config.cache'.
|
||||
|
||||
'--quiet'
|
||||
'--silent'
|
||||
'-q'
|
||||
Do not print messages saying which checks are being made. To
|
||||
suppress all normal output, redirect it to '/dev/null' (any error
|
||||
messages will still be shown).
|
||||
|
||||
'--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
'configure' can determine that directory automatically.
|
||||
|
||||
'--prefix=DIR'
|
||||
Use DIR as the installation prefix. *note Installation Names:: for
|
||||
more details, including other options available for fine-tuning the
|
||||
installation locations.
|
||||
|
||||
'--no-create'
|
||||
'-n'
|
||||
Run the configure checks, but stop before creating any output
|
||||
files.
|
||||
|
||||
'configure' also accepts some other, not widely useful, options. Run
|
||||
'configure --help' for more details.
|
||||
777
Makefile.in
777
Makefile.in
@ -1,777 +0,0 @@
|
||||
# Makefile.in generated by automake 1.16.3 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2020 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# 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.
|
||||
|
||||
@SET_MAKE@
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||
"target option '$${target_option-}' specified" >&2; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
has_opt=no; \
|
||||
sane_makeflags=$$MAKEFLAGS; \
|
||||
if $(am__is_gnu_make); then \
|
||||
sane_makeflags=$$MFLAGS; \
|
||||
else \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
bs=\\; \
|
||||
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||
esac; \
|
||||
fi; \
|
||||
skip_next=no; \
|
||||
strip_trailopt () \
|
||||
{ \
|
||||
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||
}; \
|
||||
for flg in $$sane_makeflags; do \
|
||||
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||
case $$flg in \
|
||||
*=*|--*) continue;; \
|
||||
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||
-*I?*) strip_trailopt 'I';; \
|
||||
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||
-*O?*) strip_trailopt 'O';; \
|
||||
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||
-*l?*) strip_trailopt 'l';; \
|
||||
-[dEDm]) skip_next=yes;; \
|
||||
-[JT]) skip_next=yes;; \
|
||||
esac; \
|
||||
case $$flg in \
|
||||
*$$target_option*) has_opt=yes; break;; \
|
||||
esac; \
|
||||
done; \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
subdir = .
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
|
||||
$(am__configure_deps) $(am__DIST_COMMON)
|
||||
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
|
||||
configure.lineno config.status.lineno
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||
am__v_P_0 = false
|
||||
am__v_P_1 = :
|
||||
AM_V_GEN = $(am__v_GEN_@AM_V@)
|
||||
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
am__v_GEN_1 =
|
||||
AM_V_at = $(am__v_at_@AM_V@)
|
||||
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
|
||||
am__v_at_0 = @
|
||||
am__v_at_1 =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
|
||||
ctags-recursive dvi-recursive html-recursive info-recursive \
|
||||
install-data-recursive install-dvi-recursive \
|
||||
install-exec-recursive install-html-recursive \
|
||||
install-info-recursive install-pdf-recursive \
|
||||
install-ps-recursive install-recursive installcheck-recursive \
|
||||
installdirs-recursive pdf-recursive ps-recursive \
|
||||
tags-recursive uninstall-recursive
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
|
||||
distclean-recursive maintainer-clean-recursive
|
||||
am__recursive_targets = \
|
||||
$(RECURSIVE_TARGETS) \
|
||||
$(RECURSIVE_CLEAN_TARGETS) \
|
||||
$(am__extra_recursive_targets)
|
||||
AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
|
||||
cscope distdir distdir-am dist dist-all distcheck
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \
|
||||
config.h.in
|
||||
# Read a list of newline-separated strings from the standard input,
|
||||
# and print each of them once, without duplicates. Input order is
|
||||
# *not* preserved.
|
||||
am__uniquify_input = $(AWK) '\
|
||||
BEGIN { nonempty = 0; } \
|
||||
{ items[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in items) print i; }; } \
|
||||
'
|
||||
# Make sure the list of sources is unique. This is necessary because,
|
||||
# e.g., the same source file might be shared among _SOURCES variables
|
||||
# for different programs/libraries.
|
||||
am__define_uniq_tagged_files = \
|
||||
list='$(am__tagged_files)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | $(am__uniquify_input)`
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
CSCOPE = cscope
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in COPYING \
|
||||
ChangeLog INSTALL compile depcomp install-sh missing
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
top_distdir = $(distdir)
|
||||
am__remove_distdir = \
|
||||
if test -d "$(distdir)"; then \
|
||||
find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
|
||||
&& rm -rf "$(distdir)" \
|
||||
|| { sleep 5 && rm -rf "$(distdir)"; }; \
|
||||
else :; fi
|
||||
am__post_remove_distdir = $(am__remove_distdir)
|
||||
am__relativize = \
|
||||
dir0=`pwd`; \
|
||||
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
|
||||
sed_rest='s,^[^/]*/*,,'; \
|
||||
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
|
||||
sed_butlast='s,/*[^/]*$$,,'; \
|
||||
while test -n "$$dir1"; do \
|
||||
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
|
||||
if test "$$first" != "."; then \
|
||||
if test "$$first" = ".."; then \
|
||||
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
|
||||
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
|
||||
else \
|
||||
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
|
||||
if test "$$first2" = "$$first"; then \
|
||||
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
|
||||
else \
|
||||
dir2="../$$dir2"; \
|
||||
fi; \
|
||||
dir0="$$dir0"/"$$first"; \
|
||||
fi; \
|
||||
fi; \
|
||||
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
|
||||
done; \
|
||||
reldir="$$dir2"
|
||||
DIST_ARCHIVES = $(distdir).tar.gz
|
||||
GZIP_ENV = --best
|
||||
DIST_TARGETS = dist-gzip
|
||||
# Exists only to be overridden by the user if desired.
|
||||
AM_DISTCHECK_DVI_TARGET = dvi
|
||||
distuninstallcheck_listfiles = find . -type f -print
|
||||
am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
|
||||
| sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
|
||||
distcleancheck_listfiles = find . -type f -print
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CC_FOR_BUILD = @CC_FOR_BUILD@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
GREP = @GREP@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build_alias = @build_alias@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host_alias = @host_alias@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
runstatedir = @runstatedir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
SUBDIRS = src
|
||||
all: config.h
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-recursive
|
||||
|
||||
.SUFFIXES:
|
||||
am--refresh: Makefile
|
||||
@:
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \
|
||||
$(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
echo ' $(SHELL) ./config.status'; \
|
||||
$(SHELL) ./config.status;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
$(SHELL) ./config.status --recheck
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
$(am__cd) $(srcdir) && $(AUTOCONF)
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
config.h: stamp-h1
|
||||
@test -f $@ || rm -f stamp-h1
|
||||
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1
|
||||
|
||||
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
|
||||
@rm -f stamp-h1
|
||||
cd $(top_builddir) && $(SHELL) ./config.status config.h
|
||||
$(srcdir)/config.h.in: $(am__configure_deps)
|
||||
($(am__cd) $(top_srcdir) && $(AUTOHEADER))
|
||||
rm -f stamp-h1
|
||||
touch $@
|
||||
|
||||
distclean-hdr:
|
||||
-rm -f config.h stamp-h1
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
# into them and run 'make' without going through this Makefile.
|
||||
# To change the values of 'make' variables: instead of editing Makefiles,
|
||||
# (1) if the variable is set in 'config.status', edit 'config.status'
|
||||
# (which will cause the Makefiles to be regenerated when you run 'make');
|
||||
# (2) otherwise, pass the desired values on the 'make' command line.
|
||||
$(am__recursive_targets):
|
||||
@fail=; \
|
||||
if $(am__make_keepgoing); then \
|
||||
failcom='fail=yes'; \
|
||||
else \
|
||||
failcom='exit 1'; \
|
||||
fi; \
|
||||
dot_seen=no; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
case "$@" in \
|
||||
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
|
||||
*) list='$(SUBDIRS)' ;; \
|
||||
esac; \
|
||||
for subdir in $$list; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
dot_seen=yes; \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| eval $$failcom; \
|
||||
done; \
|
||||
if test "$$dot_seen" = "no"; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
||||
fi; test -z "$$fail"
|
||||
|
||||
ID: $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); mkid -fID $$unique
|
||||
tags: tags-recursive
|
||||
TAGS: tags
|
||||
|
||||
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
|
||||
include_option=--etags-include; \
|
||||
empty_fix=.; \
|
||||
else \
|
||||
include_option=--include; \
|
||||
empty_fix=; \
|
||||
fi; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test ! -f $$subdir/TAGS || \
|
||||
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
|
||||
fi; \
|
||||
done; \
|
||||
$(am__define_uniq_tagged_files); \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: ctags-recursive
|
||||
|
||||
CTAGS: ctags
|
||||
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
cscope: cscope.files
|
||||
test ! -s cscope.files \
|
||||
|| $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
|
||||
clean-cscope:
|
||||
-rm -f cscope.files
|
||||
cscope.files: clean-cscope cscopelist
|
||||
cscopelist: cscopelist-recursive
|
||||
|
||||
cscopelist-am: $(am__tagged_files)
|
||||
list='$(am__tagged_files)'; \
|
||||
case "$(srcdir)" in \
|
||||
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
|
||||
*) sdir=$(subdir)/$(srcdir) ;; \
|
||||
esac; \
|
||||
for i in $$list; do \
|
||||
if test -f "$$i"; then \
|
||||
echo "$(subdir)/$$i"; \
|
||||
else \
|
||||
echo "$$sdir/$$i"; \
|
||||
fi; \
|
||||
done >> $(top_builddir)/cscope.files
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
|
||||
|
||||
distdir: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) distdir-am
|
||||
|
||||
distdir-am: $(DISTFILES)
|
||||
$(am__remove_distdir)
|
||||
test -d "$(distdir)" || mkdir "$(distdir)"
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
$(am__make_dryrun) \
|
||||
|| test -d "$(distdir)/$$subdir" \
|
||||
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|
||||
|| exit 1; \
|
||||
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
|
||||
$(am__relativize); \
|
||||
new_distdir=$$reldir; \
|
||||
dir1=$$subdir; dir2="$(top_distdir)"; \
|
||||
$(am__relativize); \
|
||||
new_top_distdir=$$reldir; \
|
||||
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
|
||||
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
|
||||
($(am__cd) $$subdir && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) \
|
||||
top_distdir="$$new_top_distdir" \
|
||||
distdir="$$new_distdir" \
|
||||
am__remove_distdir=: \
|
||||
am__skip_length_check=: \
|
||||
am__skip_mode_fix=: \
|
||||
distdir) \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
-test -n "$(am__skip_mode_fix)" \
|
||||
|| find "$(distdir)" -type d ! -perm -755 \
|
||||
-exec chmod u+rwx,go+rx {} \; -o \
|
||||
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|
||||
|| chmod -R a+r "$(distdir)"
|
||||
dist-gzip: distdir
|
||||
tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-bzip2: distdir
|
||||
tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-lzip: distdir
|
||||
tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-xz: distdir
|
||||
tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-zstd: distdir
|
||||
tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-tarZ: distdir
|
||||
@echo WARNING: "Support for distribution archives compressed with" \
|
||||
"legacy program 'compress' is deprecated." >&2
|
||||
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
|
||||
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-shar: distdir
|
||||
@echo WARNING: "Support for shar distribution archives is" \
|
||||
"deprecated." >&2
|
||||
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
|
||||
shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-zip: distdir
|
||||
-rm -f $(distdir).zip
|
||||
zip -rq $(distdir).zip $(distdir)
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist dist-all:
|
||||
$(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
# This target untars the dist file and tries a VPATH configuration. Then
|
||||
# it guarantees that the distribution is self-contained by making another
|
||||
# tarfile.
|
||||
distcheck: dist
|
||||
case '$(DIST_ARCHIVES)' in \
|
||||
*.tar.gz*) \
|
||||
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
|
||||
*.tar.bz2*) \
|
||||
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
|
||||
*.tar.lz*) \
|
||||
lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
|
||||
*.tar.xz*) \
|
||||
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
|
||||
*.tar.Z*) \
|
||||
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
|
||||
*.shar.gz*) \
|
||||
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
|
||||
*.zip*) \
|
||||
unzip $(distdir).zip ;;\
|
||||
*.tar.zst*) \
|
||||
zstd -dc $(distdir).tar.zst | $(am__untar) ;;\
|
||||
esac
|
||||
chmod -R a-w $(distdir)
|
||||
chmod u+w $(distdir)
|
||||
mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst
|
||||
chmod a-w $(distdir)
|
||||
test -d $(distdir)/_build || exit 0; \
|
||||
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
|
||||
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
|
||||
&& am__cwd=`pwd` \
|
||||
&& $(am__cd) $(distdir)/_build/sub \
|
||||
&& ../../configure \
|
||||
$(AM_DISTCHECK_CONFIGURE_FLAGS) \
|
||||
$(DISTCHECK_CONFIGURE_FLAGS) \
|
||||
--srcdir=../.. --prefix="$$dc_install_base" \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) check \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
|
||||
distuninstallcheck \
|
||||
&& chmod -R a-w "$$dc_install_base" \
|
||||
&& ({ \
|
||||
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
|
||||
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
|
||||
} || { rm -rf "$$dc_destdir"; exit 1; }) \
|
||||
&& rm -rf "$$dc_destdir" \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dist \
|
||||
&& rm -rf $(DIST_ARCHIVES) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
|
||||
&& cd "$$am__cwd" \
|
||||
|| exit 1
|
||||
$(am__post_remove_distdir)
|
||||
@(echo "$(distdir) archives ready for distribution: "; \
|
||||
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
|
||||
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
|
||||
distuninstallcheck:
|
||||
@test -n '$(distuninstallcheck_dir)' || { \
|
||||
echo 'ERROR: trying to run $@ with an empty' \
|
||||
'$$(distuninstallcheck_dir)' >&2; \
|
||||
exit 1; \
|
||||
}; \
|
||||
$(am__cd) '$(distuninstallcheck_dir)' || { \
|
||||
echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
|
||||
exit 1; \
|
||||
}; \
|
||||
test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
|
||||
|| { echo "ERROR: files left after uninstall:" ; \
|
||||
if test -n "$(DESTDIR)"; then \
|
||||
echo " (check DESTDIR support)"; \
|
||||
fi ; \
|
||||
$(distuninstallcheck_listfiles) ; \
|
||||
exit 1; } >&2
|
||||
distcleancheck: distclean
|
||||
@if test '$(srcdir)' = . ; then \
|
||||
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
|
||||
exit 1 ; \
|
||||
fi
|
||||
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|
||||
|| { echo "ERROR: files left in build directory after distclean:" ; \
|
||||
$(distcleancheck_listfiles) ; \
|
||||
exit 1; } >&2
|
||||
check-am: all-am
|
||||
check: check-recursive
|
||||
all-am: Makefile config.h
|
||||
installdirs: installdirs-recursive
|
||||
installdirs-am:
|
||||
install: install-recursive
|
||||
install-exec: install-exec-recursive
|
||||
install-data: install-data-recursive
|
||||
uninstall: uninstall-recursive
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-recursive
|
||||
install-strip:
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-recursive
|
||||
|
||||
clean-am: clean-generic mostlyclean-am
|
||||
|
||||
distclean: distclean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic distclean-hdr distclean-tags
|
||||
|
||||
dvi: dvi-recursive
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-recursive
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-recursive
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-recursive
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-recursive
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-recursive
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-recursive
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-recursive
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -rf $(top_srcdir)/autom4te.cache
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-recursive
|
||||
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
pdf: pdf-recursive
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-recursive
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am:
|
||||
|
||||
.MAKE: $(am__recursive_targets) all install-am install-strip
|
||||
|
||||
.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
|
||||
am--refresh check check-am clean clean-cscope clean-generic \
|
||||
cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \
|
||||
dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \
|
||||
dist-zstd distcheck distclean distclean-generic distclean-hdr \
|
||||
distclean-tags distcleancheck distdir distuninstallcheck dvi \
|
||||
dvi-am html html-am info info-am install install-am \
|
||||
install-data install-data-am install-dvi install-dvi-am \
|
||||
install-exec install-exec-am install-html install-html-am \
|
||||
install-info install-info-am install-man install-pdf \
|
||||
install-pdf-am install-ps install-ps-am install-strip \
|
||||
installcheck installcheck-am installdirs installdirs-am \
|
||||
maintainer-clean maintainer-clean-generic mostlyclean \
|
||||
mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \
|
||||
uninstall-am
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
1132
aclocal.m4
vendored
1132
aclocal.m4
vendored
File diff suppressed because it is too large
Load Diff
6
autogen.sh
Executable file
6
autogen.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
aclocal \
|
||||
&& autoheader \
|
||||
&& automake --add-missing \
|
||||
&& autoconf
|
||||
348
compile
348
compile
@ -1,348 +0,0 @@
|
||||
#! /bin/sh
|
||||
# Wrapper for compilers which do not understand '-c -o'.
|
||||
|
||||
scriptversion=2018-03-07.03; # UTC
|
||||
|
||||
# Copyright (C) 1999-2020 Free Software Foundation, Inc.
|
||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
nl='
|
||||
'
|
||||
|
||||
# We need space, tab and new line, in precisely that order. Quoting is
|
||||
# there to prevent tools from complaining about whitespace usage.
|
||||
IFS=" "" $nl"
|
||||
|
||||
file_conv=
|
||||
|
||||
# func_file_conv build_file lazy
|
||||
# Convert a $build file to $host form and store it in $file
|
||||
# Currently only supports Windows hosts. If the determined conversion
|
||||
# type is listed in (the comma separated) LAZY, no conversion will
|
||||
# take place.
|
||||
func_file_conv ()
|
||||
{
|
||||
file=$1
|
||||
case $file in
|
||||
/ | /[!/]*) # absolute file, and not a UNC file
|
||||
if test -z "$file_conv"; then
|
||||
# lazily determine how to convert abs files
|
||||
case `uname -s` in
|
||||
MINGW*)
|
||||
file_conv=mingw
|
||||
;;
|
||||
CYGWIN* | MSYS*)
|
||||
file_conv=cygwin
|
||||
;;
|
||||
*)
|
||||
file_conv=wine
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
case $file_conv/,$2, in
|
||||
*,$file_conv,*)
|
||||
;;
|
||||
mingw/*)
|
||||
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
|
||||
;;
|
||||
cygwin/* | msys/*)
|
||||
file=`cygpath -m "$file" || echo "$file"`
|
||||
;;
|
||||
wine/*)
|
||||
file=`winepath -w "$file" || echo "$file"`
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# func_cl_dashL linkdir
|
||||
# Make cl look for libraries in LINKDIR
|
||||
func_cl_dashL ()
|
||||
{
|
||||
func_file_conv "$1"
|
||||
if test -z "$lib_path"; then
|
||||
lib_path=$file
|
||||
else
|
||||
lib_path="$lib_path;$file"
|
||||
fi
|
||||
linker_opts="$linker_opts -LIBPATH:$file"
|
||||
}
|
||||
|
||||
# func_cl_dashl library
|
||||
# Do a library search-path lookup for cl
|
||||
func_cl_dashl ()
|
||||
{
|
||||
lib=$1
|
||||
found=no
|
||||
save_IFS=$IFS
|
||||
IFS=';'
|
||||
for dir in $lib_path $LIB
|
||||
do
|
||||
IFS=$save_IFS
|
||||
if $shared && test -f "$dir/$lib.dll.lib"; then
|
||||
found=yes
|
||||
lib=$dir/$lib.dll.lib
|
||||
break
|
||||
fi
|
||||
if test -f "$dir/$lib.lib"; then
|
||||
found=yes
|
||||
lib=$dir/$lib.lib
|
||||
break
|
||||
fi
|
||||
if test -f "$dir/lib$lib.a"; then
|
||||
found=yes
|
||||
lib=$dir/lib$lib.a
|
||||
break
|
||||
fi
|
||||
done
|
||||
IFS=$save_IFS
|
||||
|
||||
if test "$found" != yes; then
|
||||
lib=$lib.lib
|
||||
fi
|
||||
}
|
||||
|
||||
# func_cl_wrapper cl arg...
|
||||
# Adjust compile command to suit cl
|
||||
func_cl_wrapper ()
|
||||
{
|
||||
# Assume a capable shell
|
||||
lib_path=
|
||||
shared=:
|
||||
linker_opts=
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.[oO][bB][jJ])
|
||||
func_file_conv "$2"
|
||||
set x "$@" -Fo"$file"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
func_file_conv "$2"
|
||||
set x "$@" -Fe"$file"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
-I)
|
||||
eat=1
|
||||
func_file_conv "$2" mingw
|
||||
set x "$@" -I"$file"
|
||||
shift
|
||||
;;
|
||||
-I*)
|
||||
func_file_conv "${1#-I}" mingw
|
||||
set x "$@" -I"$file"
|
||||
shift
|
||||
;;
|
||||
-l)
|
||||
eat=1
|
||||
func_cl_dashl "$2"
|
||||
set x "$@" "$lib"
|
||||
shift
|
||||
;;
|
||||
-l*)
|
||||
func_cl_dashl "${1#-l}"
|
||||
set x "$@" "$lib"
|
||||
shift
|
||||
;;
|
||||
-L)
|
||||
eat=1
|
||||
func_cl_dashL "$2"
|
||||
;;
|
||||
-L*)
|
||||
func_cl_dashL "${1#-L}"
|
||||
;;
|
||||
-static)
|
||||
shared=false
|
||||
;;
|
||||
-Wl,*)
|
||||
arg=${1#-Wl,}
|
||||
save_ifs="$IFS"; IFS=','
|
||||
for flag in $arg; do
|
||||
IFS="$save_ifs"
|
||||
linker_opts="$linker_opts $flag"
|
||||
done
|
||||
IFS="$save_ifs"
|
||||
;;
|
||||
-Xlinker)
|
||||
eat=1
|
||||
linker_opts="$linker_opts $2"
|
||||
;;
|
||||
-*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
|
||||
func_file_conv "$1"
|
||||
set x "$@" -Tp"$file"
|
||||
shift
|
||||
;;
|
||||
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
|
||||
func_file_conv "$1" mingw
|
||||
set x "$@" "$file"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
if test -n "$linker_opts"; then
|
||||
linker_opts="-link$linker_opts"
|
||||
fi
|
||||
exec "$@" $linker_opts
|
||||
exit 1
|
||||
}
|
||||
|
||||
eat=
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try '$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: compile [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Wrapper for compilers which do not understand '-c -o'.
|
||||
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
|
||||
arguments, and rename the output as expected.
|
||||
|
||||
If you are trying to build a whole package this is not the
|
||||
right script to run: please start by reading the file 'INSTALL'.
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "compile $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
|
||||
icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
|
||||
func_cl_wrapper "$@" # Doesn't return...
|
||||
;;
|
||||
esac
|
||||
|
||||
ofile=
|
||||
cfile=
|
||||
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
||||
# So we strip '-o arg' only if arg is an object.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.obj)
|
||||
ofile=$2
|
||||
;;
|
||||
*)
|
||||
set x "$@" -o "$2"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*.c)
|
||||
cfile=$1
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
if test -z "$ofile" || test -z "$cfile"; then
|
||||
# If no '-o' option was seen then we might have been invoked from a
|
||||
# pattern rule where we don't need one. That is ok -- this is a
|
||||
# normal compilation that the losing compiler can handle. If no
|
||||
# '.c' file was seen then we are probably linking. That is also
|
||||
# ok.
|
||||
exec "$@"
|
||||
fi
|
||||
|
||||
# Name of file we expect compiler to create.
|
||||
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
|
||||
|
||||
# Create the lock directory.
|
||||
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
|
||||
# that we are using for the .o file. Also, base the name on the expected
|
||||
# object file name, since that is what matters with a parallel build.
|
||||
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
|
||||
while true; do
|
||||
if mkdir "$lockdir" >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
# FIXME: race condition here if user kills between mkdir and trap.
|
||||
trap "rmdir '$lockdir'; exit 1" 1 2 15
|
||||
|
||||
# Run the compile.
|
||||
"$@"
|
||||
ret=$?
|
||||
|
||||
if test -f "$cofile"; then
|
||||
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
|
||||
elif test -f "${cofile}bj"; then
|
||||
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
|
||||
fi
|
||||
|
||||
rmdir "$lockdir"
|
||||
exit $ret
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
211
config.h.in
211
config.h.in
@ -1,211 +0,0 @@
|
||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define if __attribute__((__alias__())) is supported */
|
||||
#undef HAVE_ALIAS_ATTRIBUTE
|
||||
|
||||
/* Define to 1 if you have the <alloca.h> header file. */
|
||||
#undef HAVE_ALLOCA_H
|
||||
|
||||
/* Define to 1 if you have the `bsearch' function. */
|
||||
#undef HAVE_BSEARCH
|
||||
|
||||
/* Define to 1 if you have the declaration of `isblank', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_ISBLANK
|
||||
|
||||
/* Define to 1 if you have the `faccessat' function. */
|
||||
#undef HAVE_FACCESSAT
|
||||
|
||||
/* Define to 1 if you have the `fnmatch' function. */
|
||||
#undef HAVE_FNMATCH
|
||||
|
||||
/* Define to 1 if you have the `getpwnam' function. */
|
||||
#undef HAVE_GETPWNAM
|
||||
|
||||
/* Define to 1 if you have the `getrlimit' function. */
|
||||
#undef HAVE_GETRLIMIT
|
||||
|
||||
/* Define to 1 if you have the `glob' function. */
|
||||
#undef HAVE_GLOB
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if you have the `isalpha' function. */
|
||||
#undef HAVE_ISALPHA
|
||||
|
||||
/* Define to 1 if you have the `killpg' function. */
|
||||
#undef HAVE_KILLPG
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the `mempcpy' function. */
|
||||
#undef HAVE_MEMPCPY
|
||||
|
||||
/* Define to 1 if you have the <paths.h> header file. */
|
||||
#undef HAVE_PATHS_H
|
||||
|
||||
/* Define to 1 if you have the `sigsetmask' function. */
|
||||
#undef HAVE_SIGSETMASK
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the `stpcpy' function. */
|
||||
#undef HAVE_STPCPY
|
||||
|
||||
/* Define to 1 if you have the `strchrnul' function. */
|
||||
#undef HAVE_STRCHRNUL
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if you have the `strsignal' function. */
|
||||
#undef HAVE_STRSIGNAL
|
||||
|
||||
/* Define to 1 if you have the `strtod' function. */
|
||||
#undef HAVE_STRTOD
|
||||
|
||||
/* Define to 1 if you have the `strtoimax' function. */
|
||||
#undef HAVE_STRTOIMAX
|
||||
|
||||
/* Define to 1 if you have the `strtoumax' function. */
|
||||
#undef HAVE_STRTOUMAX
|
||||
|
||||
/* Define if your `struct stat' has `st_mtim' */
|
||||
#undef HAVE_ST_MTIM
|
||||
|
||||
/* Define to 1 if you have the `sysconf' function. */
|
||||
#undef HAVE_SYSCONF
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define if your faccessat tells root all files are executable */
|
||||
#undef HAVE_TRADITIONAL_FACCESSAT
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#undef PACKAGE_URL
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* Define to printf format string for intmax_t */
|
||||
#undef PRIdMAX
|
||||
|
||||
/* The size of `intmax_t', as computed by sizeof. */
|
||||
#undef SIZEOF_INTMAX_T
|
||||
|
||||
/* The size of `long long int', as computed by sizeof. */
|
||||
#undef SIZEOF_LONG_LONG_INT
|
||||
|
||||
/* Define if you build with -DSMALL */
|
||||
#undef SMALL
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Enable extensions on AIX 3, Interix. */
|
||||
#ifndef _ALL_SOURCE
|
||||
# undef _ALL_SOURCE
|
||||
#endif
|
||||
/* Enable GNU extensions on systems that have them. */
|
||||
#ifndef _GNU_SOURCE
|
||||
# undef _GNU_SOURCE
|
||||
#endif
|
||||
/* Enable threading extensions on Solaris. */
|
||||
#ifndef _POSIX_PTHREAD_SEMANTICS
|
||||
# undef _POSIX_PTHREAD_SEMANTICS
|
||||
#endif
|
||||
/* Enable extensions on HP NonStop. */
|
||||
#ifndef _TANDEM_SOURCE
|
||||
# undef _TANDEM_SOURCE
|
||||
#endif
|
||||
/* Enable general extensions on Solaris. */
|
||||
#ifndef __EXTENSIONS__
|
||||
# undef __EXTENSIONS__
|
||||
#endif
|
||||
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* Define if you build with -DWITH_LINENO */
|
||||
#undef WITH_LINENO
|
||||
|
||||
/* Define to 1 if on MINIX. */
|
||||
#undef _MINIX
|
||||
|
||||
/* Define to system shell path */
|
||||
#undef _PATH_BSHELL
|
||||
|
||||
/* Define to devnull device node path */
|
||||
#undef _PATH_DEVNULL
|
||||
|
||||
/* Define to tty device node path */
|
||||
#undef _PATH_TTY
|
||||
|
||||
/* Define to 2 if the system does not provide POSIX.1 features except with
|
||||
this defined. */
|
||||
#undef _POSIX_1_SOURCE
|
||||
|
||||
/* Define to 1 if you need to in order for `stat' and other things to work. */
|
||||
#undef _POSIX_SOURCE
|
||||
|
||||
/* 64-bit operations are the same as 32-bit */
|
||||
#undef dirent64
|
||||
|
||||
/* 64-bit operations are the same as 32-bit */
|
||||
#undef fstat64
|
||||
|
||||
/* 64-bit operations are the same as 32-bit */
|
||||
#undef glob64
|
||||
|
||||
/* 64-bit operations are the same as 32-bit */
|
||||
#undef glob64_t
|
||||
|
||||
/* 64-bit operations are the same as 32-bit */
|
||||
#undef globfree64
|
||||
|
||||
/* 64-bit operations are the same as 32-bit */
|
||||
#undef lstat64
|
||||
|
||||
/* 64-bit operations are the same as 32-bit */
|
||||
#undef open64
|
||||
|
||||
/* 64-bit operations are the same as 32-bit */
|
||||
#undef readdir64
|
||||
|
||||
/* klibc has bsd_signal instead of signal */
|
||||
#undef signal
|
||||
|
||||
/* 64-bit operations are the same as 32-bit */
|
||||
#undef stat64
|
||||
15
configure.ac
15
configure.ac
@ -34,7 +34,7 @@ fi
|
||||
AC_ARG_ENABLE(static, AS_HELP_STRING(--enable-static, \
|
||||
[Build statical linked program]))
|
||||
if test "$enable_static" = "yes"; then
|
||||
export LDFLAGS="-static -Wl,--fatal-warnings"
|
||||
export LDFLAGS="-static"
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(fnmatch, AS_HELP_STRING(--disable-fnmatch, \
|
||||
@ -87,7 +87,7 @@ AC_CHECK_DECL([PRIdMAX],,
|
||||
|
||||
dnl Checks for library functions.
|
||||
AC_CHECK_FUNCS(bsearch faccessat getpwnam getrlimit isalpha killpg \
|
||||
mempcpy \
|
||||
memfd_create mempcpy \
|
||||
sigsetmask stpcpy strchrnul strsignal strtod strtoimax \
|
||||
strtoumax sysconf)
|
||||
|
||||
@ -177,6 +177,17 @@ if test "$have_st_mtim" = "yes"; then
|
||||
[Define if your `struct stat' has `st_mtim'])
|
||||
fi
|
||||
|
||||
dnl F_DUPFD_CLOEXEC is a mandatory part of POSIX since Issue 7
|
||||
AC_MSG_CHECKING(for F_DUPFD_CLOEXEC)
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([#include <unistd.h>
|
||||
#include <fcntl.h>],
|
||||
[return fcntl(0, F_DUPFD_CLOEXEC, 0)])],
|
||||
have_dupfd_cloexec=1, have_dupfd_cloexec=0)
|
||||
AC_MSG_RESULT($(expr yes \& $have_dupfd_cloexec \| no))
|
||||
AC_DEFINE_UNQUOTED([HAVE_F_DUPFD_CLOEXEC], [$have_dupfd_cloexec],
|
||||
[Define to 1 your system supports F_DUPFD_CLOEXEC])
|
||||
|
||||
AC_ARG_WITH(libedit, AS_HELP_STRING(--with-libedit, [Compile with libedit support]))
|
||||
use_libedit=
|
||||
if test "$with_libedit" = "yes"; then
|
||||
|
||||
791
depcomp
791
depcomp
@ -1,791 +0,0 @@
|
||||
#! /bin/sh
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
|
||||
scriptversion=2018-03-07.03; # UTC
|
||||
|
||||
# Copyright (C) 1999-2020 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try '$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Run PROGRAMS ARGS to compile a file, generating dependencies
|
||||
as side-effects.
|
||||
|
||||
Environment variables:
|
||||
depmode Dependency tracking mode.
|
||||
source Source file read by 'PROGRAMS ARGS'.
|
||||
object Object file output by 'PROGRAMS ARGS'.
|
||||
DEPDIR directory where to store dependencies.
|
||||
depfile Dependency file to output.
|
||||
tmpdepfile Temporary file to use when outputting dependencies.
|
||||
libtool Whether libtool is used (yes/no).
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "depcomp $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
# Get the directory component of the given path, and save it in the
|
||||
# global variables '$dir'. Note that this directory component will
|
||||
# be either empty or ending with a '/' character. This is deliberate.
|
||||
set_dir_from ()
|
||||
{
|
||||
case $1 in
|
||||
*/*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
|
||||
*) dir=;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Get the suffix-stripped basename of the given path, and save it the
|
||||
# global variable '$base'.
|
||||
set_base_from ()
|
||||
{
|
||||
base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
|
||||
}
|
||||
|
||||
# If no dependency file was actually created by the compiler invocation,
|
||||
# we still have to create a dummy depfile, to avoid errors with the
|
||||
# Makefile "include basename.Plo" scheme.
|
||||
make_dummy_depfile ()
|
||||
{
|
||||
echo "#dummy" > "$depfile"
|
||||
}
|
||||
|
||||
# Factor out some common post-processing of the generated depfile.
|
||||
# Requires the auxiliary global variable '$tmpdepfile' to be set.
|
||||
aix_post_process_depfile ()
|
||||
{
|
||||
# If the compiler actually managed to produce a dependency file,
|
||||
# post-process it.
|
||||
if test -f "$tmpdepfile"; then
|
||||
# Each line is of the form 'foo.o: dependency.h'.
|
||||
# Do two passes, one to just change these to
|
||||
# $object: dependency.h
|
||||
# and one to simply output
|
||||
# dependency.h:
|
||||
# which is needed to avoid the deleted-header problem.
|
||||
{ sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
|
||||
sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
|
||||
} > "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
else
|
||||
make_dummy_depfile
|
||||
fi
|
||||
}
|
||||
|
||||
# A tabulation character.
|
||||
tab=' '
|
||||
# A newline character.
|
||||
nl='
|
||||
'
|
||||
# Character ranges might be problematic outside the C locale.
|
||||
# These definitions help.
|
||||
upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
|
||||
lower=abcdefghijklmnopqrstuvwxyz
|
||||
digits=0123456789
|
||||
alpha=${upper}${lower}
|
||||
|
||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
|
||||
depfile=${depfile-`echo "$object" |
|
||||
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
|
||||
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||
|
||||
rm -f "$tmpdepfile"
|
||||
|
||||
# Avoid interferences from the environment.
|
||||
gccflag= dashmflag=
|
||||
|
||||
# Some modes work just like other modes, but use different flags. We
|
||||
# parameterize here, but still list the modes in the big case below,
|
||||
# to make depend.m4 easier to write. Note that we *cannot* use a case
|
||||
# here, because this file can only contain one case statement.
|
||||
if test "$depmode" = hp; then
|
||||
# HP compiler uses -M and no extra arg.
|
||||
gccflag=-M
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
if test "$depmode" = dashXmstdout; then
|
||||
# This is just like dashmstdout with a different argument.
|
||||
dashmflag=-xM
|
||||
depmode=dashmstdout
|
||||
fi
|
||||
|
||||
cygpath_u="cygpath -u -f -"
|
||||
if test "$depmode" = msvcmsys; then
|
||||
# This is just like msvisualcpp but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u='sed s,\\\\,/,g'
|
||||
depmode=msvisualcpp
|
||||
fi
|
||||
|
||||
if test "$depmode" = msvc7msys; then
|
||||
# This is just like msvc7 but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u='sed s,\\\\,/,g'
|
||||
depmode=msvc7
|
||||
fi
|
||||
|
||||
if test "$depmode" = xlc; then
|
||||
# IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
|
||||
gccflag=-qmakedep=gcc,-MF
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
case "$depmode" in
|
||||
gcc3)
|
||||
## gcc 3 implements dependency tracking that does exactly what
|
||||
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
|
||||
## it if -MD -MP comes after the -MF stuff. Hmm.
|
||||
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
|
||||
## the command line argument order; so add the flags where they
|
||||
## appear in depend2.am. Note that the slowdown incurred here
|
||||
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
|
||||
*) set fnord "$@" "$arg" ;;
|
||||
esac
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
done
|
||||
"$@"
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
mv "$tmpdepfile" "$depfile"
|
||||
;;
|
||||
|
||||
gcc)
|
||||
## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
|
||||
## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
|
||||
## (see the conditional assignment to $gccflag above).
|
||||
## There are various ways to get dependency output from gcc. Here's
|
||||
## why we pick this rather obscure method:
|
||||
## - Don't want to use -MD because we'd like the dependencies to end
|
||||
## up in a subdir. Having to rename by hand is ugly.
|
||||
## (We might end up doing this anyway to support other compilers.)
|
||||
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
||||
## -MM, not -M (despite what the docs say). Also, it might not be
|
||||
## supported by the other compilers which use the 'gcc' depmode.
|
||||
## - Using -M directly means running the compiler twice (even worse
|
||||
## than renaming).
|
||||
if test -z "$gccflag"; then
|
||||
gccflag=-MD,
|
||||
fi
|
||||
"$@" -Wp,"$gccflag$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
# The second -e expression handles DOS-style file names with drive
|
||||
# letters.
|
||||
sed -e 's/^[^:]*: / /' \
|
||||
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
||||
## This next piece of magic avoids the "deleted header file" problem.
|
||||
## The problem is that when a header file which appears in a .P file
|
||||
## is deleted, the dependency causes make to die (because there is
|
||||
## typically no way to rebuild the header). We avoid this by adding
|
||||
## dummy dependencies for each header file. Too bad gcc doesn't do
|
||||
## this for us directly.
|
||||
## Some versions of gcc put a space before the ':'. On the theory
|
||||
## that the space means something, we add a space to the output as
|
||||
## well. hp depmode also adds that space, but also prefixes the VPATH
|
||||
## to the object. Take care to not repeat it in the output.
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
sgi)
|
||||
if test "$libtool" = yes; then
|
||||
"$@" "-Wp,-MDupdate,$tmpdepfile"
|
||||
else
|
||||
"$@" -MDupdate "$tmpdepfile"
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
|
||||
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
|
||||
echo "$object : \\" > "$depfile"
|
||||
# Clip off the initial element (the dependent). Don't try to be
|
||||
# clever and replace this with sed code, as IRIX sed won't handle
|
||||
# lines with more than a fixed number of characters (4096 in
|
||||
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
|
||||
# the IRIX cc adds comments like '#:fec' to the end of the
|
||||
# dependency line.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
|
||||
| tr "$nl" ' ' >> "$depfile"
|
||||
echo >> "$depfile"
|
||||
# The second pass generates a dummy entry for each header file.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||
>> "$depfile"
|
||||
else
|
||||
make_dummy_depfile
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
xlc)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
aix)
|
||||
# The C for AIX Compiler uses -M and outputs the dependencies
|
||||
# in a .u file. In older versions, this file always lives in the
|
||||
# current directory. Also, the AIX compiler puts '$object:' at the
|
||||
# start of each line; $object doesn't have directory information.
|
||||
# Version 6 uses the directory in both cases.
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$base.u
|
||||
tmpdepfile3=$dir.libs/$base.u
|
||||
"$@" -Wc,-M
|
||||
else
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$dir$base.u
|
||||
tmpdepfile3=$dir$base.u
|
||||
"$@" -M
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
aix_post_process_depfile
|
||||
;;
|
||||
|
||||
tcc)
|
||||
# tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
|
||||
# FIXME: That version still under development at the moment of writing.
|
||||
# Make that this statement remains true also for stable, released
|
||||
# versions.
|
||||
# It will wrap lines (doesn't matter whether long or short) with a
|
||||
# trailing '\', as in:
|
||||
#
|
||||
# foo.o : \
|
||||
# foo.c \
|
||||
# foo.h \
|
||||
#
|
||||
# It will put a trailing '\' even on the last line, and will use leading
|
||||
# spaces rather than leading tabs (at least since its commit 0394caf7
|
||||
# "Emit spaces for -MD").
|
||||
"$@" -MD -MF "$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
|
||||
# We have to change lines of the first kind to '$object: \'.
|
||||
sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
|
||||
# And for each line of the second kind, we have to emit a 'dep.h:'
|
||||
# dummy dependency, to avoid the deleted-header problem.
|
||||
sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
## The order of this option in the case statement is important, since the
|
||||
## shell code in configure will try each of these formats in the order
|
||||
## listed in this file. A plain '-MD' option would be understood by many
|
||||
## compilers, so we must ensure this comes after the gcc and icc options.
|
||||
pgcc)
|
||||
# Portland's C compiler understands '-MD'.
|
||||
# Will always output deps to 'file.d' where file is the root name of the
|
||||
# source file under compilation, even if file resides in a subdirectory.
|
||||
# The object file name does not affect the name of the '.d' file.
|
||||
# pgcc 10.2 will output
|
||||
# foo.o: sub/foo.c sub/foo.h
|
||||
# and will wrap long lines using '\' :
|
||||
# foo.o: sub/foo.c ... \
|
||||
# sub/foo.h ... \
|
||||
# ...
|
||||
set_dir_from "$object"
|
||||
# Use the source, not the object, to determine the base name, since
|
||||
# that's sadly what pgcc will do too.
|
||||
set_base_from "$source"
|
||||
tmpdepfile=$base.d
|
||||
|
||||
# For projects that build the same source file twice into different object
|
||||
# files, the pgcc approach of using the *source* file root name can cause
|
||||
# problems in parallel builds. Use a locking strategy to avoid stomping on
|
||||
# the same $tmpdepfile.
|
||||
lockdir=$base.d-lock
|
||||
trap "
|
||||
echo '$0: caught signal, cleaning up...' >&2
|
||||
rmdir '$lockdir'
|
||||
exit 1
|
||||
" 1 2 13 15
|
||||
numtries=100
|
||||
i=$numtries
|
||||
while test $i -gt 0; do
|
||||
# mkdir is a portable test-and-set.
|
||||
if mkdir "$lockdir" 2>/dev/null; then
|
||||
# This process acquired the lock.
|
||||
"$@" -MD
|
||||
stat=$?
|
||||
# Release the lock.
|
||||
rmdir "$lockdir"
|
||||
break
|
||||
else
|
||||
# If the lock is being held by a different process, wait
|
||||
# until the winning process is done or we timeout.
|
||||
while test -d "$lockdir" && test $i -gt 0; do
|
||||
sleep 1
|
||||
i=`expr $i - 1`
|
||||
done
|
||||
fi
|
||||
i=`expr $i - 1`
|
||||
done
|
||||
trap - 1 2 13 15
|
||||
if test $i -le 0; then
|
||||
echo "$0: failed to acquire lock after $numtries attempts" >&2
|
||||
echo "$0: check lockdir '$lockdir'" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each line is of the form `foo.o: dependent.h',
|
||||
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp2)
|
||||
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
|
||||
# compilers, which have integrated preprocessors. The correct option
|
||||
# to use with these is +Maked; it writes dependencies to a file named
|
||||
# 'foo.d', which lands next to the object file, wherever that
|
||||
# happens to be.
|
||||
# Much of this is similar to the tru64 case; see comments there.
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir.libs/$base.d
|
||||
"$@" -Wc,+Maked
|
||||
else
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
"$@" +Maked
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
|
||||
# Add 'dependent.h:' lines.
|
||||
sed -ne '2,${
|
||||
s/^ *//
|
||||
s/ \\*$//
|
||||
s/$/:/
|
||||
p
|
||||
}' "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
make_dummy_depfile
|
||||
fi
|
||||
rm -f "$tmpdepfile" "$tmpdepfile2"
|
||||
;;
|
||||
|
||||
tru64)
|
||||
# The Tru64 compiler uses -MD to generate dependencies as a side
|
||||
# effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
|
||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||
# dependencies in 'foo.d' instead, so we check for that too.
|
||||
# Subdirectories are respected.
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
|
||||
if test "$libtool" = yes; then
|
||||
# Libtool generates 2 separate objects for the 2 libraries. These
|
||||
# two compilations output dependencies in $dir.libs/$base.o.d and
|
||||
# in $dir$base.o.d. We have to check for both files, because
|
||||
# one of the two compilations can be disabled. We should prefer
|
||||
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
|
||||
# automatically cleaned when .libs/ is deleted, while ignoring
|
||||
# the former would cause a distcleancheck panic.
|
||||
tmpdepfile1=$dir$base.o.d # libtool 1.5
|
||||
tmpdepfile2=$dir.libs/$base.o.d # Likewise.
|
||||
tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
tmpdepfile3=$dir$base.d
|
||||
"$@" -MD
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
# Same post-processing that is required for AIX mode.
|
||||
aix_post_process_depfile
|
||||
;;
|
||||
|
||||
msvc7)
|
||||
if test "$libtool" = yes; then
|
||||
showIncludes=-Wc,-showIncludes
|
||||
else
|
||||
showIncludes=-showIncludes
|
||||
fi
|
||||
"$@" $showIncludes > "$tmpdepfile"
|
||||
stat=$?
|
||||
grep -v '^Note: including file: ' "$tmpdepfile"
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
# The first sed program below extracts the file names and escapes
|
||||
# backslashes for cygpath. The second sed program outputs the file
|
||||
# name when reading, but also accumulates all include files in the
|
||||
# hold buffer in order to output them again at the end. This only
|
||||
# works with sed implementations that can handle large buffers.
|
||||
sed < "$tmpdepfile" -n '
|
||||
/^Note: including file: *\(.*\)/ {
|
||||
s//\1/
|
||||
s/\\/\\\\/g
|
||||
p
|
||||
}' | $cygpath_u | sort -u | sed -n '
|
||||
s/ /\\ /g
|
||||
s/\(.*\)/'"$tab"'\1 \\/p
|
||||
s/.\(.*\) \\/\1:/
|
||||
H
|
||||
$ {
|
||||
s/.*/'"$tab"'/
|
||||
G
|
||||
p
|
||||
}' >> "$depfile"
|
||||
echo >> "$depfile" # make sure the fragment doesn't end with a backslash
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvc7msys)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
#nosideeffect)
|
||||
# This comment above is used by automake to tell side-effect
|
||||
# dependency tracking mechanisms from slower ones.
|
||||
|
||||
dashmstdout)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout, regardless of -o.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove '-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
test -z "$dashmflag" && dashmflag=-M
|
||||
# Require at least two characters before searching for ':'
|
||||
# in the target name. This is to cope with DOS-style filenames:
|
||||
# a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
|
||||
"$@" $dashmflag |
|
||||
sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this sed invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
dashXmstdout)
|
||||
# This case only exists to satisfy depend.m4. It is never actually
|
||||
# run, as this mode is specially recognized in the preamble.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
makedepend)
|
||||
"$@" || exit $?
|
||||
# Remove any Libtool call
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
# X makedepend
|
||||
shift
|
||||
cleared=no eat=no
|
||||
for arg
|
||||
do
|
||||
case $cleared in
|
||||
no)
|
||||
set ""; shift
|
||||
cleared=yes ;;
|
||||
esac
|
||||
if test $eat = yes; then
|
||||
eat=no
|
||||
continue
|
||||
fi
|
||||
case "$arg" in
|
||||
-D*|-I*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
# Strip any option that makedepend may not understand. Remove
|
||||
# the object too, otherwise makedepend will parse it as a source file.
|
||||
-arch)
|
||||
eat=yes ;;
|
||||
-*|$object)
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
esac
|
||||
done
|
||||
obj_suffix=`echo "$object" | sed 's/^.*\././'`
|
||||
touch "$tmpdepfile"
|
||||
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||
rm -f "$depfile"
|
||||
# makedepend may prepend the VPATH from the source file name to the object.
|
||||
# No need to regex-escape $object, excess matching of '.' is harmless.
|
||||
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process the last invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed '1,2d' "$tmpdepfile" \
|
||||
| tr ' ' "$nl" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile" "$tmpdepfile".bak
|
||||
;;
|
||||
|
||||
cpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove '-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
"$@" -E \
|
||||
| sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
| sed '$ s: \\$::' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
cat < "$tmpdepfile" >> "$depfile"
|
||||
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvisualcpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case "$arg" in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
||||
set fnord "$@"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
"$@" -E 2>/dev/null |
|
||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
|
||||
echo "$tab" >> "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvcmsys)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
none)
|
||||
exec "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown depmode $depmode" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
541
install-sh
541
install-sh
@ -1,541 +0,0 @@
|
||||
#!/bin/sh
|
||||
# install - install a program, script, or datafile
|
||||
|
||||
scriptversion=2020-11-14.01; # UTC
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
#
|
||||
# Copyright (C) 1994 X Consortium
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# 'make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch.
|
||||
|
||||
tab=' '
|
||||
nl='
|
||||
'
|
||||
IFS=" $tab$nl"
|
||||
|
||||
# Set DOITPROG to "echo" to test this script.
|
||||
|
||||
doit=${DOITPROG-}
|
||||
doit_exec=${doit:-exec}
|
||||
|
||||
# Put in absolute file names if you don't have them in your path;
|
||||
# or use environment vars.
|
||||
|
||||
chgrpprog=${CHGRPPROG-chgrp}
|
||||
chmodprog=${CHMODPROG-chmod}
|
||||
chownprog=${CHOWNPROG-chown}
|
||||
cmpprog=${CMPPROG-cmp}
|
||||
cpprog=${CPPROG-cp}
|
||||
mkdirprog=${MKDIRPROG-mkdir}
|
||||
mvprog=${MVPROG-mv}
|
||||
rmprog=${RMPROG-rm}
|
||||
stripprog=${STRIPPROG-strip}
|
||||
|
||||
posix_mkdir=
|
||||
|
||||
# Desired mode of installed file.
|
||||
mode=0755
|
||||
|
||||
# Create dirs (including intermediate dirs) using mode 755.
|
||||
# This is like GNU 'install' as of coreutils 8.32 (2020).
|
||||
mkdir_umask=22
|
||||
|
||||
backupsuffix=
|
||||
chgrpcmd=
|
||||
chmodcmd=$chmodprog
|
||||
chowncmd=
|
||||
mvcmd=$mvprog
|
||||
rmcmd="$rmprog -f"
|
||||
stripcmd=
|
||||
|
||||
src=
|
||||
dst=
|
||||
dir_arg=
|
||||
dst_arg=
|
||||
|
||||
copy_on_change=false
|
||||
is_target_a_directory=possibly
|
||||
|
||||
usage="\
|
||||
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||
or: $0 [OPTION]... -d DIRECTORIES...
|
||||
|
||||
In the 1st form, copy SRCFILE to DSTFILE.
|
||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
||||
In the 4th, create DIRECTORIES.
|
||||
|
||||
Options:
|
||||
--help display this help and exit.
|
||||
--version display version info and exit.
|
||||
|
||||
-c (ignored)
|
||||
-C install only if different (preserve data modification time)
|
||||
-d create directories instead of installing files.
|
||||
-g GROUP $chgrpprog installed files to GROUP.
|
||||
-m MODE $chmodprog installed files to MODE.
|
||||
-o USER $chownprog installed files to USER.
|
||||
-p pass -p to $cpprog.
|
||||
-s $stripprog installed files.
|
||||
-S SUFFIX attempt to back up existing files, with suffix SUFFIX.
|
||||
-t DIRECTORY install into DIRECTORY.
|
||||
-T report an error if DSTFILE is a directory.
|
||||
|
||||
Environment variables override the default commands:
|
||||
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
|
||||
RMPROG STRIPPROG
|
||||
|
||||
By default, rm is invoked with -f; when overridden with RMPROG,
|
||||
it's up to you to specify -f if you want it.
|
||||
|
||||
If -S is not specified, no backups are attempted.
|
||||
|
||||
Email bug reports to bug-automake@gnu.org.
|
||||
Automake home page: https://www.gnu.org/software/automake/
|
||||
"
|
||||
|
||||
while test $# -ne 0; do
|
||||
case $1 in
|
||||
-c) ;;
|
||||
|
||||
-C) copy_on_change=true;;
|
||||
|
||||
-d) dir_arg=true;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift;;
|
||||
|
||||
--help) echo "$usage"; exit $?;;
|
||||
|
||||
-m) mode=$2
|
||||
case $mode in
|
||||
*' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
|
||||
echo "$0: invalid mode: $mode" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift;;
|
||||
|
||||
-p) cpprog="$cpprog -p";;
|
||||
|
||||
-s) stripcmd=$stripprog;;
|
||||
|
||||
-S) backupsuffix="$2"
|
||||
shift;;
|
||||
|
||||
-t)
|
||||
is_target_a_directory=always
|
||||
dst_arg=$2
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-T) is_target_a_directory=never;;
|
||||
|
||||
--version) echo "$0 $scriptversion"; exit $?;;
|
||||
|
||||
--) shift
|
||||
break;;
|
||||
|
||||
-*) echo "$0: invalid option: $1" >&2
|
||||
exit 1;;
|
||||
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# We allow the use of options -d and -T together, by making -d
|
||||
# take the precedence; this is for compatibility with GNU install.
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
if test -n "$dst_arg"; then
|
||||
echo "$0: target directory not allowed when installing a directory." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
||||
# When -d is used, all remaining arguments are directories to create.
|
||||
# When -t is used, the destination is already specified.
|
||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||
for arg
|
||||
do
|
||||
if test -n "$dst_arg"; then
|
||||
# $@ is not empty: it contains at least $arg.
|
||||
set fnord "$@" "$dst_arg"
|
||||
shift # fnord
|
||||
fi
|
||||
shift # arg
|
||||
dst_arg=$arg
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
if test $# -eq 0; then
|
||||
if test -z "$dir_arg"; then
|
||||
echo "$0: no input file specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
# It's OK to call 'install-sh -d' without argument.
|
||||
# This can happen when creating conditional directories.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
if test $# -gt 1 || test "$is_target_a_directory" = always; then
|
||||
if test ! -d "$dst_arg"; then
|
||||
echo "$0: $dst_arg: Is not a directory." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
do_exit='(exit $ret); exit $ret'
|
||||
trap "ret=129; $do_exit" 1
|
||||
trap "ret=130; $do_exit" 2
|
||||
trap "ret=141; $do_exit" 13
|
||||
trap "ret=143; $do_exit" 15
|
||||
|
||||
# Set umask so as not to create temps with too-generous modes.
|
||||
# However, 'strip' requires both read and write access to temps.
|
||||
case $mode in
|
||||
# Optimize common cases.
|
||||
*644) cp_umask=133;;
|
||||
*755) cp_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw='% 200'
|
||||
fi
|
||||
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
|
||||
*)
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw=,u+rw
|
||||
fi
|
||||
cp_umask=$mode$u_plus_rw;;
|
||||
esac
|
||||
fi
|
||||
|
||||
for src
|
||||
do
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $src in
|
||||
-* | [=\(\)!]) src=./$src;;
|
||||
esac
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
dst=$src
|
||||
dstdir=$dst
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
# Don't chown directories that already exist.
|
||||
if test $dstdir_status = 0; then
|
||||
chowncmd=""
|
||||
fi
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
if test ! -f "$src" && test ! -d "$src"; then
|
||||
echo "$0: $src does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$dst_arg"; then
|
||||
echo "$0: no destination specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
dst=$dst_arg
|
||||
|
||||
# If destination is a directory, append the input filename.
|
||||
if test -d "$dst"; then
|
||||
if test "$is_target_a_directory" = never; then
|
||||
echo "$0: $dst_arg: Is a directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
dstdir=$dst
|
||||
dstbase=`basename "$src"`
|
||||
case $dst in
|
||||
*/) dst=$dst$dstbase;;
|
||||
*) dst=$dst/$dstbase;;
|
||||
esac
|
||||
dstdir_status=0
|
||||
else
|
||||
dstdir=`dirname "$dst"`
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
fi
|
||||
fi
|
||||
|
||||
case $dstdir in
|
||||
*/) dstdirslash=$dstdir;;
|
||||
*) dstdirslash=$dstdir/;;
|
||||
esac
|
||||
|
||||
obsolete_mkdir_used=false
|
||||
|
||||
if test $dstdir_status != 0; then
|
||||
case $posix_mkdir in
|
||||
'')
|
||||
# With -d, create the new directory with the user-specified mode.
|
||||
# Otherwise, rely on $mkdir_umask.
|
||||
if test -n "$dir_arg"; then
|
||||
mkdir_mode=-m$mode
|
||||
else
|
||||
mkdir_mode=
|
||||
fi
|
||||
|
||||
posix_mkdir=false
|
||||
# The $RANDOM variable is not portable (e.g., dash). Use it
|
||||
# here however when possible just to lower collision chance.
|
||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
||||
|
||||
trap '
|
||||
ret=$?
|
||||
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null
|
||||
exit $ret
|
||||
' 0
|
||||
|
||||
# Because "mkdir -p" follows existing symlinks and we likely work
|
||||
# directly in world-writeable /tmp, make sure that the '$tmpdir'
|
||||
# directory is successfully created first before we actually test
|
||||
# 'mkdir -p'.
|
||||
if (umask $mkdir_umask &&
|
||||
$mkdirprog $mkdir_mode "$tmpdir" &&
|
||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
|
||||
then
|
||||
if test -z "$dir_arg" || {
|
||||
# Check for POSIX incompatibilities with -m.
|
||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
||||
# other-writable bit of parent directory when it shouldn't.
|
||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
||||
test_tmpdir="$tmpdir/a"
|
||||
ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
|
||||
case $ls_ld_tmpdir in
|
||||
d????-?r-*) different_mode=700;;
|
||||
d????-?--*) different_mode=755;;
|
||||
*) false;;
|
||||
esac &&
|
||||
$mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
|
||||
ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
|
||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
||||
}
|
||||
}
|
||||
then posix_mkdir=:
|
||||
fi
|
||||
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
|
||||
else
|
||||
# Remove any dirs left behind by ancient mkdir implementations.
|
||||
rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
|
||||
fi
|
||||
trap '' 0;;
|
||||
esac
|
||||
|
||||
if
|
||||
$posix_mkdir && (
|
||||
umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
|
||||
)
|
||||
then :
|
||||
else
|
||||
|
||||
# mkdir does not conform to POSIX,
|
||||
# or it failed possibly due to a race condition. Create the
|
||||
# directory the slow way, step by step, checking for races as we go.
|
||||
|
||||
case $dstdir in
|
||||
/*) prefix='/';;
|
||||
[-=\(\)!]*) prefix='./';;
|
||||
*) prefix='';;
|
||||
esac
|
||||
|
||||
oIFS=$IFS
|
||||
IFS=/
|
||||
set -f
|
||||
set fnord $dstdir
|
||||
shift
|
||||
set +f
|
||||
IFS=$oIFS
|
||||
|
||||
prefixes=
|
||||
|
||||
for d
|
||||
do
|
||||
test X"$d" = X && continue
|
||||
|
||||
prefix=$prefix$d
|
||||
if test -d "$prefix"; then
|
||||
prefixes=
|
||||
else
|
||||
if $posix_mkdir; then
|
||||
(umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
|
||||
# Don't fail if two instances are running concurrently.
|
||||
test -d "$prefix" || exit 1
|
||||
else
|
||||
case $prefix in
|
||||
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
|
||||
*) qprefix=$prefix;;
|
||||
esac
|
||||
prefixes="$prefixes '$qprefix'"
|
||||
fi
|
||||
fi
|
||||
prefix=$prefix/
|
||||
done
|
||||
|
||||
if test -n "$prefixes"; then
|
||||
# Don't fail if two instances are running concurrently.
|
||||
(umask $mkdir_umask &&
|
||||
eval "\$doit_exec \$mkdirprog $prefixes") ||
|
||||
test -d "$dstdir" || exit 1
|
||||
obsolete_mkdir_used=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
|
||||
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
|
||||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
|
||||
else
|
||||
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
dsttmp=${dstdirslash}_inst.$$_
|
||||
rmtmp=${dstdirslash}_rm.$$_
|
||||
|
||||
# Trap to clean up those temp files at exit.
|
||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
||||
|
||||
# Copy the file name to the temp name.
|
||||
(umask $cp_umask &&
|
||||
{ test -z "$stripcmd" || {
|
||||
# Create $dsttmp read-write so that cp doesn't create it read-only,
|
||||
# which would cause strip to fail.
|
||||
if test -z "$doit"; then
|
||||
: >"$dsttmp" # No need to fork-exec 'touch'.
|
||||
else
|
||||
$doit touch "$dsttmp"
|
||||
fi
|
||||
}
|
||||
} &&
|
||||
$doit_exec $cpprog "$src" "$dsttmp") &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits.
|
||||
#
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
||||
#
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
|
||||
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
|
||||
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
|
||||
|
||||
# If -C, don't bother to copy if it wouldn't change the file.
|
||||
if $copy_on_change &&
|
||||
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
||||
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
||||
set -f &&
|
||||
set X $old && old=:$2:$4:$5:$6 &&
|
||||
set X $new && new=:$2:$4:$5:$6 &&
|
||||
set +f &&
|
||||
test "$old" = "$new" &&
|
||||
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||
then
|
||||
rm -f "$dsttmp"
|
||||
else
|
||||
# If $backupsuffix is set, and the file being installed
|
||||
# already exists, attempt a backup. Don't worry if it fails,
|
||||
# e.g., if mv doesn't support -f.
|
||||
if test -n "$backupsuffix" && test -f "$dst"; then
|
||||
$doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null
|
||||
fi
|
||||
|
||||
# Rename the file to the real destination.
|
||||
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
|
||||
|
||||
# The rename failed, perhaps because mv can't rename something else
|
||||
# to itself, or perhaps because mv is so ancient that it does not
|
||||
# support -f.
|
||||
{
|
||||
# Now remove or move aside any old file at destination location.
|
||||
# We try this two ways since rm can't unlink itself on some
|
||||
# systems and the destination file might be busy for other
|
||||
# reasons. In this case, the final cleanup might fail but the new
|
||||
# file should still install successfully.
|
||||
{
|
||||
test ! -f "$dst" ||
|
||||
$doit $rmcmd "$dst" 2>/dev/null ||
|
||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
||||
{ $doit $rmcmd "$rmtmp" 2>/dev/null; :; }
|
||||
} ||
|
||||
{ echo "$0: cannot unlink or rename $dst" >&2
|
||||
(exit 1); exit 1
|
||||
}
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$doit $mvcmd "$dsttmp" "$dst"
|
||||
}
|
||||
fi || exit 1
|
||||
|
||||
trap '' 0
|
||||
fi
|
||||
done
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
215
missing
215
missing
@ -1,215 +0,0 @@
|
||||
#! /bin/sh
|
||||
# Common wrapper for a few potentially missing GNU programs.
|
||||
|
||||
scriptversion=2018-03-07.03; # UTC
|
||||
|
||||
# Copyright (C) 1996-2020 Free Software Foundation, Inc.
|
||||
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo 1>&2 "Try '$0 --help' for more information"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case $1 in
|
||||
|
||||
--is-lightweight)
|
||||
# Used by our autoconf macros to check whether the available missing
|
||||
# script is modern enough.
|
||||
exit 0
|
||||
;;
|
||||
|
||||
--run)
|
||||
# Back-compat with the calling convention used by older automake.
|
||||
shift
|
||||
;;
|
||||
|
||||
-h|--h|--he|--hel|--help)
|
||||
echo "\
|
||||
$0 [OPTION]... PROGRAM [ARGUMENT]...
|
||||
|
||||
Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
|
||||
to PROGRAM being missing or too old.
|
||||
|
||||
Options:
|
||||
-h, --help display this help and exit
|
||||
-v, --version output version information and exit
|
||||
|
||||
Supported PROGRAM values:
|
||||
aclocal autoconf autoheader autom4te automake makeinfo
|
||||
bison yacc flex lex help2man
|
||||
|
||||
Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
|
||||
'g' are ignored when checking the name.
|
||||
|
||||
Send bug reports to <bug-automake@gnu.org>."
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
|
||||
echo "missing $scriptversion (GNU Automake)"
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-*)
|
||||
echo 1>&2 "$0: unknown '$1' option"
|
||||
echo 1>&2 "Try '$0 --help' for more information"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
# Run the given program, remember its exit status.
|
||||
"$@"; st=$?
|
||||
|
||||
# If it succeeded, we are done.
|
||||
test $st -eq 0 && exit 0
|
||||
|
||||
# Also exit now if we it failed (or wasn't found), and '--version' was
|
||||
# passed; such an option is passed most likely to detect whether the
|
||||
# program is present and works.
|
||||
case $2 in --version|--help) exit $st;; esac
|
||||
|
||||
# Exit code 63 means version mismatch. This often happens when the user
|
||||
# tries to use an ancient version of a tool on a file that requires a
|
||||
# minimum version.
|
||||
if test $st -eq 63; then
|
||||
msg="probably too old"
|
||||
elif test $st -eq 127; then
|
||||
# Program was missing.
|
||||
msg="missing on your system"
|
||||
else
|
||||
# Program was found and executed, but failed. Give up.
|
||||
exit $st
|
||||
fi
|
||||
|
||||
perl_URL=https://www.perl.org/
|
||||
flex_URL=https://github.com/westes/flex
|
||||
gnu_software_URL=https://www.gnu.org/software
|
||||
|
||||
program_details ()
|
||||
{
|
||||
case $1 in
|
||||
aclocal|automake)
|
||||
echo "The '$1' program is part of the GNU Automake package:"
|
||||
echo "<$gnu_software_URL/automake>"
|
||||
echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
|
||||
echo "<$gnu_software_URL/autoconf>"
|
||||
echo "<$gnu_software_URL/m4/>"
|
||||
echo "<$perl_URL>"
|
||||
;;
|
||||
autoconf|autom4te|autoheader)
|
||||
echo "The '$1' program is part of the GNU Autoconf package:"
|
||||
echo "<$gnu_software_URL/autoconf/>"
|
||||
echo "It also requires GNU m4 and Perl in order to run:"
|
||||
echo "<$gnu_software_URL/m4/>"
|
||||
echo "<$perl_URL>"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
give_advice ()
|
||||
{
|
||||
# Normalize program name to check for.
|
||||
normalized_program=`echo "$1" | sed '
|
||||
s/^gnu-//; t
|
||||
s/^gnu//; t
|
||||
s/^g//; t'`
|
||||
|
||||
printf '%s\n' "'$1' is $msg."
|
||||
|
||||
configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
|
||||
case $normalized_program in
|
||||
autoconf*)
|
||||
echo "You should only need it if you modified 'configure.ac',"
|
||||
echo "or m4 files included by it."
|
||||
program_details 'autoconf'
|
||||
;;
|
||||
autoheader*)
|
||||
echo "You should only need it if you modified 'acconfig.h' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'autoheader'
|
||||
;;
|
||||
automake*)
|
||||
echo "You should only need it if you modified 'Makefile.am' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'automake'
|
||||
;;
|
||||
aclocal*)
|
||||
echo "You should only need it if you modified 'acinclude.m4' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'aclocal'
|
||||
;;
|
||||
autom4te*)
|
||||
echo "You might have modified some maintainer files that require"
|
||||
echo "the 'autom4te' program to be rebuilt."
|
||||
program_details 'autom4te'
|
||||
;;
|
||||
bison*|yacc*)
|
||||
echo "You should only need it if you modified a '.y' file."
|
||||
echo "You may want to install the GNU Bison package:"
|
||||
echo "<$gnu_software_URL/bison/>"
|
||||
;;
|
||||
lex*|flex*)
|
||||
echo "You should only need it if you modified a '.l' file."
|
||||
echo "You may want to install the Fast Lexical Analyzer package:"
|
||||
echo "<$flex_URL>"
|
||||
;;
|
||||
help2man*)
|
||||
echo "You should only need it if you modified a dependency" \
|
||||
"of a man page."
|
||||
echo "You may want to install the GNU Help2man package:"
|
||||
echo "<$gnu_software_URL/help2man/>"
|
||||
;;
|
||||
makeinfo*)
|
||||
echo "You should only need it if you modified a '.texi' file, or"
|
||||
echo "any other file indirectly affecting the aspect of the manual."
|
||||
echo "You might want to install the Texinfo package:"
|
||||
echo "<$gnu_software_URL/texinfo/>"
|
||||
echo "The spurious makeinfo call might also be the consequence of"
|
||||
echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
|
||||
echo "want to install GNU make:"
|
||||
echo "<$gnu_software_URL/make/>"
|
||||
;;
|
||||
*)
|
||||
echo "You might have modified some files without having the proper"
|
||||
echo "tools for further handling them. Check the 'README' file, it"
|
||||
echo "often tells you about the needed prerequisites for installing"
|
||||
echo "this package. You may also peek at any GNU archive site, in"
|
||||
echo "case some other package contains this missing '$1' program."
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
give_advice "$1" | sed -e '1s/^/WARNING: /' \
|
||||
-e '2,$s/^/ /' >&2
|
||||
|
||||
# Propagate the correct exit status (expected to be 127 for a program
|
||||
# not found, 63 for a program that failed due to version mismatch).
|
||||
exit $st
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
13
src/.gitignore
vendored
Normal file
13
src/.gitignore
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
*.o
|
||||
builtins.[ch]
|
||||
builtins.def
|
||||
dash
|
||||
init.c
|
||||
mkinit
|
||||
mknodes
|
||||
mksignames
|
||||
mksyntax
|
||||
nodes.[ch]
|
||||
signames.c
|
||||
syntax.[ch]
|
||||
token.h
|
||||
835
src/Makefile.in
835
src/Makefile.in
@ -1,835 +0,0 @@
|
||||
# Makefile.in generated by automake 1.16.3 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2020 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# 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.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||
"target option '$${target_option-}' specified" >&2; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
has_opt=no; \
|
||||
sane_makeflags=$$MAKEFLAGS; \
|
||||
if $(am__is_gnu_make); then \
|
||||
sane_makeflags=$$MFLAGS; \
|
||||
else \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
bs=\\; \
|
||||
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||
esac; \
|
||||
fi; \
|
||||
skip_next=no; \
|
||||
strip_trailopt () \
|
||||
{ \
|
||||
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||
}; \
|
||||
for flg in $$sane_makeflags; do \
|
||||
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||
case $$flg in \
|
||||
*=*|--*) continue;; \
|
||||
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||
-*I?*) strip_trailopt 'I';; \
|
||||
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||
-*O?*) strip_trailopt 'O';; \
|
||||
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||
-*l?*) strip_trailopt 'l';; \
|
||||
-[dEDm]) skip_next=yes;; \
|
||||
-[JT]) skip_next=yes;; \
|
||||
esac; \
|
||||
case $$flg in \
|
||||
*$$target_option*) has_opt=yes; break;; \
|
||||
esac; \
|
||||
done; \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
bin_PROGRAMS = dash$(EXEEXT)
|
||||
subdir = src
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
|
||||
PROGRAMS = $(bin_PROGRAMS)
|
||||
am__dirstamp = $(am__leading_dot)dirstamp
|
||||
am__objects_1 = alias.$(OBJEXT) arith_yacc.$(OBJEXT) \
|
||||
arith_yylex.$(OBJEXT) cd.$(OBJEXT) error.$(OBJEXT) \
|
||||
eval.$(OBJEXT) exec.$(OBJEXT) expand.$(OBJEXT) \
|
||||
histedit.$(OBJEXT) input.$(OBJEXT) jobs.$(OBJEXT) \
|
||||
mail.$(OBJEXT) main.$(OBJEXT) memalloc.$(OBJEXT) \
|
||||
miscbltin.$(OBJEXT) mystring.$(OBJEXT) options.$(OBJEXT) \
|
||||
parser.$(OBJEXT) redir.$(OBJEXT) show.$(OBJEXT) trap.$(OBJEXT) \
|
||||
output.$(OBJEXT) bltin/printf.$(OBJEXT) system.$(OBJEXT) \
|
||||
bltin/test.$(OBJEXT) bltin/times.$(OBJEXT) var.$(OBJEXT)
|
||||
am_dash_OBJECTS = $(am__objects_1)
|
||||
dash_OBJECTS = $(am_dash_OBJECTS)
|
||||
dash_DEPENDENCIES = builtins.o init.o nodes.o signames.o syntax.o
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||
am__v_P_0 = false
|
||||
am__v_P_1 = :
|
||||
AM_V_GEN = $(am__v_GEN_@AM_V@)
|
||||
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
am__v_GEN_1 =
|
||||
AM_V_at = $(am__v_at_@AM_V@)
|
||||
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
|
||||
am__v_at_0 = @
|
||||
am__v_at_1 =
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__maybe_remake_depfiles = depfiles
|
||||
am__depfiles_remade = ./$(DEPDIR)/alias.Po ./$(DEPDIR)/arith_yacc.Po \
|
||||
./$(DEPDIR)/arith_yylex.Po ./$(DEPDIR)/cd.Po \
|
||||
./$(DEPDIR)/error.Po ./$(DEPDIR)/eval.Po ./$(DEPDIR)/exec.Po \
|
||||
./$(DEPDIR)/expand.Po ./$(DEPDIR)/histedit.Po \
|
||||
./$(DEPDIR)/input.Po ./$(DEPDIR)/jobs.Po ./$(DEPDIR)/mail.Po \
|
||||
./$(DEPDIR)/main.Po ./$(DEPDIR)/memalloc.Po \
|
||||
./$(DEPDIR)/miscbltin.Po ./$(DEPDIR)/mystring.Po \
|
||||
./$(DEPDIR)/options.Po ./$(DEPDIR)/output.Po \
|
||||
./$(DEPDIR)/parser.Po ./$(DEPDIR)/redir.Po ./$(DEPDIR)/show.Po \
|
||||
./$(DEPDIR)/system.Po ./$(DEPDIR)/trap.Po ./$(DEPDIR)/var.Po \
|
||||
bltin/$(DEPDIR)/printf.Po bltin/$(DEPDIR)/test.Po \
|
||||
bltin/$(DEPDIR)/times.Po
|
||||
am__mv = mv -f
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
AM_V_CC = $(am__v_CC_@AM_V@)
|
||||
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
|
||||
am__v_CC_0 = @echo " CC " $@;
|
||||
am__v_CC_1 =
|
||||
CCLD = $(CC)
|
||||
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
|
||||
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
|
||||
am__v_CCLD_0 = @echo " CCLD " $@;
|
||||
am__v_CCLD_1 =
|
||||
SOURCES = $(dash_SOURCES)
|
||||
DIST_SOURCES = $(dash_SOURCES)
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
*) f=$$p;; \
|
||||
esac;
|
||||
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
|
||||
am__install_max = 40
|
||||
am__nobase_strip_setup = \
|
||||
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
|
||||
am__nobase_strip = \
|
||||
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
|
||||
am__nobase_list = $(am__nobase_strip_setup); \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
|
||||
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
|
||||
if (++n[$$2] == $(am__install_max)) \
|
||||
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
|
||||
END { for (dir in files) print dir, files[dir] }'
|
||||
am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
am__uninstall_files_from_dir = { \
|
||||
test -z "$$files" \
|
||||
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|
||||
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
|
||||
$(am__cd) "$$dir" && rm -f $$files; }; \
|
||||
}
|
||||
man1dir = $(mandir)/man1
|
||||
NROFF = nroff
|
||||
MANS = $(man_MANS)
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||
# Read a list of newline-separated strings from the standard input,
|
||||
# and print each of them once, without duplicates. Input order is
|
||||
# *not* preserved.
|
||||
am__uniquify_input = $(AWK) '\
|
||||
BEGIN { nonempty = 0; } \
|
||||
{ items[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in items) print i; }; } \
|
||||
'
|
||||
# Make sure the list of sources is unique. This is necessary because,
|
||||
# e.g., the same source file might be shared among _SOURCES variables
|
||||
# for different programs/libraries.
|
||||
am__define_uniq_tagged_files = \
|
||||
list='$(am__tagged_files)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | $(am__uniquify_input)`
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CC_FOR_BUILD = @CC_FOR_BUILD@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
GREP = @GREP@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build_alias = @build_alias@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host_alias = @host_alias@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
runstatedir = @runstatedir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
AM_YFLAGS = -d
|
||||
COMMON_CFLAGS = -Wall
|
||||
COMMON_CPPFLAGS = \
|
||||
-DBSD=1 -DSHELL
|
||||
|
||||
AM_CFLAGS = $(COMMON_CFLAGS)
|
||||
AM_CPPFLAGS = -include $(top_builddir)/config.h $(COMMON_CPPFLAGS)
|
||||
AM_CFLAGS_FOR_BUILD = -g -O2 $(COMMON_CFLAGS)
|
||||
AM_CPPFLAGS_FOR_BUILD = $(COMMON_CPPFLAGS)
|
||||
COMPILE_FOR_BUILD = \
|
||||
$(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(AM_CPPFLAGS_FOR_BUILD) \
|
||||
$(CPPFLAGS_FOR_BUILD) \
|
||||
$(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD)
|
||||
|
||||
dash_CFILES = \
|
||||
alias.c arith_yacc.c arith_yylex.c cd.c error.c eval.c exec.c expand.c \
|
||||
histedit.c input.c jobs.c mail.c main.c memalloc.c miscbltin.c \
|
||||
mystring.c options.c parser.c redir.c show.c trap.c output.c \
|
||||
bltin/printf.c system.c bltin/test.c bltin/times.c var.c
|
||||
|
||||
dash_SOURCES = \
|
||||
$(dash_CFILES) \
|
||||
alias.h arith_yacc.h bltin/bltin.h cd.h error.h eval.h exec.h \
|
||||
expand.h \
|
||||
init.h input.h jobs.h machdep.h mail.h main.h memalloc.h miscbltin.h \
|
||||
myhistedit.h mystring.h options.h output.h parser.h redir.h shell.h \
|
||||
show.h system.h trap.h var.h
|
||||
|
||||
dash_LDADD = builtins.o init.o nodes.o signames.o syntax.o
|
||||
HELPERS = mkinit mksyntax mknodes mksignames
|
||||
BUILT_SOURCES = builtins.h nodes.h syntax.h token.h token_vars.h
|
||||
CLEANFILES = \
|
||||
$(BUILT_SOURCES) $(patsubst %.o,%.c,$(dash_LDADD)) \
|
||||
$(HELPERS) builtins.def
|
||||
|
||||
man_MANS = dash.1
|
||||
EXTRA_DIST = \
|
||||
$(man_MANS) \
|
||||
mktokens mkbuiltins builtins.def.in mkinit.c \
|
||||
mknodes.c nodetypes nodes.c.pat mksyntax.c mksignames.c
|
||||
|
||||
all: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .o .obj
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign src/Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
install-binPROGRAMS: $(bin_PROGRAMS)
|
||||
@$(NORMAL_INSTALL)
|
||||
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
|
||||
if test -n "$$list"; then \
|
||||
echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
|
||||
fi; \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed 's/$(EXEEXT)$$//' | \
|
||||
while read p p1; do if test -f $$p \
|
||||
; then echo "$$p"; echo "$$p"; else :; fi; \
|
||||
done | \
|
||||
sed -e 'p;s,.*/,,;n;h' \
|
||||
-e 's|.*|.|' \
|
||||
-e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
|
||||
sed 'N;N;N;s,\n, ,g' | \
|
||||
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
|
||||
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
|
||||
if ($$2 == $$4) files[d] = files[d] " " $$1; \
|
||||
else { print "f", $$3 "/" $$4, $$1; } } \
|
||||
END { for (d in files) print "f", d, files[d] }' | \
|
||||
while read type dir files; do \
|
||||
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
|
||||
test -z "$$files" || { \
|
||||
echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
|
||||
$(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
|
||||
} \
|
||||
; done
|
||||
|
||||
uninstall-binPROGRAMS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
|
||||
files=`for p in $$list; do echo "$$p"; done | \
|
||||
sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
|
||||
-e 's/$$/$(EXEEXT)/' \
|
||||
`; \
|
||||
test -n "$$list" || exit 0; \
|
||||
echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(bindir)" && rm -f $$files
|
||||
|
||||
clean-binPROGRAMS:
|
||||
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
|
||||
bltin/$(am__dirstamp):
|
||||
@$(MKDIR_P) bltin
|
||||
@: > bltin/$(am__dirstamp)
|
||||
bltin/$(DEPDIR)/$(am__dirstamp):
|
||||
@$(MKDIR_P) bltin/$(DEPDIR)
|
||||
@: > bltin/$(DEPDIR)/$(am__dirstamp)
|
||||
bltin/printf.$(OBJEXT): bltin/$(am__dirstamp) \
|
||||
bltin/$(DEPDIR)/$(am__dirstamp)
|
||||
bltin/test.$(OBJEXT): bltin/$(am__dirstamp) \
|
||||
bltin/$(DEPDIR)/$(am__dirstamp)
|
||||
bltin/times.$(OBJEXT): bltin/$(am__dirstamp) \
|
||||
bltin/$(DEPDIR)/$(am__dirstamp)
|
||||
|
||||
dash$(EXEEXT): $(dash_OBJECTS) $(dash_DEPENDENCIES) $(EXTRA_dash_DEPENDENCIES)
|
||||
@rm -f dash$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(dash_OBJECTS) $(dash_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
-rm -f bltin/*.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alias.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arith_yacc.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arith_yylex.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cd.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eval.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exec.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/expand.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/histedit.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/input.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jobs.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mail.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memalloc.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/miscbltin.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mystring.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/options.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/output.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parser.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/redir.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/show.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/system.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trap.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/var.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@bltin/$(DEPDIR)/printf.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@bltin/$(DEPDIR)/test.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@bltin/$(DEPDIR)/times.Po@am__quote@ # am--include-marker
|
||||
|
||||
$(am__depfiles_remade):
|
||||
@$(MKDIR_P) $(@D)
|
||||
@echo '# dummy' >$@-t && $(am__mv) $@-t $@
|
||||
|
||||
am--depfiles: $(am__depfiles_remade)
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
|
||||
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
|
||||
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
install-man1: $(man_MANS)
|
||||
@$(NORMAL_INSTALL)
|
||||
@list1=''; \
|
||||
list2='$(man_MANS)'; \
|
||||
test -n "$(man1dir)" \
|
||||
&& test -n "`echo $$list1$$list2`" \
|
||||
|| exit 0; \
|
||||
echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \
|
||||
{ for i in $$list1; do echo "$$i"; done; \
|
||||
if test -n "$$list2"; then \
|
||||
for i in $$list2; do echo "$$i"; done \
|
||||
| sed -n '/\.1[a-z]*$$/p'; \
|
||||
fi; \
|
||||
} | while read p; do \
|
||||
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; echo "$$p"; \
|
||||
done | \
|
||||
sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
|
||||
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
|
||||
sed 'N;N;s,\n, ,g' | { \
|
||||
list=; while read file base inst; do \
|
||||
if test "$$base" = "$$inst"; then list="$$list $$file"; else \
|
||||
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
|
||||
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \
|
||||
fi; \
|
||||
done; \
|
||||
for i in $$list; do echo "$$i"; done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
test -z "$$files" || { \
|
||||
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \
|
||||
$(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \
|
||||
done; }
|
||||
|
||||
uninstall-man1:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list=''; test -n "$(man1dir)" || exit 0; \
|
||||
files=`{ for i in $$list; do echo "$$i"; done; \
|
||||
l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
|
||||
sed -n '/\.1[a-z]*$$/p'; \
|
||||
} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
|
||||
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
|
||||
dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir)
|
||||
|
||||
ID: $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); mkid -fID $$unique
|
||||
tags: tags-am
|
||||
TAGS: tags
|
||||
|
||||
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
$(am__define_uniq_tagged_files); \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: ctags-am
|
||||
|
||||
CTAGS: ctags
|
||||
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
cscopelist: cscopelist-am
|
||||
|
||||
cscopelist-am: $(am__tagged_files)
|
||||
list='$(am__tagged_files)'; \
|
||||
case "$(srcdir)" in \
|
||||
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
|
||||
*) sdir=$(subdir)/$(srcdir) ;; \
|
||||
esac; \
|
||||
for i in $$list; do \
|
||||
if test -f "$$i"; then \
|
||||
echo "$(subdir)/$$i"; \
|
||||
else \
|
||||
echo "$$sdir/$$i"; \
|
||||
fi; \
|
||||
done >> $(top_builddir)/cscope.files
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) distdir-am
|
||||
|
||||
distdir-am: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) check-am
|
||||
all-am: Makefile $(PROGRAMS) $(MANS)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) install-am
|
||||
install-exec: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
-rm -f bltin/$(DEPDIR)/$(am__dirstamp)
|
||||
-rm -f bltin/$(am__dirstamp)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f ./$(DEPDIR)/alias.Po
|
||||
-rm -f ./$(DEPDIR)/arith_yacc.Po
|
||||
-rm -f ./$(DEPDIR)/arith_yylex.Po
|
||||
-rm -f ./$(DEPDIR)/cd.Po
|
||||
-rm -f ./$(DEPDIR)/error.Po
|
||||
-rm -f ./$(DEPDIR)/eval.Po
|
||||
-rm -f ./$(DEPDIR)/exec.Po
|
||||
-rm -f ./$(DEPDIR)/expand.Po
|
||||
-rm -f ./$(DEPDIR)/histedit.Po
|
||||
-rm -f ./$(DEPDIR)/input.Po
|
||||
-rm -f ./$(DEPDIR)/jobs.Po
|
||||
-rm -f ./$(DEPDIR)/mail.Po
|
||||
-rm -f ./$(DEPDIR)/main.Po
|
||||
-rm -f ./$(DEPDIR)/memalloc.Po
|
||||
-rm -f ./$(DEPDIR)/miscbltin.Po
|
||||
-rm -f ./$(DEPDIR)/mystring.Po
|
||||
-rm -f ./$(DEPDIR)/options.Po
|
||||
-rm -f ./$(DEPDIR)/output.Po
|
||||
-rm -f ./$(DEPDIR)/parser.Po
|
||||
-rm -f ./$(DEPDIR)/redir.Po
|
||||
-rm -f ./$(DEPDIR)/show.Po
|
||||
-rm -f ./$(DEPDIR)/system.Po
|
||||
-rm -f ./$(DEPDIR)/trap.Po
|
||||
-rm -f ./$(DEPDIR)/var.Po
|
||||
-rm -f bltin/$(DEPDIR)/printf.Po
|
||||
-rm -f bltin/$(DEPDIR)/test.Po
|
||||
-rm -f bltin/$(DEPDIR)/times.Po
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-man
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am: install-binPROGRAMS
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man: install-man1
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f ./$(DEPDIR)/alias.Po
|
||||
-rm -f ./$(DEPDIR)/arith_yacc.Po
|
||||
-rm -f ./$(DEPDIR)/arith_yylex.Po
|
||||
-rm -f ./$(DEPDIR)/cd.Po
|
||||
-rm -f ./$(DEPDIR)/error.Po
|
||||
-rm -f ./$(DEPDIR)/eval.Po
|
||||
-rm -f ./$(DEPDIR)/exec.Po
|
||||
-rm -f ./$(DEPDIR)/expand.Po
|
||||
-rm -f ./$(DEPDIR)/histedit.Po
|
||||
-rm -f ./$(DEPDIR)/input.Po
|
||||
-rm -f ./$(DEPDIR)/jobs.Po
|
||||
-rm -f ./$(DEPDIR)/mail.Po
|
||||
-rm -f ./$(DEPDIR)/main.Po
|
||||
-rm -f ./$(DEPDIR)/memalloc.Po
|
||||
-rm -f ./$(DEPDIR)/miscbltin.Po
|
||||
-rm -f ./$(DEPDIR)/mystring.Po
|
||||
-rm -f ./$(DEPDIR)/options.Po
|
||||
-rm -f ./$(DEPDIR)/output.Po
|
||||
-rm -f ./$(DEPDIR)/parser.Po
|
||||
-rm -f ./$(DEPDIR)/redir.Po
|
||||
-rm -f ./$(DEPDIR)/show.Po
|
||||
-rm -f ./$(DEPDIR)/system.Po
|
||||
-rm -f ./$(DEPDIR)/trap.Po
|
||||
-rm -f ./$(DEPDIR)/var.Po
|
||||
-rm -f bltin/$(DEPDIR)/printf.Po
|
||||
-rm -f bltin/$(DEPDIR)/test.Po
|
||||
-rm -f bltin/$(DEPDIR)/times.Po
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-binPROGRAMS uninstall-man
|
||||
|
||||
uninstall-man: uninstall-man1
|
||||
|
||||
.MAKE: all check install install-am install-exec install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
|
||||
clean-binPROGRAMS clean-generic cscopelist-am ctags ctags-am \
|
||||
distclean distclean-compile distclean-generic distclean-tags \
|
||||
distdir dvi dvi-am html html-am info info-am install \
|
||||
install-am install-binPROGRAMS install-data install-data-am \
|
||||
install-dvi install-dvi-am install-exec install-exec-am \
|
||||
install-html install-html-am install-info install-info-am \
|
||||
install-man install-man1 install-pdf install-pdf-am install-ps \
|
||||
install-ps-am install-strip installcheck installcheck-am \
|
||||
installdirs maintainer-clean maintainer-clean-generic \
|
||||
mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \
|
||||
ps ps-am tags tags-am uninstall uninstall-am \
|
||||
uninstall-binPROGRAMS uninstall-man uninstall-man1
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
token.h token_vars.h: mktokens
|
||||
$(AM_V_GEN)$(SHELL) $^
|
||||
|
||||
builtins.def: builtins.def.in $(top_builddir)/config.h
|
||||
$(AM_V_CC)$(COMPILE) -E -x c -o $@ $<
|
||||
|
||||
builtins.c builtins.h: mkbuiltins builtins.def
|
||||
$(AM_V_GEN)$(SHELL) $^
|
||||
|
||||
init.c: mkinit $(dash_CFILES)
|
||||
$(AM_V_GEN)./$^
|
||||
|
||||
nodes.c nodes.h: mknodes nodetypes nodes.c.pat
|
||||
$(AM_V_GEN)./$^
|
||||
|
||||
syntax.c syntax.h: mksyntax
|
||||
$(AM_V_GEN)./$^
|
||||
|
||||
signames.c: mksignames
|
||||
$(AM_V_GEN)./$^
|
||||
|
||||
mksyntax: token.h
|
||||
|
||||
$(HELPERS): %: %.c
|
||||
$(AM_V_CC)$(COMPILE_FOR_BUILD) -o $@ $<
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
343
src/TOUR
Normal file
343
src/TOUR
Normal file
@ -0,0 +1,343 @@
|
||||
# @(#)TOUR 8.1 (Berkeley) 5/31/93
|
||||
|
||||
NOTE -- This is the original TOUR paper distributed with ash and
|
||||
does not represent the current state of the shell. It is provided anyway
|
||||
since it provides helpful information for how the shell is structured,
|
||||
but be warned that things have changed -- the current shell is
|
||||
still under development.
|
||||
|
||||
================================================================
|
||||
|
||||
A Tour through Ash
|
||||
|
||||
Copyright 1989 by Kenneth Almquist.
|
||||
|
||||
|
||||
DIRECTORIES: The subdirectory bltin contains commands which can
|
||||
be compiled stand-alone. The rest of the source is in the main
|
||||
ash directory.
|
||||
|
||||
SOURCE CODE GENERATORS: Files whose names begin with "mk" are
|
||||
programs that generate source code. A complete list of these
|
||||
programs is:
|
||||
|
||||
program intput files generates
|
||||
------- ------------ ---------
|
||||
mkbuiltins builtins builtins.h builtins.c
|
||||
mkinit *.c init.c
|
||||
mknodes nodetypes nodes.h nodes.c
|
||||
mksignames - signames.h signames.c
|
||||
mksyntax - syntax.h syntax.c
|
||||
mktokens - token.h
|
||||
bltin/mkexpr unary_op binary_op operators.h operators.c
|
||||
|
||||
There are undoubtedly too many of these. Mkinit searches all the
|
||||
C source files for entries looking like:
|
||||
|
||||
INIT {
|
||||
x = 1; /* executed during initialization */
|
||||
}
|
||||
|
||||
RESET {
|
||||
x = 2; /* executed when the shell does a longjmp
|
||||
back to the main command loop */
|
||||
}
|
||||
|
||||
It pulls this code out into routines which are when particular
|
||||
events occur. The intent is to improve modularity by isolating
|
||||
the information about which modules need to be explicitly
|
||||
initialized/reset within the modules themselves.
|
||||
|
||||
Mkinit recognizes several constructs for placing declarations in
|
||||
the init.c file.
|
||||
INCLUDE "file.h"
|
||||
includes a file. The storage class MKINIT makes a declaration
|
||||
available in the init.c file, for example:
|
||||
MKINIT int funcnest; /* depth of function calls */
|
||||
MKINIT alone on a line introduces a structure or union declara-
|
||||
tion:
|
||||
MKINIT
|
||||
struct redirtab {
|
||||
short renamed[10];
|
||||
};
|
||||
Preprocessor #define statements are copied to init.c without any
|
||||
special action to request this.
|
||||
|
||||
INDENTATION: The ash source is indented in multiples of six
|
||||
spaces. The only study that I have heard of on the subject con-
|
||||
cluded that the optimal amount to indent is in the range of four
|
||||
to six spaces. I use six spaces since it is not too big a jump
|
||||
from the widely used eight spaces. If you really hate six space
|
||||
indentation, use the adjind (source included) program to change
|
||||
it to something else.
|
||||
|
||||
EXCEPTIONS: Code for dealing with exceptions appears in
|
||||
exceptions.c. The C language doesn't include exception handling,
|
||||
so I implement it using setjmp and longjmp. The global variable
|
||||
exception contains the type of exception. EXERROR is raised by
|
||||
calling error. EXINT is an interrupt.
|
||||
|
||||
INTERRUPTS: In an interactive shell, an interrupt will cause an
|
||||
EXINT exception to return to the main command loop. (Exception:
|
||||
EXINT is not raised if the user traps interrupts using the trap
|
||||
command.) The INTOFF and INTON macros (defined in exception.h)
|
||||
provide uninterruptable critical sections. Between the execution
|
||||
of INTOFF and the execution of INTON, interrupt signals will be
|
||||
held for later delivery. INTOFF and INTON can be nested.
|
||||
|
||||
MEMALLOC.C: Memalloc.c defines versions of malloc and realloc
|
||||
which call error when there is no memory left. It also defines a
|
||||
stack oriented memory allocation scheme. Allocating off a stack
|
||||
is probably more efficient than allocation using malloc, but the
|
||||
big advantage is that when an exception occurs all we have to do
|
||||
to free up the memory in use at the time of the exception is to
|
||||
restore the stack pointer. The stack is implemented using a
|
||||
linked list of blocks.
|
||||
|
||||
STPUTC: If the stack were contiguous, it would be easy to store
|
||||
strings on the stack without knowing in advance how long the
|
||||
string was going to be:
|
||||
p = stackptr;
|
||||
*p++ = c; /* repeated as many times as needed */
|
||||
stackptr = p;
|
||||
The following three macros (defined in memalloc.h) perform these
|
||||
operations, but grow the stack if you run off the end:
|
||||
STARTSTACKSTR(p);
|
||||
STPUTC(c, p); /* repeated as many times as needed */
|
||||
grabstackstr(p);
|
||||
|
||||
We now start a top-down look at the code:
|
||||
|
||||
MAIN.C: The main routine performs some initialization, executes
|
||||
the user's profile if necessary, and calls cmdloop. Cmdloop is
|
||||
repeatedly parses and executes commands.
|
||||
|
||||
OPTIONS.C: This file contains the option processing code. It is
|
||||
called from main to parse the shell arguments when the shell is
|
||||
invoked, and it also contains the set builtin. The -i and -j op-
|
||||
tions (the latter turns on job control) require changes in signal
|
||||
handling. The routines setjobctl (in jobs.c) and setinteractive
|
||||
(in trap.c) are called to handle changes to these options.
|
||||
|
||||
PARSING: The parser code is all in parser.c. A recursive des-
|
||||
cent parser is used. Syntax tables (generated by mksyntax) are
|
||||
used to classify characters during lexical analysis. There are
|
||||
three tables: one for normal use, one for use when inside single
|
||||
quotes, and one for use when inside double quotes. The tables
|
||||
are machine dependent because they are indexed by character vari-
|
||||
ables and the range of a char varies from machine to machine.
|
||||
|
||||
PARSE OUTPUT: The output of the parser consists of a tree of
|
||||
nodes. The various types of nodes are defined in the file node-
|
||||
types.
|
||||
|
||||
Nodes of type NARG are used to represent both words and the con-
|
||||
tents of here documents. An early version of ash kept the con-
|
||||
tents of here documents in temporary files, but keeping here do-
|
||||
cuments in memory typically results in significantly better per-
|
||||
formance. It would have been nice to make it an option to use
|
||||
temporary files for here documents, for the benefit of small
|
||||
machines, but the code to keep track of when to delete the tem-
|
||||
porary files was complex and I never fixed all the bugs in it.
|
||||
(AT&T has been maintaining the Bourne shell for more than ten
|
||||
years, and to the best of my knowledge they still haven't gotten
|
||||
it to handle temporary files correctly in obscure cases.)
|
||||
|
||||
The text field of a NARG structure points to the text of the
|
||||
word. The text consists of ordinary characters and a number of
|
||||
special codes defined in parser.h. The special codes are:
|
||||
|
||||
CTLVAR Variable substitution
|
||||
CTLENDVAR End of variable substitution
|
||||
CTLBACKQ Command substitution
|
||||
CTLESC Escape next character
|
||||
|
||||
A variable substitution contains the following elements:
|
||||
|
||||
CTLVAR type name '=' [ alternative-text CTLENDVAR ]
|
||||
|
||||
The type field is a single character specifying the type of sub-
|
||||
stitution. The possible types are:
|
||||
|
||||
VSNORMAL $var
|
||||
VSMINUS ${var-text}
|
||||
VSMINUS|VSNUL ${var:-text}
|
||||
VSPLUS ${var+text}
|
||||
VSPLUS|VSNUL ${var:+text}
|
||||
VSQUESTION ${var?text}
|
||||
VSQUESTION|VSNUL ${var:?text}
|
||||
VSASSIGN ${var=text}
|
||||
VSASSIGN|VSNUL ${var=text}
|
||||
|
||||
The name of the variable comes next, terminated by an equals
|
||||
sign. If the type is not VSNORMAL, then the text field in the
|
||||
substitution follows, terminated by a CTLENDVAR byte.
|
||||
|
||||
Commands in back quotes are parsed and stored in a linked list.
|
||||
The locations of these commands in the string are indicated by
|
||||
the CTLBACKQ character.
|
||||
|
||||
The character CTLESC escapes the next character, so that in case
|
||||
any of the CTL characters mentioned above appear in the input,
|
||||
they can be passed through transparently. CTLESC is also used to
|
||||
escape '*', '?', '[', and '!' characters which were quoted by the
|
||||
user and thus should not be used for file name generation.
|
||||
|
||||
CTLESC characters have proved to be particularly tricky to get
|
||||
right. In the case of here documents which are not subject to
|
||||
variable and command substitution, the parser doesn't insert any
|
||||
CTLESC characters to begin with (so the contents of the text
|
||||
field can be written without any processing). Other here docu-
|
||||
ments, and words which are not subject to splitting and file name
|
||||
generation, have the CTLESC characters removed during the vari-
|
||||
able and command substitution phase. Words which are subject
|
||||
splitting and file name generation have the CTLESC characters re-
|
||||
moved as part of the file name phase.
|
||||
|
||||
EXECUTION: Command execution is handled by the following files:
|
||||
eval.c The top level routines.
|
||||
redir.c Code to handle redirection of input and output.
|
||||
jobs.c Code to handle forking, waiting, and job control.
|
||||
exec.c Code to path searches and the actual exec sys call.
|
||||
expand.c Code to evaluate arguments.
|
||||
var.c Maintains the variable symbol table. Called from expand.c.
|
||||
|
||||
EVAL.C: Evaltree recursively executes a parse tree. The exit
|
||||
status is returned in the global variable exitstatus. The alter-
|
||||
native entry evalbackcmd is called to evaluate commands in back
|
||||
quotes. It saves the result in memory if the command is a buil-
|
||||
tin; otherwise it forks off a child to execute the command and
|
||||
connects the standard output of the child to a pipe.
|
||||
|
||||
JOBS.C: To create a process, you call makejob to return a job
|
||||
structure, and then call forkshell (passing the job structure as
|
||||
an argument) to create the process. Waitforjob waits for a job
|
||||
to complete. These routines take care of process groups if job
|
||||
control is defined.
|
||||
|
||||
REDIR.C: Ash allows file descriptors to be redirected and then
|
||||
restored without forking off a child process. This is accom-
|
||||
plished by duplicating the original file descriptors. The redir-
|
||||
tab structure records where the file descriptors have be dupli-
|
||||
cated to.
|
||||
|
||||
EXEC.C: The routine find_command locates a command, and enters
|
||||
the command in the hash table if it is not already there. The
|
||||
third argument specifies whether it is to print an error message
|
||||
if the command is not found. (When a pipeline is set up,
|
||||
find_command is called for all the commands in the pipeline be-
|
||||
fore any forking is done, so to get the commands into the hash
|
||||
table of the parent process. But to make command hashing as
|
||||
transparent as possible, we silently ignore errors at that point
|
||||
and only print error messages if the command cannot be found
|
||||
later.)
|
||||
|
||||
The routine shellexec is the interface to the exec system call.
|
||||
|
||||
EXPAND.C: Arguments are processed in three passes. The first
|
||||
(performed by the routine argstr) performs variable and command
|
||||
substitution. The second (ifsbreakup) performs word splitting
|
||||
and the third (expandmeta) performs file name generation. If the
|
||||
"/u" directory is simulated, then when "/u/username" is replaced
|
||||
by the user's home directory, the flag "didudir" is set. This
|
||||
tells the cd command that it should print out the directory name,
|
||||
just as it would if the "/u" directory were implemented using
|
||||
symbolic links.
|
||||
|
||||
VAR.C: Variables are stored in a hash table. Probably we should
|
||||
switch to extensible hashing. The variable name is stored in the
|
||||
same string as the value (using the format "name=value") so that
|
||||
no string copying is needed to create the environment of a com-
|
||||
mand. Variables which the shell references internally are preal-
|
||||
located so that the shell can reference the values of these vari-
|
||||
ables without doing a lookup.
|
||||
|
||||
When a program is run, the code in eval.c sticks any environment
|
||||
variables which precede the command (as in "PATH=xxx command") in
|
||||
the variable table as the simplest way to strip duplicates, and
|
||||
then calls "environment" to get the value of the environment.
|
||||
There are two consequences of this. First, if an assignment to
|
||||
PATH precedes the command, the value of PATH before the assign-
|
||||
ment must be remembered and passed to shellexec. Second, if the
|
||||
program turns out to be a shell procedure, the strings from the
|
||||
environment variables which preceded the command must be pulled
|
||||
out of the table and replaced with strings obtained from malloc,
|
||||
since the former will automatically be freed when the stack (see
|
||||
the entry on memalloc.c) is emptied.
|
||||
|
||||
BUILTIN COMMANDS: The procedures for handling these are scat-
|
||||
tered throughout the code, depending on which location appears
|
||||
most appropriate. They can be recognized because their names al-
|
||||
ways end in "cmd". The mapping from names to procedures is
|
||||
specified in the file builtins, which is processed by the mkbuil-
|
||||
tins command.
|
||||
|
||||
A builtin command is invoked with argc and argv set up like a
|
||||
normal program. A builtin command is allowed to overwrite its
|
||||
arguments. Builtin routines can call nextopt to do option pars-
|
||||
ing. This is kind of like getopt, but you don't pass argc and
|
||||
argv to it. Builtin routines can also call error. This routine
|
||||
normally terminates the shell (or returns to the main command
|
||||
loop if the shell is interactive), but when called from a builtin
|
||||
command it causes the builtin command to terminate with an exit
|
||||
status of 2.
|
||||
|
||||
The directory bltins contains commands which can be compiled in-
|
||||
dependently but can also be built into the shell for efficiency
|
||||
reasons. The makefile in this directory compiles these programs
|
||||
in the normal fashion (so that they can be run regardless of
|
||||
whether the invoker is ash), but also creates a library named
|
||||
bltinlib.a which can be linked with ash. The header file bltin.h
|
||||
takes care of most of the differences between the ash and the
|
||||
stand-alone environment. The user should call the main routine
|
||||
"main", and #define main to be the name of the routine to use
|
||||
when the program is linked into ash. This #define should appear
|
||||
before bltin.h is included; bltin.h will #undef main if the pro-
|
||||
gram is to be compiled stand-alone.
|
||||
|
||||
CD.C: This file defines the cd and pwd builtins. The pwd com-
|
||||
mand runs /bin/pwd the first time it is invoked (unless the user
|
||||
has already done a cd to an absolute pathname), but then
|
||||
remembers the current directory and updates it when the cd com-
|
||||
mand is run, so subsequent pwd commands run very fast. The main
|
||||
complication in the cd command is in the docd command, which
|
||||
resolves symbolic links into actual names and informs the user
|
||||
where the user ended up if he crossed a symbolic link.
|
||||
|
||||
SIGNALS: Trap.c implements the trap command. The routine set-
|
||||
signal figures out what action should be taken when a signal is
|
||||
received and invokes the signal system call to set the signal ac-
|
||||
tion appropriately. When a signal that a user has set a trap for
|
||||
is caught, the routine "onsig" sets a flag. The routine dotrap
|
||||
is called at appropriate points to actually handle the signal.
|
||||
When an interrupt is caught and no trap has been set for that
|
||||
signal, the routine "onint" in error.c is called.
|
||||
|
||||
OUTPUT: Ash uses it's own output routines. There are three out-
|
||||
put structures allocated. "Output" represents the standard out-
|
||||
put, "errout" the standard error, and "memout" contains output
|
||||
which is to be stored in memory. This last is used when a buil-
|
||||
tin command appears in backquotes, to allow its output to be col-
|
||||
lected without doing any I/O through the UNIX operating system.
|
||||
The variables out1 and out2 normally point to output and errout,
|
||||
respectively, but they are set to point to memout when appropri-
|
||||
ate inside backquotes.
|
||||
|
||||
INPUT: The basic input routine is pgetc, which reads from the
|
||||
current input file. There is a stack of input files; the current
|
||||
input file is the top file on this stack. The code allows the
|
||||
input to come from a string rather than a file. (This is for the
|
||||
-c option and the "." and eval builtin commands.) The global
|
||||
variable plinno is saved and restored when files are pushed and
|
||||
popped from the stack. The parser routines store the number of
|
||||
the current line in this variable.
|
||||
|
||||
DEBUGGING: If DEBUG is defined in shell.h, then the shell will
|
||||
write debugging information to the file $HOME/trace. Most of
|
||||
this is done using the TRACE macro, which takes a set of printf
|
||||
arguments inside two sets of parenthesis. Example:
|
||||
"TRACE(("n=%d0, n))". The double parenthesis are necessary be-
|
||||
cause the preprocessor can't handle functions with a variable
|
||||
number of arguments. Defining DEBUG also causes the shell to
|
||||
generate a core dump if it is sent a quit signal. The tracing
|
||||
code is in show.c.
|
||||
47
src/alias.c
47
src/alias.c
@ -41,6 +41,8 @@
|
||||
#include "mystring.h"
|
||||
#include "alias.h"
|
||||
#include "options.h" /* XXX for argptr (should remove?) */
|
||||
#include "syntax.h"
|
||||
#include "var.h"
|
||||
|
||||
#define ATABSIZE 39
|
||||
|
||||
@ -55,25 +57,31 @@ void
|
||||
setalias(const char *name, const char *val)
|
||||
{
|
||||
struct alias *ap, **app;
|
||||
const char *p = name;
|
||||
size_t namelen;
|
||||
|
||||
do {
|
||||
if (BASESYNTAX[(signed char)*p] != CWORD)
|
||||
sh_error("Invalid alias name: %s", name);
|
||||
} while (*++p != '=');
|
||||
|
||||
app = __lookupalias(name);
|
||||
ap = *app;
|
||||
INTOFF;
|
||||
if (ap) {
|
||||
if (!(ap->flag & ALIASINUSE)) {
|
||||
ckfree(ap->val);
|
||||
}
|
||||
ap->val = savestr(val);
|
||||
if (!(ap->flag & ALIASINUSE))
|
||||
ckfree(ap->name);
|
||||
ap->flag &= ~ALIASDEAD;
|
||||
} else {
|
||||
/* not found */
|
||||
ap = ckmalloc(sizeof (struct alias));
|
||||
ap->name = savestr(name);
|
||||
ap->val = savestr(val);
|
||||
ap->flag = 0;
|
||||
ap->next = 0;
|
||||
*app = ap;
|
||||
}
|
||||
namelen = val - name;
|
||||
ap->name = savestr(name);
|
||||
ap->val = ap->name + namelen;
|
||||
INTON;
|
||||
}
|
||||
|
||||
@ -143,15 +151,15 @@ aliascmd(int argc, char **argv)
|
||||
return (0);
|
||||
}
|
||||
while ((n = *++argv) != NULL) {
|
||||
if ((v = strchr(n+1, '=')) == NULL) { /* n+1: funny ksh stuff */
|
||||
/* n + 1: funny ksh stuff (from 44lite) */
|
||||
if (!*n || !(v = strchr(n + 1, '='))) {
|
||||
if ((ap = *__lookupalias(n)) == NULL) {
|
||||
outfmt(out2, "%s: %s not found\n", "alias", n);
|
||||
ret = 1;
|
||||
} else
|
||||
printalias(ap);
|
||||
} else {
|
||||
*v++ = '\0';
|
||||
setalias(n, v);
|
||||
setalias(n, v + 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -190,35 +198,22 @@ freealias(struct alias *ap) {
|
||||
|
||||
next = ap->next;
|
||||
ckfree(ap->name);
|
||||
ckfree(ap->val);
|
||||
ckfree(ap);
|
||||
return next;
|
||||
}
|
||||
|
||||
void
|
||||
printalias(const struct alias *ap) {
|
||||
out1fmt("%s=%s\n", ap->name, single_quote(ap->val));
|
||||
void __attribute__((noinline)) printalias(const struct alias *ap) {
|
||||
out1fmt(snlfmt, single_quote(ap->name));
|
||||
}
|
||||
|
||||
STATIC struct alias **
|
||||
__lookupalias(const char *name) {
|
||||
unsigned int hashval;
|
||||
struct alias **app;
|
||||
const char *p;
|
||||
unsigned int ch;
|
||||
|
||||
p = name;
|
||||
|
||||
ch = (unsigned char)*p;
|
||||
hashval = ch << 4;
|
||||
while (ch) {
|
||||
hashval += ch;
|
||||
ch = (unsigned char)*++p;
|
||||
}
|
||||
app = &atab[hashval % ATABSIZE];
|
||||
app = &atab[hashval(name) % ATABSIZE];
|
||||
|
||||
for (; *app; app = &(*app)->next) {
|
||||
if (equal(name, (*app)->name)) {
|
||||
if (varequal(name, (*app)->name)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
111
src/bltin/echo.1
Normal file
111
src/bltin/echo.1
Normal file
@ -0,0 +1,111 @@
|
||||
.\" Copyright (c) 1991, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
.\" Copyright (c) 1997-2005
|
||||
.\" Herbert Xu <herbert@gondor.apana.org.au>. All rights reserved.
|
||||
.\"
|
||||
.\" This code is derived from software contributed to Berkeley by
|
||||
.\" Kenneth Almquist.
|
||||
.\" Copyright 1989 by Kenneth Almquist
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. Neither the name of the University nor the names of its contributors
|
||||
.\" may be used to endorse or promote products derived from this software
|
||||
.\" without specific prior written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)echo.1 8.1 (Berkeley) 5/31/93
|
||||
.\"
|
||||
.Dd May 31, 1993
|
||||
.Dt ECHO 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm echo
|
||||
.Nd produce message in a shell script
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl n | Fl e
|
||||
.Ar args ...
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
prints its arguments on the standard output, separated by spaces.
|
||||
Unless the
|
||||
.Fl n
|
||||
option is present, a newline is output following the arguments.
|
||||
The
|
||||
.Fl e
|
||||
option causes
|
||||
.Nm
|
||||
to treat the escape sequences specially, as described in the following
|
||||
paragraph.
|
||||
The
|
||||
.Fl e
|
||||
option is the default, and is provided solely for compatibility with
|
||||
other systems.
|
||||
Only one of the options
|
||||
.Fl n
|
||||
and
|
||||
.Fl e
|
||||
may be given.
|
||||
.Pp
|
||||
If any of the following sequences of characters is encountered during
|
||||
output, the sequence is not output.
|
||||
Instead, the specified action is
|
||||
performed:
|
||||
.Bl -tag -width indent
|
||||
.It Li \eb
|
||||
A backspace character is output.
|
||||
.It Li \ec
|
||||
Subsequent output is suppressed.
|
||||
This is normally used at the end of the
|
||||
last argument to suppress the trailing newline that
|
||||
.Nm
|
||||
would otherwise output.
|
||||
.It Li \ef
|
||||
Output a form feed.
|
||||
.It Li \en
|
||||
Output a newline character.
|
||||
.It Li \er
|
||||
Output a carriage return.
|
||||
.It Li \et
|
||||
Output a (horizontal) tab character.
|
||||
.It Li \ev
|
||||
Output a vertical tab.
|
||||
.It Li \e0 Ns Ar digits
|
||||
Output the character whose value is given by zero to three digits.
|
||||
If there are zero digits, a nul character is output.
|
||||
.It Li \e\e
|
||||
Output a backslash.
|
||||
.El
|
||||
.Sh HINTS
|
||||
Remember that backslash is special to the shell and needs to be escaped.
|
||||
To output a message to standard error, say
|
||||
.Pp
|
||||
.D1 echo message \*[Gt]\*[Am]2
|
||||
.Sh BUGS
|
||||
The octal character escape mechanism
|
||||
.Pq Li \e0 Ns Ar digits
|
||||
differs from the
|
||||
C language mechanism.
|
||||
.Pp
|
||||
There is no way to force
|
||||
.Nm
|
||||
to treat its arguments literally, rather than interpreting them as
|
||||
options and escape sequences.
|
||||
355
src/bltin/printf.1
Normal file
355
src/bltin/printf.1
Normal file
@ -0,0 +1,355 @@
|
||||
.\" Copyright (c) 1989, 1990, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
.\" Copyright (c) 1997-2005
|
||||
.\" Herbert Xu <herbert@gondor.apana.org.au>. All rights reserved.
|
||||
.\"
|
||||
.\" This code is derived from software contributed to Berkeley by
|
||||
.\" the Institute of Electrical and Electronics Engineers, Inc.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. Neither the name of the University nor the names of its contributors
|
||||
.\" may be used to endorse or promote products derived from this software
|
||||
.\" without specific prior written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" from: @(#)printf.1 8.1 (Berkeley) 6/6/93
|
||||
.\"
|
||||
.Dd November 5, 1993
|
||||
.Dt PRINTF 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm printf
|
||||
.Nd formatted output
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Ar format
|
||||
.Op Ar arguments ...
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
formats and prints its arguments, after the first, under control
|
||||
of the
|
||||
.Ar format .
|
||||
The
|
||||
.Ar format
|
||||
is a character string which contains three types of objects: plain characters,
|
||||
which are simply copied to standard output, character escape sequences which
|
||||
are converted and copied to the standard output, and format specifications,
|
||||
each of which causes printing of the next successive
|
||||
.Ar argument .
|
||||
.Pp
|
||||
The
|
||||
.Ar arguments
|
||||
after the first are treated as strings if the corresponding format is
|
||||
either
|
||||
.Cm b ,
|
||||
.Cm B ,
|
||||
.Cm c
|
||||
or
|
||||
.Cm s ;
|
||||
otherwise it is evaluated as a C constant, with the following extensions:
|
||||
.Pp
|
||||
.Bl -bullet -offset indent -compact
|
||||
.It
|
||||
A leading plus or minus sign is allowed.
|
||||
.It
|
||||
If the leading character is a single or double quote, the value is the
|
||||
.Tn ASCII
|
||||
code of the next character.
|
||||
.El
|
||||
.Pp
|
||||
The format string is reused as often as necessary to satisfy the
|
||||
.Ar arguments .
|
||||
Any extra format specifications are evaluated with zero or the null
|
||||
string.
|
||||
.Pp
|
||||
Character escape sequences are in backslash notation as defined in
|
||||
.St -ansiC .
|
||||
The characters and their meanings are as follows:
|
||||
.Bl -tag -width Ds -offset indent
|
||||
.It Cm \ee
|
||||
Write an \*[Lt]escape\*[Gt] character.
|
||||
.It Cm \ea
|
||||
Write a \*[Lt]bell\*[Gt] character.
|
||||
.It Cm \eb
|
||||
Write a \*[Lt]backspace\*[Gt] character.
|
||||
.It Cm \ef
|
||||
Write a \*[Lt]form-feed\*[Gt] character.
|
||||
.It Cm \en
|
||||
Write a \*[Lt]new-line\*[Gt] character.
|
||||
.It Cm \er
|
||||
Write a \*[Lt]carriage return\*[Gt] character.
|
||||
.It Cm \et
|
||||
Write a \*[Lt]tab\*[Gt] character.
|
||||
.It Cm \ev
|
||||
Write a \*[Lt]vertical tab\*[Gt] character.
|
||||
.It Cm \e\'
|
||||
Write a \*[Lt]single quote\*[Gt] character.
|
||||
.It Cm \e"
|
||||
Write a \*[Lt]double quote\*[Gt] character.
|
||||
.It Cm \e\e
|
||||
Write a backslash character.
|
||||
.It Cm \e Ns Ar num
|
||||
Write an 8\-bit character whose
|
||||
.Tn ASCII
|
||||
value is the 1\-, 2\-, or 3\-digit octal number
|
||||
.Ar num .
|
||||
.It Cm \ex Ns Ar xx
|
||||
Write an 8\-bit character whose
|
||||
.Tn ASCII
|
||||
value is the 1\- or 2\-digit hexadecimal number
|
||||
.Ar xx .
|
||||
.El
|
||||
.Pp
|
||||
Each format specification is introduced by the percent character
|
||||
(``%'').
|
||||
The remainder of the format specification includes,
|
||||
in the following order:
|
||||
.Bl -tag -width Ds
|
||||
.It "Zero or more of the following flags:"
|
||||
.Bl -tag -width Ds
|
||||
.It Cm #
|
||||
A `#' character
|
||||
specifying that the value should be printed in an ``alternative form''.
|
||||
For
|
||||
.Cm b ,
|
||||
.Cm c ,
|
||||
.Cm d ,
|
||||
and
|
||||
.Cm s
|
||||
formats, this option has no effect.
|
||||
For the
|
||||
.Cm o
|
||||
format the precision of the number is increased to force the first
|
||||
character of the output string to a zero.
|
||||
For the
|
||||
.Cm x
|
||||
.Pq Cm X
|
||||
format, a non-zero result has the string
|
||||
.Li 0x
|
||||
.Pq Li 0X
|
||||
prepended to it.
|
||||
For
|
||||
.Cm e ,
|
||||
.Cm E ,
|
||||
.Cm f ,
|
||||
.Cm g ,
|
||||
and
|
||||
.Cm G
|
||||
formats, the result will always contain a decimal point, even if no
|
||||
digits follow the point (normally, a decimal point only appears in the
|
||||
results of those formats if a digit follows the decimal point).
|
||||
For
|
||||
.Cm g
|
||||
and
|
||||
.Cm G
|
||||
formats, trailing zeros are not removed from the result as they
|
||||
would otherwise be.
|
||||
.\" I turned this off - decided it isn't a valid use of '#'
|
||||
.\" For the
|
||||
.\" .Cm B
|
||||
.\" format, backslash-escape sequences are expanded first;
|
||||
.It Cm \&\-
|
||||
A minus sign `\-' which specifies
|
||||
.Em left adjustment
|
||||
of the output in the indicated field;
|
||||
.It Cm \&+
|
||||
A `+' character specifying that there should always be
|
||||
a sign placed before the number when using signed formats.
|
||||
.It Sq \&\ \&
|
||||
A space specifying that a blank should be left before a positive number
|
||||
for a signed format.
|
||||
A `+' overrides a space if both are used;
|
||||
.It Cm \&0
|
||||
A zero `0' character indicating that zero-padding should be used
|
||||
rather than blank-padding.
|
||||
A `\-' overrides a `0' if both are used;
|
||||
.El
|
||||
.It "Field Width:"
|
||||
An optional digit string specifying a
|
||||
.Em field width ;
|
||||
if the output string has fewer characters than the field width it will
|
||||
be blank-padded on the left (or right, if the left-adjustment indicator
|
||||
has been given) to make up the field width (note that a leading zero
|
||||
is a flag, but an embedded zero is part of a field width);
|
||||
.It Precision :
|
||||
An optional period,
|
||||
.Sq Cm \&.\& ,
|
||||
followed by an optional digit string giving a
|
||||
.Em precision
|
||||
which specifies the number of digits to appear after the decimal point,
|
||||
for
|
||||
.Cm e
|
||||
and
|
||||
.Cm f
|
||||
formats, or the maximum number of characters to be printed
|
||||
from a string
|
||||
.Sm off
|
||||
.Pf ( Cm b Ns \&,
|
||||
.Sm on
|
||||
.Cm B
|
||||
and
|
||||
.Cm s
|
||||
formats); if the digit string is missing, the precision is treated
|
||||
as zero;
|
||||
.It Format :
|
||||
A character which indicates the type of format to use (one of
|
||||
.Cm diouxXfwEgGbBcs ) .
|
||||
.El
|
||||
.Pp
|
||||
A field width or precision may be
|
||||
.Sq Cm \&*
|
||||
instead of a digit string.
|
||||
In this case an
|
||||
.Ar argument
|
||||
supplies the field width or precision.
|
||||
.Pp
|
||||
The format characters and their meanings are:
|
||||
.Bl -tag -width Fl
|
||||
.It Cm diouXx
|
||||
The
|
||||
.Ar argument
|
||||
is printed as a signed decimal (d or i), unsigned octal, unsigned decimal,
|
||||
or unsigned hexadecimal (X or x), respectively.
|
||||
.It Cm f
|
||||
The
|
||||
.Ar argument
|
||||
is printed in the style
|
||||
.Sm off
|
||||
.Pf [\-]ddd Cm \&. No ddd
|
||||
.Sm on
|
||||
where the number of d's
|
||||
after the decimal point is equal to the precision specification for
|
||||
the argument.
|
||||
If the precision is missing, 6 digits are given; if the precision
|
||||
is explicitly 0, no digits and no decimal point are printed.
|
||||
.It Cm eE
|
||||
The
|
||||
.Ar argument
|
||||
is printed in the style
|
||||
.Sm off
|
||||
.Pf [\-]d Cm \&. No ddd Cm e No \\*(Pmdd
|
||||
.Sm on
|
||||
where there
|
||||
is one digit before the decimal point and the number after is equal to
|
||||
the precision specification for the argument; when the precision is
|
||||
missing, 6 digits are produced.
|
||||
An upper-case E is used for an `E' format.
|
||||
.It Cm gG
|
||||
The
|
||||
.Ar argument
|
||||
is printed in style
|
||||
.Cm f
|
||||
or in style
|
||||
.Cm e
|
||||
.Pq Cm E
|
||||
whichever gives full precision in minimum space.
|
||||
.It Cm b
|
||||
Characters from the string
|
||||
.Ar argument
|
||||
are printed with backslash-escape sequences expanded.
|
||||
.br
|
||||
The following additional backslash-escape sequences are supported:
|
||||
.Bl -tag -width Ds
|
||||
.It Cm \ec
|
||||
Causes
|
||||
.Nm
|
||||
to ignore any remaining characters in the string operand containing it,
|
||||
any remaining string operands, and any additional characters in
|
||||
the format operand.
|
||||
.It Cm \e0 Ns Ar num
|
||||
Write an 8\-bit character whose
|
||||
.Tn ASCII
|
||||
value is the 1\-, 2\-, or 3\-digit
|
||||
octal number
|
||||
.Ar num .
|
||||
.It Cm \e^ Ns Ar c
|
||||
Write the control character
|
||||
.Ar c .
|
||||
Generates characters `\e000' through `\e037`, and `\e177' (from `\e^?').
|
||||
.It Cm \eM\- Ns Ar c
|
||||
Write the character
|
||||
.Ar c
|
||||
with the 8th bit set.
|
||||
Generates characters `\e241' through `\e376`.
|
||||
.It Cm \eM^ Ns Ar c
|
||||
Write the control character
|
||||
.Ar c
|
||||
with the 8th bit set.
|
||||
Generates characters `\e000' through `\e037`, and `\e177' (from `\eM^?').
|
||||
.El
|
||||
.It Cm B
|
||||
Characters from the string
|
||||
.Ar argument
|
||||
are printed with unprintable characters backslash-escaped using the
|
||||
.Sm off
|
||||
.Pf ` Cm \e Ar c No ',
|
||||
.Pf ` Cm \e^ Ar c No ',
|
||||
.Pf ` Cm \eM\- Ar c No '
|
||||
or
|
||||
.Pf ` Cm \eM^ Ar c No ',
|
||||
.Sm on
|
||||
formats described above.
|
||||
.It Cm c
|
||||
The first character of
|
||||
.Ar argument
|
||||
is printed.
|
||||
.It Cm s
|
||||
Characters from the string
|
||||
.Ar argument
|
||||
are printed until the end is reached or until the number of characters
|
||||
indicated by the precision specification is reached; if the
|
||||
precision is omitted, all characters in the string are printed.
|
||||
.It Cm \&%
|
||||
Print a `%'; no argument is used.
|
||||
.El
|
||||
.Pp
|
||||
In no case does a non-existent or small field width cause truncation of
|
||||
a field; padding takes place only if the specified field width exceeds
|
||||
the actual width.
|
||||
.Sh EXIT STATUS
|
||||
.Nm
|
||||
exits 0 on success, 1 on failure.
|
||||
.Sh SEE ALSO
|
||||
.Xr echo 1 ,
|
||||
.Xr printf 3 ,
|
||||
.Xr printf 9 ,
|
||||
.Xr vis 3
|
||||
.Sh STANDARDS
|
||||
The
|
||||
.Nm
|
||||
utility conforms to
|
||||
.St -p1003.1-2001 .
|
||||
.Pp
|
||||
Support for the floating point formats and `*' as a field width and precision
|
||||
are optional in POSIX.
|
||||
.Pp
|
||||
The behaviour of the %B format and the \e', \e", \exxx, \ee and
|
||||
\e[M][\-|^]c escape sequences are undefined in POSIX.
|
||||
.Sh BUGS
|
||||
Since the floating point numbers are translated from
|
||||
.Tn ASCII
|
||||
to floating-point and
|
||||
then back again, floating-point precision may be lost.
|
||||
.Pp
|
||||
Hexadecimal character constants are restricted to, and should be specified
|
||||
as, two character constants.
|
||||
This is contrary to the ISO C standard but
|
||||
does guarantee detection of the end of the constant.
|
||||
309
src/bltin/test.1
Normal file
309
src/bltin/test.1
Normal file
@ -0,0 +1,309 @@
|
||||
.\" Copyright (c) 1991, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
.\" Copyright (c) 1997-2005
|
||||
.\" Herbert Xu <herbert@gondor.apana.org.au>. All rights reserved.
|
||||
.\"
|
||||
.\" This code is derived from software contributed to Berkeley by
|
||||
.\" the Institute of Electrical and Electronics Engineers, Inc.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. Neither the name of the University nor the names of its contributors
|
||||
.\" may be used to endorse or promote products derived from this software
|
||||
.\" without specific prior written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)test.1 8.1 (Berkeley) 5/31/93
|
||||
.\"
|
||||
.Dd May 31, 1993
|
||||
.Dt TEST 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm test ,
|
||||
.Nm \&[
|
||||
.Nd condition evaluation utility
|
||||
.Sh SYNOPSIS
|
||||
.Nm test
|
||||
.Ar expression
|
||||
.Nm \&[
|
||||
.Ar expression Cm \&]
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm test
|
||||
utility evaluates the expression and, if it evaluates
|
||||
to true, returns a zero (true) exit status; otherwise
|
||||
it returns 1 (false).
|
||||
If there is no expression, test also
|
||||
returns 1 (false).
|
||||
.Pp
|
||||
All operators and flags are separate arguments to the
|
||||
.Nm test
|
||||
utility.
|
||||
.Pp
|
||||
The following primaries are used to construct expression:
|
||||
.Bl -tag -width Ar
|
||||
.It Fl b Ar file
|
||||
True if
|
||||
.Ar file
|
||||
exists and is a block special
|
||||
file.
|
||||
.It Fl c Ar file
|
||||
True if
|
||||
.Ar file
|
||||
exists and is a character
|
||||
special file.
|
||||
.It Fl d Ar file
|
||||
True if
|
||||
.Ar file
|
||||
exists and is a directory.
|
||||
.It Fl e Ar file
|
||||
True if
|
||||
.Ar file
|
||||
exists (regardless of type).
|
||||
.It Fl f Ar file
|
||||
True if
|
||||
.Ar file
|
||||
exists and is a regular file.
|
||||
.It Fl g Ar file
|
||||
True if
|
||||
.Ar file
|
||||
exists and its set group ID flag
|
||||
is set.
|
||||
.It Fl h Ar file
|
||||
True if
|
||||
.Ar file
|
||||
exists and is a symbolic link.
|
||||
.It Fl k Ar file
|
||||
True if
|
||||
.Ar file
|
||||
exists and its sticky bit is set.
|
||||
.It Fl n Ar string
|
||||
True if the length of
|
||||
.Ar string
|
||||
is nonzero.
|
||||
.It Fl p Ar file
|
||||
True if
|
||||
.Ar file
|
||||
is a named pipe
|
||||
.Po Tn FIFO Pc .
|
||||
.It Fl r Ar file
|
||||
True if
|
||||
.Ar file
|
||||
exists and is readable.
|
||||
.It Fl s Ar file
|
||||
True if
|
||||
.Ar file
|
||||
exists and has a size greater
|
||||
than zero.
|
||||
.It Fl t Ar file_descriptor
|
||||
True if the file whose file descriptor number
|
||||
is
|
||||
.Ar file_descriptor
|
||||
is open and is associated with a terminal.
|
||||
.It Fl u Ar file
|
||||
True if
|
||||
.Ar file
|
||||
exists and its set user ID flag
|
||||
is set.
|
||||
.It Fl w Ar file
|
||||
True if
|
||||
.Ar file
|
||||
exists and is writable.
|
||||
True
|
||||
indicates only that the write flag is on.
|
||||
The file is not writable on a read-only file
|
||||
system even if this test indicates true.
|
||||
.It Fl x Ar file
|
||||
True if
|
||||
.Ar file
|
||||
exists and is executable.
|
||||
True
|
||||
indicates only that the execute flag is on.
|
||||
If
|
||||
.Ar file
|
||||
is a directory, true indicates that
|
||||
.Ar file
|
||||
can be searched.
|
||||
.It Fl z Ar string
|
||||
True if the length of
|
||||
.Ar string
|
||||
is zero.
|
||||
.It Fl L Ar file
|
||||
True if
|
||||
.Ar file
|
||||
exists and is a symbolic link.
|
||||
This operator is retained for compatibility with previous versions of
|
||||
this program.
|
||||
Do not rely on its existence; use
|
||||
.Fl h
|
||||
instead.
|
||||
.It Fl O Ar file
|
||||
True if
|
||||
.Ar file
|
||||
exists and its owner matches the effective user id of this process.
|
||||
.It Fl G Ar file
|
||||
True if
|
||||
.Ar file
|
||||
exists and its group matches the effective group id of this process.
|
||||
.It Fl S Ar file
|
||||
True if
|
||||
.Ar file
|
||||
exists and is a socket.
|
||||
.It Ar file1 Fl nt Ar file2
|
||||
True if
|
||||
.Ar file1
|
||||
exists and is newer than
|
||||
.Ar file2 .
|
||||
.It Ar file1 Fl ot Ar file2
|
||||
True if
|
||||
.Ar file1
|
||||
exists and is older than
|
||||
.Ar file2 .
|
||||
.It Ar file1 Fl ef Ar file2
|
||||
True if
|
||||
.Ar file1
|
||||
and
|
||||
.Ar file2
|
||||
exist and refer to the same file.
|
||||
.It Ar string
|
||||
True if
|
||||
.Ar string
|
||||
is not the null
|
||||
string.
|
||||
.It Ar \&s\&1 Cm \&= Ar \&s\&2
|
||||
True if the strings
|
||||
.Ar \&s\&1
|
||||
and
|
||||
.Ar \&s\&2
|
||||
are identical.
|
||||
.It Ar \&s\&1 Cm \&!= Ar \&s\&2
|
||||
True if the strings
|
||||
.Ar \&s\&1
|
||||
and
|
||||
.Ar \&s\&2
|
||||
are not identical.
|
||||
.It Ar \&s\&1 Cm \&\*[Lt] Ar \&s\&2
|
||||
True if string
|
||||
.Ar \&s\&1
|
||||
comes before
|
||||
.Ar \&s\&2
|
||||
based on the ASCII value of their characters.
|
||||
.It Ar \&s\&1 Cm \&\*[Gt] Ar \&s\&2
|
||||
True if string
|
||||
.Ar \&s\&1
|
||||
comes after
|
||||
.Ar \&s\&2
|
||||
based on the ASCII value of their characters.
|
||||
.It Ar \&n\&1 Fl \&eq Ar \&n\&2
|
||||
True if the integers
|
||||
.Ar \&n\&1
|
||||
and
|
||||
.Ar \&n\&2
|
||||
are algebraically
|
||||
equal.
|
||||
.It Ar \&n\&1 Fl \&ne Ar \&n\&2
|
||||
True if the integers
|
||||
.Ar \&n\&1
|
||||
and
|
||||
.Ar \&n\&2
|
||||
are not
|
||||
algebraically equal.
|
||||
.It Ar \&n\&1 Fl \> Ar \&n\&2
|
||||
True if the integer
|
||||
.Ar \&n\&1
|
||||
is algebraically
|
||||
greater than the integer
|
||||
.Ar \&n\&2 .
|
||||
.It Ar \&n\&1 Fl \&ge Ar \&n\&2
|
||||
True if the integer
|
||||
.Ar \&n\&1
|
||||
is algebraically
|
||||
greater than or equal to the integer
|
||||
.Ar \&n\&2 .
|
||||
.It Ar \&n\&1 Fl \< Ar \&n\&2
|
||||
True if the integer
|
||||
.Ar \&n\&1
|
||||
is algebraically less
|
||||
than the integer
|
||||
.Ar \&n\&2 .
|
||||
.It Ar \&n\&1 Fl \&le Ar \&n\&2
|
||||
True if the integer
|
||||
.Ar \&n\&1
|
||||
is algebraically less
|
||||
than or equal to the integer
|
||||
.Ar \&n\&2 .
|
||||
.El
|
||||
.Pp
|
||||
These primaries can be combined with the following operators:
|
||||
.Bl -tag -width Ar
|
||||
.It Cm \&! Ar expression
|
||||
True if
|
||||
.Ar expression
|
||||
is false.
|
||||
.It Ar expression1 Fl a Ar expression2
|
||||
True if both
|
||||
.Ar expression1
|
||||
and
|
||||
.Ar expression2
|
||||
are true.
|
||||
.It Ar expression1 Fl o Ar expression2
|
||||
True if either
|
||||
.Ar expression1
|
||||
or
|
||||
.Ar expression2
|
||||
are true.
|
||||
.It Cm \&( Ns Ar expression Ns Cm \&)
|
||||
True if expression is true.
|
||||
.El
|
||||
.Pp
|
||||
The
|
||||
.Fl a
|
||||
operator has higher precedence than the
|
||||
.Fl o
|
||||
operator.
|
||||
.Sh GRAMMAR AMBIGUITY
|
||||
The
|
||||
.Nm test
|
||||
grammar is inherently ambiguous.
|
||||
In order to assure a degree of consistency, the cases described in
|
||||
.St -p1003.2
|
||||
section 4.62.4,
|
||||
are evaluated consistently according to the rules specified in the
|
||||
standards document.
|
||||
All other cases are subject to the ambiguity in the command semantics.
|
||||
.Sh EXIT STATUS
|
||||
The
|
||||
.Nm test
|
||||
utility exits with one of the following values:
|
||||
.Bl -tag -width Ds
|
||||
.It 0
|
||||
expression evaluated to true.
|
||||
.It 1
|
||||
expression evaluated to false or expression was
|
||||
missing.
|
||||
.It \*[Gt]1
|
||||
An error occurred.
|
||||
.El
|
||||
.Sh STANDARDS
|
||||
The
|
||||
.Nm test
|
||||
utility implements a superset of the
|
||||
.St -p1003.2
|
||||
specification.
|
||||
@ -18,6 +18,7 @@
|
||||
#include <unistd.h>
|
||||
#include <stdarg.h>
|
||||
#include "bltin.h"
|
||||
#include "../exec.h"
|
||||
|
||||
/* test(1) accepts the following grammar:
|
||||
oexpr ::= aexpr | aexpr "-o" oexpr ;
|
||||
@ -148,11 +149,6 @@ static int isoperand(char **);
|
||||
static int newerf(const char *, const char *);
|
||||
static int olderf(const char *, const char *);
|
||||
static int equalf(const char *, const char *);
|
||||
#ifdef HAVE_FACCESSAT
|
||||
static int test_file_access(const char *, int);
|
||||
#else
|
||||
static int test_access(const struct stat64 *, int);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FACCESSAT
|
||||
# ifdef HAVE_TRADITIONAL_FACCESSAT
|
||||
@ -527,7 +523,7 @@ static int has_exec_bit_set(const char *path)
|
||||
return st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH);
|
||||
}
|
||||
|
||||
static int test_file_access(const char *path, int mode)
|
||||
int test_file_access(const char *path, int mode)
|
||||
{
|
||||
if (faccessat_confused_about_superuser() &&
|
||||
mode == X_OK && geteuid() == 0 && !has_exec_bit_set(path))
|
||||
@ -657,7 +653,7 @@ static int test_file_access(const char *path, int mode)
|
||||
* (euid==uid&&egid==gid), but uses st_mode for '-x' iff running as root.
|
||||
* i.e. it does strictly conform to 1003.1-2001 (and presumably 1003.2b).
|
||||
*/
|
||||
static int test_access(const struct stat64 *sp, int stmode)
|
||||
int test_access(const struct stat64 *sp, int stmode)
|
||||
{
|
||||
gid_t *groups;
|
||||
register int n;
|
||||
|
||||
153
src/dash.1
153
src/dash.1
@ -402,13 +402,11 @@ Append standard output (or n) to file.
|
||||
.It [n] Ns \*[Lt] file
|
||||
Redirect standard input (or n) from file.
|
||||
.It [n1] Ns \*[Lt]& Ns n2
|
||||
Copy file descriptor n2 as stdout (or fd n1).
|
||||
fd n2.
|
||||
Copy file descriptor n2 as stdin (or fd n1).
|
||||
.It [n] Ns \*[Lt]&-
|
||||
Close standard input (or n).
|
||||
.It [n1] Ns \*[Gt]& Ns n2
|
||||
Copy file descriptor n2 as stdin (or fd n1).
|
||||
fd n2.
|
||||
Copy file descriptor n2 as stdout (or fd n1).
|
||||
.It [n] Ns \*[Gt]&-
|
||||
Close standard output (or n).
|
||||
.It [n] Ns \*[Lt]\*[Gt] file
|
||||
@ -553,13 +551,17 @@ by redirection operators that are part of the command.
|
||||
If the pipeline is not in the background (discussed later), the shell
|
||||
waits for all commands to complete.
|
||||
.Pp
|
||||
If the reserved word ! does not precede the pipeline, the exit status is
|
||||
the exit status of the last command specified in the pipeline.
|
||||
Otherwise, the exit status is the logical NOT of the exit status of the
|
||||
last command.
|
||||
That is, if the last command returns zero, the exit status
|
||||
is 1; if the last command returns greater than zero, the exit status is
|
||||
zero.
|
||||
If the
|
||||
.Em pipefail
|
||||
option was enabled when the shell began execution of the pipeline, the
|
||||
pipeline's exit status is the exit status of the last command specified in
|
||||
the pipeline that exited with non-zero status, or zero if all commands in
|
||||
the pipeline exited with a status of zero. If the
|
||||
.Em pipefail
|
||||
option was not enabled, the pipeline's exit status is the exit status of
|
||||
the last command specified in the pipeline; the exit statuses of any other
|
||||
commands are not used. If the reserved word ! precedes the pipeline, its
|
||||
exit status is the logical NOT of the exit status described above.
|
||||
.Pp
|
||||
Because pipeline assignment of standard input or standard output or both
|
||||
takes place before redirection, it can be modified by redirection.
|
||||
@ -1021,6 +1023,19 @@ The shell treats each character of the
|
||||
.Ev IFS
|
||||
as a delimiter and uses the delimiters to split the results of parameter
|
||||
expansion and command substitution into fields.
|
||||
.Pp
|
||||
If
|
||||
.Ev IFS
|
||||
is empty, field splitting yields no fields if the input string was empty,
|
||||
and one string with the unchanged value of the input otherwise.
|
||||
For example, with the default
|
||||
.Ev IFS ,
|
||||
.Dq Ic read Fl r Ev l
|
||||
will remove any initial whitespace,
|
||||
but
|
||||
.Dq Ev IFS Ns = Ic read Fl r Ev l
|
||||
will leave the entire line in
|
||||
.Ev l .
|
||||
.Ss Pathname Expansion (File Name Generation)
|
||||
Unless the
|
||||
.Fl f
|
||||
@ -1095,6 +1110,8 @@ etc).
|
||||
.It :
|
||||
.It true
|
||||
A null command that returns a 0 (true) exit value.
|
||||
.It false
|
||||
A null command that returns a 1 (false) exit value.
|
||||
.It \&. file
|
||||
The commands in the specified file are read and executed by the shell.
|
||||
.It alias Op Ar name Ns Op Ar "=string ..."
|
||||
@ -1143,8 +1160,8 @@ Do not execute the command but
|
||||
search for the command and print the absolute pathname
|
||||
of utilities, the name for builtins or the expansion of aliases.
|
||||
.El
|
||||
.It cd Ar -
|
||||
.It Xo cd Op Fl LP
|
||||
.It cd|chdir Ar -
|
||||
.It Xo cd|chdir Op Fl LP
|
||||
.Op Ar directory
|
||||
.Xc
|
||||
Switch to the specified directory (default
|
||||
@ -1342,13 +1359,12 @@ The number of previous commands that are accessible.
|
||||
.El
|
||||
.It fg Op Ar job
|
||||
Move the specified job or the current job to the foreground.
|
||||
.It getopts Ar optstring var
|
||||
.It getopts Ar optstring var Op Ar arg ...
|
||||
The
|
||||
.Tn POSIX
|
||||
.Ic getopts
|
||||
command, not to be confused with the
|
||||
.Em Bell Labs
|
||||
-derived
|
||||
.Em Bell Labs Ns -derived
|
||||
.Xr getopt 1 .
|
||||
.Pp
|
||||
The first argument should be a series of letters, each of which may be
|
||||
@ -1386,6 +1402,12 @@ then
|
||||
.Ev OPTARG
|
||||
will be unset.
|
||||
.Pp
|
||||
By default, the variables
|
||||
.Va $1 , ... , $n
|
||||
are inspected; if
|
||||
.Ar arg Ns s
|
||||
are specified, they'll be parsed instead.
|
||||
.Pp
|
||||
.Va optstring
|
||||
is a string of recognized option letters (see
|
||||
.Xr getopt 3 ) .
|
||||
@ -1430,7 +1452,7 @@ do
|
||||
\\?) echo $USAGE; exit 1;;
|
||||
esac
|
||||
done
|
||||
shift `expr $OPTIND - 1`
|
||||
shift $((OPTIND - 1))
|
||||
.Ed
|
||||
.Pp
|
||||
This code will accept any of the following as equivalent:
|
||||
@ -1441,7 +1463,8 @@ cmd \-a \-c arg file file
|
||||
cmd \-carg -a file file
|
||||
cmd \-a \-carg \-\- file file
|
||||
.Ed
|
||||
.It hash Fl rv Ar command ...
|
||||
.It hash Op Ar command ...
|
||||
.It hash Fl r
|
||||
The shell maintains a hash table which remembers the
|
||||
locations of commands.
|
||||
With no arguments whatsoever,
|
||||
@ -1457,13 +1480,51 @@ With arguments, the
|
||||
.Ic hash
|
||||
command removes the specified commands from the hash table (unless
|
||||
they are functions) and then locates them.
|
||||
With the
|
||||
.Fl v
|
||||
option, hash prints the locations of the commands as it finds them.
|
||||
The
|
||||
.Fl r
|
||||
option causes the hash command to delete all the entries in the hash table
|
||||
except for functions.
|
||||
.It jobs Oo Fl lp Oc Op Ar job ...
|
||||
Display the status of all, or just the specified,
|
||||
.Ar job Ns s :
|
||||
.Bl -tag -compact -offset 5n -width "By default"
|
||||
.It By default
|
||||
display the job number, currency
|
||||
.Pq Sy +-
|
||||
status, if any, the job state, and its shell command.
|
||||
.It Fl l
|
||||
also output the PID of the group leader, and just the PID and shell commands
|
||||
of other members of the job.
|
||||
.It Fl p
|
||||
Display only leader PIDs, one per line.
|
||||
.El
|
||||
.It kill Oo Fl s Ar sigspec | Fl Ns Ar signum | Fl Ns Ar sigspec Oc Op Ar pid | job ...
|
||||
Equivalent to
|
||||
.Xr kill 1 ,
|
||||
but a
|
||||
.Ar job
|
||||
spec may also be specified.
|
||||
Signals can be either case-insensitive names without
|
||||
.Dv SIG
|
||||
prefixes or decimal numbers; the default is
|
||||
.Dv TERM .
|
||||
.It kill Fl l Op Ar signum | exitstatus
|
||||
List available signal names without the
|
||||
.Dv SIG
|
||||
prefix
|
||||
.Pq Ar sigspec Ns s .
|
||||
If
|
||||
.Ar signum
|
||||
specified, display just the
|
||||
.Ar sigspec
|
||||
for that signal.
|
||||
If
|
||||
.Ar exitstatus
|
||||
specified
|
||||
.Pq > Sy 128 ,
|
||||
display just the
|
||||
.Ar sigspec
|
||||
that caused it.
|
||||
.It pwd Op Fl LP
|
||||
builtin command remembers what the current directory
|
||||
is rather than recomputing it each time.
|
||||
@ -1528,41 +1589,36 @@ With the
|
||||
option specified the output will be formatted suitably for non-interactive use.
|
||||
.\".Pp
|
||||
.It Xo printf Ar format
|
||||
.Op Ar arguments ...
|
||||
.Oo Ar value Oc Ns ...
|
||||
.Xc
|
||||
.Ic printf
|
||||
formats and prints its arguments, after the first, under control
|
||||
of the
|
||||
.Ar format .
|
||||
The
|
||||
.Ar format
|
||||
is a character string which contains three types of objects: plain characters,
|
||||
formats and prints its arguments according to
|
||||
.Ar format ,
|
||||
a character string which contains three types of objects: plain characters,
|
||||
which are simply copied to standard output, character escape sequences which
|
||||
are converted and copied to the standard output, and format specifications,
|
||||
each of which causes printing of the next successive
|
||||
.Ar argument .
|
||||
.Ar value .
|
||||
.Pp
|
||||
The
|
||||
.Ar arguments
|
||||
after the first are treated as strings if the corresponding format is
|
||||
Each
|
||||
.Ar value
|
||||
is treated as a string if the corresponding format specification is
|
||||
either
|
||||
.Cm b ,
|
||||
.Cm c
|
||||
.Cm c ,
|
||||
or
|
||||
.Cm s ;
|
||||
otherwise it is evaluated as a C constant, with the following extensions:
|
||||
.Pp
|
||||
otherwise it is evaluated as a C constant, with the following additions:
|
||||
.Bl -bullet -offset indent -compact
|
||||
.It
|
||||
A leading plus or minus sign is allowed.
|
||||
.It
|
||||
If the leading character is a single or double quote, the value is the
|
||||
.Tn ASCII
|
||||
code of the next character.
|
||||
If the leading character is a single or double quote, the value of the next byte.
|
||||
.El
|
||||
.Pp
|
||||
The format string is reused as often as necessary to satisfy the
|
||||
.Ar arguments .
|
||||
The format string is reused as often as necessary until all
|
||||
.Ar value Ns s
|
||||
are consumed.
|
||||
Any extra format specifications are evaluated with zero or the null
|
||||
string.
|
||||
.Pp
|
||||
@ -1791,6 +1847,19 @@ if the option is +o,
|
||||
the settings are printed in a format suitable for
|
||||
reinput to the shell to affect the same option settings.
|
||||
.Pp
|
||||
In addition to the option names listed in the
|
||||
.Sx Argument List Processing
|
||||
section, the following options may be specified as arguments
|
||||
to -o or +o:
|
||||
.Bl -tag -width pipefail
|
||||
.It Em pipefail
|
||||
Derive the exit status of a pipeline from the exit statuses of all
|
||||
of the commands in the pipeline, not just the last command, as
|
||||
described in the
|
||||
.Sx Pipelines
|
||||
section.
|
||||
.El
|
||||
.Pp
|
||||
The third use of the set command is to set the values of the shell's
|
||||
positional parameters to the specified args.
|
||||
To change the positional
|
||||
@ -2121,7 +2190,7 @@ printed; for commands and tracked aliases the complete pathname of the
|
||||
command is printed.
|
||||
.It ulimit Xo
|
||||
.Op Fl H \*(Ba Fl S
|
||||
.Op Fl a \*(Ba Fl tfdscmlpnv Op Ar value
|
||||
.Op Fl a \*(Ba Fl tfdscmlpnvwr Op Ar value
|
||||
.Xc
|
||||
Inquire about or set the hard or soft limits on processes or set new
|
||||
limits.
|
||||
@ -2174,6 +2243,8 @@ show or set the limit on the number files a process can have open at once
|
||||
.It Fl v
|
||||
show or set the limit on the total virtual memory that can be
|
||||
in use by a process (in kilobytes)
|
||||
.It Fl w
|
||||
show or set the limit on the total number of locks held by a process
|
||||
.It Fl r
|
||||
show or set the limit on the real-time scheduling priority of a process
|
||||
.El
|
||||
|
||||
13
src/eval.c
13
src/eval.c
@ -491,11 +491,11 @@ evalsubshell(union node *n, int flags)
|
||||
expredir(n->nredir.redirect);
|
||||
INTOFF;
|
||||
if (!backgnd && flags & EV_EXIT && !have_traps()) {
|
||||
forkreset();
|
||||
forkreset(NULL);
|
||||
goto nofork;
|
||||
}
|
||||
jp = makejob(n, 1);
|
||||
if (forkshell(jp, n, backgnd) == 0) {
|
||||
jp = makejob(1);
|
||||
if (forkshell(jp, n->nredir.n, backgnd) == 0) {
|
||||
flags |= EV_EXIT;
|
||||
if (backgnd)
|
||||
flags &=~ EV_TESTED;
|
||||
@ -571,7 +571,7 @@ evalpipe(union node *n, int flags)
|
||||
pipelen++;
|
||||
flags |= EV_EXIT;
|
||||
INTOFF;
|
||||
jp = makejob(n, pipelen);
|
||||
jp = makejob(pipelen);
|
||||
prevfd = -1;
|
||||
for (lp = n->npipe.cmdlist ; lp ; lp = lp->next) {
|
||||
prehash(lp->n);
|
||||
@ -635,9 +635,8 @@ evalbackcmd(union node *n, struct backcmd *result)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (pipe(pip) < 0)
|
||||
sh_error("Pipe call failed");
|
||||
jp = makejob(n, 1);
|
||||
sh_pipe(pip, 0);
|
||||
jp = makejob(1);
|
||||
if (forkshell(jp, n, FORK_NOJOB) == 0) {
|
||||
FORCEINTON;
|
||||
close(pip[0]);
|
||||
|
||||
65
src/exec.c
65
src/exec.c
@ -36,6 +36,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef HAVE_PATHS_H
|
||||
#include <paths.h>
|
||||
@ -271,11 +272,16 @@ hashcmd(int argc, char **argv)
|
||||
int c;
|
||||
struct cmdentry entry;
|
||||
char *name;
|
||||
bool clear;
|
||||
|
||||
while ((c = nextopt("r")) != '\0') {
|
||||
clear = false;
|
||||
while ((c = nextopt("r")) != '\0')
|
||||
clear = true;
|
||||
if(clear) {
|
||||
clearcmdentry();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (*argptr == NULL) {
|
||||
for (pp = cmdtable ; pp < &cmdtable[CMDTABLESIZE] ; pp++) {
|
||||
for (cmdp = *pp ; cmdp ; cmdp = cmdp->next) {
|
||||
@ -319,7 +325,22 @@ printentry(struct tblentry *cmdp)
|
||||
out1fmt(snlfmt, cmdp->rehash ? "*" : nullstr);
|
||||
}
|
||||
|
||||
static int test_exec(const char *fullname, struct stat64 *statb)
|
||||
{
|
||||
if (!S_ISREG(statb->st_mode))
|
||||
return 0;
|
||||
|
||||
if ((statb->st_mode & 0111) != 0111 &&
|
||||
#ifdef HAVE_FACCESSAT
|
||||
!test_file_access(fullname, X_OK)
|
||||
#else
|
||||
!test_access(statb, X_OK)
|
||||
#endif
|
||||
)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Resolve a command name. If you change this routine, you may have to
|
||||
@ -348,9 +369,12 @@ find_command(char *name, struct cmdentry *entry, int act, const char *path)
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
#endif
|
||||
absfail:
|
||||
entry->cmdtype = CMDUNKNOWN;
|
||||
return;
|
||||
}
|
||||
if (!test_exec(name, &statb))
|
||||
goto absfail;
|
||||
}
|
||||
entry->cmdtype = CMDNORMAL;
|
||||
return;
|
||||
@ -445,9 +469,6 @@ loop:
|
||||
e = errno;
|
||||
goto loop;
|
||||
}
|
||||
e = EACCES; /* if we fail, this will be the error */
|
||||
if (!S_ISREG(statb.st_mode))
|
||||
continue;
|
||||
if (lpathopt) { /* this is a %func directory */
|
||||
stalloc(len);
|
||||
readcmdfile(fullname);
|
||||
@ -458,20 +479,9 @@ loop:
|
||||
stunalloc(fullname);
|
||||
goto success;
|
||||
}
|
||||
#ifdef notdef
|
||||
/* XXX this code stops root executing stuff, and is buggy
|
||||
if you need a group from the group list. */
|
||||
if (statb.st_uid == geteuid()) {
|
||||
if ((statb.st_mode & 0100) == 0)
|
||||
goto loop;
|
||||
} else if (statb.st_gid == getegid()) {
|
||||
if ((statb.st_mode & 010) == 0)
|
||||
goto loop;
|
||||
} else {
|
||||
if ((statb.st_mode & 01) == 0)
|
||||
goto loop;
|
||||
}
|
||||
#endif
|
||||
e = EACCES; /* if we fail, this will be the error */
|
||||
if (!test_exec(fullname, &statb))
|
||||
continue;
|
||||
TRACE(("searchexec \"%s\" returns \"%s\"\n", name, fullname));
|
||||
if (!updatetbl) {
|
||||
entry->cmdtype = CMDNORMAL;
|
||||
@ -760,21 +770,17 @@ unsetfunc(const char *name)
|
||||
int
|
||||
typecmd(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
int err = 0;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
err |= describe_command(out1, argv[i], NULL, 1);
|
||||
nextopt(nullstr);
|
||||
while (*argptr) {
|
||||
err |= describe_command(out1, *argptr++, NULL, 1);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
STATIC int
|
||||
describe_command(out, command, path, verbose)
|
||||
struct output *out;
|
||||
char *command;
|
||||
const char *path;
|
||||
int verbose;
|
||||
static int describe_command(struct output *out, char *command,
|
||||
const char *path, int verbose)
|
||||
{
|
||||
struct cmdentry entry;
|
||||
struct tblentry *cmdp;
|
||||
@ -875,10 +881,7 @@ out:
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
commandcmd(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
int commandcmd(int argc, char **argv)
|
||||
{
|
||||
char *cmd;
|
||||
int c;
|
||||
|
||||
@ -62,6 +62,8 @@ union node;
|
||||
|
||||
extern const char *pathopt; /* set by padvance */
|
||||
|
||||
struct stat64;
|
||||
|
||||
void shellexec(char **, const char *, int)
|
||||
__attribute__((__noreturn__));
|
||||
int padvance_magic(const char **path, const char *name, int magic);
|
||||
@ -78,6 +80,9 @@ void unsetfunc(const char *);
|
||||
int typecmd(int, char **);
|
||||
int commandcmd(int, char **);
|
||||
|
||||
int test_file_access(const char *path, int mode);
|
||||
int test_access(const struct stat64 *sp, int stmode);
|
||||
|
||||
static inline int padvance(const char **path, const char *name)
|
||||
{
|
||||
return padvance_magic(path, name, 1);
|
||||
|
||||
10
src/expand.c
10
src/expand.c
@ -1658,6 +1658,7 @@ _rmescapes(char *str, int flag)
|
||||
char *p, *q, *r;
|
||||
int notescaped;
|
||||
int globbing;
|
||||
int inquotes;
|
||||
|
||||
p = strpbrk(str, cqchars);
|
||||
if (!p) {
|
||||
@ -1692,16 +1693,17 @@ _rmescapes(char *str, int flag)
|
||||
q = mempcpy(q, str, len);
|
||||
}
|
||||
}
|
||||
inquotes = 0;
|
||||
notescaped = globbing;
|
||||
while (*p) {
|
||||
if (*p == (char)CTLQUOTEMARK) {
|
||||
p++;
|
||||
notescaped = globbing;
|
||||
inquotes ^= globbing;
|
||||
continue;
|
||||
}
|
||||
if (*p == '\\') {
|
||||
/* naked back slash */
|
||||
notescaped = 0;
|
||||
notescaped ^= globbing;
|
||||
goto copy;
|
||||
}
|
||||
if (FNMATCH_IS_ENABLED && *p == '^')
|
||||
@ -1711,6 +1713,10 @@ _rmescapes(char *str, int flag)
|
||||
add_escape:
|
||||
if (notescaped)
|
||||
*q++ = '\\';
|
||||
else if (inquotes) {
|
||||
*q++ = '\\';
|
||||
*q++ = '\\';
|
||||
}
|
||||
}
|
||||
notescaped = globbing;
|
||||
copy:
|
||||
|
||||
47
src/funcs/cmv
Normal file
47
src/funcs/cmv
Normal file
@ -0,0 +1,47 @@
|
||||
# Copyright (c) 1991, 1993
|
||||
# The Regents of the University of California. All rights reserved.
|
||||
# Copyright (c) 1997-2005
|
||||
# Herbert Xu <herbert@gondor.apana.org.au>. All rights reserved.
|
||||
#
|
||||
# This code is derived from software contributed to Berkeley by
|
||||
# Kenneth Almquist.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. Neither the name of the University nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
#
|
||||
# @(#)cmv 8.2 (Berkeley) 5/4/95
|
||||
|
||||
# Conditional move--don't replace an existing file.
|
||||
|
||||
cmv() {
|
||||
if test $# != 2
|
||||
then echo "cmv: arg count"
|
||||
return 2
|
||||
fi
|
||||
if test -f "$2" -o -w "$2"
|
||||
then echo "$2 exists"
|
||||
return 2
|
||||
fi
|
||||
/bin/mv "$1" "$2"
|
||||
}
|
||||
71
src/funcs/dirs
Normal file
71
src/funcs/dirs
Normal file
@ -0,0 +1,71 @@
|
||||
# Copyright (c) 1991, 1993
|
||||
# The Regents of the University of California. All rights reserved.
|
||||
# Copyright (c) 1997-2005
|
||||
# Herbert Xu <herbert@gondor.apana.org.au>. All rights reserved.
|
||||
#
|
||||
# This code is derived from software contributed to Berkeley by
|
||||
# Kenneth Almquist.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. Neither the name of the University nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
#
|
||||
# @(#)dirs 8.2 (Berkeley) 5/4/95
|
||||
|
||||
# pushd, popd, and dirs --- written by Chris Bertin
|
||||
# Pixel Computer Inc. ...!wjh12!pixel!pixutl!chris
|
||||
# as modified by Patrick Elam of GTRI and Kenneth Almquist at UW
|
||||
|
||||
pushd () {
|
||||
SAVE=`pwd`
|
||||
if [ "$1" = "" ]
|
||||
then if [ "$DSTACK" = "" ]
|
||||
then echo "pushd: directory stack empty."
|
||||
return 1
|
||||
fi
|
||||
set $DSTACK
|
||||
cd $1 || return
|
||||
shift 1
|
||||
DSTACK="$*"
|
||||
else cd $1 > /dev/null || return
|
||||
fi
|
||||
DSTACK="$SAVE $DSTACK"
|
||||
dirs
|
||||
}
|
||||
|
||||
popd () {
|
||||
if [ "$DSTACK" = "" ]
|
||||
then echo "popd: directory stack empty."
|
||||
return 1
|
||||
fi
|
||||
set $DSTACK
|
||||
cd $1
|
||||
shift
|
||||
DSTACK=$*
|
||||
dirs
|
||||
}
|
||||
|
||||
dirs () {
|
||||
echo "`pwd` $DSTACK"
|
||||
return 0
|
||||
}
|
||||
47
src/funcs/kill
Normal file
47
src/funcs/kill
Normal file
@ -0,0 +1,47 @@
|
||||
# Copyright (c) 1991, 1993
|
||||
# The Regents of the University of California. All rights reserved.
|
||||
# Copyright (c) 1997-2005
|
||||
# Herbert Xu <herbert@gondor.apana.org.au>. All rights reserved.
|
||||
#
|
||||
# This code is derived from software contributed to Berkeley by
|
||||
# Kenneth Almquist.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. Neither the name of the University nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
#
|
||||
# @(#)kill 8.2 (Berkeley) 5/4/95
|
||||
|
||||
# Convert job names to process ids and then run /bin/kill.
|
||||
|
||||
kill() {
|
||||
local args x
|
||||
args=
|
||||
for x in "$@"
|
||||
do case $x in
|
||||
%*) x=`jobid "$x"` ;;
|
||||
esac
|
||||
args="$args $x"
|
||||
done
|
||||
/bin/kill $args
|
||||
}
|
||||
36
src/funcs/login
Normal file
36
src/funcs/login
Normal file
@ -0,0 +1,36 @@
|
||||
# Copyright (c) 1991, 1993
|
||||
# The Regents of the University of California. All rights reserved.
|
||||
# Copyright (c) 1997-2005
|
||||
# Herbert Xu <herbert@gondor.apana.org.au>. All rights reserved.
|
||||
#
|
||||
# This code is derived from software contributed to Berkeley by
|
||||
# Kenneth Almquist.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. Neither the name of the University nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
#
|
||||
# @(#)login 8.2 (Berkeley) 5/4/95
|
||||
|
||||
# replaces the login builtin in the BSD shell
|
||||
login () exec login "$@"
|
||||
35
src/funcs/newgrp
Normal file
35
src/funcs/newgrp
Normal file
@ -0,0 +1,35 @@
|
||||
# Copyright (c) 1991, 1993
|
||||
# The Regents of the University of California. All rights reserved.
|
||||
# Copyright (c) 1997-2005
|
||||
# Herbert Xu <herbert@gondor.apana.org.au>. All rights reserved.
|
||||
#
|
||||
# This code is derived from software contributed to Berkeley by
|
||||
# Kenneth Almquist.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. Neither the name of the University nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
#
|
||||
# @(#)newgrp 8.2 (Berkeley) 5/4/95
|
||||
|
||||
newgrp() exec newgrp "$@"
|
||||
71
src/funcs/popd
Normal file
71
src/funcs/popd
Normal file
@ -0,0 +1,71 @@
|
||||
# Copyright (c) 1991, 1993
|
||||
# The Regents of the University of California. All rights reserved.
|
||||
# Copyright (c) 1997-2005
|
||||
# Herbert Xu <herbert@gondor.apana.org.au>. All rights reserved.
|
||||
#
|
||||
# This code is derived from software contributed to Berkeley by
|
||||
# Kenneth Almquist.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. Neither the name of the University nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
#
|
||||
# @(#)popd 8.2 (Berkeley) 5/4/95
|
||||
|
||||
# pushd, popd, and dirs --- written by Chris Bertin
|
||||
# Pixel Computer Inc. ...!wjh12!pixel!pixutl!chris
|
||||
# as modified by Patrick Elam of GTRI and Kenneth Almquist at UW
|
||||
|
||||
pushd () {
|
||||
SAVE=`pwd`
|
||||
if [ "$1" = "" ]
|
||||
then if [ "$DSTACK" = "" ]
|
||||
then echo "pushd: directory stack empty."
|
||||
return 1
|
||||
fi
|
||||
set $DSTACK
|
||||
cd $1 || return
|
||||
shift 1
|
||||
DSTACK="$*"
|
||||
else cd $1 > /dev/null || return
|
||||
fi
|
||||
DSTACK="$SAVE $DSTACK"
|
||||
dirs
|
||||
}
|
||||
|
||||
popd () {
|
||||
if [ "$DSTACK" = "" ]
|
||||
then echo "popd: directory stack empty."
|
||||
return 1
|
||||
fi
|
||||
set $DSTACK
|
||||
cd $1
|
||||
shift
|
||||
DSTACK=$*
|
||||
dirs
|
||||
}
|
||||
|
||||
dirs () {
|
||||
echo "`pwd` $DSTACK"
|
||||
return 0
|
||||
}
|
||||
71
src/funcs/pushd
Normal file
71
src/funcs/pushd
Normal file
@ -0,0 +1,71 @@
|
||||
# Copyright (c) 1991, 1993
|
||||
# The Regents of the University of California. All rights reserved.
|
||||
# Copyright (c) 1997-2005
|
||||
# Herbert Xu <herbert@gondor.apana.org.au>. All rights reserved.
|
||||
#
|
||||
# This code is derived from software contributed to Berkeley by
|
||||
# Kenneth Almquist.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. Neither the name of the University nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
#
|
||||
# @(#)pushd 8.2 (Berkeley) 5/4/95
|
||||
|
||||
# pushd, popd, and dirs --- written by Chris Bertin
|
||||
# Pixel Computer Inc. ...!wjh12!pixel!pixutl!chris
|
||||
# as modified by Patrick Elam of GTRI and Kenneth Almquist at UW
|
||||
|
||||
pushd () {
|
||||
SAVE=`pwd`
|
||||
if [ "$1" = "" ]
|
||||
then if [ "$DSTACK" = "" ]
|
||||
then echo "pushd: directory stack empty."
|
||||
return 1
|
||||
fi
|
||||
set $DSTACK
|
||||
cd $1 || return
|
||||
shift 1
|
||||
DSTACK="$*"
|
||||
else cd $1 > /dev/null || return
|
||||
fi
|
||||
DSTACK="$SAVE $DSTACK"
|
||||
dirs
|
||||
}
|
||||
|
||||
popd () {
|
||||
if [ "$DSTACK" = "" ]
|
||||
then echo "popd: directory stack empty."
|
||||
return 1
|
||||
fi
|
||||
set $DSTACK
|
||||
cd $1
|
||||
shift
|
||||
DSTACK=$*
|
||||
dirs
|
||||
}
|
||||
|
||||
dirs () {
|
||||
echo "`pwd` $DSTACK"
|
||||
return 0
|
||||
}
|
||||
39
src/funcs/suspend
Normal file
39
src/funcs/suspend
Normal file
@ -0,0 +1,39 @@
|
||||
# Copyright (c) 1991, 1993
|
||||
# The Regents of the University of California. All rights reserved.
|
||||
# Copyright (c) 1997-2005
|
||||
# Herbert Xu <herbert@gondor.apana.org.au>. All rights reserved.
|
||||
#
|
||||
# This code is derived from software contributed to Berkeley by
|
||||
# Kenneth Almquist.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. Neither the name of the University nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
#
|
||||
# @(#)suspend 8.2 (Berkeley) 5/4/95
|
||||
|
||||
suspend() {
|
||||
local -
|
||||
set +j
|
||||
kill -TSTP 0
|
||||
}
|
||||
@ -212,15 +212,12 @@ histcmd(int argc, char **argv)
|
||||
if (hist == NULL)
|
||||
sh_error("history not active");
|
||||
|
||||
if (argc == 1)
|
||||
sh_error("missing history argument");
|
||||
|
||||
#ifdef __GLIBC__
|
||||
optind = 0;
|
||||
#else
|
||||
optreset = 1; optind = 1; /* initialize getopt */
|
||||
#endif
|
||||
while (not_fcnumber(argv[optind]) &&
|
||||
while (not_fcnumber(argv[optind ?: 1]) &&
|
||||
(ch = getopt(argc, argv, ":e:lnrs")) != -1)
|
||||
switch ((char)ch) {
|
||||
case 'e':
|
||||
@ -246,6 +243,7 @@ histcmd(int argc, char **argv)
|
||||
sh_error("unknown option: -%c", optopt);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
optind = optind ?: 1;
|
||||
argc -= optind, argv += optind;
|
||||
|
||||
/*
|
||||
@ -288,14 +286,18 @@ histcmd(int argc, char **argv)
|
||||
}
|
||||
|
||||
/*
|
||||
* If executing, parse [old=new] now
|
||||
* If -s is specified, accept [old=new] first only
|
||||
*/
|
||||
if (lflg == 0 && argc > 0 &&
|
||||
((repl = strchr(argv[0], '=')) != NULL)) {
|
||||
pat = argv[0];
|
||||
*repl++ = '\0';
|
||||
argc--, argv++;
|
||||
if (sflg) {
|
||||
if (argc > 0 && ((repl = strchr(argv[0], '=')) != NULL)) {
|
||||
pat = argv[0];
|
||||
*repl++ = '\0';
|
||||
argc--, argv++;
|
||||
}
|
||||
if (argc >= 2)
|
||||
sh_error("too many args");
|
||||
}
|
||||
|
||||
/*
|
||||
* determine [first] and [last]
|
||||
*/
|
||||
@ -375,12 +377,10 @@ histcmd(int argc, char **argv)
|
||||
|
||||
evalstring(s, 0);
|
||||
if (displayhist && hist) {
|
||||
/*
|
||||
* XXX what about recursive and
|
||||
* relative histnums.
|
||||
*/
|
||||
history(hist, &he, H_ENTER, s);
|
||||
}
|
||||
|
||||
break;
|
||||
} else
|
||||
fputs(s, efp);
|
||||
}
|
||||
@ -476,6 +476,8 @@ str_to_event(const char *str, int last)
|
||||
*/
|
||||
retval = history(hist, &he,
|
||||
last ? H_FIRST : H_LAST);
|
||||
if (retval != -1 && last)
|
||||
retval = history(hist, &he, H_NEXT);
|
||||
}
|
||||
}
|
||||
if (retval == -1)
|
||||
|
||||
@ -34,7 +34,9 @@
|
||||
* @(#)init.h 8.2 (Berkeley) 5/4/95
|
||||
*/
|
||||
|
||||
union node;
|
||||
|
||||
void init(void);
|
||||
void exitreset(void);
|
||||
void forkreset(void);
|
||||
void forkreset(union node *);
|
||||
void reset(void);
|
||||
|
||||
134
src/input.c
134
src/input.c
@ -54,9 +54,7 @@
|
||||
#include "alias.h"
|
||||
#include "parser.h"
|
||||
#include "main.h"
|
||||
#ifndef SMALL
|
||||
#include "myhistedit.h"
|
||||
#endif
|
||||
|
||||
#define IBUFSIZ (BUFSIZ + 1)
|
||||
|
||||
@ -77,6 +75,7 @@ INCLUDE <stdio.h>
|
||||
INCLUDE <unistd.h>
|
||||
INCLUDE "input.h"
|
||||
INCLUDE "error.h"
|
||||
INCLUDE "syntax.h"
|
||||
|
||||
INIT {
|
||||
basepf.nextc = basepf.buf = basebuf;
|
||||
@ -85,9 +84,12 @@ INIT {
|
||||
|
||||
RESET {
|
||||
/* clear input buffer */
|
||||
basepf.lleft = basepf.nleft = 0;
|
||||
basepf.unget = 0;
|
||||
popallfiles();
|
||||
basepf.unget = 0;
|
||||
while (basepf.lastc[0] != '\n' &&
|
||||
basepf.lastc[0] != PEOF &&
|
||||
!int_pending())
|
||||
pgetc();
|
||||
}
|
||||
|
||||
FORKRESET {
|
||||
@ -159,6 +161,17 @@ int pgetc(void)
|
||||
return __pgetc();
|
||||
}
|
||||
|
||||
static int stdin_clear_nonblock(void)
|
||||
{
|
||||
int flags = fcntl(0, F_GETFL, 0);
|
||||
|
||||
if (flags >= 0) {
|
||||
flags &=~ O_NONBLOCK;
|
||||
flags = fcntl(0, F_SETFL, flags);
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
static int
|
||||
preadfd(void)
|
||||
@ -195,22 +208,38 @@ retry:
|
||||
|
||||
} else
|
||||
#endif
|
||||
if (parsefile->fd)
|
||||
nr = read(parsefile->fd, buf, IBUFSIZ - 1);
|
||||
else {
|
||||
unsigned len = IBUFSIZ - 1;
|
||||
|
||||
nr = 0;
|
||||
|
||||
do {
|
||||
int err;
|
||||
|
||||
err = read(0, buf, 1);
|
||||
if (err <= 0) {
|
||||
if (nr)
|
||||
break;
|
||||
|
||||
nr = err;
|
||||
if (errno != EWOULDBLOCK)
|
||||
break;
|
||||
if (stdin_clear_nonblock() < 0)
|
||||
break;
|
||||
|
||||
out2str("sh: turning off NDELAY mode\n");
|
||||
goto retry;
|
||||
}
|
||||
|
||||
nr++;
|
||||
} while (!IS_DEFINED_SMALL && *buf++ != '\n' && --len);
|
||||
}
|
||||
|
||||
if (nr < 0) {
|
||||
if (errno == EINTR)
|
||||
goto retry;
|
||||
if (parsefile->fd == 0 && errno == EWOULDBLOCK) {
|
||||
int flags = fcntl(0, F_GETFL, 0);
|
||||
if (flags >= 0 && flags & O_NONBLOCK) {
|
||||
flags &=~ O_NONBLOCK;
|
||||
if (fcntl(0, F_SETFL, flags) >= 0) {
|
||||
out2str("sh: turning off NDELAY mode\n");
|
||||
goto retry;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return nr;
|
||||
}
|
||||
@ -226,12 +255,11 @@ retry:
|
||||
|
||||
static int preadbuffer(void)
|
||||
{
|
||||
char *q;
|
||||
int more;
|
||||
#ifndef SMALL
|
||||
int first = whichprompt == 1;
|
||||
int something;
|
||||
#endif
|
||||
char savec;
|
||||
int more;
|
||||
char *q;
|
||||
|
||||
if (unlikely(parsefile->strpush)) {
|
||||
popstring();
|
||||
@ -241,11 +269,11 @@ static int preadbuffer(void)
|
||||
return PEOF;
|
||||
flushall();
|
||||
|
||||
more = parsefile->lleft;
|
||||
more = input_get_lleft(parsefile);
|
||||
if (more <= 0) {
|
||||
again:
|
||||
if ((more = preadfd()) <= 0) {
|
||||
parsefile->lleft = parsefile->nleft = 0;
|
||||
input_set_lleft(parsefile, parsefile->nleft = 0);
|
||||
return PEOF;
|
||||
}
|
||||
}
|
||||
@ -253,37 +281,38 @@ again:
|
||||
q = parsefile->nextc;
|
||||
|
||||
/* delete nul characters */
|
||||
#ifndef SMALL
|
||||
something = 0;
|
||||
#endif
|
||||
something = !first;
|
||||
for (;;) {
|
||||
int c;
|
||||
|
||||
more--;
|
||||
c = *q;
|
||||
|
||||
if (!c)
|
||||
if (!c) {
|
||||
memmove(q, q + 1, more);
|
||||
else {
|
||||
q++;
|
||||
|
||||
if (c == '\n') {
|
||||
parsefile->nleft = q - parsefile->nextc - 1;
|
||||
break;
|
||||
}
|
||||
|
||||
#ifndef SMALL
|
||||
switch (c) {
|
||||
default:
|
||||
something = 1;
|
||||
/* fall through */
|
||||
case '\t':
|
||||
case ' ':
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
goto check;
|
||||
}
|
||||
|
||||
q++;
|
||||
|
||||
if (IS_DEFINED_SMALL)
|
||||
goto check;
|
||||
|
||||
switch (c) {
|
||||
case '\n':
|
||||
parsefile->nleft = q - parsefile->nextc - 1;
|
||||
goto done;
|
||||
|
||||
default:
|
||||
something = 1;
|
||||
/* fall through */
|
||||
|
||||
case '\t':
|
||||
case ' ':
|
||||
break;
|
||||
}
|
||||
|
||||
check:
|
||||
if (more <= 0) {
|
||||
parsefile->nleft = q - parsefile->nextc - 1;
|
||||
if (parsefile->nleft < 0)
|
||||
@ -291,20 +320,20 @@ again:
|
||||
break;
|
||||
}
|
||||
}
|
||||
parsefile->lleft = more;
|
||||
done:
|
||||
input_set_lleft(parsefile, more);
|
||||
|
||||
savec = *q;
|
||||
if (!IS_DEFINED_SMALL)
|
||||
savec = *q;
|
||||
*q = '\0';
|
||||
|
||||
#ifndef SMALL
|
||||
if (parsefile->fd == 0 && hist && something) {
|
||||
HistEvent he;
|
||||
INTOFF;
|
||||
history(hist, &he, whichprompt == 1? H_ENTER : H_APPEND,
|
||||
history(hist, &he, first ? H_ENTER : H_APPEND,
|
||||
parsefile->nextc);
|
||||
INTON;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (vflag) {
|
||||
out2str(parsefile->nextc);
|
||||
@ -313,7 +342,8 @@ again:
|
||||
#endif
|
||||
}
|
||||
|
||||
*q = savec;
|
||||
if (!IS_DEFINED_SMALL)
|
||||
*q = savec;
|
||||
|
||||
return (signed char)*parsefile->nextc++;
|
||||
}
|
||||
@ -357,7 +387,7 @@ pushstring(char *s, void *ap)
|
||||
sp->ap = (struct alias *)ap;
|
||||
if (ap) {
|
||||
((struct alias *)ap)->flag |= ALIASINUSE;
|
||||
sp->string = s;
|
||||
sp->string = ((struct alias *)ap)->name;
|
||||
}
|
||||
parsefile->nextc = s;
|
||||
parsefile->nleft = len;
|
||||
@ -371,12 +401,12 @@ static void popstring(void)
|
||||
struct strpush *sp = parsefile->strpush;
|
||||
|
||||
INTOFF;
|
||||
if (sp->ap) {
|
||||
if (sp->ap && parsefile->nextc > sp->string) {
|
||||
if (parsefile->nextc[-1] == ' ' ||
|
||||
parsefile->nextc[-1] == '\t') {
|
||||
checkkwd |= CHKALIAS;
|
||||
}
|
||||
if (sp->string != sp->ap->val) {
|
||||
if (sp->string != sp->ap->name) {
|
||||
ckfree(sp->string);
|
||||
}
|
||||
}
|
||||
@ -428,7 +458,7 @@ setinputfd(int fd, int push)
|
||||
parsefile->fd = fd;
|
||||
if (parsefile->buf == NULL)
|
||||
parsefile->buf = ckmalloc(IBUFSIZ);
|
||||
parsefile->lleft = parsefile->nleft = 0;
|
||||
input_set_lleft(parsefile, parsefile->nleft = 0);
|
||||
plinno = 1;
|
||||
}
|
||||
|
||||
|
||||
24
src/input.h
24
src/input.h
@ -34,6 +34,12 @@
|
||||
* @(#)input.h 8.2 (Berkeley) 5/4/95
|
||||
*/
|
||||
|
||||
#ifdef SMALL
|
||||
#define IS_DEFINED_SMALL 1
|
||||
#else
|
||||
#define IS_DEFINED_SMALL 0
|
||||
#endif
|
||||
|
||||
/* PEOF (the end of file marker) is defined in syntax.h */
|
||||
|
||||
enum {
|
||||
@ -70,7 +76,9 @@ struct parsefile {
|
||||
int linno; /* current line */
|
||||
int fd; /* file descriptor (or -1 if string) */
|
||||
int nleft; /* number of chars left in this line */
|
||||
#ifndef SMALL
|
||||
int lleft; /* number of chars left in this buffer */
|
||||
#endif
|
||||
char *nextc; /* next char in buffer */
|
||||
char *buf; /* input buffer */
|
||||
struct strpush *strpush; /* for pushing strings at this level */
|
||||
@ -104,3 +112,19 @@ void setinputstring(char *);
|
||||
void popfile(void);
|
||||
void unwindfiles(struct parsefile *);
|
||||
void popallfiles(void);
|
||||
|
||||
static inline int input_get_lleft(struct parsefile *pf)
|
||||
{
|
||||
#ifdef SMALL
|
||||
return 0;
|
||||
#else
|
||||
return pf->lleft;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void input_set_lleft(struct parsefile *pf, int len)
|
||||
{
|
||||
#ifndef SMALL
|
||||
pf->lleft = len;
|
||||
#endif
|
||||
}
|
||||
|
||||
96
src/jobs.c
96
src/jobs.c
@ -53,6 +53,7 @@
|
||||
#include <termios.h>
|
||||
#undef CEOF /* syntax.h redefines this */
|
||||
#endif
|
||||
#include "builtins.h"
|
||||
#include "exec.h"
|
||||
#include "eval.h"
|
||||
#include "init.h"
|
||||
@ -187,11 +188,21 @@ set_curjob(struct job *jp, unsigned mode)
|
||||
|
||||
int jobctl;
|
||||
|
||||
static void xxtcsetpgrp(pid_t pgrp)
|
||||
{
|
||||
int fd = ttyfd;
|
||||
|
||||
if (fd < 0)
|
||||
return;
|
||||
|
||||
xtcsetpgrp(fd, pgrp);
|
||||
}
|
||||
|
||||
void
|
||||
setjobctl(int on)
|
||||
{
|
||||
int pgrp = -1;
|
||||
int fd;
|
||||
int pgrp;
|
||||
|
||||
if (on == jobctl || rootshell == 0)
|
||||
return;
|
||||
@ -207,46 +218,50 @@ setjobctl(int on)
|
||||
fd = savefd(fd, ofd);
|
||||
do { /* while we are in the background */
|
||||
if ((pgrp = tcgetpgrp(fd)) < 0) {
|
||||
close:
|
||||
close(fd);
|
||||
fd = -1;
|
||||
out:
|
||||
if (!iflag)
|
||||
break;
|
||||
sh_warnx("can't access tty; job control turned off");
|
||||
mflag = on = 0;
|
||||
goto close;
|
||||
return;
|
||||
}
|
||||
if (pgrp == getpgrp())
|
||||
break;
|
||||
if (!iflag)
|
||||
goto close;
|
||||
killpg(0, SIGTTIN);
|
||||
} while (1);
|
||||
initialpgrp = pgrp;
|
||||
|
||||
setsignal(SIGTSTP);
|
||||
setsignal(SIGTTOU);
|
||||
setsignal(SIGTTIN);
|
||||
pgrp = rootpid;
|
||||
setpgid(0, pgrp);
|
||||
xtcsetpgrp(fd, pgrp);
|
||||
} else {
|
||||
/* turning job control off */
|
||||
fd = ttyfd;
|
||||
pgrp = initialpgrp;
|
||||
xtcsetpgrp(fd, pgrp);
|
||||
setpgid(0, pgrp);
|
||||
setsignal(SIGTSTP);
|
||||
setsignal(SIGTTOU);
|
||||
setsignal(SIGTTIN);
|
||||
close:
|
||||
close(fd);
|
||||
fd = -1;
|
||||
}
|
||||
|
||||
setsignal(SIGTSTP);
|
||||
setsignal(SIGTTOU);
|
||||
setsignal(SIGTTIN);
|
||||
if (fd >= 0) {
|
||||
setpgid(0, pgrp);
|
||||
xtcsetpgrp(fd, pgrp);
|
||||
|
||||
if (!on) {
|
||||
close(fd);
|
||||
fd = -1;
|
||||
}
|
||||
}
|
||||
|
||||
ttyfd = fd;
|
||||
jobctl = on;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int
|
||||
killcmd(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
int killcmd(int argc, char **argv)
|
||||
{
|
||||
extern char *signal_names[];
|
||||
int signo = -1;
|
||||
@ -330,7 +345,7 @@ usage:
|
||||
pid = **argv == '-' ?
|
||||
-number(*argv + 1) : number(*argv);
|
||||
if (kill(pid, signo) != 0) {
|
||||
sh_warnx("%s\n", strerror(errno));
|
||||
sh_warnx(snlfmt, strerror(errno));
|
||||
i = 1;
|
||||
}
|
||||
} while (*++argv);
|
||||
@ -394,7 +409,7 @@ restartjob(struct job *jp, int mode)
|
||||
jp->state = JOBRUNNING;
|
||||
pgid = jp->ps->pid;
|
||||
if (mode == FORK_FG)
|
||||
xtcsetpgrp(ttyfd, pgid);
|
||||
xxtcsetpgrp(pgid);
|
||||
killpg(pgid, SIGCONT);
|
||||
ps = jp->ps;
|
||||
i = jp->nprocs;
|
||||
@ -748,8 +763,7 @@ err:
|
||||
* Called with interrupts off.
|
||||
*/
|
||||
|
||||
struct job *
|
||||
makejob(union node *node, int nprocs)
|
||||
struct job *makejob(int nprocs)
|
||||
{
|
||||
int i;
|
||||
struct job *jp;
|
||||
@ -780,7 +794,7 @@ makejob(union node *node, int nprocs)
|
||||
if (nprocs > 1) {
|
||||
jp->ps = ckmalloc(nprocs * sizeof (struct procstat));
|
||||
}
|
||||
TRACE(("makejob(0x%lx, %d) returns %%%d\n", (long)node, nprocs,
|
||||
TRACE(("makejob(%d) returns %%%d\n", nprocs,
|
||||
jobno(jp)));
|
||||
return jp;
|
||||
}
|
||||
@ -859,7 +873,7 @@ static void forkchild(struct job *jp, union node *n, int mode)
|
||||
if (!lvforked) {
|
||||
shlvl++;
|
||||
|
||||
forkreset();
|
||||
forkreset(mode == FORK_NOJOB ? n : NULL);
|
||||
|
||||
#if JOBS
|
||||
/* do job control only in root shell */
|
||||
@ -878,7 +892,7 @@ static void forkchild(struct job *jp, union node *n, int mode)
|
||||
/* This can fail because we are doing it in the parent also */
|
||||
(void)setpgid(0, pgrp);
|
||||
if (mode == FORK_FG)
|
||||
xtcsetpgrp(ttyfd, pgrp);
|
||||
xxtcsetpgrp(pgrp);
|
||||
setsignal(SIGTSTP);
|
||||
setsignal(SIGTTOU);
|
||||
} else
|
||||
@ -900,6 +914,11 @@ static void forkchild(struct job *jp, union node *n, int mode)
|
||||
if (lvforked)
|
||||
return;
|
||||
|
||||
freejob(jp);
|
||||
|
||||
if (issimplecmd(n, JOBSCMD->name))
|
||||
return;
|
||||
|
||||
for (jp = curjob; jp; jp = jp->prev_job)
|
||||
freejob(jp);
|
||||
}
|
||||
@ -963,7 +982,7 @@ struct job *vforkexec(union node *n, char **argv, const char *path, int idx)
|
||||
struct job *jp;
|
||||
int pid;
|
||||
|
||||
jp = makejob(n, 1);
|
||||
jp = makejob(1);
|
||||
|
||||
sigblockall(NULL);
|
||||
vforked++;
|
||||
@ -1018,7 +1037,7 @@ waitforjob(struct job *jp)
|
||||
st = getstatus(jp);
|
||||
#if JOBS
|
||||
if (jp->jobctl) {
|
||||
xtcsetpgrp(ttyfd, rootpid);
|
||||
xxtcsetpgrp(rootpid);
|
||||
/*
|
||||
* This is truly gross.
|
||||
* If we're doing job control, then we did a TIOCSPGRP which
|
||||
@ -1229,13 +1248,19 @@ commandtext(union node *n)
|
||||
{
|
||||
char *name;
|
||||
|
||||
STARTSTACKSTR(cmdnextc);
|
||||
cmdtxt(n);
|
||||
STARTSTACKSTR(name);
|
||||
commandtextcont(n, name);
|
||||
name = stackblock();
|
||||
TRACE(("commandtext: name %p, end %p\n", name, cmdnextc));
|
||||
return savestr(name);
|
||||
}
|
||||
|
||||
char *commandtextcont(union node *n, char *next)
|
||||
{
|
||||
cmdnextc = next;
|
||||
cmdtxt(n);
|
||||
return cmdnextc;
|
||||
}
|
||||
|
||||
STATIC void
|
||||
cmdtxt(union node *n)
|
||||
@ -1526,8 +1551,15 @@ STATIC int
|
||||
getstatus(struct job *job) {
|
||||
int status;
|
||||
int retval;
|
||||
struct procstat *ps;
|
||||
|
||||
ps = job->ps + job->nprocs - 1;
|
||||
status = ps->status;
|
||||
if (pipefail) {
|
||||
while (status == 0 && --ps >= job->ps)
|
||||
status = ps->status;
|
||||
}
|
||||
|
||||
status = job->ps[job->nprocs - 1].status;
|
||||
retval = WEXITSTATUS(status);
|
||||
if (!WIFEXITED(status)) {
|
||||
#if JOBS
|
||||
|
||||
@ -102,11 +102,12 @@ int jobscmd(int, char **);
|
||||
struct output;
|
||||
void showjobs(struct output *, int);
|
||||
int waitcmd(int, char **);
|
||||
struct job *makejob(union node *, int);
|
||||
struct job *makejob(int);
|
||||
int forkshell(struct job *, union node *, int);
|
||||
struct job *vforkexec(union node *n, char **argv, const char *path, int idx);
|
||||
int waitforjob(struct job *);
|
||||
int stoppedjobs(void);
|
||||
char *commandtextcont(union node *n, char *next);
|
||||
|
||||
#if ! JOBS
|
||||
#define setjobctl(on) ((void)(on)) /* do nothing */
|
||||
|
||||
@ -80,7 +80,7 @@ chkmail(void)
|
||||
int len;
|
||||
|
||||
len = padvance_magic(&mpath, nullstr, 2);
|
||||
if (!len)
|
||||
if (len < 0)
|
||||
break;
|
||||
p = stackblock();
|
||||
if (*p == '\0')
|
||||
|
||||
@ -112,7 +112,7 @@ main(int argc, char **argv)
|
||||
|
||||
s = state;
|
||||
if (e == EXEND || e == EXEXIT || s == 0 || iflag == 0 || shlvl)
|
||||
exitshell();
|
||||
goto exit;
|
||||
|
||||
reset();
|
||||
|
||||
@ -175,6 +175,7 @@ state3:
|
||||
state4: /* XXX ??? - why isn't this before the "if" statement */
|
||||
cmdloop(1);
|
||||
}
|
||||
exit:
|
||||
#if PROFILE
|
||||
monitor(0);
|
||||
#endif
|
||||
|
||||
@ -237,7 +237,7 @@ umaskcmd(int argc, char **argv)
|
||||
*ap++ = ',';
|
||||
}
|
||||
ap[-1] = '\0';
|
||||
out1fmt("%s\n", buf);
|
||||
out1fmt(snlfmt, buf);
|
||||
} else {
|
||||
out1fmt("%.4o\n", mask);
|
||||
}
|
||||
@ -440,6 +440,9 @@ ulimitcmd(int argc, char **argv)
|
||||
#endif
|
||||
#ifdef RLIMIT_LOCKS
|
||||
"w"
|
||||
#endif
|
||||
#ifdef RLIMIT_RTPRIO
|
||||
"r"
|
||||
#endif
|
||||
)) != '\0')
|
||||
switch (optc) {
|
||||
|
||||
@ -91,6 +91,7 @@ struct event {
|
||||
char *name; /* name of event (e.g. INIT) */
|
||||
char *routine; /* name of routine called on event */
|
||||
char *comment; /* comment describing routine */
|
||||
char *args; /* arguments to routine */
|
||||
struct text code; /* code for handling event */
|
||||
};
|
||||
|
||||
@ -128,7 +129,7 @@ char reset[] = "\
|
||||
struct event event[] = {
|
||||
{"INIT", "init", init},
|
||||
{"EXITRESET", "exitreset", exitreset},
|
||||
{"FORKRESET", "forkreset", forkreset},
|
||||
{"FORKRESET", "forkreset", forkreset, "union node *n"},
|
||||
{"RESET", "reset", reset},
|
||||
{NULL, NULL}
|
||||
};
|
||||
@ -388,7 +389,7 @@ output(void)
|
||||
for (ep = event ; ep->name ; ep++) {
|
||||
fputs("\n\n\n", fp);
|
||||
fputs(ep->comment, fp);
|
||||
fprintf(fp, "\nvoid\n%s() {\n", ep->routine);
|
||||
fprintf(fp, "\nvoid\n%s(%s) {\n", ep->routine, ep->args ?: "");
|
||||
writetext(&ep->code, fp);
|
||||
fprintf(fp, "}\n");
|
||||
}
|
||||
|
||||
@ -360,9 +360,7 @@ initialize_signames ()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
write_signames (stream)
|
||||
FILE *stream;
|
||||
void write_signames(FILE *stream)
|
||||
{
|
||||
register int i;
|
||||
|
||||
|
||||
@ -31,9 +31,27 @@
|
||||
* @(#)myhistedit.h 8.2 (Berkeley) 5/4/95
|
||||
*/
|
||||
|
||||
#ifdef SMALL
|
||||
typedef void History;
|
||||
typedef void EditLine;
|
||||
typedef int HistEvent;
|
||||
|
||||
enum {
|
||||
H_APPEND,
|
||||
H_ENTER,
|
||||
};
|
||||
|
||||
#define hist NULL
|
||||
|
||||
static inline void history(History *h, HistEvent *he, int action, char *p)
|
||||
{
|
||||
}
|
||||
#else
|
||||
#include <histedit.h>
|
||||
|
||||
extern History *hist;
|
||||
#endif
|
||||
|
||||
extern EditLine *el;
|
||||
extern int displayhist;
|
||||
|
||||
|
||||
@ -63,6 +63,7 @@ const char snlfmt[] = "%s\n";
|
||||
const char dolatstr[] = { CTLQUOTEMARK, CTLVAR, VSNORMAL | VSBIT, '@', '=',
|
||||
CTLQUOTEMARK, '\0' };
|
||||
const char cqchars[] = {
|
||||
'\\',
|
||||
#ifdef HAVE_FNMATCH
|
||||
'^',
|
||||
#endif
|
||||
|
||||
@ -48,7 +48,7 @@ extern const char spcstr[];
|
||||
extern const char dolatstr[];
|
||||
#define DOLATSTRLEN 6
|
||||
extern const char cqchars[];
|
||||
#define qchars (cqchars + FNMATCH_IS_ENABLED)
|
||||
#define qchars (cqchars + FNMATCH_IS_ENABLED + 1)
|
||||
extern const char illnum[];
|
||||
extern const char homestr[];
|
||||
|
||||
|
||||
@ -87,18 +87,14 @@ copyfunc(union node *n)
|
||||
|
||||
|
||||
|
||||
STATIC void
|
||||
calcsize(n)
|
||||
union node *n;
|
||||
static void calcsize(union node *n)
|
||||
{
|
||||
%CALCSIZE
|
||||
}
|
||||
|
||||
|
||||
|
||||
STATIC void
|
||||
sizenodelist(lp)
|
||||
struct nodelist *lp;
|
||||
static void sizenodelist(struct nodelist *lp)
|
||||
{
|
||||
while (lp) {
|
||||
funcblocksize += SHELL_ALIGN(sizeof(struct nodelist));
|
||||
@ -109,9 +105,7 @@ sizenodelist(lp)
|
||||
|
||||
|
||||
|
||||
STATIC union node *
|
||||
copynode(n)
|
||||
union node *n;
|
||||
static union node *copynode(union node *n)
|
||||
{
|
||||
union node *new;
|
||||
|
||||
@ -120,9 +114,7 @@ copynode(n)
|
||||
}
|
||||
|
||||
|
||||
STATIC struct nodelist *
|
||||
copynodelist(lp)
|
||||
struct nodelist *lp;
|
||||
static struct nodelist *copynodelist(struct nodelist *lp)
|
||||
{
|
||||
struct nodelist *start;
|
||||
struct nodelist **lpp;
|
||||
@ -142,9 +134,7 @@ copynodelist(lp)
|
||||
|
||||
|
||||
|
||||
STATIC char *
|
||||
nodesavestr(s)
|
||||
char *s;
|
||||
static char *nodesavestr(char *s)
|
||||
{
|
||||
char *rtn = funcstring;
|
||||
|
||||
|
||||
@ -80,6 +80,7 @@ static const char *const optnames[NOPTS] = {
|
||||
"notify",
|
||||
"nounset",
|
||||
"nolog",
|
||||
"pipefail",
|
||||
"debug",
|
||||
};
|
||||
|
||||
@ -101,6 +102,7 @@ const char optletters[NOPTS] = {
|
||||
'u',
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
};
|
||||
|
||||
char optlist[NOPTS];
|
||||
@ -389,9 +391,7 @@ setcmd(int argc, char **argv)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
getoptsreset(value)
|
||||
const char *value;
|
||||
void getoptsreset(const char *value)
|
||||
{
|
||||
shellparam.optind = number(value) ?: 1;
|
||||
shellparam.optoff = -1;
|
||||
@ -409,8 +409,11 @@ getoptscmd(int argc, char **argv)
|
||||
{
|
||||
char **optbase;
|
||||
|
||||
nextopt(nullstr);
|
||||
argc -= argptr - argv - 1;
|
||||
argv = argptr - 1;
|
||||
if (argc < 3)
|
||||
sh_error("Usage: getopts optstring var [arg]");
|
||||
sh_error("Usage: getopts optstring var [arg...]");
|
||||
else if (argc == 3) {
|
||||
optbase = shellparam.p;
|
||||
if ((unsigned)shellparam.optind > shellparam.nparam + 1) {
|
||||
@ -462,7 +465,7 @@ atend:
|
||||
}
|
||||
|
||||
c = *p++;
|
||||
for (q = optstr; *q != c; ) {
|
||||
for (q = optstr[0] == ':' ? optstr + 1 : optstr; *q != c; ) {
|
||||
if (*q == '\0') {
|
||||
if (optstr[0] == ':') {
|
||||
s[0] = c;
|
||||
|
||||
@ -60,9 +60,10 @@ struct shparam {
|
||||
#define bflag optlist[13]
|
||||
#define uflag optlist[14]
|
||||
#define nolog optlist[15]
|
||||
#define debug optlist[16]
|
||||
#define pipefail optlist[16]
|
||||
#define debug optlist[17]
|
||||
|
||||
#define NOPTS 17
|
||||
#define NOPTS 18
|
||||
|
||||
extern const char optletters[NOPTS];
|
||||
extern char optlist[NOPTS];
|
||||
|
||||
163
src/parser.c
163
src/parser.c
@ -46,6 +46,7 @@
|
||||
#include "syntax.h"
|
||||
#include "options.h"
|
||||
#include "input.h"
|
||||
#include "jobs.h"
|
||||
#include "output.h"
|
||||
#include "var.h"
|
||||
#include "error.h"
|
||||
@ -132,6 +133,12 @@ int isassignment(const char *p)
|
||||
return *q == '=';
|
||||
}
|
||||
|
||||
int issimplecmd(union node *n, const char *name)
|
||||
{
|
||||
return n && n->type == NCMD && n->ncmd.args &&
|
||||
equal(n->ncmd.args->narg.text, name);
|
||||
}
|
||||
|
||||
static inline int realeofmark(const char *eofmark)
|
||||
{
|
||||
return eofmark && eofmark != FAKEEOFMARK;
|
||||
@ -615,7 +622,7 @@ void fixredir(union node *n, const char *text, int err)
|
||||
else {
|
||||
|
||||
if (err)
|
||||
synerror("Bad fd number");
|
||||
sh_error("Bad fd number: %s", text);
|
||||
else
|
||||
n->ndup.vname = makename();
|
||||
}
|
||||
@ -628,9 +635,10 @@ parsefname(void)
|
||||
union node *n = redirnode;
|
||||
|
||||
if (n->type == NHERE)
|
||||
checkkwd = CHKEOFMARK;
|
||||
checkkwd |= CHKEOFMARK;
|
||||
if (readtoken() != TWORD)
|
||||
synexpect(-1);
|
||||
checkkwd &= ~CHKEOFMARK;
|
||||
if (n->type == NHERE) {
|
||||
struct heredoc *here = heredoc;
|
||||
struct heredoc *p;
|
||||
@ -901,6 +909,7 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs)
|
||||
/* syntax stack */
|
||||
struct synstack synbase = { .syntax = syntax };
|
||||
struct synstack *synstack = &synbase;
|
||||
int chkeofmark = checkkwd & CHKEOFMARK;
|
||||
|
||||
if (syntax == DQSYNTAX)
|
||||
synstack->dblquote = 1;
|
||||
@ -1010,39 +1019,35 @@ toggledq:
|
||||
synstack_pop(&synstack);
|
||||
else if (synstack->dqvarnest > 0)
|
||||
synstack->dqvarnest--;
|
||||
USTPUTC(CTLENDVAR, out);
|
||||
} else {
|
||||
USTPUTC(c, out);
|
||||
if (!chkeofmark)
|
||||
c = CTLENDVAR;
|
||||
}
|
||||
USTPUTC(c, out);
|
||||
break;
|
||||
case CLP: /* '(' in arithmetic */
|
||||
synstack->parenlevel++;
|
||||
USTPUTC(c, out);
|
||||
break;
|
||||
case CRP: /* ')' in arithmetic */
|
||||
if (synstack->parenlevel > 0) {
|
||||
USTPUTC(c, out);
|
||||
if (synstack->parenlevel > 0)
|
||||
--synstack->parenlevel;
|
||||
else if (pgetc_eatbnl() == ')') {
|
||||
synstack_pop(&synstack);
|
||||
if (chkeofmark)
|
||||
USTPUTC(c, out);
|
||||
else
|
||||
c = CTLENDARI;
|
||||
} else {
|
||||
if (pgetc_eatbnl() == ')') {
|
||||
USTPUTC(CTLENDARI, out);
|
||||
synstack_pop(&synstack);
|
||||
} else {
|
||||
/*
|
||||
* unbalanced parens
|
||||
* (don't 2nd guess - no error)
|
||||
*/
|
||||
pungetc();
|
||||
USTPUTC(')', out);
|
||||
}
|
||||
/*
|
||||
* unbalanced parens
|
||||
* (don't 2nd guess - no error)
|
||||
*/
|
||||
pungetc();
|
||||
}
|
||||
USTPUTC(c, out);
|
||||
break;
|
||||
case CBQUOTE: /* '`' */
|
||||
if (checkkwd & CHKEOFMARK) {
|
||||
USTPUTC('`', out);
|
||||
break;
|
||||
}
|
||||
|
||||
USTPUTC('`', out);
|
||||
PARSEBACKQOLD();
|
||||
break;
|
||||
case CEOF:
|
||||
@ -1218,13 +1223,16 @@ parsesub: {
|
||||
static const char types[] = "}-+?=";
|
||||
|
||||
c = pgetc_eatbnl();
|
||||
if (
|
||||
(checkkwd & CHKEOFMARK) ||
|
||||
(c != '(' && c != '{' && !is_name(c) && !is_special(c))
|
||||
) {
|
||||
if (c != '(' && c != '{' && !is_name(c) && !is_special(c)) {
|
||||
USTPUTC('$', out);
|
||||
pungetc();
|
||||
} else if (c == '(') { /* $(command) or $((arith)) */
|
||||
goto parsesub_return;
|
||||
}
|
||||
|
||||
USTPUTC('$', out);
|
||||
|
||||
if (c == '(') { /* $(command) or $((arith)) */
|
||||
USTPUTC(c, out);
|
||||
if (pgetc_eatbnl() == '(') {
|
||||
PARSEARITH();
|
||||
} else {
|
||||
@ -1234,11 +1242,15 @@ parsesub: {
|
||||
} else {
|
||||
const char *newsyn = synstack->syntax;
|
||||
|
||||
USTPUTC(CTLVAR, out);
|
||||
typeloc = out - (char *)stackblock();
|
||||
STADJUST(1, out);
|
||||
if (!chkeofmark) {
|
||||
out[-1] = CTLVAR;
|
||||
STADJUST(1, out);
|
||||
}
|
||||
subtype = VSNORMAL;
|
||||
if (likely(c == '{')) {
|
||||
if (chkeofmark)
|
||||
USTPUTC('{', out);
|
||||
c = pgetc_eatbnl();
|
||||
subtype = 0;
|
||||
}
|
||||
@ -1262,8 +1274,11 @@ varname:
|
||||
if (!subtype && cc == '#') {
|
||||
subtype = VSLENGTH;
|
||||
|
||||
if (c == '_' || isalnum(c))
|
||||
if (c == '_' || isalnum(c)) {
|
||||
if (chkeofmark)
|
||||
USTPUTC('#', out);
|
||||
goto varname;
|
||||
}
|
||||
|
||||
cc = c;
|
||||
c = pgetc_eatbnl();
|
||||
@ -1272,7 +1287,8 @@ varname:
|
||||
subtype = 0;
|
||||
c = cc;
|
||||
cc = '#';
|
||||
}
|
||||
} else if (chkeofmark)
|
||||
USTPUTC('#', out);
|
||||
}
|
||||
|
||||
if (!is_special(cc)) {
|
||||
@ -1288,10 +1304,15 @@ varname:
|
||||
if (subtype == 0) {
|
||||
int cc = c;
|
||||
|
||||
if (chkeofmark)
|
||||
STPUTC(c, out);
|
||||
|
||||
switch (c) {
|
||||
case ':':
|
||||
subtype = VSNUL;
|
||||
c = pgetc_eatbnl();
|
||||
if (chkeofmark)
|
||||
STPUTC(c, out);
|
||||
/*FALLTHROUGH*/
|
||||
default:
|
||||
p = strchr(types, c);
|
||||
@ -1304,9 +1325,11 @@ varname:
|
||||
subtype = c == '#' ? VSTRIMLEFT :
|
||||
VSTRIMRIGHT;
|
||||
c = pgetc_eatbnl();
|
||||
if (c == cc)
|
||||
if (c == cc) {
|
||||
if (chkeofmark)
|
||||
STPUTC(c, out);
|
||||
subtype++;
|
||||
else
|
||||
} else
|
||||
pungetc();
|
||||
|
||||
newsyn = BASESYNTAX;
|
||||
@ -1333,13 +1356,15 @@ badsub:
|
||||
synstack->dblquote = newsyn != BASESYNTAX;
|
||||
}
|
||||
|
||||
*((char *)stackblock() + typeloc) = subtype | VSBIT;
|
||||
if (subtype != VSNORMAL) {
|
||||
synstack->varnest++;
|
||||
if (synstack->dblquote)
|
||||
synstack->dqvarnest++;
|
||||
}
|
||||
STPUTC('=', out);
|
||||
if (!chkeofmark) {
|
||||
*((char *)stackblock() + typeloc) = subtype | VSBIT;
|
||||
STPUTC('=', out);
|
||||
}
|
||||
}
|
||||
goto parsesub_return;
|
||||
}
|
||||
@ -1353,28 +1378,28 @@ badsub:
|
||||
*/
|
||||
|
||||
parsebackq: {
|
||||
struct nodelist **nlpp;
|
||||
union node *n;
|
||||
char *str;
|
||||
size_t savelen;
|
||||
struct heredoc *saveheredoclist;
|
||||
int uninitialized_var(saveprompt);
|
||||
struct heredoc *saveheredoclist;
|
||||
struct nodelist **nlpp;
|
||||
size_t psavelen;
|
||||
size_t savelen;
|
||||
union node *n;
|
||||
char *pstr;
|
||||
char *str;
|
||||
|
||||
str = NULL;
|
||||
savelen = out - (char *)stackblock();
|
||||
if (savelen > 0) {
|
||||
str = alloca(savelen);
|
||||
memcpy(str, stackblock(), savelen);
|
||||
if (!chkeofmark) {
|
||||
STADJUST(oldstyle - 1, out);
|
||||
out[-1] = CTLBACKQ;
|
||||
}
|
||||
str = stackblock();
|
||||
savelen = out - (char *)stackblock();
|
||||
grabstackblock(savelen);
|
||||
if (oldstyle) {
|
||||
/* We must read until the closing backquote, giving special
|
||||
treatment to some slashes, and then push the string and
|
||||
reread it as input, interpreting it normally. */
|
||||
char *pout;
|
||||
int pc;
|
||||
size_t psavelen;
|
||||
char *pstr;
|
||||
|
||||
|
||||
STARTSTACKSTR(pout);
|
||||
for (;;) {
|
||||
@ -1407,10 +1432,8 @@ parsebackq: {
|
||||
done:
|
||||
STPUTC('\0', pout);
|
||||
psavelen = pout - (char *)stackblock();
|
||||
if (psavelen > 0) {
|
||||
pstr = grabstackstr(pout);
|
||||
setinputstring(pstr);
|
||||
}
|
||||
pstr = grabstackstr(pout);
|
||||
setinputstring(pstr);
|
||||
}
|
||||
nlpp = &bqlist;
|
||||
while (*nlpp)
|
||||
@ -1442,19 +1465,26 @@ done:
|
||||
(*nlpp)->n = n;
|
||||
/* Start reading from old file again. */
|
||||
popfile();
|
||||
/* Ignore any pushed back tokens left from the backquote parsing. */
|
||||
if (oldstyle)
|
||||
|
||||
out = stnputs(str, savelen, stackblock());
|
||||
|
||||
if (oldstyle) {
|
||||
/* Ignore any pushed back tokens left from the backquote
|
||||
* parsing.
|
||||
*/
|
||||
tokpushback = 0;
|
||||
out = growstackto(savelen + 1);
|
||||
if (str) {
|
||||
memcpy(out, str, savelen);
|
||||
STADJUST(savelen, out);
|
||||
}
|
||||
USTPUTC(CTLBACKQ, out);
|
||||
if (oldstyle)
|
||||
if (chkeofmark) {
|
||||
pstr[psavelen - 1] = '`';
|
||||
out = stnputs(pstr, psavelen, out);
|
||||
}
|
||||
goto parsebackq_oldreturn;
|
||||
else
|
||||
} else {
|
||||
if (chkeofmark) {
|
||||
out = commandtextcont(n, out);
|
||||
USTPUTC(')', out);
|
||||
}
|
||||
goto parsebackq_newreturn;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1466,7 +1496,12 @@ parsearith: {
|
||||
synstack->prev ?: alloca(sizeof(*synstack)),
|
||||
ARISYNTAX);
|
||||
synstack->dblquote = 1;
|
||||
USTPUTC(CTLARI, out);
|
||||
if (chkeofmark)
|
||||
USTPUTC(c, out);
|
||||
else {
|
||||
STADJUST(-1, out);
|
||||
out[-1] = CTLARI;
|
||||
}
|
||||
goto parsearith_return;
|
||||
}
|
||||
|
||||
|
||||
@ -36,6 +36,8 @@
|
||||
|
||||
#include "token.h"
|
||||
|
||||
union node;
|
||||
|
||||
/* control characters in argument strings */
|
||||
#define CTL_FIRST -127 /* first 'special' character */
|
||||
#define CTLESC -127 /* escape next character */
|
||||
@ -85,6 +87,7 @@ extern int checkkwd;
|
||||
|
||||
|
||||
int isassignment(const char *p);
|
||||
int issimplecmd(union node *n, const char *name);
|
||||
union node *parsecmd(int);
|
||||
void fixredir(union node *, const char *, int);
|
||||
const char *getprompt(void *);
|
||||
|
||||
85
src/redir.c
85
src/redir.c
@ -32,6 +32,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h> /* PIPE_BUF */
|
||||
@ -55,6 +56,7 @@
|
||||
#include "output.h"
|
||||
#include "memalloc.h"
|
||||
#include "error.h"
|
||||
#include "system.h"
|
||||
#include "trap.h"
|
||||
|
||||
|
||||
@ -280,21 +282,29 @@ ecreate:
|
||||
sh_open_fail(fname, O_CREAT, EEXIST);
|
||||
}
|
||||
|
||||
static int sh_dup2(int ofd, int nfd, int cfd)
|
||||
{
|
||||
if (nfd < 0) {
|
||||
nfd = dup(ofd);
|
||||
if (nfd >= 0)
|
||||
cfd = -1;
|
||||
} else
|
||||
nfd = dup2(ofd, nfd);
|
||||
if (likely(cfd >= 0))
|
||||
close(cfd);
|
||||
if (nfd < 0)
|
||||
sh_error("%d: %s", ofd, strerror(errno));
|
||||
|
||||
return nfd;
|
||||
}
|
||||
|
||||
STATIC void
|
||||
#ifdef notyet
|
||||
dupredirect(redir, f, memory)
|
||||
static void dupredirect(union node *redir, int f, char memory[10])
|
||||
#else
|
||||
dupredirect(redir, f)
|
||||
static void dupredirect(union node *redir, int f)
|
||||
#endif
|
||||
union node *redir;
|
||||
int f;
|
||||
#ifdef notyet
|
||||
char memory[10];
|
||||
#endif
|
||||
{
|
||||
{
|
||||
int fd = redir->nfile.fd;
|
||||
int err = 0;
|
||||
|
||||
#ifdef notyet
|
||||
memory[fd] = 0;
|
||||
@ -307,26 +317,29 @@ dupredirect(redir, f)
|
||||
memory[fd] = 1;
|
||||
else
|
||||
#endif
|
||||
if (dup2(f, fd) < 0) {
|
||||
err = errno;
|
||||
goto err;
|
||||
}
|
||||
sh_dup2(f, fd, -1);
|
||||
return;
|
||||
}
|
||||
f = fd;
|
||||
} else if (dup2(f, fd) < 0)
|
||||
err = errno;
|
||||
|
||||
close(f);
|
||||
if (err < 0)
|
||||
goto err;
|
||||
|
||||
return;
|
||||
|
||||
err:
|
||||
sh_error("%d: %s", f, strerror(err));
|
||||
close(fd);
|
||||
} else
|
||||
sh_dup2(f, fd, f);
|
||||
}
|
||||
|
||||
int sh_pipe(int pip[2], int memfd)
|
||||
{
|
||||
if (memfd) {
|
||||
pip[0] = memfd_create("dash", 0);
|
||||
if (pip[0] >= 0) {
|
||||
pip[1] = sh_dup2(pip[0], -1, pip[0]);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (pipe(pip) < 0)
|
||||
sh_error("Pipe call failed");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle here documents. Normally we fork off a process to write the
|
||||
@ -337,12 +350,10 @@ err:
|
||||
STATIC int
|
||||
openhere(union node *redir)
|
||||
{
|
||||
char *p;
|
||||
int pip[2];
|
||||
size_t len = 0;
|
||||
|
||||
if (pipe(pip) < 0)
|
||||
sh_error("Pipe call failed");
|
||||
int pip[2];
|
||||
int memfd;
|
||||
char *p;
|
||||
|
||||
p = redir->nhere.doc->narg.text;
|
||||
if (redir->type == NXHERE) {
|
||||
@ -351,8 +362,11 @@ openhere(union node *redir)
|
||||
}
|
||||
|
||||
len = strlen(p);
|
||||
if (len <= PIPESIZE) {
|
||||
memfd = sh_pipe(pip, len > PIPESIZE);
|
||||
|
||||
if (memfd || len <= PIPESIZE) {
|
||||
xwrite(pip[1], p, len);
|
||||
lseek(pip[1], 0, SEEK_SET);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -446,13 +460,18 @@ savefd(int from, int ofd)
|
||||
int newfd;
|
||||
int err;
|
||||
|
||||
#if HAVE_F_DUPFD_CLOEXEC
|
||||
newfd = fcntl(from, F_DUPFD_CLOEXEC, 10);
|
||||
#else
|
||||
newfd = fcntl(from, F_DUPFD, 10);
|
||||
#endif
|
||||
|
||||
err = newfd < 0 ? errno : 0;
|
||||
if (err != EBADF) {
|
||||
close(ofd);
|
||||
if (err)
|
||||
sh_error("%d: %s", from, strerror(err));
|
||||
else
|
||||
else if(!HAVE_F_DUPFD_CLOEXEC)
|
||||
fcntl(newfd, F_SETFD, FD_CLOEXEC);
|
||||
}
|
||||
|
||||
|
||||
@ -50,4 +50,5 @@ int redirectsafe(union node *, int);
|
||||
void unwindredir(struct redirtab *stop);
|
||||
struct redirtab *pushredir(union node *redir);
|
||||
int sh_open(const char *pathname, int flags, int mayfail);
|
||||
int sh_pipe(int pip[2], int memfd);
|
||||
|
||||
|
||||
@ -54,6 +54,13 @@ static inline void sigclearmask(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef HAVE_MEMFD_CREATE
|
||||
static inline int memfd_create(const char *name, unsigned int flags)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_MEMPCPY
|
||||
void *mempcpy(void *, const void *, size_t);
|
||||
#endif
|
||||
|
||||
58
src/trap.c
58
src/trap.c
@ -37,6 +37,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "builtins.h"
|
||||
#include "shell.h"
|
||||
#include "main.h"
|
||||
#include "nodes.h" /* for other headers */
|
||||
@ -47,6 +48,7 @@
|
||||
#include "options.h"
|
||||
#include "syntax.h"
|
||||
#include "output.h"
|
||||
#include "parser.h"
|
||||
#include "memalloc.h"
|
||||
#include "error.h"
|
||||
#include "trap.h"
|
||||
@ -66,7 +68,9 @@
|
||||
|
||||
|
||||
/* trap handler commands */
|
||||
MKINIT char *trap[NSIG];
|
||||
static char *trap[NSIG];
|
||||
/* traps have not been fully cleared */
|
||||
static int ptrap;
|
||||
/* number of non-null traps */
|
||||
int trapcnt;
|
||||
/* current value of signal */
|
||||
@ -81,6 +85,7 @@ volatile sig_atomic_t gotsigchld;
|
||||
extern char *signal_names[];
|
||||
|
||||
static int decode_signum(const char *);
|
||||
MKINIT void clear_traps(union node *);
|
||||
|
||||
#ifdef mkinit
|
||||
INCLUDE "memalloc.h"
|
||||
@ -92,19 +97,7 @@ INIT {
|
||||
}
|
||||
|
||||
FORKRESET {
|
||||
char **tp;
|
||||
|
||||
INTOFF;
|
||||
for (tp = trap ; tp < &trap[NSIG] ; tp++) {
|
||||
if (*tp && **tp) { /* trap not NULL or SIG_IGN */
|
||||
ckfree(*tp);
|
||||
*tp = NULL;
|
||||
if (tp != &trap[0])
|
||||
setsignal(tp - trap);
|
||||
}
|
||||
}
|
||||
trapcnt = 0;
|
||||
INTON;
|
||||
clear_traps(n);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -133,6 +126,8 @@ trapcmd(int argc, char **argv)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if (ptrap)
|
||||
clear_traps(NULL);
|
||||
if (!ap[1] || decode_signum(*ap) >= 0)
|
||||
action = NULL;
|
||||
else
|
||||
@ -168,6 +163,39 @@ trapcmd(int argc, char **argv)
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Clear traps on a fork.
|
||||
*/
|
||||
|
||||
void clear_traps(union node *n)
|
||||
{
|
||||
int simplecmd;
|
||||
char **tp;
|
||||
|
||||
simplecmd = issimplecmd(n, TRAPCMD->name);
|
||||
|
||||
INTOFF;
|
||||
for (tp = trap ; tp < &trap[NSIG] ; tp++) {
|
||||
if (*tp && **tp) { /* trap not NULL or SIG_IGN */
|
||||
char *otp = *tp;
|
||||
|
||||
*tp = NULL;
|
||||
if (tp != &trap[0])
|
||||
setsignal(tp - trap);
|
||||
|
||||
if (simplecmd)
|
||||
*tp = otp;
|
||||
else
|
||||
ckfree(*tp);
|
||||
}
|
||||
}
|
||||
trapcnt = 0;
|
||||
ptrap = simplecmd;
|
||||
INTON;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Set the signal handler for the specified signal. The routine figures
|
||||
* out what it should be set to.
|
||||
@ -390,6 +418,8 @@ exitshell(void)
|
||||
handler = &loc;
|
||||
if ((p = trap[0])) {
|
||||
trap[0] = NULL;
|
||||
if (ptrap)
|
||||
goto out;
|
||||
evalskip = 0;
|
||||
evalstring(p, 0);
|
||||
evalskip = SKIPFUNCDEF;
|
||||
|
||||
70
src/var.c
70
src/var.c
@ -107,7 +107,7 @@ STATIC struct var *vartab[VTABSIZE];
|
||||
|
||||
STATIC struct var **hashvar(const char *);
|
||||
STATIC int vpcmp(const void *, const void *);
|
||||
STATIC struct var **findvar(struct var **, const char *);
|
||||
STATIC struct var **findvar(const char *);
|
||||
|
||||
/*
|
||||
* Initialize the varable symbol tables and import the environment
|
||||
@ -154,6 +154,10 @@ RESET {
|
||||
}
|
||||
#endif
|
||||
|
||||
static char *varnull(const char *s)
|
||||
{
|
||||
return (strchr(s, '=') ?: nullstr - 1) + 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* This routine initializes the builtin variables. It is called when the
|
||||
@ -247,11 +251,12 @@ struct var *setvareq(char *s, int flags)
|
||||
{
|
||||
struct var *vp, **vpp;
|
||||
|
||||
vpp = hashvar(s);
|
||||
flags |= (VEXPORT & (((unsigned) (1 - aflag)) - 1));
|
||||
vpp = findvar(vpp, s);
|
||||
vpp = findvar(s);
|
||||
vp = *vpp;
|
||||
if (vp) {
|
||||
unsigned bits;
|
||||
|
||||
if (vp->flags & VREADONLY) {
|
||||
const char *n;
|
||||
|
||||
@ -262,17 +267,17 @@ struct var *setvareq(char *s, int flags)
|
||||
n);
|
||||
}
|
||||
|
||||
if (flags & VNOSET)
|
||||
goto out;
|
||||
|
||||
if (vp->func && (flags & VNOFUNC) == 0)
|
||||
(*vp->func)(strchrnul(s, '=') + 1);
|
||||
(*vp->func)(varnull(s));
|
||||
|
||||
if ((vp->flags & (VTEXTFIXED|VSTACK)) == 0)
|
||||
ckfree(vp->text);
|
||||
|
||||
if (((flags & (VEXPORT|VREADONLY|VSTRFIXED|VUNSET)) |
|
||||
(vp->flags & VSTRFIXED)) == VUNSET) {
|
||||
if ((flags & (VEXPORT|VREADONLY|VSTRFIXED|VUNSET)) != VUNSET)
|
||||
bits = ~(VTEXTFIXED|VSTACK|VNOSAVE|VUNSET);
|
||||
else if ((vp->flags & VSTRFIXED))
|
||||
bits = VSTRFIXED;
|
||||
else {
|
||||
*vpp = vp->next;
|
||||
ckfree(vp);
|
||||
out_free:
|
||||
@ -281,10 +286,8 @@ out_free:
|
||||
goto out;
|
||||
}
|
||||
|
||||
flags |= vp->flags & ~(VTEXTFIXED|VSTACK|VNOSAVE|VUNSET);
|
||||
flags |= vp->flags & bits;
|
||||
} else {
|
||||
if (flags & VNOSET)
|
||||
goto out;
|
||||
if ((flags & (VEXPORT|VREADONLY|VSTRFIXED|VUNSET)) == VUNSET)
|
||||
goto out_free;
|
||||
/* not found */
|
||||
@ -311,7 +314,7 @@ lookupvar(const char *name)
|
||||
{
|
||||
struct var *v;
|
||||
|
||||
if ((v = *findvar(hashvar(name), name)) && !(v->flags & VUNSET)) {
|
||||
if ((v = *findvar(name)) && !(v->flags & VUNSET)) {
|
||||
#ifdef WITH_LINENO
|
||||
if (v == &vlineno && v->text == linenovar) {
|
||||
fmtstr(linenovar+7, sizeof(linenovar)-7, "%d", lineno);
|
||||
@ -418,7 +421,7 @@ exportcmd(int argc, char **argv)
|
||||
if ((p = strchr(name, '=')) != NULL) {
|
||||
p++;
|
||||
} else {
|
||||
if ((vp = *findvar(hashvar(name), name))) {
|
||||
if ((vp = *findvar(name))) {
|
||||
vp->flags |= flag;
|
||||
continue;
|
||||
}
|
||||
@ -462,7 +465,6 @@ localcmd(int argc, char **argv)
|
||||
void mklocal(char *name, int flags)
|
||||
{
|
||||
struct localvar *lvp;
|
||||
struct var **vpp;
|
||||
struct var *vp;
|
||||
|
||||
INTOFF;
|
||||
@ -475,8 +477,7 @@ void mklocal(char *name, int flags)
|
||||
} else {
|
||||
char *eq;
|
||||
|
||||
vpp = hashvar(name);
|
||||
vp = *findvar(vpp, name);
|
||||
vp = *findvar(name);
|
||||
eq = strchr(name, '=');
|
||||
if (vp == NULL) {
|
||||
if (eq)
|
||||
@ -531,7 +532,7 @@ poplocalvars(void)
|
||||
unsetvar(vp->text);
|
||||
} else {
|
||||
if (vp->func)
|
||||
(*vp->func)(strchrnul(lvp->text, '=') + 1);
|
||||
(*vp->func)(varnull(lvp->text));
|
||||
if ((vp->flags & (VTEXTFIXED|VSTACK)) == 0)
|
||||
ckfree(vp->text);
|
||||
vp->flags = lvp->flags;
|
||||
@ -621,12 +622,7 @@ void unsetvar(const char *s)
|
||||
STATIC struct var **
|
||||
hashvar(const char *p)
|
||||
{
|
||||
unsigned int hashval;
|
||||
|
||||
hashval = ((unsigned char) *p) << 4;
|
||||
while (*p && *p != '=')
|
||||
hashval += (unsigned char) *p++;
|
||||
return &vartab[hashval % VTABSIZE];
|
||||
return &vartab[hashval(p) % VTABSIZE];
|
||||
}
|
||||
|
||||
|
||||
@ -640,19 +636,19 @@ hashvar(const char *p)
|
||||
int
|
||||
varcmp(const char *p, const char *q)
|
||||
{
|
||||
int c, d;
|
||||
|
||||
while ((c = *p) == (d = *q)) {
|
||||
if (!c || c == '=')
|
||||
goto out;
|
||||
int c = *p, d = *q;
|
||||
while (c == d) {
|
||||
if (!c)
|
||||
break;
|
||||
p++;
|
||||
q++;
|
||||
c = *p;
|
||||
d = *q;
|
||||
if (c == '=')
|
||||
c = '\0';
|
||||
if (d == '=')
|
||||
d = '\0';
|
||||
}
|
||||
if (c == '=')
|
||||
c = 0;
|
||||
if (d == '=')
|
||||
d = 0;
|
||||
out:
|
||||
return c - d;
|
||||
}
|
||||
|
||||
@ -663,9 +659,11 @@ vpcmp(const void *a, const void *b)
|
||||
}
|
||||
|
||||
STATIC struct var **
|
||||
findvar(struct var **vpp, const char *name)
|
||||
findvar(const char *name)
|
||||
{
|
||||
for (; *vpp; vpp = &(*vpp)->next) {
|
||||
struct var **vpp;
|
||||
|
||||
for (vpp = hashvar(name); *vpp; vpp = &(*vpp)->next) {
|
||||
if (varequal((*vpp)->text, name)) {
|
||||
break;
|
||||
}
|
||||
|
||||
17
src/var.h
17
src/var.h
@ -48,7 +48,7 @@
|
||||
#define VSTACK 0x10 /* text is allocated on the stack */
|
||||
#define VUNSET 0x20 /* the variable is not set */
|
||||
#define VNOFUNC 0x40 /* don't call the callback function */
|
||||
#define VNOSET 0x80 /* do not set variable - just readonly test */
|
||||
/* #define VNOSET 0x80 do not set variable - just readonly test */
|
||||
#define VNOSAVE 0x100 /* when text is on the heap before setvareq */
|
||||
|
||||
|
||||
@ -153,6 +153,21 @@ int unsetcmd(int, char **);
|
||||
void unsetvar(const char *);
|
||||
int varcmp(const char *, const char *);
|
||||
|
||||
static inline unsigned int hashval(const char *p)
|
||||
{
|
||||
unsigned int hashval;
|
||||
|
||||
hashval = ((unsigned char) *p) << 4;
|
||||
while (*p) {
|
||||
hashval += (unsigned char) *p++;
|
||||
if (*p == '=')
|
||||
break;
|
||||
}
|
||||
|
||||
return hashval;
|
||||
}
|
||||
|
||||
|
||||
static inline int varequal(const char *a, const char *b) {
|
||||
return !varcmp(a, b);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user