Imported from ../bash-3.2.tar.gz.
This commit is contained in:
parent
95732b497d
commit
0628567a28
182 changed files with 17647 additions and 9477 deletions
2
AUTHORS
2
AUTHORS
|
@ -454,3 +454,5 @@ lib/sh/vprint.c Chet Ramey, Brian Fox
|
||||||
lib/sh/xstrchr.c Chet Ramey, Mitsuru Chinen
|
lib/sh/xstrchr.c Chet Ramey, Mitsuru Chinen
|
||||||
lib/sh/zread.c Chet Ramey
|
lib/sh/zread.c Chet Ramey
|
||||||
lib/sh/zwrite.c Chet Ramey
|
lib/sh/zwrite.c Chet Ramey
|
||||||
|
|
||||||
|
tests/posix-ifs.sh Glenn Fowler
|
||||||
|
|
260
CHANGES
260
CHANGES
|
@ -1,3 +1,261 @@
|
||||||
|
This document details the changes between this version, bash-3.2-release,
|
||||||
|
and the previous version, bash-3.2-beta.
|
||||||
|
|
||||||
|
1. Changes to Bash
|
||||||
|
|
||||||
|
a. Fixed a bug that caused the temporary environment passed to a command to
|
||||||
|
affect the shell's environment under certain circumstances.
|
||||||
|
|
||||||
|
b. Fixed a bug in the printf builtin that caused the %q format specifier to
|
||||||
|
ignore empty string arguments.
|
||||||
|
|
||||||
|
c. Improved multibyte character environment detection at configuration time.
|
||||||
|
|
||||||
|
d. Fixed a bug in the read builtin that left spurious escape characters in the
|
||||||
|
input after processing backslashes when assigning to an array variable.
|
||||||
|
|
||||||
|
2. Changes to Readline
|
||||||
|
|
||||||
|
a. Fixed a redisplay bug that occurred in multibyte-capable locales when the
|
||||||
|
prompt was one character longer than the screen width.
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
This document details the changes between this version, bash-3.2-beta,
|
||||||
|
and the previous version, bash-3.2-alpha.
|
||||||
|
|
||||||
|
1. Changes to Bash
|
||||||
|
|
||||||
|
a. Changed the lexical analyzer to treat locale-specific blank characters as
|
||||||
|
white space.
|
||||||
|
|
||||||
|
b. Fixed a bug in command printing to avoid confusion between redirections and
|
||||||
|
process substitution.
|
||||||
|
|
||||||
|
c. Fixed problems with cross-compiling originating from inherited environment
|
||||||
|
variables.
|
||||||
|
|
||||||
|
d. Added write error reporting to printf builtin.
|
||||||
|
|
||||||
|
e. Fixed a bug in the variable expansion code that could cause a core dump in
|
||||||
|
a multi-byte locale.
|
||||||
|
|
||||||
|
f. Fixed a bug that caused substring expansion of a null string to return
|
||||||
|
incorrect results.
|
||||||
|
|
||||||
|
g. BASH_COMMAND now retains its previous value while executing commands as the
|
||||||
|
result of a trap, as the documentation states.
|
||||||
|
|
||||||
|
2. Changes to Readline
|
||||||
|
|
||||||
|
a. Fixed a bug with prompt redisplay in a multi-byte locale to avoid redrawing
|
||||||
|
the prompt and input line multiple times.
|
||||||
|
|
||||||
|
b. Fixed history expansion to not be confused by here-string redirection.
|
||||||
|
|
||||||
|
c. Readline no longer treats read errors by converting them to newlines, as
|
||||||
|
it does with EOF. This caused partial lines to be returned from readline().
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
This document details the changes between this version, bash-3.2-alpha,
|
||||||
|
and the previous version, bash-3.1-release.
|
||||||
|
|
||||||
|
1. Changes to Bash
|
||||||
|
|
||||||
|
a. Fixed a source bug that caused the minimal configuration to not compile.
|
||||||
|
|
||||||
|
b. Fixed memory leaks in error handling for the `read' builtin.
|
||||||
|
|
||||||
|
c. Changed the [[ and (( compound commands to set PIPESTATUS with their exit
|
||||||
|
status.
|
||||||
|
|
||||||
|
d. Fixed some parsing problems with compound array assignments.
|
||||||
|
|
||||||
|
e. Added additional configuration changes for: NetBSD (incomplete multibyte
|
||||||
|
character support)
|
||||||
|
|
||||||
|
f. Fixed two bugs with local array variable creation when shadowing a variable
|
||||||
|
of the same name from a previous context.
|
||||||
|
|
||||||
|
g. Fixed the `read' builtin to restore the correct set of completion functions
|
||||||
|
if a timeout occurs.
|
||||||
|
|
||||||
|
h. Added code to defer the initialization of HISTSIZE (and its stifling of the
|
||||||
|
history list) until the history file is loaded, allowing a startup file to
|
||||||
|
override the default value.
|
||||||
|
|
||||||
|
i. Tightened up the arithmetic expression parsing to produce better error
|
||||||
|
messages when presented with invalid operators.
|
||||||
|
|
||||||
|
j. Fixed the cross-compilation support to build the signal list at shell
|
||||||
|
invocation rather than compile time if cross-compiling.
|
||||||
|
|
||||||
|
k. Fixed multibyte support for non-gcc compilers (or compilers that do not
|
||||||
|
allow automatic array variable sizing based on a non-constant value).
|
||||||
|
|
||||||
|
l. Several fixes to the code that manages the list of terminated jobs and
|
||||||
|
their exit statuses, and the list of active and recently-terminated jobs
|
||||||
|
to avoid pid aliasing/wraparound and allocation errors.
|
||||||
|
|
||||||
|
m. Fixed a problem that allowed scripts to die due to SIGINT while waiting
|
||||||
|
for children, even when started in the background or otherwise ignoring
|
||||||
|
SIGINT.
|
||||||
|
|
||||||
|
n. Fixed a bug that caused shells invoked as -/bin/bash from not being
|
||||||
|
recognized as login shells.
|
||||||
|
|
||||||
|
o. Fixed a problem that caused shells in the background to give the terminal
|
||||||
|
to a process group other than the foreground shell process group.
|
||||||
|
|
||||||
|
p. Fixed a problem with extracting the `varname' in ${#varname}.
|
||||||
|
|
||||||
|
q. Fixed the code that handles SIGQUIT to not exit immediately -- thereby
|
||||||
|
calling functions that may not be called in a signal handler context --
|
||||||
|
but set a flag and exit afterward (like SIGINT).
|
||||||
|
|
||||||
|
r. Changed the brace expansion code to skip over braces that don't begin a
|
||||||
|
valid matched brace expansion construct.
|
||||||
|
|
||||||
|
s. Fixed `typeset' and `declare' to not require that their shell function
|
||||||
|
operands to be valid shell identifiers.
|
||||||
|
|
||||||
|
t. Changed `test' to use access(2) with a temporary uid/euid swap when testing
|
||||||
|
file attributes and running setuid, and access(2) in most other cases.
|
||||||
|
|
||||||
|
u. Changed completion code to not attempt command name completion on a line
|
||||||
|
consisting solely of whitespace when no_empty_command_completion is set.
|
||||||
|
|
||||||
|
v. The `hash' builtin now prints nothing in posix mode when the hash table is
|
||||||
|
empty, and prints a message to that effect to stdout instead of stderr
|
||||||
|
when not in posix mode.
|
||||||
|
|
||||||
|
w. Fixed a bug in the extended pattern matching code that caused it to fail to
|
||||||
|
match periods with certain patterns.
|
||||||
|
|
||||||
|
x. Fixed a bug that caused the shell to dump core when performing filename
|
||||||
|
generation in directories with thousands of files.
|
||||||
|
|
||||||
|
y. Returned to the original Bourne shell rules for parsing ``: no recursive
|
||||||
|
parsing of embedded quoted strings or ${...} constructs.
|
||||||
|
|
||||||
|
z. The inheritence of the DEBUG, RETURN, and ERR traps is now dependent only
|
||||||
|
on the settings of the `functrace' and `errtrace' shell options, rather
|
||||||
|
than whether or not the shell is in debugging mode.
|
||||||
|
|
||||||
|
aa. Fixed a problem with $HOME being converted to ~ in the expansion of
|
||||||
|
members of the DIRSTACK array.
|
||||||
|
|
||||||
|
bb. Fixed a problem with quoted arguments to arithmetic expansions in certain
|
||||||
|
constructs.
|
||||||
|
|
||||||
|
cc. The command word completion code now no longer returns matching directories
|
||||||
|
while searching $PATH.
|
||||||
|
|
||||||
|
dd. Fixed a bug with zero-padding and precision handling in snprintf()
|
||||||
|
replacement.
|
||||||
|
|
||||||
|
ee. Fixed a bug that caused the command substitution code not to take embedded
|
||||||
|
shell comments into account.
|
||||||
|
|
||||||
|
ff. Fixed a bug that caused $((...);(...)) to be misinterpreted as an
|
||||||
|
arithmetic substitution.
|
||||||
|
|
||||||
|
gg. Fixed a bug in the prompt expansion code that inappropriately added a
|
||||||
|
\001 before a \002 under certain circumstances.
|
||||||
|
|
||||||
|
hh. Fixed a bug that caused `unset LANG' to not properly reset the locale
|
||||||
|
(previous versions would set the locale back to what it was when bash
|
||||||
|
was started rather than the system's "native" locale).
|
||||||
|
|
||||||
|
ii. Fixed a bug that could cause file descriptors > 10 to not be closed even
|
||||||
|
when closed explicitly by a script.
|
||||||
|
|
||||||
|
jj. Fixed a bug that caused single quotes to be stripped from ANSI-C quoting
|
||||||
|
inside double-quoted command substitutions.
|
||||||
|
|
||||||
|
kk. Fixed a bug that could cause core dumps when `return' was executed as the
|
||||||
|
last element of a pipeline inside a shell function.
|
||||||
|
|
||||||
|
ll. Fixed a bug that caused DEBUG trap strings to overwrite commands stored in
|
||||||
|
the jobs list.
|
||||||
|
|
||||||
|
2. Changes to Readline
|
||||||
|
|
||||||
|
a. Fixed a problem that caused segmentation faults when using readline in
|
||||||
|
callback mode and typing consecutive DEL characters on an empty line.
|
||||||
|
|
||||||
|
b. Fixed several redisplay problems with multibyte characters, all having to
|
||||||
|
do with the different code paths and variable meanings between single-byte
|
||||||
|
and multibyte character redisplay.
|
||||||
|
|
||||||
|
c. Fixed a problem with key sequence translation when presented with the
|
||||||
|
sequence \M-\C-x.
|
||||||
|
|
||||||
|
d. Fixed a problem that prevented the `a' command in vi mode from being
|
||||||
|
undone and redone properly.
|
||||||
|
|
||||||
|
e. Fixed a problem that prevented empty inserts in vi mode from being undone
|
||||||
|
properly.
|
||||||
|
|
||||||
|
f. Fixed a problem that caused readline to initialize with an incorrect idea
|
||||||
|
of whether or not the terminal can autowrap.
|
||||||
|
|
||||||
|
g. Fixed output of key bindings (like bash `bind -p') to honor the setting of
|
||||||
|
convert-meta and use \e where appropriate.
|
||||||
|
|
||||||
|
h. Changed the default filename completion function to call the filename
|
||||||
|
dequoting function if the directory completion hook isn't set. This means
|
||||||
|
that any directory completion hooks need to dequote the directory name,
|
||||||
|
since application-specific hooks need to know how the word was quoted,
|
||||||
|
even if no other changes are made.
|
||||||
|
|
||||||
|
i. Fixed a bug with creating the prompt for a non-interactive search string
|
||||||
|
when there are non-printing characters in the primary prompt.
|
||||||
|
|
||||||
|
j. Fixed a bug that caused prompts with invisible characters to be redrawn
|
||||||
|
multiple times in a multibyte locale.
|
||||||
|
|
||||||
|
k. Fixed a bug that could cause the key sequence scanning code to return the
|
||||||
|
wrong function.
|
||||||
|
|
||||||
|
l. Fixed a problem with the callback interface that caused it to fail when
|
||||||
|
using multi-character keyboard macros.
|
||||||
|
|
||||||
|
m. Fixed a bug that could cause a core dump when an edited history entry was
|
||||||
|
re-executed under certain conditions.
|
||||||
|
|
||||||
|
n. Fixed a bug that caused readline to reference freed memory when attmpting
|
||||||
|
to display a portion of the prompt.
|
||||||
|
|
||||||
|
3. New Features in Bash
|
||||||
|
|
||||||
|
a. Changed the parameter pattern replacement functions to not anchor the
|
||||||
|
pattern at the beginning of the string if doing global replacement - that
|
||||||
|
combination doesn't make any sense.
|
||||||
|
|
||||||
|
b. When running in `word expansion only' mode (--wordexp option), inhibit
|
||||||
|
process substitution.
|
||||||
|
|
||||||
|
c. Loadable builtins now work on MacOS X 10.[34].
|
||||||
|
|
||||||
|
d. Shells running in posix mode no longer set $HOME, as POSIX requires.
|
||||||
|
|
||||||
|
e. The code that checks for binary files being executed as shell scripts now
|
||||||
|
checks only for NUL rather than any non-printing character.
|
||||||
|
|
||||||
|
f. Quoting the string argument to the [[ command's =~ operator now forces
|
||||||
|
string matching, as with the other pattern-matching operators.
|
||||||
|
|
||||||
|
4. New Features in Readline
|
||||||
|
|
||||||
|
a. Calling applications can now set the keyboard timeout to 0, allowing
|
||||||
|
poll-like behavior.
|
||||||
|
|
||||||
|
b. The value of SYS_INPUTRC (configurable at compilation time) is now used as
|
||||||
|
the default last-ditch startup file.
|
||||||
|
|
||||||
|
c. The history file reading functions now allow windows-like \r\n line
|
||||||
|
terminators.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
This document details the changes between this version, bash-3.1-release,
|
This document details the changes between this version, bash-3.1-release,
|
||||||
and the previous version, bash-3.1-rc2.
|
and the previous version, bash-3.1-rc2.
|
||||||
|
|
||||||
|
@ -48,7 +306,7 @@ and the previous version, bash-3.1-beta1.
|
||||||
|
|
||||||
1. Changes to Bash
|
1. Changes to Bash
|
||||||
|
|
||||||
a. Fixed a bug that could cause core dumps due of accessing the current
|
a. Fixed a bug that could cause core dumps due to accessing the current
|
||||||
pipeline while in the middle of modifying it.
|
pipeline while in the middle of modifying it.
|
||||||
|
|
||||||
b. Fixed a bug that caused pathnames with backslashes still quoting characters
|
b. Fixed a bug that caused pathnames with backslashes still quoting characters
|
||||||
|
|
120
COMPAT
120
COMPAT
|
@ -1,10 +1,10 @@
|
||||||
This document details the incompatibilites between this version of bash,
|
This document details the incompatibilities between this version of bash,
|
||||||
bash-3.1, and a previous widely-available version, bash-1.14 (which
|
bash-3.2, and the previous widely-available versions, bash-1.14 (which is
|
||||||
is still the `standard' version for a few Linux distributions). These
|
still the `standard' version for a few Linux distributions) and bash-2.x.
|
||||||
were discovered by users of bash-2.x and 3.x, so this list is not
|
These were discovered by users of bash-2.x and 3.x, so this list is not
|
||||||
comprehensive. Some of these incompatibilities occur between the current
|
comprehensive. Some of these incompatibilities occur between the current
|
||||||
version and versions 2.0 and above. (The differences between bash-1.14
|
version and versions 2.0 and above. (The differences between bash-1.14 and
|
||||||
and bash-2.0 were significant.)
|
bash-2.0 were significant.)
|
||||||
|
|
||||||
1. Bash uses a new quoting syntax, $"...", to do locale-specific
|
1. Bash uses a new quoting syntax, $"...", to do locale-specific
|
||||||
string translation. Users who have relied on the (undocumented)
|
string translation. Users who have relied on the (undocumented)
|
||||||
|
@ -184,42 +184,92 @@ and bash-2.0 were significant.)
|
||||||
with `z' and still allow individual users to change the collation order.
|
with `z' and still allow individual users to change the collation order.
|
||||||
Users may put the above command into their own profiles as well, of course.
|
Users may put the above command into their own profiles as well, of course.
|
||||||
|
|
||||||
14. Bash versions up to 1.14.7 included an undocumented `-l' operator to
|
14. Bash versions up to 1.14.7 included an undocumented `-l' operator to
|
||||||
the `test/[' builtin. It was a unary operator that expanded to the
|
the `test/[' builtin. It was a unary operator that expanded to the
|
||||||
length of its string argument. This let you do things like
|
length of its string argument. This let you do things like
|
||||||
|
|
||||||
test -l $variable -lt 20
|
test -l $variable -lt 20
|
||||||
|
|
||||||
for example.
|
for example.
|
||||||
|
|
||||||
This was included for backwards compatibility with old versions of the
|
This was included for backwards compatibility with old versions of the
|
||||||
Bourne shell, which did not provide an easy way to obtain the length of
|
Bourne shell, which did not provide an easy way to obtain the length of
|
||||||
the value of a shell variable.
|
the value of a shell variable.
|
||||||
|
|
||||||
This operator is not part of the POSIX standard, because one can (and
|
This operator is not part of the POSIX standard, because one can (and
|
||||||
should) use ${#variable} to get the length of a variable's value.
|
should) use ${#variable} to get the length of a variable's value.
|
||||||
Bash-2.x does not support it.
|
Bash-2.x does not support it.
|
||||||
|
|
||||||
15. Bash no longer auto-exports the HOME, PATH, SHELL, TERM, HOSTNAME,
|
15. Bash no longer auto-exports the HOME, PATH, SHELL, TERM, HOSTNAME,
|
||||||
HOSTTYPE, MACHTYPE, or OSTYPE variables.
|
HOSTTYPE, MACHTYPE, or OSTYPE variables. If they appear in the initial
|
||||||
|
environment, the export attribute will be set, but if bash provides a
|
||||||
|
default value, they will remain local to the current shell.
|
||||||
|
|
||||||
16. Bash no longer initializes the FUNCNAME, GROUPS, or DIRSTACK variables
|
16. Bash no longer initializes the FUNCNAME, GROUPS, or DIRSTACK variables
|
||||||
to have special behavior if they appear in the initial environment.
|
to have special behavior if they appear in the initial environment.
|
||||||
|
|
||||||
17. Bash no longer removes the export attribute from the SSH_CLIENT or
|
17. Bash no longer removes the export attribute from the SSH_CLIENT or
|
||||||
SSH2_CLIENT variables, and no longer attempts to discover whether or
|
SSH2_CLIENT variables, and no longer attempts to discover whether or
|
||||||
not it has been invoked by sshd in order to run the startup files.
|
not it has been invoked by sshd in order to run the startup files.
|
||||||
|
|
||||||
18. Bash no longer requires that the body of a function be a group command;
|
18. Bash no longer requires that the body of a function be a group command;
|
||||||
any compound command is accepted.
|
any compound command is accepted.
|
||||||
|
|
||||||
19. As of bash-3.0, the pattern substitution operators no longer perform
|
19. As of bash-3.0, the pattern substitution operators no longer perform
|
||||||
quote removal on the pattern before attempting the match. This is the
|
quote removal on the pattern before attempting the match. This is the
|
||||||
way the pattern removal functions behave, and is more consistent.
|
way the pattern removal functions behave, and is more consistent.
|
||||||
|
|
||||||
20. After bash-3.0 was released, I reimplemented tilde expansion, incorporating
|
20. After bash-3.0 was released, I reimplemented tilde expansion, incorporating
|
||||||
it into the mainline word expansion code. This fixes the bug that caused
|
it into the mainline word expansion code. This fixes the bug that caused
|
||||||
the results of tilde expansion to be re-expanded. There is one
|
the results of tilde expansion to be re-expanded. There is one
|
||||||
incompatibility: a ${paramOPword} expansion within double quotes will not
|
incompatibility: a ${paramOPword} expansion within double quotes will not
|
||||||
perform tilde expansion on WORD. This is consistent with the other
|
perform tilde expansion on WORD. This is consistent with the other
|
||||||
expansions, and what POSIX specifies.
|
expansions, and what POSIX specifies.
|
||||||
|
|
||||||
|
21. A number of variables have the integer attribute by default, so the +=
|
||||||
|
assignment operator returns expected results: RANDOM, LINENO, MAILCHECK,
|
||||||
|
HISTCMD, OPTIND.
|
||||||
|
|
||||||
|
22. Bash-3.x is much stricter about $LINENO correctly reflecting the line
|
||||||
|
number in a script; assignments to LINENO have little effect.
|
||||||
|
|
||||||
|
23. By default, readline binds the terminal special characters to their
|
||||||
|
readline equivalents. As of bash-3.1/readline-5.1, this is optional and
|
||||||
|
controlled by the bind-tty-special-chars readline variable.
|
||||||
|
|
||||||
|
24. The \W prompt string expansion abbreviates $HOME as `~'. The previous
|
||||||
|
behavior is available with ${PWD##/*/}.
|
||||||
|
|
||||||
|
25. The arithmetic exponentiation operator is right-associative as of bash-3.1.
|
||||||
|
|
||||||
|
26. The rules concerning valid alias names are stricter, as per POSIX.2.
|
||||||
|
|
||||||
|
27. The Readline key binding functions now obey the convert-meta setting active
|
||||||
|
when the binding takes place, as the dispatch code does when characters
|
||||||
|
are read and processed.
|
||||||
|
|
||||||
|
28. The historical behavior of `trap' reverting signal disposition to the
|
||||||
|
original handling in the absence of a valid first argument is implemented
|
||||||
|
only if the first argument is a valid signal number.
|
||||||
|
|
||||||
|
29. In versions of bash after 3.1, the ${parameter//pattern/replacement}
|
||||||
|
expansion does not interpret `%' or `#' specially. Those anchors don't
|
||||||
|
have any real meaning when replacing every match.
|
||||||
|
|
||||||
|
30. Beginning with bash-3.1, the combination of posix mode and enabling the
|
||||||
|
`xpg_echo' option causes echo to ignore all options, not looking for `-n'
|
||||||
|
|
||||||
|
31. Beginning with bash-3.2, bash follows the Bourne-shell-style (and POSIX-
|
||||||
|
style) rules for parsing the contents of old-style backquoted command
|
||||||
|
substitutions. Previous versions of bash attempted to recursively parse
|
||||||
|
embedded quoted strings and shell constructs; bash-3.2 uses strict POSIX
|
||||||
|
rules to find the closing backquote and simply passes the contents of the
|
||||||
|
command substitution to a subshell for parsing and execution.
|
||||||
|
|
||||||
|
32. Beginning with bash-3.2, bash uses access(2) when executing primaries for
|
||||||
|
the test builtin and the [[ compound command, rather than looking at the
|
||||||
|
file permission bits obtained with stat(2). This obeys restrictions of
|
||||||
|
the file system (e.g., read-only or noexec mounts) not available via stat.
|
||||||
|
|
||||||
|
33. Beginning with bash-3.1/readline-5.1, the readline key binding code obeys
|
||||||
|
the current setting of the `convert-meta' variable.
|
||||||
|
|
1253
CWRU/changelog
1253
CWRU/changelog
File diff suppressed because it is too large
Load diff
|
@ -21,6 +21,10 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
|
13
MANIFEST
13
MANIFEST
|
@ -203,9 +203,7 @@ builtins/bashgetopt.c f
|
||||||
builtins/common.h f
|
builtins/common.h f
|
||||||
builtins/bashgetopt.h f
|
builtins/bashgetopt.h f
|
||||||
cross-build/cygwin32.cache f
|
cross-build/cygwin32.cache f
|
||||||
cross-build/win32sig.h f
|
|
||||||
cross-build/x86-beos.cache f
|
cross-build/x86-beos.cache f
|
||||||
cross-build/beos-sig.h f
|
|
||||||
cross-build/opennt.cache f
|
cross-build/opennt.cache f
|
||||||
include/ansi_stdlib.h f
|
include/ansi_stdlib.h f
|
||||||
include/chartypes.h f
|
include/chartypes.h f
|
||||||
|
@ -379,6 +377,7 @@ lib/readline/examples/Inputrc f
|
||||||
lib/sh/Makefile.in f
|
lib/sh/Makefile.in f
|
||||||
lib/sh/clktck.c f
|
lib/sh/clktck.c f
|
||||||
lib/sh/clock.c f
|
lib/sh/clock.c f
|
||||||
|
lib/sh/eaccess.c f
|
||||||
lib/sh/fmtullong.c f
|
lib/sh/fmtullong.c f
|
||||||
lib/sh/fmtulong.c f
|
lib/sh/fmtulong.c f
|
||||||
lib/sh/fmtumax.c f
|
lib/sh/fmtumax.c f
|
||||||
|
@ -423,6 +422,7 @@ lib/sh/times.c f
|
||||||
lib/sh/timeval.c f
|
lib/sh/timeval.c f
|
||||||
lib/sh/tmpfile.c f
|
lib/sh/tmpfile.c f
|
||||||
lib/sh/vprint.c f
|
lib/sh/vprint.c f
|
||||||
|
lib/sh/wcsdup.c f
|
||||||
lib/sh/winsize.c f
|
lib/sh/winsize.c f
|
||||||
lib/sh/xstrchr.c f
|
lib/sh/xstrchr.c f
|
||||||
lib/sh/zcatfd.c f
|
lib/sh/zcatfd.c f
|
||||||
|
@ -468,6 +468,8 @@ po/en@quot.po f
|
||||||
po/en@boldquot.po f
|
po/en@boldquot.po f
|
||||||
po/en@quot.gmo f
|
po/en@quot.gmo f
|
||||||
po/en@boldquot.gmo f
|
po/en@boldquot.gmo f
|
||||||
|
po/ru.po f
|
||||||
|
po/ru.gmo f
|
||||||
po/insert-header.sin f
|
po/insert-header.sin f
|
||||||
po/quot.sed f
|
po/quot.sed f
|
||||||
po/remove-potcdate.sin f
|
po/remove-potcdate.sin f
|
||||||
|
@ -514,6 +516,7 @@ support/mkdirs f 755
|
||||||
support/mkinstalldirs f 755
|
support/mkinstalldirs f 755
|
||||||
support/mkversion.sh f 755
|
support/mkversion.sh f 755
|
||||||
support/mksignames.c f
|
support/mksignames.c f
|
||||||
|
support/signames.c f
|
||||||
support/bashbug.sh f
|
support/bashbug.sh f
|
||||||
support/man2html.c f
|
support/man2html.c f
|
||||||
support/recho.c f
|
support/recho.c f
|
||||||
|
@ -526,6 +529,8 @@ support/texi2html f 755
|
||||||
support/xenix-link.sh f 755
|
support/xenix-link.sh f 755
|
||||||
support/shobj-conf f 755
|
support/shobj-conf f 755
|
||||||
support/rlvers.sh f 755
|
support/rlvers.sh f 755
|
||||||
|
examples/INDEX.txt f
|
||||||
|
examples/INDEX.html f
|
||||||
examples/bashdb/PERMISSION f
|
examples/bashdb/PERMISSION f
|
||||||
examples/bashdb/README f
|
examples/bashdb/README f
|
||||||
examples/bashdb/bashdb f
|
examples/bashdb/bashdb f
|
||||||
|
@ -675,6 +680,7 @@ examples/misc/aliasconv.sh f
|
||||||
examples/misc/aliasconv.bash f
|
examples/misc/aliasconv.bash f
|
||||||
examples/misc/cshtobash f
|
examples/misc/cshtobash f
|
||||||
tests/README f
|
tests/README f
|
||||||
|
tests/COPYRIGHT f
|
||||||
tests/alias.tests f
|
tests/alias.tests f
|
||||||
tests/alias.right f
|
tests/alias.right f
|
||||||
tests/appendop.tests f
|
tests/appendop.tests f
|
||||||
|
@ -690,6 +696,7 @@ tests/array.right f
|
||||||
tests/array1.sub f
|
tests/array1.sub f
|
||||||
tests/array2.sub f
|
tests/array2.sub f
|
||||||
tests/array3.sub f
|
tests/array3.sub f
|
||||||
|
tests/array4.sub f
|
||||||
tests/array-at-star f
|
tests/array-at-star f
|
||||||
tests/array2.right f
|
tests/array2.right f
|
||||||
tests/braces.tests f
|
tests/braces.tests f
|
||||||
|
@ -737,6 +744,7 @@ tests/exp-tests f
|
||||||
tests/exp.right f
|
tests/exp.right f
|
||||||
tests/extglob.tests f
|
tests/extglob.tests f
|
||||||
tests/extglob.right f
|
tests/extglob.right f
|
||||||
|
tests/extglob1.sub f
|
||||||
tests/extglob2.tests f
|
tests/extglob2.tests f
|
||||||
tests/extglob2.right f
|
tests/extglob2.right f
|
||||||
tests/extglob3.tests f
|
tests/extglob3.tests f
|
||||||
|
@ -794,6 +802,7 @@ tests/new-exp2.sub f
|
||||||
tests/new-exp3.sub f
|
tests/new-exp3.sub f
|
||||||
tests/new-exp4.sub f
|
tests/new-exp4.sub f
|
||||||
tests/new-exp5.sub f
|
tests/new-exp5.sub f
|
||||||
|
tests/new-exp6.sub f
|
||||||
tests/new-exp.right f
|
tests/new-exp.right f
|
||||||
tests/nquote.tests f
|
tests/nquote.tests f
|
||||||
tests/nquote.right f
|
tests/nquote.right f
|
||||||
|
|
24
MANIFEST.doc
24
MANIFEST.doc
|
@ -1,24 +0,0 @@
|
||||||
#
|
|
||||||
# Master Manifest file for documentation-only distribution
|
|
||||||
#
|
|
||||||
doc d
|
|
||||||
MANIFEST.doc f
|
|
||||||
doc/article.ps f
|
|
||||||
doc/rose94.ps f
|
|
||||||
doc/bash.ps f
|
|
||||||
doc/bashbug.ps f
|
|
||||||
doc/builtins.ps f
|
|
||||||
doc/rbash.ps f
|
|
||||||
doc/bashref.ps f
|
|
||||||
doc/bashref.dvi f
|
|
||||||
doc/bash.0 f
|
|
||||||
doc/bashbug.0 f
|
|
||||||
doc/builtins.0 f
|
|
||||||
doc/rbash.0 f
|
|
||||||
doc/article.txt f
|
|
||||||
doc/bash.html f
|
|
||||||
doc/bashref.html f
|
|
||||||
doc/article.pdf f
|
|
||||||
doc/bash.pdf f
|
|
||||||
doc/bashref.pdf f
|
|
||||||
doc/rose94.pdf f
|
|
53
Makefile.in
53
Makefile.in
|
@ -1,4 +1,4 @@
|
||||||
# Makefile for bash-3.1, version 2.157
|
# Makefile for bash-3.1, version 2.159
|
||||||
#
|
#
|
||||||
# Copyright (C) 1996-2005 Free Software Foundation, Inc.
|
# Copyright (C) 1996-2005 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
@ -128,6 +128,8 @@ LOCALE_DEFS = -DLOCALEDIR='"$(localedir)"' -DPACKAGE='"$(PACKAGE)"'
|
||||||
|
|
||||||
LOCAL_LIBS = @LOCAL_LIBS@
|
LOCAL_LIBS = @LOCAL_LIBS@
|
||||||
LIBS = $(BUILTINS_LIB) $(LIBRARIES) @LIBS@
|
LIBS = $(BUILTINS_LIB) $(LIBRARIES) @LIBS@
|
||||||
|
LIBS_FOR_BUILD =
|
||||||
|
|
||||||
STATIC_LD = @STATIC_LD@
|
STATIC_LD = @STATIC_LD@
|
||||||
LOCAL_LDFLAGS = @LOCAL_LDFLAGS@
|
LOCAL_LDFLAGS = @LOCAL_LDFLAGS@
|
||||||
|
|
||||||
|
@ -145,8 +147,11 @@ LDFLAGS_FOR_BUILD = $(LDFLAGS)
|
||||||
|
|
||||||
INCLUDES = -I. @RL_INCLUDE@ -I$(srcdir) -I$(BASHINCDIR) -I$(LIBSRC) $(INTL_INC)
|
INCLUDES = -I. @RL_INCLUDE@ -I$(srcdir) -I$(BASHINCDIR) -I$(LIBSRC) $(INTL_INC)
|
||||||
|
|
||||||
GCC_LINT_FLAGS = -Wall -Wshadow -Wpointer-arith -Wcast-qual \
|
# Maybe add: -Wextra
|
||||||
-Wcast-align -Wstrict-prototypes -Wconversion \
|
GCC_LINT_FLAGS = -O -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wno-parentheses \
|
||||||
|
-Wcast-align -Wstrict-prototypes -Wconversion -Wformat \
|
||||||
|
-Wformat-nonliteral -Wmissing-braces -Wuninitialized \
|
||||||
|
-Wmissing-declarations -Winline \
|
||||||
-Wmissing-prototypes -Wtraditional -Wredundant-decls -pedantic
|
-Wmissing-prototypes -Wtraditional -Wredundant-decls -pedantic
|
||||||
|
|
||||||
GCC_LINT_CFLAGS = $(BASE_CCFLAGS) $(CPPFLAGS) $(GCC_LINT_FLAGS)
|
GCC_LINT_CFLAGS = $(BASE_CCFLAGS) $(CPPFLAGS) $(GCC_LINT_FLAGS)
|
||||||
|
@ -198,7 +203,8 @@ SHLIB_SOURCE = ${SH_LIBSRC}/clktck.c ${SH_LIBSRC}/getcwd.c \
|
||||||
${SH_LIBSRC}/mktime.c ${SH_LIBSRC}/strftime.c \
|
${SH_LIBSRC}/mktime.c ${SH_LIBSRC}/strftime.c \
|
||||||
${SH_LIBSRC}/memset.c ${SH_LIBSRC}/xstrchr.c \
|
${SH_LIBSRC}/memset.c ${SH_LIBSRC}/xstrchr.c \
|
||||||
${SH_LIBSRC}/zcatfd.c ${SH_LIBSRC}/shmatch.c \
|
${SH_LIBSRC}/zcatfd.c ${SH_LIBSRC}/shmatch.c \
|
||||||
${SH_LIBSRC}/strnlen.c ${SH_LIBSRC}/winsize.c
|
${SH_LIBSRC}/strnlen.c ${SH_LIBSRC}/winsize.c \
|
||||||
|
${SH_LIBSRC}/eaccess.c ${SH_LIBSRC}/wcsdup.c
|
||||||
|
|
||||||
SHLIB_LIB = -lsh
|
SHLIB_LIB = -lsh
|
||||||
SHLIB_LIBNAME = libsh.a
|
SHLIB_LIBNAME = libsh.a
|
||||||
|
@ -418,6 +424,7 @@ SIGNAMES_H = @SIGNAMES_H@
|
||||||
# object files chosen based on running of configure
|
# object files chosen based on running of configure
|
||||||
JOBS_O = @JOBS_O@
|
JOBS_O = @JOBS_O@
|
||||||
SIGLIST_O = @SIGLIST_O@
|
SIGLIST_O = @SIGLIST_O@
|
||||||
|
SIGNAMES_O = @SIGNAMES_O@
|
||||||
|
|
||||||
# Matching object files.
|
# Matching object files.
|
||||||
OBJECTS = shell.o eval.o y.tab.o general.o make_cmd.o print_cmd.o $(GLOBO) \
|
OBJECTS = shell.o eval.o y.tab.o general.o make_cmd.o print_cmd.o $(GLOBO) \
|
||||||
|
@ -426,7 +433,7 @@ OBJECTS = shell.o eval.o y.tab.o general.o make_cmd.o print_cmd.o $(GLOBO) \
|
||||||
trap.o input.o unwind_prot.o pathexp.o sig.o test.o version.o \
|
trap.o input.o unwind_prot.o pathexp.o sig.o test.o version.o \
|
||||||
alias.o array.o arrayfunc.o braces.o bracecomp.o bashhist.o \
|
alias.o array.o arrayfunc.o braces.o bracecomp.o bashhist.o \
|
||||||
bashline.o $(SIGLIST_O) list.o stringlib.o locale.o findcmd.o redir.o \
|
bashline.o $(SIGLIST_O) list.o stringlib.o locale.o findcmd.o redir.o \
|
||||||
pcomplete.o pcomplib.o syntax.o xmalloc.o
|
pcomplete.o pcomplib.o syntax.o xmalloc.o $(SIGNAMES_O)
|
||||||
|
|
||||||
# Where the source code of the shell builtins resides.
|
# Where the source code of the shell builtins resides.
|
||||||
BUILTIN_SRCDIR=$(srcdir)/builtins
|
BUILTIN_SRCDIR=$(srcdir)/builtins
|
||||||
|
@ -495,7 +502,7 @@ CREATED_SUPPORT = signames.h recho$(EXEEXT) zecho$(EXEEXT) printenv$(EXEEXT) \
|
||||||
tests/recho$(EXEEXT) tests/zecho$(EXEEXT) \
|
tests/recho$(EXEEXT) tests/zecho$(EXEEXT) \
|
||||||
tests/printenv$(EXEEXT) mksignames$(EXEEXT) lsignames.h \
|
tests/printenv$(EXEEXT) mksignames$(EXEEXT) lsignames.h \
|
||||||
mksyntax${EXEEXT} syntax.c $(VERSPROG) $(VERSOBJ) \
|
mksyntax${EXEEXT} syntax.c $(VERSPROG) $(VERSOBJ) \
|
||||||
buildversion.o
|
buildversion.o mksignames.o signames.o buildsignames.o
|
||||||
CREATED_CONFIGURE = config.h config.cache config.status config.log \
|
CREATED_CONFIGURE = config.h config.cache config.status config.log \
|
||||||
stamp-h po/POTFILES
|
stamp-h po/POTFILES
|
||||||
CREATED_MAKEFILES = Makefile builtins/Makefile doc/Makefile \
|
CREATED_MAKEFILES = Makefile builtins/Makefile doc/Makefile \
|
||||||
|
@ -547,7 +554,7 @@ version.h: $(SOURCES) config.h Makefile
|
||||||
&& mv newversion.h version.h
|
&& mv newversion.h version.h
|
||||||
|
|
||||||
bashversion$(EXEEXT): patchlevel.h conftypes.h version.h buildversion.o $(SUPPORT_SRC)bashversion.c
|
bashversion$(EXEEXT): patchlevel.h conftypes.h version.h buildversion.o $(SUPPORT_SRC)bashversion.c
|
||||||
$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) -o $@ $(SUPPORT_SRC)bashversion.c buildversion.o
|
$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) -o $@ $(SUPPORT_SRC)bashversion.c buildversion.o ${LIBS_FOR_BUILD}
|
||||||
|
|
||||||
buildversion.o: version.h conftypes.h patchlevel.h $(srcdir)/version.c
|
buildversion.o: version.h conftypes.h patchlevel.h $(srcdir)/version.c
|
||||||
$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) -DBUILDTOOL -c -o $@ $(srcdir)/version.c
|
$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) -DBUILDTOOL -c -o $@ $(srcdir)/version.c
|
||||||
|
@ -609,11 +616,25 @@ ${INTL_LIBRARY}: config.h ${INTL_LIBDIR}/Makefile
|
||||||
|
|
||||||
${LIBINTL_H}: ${INTL_LIBRARY}
|
${LIBINTL_H}: ${INTL_LIBRARY}
|
||||||
|
|
||||||
mksignames$(EXEEXT): $(SUPPORT_SRC)mksignames.c
|
signames.o: $(SUPPORT_SRC)signames.c
|
||||||
$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) -o $@ $(SUPPORT_SRC)mksignames.c
|
$(RM) $@
|
||||||
|
$(CC) $(CCFLAGS) -c $(SUPPORT_SRC)signames.c
|
||||||
|
|
||||||
|
buildsignames.o: $(SUPPORT_SRC)signames.c
|
||||||
|
$(RM) $@
|
||||||
|
$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) -DBUILDTOOL -o $@ -c $(SUPPORT_SRC)signames.c
|
||||||
|
|
||||||
|
mksignames.o: $(SUPPORT_SRC)mksignames.c
|
||||||
|
$(RM) $@
|
||||||
|
$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) -DBUILDTOOL -c $(SUPPORT_SRC)mksignames.c
|
||||||
|
|
||||||
|
mksignames$(EXEEXT): mksignames.o buildsignames.o
|
||||||
|
$(RM) $@
|
||||||
|
$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) -o $@ mksignames.o buildsignames.o ${LIBS_FOR_BUILD}
|
||||||
|
|
||||||
mksyntax$(EXEEXT): ${srcdir}/mksyntax.c config.h syntax.h ${BASHINCDIR}/chartypes.h
|
mksyntax$(EXEEXT): ${srcdir}/mksyntax.c config.h syntax.h ${BASHINCDIR}/chartypes.h
|
||||||
${CC_FOR_BUILD} ${CCFLAGS_FOR_BUILD} -o $@ ${srcdir}/mksyntax.c
|
$(RM) $@
|
||||||
|
${CC_FOR_BUILD} ${CCFLAGS_FOR_BUILD} -o $@ ${srcdir}/mksyntax.c ${LIBS_FOR_BUILD}
|
||||||
|
|
||||||
# make a list of signals for the local system -- this is done when we're
|
# make a list of signals for the local system -- this is done when we're
|
||||||
# *not* cross-compiling
|
# *not* cross-compiling
|
||||||
|
@ -686,10 +707,10 @@ info dvi ps: force
|
||||||
|
|
||||||
force:
|
force:
|
||||||
|
|
||||||
tags: $(SOURCES) $(BUILTIN_C_SRC) $(LIBRARY_SOURCE)
|
TAGS: $(SOURCES) $(BUILTIN_C_SRC) $(LIBRARY_SOURCE)
|
||||||
etags $(SOURCES) $(BUILTIN_C_SRC) $(LIBRARY_SOURCE)
|
etags $(SOURCES) $(BUILTIN_C_SRC) $(LIBRARY_SOURCE)
|
||||||
|
|
||||||
TAGS: $(SOURCES) $(BUILTIN_C_SRC) $(LIBRARY_SOURCE)
|
tags: $(SOURCES) $(BUILTIN_C_SRC) $(LIBRARY_SOURCE)
|
||||||
ctags -x $(SOURCES) $(BUILTIN_C_SRC) $(LIBRARY_SOURCE) > $@
|
ctags -x $(SOURCES) $(BUILTIN_C_SRC) $(LIBRARY_SOURCE) > $@
|
||||||
|
|
||||||
# Targets that actually do things not part of the build
|
# Targets that actually do things not part of the build
|
||||||
|
@ -782,13 +803,13 @@ maybe-clean:
|
||||||
fi
|
fi
|
||||||
|
|
||||||
recho$(EXEEXT): $(SUPPORT_SRC)recho.c
|
recho$(EXEEXT): $(SUPPORT_SRC)recho.c
|
||||||
@$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) -o $@ $(SUPPORT_SRC)recho.c
|
@$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) -o $@ $(SUPPORT_SRC)recho.c ${LIBS_FOR_BUILD}
|
||||||
|
|
||||||
zecho$(EXEEXT): $(SUPPORT_SRC)zecho.c
|
zecho$(EXEEXT): $(SUPPORT_SRC)zecho.c
|
||||||
@$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) -o $@ $(SUPPORT_SRC)zecho.c
|
@$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) -o $@ $(SUPPORT_SRC)zecho.c ${LIBS_FOR_BUILD}
|
||||||
|
|
||||||
printenv$(EXEEXT): $(SUPPORT_SRC)printenv.c
|
printenv$(EXEEXT): $(SUPPORT_SRC)printenv.c
|
||||||
@$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) -o $@ $(SUPPORT_SRC)printenv.c
|
@$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) -o $@ $(SUPPORT_SRC)printenv.c ${LIBS_FOR_BUILD}
|
||||||
|
|
||||||
test tests check: force $(Program) $(TESTS_SUPPORT)
|
test tests check: force $(Program) $(TESTS_SUPPORT)
|
||||||
@-test -d tests || mkdir tests
|
@-test -d tests || mkdir tests
|
||||||
|
@ -1143,6 +1164,8 @@ variables.o: bashintl.h ${LIBINTL_H} $(BASHINCDIR)/gettext.h
|
||||||
version.o: bashintl.h ${LIBINTL_H} $(BASHINCDIR)/gettext.h
|
version.o: bashintl.h ${LIBINTL_H} $(BASHINCDIR)/gettext.h
|
||||||
xmalloc.o: bashintl.h ${LIBINTL_H} $(BASHINCDIR)/gettext.h
|
xmalloc.o: bashintl.h ${LIBINTL_H} $(BASHINCDIR)/gettext.h
|
||||||
|
|
||||||
|
signames.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
|
||||||
|
|
||||||
# XXX - dependencies checked through here
|
# XXX - dependencies checked through here
|
||||||
|
|
||||||
# builtin c sources
|
# builtin c sources
|
||||||
|
|
35
NEWS
35
NEWS
|
@ -1,3 +1,38 @@
|
||||||
|
This is a terse description of the new features added to bash-3.2 since
|
||||||
|
the release of bash-3.1. As always, the manual page (doc/bash.1) is
|
||||||
|
the place to look for complete descriptions.
|
||||||
|
|
||||||
|
1. New Features in Bash
|
||||||
|
|
||||||
|
a. Changed the parameter pattern replacement functions to not anchor the
|
||||||
|
pattern at the beginning of the string if doing global replacement - that
|
||||||
|
combination doesn't make any sense.
|
||||||
|
|
||||||
|
b. When running in `word expansion only' mode (--wordexp option), inhibit
|
||||||
|
process substitution.
|
||||||
|
|
||||||
|
c. Loadable builtins now work on MacOS X 10.[34].
|
||||||
|
|
||||||
|
d. Shells running in posix mode no longer set $HOME, as POSIX requires.
|
||||||
|
|
||||||
|
e. The code that checks for binary files being executed as shell scripts now
|
||||||
|
checks only for NUL rather than any non-printing character.
|
||||||
|
|
||||||
|
f. Quoting the string argument to the [[ command's =~ operator now forces
|
||||||
|
string matching, as with the other pattern-matching operators.
|
||||||
|
|
||||||
|
2. New Features in Readline
|
||||||
|
|
||||||
|
a. Calling applications can now set the keyboard timeout to 0, allowing
|
||||||
|
poll-like behavior.
|
||||||
|
|
||||||
|
b. The value of SYS_INPUTRC (configurable at compilation time) is now used as
|
||||||
|
the default last-ditch startup file.
|
||||||
|
|
||||||
|
c. The history file reading functions now allow windows-like \r\n line
|
||||||
|
terminators.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
This is a terse description of the new features added to bash-3.1 since
|
This is a terse description of the new features added to bash-3.1 since
|
||||||
the release of bash-3.0. As always, the manual page (doc/bash.1) is
|
the release of bash-3.0. As always, the manual page (doc/bash.1) is
|
||||||
the place to look for complete descriptions.
|
the place to look for complete descriptions.
|
||||||
|
|
8
NOTES
8
NOTES
|
@ -261,6 +261,10 @@ Platform-Specific Configuration and Operation Notes
|
||||||
I have received word that adding -L/etc/lib (or the equivalent
|
I have received word that adding -L/etc/lib (or the equivalent
|
||||||
-Wl,-L/etc/lib) might also be necessary, in addition to the -R/etc/lib.
|
-Wl,-L/etc/lib) might also be necessary, in addition to the -R/etc/lib.
|
||||||
|
|
||||||
|
On later versions of Solaris, it may be necessary to add -lnsl before
|
||||||
|
-ldl; statically-linked versions of bash using libnsl are not guaranteed
|
||||||
|
to work correctly on future versions of Solaris.
|
||||||
|
|
||||||
12. Configuring bash to build it in a cross environment. Currently only
|
12. Configuring bash to build it in a cross environment. Currently only
|
||||||
two native versions can be compiled this way, cygwin32 and x86 BeOS.
|
two native versions can be compiled this way, cygwin32 and x86 BeOS.
|
||||||
For BeOS, you would configure it like this:
|
For BeOS, you would configure it like this:
|
||||||
|
@ -327,3 +331,7 @@ Platform-Specific Configuration and Operation Notes
|
||||||
|
|
||||||
16. Configure --disable-multibyte on NetBSD versions (1.4 through at least
|
16. Configure --disable-multibyte on NetBSD versions (1.4 through at least
|
||||||
1.6.1) that include wctype.h but do not define wctype_t.
|
1.6.1) that include wctype.h but do not define wctype_t.
|
||||||
|
|
||||||
|
17. Do NOT use bison-1.75. It builds a non-working parser. The most
|
||||||
|
obvious effect is that constructs like "for i; do echo $i; done" don't
|
||||||
|
loop over the positional parameters.
|
||||||
|
|
34
POSIX
34
POSIX
|
@ -3,8 +3,8 @@
|
||||||
|
|
||||||
Starting Bash with the `--posix' command-line option or executing `set
|
Starting Bash with the `--posix' command-line option or executing `set
|
||||||
-o posix' while Bash is running will cause Bash to conform more closely
|
-o posix' while Bash is running will cause Bash to conform more closely
|
||||||
to the POSIX 1003.2 standard by changing the behavior to match that
|
to the POSIX standard by changing the behavior to match that specified
|
||||||
specified by POSIX in areas where the Bash default differs.
|
by POSIX in areas where the Bash default differs.
|
||||||
|
|
||||||
When invoked as `sh', Bash enters POSIX mode after reading the startup
|
When invoked as `sh', Bash enters POSIX mode after reading the startup
|
||||||
files.
|
files.
|
||||||
|
@ -29,13 +29,13 @@ The following list is what's changed when `POSIX mode' is in effect:
|
||||||
5. Reserved words appearing in a context where reserved words are
|
5. Reserved words appearing in a context where reserved words are
|
||||||
recognized do not undergo alias expansion.
|
recognized do not undergo alias expansion.
|
||||||
|
|
||||||
6. The POSIX 1003.2 `PS1' and `PS2' expansions of `!' to the history
|
6. The POSIX `PS1' and `PS2' expansions of `!' to the history number
|
||||||
number and `!!' to `!' are enabled, and parameter expansion is
|
and `!!' to `!' are enabled, and parameter expansion is performed
|
||||||
performed on the values of `PS1' and `PS2' regardless of the
|
on the values of `PS1' and `PS2' regardless of the setting of the
|
||||||
setting of the `promptvars' option.
|
`promptvars' option.
|
||||||
|
|
||||||
7. The POSIX 1003.2 startup files are executed (`$ENV') rather than
|
7. The POSIX startup files are executed (`$ENV') rather than the
|
||||||
the normal Bash files.
|
normal Bash files.
|
||||||
|
|
||||||
8. Tilde expansion is only performed on assignments preceding a
|
8. Tilde expansion is only performed on assignments preceding a
|
||||||
command name, rather than on all assignment statements on the line.
|
command name, rather than on all assignment statements on the line.
|
||||||
|
@ -66,12 +66,12 @@ The following list is what's changed when `POSIX mode' is in effect:
|
||||||
may not start with a digit. Declaring a function with an invalid
|
may not start with a digit. Declaring a function with an invalid
|
||||||
name causes a fatal syntax error in non-interactive shells.
|
name causes a fatal syntax error in non-interactive shells.
|
||||||
|
|
||||||
17. POSIX 1003.2 special builtins are found before shell functions
|
17. POSIX special builtins are found before shell functions during
|
||||||
during command lookup.
|
command lookup.
|
||||||
|
|
||||||
18. If a POSIX 1003.2 special builtin returns an error status, a
|
18. If a POSIX special builtin returns an error status, a
|
||||||
non-interactive shell exits. The fatal errors are those listed in
|
non-interactive shell exits. The fatal errors are those listed in
|
||||||
the POSIX.2 standard, and include things like passing incorrect
|
the POSIX standard, and include things like passing incorrect
|
||||||
options, redirection errors, variable assignment errors for
|
options, redirection errors, variable assignment errors for
|
||||||
assignments preceding the command name, and so on.
|
assignments preceding the command name, and so on.
|
||||||
|
|
||||||
|
@ -92,15 +92,15 @@ The following list is what's changed when `POSIX mode' is in effect:
|
||||||
|
|
||||||
22. Process substitution is not available.
|
22. Process substitution is not available.
|
||||||
|
|
||||||
23. Assignment statements preceding POSIX 1003.2 special builtins
|
23. Assignment statements preceding POSIX special builtins persist in
|
||||||
persist in the shell environment after the builtin completes.
|
the shell environment after the builtin completes.
|
||||||
|
|
||||||
24. Assignment statements preceding shell function calls persist in the
|
24. Assignment statements preceding shell function calls persist in the
|
||||||
shell environment after the function returns, as if a POSIX
|
shell environment after the function returns, as if a POSIX
|
||||||
special builtin command had been executed.
|
special builtin command had been executed.
|
||||||
|
|
||||||
25. The `export' and `readonly' builtin commands display their output
|
25. The `export' and `readonly' builtin commands display their output
|
||||||
in the format required by POSIX 1003.2.
|
in the format required by POSIX.
|
||||||
|
|
||||||
26. The `trap' builtin displays signal names without the leading `SIG'.
|
26. The `trap' builtin displays signal names without the leading `SIG'.
|
||||||
|
|
||||||
|
@ -162,8 +162,8 @@ The following list is what's changed when `POSIX mode' is in effect:
|
||||||
displayed, after escape characters are converted.
|
displayed, after escape characters are converted.
|
||||||
|
|
||||||
|
|
||||||
There is other POSIX 1003.2 behavior that Bash does not implement by
|
There is other POSIX behavior that Bash does not implement by default
|
||||||
default even when in POSIX mode. Specifically:
|
even when in POSIX mode. Specifically:
|
||||||
|
|
||||||
1. The `fc' builtin checks `$EDITOR' as a program to edit history
|
1. The `fc' builtin checks `$EDITOR' as a program to edit history
|
||||||
entries if `FCEDIT' is unset, rather than defaulting directly to
|
entries if `FCEDIT' is unset, rather than defaulting directly to
|
||||||
|
|
10
README
10
README
|
@ -1,7 +1,7 @@
|
||||||
Introduction
|
Introduction
|
||||||
============
|
============
|
||||||
|
|
||||||
This is GNU Bash, version 3.1. Bash is the GNU Project's Bourne
|
This is GNU Bash, version 3.2. Bash is the GNU Project's Bourne
|
||||||
Again SHell, a complete implementation of the POSIX.2 shell spec,
|
Again SHell, a complete implementation of the POSIX.2 shell spec,
|
||||||
but also with interactive command line editing, job control on
|
but also with interactive command line editing, job control on
|
||||||
architectures that support it, csh-like features such as history
|
architectures that support it, csh-like features such as history
|
||||||
|
@ -15,9 +15,9 @@ See the file POSIX for a discussion of how the Bash defaults differ
|
||||||
from the POSIX.2 spec and a description of the Bash `posix mode'.
|
from the POSIX.2 spec and a description of the Bash `posix mode'.
|
||||||
|
|
||||||
There are some user-visible incompatibilities between this version
|
There are some user-visible incompatibilities between this version
|
||||||
of Bash and a previous widely-distributed version, bash-1.14.
|
of Bash and previous widely-distributed versions, bash-1.14 and
|
||||||
For details, see the file COMPAT. The NEWS file tersely lists
|
bash-2.05b. For details, see the file COMPAT. The NEWS file tersely
|
||||||
features that are new in this release.
|
lists features that are new in this release.
|
||||||
|
|
||||||
Bash is free software, distributed under the terms of the [GNU]
|
Bash is free software, distributed under the terms of the [GNU]
|
||||||
General Public License, version 2. For more information, see the
|
General Public License, version 2. For more information, see the
|
||||||
|
@ -87,4 +87,4 @@ like this shell to be the best that we can make it.
|
||||||
Enjoy!
|
Enjoy!
|
||||||
|
|
||||||
Chet Ramey
|
Chet Ramey
|
||||||
chet@po.cwru.edu
|
chet.ramey@case.edu
|
||||||
|
|
84
aclocal.m4
vendored
84
aclocal.m4
vendored
|
@ -933,7 +933,7 @@ AC_DEFINE(HAVE_STRUCT_STAT_ST_BLOCKS)
|
||||||
fi
|
fi
|
||||||
])
|
])
|
||||||
|
|
||||||
AC_DEFUN(BASH_CHECK_LIB_TERMCAP,
|
AC_DEFUN([BASH_CHECK_LIB_TERMCAP],
|
||||||
[
|
[
|
||||||
if test "X$bash_cv_termcap_lib" = "X"; then
|
if test "X$bash_cv_termcap_lib" = "X"; then
|
||||||
_bash_needmsg=yes
|
_bash_needmsg=yes
|
||||||
|
@ -1540,20 +1540,24 @@ fi
|
||||||
AC_DEFUN(BASH_CHECK_DEV_FD,
|
AC_DEFUN(BASH_CHECK_DEV_FD,
|
||||||
[AC_MSG_CHECKING(whether /dev/fd is available)
|
[AC_MSG_CHECKING(whether /dev/fd is available)
|
||||||
AC_CACHE_VAL(bash_cv_dev_fd,
|
AC_CACHE_VAL(bash_cv_dev_fd,
|
||||||
[if test -d /dev/fd && test -r /dev/fd/0 < /dev/null; then
|
[bash_cv_dev_fd=""
|
||||||
|
if test -d /dev/fd && test -r /dev/fd/0 < /dev/null; then
|
||||||
# check for systems like FreeBSD 5 that only provide /dev/fd/[012]
|
# check for systems like FreeBSD 5 that only provide /dev/fd/[012]
|
||||||
exec 3<&0
|
exec 3</dev/null
|
||||||
if test -r /dev/fd/3; then
|
if test -r /dev/fd/3; then
|
||||||
bash_cv_dev_fd=standard
|
bash_cv_dev_fd=standard
|
||||||
else
|
else
|
||||||
bash_cv_dev_fd=absent
|
bash_cv_dev_fd=absent
|
||||||
fi
|
fi
|
||||||
exec 3<&-
|
exec 3<&-
|
||||||
elif test -d /proc/self/fd && test -r /proc/self/fd/0 < /dev/null; then
|
fi
|
||||||
bash_cv_dev_fd=whacky
|
if test -z "$bash_cv_dev_fd" ; then
|
||||||
else
|
if test -d /proc/self/fd && test -r /proc/self/fd/0 < /dev/null; then
|
||||||
bash_cv_dev_fd=absent
|
bash_cv_dev_fd=whacky
|
||||||
fi
|
else
|
||||||
|
bash_cv_dev_fd=absent
|
||||||
|
fi
|
||||||
|
fi
|
||||||
])
|
])
|
||||||
AC_MSG_RESULT($bash_cv_dev_fd)
|
AC_MSG_RESULT($bash_cv_dev_fd)
|
||||||
if test $bash_cv_dev_fd = "standard"; then
|
if test $bash_cv_dev_fd = "standard"; then
|
||||||
|
@ -1667,6 +1671,8 @@ fi
|
||||||
dnl
|
dnl
|
||||||
dnl check for availability of multibyte characters and functions
|
dnl check for availability of multibyte characters and functions
|
||||||
dnl
|
dnl
|
||||||
|
dnl geez, I wish I didn't have to check for all of this stuff separately
|
||||||
|
dnl
|
||||||
AC_DEFUN(BASH_CHECK_MULTIBYTE,
|
AC_DEFUN(BASH_CHECK_MULTIBYTE,
|
||||||
[
|
[
|
||||||
AC_CHECK_HEADERS(wctype.h)
|
AC_CHECK_HEADERS(wctype.h)
|
||||||
|
@ -1674,23 +1680,22 @@ AC_CHECK_HEADERS(wchar.h)
|
||||||
AC_CHECK_HEADERS(langinfo.h)
|
AC_CHECK_HEADERS(langinfo.h)
|
||||||
|
|
||||||
AC_CHECK_FUNC(mbsrtowcs, AC_DEFINE(HAVE_MBSRTOWCS))
|
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(mbrlen, AC_DEFINE(HAVE_MBRLEN))
|
||||||
AC_CHECK_FUNC(wctomb, AC_DEFINE(HAVE_WCTOMB))
|
|
||||||
AC_CHECK_FUNC(wcwidth, AC_DEFINE(HAVE_WCWIDTH))
|
|
||||||
AC_CHECK_FUNC(wcsdup, AC_DEFINE(HAVE_WCSDUP))
|
|
||||||
|
|
||||||
AC_CACHE_CHECK([for mbstate_t], bash_cv_have_mbstate_t,
|
AC_CHECK_FUNC(wcrtomb, AC_DEFINE(HAVE_WCRTOMB))
|
||||||
[AC_TRY_COMPILE([
|
AC_CHECK_FUNC(wcscoll, AC_DEFINE(HAVE_WCSCOLL))
|
||||||
#include <wchar.h>], [
|
AC_CHECK_FUNC(wcsdup, AC_DEFINE(HAVE_WCSDUP))
|
||||||
mbstate_t ps;
|
AC_CHECK_FUNC(wcwidth, AC_DEFINE(HAVE_WCWIDTH))
|
||||||
mbstate_t *psp;
|
AC_CHECK_FUNC(wctype, AC_DEFINE(HAVE_WCTYPE))
|
||||||
psp = (mbstate_t *)0;
|
|
||||||
], bash_cv_have_mbstate_t=yes, bash_cv_have_mbstate_t=no)])
|
dnl checks for both mbrtowc and mbstate_t
|
||||||
if test $bash_cv_have_mbstate_t = yes; then
|
AC_FUNC_MBRTOWC
|
||||||
|
if test $ac_cv_func_mbrtowc = yes; then
|
||||||
AC_DEFINE(HAVE_MBSTATE_T)
|
AC_DEFINE(HAVE_MBSTATE_T)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AC_CHECK_FUNCS(iswlower iswupper towlower towupper iswctype)
|
||||||
|
|
||||||
AC_CACHE_CHECK([for nl_langinfo and CODESET], bash_cv_langinfo_codeset,
|
AC_CACHE_CHECK([for nl_langinfo and CODESET], bash_cv_langinfo_codeset,
|
||||||
[AC_TRY_LINK(
|
[AC_TRY_LINK(
|
||||||
[#include <langinfo.h>],
|
[#include <langinfo.h>],
|
||||||
|
@ -1700,6 +1705,43 @@ if test $bash_cv_langinfo_codeset = yes; then
|
||||||
AC_DEFINE(HAVE_LANGINFO_CODESET)
|
AC_DEFINE(HAVE_LANGINFO_CODESET)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
dnl check for wchar_t in <wchar.h>
|
||||||
|
AC_CACHE_CHECK([for wchar_t in wchar.h], bash_cv_type_wchar_t,
|
||||||
|
[AC_TRY_COMPILE(
|
||||||
|
[#include <wchar.h>
|
||||||
|
],
|
||||||
|
[
|
||||||
|
wchar_t foo;
|
||||||
|
foo = 0;
|
||||||
|
], bash_cv_type_wchar_t=yes, bash_cv_type_wchar_t=no)])
|
||||||
|
if test $bash_cv_type_wchar_t = yes; then
|
||||||
|
AC_DEFINE(HAVE_WCHAR_T, 1, [systems should define this type here])
|
||||||
|
fi
|
||||||
|
|
||||||
|
dnl check for wctype_t in <wctype.h>
|
||||||
|
AC_CACHE_CHECK([for wctype_t in wctype.h], bash_cv_type_wctype_t,
|
||||||
|
[AC_TRY_COMPILE(
|
||||||
|
[#include <wctype.h>],
|
||||||
|
[
|
||||||
|
wctype_t foo;
|
||||||
|
foo = 0;
|
||||||
|
], bash_cv_type_wctype_t=yes, bash_cv_type_wctype_t=no)])
|
||||||
|
if test $bash_cv_type_wctype_t = yes; then
|
||||||
|
AC_DEFINE(HAVE_WCTYPE_T, 1, [systems should define this type here])
|
||||||
|
fi
|
||||||
|
|
||||||
|
dnl check for wint_t in <wctype.h>
|
||||||
|
AC_CACHE_CHECK([for wint_t in wctype.h], bash_cv_type_wint_t,
|
||||||
|
[AC_TRY_COMPILE(
|
||||||
|
[#include <wctype.h>],
|
||||||
|
[
|
||||||
|
wint_t foo;
|
||||||
|
foo = 0;
|
||||||
|
], bash_cv_type_wint_t=yes, bash_cv_type_wint_t=no)])
|
||||||
|
if test $bash_cv_type_wint_t = yes; then
|
||||||
|
AC_DEFINE(HAVE_WINT_T, 1, [systems should define this type here])
|
||||||
|
fi
|
||||||
|
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl need: prefix exec_prefix libdir includedir CC TERMCAP_LIB
|
dnl need: prefix exec_prefix libdir includedir CC TERMCAP_LIB
|
||||||
|
@ -1707,7 +1749,7 @@ dnl require:
|
||||||
dnl AC_PROG_CC
|
dnl AC_PROG_CC
|
||||||
dnl BASH_CHECK_LIB_TERMCAP
|
dnl BASH_CHECK_LIB_TERMCAP
|
||||||
|
|
||||||
AC_DEFUN(RL_LIB_READLINE_VERSION,
|
AC_DEFUN([RL_LIB_READLINE_VERSION],
|
||||||
[
|
[
|
||||||
AC_REQUIRE([BASH_CHECK_LIB_TERMCAP])
|
AC_REQUIRE([BASH_CHECK_LIB_TERMCAP])
|
||||||
|
|
||||||
|
|
80
arrayfunc.c
80
arrayfunc.c
|
@ -1,6 +1,6 @@
|
||||||
/* arrayfunc.c -- High-level array functions used by other parts of the shell. */
|
/* arrayfunc.c -- High-level array functions used by other parts of the shell. */
|
||||||
|
|
||||||
/* Copyright (C) 2001-2005 Free Software Foundation, Inc.
|
/* Copyright (C) 2001-2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GNU Bash, the Bourne Again SHell.
|
This file is part of GNU Bash, the Bourne Again SHell.
|
||||||
|
|
||||||
|
@ -265,32 +265,22 @@ assign_array_var_from_word_list (var, list, flags)
|
||||||
return var;
|
return var;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Perform a compound array assignment: VAR->name=( VALUE ). The
|
WORD_LIST *
|
||||||
VALUE has already had the parentheses stripped. */
|
expand_compound_array_assignment (value, flags)
|
||||||
SHELL_VAR *
|
|
||||||
assign_array_var_from_string (var, value, flags)
|
|
||||||
SHELL_VAR *var;
|
|
||||||
char *value;
|
char *value;
|
||||||
int flags;
|
int flags;
|
||||||
{
|
{
|
||||||
ARRAY *a;
|
|
||||||
WORD_LIST *list, *nlist;
|
WORD_LIST *list, *nlist;
|
||||||
char *w, *val, *nval;
|
char *val;
|
||||||
int ni, len;
|
int ni;
|
||||||
arrayind_t ind, last_ind;
|
|
||||||
|
|
||||||
if (value == 0)
|
/* I don't believe this condition is ever true any more. */
|
||||||
return var;
|
|
||||||
|
|
||||||
/* If this is called from declare_builtin, value[0] == '(' and
|
|
||||||
xstrchr(value, ')') != 0. In this case, we need to extract
|
|
||||||
the value from between the parens before going on. */
|
|
||||||
if (*value == '(') /*)*/
|
if (*value == '(') /*)*/
|
||||||
{
|
{
|
||||||
ni = 1;
|
ni = 1;
|
||||||
val = extract_array_assignment_list (value, &ni);
|
val = extract_array_assignment_list (value, &ni);
|
||||||
if (val == 0)
|
if (val == 0)
|
||||||
return var;
|
return (WORD_LIST *)NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
val = value;
|
val = value;
|
||||||
|
@ -315,6 +305,21 @@ assign_array_var_from_string (var, value, flags)
|
||||||
if (val != value)
|
if (val != value)
|
||||||
free (val);
|
free (val);
|
||||||
|
|
||||||
|
return nlist;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
assign_compound_array_list (var, nlist, flags)
|
||||||
|
SHELL_VAR *var;
|
||||||
|
WORD_LIST *nlist;
|
||||||
|
int flags;
|
||||||
|
{
|
||||||
|
ARRAY *a;
|
||||||
|
WORD_LIST *list;
|
||||||
|
char *w, *val, *nval;
|
||||||
|
int len, iflags;
|
||||||
|
arrayind_t ind, last_ind;
|
||||||
|
|
||||||
a = array_cell (var);
|
a = array_cell (var);
|
||||||
|
|
||||||
/* Now that we are ready to assign values to the array, kill the existing
|
/* Now that we are ready to assign values to the array, kill the existing
|
||||||
|
@ -325,6 +330,7 @@ assign_array_var_from_string (var, value, flags)
|
||||||
|
|
||||||
for (list = nlist; list; list = list->next)
|
for (list = nlist; list; list = list->next)
|
||||||
{
|
{
|
||||||
|
iflags = flags;
|
||||||
w = list->word->word;
|
w = list->word->word;
|
||||||
|
|
||||||
/* We have a word of the form [ind]=value */
|
/* We have a word of the form [ind]=value */
|
||||||
|
@ -332,12 +338,8 @@ assign_array_var_from_string (var, value, flags)
|
||||||
{
|
{
|
||||||
len = skipsubscript (w, 0);
|
len = skipsubscript (w, 0);
|
||||||
|
|
||||||
#if 1
|
|
||||||
/* XXX - changes for `+=' */
|
/* XXX - changes for `+=' */
|
||||||
if (w[len] != ']' || (w[len+1] != '=' && (w[len+1] != '+' || w[len+2] != '=')))
|
if (w[len] != ']' || (w[len+1] != '=' && (w[len+1] != '+' || w[len+2] != '=')))
|
||||||
#else
|
|
||||||
if (w[len] != ']' || w[len+1] != '=')
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
nval = make_variable_value (var, w, flags);
|
nval = make_variable_value (var, w, flags);
|
||||||
if (var->assign_func)
|
if (var->assign_func)
|
||||||
|
@ -368,10 +370,10 @@ assign_array_var_from_string (var, value, flags)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
last_ind = ind;
|
last_ind = ind;
|
||||||
/* XXX - changes for `+=' */
|
/* XXX - changes for `+=' -- just accept the syntax. ksh93 doesn't do this */
|
||||||
if (w[len + 1] == '+' && w[len + 2] == '=')
|
if (w[len + 1] == '+' && w[len + 2] == '=')
|
||||||
{
|
{
|
||||||
flags |= ASS_APPEND;
|
iflags |= ASS_APPEND;
|
||||||
val = w + len + 3;
|
val = w + len + 3;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -385,11 +387,29 @@ assign_array_var_from_string (var, value, flags)
|
||||||
|
|
||||||
if (integer_p (var))
|
if (integer_p (var))
|
||||||
this_command_name = (char *)NULL; /* no command name for errors */
|
this_command_name = (char *)NULL; /* no command name for errors */
|
||||||
bind_array_var_internal (var, ind, val, flags);
|
bind_array_var_internal (var, ind, val, iflags);
|
||||||
last_ind++;
|
last_ind++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dispose_words (nlist);
|
/* Perform a compound array assignment: VAR->name=( VALUE ). The
|
||||||
|
VALUE has already had the parentheses stripped. */
|
||||||
|
SHELL_VAR *
|
||||||
|
assign_array_var_from_string (var, value, flags)
|
||||||
|
SHELL_VAR *var;
|
||||||
|
char *value;
|
||||||
|
int flags;
|
||||||
|
{
|
||||||
|
WORD_LIST *nlist;
|
||||||
|
|
||||||
|
if (value == 0)
|
||||||
|
return var;
|
||||||
|
|
||||||
|
nlist = expand_compound_array_assignment (value, flags);
|
||||||
|
assign_compound_array_list (var, nlist, flags);
|
||||||
|
|
||||||
|
if (nlist)
|
||||||
|
dispose_words (nlist);
|
||||||
return (var);
|
return (var);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -438,13 +458,11 @@ skipsubscript (s, i)
|
||||||
#if defined (HANDLE_MULTIBYTE)
|
#if defined (HANDLE_MULTIBYTE)
|
||||||
mbstate_t state, state_bak;
|
mbstate_t state, state_bak;
|
||||||
size_t slength, mblength;
|
size_t slength, mblength;
|
||||||
size_t mb_cur_max;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined (HANDLE_MULTIBYTE)
|
#if defined (HANDLE_MULTIBYTE)
|
||||||
memset (&state, '\0', sizeof (mbstate_t));
|
memset (&state, '\0', sizeof (mbstate_t));
|
||||||
slength = strlen (s + i);
|
slength = strlen (s + i);
|
||||||
mb_cur_max = MB_CUR_MAX;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
count = 1;
|
count = 1;
|
||||||
|
@ -452,7 +470,7 @@ skipsubscript (s, i)
|
||||||
{
|
{
|
||||||
/* Advance one (possibly multibyte) character in S starting at I. */
|
/* Advance one (possibly multibyte) character in S starting at I. */
|
||||||
#if defined (HANDLE_MULTIBYTE)
|
#if defined (HANDLE_MULTIBYTE)
|
||||||
if (mb_cur_max > 1)
|
if (MB_CUR_MAX > 1)
|
||||||
{
|
{
|
||||||
state_bak = state;
|
state_bak = state;
|
||||||
mblength = mbrlen (s + i, slength, &state);
|
mblength = mbrlen (s + i, slength, &state);
|
||||||
|
@ -592,11 +610,7 @@ array_expand_index (s, len)
|
||||||
exp = (char *)xmalloc (len);
|
exp = (char *)xmalloc (len);
|
||||||
strncpy (exp, s, len - 1);
|
strncpy (exp, s, len - 1);
|
||||||
exp[len - 1] = '\0';
|
exp[len - 1] = '\0';
|
||||||
#if 0
|
t = expand_arith_string (exp, 0);
|
||||||
t = expand_string_to_string (exp, 0);
|
|
||||||
#else
|
|
||||||
t = expand_string_to_string (exp, Q_DOUBLE_QUOTES);
|
|
||||||
#endif
|
|
||||||
this_command_name = (char *)NULL;
|
this_command_name = (char *)NULL;
|
||||||
val = evalexp (t, &expok);
|
val = evalexp (t, &expok);
|
||||||
free (t);
|
free (t);
|
||||||
|
|
|
@ -34,6 +34,9 @@ extern SHELL_VAR *find_or_make_array_variable __P((char *, int));
|
||||||
|
|
||||||
extern SHELL_VAR *assign_array_from_string __P((char *, char *, int));
|
extern SHELL_VAR *assign_array_from_string __P((char *, char *, int));
|
||||||
extern SHELL_VAR *assign_array_var_from_word_list __P((SHELL_VAR *, WORD_LIST *, int));
|
extern SHELL_VAR *assign_array_var_from_word_list __P((SHELL_VAR *, WORD_LIST *, int));
|
||||||
|
|
||||||
|
extern WORD_LIST *expand_compound_array_assignment __P((char *, int));
|
||||||
|
extern void assign_compound_array_list __P((SHELL_VAR *, WORD_LIST *, int));
|
||||||
extern SHELL_VAR *assign_array_var_from_string __P((SHELL_VAR *, char *, int));
|
extern SHELL_VAR *assign_array_var_from_string __P((SHELL_VAR *, char *, int));
|
||||||
|
|
||||||
extern int unbind_array_element __P((SHELL_VAR *, char *));
|
extern int unbind_array_element __P((SHELL_VAR *, char *));
|
||||||
|
|
|
@ -270,6 +270,9 @@ load_history ()
|
||||||
Note that the history file is automatically truncated to the
|
Note that the history file is automatically truncated to the
|
||||||
size of HISTSIZE if the user does not explicitly set the size
|
size of HISTSIZE if the user does not explicitly set the size
|
||||||
differently. */
|
differently. */
|
||||||
|
set_if_not ("HISTSIZE", "500");
|
||||||
|
sv_histsize ("HISTSIZE");
|
||||||
|
|
||||||
set_if_not ("HISTFILESIZE", get_string_value ("HISTSIZE"));
|
set_if_not ("HISTFILESIZE", get_string_value ("HISTSIZE"));
|
||||||
sv_histsize ("HISTFILESIZE");
|
sv_histsize ("HISTFILESIZE");
|
||||||
|
|
||||||
|
|
|
@ -38,5 +38,6 @@ extern procenv_t return_catch; /* used by `return' builtin */
|
||||||
#define DISCARD 2 /* Discard current command. */
|
#define DISCARD 2 /* Discard current command. */
|
||||||
#define EXITPROG 3 /* Unconditionally exit the program now. */
|
#define EXITPROG 3 /* Unconditionally exit the program now. */
|
||||||
#define ERREXIT 4 /* Exit due to error condition */
|
#define ERREXIT 4 /* Exit due to error condition */
|
||||||
|
#define SIGEXIT 5 /* Exit due to fatal terminating signal */
|
||||||
|
|
||||||
#endif /* _BASHJMP_H_ */
|
#endif /* _BASHJMP_H_ */
|
||||||
|
|
76
bashline.c
76
bashline.c
|
@ -1,6 +1,6 @@
|
||||||
/* bashline.c -- Bash's interface to the readline library. */
|
/* bashline.c -- Bash's interface to the readline library. */
|
||||||
|
|
||||||
/* Copyright (C) 1987-2005 Free Software Foundation, Inc.
|
/* Copyright (C) 1987-2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GNU Bash, the Bourne Again SHell.
|
This file is part of GNU Bash, the Bourne Again SHell.
|
||||||
|
|
||||||
|
@ -238,6 +238,9 @@ static int dot_in_path = 0;
|
||||||
#define COMPLETE_BSQUOTE 3
|
#define COMPLETE_BSQUOTE 3
|
||||||
static int completion_quoting_style = COMPLETE_BSQUOTE;
|
static int completion_quoting_style = COMPLETE_BSQUOTE;
|
||||||
|
|
||||||
|
/* Flag values for the final argument to bash_default_completion */
|
||||||
|
#define DEFCOMP_CMDPOS 1
|
||||||
|
|
||||||
/* Change the readline VI-mode keymaps into or out of Posix.2 compliance.
|
/* Change the readline VI-mode keymaps into or out of Posix.2 compliance.
|
||||||
Called when the shell is put into or out of `posix' mode. */
|
Called when the shell is put into or out of `posix' mode. */
|
||||||
void
|
void
|
||||||
|
@ -999,7 +1002,7 @@ attempt_shell_completion (text, start, end)
|
||||||
const char *text;
|
const char *text;
|
||||||
int start, end;
|
int start, end;
|
||||||
{
|
{
|
||||||
int in_command_position, ti, saveti, qc;
|
int in_command_position, ti, saveti, qc, dflags;
|
||||||
char **matches, *command_separator_chars;
|
char **matches, *command_separator_chars;
|
||||||
|
|
||||||
command_separator_chars = COMMAND_SEPARATORS;
|
command_separator_chars = COMMAND_SEPARATORS;
|
||||||
|
@ -1112,15 +1115,20 @@ attempt_shell_completion (text, start, end)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (matches == 0)
|
if (matches == 0)
|
||||||
matches = bash_default_completion (text, start, end, qc, in_command_position);
|
{
|
||||||
|
dflags = 0;
|
||||||
|
if (in_command_position)
|
||||||
|
dflags |= DEFCOMP_CMDPOS;
|
||||||
|
matches = bash_default_completion (text, start, end, qc, dflags);
|
||||||
|
}
|
||||||
|
|
||||||
return matches;
|
return matches;
|
||||||
}
|
}
|
||||||
|
|
||||||
char **
|
char **
|
||||||
bash_default_completion (text, start, end, qc, in_command_position)
|
bash_default_completion (text, start, end, qc, compflags)
|
||||||
const char *text;
|
const char *text;
|
||||||
int start, end, qc, in_command_position;
|
int start, end, qc, compflags;
|
||||||
{
|
{
|
||||||
char **matches;
|
char **matches;
|
||||||
|
|
||||||
|
@ -1148,9 +1156,11 @@ bash_default_completion (text, start, end, qc, in_command_position)
|
||||||
/* And last, (but not least) if this word is in a command position, then
|
/* And last, (but not least) if this word is in a command position, then
|
||||||
complete over possible command names, including aliases, functions,
|
complete over possible command names, including aliases, functions,
|
||||||
and command names. */
|
and command names. */
|
||||||
if (!matches && in_command_position)
|
if (matches == 0 && (compflags & DEFCOMP_CMDPOS))
|
||||||
{
|
{
|
||||||
if (start == 0 && end == 0 && text[0] == '\0' && no_empty_command_completion)
|
/* If END == START and text[0] == 0, we are trying to complete an empty
|
||||||
|
command word. */
|
||||||
|
if (no_empty_command_completion && end == start && text[0] == '\0')
|
||||||
{
|
{
|
||||||
matches = (char **)NULL;
|
matches = (char **)NULL;
|
||||||
rl_ignore_some_completions_function = bash_ignore_everything;
|
rl_ignore_some_completions_function = bash_ignore_everything;
|
||||||
|
@ -1226,7 +1236,7 @@ command_word_completion_function (hint_text, state)
|
||||||
static char *filename_hint = (char *)NULL;
|
static char *filename_hint = (char *)NULL;
|
||||||
static char *dequoted_hint = (char *)NULL;
|
static char *dequoted_hint = (char *)NULL;
|
||||||
static int path_index, hint_len, dequoted_len, istate, igncase;
|
static int path_index, hint_len, dequoted_len, istate, igncase;
|
||||||
static int mapping_over, local_index;
|
static int mapping_over, local_index, searching_path, hint_is_dir;
|
||||||
static SHELL_VAR **varlist = (SHELL_VAR **)NULL;
|
static SHELL_VAR **varlist = (SHELL_VAR **)NULL;
|
||||||
#if defined (ALIAS)
|
#if defined (ALIAS)
|
||||||
static alias_t **alias_list = (alias_t **)NULL;
|
static alias_t **alias_list = (alias_t **)NULL;
|
||||||
|
@ -1242,7 +1252,8 @@ command_word_completion_function (hint_text, state)
|
||||||
if (hint)
|
if (hint)
|
||||||
free (hint);
|
free (hint);
|
||||||
|
|
||||||
mapping_over = 0;
|
mapping_over = searching_path = 0;
|
||||||
|
hint_is_dir = CMD_IS_DIR (hint_text);
|
||||||
val = (char *)NULL;
|
val = (char *)NULL;
|
||||||
|
|
||||||
temp = rl_variable_value ("completion-ignore-case");
|
temp = rl_variable_value ("completion-ignore-case");
|
||||||
|
@ -1381,6 +1392,16 @@ command_word_completion_function (hint_text, state)
|
||||||
mapping_over++;
|
mapping_over++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If the text passed is a directory in the current directory, return it
|
||||||
|
as a possible match. Executables in directories in the current
|
||||||
|
directory can be specified using relative pathnames and successfully
|
||||||
|
executed even when `.' is not in $PATH. */
|
||||||
|
if (hint_is_dir)
|
||||||
|
{
|
||||||
|
hint_is_dir = 0; /* only return the hint text once */
|
||||||
|
return (savestring (hint_text));
|
||||||
|
}
|
||||||
|
|
||||||
/* Repeatedly call filename_completion_function while we have
|
/* Repeatedly call filename_completion_function while we have
|
||||||
members of PATH left. Question: should we stat each file?
|
members of PATH left. Question: should we stat each file?
|
||||||
Answer: we call executable_file () on each file. */
|
Answer: we call executable_file () on each file. */
|
||||||
|
@ -1398,6 +1419,7 @@ command_word_completion_function (hint_text, state)
|
||||||
(current_path = extract_colon_unit (path, &path_index)) == 0)
|
(current_path = extract_colon_unit (path, &path_index)) == 0)
|
||||||
return ((char *)NULL);
|
return ((char *)NULL);
|
||||||
|
|
||||||
|
searching_path = 1;
|
||||||
if (*current_path == 0)
|
if (*current_path == 0)
|
||||||
{
|
{
|
||||||
free (current_path);
|
free (current_path);
|
||||||
|
@ -1439,7 +1461,9 @@ command_word_completion_function (hint_text, state)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int match, freetemp;
|
int match, freetemp;
|
||||||
char *temp;
|
#if 0
|
||||||
|
char *temp; /* shadows previous declaration */
|
||||||
|
#endif
|
||||||
|
|
||||||
if (absolute_program (hint))
|
if (absolute_program (hint))
|
||||||
{
|
{
|
||||||
|
@ -1491,9 +1515,18 @@ command_word_completion_function (hint_text, state)
|
||||||
freetemp = match = 0;
|
freetemp = match = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
/* If we have found a match, and it is an executable file or a
|
/* If we have found a match, and it is an executable file or a
|
||||||
directory name, return it. */
|
directory name, return it. */
|
||||||
if (match && executable_or_directory (val))
|
if (match && executable_or_directory (val))
|
||||||
|
#else
|
||||||
|
/* If we have found a match, and it is an executable file, return it.
|
||||||
|
We don't return directory names when searching $PATH, since the
|
||||||
|
bash execution code won't find executables in directories which
|
||||||
|
appear in directories in $PATH when they're specified using
|
||||||
|
relative pathnames. */
|
||||||
|
if (match && (searching_path ? executable_file (val) : executable_or_directory (val)))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
free (val);
|
free (val);
|
||||||
val = ""; /* So it won't be NULL. */
|
val = ""; /* So it won't be NULL. */
|
||||||
|
@ -1729,8 +1762,9 @@ bash_servicename_completion_function (text, state)
|
||||||
if (snamelen == 0 || (STREQN (sname, srvent->s_name, snamelen)))
|
if (snamelen == 0 || (STREQN (sname, srvent->s_name, snamelen)))
|
||||||
break;
|
break;
|
||||||
/* Not primary, check aliases */
|
/* Not primary, check aliases */
|
||||||
for (alist = srvent->s_aliases; aentry = *alist; alist++)
|
for (alist = srvent->s_aliases; *alist; alist++)
|
||||||
{
|
{
|
||||||
|
aentry = *alist;
|
||||||
if (STREQN (sname, aentry, snamelen))
|
if (STREQN (sname, aentry, snamelen))
|
||||||
{
|
{
|
||||||
afound = 1;
|
afound = 1;
|
||||||
|
@ -2265,7 +2299,7 @@ static void
|
||||||
bash_directory_expansion (dirname)
|
bash_directory_expansion (dirname)
|
||||||
char **dirname;
|
char **dirname;
|
||||||
{
|
{
|
||||||
char *d;
|
char *d, *nd;
|
||||||
|
|
||||||
d = savestring (*dirname);
|
d = savestring (*dirname);
|
||||||
|
|
||||||
|
@ -2277,6 +2311,13 @@ bash_directory_expansion (dirname)
|
||||||
free (*dirname);
|
free (*dirname);
|
||||||
*dirname = d;
|
*dirname = d;
|
||||||
}
|
}
|
||||||
|
else if (rl_completion_found_quote)
|
||||||
|
{
|
||||||
|
nd = bash_dequote_filename (d, rl_completion_quote_character);
|
||||||
|
free (*dirname);
|
||||||
|
free (d);
|
||||||
|
*dirname = nd;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Handle symbolic link references and other directory name
|
/* Handle symbolic link references and other directory name
|
||||||
|
@ -2337,6 +2378,13 @@ bash_directory_completion_hook (dirname)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Dequote the filename even if we don't expand it. */
|
||||||
|
new_dirname = bash_dequote_filename (local_dirname, rl_completion_quote_character);
|
||||||
|
free (local_dirname);
|
||||||
|
local_dirname = *dirname = new_dirname;
|
||||||
|
}
|
||||||
|
|
||||||
if (!no_symbolic_links && (local_dirname[0] != '.' || local_dirname[1]))
|
if (!no_symbolic_links && (local_dirname[0] != '.' || local_dirname[1]))
|
||||||
{
|
{
|
||||||
|
@ -3123,11 +3171,7 @@ bash_directory_completion_matches (text)
|
||||||
char *dfn;
|
char *dfn;
|
||||||
int qc;
|
int qc;
|
||||||
|
|
||||||
#if 0
|
|
||||||
qc = (text[0] == '"' || text[0] == '\'') ? text[0] : 0;
|
|
||||||
#else
|
|
||||||
qc = rl_dispatching ? rl_completion_quote_character : 0;
|
qc = rl_dispatching ? rl_completion_quote_character : 0;
|
||||||
#endif
|
|
||||||
dfn = bash_dequote_filename ((char *)text, qc);
|
dfn = bash_dequote_filename ((char *)text, qc);
|
||||||
m1 = rl_completion_matches (dfn, rl_filename_completion_function);
|
m1 = rl_completion_matches (dfn, rl_filename_completion_function);
|
||||||
free (dfn);
|
free (dfn);
|
||||||
|
|
89
braces.c
89
braces.c
|
@ -61,7 +61,7 @@ int brace_arg_separator = ',';
|
||||||
static int brace_gobbler __P((char *, size_t, int *, int));
|
static int brace_gobbler __P((char *, size_t, int *, int));
|
||||||
static char **expand_amble __P((char *, size_t, int));
|
static char **expand_amble __P((char *, size_t, int));
|
||||||
static char **expand_seqterm __P((char *, size_t));
|
static char **expand_seqterm __P((char *, size_t));
|
||||||
static char **mkseq __P((int, int, int));
|
static char **mkseq __P((int, int, int, int));
|
||||||
static char **array_concat __P((char **, char **));
|
static char **array_concat __P((char **, char **));
|
||||||
#else
|
#else
|
||||||
static int brace_gobbler ();
|
static int brace_gobbler ();
|
||||||
|
@ -71,6 +71,18 @@ static char **mkseq();
|
||||||
static char **array_concat ();
|
static char **array_concat ();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
static void
|
||||||
|
dump_result (a)
|
||||||
|
char **a;
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; a[i]; i++)
|
||||||
|
printf ("dump_result: a[%d] = -%s-\n", i, a[i]);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Return an array of strings; the brace expansion of TEXT. */
|
/* Return an array of strings; the brace expansion of TEXT. */
|
||||||
char **
|
char **
|
||||||
brace_expand (text)
|
brace_expand (text)
|
||||||
|
@ -81,14 +93,45 @@ brace_expand (text)
|
||||||
char *preamble, *postamble, *amble;
|
char *preamble, *postamble, *amble;
|
||||||
size_t alen;
|
size_t alen;
|
||||||
char **tack, **result;
|
char **tack, **result;
|
||||||
int i, j, c;
|
int i, j, c, c1;
|
||||||
|
|
||||||
DECLARE_MBSTATE;
|
DECLARE_MBSTATE;
|
||||||
|
|
||||||
/* Find the text of the preamble. */
|
/* Find the text of the preamble. */
|
||||||
tlen = strlen (text);
|
tlen = strlen (text);
|
||||||
i = 0;
|
i = 0;
|
||||||
c = brace_gobbler (text, tlen, &i, '{');
|
#if defined (CSH_BRACE_COMPAT)
|
||||||
|
c = brace_gobbler (text, tlen, &i, '{'); /* } */
|
||||||
|
#else
|
||||||
|
/* Make sure that when we exit this loop, c == 0 or text[i] begins a
|
||||||
|
valid brace expansion sequence. */
|
||||||
|
do
|
||||||
|
{
|
||||||
|
c = brace_gobbler (text, tlen, &i, '{'); /* } */
|
||||||
|
c1 = c;
|
||||||
|
/* Verify that c begins a valid brace expansion word. If it doesn't, we
|
||||||
|
go on. Loop stops when there are no more open braces in the word. */
|
||||||
|
if (c)
|
||||||
|
{
|
||||||
|
start = j = i + 1; /* { */
|
||||||
|
c = brace_gobbler (text, tlen, &j, '}');
|
||||||
|
if (c == 0) /* it's not */
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
c = c1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else /* it is */
|
||||||
|
{
|
||||||
|
c = c1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
while (c);
|
||||||
|
#endif /* !CSH_BRACE_COMPAT */
|
||||||
|
|
||||||
preamble = (char *)xmalloc (i + 1);
|
preamble = (char *)xmalloc (i + 1);
|
||||||
strncpy (preamble, text, i);
|
strncpy (preamble, text, i);
|
||||||
|
@ -260,22 +303,31 @@ expand_amble (text, tlen, flags)
|
||||||
#define ST_CHAR 2
|
#define ST_CHAR 2
|
||||||
|
|
||||||
static char **
|
static char **
|
||||||
mkseq (start, end, type)
|
mkseq (start, end, incr, type)
|
||||||
int start, end, type;
|
int start, end, incr, type;
|
||||||
{
|
{
|
||||||
int n, incr, i;
|
int n, i;
|
||||||
char **result, *t;
|
char **result, *t;
|
||||||
|
|
||||||
n = abs (end - start) + 1;
|
n = abs (end - start) + 1;
|
||||||
result = strvec_create (n + 1);
|
result = strvec_create (n + 1);
|
||||||
|
|
||||||
incr = (start < end) ? 1 : -1;
|
if (incr == 0)
|
||||||
|
incr = 1;
|
||||||
|
|
||||||
|
if (start > end && incr > 0)
|
||||||
|
incr = -incr;
|
||||||
|
else if (start < end && incr < 0)
|
||||||
|
incr = -incr;
|
||||||
|
|
||||||
/* Make sure we go through the loop at least once, so {3..3} prints `3' */
|
/* Make sure we go through the loop at least once, so {3..3} prints `3' */
|
||||||
i = 0;
|
i = 0;
|
||||||
n = start;
|
n = start;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
#if defined (SHELL)
|
||||||
|
QUIT; /* XXX - memory leak here */
|
||||||
|
#endif
|
||||||
if (type == ST_INT)
|
if (type == ST_INT)
|
||||||
result[i++] = itos (n);
|
result[i++] = itos (n);
|
||||||
else
|
else
|
||||||
|
@ -349,7 +401,7 @@ expand_seqterm (text, tlen)
|
||||||
rhs_v = tr;
|
rhs_v = tr;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = mkseq (lhs_v, rhs_v, lhs_t);
|
result = mkseq (lhs_v, rhs_v, 1, lhs_t);
|
||||||
|
|
||||||
free (lhs);
|
free (lhs);
|
||||||
free (rhs);
|
free (rhs);
|
||||||
|
@ -361,6 +413,11 @@ expand_seqterm (text, tlen)
|
||||||
index of the character matching SATISFY. This understands about
|
index of the character matching SATISFY. This understands about
|
||||||
quoting. Return the character that caused us to stop searching;
|
quoting. Return the character that caused us to stop searching;
|
||||||
this is either the same as SATISFY, or 0. */
|
this is either the same as SATISFY, or 0. */
|
||||||
|
/* If SATISFY is `}', we are looking for a brace expression, so we
|
||||||
|
should enforce the rules that govern valid brace expansions:
|
||||||
|
1) to count as an arg separator, a comma or `..' has to be outside
|
||||||
|
an inner set of braces.
|
||||||
|
*/
|
||||||
static int
|
static int
|
||||||
brace_gobbler (text, tlen, indx, satisfy)
|
brace_gobbler (text, tlen, indx, satisfy)
|
||||||
char *text;
|
char *text;
|
||||||
|
@ -368,7 +425,7 @@ brace_gobbler (text, tlen, indx, satisfy)
|
||||||
int *indx;
|
int *indx;
|
||||||
int satisfy;
|
int satisfy;
|
||||||
{
|
{
|
||||||
register int i, c, quoted, level, pass_next;
|
register int i, c, quoted, level, commas, pass_next;
|
||||||
#if defined (SHELL)
|
#if defined (SHELL)
|
||||||
int si;
|
int si;
|
||||||
char *t;
|
char *t;
|
||||||
|
@ -376,6 +433,11 @@ brace_gobbler (text, tlen, indx, satisfy)
|
||||||
DECLARE_MBSTATE;
|
DECLARE_MBSTATE;
|
||||||
|
|
||||||
level = quoted = pass_next = 0;
|
level = quoted = pass_next = 0;
|
||||||
|
#if defined (CSH_BRACE_COMPAT)
|
||||||
|
commas = 1;
|
||||||
|
#else
|
||||||
|
commas = (satisfy == '}') ? 0 : 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
i = *indx;
|
i = *indx;
|
||||||
while (c = text[i])
|
while (c = text[i])
|
||||||
|
@ -436,7 +498,7 @@ brace_gobbler (text, tlen, indx, satisfy)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (c == satisfy && level == 0 && quoted == 0)
|
if (c == satisfy && level == 0 && quoted == 0 && commas > 0)
|
||||||
{
|
{
|
||||||
/* We ignore an open brace surrounded by whitespace, and also
|
/* We ignore an open brace surrounded by whitespace, and also
|
||||||
an open brace followed immediately by a close brace preceded
|
an open brace followed immediately by a close brace preceded
|
||||||
|
@ -456,6 +518,13 @@ brace_gobbler (text, tlen, indx, satisfy)
|
||||||
level++;
|
level++;
|
||||||
else if (c == '}' && level)
|
else if (c == '}' && level)
|
||||||
level--;
|
level--;
|
||||||
|
#if !defined (CSH_BRACE_COMPAT)
|
||||||
|
else if (satisfy == '}' && c == brace_arg_separator && level == 0)
|
||||||
|
commas++;
|
||||||
|
else if (satisfy == '}' && STREQN (text+i, BRACE_SEQ_SPECIFIER, 2) &&
|
||||||
|
text[i+2] != satisfy && level == 0)
|
||||||
|
commas++;
|
||||||
|
#endif
|
||||||
|
|
||||||
ADVANCE_CHAR (text, tlen, i);
|
ADVANCE_CHAR (text, tlen, i);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||||
|
|
||||||
PACKAGE = @PACKAGE@
|
PACKAGE = @PACKAGE_NAME@
|
||||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||||
PACKAGE_NAME = @PACKAGE_NAME@
|
PACKAGE_NAME = @PACKAGE_NAME@
|
||||||
PACKAGE_STRING = @PACKAGE_STRING@
|
PACKAGE_STRING = @PACKAGE_STRING@
|
||||||
|
@ -178,7 +178,7 @@ helpdoc: $(MKBUILTINS) $(DEFSRC)
|
||||||
|
|
||||||
install-help:
|
install-help:
|
||||||
@-if test -n "${HELPDIR}" && test -d helpfiles ; then \
|
@-if test -n "${HELPDIR}" && test -d helpfiles ; then \
|
||||||
test -d ${HELPDIR} || ${SHELL} ${MKDIRS} $(DESTDIR)$(HELPDIR) ;\
|
test -d $(DESTDIR)${HELPDIR} || ${SHELL} ${MKDIRS} $(DESTDIR)$(HELPDIR) ;\
|
||||||
( for f in helpfiles/*; do \
|
( for f in helpfiles/*; do \
|
||||||
echo installing $$f; \
|
echo installing $$f; \
|
||||||
${INSTALL_DATA} $$f $(DESTDIR)$(HELPDIR); \
|
${INSTALL_DATA} $$f $(DESTDIR)$(HELPDIR); \
|
||||||
|
|
|
@ -28,9 +28,9 @@ $SHORT_DOC caller [EXPR]
|
||||||
|
|
||||||
Returns the context of the current subroutine call.
|
Returns the context of the current subroutine call.
|
||||||
|
|
||||||
Without EXPR, returns returns "$line $filename". With EXPR,
|
Without EXPR, returns "$line $filename". With EXPR,
|
||||||
returns "$line $subroutine $filename"; this extra information
|
returns "$line $subroutine $filename"; this extra information
|
||||||
can be used used to provide a stack trace.
|
can be used to provide a stack trace.
|
||||||
|
|
||||||
The value of EXPR indicates how many call frames to go back before the
|
The value of EXPR indicates how many call frames to go back before the
|
||||||
current one; the top frame is frame 0.
|
current one; the top frame is frame 0.
|
||||||
|
@ -76,7 +76,6 @@ caller_builtin (list)
|
||||||
SHELL_VAR *funcname_v, *bash_source_v, *bash_lineno_v;
|
SHELL_VAR *funcname_v, *bash_source_v, *bash_lineno_v;
|
||||||
ARRAY *funcname_a, *bash_source_a, *bash_lineno_a;
|
ARRAY *funcname_a, *bash_source_a, *bash_lineno_a;
|
||||||
char *funcname_s, *source_s, *lineno_s;
|
char *funcname_s, *source_s, *lineno_s;
|
||||||
ARRAY_ELEMENT *ae;
|
|
||||||
intmax_t num;
|
intmax_t num;
|
||||||
|
|
||||||
GET_ARRAY_FROM_VAR ("FUNCNAME", funcname_v, funcname_a);
|
GET_ARRAY_FROM_VAR ("FUNCNAME", funcname_v, funcname_a);
|
||||||
|
|
|
@ -60,6 +60,7 @@ extern char *bash_getcwd_errstr;
|
||||||
|
|
||||||
static int bindpwd __P((int));
|
static int bindpwd __P((int));
|
||||||
static void setpwd __P((char *));
|
static void setpwd __P((char *));
|
||||||
|
static char *resetpwd __P((char *));
|
||||||
static int change_to_directory __P((char *, int));
|
static int change_to_directory __P((char *, int));
|
||||||
|
|
||||||
static char *cdspell __P((char *));
|
static char *cdspell __P((char *));
|
||||||
|
|
|
@ -467,9 +467,6 @@ char *
|
||||||
get_working_directory (for_whom)
|
get_working_directory (for_whom)
|
||||||
char *for_whom;
|
char *for_whom;
|
||||||
{
|
{
|
||||||
char *directory;
|
|
||||||
size_t dsize;
|
|
||||||
|
|
||||||
if (no_symbolic_links)
|
if (no_symbolic_links)
|
||||||
{
|
{
|
||||||
FREE (the_current_working_directory);
|
FREE (the_current_working_directory);
|
||||||
|
|
|
@ -149,7 +149,7 @@ extern void set_var_attribute __P((char *, int, int));
|
||||||
extern char *get_dirstack_from_string __P((char *));
|
extern char *get_dirstack_from_string __P((char *));
|
||||||
extern char *get_dirstack_element __P((intmax_t, int));
|
extern char *get_dirstack_element __P((intmax_t, int));
|
||||||
extern void set_dirstack_element __P((intmax_t, int, char *));
|
extern void set_dirstack_element __P((intmax_t, int, char *));
|
||||||
extern WORD_LIST *get_directory_stack __P((void));
|
extern WORD_LIST *get_directory_stack __P((int));
|
||||||
|
|
||||||
/* Functions from evalstring.c */
|
/* Functions from evalstring.c */
|
||||||
extern int parse_and_execute __P((char *, const char *, int));
|
extern int parse_and_execute __P((char *, const char *, int));
|
||||||
|
|
|
@ -76,6 +76,7 @@ $END
|
||||||
#include "bashgetopt.h"
|
#include "bashgetopt.h"
|
||||||
|
|
||||||
extern int array_needs_making;
|
extern int array_needs_making;
|
||||||
|
extern int posixly_correct;
|
||||||
|
|
||||||
static int declare_internal __P((register WORD_LIST *, int));
|
static int declare_internal __P((register WORD_LIST *, int));
|
||||||
|
|
||||||
|
@ -257,7 +258,11 @@ declare_internal (list, local_var)
|
||||||
making_array_special = 0;
|
making_array_special = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (legal_identifier (name) == 0)
|
/* If we're in posix mode or not looking for a shell function (since
|
||||||
|
shell function names don't have to be valid identifiers when the
|
||||||
|
shell's not in posix mode), check whether or not the argument is a
|
||||||
|
valid, well-formed shell identifier. */
|
||||||
|
if ((posixly_correct || (flags_on & att_function) == 0) && legal_identifier (name) == 0)
|
||||||
{
|
{
|
||||||
sh_invalidid (name);
|
sh_invalidid (name);
|
||||||
assign_error++;
|
assign_error++;
|
||||||
|
|
|
@ -31,6 +31,8 @@ $PRODUCES echo.c
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "../shell.h"
|
#include "../shell.h"
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
$BUILTIN echo
|
$BUILTIN echo
|
||||||
$FUNCTION echo_builtin
|
$FUNCTION echo_builtin
|
||||||
$DEPENDS_ON V9_ECHO
|
$DEPENDS_ON V9_ECHO
|
||||||
|
@ -48,7 +50,8 @@ following backslash-escaped characters is turned on:
|
||||||
\t horizontal tab
|
\t horizontal tab
|
||||||
\v vertical tab
|
\v vertical tab
|
||||||
\\ backslash
|
\\ backslash
|
||||||
\num the character whose ASCII code is NUM (octal).
|
\0nnn the character whose ASCII code is NNN (octal). NNN can be
|
||||||
|
0 to 3 octal digits
|
||||||
|
|
||||||
You can explicitly turn off the interpretation of the above characters
|
You can explicitly turn off the interpretation of the above characters
|
||||||
with the -E option.
|
with the -E option.
|
||||||
|
|
|
@ -63,7 +63,7 @@ extern int errno;
|
||||||
#define FEVAL_NOPUSHARGS 0x100
|
#define FEVAL_NOPUSHARGS 0x100
|
||||||
|
|
||||||
extern int posixly_correct;
|
extern int posixly_correct;
|
||||||
extern int indirection_level, startup_state, subshell_environment;
|
extern int indirection_level, subshell_environment;
|
||||||
extern int return_catch_flag, return_catch_value;
|
extern int return_catch_flag, return_catch_value;
|
||||||
extern int last_command_exit_value;
|
extern int last_command_exit_value;
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ extern int errno;
|
||||||
|
|
||||||
#define IS_BUILTIN(s) (builtin_address_internal(s, 0) != (struct builtin *)NULL)
|
#define IS_BUILTIN(s) (builtin_address_internal(s, 0) != (struct builtin *)NULL)
|
||||||
|
|
||||||
extern int indirection_level, startup_state, subshell_environment;
|
extern int indirection_level, subshell_environment;
|
||||||
extern int line_number;
|
extern int line_number;
|
||||||
extern int last_command_exit_value;
|
extern int last_command_exit_value;
|
||||||
extern int running_trap;
|
extern int running_trap;
|
||||||
|
@ -316,9 +316,8 @@ static int
|
||||||
cat_file (r)
|
cat_file (r)
|
||||||
REDIRECT *r;
|
REDIRECT *r;
|
||||||
{
|
{
|
||||||
char lbuf[128], *fn;
|
char *fn;
|
||||||
int fd, rval;
|
int fd, rval;
|
||||||
ssize_t nr;
|
|
||||||
|
|
||||||
if (r->instruction != r_input_direction)
|
if (r->instruction != r_input_direction)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -81,7 +81,6 @@ $END
|
||||||
extern int errno;
|
extern int errno;
|
||||||
#endif /* !errno */
|
#endif /* !errno */
|
||||||
|
|
||||||
extern int echo_input_at_read;
|
|
||||||
extern int current_command_line_count;
|
extern int current_command_line_count;
|
||||||
extern int literal_history;
|
extern int literal_history;
|
||||||
extern int posixly_correct;
|
extern int posixly_correct;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
This file is hash.def, from which is created hash.c.
|
This file is hash.def, from which is created hash.c.
|
||||||
It implements the builtin "hash" in Bash.
|
It implements the builtin "hash" in Bash.
|
||||||
|
|
||||||
Copyright (C) 1987-2003 Free Software Foundation, Inc.
|
Copyright (C) 1987-2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GNU Bash, the Bourne Again SHell.
|
This file is part of GNU Bash, the Bourne Again SHell.
|
||||||
|
|
||||||
|
@ -59,6 +59,7 @@ $END
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "bashgetopt.h"
|
#include "bashgetopt.h"
|
||||||
|
|
||||||
|
extern int posixly_correct;
|
||||||
extern int dot_found_in_search;
|
extern int dot_found_in_search;
|
||||||
extern char *this_command_name;
|
extern char *this_command_name;
|
||||||
|
|
||||||
|
@ -124,8 +125,9 @@ hash_builtin (list)
|
||||||
we test expunge_hash_table. */
|
we test expunge_hash_table. */
|
||||||
if (list == 0 && expunge_hash_table == 0)
|
if (list == 0 && expunge_hash_table == 0)
|
||||||
{
|
{
|
||||||
if (print_hashed_commands (list_portably) == 0)
|
opt = print_hashed_commands (list_portably);
|
||||||
fprintf (stderr, _("%s: hash table empty\n"), this_command_name);
|
if (opt == 0 && posixly_correct == 0)
|
||||||
|
printf (_("%s: hash table empty\n"), this_command_name);
|
||||||
|
|
||||||
return (EXECUTION_SUCCESS);
|
return (EXECUTION_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* mkbuiltins.c - Create builtins.c, builtext.h, and builtdoc.c from
|
/* mkbuiltins.c - Create builtins.c, builtext.h, and builtdoc.c from
|
||||||
a single source file called builtins.def. */
|
a single source file called builtins.def. */
|
||||||
|
|
||||||
/* Copyright (C) 1987-2002 Free Software Foundation, Inc.
|
/* Copyright (C) 1987-2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GNU Bash, the Bourne Again SHell.
|
This file is part of GNU Bash, the Bourne Again SHell.
|
||||||
|
|
||||||
|
@ -19,7 +19,16 @@ 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
|
with Bash; see the file COPYING. If not, write to the Free Software
|
||||||
Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
|
Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
|
||||||
|
|
||||||
#include <config.h>
|
#if !defined (CROSS_COMPILING)
|
||||||
|
# include <config.h>
|
||||||
|
#else /* CROSS_COMPILING */
|
||||||
|
/* A conservative set of defines based on POSIX/SUS3/XPG6 */
|
||||||
|
# define HAVE_UNISTD_H
|
||||||
|
# define HAVE_STRING_H
|
||||||
|
# define HAVE_STDLIB_H
|
||||||
|
|
||||||
|
# define HAVE_RENAME
|
||||||
|
#endif /* CROSS_COMPILING */
|
||||||
|
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
# ifdef _MINIX
|
# ifdef _MINIX
|
||||||
|
@ -1360,7 +1369,7 @@ write_documentation (stream, documentation, indentation, flags)
|
||||||
register char *line;
|
register char *line;
|
||||||
int string_array, texinfo, base_indent, last_cpp, filename_p;
|
int string_array, texinfo, base_indent, last_cpp, filename_p;
|
||||||
|
|
||||||
if (!stream)
|
if (stream == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
string_array = flags & STRING_ARRAY;
|
string_array = flags & STRING_ARRAY;
|
||||||
|
@ -1372,7 +1381,12 @@ write_documentation (stream, documentation, indentation, flags)
|
||||||
if (single_longdoc_strings)
|
if (single_longdoc_strings)
|
||||||
{
|
{
|
||||||
if (filename_p == 0)
|
if (filename_p == 0)
|
||||||
fprintf (stream, "N_(\" "); /* the empty string translates specially. */
|
{
|
||||||
|
if (documentation && documentation[0] && documentation[0][0])
|
||||||
|
fprintf (stream, "N_(\"");
|
||||||
|
else
|
||||||
|
fprintf (stream, "N_(\" "); /* the empty string translates specially. */
|
||||||
|
}
|
||||||
else
|
else
|
||||||
fprintf (stream, "\"");
|
fprintf (stream, "\"");
|
||||||
}
|
}
|
||||||
|
@ -1398,7 +1412,12 @@ write_documentation (stream, documentation, indentation, flags)
|
||||||
if (string_array && single_longdoc_strings == 0)
|
if (string_array && single_longdoc_strings == 0)
|
||||||
{
|
{
|
||||||
if (filename_p == 0)
|
if (filename_p == 0)
|
||||||
fprintf (stream, " N_(\" "); /* the empty string translates specially. */
|
{
|
||||||
|
if (line[0])
|
||||||
|
fprintf (stream, " N_(\"");
|
||||||
|
else
|
||||||
|
fprintf (stream, " N_(\" "); /* the empty string translates specially. */
|
||||||
|
}
|
||||||
else
|
else
|
||||||
fprintf (stream, " \"");
|
fprintf (stream, " \"");
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,6 +91,7 @@ extern int errno;
|
||||||
do { \
|
do { \
|
||||||
char *b = 0; \
|
char *b = 0; \
|
||||||
int nw; \
|
int nw; \
|
||||||
|
clearerr (stdout); \
|
||||||
if (have_fieldwidth && have_precision) \
|
if (have_fieldwidth && have_precision) \
|
||||||
nw = asprintf(&b, f, fieldwidth, precision, func); \
|
nw = asprintf(&b, f, fieldwidth, precision, func); \
|
||||||
else if (have_fieldwidth) \
|
else if (have_fieldwidth) \
|
||||||
|
@ -106,6 +107,12 @@ extern int errno;
|
||||||
(void)vbadd (b, nw); \
|
(void)vbadd (b, nw); \
|
||||||
else \
|
else \
|
||||||
(void)fputs (b, stdout); \
|
(void)fputs (b, stdout); \
|
||||||
|
if (ferror (stdout)) \
|
||||||
|
{ \
|
||||||
|
sh_wrerror (); \
|
||||||
|
clearerr (stdout); \
|
||||||
|
return (EXECUTION_FAILURE); \
|
||||||
|
} \
|
||||||
free (b); \
|
free (b); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
@ -132,6 +139,11 @@ extern int errno;
|
||||||
vbuf = 0; \
|
vbuf = 0; \
|
||||||
} \
|
} \
|
||||||
fflush (stdout); \
|
fflush (stdout); \
|
||||||
|
if (ferror (stdout)) \
|
||||||
|
{ \
|
||||||
|
clearerr (stdout); \
|
||||||
|
return (EXECUTION_FAILURE); \
|
||||||
|
} \
|
||||||
return (value); \
|
return (value); \
|
||||||
} \
|
} \
|
||||||
while (0)
|
while (0)
|
||||||
|
@ -407,7 +419,9 @@ printf_builtin (list)
|
||||||
|
|
||||||
r = 0;
|
r = 0;
|
||||||
p = getstr ();
|
p = getstr ();
|
||||||
if (ansic_shouldquote (p))
|
if (p && *p == 0) /* XXX - getstr never returns null */
|
||||||
|
xp = savestring ("''");
|
||||||
|
else if (ansic_shouldquote (p))
|
||||||
xp = ansic_quote (p, 0, (int *)0);
|
xp = ansic_quote (p, 0, (int *)0);
|
||||||
else
|
else
|
||||||
xp = sh_backslash_quote (p);
|
xp = sh_backslash_quote (p);
|
||||||
|
@ -816,7 +830,7 @@ vbadd (buf, blen)
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (strlen (vbuf) != vblen)
|
if (strlen (vbuf) != vblen)
|
||||||
internal_error ("printf:vbadd: vblen (%d) != strlen (vbuf) (%d)", vblen, strlen (vbuf));
|
internal_error ("printf:vbadd: vblen (%d) != strlen (vbuf) (%d)", vblen, (int)strlen (vbuf));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return vbuf;
|
return vbuf;
|
||||||
|
|
|
@ -620,7 +620,8 @@ set_dirstack_element (ind, sign, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
WORD_LIST *
|
WORD_LIST *
|
||||||
get_directory_stack ()
|
get_directory_stack (flags)
|
||||||
|
int flags;
|
||||||
{
|
{
|
||||||
register int i;
|
register int i;
|
||||||
WORD_LIST *ret;
|
WORD_LIST *ret;
|
||||||
|
@ -628,7 +629,8 @@ get_directory_stack ()
|
||||||
|
|
||||||
for (ret = (WORD_LIST *)NULL, i = 0; i < directory_list_offset; i++)
|
for (ret = (WORD_LIST *)NULL, i = 0; i < directory_list_offset; i++)
|
||||||
{
|
{
|
||||||
d = polite_directory_format (pushd_directory_list[i]);
|
d = (flags&1) ? polite_directory_format (pushd_directory_list[i])
|
||||||
|
: pushd_directory_list[i];
|
||||||
ret = make_word_list (make_word (d), ret);
|
ret = make_word_list (make_word (d), ret);
|
||||||
}
|
}
|
||||||
/* Now the current directory. */
|
/* Now the current directory. */
|
||||||
|
@ -657,7 +659,7 @@ get_directory_stack ()
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef LOADABLE_BUILTIN
|
#ifdef LOADABLE_BUILTIN
|
||||||
static char * const dirs_doc[] = {
|
char * const dirs_doc[] = {
|
||||||
N_("Display the list of currently remembered directories. Directories"),
|
N_("Display the list of currently remembered directories. Directories"),
|
||||||
N_("find their way onto the list with the `pushd' command; you can get"),
|
N_("find their way onto the list with the `pushd' command; you can get"),
|
||||||
N_("back up through the list with the `popd' command."),
|
N_("back up through the list with the `popd' command."),
|
||||||
|
@ -678,7 +680,7 @@ static char * const dirs_doc[] = {
|
||||||
(char *)NULL
|
(char *)NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
static char * const pushd_doc[] = {
|
char * const pushd_doc[] = {
|
||||||
N_("Adds a directory to the top of the directory stack, or rotates"),
|
N_("Adds a directory to the top of the directory stack, or rotates"),
|
||||||
N_("the stack, making the new top of the stack the current working"),
|
N_("the stack, making the new top of the stack the current working"),
|
||||||
N_("directory. With no arguments, exchanges the top two directories."),
|
N_("directory. With no arguments, exchanges the top two directories."),
|
||||||
|
@ -701,7 +703,7 @@ static char * const pushd_doc[] = {
|
||||||
(char *)NULL
|
(char *)NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
static char * const popd_doc[] = {
|
char * const popd_doc[] = {
|
||||||
N_("Removes entries from the directory stack. With no arguments,"),
|
N_("Removes entries from the directory stack. With no arguments,"),
|
||||||
N_("removes the top directory from the stack, and cd's to the new"),
|
N_("removes the top directory from the stack, and cd's to the new"),
|
||||||
N_("top directory."),
|
N_("top directory."),
|
||||||
|
|
|
@ -87,9 +87,8 @@ $END
|
||||||
extern int errno;
|
extern int errno;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern int interrupt_immediately;
|
|
||||||
|
|
||||||
#if defined (READLINE)
|
#if defined (READLINE)
|
||||||
|
static void reset_attempted_completion_function __P((char *));
|
||||||
static char *edit_line __P((char *));
|
static char *edit_line __P((char *));
|
||||||
static void set_eol_delim __P((int));
|
static void set_eol_delim __P((int));
|
||||||
static void reset_eol_delim __P((char *));
|
static void reset_eol_delim __P((char *));
|
||||||
|
@ -330,6 +329,10 @@ read_builtin (list)
|
||||||
}
|
}
|
||||||
old_alrm = set_signal_handler (SIGALRM, sigalrm);
|
old_alrm = set_signal_handler (SIGALRM, sigalrm);
|
||||||
add_unwind_protect (reset_alarm, (char *)NULL);
|
add_unwind_protect (reset_alarm, (char *)NULL);
|
||||||
|
#if defined (READLINE)
|
||||||
|
if (edit)
|
||||||
|
add_unwind_protect (reset_attempted_completion_function, (char *)NULL);
|
||||||
|
#endif
|
||||||
alarm (tmout);
|
alarm (tmout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -375,6 +378,7 @@ read_builtin (list)
|
||||||
of the unwind-protect stack after the realloc() works right. */
|
of the unwind-protect stack after the realloc() works right. */
|
||||||
add_unwind_protect (xfree, input_string);
|
add_unwind_protect (xfree, input_string);
|
||||||
interrupt_immediately++;
|
interrupt_immediately++;
|
||||||
|
terminate_immediately = 1;
|
||||||
|
|
||||||
unbuffered_read = (nchars > 0) || (delim != '\n') || input_is_pipe;
|
unbuffered_read = (nchars > 0) || (delim != '\n') || input_is_pipe;
|
||||||
|
|
||||||
|
@ -472,6 +476,7 @@ add_char:
|
||||||
if (retval < 0)
|
if (retval < 0)
|
||||||
{
|
{
|
||||||
builtin_error (_("read error: %d: %s"), fd, strerror (errno));
|
builtin_error (_("read error: %d: %s"), fd, strerror (errno));
|
||||||
|
run_unwind_frame ("read_builtin");
|
||||||
return (EXECUTION_FAILURE);
|
return (EXECUTION_FAILURE);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -501,6 +506,7 @@ add_char:
|
||||||
zsyncfd (fd);
|
zsyncfd (fd);
|
||||||
|
|
||||||
interrupt_immediately--;
|
interrupt_immediately--;
|
||||||
|
terminate_immediately = 0;
|
||||||
discard_unwind_frame ("read_builtin");
|
discard_unwind_frame ("read_builtin");
|
||||||
|
|
||||||
retval = eof ? EXECUTION_FAILURE : EXECUTION_SUCCESS;
|
retval = eof ? EXECUTION_FAILURE : EXECUTION_SUCCESS;
|
||||||
|
@ -519,13 +525,19 @@ add_char:
|
||||||
|
|
||||||
var = find_or_make_array_variable (arrayname, 1);
|
var = find_or_make_array_variable (arrayname, 1);
|
||||||
if (var == 0)
|
if (var == 0)
|
||||||
return EXECUTION_FAILURE; /* readonly or noassign */
|
{
|
||||||
|
xfree (input_string);
|
||||||
|
return EXECUTION_FAILURE; /* readonly or noassign */
|
||||||
|
}
|
||||||
array_flush (array_cell (var));
|
array_flush (array_cell (var));
|
||||||
|
|
||||||
alist = list_string (input_string, ifs_chars, 0);
|
alist = list_string (input_string, ifs_chars, 0);
|
||||||
if (alist)
|
if (alist)
|
||||||
{
|
{
|
||||||
word_list_remove_quoted_nulls (alist);
|
if (saw_escape)
|
||||||
|
dequote_list (alist);
|
||||||
|
else
|
||||||
|
word_list_remove_quoted_nulls (alist);
|
||||||
assign_array_var_from_word_list (var, alist, 0);
|
assign_array_var_from_word_list (var, alist, 0);
|
||||||
dispose_words (alist);
|
dispose_words (alist);
|
||||||
}
|
}
|
||||||
|
@ -688,7 +700,15 @@ bind_read_variable (name, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined (READLINE)
|
#if defined (READLINE)
|
||||||
static rl_completion_func_t *old_attempted_completion_function;
|
static rl_completion_func_t *old_attempted_completion_function = 0;
|
||||||
|
|
||||||
|
static void
|
||||||
|
reset_attempted_completion_function (cp)
|
||||||
|
char *cp;
|
||||||
|
{
|
||||||
|
if (rl_attempted_completion_function == 0 && old_attempted_completion_function)
|
||||||
|
rl_attempted_completion_function = old_attempted_completion_function;
|
||||||
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
edit_line (p)
|
edit_line (p)
|
||||||
|
@ -699,10 +719,13 @@ edit_line (p)
|
||||||
|
|
||||||
if (bash_readline_initialized == 0)
|
if (bash_readline_initialized == 0)
|
||||||
initialize_readline ();
|
initialize_readline ();
|
||||||
|
|
||||||
old_attempted_completion_function = rl_attempted_completion_function;
|
old_attempted_completion_function = rl_attempted_completion_function;
|
||||||
rl_attempted_completion_function = (rl_completion_func_t *)NULL;
|
rl_attempted_completion_function = (rl_completion_func_t *)NULL;
|
||||||
ret = readline (p);
|
ret = readline (p);
|
||||||
rl_attempted_completion_function = old_attempted_completion_function;
|
rl_attempted_completion_function = old_attempted_completion_function;
|
||||||
|
old_attempted_completion_function = (rl_completion_func_t *)NULL;
|
||||||
|
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
return ret;
|
return ret;
|
||||||
len = strlen (ret);
|
len = strlen (ret);
|
||||||
|
|
|
@ -2,7 +2,7 @@ This file is reserved.def, in which the shell reserved words are defined.
|
||||||
It has no direct C file production, but defines builtins for the Bash
|
It has no direct C file production, but defines builtins for the Bash
|
||||||
builtin help command.
|
builtin help command.
|
||||||
|
|
||||||
Copyright (C) 1987-2005 Free Software Foundation, Inc.
|
Copyright (C) 1987-2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GNU Bash, the Bourne Again SHell.
|
This file is part of GNU Bash, the Bourne Again SHell.
|
||||||
|
|
||||||
|
@ -146,21 +146,21 @@ $END
|
||||||
$BUILTIN variables
|
$BUILTIN variables
|
||||||
$DOCNAME variable_help
|
$DOCNAME variable_help
|
||||||
$SHORT_DOC variables - Some variable names and meanings
|
$SHORT_DOC variables - Some variable names and meanings
|
||||||
BASH_VERSION Version information for this Bash.
|
BASH_VERSION Version information for this Bash.
|
||||||
CDPATH A colon-separated list of directories to search
|
CDPATH A colon-separated list of directories to search
|
||||||
for directries given as arguments to `cd'.
|
for directries given as arguments to `cd'.
|
||||||
GLOBIGNORE A colon-separated list of patterns describing filenames to
|
GLOBIGNORE A colon-separated list of patterns describing filenames to
|
||||||
be ignored by pathname expansion.
|
be ignored by pathname expansion.
|
||||||
#if defined (HISTORY)
|
#if defined (HISTORY)
|
||||||
HISTFILE The name of the file where your command history is stored.
|
HISTFILE The name of the file where your command history is stored.
|
||||||
HISTFILESIZE The maximum number of lines this file can contain.
|
HISTFILESIZE The maximum number of lines this file can contain.
|
||||||
HISTSIZE The maximum number of history lines that a running
|
HISTSIZE The maximum number of history lines that a running
|
||||||
shell can access.
|
shell can access.
|
||||||
#endif /* HISTORY */
|
#endif /* HISTORY */
|
||||||
HOME The complete pathname to your login directory.
|
HOME The complete pathname to your login directory.
|
||||||
HOSTNAME The name of the current host.
|
HOSTNAME The name of the current host.
|
||||||
HOSTTYPE The type of CPU this version of Bash is running under.
|
HOSTTYPE The type of CPU this version of Bash is running under.
|
||||||
IGNOREEOF Controls the action of the shell on receipt of an EOF
|
IGNOREEOF Controls the action of the shell on receipt of an EOF
|
||||||
character as the sole input. If set, then the value
|
character as the sole input. If set, then the value
|
||||||
of it is the number of EOF characters that can be seen
|
of it is the number of EOF characters that can be seen
|
||||||
in a row on an empty line before the shell will exit
|
in a row on an empty line before the shell will exit
|
||||||
|
@ -169,19 +169,19 @@ MACHTYPE A string describing the current system Bash is running on.
|
||||||
MAILCHECK How often, in seconds, Bash checks for new mail.
|
MAILCHECK How often, in seconds, Bash checks for new mail.
|
||||||
MAILPATH A colon-separated list of filenames which Bash checks
|
MAILPATH A colon-separated list of filenames which Bash checks
|
||||||
for new mail.
|
for new mail.
|
||||||
OSTYPE The version of Unix this version of Bash is running on.
|
OSTYPE The version of Unix this version of Bash is running on.
|
||||||
PATH A colon-separated list of directories to search when
|
PATH A colon-separated list of directories to search when
|
||||||
looking for commands.
|
looking for commands.
|
||||||
PROMPT_COMMAND A command to be executed before the printing of each
|
PROMPT_COMMAND A command to be executed before the printing of each
|
||||||
primary prompt.
|
primary prompt.
|
||||||
PS1 The primary prompt string.
|
PS1 The primary prompt string.
|
||||||
PS2 The secondary prompt string.
|
PS2 The secondary prompt string.
|
||||||
PWD The full pathname of the current directory.
|
PWD The full pathname of the current directory.
|
||||||
SHELLOPTS A colon-separated list of enabled shell options.
|
SHELLOPTS A colon-separated list of enabled shell options.
|
||||||
TERM The name of the current terminal type.
|
TERM The name of the current terminal type.
|
||||||
TIMEFORMAT The output format for timing statistics displayed by the
|
TIMEFORMAT The output format for timing statistics displayed by the
|
||||||
`time' reserved word.
|
`time' reserved word.
|
||||||
auto_resume Non-null means a command word appearing on a line by
|
auto_resume Non-null means a command word appearing on a line by
|
||||||
itself is first looked for in the list of currently
|
itself is first looked for in the list of currently
|
||||||
stopped jobs. If found there, that job is foregrounded.
|
stopped jobs. If found there, that job is foregrounded.
|
||||||
A value of `exact' means that the command word must
|
A value of `exact' means that the command word must
|
||||||
|
@ -191,7 +191,7 @@ auto_resume Non-null means a command word appearing on a line by
|
||||||
the command must be a prefix of a stopped job.
|
the command must be a prefix of a stopped job.
|
||||||
#if defined (HISTORY)
|
#if defined (HISTORY)
|
||||||
# if defined (BANG_HISTORY)
|
# if defined (BANG_HISTORY)
|
||||||
histchars Characters controlling history expansion and quick
|
histchars Characters controlling history expansion and quick
|
||||||
substitution. The first character is the history
|
substitution. The first character is the history
|
||||||
substitution character, usually `!'. The second is
|
substitution character, usually `!'. The second is
|
||||||
the `quick substitution' character, usually `^'. The
|
the `quick substitution' character, usually `^'. The
|
||||||
|
|
|
@ -578,7 +578,6 @@ set_builtin (list)
|
||||||
WORD_LIST *list;
|
WORD_LIST *list;
|
||||||
{
|
{
|
||||||
int on_or_off, flag_name, force_assignment, opts_changed;
|
int on_or_off, flag_name, force_assignment, opts_changed;
|
||||||
WORD_LIST *l;
|
|
||||||
register char *arg;
|
register char *arg;
|
||||||
char s[3];
|
char s[3];
|
||||||
|
|
||||||
|
|
|
@ -68,9 +68,7 @@ $END
|
||||||
extern int errno;
|
extern int errno;
|
||||||
#endif /* !errno */
|
#endif /* !errno */
|
||||||
|
|
||||||
#if defined (RESTRICTED_SHELL)
|
static void maybe_pop_dollar_vars __P((void));
|
||||||
extern int restricted;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* If non-zero, `.' uses $PATH to look up the script to be sourced. */
|
/* If non-zero, `.' uses $PATH to look up the script to be sourced. */
|
||||||
int source_uses_path = 1;
|
int source_uses_path = 1;
|
||||||
|
|
|
@ -48,13 +48,15 @@ $END
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "bashgetopt.h"
|
#include "bashgetopt.h"
|
||||||
|
|
||||||
|
static sighandler suspend_continue __P((int));
|
||||||
|
|
||||||
static SigHandler *old_cont;
|
static SigHandler *old_cont;
|
||||||
#if 0
|
#if 0
|
||||||
static SigHandler *old_stop;
|
static SigHandler *old_stop;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Continue handler. */
|
/* Continue handler. */
|
||||||
sighandler
|
static sighandler
|
||||||
suspend_continue (sig)
|
suspend_continue (sig)
|
||||||
int sig;
|
int sig;
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
This file is trap.def, from which is created trap.c.
|
This file is trap.def, from which is created trap.c.
|
||||||
It implements the builtin "trap" in Bash.
|
It implements the builtin "trap" in Bash.
|
||||||
|
|
||||||
Copyright (C) 1987-2005 Free Software Foundation, Inc.
|
Copyright (C) 1987-2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GNU Bash, the Bourne Again SHell.
|
This file is part of GNU Bash, the Bourne Again SHell.
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ int
|
||||||
trap_builtin (list)
|
trap_builtin (list)
|
||||||
WORD_LIST *list;
|
WORD_LIST *list;
|
||||||
{
|
{
|
||||||
int list_signal_names, display, result, opt, first_signal;
|
int list_signal_names, display, result, opt;
|
||||||
|
|
||||||
list_signal_names = display = 0;
|
list_signal_names = display = 0;
|
||||||
result = EXECUTION_SUCCESS;
|
result = EXECUTION_SUCCESS;
|
||||||
|
@ -124,7 +124,10 @@ trap_builtin (list)
|
||||||
first_arg = list->word->word;
|
first_arg = list->word->word;
|
||||||
first_signal = first_arg && *first_arg && all_digits (first_arg) && signal_object_p (first_arg, opt);
|
first_signal = first_arg && *first_arg && all_digits (first_arg) && signal_object_p (first_arg, opt);
|
||||||
|
|
||||||
/* Backwards compatibility */
|
/* Backwards compatibility. XXX - question about whether or not we
|
||||||
|
should throw an error if an all-digit argument doesn't correspond
|
||||||
|
to a valid signal number (e.g., if it's `50' on a system with only
|
||||||
|
32 signals). */
|
||||||
if (first_signal)
|
if (first_signal)
|
||||||
operation = REVERT;
|
operation = REVERT;
|
||||||
/* When in posix mode, the historical behavior of looking for a
|
/* When in posix mode, the historical behavior of looking for a
|
||||||
|
@ -176,7 +179,7 @@ trap_builtin (list)
|
||||||
if (interactive)
|
if (interactive)
|
||||||
set_signal_handler (SIGINT, sigint_sighandler);
|
set_signal_handler (SIGINT, sigint_sighandler);
|
||||||
else
|
else
|
||||||
set_signal_handler (SIGINT, termination_unwind_protect);
|
set_signal_handler (SIGINT, termsig_sighandler);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SIGQUIT:
|
case SIGQUIT:
|
||||||
|
|
|
@ -34,18 +34,20 @@ option is given, it is interpreted as follows:
|
||||||
-a all current limits are reported
|
-a all current limits are reported
|
||||||
-c the maximum size of core files created
|
-c the maximum size of core files created
|
||||||
-d the maximum size of a process's data segment
|
-d the maximum size of a process's data segment
|
||||||
-f the maximum size of files created by the shell
|
-e the maximum scheduling priority (`nice')
|
||||||
-i the maximum number of pending signals
|
-f the maximum size of files written by the shell and its children
|
||||||
|
-i the maximum number of pending signals
|
||||||
-l the maximum size a process may lock into memory
|
-l the maximum size a process may lock into memory
|
||||||
-m the maximum resident set size
|
-m the maximum resident set size
|
||||||
-n the maximum number of open file descriptors
|
-n the maximum number of open file descriptors
|
||||||
-p the pipe buffer size
|
-p the pipe buffer size
|
||||||
-q the maximum number of bytes in POSIX message queues
|
-q the maximum number of bytes in POSIX message queues
|
||||||
|
-r the maximum real-time scheduling priority
|
||||||
-s the maximum stack size
|
-s the maximum stack size
|
||||||
-t the maximum amount of cpu time in seconds
|
-t the maximum amount of cpu time in seconds
|
||||||
-u the maximum number of user processes
|
-u the maximum number of user processes
|
||||||
-v the size of virtual memory
|
-v the size of virtual memory
|
||||||
-x the maximum number of file locks
|
-x the maximum number of file locks
|
||||||
|
|
||||||
If LIMIT is given, it is the new value of the specified resource;
|
If LIMIT is given, it is the new value of the specified resource;
|
||||||
the special LIMIT values `soft', `hard', and `unlimited' stand for
|
the special LIMIT values `soft', `hard', and `unlimited' stand for
|
||||||
|
@ -201,6 +203,9 @@ static RESOURCE_LIMITS limits[] = {
|
||||||
#endif
|
#endif
|
||||||
#ifdef RLIMIT_DATA
|
#ifdef RLIMIT_DATA
|
||||||
{ 'd', RLIMIT_DATA, 1024, "data seg size", "kbytes" },
|
{ 'd', RLIMIT_DATA, 1024, "data seg size", "kbytes" },
|
||||||
|
#endif
|
||||||
|
#ifdef RLIMIT_NICE
|
||||||
|
{ 'e', RLIMIT_NICE, 1, "scheduling priority", (char *)NULL },
|
||||||
#endif
|
#endif
|
||||||
{ 'f', RLIMIT_FILESIZE, 1024, "file size", "blocks" },
|
{ 'f', RLIMIT_FILESIZE, 1024, "file size", "blocks" },
|
||||||
#ifdef RLIMIT_SIGPENDING
|
#ifdef RLIMIT_SIGPENDING
|
||||||
|
@ -217,6 +222,9 @@ static RESOURCE_LIMITS limits[] = {
|
||||||
#ifdef RLIMIT_MSGQUEUE
|
#ifdef RLIMIT_MSGQUEUE
|
||||||
{ 'q', RLIMIT_MSGQUEUE, 1, "POSIX message queues", "bytes" },
|
{ 'q', RLIMIT_MSGQUEUE, 1, "POSIX message queues", "bytes" },
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef RLIMIT_RTPRIO
|
||||||
|
{ 'r', RLIMIT_RTPRIO, 1, "real-time priority", (char *)NULL },
|
||||||
|
#endif
|
||||||
#ifdef RLIMIT_STACK
|
#ifdef RLIMIT_STACK
|
||||||
{ 's', RLIMIT_STACK, 1024, "stack size", "kbytes" },
|
{ 's', RLIMIT_STACK, 1024, "stack size", "kbytes" },
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -59,7 +59,6 @@ $END
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "bashgetopt.h"
|
#include "bashgetopt.h"
|
||||||
|
|
||||||
extern int interrupt_immediately;
|
|
||||||
extern int wait_signal_received;
|
extern int wait_signal_received;
|
||||||
|
|
||||||
procenv_t wait_intr_buf;
|
procenv_t wait_intr_buf;
|
||||||
|
|
41
command.h
41
command.h
|
@ -67,26 +67,27 @@ enum command_type { cm_for, cm_case, cm_while, cm_if, cm_simple, cm_select,
|
||||||
cm_arith, cm_cond, cm_arith_for, cm_subshell };
|
cm_arith, cm_cond, cm_arith_for, cm_subshell };
|
||||||
|
|
||||||
/* Possible values for the `flags' field of a WORD_DESC. */
|
/* Possible values for the `flags' field of a WORD_DESC. */
|
||||||
#define W_HASDOLLAR 0x00001 /* Dollar sign present. */
|
#define W_HASDOLLAR 0x000001 /* Dollar sign present. */
|
||||||
#define W_QUOTED 0x00002 /* Some form of quote character is present. */
|
#define W_QUOTED 0x000002 /* Some form of quote character is present. */
|
||||||
#define W_ASSIGNMENT 0x00004 /* This word is a variable assignment. */
|
#define W_ASSIGNMENT 0x000004 /* This word is a variable assignment. */
|
||||||
#define W_GLOBEXP 0x00008 /* This word is the result of a glob expansion. */
|
#define W_GLOBEXP 0x000008 /* This word is the result of a glob expansion. */
|
||||||
#define W_NOSPLIT 0x00010 /* Do not perform word splitting on this word. */
|
#define W_NOSPLIT 0x000010 /* Do not perform word splitting on this word. */
|
||||||
#define W_NOGLOB 0x00020 /* Do not perform globbing on this word. */
|
#define W_NOGLOB 0x000020 /* Do not perform globbing on this word. */
|
||||||
#define W_NOSPLIT2 0x00040 /* Don't split word except for $@ expansion. */
|
#define W_NOSPLIT2 0x000040 /* Don't split word except for $@ expansion. */
|
||||||
#define W_TILDEEXP 0x00080 /* Tilde expand this assignment word */
|
#define W_TILDEEXP 0x000080 /* Tilde expand this assignment word */
|
||||||
#define W_DOLLARAT 0x00100 /* $@ and its special handling */
|
#define W_DOLLARAT 0x000100 /* $@ and its special handling */
|
||||||
#define W_DOLLARSTAR 0x00200 /* $* and its special handling */
|
#define W_DOLLARSTAR 0x000200 /* $* and its special handling */
|
||||||
#define W_NOCOMSUB 0x00400 /* Don't perform command substitution on this word */
|
#define W_NOCOMSUB 0x000400 /* Don't perform command substitution on this word */
|
||||||
#define W_ASSIGNRHS 0x00800 /* Word is rhs of an assignment statement */
|
#define W_ASSIGNRHS 0x000800 /* Word is rhs of an assignment statement */
|
||||||
#define W_NOTILDE 0x01000 /* Don't perform tilde expansion on this word */
|
#define W_NOTILDE 0x001000 /* Don't perform tilde expansion on this word */
|
||||||
#define W_ITILDE 0x02000 /* Internal flag for word expansion */
|
#define W_ITILDE 0x002000 /* Internal flag for word expansion */
|
||||||
#define W_NOEXPAND 0x04000 /* Don't expand at all -- do quote removal */
|
#define W_NOEXPAND 0x004000 /* Don't expand at all -- do quote removal */
|
||||||
#define W_COMPASSIGN 0x08000 /* Compound assignment */
|
#define W_COMPASSIGN 0x008000 /* Compound assignment */
|
||||||
#define W_ASSNBLTIN 0x10000 /* word is a builtin command that takes assignments */
|
#define W_ASSNBLTIN 0x010000 /* word is a builtin command that takes assignments */
|
||||||
#define W_ASSIGNARG 0x20000 /* word is assignment argument to command */
|
#define W_ASSIGNARG 0x020000 /* word is assignment argument to command */
|
||||||
#define W_HASQUOTEDNULL 0x40000 /* word contains a quoted null character */
|
#define W_HASQUOTEDNULL 0x040000 /* word contains a quoted null character */
|
||||||
#define W_DQUOTE 0x80000 /* word should be treated as if double-quoted */
|
#define W_DQUOTE 0x080000 /* word should be treated as if double-quoted */
|
||||||
|
#define W_NOPROCSUB 0x100000 /* don't perform process substitution */
|
||||||
|
|
||||||
/* Possible values for subshell_environment */
|
/* Possible values for subshell_environment */
|
||||||
#define SUBSHELL_ASYNC 0x01 /* subshell caused by `command &' */
|
#define SUBSHELL_ASYNC 0x01 /* subshell caused by `command &' */
|
||||||
|
|
16
config-bot.h
16
config-bot.h
|
@ -130,10 +130,22 @@
|
||||||
/* For platforms which support the ISO C amendement 1 functionality we
|
/* For platforms which support the ISO C amendement 1 functionality we
|
||||||
support user defined character classes. */
|
support user defined character classes. */
|
||||||
/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. */
|
/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. */
|
||||||
#if defined (HAVE_WCTYPE_H) && defined (HAVE_WCHAR_H)
|
#if defined (HAVE_WCTYPE_H) && defined (HAVE_WCHAR_H) && defined (HAVE_LOCALE_H)
|
||||||
# include <wchar.h>
|
# include <wchar.h>
|
||||||
# include <wctype.h>
|
# include <wctype.h>
|
||||||
# if defined (HAVE_MBSRTOWCS) && defined (HAVE_MBRTOWC) && defined (HAVE_MBRLEN) && defined (HAVE_WCWIDTH)
|
# if defined (HAVE_ISWCTYPE) && \
|
||||||
|
defined (HAVE_ISWLOWER) && \
|
||||||
|
defined (HAVE_ISWUPPER) && \
|
||||||
|
defined (HAVE_MBSRTOWCS) && \
|
||||||
|
defined (HAVE_MBRTOWC) && \
|
||||||
|
defined (HAVE_MBRLEN) && \
|
||||||
|
defined (HAVE_TOWLOWER) && \
|
||||||
|
defined (HAVE_TOWUPPER) && \
|
||||||
|
defined (HAVE_WCHAR_T) && \
|
||||||
|
defined (HAVE_WCTYPE_T) && \
|
||||||
|
defined (HAVE_WINT_T) && \
|
||||||
|
defined (HAVE_WCWIDTH) && \
|
||||||
|
defined (HAVE_WCTYPE)
|
||||||
/* system is supposed to support XPG5 */
|
/* system is supposed to support XPG5 */
|
||||||
# define HANDLE_MULTIBYTE 1
|
# define HANDLE_MULTIBYTE 1
|
||||||
# endif
|
# endif
|
||||||
|
|
52
config.h.in
52
config.h.in
|
@ -1,6 +1,6 @@
|
||||||
/* config.h -- Configuration file for bash. */
|
/* config.h -- Configuration file for bash. */
|
||||||
|
|
||||||
/* Copyright (C) 1987-2004 Free Software Foundation, Inc.
|
/* Copyright (C) 1987-2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GNU Bash, the Bourne Again SHell.
|
This file is part of GNU Bash, the Bourne Again SHell.
|
||||||
|
|
||||||
|
@ -305,9 +305,20 @@
|
||||||
/* Define to `unsigned int' if <sys/socket.h> doesn't define. */
|
/* Define to `unsigned int' if <sys/socket.h> doesn't define. */
|
||||||
#undef socklen_t
|
#undef socklen_t
|
||||||
|
|
||||||
|
#undef HAVE_MBSTATE_T
|
||||||
|
|
||||||
/* Define if you have quad_t in <sys/types.h>. */
|
/* Define if you have quad_t in <sys/types.h>. */
|
||||||
#undef HAVE_QUAD_T
|
#undef HAVE_QUAD_T
|
||||||
|
|
||||||
|
/* Define if you have wchar_t in <wctype.h>. */
|
||||||
|
#undef HAVE_WCHAR_T
|
||||||
|
|
||||||
|
/* Define if you have wctype_t in <wctype.h>. */
|
||||||
|
#undef HAVE_WCTYPE_T
|
||||||
|
|
||||||
|
/* Define if you have wint_t in <wctype.h>. */
|
||||||
|
#undef HAVE_WINT_T
|
||||||
|
|
||||||
#undef RLIMTYPE
|
#undef RLIMTYPE
|
||||||
|
|
||||||
/* Define to the type of elements in the array set by `getgroups'.
|
/* Define to the type of elements in the array set by `getgroups'.
|
||||||
|
@ -404,8 +415,6 @@
|
||||||
|
|
||||||
#undef STRTOLD_BROKEN
|
#undef STRTOLD_BROKEN
|
||||||
|
|
||||||
#undef HAVE_MBSTATE_T
|
|
||||||
|
|
||||||
/* Define if WCONTINUED is defined in system headers, but rejected by waitpid */
|
/* Define if WCONTINUED is defined in system headers, but rejected by waitpid */
|
||||||
#undef WCONTINUED_BROKEN
|
#undef WCONTINUED_BROKEN
|
||||||
|
|
||||||
|
@ -514,6 +523,9 @@
|
||||||
/* Define if you have the dup2 function. */
|
/* Define if you have the dup2 function. */
|
||||||
#undef HAVE_DUP2
|
#undef HAVE_DUP2
|
||||||
|
|
||||||
|
/* Define if you have the eaccess function. */
|
||||||
|
#undef HAVE_EACCESS
|
||||||
|
|
||||||
/* Define if you have the fcntl function. */
|
/* Define if you have the fcntl function. */
|
||||||
#undef HAVE_FCNTL
|
#undef HAVE_FCNTL
|
||||||
|
|
||||||
|
@ -580,15 +592,27 @@
|
||||||
/* Define if you have the isgraph function. */
|
/* Define if you have the isgraph function. */
|
||||||
#undef HAVE_ISGRAPH
|
#undef HAVE_ISGRAPH
|
||||||
|
|
||||||
/* Define if you have the isint function in libc */
|
/* Define if you have the isinf function in libc */
|
||||||
#undef HAVE_ISINF_IN_LIBC
|
#undef HAVE_ISINF_IN_LIBC
|
||||||
|
|
||||||
|
/* Define if you have the isnan function in libc */
|
||||||
|
#undef HAVE_ISNAN_IN_LIBC
|
||||||
|
|
||||||
/* Define if you have the isprint function. */
|
/* Define if you have the isprint function. */
|
||||||
#undef HAVE_ISPRINT
|
#undef HAVE_ISPRINT
|
||||||
|
|
||||||
/* Define if you have the isspace function. */
|
/* Define if you have the isspace function. */
|
||||||
#undef HAVE_ISSPACE
|
#undef HAVE_ISSPACE
|
||||||
|
|
||||||
|
/* Define if you have the iswctype function. */
|
||||||
|
#undef HAVE_ISWCTYPE
|
||||||
|
|
||||||
|
/* Define if you have the iswlower function. */
|
||||||
|
#undef HAVE_ISWLOWER
|
||||||
|
|
||||||
|
/* Define if you have the iswupper function. */
|
||||||
|
#undef HAVE_ISWUPPER
|
||||||
|
|
||||||
/* Define if you have the isxdigit function. */
|
/* Define if you have the isxdigit function. */
|
||||||
#undef HAVE_ISXDIGIT
|
#undef HAVE_ISXDIGIT
|
||||||
|
|
||||||
|
@ -661,6 +685,10 @@
|
||||||
/* Define if you have the setostype function. */
|
/* Define if you have the setostype function. */
|
||||||
#undef HAVE_SETOSTYPE
|
#undef HAVE_SETOSTYPE
|
||||||
|
|
||||||
|
/* Define if you have the setregid function. */
|
||||||
|
#undef HAVE_SETREGID
|
||||||
|
#undef HAVE_DECL_SETREGID
|
||||||
|
|
||||||
/* Define if you have the setvbuf function. */
|
/* Define if you have the setvbuf function. */
|
||||||
#undef HAVE_SETVBUF
|
#undef HAVE_SETVBUF
|
||||||
|
|
||||||
|
@ -733,6 +761,12 @@
|
||||||
/* Define if you have the times function. */
|
/* Define if you have the times function. */
|
||||||
#undef HAVE_TIMES
|
#undef HAVE_TIMES
|
||||||
|
|
||||||
|
/* Define if you have the towlower function. */
|
||||||
|
#undef HAVE_TOWLOWER
|
||||||
|
|
||||||
|
/* Define if you have the towupper function. */
|
||||||
|
#undef HAVE_TOWUPPER
|
||||||
|
|
||||||
/* Define if you have the ttyname function. */
|
/* Define if you have the ttyname function. */
|
||||||
#undef HAVE_TTYNAME
|
#undef HAVE_TTYNAME
|
||||||
|
|
||||||
|
@ -763,11 +797,17 @@
|
||||||
/* Define if you have the wait3 function. */
|
/* Define if you have the wait3 function. */
|
||||||
#undef HAVE_WAIT3
|
#undef HAVE_WAIT3
|
||||||
|
|
||||||
|
/* Define if you have the wcrtomb function. */
|
||||||
|
#undef HAVE_WCRTOMB
|
||||||
|
|
||||||
|
/* Define if you have the wcscoll function. */
|
||||||
|
#undef HAVE_WCSCOLL
|
||||||
|
|
||||||
/* Define if you have the wcsdup function. */
|
/* Define if you have the wcsdup function. */
|
||||||
#undef HAVE_WCSDUP
|
#undef HAVE_WCSDUP
|
||||||
|
|
||||||
/* Define if you have the wctomb function. */
|
/* Define if you have the wctype function. */
|
||||||
#undef HAVE_WCTOMB
|
#undef HAVE_WCTYPE
|
||||||
|
|
||||||
/* Define if you have the wcwidth function. */
|
/* Define if you have the wcwidth function. */
|
||||||
#undef HAVE_WCWIDTH
|
#undef HAVE_WCWIDTH
|
||||||
|
|
28
configure.in
28
configure.in
|
@ -1,11 +1,11 @@
|
||||||
dnl
|
dnl
|
||||||
dnl Configure script for bash-3.1
|
dnl Configure script for bash-3.2
|
||||||
dnl
|
dnl
|
||||||
dnl report bugs to chet@po.cwru.edu
|
dnl report bugs to chet@po.cwru.edu
|
||||||
dnl
|
dnl
|
||||||
dnl Process this file with autoconf to produce a configure script.
|
dnl Process this file with autoconf to produce a configure script.
|
||||||
|
|
||||||
# Copyright (C) 1987-2005 Free Software Foundation, Inc.
|
# Copyright (C) 1987-2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -22,12 +22,12 @@ dnl Process this file with autoconf to produce a configure script.
|
||||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||||
# 02111-1307, USA.
|
# 02111-1307, USA.
|
||||||
|
|
||||||
AC_REVISION([for Bash 3.1, version 3.183])dnl
|
AC_REVISION([for Bash 3.2, version 3.190])dnl
|
||||||
|
|
||||||
define(bashvers, 3.1)
|
define(bashvers, 3.2)
|
||||||
define(relstatus, release)
|
define(relstatus, release)
|
||||||
|
|
||||||
AC_INIT(bash, bashvers-relstatus, bug-bash@gnu.org)
|
AC_INIT([bash], bashvers-relstatus, [bug-bash@gnu.org])
|
||||||
|
|
||||||
dnl make sure we are using a recent autoconf version
|
dnl make sure we are using a recent autoconf version
|
||||||
AC_PREREQ(2.50)
|
AC_PREREQ(2.50)
|
||||||
|
@ -149,7 +149,7 @@ if test "$opt_curses" = yes; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -z "${DEBUGGER_START_FILE}"; then
|
if test -z "${DEBUGGER_START_FILE}"; then
|
||||||
DEBUGGER_START_FILE=${ac_default_prefix}/lib/bashdb/bashdb-main.inc
|
DEBUGGER_START_FILE=${ac_default_prefix}/share/bashdb/bashdb-main.inc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl optional shell features in config.h.in
|
dnl optional shell features in config.h.in
|
||||||
|
@ -373,6 +373,7 @@ AC_SYS_LARGEFILE
|
||||||
dnl BEGIN changes for cross-building (currently cygwin, minGW, and
|
dnl BEGIN changes for cross-building (currently cygwin, minGW, and
|
||||||
dnl (obsolete) BeOS)
|
dnl (obsolete) BeOS)
|
||||||
|
|
||||||
|
SIGNAMES_O=
|
||||||
SIGNAMES_H=lsignames.h
|
SIGNAMES_H=lsignames.h
|
||||||
|
|
||||||
dnl load up the cross-building cache file -- add more cases and cache
|
dnl load up the cross-building cache file -- add more cases and cache
|
||||||
|
@ -382,18 +383,17 @@ dnl Note that host and target machine are the same, and different than the
|
||||||
dnl build machine.
|
dnl build machine.
|
||||||
dnl Set SIGNAMES_H based on whether or not we're cross-compiling.
|
dnl Set SIGNAMES_H based on whether or not we're cross-compiling.
|
||||||
|
|
||||||
|
CROSS_COMPILE=
|
||||||
if test "x$cross_compiling" = "xyes"; then
|
if test "x$cross_compiling" = "xyes"; then
|
||||||
case "${host}" in
|
case "${host}" in
|
||||||
*-cygwin*)
|
*-cygwin*)
|
||||||
cross_cache=${srcdir}/cross-build/cygwin32.cache
|
cross_cache=${srcdir}/cross-build/cygwin32.cache
|
||||||
SIGNAMES_H='$(srcdir)/cross-build/win32sig.h'
|
|
||||||
;;
|
;;
|
||||||
*-mingw*)
|
*-mingw*)
|
||||||
cross_cache=${srcdir}/cross-build/cygwin32.cache
|
cross_cache=${srcdir}/cross-build/cygwin32.cache
|
||||||
;;
|
;;
|
||||||
i[[3456]]86-*-beos*)
|
i[[3456]]86-*-beos*)
|
||||||
cross_cache=${srcdir}/cross-build/x86-beos.cache
|
cross_cache=${srcdir}/cross-build/x86-beos.cache
|
||||||
SIGNAMES_H='${srcdir}/cross-build/beos-sig.h'
|
|
||||||
;;
|
;;
|
||||||
*) echo "configure: cross-compiling for $host is not supported" >&2
|
*) echo "configure: cross-compiling for $host is not supported" >&2
|
||||||
;;
|
;;
|
||||||
|
@ -403,10 +403,12 @@ if test "x$cross_compiling" = "xyes"; then
|
||||||
. ${cross_cache}
|
. ${cross_cache}
|
||||||
fi
|
fi
|
||||||
unset cross_cache
|
unset cross_cache
|
||||||
|
SIGNAMES_O='signames.o'
|
||||||
CROSS_COMPILE='-DCROSS_COMPILING'
|
CROSS_COMPILE='-DCROSS_COMPILING'
|
||||||
AC_SUBST(CROSS_COMPILE)
|
AC_SUBST(CROSS_COMPILE)
|
||||||
fi
|
fi
|
||||||
AC_SUBST(SIGNAMES_H)
|
AC_SUBST(SIGNAMES_H)
|
||||||
|
AC_SUBST(SIGNAMES_O)
|
||||||
|
|
||||||
if test -z "$CC_FOR_BUILD"; then
|
if test -z "$CC_FOR_BUILD"; then
|
||||||
if test "x$cross_compiling" = "xno"; then
|
if test "x$cross_compiling" = "xno"; then
|
||||||
|
@ -687,15 +689,16 @@ dnl checks for certain version-specific system calls and libc functions
|
||||||
AC_CHECK_FUNC(__setostype, AC_DEFINE(HAVE_SETOSTYPE))
|
AC_CHECK_FUNC(__setostype, AC_DEFINE(HAVE_SETOSTYPE))
|
||||||
AC_CHECK_FUNC(wait3, AC_DEFINE(HAVE_WAIT3))
|
AC_CHECK_FUNC(wait3, AC_DEFINE(HAVE_WAIT3))
|
||||||
AC_CHECK_FUNC(isinf, AC_DEFINE(HAVE_ISINF_IN_LIBC))
|
AC_CHECK_FUNC(isinf, AC_DEFINE(HAVE_ISINF_IN_LIBC))
|
||||||
|
AC_CHECK_FUNC(isnan, AC_DEFINE(HAVE_ISNAN_IN_LIBC))
|
||||||
|
|
||||||
dnl checks for missing libc functions
|
dnl checks for missing libc functions
|
||||||
AC_CHECK_FUNC(mkfifo,AC_DEFINE(HAVE_MKFIFO),AC_DEFINE(MKFIFO_MISSING))
|
AC_CHECK_FUNC(mkfifo,AC_DEFINE(HAVE_MKFIFO),AC_DEFINE(MKFIFO_MISSING))
|
||||||
|
|
||||||
dnl checks for system calls
|
dnl checks for system calls
|
||||||
AC_CHECK_FUNCS(dup2 fcntl getdtablesize getgroups gethostname getpagesize \
|
AC_CHECK_FUNCS(dup2 eaccess fcntl getdtablesize getgroups gethostname \
|
||||||
getpeername getrlimit getrusage gettimeofday kill killpg \
|
getpagesize getpeername getrlimit getrusage gettimeofday \
|
||||||
lstat readlink sbrk select setdtablesize tcgetpgrp uname \
|
kill killpg lstat readlink sbrk select setdtablesize \
|
||||||
ulimit waitpid)
|
tcgetpgrp uname ulimit waitpid)
|
||||||
AC_REPLACE_FUNCS(rename)
|
AC_REPLACE_FUNCS(rename)
|
||||||
|
|
||||||
dnl checks for c library functions
|
dnl checks for c library functions
|
||||||
|
@ -714,6 +717,7 @@ AC_REPLACE_FUNCS(strtod strtol strtoul strtoll strtoull strtoimax strtoumax)
|
||||||
AC_CHECK_DECLS([confstr])
|
AC_CHECK_DECLS([confstr])
|
||||||
AC_CHECK_DECLS([printf])
|
AC_CHECK_DECLS([printf])
|
||||||
AC_CHECK_DECLS([sbrk])
|
AC_CHECK_DECLS([sbrk])
|
||||||
|
AC_CHECK_DECLS([setregid])
|
||||||
AC_CHECK_DECLS([strcpy])
|
AC_CHECK_DECLS([strcpy])
|
||||||
AC_CHECK_DECLS([strsignal])
|
AC_CHECK_DECLS([strsignal])
|
||||||
|
|
||||||
|
|
|
@ -1,37 +0,0 @@
|
||||||
/* This file is used when cross compiling bash to run native on BeOS. */
|
|
||||||
|
|
||||||
#ifndef __GNUC__
|
|
||||||
# error cross compiling requires gcc
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* A translation list so we can be polite to our users.
|
|
||||||
Use gcc labelled initializers to set up the array. Note that
|
|
||||||
some entries might wind up being NULL. */
|
|
||||||
|
|
||||||
char *signal_names[NSIG + 3] = {
|
|
||||||
[0] "EXIT",
|
|
||||||
[SIGHUP] "SIGHUP",
|
|
||||||
[SIGINT] "SIGINT",
|
|
||||||
[SIGQUIT] "SIGQUIT",
|
|
||||||
[SIGILL] "SIGILL",
|
|
||||||
[SIGCHLD] "SIGCHLD",
|
|
||||||
[SIGABRT] "SIGABRT",
|
|
||||||
[SIGPIPE] "SIGPIPE",
|
|
||||||
[SIGFPE] "SIGFPE",
|
|
||||||
[SIGKILL] "SIGKILL",
|
|
||||||
[SIGSTOP] "SIGSTOP",
|
|
||||||
[SIGSEGV] "SIGSEGV",
|
|
||||||
[SIGCONT] "SIGCONT",
|
|
||||||
[SIGTSTP] "SIGTSTP",
|
|
||||||
[SIGALRM] "SIGALRM",
|
|
||||||
[SIGTERM] "SIGTERM",
|
|
||||||
[SIGTTIN] "SIGTTIN",
|
|
||||||
[SIGTTOU] "SIGTTOU",
|
|
||||||
[SIGUSR1] "SIGUSR1",
|
|
||||||
[SIGUSR2] "SIGUSR2",
|
|
||||||
[SIGWINCH] "SIGWINCH",
|
|
||||||
[SIGKILLTHR] "SIGKILLTHR",
|
|
||||||
[NSIG] "DEBUG",
|
|
||||||
[NSIG + 1] "ERR",
|
|
||||||
[NSIG + 2] (char *)0x0,
|
|
||||||
};
|
|
|
@ -1,256 +0,0 @@
|
||||||
/* This file is used when cross-compiling for the CYGWIN32 environment on
|
|
||||||
a Unix machine. It gets copied to signames.h in the build directory. */
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <signal.h>
|
|
||||||
|
|
||||||
#ifndef __GNUC__
|
|
||||||
# error cross compiling requires gcc
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* A translation list so we can be polite to our users. Use gcc
|
|
||||||
labelled initializers to set up the array. Note that some entries
|
|
||||||
might wind up being NULL. */
|
|
||||||
|
|
||||||
char *signal_names[NSIG + 3] = {
|
|
||||||
[0] "EXIT",
|
|
||||||
|
|
||||||
#ifdef SIGLOST
|
|
||||||
[SIGLOST] "SIGLOST",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGMSG
|
|
||||||
[SIGMSG] "SIGMSG",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGDANGER
|
|
||||||
[SIGDANGER] "SIGDANGER",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGMIGRATE
|
|
||||||
[SIGMIGRATE] "SIGMIGRATE",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGPRE
|
|
||||||
[SIGPRE] "SIGPRE",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGVIRT
|
|
||||||
[SIGVIRT] "SIGVIRT",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGALRM1
|
|
||||||
[SIGALRM1] "SIGALRM1",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGWAITING
|
|
||||||
[SIGWAITING] "SIGWAITING",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGGRANT
|
|
||||||
[SIGGRANT] "SIGGRANT",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGKAP
|
|
||||||
[SIGKAP] "SIGKAP",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGRETRACT
|
|
||||||
[SIGRETRACT] "SIGRETRACT",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGSOUND
|
|
||||||
[SIGSOUND] "SIGSOUND",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGSAK
|
|
||||||
[SIGSAK] "SIGSAK",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGLWP
|
|
||||||
[SIGLWP] "SIGLWP",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGFREEZE
|
|
||||||
[SIGFREEZE] "SIGFREEZE",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGTHAW
|
|
||||||
[SIGTHAW] "SIGTHAW",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGCANCEL
|
|
||||||
[SIGCANCEL] "SIGCANCEL",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGDIL
|
|
||||||
[SIGDIL] "SIGDIL",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGCLD
|
|
||||||
#ifndef SIGCHLD
|
|
||||||
[SIGCLD] "SIGCLD",
|
|
||||||
#else
|
|
||||||
#if SIGCHLD != SIGCLD
|
|
||||||
[SIGCLD] "SIGCLD",
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGPWR
|
|
||||||
[SIGPWR] "SIGPWR",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGPOLL
|
|
||||||
#ifndef SIGIO
|
|
||||||
[SIGPOLL] "SIGPOLL",
|
|
||||||
#else
|
|
||||||
#if SIGIO != SIGPOLL
|
|
||||||
[SIGPOLL] "SIGPOLL",
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGWINDOW
|
|
||||||
[SIGWINDOW] "SIGWINDOW",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGHUP
|
|
||||||
[SIGHUP] "SIGHUP",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGINT
|
|
||||||
[SIGINT] "SIGINT",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGQUIT
|
|
||||||
[SIGQUIT] "SIGQUIT",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGILL
|
|
||||||
[SIGILL] "SIGILL",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGTRAP
|
|
||||||
[SIGTRAP] "SIGTRAP",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGIOT
|
|
||||||
#ifndef SIGABRT
|
|
||||||
[SIGIOT] "SIGIOT",
|
|
||||||
#else
|
|
||||||
#if SIGABRT != SIGIOT
|
|
||||||
[SIGIOT] "SIGIOT",
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGABRT
|
|
||||||
[SIGABRT] "SIGABRT",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGEMT
|
|
||||||
[SIGEMT] "SIGEMT",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGFPE
|
|
||||||
[SIGFPE] "SIGFPE",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGKILL
|
|
||||||
[SIGKILL] "SIGKILL",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGBUS
|
|
||||||
[SIGBUS] "SIGBUS",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGSEGV
|
|
||||||
[SIGSEGV] "SIGSEGV",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGSYS
|
|
||||||
[SIGSYS] "SIGSYS",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGPIPE
|
|
||||||
[SIGPIPE] "SIGPIPE",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGALRM
|
|
||||||
[SIGALRM] "SIGALRM",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGTERM
|
|
||||||
[SIGTERM] "SIGTERM",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGURG
|
|
||||||
[SIGURG] "SIGURG",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGSTOP
|
|
||||||
[SIGSTOP] "SIGSTOP",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGTSTP
|
|
||||||
[SIGTSTP] "SIGTSTP",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGCONT
|
|
||||||
[SIGCONT] "SIGCONT",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGCHLD
|
|
||||||
[SIGCHLD] "SIGCHLD",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGTTIN
|
|
||||||
[SIGTTIN] "SIGTTIN",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGTTOU
|
|
||||||
[SIGTTOU] "SIGTTOU",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGIO
|
|
||||||
[SIGIO] "SIGIO",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGXCPU
|
|
||||||
[SIGXCPU] "SIGXCPU",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGXFSZ
|
|
||||||
[SIGXFSZ] "SIGXFSZ",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGVTALRM
|
|
||||||
[SIGVTALRM] "SIGVTALRM",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGPROF
|
|
||||||
[SIGPROF] "SIGPROF",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGWINCH
|
|
||||||
[SIGWINCH] "SIGWINCH",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGINFO
|
|
||||||
[SIGINFO] "SIGINFO",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGUSR1
|
|
||||||
[SIGUSR1] "SIGUSR1",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGUSR2
|
|
||||||
[SIGUSR2] "SIGUSR2",
|
|
||||||
#endif
|
|
||||||
|
|
||||||
[NSIG] "DEBUG",
|
|
||||||
|
|
||||||
[NSIG + 1] "ERR",
|
|
||||||
|
|
||||||
[NSIG + 2] (char *)0x0
|
|
||||||
};
|
|
114
doc/FAQ
114
doc/FAQ
|
@ -1,4 +1,4 @@
|
||||||
This is the Bash FAQ, version 3.32, for Bash version 3.1.
|
This is the Bash FAQ, version 3.34, for Bash version 3.2.
|
||||||
|
|
||||||
This document contains a set of frequently-asked questions concerning
|
This document contains a set of frequently-asked questions concerning
|
||||||
Bash, the GNU Bourne-Again Shell. Bash is a freely-available command
|
Bash, the GNU Bourne-Again Shell. Bash is a freely-available command
|
||||||
|
@ -9,7 +9,7 @@ Another good source of basic information about shells is the collection
|
||||||
of FAQ articles periodically posted to comp.unix.shell.
|
of FAQ articles periodically posted to comp.unix.shell.
|
||||||
|
|
||||||
Questions and comments concerning this document should be sent to
|
Questions and comments concerning this document should be sent to
|
||||||
chet@po.cwru.edu.
|
chet.ramey@case.edu.
|
||||||
|
|
||||||
This document is available for anonymous FTP with the URL
|
This document is available for anonymous FTP with the URL
|
||||||
|
|
||||||
|
@ -36,8 +36,8 @@ A10) What is the bash `posix mode'?
|
||||||
|
|
||||||
Section B: The latest version
|
Section B: The latest version
|
||||||
|
|
||||||
B1) What's new in version 3.1?
|
B1) What's new in version 3.2?
|
||||||
B2) Are there any user-visible incompatibilities between bash-3.1 and
|
B2) Are there any user-visible incompatibilities between bash-3.2 and
|
||||||
bash-2.05b?
|
bash-2.05b?
|
||||||
|
|
||||||
Section C: Differences from other Unix shells
|
Section C: Differences from other Unix shells
|
||||||
|
@ -78,6 +78,7 @@ E10) Why does `cd //' leave $PWD as `//'?
|
||||||
E11) If I resize my xterm while another program is running, why doesn't bash
|
E11) If I resize my xterm while another program is running, why doesn't bash
|
||||||
notice the change?
|
notice the change?
|
||||||
E12) Why don't negative offsets in substring expansion work like I expect?
|
E12) Why don't negative offsets in substring expansion work like I expect?
|
||||||
|
E13) Why does filename completion misbehave if a colon appears in the filename?
|
||||||
|
|
||||||
Section F: Things to watch out for on certain Unix versions
|
Section F: Things to watch out for on certain Unix versions
|
||||||
|
|
||||||
|
@ -140,26 +141,26 @@ of Case Western Reserve University.
|
||||||
|
|
||||||
A2) What's the latest version?
|
A2) What's the latest version?
|
||||||
|
|
||||||
The latest version is 3.1, first made available on 09 December, 2005.
|
The latest version is 3.2, first made available on 12 October, 2006.
|
||||||
|
|
||||||
A3) Where can I get it?
|
A3) Where can I get it?
|
||||||
|
|
||||||
Bash is the GNU project's shell, and so is available from the
|
Bash is the GNU project's shell, and so is available from the
|
||||||
master GNU archive site, ftp.gnu.org, and its mirrors. The
|
master GNU archive site, ftp.gnu.org, and its mirrors. The
|
||||||
latest version is also available for FTP from ftp.cwru.edu.
|
latest version is also available for FTP from ftp.cwru.edu.
|
||||||
The following URLs tell how to get version 3.1:
|
The following URLs tell how to get version 3.2:
|
||||||
|
|
||||||
ftp://ftp.gnu.org/pub/gnu/bash/bash-3.1.tar.gz
|
ftp://ftp.gnu.org/pub/gnu/bash/bash-3.2.tar.gz
|
||||||
ftp://ftp.cwru.edu/pub/bash/bash-3.1.tar.gz
|
ftp://ftp.cwru.edu/pub/bash/bash-3.2.tar.gz
|
||||||
|
|
||||||
Formatted versions of the documentation are available with the URLs:
|
Formatted versions of the documentation are available with the URLs:
|
||||||
|
|
||||||
ftp://ftp.gnu.org/pub/gnu/bash/bash-doc-3.1.tar.gz
|
ftp://ftp.gnu.org/pub/gnu/bash/bash-doc-3.2.tar.gz
|
||||||
ftp://ftp.cwru.edu/pub/bash/bash-doc-3.1.tar.gz
|
ftp://ftp.cwru.edu/pub/bash/bash-doc-3.2.tar.gz
|
||||||
|
|
||||||
Any patches for the current version are available with the URL:
|
Any patches for the current version are available with the URL:
|
||||||
|
|
||||||
ftp://ftp.cwru.edu/pub/bash/bash-3.1-patches/
|
ftp://ftp.cwru.edu/pub/bash/bash-3.2-patches/
|
||||||
|
|
||||||
A4) On what machines will bash run?
|
A4) On what machines will bash run?
|
||||||
|
|
||||||
|
@ -192,7 +193,7 @@ http://www.cygwin.com/.
|
||||||
Cygnus originally ported bash-1.14.7, and that port was part of their
|
Cygnus originally ported bash-1.14.7, and that port was part of their
|
||||||
early GNU-Win32 (the original name) releases. Cygnus has also done
|
early GNU-Win32 (the original name) releases. Cygnus has also done
|
||||||
ports of bash-2.05b and bash-3.0 to the CYGWIN environment, and both
|
ports of bash-2.05b and bash-3.0 to the CYGWIN environment, and both
|
||||||
are available as part of their current release. Bash-3.1 is currently
|
are available as part of their current release. Bash-3.2 is currently
|
||||||
being tested and should be available soon.
|
being tested and should be available soon.
|
||||||
|
|
||||||
Bash-2.05b and later versions should require no local Cygnus changes to
|
Bash-2.05b and later versions should require no local Cygnus changes to
|
||||||
|
@ -216,7 +217,7 @@ Mark began to work with bash-2.05, but I don't know the current status.
|
||||||
|
|
||||||
Bash-3.0 compiles and runs with no modifications under Microsoft's Services
|
Bash-3.0 compiles and runs with no modifications under Microsoft's Services
|
||||||
for Unix (SFU), once known as Interix. I do not anticipate any problems
|
for Unix (SFU), once known as Interix. I do not anticipate any problems
|
||||||
with building bash-3.1.
|
with building bash-3.1 or bash-3.2.
|
||||||
|
|
||||||
A6) How can I build bash with gcc?
|
A6) How can I build bash with gcc?
|
||||||
|
|
||||||
|
@ -385,12 +386,22 @@ They are also listed in a section in the Bash Reference Manual
|
||||||
|
|
||||||
Section B: The latest version
|
Section B: The latest version
|
||||||
|
|
||||||
B1) What's new in version 3.1?
|
B1) What's new in version 3.2?
|
||||||
|
|
||||||
Bash-3.1 is the first maintenance release of the third major release of
|
Bash-3.2 is the second maintenance release of the third major release of
|
||||||
bash. It contains the following significant new features (see the manual
|
bash. It contains the following significant new features (see the manual
|
||||||
page for complete descriptions and the CHANGES and NEWS files in the
|
page for complete descriptions and the CHANGES and NEWS files in the
|
||||||
bash-3.1 distribution).
|
bash-3.2 distribution).
|
||||||
|
|
||||||
|
o Bash-3.2 now checks shell scripts for NUL characters rather than non-printing
|
||||||
|
characters when deciding whether or not a script is a binary file.
|
||||||
|
|
||||||
|
o Quoting the string argument to the [[ command's =~ (regexp) operator now
|
||||||
|
forces string matching, as with the other pattern-matching operators.
|
||||||
|
|
||||||
|
A short feature history dating from Bash-2.0:
|
||||||
|
|
||||||
|
Bash-3.1 contained the following new features:
|
||||||
|
|
||||||
o Bash-3.1 may now be configured and built in a mode that enforces strict
|
o Bash-3.1 may now be configured and built in a mode that enforces strict
|
||||||
POSIX compliance.
|
POSIX compliance.
|
||||||
|
@ -401,8 +412,6 @@ o The `+=' assignment operator, which appends to the value of a string or
|
||||||
o It is now possible to ignore case when matching in contexts other than
|
o It is now possible to ignore case when matching in contexts other than
|
||||||
filename generation using the new `nocasematch' shell option.
|
filename generation using the new `nocasematch' shell option.
|
||||||
|
|
||||||
A short feature history dating from Bash-2.0:
|
|
||||||
|
|
||||||
Bash-3.0 contained the following new features:
|
Bash-3.0 contained the following new features:
|
||||||
|
|
||||||
o Features to support the bash debugger have been implemented, and there
|
o Features to support the bash debugger have been implemented, and there
|
||||||
|
@ -640,10 +649,10 @@ grammar tighter and smaller (66 reduce-reduce conflicts gone)
|
||||||
lots of code now smaller and faster
|
lots of code now smaller and faster
|
||||||
test suite greatly expanded
|
test suite greatly expanded
|
||||||
|
|
||||||
B2) Are there any user-visible incompatibilities between bash-3.1 and
|
B2) Are there any user-visible incompatibilities between bash-3.2 and
|
||||||
bash-2.05b?
|
bash-2.05b?
|
||||||
|
|
||||||
There are a few incompatibilities between version 2.05b and version 3.1.
|
There are a few incompatibilities between version 2.05b and version 3.2.
|
||||||
They are detailed in the file COMPAT in the bash distribution. That file
|
They are detailed in the file COMPAT in the bash distribution. That file
|
||||||
is not meant to be all-encompassing; send mail to bash-maintainers@gnu.org
|
is not meant to be all-encompassing; send mail to bash-maintainers@gnu.org
|
||||||
if if you find something that's not mentioned there.
|
if if you find something that's not mentioned there.
|
||||||
|
@ -697,7 +706,7 @@ Things bash has that sh does not:
|
||||||
read -e/-p/-a/-t/-n/-d/-s/-u,
|
read -e/-p/-a/-t/-n/-d/-s/-u,
|
||||||
readonly -a/-f/name=value, trap -l, set +o,
|
readonly -a/-f/name=value, trap -l, set +o,
|
||||||
set -b/-m/-o option/-h/-p/-B/-C/-H/-P,
|
set -b/-m/-o option/-h/-p/-B/-C/-H/-P,
|
||||||
unset -f/-v, ulimit -m/-p/-u,
|
unset -f/-v, ulimit -i/-m/-p/-q/-u/-x,
|
||||||
type -a/-p/-t/-f/-P, suspend -f, kill -n,
|
type -a/-p/-t/-f/-P, suspend -f, kill -n,
|
||||||
test -o optname/s1 == s2/s1 < s2/s1 > s2/-nt/-ot/-ef/-O/-G/-S
|
test -o optname/s1 == s2/s1 < s2/s1 > s2/-nt/-ot/-ef/-O/-G/-S
|
||||||
bash reads ~/.bashrc for interactive shells, $ENV for non-interactive
|
bash reads ~/.bashrc for interactive shells, $ENV for non-interactive
|
||||||
|
@ -793,8 +802,8 @@ Things bash has or uses that ksh88 does not:
|
||||||
set -o braceexpand/-o histexpand/-o interactive-comments/
|
set -o braceexpand/-o histexpand/-o interactive-comments/
|
||||||
-o notify/-o physical/-o posix/-o hashall/-o onecmd/
|
-o notify/-o physical/-o posix/-o hashall/-o onecmd/
|
||||||
-h/-B/-C/-b/-H/-P, set +o, suspend, trap -l, type,
|
-h/-B/-C/-b/-H/-P, set +o, suspend, trap -l, type,
|
||||||
typeset -a/-F/-p, ulimit -u, umask -S, alias -p, shopt,
|
typeset -a/-F/-p, ulimit -i/-q/-u/-x, umask -S, alias -p,
|
||||||
disown, printf, complete, compgen
|
shopt, disown, printf, complete, compgen
|
||||||
`!' csh-style history expansion
|
`!' csh-style history expansion
|
||||||
POSIX.2-style globbing character classes
|
POSIX.2-style globbing character classes
|
||||||
POSIX.2-style globbing equivalence classes
|
POSIX.2-style globbing equivalence classes
|
||||||
|
@ -837,7 +846,7 @@ Implementation differences:
|
||||||
|
|
||||||
C3) Which new features in ksh-93 are not in bash, and which are?
|
C3) Which new features in ksh-93 are not in bash, and which are?
|
||||||
|
|
||||||
New things in ksh-93 not in bash-3.0:
|
New things in ksh-93 not in bash-3.2:
|
||||||
associative arrays
|
associative arrays
|
||||||
floating point arithmetic and variables
|
floating point arithmetic and variables
|
||||||
math library functions
|
math library functions
|
||||||
|
@ -863,7 +872,7 @@ New things in ksh-93 not in bash-3.0:
|
||||||
lexical scoping for local variables in `ksh' functions
|
lexical scoping for local variables in `ksh' functions
|
||||||
no scoping for local variables in `POSIX' functions
|
no scoping for local variables in `POSIX' functions
|
||||||
|
|
||||||
New things in ksh-93 present in bash-3.0:
|
New things in ksh-93 present in bash-3.2:
|
||||||
[n]<&word- and [n]>&word- redirections (combination dup and close)
|
[n]<&word- and [n]>&word- redirections (combination dup and close)
|
||||||
for (( expr1; expr2; expr3 )) ; do list; done - arithmetic for command
|
for (( expr1; expr2; expr3 )) ; do list; done - arithmetic for command
|
||||||
?:, ++, --, `expr1 , expr2' arithmetic operators
|
?:, ++, --, `expr1 , expr2' arithmetic operators
|
||||||
|
@ -1113,7 +1122,7 @@ will try to write on a pipe without a reader. In that case, bash
|
||||||
will print `Broken pipe' to stderr when ps is killed by a
|
will print `Broken pipe' to stderr when ps is killed by a
|
||||||
SIGPIPE.
|
SIGPIPE.
|
||||||
|
|
||||||
As of bash-3.1, bash will not report SIGPIPE errors by default. You
|
As of bash-3.1, bash does not report SIGPIPE errors by default. You
|
||||||
can build a version of bash that will report such errors.
|
can build a version of bash that will report such errors.
|
||||||
|
|
||||||
E3) When I have terminal escape sequences in my prompt, why does bash
|
E3) When I have terminal escape sequences in my prompt, why does bash
|
||||||
|
@ -1390,6 +1399,32 @@ expanded value of param is unset or null, and $param otherwise.
|
||||||
To use negative offsets that begin with a minus sign, separate the
|
To use negative offsets that begin with a minus sign, separate the
|
||||||
minus sign and the colon with a space.
|
minus sign and the colon with a space.
|
||||||
|
|
||||||
|
E13) Why does filename completion misbehave if a colon appears in the filename?
|
||||||
|
|
||||||
|
Filename completion (and word completion in general) may appear to behave
|
||||||
|
improperly if there is a colon in the word to be completed.
|
||||||
|
|
||||||
|
The colon is special to readline's word completion code: it is one of the
|
||||||
|
characters that breaks words for the completer. Readline uses these characters
|
||||||
|
in sort of the same way that bash uses $IFS: they break or separate the words
|
||||||
|
the completion code hands to the application-specific or default word
|
||||||
|
completion functions. The original intent was to make it easy to edit
|
||||||
|
colon-separated lists (such as $PATH in bash) in various applications using
|
||||||
|
readline for input.
|
||||||
|
|
||||||
|
This is complicated by the fact that some versions of the popular
|
||||||
|
`bash-completion' programmable completion package have problems with the
|
||||||
|
default completion behavior in the presence of colons.
|
||||||
|
|
||||||
|
The current set of completion word break characters is available in bash as
|
||||||
|
the value of the COMP_WORDBREAKS variable. Removing `:' from that value is
|
||||||
|
enough to make the colon not special to completion:
|
||||||
|
|
||||||
|
COMP_WORDBREAKS=${COMP_WORDBREAKS//:}
|
||||||
|
|
||||||
|
You can also quote the colon with a backslash to achieve the same result
|
||||||
|
temporarily.
|
||||||
|
|
||||||
Section F: Things to watch out for on certain Unix versions
|
Section F: Things to watch out for on certain Unix versions
|
||||||
|
|
||||||
F1) Why can't I use command line editing in my `cmdtool'?
|
F1) Why can't I use command line editing in my `cmdtool'?
|
||||||
|
@ -1575,6 +1610,9 @@ this. These variables can be set in your .inputrc or using the bash
|
||||||
The `set' commands between the single quotes may also be placed
|
The `set' commands between the single quotes may also be placed
|
||||||
in ~/.inputrc.
|
in ~/.inputrc.
|
||||||
|
|
||||||
|
The script examples/scripts.noah/meta.bash encapsulates the bind
|
||||||
|
commands in a shell function.
|
||||||
|
|
||||||
G2) How do I write a function `x' to replace builtin command `x', but
|
G2) How do I write a function `x' to replace builtin command `x', but
|
||||||
still invoke the command from within the function?
|
still invoke the command from within the function?
|
||||||
|
|
||||||
|
@ -1748,13 +1786,9 @@ ftp.cwru.edu in the `pub/bash' directory.
|
||||||
Cameron Newham and Bill Rosenblatt have written a book on bash, published
|
Cameron Newham and Bill Rosenblatt have written a book on bash, published
|
||||||
by O'Reilly and Associates. The book is based on Bill Rosenblatt's Korn
|
by O'Reilly and Associates. The book is based on Bill Rosenblatt's Korn
|
||||||
Shell book. The title is ``Learning the Bash Shell'', and the ISBN number
|
Shell book. The title is ``Learning the Bash Shell'', and the ISBN number
|
||||||
is 1-56592-147-X. Look for it in fine bookstores near you. This book
|
of the third edition, published in March, 2005, is 0-596-00965-8. Look for
|
||||||
covers bash-1.14, but has an appendix describing some of the new features
|
it in fine bookstores near you. This edition of the book has been updated
|
||||||
in bash-2.0.
|
to cover bash-3.0.
|
||||||
|
|
||||||
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
|
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
|
Network Theory Ltd (Paperback, ISBN: 0-9541617-7-7, Feb 2003). It covers
|
||||||
|
@ -1762,6 +1796,16 @@ bash-2.0 and is available from most online bookstores (see
|
||||||
http://www.network-theory.co.uk/bash/manual/ for details). The publisher
|
http://www.network-theory.co.uk/bash/manual/ for details). The publisher
|
||||||
will donate $1 to the Free Software Foundation for each copy sold.
|
will donate $1 to the Free Software Foundation for each copy sold.
|
||||||
|
|
||||||
|
Arnold Robbins and Nelson Beebe have written ``Classic Shell Scripting'',
|
||||||
|
published by O'Reilly. The first edition, with ISBN number 0-596-00595-4,
|
||||||
|
was published in May, 2005.
|
||||||
|
|
||||||
|
Chris F. A. Johnson, a frequent contributor to comp.unix.shell and
|
||||||
|
gnu.bash.bug, has written ``Shell Scripting Recipes: A Problem-Solution
|
||||||
|
Approach,'' a new book on shell scripting, concentrating on features of
|
||||||
|
the POSIX standard helpful to shell script writers. The first edition from
|
||||||
|
Apress, with ISBN number 1-59059-471-1, was published in May, 2005.
|
||||||
|
|
||||||
H3) What's coming in future versions?
|
H3) What's coming in future versions?
|
||||||
|
|
||||||
These are features I hope to include in a future version of bash.
|
These are features I hope to include in a future version of bash.
|
||||||
|
@ -1786,9 +1830,9 @@ Some of the new ksh93 pattern matching operators, like backreferencing
|
||||||
|
|
||||||
H5) When will the next release appear?
|
H5) When will the next release appear?
|
||||||
|
|
||||||
The next version will appear sometime in 2006. Never make predictions.
|
The next version will appear sometime in 2007. Never make predictions.
|
||||||
|
|
||||||
This document is Copyright 1995-2005 by Chester Ramey.
|
This document is Copyright 1995-2006 by Chester Ramey.
|
||||||
|
|
||||||
Permission is hereby granted, without written agreement and
|
Permission is hereby granted, without written agreement and
|
||||||
without license or royalty fees, to use, copy, and distribute
|
without license or royalty fees, to use, copy, and distribute
|
||||||
|
|
1418
doc/article.ps
1418
doc/article.ps
File diff suppressed because it is too large
Load diff
94
doc/bash.1
94
doc/bash.1
|
@ -1,4 +1,4 @@
|
||||||
\"
|
.\"
|
||||||
.\" MAN PAGE COMMENTS to
|
.\" MAN PAGE COMMENTS to
|
||||||
.\"
|
.\"
|
||||||
.\" Chet Ramey
|
.\" Chet Ramey
|
||||||
|
@ -6,12 +6,12 @@
|
||||||
.\" Case Western Reserve University
|
.\" Case Western Reserve University
|
||||||
.\" chet@po.cwru.edu
|
.\" chet@po.cwru.edu
|
||||||
.\"
|
.\"
|
||||||
.\" Last Change: Sat Aug 27 13:28:44 EDT 2005
|
.\" Last Change: Thu Sep 28 10:25:59 EDT 2006
|
||||||
.\"
|
.\"
|
||||||
.\" bash_builtins, strip all but Built-Ins section
|
.\" bash_builtins, strip all but Built-Ins section
|
||||||
.if \n(zZ=1 .ig zZ
|
.if \n(zZ=1 .ig zZ
|
||||||
.if \n(zY=1 .ig zY
|
.if \n(zY=1 .ig zY
|
||||||
.TH BASH 1 "2005 Aug 27" "GNU Bash-3.1-beta1"
|
.TH BASH 1 "2006 September 28" "GNU Bash-3.2"
|
||||||
.\"
|
.\"
|
||||||
.\" There's some problem with having a `@'
|
.\" There's some problem with having a `@'
|
||||||
.\" in a tagged paragraph with the BSD man macros.
|
.\" in a tagged paragraph with the BSD man macros.
|
||||||
|
@ -62,8 +62,9 @@ also incorporates useful features from the \fIKorn\fP and \fIC\fP
|
||||||
shells (\fBksh\fP and \fBcsh\fP).
|
shells (\fBksh\fP and \fBcsh\fP).
|
||||||
.PP
|
.PP
|
||||||
.B Bash
|
.B Bash
|
||||||
is intended to be a conformant implementation of the IEEE
|
is intended to be a conformant implementation of the
|
||||||
POSIX Shell and Tools specification (IEEE Working Group 1003\.2).
|
Shell and Utilities portion of the IEEE POSIX specification
|
||||||
|
(IEEE Standard 1003.1).
|
||||||
.B Bash
|
.B Bash
|
||||||
can be configured to be POSIX-conformant by default.
|
can be configured to be POSIX-conformant by default.
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
|
@ -223,7 +224,7 @@ This option is on by default if the shell is invoked as
|
||||||
.TP
|
.TP
|
||||||
.B \-\-posix
|
.B \-\-posix
|
||||||
Change the behavior of \fBbash\fP where the default operation differs
|
Change the behavior of \fBbash\fP where the default operation differs
|
||||||
from the POSIX 1003.2 standard to match the standard (\fIposix mode\fP).
|
from the POSIX standard to match the standard (\fIposix mode\fP).
|
||||||
.TP
|
.TP
|
||||||
.B \-\-restricted
|
.B \-\-restricted
|
||||||
The shell becomes restricted (see
|
The shell becomes restricted (see
|
||||||
|
@ -677,8 +678,8 @@ If the shell option
|
||||||
.B nocasematch
|
.B nocasematch
|
||||||
is enabled, the match is performed without regard to the case
|
is enabled, the match is performed without regard to the case
|
||||||
of alphabetic characters.
|
of alphabetic characters.
|
||||||
The return value is 0 if the string matches or does not match
|
The return value is 0 if the string matches (\fB==\fP) or does not match
|
||||||
the pattern, respectively, and 1 otherwise.
|
(\fB!=\fP) the pattern, and 1 otherwise.
|
||||||
Any part of the pattern may be quoted to force it to be matched as a
|
Any part of the pattern may be quoted to force it to be matched as a
|
||||||
string.
|
string.
|
||||||
.if t .sp 0.5
|
.if t .sp 0.5
|
||||||
|
@ -807,6 +808,12 @@ it against each \fIpattern\fP in turn, using the same matching rules
|
||||||
as for pathname expansion (see
|
as for pathname expansion (see
|
||||||
.B Pathname Expansion
|
.B Pathname Expansion
|
||||||
below).
|
below).
|
||||||
|
The \fIword\fP is expanded using tilde
|
||||||
|
expansion, parameter and variable expansion, arithmetic substitution,
|
||||||
|
command substitution, process substitution and quote removal.
|
||||||
|
Each \fIpattern\fP examined is expanded using tilde
|
||||||
|
expansion, parameter and variable expansion, arithmetic substitution,
|
||||||
|
command substitution, and process substitution.
|
||||||
If the shell option
|
If the shell option
|
||||||
.B nocasematch
|
.B nocasematch
|
||||||
is enabled, the match is performed without regard to the case
|
is enabled, the match is performed without regard to the case
|
||||||
|
@ -971,7 +978,7 @@ quotes (see
|
||||||
.B PARAMETERS
|
.B PARAMETERS
|
||||||
below).
|
below).
|
||||||
.PP
|
.PP
|
||||||
Words of the form \fB$\fP'\fIstring\fP' are treated specially. The
|
Words of the form \fB$\fP\(aq\fIstring\fP\(aq are treated specially. The
|
||||||
word expands to \fIstring\fP, with backslash-escaped characters replaced
|
word expands to \fIstring\fP, with backslash-escaped characters replaced
|
||||||
as specified by the ANSI C standard. Backslash escape sequences, if
|
as specified by the ANSI C standard. Backslash escape sequences, if
|
||||||
present, are decoded as follows:
|
present, are decoded as follows:
|
||||||
|
@ -1005,7 +1012,7 @@ vertical tab
|
||||||
.B \e\e
|
.B \e\e
|
||||||
backslash
|
backslash
|
||||||
.TP
|
.TP
|
||||||
.B \e'
|
.B \e\(aq
|
||||||
single quote
|
single quote
|
||||||
.TP
|
.TP
|
||||||
.B \e\fInnn\fP
|
.B \e\fInnn\fP
|
||||||
|
@ -1368,6 +1375,8 @@ subsequently reset.
|
||||||
.B COMP_WORDS
|
.B COMP_WORDS
|
||||||
An array variable (see \fBArrays\fP below) consisting of the individual
|
An array variable (see \fBArrays\fP below) consisting of the individual
|
||||||
words in the current command line.
|
words in the current command line.
|
||||||
|
The words are split on shell metacharacters as the shell parser would
|
||||||
|
separate them.
|
||||||
This variable is available only in shell functions invoked by the
|
This variable is available only in shell functions invoked by the
|
||||||
programmable completion facilities (see \fBProgrammable Completion\fP
|
programmable completion facilities (see \fBProgrammable Completion\fP
|
||||||
below).
|
below).
|
||||||
|
@ -1686,7 +1695,8 @@ command history is not saved when an interactive shell exits.
|
||||||
.B HISTFILESIZE
|
.B HISTFILESIZE
|
||||||
The maximum number of lines contained in the history file. When this
|
The maximum number of lines contained in the history file. When this
|
||||||
variable is assigned a value, the history file is truncated, if
|
variable is assigned a value, the history file is truncated, if
|
||||||
necessary, to contain no more than that number of lines. The default
|
necessary, by removing the oldest entries,
|
||||||
|
to contain no more than that number of lines. The default
|
||||||
value is 500. The history file is also truncated to this size after
|
value is 500. The history file is also truncated to this size after
|
||||||
writing it when an interactive shell exits.
|
writing it when an interactive shell exits.
|
||||||
.TP
|
.TP
|
||||||
|
@ -1839,7 +1849,7 @@ the current mailfile.
|
||||||
Example:
|
Example:
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
\fBMAILPATH\fP='/var/mail/bfox?"You have mail":~/shell\-mail?"$_ has mail!"'
|
\fBMAILPATH\fP=\(aq/var/mail/bfox?"You have mail":~/shell\-mail?"$_ has mail!"\(aq
|
||||||
.PP
|
.PP
|
||||||
.B Bash
|
.B Bash
|
||||||
supplies a default value for this variable, but the location of the user
|
supplies a default value for this variable, but the location of the user
|
||||||
|
@ -1973,7 +1983,7 @@ The value of \fIp\fP determines whether or not the fraction is
|
||||||
included.
|
included.
|
||||||
.IP
|
.IP
|
||||||
If this variable is not set, \fBbash\fP acts as if it had the
|
If this variable is not set, \fBbash\fP acts as if it had the
|
||||||
value \fB$'\enreal\et%3lR\enuser\et%3lU\ensys\t%3lS'\fP.
|
value \fB$\(aq\enreal\et%3lR\enuser\et%3lU\ensys\t%3lS\(aq\fP.
|
||||||
If the value is null, no timing information is displayed.
|
If the value is null, no timing information is displayed.
|
||||||
A trailing newline is added when the format string is displayed.
|
A trailing newline is added when the format string is displayed.
|
||||||
.TP
|
.TP
|
||||||
|
@ -2525,17 +2535,12 @@ the pattern removal operation is applied to each member of the
|
||||||
array in turn, and the expansion is the resultant list.
|
array in turn, and the expansion is the resultant list.
|
||||||
.TP
|
.TP
|
||||||
${\fIparameter\fP\fB/\fP\fIpattern\fP\fB/\fP\fIstring\fP}
|
${\fIparameter\fP\fB/\fP\fIpattern\fP\fB/\fP\fIstring\fP}
|
||||||
.PD 0
|
|
||||||
.TP
|
|
||||||
${\fIparameter\fP\fB//\fP\fIpattern\fP\fB/\fP\fIstring\fP}
|
|
||||||
.PD
|
|
||||||
The \fIpattern\fP is expanded to produce a pattern just as in
|
The \fIpattern\fP is expanded to produce a pattern just as in
|
||||||
pathname expansion.
|
pathname expansion.
|
||||||
\fIParameter\fP is expanded and the longest match of \fIpattern\fP
|
\fIParameter\fP is expanded and the longest match of \fIpattern\fP
|
||||||
against its value is replaced with \fIstring\fP.
|
against its value is replaced with \fIstring\fP.
|
||||||
In the first form, only the first match is replaced.
|
If \Ipattern\fP begins with \fB/\fP, all matches of \fIpattern\fP are
|
||||||
The second form causes all matches of \fIpattern\fP to be
|
replaced with \fIstring\fP. Normally only the first match is replaced.
|
||||||
replaced with \fIstring\fP.
|
|
||||||
If \fIpattern\fP begins with \fB#\fP, it must match at the beginning
|
If \fIpattern\fP begins with \fB#\fP, it must match at the beginning
|
||||||
of the expanded value of \fIparameter\fP.
|
of the expanded value of \fIparameter\fP.
|
||||||
If \fIpattern\fP begins with \fB%\fP, it must match at the end
|
If \fIpattern\fP begins with \fB%\fP, it must match at the end
|
||||||
|
@ -2702,7 +2707,7 @@ If the value of
|
||||||
.B IFS
|
.B IFS
|
||||||
is null, no word splitting occurs.
|
is null, no word splitting occurs.
|
||||||
.PP
|
.PP
|
||||||
Explicit null arguments (\^\f3"\^"\fP or \^\f3'\^'\fP\^) are retained.
|
Explicit null arguments (\^\f3"\^"\fP or \^\f3\(aq\^\(aq\fP\^) are retained.
|
||||||
Unquoted implicit null arguments, resulting from the expansion of
|
Unquoted implicit null arguments, resulting from the expansion of
|
||||||
parameters that have no values, are removed.
|
parameters that have no values, are removed.
|
||||||
If a parameter with no value is expanded within double quotes, a
|
If a parameter with no value is expanded within double quotes, a
|
||||||
|
@ -2861,7 +2866,7 @@ and
|
||||||
.BR ] ,
|
.BR ] ,
|
||||||
\fIcharacter classes\fP can be specified using the syntax
|
\fIcharacter classes\fP can be specified using the syntax
|
||||||
\fB[:\fP\fIclass\fP\fB:]\fP, where \fIclass\fP is one of the
|
\fB[:\fP\fIclass\fP\fB:]\fP, where \fIclass\fP is one of the
|
||||||
following classes defined in the POSIX.2 standard:
|
following classes defined in the POSIX standard:
|
||||||
.PP
|
.PP
|
||||||
.RS
|
.RS
|
||||||
.B
|
.B
|
||||||
|
@ -2924,7 +2929,7 @@ Matches anything except one of the given patterns
|
||||||
After the preceding expansions, all unquoted occurrences of the
|
After the preceding expansions, all unquoted occurrences of the
|
||||||
characters
|
characters
|
||||||
.BR \e ,
|
.BR \e ,
|
||||||
.BR ' ,
|
.BR \(aq ,
|
||||||
and \^\f3"\fP\^ that did not result from one of the above
|
and \^\f3"\fP\^ that did not result from one of the above
|
||||||
expansions are removed.
|
expansions are removed.
|
||||||
.SH REDIRECTION
|
.SH REDIRECTION
|
||||||
|
@ -3417,6 +3422,10 @@ automatically have them defined with the
|
||||||
option to the
|
option to the
|
||||||
.B export
|
.B export
|
||||||
builtin.
|
builtin.
|
||||||
|
A function definition may be deleted using the \fB\-f\fP option to
|
||||||
|
the
|
||||||
|
.B unset
|
||||||
|
builtin.
|
||||||
Note that shell functions and variables with the same name may result
|
Note that shell functions and variables with the same name may result
|
||||||
in multiple identically-named entries in the environment passed to the
|
in multiple identically-named entries in the environment passed to the
|
||||||
shell's children.
|
shell's children.
|
||||||
|
@ -4489,8 +4498,8 @@ backslash
|
||||||
.B \e"
|
.B \e"
|
||||||
literal "
|
literal "
|
||||||
.TP
|
.TP
|
||||||
.B \e'
|
.B \e\(aq
|
||||||
literal '
|
literal \(aq
|
||||||
.RE
|
.RE
|
||||||
.PD
|
.PD
|
||||||
.PP
|
.PP
|
||||||
|
@ -4538,7 +4547,7 @@ be used to indicate a macro definition.
|
||||||
Unquoted text is assumed to be a function name.
|
Unquoted text is assumed to be a function name.
|
||||||
In the macro body, the backslash escapes described above are expanded.
|
In the macro body, the backslash escapes described above are expanded.
|
||||||
Backslash will quote any other character in the macro text,
|
Backslash will quote any other character in the macro text,
|
||||||
including " and '.
|
including " and \(aq.
|
||||||
.PP
|
.PP
|
||||||
.B Bash
|
.B Bash
|
||||||
allows the current readline key bindings to be displayed or modified
|
allows the current readline key bindings to be displayed or modified
|
||||||
|
@ -6635,10 +6644,6 @@ backslash
|
||||||
the eight-bit character whose value is the octal value \fInnn\fP
|
the eight-bit character whose value is the octal value \fInnn\fP
|
||||||
(zero to three octal digits)
|
(zero to three octal digits)
|
||||||
.TP
|
.TP
|
||||||
.B \e\fInnn\fP
|
|
||||||
the eight-bit character whose value is the octal value \fInnn\fP
|
|
||||||
(one to three octal digits)
|
|
||||||
.TP
|
|
||||||
.B \ex\fIHH\fP
|
.B \ex\fIHH\fP
|
||||||
the eight-bit character whose value is the hexadecimal value \fIHH\fP
|
the eight-bit character whose value is the hexadecimal value \fIHH\fP
|
||||||
(one or two hex digits)
|
(one or two hex digits)
|
||||||
|
@ -7314,7 +7319,7 @@ format specifications, each of which causes printing of the next successive
|
||||||
In addition to the standard \fIprintf\fP(1) formats, \fB%b\fP causes
|
In addition to the standard \fIprintf\fP(1) formats, \fB%b\fP causes
|
||||||
\fBprintf\fP to expand backslash escape sequences in the corresponding
|
\fBprintf\fP to expand backslash escape sequences in the corresponding
|
||||||
\fIargument\fP (except that \fB\ec\fP terminates output, backslashes in
|
\fIargument\fP (except that \fB\ec\fP terminates output, backslashes in
|
||||||
\fB\e'\fP, \fB\e"\fP, and \fB\e?\fP are not removed, and octal escapes
|
\fB\e\(aq\fP, \fB\e"\fP, and \fB\e?\fP are not removed, and octal escapes
|
||||||
beginning with \fB\e0\fP may contain up to four digits),
|
beginning with \fB\e0\fP may contain up to four digits),
|
||||||
and \fB%q\fP causes \fBprintf\fP to output the corresponding
|
and \fB%q\fP causes \fBprintf\fP to output the corresponding
|
||||||
\fIargument\fP in a format that can be reused as shell input.
|
\fIargument\fP in a format that can be reused as shell input.
|
||||||
|
@ -7712,7 +7717,7 @@ This option is disabled by default.
|
||||||
Change the behavior of
|
Change the behavior of
|
||||||
.B bash
|
.B bash
|
||||||
where the default operation differs
|
where the default operation differs
|
||||||
from the POSIX 1003.2 standard to match the standard (\fIposix mode\fP).
|
from the POSIX standard to match the standard (\fIposix mode\fP).
|
||||||
.TP 8
|
.TP 8
|
||||||
.B privileged
|
.B privileged
|
||||||
Same as
|
Same as
|
||||||
|
@ -8031,7 +8036,7 @@ If set, the extended pattern matching features described above under
|
||||||
\fBPathname Expansion\fP are enabled.
|
\fBPathname Expansion\fP are enabled.
|
||||||
.TP 8
|
.TP 8
|
||||||
.B extquote
|
.B extquote
|
||||||
If set, \fB$\fP'\fIstring\fP' and \fB$\fP"\fIstring\fP" quoting is
|
If set, \fB$\fP\(aq\fIstring\fP\(aq and \fB$\fP"\fIstring\fP" quoting is
|
||||||
performed within \fB${\fP\fIparameter\fP\fB}\fP expansions
|
performed within \fB${\fP\fIparameter\fP\fB}\fP expansions
|
||||||
enclosed in double quotes. This option is enabled by default.
|
enclosed in double quotes. This option is enabled by default.
|
||||||
.TP 8
|
.TP 8
|
||||||
|
@ -8400,8 +8405,8 @@ the command
|
||||||
is executed each time a shell function or a script executed with the
|
is executed each time a shell function or a script executed with the
|
||||||
\fB.\fP or \fBsource\fP builtins finishes executing.
|
\fB.\fP or \fBsource\fP builtins finishes executing.
|
||||||
Signals ignored upon entry to the shell cannot be trapped or reset.
|
Signals ignored upon entry to the shell cannot be trapped or reset.
|
||||||
Trapped signals are reset to their original values in a child
|
Trapped signals that are not being ignored are reset to their original
|
||||||
process when it is created.
|
values in a child process when it is created.
|
||||||
The return status is false if any
|
The return status is false if any
|
||||||
.I sigspec
|
.I sigspec
|
||||||
is invalid; otherwise
|
is invalid; otherwise
|
||||||
|
@ -8484,7 +8489,7 @@ option suppresses shell function lookup, as with the \fBcommand\fP builtin.
|
||||||
returns true if any of the arguments are found, false if
|
returns true if any of the arguments are found, false if
|
||||||
none are found.
|
none are found.
|
||||||
.TP
|
.TP
|
||||||
\fBulimit\fP [\fB\-SHacdflmnpstuv\fP [\fIlimit\fP]]
|
\fBulimit\fP [\fB\-SHacdefilmnpqrstuvx\fP [\fIlimit\fP]]
|
||||||
Provides control over the resources available to the shell and to
|
Provides control over the resources available to the shell and to
|
||||||
processes started by it, on systems that allow such control.
|
processes started by it, on systems that allow such control.
|
||||||
The \fB\-H\fP and \fB\-S\fP options specify that the hard or soft limit is
|
The \fB\-H\fP and \fB\-S\fP options specify that the hard or soft limit is
|
||||||
|
@ -8520,8 +8525,14 @@ The maximum size of core files created
|
||||||
.B \-d
|
.B \-d
|
||||||
The maximum size of a process's data segment
|
The maximum size of a process's data segment
|
||||||
.TP
|
.TP
|
||||||
|
.B \-e
|
||||||
|
The maximum scheduling priority ("nice")
|
||||||
|
.TP
|
||||||
.B \-f
|
.B \-f
|
||||||
The maximum size of files created by the shell
|
The maximum size of files written by the shell and its children
|
||||||
|
.TP
|
||||||
|
.B \-i
|
||||||
|
The maximum number of pending signals
|
||||||
.TP
|
.TP
|
||||||
.B \-l
|
.B \-l
|
||||||
The maximum size that may be locked into memory
|
The maximum size that may be locked into memory
|
||||||
|
@ -8536,6 +8547,12 @@ allow this value to be set)
|
||||||
.B \-p
|
.B \-p
|
||||||
The pipe size in 512-byte blocks (this may not be set)
|
The pipe size in 512-byte blocks (this may not be set)
|
||||||
.TP
|
.TP
|
||||||
|
.B \-q
|
||||||
|
The maximum number of bytes in POSIX message queues
|
||||||
|
.TP
|
||||||
|
.B \-r
|
||||||
|
The maximum real-time scheduling priority
|
||||||
|
.TP
|
||||||
.B \-s
|
.B \-s
|
||||||
The maximum stack size
|
The maximum stack size
|
||||||
.TP
|
.TP
|
||||||
|
@ -8547,6 +8564,9 @@ The maximum number of processes available to a single user
|
||||||
.TP
|
.TP
|
||||||
.B \-v
|
.B \-v
|
||||||
The maximum amount of virtual memory available to the shell
|
The maximum amount of virtual memory available to the shell
|
||||||
|
.TP
|
||||||
|
.B \-x
|
||||||
|
The maximum number of file locks
|
||||||
.PD
|
.PD
|
||||||
.PP
|
.PP
|
||||||
If
|
If
|
||||||
|
|
615
doc/bashref.info
615
doc/bashref.info
File diff suppressed because it is too large
Load diff
104
doc/bashref.texi
104
doc/bashref.texi
|
@ -24,7 +24,7 @@ are preserved on all copies.
|
||||||
|
|
||||||
@quotation
|
@quotation
|
||||||
Permission is granted to copy, distribute and/or modify this document
|
Permission is granted to copy, distribute and/or modify this document
|
||||||
under the terms of the GNU Free Documentation License, Version 1.1 or
|
under the terms of the GNU Free Documentation License, Version 1.2 or
|
||||||
any later version published by the Free Software Foundation; with no
|
any later version published by the Free Software Foundation; with no
|
||||||
Invariant Sections, with the Front-Cover texts being ``A GNU Manual,''
|
Invariant Sections, with the Front-Cover texts being ``A GNU Manual,''
|
||||||
and with the Back-Cover Texts as in (a) below. A copy of the license is
|
and with the Back-Cover Texts as in (a) below. A copy of the license is
|
||||||
|
@ -74,7 +74,7 @@ USA @*
|
||||||
@top Bash Features
|
@top Bash Features
|
||||||
|
|
||||||
This text is a brief description of the features that are present in
|
This text is a brief description of the features that are present in
|
||||||
the Bash shell (version @value{VERSION}, @value{UPDATED})..
|
the Bash shell (version @value{VERSION}, @value{UPDATED}).
|
||||||
|
|
||||||
This is Edition @value{EDITION}, last updated @value{UPDATED},
|
This is Edition @value{EDITION}, last updated @value{UPDATED},
|
||||||
of @cite{The GNU Bash Reference Manual},
|
of @cite{The GNU Bash Reference Manual},
|
||||||
|
@ -142,7 +142,8 @@ of Unix.
|
||||||
Bash is largely compatible with @code{sh} and incorporates useful
|
Bash is largely compatible with @code{sh} and incorporates useful
|
||||||
features from the Korn shell @code{ksh} and the C shell @code{csh}.
|
features from the Korn shell @code{ksh} and the C shell @code{csh}.
|
||||||
It is intended to be a conformant implementation of the @sc{ieee}
|
It is intended to be a conformant implementation of the @sc{ieee}
|
||||||
@sc{posix} Shell and Tools specification (@sc{ieee} Working Group 1003.2).
|
@sc{posix} Shell and Tools portion of the @sc{ieee} @sc{posix}
|
||||||
|
specification (@sc{ieee} Standard 1003.1).
|
||||||
It offers functional improvements over @code{sh} for both interactive and
|
It offers functional improvements over @code{sh} for both interactive and
|
||||||
programming use.
|
programming use.
|
||||||
|
|
||||||
|
@ -217,7 +218,8 @@ These definitions are used throughout the remainder of this manual.
|
||||||
@item POSIX
|
@item POSIX
|
||||||
@cindex POSIX
|
@cindex POSIX
|
||||||
A family of open system standards based on Unix. Bash
|
A family of open system standards based on Unix. Bash
|
||||||
is concerned with @sc{posix} 1003.2, the Shell and Tools Standard.
|
is primarily concerned with the Shell and Utilities portion of the
|
||||||
|
@sc{posix} 1003.1 standard.
|
||||||
|
|
||||||
@item blank
|
@item blank
|
||||||
A space or tab character.
|
A space or tab character.
|
||||||
|
@ -307,7 +309,7 @@ of an event occurring in the system.
|
||||||
@item special builtin
|
@item special builtin
|
||||||
@cindex special builtin
|
@cindex special builtin
|
||||||
A shell builtin command that has been classified as special by the
|
A shell builtin command that has been classified as special by the
|
||||||
@sc{posix} 1003.2 standard.
|
@sc{posix} standard.
|
||||||
|
|
||||||
@item token
|
@item token
|
||||||
@cindex token
|
@cindex token
|
||||||
|
@ -961,8 +963,8 @@ If the shell option @code{nocasematch}
|
||||||
(see the description of @code{shopt} in @ref{Bash Builtins})
|
(see the description of @code{shopt} in @ref{Bash Builtins})
|
||||||
is enabled, the match is performed without regard to the case
|
is enabled, the match is performed without regard to the case
|
||||||
of alphabetic characters.
|
of alphabetic characters.
|
||||||
The return value is 0 if the string matches or does not match
|
The return value is 0 if the string matches (@samp{==}) or does not
|
||||||
the pattern, respectively, and 1 otherwise.
|
match (@samp{!=})the pattern, and 1 otherwise.
|
||||||
Any part of the pattern may be quoted to force it to be matched as a
|
Any part of the pattern may be quoted to force it to be matched as a
|
||||||
string.
|
string.
|
||||||
|
|
||||||
|
@ -1084,6 +1086,9 @@ name of a command.
|
||||||
Any redirections (@pxref{Redirections}) associated with the shell function
|
Any redirections (@pxref{Redirections}) associated with the shell function
|
||||||
are performed when the function is executed.
|
are performed when the function is executed.
|
||||||
|
|
||||||
|
A function definition may be deleted using the @option{-f} option to the
|
||||||
|
@code{unset} builtin (@pxref{Bourne Shell Builtins}).
|
||||||
|
|
||||||
The exit status of a function definition is zero unless a syntax error
|
The exit status of a function definition is zero unless a syntax error
|
||||||
occurs or a readonly function with the same name already exists.
|
occurs or a readonly function with the same name already exists.
|
||||||
When executed, the exit status of a function is the exit status of the
|
When executed, the exit status of a function is the exit status of the
|
||||||
|
@ -1652,15 +1657,13 @@ the pattern removal operation is applied to each member of the
|
||||||
array in turn, and the expansion is the resultant list.
|
array in turn, and the expansion is the resultant list.
|
||||||
|
|
||||||
@item $@{@var{parameter}/@var{pattern}/@var{string}@}
|
@item $@{@var{parameter}/@var{pattern}/@var{string}@}
|
||||||
@itemx $@{@var{parameter}//@var{pattern}/@var{string}@}
|
|
||||||
|
|
||||||
The @var{pattern} is expanded to produce a pattern just as in
|
The @var{pattern} is expanded to produce a pattern just as in
|
||||||
filename expansion.
|
filename expansion.
|
||||||
@var{Parameter} is expanded and the longest match of @var{pattern}
|
@var{Parameter} is expanded and the longest match of @var{pattern}
|
||||||
against its value is replaced with @var{string}.
|
against its value is replaced with @var{string}.
|
||||||
In the first form, only the first match is replaced.
|
If @var{pattern} begins with @samp{/}, all matches of @var{pattern} are
|
||||||
The second form causes all matches of @var{pattern} to be
|
replaced with @var{string}. Normally only the first match is replaced.
|
||||||
replaced with @var{string}.
|
|
||||||
If @var{pattern} begins with @samp{#}, it must match at the beginning
|
If @var{pattern} begins with @samp{#}, it must match at the beginning
|
||||||
of the expanded value of @var{parameter}.
|
of the expanded value of @var{parameter}.
|
||||||
If @var{pattern} begins with @samp{%}, it must match at the end
|
If @var{pattern} begins with @samp{%}, it must match at the end
|
||||||
|
@ -1903,7 +1906,7 @@ force the use of the C locale by setting the @env{LC_COLLATE} or
|
||||||
Within @samp{[} and @samp{]}, @var{character classes} can be specified
|
Within @samp{[} and @samp{]}, @var{character classes} can be specified
|
||||||
using the syntax
|
using the syntax
|
||||||
@code{[:}@var{class}@code{:]}, where @var{class} is one of the
|
@code{[:}@var{class}@code{:]}, where @var{class} is one of the
|
||||||
following classes defined in the @sc{posix} 1003.2 standard:
|
following classes defined in the @sc{posix} standard:
|
||||||
@example
|
@example
|
||||||
alnum alpha ascii blank cntrl digit graph lower
|
alnum alpha ascii blank cntrl digit graph lower
|
||||||
print punct space upper word xdigit
|
print punct space upper word xdigit
|
||||||
|
@ -2588,7 +2591,7 @@ under another shell.
|
||||||
* The Set Builtin:: This builtin is so overloaded it
|
* The Set Builtin:: This builtin is so overloaded it
|
||||||
deserves its own section.
|
deserves its own section.
|
||||||
* Special Builtins:: Builtin commands classified specially by
|
* Special Builtins:: Builtin commands classified specially by
|
||||||
POSIX.2.
|
POSIX.
|
||||||
@end menu
|
@end menu
|
||||||
|
|
||||||
Builtin commands are contained within the shell itself.
|
Builtin commands are contained within the shell itself.
|
||||||
|
@ -2598,7 +2601,7 @@ the command directly, without invoking another program.
|
||||||
Builtin commands are necessary to implement functionality impossible
|
Builtin commands are necessary to implement functionality impossible
|
||||||
or inconvenient to obtain with separate utilities.
|
or inconvenient to obtain with separate utilities.
|
||||||
|
|
||||||
This section briefly the builtins which Bash inherits from
|
This section briefly describes the builtins which Bash inherits from
|
||||||
the Bourne Shell, as well as the builtin commands which are unique
|
the Bourne Shell, as well as the builtin commands which are unique
|
||||||
to or have been extended in Bash.
|
to or have been extended in Bash.
|
||||||
|
|
||||||
|
@ -2621,7 +2624,7 @@ builtins do not accept options.
|
||||||
@section Bourne Shell Builtins
|
@section Bourne Shell Builtins
|
||||||
|
|
||||||
The following shell builtin commands are inherited from the Bourne Shell.
|
The following shell builtin commands are inherited from the Bourne Shell.
|
||||||
These commands are implemented as specified by the @sc{posix} 1003.2 standard.
|
These commands are implemented as specified by the @sc{posix} standard.
|
||||||
|
|
||||||
@table @code
|
@table @code
|
||||||
@item : @r{(a colon)}
|
@item : @r{(a colon)}
|
||||||
|
@ -2809,7 +2812,7 @@ If @code{getopts} is silent, then a colon (@samp{:}) is placed in
|
||||||
@item hash
|
@item hash
|
||||||
@btindex hash
|
@btindex hash
|
||||||
@example
|
@example
|
||||||
hash [-'r] [-p @var{filename}] [-dt] [@var{name}]
|
hash [-r] [-p @var{filename}] [-dt] [@var{name}]
|
||||||
@end example
|
@end example
|
||||||
Remember the full pathnames of commands specified as @var{name} arguments,
|
Remember the full pathnames of commands specified as @var{name} arguments,
|
||||||
so they need not be searched for on subsequent invocations.
|
so they need not be searched for on subsequent invocations.
|
||||||
|
@ -3027,8 +3030,8 @@ each time a shell function or a script executed with the @code{.} or
|
||||||
@code{source} builtins finishes executing.
|
@code{source} builtins finishes executing.
|
||||||
|
|
||||||
Signals ignored upon entry to the shell cannot be trapped or reset.
|
Signals ignored upon entry to the shell cannot be trapped or reset.
|
||||||
Trapped signals are reset to their original values in a child
|
Trapped signals that are not being ignored are reset to their original
|
||||||
process when it is created.
|
values in a child process when it is created.
|
||||||
|
|
||||||
The return status is zero unless a @var{sigspec} does not specify a
|
The return status is zero unless a @var{sigspec} does not specify a
|
||||||
valid signal.
|
valid signal.
|
||||||
|
@ -3073,7 +3076,7 @@ The return status is zero unless a @var{name} is readonly.
|
||||||
|
|
||||||
This section describes builtin commands which are unique to
|
This section describes builtin commands which are unique to
|
||||||
or have been extended in Bash.
|
or have been extended in Bash.
|
||||||
Some of these commands are specified in the @sc{posix} 1003.2 standard.
|
Some of these commands are specified in the @sc{posix} standard.
|
||||||
|
|
||||||
@table @code
|
@table @code
|
||||||
|
|
||||||
|
@ -3338,9 +3341,6 @@ backslash
|
||||||
@item \0@var{nnn}
|
@item \0@var{nnn}
|
||||||
the eight-bit character whose value is the octal value @var{nnn}
|
the eight-bit character whose value is the octal value @var{nnn}
|
||||||
(zero to three octal digits)
|
(zero to three octal digits)
|
||||||
@item \@var{nnn}
|
|
||||||
the eight-bit character whose value is the octal value @var{nnn}
|
|
||||||
(one to three octal digits)
|
|
||||||
@item \x@var{HH}
|
@item \x@var{HH}
|
||||||
the eight-bit character whose value is the hexadecimal value @var{HH}
|
the eight-bit character whose value is the hexadecimal value @var{HH}
|
||||||
(one or two hex digits)
|
(one or two hex digits)
|
||||||
|
@ -3833,7 +3833,7 @@ builtin command.
|
||||||
@item ulimit
|
@item ulimit
|
||||||
@btindex ulimit
|
@btindex ulimit
|
||||||
@example
|
@example
|
||||||
ulimit [-acdflmnpstuvSH] [@var{limit}]
|
ulimit [-acdefilmnpqrstuvxSH] [@var{limit}]
|
||||||
@end example
|
@end example
|
||||||
@code{ulimit} provides control over the resources available to processes
|
@code{ulimit} provides control over the resources available to processes
|
||||||
started by the shell, on systems that allow such control. If an
|
started by the shell, on systems that allow such control. If an
|
||||||
|
@ -3854,8 +3854,14 @@ The maximum size of core files created.
|
||||||
@item -d
|
@item -d
|
||||||
The maximum size of a process's data segment.
|
The maximum size of a process's data segment.
|
||||||
|
|
||||||
|
@item -e
|
||||||
|
The maximum scheduling priority ("nice").
|
||||||
|
|
||||||
@item -f
|
@item -f
|
||||||
The maximum size of files created by the shell.
|
The maximum size of files written by the shell and its children.
|
||||||
|
|
||||||
|
@item -i
|
||||||
|
The maximum number of pending signals.
|
||||||
|
|
||||||
@item -l
|
@item -l
|
||||||
The maximum size that may be locked into memory.
|
The maximum size that may be locked into memory.
|
||||||
|
@ -3869,6 +3875,12 @@ The maximum number of open file descriptors.
|
||||||
@item -p
|
@item -p
|
||||||
The pipe buffer size.
|
The pipe buffer size.
|
||||||
|
|
||||||
|
@item -q
|
||||||
|
The maximum number of bytes in POSIX message queues.
|
||||||
|
|
||||||
|
@item -r
|
||||||
|
The maximum real-time scheduling priority.
|
||||||
|
|
||||||
@item -s
|
@item -s
|
||||||
The maximum stack size.
|
The maximum stack size.
|
||||||
|
|
||||||
|
@ -3881,6 +3893,9 @@ The maximum number of processes available to a single user.
|
||||||
@item -v
|
@item -v
|
||||||
The maximum amount of virtual memory available to the process.
|
The maximum amount of virtual memory available to the process.
|
||||||
|
|
||||||
|
@item -x
|
||||||
|
The maximum number of file locks.
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
If @var{limit} is given, it is the new value of the specified resource;
|
If @var{limit} is given, it is the new value of the specified resource;
|
||||||
|
@ -4045,7 +4060,7 @@ This option is disabled by default.
|
||||||
|
|
||||||
@item posix
|
@item posix
|
||||||
Change the behavior of Bash where the default operation differs
|
Change the behavior of Bash where the default operation differs
|
||||||
from the @sc{posix} 1003.2 standard to match the standard
|
from the @sc{posix} standard to match the standard
|
||||||
(@pxref{Bash POSIX Mode}).
|
(@pxref{Bash POSIX Mode}).
|
||||||
This is intended to make Bash behave as a strict superset of that
|
This is intended to make Bash behave as a strict superset of that
|
||||||
standard.
|
standard.
|
||||||
|
@ -4089,8 +4104,8 @@ shell will exit.
|
||||||
Print shell input lines as they are read.
|
Print shell input lines as they are read.
|
||||||
|
|
||||||
@item -x
|
@item -x
|
||||||
Print a trace of simple commands, \fBfor\fP commands, \fBcase\fP
|
Print a trace of simple commands, @code{for} commands, @code{case}
|
||||||
commands, \fBselect\fP commands, and arithmetic \fBfor\fP commands
|
commands, @code{select} commands, and arithmetic @code{for} commands
|
||||||
and their arguments or associated word lists after they are
|
and their arguments or associated word lists after they are
|
||||||
expanded and before they are executed. The value of the @env{PS4}
|
expanded and before they are executed. The value of the @env{PS4}
|
||||||
variable is expanded and the resultant value is printed before
|
variable is expanded and the resultant value is printed before
|
||||||
|
@ -4172,7 +4187,7 @@ The return status is always zero unless an invalid option is supplied.
|
||||||
@section Special Builtins
|
@section Special Builtins
|
||||||
@cindex special builtin
|
@cindex special builtin
|
||||||
|
|
||||||
For historical reasons, the @sc{posix} 1003.2 standard has classified
|
For historical reasons, the @sc{posix} standard has classified
|
||||||
several builtin commands as @emph{special}.
|
several builtin commands as @emph{special}.
|
||||||
When Bash is executing in @sc{posix} mode, the special builtins
|
When Bash is executing in @sc{posix} mode, the special builtins
|
||||||
differ from other builtin commands in three respects:
|
differ from other builtin commands in three respects:
|
||||||
|
@ -4414,6 +4429,8 @@ even if it is subsequently reset.
|
||||||
@item COMP_WORDS
|
@item COMP_WORDS
|
||||||
An array variable consisting of the individual
|
An array variable consisting of the individual
|
||||||
words in the current command line.
|
words in the current command line.
|
||||||
|
The words are split on shell metacharacters as the shell parser would
|
||||||
|
separate them.
|
||||||
This variable is available only in shell functions invoked by the
|
This variable is available only in shell functions invoked by the
|
||||||
programmable completion facilities (@pxref{Programmable Completion}).
|
programmable completion facilities (@pxref{Programmable Completion}).
|
||||||
|
|
||||||
|
@ -4525,7 +4542,8 @@ default value is @file{~/.bash_history}.
|
||||||
@item HISTFILESIZE
|
@item HISTFILESIZE
|
||||||
The maximum number of lines contained in the history file. When this
|
The maximum number of lines contained in the history file. When this
|
||||||
variable is assigned a value, the history file is truncated, if
|
variable is assigned a value, the history file is truncated, if
|
||||||
necessary, to contain no more than that number of lines.
|
necessary, by removing the oldest entries,
|
||||||
|
to contain no more than that number of lines.
|
||||||
The history file is also truncated to this size after
|
The history file is also truncated to this size after
|
||||||
writing it when an interactive shell exits.
|
writing it when an interactive shell exits.
|
||||||
The default value is 500.
|
The default value is 500.
|
||||||
|
@ -4875,7 +4893,7 @@ invoked as @code{sh}.
|
||||||
|
|
||||||
@item --posix
|
@item --posix
|
||||||
Change the behavior of Bash where the default operation differs
|
Change the behavior of Bash where the default operation differs
|
||||||
from the @sc{posix} 1003.2 standard to match the standard. This
|
from the @sc{posix} standard to match the standard. This
|
||||||
is intended to make Bash behave as a strict superset of that
|
is intended to make Bash behave as a strict superset of that
|
||||||
standard. @xref{Bash POSIX Mode}, for a description of the Bash
|
standard. @xref{Bash POSIX Mode}, for a description of the Bash
|
||||||
@sc{posix} mode.
|
@sc{posix} mode.
|
||||||
|
@ -5888,7 +5906,7 @@ the shell spawned to execute the script.
|
||||||
|
|
||||||
Starting Bash with the @option{--posix} command-line option or executing
|
Starting Bash with the @option{--posix} command-line option or executing
|
||||||
@samp{set -o posix} while Bash is running will cause Bash to conform more
|
@samp{set -o posix} while Bash is running will cause Bash to conform more
|
||||||
closely to the @sc{posix} 1003.2 standard by changing the behavior to
|
closely to the @sc{posix} standard by changing the behavior to
|
||||||
match that specified by @sc{posix} in areas where the Bash default differs.
|
match that specified by @sc{posix} in areas where the Bash default differs.
|
||||||
|
|
||||||
When invoked as @code{sh}, Bash enters @sc{posix} mode after reading the
|
When invoked as @code{sh}, Bash enters @sc{posix} mode after reading the
|
||||||
|
@ -5921,13 +5939,13 @@ Reserved words appearing in a context where reserved words are recognized
|
||||||
do not undergo alias expansion.
|
do not undergo alias expansion.
|
||||||
|
|
||||||
@item
|
@item
|
||||||
The @sc{posix} 1003.2 @env{PS1} and @env{PS2} expansions of @samp{!} to
|
The @sc{posix} @env{PS1} and @env{PS2} expansions of @samp{!} to
|
||||||
the history number and @samp{!!} to @samp{!} are enabled,
|
the history number and @samp{!!} to @samp{!} are enabled,
|
||||||
and parameter expansion is performed on the values of @env{PS1} and
|
and parameter expansion is performed on the values of @env{PS1} and
|
||||||
@env{PS2} regardless of the setting of the @code{promptvars} option.
|
@env{PS2} regardless of the setting of the @code{promptvars} option.
|
||||||
|
|
||||||
@item
|
@item
|
||||||
The @sc{posix} 1003.2 startup files are executed (@env{$ENV}) rather than
|
The @sc{posix} startup files are executed (@env{$ENV}) rather than
|
||||||
the normal Bash files.
|
the normal Bash files.
|
||||||
|
|
||||||
@item
|
@item
|
||||||
|
@ -5969,13 +5987,13 @@ may not start with a digit. Declaring a function with an invalid name
|
||||||
causes a fatal syntax error in non-interactive shells.
|
causes a fatal syntax error in non-interactive shells.
|
||||||
|
|
||||||
@item
|
@item
|
||||||
@sc{posix} 1003.2 special builtins are found before shell functions
|
@sc{posix} special builtins are found before shell functions
|
||||||
during command lookup.
|
during command lookup.
|
||||||
|
|
||||||
@item
|
@item
|
||||||
If a @sc{posix} 1003.2 special builtin returns an error status, a
|
If a @sc{posix} special builtin returns an error status, a
|
||||||
non-interactive shell exits. The fatal errors are those listed in
|
non-interactive shell exits. The fatal errors are those listed in
|
||||||
the POSIX.2 standard, and include things like passing incorrect options,
|
the POSIX standard, and include things like passing incorrect options,
|
||||||
redirection errors, variable assignment errors for assignments preceding
|
redirection errors, variable assignment errors for assignments preceding
|
||||||
the command name, and so on.
|
the command name, and so on.
|
||||||
|
|
||||||
|
@ -6003,7 +6021,7 @@ variable in a @code{for} statement or the selection variable in a
|
||||||
Process substitution is not available.
|
Process substitution is not available.
|
||||||
|
|
||||||
@item
|
@item
|
||||||
Assignment statements preceding @sc{posix} 1003.2 special builtins
|
Assignment statements preceding @sc{posix} special builtins
|
||||||
persist in the shell environment after the builtin completes.
|
persist in the shell environment after the builtin completes.
|
||||||
|
|
||||||
@item
|
@item
|
||||||
|
@ -6013,7 +6031,7 @@ special builtin command had been executed.
|
||||||
|
|
||||||
@item
|
@item
|
||||||
The @code{export} and @code{readonly} builtin commands display their
|
The @code{export} and @code{readonly} builtin commands display their
|
||||||
output in the format required by @sc{posix} 1003.2.
|
output in the format required by @sc{posix}.
|
||||||
|
|
||||||
@item
|
@item
|
||||||
The @code{trap} builtin displays signal names without the leading
|
The @code{trap} builtin displays signal names without the leading
|
||||||
|
@ -6092,7 +6110,7 @@ escape characters are converted.
|
||||||
|
|
||||||
@end enumerate
|
@end enumerate
|
||||||
|
|
||||||
There is other @sc{posix} 1003.2 behavior that Bash does not implement by
|
There is other @sc{posix} behavior that Bash does not implement by
|
||||||
default even when in @sc{posix} mode.
|
default even when in @sc{posix} mode.
|
||||||
Specifically:
|
Specifically:
|
||||||
|
|
||||||
|
@ -6915,7 +6933,7 @@ Please send all reports concerning this manual to
|
||||||
|
|
||||||
Bash implements essentially the same grammar, parameter and
|
Bash implements essentially the same grammar, parameter and
|
||||||
variable expansion, redirection, and quoting as the Bourne Shell.
|
variable expansion, redirection, and quoting as the Bourne Shell.
|
||||||
Bash uses the @sc{posix} 1003.2 standard as the specification of
|
Bash uses the @sc{posix} standard as the specification of
|
||||||
how these features are to be implemented. There are some
|
how these features are to be implemented. There are some
|
||||||
differences between the traditional Bourne shell and Bash; this
|
differences between the traditional Bourne shell and Bash; this
|
||||||
section quickly details the differences of significance. A
|
section quickly details the differences of significance. A
|
||||||
|
@ -7079,7 +7097,7 @@ not all words (@pxref{Word Splitting}).
|
||||||
This closes a longstanding shell security hole.
|
This closes a longstanding shell security hole.
|
||||||
|
|
||||||
@item
|
@item
|
||||||
Bash implements the full set of @sc{posix} 1003.2 filename expansion operators,
|
Bash implements the full set of @sc{posix} filename expansion operators,
|
||||||
including @var{character classes}, @var{equivalence classes}, and
|
including @var{character classes}, @var{equivalence classes}, and
|
||||||
@var{collating symbols} (@pxref{Filename Expansion}).
|
@var{collating symbols} (@pxref{Filename Expansion}).
|
||||||
|
|
||||||
|
@ -7364,8 +7382,8 @@ with a @samp{-}.
|
||||||
|
|
||||||
@item
|
@item
|
||||||
The SVR4.2 shell exits a script if any builtin fails; Bash exits
|
The SVR4.2 shell exits a script if any builtin fails; Bash exits
|
||||||
a script only if one of the @sc{posix} 1003.2 special builtins fails, and
|
a script only if one of the @sc{posix} special builtins fails, and
|
||||||
only for certain failures, as enumerated in the @sc{posix} 1003.2 standard.
|
only for certain failures, as enumerated in the @sc{posix} standard.
|
||||||
|
|
||||||
@item
|
@item
|
||||||
The SVR4.2 shell behaves differently when invoked as @code{jsh}
|
The SVR4.2 shell behaves differently when invoked as @code{jsh}
|
||||||
|
|
1581
doc/rose94.ps
1581
doc/rose94.ps
File diff suppressed because it is too large
Load diff
|
@ -1,10 +1,10 @@
|
||||||
@ignore
|
@ignore
|
||||||
Copyright (C) 1988-2005 Free Software Foundation, Inc.
|
Copyright (C) 1988-2006 Free Software Foundation, Inc.
|
||||||
@end ignore
|
@end ignore
|
||||||
|
|
||||||
@set LASTCHANGE Mon Sep 5 11:47:04 EDT 2005
|
@set LASTCHANGE Thu Sep 28 10:25:45 EDT 2006
|
||||||
|
|
||||||
@set EDITION 3.1-beta1
|
@set EDITION 3.2
|
||||||
@set VERSION 3.1-beta1
|
@set VERSION 3.2
|
||||||
@set UPDATED 5 September 2005
|
@set UPDATED 28 September 2006
|
||||||
@set UPDATED-MONTH September 2005
|
@set UPDATED-MONTH September 2006
|
||||||
|
|
2
error.c
2
error.c
|
@ -52,8 +52,6 @@ extern int errno;
|
||||||
|
|
||||||
extern int executing_line_number __P((void));
|
extern int executing_line_number __P((void));
|
||||||
|
|
||||||
extern int interactive_shell, interactive, startup_state;
|
|
||||||
extern char *dollar_vars[];
|
|
||||||
extern char *shell_name;
|
extern char *shell_name;
|
||||||
#if defined (JOB_CONTROL)
|
#if defined (JOB_CONTROL)
|
||||||
extern pid_t shell_pgrp;
|
extern pid_t shell_pgrp;
|
||||||
|
|
2
eval.c
2
eval.c
|
@ -212,7 +212,7 @@ parse_command ()
|
||||||
{
|
{
|
||||||
command_to_execute = get_string_value ("PROMPT_COMMAND");
|
command_to_execute = get_string_value ("PROMPT_COMMAND");
|
||||||
if (command_to_execute)
|
if (command_to_execute)
|
||||||
execute_prompt_command (command_to_execute);
|
execute_variable_command (command_to_execute, "PROMPT_COMMAND");
|
||||||
|
|
||||||
if (running_under_emacs == 2)
|
if (running_under_emacs == 2)
|
||||||
send_pwd_to_eterm (); /* Yuck */
|
send_pwd_to_eterm (); /* Yuck */
|
||||||
|
|
822
examples/INDEX.html
Normal file
822
examples/INDEX.html
Normal file
|
@ -0,0 +1,822 @@
|
||||||
|
<table border=1>
|
||||||
|
<tr>
|
||||||
|
<th>Path</th>
|
||||||
|
<th>Description</th>
|
||||||
|
<th>X-Ref</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./bashdb</td>
|
||||||
|
<td>Deprecated sample implementation of a bash debugger</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./complete</td>
|
||||||
|
<td>Shell completion code</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions</td>
|
||||||
|
<td>Example functions</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/array-stuff</td>
|
||||||
|
<td>Various array functions (ashift, array_sort, reverse).</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/array-to-string</td>
|
||||||
|
<td>Convert an array to a string.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/autoload</td>
|
||||||
|
<td>An almost ksh-compatible 'autoload' (no lazy load).</td>
|
||||||
|
<td>ksh</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/autoload.v2</td>
|
||||||
|
<td>An almost ksh-compatible 'autoload' (no lazy load).</td>
|
||||||
|
<td>ksh</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/autoload.v3</td>
|
||||||
|
<td>A more ksh-compatible 'autoload' (with lazy load).</td>
|
||||||
|
<td>ksh</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/basename</td>
|
||||||
|
<td>A replacement for basename(1).</td>
|
||||||
|
<td>basename</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/basename2</td>
|
||||||
|
<td>Fast basename(1) and dirname(1) functions for BASH/SH.</td>
|
||||||
|
<td>basename, dirname</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/coproc.bash</td>
|
||||||
|
<td>Start, control, and end coprocesses.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/coshell.bash</td>
|
||||||
|
<td>Control shell coprocesses (see coprocess.bash).</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/coshell.README</td>
|
||||||
|
<td>README for coshell and coproc.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/csh-compat</td>
|
||||||
|
<td>A C-shell compatibility package.</td>
|
||||||
|
<td>csh</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/dirfuncs</td>
|
||||||
|
<td>Directory manipulation functions from the book 'The Korn Shell'.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/dirname</td>
|
||||||
|
<td>A replacement for dirname(1).</td>
|
||||||
|
<td>dirname</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/emptydir</td>
|
||||||
|
<td>Find out if a directory is empty.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/exitstat</td>
|
||||||
|
<td>Display the exit status of processes.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/external</td>
|
||||||
|
<td>Like 'command' but FORCES use of external command.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/fact</td>
|
||||||
|
<td>Recursive factorial function.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/fstty</td>
|
||||||
|
<td>Front end to sync TERM changes to both stty(1) and readline 'bind'.</td>
|
||||||
|
<td>stty.bash</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/func</td>
|
||||||
|
<td>Print out definitions for functions named by arguments.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/gethtml</td>
|
||||||
|
<td>Get a web page from a remote server (wget(1) in bash!).</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/getoptx.bash</td>
|
||||||
|
<td>getopt function that parses long-named options.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/inetaddr</td>
|
||||||
|
<td>Internet address conversion (inet2hex & hex2inet).</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/inpath</td>
|
||||||
|
<td>Return zero if the argument is in the path and executable.</td>
|
||||||
|
<td>inpath</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/isnum.bash</td>
|
||||||
|
<td>Test user input on numeric or character value.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/isnum2</td>
|
||||||
|
<td>Test user input on numeric values, with floating point.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/isvalidip</td>
|
||||||
|
<td>Test user input for valid IP Addresses.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/jdate.bash</td>
|
||||||
|
<td>Julian date conversion.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/jj.bash</td>
|
||||||
|
<td>Look for running jobs.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/keep</td>
|
||||||
|
<td>Try to keep some programs in the forground and running.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/ksh-cd</td>
|
||||||
|
<td>ksh-like 'cd': cd [-LP] [dir [change]].</td>
|
||||||
|
<td>ksh</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/ksh-compat-test</td>
|
||||||
|
<td>ksh-like arithmetic test replacements.</td>
|
||||||
|
<td>ksh</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/kshenv</td>
|
||||||
|
<td>Functions and aliases to provide the beginnings of a ksh environment for bash.</td>
|
||||||
|
<td>ksh</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/login</td>
|
||||||
|
<td>Replace the 'login' and 'newgrp' builtins in old Bourne shells.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/lowercase</td>
|
||||||
|
<td>Rename files to lower case.</td>
|
||||||
|
<td>rename lower</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/manpage</td>
|
||||||
|
<td>Find and print a manual page.</td>
|
||||||
|
<td>fman</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/mhfold</td>
|
||||||
|
<td>Print MH folders, useful only because folders(1) doesn't print mod date/times.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/notify.bash</td>
|
||||||
|
<td>Notify when jobs change status.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/pathfuncs</td>
|
||||||
|
<td>Path related functions (no_path, add_path, pre-path, del_path).</td>
|
||||||
|
<td>path</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/README</td>
|
||||||
|
<td>README</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/recurse</td>
|
||||||
|
<td>Recursive directory traverser.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/repeat2</td>
|
||||||
|
<td>A clone of C shell builtin 'repeat'.</td>
|
||||||
|
<td>repeat, csh</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/repeat3</td>
|
||||||
|
<td>A clone of C shell builtin 'repeat'.</td>
|
||||||
|
<td>repeat, csh</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/seq</td>
|
||||||
|
<td>Generate a sequence from m to n, m defaults to 1.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/seq2</td>
|
||||||
|
<td>Generate a sequence from m to n, m defaults to 1.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/shcat</td>
|
||||||
|
<td>Readline-based pager.</td>
|
||||||
|
<td>cat, readline pager</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/shcat2</td>
|
||||||
|
<td>Readline-based pagers.</td>
|
||||||
|
<td>cat, readline pager</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/sort-pos-params</td>
|
||||||
|
<td>Sort the positional parameters.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/substr</td>
|
||||||
|
<td>A function to emulate the ancient ksh builtin.</td>
|
||||||
|
<td>ksh</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/substr2</td>
|
||||||
|
<td>A function to emulate the ancient ksh builtin.</td>
|
||||||
|
<td>ksh</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/term</td>
|
||||||
|
<td>A shell function to set the terminal type interactively or not.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/whatis</td>
|
||||||
|
<td>An implementation of the 10th Edition Unix sh builtin 'whatis(1)' command.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/whence</td>
|
||||||
|
<td>An almost-ksh compatible 'whence(1)' command.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/which</td>
|
||||||
|
<td>An emulation of 'which(1)' as it appears in FreeBSD.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/xalias.bash</td>
|
||||||
|
<td>Convert csh alias commands to bash functions.</td>
|
||||||
|
<td>csh, aliasconv</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./functions/xfind.bash</td>
|
||||||
|
<td>A 'find(1)' clone.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./loadables/</td>
|
||||||
|
<td>Example loadable replacements</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./loadables/basename.c</td>
|
||||||
|
<td>Return non-directory portion of pathname.</td>
|
||||||
|
<td>basename</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./loadables/cat.c</td>
|
||||||
|
<td>cat(1) replacement with no options - the way cat was intended.</td>
|
||||||
|
<td>cat, readline pager</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./loadables/cut.c</td>
|
||||||
|
<td>cut(1) replacement.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./loadables/dirname.c</td>
|
||||||
|
<td>Return directory portion of pathname.</td>
|
||||||
|
<td>dirname</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./loadables/finfo.c</td>
|
||||||
|
<td>Print file info.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./loadables/getconf.c</td>
|
||||||
|
<td>POSIX.2 getconf utility.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./loadables/getconf.h</td>
|
||||||
|
<td>Replacement definitions for ones the system doesn't provide.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./loadables/head.c</td>
|
||||||
|
<td>Copy first part of files.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./loadables/hello.c</td>
|
||||||
|
<td>Obligatory "Hello World" / sample loadable.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./loadables/id.c</td>
|
||||||
|
<td>POSIX.2 user identity.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./loadables/ln.c</td>
|
||||||
|
<td>Make links.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./loadables/logname.c</td>
|
||||||
|
<td>Print login name of current user.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./loadables/Makefile.in</td>
|
||||||
|
<td>Simple makefile for the sample loadable builtins.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./loadables/mkdir.c</td>
|
||||||
|
<td>Make directories.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./loadables/necho.c</td>
|
||||||
|
<td>echo without options or argument interpretation.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./loadables/pathchk.c</td>
|
||||||
|
<td>Check pathnames for validity and portability.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./loadables/print.c</td>
|
||||||
|
<td>Loadable ksh-93 style print builtin.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./loadables/printenv.c</td>
|
||||||
|
<td>Minimal builtin clone of BSD printenv(1).</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./loadables/push.c</td>
|
||||||
|
<td>Anyone remember TOPS-20?</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./loadables/README</td>
|
||||||
|
<td>README</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./loadables/realpath.c</td>
|
||||||
|
<td>Canonicalize pathnames, resolving symlinks.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./loadables/rmdir.c</td>
|
||||||
|
<td>Remove directory.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./loadables/sleep.c</td>
|
||||||
|
<td>sleep for fractions of a second.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./loadables/strftime.c</td>
|
||||||
|
<td>Loadable builtin interface to strftime(3).</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./loadables/sync.c</td>
|
||||||
|
<td>Sync the disks by forcing pending filesystem writes to complete.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./loadables/tee.c</td>
|
||||||
|
<td>Duplicate standard input.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./loadables/template.c</td>
|
||||||
|
<td>Example template for loadable builtin.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./loadables/truefalse.c</td>
|
||||||
|
<td>True and false builtins.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./loadables/tty.c</td>
|
||||||
|
<td>Return terminal name.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./loadables/uname.c</td>
|
||||||
|
<td>Print system information.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./loadables/unlink.c</td>
|
||||||
|
<td>Remove a directory entry.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./loadables/whoami.c</td>
|
||||||
|
<td>Print out username of current user.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./loadables/perl/</td>
|
||||||
|
<td>Illustrate how to build a Perl interpreter into bash.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./misc</td>
|
||||||
|
<td>Miscellaneous</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./misc/aliasconv.bash</td>
|
||||||
|
<td>Convert csh aliases to bash aliases and functions.</td>
|
||||||
|
<td>csh, xalias</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./misc/aliasconv.sh</td>
|
||||||
|
<td>Convert csh aliases to bash aliases and functions.</td>
|
||||||
|
<td>csh, xalias</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./misc/cshtobash</td>
|
||||||
|
<td>Convert csh aliases, environment variables, and variables to bash equivalents.</td>
|
||||||
|
<td>csh, xalias</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./misc/README</td>
|
||||||
|
<td>README</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./misc/suncmd.termcap</td>
|
||||||
|
<td>SunView TERMCAP string.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./obashdb</td>
|
||||||
|
<td>Modified version of the Korn Shell debugger from Bill Rosenblatt's 'Learning the Korn Shell'.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.noah</td>
|
||||||
|
<td>Noah Friedman's collection of scripts (updated to bash v2 syntax by Chet Ramey)</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.noah/aref.bash</td>
|
||||||
|
<td>Pseudo-arrays and substring indexing examples.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.noah/bash.sub.bash</td>
|
||||||
|
<td>Library functions used by require.bash.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.noah/bash_version.bash</td>
|
||||||
|
<td>A function to slice up $BASH_VERSION.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.noah/meta.bash</td>
|
||||||
|
<td>Enable and disable eight-bit readline input.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.noah/mktmp.bash</td>
|
||||||
|
<td>Make a temporary file with a unique name.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.noah/number.bash</td>
|
||||||
|
<td>A fun hack to translate numerals into English.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.noah/PERMISSION</td>
|
||||||
|
<td>Permissions to use the scripts in this directory.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.noah/prompt.bash</td>
|
||||||
|
<td>A way to set PS1 to some predefined strings.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.noah/README</td>
|
||||||
|
<td>README</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.noah/remap_keys.bash</td>
|
||||||
|
<td>A front end to 'bind' to redo readline bindings.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.noah/require.bash</td>
|
||||||
|
<td>Lisp-like require/provide library functions for bash.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.noah/send_mail.bash</td>
|
||||||
|
<td>Replacement SMTP client written in bash.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.noah/shcat.bash</td>
|
||||||
|
<td>Bash replacement for 'cat(1)'.</td>
|
||||||
|
<td>cat</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.noah/source.bash</td>
|
||||||
|
<td>Replacement for source that uses current directory.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.noah/string.bash</td>
|
||||||
|
<td>The string(3) functions at the shell level.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.noah/stty.bash</td>
|
||||||
|
<td>Front-end to stty(1) that changes readline bindings too.</td>
|
||||||
|
<td>fstty</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.noah/y_or_n_p.bash</td>
|
||||||
|
<td>Prompt for a yes/no/quit answer.</td>
|
||||||
|
<td>ask</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.v2</td>
|
||||||
|
<td>John DuBois' ksh script collection (converted to bash v2 syntax by Chet Ramey).</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.v2/arc2tarz</td>
|
||||||
|
<td>Convert an "arc" archive to a compressed tar archive.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.v2/bashrand</td>
|
||||||
|
<td>Random number generator with upper and lower bounds and optional seed.</td>
|
||||||
|
<td>random</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.v2/cal2day.bash</td>
|
||||||
|
<td>Convert a day number to a name.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.v2/cdhist.bash</td>
|
||||||
|
<td>cd replacement with a directory stack added.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.v2/corename</td>
|
||||||
|
<td>Tell what produced a core file.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.v2/fman</td>
|
||||||
|
<td>Fast man(1) replacement.</td>
|
||||||
|
<td>manpage</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.v2/frcp</td>
|
||||||
|
<td>Copy files using ftp(1) but with rcp-type command line syntax.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.v2/lowercase</td>
|
||||||
|
<td>Change filenames to lower case.</td>
|
||||||
|
<td>rename lower</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.v2/ncp</td>
|
||||||
|
<td>A nicer front end for cp(1) (has -i, etc.).</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.v2/newext</td>
|
||||||
|
<td>Change the extension of a group of files.</td>
|
||||||
|
<td>rename</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.v2/nmv</td>
|
||||||
|
<td>A nicer front end for mv(1) (has -i, etc.).</td>
|
||||||
|
<td>rename</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.v2/pages</td>
|
||||||
|
<td>Print specified pages from files.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.v2/PERMISSION</td>
|
||||||
|
<td>Permissions to use the scripts in this directory.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.v2/pf</td>
|
||||||
|
<td>A pager front end that handles compressed files.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.v2/pmtop</td>
|
||||||
|
<td>Poor man's 'top(1)' for SunOS 4.x and BSD/OS.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.v2/README</td>
|
||||||
|
<td>README</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.v2/ren</td>
|
||||||
|
<td>Rename files by changing parts of filenames that match a pattern.</td>
|
||||||
|
<td>rename</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.v2/rename</td>
|
||||||
|
<td>Change the names of files that match a pattern.</td>
|
||||||
|
<td>rename</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.v2/repeat</td>
|
||||||
|
<td>Execute a command multiple times.</td>
|
||||||
|
<td>repeat</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.v2/shprof</td>
|
||||||
|
<td>Line profiler for bash scripts.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.v2/untar</td>
|
||||||
|
<td>Unarchive a (possibly compressed) tarfile into a directory.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.v2/uudec</td>
|
||||||
|
<td>Carefully uudecode(1) multiple files.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.v2/uuenc</td>
|
||||||
|
<td>uuencode(1) multiple files.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.v2/vtree</td>
|
||||||
|
<td>Print a visual display of a directory tree.</td>
|
||||||
|
<td>tree</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts.v2/where</td>
|
||||||
|
<td>Show where commands that match a pattern are.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts</td>
|
||||||
|
<td>Example scripts</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts/adventure.sh</td>
|
||||||
|
<td>Text adventure game in bash!</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts/bcsh.sh</td>
|
||||||
|
<td>Bourne shell cshell-emulator.</td>
|
||||||
|
<td>csh</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts/cat.sh</td>
|
||||||
|
<td>Readline-based pager.</td>
|
||||||
|
<td>cat, readline pager</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts/center</td>
|
||||||
|
<td>Center - center a group of lines.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts/dd-ex.sh</td>
|
||||||
|
<td>Line editor using only /bin/sh, /bin/dd and /bin/rm.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts/fixfiles.bash</td>
|
||||||
|
<td>Recurse a tree and fix files containing various "bad" chars.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts/hanoi.bash</td>
|
||||||
|
<td>The inevitable Towers of Hanoi in bash.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts/inpath</td>
|
||||||
|
<td>Search $PATH for a file the same name as $1; return TRUE if found.</td>
|
||||||
|
<td>inpath</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts/krand.bash</td>
|
||||||
|
<td>Produces a random number within integer limits.</td>
|
||||||
|
<td>random</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts/line-input.bash</td>
|
||||||
|
<td>Line input routine for GNU Bourne-Again Shell plus terminal-control primitives.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts/nohup.bash</td>
|
||||||
|
<td>bash version of 'nohup' command.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts/precedence</td>
|
||||||
|
<td>Test relative precedences for '&&' and '||' operators.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts/randomcard.bash</td>
|
||||||
|
<td>Print a random card from a card deck.</td>
|
||||||
|
<td>random</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts/README</td>
|
||||||
|
<td>README</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts/scrollbar</td>
|
||||||
|
<td>Display scrolling text.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts/scrollbar2</td>
|
||||||
|
<td>Display scrolling text.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts/self-repro</td>
|
||||||
|
<td>A self-reproducing script (careful!)</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts/showperm.bash</td>
|
||||||
|
<td>Convert ls(1) symbolic permissions into octal mode.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts/shprompt</td>
|
||||||
|
<td>Display a prompt and get an answer satisfying certain criteria.</td>
|
||||||
|
<td>ask</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts/spin.bash</td>
|
||||||
|
<td>Display a 'spinning wheel' to show progress.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts/timeout</td>
|
||||||
|
<td>Give rsh(1) a shorter timeout.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts/vtree2</td>
|
||||||
|
<td>Display a tree printout of dir in 1k blocks.</td>
|
||||||
|
<td>tree</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts/vtree3</td>
|
||||||
|
<td>Display a graphical tree printout of dir.</td>
|
||||||
|
<td>tree</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts/vtree3a</td>
|
||||||
|
<td>Display a graphical tree printout of dir.</td>
|
||||||
|
<td>tree</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts/websrv.sh</td>
|
||||||
|
<td>A web server in bash!</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts/xterm_title</td>
|
||||||
|
<td>Print the contents of the xterm title bar.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./scripts/zprintf</td>
|
||||||
|
<td>Emulate printf (obsolete since it's now a bash builtin).</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./startup-files</td>
|
||||||
|
<td>Example Start-up files.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./startup-files/Bash_aliases</td>
|
||||||
|
<td>Some useful aliases (Fox).</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./startup-files/Bash_profile</td>
|
||||||
|
<td>Sample startup file for bash login shells (Fox).</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./startup-files/bash-profile</td>
|
||||||
|
<td>Sample startup file for bash login shells (Ramey).</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./startup-files/bashrc</td>
|
||||||
|
<td>Sample Bourne Again SHell init file (Ramey).</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./startup-files/Bashrc.bfox</td>
|
||||||
|
<td>Sample Bourne Again SHell init file (Fox).</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./startup-files/README</td>
|
||||||
|
<td>README</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./startup-files/apple</td>
|
||||||
|
<td>Example Start-up files for Mac OS X.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./startup-files/apple/aliases</td>
|
||||||
|
<td>Sample aliases for Mac OS X.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./startup-files/apple/bash.defaults</td>
|
||||||
|
<td>Sample User preferences file.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./startup-files/apple/environment</td>
|
||||||
|
<td>Sample Bourne Again Shell environment file.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./startup-files/apple/login</td>
|
||||||
|
<td>Sample login wrapper.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./startup-files/apple/logout</td>
|
||||||
|
<td>Sample logout wrapper.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./startup-files/apple/rc</td>
|
||||||
|
<td>Sample Bourne Again Shell config file.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>./startup-files/apple/README</td>
|
||||||
|
<td>README</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
198
examples/INDEX.txt
Normal file
198
examples/INDEX.txt
Normal file
|
@ -0,0 +1,198 @@
|
||||||
|
Path Description X-Ref
|
||||||
|
./bashdb Deprecated sample implementation of a bash debugger
|
||||||
|
|
||||||
|
./complete Shell completion code
|
||||||
|
|
||||||
|
./functions Example functions
|
||||||
|
./functions/array-stuff Various array functions (ashift, array_sort, reverse).
|
||||||
|
./functions/array-to-string Convert an array to a string.
|
||||||
|
./functions/autoload An almost ksh-compatible 'autoload' (no lazy load). ksh
|
||||||
|
./functions/autoload.v2 An almost ksh-compatible 'autoload' (no lazy load). ksh
|
||||||
|
./functions/autoload.v3 A more ksh-compatible 'autoload' (with lazy load). ksh
|
||||||
|
./functions/basename A replacement for basename(1). basename
|
||||||
|
./functions/basename2 Fast basename(1) and dirname(1) functions for BASH/SH. basename, dirname
|
||||||
|
./functions/coproc.bash Start, control, and end coprocesses.
|
||||||
|
./functions/coshell.bash Control shell coprocesses (see coprocess.bash).
|
||||||
|
./functions/coshell.README README for coshell and coproc.
|
||||||
|
./functions/csh-compat A C-shell compatibility package. csh
|
||||||
|
./functions/dirfuncs Directory manipulation functions from the book 'The Korn Shell'.
|
||||||
|
./functions/dirname A replacement for dirname(1). dirname
|
||||||
|
./functions/emptydir Find out if a directory is empty.
|
||||||
|
./functions/exitstat Display the exit status of processes.
|
||||||
|
./functions/external Like 'command' but FORCES use of external command.
|
||||||
|
./functions/fact Recursive factorial function.
|
||||||
|
./functions/fstty Front end to sync TERM changes to both stty(1) and readline 'bind'. stty.bash
|
||||||
|
./functions/func Print out definitions for functions named by arguments.
|
||||||
|
./functions/gethtml Get a web page from a remote server (wget(1) in bash!).
|
||||||
|
./functions/getoptx.bash getopt function that parses long-named options.
|
||||||
|
./functions/inetaddr Internet address conversion (inet2hex & hex2inet).
|
||||||
|
./functions/inpath Return zero if the argument is in the path and executable. inpath
|
||||||
|
./functions/isnum.bash Test user input on numeric or character value.
|
||||||
|
./functions/isnum2 Test user input on numeric values, with floating point.
|
||||||
|
./functions/isvalidip Test user input for valid IP Addresses.
|
||||||
|
./functions/jdate.bash Julian date conversion.
|
||||||
|
./functions/jj.bash Look for running jobs.
|
||||||
|
./functions/keep Try to keep some programs in the forground and running.
|
||||||
|
./functions/ksh-cd ksh-like 'cd': cd [-LP] [dir [change]]. ksh
|
||||||
|
./functions/ksh-compat-test ksh-like arithmetic test replacements. ksh
|
||||||
|
./functions/kshenv Functions and aliases to provide the beginnings of a ksh environment for bash. ksh
|
||||||
|
./functions/login Replace the 'login' and 'newgrp' builtins in old Bourne shells.
|
||||||
|
./functions/lowercase Rename files to lower case. rename lower
|
||||||
|
./functions/manpage Find and print a manual page. fman
|
||||||
|
./functions/mhfold Print MH folders, useful only because folders(1) doesn't print mod date/times.
|
||||||
|
./functions/notify.bash Notify when jobs change status.
|
||||||
|
./functions/pathfuncs Path related functions (no_path, add_path, pre-path, del_path). path
|
||||||
|
./functions/README README
|
||||||
|
./functions/recurse Recursive directory traverser.
|
||||||
|
./functions/repeat2 A clone of C shell builtin 'repeat'. repeat, csh
|
||||||
|
./functions/repeat3 A clone of C shell builtin 'repeat'. repeat, csh
|
||||||
|
./functions/seq Generate a sequence from m to n, m defaults to 1.
|
||||||
|
./functions/seq2 Generate a sequence from m to n, m defaults to 1.
|
||||||
|
./functions/shcat Readline-based pager. cat, readline pager
|
||||||
|
./functions/shcat2 Readline-based pagers. cat, readline pager
|
||||||
|
./functions/sort-pos-params Sort the positional parameters.
|
||||||
|
./functions/substr A function to emulate the ancient ksh builtin. ksh
|
||||||
|
./functions/substr2 A function to emulate the ancient ksh builtin. ksh
|
||||||
|
./functions/term A shell function to set the terminal type interactively or not.
|
||||||
|
./functions/whatis An implementation of the 10th Edition Unix sh builtin 'whatis(1)' command.
|
||||||
|
./functions/whence An almost-ksh compatible 'whence(1)' command.
|
||||||
|
./functions/which An emulation of 'which(1)' as it appears in FreeBSD.
|
||||||
|
./functions/xalias.bash Convert csh alias commands to bash functions. csh, aliasconv
|
||||||
|
./functions/xfind.bash A 'find(1)' clone.
|
||||||
|
|
||||||
|
./loadables/ Example loadable replacements
|
||||||
|
./loadables/basename.c Return non-directory portion of pathname. basename
|
||||||
|
./loadables/cat.c cat(1) replacement with no options - the way cat was intended. cat, readline pager
|
||||||
|
./loadables/cut.c cut(1) replacement.
|
||||||
|
./loadables/dirname.c Return directory portion of pathname. dirname
|
||||||
|
./loadables/finfo.c Print file info.
|
||||||
|
./loadables/getconf.c POSIX.2 getconf utility.
|
||||||
|
./loadables/getconf.h Replacement definitions for ones the system doesn't provide.
|
||||||
|
./loadables/head.c Copy first part of files.
|
||||||
|
./loadables/hello.c Obligatory "Hello World" / sample loadable.
|
||||||
|
./loadables/id.c POSIX.2 user identity.
|
||||||
|
./loadables/ln.c Make links.
|
||||||
|
./loadables/logname.c Print login name of current user.
|
||||||
|
./loadables/Makefile.in Simple makefile for the sample loadable builtins.
|
||||||
|
./loadables/mkdir.c Make directories.
|
||||||
|
./loadables/necho.c echo without options or argument interpretation.
|
||||||
|
./loadables/pathchk.c Check pathnames for validity and portability.
|
||||||
|
./loadables/print.c Loadable ksh-93 style print builtin.
|
||||||
|
./loadables/printenv.c Minimal builtin clone of BSD printenv(1).
|
||||||
|
./loadables/push.c Anyone remember TOPS-20?
|
||||||
|
./loadables/README README
|
||||||
|
./loadables/realpath.c Canonicalize pathnames, resolving symlinks.
|
||||||
|
./loadables/rmdir.c Remove directory.
|
||||||
|
./loadables/sleep.c sleep for fractions of a second.
|
||||||
|
./loadables/strftime.c Loadable builtin interface to strftime(3).
|
||||||
|
./loadables/sync.c Sync the disks by forcing pending filesystem writes to complete.
|
||||||
|
./loadables/tee.c Duplicate standard input.
|
||||||
|
./loadables/template.c Example template for loadable builtin.
|
||||||
|
./loadables/truefalse.c True and false builtins.
|
||||||
|
./loadables/tty.c Return terminal name.
|
||||||
|
./loadables/uname.c Print system information.
|
||||||
|
./loadables/unlink.c Remove a directory entry.
|
||||||
|
./loadables/whoami.c Print out username of current user.
|
||||||
|
|
||||||
|
./loadables/perl/ Illustrate how to build a Perl interpreter into bash.
|
||||||
|
|
||||||
|
./misc Miscellaneous
|
||||||
|
./misc/aliasconv.bash Convert csh aliases to bash aliases and functions. csh, xalias
|
||||||
|
./misc/aliasconv.sh Convert csh aliases to bash aliases and functions. csh, xalias
|
||||||
|
./misc/cshtobash Convert csh aliases, environment variables, and variables to bash equivalents. csh, xalias
|
||||||
|
./misc/README README
|
||||||
|
./misc/suncmd.termcap SunView TERMCAP string.
|
||||||
|
|
||||||
|
./obashdb Modified version of the Korn Shell debugger from Bill Rosenblatt's 'Learning the Korn Shell'.
|
||||||
|
|
||||||
|
./scripts.noah Noah Friedman's collection of scripts (updated to bash v2 syntax by Chet Ramey)
|
||||||
|
./scripts.noah/aref.bash Pseudo-arrays and substring indexing examples.
|
||||||
|
./scripts.noah/bash.sub.bash Library functions used by require.bash.
|
||||||
|
./scripts.noah/bash_version.bash A function to slice up $BASH_VERSION.
|
||||||
|
./scripts.noah/meta.bash Enable and disable eight-bit readline input.
|
||||||
|
./scripts.noah/mktmp.bash Make a temporary file with a unique name.
|
||||||
|
./scripts.noah/number.bash A fun hack to translate numerals into English.
|
||||||
|
./scripts.noah/PERMISSION Permissions to use the scripts in this directory.
|
||||||
|
./scripts.noah/prompt.bash A way to set PS1 to some predefined strings.
|
||||||
|
./scripts.noah/README README
|
||||||
|
./scripts.noah/remap_keys.bash A front end to 'bind' to redo readline bindings.
|
||||||
|
./scripts.noah/require.bash Lisp-like require/provide library functions for bash.
|
||||||
|
./scripts.noah/send_mail.bash Replacement SMTP client written in bash.
|
||||||
|
./scripts.noah/shcat.bash Bash replacement for 'cat(1)'. cat
|
||||||
|
./scripts.noah/source.bash Replacement for source that uses current directory.
|
||||||
|
./scripts.noah/string.bash The string(3) functions at the shell level.
|
||||||
|
./scripts.noah/stty.bash Front-end to stty(1) that changes readline bindings too. fstty
|
||||||
|
./scripts.noah/y_or_n_p.bash Prompt for a yes/no/quit answer. ask
|
||||||
|
|
||||||
|
./scripts.v2 John DuBois' ksh script collection (converted to bash v2 syntax by Chet Ramey).
|
||||||
|
./scripts.v2/arc2tarz Convert an "arc" archive to a compressed tar archive.
|
||||||
|
./scripts.v2/bashrand Random number generator with upper and lower bounds and optional seed. random
|
||||||
|
./scripts.v2/cal2day.bash Convert a day number to a name.
|
||||||
|
./scripts.v2/cdhist.bash cd replacement with a directory stack added.
|
||||||
|
./scripts.v2/corename Tell what produced a core file.
|
||||||
|
./scripts.v2/fman Fast man(1) replacement. manpage
|
||||||
|
./scripts.v2/frcp Copy files using ftp(1) but with rcp-type command line syntax.
|
||||||
|
./scripts.v2/lowercase Change filenames to lower case. rename lower
|
||||||
|
./scripts.v2/ncp A nicer front end for cp(1) (has -i, etc.).
|
||||||
|
./scripts.v2/newext Change the extension of a group of files. rename
|
||||||
|
./scripts.v2/nmv A nicer front end for mv(1) (has -i, etc.). rename
|
||||||
|
./scripts.v2/pages Print specified pages from files.
|
||||||
|
./scripts.v2/PERMISSION Permissions to use the scripts in this directory.
|
||||||
|
./scripts.v2/pf A pager front end that handles compressed files.
|
||||||
|
./scripts.v2/pmtop Poor man's 'top(1)' for SunOS 4.x and BSD/OS.
|
||||||
|
./scripts.v2/README README
|
||||||
|
./scripts.v2/ren Rename files by changing parts of filenames that match a pattern. rename
|
||||||
|
./scripts.v2/rename Change the names of files that match a pattern. rename
|
||||||
|
./scripts.v2/repeat Execute a command multiple times. repeat
|
||||||
|
./scripts.v2/shprof Line profiler for bash scripts.
|
||||||
|
./scripts.v2/untar Unarchive a (possibly compressed) tarfile into a directory.
|
||||||
|
./scripts.v2/uudec Carefully uudecode(1) multiple files.
|
||||||
|
./scripts.v2/uuenc uuencode(1) multiple files.
|
||||||
|
./scripts.v2/vtree Print a visual display of a directory tree. tree
|
||||||
|
./scripts.v2/where Show where commands that match a pattern are.
|
||||||
|
|
||||||
|
./scripts Example scripts
|
||||||
|
./scripts/adventure.sh Text adventure game in bash!
|
||||||
|
./scripts/bcsh.sh Bourne shell cshell-emulator. csh
|
||||||
|
./scripts/cat.sh Readline-based pager. cat, readline pager
|
||||||
|
./scripts/center Center - center a group of lines.
|
||||||
|
./scripts/dd-ex.sh Line editor using only /bin/sh, /bin/dd and /bin/rm.
|
||||||
|
./scripts/fixfiles.bash Recurse a tree and fix files containing various "bad" chars.
|
||||||
|
./scripts/hanoi.bash The inevitable Towers of Hanoi in bash.
|
||||||
|
./scripts/inpath Search $PATH for a file the same name as $1; return TRUE if found. inpath
|
||||||
|
./scripts/krand.bash Produces a random number within integer limits. random
|
||||||
|
./scripts/line-input.bash Line input routine for GNU Bourne-Again Shell plus terminal-control primitives.
|
||||||
|
./scripts/nohup.bash bash version of 'nohup' command.
|
||||||
|
./scripts/precedence Test relative precedences for '&&' and '||' operators.
|
||||||
|
./scripts/randomcard.bash Print a random card from a card deck. random
|
||||||
|
./scripts/README README
|
||||||
|
./scripts/scrollbar Display scrolling text.
|
||||||
|
./scripts/scrollbar2 Display scrolling text.
|
||||||
|
./scripts/self-repro A self-reproducing script (careful!)
|
||||||
|
./scripts/showperm.bash Convert ls(1) symbolic permissions into octal mode.
|
||||||
|
./scripts/shprompt Display a prompt and get an answer satisfying certain criteria. ask
|
||||||
|
./scripts/spin.bash Display a 'spinning wheel' to show progress.
|
||||||
|
./scripts/timeout Give rsh(1) a shorter timeout.
|
||||||
|
./scripts/vtree2 Display a tree printout of dir in 1k blocks. tree
|
||||||
|
./scripts/vtree3 Display a graphical tree printout of dir. tree
|
||||||
|
./scripts/vtree3a Display a graphical tree printout of dir. tree
|
||||||
|
./scripts/websrv.sh A web server in bash!
|
||||||
|
./scripts/xterm_title Print the contents of the xterm title bar.
|
||||||
|
./scripts/zprintf Emulate printf (obsolete since it's now a bash builtin).
|
||||||
|
|
||||||
|
./startup-files Example Start-up files.
|
||||||
|
./startup-files/Bash_aliases Some useful aliases (Fox).
|
||||||
|
./startup-files/Bash_profile Sample startup file for bash login shells (Fox).
|
||||||
|
./startup-files/bash-profile Sample startup file for bash login shells (Ramey).
|
||||||
|
./startup-files/bashrc Sample Bourne Again SHell init file (Ramey).
|
||||||
|
./startup-files/Bashrc.bfox Sample Bourne Again SHell init file (Fox).
|
||||||
|
./startup-files/README README
|
||||||
|
|
||||||
|
./startup-files/apple Example Start-up files for Mac OS X.
|
||||||
|
./startup-files/apple/aliases Sample aliases for Mac OS X.
|
||||||
|
./startup-files/apple/bash.defaults Sample User preferences file.
|
||||||
|
./startup-files/apple/environment Sample Bourne Again Shell environment file.
|
||||||
|
./startup-files/apple/login Sample login wrapper.
|
||||||
|
./startup-files/apple/logout Sample logout wrapper.
|
||||||
|
./startup-files/apple/rc Sample Bourne Again Shell config file.
|
||||||
|
./startup-files/apple/README README
|
|
@ -31,3 +31,36 @@ Many of the details needed by builtin writers are found in hello.c,
|
||||||
the canonical example. There is no real `builtin writers' programming
|
the canonical example. There is no real `builtin writers' programming
|
||||||
guide'. The file template.c provides a template to use for creating
|
guide'. The file template.c provides a template to use for creating
|
||||||
new loadable builtins.
|
new loadable builtins.
|
||||||
|
|
||||||
|
basename.c Return non-directory portion of pathname.
|
||||||
|
cat.c cat(1) replacement with no options - the way cat was intended.
|
||||||
|
cut.c cut(1) replacement.
|
||||||
|
dirname.c Return directory portion of pathname.
|
||||||
|
finfo.c Print file info.
|
||||||
|
getconf.c POSIX.2 getconf utility.
|
||||||
|
getconf.h Replacement definitions for ones the system doesn't provide.
|
||||||
|
head.c Copy first part of files.
|
||||||
|
hello.c Obligatory "Hello World" / sample loadable.
|
||||||
|
id.c POSIX.2 user identity.
|
||||||
|
ln.c Make links.
|
||||||
|
logname.c Print login name of current user.
|
||||||
|
Makefile.in Simple makefile for the sample loadable builtins.
|
||||||
|
mkdir.c Make directories.
|
||||||
|
necho.c echo without options or argument interpretation.
|
||||||
|
pathchk.c Check pathnames for validity and portability.
|
||||||
|
print.c Loadable ksh-93 style print builtin.
|
||||||
|
printenv.c Minimal builtin clone of BSD printenv(1).
|
||||||
|
push.c Anyone remember TOPS-20?
|
||||||
|
README README
|
||||||
|
realpath.c Canonicalize pathnames, resolving symlinks.
|
||||||
|
rmdir.c Remove directory.
|
||||||
|
sleep.c sleep for fractions of a second.
|
||||||
|
strftime.c Loadable builtin interface to strftime(3).
|
||||||
|
sync.c Sync the disks by forcing pending filesystem writes to complete.
|
||||||
|
tee.c Duplicate standard input.
|
||||||
|
template.c Example template for loadable builtin.
|
||||||
|
truefalse.c True and false builtins.
|
||||||
|
tty.c Return terminal name.
|
||||||
|
uname.c Print system information.
|
||||||
|
unlink.c Remove a directory entry.
|
||||||
|
whoami.c Print out username of current user.
|
||||||
|
|
|
@ -7,18 +7,20 @@ any of them. They exist simply as examples of bash scripting.
|
||||||
|
|
||||||
Here's a description of what's in this directory:
|
Here's a description of what's in this directory:
|
||||||
|
|
||||||
aref.bash pseudo-arrays and substring indexing examples
|
aref.bash Pseudo-arrays and substring indexing examples.
|
||||||
bash.sub.bash library functions used by require.bash
|
bash.sub.bash Library functions used by require.bash.
|
||||||
bash_version.bash a function to slice up $BASH_VERSION
|
bash_version.bash A function to slice up $BASH_VERSION.
|
||||||
meta.bash enable and disable eight-bit readline input
|
meta.bash Enable and disable eight-bit readline input.
|
||||||
mktmp.bash make a temporary file with a unique name
|
mktmp.bash Make a temporary file with a unique name.
|
||||||
number.bash a fun hack to translate numerals into english
|
number.bash A fun hack to translate numerals into English.
|
||||||
prompt.bash a way to set PS1 to some predefined strings
|
PERMISSION Permissions to use the scripts in this directory.
|
||||||
remap_keys.bash a front end to `bind' to redo readline bindings
|
prompt.bash A way to set PS1 to some predefined strings.
|
||||||
require.bash lisp-like require/provide library functions for bash
|
README README
|
||||||
send_mail.bash replacement smtp client written in bash
|
remap_keys.bash A front end to 'bind' to redo readline bindings.
|
||||||
shcat.bash bash replacement for `cat'
|
require.bash Lisp-like require/provide library functions for bash.
|
||||||
source.bash replacement for source that uses current directory
|
send_mail.bash Replacement SMTP client written in bash.
|
||||||
string.bash the string(3) functions at the shell level
|
shcat.bash Bash replacement for 'cat(1)'.
|
||||||
stty.bash front-end to stty that changes readline bindings too
|
source.bash Replacement for source that uses current directory.
|
||||||
y_or_n_p.bash prompt for a yes/no/quit answer
|
string.bash The string(3) functions at the shell level.
|
||||||
|
stty.bash Front-end to stty(1) that changes readline bindings too.
|
||||||
|
y_or_n_p.bash Prompt for a yes/no/quit answer.
|
||||||
|
|
|
@ -7,27 +7,31 @@ any of them. They exist simply as examples of bash scripting.
|
||||||
|
|
||||||
Here's a description of what's in this directory:
|
Here's a description of what's in this directory:
|
||||||
|
|
||||||
arc2tarz Convert an "arc" archive to a compressed tar archive.
|
arc2tarz Convert an "arc" archive to a compressed tar archive.
|
||||||
corename Tell what produced a core file.
|
cal2day.bash Convert a day number to a name.
|
||||||
fman Fast man replacement.
|
corename Tell what produced a core file.
|
||||||
frcp Copy files using ftp but with rcp-type command line syntax.
|
fman Fast man(1) replacement.
|
||||||
lowercase Change filenames to lower case.
|
frcp Copy files using ftp(1) but with rcp-type command line syntax.
|
||||||
ncp A nicer front end for cp (has -i, etc.).
|
lowercase Change filenames to lower case.
|
||||||
newext Change the extension of a group of files.
|
ncp A nicer front end for cp(1) (has -i, etc.).
|
||||||
nmv A nicer front end for mv (has -i, etc.).
|
newext Change the extension of a group of files.
|
||||||
pages Print specified pages from files.
|
nmv A nicer front end for mv(1) (has -i, etc.).
|
||||||
pf A pager front end that handles compressed files.
|
pages Print specified pages from files.
|
||||||
rename Change the names of files that match a pattern.
|
PERMISSION Permissions to use the scripts in this directory.
|
||||||
repeat Execute a command multiple times.
|
pf A pager front end that handles compressed files.
|
||||||
untar Unarchive a (possibly compressed) tarfile into a directory.
|
README README
|
||||||
uudec Carefully uudecode multiple files.
|
ren Rename files by changing parts of filenames that match a pattern.
|
||||||
uuenc uuencode multiple files.
|
rename Change the names of files that match a pattern.
|
||||||
vtree Print a visual display of a directory tree.
|
repeat Execute a command multiple times.
|
||||||
where Show where commands that match a pattern are.
|
untar Unarchive a (possibly compressed) tarfile into a directory.
|
||||||
|
uudec Carefully uudecode(1) multiple files.
|
||||||
|
uuenc uuencode(1) multiple files.
|
||||||
|
vtree Print a visual display of a directory tree.
|
||||||
|
where Show where commands that match a pattern are.
|
||||||
|
|
||||||
The following scripts were written or converted by Chet Ramey:
|
The following scripts were written or converted by Chet Ramey:
|
||||||
|
|
||||||
bashrand Random number generator with upper and lower bounds and optional seed
|
bashrand Random number generator with upper and lower bounds and optional seed.
|
||||||
cdhist cd replacement with a directory stack added
|
cdhist.bash cd replacement with a directory stack added.
|
||||||
pmtop Poor man's `top' for SunOS 4.x and BSD/OS
|
pmtop Poor man's 'top(1)' for SunOS 4.x and BSD/OS.
|
||||||
shprof Line profiler for bash scripts
|
shprof Line profiler for bash scripts.
|
||||||
|
|
|
@ -3,3 +3,19 @@ are originally from Brian Fox. The ones starting with lowercase
|
||||||
letters are from Chet Ramey.
|
letters are from Chet Ramey.
|
||||||
|
|
||||||
They will require changes for your environment.
|
They will require changes for your environment.
|
||||||
|
|
||||||
|
Bash_aliases Some useful aliases (Fox).
|
||||||
|
Bash_profile Sample startup file for bash login shells (Fox).
|
||||||
|
bash-profile Sample startup file for bash login shells (Ramey).
|
||||||
|
bashrc Sample Bourne Again SHell init file (Ramey).
|
||||||
|
Bashrc.bfox Sample Bourne Again SHell init file (Fox).
|
||||||
|
README README
|
||||||
|
|
||||||
|
apple Example Start-up files for Mac OS X.
|
||||||
|
apple/aliases Sample aliases for Mac OS X.
|
||||||
|
apple/bash.defaults Sample User preferences file.
|
||||||
|
apple/environment Sample Bourne Again Shell environment file.
|
||||||
|
apple/login Sample login wrapper.
|
||||||
|
apple/logout Sample logout wrapper.
|
||||||
|
apple/rc Sample Bourne Again Shell config file.
|
||||||
|
apple/README README
|
||||||
|
|
|
@ -22,3 +22,12 @@ See the corresponding file in /usr/share/init/bash for more information about th
|
||||||
|
|
||||||
-Fred
|
-Fred
|
||||||
tritan@mit.edu
|
tritan@mit.edu
|
||||||
|
|
||||||
|
|
||||||
|
aliases Sample aliases for Mac OS X.
|
||||||
|
bash.defaults Sample User preferences file.
|
||||||
|
environment Sample Bourne Again Shell environment file.
|
||||||
|
login Sample login wrapper.
|
||||||
|
logout Sample logout wrapper.
|
||||||
|
rc Sample Bourne Again Shell config file.
|
||||||
|
README README
|
||||||
|
|
104
execute_cmd.c
104
execute_cmd.c
|
@ -1,4 +1,4 @@
|
||||||
/* execute_command.c -- Execute a COMMAND structure. */
|
/* execute_cmd.c -- Execute a COMMAND structure. */
|
||||||
|
|
||||||
/* Copyright (C) 1987-2005 Free Software Foundation, Inc.
|
/* Copyright (C) 1987-2005 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
@ -214,6 +214,8 @@ static int special_builtin_failed;
|
||||||
report the correct line number. Kind of a hack. */
|
report the correct line number. Kind of a hack. */
|
||||||
static int showing_function_line;
|
static int showing_function_line;
|
||||||
|
|
||||||
|
static int line_number_for_err_trap;
|
||||||
|
|
||||||
/* For catching RETURN in a function. */
|
/* For catching RETURN in a function. */
|
||||||
int return_catch_flag;
|
int return_catch_flag;
|
||||||
int return_catch_value;
|
int return_catch_value;
|
||||||
|
@ -359,6 +361,7 @@ execute_command (command)
|
||||||
unlink_fifo_list ();
|
unlink_fifo_list ();
|
||||||
#endif /* PROCESS_SUBSTITUTION */
|
#endif /* PROCESS_SUBSTITUTION */
|
||||||
|
|
||||||
|
QUIT;
|
||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -501,6 +504,7 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
|
||||||
if (command == 0 || breaking || continuing || read_but_dont_execute)
|
if (command == 0 || breaking || continuing || read_but_dont_execute)
|
||||||
return (EXECUTION_SUCCESS);
|
return (EXECUTION_SUCCESS);
|
||||||
|
|
||||||
|
QUIT;
|
||||||
run_pending_traps ();
|
run_pending_traps ();
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -663,7 +667,7 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
|
||||||
if (command->flags & CMD_STDIN_REDIR)
|
if (command->flags & CMD_STDIN_REDIR)
|
||||||
command->value.Simple->flags |= CMD_STDIN_REDIR;
|
command->value.Simple->flags |= CMD_STDIN_REDIR;
|
||||||
|
|
||||||
line_number = command->value.Simple->line;
|
line_number_for_err_trap = line_number = command->value.Simple->line;
|
||||||
exec_result =
|
exec_result =
|
||||||
execute_simple_command (command->value.Simple, pipe_in, pipe_out,
|
execute_simple_command (command->value.Simple, pipe_in, pipe_out,
|
||||||
asynchronous, fds_to_close);
|
asynchronous, fds_to_close);
|
||||||
|
@ -865,6 +869,24 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
|
||||||
? EXECUTION_FAILURE
|
? EXECUTION_FAILURE
|
||||||
: EXECUTION_SUCCESS;
|
: EXECUTION_SUCCESS;
|
||||||
|
|
||||||
|
#if defined (DPAREN_ARITHMETIC) || defined (COND_COMMAND)
|
||||||
|
/* This is where we set PIPESTATUS from the exit status of the appropriate
|
||||||
|
compound commands (the ones that look enough like simple commands to
|
||||||
|
cause confusion). We might be able to optimize by not doing this if
|
||||||
|
subshell_environment != 0. */
|
||||||
|
switch (command->type)
|
||||||
|
{
|
||||||
|
# if defined (DPAREN_ARITHMETIC)
|
||||||
|
case cm_arith:
|
||||||
|
# endif
|
||||||
|
# if defined (COND_COMMAND)
|
||||||
|
case cm_cond:
|
||||||
|
# endif
|
||||||
|
set_pipestatus_from_exit (exec_result);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
last_command_exit_value = exec_result;
|
last_command_exit_value = exec_result;
|
||||||
run_pending_traps ();
|
run_pending_traps ();
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -1187,6 +1209,10 @@ execute_in_subshell (command, asynchronous, pipe_in, pipe_out, fds_to_close)
|
||||||
the special case of an asynchronous GROUP command where the
|
the special case of an asynchronous GROUP command where the
|
||||||
the subshell bit is turned on down in case cm_group: below),
|
the subshell bit is turned on down in case cm_group: below),
|
||||||
turn off `asynchronous', so that two subshells aren't spawned.
|
turn off `asynchronous', so that two subshells aren't spawned.
|
||||||
|
XXX - asynchronous used to be set to 0 in this block, but that
|
||||||
|
means that setup_async_signals was never run. Now it's set to
|
||||||
|
0 after subshell_environment is set appropriately and setup_async_signals
|
||||||
|
is run.
|
||||||
|
|
||||||
This seems semantically correct to me. For example,
|
This seems semantically correct to me. For example,
|
||||||
( foo ) & seems to say ``do the command `foo' in a subshell
|
( foo ) & seems to say ``do the command `foo' in a subshell
|
||||||
|
@ -1214,19 +1240,35 @@ execute_in_subshell (command, asynchronous, pipe_in, pipe_out, fds_to_close)
|
||||||
aliases. */
|
aliases. */
|
||||||
if (ois != interactive_shell)
|
if (ois != interactive_shell)
|
||||||
expand_aliases = 0;
|
expand_aliases = 0;
|
||||||
asynchronous = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Subshells are neither login nor interactive. */
|
/* Subshells are neither login nor interactive. */
|
||||||
login_shell = interactive = 0;
|
login_shell = interactive = 0;
|
||||||
|
|
||||||
subshell_environment = user_subshell ? SUBSHELL_PAREN : SUBSHELL_ASYNC;
|
if (user_subshell)
|
||||||
|
subshell_environment = SUBSHELL_PAREN;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
subshell_environment = 0; /* XXX */
|
||||||
|
if (asynchronous)
|
||||||
|
subshell_environment |= SUBSHELL_ASYNC;
|
||||||
|
if (pipe_in != NO_PIPE || pipe_out != NO_PIPE)
|
||||||
|
subshell_environment |= SUBSHELL_PIPE;
|
||||||
|
}
|
||||||
|
|
||||||
reset_terminating_signals (); /* in sig.c */
|
reset_terminating_signals (); /* in sig.c */
|
||||||
/* Cancel traps, in trap.c. */
|
/* Cancel traps, in trap.c. */
|
||||||
restore_original_signals ();
|
restore_original_signals ();
|
||||||
|
|
||||||
|
/* Make sure restore_original_signals doesn't undo the work done by
|
||||||
|
make_child to ensure that asynchronous children are immune to SIGINT
|
||||||
|
and SIGQUIT. Turn off asynchronous to make sure more subshells are
|
||||||
|
not spawned. */
|
||||||
if (asynchronous)
|
if (asynchronous)
|
||||||
setup_async_signals ();
|
{
|
||||||
|
setup_async_signals ();
|
||||||
|
asynchronous = 0;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined (JOB_CONTROL)
|
#if defined (JOB_CONTROL)
|
||||||
set_sigchld_handler ();
|
set_sigchld_handler ();
|
||||||
|
@ -1308,8 +1350,7 @@ execute_in_subshell (command, asynchronous, pipe_in, pipe_out, fds_to_close)
|
||||||
if (function_value)
|
if (function_value)
|
||||||
return_code = return_catch_value;
|
return_code = return_catch_value;
|
||||||
else
|
else
|
||||||
return_code = execute_command_internal
|
return_code = execute_command_internal (tcom, asynchronous, NO_PIPE, NO_PIPE, fds_to_close);
|
||||||
(tcom, asynchronous, NO_PIPE, NO_PIPE, fds_to_close);
|
|
||||||
|
|
||||||
/* If we are asked to, invert the return value. */
|
/* If we are asked to, invert the return value. */
|
||||||
if (invert)
|
if (invert)
|
||||||
|
@ -1629,7 +1670,11 @@ execute_for_command (for_command)
|
||||||
|
|
||||||
/* Save this command unless it's a trap command and we're not running
|
/* Save this command unless it's a trap command and we're not running
|
||||||
a debug trap. */
|
a debug trap. */
|
||||||
|
#if 0
|
||||||
if (signal_in_progress (DEBUG_TRAP) == 0 && (this_command_name == 0 || (STREQ (this_command_name, "trap") == 0)))
|
if (signal_in_progress (DEBUG_TRAP) == 0 && (this_command_name == 0 || (STREQ (this_command_name, "trap") == 0)))
|
||||||
|
#else
|
||||||
|
if (signal_in_progress (DEBUG_TRAP) == 0 && running_trap == 0)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
FREE (the_printed_command_except_trap);
|
FREE (the_printed_command_except_trap);
|
||||||
the_printed_command_except_trap = savestring (the_printed_command);
|
the_printed_command_except_trap = savestring (the_printed_command);
|
||||||
|
@ -2048,7 +2093,11 @@ execute_select_command (select_command)
|
||||||
if (echo_command_at_execute)
|
if (echo_command_at_execute)
|
||||||
xtrace_print_select_command_head (select_command);
|
xtrace_print_select_command_head (select_command);
|
||||||
|
|
||||||
|
#if 0
|
||||||
if (signal_in_progress (DEBUG_TRAP) == 0 && (this_command_name == 0 || (STREQ (this_command_name, "trap") == 0)))
|
if (signal_in_progress (DEBUG_TRAP) == 0 && (this_command_name == 0 || (STREQ (this_command_name, "trap") == 0)))
|
||||||
|
#else
|
||||||
|
if (signal_in_progress (DEBUG_TRAP) == 0 && running_trap == 0)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
FREE (the_printed_command_except_trap);
|
FREE (the_printed_command_except_trap);
|
||||||
the_printed_command_except_trap = savestring (the_printed_command);
|
the_printed_command_except_trap = savestring (the_printed_command);
|
||||||
|
@ -2180,7 +2229,11 @@ execute_case_command (case_command)
|
||||||
if (echo_command_at_execute)
|
if (echo_command_at_execute)
|
||||||
xtrace_print_case_command_head (case_command);
|
xtrace_print_case_command_head (case_command);
|
||||||
|
|
||||||
if (signal_in_progress (DEBUG_TRAP == 0) && (this_command_name == 0 || (STREQ (this_command_name, "trap") == 0)))
|
#if 0
|
||||||
|
if (signal_in_progress (DEBUG_TRAP) == 0 && (this_command_name == 0 || (STREQ (this_command_name, "trap") == 0)))
|
||||||
|
#else
|
||||||
|
if (signal_in_progress (DEBUG_TRAP) == 0 && running_trap == 0)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
FREE (the_printed_command_except_trap);
|
FREE (the_printed_command_except_trap);
|
||||||
the_printed_command_except_trap = savestring (the_printed_command);
|
the_printed_command_except_trap = savestring (the_printed_command);
|
||||||
|
@ -2378,6 +2431,7 @@ execute_arith_command (arith_command)
|
||||||
int expok, save_line_number, retval;
|
int expok, save_line_number, retval;
|
||||||
intmax_t expresult;
|
intmax_t expresult;
|
||||||
WORD_LIST *new;
|
WORD_LIST *new;
|
||||||
|
char *exp;
|
||||||
|
|
||||||
expresult = 0;
|
expresult = 0;
|
||||||
|
|
||||||
|
@ -2420,8 +2474,11 @@ execute_arith_command (arith_command)
|
||||||
|
|
||||||
if (new)
|
if (new)
|
||||||
{
|
{
|
||||||
expresult = evalexp (new->word->word, &expok);
|
exp = new->next ? string_list (new) : new->word->word;
|
||||||
|
expresult = evalexp (exp, &expok);
|
||||||
line_number = save_line_number;
|
line_number = save_line_number;
|
||||||
|
if (exp != new->word->word)
|
||||||
|
free (exp);
|
||||||
dispose_words (new);
|
dispose_words (new);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2477,6 +2534,7 @@ execute_cond_node (cond)
|
||||||
}
|
}
|
||||||
else if (cond->type == COND_BINARY)
|
else if (cond->type == COND_BINARY)
|
||||||
{
|
{
|
||||||
|
rmatch = 0;
|
||||||
patmatch = ((cond->op->word[1] == '=') && (cond->op->word[2] == '\0') &&
|
patmatch = ((cond->op->word[1] == '=') && (cond->op->word[2] == '\0') &&
|
||||||
(cond->op->word[0] == '!' || cond->op->word[0] == '=') ||
|
(cond->op->word[0] == '!' || cond->op->word[0] == '=') ||
|
||||||
(cond->op->word[0] == '=' && cond->op->word[1] == '\0'));
|
(cond->op->word[0] == '=' && cond->op->word[1] == '\0'));
|
||||||
|
@ -2488,7 +2546,7 @@ execute_cond_node (cond)
|
||||||
arg1 = cond_expand_word (cond->left->op, 0);
|
arg1 = cond_expand_word (cond->left->op, 0);
|
||||||
if (arg1 == 0)
|
if (arg1 == 0)
|
||||||
arg1 = nullstr;
|
arg1 = nullstr;
|
||||||
arg2 = cond_expand_word (cond->right->op, patmatch);
|
arg2 = cond_expand_word (cond->right->op, patmatch||rmatch);
|
||||||
if (arg2 == 0)
|
if (arg2 == 0)
|
||||||
arg2 = nullstr;
|
arg2 = nullstr;
|
||||||
|
|
||||||
|
@ -2614,7 +2672,10 @@ execute_null_command (redirects, pipe_in, pipe_out, async)
|
||||||
|
|
||||||
do_piping (pipe_in, pipe_out);
|
do_piping (pipe_in, pipe_out);
|
||||||
|
|
||||||
subshell_environment = SUBSHELL_ASYNC;
|
if (async)
|
||||||
|
subshell_environment |= SUBSHELL_ASYNC;
|
||||||
|
if (pipe_in != NO_PIPE || pipe_out != NO_PIPE)
|
||||||
|
subshell_environment |= SUBSHELL_PIPE;
|
||||||
|
|
||||||
if (do_redirections (redirects, RX_ACTIVE) == 0)
|
if (do_redirections (redirects, RX_ACTIVE) == 0)
|
||||||
exit (EXECUTION_SUCCESS);
|
exit (EXECUTION_SUCCESS);
|
||||||
|
@ -2709,7 +2770,11 @@ execute_simple_command (simple_command, pipe_in, pipe_out, async, fds_to_close)
|
||||||
command_string_index = 0;
|
command_string_index = 0;
|
||||||
print_simple_command (simple_command);
|
print_simple_command (simple_command);
|
||||||
|
|
||||||
|
#if 0
|
||||||
if (signal_in_progress (DEBUG_TRAP) == 0 && (this_command_name == 0 || (STREQ (this_command_name, "trap") == 0)))
|
if (signal_in_progress (DEBUG_TRAP) == 0 && (this_command_name == 0 || (STREQ (this_command_name, "trap") == 0)))
|
||||||
|
#else
|
||||||
|
if (signal_in_progress (DEBUG_TRAP) == 0 && running_trap == 0)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
FREE (the_printed_command_except_trap);
|
FREE (the_printed_command_except_trap);
|
||||||
the_printed_command_except_trap = the_printed_command ? savestring (the_printed_command) : (char *)0;
|
the_printed_command_except_trap = the_printed_command ? savestring (the_printed_command) : (char *)0;
|
||||||
|
@ -2983,7 +3048,7 @@ execute_simple_command (simple_command, pipe_in, pipe_out, async, fds_to_close)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (command_line == 0)
|
if (command_line == 0)
|
||||||
command_line = savestring (the_printed_command);
|
command_line = savestring (the_printed_command_except_trap);
|
||||||
|
|
||||||
execute_disk_command (words, simple_command->redirects, command_line,
|
execute_disk_command (words, simple_command->redirects, command_line,
|
||||||
pipe_in, pipe_out, async, fds_to_close,
|
pipe_in, pipe_out, async, fds_to_close,
|
||||||
|
@ -3342,7 +3407,7 @@ execute_subshell_builtin_or_function (words, redirects, builtin, var,
|
||||||
struct fd_bitmap *fds_to_close;
|
struct fd_bitmap *fds_to_close;
|
||||||
int flags;
|
int flags;
|
||||||
{
|
{
|
||||||
int result, r;
|
int result, r, funcvalue;
|
||||||
#if defined (JOB_CONTROL)
|
#if defined (JOB_CONTROL)
|
||||||
int jobs_hack;
|
int jobs_hack;
|
||||||
|
|
||||||
|
@ -3353,7 +3418,10 @@ execute_subshell_builtin_or_function (words, redirects, builtin, var,
|
||||||
/* A subshell is neither a login shell nor interactive. */
|
/* A subshell is neither a login shell nor interactive. */
|
||||||
login_shell = interactive = 0;
|
login_shell = interactive = 0;
|
||||||
|
|
||||||
subshell_environment = SUBSHELL_ASYNC;
|
if (async)
|
||||||
|
subshell_environment |= SUBSHELL_ASYNC;
|
||||||
|
if (pipe_in != NO_PIPE || pipe_out != NO_PIPE)
|
||||||
|
subshell_environment |= SUBSHELL_PIPE;
|
||||||
|
|
||||||
maybe_make_export_env (); /* XXX - is this needed? */
|
maybe_make_export_env (); /* XXX - is this needed? */
|
||||||
|
|
||||||
|
@ -3387,10 +3455,18 @@ execute_subshell_builtin_or_function (words, redirects, builtin, var,
|
||||||
so we don't go back up to main(). */
|
so we don't go back up to main(). */
|
||||||
result = setjmp (top_level);
|
result = setjmp (top_level);
|
||||||
|
|
||||||
|
/* Give the return builtin a place to jump to when executed in a subshell
|
||||||
|
or pipeline */
|
||||||
|
funcvalue = 0;
|
||||||
|
if (return_catch_flag && builtin == return_builtin)
|
||||||
|
funcvalue = setjmp (return_catch);
|
||||||
|
|
||||||
if (result == EXITPROG)
|
if (result == EXITPROG)
|
||||||
exit (last_command_exit_value);
|
exit (last_command_exit_value);
|
||||||
else if (result)
|
else if (result)
|
||||||
exit (EXECUTION_FAILURE);
|
exit (EXECUTION_FAILURE);
|
||||||
|
else if (funcvalue)
|
||||||
|
exit (return_catch_value);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
r = execute_builtin (builtin, words, flags, 1);
|
r = execute_builtin (builtin, words, flags, 1);
|
||||||
|
|
73
expr.c
73
expr.c
|
@ -148,6 +148,7 @@ static intmax_t tokval; /* current token value */
|
||||||
static int noeval; /* set to 1 if no assignment to be done */
|
static int noeval; /* set to 1 if no assignment to be done */
|
||||||
static procenv_t evalbuf;
|
static procenv_t evalbuf;
|
||||||
|
|
||||||
|
static int _is_arithop __P((int));
|
||||||
static void readtok __P((void)); /* lexical analyzer */
|
static void readtok __P((void)); /* lexical analyzer */
|
||||||
|
|
||||||
static intmax_t expr_streval __P((char *, int));
|
static intmax_t expr_streval __P((char *, int));
|
||||||
|
@ -949,6 +950,64 @@ expr_streval (tok, e)
|
||||||
return (tval);
|
return (tval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
_is_multiop (c)
|
||||||
|
int c;
|
||||||
|
{
|
||||||
|
switch (c)
|
||||||
|
{
|
||||||
|
case EQEQ:
|
||||||
|
case NEQ:
|
||||||
|
case LEQ:
|
||||||
|
case GEQ:
|
||||||
|
case LAND:
|
||||||
|
case LOR:
|
||||||
|
case LSH:
|
||||||
|
case RSH:
|
||||||
|
case OP_ASSIGN:
|
||||||
|
case COND:
|
||||||
|
case POWER:
|
||||||
|
case PREINC:
|
||||||
|
case PREDEC:
|
||||||
|
case POSTINC:
|
||||||
|
case POSTDEC:
|
||||||
|
return 1;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
_is_arithop (c)
|
||||||
|
int c;
|
||||||
|
{
|
||||||
|
switch (c)
|
||||||
|
{
|
||||||
|
case EQ:
|
||||||
|
case GT:
|
||||||
|
case LT:
|
||||||
|
case PLUS:
|
||||||
|
case MINUS:
|
||||||
|
case MUL:
|
||||||
|
case DIV:
|
||||||
|
case MOD:
|
||||||
|
case NOT:
|
||||||
|
case LPAR:
|
||||||
|
case RPAR:
|
||||||
|
case BAND:
|
||||||
|
case BOR:
|
||||||
|
case BXOR:
|
||||||
|
case BNOT:
|
||||||
|
return 1; /* operator tokens */
|
||||||
|
case QUES:
|
||||||
|
case COL:
|
||||||
|
case COMMA:
|
||||||
|
return 1; /* questionable */
|
||||||
|
default:
|
||||||
|
return 0; /* anything else is invalid */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Lexical analyzer/token reader for the expression evaluator. Reads the
|
/* Lexical analyzer/token reader for the expression evaluator. Reads the
|
||||||
next token and puts its value into curtok, while advancing past it.
|
next token and puts its value into curtok, while advancing past it.
|
||||||
Updates value of tp. May also set tokval (for number) or tokstr (for
|
Updates value of tp. May also set tokval (for number) or tokstr (for
|
||||||
|
@ -1104,8 +1163,22 @@ readtok ()
|
||||||
assigntok = c; /* a OP= b */
|
assigntok = c; /* a OP= b */
|
||||||
c = OP_ASSIGN;
|
c = OP_ASSIGN;
|
||||||
}
|
}
|
||||||
|
else if (_is_arithop (c) == 0)
|
||||||
|
{
|
||||||
|
cp--;
|
||||||
|
/* use curtok, since it hasn't been copied to lasttok yet */
|
||||||
|
if (curtok == 0 || _is_arithop (curtok) || _is_multiop (curtok))
|
||||||
|
evalerror (_("syntax error: operand expected"));
|
||||||
|
else
|
||||||
|
evalerror (_("syntax error: invalid arithmetic operator"));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
cp--; /* `unget' the character */
|
cp--; /* `unget' the character */
|
||||||
|
|
||||||
|
/* Should check here to make sure that the current character is one
|
||||||
|
of the recognized operators and flag an error if not. Could create
|
||||||
|
a character map the first time through and check it on subsequent
|
||||||
|
calls. */
|
||||||
lasttok = curtok;
|
lasttok = curtok;
|
||||||
curtok = c;
|
curtok = c;
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,6 +112,7 @@ extern void set_default_locale __P((void));
|
||||||
extern void set_default_locale_vars __P((void));
|
extern void set_default_locale_vars __P((void));
|
||||||
extern int set_locale_var __P((char *, char *));
|
extern int set_locale_var __P((char *, char *));
|
||||||
extern int set_lang __P((char *, char *));
|
extern int set_lang __P((char *, char *));
|
||||||
|
extern void set_default_lang __P((void));
|
||||||
extern char *get_locale_var __P((char *));
|
extern char *get_locale_var __P((char *));
|
||||||
extern char *localetrans __P((char *, int, int *));
|
extern char *localetrans __P((char *, int, int *));
|
||||||
extern char *mk_msgstr __P((char *, int *));
|
extern char *mk_msgstr __P((char *, int *));
|
||||||
|
@ -225,6 +226,9 @@ extern char *sh_realpath __P((const char *, char *));
|
||||||
extern int sh_setlinebuf __P((FILE *));
|
extern int sh_setlinebuf __P((FILE *));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* declarations for functions defined in lib/sh/shaccess.c */
|
||||||
|
extern int sh_eaccess __P((char *, int));
|
||||||
|
|
||||||
/* declarations for functions defined in lib/sh/shmatch.c */
|
/* declarations for functions defined in lib/sh/shmatch.c */
|
||||||
extern int sh_regmatch __P((const char *, const char *, int));
|
extern int sh_regmatch __P((const char *, const char *, int));
|
||||||
|
|
||||||
|
@ -251,7 +255,7 @@ extern int strcasecmp __P((const char *, const char *));
|
||||||
#endif /* HAVE_STRCASECMP */
|
#endif /* HAVE_STRCASECMP */
|
||||||
|
|
||||||
/* declarations for functions defined in lib/sh/strerror.c */
|
/* declarations for functions defined in lib/sh/strerror.c */
|
||||||
#if !defined (strerror)
|
#if !defined (HAVE_STRERROR) && !defined (strerror)
|
||||||
extern char *strerror __P((int));
|
extern char *strerror __P((int));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,6 @@ extern int errno;
|
||||||
#endif /* !errno */
|
#endif /* !errno */
|
||||||
|
|
||||||
extern int expand_aliases;
|
extern int expand_aliases;
|
||||||
extern int interrupt_immediately;
|
|
||||||
extern int interactive_comments;
|
extern int interactive_comments;
|
||||||
extern int check_hashed_filenames;
|
extern int check_hashed_filenames;
|
||||||
extern int source_uses_path;
|
extern int source_uses_path;
|
||||||
|
@ -477,8 +476,13 @@ check_binary_file (sample, sample_len)
|
||||||
if (c == '\n')
|
if (c == '\n')
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
|
#if 0
|
||||||
if (ISSPACE (c) == 0 && ISPRINT (c) == 0)
|
if (ISSPACE (c) == 0 && ISPRINT (c) == 0)
|
||||||
|
#else
|
||||||
|
if (c == '\0')
|
||||||
|
#endif
|
||||||
return (1);
|
return (1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
|
@ -503,7 +507,7 @@ int
|
||||||
file_iswdir (fn)
|
file_iswdir (fn)
|
||||||
char *fn;
|
char *fn;
|
||||||
{
|
{
|
||||||
return (file_isdir (fn) && test_eaccess (fn, W_OK) == 0);
|
return (file_isdir (fn) && sh_eaccess (fn, W_OK) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return 1 if STRING contains an absolute pathname, else 0. Used by `cd'
|
/* Return 1 if STRING contains an absolute pathname, else 0. Used by `cd'
|
||||||
|
|
9
input.c
9
input.c
|
@ -41,11 +41,14 @@
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "externs.h"
|
#include "externs.h"
|
||||||
|
#include "quit.h"
|
||||||
|
|
||||||
#if !defined (errno)
|
#if !defined (errno)
|
||||||
extern int errno;
|
extern int errno;
|
||||||
#endif /* !errno */
|
#endif /* !errno */
|
||||||
|
|
||||||
|
extern void termsig_handler __P((int));
|
||||||
|
|
||||||
/* Functions to handle reading input on systems that don't restart read(2)
|
/* Functions to handle reading input on systems that don't restart read(2)
|
||||||
if a signal is received. */
|
if a signal is received. */
|
||||||
|
|
||||||
|
@ -61,11 +64,14 @@ getc_with_restart (stream)
|
||||||
{
|
{
|
||||||
unsigned char uc;
|
unsigned char uc;
|
||||||
|
|
||||||
|
CHECK_TERMSIG;
|
||||||
|
|
||||||
/* Try local buffering to reduce the number of read(2) calls. */
|
/* Try local buffering to reduce the number of read(2) calls. */
|
||||||
if (local_index == local_bufused || local_bufused == 0)
|
if (local_index == local_bufused || local_bufused == 0)
|
||||||
{
|
{
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
CHECK_TERMSIG;
|
||||||
local_bufused = read (fileno (stream), localbuf, sizeof(localbuf));
|
local_bufused = read (fileno (stream), localbuf, sizeof(localbuf));
|
||||||
if (local_bufused > 0)
|
if (local_bufused > 0)
|
||||||
break;
|
break;
|
||||||
|
@ -446,6 +452,7 @@ b_fill_buffer (bp)
|
||||||
{
|
{
|
||||||
ssize_t nr;
|
ssize_t nr;
|
||||||
|
|
||||||
|
CHECK_TERMSIG;
|
||||||
nr = zread (bp->b_fd, bp->b_buffer, bp->b_size);
|
nr = zread (bp->b_fd, bp->b_buffer, bp->b_size);
|
||||||
if (nr <= 0)
|
if (nr <= 0)
|
||||||
{
|
{
|
||||||
|
@ -513,6 +520,8 @@ sync_buffered_stream (bfd)
|
||||||
int
|
int
|
||||||
buffered_getchar ()
|
buffered_getchar ()
|
||||||
{
|
{
|
||||||
|
CHECK_TERMSIG;
|
||||||
|
|
||||||
#if !defined (DJGPP)
|
#if !defined (DJGPP)
|
||||||
return (bufstream_getc (buffers[bash_input.location.buffered_fd]));
|
return (bufstream_getc (buffers[bash_input.location.buffered_fd]));
|
||||||
#else
|
#else
|
||||||
|
|
2
input.h
2
input.h
|
@ -100,7 +100,7 @@ extern int stream_on_stack __P((enum stream_type));
|
||||||
extern char *read_secondary_line __P((int));
|
extern char *read_secondary_line __P((int));
|
||||||
extern int find_reserved_word __P((char *));
|
extern int find_reserved_word __P((char *));
|
||||||
extern void gather_here_documents __P((void));
|
extern void gather_here_documents __P((void));
|
||||||
extern void execute_prompt_command __P((char *));
|
extern void execute_variable_command __P((char *, char *));
|
||||||
|
|
||||||
extern int *save_token_state __P((void));
|
extern int *save_token_state __P((void));
|
||||||
extern void restore_token_state __P((int *));
|
extern void restore_token_state __P((int *));
|
||||||
|
|
190
jobs.c
190
jobs.c
|
@ -3,7 +3,7 @@
|
||||||
/* This file works with both POSIX and BSD systems. It implements job
|
/* This file works with both POSIX and BSD systems. It implements job
|
||||||
control. */
|
control. */
|
||||||
|
|
||||||
/* Copyright (C) 1989-2005 Free Software Foundation, Inc.
|
/* Copyright (C) 1989-2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GNU Bash, the Bourne Again SHell.
|
This file is part of GNU Bash, the Bourne Again SHell.
|
||||||
|
|
||||||
|
@ -77,7 +77,15 @@ extern int errno;
|
||||||
#endif /* !errno */
|
#endif /* !errno */
|
||||||
|
|
||||||
#define DEFAULT_CHILD_MAX 32
|
#define DEFAULT_CHILD_MAX 32
|
||||||
#define MAX_JOBS_IN_ARRAY 4096 /* testing */
|
#if !defined (DEBUG)
|
||||||
|
#define MAX_JOBS_IN_ARRAY 4096 /* production */
|
||||||
|
#else
|
||||||
|
#define MAX_JOBS_IN_ARRAY 128 /* testing */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Flag values for second argument to delete_job */
|
||||||
|
#define DEL_WARNSTOPPED 1 /* warn about deleting stopped jobs */
|
||||||
|
#define DEL_NOBGPID 2 /* don't add pgrp leader to bgpids */
|
||||||
|
|
||||||
/* Take care of system dependencies that must be handled when waiting for
|
/* Take care of system dependencies that must be handled when waiting for
|
||||||
children. The arguments to the WAITPID macro match those to the Posix.1
|
children. The arguments to the WAITPID macro match those to the Posix.1
|
||||||
|
@ -134,10 +142,10 @@ typedef int sh_job_map_func_t __P((JOB *, int, int, int));
|
||||||
/* Variables used here but defined in other files. */
|
/* Variables used here but defined in other files. */
|
||||||
extern int subshell_environment, line_number;
|
extern int subshell_environment, line_number;
|
||||||
extern int posixly_correct, shell_level;
|
extern int posixly_correct, shell_level;
|
||||||
extern int interrupt_immediately;
|
|
||||||
extern int last_command_exit_value, last_command_exit_signal;
|
extern int last_command_exit_value, last_command_exit_signal;
|
||||||
extern int loop_level, breaking;
|
extern int loop_level, breaking;
|
||||||
extern int sourcelevel;
|
extern int sourcelevel;
|
||||||
|
extern int running_trap;
|
||||||
extern sh_builtin_func_t *this_shell_builtin;
|
extern sh_builtin_func_t *this_shell_builtin;
|
||||||
extern char *shell_name, *this_command_name;
|
extern char *shell_name, *this_command_name;
|
||||||
extern sigset_t top_level_mask;
|
extern sigset_t top_level_mask;
|
||||||
|
@ -307,6 +315,10 @@ static int jobs_list_frozen;
|
||||||
|
|
||||||
static char retcode_name_buffer[64];
|
static char retcode_name_buffer[64];
|
||||||
|
|
||||||
|
/* flags to detect pid wraparound */
|
||||||
|
static pid_t first_pid = NO_PID;
|
||||||
|
static int pid_wrap = -1;
|
||||||
|
|
||||||
#if !defined (_POSIX_VERSION)
|
#if !defined (_POSIX_VERSION)
|
||||||
|
|
||||||
/* These are definitions to map POSIX 1003.1 functions onto existing BSD
|
/* These are definitions to map POSIX 1003.1 functions onto existing BSD
|
||||||
|
@ -328,11 +340,13 @@ tcgetpgrp (fd)
|
||||||
|
|
||||||
#endif /* !_POSIX_VERSION */
|
#endif /* !_POSIX_VERSION */
|
||||||
|
|
||||||
/* Initialize the global job stats structure. */
|
/* Initialize the global job stats structure and other bookkeeping variables */
|
||||||
void
|
void
|
||||||
init_job_stats ()
|
init_job_stats ()
|
||||||
{
|
{
|
||||||
js = zerojs;
|
js = zerojs;
|
||||||
|
first_pid = NO_PID;
|
||||||
|
pid_wrap = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the working directory for the current process. Unlike
|
/* Return the working directory for the current process. Unlike
|
||||||
|
@ -619,8 +633,11 @@ stop_pipeline (async, deferred)
|
||||||
* once in the parent and once in each child. This is where
|
* once in the parent and once in each child. This is where
|
||||||
* the parent gives it away.
|
* the parent gives it away.
|
||||||
*
|
*
|
||||||
|
* Don't give the terminal away if this shell is an asynchronous
|
||||||
|
* subshell.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
if (job_control && newjob->pgrp)
|
if (job_control && newjob->pgrp && (subshell_environment&SUBSHELL_ASYNC) == 0)
|
||||||
give_terminal_to (newjob->pgrp, 0);
|
give_terminal_to (newjob->pgrp, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -743,7 +760,7 @@ bgp_search (pid)
|
||||||
static void
|
static void
|
||||||
bgp_prune ()
|
bgp_prune ()
|
||||||
{
|
{
|
||||||
struct pidstat *ps, *p;
|
struct pidstat *ps;
|
||||||
|
|
||||||
while (bgpids.npid > js.c_childmax)
|
while (bgpids.npid > js.c_childmax)
|
||||||
{
|
{
|
||||||
|
@ -805,12 +822,14 @@ cleanup_dead_jobs ()
|
||||||
|
|
||||||
QUEUE_SIGCHLD(os);
|
QUEUE_SIGCHLD(os);
|
||||||
|
|
||||||
/* XXX could use js.j_firstj here */
|
/* XXX could use js.j_firstj and js.j_lastj here */
|
||||||
for (i = 0; i < js.j_jobslots; i++)
|
for (i = 0; i < js.j_jobslots; i++)
|
||||||
{
|
{
|
||||||
#if defined (DEBUG)
|
#if defined (DEBUG)
|
||||||
if (i < js.j_firstj && jobs[i])
|
if (i < js.j_firstj && jobs[i])
|
||||||
itrace("cleanup_dead_jobs: job %d non-null before js.j_firstj (%d)", i, js.j_firstj);
|
itrace("cleanup_dead_jobs: job %d non-null before js.j_firstj (%d)", i, js.j_firstj);
|
||||||
|
if (i > js.j_lastj && jobs[i])
|
||||||
|
itrace("cleanup_dead_jobs: job %d non-null after js.j_lastj (%d)", i, js.j_lastj);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (jobs[i] && DEADJOB (i) && IS_NOTIFIED (i))
|
if (jobs[i] && DEADJOB (i) && IS_NOTIFIED (i))
|
||||||
|
@ -837,6 +856,30 @@ processes_in_job (job)
|
||||||
return nproc;
|
return nproc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
delete_old_job (pid)
|
||||||
|
pid_t pid;
|
||||||
|
{
|
||||||
|
PROCESS *p;
|
||||||
|
int job;
|
||||||
|
|
||||||
|
job = find_job (pid, 0, &p);
|
||||||
|
if (job != NO_JOB)
|
||||||
|
{
|
||||||
|
#ifdef DEBUG
|
||||||
|
itrace ("delete_old_job: found pid %d in job %d with state %d", pid, job, jobs[job]->state);
|
||||||
|
#endif
|
||||||
|
if (JOBSTATE (job) == JDEAD)
|
||||||
|
delete_job (job, DEL_NOBGPID);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
internal_warning (_("forked pid %d appears in running job %d"), pid, job);
|
||||||
|
if (p)
|
||||||
|
p->pid = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Reallocate and compress the jobs list. This returns with a jobs array
|
/* Reallocate and compress the jobs list. This returns with a jobs array
|
||||||
whose size is a multiple of JOB_SLOTS and can hold the current number of
|
whose size is a multiple of JOB_SLOTS and can hold the current number of
|
||||||
jobs. Heuristics are used to minimize the number of new reallocs. */
|
jobs. Heuristics are used to minimize the number of new reallocs. */
|
||||||
|
@ -844,9 +887,10 @@ static void
|
||||||
realloc_jobs_list ()
|
realloc_jobs_list ()
|
||||||
{
|
{
|
||||||
sigset_t set, oset;
|
sigset_t set, oset;
|
||||||
int nsize, i, j;
|
int nsize, i, j, ncur, nprev;
|
||||||
JOB **nlist;
|
JOB **nlist;
|
||||||
|
|
||||||
|
ncur = nprev = NO_JOB;
|
||||||
nsize = ((js.j_njobs + JOB_SLOTS - 1) / JOB_SLOTS);
|
nsize = ((js.j_njobs + JOB_SLOTS - 1) / JOB_SLOTS);
|
||||||
nsize *= JOB_SLOTS;
|
nsize *= JOB_SLOTS;
|
||||||
i = js.j_njobs % JOB_SLOTS;
|
i = js.j_njobs % JOB_SLOTS;
|
||||||
|
@ -854,17 +898,51 @@ realloc_jobs_list ()
|
||||||
nsize += JOB_SLOTS;
|
nsize += JOB_SLOTS;
|
||||||
|
|
||||||
BLOCK_CHILD (set, oset);
|
BLOCK_CHILD (set, oset);
|
||||||
nlist = (JOB **) xmalloc (nsize * sizeof (JOB *));
|
nlist = (js.j_jobslots == nsize) ? jobs : (JOB **) xmalloc (nsize * sizeof (JOB *));
|
||||||
|
|
||||||
for (i = j = 0; i < js.j_jobslots; i++)
|
for (i = j = 0; i < js.j_jobslots; i++)
|
||||||
if (jobs[i])
|
if (jobs[i])
|
||||||
nlist[j++] = jobs[i];
|
{
|
||||||
|
if (i == js.j_current)
|
||||||
|
ncur = j;
|
||||||
|
if (i == js.j_previous)
|
||||||
|
nprev = j;
|
||||||
|
nlist[j++] = jobs[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined (DEBUG)
|
||||||
|
itrace ("realloc_jobs_list: resize jobs list from %d to %d", js.j_jobslots, nsize);
|
||||||
|
itrace ("realloc_jobs_list: j_lastj changed from %d to %d", js.j_lastj, (j > 0) ? j - 1 : 0);
|
||||||
|
itrace ("realloc_jobs_list: j_njobs changed from %d to %d", js.j_njobs, (j > 0) ? j - 1 : 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
js.j_firstj = 0;
|
js.j_firstj = 0;
|
||||||
js.j_lastj = (j > 0) ? j - 1: 0;
|
js.j_lastj = (j > 0) ? j - 1 : 0;
|
||||||
|
js.j_njobs = j;
|
||||||
js.j_jobslots = nsize;
|
js.j_jobslots = nsize;
|
||||||
|
|
||||||
free (jobs);
|
/* Zero out remaining slots in new jobs list */
|
||||||
jobs = nlist;
|
for ( ; j < nsize; j++)
|
||||||
|
nlist[j] = (JOB *)NULL;
|
||||||
|
|
||||||
|
if (jobs != nlist)
|
||||||
|
{
|
||||||
|
free (jobs);
|
||||||
|
jobs = nlist;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ncur != NO_JOB)
|
||||||
|
js.j_current = ncur;
|
||||||
|
if (nprev != NO_JOB)
|
||||||
|
js.j_previous = nprev;
|
||||||
|
|
||||||
|
/* Need to reset these */
|
||||||
|
if (js.j_current == NO_JOB || js.j_previous == NO_JOB || js.j_current > js.j_lastj || js.j_previous > js.j_lastj)
|
||||||
|
reset_current ();
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
itrace ("realloc_jobs_list: reset js.j_current (%d) and js.j_previous (%d)", js.j_current, js.j_previous);
|
||||||
|
#endif
|
||||||
|
|
||||||
UNBLOCK_CHILD (oset);
|
UNBLOCK_CHILD (oset);
|
||||||
}
|
}
|
||||||
|
@ -873,7 +951,7 @@ realloc_jobs_list ()
|
||||||
the jobs array to some predefined maximum. Called when the shell is not
|
the jobs array to some predefined maximum. Called when the shell is not
|
||||||
the foreground process (subshell_environment != 0). Returns the first
|
the foreground process (subshell_environment != 0). Returns the first
|
||||||
available slot in the compacted list. If that value is js.j_jobslots, then
|
available slot in the compacted list. If that value is js.j_jobslots, then
|
||||||
the list needs to be reallocated. The jobs array is in new memory if
|
the list needs to be reallocated. The jobs array may be in new memory if
|
||||||
this returns > 0 and < js.j_jobslots. FLAGS is reserved for future use. */
|
this returns > 0 and < js.j_jobslots. FLAGS is reserved for future use. */
|
||||||
static int
|
static int
|
||||||
compact_jobs_list (flags)
|
compact_jobs_list (flags)
|
||||||
|
@ -891,29 +969,33 @@ compact_jobs_list (flags)
|
||||||
/* Delete the job at INDEX from the job list. Must be called
|
/* Delete the job at INDEX from the job list. Must be called
|
||||||
with SIGCHLD blocked. */
|
with SIGCHLD blocked. */
|
||||||
void
|
void
|
||||||
delete_job (job_index, warn_stopped)
|
delete_job (job_index, dflags)
|
||||||
int job_index, warn_stopped;
|
int job_index, dflags;
|
||||||
{
|
{
|
||||||
register JOB *temp;
|
register JOB *temp;
|
||||||
PROCESS *proc;
|
PROCESS *proc;
|
||||||
int ndel, status;
|
int ndel;
|
||||||
pid_t pid;
|
|
||||||
|
|
||||||
if (js.j_jobslots == 0 || jobs_list_frozen)
|
if (js.j_jobslots == 0 || jobs_list_frozen)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (warn_stopped && subshell_environment == 0 && STOPPED (job_index))
|
if ((dflags & DEL_WARNSTOPPED) && subshell_environment == 0 && STOPPED (job_index))
|
||||||
internal_warning (_("deleting stopped job %d with process group %ld"), job_index+1, (long)jobs[job_index]->pgrp);
|
internal_warning (_("deleting stopped job %d with process group %ld"), job_index+1, (long)jobs[job_index]->pgrp);
|
||||||
temp = jobs[job_index];
|
temp = jobs[job_index];
|
||||||
|
if (temp == 0)
|
||||||
|
return;
|
||||||
if (job_index == js.j_current || job_index == js.j_previous)
|
if (job_index == js.j_current || job_index == js.j_previous)
|
||||||
reset_current ();
|
reset_current ();
|
||||||
|
|
||||||
proc = find_last_proc (job_index, 0);
|
if ((dflags & DEL_NOBGPID) == 0)
|
||||||
/* Could do this just for J_ASYNC jobs, but we save all. */
|
{
|
||||||
bgp_add (proc->pid, process_exit_status (proc->status));
|
proc = find_last_proc (job_index, 0);
|
||||||
|
/* Could do this just for J_ASYNC jobs, but we save all. */
|
||||||
|
if (proc)
|
||||||
|
bgp_add (proc->pid, process_exit_status (proc->status));
|
||||||
|
}
|
||||||
|
|
||||||
jobs[job_index] = (JOB *)NULL;
|
jobs[job_index] = (JOB *)NULL;
|
||||||
|
|
||||||
if (temp == js.j_lastmade)
|
if (temp == js.j_lastmade)
|
||||||
js.j_lastmade = 0;
|
js.j_lastmade = 0;
|
||||||
else if (temp == js.j_lastasync)
|
else if (temp == js.j_lastasync)
|
||||||
|
@ -1091,6 +1173,8 @@ map_over_jobs (func, arg1, arg2)
|
||||||
#if defined (DEBUG)
|
#if defined (DEBUG)
|
||||||
if (i < js.j_firstj && jobs[i])
|
if (i < js.j_firstj && jobs[i])
|
||||||
itrace("map_over_jobs: job %d non-null before js.j_firstj (%d)", i, js.j_firstj);
|
itrace("map_over_jobs: job %d non-null before js.j_firstj (%d)", i, js.j_firstj);
|
||||||
|
if (i > js.j_lastj && jobs[i])
|
||||||
|
itrace("map_over_jobs: job %d non-null after js.j_lastj (%d)", i, js.j_lastj);
|
||||||
#endif
|
#endif
|
||||||
if (jobs[i])
|
if (jobs[i])
|
||||||
{
|
{
|
||||||
|
@ -1145,8 +1229,9 @@ hangup_all_jobs ()
|
||||||
{
|
{
|
||||||
if (jobs[i])
|
if (jobs[i])
|
||||||
{
|
{
|
||||||
if ((jobs[i]->flags & J_NOHUP) == 0)
|
if (jobs[i]->flags & J_NOHUP)
|
||||||
killpg (jobs[i]->pgrp, SIGHUP);
|
continue;
|
||||||
|
killpg (jobs[i]->pgrp, SIGHUP);
|
||||||
if (STOPPED (i))
|
if (STOPPED (i))
|
||||||
killpg (jobs[i]->pgrp, SIGCONT);
|
killpg (jobs[i]->pgrp, SIGCONT);
|
||||||
}
|
}
|
||||||
|
@ -1223,12 +1308,14 @@ find_job (pid, alive_only, procp)
|
||||||
register int i;
|
register int i;
|
||||||
PROCESS *p;
|
PROCESS *p;
|
||||||
|
|
||||||
/* XXX could use js.j_firstj here */
|
/* XXX could use js.j_firstj here, and should check js.j_lastj */
|
||||||
for (i = 0; i < js.j_jobslots; i++)
|
for (i = 0; i < js.j_jobslots; i++)
|
||||||
{
|
{
|
||||||
#if defined (DEBUG)
|
#if defined (DEBUG)
|
||||||
if (i < js.j_firstj && jobs[i])
|
if (i < js.j_firstj && jobs[i])
|
||||||
itrace("find_job: job %d non-null before js.j_firstj (%d)", i, js.j_firstj);
|
itrace("find_job: job %d non-null before js.j_firstj (%d)", i, js.j_firstj);
|
||||||
|
if (i > js.j_lastj && jobs[i])
|
||||||
|
itrace("find_job: job %d non-null after js.j_lastj (%d)", i, js.j_lastj);
|
||||||
#endif
|
#endif
|
||||||
if (jobs[i])
|
if (jobs[i])
|
||||||
{
|
{
|
||||||
|
@ -1655,7 +1742,7 @@ make_child (command, async_p)
|
||||||
In this case, we don't want to give the terminal to the
|
In this case, we don't want to give the terminal to the
|
||||||
shell's process group (we could be in the middle of a
|
shell's process group (we could be in the middle of a
|
||||||
pipeline, for example). */
|
pipeline, for example). */
|
||||||
if (async_p == 0 && pipeline_pgrp != shell_pgrp)
|
if (async_p == 0 && pipeline_pgrp != shell_pgrp && ((subshell_environment&SUBSHELL_ASYNC) == 0))
|
||||||
give_terminal_to (pipeline_pgrp, 0);
|
give_terminal_to (pipeline_pgrp, 0);
|
||||||
|
|
||||||
#if defined (PGRP_PIPE)
|
#if defined (PGRP_PIPE)
|
||||||
|
@ -1697,6 +1784,13 @@ make_child (command, async_p)
|
||||||
/* In the parent. Remember the pid of the child just created
|
/* In the parent. Remember the pid of the child just created
|
||||||
as the proper pgrp if this is the first child. */
|
as the proper pgrp if this is the first child. */
|
||||||
|
|
||||||
|
if (first_pid == NO_PID)
|
||||||
|
first_pid = pid;
|
||||||
|
else if (pid_wrap == -1 && pid < first_pid)
|
||||||
|
pid_wrap = 0;
|
||||||
|
else if (pid_wrap == 0 && pid >= first_pid)
|
||||||
|
pid_wrap = 1;
|
||||||
|
|
||||||
if (job_control)
|
if (job_control)
|
||||||
{
|
{
|
||||||
if (pipeline_pgrp == 0)
|
if (pipeline_pgrp == 0)
|
||||||
|
@ -1730,6 +1824,9 @@ make_child (command, async_p)
|
||||||
last_asynchronous_pid = 1;
|
last_asynchronous_pid = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (pid_wrap > 0)
|
||||||
|
delete_old_job (pid);
|
||||||
|
|
||||||
#if !defined (RECYCLES_PIDS)
|
#if !defined (RECYCLES_PIDS)
|
||||||
/* Only check for saved status if we've saved more than CHILD_MAX
|
/* Only check for saved status if we've saved more than CHILD_MAX
|
||||||
statuses, unless the system recycles pids. */
|
statuses, unless the system recycles pids. */
|
||||||
|
@ -1914,7 +2011,7 @@ find_last_proc (job, block)
|
||||||
BLOCK_CHILD (set, oset);
|
BLOCK_CHILD (set, oset);
|
||||||
|
|
||||||
p = jobs[job]->pipe;
|
p = jobs[job]->pipe;
|
||||||
while (p->next != jobs[job]->pipe)
|
while (p && p->next != jobs[job]->pipe)
|
||||||
p = p->next;
|
p = p->next;
|
||||||
|
|
||||||
if (block)
|
if (block)
|
||||||
|
@ -1998,12 +2095,14 @@ wait_for_background_pids ()
|
||||||
BLOCK_CHILD (set, oset);
|
BLOCK_CHILD (set, oset);
|
||||||
|
|
||||||
/* find first running job; if none running in foreground, break */
|
/* find first running job; if none running in foreground, break */
|
||||||
/* XXX could use js.j_firstj here */
|
/* XXX could use js.j_firstj and js.j_lastj here */
|
||||||
for (i = 0; i < js.j_jobslots; i++)
|
for (i = 0; i < js.j_jobslots; i++)
|
||||||
{
|
{
|
||||||
#if defined (DEBUG)
|
#if defined (DEBUG)
|
||||||
if (i < js.j_firstj && jobs[i])
|
if (i < js.j_firstj && jobs[i])
|
||||||
itrace("wait_for_background_pids: job %d non-null before js.j_firstj (%d)", i, js.j_firstj);
|
itrace("wait_for_background_pids: job %d non-null before js.j_firstj (%d)", i, js.j_firstj);
|
||||||
|
if (i > js.j_lastj && jobs[i])
|
||||||
|
itrace("wait_for_background_pids: job %d non-null after js.j_lastj (%d)", i, js.j_lastj);
|
||||||
#endif
|
#endif
|
||||||
if (jobs[i] && RUNNING (i) && IS_FOREGROUND (i) == 0)
|
if (jobs[i] && RUNNING (i) && IS_FOREGROUND (i) == 0)
|
||||||
break;
|
break;
|
||||||
|
@ -2198,7 +2297,11 @@ wait_for (pid)
|
||||||
/* This is possibly a race condition -- should it go in stop_pipeline? */
|
/* This is possibly a race condition -- should it go in stop_pipeline? */
|
||||||
wait_sigint_received = 0;
|
wait_sigint_received = 0;
|
||||||
if (job_control == 0)
|
if (job_control == 0)
|
||||||
old_sigint_handler = set_signal_handler (SIGINT, wait_sigint_handler);
|
{
|
||||||
|
old_sigint_handler = set_signal_handler (SIGINT, wait_sigint_handler);
|
||||||
|
if (old_sigint_handler == SIG_IGN)
|
||||||
|
set_signal_handler (SIGINT, old_sigint_handler);
|
||||||
|
}
|
||||||
|
|
||||||
termination_state = last_command_exit_value;
|
termination_state = last_command_exit_value;
|
||||||
|
|
||||||
|
@ -2265,6 +2368,7 @@ wait_for (pid)
|
||||||
{
|
{
|
||||||
child->running = PS_DONE;
|
child->running = PS_DONE;
|
||||||
child->status = 0; /* XXX -- can't find true status */
|
child->status = 0; /* XXX -- can't find true status */
|
||||||
|
js.c_living = 0; /* no living child processes */
|
||||||
if (job != NO_JOB)
|
if (job != NO_JOB)
|
||||||
{
|
{
|
||||||
jobs[job]->state = JDEAD;
|
jobs[job]->state = JDEAD;
|
||||||
|
@ -2316,7 +2420,6 @@ wait_for (pid)
|
||||||
if (job == NO_JOB)
|
if (job == NO_JOB)
|
||||||
itrace("wait_for: job == NO_JOB, giving the terminal to shell_pgrp (%ld)", (long)shell_pgrp);
|
itrace("wait_for: job == NO_JOB, giving the terminal to shell_pgrp (%ld)", (long)shell_pgrp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
give_terminal_to (shell_pgrp, 0);
|
give_terminal_to (shell_pgrp, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2722,14 +2825,14 @@ start_job (job, foreground)
|
||||||
if (foreground)
|
if (foreground)
|
||||||
{
|
{
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
int s;
|
int st;
|
||||||
|
|
||||||
pid = find_last_pid (job, 0);
|
pid = find_last_pid (job, 0);
|
||||||
UNBLOCK_CHILD (oset);
|
UNBLOCK_CHILD (oset);
|
||||||
s = wait_for (pid);
|
st = wait_for (pid);
|
||||||
shell_tty_info = save_stty;
|
shell_tty_info = save_stty;
|
||||||
set_tty_state ();
|
set_tty_state ();
|
||||||
return (s);
|
return (st);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2865,6 +2968,7 @@ waitchld (wpid, block)
|
||||||
: 0;
|
: 0;
|
||||||
if (sigchld || block == 0)
|
if (sigchld || block == 0)
|
||||||
waitpid_flags |= WNOHANG;
|
waitpid_flags |= WNOHANG;
|
||||||
|
CHECK_TERMSIG;
|
||||||
pid = WAITPID (-1, &status, waitpid_flags);
|
pid = WAITPID (-1, &status, waitpid_flags);
|
||||||
|
|
||||||
/* WCONTINUED may be rejected by waitpid as invalid even when defined */
|
/* WCONTINUED may be rejected by waitpid as invalid even when defined */
|
||||||
|
@ -2891,13 +2995,17 @@ waitchld (wpid, block)
|
||||||
|
|
||||||
/* If waitpid returns 0, there are running children. If it returns -1,
|
/* If waitpid returns 0, there are running children. If it returns -1,
|
||||||
the only other error POSIX says it can return is EINTR. */
|
the only other error POSIX says it can return is EINTR. */
|
||||||
|
CHECK_TERMSIG;
|
||||||
if (pid <= 0)
|
if (pid <= 0)
|
||||||
continue; /* jumps right to the test */
|
continue; /* jumps right to the test */
|
||||||
|
|
||||||
/* children_exited is used to run traps on SIGCHLD. We don't want to
|
/* children_exited is used to run traps on SIGCHLD. We don't want to
|
||||||
run the trap if a process is just being continued. */
|
run the trap if a process is just being continued. */
|
||||||
if (WIFCONTINUED(status) == 0)
|
if (WIFCONTINUED(status) == 0)
|
||||||
children_exited++;
|
{
|
||||||
|
children_exited++;
|
||||||
|
js.c_living--;
|
||||||
|
}
|
||||||
|
|
||||||
/* Locate our PROCESS for this pid. */
|
/* Locate our PROCESS for this pid. */
|
||||||
child = find_process (pid, 1, &job); /* want living procs only */
|
child = find_process (pid, 1, &job); /* want living procs only */
|
||||||
|
@ -3122,7 +3230,7 @@ set_job_status_and_cleanup (job)
|
||||||
temp_handler = trap_to_sighandler (SIGINT);
|
temp_handler = trap_to_sighandler (SIGINT);
|
||||||
restore_sigint_handler ();
|
restore_sigint_handler ();
|
||||||
if (temp_handler == SIG_DFL)
|
if (temp_handler == SIG_DFL)
|
||||||
termination_unwind_protect (SIGINT);
|
termsig_handler (SIGINT);
|
||||||
else if (temp_handler != SIG_IGN)
|
else if (temp_handler != SIG_IGN)
|
||||||
(*temp_handler) (SIGINT);
|
(*temp_handler) (SIGINT);
|
||||||
}
|
}
|
||||||
|
@ -3637,9 +3745,11 @@ delete_all_jobs (running_only)
|
||||||
#if defined (DEBUG)
|
#if defined (DEBUG)
|
||||||
if (i < js.j_firstj && jobs[i])
|
if (i < js.j_firstj && jobs[i])
|
||||||
itrace("delete_all_jobs: job %d non-null before js.j_firstj (%d)", i, js.j_firstj);
|
itrace("delete_all_jobs: job %d non-null before js.j_firstj (%d)", i, js.j_firstj);
|
||||||
|
if (i > js.j_lastj && jobs[i])
|
||||||
|
itrace("delete_all_jobs: job %d non-null after js.j_lastj (%d)", i, js.j_lastj);
|
||||||
#endif
|
#endif
|
||||||
if (jobs[i] && (running_only == 0 || (running_only && RUNNING(i))))
|
if (jobs[i] && (running_only == 0 || (running_only && RUNNING(i))))
|
||||||
delete_job (i, 1);
|
delete_job (i, DEL_WARNSTOPPED);
|
||||||
}
|
}
|
||||||
if (running_only == 0)
|
if (running_only == 0)
|
||||||
{
|
{
|
||||||
|
@ -3691,6 +3801,8 @@ count_all_jobs ()
|
||||||
#if defined (DEBUG)
|
#if defined (DEBUG)
|
||||||
if (i < js.j_firstj && jobs[i])
|
if (i < js.j_firstj && jobs[i])
|
||||||
itrace("count_all_jobs: job %d non-null before js.j_firstj (%d)", i, js.j_firstj);
|
itrace("count_all_jobs: job %d non-null before js.j_firstj (%d)", i, js.j_firstj);
|
||||||
|
if (i > js.j_lastj && jobs[i])
|
||||||
|
itrace("count_all_jobs: job %d non-null after js.j_lastj (%d)", i, js.j_lastj);
|
||||||
#endif
|
#endif
|
||||||
if (jobs[i] && DEADJOB(i) == 0)
|
if (jobs[i] && DEADJOB(i) == 0)
|
||||||
n++;
|
n++;
|
||||||
|
@ -3764,6 +3876,8 @@ mark_dead_jobs_as_notified (force)
|
||||||
#if defined (DEBUG)
|
#if defined (DEBUG)
|
||||||
if (i < js.j_firstj && jobs[i])
|
if (i < js.j_firstj && jobs[i])
|
||||||
itrace("mark_dead_jobs_as_notified: job %d non-null before js.j_firstj (%d)", i, js.j_firstj);
|
itrace("mark_dead_jobs_as_notified: job %d non-null before js.j_firstj (%d)", i, js.j_firstj);
|
||||||
|
if (i > js.j_lastj && jobs[i])
|
||||||
|
itrace("mark_dead_jobs_as_notified: job %d non-null after js.j_lastj (%d)", i, js.j_lastj);
|
||||||
#endif
|
#endif
|
||||||
if (jobs[i] && DEADJOB (i))
|
if (jobs[i] && DEADJOB (i))
|
||||||
{
|
{
|
||||||
|
@ -3815,6 +3929,8 @@ itrace("mark_dead_jobs_as_notified: child_max = %d ndead = %d ndeadproc = %d", j
|
||||||
#if defined (DEBUG)
|
#if defined (DEBUG)
|
||||||
if (i < js.j_firstj && jobs[i])
|
if (i < js.j_firstj && jobs[i])
|
||||||
itrace("mark_dead_jobs_as_notified: job %d non-null before js.j_firstj (%d)", i, js.j_firstj);
|
itrace("mark_dead_jobs_as_notified: job %d non-null before js.j_firstj (%d)", i, js.j_firstj);
|
||||||
|
if (i > js.j_lastj && jobs[i])
|
||||||
|
itrace("mark_dead_jobs_as_notified: job %d non-null after js.j_lastj (%d)", i, js.j_lastj);
|
||||||
#endif
|
#endif
|
||||||
/* If marking this job as notified would drop us down below
|
/* If marking this job as notified would drop us down below
|
||||||
child_max, don't mark it so we can keep at least child_max
|
child_max, don't mark it so we can keep at least child_max
|
||||||
|
|
|
@ -33,7 +33,7 @@ CC = @CC@
|
||||||
RANLIB = @RANLIB@
|
RANLIB = @RANLIB@
|
||||||
AR = @AR@
|
AR = @AR@
|
||||||
ARFLAGS = @ARFLAGS@
|
ARFLAGS = @ARFLAGS@
|
||||||
RM = rm
|
RM = rm -f
|
||||||
CP = cp
|
CP = cp
|
||||||
MV = mv
|
MV = mv
|
||||||
|
|
||||||
|
@ -59,6 +59,7 @@ CCFLAGS = $(PROFILE_FLAGS) $(DEFS) $(LOCAL_DEFS) $(CPPFLAGS) ${INCLUDES} \
|
||||||
# Here is a rule for making .o files from .c files that doesn't force
|
# Here is a rule for making .o files from .c files that doesn't force
|
||||||
# the type of the machine (like -sun3) into the flags.
|
# the type of the machine (like -sun3) into the flags.
|
||||||
.c.o:
|
.c.o:
|
||||||
|
$(RM) $@
|
||||||
$(CC) -c $(CCFLAGS) $<
|
$(CC) -c $(CCFLAGS) $<
|
||||||
|
|
||||||
# The name of the library target.
|
# The name of the library target.
|
||||||
|
|
|
@ -73,7 +73,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern void throw_to_top_level __P((void));
|
extern void throw_to_top_level __P((void));
|
||||||
extern int test_eaccess __P((char *, int));
|
extern int sh_eaccess __P((char *, int));
|
||||||
|
|
||||||
extern int extended_glob;
|
extern int extended_glob;
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ mbskipname (pat, dname)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
wchar_t *pat_wc, *dn_wc;
|
wchar_t *pat_wc, *dn_wc;
|
||||||
size_t pat_n, dn_n, n;
|
size_t pat_n, dn_n;
|
||||||
|
|
||||||
pat_n = xdupmbstowcs (&pat_wc, NULL, pat);
|
pat_n = xdupmbstowcs (&pat_wc, NULL, pat);
|
||||||
dn_n = xdupmbstowcs (&dn_wc, NULL, dname);
|
dn_n = xdupmbstowcs (&dn_wc, NULL, dname);
|
||||||
|
@ -293,7 +293,7 @@ dequote_pathname (pathname)
|
||||||
# define GLOB_TESTNAME(name) (lstat (name, &finfo))
|
# define GLOB_TESTNAME(name) (lstat (name, &finfo))
|
||||||
#else /* !HAVE_LSTAT */
|
#else /* !HAVE_LSTAT */
|
||||||
# if !defined (AFS)
|
# if !defined (AFS)
|
||||||
# define GLOB_TESTNAME(name) (test_eaccess (nextname, F_OK))
|
# define GLOB_TESTNAME(name) (sh_eaccess (nextname, F_OK))
|
||||||
# else /* AFS */
|
# else /* AFS */
|
||||||
# define GLOB_TESTNAME(name) (access (nextname, F_OK))
|
# define GLOB_TESTNAME(name) (access (nextname, F_OK))
|
||||||
# endif /* AFS */
|
# endif /* AFS */
|
||||||
|
@ -360,6 +360,7 @@ glob_vector (pat, dir, flags)
|
||||||
count = lose = skip = 0;
|
count = lose = skip = 0;
|
||||||
|
|
||||||
firstmalloc = 0;
|
firstmalloc = 0;
|
||||||
|
nalloca = 0;
|
||||||
|
|
||||||
/* If PAT is empty, skip the loop, but return one (empty) filename. */
|
/* If PAT is empty, skip the loop, but return one (empty) filename. */
|
||||||
if (pat == 0 || *pat == '\0')
|
if (pat == 0 || *pat == '\0')
|
||||||
|
@ -469,7 +470,7 @@ glob_vector (pat, dir, flags)
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
/* Make globbing interruptible in the shell. */
|
/* Make globbing interruptible in the shell. */
|
||||||
if (interrupt_state)
|
if (interrupt_state || terminating_signal)
|
||||||
{
|
{
|
||||||
lose = 1;
|
lose = 1;
|
||||||
break;
|
break;
|
||||||
|
@ -540,12 +541,17 @@ glob_vector (pat, dir, flags)
|
||||||
/* Here free the strings we have got. */
|
/* Here free the strings we have got. */
|
||||||
while (lastlink)
|
while (lastlink)
|
||||||
{
|
{
|
||||||
|
/* Since we build the list in reverse order, the first N entries
|
||||||
|
will be allocated with malloc, if firstmalloc is set, from
|
||||||
|
lastlink to firstmalloc. */
|
||||||
if (firstmalloc)
|
if (firstmalloc)
|
||||||
{
|
{
|
||||||
if (lastlink == firstmalloc)
|
if (lastlink == firstmalloc)
|
||||||
firstmalloc = 0;
|
firstmalloc = 0;
|
||||||
tmplink = lastlink;
|
tmplink = lastlink;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
tmplink = 0;
|
||||||
free (lastlink->name);
|
free (lastlink->name);
|
||||||
lastlink = lastlink->next;
|
lastlink = lastlink->next;
|
||||||
FREE (tmplink);
|
FREE (tmplink);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 1991-2005 Free Software Foundation, Inc.
|
/* Copyright (C) 1991-2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GNU Bash, the Bourne Again SHell.
|
This file is part of GNU Bash, the Bourne Again SHell.
|
||||||
|
|
||||||
|
@ -15,7 +15,6 @@
|
||||||
You should have received a copy of the GNU General Public License along
|
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
|
with Bash; see the file COPYING. If not, write to the Free Software
|
||||||
Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
|
Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
|
||||||
|
|
||||||
int FCT __P((CHAR *, CHAR *, int));
|
int FCT __P((CHAR *, CHAR *, int));
|
||||||
|
|
||||||
static int GMATCH __P((CHAR *, CHAR *, CHAR *, CHAR *, int));
|
static int GMATCH __P((CHAR *, CHAR *, CHAR *, CHAR *, int));
|
||||||
|
@ -638,12 +637,13 @@ EXTMATCH (xc, s, se, p, pe, flags)
|
||||||
CHAR *psub; /* pointer to sub-pattern */
|
CHAR *psub; /* pointer to sub-pattern */
|
||||||
CHAR *pnext; /* pointer to next sub-pattern */
|
CHAR *pnext; /* pointer to next sub-pattern */
|
||||||
CHAR *srest; /* pointer to rest of string */
|
CHAR *srest; /* pointer to rest of string */
|
||||||
int m1, m2;
|
int m1, m2, xflags; /* xflags = flags passed to recursive matches */
|
||||||
|
|
||||||
#if DEBUG_MATCHING
|
#if DEBUG_MATCHING
|
||||||
fprintf(stderr, "extmatch: xc = %c\n", xc);
|
fprintf(stderr, "extmatch: xc = %c\n", xc);
|
||||||
fprintf(stderr, "extmatch: s = %s; se = %s\n", s, se);
|
fprintf(stderr, "extmatch: s = %s; se = %s\n", s, se);
|
||||||
fprintf(stderr, "extmatch: p = %s; pe = %s\n", p, pe);
|
fprintf(stderr, "extmatch: p = %s; pe = %s\n", p, pe);
|
||||||
|
fprintf(stderr, "extmatch: flags = %d\n", flags);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
prest = PATSCAN (p + (*p == L('(')), pe, 0); /* ) */
|
prest = PATSCAN (p + (*p == L('(')), pe, 0); /* ) */
|
||||||
|
@ -677,8 +677,12 @@ fprintf(stderr, "extmatch: p = %s; pe = %s\n", p, pe);
|
||||||
string matches the rest of the pattern. Also handle
|
string matches the rest of the pattern. Also handle
|
||||||
multiple matches of the pattern. */
|
multiple matches of the pattern. */
|
||||||
if (m1)
|
if (m1)
|
||||||
m2 = (GMATCH (srest, se, prest, pe, flags) == 0) ||
|
{
|
||||||
(s != srest && GMATCH (srest, se, p - 1, pe, flags) == 0);
|
/* if srest > s, we are not at start of string */
|
||||||
|
xflags = (srest > s) ? (flags & ~FNM_PERIOD) : flags;
|
||||||
|
m2 = (GMATCH (srest, se, prest, pe, xflags) == 0) ||
|
||||||
|
(s != srest && GMATCH (srest, se, p - 1, pe, xflags) == 0);
|
||||||
|
}
|
||||||
if (m1 && m2)
|
if (m1 && m2)
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
@ -688,7 +692,7 @@ fprintf(stderr, "extmatch: p = %s; pe = %s\n", p, pe);
|
||||||
return (FNM_NOMATCH);
|
return (FNM_NOMATCH);
|
||||||
|
|
||||||
case L('?'): /* match zero or one of the patterns */
|
case L('?'): /* match zero or one of the patterns */
|
||||||
case L('@'): /* match exactly one of the patterns */
|
case L('@'): /* match one (or more) of the patterns */
|
||||||
/* If we can get away with no matches, don't even bother. Just
|
/* If we can get away with no matches, don't even bother. Just
|
||||||
call gmatch on the rest of the pattern and return success if
|
call gmatch on the rest of the pattern and return success if
|
||||||
it succeeds. */
|
it succeeds. */
|
||||||
|
@ -704,8 +708,10 @@ fprintf(stderr, "extmatch: p = %s; pe = %s\n", p, pe);
|
||||||
srest = (prest == pe) ? se : s;
|
srest = (prest == pe) ? se : s;
|
||||||
for ( ; srest <= se; srest++)
|
for ( ; srest <= se; srest++)
|
||||||
{
|
{
|
||||||
|
/* if srest > s, we are not at start of string */
|
||||||
|
xflags = (srest > s) ? (flags & ~FNM_PERIOD) : flags;
|
||||||
if (GMATCH (s, srest, psub, pnext - 1, flags) == 0 &&
|
if (GMATCH (s, srest, psub, pnext - 1, flags) == 0 &&
|
||||||
GMATCH (srest, se, prest, pe, flags) == 0)
|
GMATCH (srest, se, prest, pe, xflags) == 0)
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
if (pnext == prest)
|
if (pnext == prest)
|
||||||
|
@ -726,7 +732,9 @@ fprintf(stderr, "extmatch: p = %s; pe = %s\n", p, pe);
|
||||||
if (pnext == prest)
|
if (pnext == prest)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (m1 == 0 && GMATCH (srest, se, prest, pe, flags) == 0)
|
/* if srest > s, we are not at start of string */
|
||||||
|
xflags = (srest > s) ? (flags & ~FNM_PERIOD) : flags;
|
||||||
|
if (m1 == 0 && GMATCH (srest, se, prest, pe, xflags) == 0)
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
return (FNM_NOMATCH);
|
return (FNM_NOMATCH);
|
||||||
|
|
|
@ -247,7 +247,6 @@ rangecmp_wc (c1, c2)
|
||||||
{
|
{
|
||||||
static wchar_t s1[2] = { L' ', L'\0' };
|
static wchar_t s1[2] = { L' ', L'\0' };
|
||||||
static wchar_t s2[2] = { L' ', L'\0' };
|
static wchar_t s2[2] = { L' ', L'\0' };
|
||||||
int ret;
|
|
||||||
|
|
||||||
if (c1 == c2)
|
if (c1 == c2)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -145,7 +145,8 @@ xdupmbstowcs (destp, indicesp, src)
|
||||||
/* In case SRC or DESP is NULL, conversion doesn't take place. */
|
/* In case SRC or DESP is NULL, conversion doesn't take place. */
|
||||||
if (src == NULL || destp == NULL)
|
if (src == NULL || destp == NULL)
|
||||||
{
|
{
|
||||||
*destp = NULL;
|
if (destp)
|
||||||
|
*destp = NULL;
|
||||||
return (size_t)-1;
|
return (size_t)-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "mstats.h"
|
#include "mstats.h"
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "imalloc.h"
|
#include "imalloc.h"
|
||||||
#include "table.h"
|
#include "table.h"
|
||||||
|
|
|
@ -5,6 +5,10 @@
|
||||||
#
|
#
|
||||||
# NOTE: we ignore `realloc' tags because they're just extra information
|
# NOTE: we ignore `realloc' tags because they're just extra information
|
||||||
#
|
#
|
||||||
|
# Copyright (c) 2001 Chester Ramey
|
||||||
|
# Permission is hereby granted to deal in this Software without restriction.
|
||||||
|
# THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.
|
||||||
|
#
|
||||||
# Chet Ramey
|
# Chet Ramey
|
||||||
# chet@po.cwru.edu
|
# chet@po.cwru.edu
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* bind.c -- key binding and startup file support for the readline library. */
|
/* bind.c -- key binding and startup file support for the readline library. */
|
||||||
|
|
||||||
/* Copyright (C) 1987-2005 Free Software Foundation, Inc.
|
/* Copyright (C) 1987-2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of the GNU Readline Library, a library for
|
This file is part of the GNU Readline Library, a library for
|
||||||
reading lines of text with interactive input and history editing.
|
reading lines of text with interactive input and history editing.
|
||||||
|
@ -370,7 +370,10 @@ rl_generic_bind (type, keyseq, data, map)
|
||||||
|
|
||||||
ic = uc;
|
ic = uc;
|
||||||
if (ic < 0 || ic >= KEYMAP_SIZE)
|
if (ic < 0 || ic >= KEYMAP_SIZE)
|
||||||
return -1;
|
{
|
||||||
|
free (keys);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (META_CHAR (ic) && _rl_convert_meta_chars_to_ascii)
|
if (META_CHAR (ic) && _rl_convert_meta_chars_to_ascii)
|
||||||
{
|
{
|
||||||
|
@ -462,12 +465,21 @@ rl_translate_keyseq (seq, array, len)
|
||||||
}
|
}
|
||||||
else if (c == 'M')
|
else if (c == 'M')
|
||||||
{
|
{
|
||||||
i++;
|
i++; /* seq[i] == '-' */
|
||||||
/* XXX - should obey convert-meta setting? */
|
/* XXX - obey convert-meta setting */
|
||||||
if (_rl_convert_meta_chars_to_ascii && _rl_keymap[ESC].type == ISKMAP)
|
if (_rl_convert_meta_chars_to_ascii && _rl_keymap[ESC].type == ISKMAP)
|
||||||
array[l++] = ESC; /* ESC is meta-prefix */
|
array[l++] = ESC; /* ESC is meta-prefix */
|
||||||
|
else if (seq[i+1] == '\\' && seq[i+2] == 'C' && seq[i+3] == '-')
|
||||||
|
{
|
||||||
|
i += 4;
|
||||||
|
temp = (seq[i] == '?') ? RUBOUT : CTRL (_rl_to_upper (seq[i]));
|
||||||
|
array[l++] = META (temp);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
/* This doesn't yet handle things like \M-\a, which may
|
||||||
|
or may not have any reasonable meaning. You're
|
||||||
|
probably better off using straight octal or hex. */
|
||||||
i++;
|
i++;
|
||||||
array[l++] = META (seq[i]);
|
array[l++] = META (seq[i]);
|
||||||
}
|
}
|
||||||
|
@ -565,6 +577,11 @@ rl_untranslate_keyseq (seq)
|
||||||
kseq[i++] = '-';
|
kseq[i++] = '-';
|
||||||
c = UNMETA (c);
|
c = UNMETA (c);
|
||||||
}
|
}
|
||||||
|
else if (c == ESC)
|
||||||
|
{
|
||||||
|
kseq[i++] = '\\';
|
||||||
|
c = 'e';
|
||||||
|
}
|
||||||
else if (CTRL_CHAR (c))
|
else if (CTRL_CHAR (c))
|
||||||
{
|
{
|
||||||
kseq[i++] = '\\';
|
kseq[i++] = '\\';
|
||||||
|
@ -613,7 +630,12 @@ _rl_untranslate_macro_value (seq)
|
||||||
*r++ = '-';
|
*r++ = '-';
|
||||||
c = UNMETA (c);
|
c = UNMETA (c);
|
||||||
}
|
}
|
||||||
else if (CTRL_CHAR (c) && c != ESC)
|
else if (c == ESC)
|
||||||
|
{
|
||||||
|
*r++ = '\\';
|
||||||
|
c = 'e';
|
||||||
|
}
|
||||||
|
else if (CTRL_CHAR (c))
|
||||||
{
|
{
|
||||||
*r++ = '\\';
|
*r++ = '\\';
|
||||||
*r++ = 'C';
|
*r++ = 'C';
|
||||||
|
@ -672,7 +694,7 @@ rl_function_of_keyseq (keyseq, map, type)
|
||||||
{
|
{
|
||||||
register int i;
|
register int i;
|
||||||
|
|
||||||
if (!map)
|
if (map == 0)
|
||||||
map = _rl_keymap;
|
map = _rl_keymap;
|
||||||
|
|
||||||
for (i = 0; keyseq && keyseq[i]; i++)
|
for (i = 0; keyseq && keyseq[i]; i++)
|
||||||
|
@ -681,25 +703,27 @@ rl_function_of_keyseq (keyseq, map, type)
|
||||||
|
|
||||||
if (META_CHAR (ic) && _rl_convert_meta_chars_to_ascii)
|
if (META_CHAR (ic) && _rl_convert_meta_chars_to_ascii)
|
||||||
{
|
{
|
||||||
if (map[ESC].type != ISKMAP)
|
if (map[ESC].type == ISKMAP)
|
||||||
|
{
|
||||||
|
map = FUNCTION_TO_KEYMAP (map, ESC);
|
||||||
|
ic = UNMETA (ic);
|
||||||
|
}
|
||||||
|
/* XXX - should we just return NULL here, since this obviously
|
||||||
|
doesn't match? */
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if (type)
|
if (type)
|
||||||
*type = map[ESC].type;
|
*type = map[ESC].type;
|
||||||
|
|
||||||
return (map[ESC].function);
|
return (map[ESC].function);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
map = FUNCTION_TO_KEYMAP (map, ESC);
|
|
||||||
ic = UNMETA (ic);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (map[ic].type == ISKMAP)
|
if (map[ic].type == ISKMAP)
|
||||||
{
|
{
|
||||||
/* If this is the last key in the key sequence, return the
|
/* If this is the last key in the key sequence, return the
|
||||||
map. */
|
map. */
|
||||||
if (!keyseq[i + 1])
|
if (keyseq[i + 1] == '\0')
|
||||||
{
|
{
|
||||||
if (type)
|
if (type)
|
||||||
*type = ISKMAP;
|
*type = ISKMAP;
|
||||||
|
@ -709,7 +733,12 @@ rl_function_of_keyseq (keyseq, map, type)
|
||||||
else
|
else
|
||||||
map = FUNCTION_TO_KEYMAP (map, ic);
|
map = FUNCTION_TO_KEYMAP (map, ic);
|
||||||
}
|
}
|
||||||
else
|
/* If we're not at the end of the key sequence, and the current key
|
||||||
|
is bound to something other than a keymap, then the entire key
|
||||||
|
sequence is not bound. */
|
||||||
|
else if (map[ic].type != ISKMAP && keyseq[i+1])
|
||||||
|
return ((rl_command_func_t *)NULL);
|
||||||
|
else /* map[ic].type != ISKMAP && keyseq[i+1] == 0 */
|
||||||
{
|
{
|
||||||
if (type)
|
if (type)
|
||||||
*type = map[ic].type;
|
*type = map[ic].type;
|
||||||
|
@ -791,6 +820,7 @@ rl_re_read_init_file (count, ignore)
|
||||||
1. the filename used for the previous call
|
1. the filename used for the previous call
|
||||||
2. the value of the shell variable `INPUTRC'
|
2. the value of the shell variable `INPUTRC'
|
||||||
3. ~/.inputrc
|
3. ~/.inputrc
|
||||||
|
4. /etc/inputrc
|
||||||
If the file existed and could be opened and read, 0 is returned,
|
If the file existed and could be opened and read, 0 is returned,
|
||||||
otherwise errno is returned. */
|
otherwise errno is returned. */
|
||||||
int
|
int
|
||||||
|
@ -799,17 +829,18 @@ rl_read_init_file (filename)
|
||||||
{
|
{
|
||||||
/* Default the filename. */
|
/* Default the filename. */
|
||||||
if (filename == 0)
|
if (filename == 0)
|
||||||
|
filename = last_readline_init_file;
|
||||||
|
if (filename == 0)
|
||||||
|
filename = sh_get_env_value ("INPUTRC");
|
||||||
|
if (filename == 0 || *filename == 0)
|
||||||
{
|
{
|
||||||
filename = last_readline_init_file;
|
filename = DEFAULT_INPUTRC;
|
||||||
if (filename == 0)
|
/* Try to read DEFAULT_INPUTRC; fall back to SYS_INPUTRC on failure */
|
||||||
filename = sh_get_env_value ("INPUTRC");
|
if (_rl_read_init_file (filename, 0) == 0)
|
||||||
if (filename == 0)
|
return 0;
|
||||||
filename = DEFAULT_INPUTRC;
|
filename = SYS_INPUTRC;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*filename == 0)
|
|
||||||
filename = DEFAULT_INPUTRC;
|
|
||||||
|
|
||||||
#if defined (__MSDOS__)
|
#if defined (__MSDOS__)
|
||||||
if (_rl_read_init_file (filename, 0) == 0)
|
if (_rl_read_init_file (filename, 0) == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1506,8 +1537,6 @@ rl_variable_value (name)
|
||||||
const char *name;
|
const char *name;
|
||||||
{
|
{
|
||||||
register int i;
|
register int i;
|
||||||
int v;
|
|
||||||
char *ret;
|
|
||||||
|
|
||||||
/* Check for simple variables first. */
|
/* Check for simple variables first. */
|
||||||
i = find_boolean_var (name);
|
i = find_boolean_var (name);
|
||||||
|
@ -1948,12 +1977,16 @@ rl_invoking_keyseqs_in_map (function, map)
|
||||||
char *keyname = (char *)xmalloc (6 + strlen (seqs[i]));
|
char *keyname = (char *)xmalloc (6 + strlen (seqs[i]));
|
||||||
|
|
||||||
if (key == ESC)
|
if (key == ESC)
|
||||||
#if 0
|
{
|
||||||
sprintf (keyname, "\\e");
|
/* If ESC is the meta prefix and we're converting chars
|
||||||
#else
|
with the eighth bit set to ESC-prefixed sequences, then
|
||||||
/* XXX - experimental */
|
we can use \M-. Otherwise we need to use the sequence
|
||||||
sprintf (keyname, "\\M-");
|
for ESC. */
|
||||||
#endif
|
if (_rl_convert_meta_chars_to_ascii && map[ESC].type == ISKMAP)
|
||||||
|
sprintf (keyname, "\\M-");
|
||||||
|
else
|
||||||
|
sprintf (keyname, "\\e");
|
||||||
|
}
|
||||||
else if (CTRL_CHAR (key))
|
else if (CTRL_CHAR (key))
|
||||||
sprintf (keyname, "\\C-%c", _rl_to_lower (UNCTRL (key)));
|
sprintf (keyname, "\\C-%c", _rl_to_lower (UNCTRL (key)));
|
||||||
else if (key == RUBOUT)
|
else if (key == RUBOUT)
|
||||||
|
@ -2170,7 +2203,6 @@ _rl_get_string_variable_value (name)
|
||||||
{
|
{
|
||||||
static char numbuf[32];
|
static char numbuf[32];
|
||||||
char *ret;
|
char *ret;
|
||||||
int n;
|
|
||||||
|
|
||||||
if (_rl_stricmp (name, "bell-style") == 0)
|
if (_rl_stricmp (name, "bell-style") == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
#include "rldefs.h"
|
#include "rldefs.h"
|
||||||
#include "readline.h"
|
#include "readline.h"
|
||||||
#include "rlprivate.h"
|
#include "rlprivate.h"
|
||||||
|
#include "xmalloc.h"
|
||||||
|
|
||||||
/* Private data for callback registration functions. See comments in
|
/* Private data for callback registration functions. See comments in
|
||||||
rl_callback_read_char for more details. */
|
rl_callback_read_char for more details. */
|
||||||
|
@ -124,73 +125,73 @@ rl_callback_read_char ()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RL_ISSTATE (RL_STATE_ISEARCH))
|
do
|
||||||
{
|
{
|
||||||
eof = _rl_isearch_callback (_rl_iscxt);
|
if (RL_ISSTATE (RL_STATE_ISEARCH))
|
||||||
if (eof == 0 && (RL_ISSTATE (RL_STATE_ISEARCH) == 0) && RL_ISSTATE (RL_STATE_INPUTPENDING))
|
|
||||||
rl_callback_read_char ();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (RL_ISSTATE (RL_STATE_NSEARCH))
|
|
||||||
{
|
|
||||||
eof = _rl_nsearch_callback (_rl_nscxt);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (RL_ISSTATE (RL_STATE_NUMERICARG))
|
|
||||||
{
|
|
||||||
eof = _rl_arg_callback (_rl_argcxt);
|
|
||||||
if (eof == 0 && (RL_ISSTATE (RL_STATE_NUMERICARG) == 0) && RL_ISSTATE (RL_STATE_INPUTPENDING))
|
|
||||||
rl_callback_read_char ();
|
|
||||||
/* XXX - this should handle _rl_last_command_was_kill better */
|
|
||||||
else if (RL_ISSTATE (RL_STATE_NUMERICARG) == 0)
|
|
||||||
_rl_internal_char_cleanup ();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (RL_ISSTATE (RL_STATE_MULTIKEY))
|
|
||||||
{
|
|
||||||
eof = _rl_dispatch_callback (_rl_kscxt); /* For now */
|
|
||||||
while ((eof == -1 || eof == -2) && RL_ISSTATE (RL_STATE_MULTIKEY) && _rl_kscxt && (_rl_kscxt->flags & KSEQ_DISPATCHED))
|
|
||||||
eof = _rl_dispatch_callback (_rl_kscxt);
|
|
||||||
if (RL_ISSTATE (RL_STATE_MULTIKEY) == 0)
|
|
||||||
{
|
{
|
||||||
_rl_internal_char_cleanup ();
|
eof = _rl_isearch_callback (_rl_iscxt);
|
||||||
_rl_want_redisplay = 1;
|
if (eof == 0 && (RL_ISSTATE (RL_STATE_ISEARCH) == 0) && RL_ISSTATE (RL_STATE_INPUTPENDING))
|
||||||
|
rl_callback_read_char ();
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
else if (RL_ISSTATE (RL_STATE_NSEARCH))
|
||||||
else if (_rl_callback_func)
|
|
||||||
{
|
|
||||||
/* This allows functions that simply need to read an additional character
|
|
||||||
(like quoted-insert) to register a function to be called when input is
|
|
||||||
available. _rl_callback_data is simply a pointer to a struct that has
|
|
||||||
the argument count originally passed to the registering function and
|
|
||||||
space for any additional parameters. */
|
|
||||||
eof = (*_rl_callback_func) (_rl_callback_data);
|
|
||||||
/* If the function `deregisters' itself, make sure the data is cleaned
|
|
||||||
up. */
|
|
||||||
if (_rl_callback_func == 0)
|
|
||||||
{
|
{
|
||||||
if (_rl_callback_data)
|
eof = _rl_nsearch_callback (_rl_nscxt);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (RL_ISSTATE (RL_STATE_NUMERICARG))
|
||||||
|
{
|
||||||
|
eof = _rl_arg_callback (_rl_argcxt);
|
||||||
|
if (eof == 0 && (RL_ISSTATE (RL_STATE_NUMERICARG) == 0) && RL_ISSTATE (RL_STATE_INPUTPENDING))
|
||||||
|
rl_callback_read_char ();
|
||||||
|
/* XXX - this should handle _rl_last_command_was_kill better */
|
||||||
|
else if (RL_ISSTATE (RL_STATE_NUMERICARG) == 0)
|
||||||
|
_rl_internal_char_cleanup ();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (RL_ISSTATE (RL_STATE_MULTIKEY))
|
||||||
|
{
|
||||||
|
eof = _rl_dispatch_callback (_rl_kscxt); /* For now */
|
||||||
|
while ((eof == -1 || eof == -2) && RL_ISSTATE (RL_STATE_MULTIKEY) && _rl_kscxt && (_rl_kscxt->flags & KSEQ_DISPATCHED))
|
||||||
|
eof = _rl_dispatch_callback (_rl_kscxt);
|
||||||
|
if (RL_ISSTATE (RL_STATE_MULTIKEY) == 0)
|
||||||
{
|
{
|
||||||
_rl_callback_data_dispose (_rl_callback_data);
|
_rl_internal_char_cleanup ();
|
||||||
_rl_callback_data = 0;
|
_rl_want_redisplay = 1;
|
||||||
}
|
}
|
||||||
_rl_internal_char_cleanup ();
|
|
||||||
}
|
}
|
||||||
}
|
else if (_rl_callback_func)
|
||||||
else
|
{
|
||||||
eof = readline_internal_char ();
|
/* This allows functions that simply need to read an additional
|
||||||
|
character (like quoted-insert) to register a function to be
|
||||||
|
called when input is available. _rl_callback_data is simply a
|
||||||
|
pointer to a struct that has the argument count originally
|
||||||
|
passed to the registering function and space for any additional
|
||||||
|
parameters. */
|
||||||
|
eof = (*_rl_callback_func) (_rl_callback_data);
|
||||||
|
/* If the function `deregisters' itself, make sure the data is
|
||||||
|
cleaned up. */
|
||||||
|
if (_rl_callback_func == 0)
|
||||||
|
{
|
||||||
|
if (_rl_callback_data)
|
||||||
|
{
|
||||||
|
_rl_callback_data_dispose (_rl_callback_data);
|
||||||
|
_rl_callback_data = 0;
|
||||||
|
}
|
||||||
|
_rl_internal_char_cleanup ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
eof = readline_internal_char ();
|
||||||
|
|
||||||
if (rl_done == 0 && _rl_want_redisplay)
|
if (rl_done == 0 && _rl_want_redisplay)
|
||||||
{
|
{
|
||||||
(*rl_redisplay_function) ();
|
(*rl_redisplay_function) ();
|
||||||
_rl_want_redisplay = 0;
|
_rl_want_redisplay = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We loop in case some function has pushed input back with rl_execute_next. */
|
|
||||||
for (;;)
|
|
||||||
{
|
|
||||||
if (rl_done)
|
if (rl_done)
|
||||||
{
|
{
|
||||||
line = readline_internal_teardown (eof);
|
line = readline_internal_teardown (eof);
|
||||||
|
@ -212,11 +213,8 @@ rl_callback_read_char ()
|
||||||
if (in_handler == 0 && rl_linefunc)
|
if (in_handler == 0 && rl_linefunc)
|
||||||
_rl_callback_newline ();
|
_rl_callback_newline ();
|
||||||
}
|
}
|
||||||
if (rl_pending_input || _rl_pushed_input_available () || RL_ISSTATE (RL_STATE_MACROINPUT))
|
|
||||||
eof = readline_internal_char ();
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
while (rl_pending_input || _rl_pushed_input_available () || RL_ISSTATE (RL_STATE_MACROINPUT));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remove the handler, and make sure the terminal is in its normal state. */
|
/* Remove the handler, and make sure the terminal is in its normal state. */
|
||||||
|
|
|
@ -950,7 +950,7 @@ gen_completion_matches (text, start, end, our_func, found_quote, quote_char)
|
||||||
rl_compentry_func_t *our_func;
|
rl_compentry_func_t *our_func;
|
||||||
int found_quote, quote_char;
|
int found_quote, quote_char;
|
||||||
{
|
{
|
||||||
char **matches, *temp;
|
char **matches;
|
||||||
|
|
||||||
rl_completion_found_quote = found_quote;
|
rl_completion_found_quote = found_quote;
|
||||||
rl_completion_quote_character = quote_char;
|
rl_completion_quote_character = quote_char;
|
||||||
|
@ -969,21 +969,9 @@ gen_completion_matches (text, start, end, our_func, found_quote, quote_char)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Beware -- we're stripping the quotes here. Do this only if we know
|
/* XXX -- filename dequoting moved into rl_filename_completion_function */
|
||||||
we are doing filename completion and the application has defined a
|
|
||||||
filename dequoting function. */
|
|
||||||
temp = (char *)NULL;
|
|
||||||
|
|
||||||
if (found_quote && our_func == rl_filename_completion_function &&
|
|
||||||
rl_filename_dequoting_function)
|
|
||||||
{
|
|
||||||
/* delete single and double quotes */
|
|
||||||
temp = (*rl_filename_dequoting_function) (text, quote_char);
|
|
||||||
text = temp; /* not freeing text is not a memory leak */
|
|
||||||
}
|
|
||||||
|
|
||||||
matches = rl_completion_matches (text, our_func);
|
matches = rl_completion_matches (text, our_func);
|
||||||
FREE (temp);
|
|
||||||
return matches;
|
return matches;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1116,7 +1104,8 @@ compute_lcd_of_matches (match_list, matches, text)
|
||||||
#if defined (HANDLE_MULTIBYTE)
|
#if defined (HANDLE_MULTIBYTE)
|
||||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||||
{
|
{
|
||||||
mbstate_t ps_back = ps1;
|
mbstate_t ps_back;
|
||||||
|
ps_back = ps1;
|
||||||
if (!_rl_compare_chars (match_list[i], si, &ps1, match_list[i+1], si, &ps2))
|
if (!_rl_compare_chars (match_list[i], si, &ps1, match_list[i+1], si, &ps2))
|
||||||
break;
|
break;
|
||||||
else if ((v = _rl_get_char_len (&match_list[i][si], &ps_back)) > 1)
|
else if ((v = _rl_get_char_len (&match_list[i][si], &ps_back)) > 1)
|
||||||
|
@ -1974,13 +1963,30 @@ rl_filename_completion_function (text, state)
|
||||||
if (rl_directory_rewrite_hook)
|
if (rl_directory_rewrite_hook)
|
||||||
(*rl_directory_rewrite_hook) (&dirname);
|
(*rl_directory_rewrite_hook) (&dirname);
|
||||||
|
|
||||||
|
/* The directory completion hook should perform any necessary
|
||||||
|
dequoting. */
|
||||||
if (rl_directory_completion_hook && (*rl_directory_completion_hook) (&dirname))
|
if (rl_directory_completion_hook && (*rl_directory_completion_hook) (&dirname))
|
||||||
{
|
{
|
||||||
free (users_dirname);
|
free (users_dirname);
|
||||||
users_dirname = savestring (dirname);
|
users_dirname = savestring (dirname);
|
||||||
}
|
}
|
||||||
|
else if (rl_completion_found_quote && rl_filename_dequoting_function)
|
||||||
|
{
|
||||||
|
/* delete single and double quotes */
|
||||||
|
temp = (*rl_filename_dequoting_function) (users_dirname, rl_completion_quote_character);
|
||||||
|
free (users_dirname);
|
||||||
|
users_dirname = temp;
|
||||||
|
}
|
||||||
directory = opendir (dirname);
|
directory = opendir (dirname);
|
||||||
|
|
||||||
|
/* Now dequote a non-null filename. */
|
||||||
|
if (filename && *filename && rl_completion_found_quote && rl_filename_dequoting_function)
|
||||||
|
{
|
||||||
|
/* delete single and double quotes */
|
||||||
|
temp = (*rl_filename_dequoting_function) (filename, rl_completion_quote_character);
|
||||||
|
free (filename);
|
||||||
|
filename = temp;
|
||||||
|
}
|
||||||
filename_len = strlen (filename);
|
filename_len = strlen (filename);
|
||||||
|
|
||||||
rl_filename_completion_desired = 1;
|
rl_filename_completion_desired = 1;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* display.c -- readline redisplay facility. */
|
/* display.c -- readline redisplay facility. */
|
||||||
|
|
||||||
/* Copyright (C) 1987-2005 Free Software Foundation, Inc.
|
/* Copyright (C) 1987-2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of the GNU Readline Library, a library for
|
This file is part of the GNU Readline Library, a library for
|
||||||
reading lines of text with interactive input and history editing.
|
reading lines of text with interactive input and history editing.
|
||||||
|
@ -59,10 +59,6 @@
|
||||||
extern char *strchr (), *strrchr ();
|
extern char *strchr (), *strrchr ();
|
||||||
#endif /* !strchr && !__STDC__ */
|
#endif /* !strchr && !__STDC__ */
|
||||||
|
|
||||||
#if defined (HACK_TERMCAP_MOTION)
|
|
||||||
extern char *_rl_term_forward_char;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void update_line PARAMS((char *, char *, int, int, int, int));
|
static void update_line PARAMS((char *, char *, int, int, int, int));
|
||||||
static void space_to_eol PARAMS((int));
|
static void space_to_eol PARAMS((int));
|
||||||
static void delete_chars PARAMS((int));
|
static void delete_chars PARAMS((int));
|
||||||
|
@ -80,9 +76,18 @@ static int *inv_lbreaks, *vis_lbreaks;
|
||||||
static int inv_lbsize, vis_lbsize;
|
static int inv_lbsize, vis_lbsize;
|
||||||
|
|
||||||
/* Heuristic used to decide whether it is faster to move from CUR to NEW
|
/* Heuristic used to decide whether it is faster to move from CUR to NEW
|
||||||
by backing up or outputting a carriage return and moving forward. */
|
by backing up or outputting a carriage return and moving forward. CUR
|
||||||
|
and NEW are either both buffer positions or absolute screen positions. */
|
||||||
#define CR_FASTER(new, cur) (((new) + 1) < ((cur) - (new)))
|
#define CR_FASTER(new, cur) (((new) + 1) < ((cur) - (new)))
|
||||||
|
|
||||||
|
/* _rl_last_c_pos is an absolute cursor position in multibyte locales and a
|
||||||
|
buffer index in others. This macro is used when deciding whether the
|
||||||
|
current cursor position is in the middle of a prompt string containing
|
||||||
|
invisible characters. */
|
||||||
|
#define PROMPT_ENDING_INDEX \
|
||||||
|
((MB_CUR_MAX > 1 && rl_byte_oriented == 0) ? prompt_physical_chars : prompt_last_invisible+1)
|
||||||
|
|
||||||
|
|
||||||
/* **************************************************************** */
|
/* **************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* Display stuff */
|
/* Display stuff */
|
||||||
|
@ -135,6 +140,7 @@ int _rl_last_c_pos = 0;
|
||||||
int _rl_last_v_pos = 0;
|
int _rl_last_v_pos = 0;
|
||||||
|
|
||||||
static int cpos_adjusted;
|
static int cpos_adjusted;
|
||||||
|
static int cpos_buffer_position;
|
||||||
|
|
||||||
/* Number of lines currently on screen minus 1. */
|
/* Number of lines currently on screen minus 1. */
|
||||||
int _rl_vis_botlin = 0;
|
int _rl_vis_botlin = 0;
|
||||||
|
@ -162,6 +168,7 @@ static int line_size = 1024;
|
||||||
include invisible characters. */
|
include invisible characters. */
|
||||||
|
|
||||||
static char *local_prompt, *local_prompt_prefix;
|
static char *local_prompt, *local_prompt_prefix;
|
||||||
|
static int local_prompt_len;
|
||||||
static int prompt_visible_length, prompt_prefix_length;
|
static int prompt_visible_length, prompt_prefix_length;
|
||||||
|
|
||||||
/* The number of invisible characters in the line currently being
|
/* The number of invisible characters in the line currently being
|
||||||
|
@ -197,6 +204,7 @@ static char *saved_local_prefix;
|
||||||
static int saved_last_invisible;
|
static int saved_last_invisible;
|
||||||
static int saved_visible_length;
|
static int saved_visible_length;
|
||||||
static int saved_prefix_length;
|
static int saved_prefix_length;
|
||||||
|
static int saved_local_length;
|
||||||
static int saved_invis_chars_first_line;
|
static int saved_invis_chars_first_line;
|
||||||
static int saved_physical_chars;
|
static int saved_physical_chars;
|
||||||
|
|
||||||
|
@ -220,7 +228,7 @@ expand_prompt (pmt, lp, lip, niflp, vlp)
|
||||||
char *pmt;
|
char *pmt;
|
||||||
int *lp, *lip, *niflp, *vlp;
|
int *lp, *lip, *niflp, *vlp;
|
||||||
{
|
{
|
||||||
char *r, *ret, *p;
|
char *r, *ret, *p, *igstart;
|
||||||
int l, rl, last, ignoring, ninvis, invfl, invflset, ind, pind, physchars;
|
int l, rl, last, ignoring, ninvis, invfl, invflset, ind, pind, physchars;
|
||||||
|
|
||||||
/* Short-circuit if we can. */
|
/* Short-circuit if we can. */
|
||||||
|
@ -244,19 +252,21 @@ expand_prompt (pmt, lp, lip, niflp, vlp)
|
||||||
invfl = 0; /* invisible chars in first line of prompt */
|
invfl = 0; /* invisible chars in first line of prompt */
|
||||||
invflset = 0; /* we only want to set invfl once */
|
invflset = 0; /* we only want to set invfl once */
|
||||||
|
|
||||||
|
igstart = 0;
|
||||||
for (rl = ignoring = last = ninvis = physchars = 0, p = pmt; p && *p; p++)
|
for (rl = ignoring = last = ninvis = physchars = 0, p = pmt; p && *p; p++)
|
||||||
{
|
{
|
||||||
/* This code strips the invisible character string markers
|
/* This code strips the invisible character string markers
|
||||||
RL_PROMPT_START_IGNORE and RL_PROMPT_END_IGNORE */
|
RL_PROMPT_START_IGNORE and RL_PROMPT_END_IGNORE */
|
||||||
if (*p == RL_PROMPT_START_IGNORE)
|
if (ignoring == 0 && *p == RL_PROMPT_START_IGNORE) /* XXX - check ignoring? */
|
||||||
{
|
{
|
||||||
ignoring++;
|
ignoring = 1;
|
||||||
|
igstart = p;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (ignoring && *p == RL_PROMPT_END_IGNORE)
|
else if (ignoring && *p == RL_PROMPT_END_IGNORE)
|
||||||
{
|
{
|
||||||
ignoring = 0;
|
ignoring = 0;
|
||||||
if (p[-1] != RL_PROMPT_START_IGNORE)
|
if (p != (igstart + 1))
|
||||||
last = r - ret - 1;
|
last = r - ret - 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -356,6 +366,7 @@ rl_expand_prompt (prompt)
|
||||||
FREE (local_prompt_prefix);
|
FREE (local_prompt_prefix);
|
||||||
|
|
||||||
local_prompt = local_prompt_prefix = (char *)0;
|
local_prompt = local_prompt_prefix = (char *)0;
|
||||||
|
local_prompt_len = 0;
|
||||||
prompt_last_invisible = prompt_invis_chars_first_line = 0;
|
prompt_last_invisible = prompt_invis_chars_first_line = 0;
|
||||||
prompt_visible_length = prompt_physical_chars = 0;
|
prompt_visible_length = prompt_physical_chars = 0;
|
||||||
|
|
||||||
|
@ -371,6 +382,7 @@ rl_expand_prompt (prompt)
|
||||||
&prompt_invis_chars_first_line,
|
&prompt_invis_chars_first_line,
|
||||||
&prompt_physical_chars);
|
&prompt_physical_chars);
|
||||||
local_prompt_prefix = (char *)0;
|
local_prompt_prefix = (char *)0;
|
||||||
|
local_prompt_len = local_prompt ? strlen (local_prompt) : 0;
|
||||||
return (prompt_visible_length);
|
return (prompt_visible_length);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -389,6 +401,7 @@ rl_expand_prompt (prompt)
|
||||||
&prompt_invis_chars_first_line,
|
&prompt_invis_chars_first_line,
|
||||||
(int *)NULL);
|
(int *)NULL);
|
||||||
*t = c;
|
*t = c;
|
||||||
|
local_prompt_len = local_prompt ? strlen (local_prompt) : 0;
|
||||||
return (prompt_prefix_length);
|
return (prompt_prefix_length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -445,7 +458,7 @@ rl_redisplay ()
|
||||||
{
|
{
|
||||||
register int in, out, c, linenum, cursor_linenum;
|
register int in, out, c, linenum, cursor_linenum;
|
||||||
register char *line;
|
register char *line;
|
||||||
int c_pos, inv_botlin, lb_botlin, lb_linenum, o_cpos;
|
int inv_botlin, lb_botlin, lb_linenum, o_cpos;
|
||||||
int newlines, lpos, temp, modmark, n0, num;
|
int newlines, lpos, temp, modmark, n0, num;
|
||||||
char *prompt_this_line;
|
char *prompt_this_line;
|
||||||
#if defined (HANDLE_MULTIBYTE)
|
#if defined (HANDLE_MULTIBYTE)
|
||||||
|
@ -469,7 +482,7 @@ rl_redisplay ()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Draw the line into the buffer. */
|
/* Draw the line into the buffer. */
|
||||||
c_pos = -1;
|
cpos_buffer_position = -1;
|
||||||
|
|
||||||
line = invisible_line;
|
line = invisible_line;
|
||||||
out = inv_botlin = 0;
|
out = inv_botlin = 0;
|
||||||
|
@ -496,24 +509,23 @@ rl_redisplay ()
|
||||||
number of non-visible characters in the prompt string. */
|
number of non-visible characters in the prompt string. */
|
||||||
if (rl_display_prompt == rl_prompt || local_prompt)
|
if (rl_display_prompt == rl_prompt || local_prompt)
|
||||||
{
|
{
|
||||||
int local_len = local_prompt ? strlen (local_prompt) : 0;
|
|
||||||
if (local_prompt_prefix && forced_display)
|
if (local_prompt_prefix && forced_display)
|
||||||
_rl_output_some_chars (local_prompt_prefix, strlen (local_prompt_prefix));
|
_rl_output_some_chars (local_prompt_prefix, strlen (local_prompt_prefix));
|
||||||
|
|
||||||
if (local_len > 0)
|
if (local_prompt_len > 0)
|
||||||
{
|
{
|
||||||
temp = local_len + out + 2;
|
temp = local_prompt_len + out + 2;
|
||||||
if (temp >= line_size)
|
if (temp >= line_size)
|
||||||
{
|
{
|
||||||
line_size = (temp + 1024) - (temp % 1024);
|
line_size = (temp + 1024) - (temp % 1024);
|
||||||
visible_line = (char *)xrealloc (visible_line, line_size);
|
visible_line = (char *)xrealloc (visible_line, line_size);
|
||||||
line = invisible_line = (char *)xrealloc (invisible_line, line_size);
|
line = invisible_line = (char *)xrealloc (invisible_line, line_size);
|
||||||
}
|
}
|
||||||
strncpy (line + out, local_prompt, local_len);
|
strncpy (line + out, local_prompt, local_prompt_len);
|
||||||
out += local_len;
|
out += local_prompt_len;
|
||||||
}
|
}
|
||||||
line[out] = '\0';
|
line[out] = '\0';
|
||||||
wrap_offset = local_len - prompt_visible_length;
|
wrap_offset = local_prompt_len - prompt_visible_length;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -614,6 +626,7 @@ rl_redisplay ()
|
||||||
contents of the command line? */
|
contents of the command line? */
|
||||||
while (lpos >= _rl_screenwidth)
|
while (lpos >= _rl_screenwidth)
|
||||||
{
|
{
|
||||||
|
int z;
|
||||||
/* fix from Darin Johnson <darin@acuson.com> for prompt string with
|
/* fix from Darin Johnson <darin@acuson.com> for prompt string with
|
||||||
invisible characters that is longer than the screen width. The
|
invisible characters that is longer than the screen width. The
|
||||||
prompt_invis_chars_first_line variable could be made into an array
|
prompt_invis_chars_first_line variable could be made into an array
|
||||||
|
@ -622,37 +635,46 @@ rl_redisplay ()
|
||||||
prompts that exceed two physical lines?
|
prompts that exceed two physical lines?
|
||||||
Additional logic fix from Edward Catmur <ed@catmur.co.uk> */
|
Additional logic fix from Edward Catmur <ed@catmur.co.uk> */
|
||||||
#if defined (HANDLE_MULTIBYTE)
|
#if defined (HANDLE_MULTIBYTE)
|
||||||
n0 = num;
|
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||||
temp = local_prompt ? strlen (local_prompt) : 0;
|
|
||||||
while (num < temp)
|
|
||||||
{
|
{
|
||||||
if (_rl_col_width (local_prompt, n0, num) > _rl_screenwidth)
|
n0 = num;
|
||||||
|
temp = local_prompt_len;
|
||||||
|
while (num < temp)
|
||||||
{
|
{
|
||||||
num = _rl_find_prev_mbchar (local_prompt, num, MB_FIND_ANY);
|
z = _rl_col_width (local_prompt, n0, num);
|
||||||
break;
|
if (z > _rl_screenwidth)
|
||||||
|
{
|
||||||
|
num = _rl_find_prev_mbchar (local_prompt, num, MB_FIND_ANY);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if (z == _rl_screenwidth)
|
||||||
|
break;
|
||||||
|
num++;
|
||||||
}
|
}
|
||||||
num++;
|
temp = num;
|
||||||
}
|
}
|
||||||
temp = num +
|
else
|
||||||
#else
|
|
||||||
temp = ((newlines + 1) * _rl_screenwidth) +
|
|
||||||
#endif /* !HANDLE_MULTIBYTE */
|
#endif /* !HANDLE_MULTIBYTE */
|
||||||
((local_prompt_prefix == 0) ? ((newlines == 0) ? prompt_invis_chars_first_line
|
temp = ((newlines + 1) * _rl_screenwidth);
|
||||||
: ((newlines == 1) ? wrap_offset : 0))
|
|
||||||
: ((newlines == 0) ? wrap_offset :0));
|
/* Now account for invisible characters in the current line. */
|
||||||
|
temp += ((local_prompt_prefix == 0) ? ((newlines == 0) ? prompt_invis_chars_first_line
|
||||||
|
: ((newlines == 1) ? wrap_offset : 0))
|
||||||
|
: ((newlines == 0) ? wrap_offset :0));
|
||||||
|
|
||||||
inv_lbreaks[++newlines] = temp;
|
inv_lbreaks[++newlines] = temp;
|
||||||
#if defined (HANDLE_MULTIBYTE)
|
#if defined (HANDLE_MULTIBYTE)
|
||||||
lpos -= _rl_col_width (local_prompt, n0, num);
|
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||||
#else
|
lpos -= _rl_col_width (local_prompt, n0, num);
|
||||||
lpos -= _rl_screenwidth;
|
else
|
||||||
#endif
|
#endif
|
||||||
|
lpos -= _rl_screenwidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
prompt_last_screen_line = newlines;
|
prompt_last_screen_line = newlines;
|
||||||
|
|
||||||
/* Draw the rest of the line (after the prompt) into invisible_line, keeping
|
/* Draw the rest of the line (after the prompt) into invisible_line, keeping
|
||||||
track of where the cursor is (c_pos), the number of the line containing
|
track of where the cursor is (cpos_buffer_position), the number of the line containing
|
||||||
the cursor (lb_linenum), the last line number (lb_botlin and inv_botlin).
|
the cursor (lb_linenum), the last line number (lb_botlin and inv_botlin).
|
||||||
It maintains an array of line breaks for display (inv_lbreaks).
|
It maintains an array of line breaks for display (inv_lbreaks).
|
||||||
This handles expanding tabs for display and displaying meta characters. */
|
This handles expanding tabs for display and displaying meta characters. */
|
||||||
|
@ -705,7 +727,7 @@ rl_redisplay ()
|
||||||
|
|
||||||
if (in == rl_point)
|
if (in == rl_point)
|
||||||
{
|
{
|
||||||
c_pos = out;
|
cpos_buffer_position = out;
|
||||||
lb_linenum = newlines;
|
lb_linenum = newlines;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -799,7 +821,7 @@ rl_redisplay ()
|
||||||
}
|
}
|
||||||
if (in == rl_point)
|
if (in == rl_point)
|
||||||
{
|
{
|
||||||
c_pos = out;
|
cpos_buffer_position = out;
|
||||||
lb_linenum = newlines;
|
lb_linenum = newlines;
|
||||||
}
|
}
|
||||||
for (i = in; i < in+wc_bytes; i++)
|
for (i = in; i < in+wc_bytes; i++)
|
||||||
|
@ -830,9 +852,9 @@ rl_redisplay ()
|
||||||
|
|
||||||
}
|
}
|
||||||
line[out] = '\0';
|
line[out] = '\0';
|
||||||
if (c_pos < 0)
|
if (cpos_buffer_position < 0)
|
||||||
{
|
{
|
||||||
c_pos = out;
|
cpos_buffer_position = out;
|
||||||
lb_linenum = newlines;
|
lb_linenum = newlines;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -841,7 +863,7 @@ rl_redisplay ()
|
||||||
inv_lbreaks[newlines+1] = out;
|
inv_lbreaks[newlines+1] = out;
|
||||||
cursor_linenum = lb_linenum;
|
cursor_linenum = lb_linenum;
|
||||||
|
|
||||||
/* C_POS == position in buffer where cursor should be placed.
|
/* CPOS_BUFFER_POSITION == position in buffer where cursor should be placed.
|
||||||
CURSOR_LINENUM == line number where the cursor should be placed. */
|
CURSOR_LINENUM == line number where the cursor should be placed. */
|
||||||
|
|
||||||
/* PWP: now is when things get a bit hairy. The visible and invisible
|
/* PWP: now is when things get a bit hairy. The visible and invisible
|
||||||
|
@ -886,6 +908,8 @@ rl_redisplay ()
|
||||||
/* For each line in the buffer, do the updating display. */
|
/* For each line in the buffer, do the updating display. */
|
||||||
for (linenum = 0; linenum <= inv_botlin; linenum++)
|
for (linenum = 0; linenum <= inv_botlin; linenum++)
|
||||||
{
|
{
|
||||||
|
/* This can lead us astray if we execute a program that changes
|
||||||
|
the locale from a non-multibyte to a multibyte one. */
|
||||||
o_cpos = _rl_last_c_pos;
|
o_cpos = _rl_last_c_pos;
|
||||||
cpos_adjusted = 0;
|
cpos_adjusted = 0;
|
||||||
update_line (VIS_LINE(linenum), INV_LINE(linenum), linenum,
|
update_line (VIS_LINE(linenum), INV_LINE(linenum), linenum,
|
||||||
|
@ -898,7 +922,11 @@ rl_redisplay ()
|
||||||
change update_line itself. There is one case in which
|
change update_line itself. There is one case in which
|
||||||
update_line adjusts _rl_last_c_pos itself (so it can pass
|
update_line adjusts _rl_last_c_pos itself (so it can pass
|
||||||
_rl_move_cursor_relative accurate values); it communicates
|
_rl_move_cursor_relative accurate values); it communicates
|
||||||
this back by setting cpos_adjusted */
|
this back by setting cpos_adjusted. If we assume that
|
||||||
|
_rl_last_c_pos is correct (an absolute cursor position) each
|
||||||
|
time update_line is called, then we can assume in our
|
||||||
|
calculations that o_cpos does not need to be adjusted by
|
||||||
|
wrap_offset. */
|
||||||
if (linenum == 0 && (MB_CUR_MAX > 1 && rl_byte_oriented == 0) &&
|
if (linenum == 0 && (MB_CUR_MAX > 1 && rl_byte_oriented == 0) &&
|
||||||
cpos_adjusted == 0 &&
|
cpos_adjusted == 0 &&
|
||||||
_rl_last_c_pos != o_cpos &&
|
_rl_last_c_pos != o_cpos &&
|
||||||
|
@ -967,7 +995,11 @@ rl_redisplay ()
|
||||||
invisible character in the prompt string. */
|
invisible character in the prompt string. */
|
||||||
nleft = prompt_visible_length + wrap_offset;
|
nleft = prompt_visible_length + wrap_offset;
|
||||||
if (cursor_linenum == 0 && wrap_offset > 0 && _rl_last_c_pos > 0 &&
|
if (cursor_linenum == 0 && wrap_offset > 0 && _rl_last_c_pos > 0 &&
|
||||||
_rl_last_c_pos <= prompt_last_invisible && local_prompt)
|
#if 0
|
||||||
|
_rl_last_c_pos <= PROMPT_ENDING_INDEX && local_prompt)
|
||||||
|
#else
|
||||||
|
_rl_last_c_pos < PROMPT_ENDING_INDEX && local_prompt)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
#if defined (__MSDOS__)
|
#if defined (__MSDOS__)
|
||||||
putc ('\r', rl_outstream);
|
putc ('\r', rl_outstream);
|
||||||
|
@ -986,8 +1018,8 @@ rl_redisplay ()
|
||||||
in the buffer? */
|
in the buffer? */
|
||||||
pos = inv_lbreaks[cursor_linenum];
|
pos = inv_lbreaks[cursor_linenum];
|
||||||
/* nleft == number of characters in the line buffer between the
|
/* nleft == number of characters in the line buffer between the
|
||||||
start of the line and the cursor position. */
|
start of the line and the desired cursor position. */
|
||||||
nleft = c_pos - pos;
|
nleft = cpos_buffer_position - pos;
|
||||||
|
|
||||||
/* NLEFT is now a number of characters in a buffer. When in a
|
/* NLEFT is now a number of characters in a buffer. When in a
|
||||||
multibyte locale, however, _rl_last_c_pos is an absolute cursor
|
multibyte locale, however, _rl_last_c_pos is an absolute cursor
|
||||||
|
@ -999,6 +1031,7 @@ rl_redisplay ()
|
||||||
those characters here and call _rl_backspace() directly. */
|
those characters here and call _rl_backspace() directly. */
|
||||||
if (wrap_offset && cursor_linenum == 0 && nleft < _rl_last_c_pos)
|
if (wrap_offset && cursor_linenum == 0 && nleft < _rl_last_c_pos)
|
||||||
{
|
{
|
||||||
|
/* TX == new physical cursor position in multibyte locale. */
|
||||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||||
tx = _rl_col_width (&visible_line[pos], 0, nleft) - visible_wrap_offset;
|
tx = _rl_col_width (&visible_line[pos], 0, nleft) - visible_wrap_offset;
|
||||||
else
|
else
|
||||||
|
@ -1032,11 +1065,11 @@ rl_redisplay ()
|
||||||
will be LMARGIN. */
|
will be LMARGIN. */
|
||||||
|
|
||||||
/* The number of characters that will be displayed before the cursor. */
|
/* The number of characters that will be displayed before the cursor. */
|
||||||
ndisp = c_pos - wrap_offset;
|
ndisp = cpos_buffer_position - wrap_offset;
|
||||||
nleft = prompt_visible_length + wrap_offset;
|
nleft = prompt_visible_length + wrap_offset;
|
||||||
/* Where the new cursor position will be on the screen. This can be
|
/* Where the new cursor position will be on the screen. This can be
|
||||||
longer than SCREENWIDTH; if it is, lmargin will be adjusted. */
|
longer than SCREENWIDTH; if it is, lmargin will be adjusted. */
|
||||||
phys_c_pos = c_pos - (last_lmargin ? last_lmargin : wrap_offset);
|
phys_c_pos = cpos_buffer_position - (last_lmargin ? last_lmargin : wrap_offset);
|
||||||
t = _rl_screenwidth / 3;
|
t = _rl_screenwidth / 3;
|
||||||
|
|
||||||
/* If the number of characters had already exceeded the screenwidth,
|
/* If the number of characters had already exceeded the screenwidth,
|
||||||
|
@ -1047,7 +1080,7 @@ rl_redisplay ()
|
||||||
two-thirds of the way across the screen. */
|
two-thirds of the way across the screen. */
|
||||||
if (phys_c_pos > _rl_screenwidth - 2)
|
if (phys_c_pos > _rl_screenwidth - 2)
|
||||||
{
|
{
|
||||||
lmargin = c_pos - (2 * t);
|
lmargin = cpos_buffer_position - (2 * t);
|
||||||
if (lmargin < 0)
|
if (lmargin < 0)
|
||||||
lmargin = 0;
|
lmargin = 0;
|
||||||
/* If the left margin would be in the middle of a prompt with
|
/* If the left margin would be in the middle of a prompt with
|
||||||
|
@ -1061,7 +1094,7 @@ rl_redisplay ()
|
||||||
{
|
{
|
||||||
/* If we are moving back towards the beginning of the line and
|
/* If we are moving back towards the beginning of the line and
|
||||||
the last margin is no longer correct, compute a new one. */
|
the last margin is no longer correct, compute a new one. */
|
||||||
lmargin = ((c_pos - 1) / t) * t; /* XXX */
|
lmargin = ((cpos_buffer_position - 1) / t) * t; /* XXX */
|
||||||
if (wrap_offset && lmargin > 0 && lmargin < nleft)
|
if (wrap_offset && lmargin > 0 && lmargin < nleft)
|
||||||
lmargin = nleft;
|
lmargin = nleft;
|
||||||
}
|
}
|
||||||
|
@ -1106,7 +1139,7 @@ rl_redisplay ()
|
||||||
if (visible_first_line_len > _rl_screenwidth)
|
if (visible_first_line_len > _rl_screenwidth)
|
||||||
visible_first_line_len = _rl_screenwidth;
|
visible_first_line_len = _rl_screenwidth;
|
||||||
|
|
||||||
_rl_move_cursor_relative (c_pos - lmargin, &invisible_line[lmargin]);
|
_rl_move_cursor_relative (cpos_buffer_position - lmargin, &invisible_line[lmargin]);
|
||||||
last_lmargin = lmargin;
|
last_lmargin = lmargin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1164,7 +1197,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
|
||||||
int col_lendiff, col_temp;
|
int col_lendiff, col_temp;
|
||||||
#if defined (HANDLE_MULTIBYTE)
|
#if defined (HANDLE_MULTIBYTE)
|
||||||
mbstate_t ps_new, ps_old;
|
mbstate_t ps_new, ps_old;
|
||||||
int new_offset, old_offset, tmp;
|
int new_offset, old_offset;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* If we're at the right edge of a terminal that supports xn, we're
|
/* If we're at the right edge of a terminal that supports xn, we're
|
||||||
|
@ -1397,11 +1430,11 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
|
||||||
sequences (like drawing the `unbold' sequence without a corresponding
|
sequences (like drawing the `unbold' sequence without a corresponding
|
||||||
`bold') that manifests itself on certain terminals. */
|
`bold') that manifests itself on certain terminals. */
|
||||||
|
|
||||||
lendiff = local_prompt ? strlen (local_prompt) : 0;
|
lendiff = local_prompt_len;
|
||||||
od = ofd - old; /* index of first difference in visible line */
|
od = ofd - old; /* index of first difference in visible line */
|
||||||
if (current_line == 0 && !_rl_horizontal_scroll_mode &&
|
if (current_line == 0 && !_rl_horizontal_scroll_mode &&
|
||||||
_rl_term_cr && lendiff > prompt_visible_length && _rl_last_c_pos > 0 &&
|
_rl_term_cr && lendiff > prompt_visible_length && _rl_last_c_pos > 0 &&
|
||||||
od >= lendiff && _rl_last_c_pos <= prompt_last_invisible)
|
od >= lendiff && _rl_last_c_pos < PROMPT_ENDING_INDEX)
|
||||||
{
|
{
|
||||||
#if defined (__MSDOS__)
|
#if defined (__MSDOS__)
|
||||||
putc ('\r', rl_outstream);
|
putc ('\r', rl_outstream);
|
||||||
|
@ -1420,7 +1453,19 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
|
||||||
_rl_last_c_pos = lendiff;
|
_rl_last_c_pos = lendiff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* When this function returns, _rl_last_c_pos is correct, and an absolute
|
||||||
|
cursor postion in multibyte mode, but a buffer index when not in a
|
||||||
|
multibyte locale. */
|
||||||
_rl_move_cursor_relative (od, old);
|
_rl_move_cursor_relative (od, old);
|
||||||
|
#if 1
|
||||||
|
#if defined (HANDLE_MULTIBYTE)
|
||||||
|
/* We need to indicate that the cursor position is correct in the presence of
|
||||||
|
invisible characters in the prompt string. Let's see if setting this when
|
||||||
|
we make sure we're at the end of the drawn prompt string works. */
|
||||||
|
if (current_line == 0 && MB_CUR_MAX > 1 && rl_byte_oriented == 0 && _rl_last_c_pos == prompt_physical_chars)
|
||||||
|
cpos_adjusted = 1;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/* if (len (new) > len (old))
|
/* if (len (new) > len (old))
|
||||||
lendiff == difference in buffer
|
lendiff == difference in buffer
|
||||||
|
@ -1648,10 +1693,11 @@ rl_on_new_line_with_prompt ()
|
||||||
int
|
int
|
||||||
rl_forced_update_display ()
|
rl_forced_update_display ()
|
||||||
{
|
{
|
||||||
|
register char *temp;
|
||||||
|
|
||||||
if (visible_line)
|
if (visible_line)
|
||||||
{
|
{
|
||||||
register char *temp = visible_line;
|
temp = visible_line;
|
||||||
|
|
||||||
while (*temp)
|
while (*temp)
|
||||||
*temp++ = '\0';
|
*temp++ = '\0';
|
||||||
}
|
}
|
||||||
|
@ -1686,8 +1732,14 @@ _rl_move_cursor_relative (new, data)
|
||||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||||
{
|
{
|
||||||
dpos = _rl_col_width (data, 0, new);
|
dpos = _rl_col_width (data, 0, new);
|
||||||
if (dpos > woff)
|
if (dpos > prompt_last_invisible) /* XXX - don't use woff here */
|
||||||
dpos -= woff;
|
{
|
||||||
|
dpos -= woff;
|
||||||
|
/* Since this will be assigned to _rl_last_c_pos at the end (more
|
||||||
|
precisely, _rl_last_c_pos == dpos when this function returns),
|
||||||
|
let the caller know. */
|
||||||
|
cpos_adjusted = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
@ -1706,7 +1758,7 @@ _rl_move_cursor_relative (new, data)
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
i = _rl_last_c_pos - woff;
|
i = _rl_last_c_pos - woff;
|
||||||
if (new == 0 || CR_FASTER (new, _rl_last_c_pos) ||
|
if (dpos == 0 || CR_FASTER (dpos, _rl_last_c_pos) ||
|
||||||
(_rl_term_autowrap && i == _rl_screenwidth))
|
(_rl_term_autowrap && i == _rl_screenwidth))
|
||||||
{
|
{
|
||||||
#if defined (__MSDOS__)
|
#if defined (__MSDOS__)
|
||||||
|
@ -1728,19 +1780,27 @@ _rl_move_cursor_relative (new, data)
|
||||||
sequence telling the terminal to move forward one character.
|
sequence telling the terminal to move forward one character.
|
||||||
That kind of control is for people who don't know what the
|
That kind of control is for people who don't know what the
|
||||||
data is underneath the cursor. */
|
data is underneath the cursor. */
|
||||||
#if defined (HACK_TERMCAP_MOTION)
|
|
||||||
if (_rl_term_forward_char)
|
/* However, we need a handle on where the current display position is
|
||||||
{
|
in the buffer for the immediately preceding comment to be true.
|
||||||
for (i = cpos; i < dpos; i++)
|
In multibyte locales, we don't currently have that info available.
|
||||||
tputs (_rl_term_forward_char, 1, _rl_output_character_function);
|
Without it, we don't know where the data we have to display begins
|
||||||
}
|
in the buffer and we have to go back to the beginning of the screen
|
||||||
else
|
line. In this case, we can use the terminal sequence to move forward
|
||||||
#endif /* HACK_TERMCAP_MOTION */
|
if it's available. */
|
||||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||||
{
|
{
|
||||||
tputs (_rl_term_cr, 1, _rl_output_character_function);
|
if (_rl_term_forward_char)
|
||||||
for (i = 0; i < new; i++)
|
{
|
||||||
putc (data[i], rl_outstream);
|
for (i = cpos; i < dpos; i++)
|
||||||
|
tputs (_rl_term_forward_char, 1, _rl_output_character_function);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tputs (_rl_term_cr, 1, _rl_output_character_function);
|
||||||
|
for (i = 0; i < new; i++)
|
||||||
|
putc (data[i], rl_outstream);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
for (i = cpos; i < new; i++)
|
for (i = cpos; i < new; i++)
|
||||||
|
@ -1889,6 +1949,7 @@ rl_message (va_alist)
|
||||||
&prompt_invis_chars_first_line,
|
&prompt_invis_chars_first_line,
|
||||||
&prompt_physical_chars);
|
&prompt_physical_chars);
|
||||||
local_prompt_prefix = (char *)NULL;
|
local_prompt_prefix = (char *)NULL;
|
||||||
|
local_prompt_len = local_prompt ? strlen (local_prompt) : 0;
|
||||||
(*rl_redisplay_function) ();
|
(*rl_redisplay_function) ();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1912,6 +1973,7 @@ rl_message (format, arg1, arg2)
|
||||||
&prompt_invis_chars_first_line,
|
&prompt_invis_chars_first_line,
|
||||||
&prompt_physical_chars);
|
&prompt_physical_chars);
|
||||||
local_prompt_prefix = (char *)NULL;
|
local_prompt_prefix = (char *)NULL;
|
||||||
|
local_prompt_len = local_prompt ? strlen (local_prompt) : 0;
|
||||||
(*rl_redisplay_function) ();
|
(*rl_redisplay_function) ();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1948,12 +2010,14 @@ rl_save_prompt ()
|
||||||
saved_local_prompt = local_prompt;
|
saved_local_prompt = local_prompt;
|
||||||
saved_local_prefix = local_prompt_prefix;
|
saved_local_prefix = local_prompt_prefix;
|
||||||
saved_prefix_length = prompt_prefix_length;
|
saved_prefix_length = prompt_prefix_length;
|
||||||
|
saved_local_length = local_prompt_len;
|
||||||
saved_last_invisible = prompt_last_invisible;
|
saved_last_invisible = prompt_last_invisible;
|
||||||
saved_visible_length = prompt_visible_length;
|
saved_visible_length = prompt_visible_length;
|
||||||
saved_invis_chars_first_line = prompt_invis_chars_first_line;
|
saved_invis_chars_first_line = prompt_invis_chars_first_line;
|
||||||
saved_physical_chars = prompt_physical_chars;
|
saved_physical_chars = prompt_physical_chars;
|
||||||
|
|
||||||
local_prompt = local_prompt_prefix = (char *)0;
|
local_prompt = local_prompt_prefix = (char *)0;
|
||||||
|
local_prompt_len = 0;
|
||||||
prompt_last_invisible = prompt_visible_length = prompt_prefix_length = 0;
|
prompt_last_invisible = prompt_visible_length = prompt_prefix_length = 0;
|
||||||
prompt_invis_chars_first_line = prompt_physical_chars = 0;
|
prompt_invis_chars_first_line = prompt_physical_chars = 0;
|
||||||
}
|
}
|
||||||
|
@ -1966,6 +2030,7 @@ rl_restore_prompt ()
|
||||||
|
|
||||||
local_prompt = saved_local_prompt;
|
local_prompt = saved_local_prompt;
|
||||||
local_prompt_prefix = saved_local_prefix;
|
local_prompt_prefix = saved_local_prefix;
|
||||||
|
local_prompt_len = saved_local_length;
|
||||||
prompt_prefix_length = saved_prefix_length;
|
prompt_prefix_length = saved_prefix_length;
|
||||||
prompt_last_invisible = saved_last_invisible;
|
prompt_last_invisible = saved_last_invisible;
|
||||||
prompt_visible_length = saved_visible_length;
|
prompt_visible_length = saved_visible_length;
|
||||||
|
@ -1974,6 +2039,7 @@ rl_restore_prompt ()
|
||||||
|
|
||||||
/* can test saved_local_prompt to see if prompt info has been saved. */
|
/* can test saved_local_prompt to see if prompt info has been saved. */
|
||||||
saved_local_prompt = saved_local_prefix = (char *)0;
|
saved_local_prompt = saved_local_prefix = (char *)0;
|
||||||
|
saved_local_length = 0;
|
||||||
saved_last_invisible = saved_visible_length = saved_prefix_length = 0;
|
saved_last_invisible = saved_visible_length = saved_prefix_length = 0;
|
||||||
saved_invis_chars_first_line = saved_physical_chars = 0;
|
saved_invis_chars_first_line = saved_physical_chars = 0;
|
||||||
}
|
}
|
||||||
|
@ -1983,11 +2049,15 @@ _rl_make_prompt_for_search (pchar)
|
||||||
int pchar;
|
int pchar;
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
char *pmt;
|
char *pmt, *p;
|
||||||
|
|
||||||
rl_save_prompt ();
|
rl_save_prompt ();
|
||||||
|
|
||||||
if (saved_local_prompt == 0)
|
/* We've saved the prompt, and can do anything with the various prompt
|
||||||
|
strings we need before they're restored. We want the unexpanded
|
||||||
|
portion of the prompt string after any final newline. */
|
||||||
|
p = rl_prompt ? strrchr (rl_prompt, '\n') : 0;
|
||||||
|
if (p == 0)
|
||||||
{
|
{
|
||||||
len = (rl_prompt && *rl_prompt) ? strlen (rl_prompt) : 0;
|
len = (rl_prompt && *rl_prompt) ? strlen (rl_prompt) : 0;
|
||||||
pmt = (char *)xmalloc (len + 2);
|
pmt = (char *)xmalloc (len + 2);
|
||||||
|
@ -1998,19 +2068,17 @@ _rl_make_prompt_for_search (pchar)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
len = *saved_local_prompt ? strlen (saved_local_prompt) : 0;
|
p++;
|
||||||
|
len = strlen (p);
|
||||||
pmt = (char *)xmalloc (len + 2);
|
pmt = (char *)xmalloc (len + 2);
|
||||||
if (len)
|
if (len)
|
||||||
strcpy (pmt, saved_local_prompt);
|
strcpy (pmt, p);
|
||||||
pmt[len] = pchar;
|
pmt[len] = pchar;
|
||||||
pmt[len+1] = '\0';
|
pmt[len+1] = '\0';
|
||||||
local_prompt = savestring (pmt);
|
|
||||||
prompt_last_invisible = saved_last_invisible;
|
|
||||||
prompt_visible_length = saved_visible_length + 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* will be overwritten by expand_prompt, called from rl_message */
|
||||||
prompt_physical_chars = saved_physical_chars + 1;
|
prompt_physical_chars = saved_physical_chars + 1;
|
||||||
|
|
||||||
return pmt;
|
return pmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2160,7 +2228,8 @@ _rl_update_final ()
|
||||||
char *last_line;
|
char *last_line;
|
||||||
|
|
||||||
last_line = &visible_line[vis_lbreaks[_rl_vis_botlin]];
|
last_line = &visible_line[vis_lbreaks[_rl_vis_botlin]];
|
||||||
_rl_move_cursor_relative (_rl_screenwidth - 1, last_line);
|
cpos_buffer_position = -1; /* don't know where we are in buffer */
|
||||||
|
_rl_move_cursor_relative (_rl_screenwidth - 1, last_line); /* XXX */
|
||||||
_rl_clear_to_eol (0);
|
_rl_clear_to_eol (0);
|
||||||
putc (last_line[_rl_screenwidth - 1], rl_outstream);
|
putc (last_line[_rl_screenwidth - 1], rl_outstream);
|
||||||
}
|
}
|
||||||
|
@ -2203,6 +2272,7 @@ redraw_prompt (t)
|
||||||
&prompt_invis_chars_first_line,
|
&prompt_invis_chars_first_line,
|
||||||
&prompt_physical_chars);
|
&prompt_physical_chars);
|
||||||
local_prompt_prefix = (char *)NULL;
|
local_prompt_prefix = (char *)NULL;
|
||||||
|
local_prompt_len = local_prompt ? strlen (local_prompt) : 0;
|
||||||
|
|
||||||
rl_forced_update_display ();
|
rl_forced_update_display ();
|
||||||
|
|
||||||
|
@ -2305,12 +2375,14 @@ _rl_col_width (str, start, end)
|
||||||
int start, end;
|
int start, end;
|
||||||
{
|
{
|
||||||
wchar_t wc;
|
wchar_t wc;
|
||||||
mbstate_t ps = {0};
|
mbstate_t ps;
|
||||||
int tmp, point, width, max;
|
int tmp, point, width, max;
|
||||||
|
|
||||||
if (end <= start)
|
if (end <= start)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
memset (&ps, 0, sizeof (mbstate_t));
|
||||||
|
|
||||||
point = 0;
|
point = 0;
|
||||||
max = end;
|
max = end;
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ This document describes the GNU History library
|
||||||
a programming tool that provides a consistent user interface for
|
a programming tool that provides a consistent user interface for
|
||||||
recalling lines of previously typed input.
|
recalling lines of previously typed input.
|
||||||
|
|
||||||
Copyright @copyright{} 1988-2004 Free Software Foundation, Inc.
|
Copyright @copyright{} 1988-2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Permission is granted to make and distribute verbatim copies of
|
Permission is granted to make and distribute verbatim copies of
|
||||||
this manual provided the copyright notice and this permission notice
|
this manual provided the copyright notice and this permission notice
|
||||||
|
@ -22,7 +22,7 @@ are preserved on all copies.
|
||||||
|
|
||||||
@quotation
|
@quotation
|
||||||
Permission is granted to copy, distribute and/or modify this document
|
Permission is granted to copy, distribute and/or modify this document
|
||||||
under the terms of the GNU Free Documentation License, Version 1.1 or
|
under the terms of the GNU Free Documentation License, Version 1.2 or
|
||||||
any later version published by the Free Software Foundation; with no
|
any later version published by the Free Software Foundation; with no
|
||||||
Invariant Sections, with the Front-Cover texts being ``A GNU Manual,''
|
Invariant Sections, with the Front-Cover texts being ``A GNU Manual,''
|
||||||
and with the Back-Cover Texts as in (a) below. A copy of the license is
|
and with the Back-Cover Texts as in (a) below. A copy of the license is
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
@ignore
|
@ignore
|
||||||
This file documents the user interface to the GNU History library.
|
This file documents the user interface to the GNU History library.
|
||||||
|
|
||||||
Copyright (C) 1988-2002 Free Software Foundation, Inc.
|
Copyright (C) 1988-2006 Free Software Foundation, Inc.
|
||||||
Authored by Brian Fox and Chet Ramey.
|
Authored by Brian Fox and Chet Ramey.
|
||||||
|
|
||||||
Permission is granted to make and distribute verbatim copies of this manual
|
Permission is granted to make and distribute verbatim copies of this manual
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
@ignore
|
@ignore
|
||||||
This file documents the user interface to the GNU History library.
|
This file documents the user interface to the GNU History library.
|
||||||
|
|
||||||
Copyright (C) 1988-2002 Free Software Foundation, Inc.
|
Copyright (C) 1988-2006 Free Software Foundation, Inc.
|
||||||
Authored by Brian Fox and Chet Ramey.
|
Authored by Brian Fox and Chet Ramey.
|
||||||
|
|
||||||
Permission is granted to make and distribute verbatim copies of this manual
|
Permission is granted to make and distribute verbatim copies of this manual
|
||||||
|
|
|
@ -14,7 +14,7 @@ This manual describes the GNU Readline Library
|
||||||
consistency of user interface across discrete programs which provide
|
consistency of user interface across discrete programs which provide
|
||||||
a command line interface.
|
a command line interface.
|
||||||
|
|
||||||
Copyright @copyright{} 1988-2004 Free Software Foundation, Inc.
|
Copyright @copyright{} 1988-2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Permission is granted to make and distribute verbatim copies of
|
Permission is granted to make and distribute verbatim copies of
|
||||||
this manual provided the copyright notice and this permission notice
|
this manual provided the copyright notice and this permission notice
|
||||||
|
@ -22,7 +22,7 @@ are preserved on all copies.
|
||||||
|
|
||||||
@quotation
|
@quotation
|
||||||
Permission is granted to copy, distribute and/or modify this document
|
Permission is granted to copy, distribute and/or modify this document
|
||||||
under the terms of the GNU Free Documentation License, Version 1.1 or
|
under the terms of the GNU Free Documentation License, Version 1.2 or
|
||||||
any later version published by the Free Software Foundation; with no
|
any later version published by the Free Software Foundation; with no
|
||||||
Invariant Sections, with the Front-Cover texts being ``A GNU Manual,''
|
Invariant Sections, with the Front-Cover texts being ``A GNU Manual,''
|
||||||
and with the Back-Cover Texts as in (a) below. A copy of the license is
|
and with the Back-Cover Texts as in (a) below. A copy of the license is
|
||||||
|
|
|
@ -8,7 +8,7 @@ This document describes the GNU Readline Library, a utility for aiding
|
||||||
in the consistency of user interface across discrete programs that need
|
in the consistency of user interface across discrete programs that need
|
||||||
to provide a command line interface.
|
to provide a command line interface.
|
||||||
|
|
||||||
Copyright (C) 1988-2005 Free Software Foundation, Inc.
|
Copyright (C) 1988-2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Permission is granted to make and distribute verbatim copies of
|
Permission is granted to make and distribute verbatim copies of
|
||||||
this manual provided the copyright notice and this permission notice
|
this manual provided the copyright notice and this permission notice
|
||||||
|
@ -1033,8 +1033,10 @@ pending input has not already been read with @code{rl_read_key()}.
|
||||||
@deftypefun int rl_set_keyboard_input_timeout (int u)
|
@deftypefun int rl_set_keyboard_input_timeout (int u)
|
||||||
While waiting for keyboard input in @code{rl_read_key()}, Readline will
|
While waiting for keyboard input in @code{rl_read_key()}, Readline will
|
||||||
wait for @var{u} microseconds for input before calling any function
|
wait for @var{u} microseconds for input before calling any function
|
||||||
assigned to @code{rl_event_hook}. The default waiting period is
|
assigned to @code{rl_event_hook}. @var{u} must be greater than or equal
|
||||||
one-tenth of a second. Returns the old timeout value.
|
to zero (a zero-length timeout is equivalent to a poll).
|
||||||
|
The default waiting period is one-tenth of a second.
|
||||||
|
Returns the old timeout value.
|
||||||
@end deftypefun
|
@end deftypefun
|
||||||
|
|
||||||
@node Terminal Management
|
@node Terminal Management
|
||||||
|
@ -1668,6 +1670,9 @@ the directory portion of the pathname the user typed.
|
||||||
It returns an integer that should be non-zero if the function modifies
|
It returns an integer that should be non-zero if the function modifies
|
||||||
its directory argument.
|
its directory argument.
|
||||||
It could be used to expand symbolic links or shell variables in pathnames.
|
It could be used to expand symbolic links or shell variables in pathnames.
|
||||||
|
At the least, even if no other expansion is performed, this function should
|
||||||
|
remove any quote characters from the directory name, because its result will
|
||||||
|
be passed directly to @code{opendir()}.
|
||||||
@end deftypevar
|
@end deftypevar
|
||||||
|
|
||||||
@deftypevar {rl_compdisp_func_t *} rl_completion_display_matches_hook
|
@deftypevar {rl_compdisp_func_t *} rl_completion_display_matches_hook
|
||||||
|
|
|
@ -10,7 +10,7 @@ use these features. There is a document entitled "readline.texinfo"
|
||||||
which contains both end-user and programmer documentation for the
|
which contains both end-user and programmer documentation for the
|
||||||
GNU Readline Library.
|
GNU Readline Library.
|
||||||
|
|
||||||
Copyright (C) 1988-2005 Free Software Foundation, Inc.
|
Copyright (C) 1988-2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Authored by Brian Fox and Chet Ramey.
|
Authored by Brian Fox and Chet Ramey.
|
||||||
|
|
||||||
|
@ -336,7 +336,9 @@ file is taken from the value of the shell variable @env{INPUTRC}. If
|
||||||
@ifclear BashFeatures
|
@ifclear BashFeatures
|
||||||
file is taken from the value of the environment variable @env{INPUTRC}. If
|
file is taken from the value of the environment variable @env{INPUTRC}. If
|
||||||
@end ifclear
|
@end ifclear
|
||||||
that variable is unset, the default is @file{~/.inputrc}.
|
that variable is unset, the default is @file{~/.inputrc}. If that
|
||||||
|
file does not exist or cannot be read, the ultimate default is
|
||||||
|
@file{/etc/inputrc}.
|
||||||
|
|
||||||
When a program which uses the Readline library starts up, the
|
When a program which uses the Readline library starts up, the
|
||||||
init file is read, and the key bindings are set.
|
init file is read, and the key bindings are set.
|
||||||
|
@ -593,9 +595,11 @@ the command does.
|
||||||
Once you know the name of the command, simply place on a line
|
Once you know the name of the command, simply place on a line
|
||||||
in the init file the name of the key
|
in the init file the name of the key
|
||||||
you wish to bind the command to, a colon, and then the name of the
|
you wish to bind the command to, a colon, and then the name of the
|
||||||
command. The name of the key
|
command.
|
||||||
can be expressed in different ways, depending on what you find most
|
There can be no space between the key name and the colon -- that will be
|
||||||
comfortable.
|
interpreted as part of the key name.
|
||||||
|
The name of the key can be expressed in different ways, depending on
|
||||||
|
what you find most comfortable.
|
||||||
|
|
||||||
In addition to command names, readline allows keys to be bound
|
In addition to command names, readline allows keys to be bound
|
||||||
to a string that is inserted when the key is pressed (a @var{macro}).
|
to a string that is inserted when the key is pressed (a @var{macro}).
|
||||||
|
|
|
@ -14,7 +14,7 @@ This manual describes the end user interface of the GNU Readline Library
|
||||||
consistency of user interface across discrete programs which provide
|
consistency of user interface across discrete programs which provide
|
||||||
a command line interface.
|
a command line interface.
|
||||||
|
|
||||||
Copyright @copyright{} 1988-2005 Free Software Foundation, Inc.
|
Copyright @copyright{} 1988-2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Permission is granted to make and distribute verbatim copies of
|
Permission is granted to make and distribute verbatim copies of
|
||||||
this manual provided the copyright notice and this permission notice
|
this manual provided the copyright notice and this permission notice
|
||||||
|
@ -22,7 +22,7 @@ are preserved on all copies.
|
||||||
|
|
||||||
@quotation
|
@quotation
|
||||||
Permission is granted to copy, distribute and/or modify this document
|
Permission is granted to copy, distribute and/or modify this document
|
||||||
under the terms of the GNU Free Documentation License, Version 1.1 or
|
under the terms of the GNU Free Documentation License, Version 1.2 or
|
||||||
any later version published by the Free Software Foundation; with no
|
any later version published by the Free Software Foundation; with no
|
||||||
Invariant Sections, with the Front-Cover texts being ``A GNU Manual,''
|
Invariant Sections, with the Front-Cover texts being ``A GNU Manual,''
|
||||||
and with the Back-Cover Texts as in (a) below. A copy of the license is
|
and with the Back-Cover Texts as in (a) below. A copy of the license is
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
@ignore
|
@ignore
|
||||||
Copyright (C) 1988-2005 Free Software Foundation, Inc.
|
Copyright (C) 1988-2006 Free Software Foundation, Inc.
|
||||||
@end ignore
|
@end ignore
|
||||||
|
|
||||||
@set EDITION 5.1-beta1
|
@set EDITION 5.2
|
||||||
@set VERSION 5.1-beta1
|
@set VERSION 5.2
|
||||||
@set UPDATED 11 November 2005
|
@set UPDATED 26 April 2006
|
||||||
@set UPDATED-MONTH November 2005
|
@set UPDATED-MONTH April 2006
|
||||||
|
|
||||||
@set LASTCHANGE Fri Nov 11 19:50:51 EST 2005
|
@set LASTCHANGE Wed Apr 26 09:22:57 EDT 2006
|
||||||
|
|
|
@ -32,6 +32,9 @@ Let me know what you think.
|
||||||
|
|
||||||
Jeff
|
Jeff
|
||||||
*/
|
*/
|
||||||
|
/*
|
||||||
|
Copyright (C) 1999 Jeff Solomon
|
||||||
|
*/
|
||||||
|
|
||||||
#if defined (HAVE_CONFIG_H)
|
#if defined (HAVE_CONFIG_H)
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
|
@ -56,8 +56,6 @@
|
||||||
|
|
||||||
typedef int _hist_search_func_t PARAMS((const char *, int));
|
typedef int _hist_search_func_t PARAMS((const char *, int));
|
||||||
|
|
||||||
extern int rl_byte_oriented; /* declared in mbutil.c */
|
|
||||||
|
|
||||||
static char error_pointer;
|
static char error_pointer;
|
||||||
|
|
||||||
static char *subst_lhs;
|
static char *subst_lhs;
|
||||||
|
@ -564,12 +562,12 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line)
|
||||||
#if defined (HANDLE_MULTIBYTE)
|
#if defined (HANDLE_MULTIBYTE)
|
||||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||||
{
|
{
|
||||||
int c, l;
|
int ch, l;
|
||||||
l = _rl_find_prev_mbchar (string, i, MB_FIND_ANY);
|
l = _rl_find_prev_mbchar (string, i, MB_FIND_ANY);
|
||||||
c = string[l];
|
ch = string[l];
|
||||||
/* XXX - original patch had i - 1 ??? If i == 0 it would fail. */
|
/* XXX - original patch had i - 1 ??? If i == 0 it would fail. */
|
||||||
if (i && (c == '\'' || c == '"'))
|
if (i && (ch == '\'' || ch == '"'))
|
||||||
quoted_search_delimiter = c;
|
quoted_search_delimiter = ch;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif /* HANDLE_MULTIBYTE */
|
#endif /* HANDLE_MULTIBYTE */
|
||||||
|
@ -1430,6 +1428,8 @@ history_tokenize_word (string, ind)
|
||||||
{
|
{
|
||||||
if (peek == '<' && string[i + 2] == '-')
|
if (peek == '<' && string[i + 2] == '-')
|
||||||
i++;
|
i++;
|
||||||
|
else if (peek == '<' && string[i + 2] == '<')
|
||||||
|
i++;
|
||||||
i += 2;
|
i += 2;
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
|
@ -256,7 +256,11 @@ read_history_range (filename, from, to)
|
||||||
for (line_end = line_start; line_end < bufend; line_end++)
|
for (line_end = line_start; line_end < bufend; line_end++)
|
||||||
if (*line_end == '\n')
|
if (*line_end == '\n')
|
||||||
{
|
{
|
||||||
*line_end = '\0';
|
/* Change to allow Windows-like \r\n end of line delimiter. */
|
||||||
|
if (line_end > line_start && line_end[-1] == '\r')
|
||||||
|
line_end[-1] = '\0';
|
||||||
|
else
|
||||||
|
*line_end = '\0';
|
||||||
|
|
||||||
if (*line_start)
|
if (*line_start)
|
||||||
{
|
{
|
||||||
|
|
|
@ -209,6 +209,22 @@ history_get (offset)
|
||||||
: the_history[local_index];
|
: the_history[local_index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HIST_ENTRY *
|
||||||
|
alloc_history_entry (string, ts)
|
||||||
|
char *string;
|
||||||
|
char *ts;
|
||||||
|
{
|
||||||
|
HIST_ENTRY *temp;
|
||||||
|
|
||||||
|
temp = (HIST_ENTRY *)xmalloc (sizeof (HIST_ENTRY));
|
||||||
|
|
||||||
|
temp->line = string ? savestring (string) : string;
|
||||||
|
temp->data = (char *)NULL;
|
||||||
|
temp->timestamp = ts;
|
||||||
|
|
||||||
|
return temp;
|
||||||
|
}
|
||||||
|
|
||||||
time_t
|
time_t
|
||||||
history_get_time (hist)
|
history_get_time (hist)
|
||||||
HIST_ENTRY *hist;
|
HIST_ENTRY *hist;
|
||||||
|
@ -290,11 +306,7 @@ add_history (string)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
temp = (HIST_ENTRY *)xmalloc (sizeof (HIST_ENTRY));
|
temp = alloc_history_entry (string, hist_inittime ());
|
||||||
temp->line = savestring (string);
|
|
||||||
temp->data = (char *)NULL;
|
|
||||||
|
|
||||||
temp->timestamp = hist_inittime ();
|
|
||||||
|
|
||||||
the_history[history_length] = (HIST_ENTRY *)NULL;
|
the_history[history_length] = (HIST_ENTRY *)NULL;
|
||||||
the_history[history_length - 1] = temp;
|
the_history[history_length - 1] = temp;
|
||||||
|
@ -329,6 +341,26 @@ free_history_entry (hist)
|
||||||
return (x);
|
return (x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HIST_ENTRY *
|
||||||
|
copy_history_entry (hist)
|
||||||
|
HIST_ENTRY *hist;
|
||||||
|
{
|
||||||
|
HIST_ENTRY *ret;
|
||||||
|
char *ts;
|
||||||
|
|
||||||
|
if (hist == 0)
|
||||||
|
return hist;
|
||||||
|
|
||||||
|
ret = alloc_history_entry (hist->line, (char *)NULL);
|
||||||
|
|
||||||
|
ts = hist->timestamp ? savestring (hist->timestamp) : hist->timestamp;
|
||||||
|
ret->timestamp = ts;
|
||||||
|
|
||||||
|
ret->data = hist->data;
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/* Make the history entry at WHICH have LINE and DATA. This returns
|
/* Make the history entry at WHICH have LINE and DATA. This returns
|
||||||
the old entry so you can dispose of the data. In the case of an
|
the old entry so you can dispose of the data. In the case of an
|
||||||
invalid WHICH, a NULL pointer is returned. */
|
invalid WHICH, a NULL pointer is returned. */
|
||||||
|
@ -354,6 +386,51 @@ replace_history_entry (which, line, data)
|
||||||
return (old_value);
|
return (old_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Replace the DATA in the specified history entries, replacing OLD with
|
||||||
|
NEW. WHICH says which one(s) to replace: WHICH == -1 means to replace
|
||||||
|
all of the history entries where entry->data == OLD; WHICH == -2 means
|
||||||
|
to replace the `newest' history entry where entry->data == OLD; and
|
||||||
|
WHICH >= 0 means to replace that particular history entry's data, as
|
||||||
|
long as it matches OLD. */
|
||||||
|
void
|
||||||
|
replace_history_data (which,old, new)
|
||||||
|
int which;
|
||||||
|
histdata_t *old, *new;
|
||||||
|
{
|
||||||
|
HIST_ENTRY *entry;
|
||||||
|
register int i, last;
|
||||||
|
|
||||||
|
if (which < -2 || which >= history_length || history_length == 0 || the_history == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (which >= 0)
|
||||||
|
{
|
||||||
|
entry = the_history[which];
|
||||||
|
if (entry && entry->data == old)
|
||||||
|
entry->data = new;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
last = -1;
|
||||||
|
for (i = 0; i < history_length; i++)
|
||||||
|
{
|
||||||
|
entry = the_history[i];
|
||||||
|
if (entry == 0)
|
||||||
|
continue;
|
||||||
|
if (entry->data == old)
|
||||||
|
{
|
||||||
|
last = i;
|
||||||
|
if (which == -1)
|
||||||
|
entry->data = new;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (which == -2 && last >= 0)
|
||||||
|
{
|
||||||
|
entry = the_history[last];
|
||||||
|
entry->data = new; /* XXX - we don't check entry->old */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Remove history element WHICH from the history. The removed
|
/* Remove history element WHICH from the history. The removed
|
||||||
element is returned to you so you can free the line, data,
|
element is returned to you so you can free the line, data,
|
||||||
and containing structure. */
|
and containing structure. */
|
||||||
|
|
|
@ -179,6 +179,7 @@ rl_gather_tyi ()
|
||||||
struct timeval timeout;
|
struct timeval timeout;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
chars_avail = 0;
|
||||||
tty = fileno (rl_instream);
|
tty = fileno (rl_instream);
|
||||||
|
|
||||||
#if defined (HAVE_SELECT)
|
#if defined (HAVE_SELECT)
|
||||||
|
@ -220,6 +221,13 @@ rl_gather_tyi ()
|
||||||
}
|
}
|
||||||
#endif /* O_NDELAY */
|
#endif /* O_NDELAY */
|
||||||
|
|
||||||
|
#if defined (__MINGW32__)
|
||||||
|
/* Use getch/_kbhit to check for available console input, in the same way
|
||||||
|
that we read it normally. */
|
||||||
|
chars_avail = isatty (tty) ? _kbhit () : 0;
|
||||||
|
result = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* If there's nothing available, don't waste time trying to read
|
/* If there's nothing available, don't waste time trying to read
|
||||||
something. */
|
something. */
|
||||||
if (chars_avail <= 0)
|
if (chars_avail <= 0)
|
||||||
|
@ -263,7 +271,7 @@ rl_set_keyboard_input_timeout (u)
|
||||||
int o;
|
int o;
|
||||||
|
|
||||||
o = _keyboard_input_timeout;
|
o = _keyboard_input_timeout;
|
||||||
if (u > 0)
|
if (u >= 0)
|
||||||
_keyboard_input_timeout = u;
|
_keyboard_input_timeout = u;
|
||||||
return (o);
|
return (o);
|
||||||
}
|
}
|
||||||
|
@ -303,6 +311,11 @@ _rl_input_available ()
|
||||||
return (chars_avail);
|
return (chars_avail);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined (__MINGW32__)
|
||||||
|
if (isatty (tty))
|
||||||
|
return (_kbhit ());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -489,7 +502,7 @@ rl_getc (stream)
|
||||||
this is simply an interrupted system call to read ().
|
this is simply an interrupted system call to read ().
|
||||||
Otherwise, some error ocurred, also signifying EOF. */
|
Otherwise, some error ocurred, also signifying EOF. */
|
||||||
if (errno != EINTR)
|
if (errno != EINTR)
|
||||||
return (EOF);
|
return (RL_ISSTATE (RL_STATE_READCMD) ? READERR : EOF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -537,21 +550,21 @@ _rl_read_mbchar (mbchar, size)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read a multibyte-character string whose first character is FIRST into
|
/* Read a multibyte-character string whose first character is FIRST into
|
||||||
the buffer MB of length MBLEN. Returns the last character read, which
|
the buffer MB of length MLEN. Returns the last character read, which
|
||||||
may be FIRST. Used by the search functions, among others. Very similar
|
may be FIRST. Used by the search functions, among others. Very similar
|
||||||
to _rl_read_mbchar. */
|
to _rl_read_mbchar. */
|
||||||
int
|
int
|
||||||
_rl_read_mbstring (first, mb, mblen)
|
_rl_read_mbstring (first, mb, mlen)
|
||||||
int first;
|
int first;
|
||||||
char *mb;
|
char *mb;
|
||||||
int mblen;
|
int mlen;
|
||||||
{
|
{
|
||||||
int i, c;
|
int i, c;
|
||||||
mbstate_t ps;
|
mbstate_t ps;
|
||||||
|
|
||||||
c = first;
|
c = first;
|
||||||
memset (mb, 0, mblen);
|
memset (mb, 0, mlen);
|
||||||
for (i = 0; i < mblen; i++)
|
for (i = 0; i < mlen; i++)
|
||||||
{
|
{
|
||||||
mb[i] = (char)c;
|
mb[i] = (char)c;
|
||||||
memset (&ps, 0, sizeof (mbstate_t));
|
memset (&ps, 0, sizeof (mbstate_t));
|
||||||
|
|
|
@ -68,8 +68,8 @@ static void _rl_isearch_fini PARAMS((_rl_search_cxt *));
|
||||||
static int _rl_isearch_cleanup PARAMS((_rl_search_cxt *, int));
|
static int _rl_isearch_cleanup PARAMS((_rl_search_cxt *, int));
|
||||||
|
|
||||||
/* Last line found by the current incremental search, so we don't `find'
|
/* Last line found by the current incremental search, so we don't `find'
|
||||||
identical lines many times in a row. */
|
identical lines many times in a row. Now part of isearch context. */
|
||||||
static char *prev_line_found;
|
/* static char *prev_line_found; */
|
||||||
|
|
||||||
/* Last search string and its length. */
|
/* Last search string and its length. */
|
||||||
static char *last_isearch_string;
|
static char *last_isearch_string;
|
||||||
|
|
|
@ -582,6 +582,7 @@ rl_yank_nth_arg_internal (count, ignore, history_skip)
|
||||||
if (!arg || !*arg)
|
if (!arg || !*arg)
|
||||||
{
|
{
|
||||||
rl_ding ();
|
rl_ding ();
|
||||||
|
FREE (arg);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ _rl_next_macro_key ()
|
||||||
|
|
||||||
#if defined (READLINE_CALLBACKS)
|
#if defined (READLINE_CALLBACKS)
|
||||||
c = rl_executing_macro[executing_macro_index++];
|
c = rl_executing_macro[executing_macro_index++];
|
||||||
if (RL_ISSTATE (RL_STATE_CALLBACK) && RL_ISSTATE (RL_STATE_READCMD) && rl_executing_macro[executing_macro_index] == 0)
|
if (RL_ISSTATE (RL_STATE_CALLBACK) && RL_ISSTATE (RL_STATE_READCMD|RL_STATE_MOREINPUT) && rl_executing_macro[executing_macro_index] == 0)
|
||||||
_rl_pop_executing_macro ();
|
_rl_pop_executing_macro ();
|
||||||
return c;
|
return c;
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -212,6 +212,8 @@ rl_digit_loop ()
|
||||||
if (r <= 0 || (RL_ISSTATE (RL_STATE_NUMERICARG) == 0))
|
if (r <= 0 || (RL_ISSTATE (RL_STATE_NUMERICARG) == 0))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create a default argument. */
|
/* Create a default argument. */
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue