Initial devel branch import from bash-3.0-alpha

This commit is contained in:
Chet Ramey
2011-11-28 14:41:26 -05:00
parent 7117c2d221
commit d3a24ed242
261 changed files with 24280 additions and 6327 deletions
+1
View File
@@ -100,6 +100,7 @@ builtins/alias.def Brian Fox, Chet Ramey
builtins/bind.def Brian Fox, Chet Ramey
builtins/break.def Brian Fox, Chet Ramey
builtins/builtin.def Brian Fox, Chet Ramey
builtins/caller.def Rocky Bernstein, Chet Ramey
builtins/cd.def Brian Fox, Chet Ramey
builtins/colon.def Brian Fox, Chet Ramey
builtins/command.def Brian Fox, Chet Ramey
+426 -1
View File
@@ -1,3 +1,428 @@
This document details the changes between this version, bash-3.0-alpha,
and the previous version, bash-2.05b-release.
1. Changes to Bash
a. Fixes so that the shell will compile without some of the default options
defined.
b. Fixed an error message that did not pass enough arguments to printf.
c. Fixed a bug that caused input redirection to a builtin inside a script
being read from standard input to result in the rest of the already-
read and buffered script to be discarded.
d. Fixed a bug that caused subshell initialization to close the file
descriptor from which the shell was reading a script under certain
circumstances.
e. Fixed a bug that caused the shell to not advance a string pointer over
a null wide character when doing string operations.
f. Fixed the internal logout code so that shells that time out waiting for
input (using $TMOUT) run ~/.bash_logout.
g. Portability and configuration changes for: cygwin, HP/UX, GNU/FreeBSD.
h. The parser no longer adds implicit double quotes to ((...)) arithmetic
commands.
i. The ((...)) arithmetic command evaluation code was fixed to not dump core
when the expanded string is null.
j. The ((...)) arithmetic command evaluation code was fixed to not perform
variable assignments while expanding the expression.
k. Fixed a bug that caused word splitting to be performed incorrectly when
IFS is set, but null.
l. Fixed a bug in brace expansion that caused a quoted `$' preceding an
open brace to inhibit brace expansion.
m. Fixed a bug that caused a leading `-' in the shell's name to cause it to
not be recognized as a restricted shell.
n. Fixed a bug in the arithmetic evaluation code that could cause longjmps
to an invalid location and result in a core dump.
o. Fixed a bug in the calculation of how many history lines are new in a
single shell session when reading new history lines from a file with
`history -n'.
p. Fixed a bug in pathname canonicalization that caused the shell to dump
core when presented with a pathname longer than PATH_MAX.
q. Fixed the parser so that it doesn't try to compare a char variable to
EOF, which fails when chars are unsigned.
r. Fixed a bug in the simple command execution code that caused occasional
core dumps.
s. The shell does a better job of saving any partial parsing state during
operations which cause a command to be executed while a line is being
entered and parsed.
t. The completion code now splits words more like the expansion code when
$IFS is used to split.
u. The locale code does a better job of recomputing the various locale
variable values when LC_ALL is unset.
v. The programmable completion code does a better job of dequoting expanded
word lists before comparing them against the word to be matched.
w. The shell no longer seg faults if the expanded value of $PS4 is null
and `set -x' is enabled.
x. Fixed a bug that caused core dumps when a here string expanded to NULL.
y. The mail checking code now makes sure the mailbox is bigger before
reporting the existence of new mail.
z. The parser does not try to expand $'...' and $"..." when the appear
within double quotes unless the `extquote' option has been enabled with
`shopt'. For backwards compatibility, it is enabled by default.
aa. Fixed a bug that caused `for x; do ...' and `select x; do ... to use
$@ instead of "$@" for the implicit list of arguments.
bb. Fixed a bug that caused a subshell of a restricted shell (e.g., one
spawned to execute a pipeline) to not exit immediately if attempting
to use a command containing a slash.
cc. Fixed a problem with empty replacements for a pattern that doesn't match
when performing ${param/word/} expansion.
dd. Word expansions performed while expanding redirections no longer search
a command's temporary environment to expand variable values.
ee. Improvements to the alias expansion code when expanding subsequent words
because an aliase's value ends with a space.
ff. `cd -' now prints the current working directory after a successful chdir
even when the shell is not interactive, as the standard requires.
gg. The shell does a better job of ensuring a child process dies of SIGINT
before resending SIGINT to itself.
hh. The arithmetic expansion variable assignment code now does the right
thing when assigning to `special' variables like OPTIND.
ii. When history expansion verification is enabled, the bash readline helper
functions that do history expansion on the current line don't print
the results.
jj. Fixed bugs with multiple consecutive alias expansion when one of the
expansions ends with a space.
kk. Fixed a problem in the programmable completion code that could cause core
dumps when trying to initialize a set of possible completions from a
list of variables.
ll. The \[ and \] escape characters are now ignored when decoding the prompt
string if the shell is started with editing disabled.
mm. Fixed a bug that could leave extra characters in a string when doing
quoted null character removal.
nn. Command substitution and other subshell operations no longer reset the
line number (aids the bash debugger).
oo. Better line number management when executing simple commands, conditional
commands, for commands, and select commands.
pp. The globbing code now uses malloc, with its better failure properties,
rather than alloca().
qq. Fixed a bug that caused expansions like #{a[2]:=value} to create the
appropriate array element instead of a variable named `a[2]'.
rr. Fixed a bug in the handling of a `?(...)' pattern immediately following
a `*' when extglob is enabled.
ss. Fixed a bug that caused a `return' invoked in an exit trap when exit is
invoked in a function to misbehave.
tt. Fixed a bug that caused CTLESC and CTLNUL characters to not be escaped
by the internal shell string quoting functions.
uu. Fixed a bug that cause
vv. Fixed a bug that caused redirections accompanying a null command to persist
in the current shell.
ww. Fixed a bug that caused the prompt to be printed when the shell was
expanding a multiline alias.
xx. Fixed a bug that resulted in core dumps when the completion for a command
changed the compspec.
yy. Fixed a bug that caused evaluation of programmable completions to print
notifications of completed jobs.
zz. Bash now disables line editing when $EMACS == `t' and $TERM == `dumb'
(which is what emacs shell windows do).
aaa. In posix mode, `kill -l' causes signal names to be displayed without
a leading `SIG'.
bbb. Clear error flag on standard output so it doesn't persist across multiple
builtin commands.
ccc. In posix mode, `alias' displays alias values without the leading `alias',
so the output cannot be used as subsequent input.
ddd. In posix mode, the `trap' builtin doesn't check whether or not its
first argument is a signal specification and revert the signal handling
to its original disposition if it is.
eee. Fixed several bugs in the handling of "$*" and "${array[*]}" by the
pattern substitution and removal expansions.
fff. Fixed several problems with the handling of ${array[@]}, ${array[*]},
$@, and $* by the indirect variable expansion code.
ggg. Fixed a bug that did not allow `time' to be aliased.
hhh. Improved the mail checking code so it won't check (and possibly cause an
NFS file system mount) until MAILPATH or MAIL is given a value -- there
is no default if DEFAULT_MAIL_DIRECTORY is not defined at compile time.
(It is computed by configure, but can be #undef'd in config-bot.h.)
iii. If the `chkwinsize' option is enabled, the shell checks for window size
changes if a child process exits due to a signal.
jjj. Removed the attempts to avoid adding a slash at the end of a completed
executable name if there was a directory with the same name in the
current directory.
kkk. Fixed PATH lookup code so it treats the permission bits separately for
owner, group, and other, rather than checking them all.
lll. Fixed the locale code to reset the parser's idea of the character class
<blank>, which controls how it splits tokens, when the locale changes.
mmm. The shell now binds its special readline functions and key bindings only
if the user's inputrc file has not already bound them.
nnn. The shell now reports on processes that dump core due to signals when
invoked as `-c command'.
2. Changes to Readline
a. Fixes to avoid core dumps because of null pointer references in the
multibyte character code.
b. Fix to avoid infinite recursion caused by certain key combinations.
c. Fixed a bug that caused the vi-mode `last command' to be set incorrectly.
d. Readline no longer tries to read ahead more than one line of input, even
when more is available.
e. Fixed the code that adjusts the point to not mishandle null wide
characters.
f. Fixed a bug in the history expansion `g' modifier that caused it to skip
every other match.
g. Fixed a bug that caused the prompt to overwrite previous output when the
output doesn't contain a newline and the locale supports multibyte
characters. This same change fixes the problem of readline redisplay
slowing down dramatically as the line gets longer in multibyte locales.
h. History traversal with arrow keys in vi insertion mode causes the cursor
to be placed at the end of the new line, like in emacs mode.
i. The locale initialization code does a better job of using the right
precedence and defaulting when checking the appropriate environment
variables.
j. Fixed the history word tokenizer to handle <( and >( better when used as
part of bash.
k. The overwrite mode code received several bug fixes to improve undo.
l. Many speedups to the multibyte character redisplay code.
m. The callback character reading interface should not hang waiting to read
keyboard input.
n. Fixed a bug with redoing vi-mode `s' command.
o. The code that initializes the terminal tracks changes made to the terminal
special characters with stty(1) (or equivalent), so that these changes
are reflected in the readline bindings. New application-callable function
to make it work: rl_tty_unset_default_bindings().
p. Fixed a bug that could cause garbage to be inserted in the buffer when
changing character case in vi mode when using a multibyte locale.
q. Fixed a bug in the redisplay code that caused problems on systems
supporting multibyte characters when moving between history lines when the
new line has more glyphs but fewer bytes.
r. Undo and redo now work better after exiting vi insertion mode.
s. Make sure system calls are restarted after a SIGWINCH is received using
SA_RESTART.
t. Improvements to the code that displays possible completions when using
multibyte characters.
u. Fixed a problem when parsing nested if statements in inputrc files.
v. The completer now takes multibyte characters into account when looking for
quoted substrings on which to perform completion.
w. The history search functions now perform better bounds checking on the
history list.
3. New Features in Bash
a. ANSI string expansion now implements the \x{hexdigits} escape.
b. There is a new loadable `strftime' builtin.
c. New variable, COMP_WORDBREAKS, which controls the readline completer's
idea of word break characters.
d. The `type' builtin no longer reports on aliases unless alias expansion
will actually be performed.
e. HISTCONTROL is now a colon-separated list of values, which permits
more extensibility and backwards compatibility.
f. HISTCONTROL may now include the `erasedups' option, which causes all lines
matching a line being added to be removed from the history list.
g. `configure' has a new `--enable-multibyte' argument that permits multibyte
character support to be disabled even on systems that support it.
h. New variables to support the bash debugger: BASH_ARGC, BASH_ARGV,
BASH_SOURCE, BASH_LINENO, BASH_SUBSHELL, BASH_EXECUTION_STRING,
BASH_COMMAND
i. FUNCNAME has been changed to support the debugger: it's now an array
variable.
j. for, case, select, arithmetic commands now keep line number information
for the debugger.
k. There is a new `RETURN' trap executed when a function or sourced script
returns (not inherited child processes; inherited by command substitution
if function tracing is enabled and the debugger is active).
l. New invocation option: --debugger. Enables debugging and turns on new
`extdebug' shell option.
m. New `functrace' and `errtrace' options to `set -o' cause DEBUG and ERR
traps, respectively, to be inherited by shell functions. Equivalent to
`set -T' and `set -E' respectively. The `functrace' option also controls
whether or not the DEBUG trap is inherited by sourced scripts.
n. The DEBUG trap is run before binding the variable and running the action
list in a `for' command, binding the selection variable and running the
query in a `select' command, and before attempting a match in a `case'
command.
o. New `--enable-debugger' option to `configure' to compile in the debugger
support code.
p. `declare -F' now prints out extra line number and source file information
if the `extdebug' option is set.
q. If `extdebug' is enabled, a non-zero return value from a DEBUG trap causes
the next command to be skipped, and a return value of 2 while in a
function or sourced script forces a `return'.
r. New `caller' builtin to provide a call stack for the bash debugger.
s. The DEBUG trap is run just before the first command in a function body is
executed, for the debugger.
t. `for', `select', and `case' command heads are printed when `set -x' is
enabled.
u. There is a new {x..y} brace expansion, which is shorthand for {x.x+1,
x+2,...,y}. x and y can be integers or single characters; the sequence
may ascend or descend; the increment is always 1.
v. New ksh93-like ${!array[@]} expansion, expands to all the keys (indices)
of array.
w. New `force_fignore' shopt option; if enabled, suffixes specified by
FIGNORE cause words to be ignored when performing word completion even
if they're the only possibilities.
x. New `gnu_errfmt' shopt option; if enabled, error messages follow the `gnu
style' (filename:lineno:message) format.
y. New `-o bashdefault' option to complete and compgen; if set, causes the
whole set of bash completions to be performed if the compspec doesn't
result in a match.
z. New `-o plusdirs' option to complete and compgen; if set, causes directory
name completion to be performed and the results added to the rest of the
possible completions.
aa. `kill' is available as a builtin even when the shell is built without
job control.
bb. New HISTTIMEFORMAT variable; value is a format string to pass to
strftime(3). If set and not null, the `history' builtin prints out
timestamp information according to the specified format when displaying
history entries. If set, bash tells the history library to write out
timestamp information when the history file is written.
cc. The [[ ... ]] command has a new binary `=~' operator that performs
extended regular expression (egrep-like) matching.
dd. `configure' has a new `--enable-cond-regexp' option (enabled by default)
to enable the =~ operator and regexp matching in [[ ... ]].
ee. Subexpressions matched by the =~ operator are placed in the new
BASH_REMATCH array variable.
ff. New `failglob' option that causes an expansion error when pathname
expansion fails to produce a match.
gg. New `set -o pipefail' option that causes a pipeline to return a failure
status if any of the processes in the pipeline fail, not just the last
one.
4. New Features in Readline
a. History expansion has a new `a' modifier equivalent to the `g' modifier
for compatibility with the BSD csh.
b. History expansion has a new `G' modifier equivalent to the BSD csh `g'
modifier, which performs a substitution once per word.
c. All non-incremental search operations may now undo the operation of
replacing the current line with the history line.
d. The text inserted by an `a' command in vi mode can be reinserted with
`.'.
e. New bindable variable, `show-all-if-unmodified'. If set, the readline
completer will list possible completions immediately if there is more
than one completion and partial completion cannot be performed.
f. There is a new application-callable `free_history_entry()' function.
g. History list entries now contain timestamp information; the history file
functions know how to read and write timestamp information associated
with each entry.
h. Four new key binding functions have been added:
rl_bind_key_if_unbound()
rl_bind_key_if_unbound_in_map()
rl_bind_keyseq_if_unbound()
rl_bind_keyseq_if_unbound_in_map()
------------------------------------------------------------------------------
This document details the changes between this version, bash-2.05b-release,
and the previous version, bash-2.05b-beta2.
@@ -157,7 +582,7 @@ e. The `fc' builtin has been fixed, as POSIX requires, to use the closest
f. The history file loading code was changed to allow lines to be saved in
the history list from the shell startup files.
g. `history -s args' now works bettern in compound commands.
g. `history -s args' now works better in compound commands.
h. The tilde expansion code was fixed to better recognize when it's being
invoked in an assignment context, which enables expansion after `='
+2205 -1
View File
File diff suppressed because it is too large Load Diff
+4
View File
@@ -316,6 +316,10 @@ does not provide the necessary support.
This enables the job control features (*note Job Control::), if
the operating system supports them.
`--enable-multibyte'
This enables support for multibyte characters if the operating
system provides the necessary support.
`--enable-net-redirections'
This enables the special handling of filenames of the form
`/dev/tcp/HOST/PORT' and `/dev/udp/HOST/PORT' when used in
+41 -11
View File
@@ -140,16 +140,17 @@ execute_cmd.h f
redir.h f
bashtypes.h f
mailcheck.h f
pathnames.h f
xmalloc.h f
y.tab.c f
y.tab.h f
parser-built f
pathnames.h.in f
builtins/Makefile.in f
builtins/alias.def f
builtins/bind.def f
builtins/break.def f
builtins/builtin.def f
builtins/caller.def f
builtins/cd.def f
builtins/colon.def f
builtins/command.def f
@@ -313,14 +314,15 @@ lib/readline/rlstdc.h f
lib/readline/rlprivate.h f
lib/readline/xmalloc.h f
lib/readline/doc/Makefile f
lib/readline/doc/manvers.texinfo f
lib/readline/doc/rlman.texinfo f
lib/readline/doc/rltech.texinfo f
lib/readline/doc/rluser.texinfo f
lib/readline/doc/rluserman.texinfo f
lib/readline/doc/hist.texinfo f
lib/readline/doc/hstech.texinfo f
lib/readline/doc/hsuser.texinfo f
lib/readline/doc/version.texi f
lib/readline/doc/rlman.texi f
lib/readline/doc/rltech.texi f
lib/readline/doc/rluser.texi f
lib/readline/doc/rluserman.texi f
lib/readline/doc/history.texi f
lib/readline/doc/hstech.texi f
lib/readline/doc/hsuser.texi f
lib/readline/doc/fdl.texi f
lib/readline/examples/Makefile f
lib/readline/examples/excallback.c f
lib/readline/examples/fileman.c f
@@ -351,6 +353,7 @@ lib/sh/pathcanon.c f
lib/sh/pathphys.c f
lib/sh/rename.c f
lib/sh/setlinebuf.c f
lib/sh/shmatch.c f
lib/sh/shquote.c f
lib/sh/shtty.c f
lib/sh/snprintf.c f
@@ -362,6 +365,7 @@ lib/sh/strindex.c f
lib/sh/stringlist.c f
lib/sh/stringvec.c f
lib/sh/strpbrk.c f
lib/sh/strstr.c f
lib/sh/strtod.c f
lib/sh/strtoimax.c f
lib/sh/strtol.c f
@@ -427,9 +431,13 @@ doc/README f
doc/INTRO f
doc/texinfo.tex f
doc/bashref.texi f
doc/version.texi f
doc/bashref.info f
doc/article.ms f
doc/htmlpost.sh f 755
doc/infopost.sh f 755
doc/fdl.texi f
doc/fdl.txt f
support/Makefile.in f
support/bashversion.c f
support/config.guess f
@@ -450,7 +458,7 @@ support/zecho.c f
support/SYMLINKS f
support/fixlinks f 755
support/install.sh f 755
support/texi2dvi f
support/texi2dvi f 755
support/texi2html f 755
support/xenix-link.sh f 755
support/shobj-conf f 755
@@ -468,6 +476,7 @@ examples/complete/complete.ianmac f
examples/complete/complete2.ianmac f
examples/complete/complete.freebsd f
examples/complete/complete.gnu-longopt f
examples/complete/bashcc-1.0.1.tar.gz f
examples/loadables/README f
examples/loadables/template.c f
examples/loadables/Makefile.in f
@@ -476,6 +485,7 @@ examples/loadables/hello.c f
examples/loadables/print.c f
examples/loadables/realpath.c f
examples/loadables/sleep.c f
examples/loadables/strftime.c f
examples/loadables/truefalse.c f
examples/loadables/getconf.h f
examples/loadables/getconf.c f
@@ -601,6 +611,8 @@ examples/misc/aliasconv.sh f
examples/misc/aliasconv.bash f
examples/misc/cshtobash f
tests/README f
tests/alias.tests f
tests/alias.right f
tests/arith-for.tests f
tests/arith-for.right f
tests/arith.tests f
@@ -609,7 +621,7 @@ tests/array.tests f
tests/array.right f
tests/array-at-star f
tests/array2.right f
tests/braces-tests f
tests/braces.tests f
tests/braces.right f
tests/builtins.tests f
tests/builtins.right f
@@ -624,7 +636,13 @@ tests/cond.tests f
tests/cond.right f
tests/cprint.tests f
tests/cprint.right f
tests/dbg-support.right f
tests/dbg-support.sub f
tests/dbg-support.tests f
tests/dbg-support2.right f
tests/dbg-support2.tests f
tests/dollar-at-star f
tests/dollar-star1.sub f
tests/dollar.right f
tests/dstack.tests f
tests/dstack.right f
@@ -640,6 +658,7 @@ tests/exec3.sub f
tests/exec4.sub f
tests/exec5.sub f
tests/exec6.sub f
tests/exec7.sub f
tests/exp-tests f
tests/exp.right f
tests/extglob.tests f
@@ -690,6 +709,7 @@ tests/new-exp.tests f
tests/new-exp1.sub f
tests/new-exp2.sub f
tests/new-exp3.sub f
tests/new-exp4.sub f
tests/new-exp.right f
tests/nquote.tests f
tests/nquote.right f
@@ -699,6 +719,8 @@ tests/nquote2.tests f
tests/nquote2.right f
tests/nquote3.tests f
tests/nquote3.right f
tests/nquote4.tests f
tests/nquote4.right f
tests/posix2.tests f
tests/posix2.right f
tests/posixpat.tests f
@@ -725,12 +747,14 @@ tests/redir3.in2 f
tests/redir4.sub f
tests/redir4.in1 f
tests/redir5.sub f
tests/redir6.sub f
tests/rhs-exp.tests f
tests/rhs-exp.right f
tests/rsh.tests f
tests/rsh.right f
tests/run-all f
tests/run-minimal f
tests/run-alias f
tests/run-arith-for f
tests/run-arith f
tests/run-array f
@@ -739,6 +763,8 @@ tests/run-braces f
tests/run-builtins f
tests/run-cond f
tests/run-cprint f
tests/run-dbg-support f
tests/run-dbg-support2 f
tests/run-dirstack f
tests/run-dollars f
tests/run-errors f
@@ -763,6 +789,7 @@ tests/run-nquote f
tests/run-nquote1 f
tests/run-nquote2 f
tests/run-nquote3 f
tests/run-nquote4 f
tests/run-posix2 f
tests/run-posixpat f
tests/run-precedence f
@@ -773,6 +800,7 @@ tests/run-redir f
tests/run-rhs-exp f
tests/run-rsh f
tests/run-set-e f
tests/run-set-x f
tests/run-shopt f
tests/run-strip f
tests/run-test f
@@ -782,6 +810,8 @@ tests/run-type f
tests/run-varenv f
tests/set-e-test f
tests/set-e.right f
tests/set-x.tests f
tests/set-x.right f
tests/shopt.tests f
tests/shopt.right f
tests/strip.tests f
+69 -52
View File
@@ -1,4 +1,4 @@
# Makefile for bash-2.05b, version 2.142
# Makefile for bash-2.05b, version 2.145
#
# Copyright (C) 1996-2002 Free Software Foundation, Inc.
@@ -179,7 +179,7 @@ SHLIB_SOURCE = ${SH_LIBSRC}/clktck.c ${SH_LIBSRC}/getcwd.c \
${SH_LIBSRC}/fmtumax.c ${SH_LIBSRC}/netconn.c \
${SH_LIBSRC}/mktime.c ${SH_LIBSRC}/strftime.c \
${SH_LIBSRC}/memset.c ${SH_LIBSRC}/xstrchr.c \
${SH_LIBSRC}/zcatfd.c
${SH_LIBSRC}/zcatfd.c ${SH_LIBSRC}/shmatch.c
SHLIB_LIB = -lsh
SHLIB_LIBNAME = libsh.a
@@ -221,7 +221,7 @@ READLINE_SOURCE = $(RL_LIBSRC)/rldefs.h $(RL_LIBSRC)/rlconf.h \
$(RL_LIBSRC)/terminal.c $(RL_LIBSRC)/nls.c \
$(RL_LIBSRC)/input.c $(RL_LIBSRC)/xmalloc.c \
$(RL_LIBSRC)/shell.c $(RL_LIBSRC)/savestring.c \
$(RL_LIBSRC)/misc.c $(RL_LIBSRC)/compat.c \
$(RL_LIBSRC)/misc.c $(RL_LIBSRC)/mbutil.c $(RL_LIBSRC)/compat.c \
$(RL_LIBSRC)/histexpand.c $(RL_LIBSRC)/history.c \
$(RL_LIBSRC)/histsearch.c $(RL_LIBSRC)/histfile.c
@@ -236,7 +236,7 @@ READLINE_OBJ = $(RL_LIBDIR)/readline.o $(RL_LIBDIR)/funmap.o \
$(RL_LIBDIR)/macro.o $(RL_LIBDIR)/input.o \
$(RL_LIBDIR)/terminal.o $(RL_LIBDIR)/callback.o \
$(RL_LIBDIR)/shell.o $(RL_LIBDIR)/savestring.o \
$(RL_LIBDIR)/compat.o \
$(RL_LIBDIR)/mbutil.o $(RL_LIBDIR)/compat.o \
$(RL_LIBDIR)/history.o $(RL_LIBDIR)/histexpand.o \
$(RL_LIBDIR)/histsearch.o $(RL_LIBDIR)/histfile.o
@@ -395,11 +395,12 @@ BUILTIN_SRCDIR=$(srcdir)/builtins
DEFSRC=$(BUILTIN_SRCDIR)
BUILTIN_ABSSRC=${topdir}/builtins
DEFDIR = $(dot)/builtins
DEBUGGER_DIR = $(dot)/debugger
BUILTIN_DEFS = $(DEFSRC)/alias.def $(DEFSRC)/bind.def $(DEFSRC)/break.def \
$(DEFSRC)/builtin.def $(DEFSRC)/cd.def $(DEFSRC)/colon.def \
$(DEFSRC)/command.def ${DEFSRC}/complete.def \
$(DEFSRC)/declare.def \
$(DEFSRC)/caller.def $(DEFSRC)/declare.def \
$(DEFSRC)/echo.def $(DEFSRC)/enable.def $(DEFSRC)/eval.def \
$(DEFSRC)/exec.def $(DEFSRC)/exit.def $(DEFSRC)/fc.def \
$(DEFSRC)/fg_bg.def $(DEFSRC)/hash.def $(DEFSRC)/help.def \
@@ -418,7 +419,7 @@ BUILTIN_C_OBJ = $(DEFDIR)/common.o $(DEFDIR)/evalstring.o \
$(DEFDIR)/evalfile.o $(DEFDIR)/bashgetopt.o
BUILTIN_OBJS = $(DEFDIR)/alias.o $(DEFDIR)/bind.o $(DEFDIR)/break.o \
$(DEFDIR)/builtin.o $(DEFDIR)/cd.o $(DEFDIR)/colon.o \
$(DEFDIR)/command.o $(DEFDIR)/declare.o \
$(DEFDIR)/command.o $(DEFDIR)/caller.o $(DEFDIR)/declare.o \
$(DEFDIR)/echo.o $(DEFDIR)/enable.o $(DEFDIR)/eval.o \
$(DEFDIR)/exec.o $(DEFDIR)/exit.o $(DEFDIR)/fc.o \
$(DEFDIR)/fg_bg.o $(DEFDIR)/hash.o $(DEFDIR)/help.o \
@@ -578,7 +579,7 @@ syntax.c: mksyntax${EXEEXT} $(srcdir)/syntax.h
$(RM) $@
./mksyntax -o $@
$(BUILTINS_LIBRARY): $(BUILTIN_DEFS) $(BUILTIN_C_SRC) config.h ${BASHINCDIR}/memalloc.h
$(BUILTINS_LIBRARY): $(BUILTIN_DEFS) $(BUILTIN_C_SRC) config.h ${BASHINCDIR}/memalloc.h version.h
@(cd $(DEFDIR) && $(MAKE) $(MFLAGS) DEBUG=${DEBUG} libbuiltins.a ) || exit 1
# these require special rules to circumvent make builtin rules
@@ -597,6 +598,9 @@ ${DEFDIR}/builtext.h: $(BUILTIN_DEFS)
Makefile makefile: config.status $(srcdir)/Makefile.in
CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status
pathnames.h: config.status $(srcdir)/Makefile.in
CONFIG_HEADERS= $(SHELL) ./config.status
Makefiles makefiles: config.status $(srcdir)/Makefile.in
@for mf in $(CREATED_MAKEFILES); do \
CONFIG_FILES=$$mf CONFIG_HEADERS= $(SHELL) ./config.status ; \
@@ -670,7 +674,7 @@ uninstall: .made
basic-clean:
$(RM) $(OBJECTS) $(Program) bashbug
$(RM) .build .made version.h
$(RM) .build .made version.h pathnames.h
clean: basic-clean
( cd $(DOCDIR) && $(MAKE) $(MFLAGS) $@ )
@@ -799,22 +803,27 @@ dispose_cmd.o: make_cmd.h subst.h sig.h pathnames.h externs.h
dispose_cmd.o: ${BASHINCDIR}/ocache.h
error.o: config.h bashtypes.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h flags.h ${BASHINCDIR}/stdc.h error.h
error.o: command.h general.h xmalloc.h externs.h input.h bashhist.h
error.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
error.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
error.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
error.o: make_cmd.h subst.h sig.h pathnames.h externs.h
error.o: input.h execute_cmd.h
eval.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h trap.h flags.h ${DEFSRC}/common.h
eval.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
eval.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
eval.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
eval.o: make_cmd.h subst.h sig.h pathnames.h externs.h
eval.o: input.h execute_cmd.h
eval.o: input.h execute_cmd.h
execute_cmd.o: config.h bashtypes.h ${BASHINCDIR}/filecntl.h ${BASHINCDIR}/posixstat.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
execute_cmd.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
execute_cmd.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
execute_cmd.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
execute_cmd.o: make_cmd.h subst.h sig.h pathnames.h externs.h
execute_cmd.o: make_cmd.h subst.h sig.h pathnames.h externs.h
execute_cmd.o: ${BASHINCDIR}/memalloc.h ${GRAM_H} flags.h builtins.h jobs.h quit.h siglist.h
execute_cmd.o: execute_cmd.h findcmd.h redir.h trap.h test.h pathexp.h
execute_cmd.o: $(DEFSRC)/common.h ${DEFDIR}/builtext.h ${GLOB_LIBSRC}/strmatch.h
execute_cmd.o: ${BASHINCDIR}/posixtime.h ${BASHINCDIR}/chartypes.h
expr.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
expr.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
expr.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
expr.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
expr.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
@@ -826,7 +835,7 @@ findcmd.o: ${BASHINCDIR}/stdc.h error.h general.h xmalloc.h variables.h arrayfun
findcmd.o: dispose_cmd.h make_cmd.h subst.h sig.h pathnames.h externs.h
findcmd.o: flags.h hashlib.h pathexp.h hashcmd.h
findcmd.o: ${BASHINCDIR}/chartypes.h
flags.o: config.h flags.h
flags.o: config.h flags.h
flags.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
flags.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
flags.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
@@ -835,7 +844,7 @@ general.o: config.h bashtypes.h ${BASHINCDIR}/posixstat.h ${BASHINCDIR}/filecntl
general.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
general.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
general.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
general.o: make_cmd.h subst.h sig.h pathnames.h externs.h
general.o: make_cmd.h subst.h sig.h pathnames.h externs.h
general.o: ${BASHINCDIR}/maxpath.h ${BASHINCDIR}/posixtime.h
general.o: ${BASHINCDIR}/chartypes.h
hashcmd.o: config.h ${BASHINCDIR}/posixstat.h bashtypes.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
@@ -846,18 +855,18 @@ hashlib.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
hashlib.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
hashlib.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
hashlib.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
hashlib.o: make_cmd.h subst.h sig.h pathnames.h externs.h
hashlib.o: make_cmd.h subst.h sig.h pathnames.h externs.h
input.o: config.h bashtypes.h ${BASHINCDIR}/filecntl.h ${BASHINCDIR}/posixstat.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
input.o: command.h ${BASHINCDIR}/stdc.h general.h xmalloc.h input.h error.h externs.h
list.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
list.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
list.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
list.o: make_cmd.h subst.h sig.h pathnames.h externs.h
list.o: make_cmd.h subst.h sig.h pathnames.h externs.h
locale.o: config.h bashtypes.h bashintl.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
locale.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
locale.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
locale.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
locale.o: make_cmd.h subst.h sig.h pathnames.h externs.h
locale.o: make_cmd.h subst.h sig.h pathnames.h externs.h
locale.o: ${BASHINCDIR}/chartypes.h
mailcheck.o: config.h bashtypes.h ${BASHINCDIR}/posixstat.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
mailcheck.o: ${BASHINCDIR}/posixtime.h
@@ -865,7 +874,7 @@ mailcheck.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h comman
mailcheck.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
mailcheck.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
mailcheck.o: make_cmd.h subst.h sig.h pathnames.h externs.h
mailcheck.o: execute_cmd.h mailcheck.h
mailcheck.o: execute_cmd.h mailcheck.h
make_cmd.o: config.h bashtypes.h ${BASHINCDIR}/filecntl.h bashansi.h
make_cmd.o: command.h ${BASHINCDIR}/stdc.h general.h xmalloc.h error.h flags.h make_cmd.h
make_cmd.o: variables.h arrayfunc.h conftypes.h array.h hashlib.h subst.h input.h externs.h
@@ -890,18 +899,18 @@ print_cmd.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
print_cmd.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
print_cmd.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
print_cmd.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
print_cmd.o: make_cmd.h subst.h sig.h pathnames.h externs.h
print_cmd.o: make_cmd.h subst.h sig.h pathnames.h externs.h
print_cmd.o: ${GRAM_H} $(DEFSRC)/common.h
redir.o: config.h bashtypes.h ${BASHINCDIR}/posixstat.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/filecntl.h
redir.o: ${BASHINCDIR}/memalloc.h shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
redir.o: general.h xmalloc.h variables.h arrayfunc.h conftypes.h array.h hashlib.h quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h
redir.o: dispose_cmd.h make_cmd.h subst.h sig.h pathnames.h externs.h
redir.o: dispose_cmd.h make_cmd.h subst.h sig.h pathnames.h externs.h
redir.o: flags.h execute_cmd.h redir.h input.h
shell.o: config.h bashtypes.h ${BASHINCDIR}/posixstat.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/filecntl.h
shell.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
shell.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
shell.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
shell.o: make_cmd.h subst.h sig.h pathnames.h externs.h version.h
shell.o: make_cmd.h subst.h sig.h pathnames.h externs.h
shell.o: flags.h trap.h mailcheck.h builtins.h $(DEFSRC)/common.h
shell.o: jobs.h siglist.h input.h execute_cmd.h findcmd.h bashhist.h
shell.o: ${GLOB_LIBSRC}/strmatch.h ${BASHINCDIR}/posixtime.h
@@ -909,20 +918,20 @@ sig.o: config.h bashtypes.h
sig.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
sig.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
sig.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
sig.o: make_cmd.h subst.h sig.h pathnames.h externs.h
sig.o: make_cmd.h subst.h sig.h pathnames.h externs.h
sig.o: jobs.h siglist.h trap.h $(DEFSRC)/common.h bashline.h bashhist.h
siglist.o: config.h bashtypes.h siglist.h trap.h
stringlib.o: bashtypes.h ${BASHINCDIR}/chartypes.h
stringlib.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
stringlib.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
stringlib.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
stringlib.o: make_cmd.h subst.h sig.h pathnames.h externs.h
stringlib.o: make_cmd.h subst.h sig.h pathnames.h externs.h
stringlib.o: ${GLOB_LIBSRC}/glob.h ${GLOB_LIBSRC}/strmatch.h
subst.o: config.h bashtypes.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/posixstat.h
subst.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
subst.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
subst.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
subst.o: make_cmd.h subst.h sig.h pathnames.h externs.h
subst.o: make_cmd.h subst.h sig.h pathnames.h externs.h
subst.o: flags.h jobs.h siglist.h execute_cmd.h ${BASHINCDIR}/filecntl.h trap.h pathexp.h
subst.o: mailcheck.h input.h $(DEFSRC)/getopt.h $(DEFSRC)/common.h
subst.o: bashline.h bashhist.h ${GLOB_LIBSRC}/strmatch.h
@@ -933,25 +942,26 @@ test.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h $
test.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
test.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
test.o: make_cmd.h subst.h sig.h pathnames.h externs.h test.h
test.o: ${DEFSRC}/common.h
test.o: ${DEFSRC}/common.h
trap.o: config.h bashtypes.h trap.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
trap.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
trap.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
trap.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
trap.o: make_cmd.h subst.h sig.h pathnames.h externs.h
trap.o: make_cmd.h subst.h sig.h pathnames.h externs.h
trap.o: signames.h $(DEFSRC)/common.h
trap.o: ${DEFDIR}/builtext.h
unwind_prot.o: config.h bashtypes.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h command.h ${BASHINCDIR}/stdc.h
unwind_prot.o: general.h xmalloc.h unwind_prot.h quit.h sig.h
variables.o: config.h bashtypes.h ${BASHINCDIR}/posixstat.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
variables.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
variables.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
variables.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
variables.o: make_cmd.h subst.h sig.h pathnames.h externs.h
variables.o: make_cmd.h subst.h sig.h pathnames.h externs.h
variables.o: flags.h execute_cmd.h mailcheck.h input.h $(DEFSRC)/common.h
variables.o: findcmd.h bashhist.h hashcmd.h pathexp.h
variables.o: pcomplete.h version.h ${BASHINCDIR}/chartypes.h
variables.o: pcomplete.h ${BASHINCDIR}/chartypes.h
variables.o: ${BASHINCDIR}/posixtime.h
version.o: version.h conftypes.h patchlevel.h
version.o: conftypes.h patchlevel.h version.h
xmalloc.o: config.h bashtypes.h ${BASHINCDIR}/ansi_stdlib.h error.h
# job control
@@ -961,7 +971,7 @@ jobs.o: bashansi.h ${BASHINCDIR}/ansi_stdlib.h
jobs.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
jobs.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
jobs.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
jobs.o: make_cmd.h subst.h sig.h pathnames.h externs.h
jobs.o: make_cmd.h subst.h sig.h pathnames.h externs.h
jobs.o: jobs.h flags.h $(DEFSRC)/common.h $(DEFDIR)/builtext.h
jobs.o: ${BASHINCDIR}/posixwait.h ${BASHINCDIR}/unionwait.h
jobs.o: ${BASHINCDIR}/posixtime.h
@@ -975,24 +985,24 @@ array.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
array.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
array.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
array.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
array.o: make_cmd.h subst.h sig.h pathnames.h externs.h
array.o: make_cmd.h subst.h sig.h pathnames.h externs.h
array.o: $(DEFSRC)/common.h
arrayfunc.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
arrayfunc.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
arrayfunc.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
arrayfunc.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
arrayfunc.o: make_cmd.h subst.h sig.h pathnames.h externs.h
arrayfunc.o: make_cmd.h subst.h sig.h pathnames.h externs.h
arrayfunc.o: $(DEFSRC)/common.h
arrayfunc.o: ${BASHINCDIR}/shmbutil.h
braces.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
braces.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
braces.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
braces.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
braces.o: make_cmd.h subst.h sig.h pathnames.h externs.h
braces.o: make_cmd.h subst.h sig.h pathnames.h externs.h
braces.o: ${BASHINCDIR}/shmbutil.h
alias.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h command.h ${BASHINCDIR}/stdc.h
alias.o: general.h xmalloc.h bashtypes.h externs.h alias.h
alias.o: pcomplete.h
alias.o: pcomplete.h
alias.o: ${BASHINCDIR}/chartypes.h
pcomplib.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h bashtypes.h
@@ -1005,7 +1015,7 @@ pcomplete.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h bashtypes.h
pcomplete.o: ${BASHINCDIR}/stdc.h hashlib.h pcomplete.h shell.h syntax.h
pcomplete.o: bashjmp.h command.h general.h xmalloc.h error.h variables.h arrayfunc.h conftypes.h quit.h
pcomplete.o: unwind_prot.h dispose_cmd.h make_cmd.h subst.h sig.h pathnames.h
pcomplete.o: externs.h ${BASHINCDIR}/maxpath.h execute_cmd.h
pcomplete.o: externs.h ${BASHINCDIR}/maxpath.h execute_cmd.h
# library support files
@@ -1014,14 +1024,14 @@ bashhist.o: ${BASHINCDIR}/filecntl.h
bashhist.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
bashhist.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
bashhist.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
bashhist.o: make_cmd.h subst.h sig.h pathnames.h externs.h
bashhist.o: make_cmd.h subst.h sig.h pathnames.h externs.h
bashhist.o: flags.h input.h parser.h pathexp.h $(DEFSRC)/common.h bashline.h
bashhist.o: $(GLOB_LIBSRC)/strmatch.h
bashline.o: config.h bashtypes.h ${BASHINCDIR}/posixstat.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
bashline.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
bashline.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
bashline.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
bashline.o: make_cmd.h subst.h sig.h pathnames.h externs.h
bashline.o: make_cmd.h subst.h sig.h pathnames.h externs.h
bashline.o: builtins.h bashhist.h bashline.h execute_cmd.h findcmd.h pathexp.h
bashline.o: $(DEFSRC)/common.h $(GLOB_LIBSRC)/glob.h alias.h
bashline.o: pcomplete.h ${BASHINCDIR}/chartypes.h input.h
@@ -1029,7 +1039,7 @@ bracecomp.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
bracecomp.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
bracecomp.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
bracecomp.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
bracecomp.o: make_cmd.h subst.h sig.h pathnames.h externs.h
bracecomp.o: make_cmd.h subst.h sig.h pathnames.h externs.h
bracecomp.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h command.h hashlib.h builtins.h general.h xmalloc.h
bracecomp.o: quit.h alias.h config.h variables.h arrayfunc.h conftypes.h
bracecomp.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
@@ -1065,21 +1075,21 @@ variables.o: $(TILDE_LIBSRC)/tilde.h
builtins/bashgetopt.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
builtins/bashgetopt.o: shell.h syntax.h config.h bashjmp.h command.h general.h xmalloc.h error.h
builtins/bashgetopt.o: variables.h arrayfunc.h conftypes.h quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
builtins/bashgetopt.o: make_cmd.h subst.h sig.h pathnames.h externs.h
builtins/bashgetopt.o: make_cmd.h subst.h sig.h pathnames.h externs.h
builtins/bashgetopt.o: $(DEFSRC)/common.h
builtins/bashgetopt.o: ${BASHINCDIR}/chartypes.h
builtins/common.o: bashtypes.h ${BASHINCDIR}/posixstat.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
builtins/common.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h command.h
builtins/common.o: ${BASHINCDIR}/memalloc.h variables.h arrayfunc.h conftypes.h input.h siglist.h
builtins/common.o: quit.h unwind_prot.h ${BASHINCDIR}/maxpath.h jobs.h builtins.h
builtins/common.o: dispose_cmd.h make_cmd.h subst.h externs.h bashhist.h
builtins/common.o: dispose_cmd.h make_cmd.h subst.h externs.h bashhist.h
builtins/common.o: execute_cmd.h ${BASHINCDIR}/stdc.h general.h xmalloc.h error.h pathnames.h
builtins/common.o: ${DEFDIR}/builtext.h
builtins/common.o: ${BASHINCDIR}/chartypes.h
builtins/evalfile.o: bashtypes.h ${BASHINCDIR}/posixstat.h ${BASHINCDIR}/filecntl.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
builtins/evalfile.o: shell.h syntax.h config.h bashjmp.h command.h general.h xmalloc.h error.h
builtins/evalfile.o: variables.h arrayfunc.h conftypes.h quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
builtins/evalfile.o: make_cmd.h subst.h sig.h pathnames.h externs.h
builtins/evalfile.o: make_cmd.h subst.h sig.h pathnames.h externs.h
builtins/evalfile.o: jobs.h builtins.h flags.h input.h execute_cmd.h
builtins/evalfile.o: bashhist.h $(DEFSRC)/common.h
builtins/evalstring.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
@@ -1092,7 +1102,7 @@ builtins/evalstring.o: bashhist.h $(DEFSRC)/common.h
builtins/getopt.o: config.h ${BASHINCDIR}/memalloc.h
builtins/getopt.o: shell.h syntax.h bashjmp.h command.h general.h xmalloc.h error.h
builtins/getopt.o: variables.h arrayfunc.h conftypes.h quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
builtins/getopt.o: make_cmd.h subst.h sig.h pathnames.h externs.h
builtins/getopt.o: make_cmd.h subst.h sig.h pathnames.h externs.h
builtins/getopt.o: $(DEFSRC)/getopt.h
builtins/mkbuiltins.o: config.h bashtypes.h ${BASHINCDIR}/posixstat.h ${BASHINCDIR}/filecntl.h
builtins/mkbuiltins.o: bashansi.h ${BASHINCDIR}/ansi_stdlib.h
@@ -1113,6 +1123,12 @@ builtins/builtin.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.
builtins/builtin.o: quit.h $(DEFSRC)/common.h $(DEFSRC)/bashgetopt.h
builtins/builtin.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/builtin.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/caller.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/caller.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/caller.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/caller.o: $(DEFSRC)/common.h quit.h
builtins/caller.o: ${BASHINCDIR}/chartypes.h bashtypes.h
builtins/caller.o: ${DEFDIR}/builtext.h
builtins/cd.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/cd.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/cd.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
@@ -1131,16 +1147,16 @@ builtins/echo.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/enable.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/enable.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h quit.h
builtins/enable.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/enable.o: pcomplete.h
builtins/enable.o: pcomplete.h
builtins/eval.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/eval.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h quit.h
builtins/eval.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/exec.o: bashtypes.h
builtins/exec.o: bashtypes.h
builtins/exec.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/exec.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/exec.o: dispose_cmd.h make_cmd.h subst.h externs.h execute_cmd.h
builtins/exec.o: dispose_cmd.h make_cmd.h subst.h externs.h execute_cmd.h
builtins/exec.o: findcmd.h flags.h quit.h $(DEFSRC)/common.h ${BASHINCDIR}/stdc.h
builtins/exit.o: bashtypes.h
builtins/exit.o: bashtypes.h
builtins/exit.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/exit.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h quit.h
builtins/exit.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
@@ -1151,22 +1167,22 @@ builtins/fc.o: flags.h unwind_prot.h variables.h arrayfunc.h conftypes.h shell.h
builtins/fc.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h quit.h
builtins/fc.o: $(DEFSRC)/bashgetopt.h bashhist.h
builtins/fc.o: ${BASHINCDIR}/chartypes.h
builtins/fg_bg.o: bashtypes.h $(DEFSRC)/bashgetopt.h
builtins/fg_bg.o: bashtypes.h $(DEFSRC)/bashgetopt.h
builtins/fg_bg.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/fg_bg.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h quit.h
builtins/fg_bg.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/getopts.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/getopts.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h quit.h
builtins/getopts.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/hash.o: bashtypes.h
builtins/hash.o: bashtypes.h
builtins/hash.o: builtins.h command.h findcmd.h ${BASHINCDIR}/stdc.h $(DEFSRC)/common.h
builtins/hash.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/hash.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h quit.h
builtins/help.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/help.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/help.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h quit.h
builtins/help.o: $(GLOB_LIBSRC)/glob.h version.h
builtins/history.o: bashtypes.h
builtins/help.o: $(GLOB_LIBSRC)/glob.h
builtins/history.o: bashtypes.h
builtins/history.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/history.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/history.o: ${BASHINCDIR}/filecntl.h shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h
@@ -1217,14 +1233,14 @@ builtins/shopt.o: $(DEFSRC)/common.h $(DEFSRC)/bashgetopt.h
builtins/source.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/source.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/source.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/source.o: findcmd.h $(DEFSRC)/bashgetopt.h
builtins/source.o: findcmd.h $(DEFSRC)/bashgetopt.h flags.h trap.h
builtins/suspend.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/suspend.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/suspend.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/test.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/test.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/test.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/test.o: test.h
builtins/test.o: test.h
builtins/times.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/times.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/times.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
@@ -1251,7 +1267,7 @@ builtins/wait.o: ${BASHINCDIR}/chartypes.h
builtins/complete.o: config.h shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h
builtins/complete.o: unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/complete.o: bashtypes.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
builtins/complete.o: builtins.h
builtins/complete.o: builtins.h
builtins/complete.o: pcomplete.h
builtins/complete.o: ${DEFSRC}/common.h ${DEFSRC}/bashgetopt.h
@@ -1270,6 +1286,7 @@ builtins/alias.o: $(DEFSRC)/alias.def
builtins/bind.o: $(DEFSRC)/bind.def
builtins/break.o: $(DEFSRC)/break.def
builtins/builtin.o: $(DEFSRC)/builtin.def
builtins/caller.o: $(DEFSRC)/caller.def
builtins/cd.o: $(DEFSRC)/cd.def
builtins/colon.o: $(DEFSRC)/colon.def
builtins/command.o: $(DEFSRC)/command.def
+149
View File
@@ -1,3 +1,152 @@
This is a terse description of the new features added to bash-3.0 since
the release of bash-2.05b. As always, the manual page (doc/bash.1) is
the place to look for complete descriptions.
1. New Features in Bash
a. ANSI string expansion now implements the \x{hexdigits} escape.
b. There is a new loadable `strftime' builtin.
c. New variable, COMP_WORDBREAKS, which controls the readline completer's
idea of word break characters.
d. The `type' builtin no longer reports on aliases unless alias expansion
will actually be performed.
e. HISTCONTROL is now a colon-separated list of values, which permits
more extensibility and backwards compatibility.
f. HISTCONTROL may now include the `erasedups' option, which causes all lines
matching a line being added to be removed from the history list.
g. `configure' has a new `--enable-multibyte' argument that permits multibyte
character support to be disabled even on systems that support it.
h. New variables to support the bash debugger: BASH_ARGC, BASH_ARGV,
BASH_SOURCE, BASH_LINENO, BASH_SUBSHELL, BASH_EXECUTION_STRING,
BASH_COMMAND
i. FUNCNAME has been changed to support the debugger: it's now an array
variable.
j. for, case, select, arithmetic commands now keep line number information
for the debugger.
k. There is a new `RETURN' trap executed when a function or sourced script
returns (not inherited child processes; inherited by command substitution
if function tracing is enabled and the debugger is active).
l. New invocation option: --debugger. Enables debugging and turns on new
`extdebug' shell option.
m. New `functrace' and `errtrace' options to `set -o' cause DEBUG and ERR
traps, respectively, to be inherited by shell functions. Equivalent to
`set -T' and `set -E' respectively. The `functrace' option also controls
whether or not the DEBUG trap is inherited by sourced scripts.
n. The DEBUG trap is run before binding the variable and running the action
list in a `for' command, binding the selection variable and running the
query in a `select' command, and before attempting a match in a `case'
command.
o. New `--enable-debugger' option to `configure' to compile in the debugger
support code.
p. `declare -F' now prints out extra line number and source file information
if the `extdebug' option is set.
q. If `extdebug' is enabled, a non-zero return value from a DEBUG trap causes
the next command to be skipped, and a return value of 2 while in a
function or sourced script forces a `return'.
r. New `caller' builtin to provide a call stack for the bash debugger.
s. The DEBUG trap is run just before the first command in a function body is
executed, for the debugger.
t. `for', `select', and `case' command heads are printed when `set -x' is
enabled.
u. There is a new {x..y} brace expansion, which is shorthand for {x.x+1,
x+2,...,y}. x and y can be integers or single characters; the sequence
may ascend or descend; the increment is always 1.
v. New ksh93-like ${!array[@]} expansion, expands to all the keys (indices)
of array.
w. New `force_fignore' shopt option; if enabled, suffixes specified by
FIGNORE cause words to be ignored when performing word completion even
if they're the only possibilities.
x. New `gnu_errfmt' shopt option; if enabled, error messages follow the `gnu
style' (filename:lineno:message) format.
y. New `-o bashdefault' option to complete and compgen; if set, causes the
whole set of bash completions to be performed if the compspec doesn't
result in a match.
z. New `-o plusdirs' option to complete and compgen; if set, causes directory
name completion to be performed and the results added to the rest of the
possible completions.
aa. `kill' is available as a builtin even when the shell is built without
job control.
bb. New HISTTIMEFORMAT variable; value is a format string to pass to
strftime(3). If set and not null, the `history' builtin prints out
timestamp information according to the specified format when displaying
history entries. If set, bash tells the history library to write out
timestamp information when the history file is written.
cc. The [[ ... ]] command has a new binary `=~' operator that performs
extended regular expression (egrep-like) matching.
dd. `configure' has a new `--enable-cond-regexp' option (enabled by default)
to enable the =~ operator and regexp matching in [[ ... ]].
ee. Subexpressions matched by the =~ operator are placed in the new
BASH_REMATCH array variable.
ff. New `failglob' option that causes an expansion error when pathname
expansion fails to produce a match.
gg. New `set -o pipefail' option that causes a pipeline to return a failure
status if any of the processes in the pipeline fail, not just the last
one.
2. New Features in Readline
a. History expansion has a new `a' modifier equivalent to the `g' modifier
for compatibility with the BSD csh.
b. History expansion has a new `G' modifier equivalent to the BSD csh `g'
modifier, which performs a substitution once per word.
c. All non-incremental search operations may now undo the operation of
replacing the current line with the history line.
d. The text inserted by an `a' command in vi mode can be reinserted with
`.'.
e. New bindable variable, `show-all-if-unmodified'. If set, the readline
completer will list possible completions immediately if there is more
than one completion and partial completion cannot be performed.
f. There is a new application-callable `free_history_entry()' function.
g. History list entries now contain timestamp information; the history file
functions know how to read and write timestamp information associated
with each entry.
h. Four new key binding functions have been added:
rl_bind_key_if_unbound()
rl_bind_key_if_unbound_in_map()
rl_bind_keyseq_if_unbound()
rl_bind_keyseq_if_unbound_in_map()
-------------------------------------------------------------------------------
This is a terse description of the new features added to bash-2.05b since
the release of bash-2.05a. As always, the manual page (doc/bash.1) is
the place to look for complete descriptions.
+24 -14
View File
@@ -29,20 +29,20 @@ The following list is what's changed when `POSIX mode' is in effect:
performed on the values of `PS1' and `PS2' regardless of the
setting of the `promptvars' option.
6. Interactive comments are enabled by default. (Bash has them on by
default anyway.)
7. The POSIX 1003.2 startup files are executed (`$ENV') rather than
6. The POSIX 1003.2 startup files are executed (`$ENV') rather than
the normal Bash files.
8. Tilde expansion is only performed on assignments preceding a
7. Tilde expansion is only performed on assignments preceding a
command name, rather than on all assignment statements on the line.
9. The default history file is `~/.sh_history' (this is the default
8. The default history file is `~/.sh_history' (this is the default
value of `$HISTFILE').
10. The output of `kill -l' prints all the signal names on a single
line, separated by spaces.
9. The output of `kill -l' prints all the signal names on a single
line, separated by spaces, without the `SIG' prefix.
10. The `kill' builtin does not accept signal names with a `SIG'
prefix.
11. Non-interactive shells exit if FILENAME in `.' FILENAME is not
found.
@@ -103,23 +103,33 @@ The following list is what's changed when `POSIX mode' is in effect:
26. The `trap' builtin displays signal names without the leading `SIG'.
27. The `.' and `source' builtins do not search the current directory
27. The `trap' builtin doesn't check the first argument for a possible
signal specification and revert the signal handling to the original
disposition if it is. If users want to reset the handler for a
given signal to the original disposition, they should use `-' as
the first argument.
28. The `.' and `source' builtins do not search the current directory
for the filename argument if it is not found by searching `PATH'.
28. Subshells spawned to execute command substitutions inherit the
29. Subshells spawned to execute command substitutions inherit the
value of the `-e' option from the parent shell. When not in POSIX
mode, Bash clears the `-e' option in such subshells.
29. Alias expansion is always enabled, even in non-interactive shells.
30. Alias expansion is always enabled, even in non-interactive shells.
30. When the `set' builtin is invoked without options, it does not
31. When the `alias' builtin displays alias definitions, it does not
display them with a leading `alias ' unless the `-p' option is
supplied.
32. When the `set' builtin is invoked without options, it does not
display shell function names and definitions.
31. When the `set' builtin is invoked without options, it displays
33. When the `set' builtin is invoked without options, it displays
variable values without quotes, unless they contain shell
metacharacters, even if the result contains nonprinting characters.
32. When the `cd' builtin is invoked in LOGICAL mode, and the pathname
34. When the `cd' builtin is invoked in LOGICAL mode, and the pathname
constructed from `$PWD' and the directory name supplied as an
argument does not refer to an existing directory, `cd' will fail
instead of falling back to PHYSICAL mode.
+1 -1
View File
@@ -1,7 +1,7 @@
Introduction
============
This is GNU Bash, version 2.05b. Bash is the GNU Project's Bourne
This is GNU Bash, version 3.0b. Bash is the GNU Project's Bourne
Again SHell, a complete implementation of the POSIX.2 shell spec,
but also with interactive command line editing, job control on
architectures that support it, csh-like features such as history
Vendored
+111 -15
View File
@@ -981,11 +981,12 @@ AC_MSG_CHECKING(which library has the termcap functions)
_bash_needmsg=
fi
AC_CACHE_VAL(bash_cv_termcap_lib,
[AC_CHECK_LIB(termcap, tgetent, bash_cv_termcap_lib=libtermcap,
[AC_CHECK_FUNC(tgetent, bash_cv_termcap_lib=libc,
[AC_CHECK_LIB(termcap, tgetent, bash_cv_termcap_lib=libtermcap,
[AC_CHECK_LIB(tinfo, tgetent, bash_cv_termcap_lib=libtinfo,
[AC_CHECK_LIB(curses, tgetent, bash_cv_termcap_lib=libcurses,
[AC_CHECK_LIB(ncurses, tgetent, bash_cv_termcap_lib=libncurses,
bash_cv_termcap_lib=gnutermcap)])])])])
bash_cv_termcap_lib=gnutermcap)])])])])])
if test "X$_bash_needmsg" = "Xyes"; then
AC_MSG_CHECKING(which library has the termcap functions)
fi
@@ -1003,6 +1004,9 @@ TERMCAP_DEP=
elif test $bash_cv_termcap_lib = libncurses; then
TERMCAP_LIB=-lncurses
TERMCAP_DEP=
elif test $bash_cv_termcap_lib = libc; then
TERMCAP_LIB=
TERMCAP_DEP=
else
TERMCAP_LIB=-lcurses
TERMCAP_DEP=
@@ -1141,6 +1145,22 @@ if test $bash_cv_struct_timeval = yes; then
fi
])
AC_DEFUN(BASH_STRUCT_TIMEZONE,
[AC_MSG_CHECKING(for struct timezone in sys/time.h and time.h)
AC_CACHE_VAL(bash_cv_struct_timezone,
[
AC_EGREP_HEADER(struct timezone, sys/time.h,
bash_cv_struct_timezone=yes,
AC_EGREP_HEADER(struct timezone, time.h,
bash_cv_struct_timezone=yes,
bash_cv_struct_timezone=no))
])
AC_MSG_RESULT($bash_cv_struct_timezone)
if test $bash_cv_struct_timezone = yes; then
AC_DEFINE(HAVE_STRUCT_TIMEZONE)
fi
])
AC_DEFUN(BASH_STRUCT_WINSIZE,
[AC_MSG_CHECKING(for struct winsize in sys/ioctl.h and termios.h)
AC_CACHE_VAL(bash_cv_struct_winsize_header,
@@ -1526,9 +1546,9 @@ fi
AC_DEFUN(BASH_CHECK_DEV_FD,
[AC_MSG_CHECKING(whether /dev/fd is available)
AC_CACHE_VAL(bash_cv_dev_fd,
[if test -d /dev/fd && test -r /dev/fd/0; then
[if test -d /dev/fd && test -r /dev/fd/0 < /dev/null; then
bash_cv_dev_fd=standard
elif test -d /proc/self/fd && test -r /proc/self/fd/0; then
elif test -d /proc/self/fd && test -r /proc/self/fd/0 < /dev/null; then
bash_cv_dev_fd=whacky
else
bash_cv_dev_fd=absent
@@ -1547,9 +1567,9 @@ fi
AC_DEFUN(BASH_CHECK_DEV_STDIN,
[AC_MSG_CHECKING(whether /dev/stdin stdout stderr are available)
AC_CACHE_VAL(bash_cv_dev_stdin,
[if test -d /dev/fd && test -r /dev/stdin; then
[if test -d /dev/fd && test -r /dev/stdin < /dev/null; then
bash_cv_dev_stdin=present
elif test -d /proc/self/fd && test -r /dev/stdin; then
elif test -d /proc/self/fd && test -r /dev/stdin < /dev/null; then
bash_cv_dev_stdin=present
else
bash_cv_dev_stdin=absent
@@ -1653,17 +1673,18 @@ AC_CHECK_HEADERS(wchar.h)
AC_CHECK_HEADERS(langinfo.h)
AC_CHECK_FUNC(mbsrtowcs, AC_DEFINE(HAVE_MBSRTOWCS))
AC_CHECK_FUNC(mbrtowc, AC_DEFINE(HAVE_MBRTOWC))
AC_CHECK_FUNC(mbrlen, AC_DEFINE(HAVE_MBRLEN))
AC_CHECK_FUNC(wctomb, AC_DEFINE(HAVE_WCTOMB))
AC_CHECK_FUNC(wcwidth, AC_DEFINE(HAVE_WCWIDTH))
AC_CACHE_CHECK([for mbstate_t], bash_cv_have_mbstate_t,
[AC_TRY_RUN([
#include <wchar.h>
int
main ()
{
[AC_TRY_COMPILE([
#include <wchar.h>], [
mbstate_t ps;
return 0;
}], bash_cv_have_mbstate_t=yes, bash_cv_have_mbstate_t=no)])
mbstate_t *psp;
psp = (mbstate_t *)0;
], bash_cv_have_mbstate_t=yes, bash_cv_have_mbstate_t=no)])
if test $bash_cv_have_mbstate_t = yes; then
AC_DEFINE(HAVE_MBSTATE_T)
fi
@@ -1712,7 +1733,8 @@ LIBS="$LIBS -lreadline ${TERMCAP_LIB}"
CFLAGS="$CFLAGS -I${ac_cv_rl_includedir}"
LDFLAGS="$LDFLAGS -L${ac_cv_rl_libdir}"
AC_TRY_RUN([
AC_CACHE_VAL(ac_cv_rl_version,
[AC_TRY_RUN([
#include <stdio.h>
#include <readline/readline.h>
@@ -1728,7 +1750,7 @@ main()
],
ac_cv_rl_version=`cat conftest.rlv`,
ac_cv_rl_version='0.0',
ac_cv_rl_version='4.2')
ac_cv_rl_version='4.2')])
CFLAGS="$_save_CFLAGS"
LDFLAGS="$_save_LDFLAGS"
@@ -1790,3 +1812,77 @@ AC_MSG_RESULT($ac_cv_rl_version)
fi
])
AC_DEFUN(BASH_FUNC_CTYPE_NONASCII,
[
AC_MSG_CHECKING(whether the ctype macros accept non-ascii characters)
AC_CACHE_VAL(bash_cv_func_ctype_nonascii,
[AC_TRY_RUN([
#ifdef HAVE_LOCALE_H
#include <locale.h>
#endif
#include <stdio.h>
#include <ctype.h>
main(c, v)
int c;
char *v[];
{
char *deflocale;
unsigned char x;
int r1, r2;
#ifdef HAVE_SETLOCALE
/* We take a shot here. If that locale is not known, try the
system default. We try this one because '\342' (226) is
known to be a printable character in that locale. */
deflocale = setlocale(LC_ALL, "en_US.ISO8859-1");
if (deflocale == 0)
deflocale = setlocale(LC_ALL, "");
#endif
x = '\342';
r1 = isprint(x);
x -= 128;
r2 = isprint(x);
exit (r1 == 0 || r2 == 0);
}
], bash_cv_func_ctype_nonascii=yes, bash_cv_func_ctype_nonascii=no,
[AC_MSG_WARN(cannot check ctype macros if cross compiling -- defaulting to no)
bash_cv_func_ctype_nonascii=no]
)])
AC_MSG_RESULT($bash_cv_func_ctype_nonascii)
if test $bash_cv_func_ctype_nonascii = yes; then
AC_DEFINE(CTYPE_NON_ASCII)
fi
])
dnl
dnl tests added for bashdb
dnl
AC_DEFUN([AM_PATH_LISPDIR],
[AC_ARG_WITH(lispdir, AC_HELP_STRING([--with-lispdir], [override the default lisp directory]),
[ lispdir="$withval"
AC_MSG_CHECKING([where .elc files should go])
AC_MSG_RESULT([$lispdir])],
[
# If set to t, that means we are running in a shell under Emacs.
# If you have an Emacs named "t", then use the full path.
test x"$EMACS" = xt && EMACS=
AC_CHECK_PROGS(EMACS, emacs xemacs, no)
if test $EMACS != "no"; then
if test x${lispdir+set} != xset; then
AC_CACHE_CHECK([where .elc files should go], [am_cv_lispdir], [dnl
am_cv_lispdir=`$EMACS -batch -q -eval '(while load-path (princ (concat (car load-path) "\n")) (setq load-path (cdr load-path)))' | sed -n -e 's,/$,,' -e '/.*\/lib\/\(x\?emacs\/site-lisp\)$/{s,,${libdir}/\1,;p;q;}' -e '/.*\/share\/\(x\?emacs\/site-lisp\)$/{s,,${datadir}/\1,;p;q;}'`
if test -z "$am_cv_lispdir"; then
am_cv_lispdir='${datadir}/emacs/site-lisp'
fi
])
lispdir="$am_cv_lispdir"
fi
fi
])
AC_SUBST(lispdir)
])
+62 -10
View File
@@ -154,16 +154,17 @@ ARRAY_ELEMENT *s, *e;
* element as the argument.
*/
void
array_walk(a, func)
array_walk(a, func, udata)
ARRAY *a;
sh_ae_map_func_t *func;
void *udata;
{
register ARRAY_ELEMENT *ae;
if (a == 0 || array_empty(a))
return;
for (ae = element_forw(a->head); ae != a->head; ae = element_forw(ae))
if ((*func)(ae) < 0)
if ((*func)(ae, udata) < 0)
return;
}
@@ -265,6 +266,21 @@ char *s;
return (a->num_elements);
}
ARRAY_ELEMENT *
array_unshift_element(a)
ARRAY *a;
{
return (array_shift (a, 1, 0));
}
int
array_shift_element(a, v)
ARRAY *a;
char *v;
{
return (array_rshift (a, 1, v));
}
ARRAY *
array_quote(array)
ARRAY *array;
@@ -283,13 +299,14 @@ ARRAY *array;
}
char *
array_subrange (a, start, end, quoted)
array_subrange (a, start, end, starsub, quoted)
ARRAY *a;
arrayind_t start, end;
int quoted;
int starsub, quoted;
{
ARRAY_ELEMENT *h, *p;
arrayind_t i;
char *ifs, sep[2];
p = array_head (a);
if (p == 0 || array_empty (a) || start > array_num_elements (a))
@@ -302,7 +319,14 @@ int quoted;
for (h = p; p != a->head && i < end; i++, p = element_forw(p))
;
return (array_to_string_internal (h, p, " ", quoted));
if (starsub && (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT))) {
ifs = getifs();
sep[0] = ifs ? *ifs : '\0';
} else
sep[0] = ' ';
sep[1] = '\0';
return (array_to_string_internal (h, p, sep, quoted));
}
char *
@@ -313,7 +337,7 @@ int mflags;
{
ARRAY *a2;
ARRAY_ELEMENT *e;
char *t;
char *t, *ifs, sifs[2];
if (array_head (a) == 0 || array_empty (a))
return ((char *)NULL);
@@ -327,7 +351,13 @@ int mflags;
if (mflags & MATCH_QUOTED)
array_quote (a2);
t = array_to_string (a2, " ", 0);
if (mflags & MATCH_STARSUB) {
ifs = getifs();
sifs[0] = ifs ? *ifs : '\0';
sifs[1] = '\0';
t = array_to_string (a2, sifs, 0);
} else
t = array_to_string (a2, " ", 0);
array_dispose (a2);
return t;
@@ -365,8 +395,10 @@ void
array_dispose_element(ae)
ARRAY_ELEMENT *ae;
{
FREE(ae->value);
free(ae);
if (ae) {
FREE(ae->value);
free(ae);
}
}
/*
@@ -460,6 +492,7 @@ arrayind_t i;
/* Convenience routines for the shell to translate to and from the form used
by the rest of the code. */
WORD_LIST *
array_to_word_list(a)
ARRAY *a;
@@ -487,6 +520,25 @@ WORD_LIST *list;
return (array_assign_list (a, list));
}
WORD_LIST *
array_keys_to_word_list(a)
ARRAY *a;
{
WORD_LIST *list;
ARRAY_ELEMENT *ae;
char *t;
if (a == 0 || array_empty(a))
return((WORD_LIST *)NULL);
list = (WORD_LIST *)NULL;
for (ae = element_forw(a->head); ae != a->head; ae = element_forw(ae)) {
t = itos(element_index(ae));
list = make_word_list (make_bare_word(t), list);
free(t);
}
return (REVERSE_LIST(list, WORD_LIST *));
}
ARRAY *
array_assign_list (array, list)
ARRAY *array;
@@ -767,7 +819,7 @@ print_array(a)
ARRAY *a;
{
printf("\n");
array_walk(a, print_element);
array_walk(a, print_element, (void *)NULL);
}
main()
+19 -3
View File
@@ -40,7 +40,7 @@ typedef struct array_element {
struct array_element *next, *prev;
} ARRAY_ELEMENT;
typedef int sh_ae_map_func_t __P((ARRAY_ELEMENT *));
typedef int sh_ae_map_func_t __P((ARRAY_ELEMENT *, void *));
/* Basic operations on entire arrays */
extern ARRAY *array_create __P((void));
@@ -48,13 +48,15 @@ extern void array_flush __P((ARRAY *));
extern void array_dispose __P((ARRAY *));
extern ARRAY *array_copy __P((ARRAY *));
extern ARRAY *array_slice __P((ARRAY *, ARRAY_ELEMENT *, ARRAY_ELEMENT *));
extern void array_walk __P((ARRAY *, sh_ae_map_func_t *));
extern void array_walk __P((ARRAY *, sh_ae_map_func_t *, void *));
extern ARRAY_ELEMENT *array_shift __P((ARRAY *, int, int));
extern int array_rshift __P((ARRAY *, int, char *));
extern ARRAY_ELEMENT *array_unshift_element __P((ARRAY *));
extern int array_shift_element __P((ARRAY *, char *));
extern ARRAY *array_quote __P((ARRAY *));
extern char *array_subrange __P((ARRAY *, arrayind_t, arrayind_t, int));
extern char *array_subrange __P((ARRAY *, arrayind_t, arrayind_t, int, int));
extern char *array_patsub __P((ARRAY *, char *, char *, int));
/* Basic operations on array elements. */
@@ -69,6 +71,8 @@ extern char *array_reference __P((ARRAY *, arrayind_t));
/* Converting to and from arrays */
extern WORD_LIST *array_to_word_list __P((ARRAY *));
extern ARRAY *array_from_word_list __P((WORD_LIST *));
extern WORD_LIST *array_keys_to_word_list __P((ARRAY *));
extern ARRAY *array_assign_list __P((ARRAY *, WORD_LIST *));
extern char **array_to_argv __P((ARRAY *));
@@ -90,6 +94,18 @@ extern ARRAY *array_from_string __P((char *, char *));
#define element_forw(ae) ((ae)->next)
#define element_back(ae) ((ae)->prev)
/* Convenience */
#define array_push(a,v) \
do { array_rshift ((a), 1, (v)); } while (0)
#define array_pop(a) \
do { array_dispose_element (array_shift ((a), 1, 0)); } while (0)
#define GET_ARRAY_FROM_VAR(n, v, a) \
do { \
(v) = find_variable (n); \
(a) = ((v) && array_p ((v))) ? array_cell (v) : (ARRAY *)0; \
} while (0)
#define ALL_ELEMENT_SUB(c) ((c) == '@' || (c) == '*')
#endif /* _ARRAY_H_ */
+44 -3
View File
@@ -56,7 +56,8 @@ convert_var_to_array (var)
oldval = value_cell (var);
array = array_create ();
array_insert (array, 0, oldval);
if (oldval)
array_insert (array, 0, oldval);
FREE (value_cell (var));
var_setarray (var, array);
@@ -395,13 +396,13 @@ skipsubscript (s, i)
state_bak = state;
mblength = mbrlen (s + i, slength, &state);
if (mblength == (size_t)-2 || mblength == (size_t)-1)
if (MB_INVALIDCH (mblength))
{
state = state_bak;
i++;
slength--;
}
else if (mblength == 0)
else if (MB_NULLWCH (mblength))
return i;
else
{
@@ -623,6 +624,9 @@ array_value_internal (s, quoted, allow_all, rtype)
return (char *)NULL;
#endif
if (len == 0)
return ((char *)NULL); /* error message already printed */
/* [ */
if (ALL_ELEMENT_SUB (t[0]) && t[1] == ']')
{
@@ -704,4 +708,41 @@ get_array_value (s, allow_all, rtype)
return (array_value_internal (s, 0, allow_all, rtype));
}
char *
array_keys (s, quoted)
char *s;
int quoted;
{
int len;
char *retval, *t, *temp;
WORD_LIST *l;
SHELL_VAR *var;
var = array_variable_part (s, &t, &len);
/* [ */
if (var == 0 || ALL_ELEMENT_SUB (t[0]) == 0 || t[1] != ']')
return (char *)NULL;
if (array_p (var) == 0)
l = add_string_to_list ("0", (WORD_LIST *)NULL);
else
{
l = array_keys_to_word_list (array_cell (var));
if (l == (WORD_LIST *)NULL)
return ((char *) NULL);
}
if (t[0] == '*' && (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)))
{
temp = string_list_dollar_star (l);
retval = quote_string (temp);
free (temp);
}
else /* ${!name[@]} or unquoted ${!name[*]} */
retval = string_list_dollar_at (l, quoted);
dispose_words (l);
return retval;
}
#endif /* ARRAY_VARS */
+2
View File
@@ -45,6 +45,8 @@ extern int valid_array_reference __P((char *));
extern char *array_value __P((char *, int, int *));
extern char *get_array_value __P((char *, int, int *));
extern char *array_keys __P((char *, int));
extern char *array_variable_name __P((char *, char **, int *));
extern SHELL_VAR *array_variable_part __P((char *, char **, int *));
+55 -21
View File
@@ -58,6 +58,7 @@ extern int errno;
static int histignore_item_func __P((struct ign *));
static int check_history_control __P((char *));
static void hc_erasedups __P((char *));
static void really_add_history __P((char *));
static struct ignorevar histignore =
@@ -77,7 +78,10 @@ static struct ignorevar histignore =
becomes zero when we read lines from a file, for example. */
int remember_on_history = 1;
/* The number of lines that Bash has added to this history session. */
/* The number of lines that Bash has added to this history session. The
difference between the number of the top element in the history list
(offset from history_base) and the number of lines in the history file.
Appending this session's history to the history file resets this to 0. */
int history_lines_this_session;
/* The number of lines that Bash has read from the history file. */
@@ -134,10 +138,14 @@ int literal_history;
exit, even if the history has been stifled. */
int force_append_history;
/* A nit for picking at history saving.
Value of 0 means save all lines parsed by the shell on the history.
Value of 1 means save all lines that do not start with a space.
Value of 2 means save all lines that do not match the last line saved. */
/* A nit for picking at history saving. Flags have the following values:
Value == 0 means save all lines parsed by the shell on the history.
Value & HC_IGNSPACE means save all lines that do not start with a space.
Value & HC_IGNDUPS means save all lines that do not match the last
line saved.
Value & HC_ERASEDUPS means to remove all other matching lines from the
history list before saving the latest line. */
int history_control;
/* Set to 1 if the last command was added to the history list successfully
@@ -206,6 +214,7 @@ bash_initialize_history ()
history_quotes_inhibit_expansion = 1;
history_search_delimiter_chars = ";&()|<>";
history_inhibit_expansion_function = bash_history_inhibit_expansion;
history_comment_char = '#';
}
void
@@ -511,27 +520,49 @@ check_history_control (line)
HIST_ENTRY *temp;
int r;
switch (history_control)
if (history_control == 0)
return 1;
/* ignorespace or ignoreboth */
if ((history_control & HC_IGNSPACE) && *line == ' ')
return 0;
/* ignoredups or ignoreboth */
if (history_control & HC_IGNDUPS)
{
case 0: /* nothing */
return 1;
case 1: /* ignorespace */
return (*line != ' ');
case 3: /* ignoreboth */
if (*line == ' ')
return 0;
/* FALLTHROUGH if case == 3 (`ignoreboth') */
case 2: /* ignoredups */
using_history ();
temp = previous_history ();
r = (temp == 0 || STREQ (temp->line, line) == 0);
using_history ();
return r;
if (r == 0)
return r;
}
return 0;
return 1;
}
/* Remove all entries matching LINE from the history list. Triggered when
HISTCONTROL includes `erasedups'. */
static void
hc_erasedups (line)
char *line;
{
HIST_ENTRY *temp;
int r;
using_history ();
while (temp = previous_history ())
{
if (STREQ (temp->line, line))
{
r = where_history ();
remove_history (r);
}
}
using_history ();
}
/* Add LINE to the history list, handling possibly multi-line compound
@@ -577,6 +608,11 @@ check_add_history (line, force)
{
if (check_history_control (line) && history_should_ignore (line) == 0)
{
/* We're committed to saving the line. If the user has requested it,
remove other matching lines from the history. */
if (history_control & HC_ERASEDUPS)
hc_erasedups (line);
if (force)
{
really_add_history (line);
@@ -635,10 +671,8 @@ bash_add_history (line)
free (new_line);
if (old)
{
FREE (old->line);
free (old);
}
free_history_entry (old);
add_it = 0;
}
}
+7
View File
@@ -23,6 +23,13 @@
#include "stdc.h"
/* Flag values for history_control */
#define HC_IGNSPACE 0x01
#define HC_IGNDUPS 0x02
#define HC_ERASEDUPS 0x04
#define HC_IGNBOTH (HC_IGNSPACE|HC_IGNDUPS)
extern int remember_on_history;
extern int history_lines_this_session;
extern int history_lines_in_file;
+5 -4
View File
@@ -33,9 +33,10 @@ extern procenv_t return_catch; /* used by `return' builtin */
xbcopy ((char *)old, (char *)save, sizeof (procenv_t));
/* Values for the second argument to longjmp/siglongjmp. */
#define NOT_JUMPED 0 /* Not returning from a longjmp. */
#define FORCE_EOF 1 /* We want to stop parsing. */
#define DISCARD 2 /* Discard current command. */
#define EXITPROG 3 /* Unconditionally exit the program now. */
#define NOT_JUMPED 0 /* Not returning from a longjmp. */
#define FORCE_EOF 1 /* We want to stop parsing. */
#define DISCARD 2 /* Discard current command. */
#define EXITPROG 3 /* Unconditionally exit the program now. */
#define ERREXIT 4 /* Exit due to error condition */
#endif /* _BASHJMP_H_ */
+176 -78
View File
@@ -150,10 +150,15 @@ static char **prog_complete_matches;
#endif
/* Variables used here but defined in other files. */
extern int current_command_line_count;
#if defined (BANG_HISTORY)
extern int hist_verify;
#endif
extern int current_command_line_count, last_command_exit_value;
extern int posixly_correct, no_symbolic_links;
extern char *current_prompt_string, *ps1_prompt;
extern STRING_INT_ALIST word_token_alist[];
extern sh_builtin_func_t *last_shell_builtin, *this_shell_builtin;
/* SPECIFIC_COMPLETION_FUNCTIONS specifies that we have individual
completion functions which indicate what type of completion should be
@@ -205,8 +210,14 @@ int perform_hostname_completion = 1;
/* If non-zero, we don't do command completion on an empty line. */
int no_empty_command_completion;
/* Set FORCE_FIGNORE if you want to honor FIGNORE even if it ignores the
only possible matches. Set to 0 if you want to match filenames if they
are the only possible matches, even if FIGNORE says to. */
int force_fignore = 1;
static char *bash_completer_word_break_characters = " \t\n\"'@><=;|&(:";
static char *bash_nohostname_word_break_characters = " \t\n\"'><=;|&(:";
/* )) */
static rl_hook_func_t *old_rl_startup_hook = (rl_hook_func_t *)NULL;
@@ -233,11 +244,14 @@ posix_readline_initialize (on_or_off)
#endif
}
/* When this function returns, rl_completer_word_break_characters points to
dynamically allocated memory. */
int
enable_hostname_completion (on_or_off)
int on_or_off;
{
int old_value;
char *at, *nv, *nval;
old_value = perform_hostname_completion;
@@ -245,13 +259,60 @@ enable_hostname_completion (on_or_off)
{
perform_hostname_completion = 1;
rl_special_prefixes = "$@";
rl_completer_word_break_characters = bash_completer_word_break_characters;
}
else
{
perform_hostname_completion = 0;
rl_special_prefixes = "$";
rl_completer_word_break_characters = bash_nohostname_word_break_characters;
}
/* Now we need to figure out how to appropriately modify and assign
rl_completer_word_break_characters depending on whether we want
hostname completion on or off. */
/* If this is the first time this has been called
(bash_readline_initialized == 0), use the sames values as before, but
allocate new memory for rl_completer_word_break_characters. */
if (bash_readline_initialized == 0 &&
(rl_completer_word_break_characters == 0 ||
rl_completer_word_break_characters == rl_basic_word_break_characters))
{
if (on_or_off)
rl_completer_word_break_characters = savestring (bash_completer_word_break_characters);
else
rl_completer_word_break_characters = savestring (bash_nohostname_word_break_characters);
}
else
{
/* See if we have anything to do. */
at = strchr (rl_completer_word_break_characters, '@');
if ((at == 0 && on_or_off == 0) || (at != 0 && on_or_off != 0))
return;
/* We have something to do. Do it. */
nval = (char *)xmalloc (strlen (rl_completer_word_break_characters) + 1 + on_or_off);
if (on_or_off == 0)
{
/* Turn it off -- just remove `@' from word break chars. We want
to remove all occurrences of `@' from the char list, so we loop
rather than just copy the rest of the list over AT. */
for (nv = nval, at = rl_completer_word_break_characters; *at; )
if (*at != '@')
*nv++ = *at++;
else
at++;
*nv = '\0';
}
else
{
nval[0] = '@';
strcpy (nval + 1, rl_completer_word_break_characters);
}
free (rl_completer_word_break_characters);
rl_completer_word_break_characters = nval;
}
return (old_value);
@@ -320,15 +381,14 @@ initialize_readline ()
rl_initialize ();
/* Bind up our special shell functions. */
rl_bind_key_in_map (CTRL('E'), shell_expand_line, emacs_meta_keymap);
rl_bind_key_if_unbound_in_map (CTRL('E'), shell_expand_line, emacs_meta_keymap);
/* Bind up our special shell functions. */
#ifdef BANG_HISTORY
rl_bind_key_in_map ('^', history_expand_line, emacs_meta_keymap);
rl_bind_key_if_unbound_in_map ('^', history_expand_line, emacs_meta_keymap);
#endif
rl_bind_key_in_map (CTRL ('O'), operate_and_get_next, emacs_standard_keymap);
rl_bind_key_in_map (CTRL ('V'), display_shell_version, emacs_ctlx_keymap);
rl_bind_key_if_unbound_in_map (CTRL ('O'), operate_and_get_next, emacs_standard_keymap);
rl_bind_key_if_unbound_in_map (CTRL ('V'), display_shell_version, emacs_ctlx_keymap);
/* In Bash, the user can switch editing modes with "set -o [vi emacs]",
so it is not necessary to allow C-M-j for context switching. Turn
@@ -340,32 +400,32 @@ initialize_readline ()
#endif
#if defined (BRACE_COMPLETION)
rl_bind_key_in_map ('{', bash_brace_completion, emacs_meta_keymap);
rl_bind_key_if_unbound_in_map ('{', bash_brace_completion, emacs_meta_keymap); /*}*/
#endif /* BRACE_COMPLETION */
#if defined (SPECIFIC_COMPLETION_FUNCTIONS)
rl_bind_key_in_map ('/', bash_complete_filename, emacs_meta_keymap);
rl_bind_key_in_map ('/', bash_possible_filename_completions, emacs_ctlx_keymap);
rl_bind_key_if_unbound_in_map ('/', bash_complete_filename, emacs_meta_keymap);
rl_bind_key_if_unbound_in_map ('/', bash_possible_filename_completions, emacs_ctlx_keymap);
rl_bind_key_in_map ('~', bash_complete_username, emacs_meta_keymap);
rl_bind_key_in_map ('~', bash_possible_username_completions, emacs_ctlx_keymap);
rl_bind_key_if_unbound_in_map ('~', bash_complete_username, emacs_meta_keymap);
rl_bind_key_if_unbound_in_map ('~', bash_possible_username_completions, emacs_ctlx_keymap);
rl_bind_key_in_map ('@', bash_complete_hostname, emacs_meta_keymap);
rl_bind_key_in_map ('@', bash_possible_hostname_completions, emacs_ctlx_keymap);
rl_bind_key_if_unbound_in_map ('@', bash_complete_hostname, emacs_meta_keymap);
rl_bind_key_if_unbound_in_map ('@', bash_possible_hostname_completions, emacs_ctlx_keymap);
rl_bind_key_in_map ('$', bash_complete_variable, emacs_meta_keymap);
rl_bind_key_in_map ('$', bash_possible_variable_completions, emacs_ctlx_keymap);
rl_bind_key_if_unbound_in_map ('$', bash_complete_variable, emacs_meta_keymap);
rl_bind_key_if_unbound_in_map ('$', bash_possible_variable_completions, emacs_ctlx_keymap);
rl_bind_key_in_map ('!', bash_complete_command, emacs_meta_keymap);
rl_bind_key_in_map ('!', bash_possible_command_completions, emacs_ctlx_keymap);
rl_bind_key_if_unbound_in_map ('!', bash_complete_command, emacs_meta_keymap);
rl_bind_key_if_unbound_in_map ('!', bash_possible_command_completions, emacs_ctlx_keymap);
rl_bind_key_in_map ('g', bash_glob_complete_word, emacs_meta_keymap);
rl_bind_key_in_map ('*', bash_glob_expand_word, emacs_ctlx_keymap);
rl_bind_key_in_map ('g', bash_glob_list_expansions, emacs_ctlx_keymap);
rl_bind_key_if_unbound_in_map ('g', bash_glob_complete_word, emacs_meta_keymap);
rl_bind_key_if_unbound_in_map ('*', bash_glob_expand_word, emacs_ctlx_keymap);
rl_bind_key_if_unbound_in_map ('g', bash_glob_list_expansions, emacs_ctlx_keymap);
#endif /* SPECIFIC_COMPLETION_FUNCTIONS */
rl_bind_key_in_map (TAB, dynamic_complete_history, emacs_meta_keymap);
rl_bind_key_if_unbound_in_map (TAB, dynamic_complete_history, emacs_meta_keymap);
/* Tell the completer that we want a crack first. */
rl_attempted_completion_function = attempt_shell_completion;
@@ -378,11 +438,11 @@ initialize_readline ()
rl_ignore_some_completions_function = filename_completion_ignore;
/* Bind C-xC-e to invoke emacs and run result as commands. */
rl_bind_key_in_map (CTRL ('E'), emacs_edit_and_execute_command, emacs_ctlx_keymap);
rl_bind_key_if_unbound_in_map (CTRL ('E'), emacs_edit_and_execute_command, emacs_ctlx_keymap);
#if defined (VI_MODE)
rl_bind_key_in_map ('v', vi_edit_and_execute_command, vi_movement_keymap);
rl_bind_key_if_unbound_in_map ('v', vi_edit_and_execute_command, vi_movement_keymap);
# if defined (ALIAS)
rl_bind_key_in_map ('@', posix_edit_macros, vi_movement_keymap);
rl_bind_key_if_unbound_in_map ('@', posix_edit_macros, vi_movement_keymap);
# endif
#endif
@@ -708,8 +768,8 @@ operate_and_get_next (count, c)
command being entered (if no explicit argument is given), otherwise on
a command from the history file. */
#define VI_EDIT_COMMAND "fc -e ${VISUAL:-${EDITOR:-vi}}"
#define EMACS_EDIT_COMMAND "fc -e ${VISUAL:-${EDITOR:-emacs}}"
#define VI_EDIT_COMMAND "fc -e \"${VISUAL:-${EDITOR:-vi}}\""
#define EMACS_EDIT_COMMAND "fc -e \"${VISUAL:-${EDITOR:-emacs}}\""
static int
edit_and_execute_command (count, c, editing_mode, edit_command)
@@ -810,6 +870,7 @@ posix_edit_macros (count, key)
/* **************************************************************** */
#define COMMAND_SEPARATORS ";|&{(`"
/* )} */
static int
check_redir (ti)
@@ -1008,11 +1069,27 @@ attempt_shell_completion (text, start, end)
matches = rl_completion_matches (text, prog_complete_return);
if ((foundcs & COPT_DEFAULT) == 0)
rl_attempted_completion_over = 1; /* no default */
return (matches);
if (matches || ((foundcs & COPT_BASHDEFAULT) == 0))
return (matches);
}
}
#endif
if (matches == 0)
matches = bash_default_completion (text, start, end, qc, in_command_position);
return matches;
}
char **
bash_default_completion (text, start, end, qc, in_command_position)
const char *text;
int start, end, qc, in_command_position;
{
char **matches;
matches = (char **)NULL;
/* New posix-style command substitution or variable name? */
if (!matches && *text == '$')
{
@@ -1044,7 +1121,10 @@ attempt_shell_completion (text, start, end)
}
else
{
#define CMD_IS_DIR(x) (absolute_pathname(x) == 0 && absolute_program(x) == 0 && *(x) != '~' && test_for_directory (x))
matches = rl_completion_matches (text, command_word_completion_function);
/* If we are attempting command completion and nothing matches, we
do not want readline to perform filename completion for us. We
still want to be able to complete partial pathnames, so set the
@@ -1052,7 +1132,8 @@ attempt_shell_completion (text, start, end)
filenames and leave directories in the match list. */
if (matches == (char **)NULL)
rl_ignore_some_completions_function = bash_ignore_filenames;
else if (matches[1] == 0 && *matches[0] != '/')
#if 0
else if (matches[1] == 0 && CMD_IS_DIR(matches[0]))
/* Turn off rl_filename_completion_desired so readline doesn't
append a slash if there is a directory with the same name
in the current directory, or other filename-specific things.
@@ -1061,7 +1142,7 @@ attempt_shell_completion (text, start, end)
looking in the current directory anyway, so there's no
conflict. */
rl_filename_completion_desired = 0;
else if (matches[0] && matches[1] && STREQ (matches[0], matches[1]) && *matches[0] != '/')
else if (matches[0] && matches[1] && STREQ (matches[0], matches[1]) && CMD_IS_DIR (matches[0]))
/* There are multiple instances of the same match (duplicate
completions haven't yet been removed). In this case, all of
the matches will be the same, and the duplicate removal code
@@ -1071,6 +1152,7 @@ attempt_shell_completion (text, start, end)
completion. If there are multiple completions this won't
make a difference and the problem won't occur. */
rl_filename_completion_desired = 0;
#endif
}
}
@@ -1631,8 +1713,13 @@ history_expand_line_internal (line)
char *line;
{
char *new_line;
int old_verify;
old_verify = hist_verify;
hist_verify = 0;
new_line = pre_process_line (line, 0, 0);
hist_verify = old_verify;
return (new_line == line) ? savestring (line) : new_line;
}
#endif
@@ -1643,9 +1730,18 @@ static void
cleanup_expansion_error ()
{
char *to_free;
#if defined (BANG_HISTORY)
int old_verify;
old_verify = hist_verify;
hist_verify = 0;
#endif
fprintf (rl_outstream, "\r\n");
to_free = pre_process_line (rl_line_buffer, 1, 0);
#if defined (BANG_HISTORY)
hist_verify = old_verify;
#endif
if (to_free != rl_line_buffer)
free (to_free);
putc ('\r', rl_outstream);
@@ -1773,9 +1869,7 @@ history_and_alias_expand_line (count, ignore)
{
char *new_line;
new_line = pre_process_line (rl_line_buffer, 0, 0);
if (new_line == rl_line_buffer)
new_line = savestring (new_line);
new_line = history_expand_line_internal (rl_line_buffer);
#if defined (ALIAS)
if (new_line)
@@ -1811,9 +1905,7 @@ shell_expand_line (count, ignore)
char *new_line;
WORD_LIST *expanded_string;
new_line = pre_process_line (rl_line_buffer, 0, 0);
if (new_line == rl_line_buffer)
new_line = savestring (new_line);
new_line = history_expand_line_internal (rl_line_buffer);
#if defined (ALIAS)
if (new_line)
@@ -1873,10 +1965,6 @@ shell_expand_line (count, ignore)
}
}
/* Define NO_FORCE_FIGNORE if you want to match filenames that would
otherwise be ignored if they are the only possible matches. */
/* #define NO_FORCE_FIGNORE */
/* If FIGNORE is set, then don't match files with the given suffixes when
completing filenames. If only one of the possibilities has an acceptable
suffix, delete the others, else just return and let the completer
@@ -1901,10 +1989,8 @@ _ignore_completion_names (names, name_func)
{
char **newnames;
int idx, nidx;
#ifdef NO_FORCE_FIGNORE
char **oldnames;
int oidx;
#endif
/* If there is only one completion, see if it is acceptable. If it is
not, free it up. In any case, short-circuit and return. This is a
@@ -1912,13 +1998,13 @@ _ignore_completion_names (names, name_func)
if there is only one completion; it is the completion itself. */
if (names[1] == (char *)0)
{
#ifndef NO_FORCE_FIGNORE
if ((*name_func) (names[0]) == 0)
{
free (names[0]);
names[0] = (char *)NULL;
}
#endif
if (force_fignore)
if ((*name_func) (names[0]) == 0)
{
free (names[0]);
names[0] = (char *)NULL;
}
return;
}
@@ -1927,22 +2013,22 @@ _ignore_completion_names (names, name_func)
for (nidx = 1; names[nidx]; nidx++)
;
newnames = strvec_create (nidx + 1);
#ifdef NO_FORCE_FIGNORE
oldnames = strvec_create (nidx - 1);
oidx = 0;
#endif
if (force_fignore == 0)
{
oldnames = strvec_create (nidx - 1);
oidx = 0;
}
newnames[0] = names[0];
for (idx = nidx = 1; names[idx]; idx++)
{
if ((*name_func) (names[idx]))
newnames[nidx++] = names[idx];
else
#ifndef NO_FORCE_FIGNORE
free (names[idx]);
#else
else if (force_fignore == 0)
oldnames[oidx++] = names[idx];
#endif
else
free (names[idx]);
}
newnames[nidx] = (char *)NULL;
@@ -1950,21 +2036,24 @@ _ignore_completion_names (names, name_func)
/* If none are acceptable then let the completer handle it. */
if (nidx == 1)
{
#ifndef NO_FORCE_FIGNORE
free (names[0]);
names[0] = (char *)NULL;
#else
free (oldnames);
#endif
if (force_fignore)
{
free (names[0]);
names[0] = (char *)NULL;
}
else
free (oldnames);
free (newnames);
return;
}
#ifdef NO_FORCE_FIGNORE
while (oidx)
free (oldnames[--oidx]);
free (oldnames);
#endif
if (force_fignore == 0)
{
while (oidx)
free (oldnames[--oidx]);
free (oldnames);
}
/* If only one is acceptable, copy it to names[0] and return. */
if (nidx == 2)
@@ -2292,7 +2381,7 @@ bash_complete_filename_internal (what_to_do)
rl_compentry_func_t *orig_func;
rl_completion_func_t *orig_attempt_func;
rl_icppfunc_t *orig_dir_func;
const char *orig_rl_completer_word_break_characters;
/*const*/ char *orig_rl_completer_word_break_characters;
int r;
orig_func = rl_completion_entry_function;
@@ -2676,8 +2765,7 @@ bash_execute_unix_command (count, key)
Keymap xkmap; /* unix command executing keymap */
register int i;
char *cmd;
int old_line_count;
int *ts;
sh_parser_state_t ps;
/* First, we need to find the right command to execute. This is tricky,
because we might have already indirected into another keymap. */
@@ -2713,14 +2801,12 @@ bash_execute_unix_command (count, key)
rl_crlf (); /* move to a new line */
old_line_count = current_command_line_count;
ts = save_token_state ();
save_parser_state (&ps);
cmd = savestring (cmd);
parse_and_execute (cmd, "bash_execute_unix_command", SEVAL_NOHIST);
current_command_line_count = old_line_count;
restore_token_state (ts);
restore_parser_state (&ps);
/* and restore the readline buffer and display after command execution. */
rl_forced_update_display ();
@@ -2825,7 +2911,7 @@ bind_keyseq_to_unix_command (line)
/* and bind the key sequence in the current keymap to a function that
understands how to execute from CMD_XMAP */
rl_set_key (kseq, bash_execute_unix_command, kmap);
rl_bind_keyseq_in_map (kseq, bash_execute_unix_command, kmap);
return 0;
}
@@ -2854,4 +2940,16 @@ bash_directory_completion_matches (text)
(void)bash_ignore_filenames (m1);
return m1;
}
char *
bash_dequote_text (text)
const char *text;
{
char *dtxt;
int qc;
qc = (text[0] == '"' || text[0] == '\'') ? text[0] : 0;
dtxt = bash_dequote_filename ((char *)text, qc);
return (dtxt);
}
#endif /* READLINE */
+3
View File
@@ -33,6 +33,8 @@ extern int bash_re_edit __P((char *));
extern int bind_keyseq_to_unix_command __P((char *));
extern char **bash_default_completion __P((const char *, int, int, int, int));
/* Used by programmable completion code. */
extern char *command_word_completion_function __P((const char *, int));
extern char *bash_groupname_completion_function __P((const char *, int));
@@ -42,5 +44,6 @@ extern char **get_hostname_list __P((void));
extern void clear_hostname_list __P((void));
extern char **bash_directory_completion_matches __P((const char *));
extern char *bash_dequote_text __P((const char *));
#endif /* _BASHLINE_H_ */
+144 -21
View File
@@ -1,6 +1,6 @@
/* braces.c -- code for doing word expansion in curly braces. */
/* Copyright (C) 1987-2002 Free Software Foundation, Inc.
/* Copyright (C) 1987-2003 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -39,9 +39,12 @@
#include "general.h"
#include "shmbutil.h"
#include "chartypes.h"
#define brace_whitespace(c) (!(c) || (c) == ' ' || (c) == '\t' || (c) == '\n')
#define BRACE_SEQ_SPECIFIER ".."
/* Basic idea:
Segregate the text into 3 sections: preamble (stuff before an open brace),
@@ -56,11 +59,15 @@ int brace_arg_separator = ',';
#if defined (__P)
static int brace_gobbler __P((char *, size_t, int *, int));
static char **expand_amble __P((char *, size_t));
static char **expand_amble __P((char *, size_t, int));
static char **expand_seqterm __P((char *, size_t));
static char **mkseq __P((int, int, int));
static char **array_concat __P((char **, char **));
#else
static int brace_gobbler ();
static char **expand_amble ();
static char **expand_seqterm ();
static char **mkseq();
static char **array_concat ();
#endif
@@ -161,22 +168,29 @@ brace_expand (text)
ADVANCE_CHAR (amble, alen, j);
}
if (!amble[j])
if (amble[j] == 0)
{
free (amble);
free (preamble);
result[0] = savestring (text);
return (result);
tack = expand_seqterm (amble, alen);
if (tack)
goto add_tack;
else
{
free (amble);
free (preamble);
result[0] = savestring (text);
return (result);
}
}
#endif /* SHELL */
postamble = &text[i + 1];
tack = expand_amble (amble, alen);
tack = expand_amble (amble, alen, 0);
add_tack:
result = array_concat (result, tack);
free (amble);
strvec_dispose (tack);
postamble = text + i + 1;
tack = brace_expand (postamble);
result = array_concat (result, tack);
strvec_dispose (tack);
@@ -189,9 +203,10 @@ brace_expand (text)
expand each slot which needs it, until there are no more slots which
need it. */
static char **
expand_amble (text, tlen)
expand_amble (text, tlen, flags)
char *text;
size_t tlen;
int flags;
{
char **result, **partial;
char *tem;
@@ -220,9 +235,10 @@ expand_amble (text, tlen)
result = partial;
else
{
register int lr = strvec_len (result);
register int lp = strvec_len (partial);
register int j;
register int lr, lp, j;
lr = strvec_len (result);
lp = strvec_len (partial);
result = strvec_resize (result, lp + lr + 1);
@@ -239,6 +255,108 @@ expand_amble (text, tlen)
return (result);
}
#define ST_BAD 0
#define ST_INT 1
#define ST_CHAR 2
static char **
mkseq (start, end, type)
int start, end, type;
{
int n, incr, i;
char **result, *t;
n = abs (end - start) + 1;
result = strvec_create (n + 1);
incr = (start < end) ? 1 : -1;
/* Make sure we go through the loop at least once, so {3..3} prints `3' */
i = 0;
n = start;
do
{
if (type == ST_INT)
result[i++] = itos (n);
else
{
t = (char *)xmalloc (2);
t[0] = n;
t[1] = '\0';
result[i++] = t;
}
if (n == end)
break;
n += incr;
}
while (1);
result[i] = (char *)0;
return (result);
}
static char **
expand_seqterm (text, tlen)
char *text;
size_t tlen;
{
char *t, *lhs, *rhs;
int i, lhs_t, rhs_t, lhs_v, rhs_v;
intmax_t tl, tr;
char **result;
t = strstr (text, BRACE_SEQ_SPECIFIER);
if (t == 0)
return ((char **)NULL);
i = t - text; /* index of start of BRACE_SEQ_SPECIFIER */
lhs = substring (text, 0, i);
rhs = substring (text, i + sizeof(BRACE_SEQ_SPECIFIER) - 1, tlen);
if (lhs[0] == 0 || rhs[0] == 0)
{
free (lhs);
free (rhs);
return ((char **)NULL);
}
/* Now figure out whether LHS and RHS are integers or letters. Both
sides have to match. */
lhs_t = (legal_number (lhs, &tl)) ? ST_INT :
((ISALPHA (lhs[0]) && lhs[1] == 0) ? ST_CHAR : ST_BAD);
rhs_t = (legal_number (rhs, &tr)) ? ST_INT :
((ISALPHA (rhs[0]) && rhs[1] == 0) ? ST_CHAR : ST_BAD);
if (lhs_t != rhs_t || lhs_t == ST_BAD || rhs_t == ST_BAD)
{
free (lhs);
free (rhs);
return ((char **)NULL);
}
/* OK, we have something. It's either a sequence of integers, ascending
or descending, or a sequence or letters, ditto. Generate the sequence,
put it into a string vector, and return it. */
if (lhs_t == ST_CHAR)
{
lhs_v = lhs[0];
rhs_v = rhs[0];
}
else
{
lhs_v = tl; /* integer truncation */
rhs_v = tr;
}
result = mkseq (lhs_v, rhs_v, lhs_t);
free (lhs);
free (rhs);
return (result);
}
/* Start at INDEX, and skip characters in TEXT. Set INDEX to the
index of the character matching SATISFY. This understands about
quoting. Return the character that caused us to stop searching;
@@ -278,6 +396,16 @@ brace_gobbler (text, tlen, indx, satisfy)
continue;
}
#if defined (SHELL)
/* If compiling for the shell, treat ${...} like \{...} */
if (c == '$' && text[i+1] == '{' && quoted != '\'') /* } */
{
pass_next = 1;
i++;
continue;
}
#endif
if (quoted)
{
if (c == quoted)
@@ -318,11 +446,7 @@ brace_gobbler (text, tlen, indx, satisfy)
i++;
continue;
}
#if defined (SHELL)
/* If this is being compiled as part of bash, ignore the `{'
in a `${}' construct */
if ((c != '{') || i == 0 || (text[i - 1] != '$'))
#endif /* SHELL */
break;
}
@@ -368,8 +492,7 @@ array_concat (arr1, arr2)
for (j = 0; j < len2; j++)
{
result[len] =
(char *)xmalloc (1 + strlen_1 + strlen (arr2[j]));
result[len] = (char *)xmalloc (1 + strlen_1 + strlen (arr2[j]));
strcpy (result[len], arr1[i]);
strcpy (result[len] + strlen_1, arr2[j]);
len++;
+28 -16
View File
@@ -106,7 +106,8 @@ RL_LIBSRC = $(topdir)/lib/readline
$(CC) -c $(CCFLAGS) $<
DEFSRC = $(srcdir)/alias.def $(srcdir)/bind.def $(srcdir)/break.def \
$(srcdir)/builtin.def $(srcdir)/cd.def $(srcdir)/colon.def \
$(srcdir)/builtin.def $(srcdir)/caller.def \
$(srcdir)/cd.def $(srcdir)/colon.def \
$(srcdir)/command.def $(srcdir)/declare.def $(srcdir)/echo.def \
$(srcdir)/enable.def $(srcdir)/eval.def $(srcdir)/getopts.def \
$(srcdir)/exec.def $(srcdir)/exit.def $(srcdir)/fc.def \
@@ -124,7 +125,7 @@ STATIC_SOURCE = common.c evalstring.c evalfile.c getopt.c bashgetopt.c \
getopt.h
OFILES = builtins.o \
alias.o bind.o break.o builtin.o cd.o colon.o command.o \
alias.o bind.o break.o builtin.o caller.o cd.o colon.o command.o \
common.o declare.o echo.o enable.o eval.o evalfile.o \
evalstring.o exec.o \
exit.o fc.o fg_bg.o hash.o help.o history.o jobs.o kill.o let.o \
@@ -214,10 +215,14 @@ distclean maintainer-clean: clean
$(OFILES): $(MKBUILTINS) ../config.h
../version.h: ../config.h ../Makefile Makefile
-( cd ${BUILD_DIR} && ${MAKE} ${MFLAGS} version.h )
alias.o: alias.def
bind.o: bind.def
break.o: break.def
builtin.o: builtin.def
caller.o: caller.def
cd.o: cd.def
colon.o: colon.def
command.o: command.def
@@ -263,7 +268,7 @@ bashgetopt.o: $(topdir)/command.h $(topdir)/general.h $(topdir)/xmalloc.h $(topd
bashgetopt.o: $(topdir)/variables.h $(topdir)/conftypes.h $(topdir)/quit.h $(BASHINCDIR)/maxpath.h
bashgetopt.o: $(topdir)/unwind_prot.h $(topdir)/dispose_cmd.h
bashgetopt.o: $(topdir)/make_cmd.h $(topdir)/subst.h $(topdir)/sig.h
bashgetopt.o: $(topdir)/pathnames.h $(topdir)/externs.h $(srcdir)/common.h
bashgetopt.o: ../pathnames.h $(topdir)/externs.h $(srcdir)/common.h
bashgetopt.o: $(BASHINCDIR)/chartypes.h
common.o: $(topdir)/bashtypes.h $(BASHINCDIR)/posixstat.h $(topdir)/bashansi.h $(BASHINCDIR)/ansi_stdlib.h
common.o: $(topdir)/shell.h $(topdir)/syntax.h ../config.h $(topdir)/bashjmp.h $(BASHINCDIR)/posixjmp.h
@@ -274,7 +279,7 @@ common.o: $(topdir)/siglist.h $(topdir)/bashhist.h $(topdir)/quit.h
common.o: $(topdir)/unwind_prot.h $(BASHINCDIR)/maxpath.h $(topdir)/jobs.h
common.o: $(topdir)/builtins.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
common.o: $(topdir)/subst.h $(topdir)/execute_cmd.h $(topdir)/error.h
common.o: $(topdir)/externs.h $(topdir)/pathnames.h ./builtext.h
common.o: $(topdir)/externs.h ../pathnames.h ./builtext.h
common.o: $(BASHINCDIR)/chartypes.h
evalfile.o: $(topdir)/bashtypes.h $(BASHINCDIR)/posixstat.h ${BASHINCDIR}/filecntl.h
evalfile.o: $(topdir)/bashansi.h $(BASHINCDIR)/ansi_stdlib.h
@@ -283,7 +288,7 @@ evalfile.o: $(topdir)/command.h $(topdir)/general.h $(topdir)/xmalloc.h $(topdir
evalfile.o: $(topdir)/variables.h $(topdir)/conftypes.h $(topdir)/quit.h $(BASHINCDIR)/maxpath.h
evalfile.o: $(topdir)/unwind_prot.h $(topdir)/dispose_cmd.h
evalfile.o: $(topdir)/make_cmd.h $(topdir)/subst.h $(topdir)/sig.h
evalfile.o: $(topdir)/pathnames.h $(topdir)/externs.h
evalfile.o: ../pathnames.h $(topdir)/externs.h
evalfile.o: $(topdir)/jobs.h $(topdir)/builtins.h $(topdir)/flags.h
evalfile.o: $(topdir)/input.h $(topdir)/execute_cmd.h
evalfile.o: $(topdir)/bashhist.h $(srcdir)/common.h
@@ -303,8 +308,8 @@ getopt.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/bashjmp.h $(topdir)/com
getopt.o: $(topdir)/general.h $(topdir)/xmalloc.h $(topdir)/error.h $(topdir)/variables.h $(topdir)/conftypes.h
getopt.o: $(topdir)/quit.h $(BASHINCDIR)/maxpath.h $(topdir)/unwind_prot.h
getopt.o: $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h $(topdir)/subst.h
getopt.o: $(topdir)/sig.h $(topdir)/pathnames.h $(topdir)/externs.h
getopt.o: $(srcdir)/getopt.h
getopt.o: $(topdir)/sig.h ../pathnames.h $(topdir)/externs.h
getopt.o: $(srcdir)/getopt.h
mkbuiltins.o: ../config.h $(topdir)/bashtypes.h $(BASHINCDIR)/posixstat.h
mkbuiltins.o: ${BASHINCDIR}/filecntl.h
mkbuiltins.o: $(topdir)/bashansi.h $(BASHINCDIR)/ansi_stdlib.h
@@ -331,6 +336,12 @@ builtin.o: $(topdir)/quit.h $(srcdir)/common.h $(BASHINCDIR)/maxpath.h
builtin.o: $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h $(topdir)/subst.h
builtin.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
builtin.o: $(srcdir)/bashgetopt.h
caller.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h $(topdir)/error.h
caller.o: $(topdir)/general.h $(topdir)/xmalloc.h $(topdir)/quit.h $(topdir)/dispose_cmd.h
caller.o: $(topdir)/make_cmd.h $(topdir)/subst.h $(topdir)/externs.h
caller.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
caller.o: $(srcdir)/common.h $(BASHINCDIR)/maxpath.h ./builtext.h
caller.o: ${BASHINCDIR}/chartypes.h $(topdir)/bashtypes.h
cd.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h $(topdir)/error.h
cd.o: $(topdir)/general.h $(topdir)/xmalloc.h $(topdir)/quit.h $(topdir)/dispose_cmd.h
cd.o: $(topdir)/make_cmd.h $(topdir)/subst.h $(topdir)/externs.h
@@ -347,6 +358,7 @@ declare.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
declare.o: $(topdir)/subst.h $(topdir)/externs.h $(BASHINCDIR)/maxpath.h
declare.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
declare.o: $(topdir)/arrayfunc.h $(srcdir)/bashgetopt.h
declare.o: ./builtext.h
echo.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h $(topdir)/error.h
echo.o: $(topdir)/general.h $(topdir)/xmalloc.h $(topdir)/subst.h $(topdir)/externs.h
echo.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
@@ -362,7 +374,7 @@ enable.o: $(topdir)/pcomplete.h
eval.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
eval.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
eval.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
eval.o: $(topdir)/subst.h $(topdir)/externs.h
eval.o: $(topdir)/subst.h $(topdir)/externs.h
eval.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
eval.o: $(BASHINCDIR)/maxpath.h
exec.o: $(topdir)/bashtypes.h
@@ -377,7 +389,7 @@ exit.o: $(topdir)/bashtypes.h
exit.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
exit.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
exit.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
exit.o: $(topdir)/subst.h $(topdir)/externs.h
exit.o: $(topdir)/subst.h $(topdir)/externs.h
exit.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
exit.o: $(BASHINCDIR)/maxpath.h ./builtext.h
fc.o: $(topdir)/bashtypes.h $(BASHINCDIR)/posixstat.h
@@ -416,7 +428,7 @@ history.o: $(topdir)/bashtypes.h
history.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
history.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
history.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
history.o: $(topdir)/subst.h $(topdir)/externs.h
history.o: $(topdir)/subst.h $(topdir)/externs.h
history.o: ${BASHINCDIR}/filecntl.h $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h
history.o: $(topdir)/variables.h $(topdir)/conftypes.h $(topdir)/bashhist.h $(BASHINCDIR)/maxpath.h
inlib.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
@@ -426,7 +438,7 @@ inlib.o: $(BASHINCDIR)/maxpath.h $(topdir)/subst.h $(topdir)/externs.h
inlib.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
jobs.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h $(topdir)/error.h
jobs.o: $(topdir)/general.h $(topdir)/xmalloc.h $(topdir)/quit.h $(srcdir)/bashgetopt.h
jobs.o: $(BASHINCDIR)/maxpath.h $(topdir)/externs.h
jobs.o: $(BASHINCDIR)/maxpath.h $(topdir)/externs.h
jobs.o: $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h $(topdir)/subst.h
jobs.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
kill.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h $(topdir)/error.h
@@ -443,13 +455,13 @@ printf.o: ../config.h $(BASHINCDIR)/memalloc.h $(topdir)/bashjmp.h
printf.o: $(topdir)/command.h $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
printf.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
printf.o: $(topdir)/subst.h $(topdir)/externs.h $(topdir)/sig.h
printf.o: $(topdir)/pathnames.h $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h
printf.o: ../pathnames.h $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h
printf.o: $(topdir)/variables.h $(topdir)/conftypes.h $(BASHINCDIR)/stdc.h $(srcdir)/bashgetopt.h
printf.o: $(topdir)/bashtypes.h ${srcdir}/common.h $(BASHINCDIR)/chartypes.h
pushd.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
pushd.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
pushd.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
pushd.o: $(topdir)/subst.h $(topdir)/externs.h
pushd.o: $(topdir)/subst.h $(topdir)/externs.h
pushd.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
pushd.o: $(BASHINCDIR)/maxpath.h $(srcdir)/common.h ./builtext.h
read.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
@@ -474,7 +486,7 @@ setattr.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
setattr.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h $(BASHINCDIR)/maxpath.h
setattr.o: $(topdir)/quit.h $(srcdir)/common.h $(srcdir)/bashgetopt.h
setattr.o: $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h $(topdir)/subst.h
setattr.o: $(topdir)/externs.h
setattr.o: $(topdir)/externs.h
setattr.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
setattr.o: $(topdir)/arrayfunc.h
shift.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
@@ -487,7 +499,7 @@ source.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h $(topdir)/fi
source.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
source.o: $(topdir)/subst.h $(topdir)/externs.h $(BASHINCDIR)/maxpath.h
source.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
source.o: $(srcdir)/bashgetopt.h
source.o: $(srcdir)/bashgetopt.h $(topdir)/flags.h $(topdir)/trap.h
suspend.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
suspend.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
suspend.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
@@ -541,7 +553,7 @@ shopt.o: $(topdir)/subst.h $(topdir)/externs.h $(BASHINCDIR)/maxpath.h
shopt.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
shopt.o: $(srcdir)/common.h $(srcdir)/bashgetopt.h
complete.o: ../config.h
complete.o: ../config.h
complete.o: ${topdir}/shell.h $(topdir)/syntax.h ${topdir}/bashjmp.h ${BASHINCDIR}/posixjmp.h ${topdir}/sig.h
complete.o: ${topdir}/unwind_prot.h ${topdir}/variables.h
complete.o: ${topdir}/bashtypes.h ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
+16 -6
View File
@@ -51,17 +51,23 @@ $END
# include "common.h"
# include "bashgetopt.h"
static void print_alias __P((alias_t *));
/* Flags for print_alias */
#define AL_REUSABLE 0x01
static void print_alias __P((alias_t *, int));
extern int posixly_correct;
/* Hack the alias command in a Korn shell way. */
int
alias_builtin (list)
WORD_LIST *list;
{
int any_failed, offset, pflag;
int any_failed, offset, pflag, dflags;
alias_t **alias_list, *t;
char *name, *value;
dflags = posixly_correct ? 0 : AL_REUSABLE;
pflag = 0;
reset_internal_getopt ();
while ((offset = internal_getopt (list, "p")) != -1)
@@ -70,6 +76,7 @@ alias_builtin (list)
{
case 'p':
pflag = 1;
dflags |= AL_REUSABLE;
break;
default:
builtin_usage ();
@@ -90,7 +97,7 @@ alias_builtin (list)
return (EXECUTION_SUCCESS);
for (offset = 0; alias_list[offset]; offset++)
print_alias (alias_list[offset]);
print_alias (alias_list[offset], dflags);
free (alias_list); /* XXX - Do not free the strings. */
@@ -117,7 +124,7 @@ alias_builtin (list)
{
t = find_alias (name);
if (t)
print_alias (t);
print_alias (t, dflags);
else
{
sh_notfound (name);
@@ -192,13 +199,16 @@ unalias_builtin (list)
/* Output ALIAS in such a way as to allow it to be read back in. */
static void
print_alias (alias)
print_alias (alias, flags)
alias_t *alias;
int flags;
{
char *value;
value = sh_single_quote (alias->value);
printf ("alias %s=%s\n", alias->name, value);
if (flags & AL_REUSABLE)
printf ("alias ");
printf ("%s=%s\n", alias->name, value);
free (value);
fflush (stdout);
+146
View File
@@ -0,0 +1,146 @@
This file is caller.def, from which is created caller.c. It implements the
builtin "caller" in Bash.
Copyright (C) 2002 Rocky Bernstein for Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
Bash is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along
with Bash; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA.
$PRODUCES caller.c
$BUILTIN caller
$FUNCTION caller_builtin
$DEPENDS_ON DEBUGGER
$SHORT_DOC caller [EXPR]
Returns the context of the current subroutine call.
Without EXPR, returns returns "$line $filename". With EXPR,
returns "$line $subroutine $filename"; this extra information
can be used used to provide a stack trace.
The value of EXPR indicates how many call frames to go back before the
current one; the top frame is frame 0.
$END
#include <config.h>
#include <stdio.h>
#include "chartypes.h"
#include "bashtypes.h"
#if defined (HAVE_UNISTD_H)
# ifdef _MINIX
# include <sys/types.h>
# endif
# include <unistd.h>
#endif
#include <errno.h>
#include "../shell.h"
#include "common.h"
#include "builtext.h"
#ifdef LOADABLE_BUILTIN
# include "builtins.h"
#endif
#if !defined (errno)
extern int errno;
#endif /* !errno */
int
caller_builtin (list)
WORD_LIST *list;
{
#if !defined (ARRAY_VARS)
printf ("1 NULL\n");
return (EXECUTION_FAILURE);
#else
SHELL_VAR *funcname_v, *bash_source_v, *bash_lineno_v;
ARRAY *funcname_a, *bash_source_a, *bash_lineno_a;
char *funcname_s, *source_s, *lineno_s;
ARRAY_ELEMENT *ae;
intmax_t num;
GET_ARRAY_FROM_VAR ("FUNCNAME", funcname_v, funcname_a);
GET_ARRAY_FROM_VAR ("BASH_SOURCE", bash_source_v, bash_source_a);
GET_ARRAY_FROM_VAR ("BASH_LINENO", bash_lineno_v, bash_lineno_a);
if (bash_lineno_a == 0 || array_empty (bash_lineno_a))
return (EXECUTION_FAILURE);
if (bash_source_a == 0 || array_empty (bash_source_a))
return (EXECUTION_FAILURE);
/* If there is no argument list, then give short form: line filename. */
if (list == 0)
{
lineno_s = array_reference (bash_lineno_a, 0);
source_s = array_reference (bash_source_a, 1);
printf("%s %s\n", lineno_s ? lineno_s : "NULL", source_s ? source_s : "NULL");
return (EXECUTION_SUCCESS);
}
if (funcname_a == 0 || array_empty (funcname_a))
return (EXECUTION_FAILURE);
if (legal_number (list->word->word, &num))
{
lineno_s = array_reference (bash_lineno_a, num);
source_s = array_reference (bash_source_a, num+1);
funcname_s = array_reference (funcname_a, num+1);
if (lineno_s == NULL|| source_s == NULL || funcname_s == NULL)
return (EXECUTION_FAILURE);
printf("%s %s %s\n", lineno_s, funcname_s, source_s);
}
else
{
sh_invalidnum (list->word->word);
builtin_usage ();
return (EXECUTION_FAILURE);
}
return (EXECUTION_SUCCESS);
#endif
}
#ifdef LOADABLE_BUILTIN
static char *caller_doc[] = {
"Returns the context of the current subroutine call.",
"",
"Without EXPR, returns returns \"$line $filename\". With EXPR,",
"returns \"$line $subroutine $filename\"; this extra information",
"can be used used to provide a stack trace.",
"",
"The value of EXPR indicates how many call frames to go back before the",
"current one; the top frame is frame 0.",
(char *)NULL
};
struct builtin caller_struct = {
"caller",
caller_builtin,
BUILTIN_ENABLED,
caller_doc,
"caller [EXPR]",
0
};
#endif /* LOADABLE_BUILTIN */
+6
View File
@@ -199,7 +199,11 @@ cd_builtin (list)
builtin_error ("OLDPWD not set");
return (EXECUTION_FAILURE);
}
#if 0
lflag = interactive ? LCD_PRINTPATH : 0;
#else
lflag = LCD_PRINTPATH; /* According to SUSv3 */
#endif
}
else if (absolute_pathname (list->word->word))
dirname = list->word->word;
@@ -343,8 +347,10 @@ pwd_builtin (list)
if (ferror (stdout))
{
builtin_error ("write error: %s", strerror (errno));
clearerr (stdout);
return (EXECUTION_FAILURE);
}
return (EXECUTION_SUCCESS);
}
else
+16 -5
View File
@@ -244,7 +244,7 @@ sh_nojobs (s)
char *s;
{
if (s)
builtin_error ("%s: no job control");
builtin_error ("%s: no job control", s);
else
builtin_error ("no job control");
}
@@ -602,6 +602,9 @@ get_job_spec (list)
}
#endif /* JOB_CONTROL */
/*
* NOTE: `kill' calls this function with forcecols == 0
*/
int
display_signal_list (list, forcecols)
WORD_LIST *list;
@@ -609,8 +612,7 @@ display_signal_list (list, forcecols)
{
register int i, column;
char *name;
int result;
int signum;
int result, signum, dflags;
intmax_t lsignum;
result = EXECUTION_SUCCESS;
@@ -623,7 +625,13 @@ display_signal_list (list, forcecols)
continue;
if (posixly_correct && !forcecols)
printf ("%s%s", name, (i == NSIG - 1) ? "" : " ");
{
/* This is for the kill builtin. POSIX.2 says the signal names
are displayed without the `SIG' prefix. */
if (STREQN (name, "SIG", 3))
name += 3;
printf ("%s%s", name, (i == NSIG - 1) ? "" : " ");
}
else
{
printf ("%2d) %s", i, name);
@@ -677,7 +685,10 @@ display_signal_list (list, forcecols)
}
else
{
signum = decode_signal (list->word->word);
dflags = DSIG_NOCASE;
if (posixly_correct == 0 || this_shell_builtin != kill_builtin)
dflags |= DSIG_SIGPREFIX;
signum = decode_signal (list->word->word, dflags);
if (signum == NO_SIG)
{
sh_invalidsig (list->word->word);
+5 -1
View File
@@ -30,6 +30,7 @@
#define SEVAL_INTERACT 0x002
#define SEVAL_NOHIST 0x004
#define SEVAL_NOFREE 0x008
#define SEVAL_RESETLINE 0x010
/* Flags for describe_command, shared between type.def and command.def */
#define CDESC_ALL 0x001 /* type -a */
@@ -105,6 +106,9 @@ extern sh_builtin_func_t *builtin_address __P((char *));
extern sh_builtin_func_t *find_special_builtin __P((char *));
extern void initialize_shell_builtins __P((void));
/* Functions from exit.def */
extern void bash_logout __P((void));
/* Functions from getopts.def */
extern void getopts_reset __P((int));
@@ -150,7 +154,7 @@ extern void parse_and_execute_cleanup __P((void));
/* Functions from evalfile.c */
extern int maybe_execute_file __P((const char *, int));
extern int source_file __P((const char *));
extern int source_file __P((const char *, int));
extern int fc_execute_file __P((const char *));
#endif /* !__COMMON_H */
+15 -3
View File
@@ -47,6 +47,7 @@ $END
#include "../shell.h"
#include "../builtins.h"
#include "../pcomplete.h"
#include "../bashline.h"
#include "common.h"
#include "bashgetopt.h"
@@ -106,10 +107,12 @@ static struct _compopt {
char *optname;
int optflag;
} compopts[] = {
{ "bashdefault", COPT_BASHDEFAULT },
{ "default", COPT_DEFAULT },
{ "dirnames", COPT_DIRNAMES },
{ "filenames",COPT_FILENAMES},
{ "nospace", COPT_NOSPACE },
{ "plusdirs", COPT_PLUSDIRS },
{ (char *)NULL, 0 },
};
@@ -428,10 +431,12 @@ print_one_completion (cmd, cs)
copts = cs->options;
/* First, print the -o options. */
PRINTCOMPOPT (COPT_BASHDEFAULT, "bashdefault");
PRINTCOMPOPT (COPT_DEFAULT, "default");
PRINTCOMPOPT (COPT_DIRNAMES, "dirnames");
PRINTCOMPOPT (COPT_FILENAMES, "filenames");
PRINTCOMPOPT (COPT_NOSPACE, "nospace");
PRINTCOMPOPT (COPT_PLUSDIRS, "plusdirs");
acts = cs->actions;
@@ -540,7 +545,7 @@ compgen_builtin (list)
unsigned long acts, copts;
COMPSPEC *cs;
STRINGLIST *sl;
char *word;
char *word, **matches;
if (list == 0)
return (EXECUTION_SUCCESS);
@@ -583,12 +588,19 @@ compgen_builtin (list)
rval = EXECUTION_FAILURE;
sl = gen_compspec_completions (cs, "compgen", word, 0, 0);
/* If the compspec wants the bash default completions, temporarily
turn off programmable completion and call the bash completion code. */
if ((sl == 0 || sl->list_len == 0) && (copts & COPT_BASHDEFAULT))
{
matches = bash_default_completion (word, 0, 0, 0, 0);
sl = completions_to_stringlist (matches);
strvec_dispose (matches);
}
/* This isn't perfect, but it's the best we can do, given what readline
exports from its set of completion utility functions. */
if ((sl == 0 || sl->list_len == 0) && (copts & COPT_DEFAULT))
{
char **matches;
matches = rl_completion_matches (word, rl_filename_completion_function);
sl = completions_to_stringlist (matches);
strvec_dispose (matches);
+21 -6
View File
@@ -1,7 +1,7 @@
This file is declare.def, from which is created declare.c.
It implements the builtins "declare" and "local" in Bash.
Copyright (C) 1987-2002 Free Software Foundation, Inc.
Copyright (C) 1987-2003 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -23,7 +23,7 @@ $PRODUCES declare.c
$BUILTIN declare
$FUNCTION declare_builtin
$SHORT_DOC declare [-afFirtx] [-p] name[=value] ...
$SHORT_DOC declare [-afFirtx] [-p] [name[=value] ...]
Declare variables and/or give them attributes. If no NAMEs are
given, then display the values of variables instead. The -p option
will display the attributes and values of each NAME.
@@ -32,7 +32,8 @@ The flags are:
-a to make NAMEs arrays (if supported)
-f to select from among function names only
-F to display function names without definitions
-F to display function names (and line number and source file name if
debugging) without definitions
-i to make NAMEs have the `integer' attribute
-r to make NAMEs readonly
-t to make NAMEs have the `trace' attribute
@@ -120,6 +121,7 @@ declare_internal (list, local_var)
int flags_on, flags_off, *flags, any_failed, assign_error, pflag, nodefs, opt;
char *t, *subscript_start;
SHELL_VAR *var;
FUNCTION_DEF *shell_fn;
flags_on = flags_off = any_failed = assign_error = pflag = nodefs = 0;
reset_internal_getopt ();
@@ -309,9 +311,22 @@ declare_internal (list, local_var)
/* declare -[Ff] name [name...] */
if (flags_on == att_function && flags_off == 0)
{
t = nodefs ? var->name
: named_function_string (name, function_cell (var), 1);
printf ("%s\n", t);
#if defined (DEBUGGER)
if (nodefs && debugging_mode)
{
shell_fn = find_function_def (var->name);
if (shell_fn)
printf ("%s %d %s\n", var->name, shell_fn->line, shell_fn->source_file);
else
printf ("%s\n", var->name);
}
else
#endif /* DEBUGGER */
{
t = nodefs ? var->name
: named_function_string (name, function_cell (var), 1);
printf ("%s\n", t);
}
}
else /* declare -[fF] -[rx] name [name...] */
{
+63 -5
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 1996 Free Software Foundation, Inc.
/* Copyright (C) 1996-2003 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -58,6 +58,7 @@ extern int errno;
#define FEVAL_HISTORY 0x020
#define FEVAL_CHECKBINARY 0x040
#define FEVAL_REGFILE 0x080
#define FEVAL_NOPUSHARGS 0x100
extern int posixly_correct;
extern int indirection_level, startup_state, subshell_environment;
@@ -79,9 +80,28 @@ _evalfile (filename, flags)
struct stat finfo;
size_t file_size;
sh_vmsg_func_t *errfunc;
#if defined (ARRAY_VARS)
SHELL_VAR *funcname_v, *bash_source_v, *bash_lineno_v;
ARRAY *funcname_a, *bash_source_a, *bash_lineno_a;
# if defined (DEBUGGER)
SHELL_VAR *bash_argv_v, *bash_argc_v;
ARRAY *bash_argv_a, *bash_argc_a;
# endif
char *t, tt[2];
#endif
USE_VAR(pflags);
#if defined (ARRAY_VARS)
GET_ARRAY_FROM_VAR ("FUNCNAME", funcname_v, funcname_a);
GET_ARRAY_FROM_VAR ("BASH_SOURCE", bash_source_v, bash_source_a);
GET_ARRAY_FROM_VAR ("BASH_LINENO", bash_lineno_v, bash_lineno_a);
# if defined (DEBUGGER)
GET_ARRAY_FROM_VAR ("BASH_ARGV", bash_argv_v, bash_argv_a);
GET_ARRAY_FROM_VAR ("BASH_ARGC", bash_argc_v, bash_argc_a);
# endif
#endif
fd = open (filename, O_RDONLY);
if (fd < 0 || (fstat (fd, &finfo) == -1))
@@ -176,8 +196,27 @@ file_error_and_exit:
return_catch_flag++;
sourcelevel++;
#if defined (ARRAY_VARS)
array_push (bash_source_a, (char *)filename);
t = itos (executing_line_number ());
array_push (bash_lineno_a, t);
free (t);
array_push (funcname_a, "source"); /* not exactly right */
# if defined (DEBUGGER)
/* Have to figure out a better way to do this when `source' is supplied
arguments */
if ((flags & FEVAL_NOPUSHARGS) == 0)
{
array_push (bash_argv_a, (char *)filename);
tt[0] = '1'; tt[1] = '\0';
array_push (bash_argc_a, tt);
}
# endif
#endif
/* set the flags to be passed to parse_and_execute */
pflags = (flags & FEVAL_HISTORY) ? 0 : SEVAL_NOHIST;
pflags = SEVAL_RESETLINE;
pflags |= (flags & FEVAL_HISTORY) ? 0 : SEVAL_NOHIST;
if (flags & FEVAL_BUILTIN)
result = EXECUTION_SUCCESS;
@@ -205,6 +244,19 @@ file_error_and_exit:
COPY_PROCENV (old_return_catch, return_catch);
}
#if defined (ARRAY_VARS)
array_pop (bash_source_a);
array_pop (bash_lineno_a);
array_pop (funcname_a);
# if defined (DEBUGGER)
if ((flags & FEVAL_NOPUSHARGS) == 0)
{
array_pop (bash_argc_a);
array_pop (bash_argv_a);
}
# endif
#endif
return ((flags & FEVAL_BUILTIN) ? result : 1);
}
@@ -240,14 +292,20 @@ fc_execute_file (filename)
#endif /* HISTORY */
int
source_file (filename)
source_file (filename, sflags)
const char *filename;
int sflags;
{
int flags;
int flags, rval;
flags = FEVAL_BUILTIN|FEVAL_UNWINDPROT|FEVAL_NONINT;
if (sflags)
flags |= FEVAL_NOPUSHARGS;
/* POSIX shells exit if non-interactive and file error. */
if (posixly_correct && !interactive_shell)
flags |= FEVAL_LONGJMP;
return (_evalfile (filename, flags));
rval = _evalfile (filename, flags);
run_return_trap ();
return rval;
}
+20 -5
View File
@@ -84,6 +84,7 @@ parse_and_execute_cleanup ()
(flags & SEVAL_INTERACT) -> interactive = 1;
(flags & SEVAL_NOHIST) -> call bash_history_disable ()
(flags & SEVAL_NOFREE) -> don't free STRING when finished
(flags & SEVAL_RESETLINE) -> reset line_number to 1
*/
int
@@ -92,7 +93,7 @@ parse_and_execute (string, from_file, flags)
const char *from_file;
int flags;
{
int code, x;
int code, x, lreset;
volatile int should_jump_to_top_level, last_result;
char *orig_string;
COMMAND *volatile command;
@@ -107,6 +108,8 @@ parse_and_execute (string, from_file, flags)
if (flags & (SEVAL_NONINT|SEVAL_INTERACT))
unwind_protect_int (interactive);
lreset = flags & SEVAL_RESETLINE;
#if defined (HISTORY)
unwind_protect_int (remember_on_history); /* can be used in scripts */
# if defined (BANG_HISTORY)
@@ -129,7 +132,15 @@ parse_and_execute (string, from_file, flags)
end_unwind_frame ();
parse_and_execute_level++;
push_stream (1); /* reset the line number */
/* Reset the line number if the caller wants us to. If we don't reset the
line number, we have to subtract one, because we will add one just
before executing the next command (resetting the line number sets it to
0; the first line number is 1). */
push_stream (lreset);
if (lreset == 0)
line_number--;
indirection_level++;
if (flags & (SEVAL_NONINT|SEVAL_INTERACT))
interactive = (flags & SEVAL_NONINT) ? 0 : 1;
@@ -141,11 +152,12 @@ parse_and_execute (string, from_file, flags)
code = should_jump_to_top_level = 0;
last_result = EXECUTION_SUCCESS;
command = (COMMAND *)NULL;
with_input_from_string (string, from_file);
while (*(bash_input.location.string))
{
command = (COMMAND *)NULL;
if (interrupt_state)
{
last_result = EXECUTION_FAILURE;
@@ -163,15 +175,18 @@ parse_and_execute (string, from_file, flags)
switch (code)
{
case FORCE_EOF:
case ERREXIT:
case EXITPROG:
run_unwind_frame ("pe_dispose");
if (command)
run_unwind_frame ("pe_dispose");
/* Remember to call longjmp (top_level) after the old
value for it is restored. */
should_jump_to_top_level = 1;
goto out;
case DISCARD:
run_unwind_frame ("pe_dispose");
if (command)
run_unwind_frame ("pe_dispose");
last_result = last_command_exit_value = EXECUTION_FAILURE; /* XXX */
if (subshell_environment)
{
+1 -2
View File
@@ -208,8 +208,7 @@ exec_builtin (list)
file_error (command);
failed_exec:
if (command)
free (command);
FREE (command);
if (subshell_environment || (interactive == 0 && no_exit_on_failed_exec == 0))
exit_shell (exit_value);
+12 -6
View File
@@ -122,6 +122,18 @@ exit_or_logout (list)
exit_value = get_exitstat (list);
bash_logout ();
last_command_exit_value = exit_value;
/* Exit the program. */
jump_to_top_level (EXITPROG);
/*NOTREACHED*/
}
void
bash_logout ()
{
/* Run our `~/.bash_logout' file if it exists, and this is a login shell. */
if (login_shell && sourced_logout++ == 0 && subshell_environment == 0)
{
@@ -130,10 +142,4 @@ exit_or_logout (list)
maybe_execute_file (SYS_BASH_LOGOUT, 1);
#endif
}
last_command_exit_value = exit_value;
/* Exit the program. */
jump_to_top_level (EXITPROG);
/*NOTREACHED*/
}
+1 -1
View File
@@ -54,7 +54,7 @@ $END
#endif
#include "../bashtypes.h"
#include "posixstat.h"
#ifndef _MINIX
#if ! defined(_MINIX) && defined (HAVE_SYS_FILE_H)
# include <sys/file.h>
#endif
+1 -1
View File
@@ -44,7 +44,7 @@ seen, getopts places the option character found into OPTARG. If a
required argument is not found, getopts places a ':' into NAME and
sets OPTARG to the option character found. If getopts is not in
silent mode, and an invalid option is seen, getopts places '?' into
NAME and unsets OPTARG. If a required option is not found, a '?'
NAME and unsets OPTARG. If a required argument is not found, a '?'
is placed in NAME, OPTARG is unset, and a diagnostic message is
printed.
+56 -12
View File
@@ -34,20 +34,25 @@ current history to the history file; `-r' means to read the file and
append the contents to the history list instead. `-a' means
to append history lines from this session to the history file.
Argument `-n' means to read all history lines not already read
from the history file and append them to the history list. If
FILENAME is given, then that is used as the history file else
from the history file and append them to the history list.
If FILENAME is given, then that is used as the history file else
if $HISTFILE has a value, that is used, else ~/.bash_history.
If the -s option is supplied, the non-option ARGs are appended to
the history list as a single entry. The -p option means to perform
history expansion on each ARG and display the result, without storing
anything in the history list.
If the $HISTTIMEFORMAT variable is set and not null, its value is used
as a format string for strftime(3) to print the time stamp associated
with each displayed history entry. No time stamps are printed otherwise.
$END
#include <config.h>
#if defined (HISTORY)
#include "../bashtypes.h"
#ifndef _MINIX
#if ! defined(_MINIX) && defined (HAVE_SYS_FILE_H)
# include <sys/file.h>
#endif
#include "posixstat.h"
@@ -72,6 +77,7 @@ extern int errno;
extern int current_command_line_count;
static char *histtime __P((HIST_ENTRY *, const char *));
static void display_history __P((WORD_LIST *));
static int delete_histent __P((int));
static int delete_last_history __P((void));
@@ -91,7 +97,7 @@ int
history_builtin (list)
WORD_LIST *list;
{
int flags, opt, result, old_history_lines;
int flags, opt, result, old_history_lines, obase;
char *filename, *delete_arg;
intmax_t delete_offset;
@@ -200,11 +206,23 @@ history_builtin (list)
{
/* Read all of the lines in the file that we haven't already read. */
old_history_lines = history_lines_in_file;
obase = history_base;
using_history ();
result = read_history_range (filename, history_lines_in_file, -1);
using_history ();
history_lines_in_file = where_history ();
history_lines_this_session += history_lines_in_file - old_history_lines;
/* The question is whether we reset history_lines_this_session to 0,
losing any history entries we had before we read the new entries
from the history file, or whether we count the new entries we just
read from the file as history lines added during this session.
Right now, we do the latter. This will cause these history entries
to be written to the history file along with any intermediate entries
we add when we do a `history -a', but the alternative is losing
them altogether. */
history_lines_this_session += history_lines_in_file - old_history_lines +
history_base - obase;
}
return (result ? EXECUTION_FAILURE : EXECUTION_SUCCESS);
@@ -214,6 +232,22 @@ history_builtin (list)
#define histline(i) (hlist[(i)]->line)
#define histdata(i) (hlist[(i)]->data)
static char *
histtime (hlist, histtimefmt)
HIST_ENTRY *hlist;
const char *histtimefmt;
{
static char timestr[128];
time_t t;
t = history_get_time (hlist);
if (t)
strftime (timestr, sizeof (timestr), histtimefmt, localtime (&t));
else
strcpy (timestr, "??");
return timestr;
}
static void
display_history (list)
WORD_LIST *list;
@@ -221,6 +255,7 @@ display_history (list)
register int i;
intmax_t limit;
HIST_ENTRY **hlist;
char *histtimefmt, *timestr;
if (list)
{
@@ -243,11 +278,17 @@ display_history (list)
else
i = 0;
histtimefmt = get_string_value ("HISTTIMEFORMAT");
while (hlist[i])
{
QUIT;
printf ("%5d%c %s\n", i + history_base,
timestr = (histtimefmt && *histtimefmt) ? histtime (hlist[i], histtimefmt) : (char *)NULL;
printf ("%5d%c %s%s\n", i + history_base,
histdata(i) ? '*' : ' ',
((timestr && *timestr) ? timestr : ""),
histline(i));
i++;
}
@@ -263,11 +304,8 @@ delete_histent (i)
discard = remove_history (i);
if (discard)
{
if (discard->line)
free (discard->line);
free ((char *) discard);
}
free_history_entry (discard);
return 1;
}
@@ -276,6 +314,7 @@ delete_last_history ()
{
register int i;
HIST_ENTRY **hlist, *histent;
int r;
hlist = history_list ();
if (hlist == NULL)
@@ -290,7 +329,12 @@ delete_last_history ()
if (histent == NULL)
return 0;
return (delete_histent (i));
r = delete_histent (i);
if (where_history () > history_length)
history_set_pos (history_length);
return r;
}
/* Remove the last entry in the history list and add each argument in
+10 -12
View File
@@ -163,6 +163,7 @@ execute_list_with_replacements (list)
{
register WORD_LIST *l;
int job, result;
COMMAND *command;
/* First do the replacement of job specifications with pids. */
for (l = list; l; l = l->next)
@@ -182,21 +183,18 @@ execute_list_with_replacements (list)
/* Next make a new simple command and execute it. */
begin_unwind_frame ("jobs_builtin");
{
COMMAND *command = (COMMAND *)NULL;
add_unwind_protect (dispose_command, command);
command = make_bare_simple_command ();
command->value.Simple->words = copy_word_list (list);
command->value.Simple->redirects = (REDIRECT *)NULL;
command->flags |= CMD_INHIBIT_EXPANSION;
command->value.Simple->flags |= CMD_INHIBIT_EXPANSION;
command = make_bare_simple_command ();
command->value.Simple->words = copy_word_list (list);
command->value.Simple->redirects = (REDIRECT *)NULL;
command->flags |= CMD_INHIBIT_EXPANSION;
command->value.Simple->flags |= CMD_INHIBIT_EXPANSION;
add_unwind_protect (dispose_command, command);
result = execute_command (command);
dispose_command (command);
result = execute_command (command);
}
run_unwind_frame ("jobs_builtin");
discard_unwind_frame ("jobs_builtin");
return (result);
}
#endif /* JOB_CONTROL */
+31 -11
View File
@@ -1,7 +1,7 @@
This file is kill.def, from which is created kill.c.
It implements the builtin "kill" in Bash.
Copyright (C) 1987-2002 Free Software Foundation, Inc.
Copyright (C) 1987-2003 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -23,7 +23,6 @@ $PRODUCES kill.c
$BUILTIN kill
$FUNCTION kill_builtin
$DEPENDS_ON JOB_CONTROL
$SHORT_DOC kill [-s sigspec | -n signum | -sigspec] [pid | job]... or kill -l [sigspec]
Send the processes named by PID (or JOB) the signal SIGSPEC. If
SIGSPEC is not present, then SIGTERM is assumed. An argument of `-l'
@@ -57,9 +56,10 @@ $END
extern int errno;
#endif /* !errno */
#if defined (JOB_CONTROL)
extern int posixly_correct;
static void kill_error __P((pid_t, int));
#if !defined (CONTINUE_AFTER_KILL_ERROR)
# define CONTINUE_OR_FAIL return (EXECUTION_FAILURE)
#else
@@ -73,7 +73,7 @@ int
kill_builtin (list)
WORD_LIST *list;
{
int sig, any_succeeded, listing, saw_signal;
int sig, any_succeeded, listing, saw_signal, dflags;
char *sigspec, *word;
pid_t pid;
intmax_t pid_value;
@@ -88,6 +88,7 @@ kill_builtin (list)
sig = SIGTERM;
sigspec = "TERM";
dflags = DSIG_NOCASE | ((posixly_correct == 0) ? DSIG_SIGPREFIX : 0);
/* Process options. */
while (list)
{
@@ -107,7 +108,7 @@ kill_builtin (list)
if (sigspec[0] == '0' && sigspec[1] == '\0')
sig = 0;
else
sig = decode_signal (sigspec);
sig = decode_signal (sigspec, dflags);
list = list->next;
}
else
@@ -132,7 +133,7 @@ kill_builtin (list)
else if ((*word == '-') && !saw_signal)
{
sigspec = word + 1;
sig = decode_signal (sigspec);
sig = decode_signal (sigspec, dflags);
saw_signal++;
list = list->next;
}
@@ -169,13 +170,20 @@ kill_builtin (list)
pid = (pid_t) pid_value;
if ((pid < -1 ? kill_pid (-pid, sig, 1) : kill_pid (pid, sig, 0)) < 0)
goto signal_error;
{
if (errno == EINVAL)
sh_invalidsig (sigspec);
else
kill_error (pid, errno);
CONTINUE_OR_FAIL;
}
else
any_succeeded++;
}
#if defined (JOB_CONTROL)
else if (*list->word->word && *list->word->word != '%')
{
builtin_error ("%s: no such pid", list->word->word);
builtin_error ("%s: arguments must be process or job IDs", list->word->word);
CONTINUE_OR_FAIL;
}
else if (*word && (interactive || job_control))
@@ -205,16 +213,16 @@ kill_builtin (list)
if (kill_pid (pid, sig, 1) < 0)
{
signal_error:
if (errno == EINVAL)
sh_invalidsig (sigspec);
else
builtin_error ("(%ld) - %s", (long)pid, strerror (errno));
kill_error (pid, errno);
CONTINUE_OR_FAIL;
}
else
any_succeeded++;
}
#endif /* !JOB_CONTROL */
else
{
sh_badpid (list->word->word);
@@ -226,4 +234,16 @@ kill_builtin (list)
return (any_succeeded ? EXECUTION_SUCCESS : EXECUTION_FAILURE);
}
#endif /* JOB_CONTROL */
static void
kill_error (pid, e)
pid_t pid;
int e;
{
char *x;
x = strerror (e);
if (x == 0)
x = "Unknown error";
builtin_error ("(%ld) - %s", (long)pid, x);
}
+1 -1
View File
@@ -45,7 +45,7 @@ The levels are listed in order of decreasing precedence.
&& logical AND
|| logical OR
expr ? expr : expr
conditional expression
conditional operator
=, *=, /=, %=,
+=, -=, <<=, >>=,
&=, ^=, |= assignment
+4 -2
View File
@@ -29,8 +29,10 @@ Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#endif
#ifndef _MINIX
#include "../bashtypes.h"
#include <sys/file.h>
# include "../bashtypes.h"
# if defined (HAVE_SYS_FILE_H)
# include <sys/file.h>
# endif
#endif
#include "posixstat.h"
+1 -1
View File
@@ -114,7 +114,7 @@ static int getint __P((void));
static intmax_t getintmax __P((void));
static uintmax_t getuintmax __P((void));
#if defined (HAVE_LONG_DOUBLE) && HAVE_DECL_STRTOLD
#if defined (HAVE_LONG_DOUBLE) && HAVE_DECL_STRTOLD && !defined(STRTOLD_BROKEN)
typedef long double floatmax_t;
# define FLOATMAX_CONV "L"
# define strtofltmax strtold
+1
View File
@@ -505,6 +505,7 @@ read_builtin (list)
alist = list_string (input_string, ifs_chars, 0);
if (alist)
{
word_list_remove_quoted_nulls (alist);
assign_array_var_from_word_list (var, alist);
dispose_words (alist);
}
+10
View File
@@ -77,6 +77,8 @@ $SHORT_DOC set [--abefhkmnptuvxBCHP] [-o option] [arg ...]
emacs use an emacs-style line editing interface
#endif /* READLINE */
errexit same as -e
errtrace same as -E
functrace same as -T
hashall same as -h
#if defined (BANG_HISTORY)
histexpand same as -H
@@ -97,6 +99,9 @@ $SHORT_DOC set [--abefhkmnptuvxBCHP] [-o option] [arg ...]
nounset same as -u
onecmd same as -t
physical same as -P
pipefail the return value of a pipeline is the status of
the last command to exit with a non-zero status,
or zero if no command exited with a non-zero status
posix change the behavior of bash where the default
operation differs from the 1003.2 standard to
match the standard
@@ -119,12 +124,14 @@ $SHORT_DOC set [--abefhkmnptuvxBCHP] [-o option] [arg ...]
#endif /* BRACE_EXPANSION */
-C If set, disallow existing regular files to be overwritten
by redirection of output.
-E If set, the ERR trap is inherited by shell functions.
#if defined (BANG_HISTORY)
-H Enable ! style history substitution. This flag is on
by default.
#endif /* BANG_HISTORY */
-P If set, do not follow symbolic links when executing commands
such as cd which change the current directory.
-T If set, the DEBUG trap is inherited by shell functions.
Using + rather than - causes these flags to be turned off. The
flags can also be used upon invocation of the shell. The current
@@ -172,6 +179,8 @@ struct {
{ "emacs", '\0', (int *)NULL, set_edit_mode, get_edit_mode },
#endif
{ "errexit", 'e', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
{ "errtrace", 'E', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
{ "functrace", 'T', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
{ "hashall", 'h', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
#if defined (BANG_HISTORY)
{ "histexpand", 'H', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
@@ -195,6 +204,7 @@ struct {
{ "nounset", 'u', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
{ "onecmd", 't', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
{ "physical", 'P', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
{ "pipefail", '\0', &pipefail_opt, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
{ "posix", '\0', &posixly_correct, set_posix_mode, (setopt_get_func_t *)NULL },
{ "privileged", 'p', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
{ "verbose", 'v', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
+3 -4
View File
@@ -75,13 +75,12 @@ export_builtin (list)
$BUILTIN readonly
$FUNCTION readonly_builtin
$SHORT_DOC readonly [-anf] [name[=value] ...] or readonly -p
$SHORT_DOC readonly [-af] [name[=value] ...] or readonly -p
The given NAMEs are marked readonly and the values of these NAMEs may
not be changed by subsequent assignment. If the -f option is given,
then functions corresponding to the NAMEs are so marked. If no
arguments are given, or if `-p' is given, a list of all readonly names
is printed. An argument of `-n' says to remove the readonly property
from subsequent NAMEs. The `-a' option means to treat each NAME as
is printed. The `-a' option means to treat each NAME as
an array variable. An argument of `--' disables further option
processing.
$END
@@ -103,7 +102,7 @@ readonly_builtin (list)
/* For each variable name in LIST, make that variable have the specified
ATTRIBUTE. An arg of `-n' says to remove the attribute from the the
remaining names in LIST. */
remaining names in LIST (doesn't work for readonly). */
int
set_or_show_attributes (list, attribute, nodefs)
register WORD_LIST *list;
+1 -1
View File
@@ -68,7 +68,7 @@ shift_builtin (list)
else if (times > number_of_args ())
{
if (print_shift_error)
sh_erange (list->word->word, "shift count");
sh_erange (list ? list->word->word : NULL, "shift count");
return (EXECUTION_FAILURE);
}
+18 -4
View File
@@ -55,15 +55,17 @@ $END
#define OPTFMT "%-15s\t%s\n"
extern int allow_null_glob_expansion, glob_dot_filenames;
extern int allow_null_glob_expansion, fail_glob_expansion, glob_dot_filenames;
extern int cdable_vars, mail_warning, source_uses_path;
extern int no_exit_on_failed_exec, print_shift_error;
extern int check_hashed_filenames, promptvars;
extern int cdspelling, expand_aliases;
extern int extended_quote;
extern int check_window_size;
extern int glob_ignore_case;
extern int hup_on_exit;
extern int xpg_echo;
extern int gnu_error_format;
#if defined (EXTENDED_GLOB)
extern int extended_glob;
@@ -77,6 +79,7 @@ extern int force_append_history;
#if defined (READLINE)
extern int hist_verify, history_reediting, perform_hostname_completion;
extern int no_empty_command_completion;
extern int force_fignore;
extern int enable_hostname_completion __P((int));
#endif
@@ -88,9 +91,13 @@ extern int prog_completion_enabled;
extern char *shell_name;
#endif
#if defined (DEBUGGER)
extern int debugging_mode;
#endif
static void shopt_error __P((char *));
static int set_interactive_comments __P((int));
static int set_shellopts_after_change __P((int));
#if defined (RESTRICTED_SHELL)
static int set_restricted_shell __P((int));
@@ -115,10 +122,17 @@ static struct {
{ "dotglob", &glob_dot_filenames, (shopt_set_func_t *)NULL },
{ "execfail", &no_exit_on_failed_exec, (shopt_set_func_t *)NULL },
{ "expand_aliases", &expand_aliases, (shopt_set_func_t *)NULL },
#if defined (DEBUGGER)
{ "extdebug", &debugging_mode, (shopt_set_func_t *)NULL },
#endif
#if defined (EXTENDED_GLOB)
{ "extglob", &extended_glob, (shopt_set_func_t *)NULL },
#endif
{ "extquote", &extended_quote, (shopt_set_func_t *)NULL },
{ "failglob", &fail_glob_expansion, (shopt_set_func_t *)NULL },
#if defined (READLINE)
{ "force_fignore", &force_fignore, (shopt_set_func_t *)NULL },
{ "gnu_errfmt", &gnu_error_format, (shopt_set_func_t *)NULL },
{ "histreedit", &history_reediting, (shopt_set_func_t *)NULL },
#endif
#if defined (HISTORY)
@@ -129,7 +143,7 @@ static struct {
{ "hostcomplete", &perform_hostname_completion, enable_hostname_completion },
#endif
{ "huponexit", &hup_on_exit, (shopt_set_func_t *)NULL },
{ "interactive_comments", &interactive_comments, set_interactive_comments },
{ "interactive_comments", &interactive_comments, set_shellopts_after_change },
#if defined (HISTORY)
{ "lithist", &literal_history, (shopt_set_func_t *)NULL },
#endif
@@ -435,7 +449,7 @@ set_shopt_o_options (mode, list, quiet)
/* If we set or unset interactive_comments with shopt, make sure the
change is reflected in $SHELLOPTS. */
static int
set_interactive_comments (mode)
set_shellopts_after_change (mode)
int mode;
{
set_shellopts ();
+27 -7
View File
@@ -23,16 +23,20 @@ $PRODUCES source.c
$BUILTIN source
$FUNCTION source_builtin
$SHORT_DOC source filename
$SHORT_DOC source filename [arguments]
Read and execute commands from FILENAME and return. The pathnames
in $PATH are used to find the directory containing FILENAME.
in $PATH are used to find the directory containing FILENAME. If any
ARGUMENTS are supplied, they become the positional parameters when
FILENAME is executed.
$END
$BUILTIN .
$DOCNAME dot
$FUNCTION source_builtin
$SHORT_DOC . filename
$SHORT_DOC . filename [arguments]
Read and execute commands from FILENAME and return. The pathnames
in $PATH are used to find the directory containing FILENAME.
in $PATH are used to find the directory containing FILENAME. If any
ARGUMENTS are supplied, they become the positional parameters when
FILENAME is executed.
$END
/* source.c - Implements the `.' and `source' builtins. */
@@ -41,7 +45,7 @@ $END
#include "../bashtypes.h"
#include "posixstat.h"
#include "filecntl.h"
#ifndef _MINIX
#if ! defined(_MINIX) && defined (HAVE_SYS_FILE_H)
# include <sys/file.h>
#endif
#include <errno.h>
@@ -53,9 +57,11 @@ $END
#include "../bashansi.h"
#include "../shell.h"
#include "../flags.h"
#include "../findcmd.h"
#include "common.h"
#include "bashgetopt.h"
#include "../trap.h"
#if !defined (errno)
extern int errno;
@@ -85,6 +91,7 @@ maybe_pop_dollar_vars ()
dispose_saved_dollar_vars ();
else
pop_dollar_vars ();
pop_args (); /* restore BASH_ARGC and BASH_ARGV */
set_dollar_vars_unchanged ();
}
@@ -97,7 +104,7 @@ source_builtin (list)
WORD_LIST *list;
{
int result;
char *filename;
char *filename, *debug_trap;
if (no_options (list))
return (EX_USAGE);
@@ -140,10 +147,23 @@ source_builtin (list)
push_dollar_vars ();
add_unwind_protect ((Function *)maybe_pop_dollar_vars, (char *)NULL);
remember_args (list->next, 1);
push_args (list->next); /* Update BASH_ARGV and BASH_ARGC */
}
set_dollar_vars_unchanged ();
result = source_file (filename);
/* Don't inherit the DEBUG trap unless function_trace_mode (overloaded)
is set. XXX - should sourced files inherit the RETURN trap? Functions
don't. */
debug_trap = TRAP_STRING (DEBUG_TRAP);
if (debug_trap && function_trace_mode == 0)
{
debug_trap = savestring (debug_trap);
add_unwind_protect (xfree, debug_trap);
add_unwind_protect (set_debug_trap, debug_trap);
restore_default_signal (DEBUG_TRAP);
}
result = source_file (filename, (list && list->next));
run_unwind_frame ("source");
+3
View File
@@ -104,6 +104,9 @@ suspend_builtin (list)
}
}
/* XXX - should we put ourselves back into the original pgrp now? If so,
call end_job_control() here and do the right thing in suspend_continue
(that is, call restart_job_control()). */
old_cont = (SigHandler *)set_signal_handler (SIGCONT, suspend_continue);
#if 0
old_stop = (SigHandler *)set_signal_handler (SIGSTOP, SIG_DFL);
+10 -4
View File
@@ -108,6 +108,8 @@ trap_builtin (list)
}
list = loptend;
opt = DSIG_NOCASE|DSIG_SIGPREFIX; /* flags for decode_signal */
if (list_signal_names)
return (display_signal_list ((WORD_LIST *)NULL, 1));
else if (display || list == 0)
@@ -119,8 +121,12 @@ trap_builtin (list)
operation = SET;
first_arg = list->word->word;
if (first_arg && *first_arg && (*first_arg != '-' || first_arg[1]) &&
signal_object_p (first_arg))
/* When not in posix mode, the historical behavior of looking for a
missing first argument is disabled. To revert to the original
signal handling disposition, use `-' as the first argument. */
if (posixly_correct == 0 && first_arg && *first_arg &&
(*first_arg != '-' || first_arg[1]) &&
signal_object_p (first_arg, opt))
operation = REVERT;
else
{
@@ -133,7 +139,7 @@ trap_builtin (list)
while (list)
{
sig = decode_signal (list->word->word);
sig = decode_signal (list->word->word, opt);
if (sig == NO_SIG)
{
@@ -235,7 +241,7 @@ display_traps (list)
for (result = EXECUTION_SUCCESS; list; list = list->next)
{
i = decode_signal (list->word->word);
i = decode_signal (list->word->word, DSIG_NOCASE|DSIG_SIGPREFIX);
if (i == NO_SIG)
{
sh_invalidsig (list->word->word);
+2 -1
View File
@@ -73,6 +73,7 @@ $END
extern int find_reserved_word __P((char *));
extern char *this_command_name;
extern int expand_aliases;
/* For each word in LIST, find out what the shell is going to do with
it as a simple command. i.e., which file would this shell use to
@@ -221,7 +222,7 @@ describe_command (command, dflags)
#if defined (ALIAS)
/* Command is an alias? */
if (((dflags & CDESC_FORCE_PATH) == 0) && (alias = find_alias (command)))
if (((dflags & CDESC_FORCE_PATH) == 0) && expand_aliases && (alias = find_alias (command)))
{
if (dflags & CDESC_TYPE)
puts ("alias");
+1 -1
View File
@@ -37,7 +37,7 @@ $END
#include "../bashtypes.h"
#include "filecntl.h"
#ifndef _MINIX
#if ! defined(_MINIX) && defined (HAVE_SYS_FILE_H)
# include <sys/file.h>
#endif
+21 -11
View File
@@ -67,14 +67,17 @@ enum command_type { cm_for, cm_case, cm_while, cm_if, cm_simple, cm_select,
cm_arith, cm_cond, cm_arith_for, cm_subshell };
/* Possible values for the `flags' field of a WORD_DESC. */
#define W_HASDOLLAR 0x01 /* Dollar sign present. */
#define W_QUOTED 0x02 /* Some form of quote character is present. */
#define W_ASSIGNMENT 0x04 /* This word is a variable assignment. */
#define W_GLOBEXP 0x08 /* This word is the result of a glob expansion. */
#define W_NOSPLIT 0x10 /* Do not perform word splitting on this word. */
#define W_NOGLOB 0x20 /* Do not perform globbing on this word. */
#define W_NOSPLIT2 0x40 /* Don't split word except for $@ expansion. */
#define W_TILDEEXP 0x80 /* Tilde expand this assignment word */
#define W_HASDOLLAR 0x0001 /* Dollar sign present. */
#define W_QUOTED 0x0002 /* Some form of quote character is present. */
#define W_ASSIGNMENT 0x0004 /* This word is a variable assignment. */
#define W_GLOBEXP 0x0008 /* This word is the result of a glob expansion. */
#define W_NOSPLIT 0x0010 /* Do not perform word splitting on this word. */
#define W_NOGLOB 0x0020 /* Do not perform globbing on this word. */
#define W_NOSPLIT2 0x0040 /* Don't split word except for $@ expansion. */
#define W_TILDEEXP 0x0080 /* Tilde expand this assignment word */
#define W_DOLLARAT 0x0100 /* $@ and its special handling */
#define W_DOLLARSTAR 0x0200 /* $* and its special handling */
#define W_NOCOMSUB 0x0400 /* Don't perform command substitution on this word */
/* Possible values for subshell_environment */
#define SUBSHELL_ASYNC 0x01 /* subshell caused by `command &' */
@@ -195,6 +198,7 @@ typedef struct pattern_list {
/* The CASE command. */
typedef struct case_com {
int flags; /* See description of CMD flags. */
int line; /* line number the `case' keyword appears on */
WORD_DESC *word; /* The thing to test. */
PATTERN_LIST *clauses; /* The clauses to test against, or NULL. */
} CASE_COM;
@@ -202,6 +206,7 @@ typedef struct case_com {
/* FOR command. */
typedef struct for_com {
int flags; /* See description of CMD flags. */
int line; /* line number the `for' keyword appears on */
WORD_DESC *name; /* The variable name to get mapped over. */
WORD_LIST *map_list; /* The things to map over. This is never NULL. */
COMMAND *action; /* The action to execute.
@@ -224,6 +229,7 @@ typedef struct arith_for_com {
/* KSH SELECT command. */
typedef struct select_com {
int flags; /* See description of CMD flags. */
int line; /* line number the `select' keyword appears on */
WORD_DESC *name; /* The variable name to get mapped over. */
WORD_LIST *map_list; /* The things to map over. This is never NULL. */
COMMAND *action; /* The action to execute.
@@ -253,8 +259,8 @@ typedef struct while_com {
time being. */
typedef struct arith_com {
int flags;
WORD_LIST *exp;
int line;
WORD_LIST *exp;
} ARITH_COM;
#endif /* DPAREN_ARITHMETIC */
@@ -278,18 +284,19 @@ typedef struct cond_com {
/* The "simple" command. Just a collection of words and redirects. */
typedef struct simple_com {
int flags; /* See description of CMD flags. */
int line; /* line number the command starts on */
WORD_LIST *words; /* The program name, the arguments,
variable assignments, etc. */
REDIRECT *redirects; /* Redirections to perform. */
int line; /* line number the command starts on */
} SIMPLE_COM;
/* The "function definition" command. */
typedef struct function_def {
int flags; /* See description of CMD flags. */
int line; /* Line number the function def starts on. */
WORD_DESC *name; /* The name of the function. */
COMMAND *command; /* The parsed execution tree. */
int line; /* Line number the function def starts on. */
char *source_file; /* file in which function was defined, if any */
} FUNCTION_DEF;
/* A command that is `grouped' allows pipes and redirections to affect all
@@ -316,6 +323,9 @@ extern COMMAND *global_command;
/* Forward declarations of functions declared in copy_cmd.c. */
extern FUNCTION_DEF *copy_function_def_contents __P((FUNCTION_DEF *, FUNCTION_DEF *));
extern FUNCTION_DEF *copy_function_def __P((FUNCTION_DEF *));
extern WORD_DESC *copy_word __P((WORD_DESC *));
extern WORD_LIST *copy_word_list __P((WORD_LIST *));
extern REDIRECT *copy_redirect __P((REDIRECT *));
+73 -31
View File
@@ -19,11 +19,51 @@
with Bash; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
/*********************************************************/
/* Modify or set defines based on the configure results. */
/*********************************************************/
#if !defined (HAVE_VPRINTF) && defined (HAVE_DOPRNT)
# define USE_VFPRINTF_EMULATION
# define HAVE_VPRINTF
#endif
#if defined (HAVE_SYS_RESOURCE_H) && defined (HAVE_GETRLIMIT)
# define HAVE_RESOURCE
#endif
#if !defined (GETPGRP_VOID)
# define HAVE_BSD_PGRP
#endif
/* Try this without testing __STDC__ for the time being. */
#if defined (HAVE_STDARG_H)
# define PREFER_STDARG
# define USE_VARARGS
#else
# if defined (HAVE_VARARGS_H)
# define PREFER_VARARGS
# define USE_VARARGS
# endif
#endif
#if defined (HAVE_SYS_SOCKET_H) && defined (HAVE_GETPEERNAME) && defined (HAVE_NETINET_IN_H)
# define HAVE_NETWORK
#endif
#if defined (HAVE_REGEX_H) && defined (HAVE_REGCOMP) && defined (HAVE_REGEXEC)
# define HAVE_POSIX_REGEXP
#endif
/* backwards compatibility between different autoconf versions */
#if defined (HAVE_DECL_SYS_SIGLIST) && !defined (SYS_SIGLIST_DECLARED)
# define SYS_SIGLIST_DECLARED
#endif
/***********************************************************************/
/* Unset defines based on what configure reports as missing or broken. */
/***********************************************************************/
/* Ultrix botches type-ahead when switching from canonical to
non-canonical mode, at least through version 4.3 */
#if !defined (HAVE_TERMIOS_H) || !defined (HAVE_TCGETATTR) || defined (ultrix)
@@ -36,23 +76,31 @@
# undef HAVE_GETCWD
#endif
#if defined (HAVE_SYS_RESOURCE_H) && defined (HAVE_GETRLIMIT)
# define HAVE_RESOURCE
#endif
#if !defined (GETPGRP_VOID)
# define HAVE_BSD_PGRP
#endif
#if !defined (HAVE_DEV_FD) && defined (NAMED_PIPES_MISSING)
# undef PROCESS_SUBSTITUTION
#endif
#if defined (JOB_CONTROL_MISSING)
# undef JOB_CONTROL
#endif
#if defined (STRCOLL_BROKEN)
# undef HAVE_STRCOLL
#endif
#if !defined (HAVE_POSIX_REGEXP)
# undef COND_REGEXP
#endif
/* If the shell is called by this name, it will become restricted. */
#if defined (RESTRICTED_SHELL)
# define RESTRICTED_SHELL_NAME "rbash"
#endif
/***********************************************************/
/* Make sure feature defines have necessary prerequisites. */
/***********************************************************/
/* BANG_HISTORY requires HISTORY. */
#if defined (BANG_HISTORY) && !defined (HISTORY)
# define HISTORY
@@ -70,28 +118,6 @@
# undef DEFAULT_ECHO_TO_XPG
#endif
#if defined (JOB_CONTROL_MISSING)
# undef JOB_CONTROL
#endif
#if defined (__STDC__) && defined (HAVE_STDARG_H)
# define PREFER_STDARG
# define USE_VARARGS
#else
# if defined (HAVE_VARARGS_H)
# define PREFER_VARARGS
# define USE_VARARGS
# endif
#endif
#if defined (STRCOLL_BROKEN)
# undef HAVE_STRCOLL
#endif
#if defined (HAVE_SYS_SOCKET_H) && defined (HAVE_GETPEERNAME) && defined (HAVE_NETINET_IN_H)
# define HAVE_NETWORK
#endif
#if !defined (PROMPT_STRING_DECODE)
# undef PPROMPT
# define PPROMPT "$ "
@@ -107,11 +133,18 @@
#if defined (HAVE_WCTYPE_H) && defined (HAVE_WCHAR_H)
# include <wchar.h>
# include <wctype.h>
# if defined (HAVE_MBSRTOWCS) /* system is supposed to support XPG5 */
# if defined (HAVE_MBSRTOWCS) && defined (HAVE_MBRTOWC) && defined (HAVE_MBRLEN) && defined (HAVE_WCWIDTH)
/* system is supposed to support XPG5 */
# define HANDLE_MULTIBYTE 1
# endif
#endif
/* If we don't want multibyte chars even on a system that supports them, let
the configuring user turn multibyte support off. */
#if defined (NO_MULTIBYTE_SUPPORT)
# undef HANDLE_MULTIBYTE
#endif
/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */
#if HANDLE_MULTIBYTE && !defined (HAVE_MBSTATE_T)
# define wcsrtombs(dest, src, len, ps) (wcsrtombs) (dest, src, len, 0)
@@ -137,3 +170,12 @@
/************************************************/
/* end of multibyte capability checks for I18N */
/************************************************/
/******************************************************************/
/* Placeholder for builders to #undef any unwanted features from */
/* config-top.h or created by configure (such as the default mail */
/* file for mail checking). */
/******************************************************************/
/* If you don't want bash to provide a default mail file to check. */
/* #undef DEFAULT_MAIL_DIRECTORY */
+2 -2
View File
@@ -52,14 +52,14 @@
/* The default value of the PATH variable. */
#ifndef DEFAULT_PATH_VALUE
#define DEFAULT_PATH_VALUE \
"/usr/gnu/bin:/usr/local/bin:/usr/ucb:/bin:/usr/bin:."
"/usr/gnu/bin:/usr/local/bin:/bin:/usr/bin:."
#endif
/* The value for PATH when invoking `command -p'. This is only used when
the Posix.2 confstr () function, or CS_PATH define are not present. */
#ifndef STANDARD_UTILS_PATH
#define STANDARD_UTILS_PATH \
"/bin:/usr/bin:/usr/ucb:/sbin:/usr/sbin:/etc:/usr/etc"
"/bin:/usr/bin:/sbin:/usr/sbin:/etc:/usr/etc"
#endif
/* Default primary and secondary prompt strings. */
+42 -3
View File
@@ -1,6 +1,6 @@
/* config.h -- Configuration file for bash. */
/* Copyright (C) 1987-2002 Free Software Foundation, Inc.
/* Copyright (C) 1987-2003 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -119,6 +119,10 @@
command. */
#undef COND_COMMAND
/* Define COND_REGEXP if you want extended regular expression matching and the
=~ binary operator in the [[...]] conditional command. */
#define COND_REGEXP
/* Define ARITH_FOR_COMMAND if you want the ksh93-style
for (( init; test; step )) do list; done
arithmetic for command. */
@@ -132,6 +136,14 @@
and the complete builtin. */
#undef PROGRAMMABLE_COMPLETION
/* Define NO_MULTIBYTE_SUPPORT to not compile in support for multibyte
characters, even if the OS supports them. */
#undef NO_MULTIBYTE_SUPPORT
/* Define DEBUGGER if you want to compile in some features used only by the
bash debugger. */
#undef DEBUGGER
/* Define MEMSCRAMBLE if you want the bash malloc and free to scramble
memory contents on malloc() and free(). */
#undef MEMSCRAMBLE
@@ -314,6 +326,7 @@
libraries. */
/* Define if `sys_siglist' is declared by <signal.h> or <unistd.h>. */
#undef HAVE_DECL_SYS_SIGLIST
#undef SYS_SIGLIST_DECLARED
/* Define if `_sys_siglist' is declared by <signal.h> or <unistd.h>. */
@@ -325,8 +338,6 @@
#undef HAVE_SYS_ERRLIST
#undef HAVE_TIMEVAL
#undef HAVE_TZNAME
@@ -359,6 +370,10 @@
#undef HAVE_STRUCT_TM_TM_ZONE
#undef HAVE_TM_ZONE
#undef HAVE_TIMEVAL
#undef HAVE_STRUCT_TIMEZONE
/* Characteristics of definitions in the system header files. */
#undef HAVE_GETPW_DECLS
@@ -380,6 +395,7 @@
#undef HAVE_DECL_STRTOLD
#undef STRTOLD_BROKEN
#undef HAVE_MBSTATE_T
@@ -420,6 +436,8 @@
#undef HAVE_PRINTF_A_FORMAT
#undef CTYPE_NON_ASCII
/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
#undef HAVE_LANGINFO_CODESET
@@ -564,6 +582,12 @@
/* Define if you have the lstat function. */
#undef HAVE_LSTAT
/* Define if you have the mbrlen function. */
#undef HAVE_MBRLEN
/* Define if you have the mbrtowc function. */
#undef HAVE_MBRTOWC
/* Define if you have the mbsrtowcs function. */
#undef HAVE_MBSRTOWCS
@@ -585,6 +609,12 @@
/* Define if you have the readlink function. */
#undef HAVE_READLINK
/* Define if you have the regcomp function. */
#undef HAVE_REGCOMP
/* Define if you have the regexec function. */
#undef HAVE_REGEXEC
/* Define if you have the rename function. */
#undef HAVE_RENAME
@@ -639,6 +669,9 @@
/* Define if you have the strpbrk function. */
#undef HAVE_STRPBRK
/* Define if you have the strstr function. */
#undef HAVE_STRSTR
/* Define if you have the strtod function. */
#undef HAVE_STRTOD
@@ -708,6 +741,9 @@
/* Define if you have the wait3 function. */
#undef HAVE_WAIT3
/* Define if you have the wctomb function. */
#undef HAVE_WCTOMB
/* Define if you have the wcwidth function. */
#undef HAVE_WCWIDTH
@@ -749,6 +785,9 @@
/* Define if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H
/* Define if you have the <regex.h> header file. */
#undef HAVE_REGEX_H
/* Define if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
Vendored
+2856 -2220
View File
File diff suppressed because it is too large Load Diff
+76 -18
View File
@@ -5,7 +5,7 @@ dnl report bugs to chet@po.cwru.edu
dnl
dnl Process this file with autoconf to produce a configure script.
# Copyright (C) 1987-2002 Free Software Foundation, Inc.
# Copyright (C) 1987-2003 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
@@ -22,9 +22,12 @@ dnl Process this file with autoconf to produce a configure script.
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
AC_REVISION([for Bash 2.05b, version 2.144, from autoconf version] AC_ACVERSION)dnl
AC_REVISION([for Bash 3.0, version 3.154, from autoconf version] AC_ACVERSION)dnl
AC_INIT(bash, 2.05b, bug-bash@gnu.org)
define(bashvers, 3.0)
define(relstatus, alpha)
AC_INIT(bash, bashvers-relstatus, bug-bash@gnu.org)
dnl make sure we are using a recent autoconf version
AC_PREREQ(2.50)
@@ -35,8 +38,8 @@ AC_CONFIG_AUX_DIR(./support)
AC_CONFIG_HEADERS(config.h)
dnl checks for version info
BASHVERS=2.05b
RELSTATUS=release
BASHVERS=bashvers
RELSTATUS=relstatus
dnl defaults for debug settings
case "$RELSTATUS" in
@@ -70,6 +73,7 @@ sparc-netbsd*) opt_bash_malloc=no ;; # needs 8-byte alignment
mips-irix6*) opt_bash_malloc=no ;; # needs 8-byte alignment
m68k-sysv) opt_bash_malloc=no ;; # fixes file descriptor leak in closedir
sparc-linux*) opt_bash_malloc=no ;; # sparc running linux; requires ELF
*-freebsd*-gnu) opt_bash_malloc=no ;; # there's some undetermined problem here
#*-freebsd*) opt_bash_malloc=no ;; # they claim it's better; I disagree
*-openbsd*) opt_bash_malloc=no ;; # they claim it needs eight-bit alignment
*-aix*) opt_bash_malloc=no ;; # AIX machines
@@ -92,6 +96,12 @@ sco3.2v5*|sco3.2v4*) opt_memscramble=no ;;
*) opt_memscramble=yes ;;
esac
dnl
dnl macros for the bash debugger
dnl
AM_PATH_LISPDIR
AC_ARG_VAR(DEBUGGER_START_FILE, [location of bash debugger initialization file])
dnl arguments to configure
dnl packages
AC_ARG_WITH(afs, AC_HELP_STRING([--with-afs], [if you are running AFS]), opt_afs=$withval)
@@ -138,6 +148,10 @@ if test "$opt_curses" = yes; then
prefer_curses=yes
fi
if test -z "${DEBUGGER_START_FILE}"; then
DEBUGGER_START_FILE=${ac_default_prefix}/lib/bashdb/bashdb-main.inc
fi
dnl optional shell features in config.h.in
opt_minimal_config=no
@@ -160,10 +174,13 @@ opt_disabled_builtins=no
opt_command_timing=yes
opt_xpg_echo=no
opt_cond_command=yes
opt_cond_regexp=yes
opt_arith_for_command=yes
opt_net_redirs=yes
opt_progcomp=yes
opt_separate_help=no
opt_multibyte=yes
opt_debugger=yes
dnl options that affect how bash is compiled and linked
opt_static_link=no
@@ -182,6 +199,7 @@ if test $opt_minimal_config = yes; then
opt_brace_expansion=no opt_disabled_builtins=no opt_command_timing=no
opt_extended_glob=no opt_cond_command=no opt_arith_for_command=no
opt_net_redirs=no opt_progcomp=no opt_separate_help=no
opt_multibyte=yes opt_cond_regexp=no
fi
AC_ARG_ENABLE(alias, AC_HELP_STRING([--enable-alias], [enable shell aliases]), opt_alias=$enableval)
@@ -191,6 +209,8 @@ AC_ARG_ENABLE(bang-history, AC_HELP_STRING([--enable-bang-history], [turn on csh
AC_ARG_ENABLE(brace-expansion, AC_HELP_STRING([--enable-brace-expansion], [include brace expansion]), opt_brace_expansion=$enableval)
AC_ARG_ENABLE(command-timing, AC_HELP_STRING([--enable-command-timing], [enable the time reserved word and command timing]), opt_command_timing=$enableval)
AC_ARG_ENABLE(cond-command, AC_HELP_STRING([--enable-cond-command], [enable the conditional command]), opt_cond_command=$enableval)
AC_ARG_ENABLE(cond-regexp, AC_HELP_STRING([--enable-cond-regexp], [enable extgended regular expression matching in conditional commands]), opt_cond_regexp=$enableval)
AC_ARG_ENABLE(debugger, AC_HELP_STRING([--enable-debugger], [enable support for bash debugger]), opt_debugger=$enableval)
AC_ARG_ENABLE(directory-stack, AC_HELP_STRING([--enable-directory-stack], [enable builtins pushd/popd/dirs]), opt_dirstack=$enableval)
AC_ARG_ENABLE(disabled-builtins, AC_HELP_STRING([--enable-disabled-builtins], [allow disabled builtins to still be invoked]), opt_disabled_builtins=$enableval)
AC_ARG_ENABLE(dparen-arithmetic, AC_HELP_STRING([--enable-dparen-arithmetic], [include ((...)) command]), opt_dparen_arith=$enableval)
@@ -198,6 +218,7 @@ AC_ARG_ENABLE(extended-glob, AC_HELP_STRING([--enable-extended-glob], [include k
AC_ARG_ENABLE(help-builtin, AC_HELP_STRING([--enable-help-builtin], [include the help builtin]), opt_help=$enableval)
AC_ARG_ENABLE(history, AC_HELP_STRING([--enable-history], [turn on command history]), opt_history=$enableval)
AC_ARG_ENABLE(job-control, AC_HELP_STRING([--enable-job-control], [enable job control features]), opt_job_control=$enableval)
AC_ARG_ENABLE(multibyte, AC_HELP_STRING([--enable-multibyte], [enable multibyte characters if OS supports them]), opt_multibyte=$enableval)
AC_ARG_ENABLE(net-redirections, AC_HELP_STRING([--enable-net-redirections], [enable /dev/tcp/host/port redirection]), opt_net_redirs=$enableval)
AC_ARG_ENABLE(process-substitution, AC_HELP_STRING([--enable-process-substitution], [enable process substitution]), opt_process_subst=$enableval)
AC_ARG_ENABLE(progcomp, AC_HELP_STRING([--enable-progcomp], [enable programmable completion and the complete builtin]), opt_progcomp=$enableval)
@@ -265,6 +286,9 @@ fi
if test $opt_cond_command = yes ; then
AC_DEFINE(COND_COMMAND)
fi
if test $opt_cond_regexp = yes ; then
AC_DEFINE(COND_REGEXP)
fi
if test $opt_arith_for_command = yes; then
AC_DEFINE(ARITH_FOR_COMMAND)
fi
@@ -274,6 +298,12 @@ fi
if test $opt_progcomp = yes; then
AC_DEFINE(PROGRAMMABLE_COMPLETION)
fi
if test $opt_multibyte = no; then
AC_DEFINE(NO_MULTIBYTE_SUPPORT)
fi
if test $opt_debugger = yes; then
AC_DEFINE(DEBUGGER)
fi
if test $opt_memscramble = yes; then
AC_DEFINE(MEMSCRAMBLE)
@@ -430,7 +460,7 @@ then
RL_LIB_READLINE_VERSION
case "$ac_cv_rl_version" in
4.[[3-9]]*|5*|6*|7*|8*|9*) ;;
5*|6*|7*|8*|9*) ;;
*) opt_with_installed_readline=no
AC_MSG_WARN(installed readline library is too old to be linked with bash)
AC_MSG_WARN(using private bash version)
@@ -442,9 +472,13 @@ if test $opt_readline = yes; then
AC_DEFINE(READLINE)
READLINE_LIB=-lreadline
if test "$opt_with_installed_readline" != "no" ; then
case "$RL_INCLUDEDIR" in
/usr/include) ;;
*) RL_INCLUDE='-I${RL_INCLUDEDIR}'
case "$opt_with_installed_readline" in
yes) RL_INCLUDE= ;;
*) case "$RL_INCLUDEDIR" in
/usr/include) ;;
*) RL_INCLUDE='-I${RL_INCLUDEDIR}' ;;
esac
;;
esac
READLINE_DEP=
else
@@ -466,9 +500,13 @@ if test $opt_history = yes || test $opt_bang_history = yes; then
if test "$opt_with_installed_readline" != "no"; then
HIST_LIBDIR=$RL_LIBDIR
HISTORY_DEP=
case "$RL_INCLUDEDIR" in
/usr/include) ;;
*) RL_INCLUDE='-I${RL_INCLUDEDIR}'
case "$opt_with_installed_readline" in
yes) RL_INCLUDE= ;;
*) case "$RL_INCLUDEDIR" in
/usr/include) ;;
*) RL_INCLUDE='-I${RL_INCLUDEDIR}' ;;
esac
;;
esac
else
HIST_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
@@ -525,7 +563,7 @@ BASH_HEADER_INTTYPES
AC_CHECK_HEADERS(unistd.h stdlib.h stdarg.h varargs.h limits.h string.h \
memory.h locale.h termcap.h termio.h termios.h dlfcn.h \
stddef.h stdint.h netdb.h grp.h strings.h)
stddef.h stdint.h netdb.h grp.h strings.h regex.h)
AC_CHECK_HEADERS(sys/ptem.h sys/pte.h sys/stream.h sys/select.h sys/file.h \
sys/resource.h sys/param.h sys/socket.h \
sys/time.h sys/times.h sys/wait.h)
@@ -588,9 +626,9 @@ AC_CHECK_FUNCS(bcopy bzero confstr sysconf pathconf setenv putenv unsetenv \
setlinebuf setvbuf setlocale strchr tcgetattr uname \
ulimit tzset siginterrupt memmove ttyname times \
getaddrinfo gethostbyname getservbyname getservent inet_aton \
vsnprintf snprintf vasprintf asprintf fnmatch)
vsnprintf snprintf vasprintf asprintf fnmatch regcomp regexec)
AC_CHECK_FUNCS(isascii isblank isgraph isprint isspace isxdigit)
AC_REPLACE_FUNCS(getcwd strcasecmp strerror strftime strpbrk memset)
AC_REPLACE_FUNCS(getcwd strcasecmp strerror strftime strpbrk memset strstr)
AC_REPLACE_FUNCS(strtod strtol strtoul strtoll strtoull strtoimax strtoumax)
AC_CHECK_DECLS([confstr])
@@ -598,7 +636,24 @@ AC_CHECK_DECLS([printf])
AC_CHECK_DECLS([sbrk])
AC_CHECK_DECLS([strcpy])
AC_CHECK_DECLS([strsignal])
AC_CHECK_DECLS([strtold])
dnl Extra test to detect the horribly broken HP/UX 11.00 strtold(3)
AC_CHECK_DECLS([strtold], [
AC_MSG_CHECKING([for broken strtold])
AC_CACHE_VAL(bash_cv_strtold_broken,
[AC_TRY_COMPILE(
[#include <stdlib.h>],
[int main() { long double r; char *foo, bar; r = strtold(foo, &bar);}],
bash_cv_strtold_broken=no, bash_cv_strtold_broken=yes,
[AC_MSG_WARN(cannot check for broken strtold if cross-compiling, defaulting to no)])
]
)
AC_MSG_RESULT($bash_cv_strtold_broken)
if test "$bash_cv_strtold_broken" = "yes" ; then
AC_DEFINE(STRTOLD_BROKEN)
fi
])
BASH_CHECK_DECL(strtoimax)
BASH_CHECK_DECL(strtol)
@@ -702,6 +757,7 @@ BASH_FUNC_LSTAT
fi
dnl behavior of system calls and library functions
BASH_FUNC_CTYPE_NONASCII
BASH_FUNC_DUP2_CLOEXEC_CHECK
BASH_SYS_PGRP_SYNC
BASH_SYS_SIGNAL_VINTAGE
@@ -733,6 +789,7 @@ BASH_STRUCT_TIMEVAL
AC_CHECK_MEMBERS([struct stat.st_blocks])
AC_STRUCT_TM
AC_STRUCT_TIMEZONE
BASH_STRUCT_TIMEZONE
dnl presence and behavior of C library functions
BASH_FUNC_STRSIGNAL
@@ -851,7 +908,7 @@ lynxos*) LOCAL_CFLAGS=-DRECYCLES_PIDS ;;
linux*) LOCAL_LDFLAGS=-rdynamic ;; # allow dynamic loading
*qnx*) LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s" LOCAL_LIBS="-lunix -lncurses" ;;
powerux*) LOCAL_LIBS="-lgen" ;;
cygwin*) LOCAL_LIBS="-luser32" ;;
cygwin*) LOCAL_CFLAGS=-DRECYCLES_PIDS ;;
opennt*|interix*) LOCAL_CFLAGS="-DNO_MAIN_ENV_ARG -DBROKEN_DIRENT_D_INO" ;;
esac
@@ -948,7 +1005,8 @@ AC_SUBST(LOCAL_DEFS)
AC_OUTPUT([Makefile builtins/Makefile lib/readline/Makefile lib/glob/Makefile \
lib/malloc/Makefile lib/sh/Makefile lib/termcap/Makefile \
lib/tilde/Makefile doc/Makefile support/Makefile \
examples/loadables/Makefile examples/loadables/perl/Makefile],
examples/loadables/Makefile examples/loadables/perl/Makefile \
pathnames.h],
[
# Makefile uses this timestamp file to record whether config.h is up to date.
echo timestamp > stamp-h
+16 -6
View File
@@ -50,7 +50,6 @@ static ARITH_COM *copy_arith_command __P((ARITH_COM *));
static COND_COM *copy_cond_command __P((COND_COM *));
#endif
static SIMPLE_COM *copy_simple_command __P((SIMPLE_COM *));
static FUNCTION_DEF *copy_function_def __P((FUNCTION_DEF *));
WORD_DESC *
copy_word (w)
@@ -166,6 +165,7 @@ copy_for_command (com)
new_for = (FOR_COM *)xmalloc (sizeof (FOR_COM));
new_for->flags = com->flags;
new_for->line = com->line;
new_for->name = copy_word (com->name);
new_for->map_list = copy_word_list (com->map_list);
new_for->action = copy_command (com->action);
@@ -221,6 +221,7 @@ copy_case_command (com)
new_case = (CASE_COM *)xmalloc (sizeof (CASE_COM));
new_case->flags = com->flags;
new_case->line = com->line;
new_case->word = copy_word (com->word);
new_case->clauses = copy_case_clauses (com->clauses);
return (new_case);
@@ -302,17 +303,26 @@ copy_simple_command (com)
return (new_simple);
}
static FUNCTION_DEF *
FUNCTION_DEF *
copy_function_def_contents (old, new_def)
FUNCTION_DEF *old, *new_def;
{
new_def->name = copy_word (old->name);
new_def->command = copy_command (old->command);
new_def->flags = old->flags;
new_def->line = old->line;
new_def->source_file = old->source_file ? savestring (old->source_file) : old->source_file;
return (new_def);
}
FUNCTION_DEF *
copy_function_def (com)
FUNCTION_DEF *com;
{
FUNCTION_DEF *new_def;
new_def = (FUNCTION_DEF *)xmalloc (sizeof (FUNCTION_DEF));
new_def->name = copy_word (com->name);
new_def->command = copy_command (com->command);
new_def->flags = com->flags;
new_def->line = com->line;
new_def = copy_function_def_contents (com, new_def);
return (new_def);
}
+18 -3
View File
@@ -186,9 +186,7 @@ dispose_command (command)
register FUNCTION_DEF *c;
c = command->value.Function_def;
dispose_word (c->name);
dispose_command (c->command);
free (c);
dispose_function_def (c);
break;
}
@@ -218,6 +216,23 @@ dispose_cond_node (cond)
}
#endif /* COND_COMMAND */
void
dispose_function_def_contents (c)
FUNCTION_DEF *c;
{
dispose_word (c->name);
dispose_command (c->command);
FREE (c->source_file);
}
void
dispose_function_def (c)
FUNCTION_DEF *c;
{
dispose_function_def_contents (c);
free (c);
}
/* How to free a WORD_DESC. */
void
dispose_word (w)
+3
View File
@@ -33,4 +33,7 @@ extern void dispose_redirects __P((REDIRECT *));
extern void dispose_cond_node __P((COND_COM *));
#endif
extern void dispose_function_def_contents __P((FUNCTION_DEF *));
extern void dispose_function_def __P((FUNCTION_DEF *));
#endif /* !_DISPOSE_CMD_H_ */
+89 -28
View File
@@ -1,4 +1,4 @@
This is the Bash FAQ, version 3.20, for Bash version 2.05b.
This is the Bash FAQ, version 3.26, for Bash version 2.05b.
This document contains a set of frequently-asked questions concerning
Bash, the GNU Bourne-Again Shell. Bash is a freely-available command
@@ -31,7 +31,7 @@ A6) How can I build bash with gcc?
A7) How can I make bash my login shell?
A8) I just changed my login shell to bash, and now I can't FTP into my
machine. Why not?
A9) What's the `POSIX 1003.2 standard'?
A9) What's the `POSIX Shell and Utilities standard'?
A10) What is the bash `posix mode'?
Section B: The latest version
@@ -75,6 +75,9 @@ E8) Why does the arithmetic evaluation code complain about `08'?
E9) Why does the pattern matching expression [A-Z]* match files beginning
with every letter except `z'?
E10) Why does `cd //' leave $PWD as `//'?
E11) If I resize my xterm while another program is running, why doesn't bash
notice the change?
E12) Why don't negative offsets in substring expansion work like I expect?
Section F: Things to watch out for on certain Unix versions
@@ -271,7 +274,8 @@ it is invoked as a login shell.
Next, add a line similar to the above to ~/.profile:
[ -f /usr/gnu/bin/bash ] && exec /usr/gnu/bin/bash --login
[ -f /usr/gnu/bin/bash ] && [ -x /usr/gnu/bin/bash ] && \
exec /usr/gnu/bin/bash --login
This will cause login shells to replace themselves with bash running as
a login shell. Once you have this working, you can copy your initialization
@@ -325,7 +329,7 @@ this before you can make bash your login shell.
Most versions of ftpd use this file to prohibit `special' users
such as `uucp' and `news' from using FTP.
A9) What's the `POSIX 1003.2 standard'?
A9) What's the `POSIX Shell and Utilities standard'?
POSIX is a name originally coined by Richard Stallman for a
family of open system standards based on UNIX. There are a
@@ -335,44 +339,50 @@ call and C library level to applications and tools to system
administration and management. Each area of standardization is
assigned to a working group in the 1003 series.
The POSIX Shell and Utilities standard has been developed by IEEE
Working Group 1003.2 (POSIX.2). It concentrates on the command
interpreter interface and utility programs commonly executed from
the command line or by other programs. An initial version of the
standard has been approved and published by the IEEE, and work is
currently underway to update it.
The POSIX Shell and Utilities standard was originally developed by
IEEE Working Group 1003.2 (POSIX.2). Today it has been merged with
the original 1003.1 Working Group and is maintained by the Austin
Group (a joint working group of the IEEE, The Open Group and
ISO/IEC SC22/WG15). Today the Shell and Utilities are a volume
within the set of documents that make up IEEE Std 1003.1-2001, and
thus now the former POSIX.2 (from 1992) is now part of the current
POSIX.1 standard (POSIX 1003.1-2001).
Bash is concerned with the aspects of the shell's behavior
defined by POSIX.2. The shell command language has of course
been standardized, including the basic flow control and program
execution constructs, I/O redirection and pipelining, argument
handling, variable expansion, and quoting.
The Shell and Utilities volume concentrates on the command
interpreter interface and utility programs commonly executed from
the command line or by other programs. The standard is freely
available on the web at http://www.UNIX-systems.org/version3/ .
Work continues at the Austin Group on maintenance issues; see
http://www.opengroup.org/austin/ to join the discussions.
Bash is concerned with the aspects of the shell's behavior defined
by the POSIX Shell and Utilities volume. The shell command
language has of course been standardized, including the basic flow
control and program execution constructs, I/O redirection and
pipelining, argument handling, variable expansion, and quoting.
The `special' builtins, which must be implemented as part of the
shell to provide the desired functionality, are specified as
being part of the shell; examples of these are `eval' and
`export'. Other utilities appear in the sections of POSIX.2 not
`export'. Other utilities appear in the sections of POSIX not
devoted to the shell which are commonly (and in some cases must
be) implemented as builtin commands, such as `read' and `test'.
POSIX.2 also specifies aspects of the shell's interactive
POSIX also specifies aspects of the shell's interactive
behavior as part of the UPE, including job control and command
line editing. Only vi-style line editing commands have been
standardized; emacs editing commands were left out due to
objections.
The Open Group has made an older version of its Single Unix
Specification (version 2), which is very similar to POSIX.2,
available on the web at
The latest version of the POSIX Shell and Utilities standard is
available (now updated to the 2003 Edition incorporating the
Technical Corrigendum 1), as part of the Single UNIX Specification
Version 3 at
http://www.opengroup.org/onlinepubs/007908799/
The Single Unix Specification, version 3, is available on the web at
http://www.opengroup.org/onlinepubs/007904975/
http://www.UNIX-systems.org/version3/
A10) What is the bash `posix mode'?
Although bash is an implementation of the POSIX.2 shell
Although bash is an implementation of the POSIX shell
specification, there are areas where the bash default behavior
differs from that spec. The bash `posix mode' changes the bash
behavior in these areas so that it obeys the spec more closely.
@@ -821,6 +831,8 @@ New things in ksh-93 not in bash-2.05b:
-I invocation option
DEBUG trap now executed before each simple command, instead of after
printf %H, %P, %T, %Z modifiers, output base for %d
lexical scoping for local variables in `ksh' functions
no scoping for local variables in `POSIX' functions
New things in ksh-93 present in bash-2.05b:
[n]<&word- and [n]>&word- redirections (combination dup and close)
@@ -1305,6 +1317,49 @@ This is, I presume, for historical compatibility. Certain versions of
Unix, and early network file systems, used paths of the form
//hostname/path to access `path' on server `hostname'.
E11) If I resize my xterm while another program is running, why doesn't bash
notice the change?
This is another issue that deals with job control.
The kernel maintains a notion of a current terminal process group. Members
of this process group (processes whose process group ID is equal to the
current terminal process group ID) receive terminal-generated signals like
SIGWINCH. (For more details, see the JOB CONTROL section of the bash
man page.)
If a terminal is resized, the kernel sends SIGWINCH to each member of
the terminal's current process group (the `foreground' process group).
When bash is running with job control enabled, each pipeline (which may be
a single command) is run in its own process group, different from bash's
process group. This foreground process group receives the SIGWINCH; bash
does not. Bash has no way of knowing that the terminal has been resized.
There is a `checkwinsize' option, settable with the `shopt' builtin, that
will cause bash to check the window size and adjust its idea of the
terminal's dimensions each time a process stops or exits and returns control
of the terminal to bash. Enable it with `shopt -s checkwinsize'.
E12) Why don't negative offsets in substring expansion work like I expect?
When substring expansion of the form ${param:offset[:length} is used,
an `offset' that evaluates to a number less than zero counts back from
the end of the expanded value of $param.
When a negative `offset' begins with a minus sign, however, unexpected things
can happen. Consider
a=12345678
echo ${a:-4}
intending to print the last four characters of $a. The problem is that
${param:-word} already has a well-defined meaning: expand to word if the
expanded value of param is unset or null, and $param otherwise.
To use negative offsets that begin with a minus sign, separate the
minus sign and the colon with a space.
Section F: Things to watch out for on certain Unix versions
F1) Why can't I use command line editing in my `cmdtool'?
@@ -1671,6 +1726,12 @@ A second edition of this book is available, published in January, 1998.
The ISBN number is 1-56592-347-2. Look for it in the same fine bookstores
or on the web.
The GNU Bash Reference Manual has been published as a printed book by
Network Theory Ltd (Paperback, ISBN: 0-9541617-7-7, Feb 2003). It covers
bash-2.0 and is available from most online bookstores (see
http://www.network-theory.co.uk/bash/manual/ for details). The publisher
will donate $1 to the Free Software Foundation for each copy sold.
H3) What's coming in future versions?
These are features I hope to include in a future version of bash.
@@ -1698,10 +1759,10 @@ Some of the new ksh93 pattern matching operators, like backreferencing
H5) When will the next release appear?
The next version will appear sometime in 2002. Never make predictions.
The next version will appear sometime in 2003. Never make predictions.
This document is Copyright 1995-2002 by Chester Ramey.
This document is Copyright 1995-2003 by Chester Ramey.
Permission is hereby granted, without written agreement and
without license or royalty fees, to use, copy, and distribute
+24 -31
View File
@@ -1,6 +1,6 @@
# This Makefile is for the Bash/documentation directory -*- text -*-.
#
# Copyright (C) 1996 Free Software Foundation, Inc.
# Copyright (C) 2003 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
@@ -59,11 +59,14 @@ TEXI2DVI = ${topdir}/support/texi2dvi
TEXI2HTML = ${topdir}/support/texi2html
MAN2HTML = ${BUILD_DIR}/support/man2html
HTMLPOST = ${srcdir}/htmlpost.sh
INFOPOST = ${srcdir}/infopost.sh
QUIETPS = #set this to -q to shut up dvips
PAPERSIZE = letter # change to a4 for A4-size paper
PSDPI = 300 # could be 600 if you like
PSDPI = 600 # could be 300 if you like
DVIPS = dvips -D ${PSDPI} $(QUIETPS) -t ${PAPERSIZE} -o $@ # tricky
TEXINPUTDIR = $(RL_LIBDIR)/doc
SET_TEXINPUTS = TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS
# These tools might not be available; they're not required
DVIPDF = dvipdfm -o $@ -p ${PAPERSIZE}
@@ -77,8 +80,10 @@ NROFF = groff -Tascii
# This should be a program that converts troff to postscript
GROFF = groff
HSUSER = $(RL_LIBDIR)/doc/hsuser.texinfo
RLUSER = $(RL_LIBDIR)/doc/rluser.texinfo
HSUSER = $(RL_LIBDIR)/doc/hsuser.texi
RLUSER = $(RL_LIBDIR)/doc/rluser.texi
BASHREF_FILES = $(srcdir)/bashref.texi $(srcdir)/version.texi
.SUFFIXES: .0 .1 .3 .ms .ps .txt .dvi .html .pdf
@@ -122,10 +127,14 @@ RLUSER = $(RL_LIBDIR)/doc/rluser.texinfo
$(RM) $@
-${DVIPDF} $<
.dvi.ps:
${RM} $@
-${DVIPS} $<
all: ps info dvi text html
nodvi: ps info text html
PSFILES = bash.ps bashbug.ps article.ps builtins.ps rbash.ps
PSFILES = bash.ps bashbug.ps article.ps builtins.ps rbash.ps
DVIFILES = bashref.dvi bashref.ps
INFOFILES = bashref.info
MAN0FILES = bash.0 bashbug.0 builtins.0 rbash.0
@@ -139,35 +148,17 @@ text: ${MAN0FILES}
html: ${HTMLFILES}
pdf: ${PDFFILES}
bashref.dvi: $(srcdir)/bashref.texi $(HSUSER) $(RLUSER)
TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2DVI) $(srcdir)/bashref.texi
bashref.dvi: $(BASHREF_FILES) $(HSUSER) $(RLUSER)
${SET_TEXINPUTS} $(TEXI2DVI) $(srcdir)/bashref.texi
bashref.ps: bashref.dvi
$(RM) $@
$(DVIPS) bashref.dvi
bashref.info: $(srcdir)/bashref.texi $(HSUSER) $(RLUSER)
bashref.info: $(BASHREF_FILES) $(HSUSER) $(RLUSER)
$(MAKEINFO) --no-split -I$(TEXINPUTDIR) $(srcdir)/bashref.texi
bashref.html: bashref.texi $(HSUSER) $(RLUSER)
bashref.html: $(BASHREF_FILES) $(HSUSER) $(RLUSER)
$(TEXI2HTML) -menu -monolithic -I $(TEXINPUTDIR) $(srcdir)/bashref.texi
new-bashref.dvi: $(srcdir)/new-bashref.texi $(HSUSER) $(RLUSER)
TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2DVI) $(srcdir)/new-bashref.texi
new-bashref.ps: new-bashref.dvi
$(RM) $@
$(DVIPS) new-bashref.dvi
new-bashref.info: $(srcdir)/new-bashref.texi $(HSUSER) $(RLUSER)
$(MAKEINFO) --no-split -I$(TEXINPUTDIR) $(srcdir)/new-bashref.texi
#bash.dvi: bash.texinfo $(HSUSER) $(RLUSER)
# TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2DVI) bash.texinfo
#
#bashman.ps: bash.dvi
# $(RM) $@
# $(DVIPS) bash.dvi
bash.info: bashref.info
${SHELL} ${INFOPOST} < bashref.info > $@
bash.txt: bash.1
bash.ps: bash.1
@@ -181,6 +172,8 @@ builtins.0: builtins.1 bash.1
rbash.0: rbash.1 bash.1
article.ps: article.ms
bashref.ps: bashref.dvi
article.pdf: article.ps
bashref.pdf: bashref.dvi
bash.pdf: bash.ps
@@ -217,12 +210,12 @@ installdirs:
test -d $(htmldir) || $(SHELL) ${MKDIRS} $(DESTDIR)$(htmldir) ; \
fi
install: info installdirs
install: info installdirs bash.info
-$(INSTALL_DATA) $(srcdir)/bash.1 $(DESTDIR)$(man1dir)/bash${man1ext}
-$(INSTALL_DATA) $(srcdir)/bashbug.1 $(DESTDIR)$(man1dir)/bashbug${man1ext}
# uncomment the next line to install the builtins man page
# -$(INSTALL_DATA) $(srcdir)/builtins.1 $(DESTDIR)$(man1dir)/bash_builtins${man1ext}
-$(INSTALL_DATA) $(srcdir)/bashref.info $(DESTDIR)$(infodir)/bash.info
-$(INSTALL_DATA) $(srcdir)/bash.info $(DESTDIR)$(infodir)/bash.info
# run install-info if it is present to update the info directory
if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
install-info --dir-file=$(DESTDIR)$(infodir)/dir $(DESTDIR)$(infodir)/bash.info; \
+448 -95
View File
File diff suppressed because it is too large Load Diff
+1172 -351
View File
File diff suppressed because it is too large Load Diff
+544 -175
View File
File diff suppressed because it is too large Load Diff
+452
View File
@@ -0,0 +1,452 @@
@node GNU Free Documentation License
@appendixsec GNU Free Documentation License
@cindex FDL, GNU Free Documentation License
@center Version 1.2, November 2002
@display
Copyright @copyright{} 2000,2001,2002 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@end display
@enumerate 0
@item
PREAMBLE
The purpose of this License is to make a manual, textbook, or other
functional and useful document @dfn{free} in the sense of freedom: to
assure everyone the effective freedom to copy and redistribute it,
with or without modifying it, either commercially or noncommercially.
Secondarily, this License preserves for the author and publisher a way
to get credit for their work, while not being considered responsible
for modifications made by others.
This License is a kind of ``copyleft'', which means that derivative
works of the document must themselves be free in the same sense. It
complements the GNU General Public License, which is a copyleft
license designed for free software.
We have designed this License in order to use it for manuals for free
software, because free software needs free documentation: a free
program should come with manuals providing the same freedoms that the
software does. But this License is not limited to software manuals;
it can be used for any textual work, regardless of subject matter or
whether it is published as a printed book. We recommend this License
principally for works whose purpose is instruction or reference.
@item
APPLICABILITY AND DEFINITIONS
This License applies to any manual or other work, in any medium, that
contains a notice placed by the copyright holder saying it can be
distributed under the terms of this License. Such a notice grants a
world-wide, royalty-free license, unlimited in duration, to use that
work under the conditions stated herein. The ``Document'', below,
refers to any such manual or work. Any member of the public is a
licensee, and is addressed as ``you''. You accept the license if you
copy, modify or distribute the work in a way requiring permission
under copyright law.
A ``Modified Version'' of the Document means any work containing the
Document or a portion of it, either copied verbatim, or with
modifications and/or translated into another language.
A ``Secondary Section'' is a named appendix or a front-matter section
of the Document that deals exclusively with the relationship of the
publishers or authors of the Document to the Document's overall
subject (or to related matters) and contains nothing that could fall
directly within that overall subject. (Thus, if the Document is in
part a textbook of mathematics, a Secondary Section may not explain
any mathematics.) The relationship could be a matter of historical
connection with the subject or with related matters, or of legal,
commercial, philosophical, ethical or political position regarding
them.
The ``Invariant Sections'' are certain Secondary Sections whose titles
are designated, as being those of Invariant Sections, in the notice
that says that the Document is released under this License. If a
section does not fit the above definition of Secondary then it is not
allowed to be designated as Invariant. The Document may contain zero
Invariant Sections. If the Document does not identify any Invariant
Sections then there are none.
The ``Cover Texts'' are certain short passages of text that are listed,
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
the Document is released under this License. A Front-Cover Text may
be at most 5 words, and a Back-Cover Text may be at most 25 words.
A ``Transparent'' copy of the Document means a machine-readable copy,
represented in a format whose specification is available to the
general public, that is suitable for revising the document
straightforwardly with generic text editors or (for images composed of
pixels) generic paint programs or (for drawings) some widely available
drawing editor, and that is suitable for input to text formatters or
for automatic translation to a variety of formats suitable for input
to text formatters. A copy made in an otherwise Transparent file
format whose markup, or absence of markup, has been arranged to thwart
or discourage subsequent modification by readers is not Transparent.
An image format is not Transparent if used for any substantial amount
of text. A copy that is not ``Transparent'' is called ``Opaque''.
Examples of suitable formats for Transparent copies include plain
@sc{ascii} without markup, Texinfo input format, La@TeX{} input
format, @acronym{SGML} or @acronym{XML} using a publicly available
@acronym{DTD}, and standard-conforming simple @acronym{HTML},
PostScript or @acronym{PDF} designed for human modification. Examples
of transparent image formats include @acronym{PNG}, @acronym{XCF} and
@acronym{JPG}. Opaque formats include proprietary formats that can be
read and edited only by proprietary word processors, @acronym{SGML} or
@acronym{XML} for which the @acronym{DTD} and/or processing tools are
not generally available, and the machine-generated @acronym{HTML},
PostScript or @acronym{PDF} produced by some word processors for
output purposes only.
The ``Title Page'' means, for a printed book, the title page itself,
plus such following pages as are needed to hold, legibly, the material
this License requires to appear in the title page. For works in
formats which do not have any title page as such, ``Title Page'' means
the text near the most prominent appearance of the work's title,
preceding the beginning of the body of the text.
A section ``Entitled XYZ'' means a named subunit of the Document whose
title either is precisely XYZ or contains XYZ in parentheses following
text that translates XYZ in another language. (Here XYZ stands for a
specific section name mentioned below, such as ``Acknowledgements'',
``Dedications'', ``Endorsements'', or ``History''.) To ``Preserve the Title''
of such a section when you modify the Document means that it remains a
section ``Entitled XYZ'' according to this definition.
The Document may include Warranty Disclaimers next to the notice which
states that this License applies to the Document. These Warranty
Disclaimers are considered to be included by reference in this
License, but only as regards disclaiming warranties: any other
implication that these Warranty Disclaimers may have is void and has
no effect on the meaning of this License.
@item
VERBATIM COPYING
You may copy and distribute the Document in any medium, either
commercially or noncommercially, provided that this License, the
copyright notices, and the license notice saying this License applies
to the Document are reproduced in all copies, and that you add no other
conditions whatsoever to those of this License. You may not use
technical measures to obstruct or control the reading or further
copying of the copies you make or distribute. However, you may accept
compensation in exchange for copies. If you distribute a large enough
number of copies you must also follow the conditions in section 3.
You may also lend copies, under the same conditions stated above, and
you may publicly display copies.
@item
COPYING IN QUANTITY
If you publish printed copies (or copies in media that commonly have
printed covers) of the Document, numbering more than 100, and the
Document's license notice requires Cover Texts, you must enclose the
copies in covers that carry, clearly and legibly, all these Cover
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
the back cover. Both covers must also clearly and legibly identify
you as the publisher of these copies. The front cover must present
the full title with all words of the title equally prominent and
visible. You may add other material on the covers in addition.
Copying with changes limited to the covers, as long as they preserve
the title of the Document and satisfy these conditions, can be treated
as verbatim copying in other respects.
If the required texts for either cover are too voluminous to fit
legibly, you should put the first ones listed (as many as fit
reasonably) on the actual cover, and continue the rest onto adjacent
pages.
If you publish or distribute Opaque copies of the Document numbering
more than 100, you must either include a machine-readable Transparent
copy along with each Opaque copy, or state in or with each Opaque copy
a computer-network location from which the general network-using
public has access to download using public-standard network protocols
a complete Transparent copy of the Document, free of added material.
If you use the latter option, you must take reasonably prudent steps,
when you begin distribution of Opaque copies in quantity, to ensure
that this Transparent copy will remain thus accessible at the stated
location until at least one year after the last time you distribute an
Opaque copy (directly or through your agents or retailers) of that
edition to the public.
It is requested, but not required, that you contact the authors of the
Document well before redistributing any large number of copies, to give
them a chance to provide you with an updated version of the Document.
@item
MODIFICATIONS
You may copy and distribute a Modified Version of the Document under
the conditions of sections 2 and 3 above, provided that you release
the Modified Version under precisely this License, with the Modified
Version filling the role of the Document, thus licensing distribution
and modification of the Modified Version to whoever possesses a copy
of it. In addition, you must do these things in the Modified Version:
@enumerate A
@item
Use in the Title Page (and on the covers, if any) a title distinct
from that of the Document, and from those of previous versions
(which should, if there were any, be listed in the History section
of the Document). You may use the same title as a previous version
if the original publisher of that version gives permission.
@item
List on the Title Page, as authors, one or more persons or entities
responsible for authorship of the modifications in the Modified
Version, together with at least five of the principal authors of the
Document (all of its principal authors, if it has fewer than five),
unless they release you from this requirement.
@item
State on the Title page the name of the publisher of the
Modified Version, as the publisher.
@item
Preserve all the copyright notices of the Document.
@item
Add an appropriate copyright notice for your modifications
adjacent to the other copyright notices.
@item
Include, immediately after the copyright notices, a license notice
giving the public permission to use the Modified Version under the
terms of this License, in the form shown in the Addendum below.
@item
Preserve in that license notice the full lists of Invariant Sections
and required Cover Texts given in the Document's license notice.
@item
Include an unaltered copy of this License.
@item
Preserve the section Entitled ``History'', Preserve its Title, and add
to it an item stating at least the title, year, new authors, and
publisher of the Modified Version as given on the Title Page. If
there is no section Entitled ``History'' in the Document, create one
stating the title, year, authors, and publisher of the Document as
given on its Title Page, then add an item describing the Modified
Version as stated in the previous sentence.
@item
Preserve the network location, if any, given in the Document for
public access to a Transparent copy of the Document, and likewise
the network locations given in the Document for previous versions
it was based on. These may be placed in the ``History'' section.
You may omit a network location for a work that was published at
least four years before the Document itself, or if the original
publisher of the version it refers to gives permission.
@item
For any section Entitled ``Acknowledgements'' or ``Dedications'', Preserve
the Title of the section, and preserve in the section all the
substance and tone of each of the contributor acknowledgements and/or
dedications given therein.
@item
Preserve all the Invariant Sections of the Document,
unaltered in their text and in their titles. Section numbers
or the equivalent are not considered part of the section titles.
@item
Delete any section Entitled ``Endorsements''. Such a section
may not be included in the Modified Version.
@item
Do not retitle any existing section to be Entitled ``Endorsements'' or
to conflict in title with any Invariant Section.
@item
Preserve any Warranty Disclaimers.
@end enumerate
If the Modified Version includes new front-matter sections or
appendices that qualify as Secondary Sections and contain no material
copied from the Document, you may at your option designate some or all
of these sections as invariant. To do this, add their titles to the
list of Invariant Sections in the Modified Version's license notice.
These titles must be distinct from any other section titles.
You may add a section Entitled ``Endorsements'', provided it contains
nothing but endorsements of your Modified Version by various
parties---for example, statements of peer review or that the text has
been approved by an organization as the authoritative definition of a
standard.
You may add a passage of up to five words as a Front-Cover Text, and a
passage of up to 25 words as a Back-Cover Text, to the end of the list
of Cover Texts in the Modified Version. Only one passage of
Front-Cover Text and one of Back-Cover Text may be added by (or
through arrangements made by) any one entity. If the Document already
includes a cover text for the same cover, previously added by you or
by arrangement made by the same entity you are acting on behalf of,
you may not add another; but you may replace the old one, on explicit
permission from the previous publisher that added the old one.
The author(s) and publisher(s) of the Document do not by this License
give permission to use their names for publicity for or to assert or
imply endorsement of any Modified Version.
@item
COMBINING DOCUMENTS
You may combine the Document with other documents released under this
License, under the terms defined in section 4 above for modified
versions, provided that you include in the combination all of the
Invariant Sections of all of the original documents, unmodified, and
list them all as Invariant Sections of your combined work in its
license notice, and that you preserve all their Warranty Disclaimers.
The combined work need only contain one copy of this License, and
multiple identical Invariant Sections may be replaced with a single
copy. If there are multiple Invariant Sections with the same name but
different contents, make the title of each such section unique by
adding at the end of it, in parentheses, the name of the original
author or publisher of that section if known, or else a unique number.
Make the same adjustment to the section titles in the list of
Invariant Sections in the license notice of the combined work.
In the combination, you must combine any sections Entitled ``History''
in the various original documents, forming one section Entitled
``History''; likewise combine any sections Entitled ``Acknowledgements'',
and any sections Entitled ``Dedications''. You must delete all
sections Entitled ``Endorsements.''
@item
COLLECTIONS OF DOCUMENTS
You may make a collection consisting of the Document and other documents
released under this License, and replace the individual copies of this
License in the various documents with a single copy that is included in
the collection, provided that you follow the rules of this License for
verbatim copying of each of the documents in all other respects.
You may extract a single document from such a collection, and distribute
it individually under this License, provided you insert a copy of this
License into the extracted document, and follow this License in all
other respects regarding verbatim copying of that document.
@item
AGGREGATION WITH INDEPENDENT WORKS
A compilation of the Document or its derivatives with other separate
and independent documents or works, in or on a volume of a storage or
distribution medium, is called an ``aggregate'' if the copyright
resulting from the compilation is not used to limit the legal rights
of the compilation's users beyond what the individual works permit.
When the Document is included an aggregate, this License does not
apply to the other works in the aggregate which are not themselves
derivative works of the Document.
If the Cover Text requirement of section 3 is applicable to these
copies of the Document, then if the Document is less than one half of
the entire aggregate, the Document's Cover Texts may be placed on
covers that bracket the Document within the aggregate, or the
electronic equivalent of covers if the Document is in electronic form.
Otherwise they must appear on printed covers that bracket the whole
aggregate.
@item
TRANSLATION
Translation is considered a kind of modification, so you may
distribute translations of the Document under the terms of section 4.
Replacing Invariant Sections with translations requires special
permission from their copyright holders, but you may include
translations of some or all Invariant Sections in addition to the
original versions of these Invariant Sections. You may include a
translation of this License, and all the license notices in the
Document, and any Warranty Disclaimers, provided that you also include
the original English version of this License and the original versions
of those notices and disclaimers. In case of a disagreement between
the translation and the original version of this License or a notice
or disclaimer, the original version will prevail.
If a section in the Document is Entitled ``Acknowledgements'',
``Dedications'', or ``History'', the requirement (section 4) to Preserve
its Title (section 1) will typically require changing the actual
title.
@item
TERMINATION
You may not copy, modify, sublicense, or distribute the Document except
as expressly provided for under this License. Any other attempt to
copy, modify, sublicense or distribute the Document is void, and will
automatically terminate your rights under this License. However,
parties who have received copies, or rights, from you under this
License will not have their licenses terminated so long as such
parties remain in full compliance.
@item
FUTURE REVISIONS OF THIS LICENSE
The Free Software Foundation may publish new, revised versions
of the GNU Free Documentation License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns. See
@uref{http://www.gnu.org/copyleft/}.
Each version of the License is given a distinguishing version number.
If the Document specifies that a particular numbered version of this
License ``or any later version'' applies to it, you have the option of
following the terms and conditions either of that specified version or
of any later version that has been published (not as a draft) by the
Free Software Foundation. If the Document does not specify a version
number of this License, you may choose any version ever published (not
as a draft) by the Free Software Foundation.
@end enumerate
@page
@appendixsubsec ADDENDUM: How to use this License for your documents
To use this License in a document you have written, include a copy of
the License in the document and put the following copyright and
license notices just after the title page:
@smallexample
@group
Copyright (C) @var{year} @var{your name}.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled ``GNU
Free Documentation License''.
@end group
@end smallexample
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
replace the ``with...Texts.'' line with this:
@smallexample
@group
with the Invariant Sections being @var{list their titles}, with
the Front-Cover Texts being @var{list}, and with the Back-Cover Texts
being @var{list}.
@end group
@end smallexample
If you have Invariant Sections without Cover Texts, or some other
combination of the three, merge those two alternatives to suit the
situation.
If your document contains nontrivial examples of program code, we
recommend releasing these examples in parallel under your choice of
free software license, such as the GNU General Public License,
to permit their use in free software.
@c Local Variables:
@c ispell-local-pdict: "ispell-dict"
@c End:
+397
View File
@@ -0,0 +1,397 @@
GNU Free Documentation License
Version 1.2, November 2002
Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
0. PREAMBLE
The purpose of this License is to make a manual, textbook, or other
functional and useful document "free" in the sense of freedom: to
assure everyone the effective freedom to copy and redistribute it,
with or without modifying it, either commercially or noncommercially.
Secondarily, this License preserves for the author and publisher a way
to get credit for their work, while not being considered responsible
for modifications made by others.
This License is a kind of "copyleft", which means that derivative
works of the document must themselves be free in the same sense. It
complements the GNU General Public License, which is a copyleft
license designed for free software.
We have designed this License in order to use it for manuals for free
software, because free software needs free documentation: a free
program should come with manuals providing the same freedoms that the
software does. But this License is not limited to software manuals;
it can be used for any textual work, regardless of subject matter or
whether it is published as a printed book. We recommend this License
principally for works whose purpose is instruction or reference.
1. APPLICABILITY AND DEFINITIONS
This License applies to any manual or other work, in any medium, that
contains a notice placed by the copyright holder saying it can be
distributed under the terms of this License. Such a notice grants a
world-wide, royalty-free license, unlimited in duration, to use that
work under the conditions stated herein. The "Document", below,
refers to any such manual or work. Any member of the public is a
licensee, and is addressed as "you". You accept the license if you
copy, modify or distribute the work in a way requiring permission
under copyright law.
A "Modified Version" of the Document means any work containing the
Document or a portion of it, either copied verbatim, or with
modifications and/or translated into another language.
A "Secondary Section" is a named appendix or a front-matter section of
the Document that deals exclusively with the relationship of the
publishers or authors of the Document to the Document's overall subject
(or to related matters) and contains nothing that could fall directly
within that overall subject. (Thus, if the Document is in part a
textbook of mathematics, a Secondary Section may not explain any
mathematics.) The relationship could be a matter of historical
connection with the subject or with related matters, or of legal,
commercial, philosophical, ethical or political position regarding
them.
The "Invariant Sections" are certain Secondary Sections whose titles
are designated, as being those of Invariant Sections, in the notice
that says that the Document is released under this License. If a
section does not fit the above definition of Secondary then it is not
allowed to be designated as Invariant. The Document may contain zero
Invariant Sections. If the Document does not identify any Invariant
Sections then there are none.
The "Cover Texts" are certain short passages of text that are listed,
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
the Document is released under this License. A Front-Cover Text may
be at most 5 words, and a Back-Cover Text may be at most 25 words.
A "Transparent" copy of the Document means a machine-readable copy,
represented in a format whose specification is available to the
general public, that is suitable for revising the document
straightforwardly with generic text editors or (for images composed of
pixels) generic paint programs or (for drawings) some widely available
drawing editor, and that is suitable for input to text formatters or
for automatic translation to a variety of formats suitable for input
to text formatters. A copy made in an otherwise Transparent file
format whose markup, or absence of markup, has been arranged to thwart
or discourage subsequent modification by readers is not Transparent.
An image format is not Transparent if used for any substantial amount
of text. A copy that is not "Transparent" is called "Opaque".
Examples of suitable formats for Transparent copies include plain
ASCII without markup, Texinfo input format, LaTeX input format, SGML
or XML using a publicly available DTD, and standard-conforming simple
HTML, PostScript or PDF designed for human modification. Examples of
transparent image formats include PNG, XCF and JPG. Opaque formats
include proprietary formats that can be read and edited only by
proprietary word processors, SGML or XML for which the DTD and/or
processing tools are not generally available, and the
machine-generated HTML, PostScript or PDF produced by some word
processors for output purposes only.
The "Title Page" means, for a printed book, the title page itself,
plus such following pages as are needed to hold, legibly, the material
this License requires to appear in the title page. For works in
formats which do not have any title page as such, "Title Page" means
the text near the most prominent appearance of the work's title,
preceding the beginning of the body of the text.
A section "Entitled XYZ" means a named subunit of the Document whose
title either is precisely XYZ or contains XYZ in parentheses following
text that translates XYZ in another language. (Here XYZ stands for a
specific section name mentioned below, such as "Acknowledgements",
"Dedications", "Endorsements", or "History".) To "Preserve the Title"
of such a section when you modify the Document means that it remains a
section "Entitled XYZ" according to this definition.
The Document may include Warranty Disclaimers next to the notice which
states that this License applies to the Document. These Warranty
Disclaimers are considered to be included by reference in this
License, but only as regards disclaiming warranties: any other
implication that these Warranty Disclaimers may have is void and has
no effect on the meaning of this License.
2. VERBATIM COPYING
You may copy and distribute the Document in any medium, either
commercially or noncommercially, provided that this License, the
copyright notices, and the license notice saying this License applies
to the Document are reproduced in all copies, and that you add no other
conditions whatsoever to those of this License. You may not use
technical measures to obstruct or control the reading or further
copying of the copies you make or distribute. However, you may accept
compensation in exchange for copies. If you distribute a large enough
number of copies you must also follow the conditions in section 3.
You may also lend copies, under the same conditions stated above, and
you may publicly display copies.
3. COPYING IN QUANTITY
If you publish printed copies (or copies in media that commonly have
printed covers) of the Document, numbering more than 100, and the
Document's license notice requires Cover Texts, you must enclose the
copies in covers that carry, clearly and legibly, all these Cover
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
the back cover. Both covers must also clearly and legibly identify
you as the publisher of these copies. The front cover must present
the full title with all words of the title equally prominent and
visible. You may add other material on the covers in addition.
Copying with changes limited to the covers, as long as they preserve
the title of the Document and satisfy these conditions, can be treated
as verbatim copying in other respects.
If the required texts for either cover are too voluminous to fit
legibly, you should put the first ones listed (as many as fit
reasonably) on the actual cover, and continue the rest onto adjacent
pages.
If you publish or distribute Opaque copies of the Document numbering
more than 100, you must either include a machine-readable Transparent
copy along with each Opaque copy, or state in or with each Opaque copy
a computer-network location from which the general network-using
public has access to download using public-standard network protocols
a complete Transparent copy of the Document, free of added material.
If you use the latter option, you must take reasonably prudent steps,
when you begin distribution of Opaque copies in quantity, to ensure
that this Transparent copy will remain thus accessible at the stated
location until at least one year after the last time you distribute an
Opaque copy (directly or through your agents or retailers) of that
edition to the public.
It is requested, but not required, that you contact the authors of the
Document well before redistributing any large number of copies, to give
them a chance to provide you with an updated version of the Document.
4. MODIFICATIONS
You may copy and distribute a Modified Version of the Document under
the conditions of sections 2 and 3 above, provided that you release
the Modified Version under precisely this License, with the Modified
Version filling the role of the Document, thus licensing distribution
and modification of the Modified Version to whoever possesses a copy
of it. In addition, you must do these things in the Modified Version:
A. Use in the Title Page (and on the covers, if any) a title distinct
from that of the Document, and from those of previous versions
(which should, if there were any, be listed in the History section
of the Document). You may use the same title as a previous version
if the original publisher of that version gives permission.
B. List on the Title Page, as authors, one or more persons or entities
responsible for authorship of the modifications in the Modified
Version, together with at least five of the principal authors of the
Document (all of its principal authors, if it has fewer than five),
unless they release you from this requirement.
C. State on the Title page the name of the publisher of the
Modified Version, as the publisher.
D. Preserve all the copyright notices of the Document.
E. Add an appropriate copyright notice for your modifications
adjacent to the other copyright notices.
F. Include, immediately after the copyright notices, a license notice
giving the public permission to use the Modified Version under the
terms of this License, in the form shown in the Addendum below.
G. Preserve in that license notice the full lists of Invariant Sections
and required Cover Texts given in the Document's license notice.
H. Include an unaltered copy of this License.
I. Preserve the section Entitled "History", Preserve its Title, and add
to it an item stating at least the title, year, new authors, and
publisher of the Modified Version as given on the Title Page. If
there is no section Entitled "History" in the Document, create one
stating the title, year, authors, and publisher of the Document as
given on its Title Page, then add an item describing the Modified
Version as stated in the previous sentence.
J. Preserve the network location, if any, given in the Document for
public access to a Transparent copy of the Document, and likewise
the network locations given in the Document for previous versions
it was based on. These may be placed in the "History" section.
You may omit a network location for a work that was published at
least four years before the Document itself, or if the original
publisher of the version it refers to gives permission.
K. For any section Entitled "Acknowledgements" or "Dedications",
Preserve the Title of the section, and preserve in the section all
the substance and tone of each of the contributor acknowledgements
and/or dedications given therein.
L. Preserve all the Invariant Sections of the Document,
unaltered in their text and in their titles. Section numbers
or the equivalent are not considered part of the section titles.
M. Delete any section Entitled "Endorsements". Such a section
may not be included in the Modified Version.
N. Do not retitle any existing section to be Entitled "Endorsements"
or to conflict in title with any Invariant Section.
O. Preserve any Warranty Disclaimers.
If the Modified Version includes new front-matter sections or
appendices that qualify as Secondary Sections and contain no material
copied from the Document, you may at your option designate some or all
of these sections as invariant. To do this, add their titles to the
list of Invariant Sections in the Modified Version's license notice.
These titles must be distinct from any other section titles.
You may add a section Entitled "Endorsements", provided it contains
nothing but endorsements of your Modified Version by various
parties--for example, statements of peer review or that the text has
been approved by an organization as the authoritative definition of a
standard.
You may add a passage of up to five words as a Front-Cover Text, and a
passage of up to 25 words as a Back-Cover Text, to the end of the list
of Cover Texts in the Modified Version. Only one passage of
Front-Cover Text and one of Back-Cover Text may be added by (or
through arrangements made by) any one entity. If the Document already
includes a cover text for the same cover, previously added by you or
by arrangement made by the same entity you are acting on behalf of,
you may not add another; but you may replace the old one, on explicit
permission from the previous publisher that added the old one.
The author(s) and publisher(s) of the Document do not by this License
give permission to use their names for publicity for or to assert or
imply endorsement of any Modified Version.
5. COMBINING DOCUMENTS
You may combine the Document with other documents released under this
License, under the terms defined in section 4 above for modified
versions, provided that you include in the combination all of the
Invariant Sections of all of the original documents, unmodified, and
list them all as Invariant Sections of your combined work in its
license notice, and that you preserve all their Warranty Disclaimers.
The combined work need only contain one copy of this License, and
multiple identical Invariant Sections may be replaced with a single
copy. If there are multiple Invariant Sections with the same name but
different contents, make the title of each such section unique by
adding at the end of it, in parentheses, the name of the original
author or publisher of that section if known, or else a unique number.
Make the same adjustment to the section titles in the list of
Invariant Sections in the license notice of the combined work.
In the combination, you must combine any sections Entitled "History"
in the various original documents, forming one section Entitled
"History"; likewise combine any sections Entitled "Acknowledgements",
and any sections Entitled "Dedications". You must delete all sections
Entitled "Endorsements".
6. COLLECTIONS OF DOCUMENTS
You may make a collection consisting of the Document and other documents
released under this License, and replace the individual copies of this
License in the various documents with a single copy that is included in
the collection, provided that you follow the rules of this License for
verbatim copying of each of the documents in all other respects.
You may extract a single document from such a collection, and distribute
it individually under this License, provided you insert a copy of this
License into the extracted document, and follow this License in all
other respects regarding verbatim copying of that document.
7. AGGREGATION WITH INDEPENDENT WORKS
A compilation of the Document or its derivatives with other separate
and independent documents or works, in or on a volume of a storage or
distribution medium, is called an "aggregate" if the copyright
resulting from the compilation is not used to limit the legal rights
of the compilation's users beyond what the individual works permit.
When the Document is included an aggregate, this License does not
apply to the other works in the aggregate which are not themselves
derivative works of the Document.
If the Cover Text requirement of section 3 is applicable to these
copies of the Document, then if the Document is less than one half of
the entire aggregate, the Document's Cover Texts may be placed on
covers that bracket the Document within the aggregate, or the
electronic equivalent of covers if the Document is in electronic form.
Otherwise they must appear on printed covers that bracket the whole
aggregate.
8. TRANSLATION
Translation is considered a kind of modification, so you may
distribute translations of the Document under the terms of section 4.
Replacing Invariant Sections with translations requires special
permission from their copyright holders, but you may include
translations of some or all Invariant Sections in addition to the
original versions of these Invariant Sections. You may include a
translation of this License, and all the license notices in the
Document, and any Warranty Disclaimers, provided that you also include
the original English version of this License and the original versions
of those notices and disclaimers. In case of a disagreement between
the translation and the original version of this License or a notice
or disclaimer, the original version will prevail.
If a section in the Document is Entitled "Acknowledgements",
"Dedications", or "History", the requirement (section 4) to Preserve
its Title (section 1) will typically require changing the actual
title.
9. TERMINATION
You may not copy, modify, sublicense, or distribute the Document except
as expressly provided for under this License. Any other attempt to
copy, modify, sublicense or distribute the Document is void, and will
automatically terminate your rights under this License. However,
parties who have received copies, or rights, from you under this
License will not have their licenses terminated so long as such
parties remain in full compliance.
10. FUTURE REVISIONS OF THIS LICENSE
The Free Software Foundation may publish new, revised versions
of the GNU Free Documentation License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns. See
http://www.gnu.org/copyleft/.
Each version of the License is given a distinguishing version number.
If the Document specifies that a particular numbered version of this
License "or any later version" applies to it, you have the option of
following the terms and conditions either of that specified version or
of any later version that has been published (not as a draft) by the
Free Software Foundation. If the Document does not specify a version
number of this License, you may choose any version ever published (not
as a draft) by the Free Software Foundation.
ADDENDUM: How to use this License for your documents
To use this License in a document you have written, include a copy of
the License in the document and put the following copyright and
license notices just after the title page:
Copyright (c) YEAR YOUR NAME.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
replace the "with...Texts." line with this:
with the Invariant Sections being LIST THEIR TITLES, with the
Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
If you have Invariant Sections without Cover Texts, or some other
combination of the three, merge those two alternatives to suit the
situation.
If your document contains nontrivial examples of program code, we
recommend releasing these examples in parallel under your choice of
free software license, such as the GNU General Public License,
to permit their use in free software.
+8
View File
@@ -0,0 +1,8 @@
#! /bin/sh
#
# Some of these should really be done by options to makeinfo or by
# using @setfilename, but this way we can have both bashref.info and
# bash.info (for installing)
#
sed -e 's|bashref.info|bash.info|g'
+1807 -1111
View File
File diff suppressed because it is too large Load Diff
+10
View File
@@ -0,0 +1,10 @@
@ignore
Copyright (C) 1988-2003 Free Software Foundation, Inc.
@end ignore
@set EDITION 3.0
@set VERSION 3.0-alpha
@set UPDATED 12 September 2003
@set UPDATED-MONTH September 2003
@set LASTCHANGE Fri Sep 12 18:21:15 EDT 2003
+27 -15
View File
@@ -40,11 +40,8 @@ extern int errno;
#endif /* !errno */
#include "bashansi.h"
#include "shell.h"
#include "flags.h"
#include "error.h"
#include "command.h"
#include "general.h"
#include "externs.h"
#include "input.h"
#if defined (HISTORY)
@@ -71,20 +68,22 @@ static void error_prolog __P((int));
char *the_current_maintainer = MAINTAINER;
int gnu_error_format = 0;
static void
error_prolog (print_lineno)
int print_lineno;
{
char *ename;
int line;
fprintf (stderr, "%s: ", get_name_for_error ());
ename = get_name_for_error ();
line = (print_lineno && interactive_shell == 0) ? executing_line_number () : -1;
if (print_lineno && interactive_shell == 0)
{
line = executing_line_number ();
if (line > 0)
fprintf (stderr, "line %d: ", line);
}
if (line > 0)
fprintf (stderr, "%s:%s%d: ", ename, gnu_error_format ? "" : " line ", line);
else
fprintf (stderr, "%s: ", ename);
}
/* Return the name of the shell or the shell script for error reporting. */
@@ -92,10 +91,23 @@ char *
get_name_for_error ()
{
char *name;
#if defined (ARRAY_VARS)
SHELL_VAR *bash_source_v;
ARRAY *bash_source_a;
#endif
name = (char *)NULL;
if (interactive_shell == 0)
name = dollar_vars[0];
{
#if defined (ARRAY_VARS)
bash_source_v = find_variable ("BASH_SOURCE");
if (bash_source_v && array_p (bash_source_v) &&
(bash_source_a = array_cell (bash_source_v)))
name = array_reference (bash_source_a, 0);
if (name == 0)
#endif
name = dollar_vars[0];
}
if (name == 0 && shell_name && *shell_name)
name = base_pathname (shell_name);
if (name == 0)
@@ -299,11 +311,11 @@ parser_error (lineno, format, va_alist)
if (interactive)
fprintf (stderr, "%s: ", ename);
else if (interactive_shell)
fprintf (stderr, "%s: %s: line %d: ", ename, iname, lineno);
fprintf (stderr, "%s: %s:%s%d: ", ename, iname, gnu_error_format ? "" : " line ", lineno);
else if (STREQ (ename, iname))
fprintf (stderr, "%s: line %d: ", ename, lineno);
fprintf (stderr, "%s:%s%d: ", ename, gnu_error_format ? "" : " line ", lineno);
else
fprintf (stderr, "%s: %s: line %d: ", ename, iname, lineno);
fprintf (stderr, "%s: %s:%s%d: ", ename, iname, gnu_error_format ? "" : " line ", lineno);
SH_VA_START (args, format);
+2
View File
@@ -88,6 +88,7 @@ reader_loop ()
{
/* Some kind of throw to top_level has occured. */
case FORCE_EOF:
case ERREXIT:
case EXITPROG:
current_command = (COMMAND *)NULL;
if (exit_immediately_on_error)
@@ -170,6 +171,7 @@ alrm_catcher(i)
int i;
{
printf ("\007timed out waiting for input: auto-logout\n");
bash_logout (); /* run ~/.bash_logout if this is a login shell */
jump_to_top_level (EXITPROG);
SIGRETURN (0);
}
Binary file not shown.
+1 -2
View File
@@ -63,7 +63,7 @@ function coprocess ()
shift
local old_trap=$(trap -p SIGPIPE)
trap 'coprocess close -SIGPIPE' SIGPIPE
if [ $# -eq 1 -a "$1" = "--stdin" ] ; then
if [ $# -eq 1 ] && [ "$1" = "--stdin" ] ; then
cat >&61
else
echo "$@" >&61
@@ -106,4 +106,3 @@ function coprocess ()
coprocess status
return $?
}
+7 -6
View File
@@ -33,15 +33,16 @@ function alias ()
then
declare -f $1
else
echo $2 | egrep -s '(\!|#)' 2>/dev/null
if [ $? -eq 0 ]
then
case $2 in
*[#\!]*)
comm=$(echo $2 | sed 's/\\!\*/\"$\@\"/g
s/\\!:\([1-9]\)/\"$\1\"/g
s/#/\\#/g')
else
comm="$2 \"\$@\""
fi
;;
*)
comm="$2 \"\$@\"" ;;
esac
eval function $1 \(\) "{" command "$comm" "; }"
fi
}
+1 -1
View File
@@ -8,7 +8,7 @@ function check_exit_status ()
local status="$?"
local signal=""
if [ ${status} -ne 0 -a ${status} != 128 ]; then
if [ ${status} -ne 0 ] && [ ${status} != 128 ]; then
# If process exited by a signal, determine name of signal.
if [ ${status} -gt 128 ]; then
signal="$(builtin kill -l $((${status} - 128)) 2>/dev/null)"
+1 -2
View File
@@ -134,7 +134,7 @@ function getoptex()
let OPTIND || OPTIND=1
[ $OPTIND -lt $# ] || return 1
shift $OPTIND
if [ "$1" != "-" -a "$1" != "${1#-}" ]
if [ "$1" != "-" ] && [ "$1" != "${1#-}" ]
then OPTIND=$[OPTIND+1]; if [ "$1" != "--" ]
then
local o
@@ -299,4 +299,3 @@ function getopt()
#**************************************
#*** (end of getopt2) ***
+1 -1
View File
@@ -207,7 +207,7 @@ substring ()
;;
esac
# test for too few or too many arguments
if [ x"$1" = x -o $# -gt 2 ]; then
if [ x"$1" = x ] || [ $# -gt 2 ]; then
print -u2 'substring: bad argument count'
return 1
fi
+2 -2
View File
@@ -70,7 +70,7 @@ function whatis ()
function apropos ()
{
whatis_internal "$1" "fgrep"
whatis_internal "$1" "grep -F"
}
# Note: "-" and "-t" together not supported. This man could be
@@ -102,7 +102,7 @@ function man ()
g="grep -w"
a=$(basename "$2")
else
g=fgrep
g="grep -F"
a="$2"
fi
whatis_internal "$a" "$g"
+3 -4
View File
@@ -44,15 +44,15 @@ function recurse
if cd "$1" ; then
for file in $2; do
if [ -f "$file" -o -d "$file" ]; then
if [ -f "$file" ] || [ -d "$file" ]; then
eval "$3"
fi
done
for file in .* * ; do
if [ "$file" = "." -o "$file" = ".." ] ; then
if [ "$file" = "." ] || [ "$file" = ".." ] ; then
continue
fi
if [ -d "$file" -a ! -L "$file" ]; then
if [ -d "$file" ] && [ ! -L "$file" ]; then
recurse "$file" "$2" "$3" "$path"
fi
done
@@ -61,4 +61,3 @@ function recurse
}
recurse "$1" "$2" 'echo "$path$file"'
+1 -1
View File
@@ -30,7 +30,7 @@ substr()
;;
esac
if [ "$#" -eq 0 -o "$#" -gt 2 ] ; then
if [ "$#" -eq 0 ] || [ "$#" -gt 2 ] ; then
echo "substr: bad argument count"
return 2
fi
+1 -1
View File
@@ -32,7 +32,7 @@ substr()
shift $[ $OPTIND -1 ]
fi
if [ "$#" -eq 0 -o "$#" -gt 2 ] ; then
if [ "$#" -eq 0 ] || [ "$#" -gt 2 ] ; then
echo "substr: bad argument count"
return 2
fi
+7 -6
View File
@@ -7,15 +7,16 @@ function xalias ()
then
declare -f $1
else
echo $2 | egrep -q '(\!|#)'
if [ $? -eq 0 ]
then
case $2 in
*[#\!]*)
comm=$(echo $2 | sed 's/\\!\*/\"$\@\"/g
s/\\!:\([1-9]\)/\"$\1\"/g
s/#/\\#/g')
else
comm="$2 \"\$@\""
fi
;;
*)
comm="$2 \"\$@\"" ;;
esac
eval function $1 \(\) "{" command "$comm" "; }"
fi
}
+1 -1
View File
@@ -39,7 +39,7 @@ xfind()
# and directories that start with a period.
for x in * ; do
if [ -d "$x" -a ! -L "$x" ] ; then
if [ -d "$x" ] && [ ! -L "$x" ] ; then
$FUNCNAME "$x" "$2" "$action"
fi
done
+5 -1
View File
@@ -72,7 +72,7 @@ INC = -I. -I.. -I$(topdir) -I$(topdir)/lib -I$(topdir)/builtins \
ALLPROG = print truefalse sleep pushd finfo logname basename dirname \
tty pathchk tee head mkdir rmdir printenv id whoami \
uname sync push ln unlink cut realpath getconf
uname sync push ln unlink cut realpath getconf strftime
OTHERPROG = necho hello cat
all: $(SHOBJ_STATUS)
@@ -172,6 +172,9 @@ cut: cut.o
realpath: realpath.o
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ realpath.o $(SHOBJ_LIBS)
strftime: strftime.o
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ strftime.o $(SHOBJ_LIBS)
# pushd is a special case. We use the same source that the builtin version
# uses, with special compilation options.
#
@@ -221,3 +224,4 @@ sync.o: sync.c
push.o: push.c
mkdir.o: mkdir.c
realpath.o: realpath.c
strftime.o: strftime.c
+298 -24
View File
@@ -78,7 +78,7 @@ extern int errno;
struct conf_variable
{
const char *name;
enum { SYSCONF, CONFSTR, PATHCONF, CONSTANT, G_UNDEF } type;
enum { SYSCONF, CONFSTR, PATHCONF, CONSTANT, LLCONST, G_UNDEF } type;
long value;
};
@@ -94,6 +94,11 @@ static long sysconf __P((int));
static long pathconf __P((const char *, int));
#endif
/* Hack to `encode' values wider than long into a conf_variable */
#define VAL_LLONG_MIN -1000
#define VAL_LLONG_MAX -1001
#define VAL_ULLONG_MAX -1002
static const struct conf_variable conf_table[] =
{
/* POSIX.2 Configurable Variable Values */
@@ -169,6 +174,8 @@ static const struct conf_variable conf_table[] =
{ "POSIX_V6_ILP32_OFF32_CFLAGS", CONFSTR, _CS_POSIX_V6_ILP32_OFF32_CFLAGS },
{ "POSIX_V6_ILP32_OFF32_LDFLAGS", CONFSTR, _CS_POSIX_V6_ILP32_OFF32_LDFLAGS },
{ "POSIX_V6_ILP32_OFF32_LIBS", CONFSTR, _CS_POSIX_V6_ILP32_OFF32_LIBS },
#endif
#if defined (_CS_POSIX_V6_ILP32_OFF32_LINTFLAGS)
{ "POSIX_V6_ILP32_OFF32_LINTFLAGS", CONFSTR, _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS },
#endif
#if defined (_SC_POSIX_V6_ILP32_OFFBIG)
@@ -178,6 +185,8 @@ static const struct conf_variable conf_table[] =
{ "POSIX_V6_ILP32_OFFBIG_CFLAGS", CONFSTR, _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS },
{ "POSIX_V6_ILP32_OFFBIG_LDFLAGS", CONFSTR, _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS },
{ "POSIX_V6_ILP32_OFFBIG_LIBS", CONFSTR, _CS_POSIX_V6_ILP32_OFFBIG_LIBS },
#endif
#if defined (_CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS)
{ "POSIX_V6_ILP32_OFFBIG_LINTFLAGS", CONFSTR, _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS },
#endif
#if defined (_SC_POSIX_V6_LP64_OFF64)
@@ -187,6 +196,8 @@ static const struct conf_variable conf_table[] =
{ "POSIX_V6_LP64_OFF64_CFLAGS", CONFSTR, _CS_POSIX_V6_LP64_OFF64_CFLAGS },
{ "POSIX_V6_LP64_OFF64_LDFLAGS", CONFSTR, _CS_POSIX_V6_LP64_OFF64_LDFLAGS },
{ "POSIX_V6_LP64_OFF64_LIBS", CONFSTR, _CS_POSIX_V6_LP64_OFF64_LIBS },
#endif
#if defined (CS_POSIX_V6_LP64_OFF64_LINTFLAGS)
{ "POSIX_V6_LP64_OFF64_LINTFLAGS", CONFSTR, _CS_POSIX_V6_LP64_OFF64_LINTFLAGS },
#endif
#if defined (_SC_POSIX_V6_LPBIG_OFFBIG)
@@ -196,9 +207,15 @@ static const struct conf_variable conf_table[] =
{ "POSIX_V6_LPBIG_OFFBIG_CFLAGS", CONFSTR, _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS },
{ "POSIX_V6_LPBIG_OFFBIG_LDFLAGS", CONFSTR, _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS },
{ "POSIX_V6_LPBIG_OFFBIG_LIBS", CONFSTR, _CS_POSIX_V6_LPBIG_OFFBIG_LIBS },
#endif
#if defined (_CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS)
{ "POSIX_V6_LPBIG_OFFBIG_LINTFLAGS", CONFSTR, _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS },
#endif
#if defined (_CS_POSIX_V6_WIDTH_RESTRICTED_ENVS)
{ "POSIX_6_WIDTH_RESTRICTED_ENVS", CONFSTR, _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS },
#endif
/* POSIX.2 Utility Limit Minimum Values */
#ifdef _POSIX2_BC_BASE_MAX
{ "POSIX2_BC_BASE_MAX", CONSTANT, _POSIX2_BC_BASE_MAX },
@@ -220,6 +237,11 @@ static const struct conf_variable conf_table[] =
#else
{ "POSIX2_BC_STRING_MAX", G_UNDEF, -1 },
#endif
#ifdef _POSIX2_CHARCLASS_NAME_MAX
{ "POSIX2_CHARCLASS_NAME_MAX", CONSTANT, _POSIX2_CHARCLASS_NAME_MAX },
#else
{ "POSIX2_CHARCLASS_NAME_MAX", G_UNDEF, -1 },
#endif
#ifdef _POSIX2_COLL_WEIGHTS_MAX
{ "POSIX2_COLL_WEIGHTS_MAX", CONSTANT, _POSIX2_COLL_WEIGHTS_MAX },
#else
@@ -251,7 +273,83 @@ static const struct conf_variable conf_table[] =
# endif
#endif
#ifdef _POSIX2_BC_BASE_MAX
{ "_POSIX2_BC_BASE_MAX", CONSTANT, _POSIX2_BC_BASE_MAX },
#else
{ "_POSIX2_BC_BASE_MAX", G_UNDEF, -1 },
#endif
#ifdef _POSIX2_BC_DIM_MAX
{ "_POSIX2_BC_DIM_MAX", CONSTANT, _POSIX2_BC_DIM_MAX },
#else
{ "_POSIX2_BC_DIM_MAX", G_UNDEF, -1 },
#endif
#ifdef _POSIX2_BC_SCALE_MAX
{ "_POSIX2_BC_SCALE_MAX", CONSTANT, _POSIX2_BC_SCALE_MAX },
#else
{ "_POSIX2_BC_SCALE_MAX", G_UNDEF, -1 },
#endif
#ifdef _POSIX2_BC_STRING_MAX
{ "_POSIX2_BC_STRING_MAX", CONSTANT, _POSIX2_BC_STRING_MAX },
#else
{ "_POSIX2_BC_STRING_MAX", G_UNDEF, -1 },
#endif
#ifdef _POSIX2_CHARCLASS_NAME_MAX
{ "_POSIX2_CHARCLASS_NAME_MAX", CONSTANT, _POSIX2_CHARCLASS_NAME_MAX },
#else
{ "_POSIX2_CHARCLASS_NAME_MAX", G_UNDEF, -1 },
#endif
#ifdef _POSIX2_COLL_WEIGHTS_MAX
{ "_POSIX2_COLL_WEIGHTS_MAX", CONSTANT, _POSIX2_COLL_WEIGHTS_MAX },
#else
{ "_POSIX2_COLL_WEIGHTS_MAX", G_UNDEF, -1 },
#endif
#if defined (_POSIX2_EQUIV_CLASS_MAX)
{ "POSIX2_EQUIV_CLASS_MAX", CONSTANT, _POSIX2_EQUIV_CLASS_MAX },
#endif
#ifdef _POSIX2_EXPR_NEST_MAX
{ "_POSIX2_EXPR_NEST_MAX", CONSTANT, _POSIX2_EXPR_NEST_MAX },
#else
{ "_POSIX2_EXPR_NEST_MAX", G_UNDEF, -1 },
#endif
#ifdef _POSIX2_LINE_MAX
{ "_POSIX2_LINE_MAX", CONSTANT, _POSIX2_LINE_MAX },
#else
{ "_POSIX2_LINE_MAX", G_UNDEF, -1 },
#endif
#ifdef _POSIX2_RE_DUP_MAX
{ "_POSIX2_RE_DUP_MAX", CONSTANT, _POSIX2_RE_DUP_MAX },
#else
{ "_POSIX2_RE_DUP_MAX", G_UNDEF, -1 },
#endif
/* X/OPEN Maxmimum Values */
#ifdef _XOPEN_IOV_MAX
{ "_XOPEN_IOV_MAX", CONSTANT, _XOPEN_IOV_MAX },
#else
{ "_XOPEN_IOV_MAX", G_UNDEF, -1 },
#endif
#ifdef _XOPEN_NAME_MAX
{ "_XOPEN_NAME_MAX", CONSTANT, _XOPEN_NAME_MAX },
#else
{ "_XOPEN_NAME_MAX", G_UNDEF, -1 },
#endif
#ifdef _XOPEN_PATH_MAX
{ "_XOPEN_PATH_MAX", CONSTANT, _XOPEN_PATH_MAX },
#else
{ "_XOPEN_PATH_MAX", G_UNDEF, -1 },
#endif
/* POSIX.1 Minimum Values */
#ifdef _POSIX_AIO_LISTIO_MAX
{ "_POSIX_AIO_LISTIO_MAX", CONSTANT, _POSIX_AIO_LISTIO_MAX },
#else
{ "_POSIX_AIO_LISTIO_MAX", G_UNDEF, -1 },
#endif
#ifdef _POSIX_AIO_MAX
{ "_POSIX_AIO_MAX", CONSTANT, _POSIX_AIO_MAX },
#else
{ "_POSIX_AIO_MAX", G_UNDEF, -1 },
#endif
#ifdef _POSIX_ARG_MAX
{ "_POSIX_ARG_MAX", CONSTANT, _POSIX_ARG_MAX },
#else
@@ -260,13 +358,28 @@ static const struct conf_variable conf_table[] =
#ifdef _POSIX_CHILD_MAX
{ "_POSIX_CHILD_MAX", CONSTANT, _POSIX_CHILD_MAX },
#else
{ "_POSIX_CHILD_MAX", G_UNDEF, -1 },
{ "_POSIX_CHILD_MAX", G_UNDEF, -1 },
#endif
#ifdef _POSIX_DELAYTIMER_MAX
{ "_POSIX_DELAYTIMER_MAX", CONSTANT, _POSIX_DELAYTIMER_MAX },
#else
{ "_POSIX_DELAYTIMER_MAX", G_UNDEF, -1 },
#endif
#ifdef _POSIX_HOST_NAME_MAX
{ "_POSIX_HOST_NAME_MAX", CONSTANT, _POSIX_HOST_NAME_MAX },
#else
{ "_POSIX_HOST_NAME_MAX", G_UNDEF, -1 },
#endif
#ifdef _POSIX_LINK_MAX
{ "_POSIX_LINK_MAX", CONSTANT, _POSIX_LINK_MAX },
#else
{ "_POSIX_LINK_MAX", G_UNDEF, -1 },
#endif
#ifdef _POSIX_LOGIN_NAME_MAX
{ "_POSIX_LOGIN_NAME_MAX", CONSTANT, _POSIX_LOGIN_NAME_MAX },
#else
{ "_POSIX_LOGIN_NAME_MAX", G_UNDEF, -1 },
#endif
#ifdef _POSIX_MAX_CANON
{ "_POSIX_MAX_CANON", CONSTANT, _POSIX_MAX_CANON },
#else
@@ -277,6 +390,16 @@ static const struct conf_variable conf_table[] =
#else
{ "_POSIX_MAX_INPUT", G_UNDEF, -1 },
#endif
#ifdef _POSIX_MQ_OPEN_MAX
{ "_POSIX_MQ_OPEN_MAX", CONSTANT, _POSIX_MQ_OPEN_MAX },
#else
{ "_POSIX_MQ_OPEN_MAX", G_UNDEF, -1 },
#endif
#ifdef _POSIX_MQ_PRIO_MAX
{ "_POSIX_MQ_PRIO_MAX", CONSTANT, _POSIX_MQ_PRIO_MAX },
#else
{ "_POSIX_MQ_PRIO_MAX", G_UNDEF, -1 },
#endif
#ifdef _POSIX_NAME_MAX
{ "_POSIX_NAME_MAX", CONSTANT, _POSIX_NAME_MAX },
#else
@@ -302,20 +425,129 @@ static const struct conf_variable conf_table[] =
#else
{ "_POSIX_PIPE_BUF", G_UNDEF, -1 },
#endif
#ifdef _POSIX_RE_DUP_MAX
{ "_POSIX_RE_DUP_MAX", CONSTANT, _POSIX_RE_DUP_MAX },
#else
{ "_POSIX_RE_DUP_MAX", G_UNDEF, -1 },
#endif
#ifdef _POSIX_RTSIG_MAX
{ "_POSIX_RTSIG_MAX", CONSTANT, _POSIX_RTSIG_MAX },
#else
{ "_POSIX_RTSIG_MAX", G_UNDEF, -1 },
#endif
#ifdef _POSIX_SEM_NSEMS_MAX
{ "_POSIX_SEM_NSEMS_MAX", CONSTANT, _POSIX_SEM_NSEMS_MAX },
#else
{ "_POSIX_SEM_NSEMS_MAX", G_UNDEF, -1 },
#endif
#ifdef _POSIX_SEM_VALUE_MAX
{ "_POSIX_SEM_VALUE_MAX", CONSTANT, _POSIX_SEM_VALUE_MAX },
#else
{ "_POSIX_SEM_VALUE_MAX", G_UNDEF, -1 },
#endif
#ifdef _POSIX_SIGQUEUE_MAX
{ "_POSIX_SIGQUEUE_MAX", CONSTANT, _POSIX_SIGQUEUE_MAX },
#else
{ "_POSIX_SIGQUEUE_MAX", G_UNDEF, -1 },
#endif
#ifdef _POSIX_SSIZE_MAX
{ "_POSIX_SSIZE_MAX", CONSTANT, _POSIX_SSIZE_MAX },
#else
{ "_POSIX_SSIZE_MAX", G_UNDEF, -1 },
#endif
#ifdef _POSIX_SS_REPL_MAX
{ "_POSIX_SS_REPL_MAX", CONSTANT, _POSIX_SS_REPL_MAX },
#else
{ "_POSIX_SS_REPL_MAX", G_UNDEF, -1 },
#endif
#ifdef _POSIX_STREAM_MAX
{ "_POSIX_STREAM_MAX", CONSTANT, _POSIX_STREAM_MAX },
#else
{ "_POSIX_STREAM_MAX", G_UNDEF, -1 },
#endif
#ifdef _POSIX_SYMLINK_MAX
{ "_POSIX_SYMLINK_MAX", CONSTANT, _POSIX_SYMLINK_MAX },
#else
{ "_POSIX_SYMLINK_MAX", G_UNDEF, -1 },
#endif
#ifdef _POSIX_SYMLOOP_MAX
{ "_POSIX_SYMLOOP_MAX", CONSTANT, _POSIX_SYMLOOP_MAX },
#else
{ "_POSIX_SYMLOOP_MAX", G_UNDEF, -1 },
#endif
#ifdef _POSIX_THREAD_DESTRUCTOR_ITERATIONS
{ "_POSIX_THREAD_DESTRUCTOR_ITERATIONS", CONSTANT, _POSIX_THREAD_DESTRUCTOR_ITERATIONS },
#else
{ "_POSIX_THREAD_DESTRUCTOR_ITERATIONS", G_UNDEF, -1 },
#endif
#ifdef _POSIX_THREAD_KEYS_MAX
{ "_POSIX_THREAD_KEYS_MAX", CONSTANT, _POSIX_THREAD_KEYS_MAX },
#else
{ "_POSIX_THREAD_KEYS_MAX", G_UNDEF, -1 },
#endif
#ifdef _POSIX_THREAD_THREADS_MAX
{ "_POSIX_THREAD_THREADS_MAX",CONSTANT, _POSIX_THREAD_THREADS_MAX },
#else
{ "_POSIX_THREAD_THREADS_MAX",G_UNDEF, -1 },
#endif
#ifdef _POSIX_TIMER_MAX
{ "_POSIX_TIMER_MAX", CONSTANT, _POSIX_TIMER_MAX },
#else
{ "_POSIX_TIMER_MAX", G_UNDEF, -1 },
#endif
#ifdef _POSIX_TRACE_EVENT_NAME_MAX
{ "_POSIX_TRACE_EVENT_NAME_MAX", CONSTANT, _POSIX_TRACE_EVENT_NAME_MAX },
#else
{ "_POSIX_TRACE_EVENT_NAME_MAX", G_UNDEF, -1 },
#endif
#ifdef _POSIX_TRACE_NAME_MAX
{ "_POSIX_TRACE_NAME_MAX", CONSTANT, _POSIX_TRACE_NAME_MAX },
#else
{ "_POSIX_TRACE_NAME_MAX", G_UNDEF, -1 },
#endif
#ifdef _POSIX_TRACE_SYS_MAX
{ "_POSIX_TRACE_SYS_MAX", CONSTANT, _POSIX_TRACE_SYS_MAX },
#else
{ "_POSIX_TRACE_SYS_MAX", G_UNDEF, -1 },
#endif
#ifdef _POSIX_TRACE_USER_EVENT_MAX
{ "_POSIX_TRACE_USER_EVENT_MAX", CONSTANT, _POSIX_TRACE_USER_EVENT_MAX },
#else
{ "_POSIX_TRACE_USER_EVENT_MAX", G_UNDEF, -1 },
#endif
#ifdef _POSIX_TTY_NAME_MAX
{ "_POSIX_TTY_NAME_MAX", CONSTANT, _POSIX_TTY_NAME_MAX },
#else
{ "_POSIX_TTY_NAME_MAX", G_UNDEF, -1 },
#endif
#ifdef _POSIX_TZNAME_MAX
{ "_POSIX_TZNAME_MAX", CONSTANT, _POSIX_TZNAME_MAX },
#else
{ "_POSIX_TZNAME_MAX", G_UNDEF, -1 },
{ "_POSIX_TZNAME_MAX", G_UNDEF, -1 },
#endif
/* POSIX.1 Maximum Values */
#ifdef _POSIX_CLOCKRES_MIN
{ "_POSIX_CLOCKRES_MIN", CONSTANT, _POSIX_CLOCKRES_MIN },
#else
{ "_POSIX_CLOCKRES_MIN", G_UNDEF, -1 },
#endif
/* POSIX.1-2001/XPG6 (and later) Runtime Invariants from <limits.h> */
#ifdef _SC_SS_REPL_MAX
{ "SS_REPL_MAX", SYSCONF, _SC_SS_REPL_MAX },
#endif
#ifdef _SC_TRACE_EVENT_NAME_MAX
{ "TRACE_EVENT_NAME_MAX", SYSCONF, _SC_TRACE_EVENT_NAME_MAX },
#endif
#ifdef _SC_TRACE_NAME_MAX
{ "TRACE_NAME_MAX", SYSCONF, _SC_TRACE_NAME_MAX },
#endif
#ifdef _SC_TRACE_SYS_MAX
{ "TRACE_SYS_MAX", SYSCONF, _SC_TRACE_SYS_MAX },
#endif
#ifdef _SC_TRACE_USER_EVENT_MAX
{ "TRACE_USER_EVENT_MAX", SYSCONF, _SC_TRACE_USER_EVENT_MAX },
#endif
/* POSIX.2/XPG 4.2 (and later) Symbolic Utility Limits */
@@ -361,55 +593,58 @@ static const struct conf_variable conf_table[] =
#ifdef NL_TEXTMAX
{ "NL_TEXTMAX", CONSTANT, NL_TEXTMAX },
#endif
#ifdef _SC_RAW_SOCKET
{ "RAW_SOCKET", SYSCONF, _SC_RAW_SOCKET },
#endif
#ifdef _SC_RE_DUP_MAX
{ "RE_DUP_MAX", SYSCONF, _SC_RE_DUP_MAX },
#endif
/* POSIX.2 Optional Facility Configuration Values */
#ifdef _SC_2_C_BIND
{ "_POSIX2_C_BIND", SYSCONF, _SC_2_C_BIND },
{ "POSIX2_C_BIND", SYSCONF, _SC_2_C_BIND },
#else
{ "_POSIX2_C_BIND", G_UNDEF, -1 },
{ "POSIX2_C_BIND", G_UNDEF, -1 },
#endif
#ifdef _SC_2_C_DEV
{ "_POSIX2_C_DEV", SYSCONF, _SC_2_C_DEV },
{ "POSIX2_C_DEV", SYSCONF, _SC_2_C_DEV },
#else
{ "_POSIX2_C_DEV", G_UNDEF, -1 },
{ "POSIX2_C_DEV", G_UNDEF, -1 },
#endif
#if defined (_SC_2_C_VERSION)
{ "_POSIX2_C_VERSION", SYSCONF, _SC_2_C_VERSION },
{ "POSIX2_C_VERSION", SYSCONF, _SC_2_C_VERSION },
#else
{ "_POSIX2_C_VERSION", G_UNDEF, -1 },
{ "POSIX2_C_VERSION", G_UNDEF, -1 },
#endif
#if defined (_SC_2_CHAR_TERM)
{ "_POSIX2_CHAR_TERM", SYSCONF, _SC_2_CHAR_TERM },
{ "POSIX2_CHAR_TERM", SYSCONF, _SC_2_CHAR_TERM },
#else
{ "_POSIX2_CHAR_TERM", G_UNDEF, -1 },
{ "POSIX2_CHAR_TERM", G_UNDEF, -1 },
#endif
#ifdef _SC_2_FORT_DEV
{ "_POSIX2_FORT_DEV", SYSCONF, _SC_2_FORT_DEV },
{ "POSIX2_FORT_DEV", SYSCONF, _SC_2_FORT_DEV },
#else
{ "_POSIX2_FORT_DEV", G_UNDEF, -1 },
{ "POSIX2_FORT_DEV", G_UNDEF, -1 },
#endif
#ifdef _SC_2_FORT_RUN
{ "_POSIX2_FORT_RUN", SYSCONF, _SC_2_FORT_RUN },
{ "POSIX2_FORT_RUN", SYSCONF, _SC_2_FORT_RUN },
#else
{ "_POSIX2_FORT_RUN", G_UNDEF, -1 },
{ "POSIX2_FORT_RUN", G_UNDEF, -1 },
#endif
#ifdef _SC_2_LOCALEDEF
{ "_POSIX2_LOCALEDEF", SYSCONF, _SC_2_LOCALEDEF },
{ "POSIX2_LOCALEDEF", SYSCONF, _SC_2_LOCALEDEF },
#else
{ "_POSIX2_LOCALEDEF", G_UNDEF, -1 },
{ "POSIX2_LOCALEDEF", G_UNDEF, -1 },
#endif
#ifdef _SC_2_SW_DEV
{ "_POSIX2_SW_DEV", SYSCONF, _SC_2_SW_DEV },
{ "POSIX2_SW_DEV", SYSCONF, _SC_2_SW_DEV },
#else
{ "_POSIX2_SW_DEV", G_UNDEF, -1 },
{ "POSIX2_SW_DEV", G_UNDEF, -1 },
#endif
#if defined (_SC2_UPE)
{ "_POSIX2_UPE", SYSCONF, _SC_2_UPE },
{ "POSIX2_UPE", SYSCONF, _SC_2_UPE },
#else
{ "_POSIX2_UPE", G_UNDEF, -1 },
{ "POSIX2_UPE", G_UNDEF, -1 },
#endif
#if !defined (_POSIX2_VERSION) && defined (_SC_2_VERSION)
{ "_POSIX2_VERSION", SYSCONF, _SC_2_VERSION },
@@ -418,13 +653,18 @@ static const struct conf_variable conf_table[] =
#endif
#if defined (_SC_REGEX_VERSION)
{ "REGEX_VERSION", SYSCONF, _SC_REGEX_VERSION },
{ "_REGEX_VERSION", SYSCONF, _SC_REGEX_VERSION },
#else
{ "REGEX_VERSION", G_UNDEF, -1 },
{ "_REGEX_VERSION", G_UNDEF, -1 },
#endif
#if defined (_SC_2_PBS)
{ "_POSIX2_PBS", SYSCONF, _SC_2_PBS },
{ "_POSIX2_PBS_ACCOUNTING", SYSCONF, _SC_2_PBS_ACCOUNTING },
# if defined (_SC_2_PBS_CHECKPOINT)
{ "_POSIX2_PBS_CHECKPOINT", SYSCONF, _SC_2_PBS_CHECKPOINT },
# endif
{ "_POSIX2_PBS_LOCATE", SYSCONF, _SC_2_PBS_LOCATE },
{ "_POSIX2_PBS_MESSAGE", SYSCONF, _SC_2_PBS_MESSAGE },
{ "_POSIX2_PBS_TRACK", SYSCONF, _SC_2_PBS_TRACK },
@@ -517,6 +757,9 @@ static const struct conf_variable conf_table[] =
#if defined (_SC_FSYNC)
{ "_POSIX_FSYNC", SYSCONF, _SC_FSYNC },
#endif
#if defined (_SC_IPV6)
{ "_POSIX_IPV6", SYSCONF, _SC_IPV6 },
#endif
#if defined (_SC_JOB_CONTROL)
{ "_POSIX_JOB_CONTROL", SYSCONF, _SC_JOB_CONTROL },
#endif
@@ -556,6 +799,9 @@ static const struct conf_variable conf_table[] =
#if defined (_SC_READER_WRITER_LOCKS)
{ "_POSIX_READER_WRITER_LOCKS", SYSCONF, _SC_READER_WRITER_LOCKS },
#endif
#if defined (_SC_RAW_SOCKETS)
{ "_POSIX_RAW_SOCKETS", SYSCONF, _SC_RAW_SOCKETS },
#endif
#if defined (_SC_REALTIME_SIGNALS)
{ "_POSIX_REALTIME_SIGNALS", SYSCONF, _SC_REALTIME_SIGNALS },
#endif
@@ -587,6 +833,9 @@ static const struct conf_variable conf_table[] =
#if defined (_SC_SPORADIC_SERVER)
{ "_POSIX_SPORADIC_SERVER", SYSCONF, _SC_SPORADIC_SERVER },
#endif
#if defined (_SC_SYMLOOP_MAX)
{ "_POSIX_SYMLOOP_MAX", SYSCONF, _SC_SYMLOOP_MAX },
#endif
#if defined (_SC_SYNCHRONIZED_IO)
{ "_POSIX_SYNCHRONIZED_IO", SYSCONF, _SC_SYNCHRONIZED_IO },
#endif
@@ -701,9 +950,6 @@ static const struct conf_variable conf_table[] =
#if defined (_SC_AIO_PRIO_DELTA_MAX)
{ "AIO_PRIO_DELTA_MAX", SYSCONF, _SC_AIO_PRIO_DELTA_MAX },
#endif
#if defined (_SC_DELAYTIMER_MAX)
{ "DELAYTIMER_MAX", SYSCONF, _SC_DELAYTIMER_MAX },
#endif
#if defined (_SC_MQ_OPEN_MAX)
{ "MQ_OPEN_MAX", SYSCONF, _SC_MQ_OPEN_MAX },
#endif
@@ -758,6 +1004,9 @@ static const struct conf_variable conf_table[] =
#if defined (_SC_XOPEN_SHM)
{ "_XOPEN_SHM", SYSCONF, _SC_XOPEN_SHM },
#endif
#if defined (_SC_XOPEN_STREAMS)
{ "_XOPEN_STREAMS", SYSCONF, _SC_XOPEN_STREAMS },
#endif
#if defined (_SC_XOPEN_UNIX)
{ "_XOPEN_UNIX", SYSCONF, _SC_XOPEN_UNIX },
#endif
@@ -842,6 +1091,10 @@ static const struct conf_variable conf_table[] =
{ "INT_BIT", CONSTANT, INT_BIT },
{ "INT_MAX", CONSTANT, INT_MAX },
{ "INT_MIN", CONSTANT, INT_MIN },
#ifdef LLONG_MAX
{ "LLONG_MAX", LLCONST, VAL_LLONG_MAX },
{ "LLONG_MIN", LLCONST, VAL_LLONG_MIN },
#endif
{ "LONG_BIT", CONSTANT, LONG_BIT },
{ "LONG_MAX", CONSTANT, LONG_MAX },
{ "LONG_MIN", CONSTANT, LONG_MIN },
@@ -856,6 +1109,9 @@ static const struct conf_variable conf_table[] =
{ "SSIZE_MAX", CONSTANT, SSIZE_MAX },
{ "UCHAR_MAX", CONSTANT, UCHAR_MAX },
{ "UINT_MAX", CONSTANT, UINT_MAX },
#ifdef ULLONG_MAX
{ "ULLONG_MAX", LLCONST, VAL_ULLONG_MAX },
#endif
{ "ULONG_MAX", CONSTANT, ULONG_MAX },
{ "USHRT_MAX", CONSTANT, USHRT_MAX },
{ "WORD_BIT", CONSTANT, WORD_BIT },
@@ -940,6 +1196,24 @@ int all;
printf("undefined\n");
break;
#ifdef LLONG_MAX
case LLCONST:
switch (cp->value) {
default:
case VAL_LLONG_MIN:
printf ("%lld\n", LLONG_MIN);
break;
case VAL_LLONG_MAX:
printf ("%lld\n", LLONG_MAX);
break;
# if (ULLONG_MAX != LLONG_MAX)
case VAL_ULLONG_MAX:
printf ("%llu\n", ULLONG_MAX);
break;
# endif
}
break;
#endif
case CONSTANT:
switch (cp->value) {
case UCHAR_MAX:
+105
View File
@@ -0,0 +1,105 @@
/* strftime - loadable builtin interface to strftime(3) */
/* See Makefile for compilation details. */
#include <config.h>
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif
#include "bashtypes.h"
#include "posixtime.h"
#include <stdio.h>
#include "builtins.h"
#include "shell.h"
#include "common.h"
int
strftime_builtin (list)
WORD_LIST *list;
{
char *format, *tbuf;
size_t tbsize, tsize;
time_t secs;
struct tm *t;
int n;
intmax_t i;
if (list == 0)
{
builtin_usage ();
return (EX_USAGE);
}
if (no_options (list))
return (EX_USAGE);
format = list->word->word;
if (format == 0 || *format == 0)
{
printf ("\n");
return (EXECUTION_SUCCESS);
}
list = list->next;
if (list && list->word->word)
{
n = legal_number (list->word->word, &i);
if (n == 0 || i < 0 || i != (time_t)i)
{
sh_invalidnum (list->word->word);
return (EXECUTION_FAILURE);
}
else
secs = i;
}
else
secs = NOW;
t = localtime (&secs);
tbsize = strlen (format) * 4;
tbuf = 0;
/* Now try to figure out how big the buffer should really be. strftime(3)
will return the number of bytes placed in the buffer unless it's greater
than MAXSIZE, in which case it returns 0. */
for (n = 1; n < 4; n++)
{
tbuf = xrealloc (tbuf, tbsize * n);
tsize = strftime (tbuf, tbsize * n, format, t);
if (tsize)
break;
}
printf ("%s\n", tbuf);
free (tbuf);
return (EXECUTION_SUCCESS);
}
/* An array of strings forming the `long' documentation for a builtin xxx,
which is printed by `help xxx'. It must end with a NULL. */
char *strftime_doc[] = {
"Converts date and time format to a string and displays it on the",
"standard output. If the optional second argument is supplied, it",
"is used as the number of seconds since the epoch to use in the",
"conversion, otherwise the current time is used.",
(char *)NULL
};
/* The standard structure describing a builtin command. bash keeps an array
of these structures. The flags must include BUILTIN_ENABLED so the
builtin can be used. */
struct builtin strftime_struct = {
"strftime", /* builtin name */
strftime_builtin, /* function implementing the builtin */
BUILTIN_ENABLED, /* initial flags for builtin */
strftime_doc, /* array of long documentation strings. */
"strftime format [seconds]", /* usage synopsis; becomes short_doc */
0 /* reserved for internal use */
};
+6 -6
View File
@@ -14,16 +14,16 @@ T=$'\t'
cat << \EOF >/tmp/cb$$.1
mkalias ()
{
if [ "x$2" = "x" ]; then
echo alias ${1}="''"
elif echo "$2" | egrep -s '(\!|#)' >/dev/null 2>&1; then
case $2 in
'') echo alias ${1}="''" ;;
*[#\!]*)
comm=$(echo $2 | sed 's/\!\*/"$\@"/g
s/\!:\([1-9]\)/"$\1"/g
s/#/\#/g')
echo $1 \(\) "{" command "$comm" "; }"
else
echo alias ${1}=\'$(echo "${2}" | sed "s:':'\\\\'':")\'
fi
;;
*) echo alias ${1}=\'$(echo "${2}" | sed "s:':'\\\\'':")\' ;;
esac
}
EOF
+6 -6
View File
@@ -14,16 +14,16 @@ T=' '
cat << \EOF >/tmp/cb$$.1
mkalias ()
{
if [ "x$2" = "x" ]; then
echo alias ${1}="''"
elif echo "$2" | egrep -s '(\!|#)' >/dev/null 2>&1; then
case $2 in
'') echo alias ${1}="''" ;;
*[#\!]*)
comm=`echo $2 | sed 's/\\!\*/"$\@"/g
s/\\!:\([1-9]\)/"$\1"/g
s/#/\#/g'`
echo $1 \(\) "{" command "$comm" "; }"
else
echo alias ${1}=\'`echo "${2}" | sed "s:':'\\\\\\\\'':"`\'
fi
;;
*) echo alias ${1}=\'`echo "${2}" | sed "s:':'\\\\\\\\'':"`\' ;;
esac
}
EOF
+6 -6
View File
@@ -36,16 +36,16 @@ EOF
cat << \EOF >/tmp/cb$$.1
mkalias ()
{
if [ -z "$2" ]; then
echo alias ${1}="''"
elif echo "$2" | egrep -s '(\!|#)' >/dev/null 2>&1; then
case $2 in
'') echo alias ${1}="''" ;;
*[#\!]*)
comm=$(echo $2 | sed 's/\!\*/"$\@"/g
s/\!:\([1-9]\)/"$\1"/g
s/#/\#/g')
echo $1 \(\) "{" command "$comm" "; }"
else
echo alias ${1}=\'$(echo "${2}" | sed "s:':'\\\\'':")\'
fi
;;
*) echo alias ${1}=\'$(echo "${2}" | sed "s:':'\\\\'':")\' ;;
esac
}
EOF
+5 -1
View File
@@ -4,5 +4,9 @@ and Associates (ISBN 1-56592-054-6).
The original `kshdb' is available for anonymous FTP with the URL
ftp://ftp.uu.net/published/oreilly/nutshell/ksh/ksh.tar.Z
http://examples.oreilly.com/korn/ksh.tar.Z
A revised edition is available at:
http://examples.oreilly.com/korn2/korn2_examples.tar.gz
+2 -2
View File
@@ -88,7 +88,7 @@ _at_linenumbp() {
if [ -z "${_linebp}" ]; then
return 1
fi
echo "${_curline}" | egrep "(${_linebp%\|})" >/dev/null 2>&1
echo "${_curline}" | grep -E "(${_linebp%\|})" >/dev/null 2>&1
return $?
}
@@ -101,7 +101,7 @@ _at_stringbp() {
return 1;
fi
l=${_lines[$_curline-$_firstline+1]}
echo "${l}" | egrep "*(${_stringbp%\|})*" >/dev/null 2>&1
echo "${l}" | grep -E "\\*(${_stringbp%\|})\\*" >/dev/null 2>&1
return $?
}
+1 -1
View File
@@ -108,7 +108,7 @@ function number ()
;;
0 ) : ;;
* )
if test ".${val2}" != '.' -a ".${d1}" != '.0' ; then
if test ".${val2}" != '.' && test ".${d1}" != '.0' ; then
val2="${val2}-"
fi
case "${d1}" in
+2 -2
View File
@@ -95,11 +95,11 @@ function strcmp ()
###;;;autoload
function strncmp ()
{
if [ -z "${3}" -o "${3}" -le "0" ]; then
if [ -z "${3}" ] || [ "${3}" -le "0" ]; then
return 0
fi
if [ ${3} -ge ${#1} -a ${3} -ge ${#2} ]; then
if [ ${3} -ge ${#1} ] && [ ${3} -ge ${#2} ]; then
strcmp "$1" "$2"
return $?
else
+2 -2
View File
@@ -39,7 +39,7 @@ cd()
set -- $HOME
fi
if [ "$CDHISTFILE" -a -r "$CDHISTFILE" ] # if directory history exists
if [ "$CDHISTFILE" ] && [ -r "$CDHISTFILE" ] # if directory history exists
then
typeset CDHIST
i=-1
@@ -49,7 +49,7 @@ cd()
done <$CDHISTFILE
fi
if [ "${CDHIST[0]}" != "$PWD" -a "$PWD" != "" ]
if [ "${CDHIST[0]}" != "$PWD" ] && [ -n "$PWD" ]
then
_cdins # insert $PWD into cd history
fi
+2 -2
View File
@@ -56,13 +56,13 @@ FindSectionsInIndex ()
fi
done
[ -z "$indexes" ] && return
# Make egrep give filename
# Make grep give filename
[ NIndex -lt 2 ] && indexes="$indexes /dev/null"
# set positional parameters to
# indexfile:searchname pagename section ...
# e.g.
# /usr/man/index:FP_OFF Routines DOS
set -- `egrep "^$page[ ]" $indexes`
set -- `grep "^$page[ ]" $indexes`
while [ $# -gt 2 ]; do
FileNames[i]=${1%%index*}cat$3/$2.$3
Sections[i]=$3
+1 -1
View File
@@ -110,7 +110,7 @@ function CopyFiles {
*/) ;; # don't add / if trailing / already present
*) if [ $# -gt 2 ] || # if more than two args given, last must be a dir
# If dest in on local machine, check whether it is a directory
[ $DestMach = $LocalMach -a -d $DestPath ] ||
[ $DestMach = $LocalMach ] && [ -d "$DestPath" ] ||
# If dest ends with . or .., it is a directory
lastisdot "$DestPath"
then
+1 -1
View File
@@ -103,7 +103,7 @@ esac
shift
[ -z "$end" -o $count -le "$end" ] && increment=1 || increment=-1
[ -z "$end" ] && [ $count -le "$end" ] && increment=1 || increment=-1
istrue $verbose && echo "start=$count end=$end" 1>&2
+1 -1
View File
@@ -38,7 +38,7 @@ for i in "$@"; do
vars="$vars $i"
;;
*)
if [ ! -x $i -o ! -d $i ]; then # arg must be a dir and executable
if [ ! -x $i ] || [ ! -d $i ]; then # arg must be a dir and executable
echo "$i: directory not accessible."
exit
fi
+10 -10
View File
@@ -389,7 +389,7 @@ esac
trap ':' 2
trap exit 3
trap "tail -$savehist $histfile>/tmp/hist$$;uniq /tmp/hist$$ > $histfile;\
trap "tail -n $savehist $histfile>/tmp/hist$$;uniq /tmp/hist$$ > $histfile;\
rm -f /tmp/*$$;exit 0" 15
getcmd=yes
@@ -517,7 +517,7 @@ do
esac
cmd="${cmd};$line"
while test "$line" != "done" -a "$line" != "end"
while test "$line" != "done" && test "$line" != "end"
do
echo $n "$PS2$c"
read line
@@ -531,7 +531,7 @@ do
echo "$cmd" > /tmp/bcsh$$
;;
if[\ \ ]*)
while test "$line" != "fi" -a "$line" != "endif"
while test "$line" != "fi" && test "$line" != "endif"
do
echo $n "$PS2$c"
read line
@@ -659,7 +659,7 @@ esac/
-[0-9]*)
wanted="`expr \"$i\" : '-\([0-9][0-9]*\).*'`"
rest="`expr \"$i\" : '-[0-9][0-9]*\(.*\)'`"
i="`tail -$wanted $histfile | sed -e "1q"`"
i="`tail -n $wanted $histfile | sed -e "1q"`"
;;
esac
;;
@@ -917,14 +917,14 @@ esac/
continue
;;
exec[\ \ ]*)
tail -$savehist $histfile>/tmp/hist$$
tail -n $savehist $histfile>/tmp/hist$$
uniq /tmp/hist$$ > $histfile
rm -f /tmp/*$$
echo $cmd > /tmp/cmd$$
. /tmp/cmd$$
;;
login[\ \ ]*|newgrp[\ \ ]*)
tail -$savehist $histfile>/tmp/hist$$
tail -n $savehist $histfile>/tmp/hist$$
uniq /tmp/hist$$ > $histfile
rm -f /tmp/*$$
echo $cmd > /tmp/cmd$$
@@ -936,22 +936,22 @@ esac/
# sh $logoutfile
$SHELL $logoutfile
fi
tail -$savehist $histfile > /tmp/hist$$
tail -n $savehist $histfile > /tmp/hist$$
uniq /tmp/hist$$ > $histfile
rm -f /tmp/*$$
exit 0
;;
h|history)
grep -n . $histfile | tail -$history | sed -e 's@:@ @' | $PAGER
grep -n . $histfile | tail -n $history | sed -e 's@:@ @' | $PAGER
continue
;;
h[\ \ ]\|*|h[\ \ ]\>*|h\|*|h\>*)
cmd="`echo \"$cmd\" | sed -e \"s@h@grep -n . $histfile | tail -$history | sed -e 's@:@ @'@\"`"
cmd="`echo \"$cmd\" | sed -e \"s@h@grep -n . $histfile | tail -n $history | sed -e 's@:@ @'@\"`"
getcmd=no
continue
;;
history[\ \ ]*\|*|history[\ \ ]*\>*)
cmd="`echo \"$cmd\" | sed -e \"s@history@grep -n . $histfile | tail -$history | sed -e 's@:@ @'@\"`"
cmd="`echo \"$cmd\" | sed -e \"s@history@grep -n . $histfile | tail -n $history | sed -e 's@:@ @'@\"`"
getcmd=no
continue
;;
+1 -1
View File
@@ -62,7 +62,7 @@ processdir()
set +f
for file in * ; do
set -f
if [ "$file" != "." -a "$file" != ".." ] ; then
if [ "$file" != "." ] && [ "$file" != ".." ] ; then
if [ -L "$file" ] ; then
echo "skipping symlink" $file in `pwd`
elif [ -d "$file" ] ; then

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