Imported from ../bash-2.05a.tar.gz.

This commit is contained in:
Jari Aalto 2001-11-13 17:56:06 +00:00
parent 28ef6c316f
commit f73dda092b
303 changed files with 37069 additions and 28812 deletions

View File

@ -153,8 +153,8 @@ lib/doc-support/getopt.c Roland McGrath
lib/doc-support/getopt1.c Roland McGrath
lib/glob/ChangeLog Brian Fox, Chet Ramey
lib/glob/Makefile.in Brian Fox, Chet Ramey
lib/glob/fnmatch.c Roland McGrath, Brian Fox, Chet Ramey
lib/glob/fnmatch.h Roland McGrath, Brian Fox, Chet Ramey
lib/glob/strmatch.c Roland McGrath, Brian Fox, Chet Ramey
lib/glob/strmatch.h Roland McGrath, Brian Fox, Chet Ramey
lib/glob/glob.c Richard Stallman, Roland McGrath, Brian Fox, Chet Ramey
lib/glob/glob.h Chet Ramey
lib/glob/ndir.h Doug Gwyn, Richard Stallman

530
CHANGES
View File

@ -1,3 +1,533 @@
This document details the changes between this version, bash-2.05a-release,
and the previous version, bash-2.05a-rc1.
1. Changes to Bash
a. Fixed the `printf' builtin so that the variable name supplied as an
argument to a %n conversion must be a valid shell identifier.
b. Improved the random number generator slightly.
c. Changes to configuration to not put -I/usr/include into $CFLAGS, since
it messes up some includes.
d. Corrected description of POSIXLY_CORRECT in man page and info manual.
e. Fixed a couple of cases of incorrect function prototypes that sneaked
through and caused compilation problems.
f. A few changes to avoid potential core dumps in the programmable completion
code.
g. Fixed a configure problem that could cause a non-existent file to show
up in LIBOBJS.
h. Fixed a configure problem that could cause siglist.o to not be built when
required.
i. Changes to the strtoimax and strtoumax replacement functions to work
around buggy compilers.
j. Fixed a problem with the snprintf replacement function that could
potentially cause a core dump.
2. Changes to Readline
a. Fixed a locale-specific problem in the vi-mode `goto mark' command.
b. Fixed Makefile to not put -I/usr/include into CFLAGS, since it can cause
include file problems.
------------------------------------------------------------------------------
This document details the changes between this version, bash-2.05a-rc1,
and the previous version, bash-2.05a-beta1.
1. Changes to Bash
a. Fixed the snprintf replacement to correctly implement the `alternate form'
of the %g and %G conversions.
b. Fixed snprintf to correctly handle the optional precision with the %g and
%G conversions.
c. Fixed the arithmetic evaluation code to correct the values of `@' and `_'
when translating base-64 constants (they were backwards).
d. New library functions for formatting long and long long ints.
e. Fixed a few places where negative array subscripts could have occurred,
mostly as the result of systems using signed characters.
f. Fixed a few places that assumed a pid_t was no wider than an int.
g. Fixed the `maildir' mail checking code to work on systems where a
`struct stat' doesn't include an `st_blocks' member.
h. Fixed snprintf to make `unsigned long long' conversion formats (%llu)
work better.
i. Fixed snprintf to not print a sign when asked to do an unsigned conversion.
j. Made configure changes to avoid compiling empty source files in lib/sh.
k. New replacement functions (if necessary) for strtoull, strtoll, strtoimax,
strtoumax.
l. The `printf' builtin now handles the `ll' and `j' length modifiers
directly, since they can affect the type and width of the argument
passed to printf(3).
m. Renamed a number of the bash-specific autoconf macros in aclocal.m4 to
have more sytematic naming, with accompanying changes to configure.in.
n. Fixed snprintf to handle long doubles and the %a/%A conversions by
falling back to sprintf, as long as sprintf supports them.
o. Fixed return value from vsnprintf/snprintf to be the number of characters
that would have been printed, even if that number exceeds the buffer
size passed as an argument.
p. Bash no longer attempts to define its own versions of some ctype macros
if they are implemented as functions in libc but not as macros in
<ctype.h>.
q. Changed the variable printing code (used by `set', `export', etc.) to
not use the $'...' syntax when in posix mode, since that caused
interoperability problems with other shells (most notably with autoconf).
When not in posix mode, it uses $'...' if the string to be printed
contains non-printing characters and regular single quotes otherwise.
r. snprintf now recognizes the %F conversion.
s. Fixed a bug that could cause the wrong status to be returned by a shell
function when the shell is compiled without job control and a null
command containing a command substutition was executed in the function.
t. When in posix mode, the default value for MAILCHECK is 600.
u. Bash only initializes FUNCNAME, GROUPS, and DIRSTACK as special variables
if they're not in the initial environment.
v. If SECONDS appears in the initial environment with a valid integer value,
bash uses that as the starting value, as if an assignment had been
performed.
w. Bash no longer auto-exports HOME, PATH, SHELL, or TERM, even though it
gives them default values if they don't appear in the initial environment.
x. Bash no longer auto-exports HOSTNAME, HOSTTYPE, MACHTYPE, or OSTYPE,
even if it assigns them default values.
y. Bash no longer removes the export attribute from SSH_CLIENT or SSH2_CLIENT
if they appear in the initial environment.
z. Bash no longer attempts to discover if it's being run by sshd in order to
run the startup files. If the SSH_SOURCE_BASHRC is uncommented in
config-top.h it will attempt to do so as previously, but that's commented
out in the distributed version.
aa. Fixed a typo in the code that tests for LC_NUMERIC.
bb. The POSIXLY_CORRECT shell variable and its effects are now documented.
cc. Some changes to several of the support shell scripts included in the
definitions to try to avoid race conditions and attacks.
dd. Several changes to avoid warnings from `gcc -Wall'.
ee. Fixed a problem with the `unset' builtin that could cause incorrect
results if asked to unset a variable and an array subscript in the
same command.
ff. A few changes to the shell's temporary file creation code to avoid
potential file descriptor leaks and to prefer the system's idea of
the temporary directory to use.
gg. Fixes to build with the C alloca in lib/malloc/alloca.c if the system
requires it but the shell has been configured --without-bash-malloc.
hh. Updated the documentation to note that only interactive shells resend
SIGHUP to all jobs before exiting.
ii. Fixes to only pass unquoted tilde words to tilde_expand, rather than
rely on tilde_expand or getpwnam(3) to handle the quotes (MacOS 10.x
will remove backslashes in any login name passed to getpwnam(3)).
jj. Small change from Paul Eggert to make LINENO right in commands run with
`bash -c'.
2. New Features in Bash
a. The `printf' builtin now handles the %a and %A conversions if they're
implemented by printf(3).
b. The `printf' builtin now handles the %F conversion (just about like %f).
c. The `printf' builtin now handles the %n conversion like printf(3). The
corresponding argument is the name of a shell variable to which the
value is assigned.
3. Changes to Readline
a. Fixed a few places where negative array subscripts could have occurred.
b. Fixed the vi-mode code to use a better method to determine the bounds of
the array used to hold the marks.
c. Fixed the defines in chardefs.h to work better when chars are signed.
d. Fixed configure.in to use the new names for bash autoconf macros.
e. Readline no longer attempts to define its own versions of some ctype
macros if they are implemented as functions in libc but not as macros in
<ctype.h>.
f. Fixed a problem where rl_backward could possibly set point to before
the beginning of the line.
------------------------------------------------------------------------------
This document details the changes between this version, bash-2.05a-beta1,
and the previous version, bash-2.05a-alpha1.
1. Changes to Bash
a. Fixed a bug in the evalution of arithmetic `for' statements when the
expanded expression is NULL.
b. Fixed an unassigned variable problem in the redirection printing code.
c. Added more prototypes to extern function declarations in the header
files and to static function declarations in C source files.
d. Make sure called functions have a prototype in scope, to get the arguments
and return values right instead of casting. Removed extern function
declarations from C source files that were already included in header
files.
e. Changed some function arguments to use function typedefs in general.h so
the prototypes can be checked. The only use of Function and VFunction
now is for unwind-protects.
f. More const changes to function arguments and appropriate variables.
g. Changed the mail checking support to handle `maildir'-style mail
directories.
h. Augmented the bash malloc to pass in the file and line number information
for each malloc, realloc, and free. This should result in better error
messages.
i. The `old' gnu malloc is no longer a configuration option.
j. Augmented the bash malloc with optional tracing and registering allocated
and freed memory.
k. Prompt string decoding now saves and restores the value of $? when it
expands the prompt string, so command substitutions don't change $?.
i. Array indices are now `long', since shell arithmetic is performed as long,
and the internal arrayind_t type is used consistently.
j. Some more `unsigned char *' fixes from Paul Eggert.
k. Fixed a bad call to builtin_error that could cause core dumps when making
local variables.
l. `return' may no longer be used to terminate a `select' command, for
compatibility with ksh.
m. Changed code that reads octal numbers to do a better job of detecting
overflows.
n. The time formatting code no longer uses absolute indices into a buffer,
because the buffer size changes depending on the size of a `time_t'.
o. `umask' now prints four digits when printing in octal mode, for
compatibility with other shells.
p. Lots of changes to the `printf' builtin from Paul Eggert: it handles `L'
formats and long doubles better, and internal functions have been
simpified where appropriate.
q. Some `time_t' fixes for machines were a time_t is bigger than a long.
r. Replaced some bash-specific autoconf macros with standard equivalents.
s. Improvmed the code that constructs temporary filenames to make the
generated names a bit more random.
t. Added code that checks for ascii before calling any of the is* ctype
functions.
u. Changed some places where a `char' was used as an array subscript to use
`unsigned char', since a `char' can be negative if it's signed by default.
v. Lots of changes to the `ulimit' builtin from Paul Eggert to add support
for the new POSIX-200x RLIM_SAVED_CUR and RLIM_SAVED_MAX values and
simplify the code.
w. `ulimit' now prints the description of a resource in any error message
relating to fetching or setting that resource's limits.
x. The `snprintf' replacement now computes maximum values at compile
time rather than using huge constants for things like long long.
y. Interactive shells now ignore `set -n'.
z. Changed the malloc bookkeeping information so that it's now 8 bytes
instead of 12 on most 32-bit machines (saving 4 bytes per allocation),
restoring 8-byte alignment.
aa. The malloc error reporting code now attempts to print the file and line
number of the call that caused the error.
bb. Changed the redirection error reporting code to catch EBADF errors and
report the file descriptor number rather than the file being redirected
to or from (e.g., things like `exec 4242<x' where 4242 is an out-of-range
file descriptor).
cc. `printf', `echo -e', and the $'...' code now process only two hex digits
after a `\x' escape sequence for compatibility with other shells, and
the documentation was changed to note that the octal and hex escape
sequences result in an eight-bit value rather than strict ASCII.
2. Changes to Readline
a. The completion code now attempts to do a better job of preserving the
case of the word the user typed if ignoring case in completions.
b. Readline defaults to not echoing the input and lets the terminal
initialization code enable echoing if there is a controlling terminal.
c. The key binding code now processes only two hex digits after a `\x'
escape sequence, and the documentation was changed to note that the
octal and hex escape sequences result in an eight-bit value rather
than strict ASCII.
3. New Features in Bash
a. The builtin `ulimit' now takes two new non-numeric arguments: `hard',
meaning the current hard limit, and `soft', meaning the current soft
limit, in addition to `unlimited'
b. `ulimit' now prints the option letter associated with a particular
resource when printing more than one limit.
c. `ulimit' prints `hard' or `soft' when a value is not `unlimited' but is
one of RLIM_SAVED_MAX or RLIM_SAVED_CUR, respectively.
4. New Features in Readline
a. New bindable variable `history-preserve-point'. If set, the history
code attempts to place the user at the same location on each history
line retrived with previous-history or next-history.
------------------------------------------------------------------------------
This document details the changes between this version, bash-2.05a-alpha1,
and the previous version, bash-2.05-release.
1. Changes to Bash
a. Better checks in the redirection code for write errors.
b. bashbug now uses $TMPDIR, defaulting to /tmp, and uses mktemp(1) more
portably.
c. System-specific configuration changes for: Interix, OpenBSD, FreeBSD,
MacOS X.
d. Some more `const' cleanups through the code.
e. Fixed a typo in the /dev/fd redirection code, better checks for valid
numeric fds in /dev/fd.
f. Fixed many parts of the shell to handle integer overflow more gracefully
and to do more stringent checks for valid numbers.
g. Fixed mksignames to include config.h.
h. Fixed an uninitialized variable problem that could cause the shell to core
dump when replacing characters in a string.
i. New mechanism for updating the patch level when official patches are
released (patchlevel.h).
j. configure.in changed to no longer require external files _distribution and
_patchlevel.
k. Fixed non-interactive shell initialization problem when bash started as
`bash -i filename'.
l. Fixed printf builtin conversion error handling to be POSIX.2-conformant.
m. autoconf-2.52 is now used to build configure; autoconf-2.50 or newer is
required. Some of the bash-specific macros were removed, since they are
now standard.
n. Startup files and files read with source or `.' are no longer required to
be regular files.
o. Fixed core dump in builtin printf when user-supplied precision or field
width is 0.
p. Fixed builtin printf to treat a negative field width as a positive field
width with left-justification.
r. New unwind-protect implementation from Paul Eggert.
s. Fixed an inadvertently-unclosed comment in the bash completion code that
caused programmable completions to not add trailing slashes or spaces to
completions.
t. Fixed the process substitution code to cope better when stdin is closed.
v. Fixes, mostly from Paul Eggert, for a few possible buffer overflows in
the shell.
w. Fixes from Paul Eggert to avoid most of the type casts in the shell code,
and use more appropriate types for a number of variables.
x. Command substition no longer inherits the DEBUG trap.
y. Some fixes to the process substition code on machines without /dev/fd so
that named pipes are not removed inappropriately.
z. The loadable `getconf' builtin is now much more complete, and will become
part of the shell in the future.
aa. The select command no longer terminates on a `return', so it can be used
to return from an enclosing function (as ksh does it).
bb. Fixed the extended pattern matching code to behave better when presented
with incorrectly-formed patterns.
cc. Some changes were made with the intent of making cross-compilation easier.
dd. The network code (/dev/tcp and /dev/udp redirections) uses getaddrinfo(3)
if it's available, which adds support for IPv6.
ee. Subshells of login shells no longer source ~/.bash_logout when they exit.
ff. Fixes so that subshells don't exit inappropriately if the -e option has
been set.
gg. Restricted shells no longer allow functions to be exported.
hh. Changes to the pattern matching code so extended pattern matching works
on systems with deficient shared library implementations, like MacOS X.
ii. Better error messages when a script with a leading `#!interp' fails
to execute because of problems with `interp'.
jj. Fixed `compgen' to handle the `-o default' option better.
kk. Fixed the job control code to force an asynchronous process's standard
input to /dev/null only if job control is not active.
ll. Fixed a possible infinite recursion problem when `fc ""=abc' (a null
pattern) is used to re-execute a previous command.
mm. Fixed `declare [-a] var=value' to assign VALUE to element 0 if VAR is an
array variable. Similarly for `declare [-a] var[N]=value'. This is like
ksh93.
nn. Fixed a bug that caused `read -a aname' to work even if ANAME had been
declared readonly.
oo. Fixed a possible integer overflow problem when constructing names for
temporary files.
2. New Features in Bash
a. Added support for DESTDIR installation root prefix, so you can do a
`make install DESTDIR=bash-root' and do easier binary packaging.
b. Added support for builtin printf "'" flag character as per latest POSIX
drafts.
c. Support for POSIX.2 printf(1) length specifiers `j', `t', and `z' (from
ISO C99).
d. New autoconf macro, RL_LIB_READLINE_VERSION, for use by other applications
(bash doesn't use very much of what it returns).
e. `set [-+]o nolog' is recognized as required by the latest POSIX drafts,
but ignored.
f. New read-only `shopt' option: login_shell. Set to non-zero value if the
shell is a login shell.
g. New `\A' prompt string escape sequence; expands to time in 24 HH:MM format.
h. New `-A group/-g' option to complete and compgen; does group name
completion.
i. New `-t' option to `hash' to list hash values for each filename argument.
j. New [-+]O invocation option to set and unset `shopt' options at startup.
k. configure's `--with-installed-readline' option now takes an optional
`=PATH' suffix to set the root of the tree where readline is installed
to PATH.
l. The ksh-like `ERR' trap has been added. The `ERR' trap will be run
whenever the shell would have exited if the -e option were enabled.
It is not inherited by shell functions.
m. `readonly', `export', and `declare' now print variables which have been
given attributes but not set by assigning a value as just a command and
a variable name (like `export foo') when listing, as the latest POSIX
drafts require.
n. `bashbug' now requires that the subject be changed from the default.
o. configure has a new `--enable-largefile' option, like other GNU utilities.
p. `for' loops now allow empty word lists after `in', like the latest POSIX
drafts require.
3. Changes to Readline
a. More `const' and type casting fixes.
b. Changed rl_message() to use vsnprintf(3) (if available) to fix buffer
overflow problems.
c. The completion code no longer appends a `/' or ` ' to a match when
completing a symbolic link that resolves to a directory name, unless
the match does not add anything to the word being completed. This
means that a tab will complete the word up to the full name, but not
add anything, and a subsequent tab will add a slash.
d. Fixed a trivial typo that made the vi-mode `dT' command not work.
e. Fixed the tty code so that ^S and ^Q can be inserted with rl_quoted_insert.
f. Fixed the tty code so that ^V works more than once.
g. Changed the use of __P((...)) for function prototypes to PARAMS((...))
because the use of __P in typedefs conflicted g++ and glibc.
4. New Features in Readline
a. Added extern declaration for rl_get_termcap to readline.h, making it a
public function (it was always there, just not in readline.h).
b. New #defines in readline.h: RL_READLINE_VERSION, currently 0x0402,
RL_VERSION_MAJOR, currently 4, and RL_VERSION_MINOR, currently 2.
c. New readline variable: rl_readline_version, mirrors RL_READLINE_VERSION.
d. New bindable boolean readline variable: match-hidden-files. Controls
completion of files beginning with a `.' (on Unix). Enabled by default.
e. The history expansion code now allows any character to terminate a
`:first-' modifier, like csh.
f. The incremental search code remembers the last search string and uses
it if ^R^R is typed without a search string.
------------------------------------------------------------------------------
This document details the changes between this version, bash-2.05-release,
and the previous version, bash-2.05-beta2.

25
COMPAT
View File

@ -1,7 +1,9 @@
This document details the incompatibilites between this version of bash,
bash-2.05, and the previous widely-available version, bash-1.14 (which
bash-2.05a, and the previous widely-available version, bash-1.14 (which
is still the `standard' version for many Linux distributions). These
were discovered by users of bash-2.x, so this list is not comprehensive.
Some of these incompatibilities occur between the current version and
versions 2.0 and above.
1. Bash now uses a new quoting syntax, $"...", to do locale-specific
string translation. Users who have relied on the (undocumented)
@ -132,14 +134,7 @@ were discovered by users of bash-2.x, so this list is not comprehensive.
alias -x='chmod a-x' --> alias -- -x='chmod a-x'
13. There was a bug in bash-1.14 and previous versions that caused it to
accept as valid syntax for loops of the form
for f in ; do ... ; done
This should be a syntax error, and bash-2.x treats it as such.
14. The behavior of range specificiers within bracket matching expressions
13. The behavior of range specificiers within bracket matching expressions
in the pattern matcher (e.g., [A-Z]) depends on the current locale,
specifically the value of the LC_COLLATE environment variable. Setting
this variable to C or POSIX will result in the traditional ASCII behavior
@ -183,7 +178,7 @@ were discovered by users of bash-2.x, so this list is not comprehensive.
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.
15. 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
length of its string argument. This let you do things like
@ -198,3 +193,13 @@ were discovered by users of bash-2.x, so this list is not comprehensive.
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.
Bash-2.x does not support it.
15. Bash no longer auto-exports the HOME, PATH, SHELL, TERM, HOSTNAME,
HOSTTYPE, MACHTYPE, or OSTYPE variables.
16. Bash no longer initializes the FUNCNAME, GROUPS, or DIRSTACK variables
to have special behavior if they appear in the initial environment.
17. Bash no longer removes the export attribute from the SSH_CLIENT 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.

File diff suppressed because it is too large Load Diff

View File

@ -1,25 +0,0 @@
This patch is from Brian Fox, in reply to an email message from
"Marcin 'Qrczak' Kowalczyk" <qrczak@knm.org.pl>, who wrote:
I think that bash should accept such a syntax:
for var in ; do command; done
Of course it should do nothing. It would simplify some scripts.
Here is a patch for those who wish it:
*** parse.y.~1~ Wed Mar 4 09:39:46 1998
--- parse.y Mon Jul 13 14:40:23 1998
***************
*** 495,500 ****
--- 495,504 ----
{ $$ = make_for_command ($2, REVERSE_LIST ($5, WORD_LIST *), $9); }
| FOR WORD newline_list IN word_list list_terminator newline_list '{' compound_list '}'
{ $$ = make_for_command ($2, REVERSE_LIST ($5, WORD_LIST *), $9); }
+ | FOR WORD newline_list IN list_terminator newline_list DO compound_list DONE
+ { $$ = make_for_command ($2, (WORD_LIST *)NULL, $8); }
+ | FOR WORD newline_list IN list_terminator newline_list '{' compound_list '}'
+ { $$ = make_for_command ($2, (WORD_LIST *)NULL, $8); }
;

View File

@ -1,175 +0,0 @@
# DP: From: Miquel van Smoorenburg <miquels@cistron.nl>
# DP: A patch that adds support for Maildir type mailboxes.
--- ./mailcheck.c.orig Wed Feb 4 21:30:33 1998
+++ ./mailcheck.c Sun Nov 14 15:35:07 1999
@@ -21,8 +21,10 @@
#include "config.h"
#include <stdio.h>
+#include <errno.h>
#include "bashtypes.h"
#include "posixstat.h"
+#include "posixdir.h"
#ifndef _MINIX
# include <sys/param.h>
#endif
@@ -37,6 +39,8 @@
#include "mailcheck.h"
#include <tilde/tilde.h>
+#include "mailstat.c"
+
#ifndef NOW
#define NOW ((time_t)time ((time_t *)0))
#endif
@@ -131,7 +135,7 @@
struct stat finfo;
file = mailfiles[i]->name;
- if (stat (file, &finfo) == 0)
+ if (mailstat (file, &finfo) == 0)
{
mailfiles[i]->access_time = finfo.st_atime;
mailfiles[i]->mod_time = finfo.st_mtime;
@@ -155,7 +159,7 @@
i = find_mail_file (filename);
if (i >= 0)
{
- if (stat (filename, &finfo) == 0)
+ if (mailstat (filename, &finfo) == 0)
{
mailfiles[i]->mod_time = finfo.st_mtime;
mailfiles[i]->access_time = finfo.st_atime;
@@ -221,7 +225,7 @@
file = mailfiles[i]->name;
mtime = mailfiles[i]->mod_time;
- if ((stat (file, &finfo) == 0) && (finfo.st_size > 0))
+ if ((mailstat (file, &finfo) == 0) && (finfo.st_size > 0))
return (mtime != finfo.st_mtime);
return (0);
@@ -239,7 +243,7 @@
file = mailfiles[i]->name;
atime = mailfiles[i]->access_time;
- if ((stat (file, &finfo) == 0) && (finfo.st_size > 0))
+ if ((mailstat (file, &finfo) == 0) && (finfo.st_size > 0))
return (atime != finfo.st_atime);
return (0);
@@ -257,7 +261,7 @@
file = mailfiles[i]->name;
size = mailfiles[i]->file_size;
- return ((stat (file, &finfo) == 0) && (finfo.st_size > size));
+ return ((mailstat (file, &finfo) == 0) && (finfo.st_size > size));
}
/* Take an element from $MAILPATH and return the portion from
diff -ruN bash-2.01.1.b4/mailstat.c bash-2.01.1/mailstat.c
--- bash-2.01.1.b4/mailstat.c Thu Jan 1 01:00:00 1970
+++ bash-2.01.1/mailstat.c Wed Jun 2 12:05:04 1999
@@ -0,0 +1,98 @@
+/*
+ * Stat a file. If it's a maildir, check all messages
+ * in the maildir and present the grand total as a file.
+ * The fields in the 'struct stat' are from the mail directory.
+ * The following fields are emulated:
+ *
+ * st_nlink always 1
+ * st_size total number of bytes in all files
+ * st_blocks total number of messages
+ * st_atime access time of newest file in maildir
+ * st_mtime modify time of newest file in maildir
+ * st_mode S_IFDIR changed to S_IFREG
+ *
+ * This is good enough for most mail-checking applications.
+ */
+int
+mailstat(char *path, struct stat *st)
+{
+ DIR *dd;
+ struct dirent *fn;
+ struct stat st_ret, st_tmp;
+ static struct stat st_new_last, st_ret_last;
+ char dir[PATH_MAX * 2];
+ char file[PATH_MAX * 2];
+ int i, l;
+ time_t atime = 0, mtime = 0;
+
+ /* First see if it's a directory. */
+ if ((i = stat(path, st)) != 0 || !S_ISDIR(st->st_mode))
+ return i;
+ if (strlen(path) > sizeof(dir) - 5) {
+ errno = ENAMETOOLONG;
+ return -1;
+ }
+
+ st_ret = *st;
+ st_ret.st_nlink = 1;
+ st_ret.st_size = 0;
+ st_ret.st_blocks = 0;
+ st_ret.st_mode &= ~S_IFDIR;
+ st_ret.st_mode |= S_IFREG;
+
+ /* See if cur/ is present */
+ sprintf(dir, "%s/cur", path);
+ if (stat(dir, &st_tmp) || !S_ISDIR(st_tmp.st_mode)) return 0;
+ st_ret.st_atime = st_tmp.st_atime;
+
+ /* See if tmp/ is present */
+ sprintf(dir, "%s/tmp", path);
+ if (stat(dir, &st_tmp) || !S_ISDIR(st_tmp.st_mode)) return 0;
+ st_ret.st_mtime = st_tmp.st_mtime;
+
+ /* And new/ */
+ sprintf(dir, "%s/new", path);
+ if (stat(dir, &st_tmp) || !S_ISDIR(st_tmp.st_mode)) return 0;
+ st_ret.st_mtime = st_tmp.st_mtime;
+
+ /* Optimization - if new/ didn't change, nothing else did. */
+ if (st_tmp.st_dev == st_new_last.st_dev &&
+ st_tmp.st_ino == st_new_last.st_ino &&
+ st_tmp.st_atime == st_new_last.st_atime &&
+ st_tmp.st_mtime == st_new_last.st_mtime) {
+ *st = st_ret_last;
+ return 0;
+ }
+ st_new_last = st_tmp;
+
+ /* Loop over new/ and cur/ */
+ for (i = 0; i < 2; i++) {
+ sprintf(dir, "%s/%s", path, i ? "cur" : "new");
+ sprintf(file, "%s/", dir);
+ l = strlen(file);
+ if ((dd = opendir(dir)) == NULL)
+ return 0;
+ while ((fn = readdir(dd)) != NULL) {
+ if (fn->d_name[0] == '.' ||
+ strlen(fn->d_name) + l >= sizeof(file))
+ continue;
+ strcpy(file + l, fn->d_name);
+ if (stat(file, &st_tmp) != 0)
+ continue;
+ st_ret.st_size += st_tmp.st_size;
+ st_ret.st_blocks++;
+ if (st_tmp.st_atime != st_tmp.st_mtime &&
+ st_tmp.st_atime > atime)
+ atime = st_tmp.st_atime;
+ if (st_tmp.st_mtime > mtime)
+ mtime = st_tmp.st_mtime;
+ }
+ closedir(dd);
+ }
+
+ if (atime) st_ret.st_atime = atime;
+ if (mtime) st_ret.st_mtime = mtime;
+
+ *st = st_ret_last = st_ret;
+ return 0;
+}

45
INSTALL
View File

@ -50,15 +50,7 @@ considered for the next release.
The file `configure.in' is used to create `configure' by a program
called Autoconf. You only need `configure.in' if you want to change it
or regenerate `configure' using a newer version of Autoconf. If you do
this, make sure you are using Autoconf version 2.10 or newer.
If you need to change `configure.in' or regenerate `configure', you
will need to create two files: `_distribution' and `_patchlevel'.
`_distribution' should contain the major and minor version numbers of
the Bash distribution, for example `2.01'. `_patchlevel' should
contain the patch level of the Bash distribution, `0' for example. The
script `support/mkconffiles' has been provided to automate the creation
of these files.
this, make sure you are using Autoconf version 2.50 or newer.
You can remove the program binaries and object files from the source
code directory by typing `make clean'. To also remove the files that
@ -118,7 +110,9 @@ Installation Names
By default, `make install' will install into `/usr/local/bin',
`/usr/local/man', etc. You can specify an installation prefix other
than `/usr/local' by giving `configure' the option `--prefix=PATH'.
than `/usr/local' by giving `configure' the option `--prefix=PATH', or
by specifying a value for the `DESTDIR' `make' variable when running
`make install'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
@ -130,12 +124,12 @@ Specifying the System Type
==========================
There may be some features `configure' can not figure out
automatically, but needs to determine by the type of host Bash will run
automatically, but need to determine by the type of host Bash will run
on. Usually `configure' can figure that out, but if it prints a
message saying it can not guess the host type, give it the
`--host=TYPE' option. `TYPE' can either be a short name for the system
type, such as `sun4', or a canonical name with three fields:
`CPU-COMPANY-SYSTEM' (e.g., `sparc-sun-sunos4.1.2').
`CPU-COMPANY-SYSTEM' (e.g., `i386-unknown-freebsd4.2').
See the file `support/config.sub' for the possible values of each field.
@ -210,21 +204,22 @@ the Bash `configure' recognizes.
be supplied if your system has an inadequate or incomplete termcap
database.
`--with-glibc-malloc'
Use the GNU libc version of `malloc' in `lib/malloc/gmalloc.c'.
This is not the version of `malloc' that appears in glibc version
2, but a modified version of the `malloc' from glibc version 1.
This is somewhat slower than the default `malloc', but wastes less
space on a per-allocation basis, and will return memory to the
operating system under certain circumstances.
`--with-gnu-malloc'
A synonym for `--with-bash-malloc'.
`--with-installed-readline'
`--with-installed-readline[=PREFIX]'
Define this to make Bash link with a locally-installed version of
Readline rather than the version in `lib/readline'. This works
only with Readline 4.1 and later versions.
only with Readline 4.2 and later versions. If PREFIX is `yes' or
not supplied, `configure' uses the values of the make variables
`includedir' and `libdir', which are subdirectories of `prefix' by
default, to find the installed version of Readline if it is not in
the standard system include and library directories. If PREFIX is
`no', Bash links with the version in `lib/readline'. If PREFIX is
set to any other value, `configure' treats it as a directory
pathname and looks for the installed version of Readline in
subdirectories of that directory (include files in
PREFIX/`include' and the library in PREFIX/`lib').
`--with-purify'
Define this to use the Purify memory allocation checker from
@ -237,6 +232,12 @@ the Bash `configure' recognizes.
There are several `--enable-' options that alter how Bash is compiled
and linked, rather than changing run-time features.
`--enable-largefile'
Enable support for large files
(http://www.sas.com/standards/large_file/x_open.20Mar96.html) if
the operating system requires special compiler options to build
programs which can access large files.
`--enable-profiling'
This builds a Bash binary that produces profiling information to be
processed by `gprof' each time it is executed.

View File

@ -55,6 +55,7 @@ config-bot.h f
config.h.in f
aclocal.m4 f
array.c f
arrayfunc.c f
eval.c f
print_cmd.c f
general.c f
@ -100,8 +101,11 @@ alias.h f
builtins.h f
bashhist.h f
bashline.h f
conftypes.h f
patchlevel.h f
variables.h f
array.h f
arrayfunc.h f
jobs.h f
findcmd.h f
hashlib.h f
@ -134,10 +138,10 @@ redir.h f
bashtypes.h f
mailcheck.h f
pathnames.h f
xmalloc.h f
y.tab.c f
y.tab.h f
parser-built f
builtins/ChangeLog f
builtins/Makefile.in f
builtins/alias.def f
builtins/bind.def f
@ -198,6 +202,7 @@ cross-build/x86-beos.cache f
cross-build/beos-sig.h f
cross-build/opennt.cache f
include/ansi_stdlib.h f
include/chartypes.h f
include/filecntl.h f
include/maxpath.h f
include/memalloc.h f
@ -209,11 +214,11 @@ include/posixwait.h f
include/shtty.h f
include/stdc.h f
include/systimes.h f
include/typemax.h f
include/unionwait.h f
lib/glob/ChangeLog f
lib/glob/Makefile.in f
lib/glob/fnmatch.c f
lib/glob/fnmatch.h f
lib/glob/strmatch.c f
lib/glob/strmatch.h f
lib/glob/glob.c f
lib/glob/glob.h f
lib/glob/collsyms.h f
@ -222,12 +227,17 @@ lib/glob/doc/glob.texi f
lib/glob/ndir.h f
lib/malloc/Makefile.in f
lib/malloc/getpagesize.h f
lib/malloc/imalloc.h f
lib/malloc/mstats.h f
lib/malloc/shmalloc.h f
lib/malloc/table.h f
lib/malloc/alloca.c f
lib/malloc/malloc.c f
lib/malloc/gmalloc.c f
lib/malloc/stats.c f
lib/malloc/table.c f
lib/malloc/trace.c f
lib/malloc/xmalloc.c f
lib/malloc/ogmalloc.c f
lib/malloc/omalloc.c f
lib/malloc/xleaktrace f 755
lib/malloc/stub.c f
lib/malloc/i386-alloca.s f
lib/malloc/x386-alloca.s f
@ -307,10 +317,13 @@ lib/readline/examples/Inputrc f
lib/sh/Makefile.in f
lib/sh/clktck.c f
lib/sh/clock.c f
lib/sh/fmtullong.c f
lib/sh/fmtulong.c f
lib/sh/getcwd.c f
lib/sh/getenv.c f
lib/sh/inet_aton.c f
lib/sh/itos.c f
lib/sh/mailstat.c f
lib/sh/makepath.c f
lib/sh/netopen.c f
lib/sh/oslib.c f
@ -320,6 +333,7 @@ lib/sh/rename.c f
lib/sh/setlinebuf.c f
lib/sh/shquote.c f
lib/sh/shtty.c f
lib/sh/snprintf.c f
lib/sh/spell.c f
lib/sh/strcasecmp.c f
lib/sh/strerror.c f
@ -328,8 +342,12 @@ lib/sh/stringlist.c f
lib/sh/stringvec.c f
lib/sh/strpbrk.c f
lib/sh/strtod.c f
lib/sh/strtoimax.c f
lib/sh/strtol.c f
lib/sh/strtoll.c f
lib/sh/strtoul.c f
lib/sh/strtoull.c f
lib/sh/strtoumax.c f
lib/sh/strtrans.c f
lib/sh/times.c f
lib/sh/timeval.c f
@ -359,7 +377,6 @@ lib/termcap/grot/configure.in f
lib/termcap/grot/COPYING f
lib/termcap/grot/README f
lib/tilde/README f
lib/tilde/ChangeLog f
lib/tilde/Makefile.in f
lib/tilde/doc/tilde.texi f
lib/tilde/doc/Makefile f
@ -378,8 +395,6 @@ CWRU/README f
CWRU/POSIX.NOTES f
CWRU/changelog f
CWRU/sh-redir-hack f
CWRU/empty-for-wordlist f
CWRU/maildir-patch f
CWRU/mh-folder-comp f
doc/FAQ f
doc/Makefile.in f
@ -395,6 +410,7 @@ doc/bashref.info f
doc/article.ms f
doc/htmlpost.sh f 755
support/Makefile.in f
support/bashversion.c f
support/config.guess f
support/config.sub f
support/printenv.sh f 755
@ -427,6 +443,7 @@ examples/complete/complete-examples f
examples/complete/complete.ianmac f
examples/complete/complete2.ianmac f
examples/complete/complete.freebsd f
examples/complete/complete.gnu-longopt f
examples/loadables/README f
examples/loadables/template.c f
examples/loadables/Makefile.in f
@ -434,9 +451,9 @@ examples/loadables/necho.c f
examples/loadables/hello.c f
examples/loadables/print.c f
examples/loadables/realpath.c f
examples/loadables/sprintf.c f
examples/loadables/sleep.c f
examples/loadables/truefalse.c f
examples/loadables/getconf.h f
examples/loadables/getconf.c f
examples/loadables/finfo.c f
examples/loadables/cat.c f
@ -469,6 +486,9 @@ examples/functions/autoload.v2 f
examples/functions/autoload.v3 f
examples/functions/basename f
examples/functions/basename2 f
examples/functions/coproc.bash f
examples/functions/coshell.README f
examples/functions/coshell.bash f
examples/functions/csh-compat f
examples/functions/dirfuncs f
examples/functions/dirname f
@ -737,6 +757,8 @@ tests/tilde.right f
tests/trap.tests f
tests/trap.right f
tests/trap1.sub f 755
tests/trap2.sub f 755
tests/trap2a.sub f 755
tests/type.tests f
tests/type.right f
tests/varenv.right f

View File

@ -1,4 +1,4 @@
# Makefile for bash-2.05, version 2.120
# Makefile for bash-2.05a, version 2.128
#
# Copyright (C) 1996 Free Software Foundation, Inc.
@ -31,13 +31,16 @@ includedir = @includedir@
mandir = @mandir@
manpfx = man
man1ext = 1
man1dir = $(mandir)/$(manpfx)$(man1ext)
man3ext = 3
man3dir = $(mandir)/$(manpfx)$(man3ext)
man1ext = .1
man1dir = $(mandir)/$(manpfx)1
man3ext = .3
man3dir = $(mandir)/$(manpfx)3
htmldir = @htmldir@
# Support an alternate destination root directory for package building
DESTDIR =
topdir = @top_srcdir@
BUILD_DIR = @BUILD_DIR@
srcdir = @srcdir@
@ -73,11 +76,16 @@ PURIFY = @PURIFY@
$(RM) $@
$(CC) $(CCFLAGS) -c $<
# The name of this program and some version information.
EXEEXT = @EXEEXT@
OBJEXT = @OBJEXT@
# The name of this program and some version information.
VERSPROG = bashversion$(EXEEXT)
VERSOBJ = bashversion.$(OBJEXT)
Program = bash$(EXEEXT)
Version = @BASHVERS@
PatchLevel = @BASHPATCH@
PatchLevel = `$(BUILD_DIR)/$(VERSPROG) -p`
RELSTATUS = release
Machine = @host_cpu@
@ -86,7 +94,8 @@ VENDOR = @host_vendor@
MACHTYPE = @host@
# comment out for release
# DEBUG = -DDEBUG
#DEBUG = -DDEBUG
#MALLOC_DEBUG = -DMALLOC_DEBUG
THIS_SH = $(BUILD_DIR)/$(Program)
@ -110,15 +119,18 @@ LOCAL_LDFLAGS = @LOCAL_LDFLAGS@
SYSTEM_FLAGS = -DPROGRAM='"$(Program)"' -DCONF_HOSTTYPE='"$(Machine)"' -DCONF_OSTYPE='"$(OS)"' -DCONF_MACHTYPE='"$(MACHTYPE)"' -DCONF_VENDOR='"$(VENDOR)"'
CCFLAGS = $(PROFILE_FLAGS) $(SYSTEM_FLAGS) $(LOCAL_DEFS) \
$(DEFS) $(LOCAL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(CFLAGS)
CCFLAGS_FOR_BUILD = $(PROFILE_FLAGS) $(SYSTEM_FLAGS) $(LOCAL_DEFS) \
$(DEFS) $(LOCAL_CFLAGS) $(CPPFLAGS) $(INCLUDES)
INCLUDES = -I. @RL_INCLUDE@ -I$(srcdir) -I$(BASHINCDIR) -I$(LIBSRC) -I$(includedir)
CCFLAGS = $(CCFLAGS_FOR_BUILD) $(CFLAGS)
GCC_LINT_FLAGS = -ansi -Wall -Wshadow -Wpointer-arith -Wcast-qual \
-Wwrite-strings -Werror -Wstrict-prototypes \
-Wmissing-prototypes -Wno-implicit
GCC_LINT_CFLAGS = $(CCFLAGS) $(GCC_LINT_FLAGS)
INCLUDES = -I. @RL_INCLUDE@ -I$(srcdir) -I$(BASHINCDIR) -I$(LIBSRC)
GCC_LINT_FLAGS = -Wall -Wshadow -Wpointer-arith -Wcast-qual \
-Wcast-align -Wstrict-prototypes -Wconversion \
-Wmissing-prototypes -Wtraditional -Wredundant-decls -pedantic
GCC_LINT_CFLAGS = $(CCFLAGS_FOR_BUILD) $(GCC_LINT_FLAGS)
#
# Support libraries
@ -129,7 +141,7 @@ dot = .
LIBSUBDIR = lib
LIBSRC = $(srcdir)/$(LIBSUBDIR)
SUBDIR_INCLUDES = -I. @RL_INCLUDE@ -I$(topdir) -I$(topdir)/$(LIBSUBDIR) -I$(includedir)
SUBDIR_INCLUDES = -I. @RL_INCLUDE@ -I$(topdir) -I$(topdir)/$(LIBSUBDIR)
# the bash library
# the library is a mix of functions that the C library does not provide on
@ -153,7 +165,11 @@ SHLIB_SOURCE = ${SH_LIBSRC}/clktck.c ${SH_LIBSRC}/getcwd.c \
${SH_LIBSRC}/pathphys.c ${SH_LIBSRC}/stringlist.c \
${SH_LIBSRC}/stringvec.c ${SH_LIBSRC}/tmpfile.c \
${SH_LIBSRC}/spell.c ${SH_LIBSRC}/strtrans.c \
${SH_LIBSRC}/strindex.c ${SH_LIBSRC}/shquote.c
${SH_LIBSRC}/strindex.c ${SH_LIBSRC}/shquote.c \
${SH_LIBSRC}/snprintf.c ${SH_LIBSRC}/mailstat.c \
${SH_LIBSRC}/fmtulong.c ${SH_LIBSRC}/fmtullong.c \
${SH_LIBSRC}/strtoll.c ${SH_LIBSRC}/strtoull.c \
${SH_LIBSRC}/strtoimax.c ${SH_LIBSRC}/strtoumax.c
SHLIB_LIB = -lsh
SHLIB_LIBNAME = libsh.a
@ -167,6 +183,8 @@ RL_LIBDOC = $(RL_LIBSRC)/doc
RL_LIBDIR = @RL_LIBDIR@
RL_ABSSRC = ${topdir}/$(RL_LIBDIR)
RL_INCLUDEDIR = @RL_INCLUDEDIR@
READLINE_LIB = @READLINE_LIB@
READLINE_LIBRARY = $(RL_LIBDIR)/libreadline.a
READLINE_LDFLAGS = -L${RL_LIBDIR}
@ -252,9 +270,9 @@ GLOB_LIBRARY = $(GLOB_LIBDIR)/libglob.a
GLOB_LDFLAGS = -L$(GLOB_LIBDIR)
GLOB_DEP = $(GLOB_LIBRARY)
GLOB_SOURCE = $(GLOB_LIBSRC)/glob.c $(GLOB_LIBSRC)/fnmatch.c \
$(GLOB_LIBSRC)/glob.h $(GLOB_LIBSRC)/fnmatch.h
GLOB_OBJ = $(GLOB_LIBDIR)/glob.o $(GLOB_LIBDIR)/fnmatch.o
GLOB_SOURCE = $(GLOB_LIBSRC)/glob.c $(GLOB_LIBSRC)/strmatch.c \
$(GLOB_LIBSRC)/glob.h $(GLOB_LIBSRC)/strmatch.h
GLOB_OBJ = $(GLOB_LIBDIR)/glob.o $(GLOB_LIBDIR)/strmatch.o
# The source, object and documentation for the GNU Tilde library.
TILDE_LIBSRC = $(LIBSRC)/tilde
@ -280,17 +298,20 @@ ALLOC_LIBDIR = $(dot)/$(LIBSUBDIR)/malloc
ALLOC_ABSSRC = ${topdir}/$(ALLOC_LIBDIR)
MALLOC_SRC = @MALLOC_SRC@
MALLOC_SOURCE = ${ALLOC_LIBSRC}/${MALLOC_SRC}
MALLOC_CFLAGS = -DRCHECK -Dbotch=programming_error
MALLOC_OTHERSRC = ${ALLOC_LIBSRC}/trace.c ${ALLOC_LIBSRC}/stats.c \
${ALLOC_LIBSRC}/table.c
MALLOC_SOURCE = ${ALLOC_LIBSRC}/${MALLOC_SRC} ${MALLOC_OTHERSRC}
MALLOC_CFLAGS = -DRCHECK -Dbotch=programming_error ${MALLOC_DEBUG}
MALLOC_LIB = -lmalloc
MALLOC_LIBRARY = $(ALLOC_LIBDIR)/libmalloc.a
MALLOC_LDFLAGS = -L$(ALLOC_LIBDIR)
MALLOC_DEP = $(MALLOC_LIBRARY)
MALLOC_LIB = @MALLOC_LIB@
MALLOC_LIBRARY = @MALLOC_LIBRARY@
MALLOC_LDFLAGS = @MALLOC_LDFLAGS@
MALLOC_DEP = @MALLOC_DEP@
ALLOC_HEADERS = $(ALLOC_LIBSRC)/getpagesize.h
ALLOC_HEADERS = $(ALLOC_LIBSRC)/getpagesize.h $(ALLOC_LIBSRC)/shmalloc.h \
$(ALLOC_LIBSRC)/imalloc.h $(ALLOC_LIBSRC)/mstats.h
$(MALLOC_LIBRARY): ${MALLOC_SOURCE}
$(MALLOC_LIBRARY): ${MALLOC_SOURCE} ${ALLOC_HEADERS} config.h
@(cd $(ALLOC_LIBDIR) && \
$(MAKE) $(MFLAGS) \
MALLOC_CFLAGS="$(MALLOC_CFLAGS)" ${MALLOC_TARGET} ) || exit 1
@ -302,7 +323,7 @@ BASHINCFILES = $(BASHINCDIR)/posixstat.h $(BASHINCDIR)/ansi_stdlib.h \
$(BASHINCDIR)/posixjmp.h $(BASHINCDIR)/posixwait.h \
$(BASHINCDIR)/posixtime.h $(BASHINCDIR)/systimes.h \
$(BASHINCDIR)/unionwait.h $(BASHINCDIR)/maxpath.h \
$(BASHINCDIR)/shtty.h
$(BASHINCDIR)/shtty.h $(BASHINCDIR)/typemax.h
LIBRARIES = $(SHLIB_LIB) $(READLINE_LIB) $(HISTORY_LIB) $(TERMCAP_LIB) $(GLOB_LIB) \
$(TILDE_LIB) $(MALLOC_LIB) $(LOCAL_LIBS)
@ -322,17 +343,17 @@ CSOURCES = shell.c eval.c parse.y general.c make_cmd.c print_cmd.c y.tab.c \
dispose_cmd.c execute_cmd.c variables.c $(GLOBC) version.c \
expr.c copy_cmd.c flags.c subst.c hashcmd.c hashlib.c mailcheck.c \
test.c trap.c alias.c jobs.c nojobs.c $(ALLOC_FILES) braces.c \
input.c bashhist.c array.c sig.c pathexp.c \
input.c bashhist.c array.c arrayfunc.c sig.c pathexp.c \
unwind_prot.c siglist.c bashline.c bracecomp.c error.c \
list.c stringlib.c locale.c findcmd.c redir.c \
pcomplete.c pcomplib.c syntax.c xmalloc.c
HSOURCES = shell.h flags.h trap.h hashcmd.h hashlib.h jobs.h builtins.h \
general.h variables.h config.h $(ALLOC_HEADERS) alias.h \
quit.h unwind_prot.h syntax.h \
quit.h unwind_prot.h syntax.h ${GRAM_H} \
command.h input.h error.h bashansi.h dispose_cmd.h make_cmd.h \
subst.h externs.h siglist.h bashhist.h bashline.h bashtypes.h \
array.h sig.h mailcheck.h bashintl.h bashjmp.h ${GRAM_H} \
array.h arrayfunc.h sig.h mailcheck.h bashintl.h bashjmp.h \
execute_cmd.h parser.h pathexp.h pathnames.h pcomplete.h \
$(BASHINCFILES)
@ -343,14 +364,15 @@ SIGNAMES_H = @SIGNAMES_H@
# object files chosen based on running of configure
JOBS_O = @JOBS_O@
SIGLIST_O = @SIGLIST_O@
# Matching object files.
OBJECTS = shell.o eval.o y.tab.o general.o make_cmd.o print_cmd.o $(GLOBO) \
dispose_cmd.o execute_cmd.o variables.o copy_cmd.o error.o \
expr.o flags.o $(JOBS_O) subst.o hashcmd.o hashlib.o mailcheck.o \
trap.o input.o unwind_prot.o pathexp.o sig.o test.o version.o \
alias.o array.o braces.o bracecomp.o bashhist.o bashline.o \
siglist.o list.o stringlib.o locale.o findcmd.o redir.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 \
pcomplete.o pcomplib.o syntax.o xmalloc.o
# Where the source code of the shell builtins resides.
@ -414,7 +436,7 @@ TESTS_SUPPORT = recho$(EXEEXT) zecho$(EXEEXT) printenv$(EXEEXT)
CREATED_SUPPORT = signames.h recho$(EXEEXT) zecho$(EXEEXT) printenv$(EXEEXT) \
tests/recho$(EXEEXT) tests/zecho$(EXEEXT) \
tests/printenv$(EXEEXT) mksignames$(EXEEXT) lsignames.h \
mksyntax${EXEEXT} syntax.c
mksyntax${EXEEXT} syntax.c $(VERSPROG) $(VERSOBJ)
CREATED_CONFIGURE = config.h config.cache config.status config.log \
stamp-h
CREATED_MAKEFILES = Makefile builtins/Makefile doc/Makefile \
@ -435,16 +457,16 @@ $(Program): .build $(OBJECTS) $(BUILTINS_DEP) $(LIBDEP)
ls -l $(Program)
size $(Program)
.build: $(SOURCES) config.h Makefile version.h
.build: $(SOURCES) config.h Makefile version.h $(VERSPROG)
@echo
@echo " ***********************************************************"
@echo " * *"
@echo " * Making Bash-$(Version).$(PatchLevel)-$(RELSTATUS) for a $(Machine) running $(OS)"
@echo " * `$(BUILD_DIR)/$(VERSPROG) -l`"
@echo " * *"
@echo " ***********************************************************"
@echo
bashbug: $(SUPPORT_SRC)bashbug.sh config.h Makefile
bashbug: $(SUPPORT_SRC)bashbug.sh config.h Makefile $(VERSPROG)
@sed -e "s%!MACHINE!%$(Machine)%" -e "s%!OS!%$(OS)%" \
-e "s%!CFLAGS!%$(CCFLAGS)%" -e "s%!CC!%$(CC)%" \
-e "s%!RELEASE!%$(Version)%" -e "s%!PATCHLEVEL!%$(PatchLevel)%" \
@ -457,10 +479,16 @@ strip: $(Program) .made
ls -l $(Program)
size $(Program)
lint:
${MAKE} ${MFLAGS} CFLAGS='${GCC_LINT_FLAGS}' .made
version.h: $(SOURCES) config.h Makefile
$(SHELL) $(SUPPORT_SRC)mkversion.sh -b -s $(RELSTATUS) -d $(Version) -p $(PatchLevel) -o newversion.h \
$(SHELL) $(SUPPORT_SRC)mkversion.sh -b -S ${topdir} -s $(RELSTATUS) -d $(Version) -o newversion.h \
&& mv newversion.h version.h
bashversion$(EXEEXT): patchlevel.h conftypes.h version.h version.o $(SUPPORT_SRC)bashversion.c
$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) $(CPPFLAGS) -o $@ $(SUPPORT_SRC)bashversion.c version.o
# old rules
GRAM_H = parser-built
y.tab.o: y.tab.c ${GRAM_H} command.h ${BASHINCDIR}/stdc.h input.h
@ -471,6 +499,7 @@ ${GRAM_H}: y.tab.h
y.tab.c y.tab.h: parse.y
# -if test -f y.tab.h; then mv -f y.tab.h old-y.tab.h; fi
$(YACC) -d $(srcdir)/parse.y
touch parser-built
# -if cmp -s old-y.tab.h y.tab.h; then mv old-y.tab.h y.tab.h; else cp -p y.tab.h ${GRAM_H}; fi
# experimental new rules - work with GNU make but not BSD (or OSF) make
@ -493,7 +522,7 @@ $(HISTORY_LIBRARY): config.h $(HISTORY_SOURCE)
$(GLOB_LIBRARY): config.h $(GLOB_SOURCE)
@echo making $@ in ${GLOB_LIBDIR}
@(cd ${GLOB_LIBDIR} && \
$(MAKE) $(MFLAGS) libglob.a) || exit 1
$(MAKE) $(MFLAGS) DEBUG=${DEBUG} libglob.a) || exit 1
$(TILDE_LIBRARY): config.h $(TILDE_SOURCE)
@echo making $@ in ${TILDE_LIBDIR}
@ -508,13 +537,13 @@ $(TERMCAP_LIBRARY): config.h ${TERMCAP_SOURCE}
$(SHLIB_LIBRARY): config.h ${SHLIB_SOURCE}
@echo making $@ in ${SH_LIBDIR}
@(cd ${SH_LIBDIR} && \
$(MAKE) $(MFLAGS) ${SHLIB_LIBNAME}) || exit 1
$(MAKE) $(MFLAGS) DEBUG=${DEBUG} ${SHLIB_LIBNAME}) || exit 1
mksignames$(EXEEXT): $(SUPPORT_SRC)mksignames.c
$(CC_FOR_BUILD) $(CCFLAGS) $(CPPFLAGS) -o $@ $(SUPPORT_SRC)mksignames.c
$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) $(CPPFLAGS) -o $@ $(SUPPORT_SRC)mksignames.c
mksyntax$(EXEEXT): ${srcdir}/mksyntax.c config.h syntax.h
${CC_FOR_BUILD} ${CCFLAGS} ${CPPFLAGS} -o $@ ${srcdir}/mksyntax.c
mksyntax$(EXEEXT): ${srcdir}/mksyntax.c config.h syntax.h ${BASHINCDIR}/chartypes.h
${CC_FOR_BUILD} ${CCFLAGS_FOR_BUILD} ${CPPFLAGS} -o $@ ${srcdir}/mksyntax.c
# make a list of signals for the local system -- this is done when we're
# *not* cross-compiling
@ -531,14 +560,14 @@ syntax.c: mksyntax${EXEEXT} $(srcdir)/syntax.h
./mksyntax -o $@
$(BUILTINS_LIBRARY): $(BUILTIN_DEFS) $(BUILTIN_C_SRC) config.h ${BASHINCDIR}/memalloc.h
@(cd $(DEFDIR) && $(MAKE) $(MFLAGS) libbuiltins.a ) || exit 1
@(cd $(DEFDIR) && $(MAKE) $(MFLAGS) DEBUG=${DEBUG} libbuiltins.a ) || exit 1
# these require special rules to circumvent make builtin rules
${DEFDIR}/common.o: $(BUILTIN_SRCDIR)/common.c
@(cd $(DEFDIR) && $(MAKE) $(MFLAGS) common.o) || exit 1
@(cd $(DEFDIR) && $(MAKE) $(MFLAGS) DEBUG=${DEBUG} common.o) || exit 1
${DEFDIR}/bashgetopt.o: $(BUILTIN_SRCDIR)/bashgetopt.c
@(cd $(DEFDIR) && $(MAKE) $(MFLAGS) bashgetopt.o) || exit 1
@(cd $(DEFDIR) && $(MAKE) $(MFLAGS) DEBUG=${DEBUG} bashgetopt.o) || exit 1
${DEFDIR}/builtext.h: $(BUILTIN_DEFS)
@(cd $(DEFDIR) && $(MAKE) $(MFLAGS) builtext.h ) || exit 1
@ -593,28 +622,29 @@ TAGS: $(SOURCES) $(BUILTIN_C_SRC) $(LIBRARY_SOURCE)
# Targets that actually do things not part of the build
installdirs:
@${SHELL} $(SUPPORT_SRC)mkdirs $(bindir)
@${SHELL} $(SUPPORT_SRC)mkdirs $(man1dir) $(man3dir)
@${SHELL} $(SUPPORT_SRC)mkdirs $(infodir)
@${SHELL} $(SUPPORT_SRC)mkdirs $(DESTDIR)$(bindir)
@${SHELL} $(SUPPORT_SRC)mkdirs $(DESTDIR)$(man1dir)
@${SHELL} $(SUPPORT_SRC)mkdirs $(DESTDIR)$(infodir)
install: .made installdirs
$(INSTALL_PROGRAM) $(INSTALLMODE) $(Program) $(bindir)/$(Program)
$(INSTALL_PROGRAM) $(INSTALLMODE2) bashbug $(bindir)/bashbug
$(INSTALL_PROGRAM) $(INSTALLMODE) $(Program) $(DESTDIR)$(bindir)/$(Program)
$(INSTALL_PROGRAM) $(INSTALLMODE2) bashbug $(DESTDIR)$(bindir)/bashbug
-( cd $(DOCDIR) ; $(MAKE) $(MFLAGS) \
man1dir=$(man1dir) man1ext=$(man1ext) \
man3dir=$(man3dir) man3ext=$(man3ext) \
infodir=$(infodir) htmldir=$(htmldir) $@ )
infodir=$(infodir) htmldir=$(htmldir) DESTDIR=$(DESTDIR) $@ )
install-strip:
$(MAKE) $(MFLAGS) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' \
prefix=${prefix} exec_prefix=${exec_prefix} install
prefix=${prefix} exec_prefix=${exec_prefix} \
DESTDIR=$(DESTDIR) install
uninstall: .made
$(RM) $(bindir)/$(Program) $(bindir)/bashbug
$(RM) $(DESTDIR)$(bindir)/$(Program) $(DESTDIR)$(bindir)/bashbug
-( cd $(DOCDIR) ; $(MAKE) $(MFLAGS) \
man1dir=$(man1dir) man1ext=$(man1ext) \
man3dir=$(man3dir) man3ext=$(man3ext) \
infodir=$(infodir) $@ )
infodir=$(infodir) htmldir=$(htmldir) DESTDIR=$(DESTDIR) $@ )
.PHONY: basic-clean clean realclean maintainer-clean distclean mostlyclean
basic-clean:
@ -660,7 +690,7 @@ distclean: basic-clean
maintainer-clean: basic-clean
@echo This command is intended for maintainers to use.
@echo It deletes files that may require special tools to rebuild.
$(RM) y.tab.c y.tab.h parser-built.h tags TAGS
$(RM) y.tab.c y.tab.h parser-built tags TAGS
( cd $(DOCDIR) && $(MAKE) $(MFLAGS) $@ )
( cd builtins && $(MAKE) $(MFLAGS) $@ )
-(cd $(RL_LIBDIR) && $(MAKE) $(MFLAGS) $@)
@ -682,7 +712,7 @@ zecho$(EXEEXT): $(SUPPORT_SRC)zecho.c
printenv$(EXEEXT): $(SUPPORT_SRC)printenv.c
@$(CC) $(CCFLAGS) -o $@ $(SUPPORT_SRC)printenv.c
test tests check: force $(Program) $(TESTS_SUPPORT)
test tests check: force $(Program) $(TESTS_SUPPORT)
@-test -d tests || mkdir tests
@cp $(TESTS_SUPPORT) tests
@( cd $(srcdir)/tests && \
@ -703,6 +733,10 @@ depend: depends
depends: force
$(Program) $(SUPPORT_SRC)mkdep -c ${CC} -- ${CCFLAGS} ${CSOURCES}
#### PRIVATE TARGETS ####
hashtest: hashlib.c
$(CC) -DTEST_HASHING $(CCFLAGS) -o $@ $(srcdir)/hashlib.c
############################ DEPENDENCIES ###############################
# Files that depend on the definitions in config-top.h, which are not meant
@ -724,158 +758,166 @@ builtins/kill.o: config-top.h
# shell basics
copy_cmd.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
copy_cmd.o: general.h bashtypes.h variables.h array.h hashlib.h
copy_cmd.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
copy_cmd.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
copy_cmd.o: make_cmd.h subst.h sig.h pathnames.h externs.h
dispose_cmd.o: bashansi.h ${BASHINCDIR}/ansi_stdlib.h
dispose_cmd.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h
dispose_cmd.o: error.h general.h bashtypes.h variables.h array.h hashlib.h
dispose_cmd.o: error.h general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
dispose_cmd.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
dispose_cmd.o: make_cmd.h subst.h sig.h pathnames.h externs.h
error.o: config.h bashtypes.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h flags.h ${BASHINCDIR}/stdc.h error.h
error.o: command.h general.h externs.h input.h bashhist.h
error.o: command.h general.h xmalloc.h externs.h input.h bashhist.h
eval.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h trap.h flags.h ${DEFSRC}/common.h
eval.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
eval.o: general.h bashtypes.h variables.h array.h hashlib.h
eval.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
eval.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
eval.o: make_cmd.h subst.h sig.h pathnames.h externs.h
eval.o: input.h execute_cmd.h
execute_cmd.o: config.h bashtypes.h ${BASHINCDIR}/filecntl.h ${BASHINCDIR}/posixstat.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
execute_cmd.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
execute_cmd.o: general.h bashtypes.h variables.h array.h hashlib.h
execute_cmd.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
execute_cmd.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
execute_cmd.o: make_cmd.h subst.h sig.h pathnames.h externs.h
execute_cmd.o: ${BASHINCDIR}/memalloc.h ${GRAM_H} flags.h builtins.h jobs.h quit.h siglist.h
execute_cmd.o: execute_cmd.h findcmd.h redir.h trap.h test.h pathexp.h
execute_cmd.o: $(DEFSRC)/common.h ${DEFDIR}/builtext.h ${GLOB_LIBSRC}/fnmatch.h
execute_cmd.o: ${BASHINCDIR}/posixtime.h
execute_cmd.o: $(DEFSRC)/common.h ${DEFDIR}/builtext.h ${GLOB_LIBSRC}/strmatch.h
execute_cmd.o: ${BASHINCDIR}/posixtime.h ${BASHINCDIR}/chartypes.h
expr.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
expr.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
expr.o: general.h bashtypes.h variables.h array.h hashlib.h
expr.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
expr.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
expr.o: make_cmd.h subst.h sig.h pathnames.h externs.h
expr.o: ${BASHINCDIR}/chartypes.h
findcmd.o: config.h bashtypes.h ${BASHINCDIR}/filecntl.h ${BASHINCDIR}/posixstat.h bashansi.h
findcmd.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/memalloc.h shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h
findcmd.o: ${BASHINCDIR}/stdc.h error.h general.h variables.h quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h
findcmd.o: ${BASHINCDIR}/stdc.h error.h general.h xmalloc.h variables.h arrayfunc.h conftypes.h quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h
findcmd.o: dispose_cmd.h make_cmd.h subst.h sig.h pathnames.h externs.h
findcmd.o: flags.h hashlib.h pathexp.h hashcmd.h
findcmd.o: ${BASHINCDIR}/chartypes.h
flags.o: config.h flags.h
flags.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
flags.o: general.h bashtypes.h variables.h array.h hashlib.h
flags.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
flags.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
flags.o: make_cmd.h subst.h sig.h pathnames.h externs.h
flags.o: make_cmd.h subst.h sig.h pathnames.h externs.h bashhist.h
general.o: config.h bashtypes.h ${BASHINCDIR}/posixstat.h ${BASHINCDIR}/filecntl.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
general.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
general.o: general.h bashtypes.h variables.h array.h hashlib.h
general.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
general.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
general.o: make_cmd.h subst.h sig.h pathnames.h externs.h
general.o: ${BASHINCDIR}/maxpath.h ${BASHINCDIR}/posixtime.h
general.o: ${BASHINCDIR}/chartypes.h
hashcmd.o: config.h ${BASHINCDIR}/posixstat.h bashtypes.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
hashcmd.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
hashcmd.o: general.h bashtypes.h variables.h array.h hashcmd.h
hashcmd.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashcmd.h
hashcmd.o: execute_cmd.h findcmd.h ${BASHINCDIR}/stdc.h
hashlib.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
hashlib.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
hashlib.o: general.h bashtypes.h variables.h array.h hashlib.h
hashlib.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
hashlib.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
hashlib.o: make_cmd.h subst.h sig.h pathnames.h externs.h
input.o: config.h bashtypes.h ${BASHINCDIR}/filecntl.h ${BASHINCDIR}/posixstat.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
input.o: command.h ${BASHINCDIR}/stdc.h general.h input.h error.h externs.h
input.o: command.h ${BASHINCDIR}/stdc.h general.h xmalloc.h input.h error.h externs.h
list.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
list.o: general.h bashtypes.h variables.h array.h hashlib.h
list.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
list.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
list.o: make_cmd.h subst.h sig.h pathnames.h externs.h
locale.o: config.h bashtypes.h bashintl.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
locale.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
locale.o: general.h bashtypes.h variables.h array.h hashlib.h
locale.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
locale.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
locale.o: make_cmd.h subst.h sig.h pathnames.h externs.h
locale.o: ${BASHINCDIR}/chartypes.h
mailcheck.o: config.h bashtypes.h ${BASHINCDIR}/posixstat.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
mailcheck.o: ${BASHINCDIR}/posixtime.h
mailcheck.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
mailcheck.o: general.h bashtypes.h variables.h array.h hashlib.h
mailcheck.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
mailcheck.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
mailcheck.o: make_cmd.h subst.h sig.h pathnames.h externs.h
mailcheck.o: execute_cmd.h mailcheck.h
make_cmd.o: config.h bashtypes.h ${BASHINCDIR}/filecntl.h bashansi.h
make_cmd.o: command.h ${BASHINCDIR}/stdc.h general.h error.h flags.h make_cmd.h
make_cmd.o: variables.h array.h hashlib.h subst.h input.h externs.h
make_cmd.o: command.h ${BASHINCDIR}/stdc.h general.h xmalloc.h error.h flags.h make_cmd.h
make_cmd.o: variables.h arrayfunc.h conftypes.h array.h hashlib.h subst.h input.h externs.h
make_cmd.o: jobs.h quit.h siglist.h syntax.h
y.tab.o: config.h bashtypes.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/memalloc.h
y.tab.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
y.tab.o: general.h bashtypes.h variables.h array.h hashlib.h
y.tab.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
y.tab.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
y.tab.o: make_cmd.h subst.h sig.h pathnames.h externs.h
y.tab.o: make_cmd.h subst.h sig.h pathnames.h externs.h test.h
y.tab.o: trap.h flags.h parser.h input.h mailcheck.h $(DEFSRC)/common.h
y.tab.o: $(DEFDIR)/builtext.h bashline.h bashhist.h jobs.h siglist.h alias.h
pathexp.o: config.h bashtypes.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
pathexp.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
pathexp.o: general.h bashtypes.h variables.h array.h hashlib.h
pathexp.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
pathexp.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
pathexp.o: make_cmd.h subst.h sig.h pathnames.h externs.h
pathexp.o: pathexp.h flags.h
pathexp.o: $(GLOB_LIBSRC)/glob.h $(GLOB_LIBSRC)/fnmatch.h
pathexp.o: $(GLOB_LIBSRC)/glob.h $(GLOB_LIBSRC)/strmatch.h
print_cmd.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
print_cmd.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
print_cmd.o: general.h bashtypes.h variables.h array.h hashlib.h
print_cmd.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
print_cmd.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
print_cmd.o: make_cmd.h subst.h sig.h pathnames.h externs.h
print_cmd.o: ${GRAM_H} $(DEFSRC)/common.h
redir.o: config.h bashtypes.h ${BASHINCDIR}/posixstat.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/filecntl.h
redir.o: ${BASHINCDIR}/memalloc.h shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
redir.o: general.h variables.h array.h hashlib.h quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h
redir.o: general.h xmalloc.h variables.h arrayfunc.h conftypes.h array.h hashlib.h quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h
redir.o: dispose_cmd.h make_cmd.h subst.h sig.h pathnames.h externs.h
redir.o: flags.h execute_cmd.h redir.h input.h
shell.o: config.h bashtypes.h ${BASHINCDIR}/posixstat.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/filecntl.h
shell.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
shell.o: general.h bashtypes.h variables.h array.h hashlib.h
shell.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
shell.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
shell.o: make_cmd.h subst.h sig.h pathnames.h externs.h
shell.o: make_cmd.h subst.h sig.h pathnames.h externs.h version.h
shell.o: flags.h trap.h mailcheck.h builtins.h $(DEFSRC)/common.h
shell.o: jobs.h siglist.h input.h execute_cmd.h findcmd.h bashhist.h
shell.o: ${GLOB_LIBSRC}/fnmatch.h
shell.o: ${GLOB_LIBSRC}/strmatch.h ${BASHINCDIR}/posixtime.h
sig.o: config.h bashtypes.h
sig.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
sig.o: general.h bashtypes.h variables.h array.h hashlib.h
sig.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
sig.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
sig.o: make_cmd.h subst.h sig.h pathnames.h externs.h
sig.o: jobs.h siglist.h trap.h $(DEFSRC)/common.h bashline.h bashhist.h
siglist.o: config.h bashtypes.h siglist.h trap.h
stringlib.o: bashtypes.h
stringlib.o: bashtypes.h ${BASHINCDIR}/chartypes.h
stringlib.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
stringlib.o: general.h bashtypes.h variables.h array.h hashlib.h
stringlib.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
stringlib.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
stringlib.o: make_cmd.h subst.h sig.h pathnames.h externs.h
stringlib.o: ${GLOB_LIBSRC}/glob.h ${GLOB_LIBSRC}/strmatch.h
subst.o: config.h bashtypes.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/posixstat.h
subst.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
subst.o: general.h bashtypes.h variables.h array.h hashlib.h
subst.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
subst.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
subst.o: make_cmd.h subst.h sig.h pathnames.h externs.h
subst.o: flags.h jobs.h siglist.h execute_cmd.h ${BASHINCDIR}/filecntl.h trap.h pathexp.h
subst.o: mailcheck.h input.h $(DEFSRC)/getopt.h $(DEFSRC)/common.h
subst.o: bashline.h bashhist.h ${GLOB_LIBSRC}/fnmatch.h
subst.o: bashline.h bashhist.h ${GLOB_LIBSRC}/strmatch.h
subst.o: ${BASHINCDIR}/chartypes.h
test.o: bashtypes.h ${BASHINCDIR}/posixstat.h ${BASHINCDIR}/filecntl.h
test.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
test.o: general.h bashtypes.h variables.h array.h hashlib.h
test.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
test.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
test.o: make_cmd.h subst.h sig.h pathnames.h externs.h test.h
test.o: ${DEFSRC}/common.h
trap.o: config.h bashtypes.h trap.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
trap.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
trap.o: general.h bashtypes.h variables.h array.h hashlib.h
trap.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
trap.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
trap.o: make_cmd.h subst.h sig.h pathnames.h externs.h
trap.o: signames.h $(DEFSRC)/common.h
unwind_prot.o: config.h bashtypes.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h command.h ${BASHINCDIR}/stdc.h
unwind_prot.o: general.h unwind_prot.h quit.h sig.h
unwind_prot.o: general.h xmalloc.h unwind_prot.h quit.h sig.h
variables.o: config.h bashtypes.h ${BASHINCDIR}/posixstat.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
variables.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
variables.o: general.h bashtypes.h variables.h array.h hashlib.h
variables.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
variables.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
variables.o: make_cmd.h subst.h sig.h pathnames.h externs.h
variables.o: flags.h execute_cmd.h mailcheck.h input.h $(DEFSRC)/common.h
variables.o: findcmd.h bashhist.h
variables.o: pcomplete.h
version.o: version.h .build
variables.o: findcmd.h bashhist.h hashcmd.h pathexp.h
variables.o: pcomplete.h version.h ${BASHINCDIR}/chartypes.h
variables.o: ${BASHINCDIR}/posixtime.h
version.o: version.h conftypes.h patchlevel.h
xmalloc.o: config.h bashtypes.h ${BASHINCDIR}/ansi_stdlib.h error.h
# job control
@ -883,69 +925,77 @@ xmalloc.o: config.h bashtypes.h ${BASHINCDIR}/ansi_stdlib.h error.h
jobs.o: config.h bashtypes.h trap.h ${BASHINCDIR}/filecntl.h input.h ${BASHINCDIR}/shtty.h
jobs.o: bashansi.h ${BASHINCDIR}/ansi_stdlib.h
jobs.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
jobs.o: general.h bashtypes.h variables.h array.h hashlib.h
jobs.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
jobs.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
jobs.o: make_cmd.h subst.h sig.h pathnames.h externs.h
jobs.o: jobs.h flags.h $(DEFSRC)/common.h $(DEFDIR)/builtext.h
jobs.o: ${BASHINCDIR}/posixwait.h ${BASHINCDIR}/unionwait.h
jobs.o: ${BASHINCDIR}/posixtime.h
nojobs.o: config.h bashtypes.h ${BASHINCDIR}/filecntl.h bashjmp.h ${BASHINCDIR}/posixjmp.h
nojobs.o: command.h ${BASHINCDIR}/stdc.h general.h jobs.h quit.h siglist.h externs.h
nojobs.o: command.h ${BASHINCDIR}/stdc.h general.h xmalloc.h jobs.h quit.h siglist.h externs.h
nojobs.o: sig.h error.h ${BASHINCDIR}/shtty.h input.h
# shell features that may be compiled in
array.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
array.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
array.o: general.h bashtypes.h variables.h array.h hashlib.h
array.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
array.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
array.o: make_cmd.h subst.h sig.h pathnames.h externs.h
array.o: $(DEFSRC)/common.h
arrayfunc.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
arrayfunc.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
arrayfunc.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
arrayfunc.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
arrayfunc.o: make_cmd.h subst.h sig.h pathnames.h externs.h
arrayfunc.o: $(DEFSRC)/common.h
braces.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
braces.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
braces.o: general.h bashtypes.h variables.h array.h hashlib.h
braces.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
braces.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
braces.o: make_cmd.h subst.h sig.h pathnames.h externs.h
alias.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h command.h ${BASHINCDIR}/stdc.h
alias.o: general.h bashtypes.h externs.h alias.h
alias.o: general.h xmalloc.h bashtypes.h externs.h alias.h
alias.o: pcomplete.h
alias.o: ${BASHINCDIR}/chartypes.h
pcomplib.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h bashtypes.h
pcomplib.o: ${BASHINCDIR}/stdc.h hashlib.h pcomplete.h shell.h syntax.h
pcomplib.o: bashjmp.h command.h general.h error.h variables.h quit.h
pcomplib.o: bashjmp.h command.h general.h xmalloc.h error.h variables.h arrayfunc.h conftypes.h quit.h
pcomplib.o: unwind_prot.h dispose_cmd.h make_cmd.h subst.h sig.h pathnames.h
pcomplib.o: externs.h ${BASHINCDIR}/maxpath.h
pcomplete.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h bashtypes.h
pcomplete.o: ${BASHINCDIR}/stdc.h hashlib.h pcomplete.h shell.h syntax.h
pcomplete.o: bashjmp.h command.h general.h error.h variables.h quit.h
pcomplete.o: bashjmp.h command.h general.h xmalloc.h error.h variables.h arrayfunc.h conftypes.h quit.h
pcomplete.o: unwind_prot.h dispose_cmd.h make_cmd.h subst.h sig.h pathnames.h
pcomplete.o: externs.h ${BASHINCDIR}/maxpath.h
pcomplete.o: externs.h ${BASHINCDIR}/maxpath.h execute_cmd.h
# library support files
bashhist.o: config.h bashtypes.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/posixstat.h
bashhist.o: ${BASHINCDIR}/filecntl.h
bashhist.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
bashhist.o: general.h bashtypes.h variables.h array.h hashlib.h
bashhist.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
bashhist.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
bashhist.o: make_cmd.h subst.h sig.h pathnames.h externs.h
bashhist.o: flags.h input.h parser.h pathexp.h $(DEFSRC)/common.h bashline.h
bashhist.o: $(GLOB_LIBSRC)/fnmatch.h
bashhist.o: $(GLOB_LIBSRC)/strmatch.h
bashline.o: config.h bashtypes.h ${BASHINCDIR}/posixstat.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
bashline.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
bashline.o: general.h bashtypes.h variables.h array.h hashlib.h
bashline.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
bashline.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
bashline.o: make_cmd.h subst.h sig.h pathnames.h externs.h
bashline.o: builtins.h bashhist.h bashline.h execute_cmd.h findcmd.h pathexp.h
bashline.o: $(DEFSRC)/common.h $(GLOB_LIBSRC)/glob.h alias.h
bashline.o: pcomplete.h
bashline.o: pcomplete.h ${BASHINCDIR}/chartypes.h
bracecomp.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
bracecomp.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
bracecomp.o: general.h bashtypes.h variables.h array.h hashlib.h
bracecomp.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
bracecomp.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
bracecomp.o: make_cmd.h subst.h sig.h pathnames.h externs.h
bracecomp.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h command.h hashlib.h builtins.h general.h
bracecomp.o: quit.h alias.h config.h variables.h
bracecomp.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h command.h hashlib.h builtins.h general.h xmalloc.h
bracecomp.o: quit.h alias.h config.h variables.h arrayfunc.h conftypes.h
bracecomp.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
# library dependencies
@ -977,186 +1027,192 @@ variables.o: $(TILDE_LIBSRC)/tilde.h
# builtin c sources
builtins/bashgetopt.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
builtins/bashgetopt.o: shell.h syntax.h config.h bashjmp.h command.h general.h error.h
builtins/bashgetopt.o: variables.h quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
builtins/bashgetopt.o: shell.h syntax.h config.h bashjmp.h command.h general.h xmalloc.h error.h
builtins/bashgetopt.o: variables.h arrayfunc.h conftypes.h quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
builtins/bashgetopt.o: make_cmd.h subst.h sig.h pathnames.h externs.h
builtins/bashgetopt.o: $(DEFSRC)/common.h
builtins/bashgetopt.o: ${BASHINCDIR}/chartypes.h
builtins/common.o: bashtypes.h ${BASHINCDIR}/posixstat.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
builtins/common.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h command.h
builtins/common.o: ${BASHINCDIR}/memalloc.h variables.h input.h siglist.h
builtins/common.o: ${BASHINCDIR}/memalloc.h variables.h arrayfunc.h conftypes.h input.h siglist.h
builtins/common.o: quit.h unwind_prot.h ${BASHINCDIR}/maxpath.h jobs.h builtins.h
builtins/common.o: dispose_cmd.h make_cmd.h subst.h externs.h bashhist.h
builtins/common.o: execute_cmd.h ${BASHINCDIR}/stdc.h general.h error.h pathnames.h
builtins/common.o: execute_cmd.h ${BASHINCDIR}/stdc.h general.h xmalloc.h error.h pathnames.h
builtins/common.o: ${DEFDIR}/builtext.h
builtins/common.o: ${BASHINCDIR}/chartypes.h
builtins/evalfile.o: bashtypes.h ${BASHINCDIR}/posixstat.h ${BASHINCDIR}/filecntl.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
builtins/evalfile.o: shell.h syntax.h config.h bashjmp.h command.h general.h error.h
builtins/evalfile.o: variables.h quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
builtins/evalfile.o: shell.h syntax.h config.h bashjmp.h command.h general.h xmalloc.h error.h
builtins/evalfile.o: variables.h arrayfunc.h conftypes.h quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
builtins/evalfile.o: make_cmd.h subst.h sig.h pathnames.h externs.h
builtins/evalfile.o: jobs.h builtins.h flags.h input.h execute_cmd.h
builtins/evalfile.o: bashhist.h $(DEFSRC)/common.h
builtins/evalstring.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
builtins/evalstring.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h command.h siglist.h
builtins/evalstring.o: ${BASHINCDIR}/memalloc.h variables.h input.h
builtins/evalstring.o: ${BASHINCDIR}/memalloc.h variables.h arrayfunc.h conftypes.h input.h
builtins/evalstring.o: quit.h unwind_prot.h ${BASHINCDIR}/maxpath.h jobs.h builtins.h
builtins/evalstring.o: dispose_cmd.h make_cmd.h subst.h externs.h
builtins/evalstring.o: jobs.h builtins.h flags.h input.h execute_cmd.h
builtins/evalstring.o: bashhist.h $(DEFSRC)/common.h
builtins/getopt.o: config.h ${BASHINCDIR}/memalloc.h
builtins/getopt.o: shell.h syntax.h bashjmp.h command.h general.h error.h
builtins/getopt.o: variables.h quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
builtins/getopt.o: shell.h syntax.h bashjmp.h command.h general.h xmalloc.h error.h
builtins/getopt.o: variables.h arrayfunc.h conftypes.h quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
builtins/getopt.o: make_cmd.h subst.h sig.h pathnames.h externs.h
builtins/getopt.o: $(DEFSRC)/getopt.h
builtins/mkbuiltins.o: config.h bashtypes.h ${BASHINCDIR}/posixstat.h ${BASHINCDIR}/filecntl.h
builtins/mkbuiltins.o: bashansi.h ${BASHINCDIR}/ansi_stdlib.h
# builtin def files
builtins/alias.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h ${BASHINCDIR}/maxpath.h
builtins/alias.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/alias.o: quit.h $(DEFSRC)/common.h
builtins/alias.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h command.h ${BASHINCDIR}/stdc.h unwind_prot.h
builtins/alias.o: dispose_cmd.h make_cmd.h subst.h externs.h variables.h
builtins/bind.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h ${BASHINCDIR}/maxpath.h
builtins/alias.o: dispose_cmd.h make_cmd.h subst.h externs.h variables.h arrayfunc.h conftypes.h
builtins/bind.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/bind.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/bind.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h quit.h
builtins/bind.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h quit.h
builtins/bind.o: $(DEFSRC)/bashgetopt.h
builtins/break.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h ${BASHINCDIR}/maxpath.h
builtins/break.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h quit.h
builtins/break.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/break.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h quit.h
builtins/break.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/builtin.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h ${BASHINCDIR}/maxpath.h
builtins/builtin.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/builtin.o: quit.h $(DEFSRC)/common.h
builtins/builtin.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h
builtins/builtin.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/builtin.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/cd.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h ${BASHINCDIR}/maxpath.h
builtins/cd.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h
builtins/cd.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/cd.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/cd.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/cd.o: $(DEFSRC)/common.h quit.h
builtins/command.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h ${BASHINCDIR}/maxpath.h
builtins/command.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/command.o: quit.h $(DEFSRC)/bashgetopt.h
builtins/command.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h
builtins/command.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/command.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/declare.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h ${BASHINCDIR}/maxpath.h
builtins/declare.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h quit.h
builtins/declare.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/declare.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h quit.h
builtins/declare.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/echo.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h ${BASHINCDIR}/maxpath.h
builtins/echo.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h quit.h
builtins/echo.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/echo.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h quit.h
builtins/echo.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/enable.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h ${BASHINCDIR}/maxpath.h
builtins/enable.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h quit.h
builtins/enable.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/enable.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h quit.h
builtins/enable.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/enable.o: pcomplete.h
builtins/eval.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h ${BASHINCDIR}/maxpath.h
builtins/eval.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h quit.h
builtins/eval.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/eval.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h quit.h
builtins/eval.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/exec.o: bashtypes.h
builtins/exec.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h ${BASHINCDIR}/maxpath.h
builtins/exec.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h
builtins/exec.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/exec.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/exec.o: dispose_cmd.h make_cmd.h subst.h externs.h execute_cmd.h
builtins/exec.o: findcmd.h flags.h quit.h $(DEFSRC)/common.h ${BASHINCDIR}/stdc.h
builtins/exit.o: bashtypes.h
builtins/exit.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h ${BASHINCDIR}/maxpath.h
builtins/exit.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h quit.h
builtins/exit.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/exit.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h quit.h
builtins/exit.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/fc.o: bashtypes.h ${BASHINCDIR}/posixstat.h
builtins/fc.o: bashansi.h ${BASHINCDIR}/ansi_stdlib.h builtins.h command.h ${BASHINCDIR}/stdc.h
builtins/fc.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h ${BASHINCDIR}/maxpath.h
builtins/fc.o: flags.h unwind_prot.h variables.h shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h
builtins/fc.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/fc.o: flags.h unwind_prot.h variables.h arrayfunc.h conftypes.h shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h
builtins/fc.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h quit.h
builtins/fc.o: $(DEFSRC)/bashgetopt.h bashhist.h
builtins/fc.o: ${BASHINCDIR}/chartypes.h
builtins/fg_bg.o: bashtypes.h
builtins/fg_bg.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h ${BASHINCDIR}/maxpath.h
builtins/fg_bg.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h quit.h
builtins/fg_bg.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/fg_bg.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h quit.h
builtins/fg_bg.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/getopts.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h ${BASHINCDIR}/maxpath.h
builtins/getopts.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h quit.h
builtins/getopts.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/getopts.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h quit.h
builtins/getopts.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/hash.o: bashtypes.h
builtins/hash.o: builtins.h command.h findcmd.h ${BASHINCDIR}/stdc.h $(DEFSRC)/common.h
builtins/hash.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h ${BASHINCDIR}/maxpath.h
builtins/hash.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h quit.h
builtins/help.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h ${BASHINCDIR}/maxpath.h
builtins/hash.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/hash.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h quit.h
builtins/help.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/help.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/help.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h quit.h
builtins/help.o: $(GLOB_LIBSRC)/glob.h
builtins/help.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h quit.h
builtins/help.o: $(GLOB_LIBSRC)/glob.h version.h
builtins/history.o: bashtypes.h
builtins/history.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h ${BASHINCDIR}/maxpath.h
builtins/history.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/history.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/history.o: ${BASHINCDIR}/filecntl.h shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h
builtins/history.o: bashhist.h variables.h
builtins/inlib.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h ${BASHINCDIR}/maxpath.h
builtins/inlib.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h quit.h
builtins/history.o: bashhist.h variables.h arrayfunc.h conftypes.h
builtins/inlib.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/inlib.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h quit.h
builtins/inlib.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/jobs.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h ${BASHINCDIR}/maxpath.h
builtins/jobs.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/jobs.o: quit.h $(DEFSRC)/bashgetopt.h
builtins/jobs.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h
builtins/jobs.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/jobs.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/kill.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h ${BASHINCDIR}/maxpath.h
builtins/kill.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/kill.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/kill.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h trap.h unwind_prot.h variables.h
builtins/let.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h ${BASHINCDIR}/maxpath.h
builtins/kill.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h trap.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/let.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/let.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/let.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h
builtins/let.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/printf.o: config.h ${BASHINCDIR}/memalloc.h bashjmp.h command.h error.h
builtins/printf.o: general.h quit.h dispose_cmd.h make_cmd.h subst.h
builtins/printf.o: general.h xmalloc.h quit.h dispose_cmd.h make_cmd.h subst.h
builtins/printf.o: externs.h sig.h pathnames.h shell.h syntax.h unwind_prot.h
builtins/printf.o: variables.h ${BASHINCDIR}/stdc.h $(DEFSRC)/bashgetopt.h
builtins/pushd.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h ${BASHINCDIR}/maxpath.h
builtins/printf.o: variables.h arrayfunc.h conftypes.h ${BASHINCDIR}/stdc.h $(DEFSRC)/bashgetopt.h
builtins/printf.o: ${BASHINCDIR}/chartypes.h
builtins/pushd.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/pushd.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/pushd.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h
builtins/pushd.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/pushd.o: $(DEFSRC)/common.h
builtins/read.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h ${BASHINCDIR}/maxpath.h
builtins/read.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/read.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/read.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h
builtins/return.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h ${BASHINCDIR}/maxpath.h
builtins/read.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/return.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/return.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/return.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h
builtins/set.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h ${BASHINCDIR}/maxpath.h
builtins/return.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/set.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/set.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/set.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h flags.h
builtins/setattr.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h ${BASHINCDIR}/maxpath.h
builtins/set.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h flags.h
builtins/setattr.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/setattr.o: quit.h $(DEFSRC)/common.h $(DEFSRC)/bashgetopt.h
builtins/setattr.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h
builtins/setattr.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/setattr.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/shift.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h ${BASHINCDIR}/maxpath.h
builtins/shift.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/shift.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/shift.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h
builtins/shift.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/shift.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/shopt.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h
builtins/shopt.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h
builtins/shopt.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h
builtins/shopt.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h unwind_prot.h variables.h ${BASHINCDIR}/maxpath.h
builtins/shopt.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h unwind_prot.h variables.h arrayfunc.h conftypes.h ${BASHINCDIR}/maxpath.h
builtins/shopt.o: $(DEFSRC)/common.h $(DEFSRC)/bashgetopt.h
builtins/source.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h ${BASHINCDIR}/maxpath.h
builtins/source.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/source.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/source.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h
builtins/source.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/source.o: findcmd.h
builtins/suspend.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h ${BASHINCDIR}/maxpath.h
builtins/suspend.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/suspend.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/suspend.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h
builtins/test.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h ${BASHINCDIR}/maxpath.h
builtins/suspend.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/test.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/test.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/test.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h
builtins/test.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/test.o: test.h
builtins/times.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h ${BASHINCDIR}/maxpath.h
builtins/times.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/times.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/times.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h
builtins/trap.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h ${BASHINCDIR}/maxpath.h
builtins/times.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/trap.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/trap.o: quit.h $(DEFSRC)/common.h
builtins/trap.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h
builtins/trap.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/trap.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/type.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h ${BASHINCDIR}/maxpath.h
builtins/type.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/type.o: quit.h $(DEFSRC)/common.h findcmd.h
builtins/type.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h
builtins/type.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/type.o: dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/ulimit.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h ${BASHINCDIR}/maxpath.h
builtins/ulimit.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/ulimit.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/ulimit.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h
builtins/umask.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h ${BASHINCDIR}/maxpath.h
builtins/ulimit.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/umask.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/umask.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/umask.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h
builtins/wait.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h ${BASHINCDIR}/maxpath.h
builtins/umask.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/umask.o: ${BASHINCDIR}/chartypes.h
builtins/wait.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/wait.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/wait.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h
builtins/wait.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/wait.o: ${BASHINCDIR}/chartypes.h
builtins/complete.o: config.h shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h
builtins/complete.o: unwind_prot.h variables.h
builtins/complete.o: unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/complete.o: bashtypes.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
builtins/complete.o: builtins.h
builtins/complete.o: pcomplete.h

95
NEWS
View File

@ -1,3 +1,96 @@
This is a terse description of the new features added to bash-2.05a since
the release of bash-2.05. As always, the manual page (doc/bash.1) is
the place to look for complete descriptions.
1. New Features in Bash
a. Added support for DESTDIR installation root prefix, so you can do a
`make install DESTDIR=bash-root' and do easier binary packaging.
b. Added support for builtin printf "'" flag character as per latest POSIX
drafts.
c. Support for POSIX.2 printf(1) length specifiers `j', `t', and `z' (from
ISO C99).
d. New autoconf macro, RL_LIB_READLINE_VERSION, for use by other applications
(bash doesn't use very much of what it returns).
e. `set [-+]o nolog' is recognized as required by the latest POSIX drafts,
but ignored.
f. New read-only `shopt' option: login_shell. Set to non-zero value if the
shell is a login shell.
g. New `\A' prompt string escape sequence; expands to time in 24 HH:MM format.
h. New `-A group/-g' option to complete and compgen; does group name
completion.
i. New `-t' option to `hash' to list hash values for each filename argument.
j. New [-+]O invocation option to set and unset `shopt' options at startup.
k. configure's `--with-installed-readline' option now takes an optional
`=PATH' suffix to set the root of the tree where readline is installed
to PATH.
l. The ksh-like `ERR' trap has been added. The `ERR' trap will be run
whenever the shell would have exited if the -e option were enabled.
It is not inherited by shell functions.
m. `readonly', `export', and `declare' now print variables which have been
given attributes but not set by assigning a value as just a command and
a variable name (like `export foo') when listing, as the latest POSIX
drafts require.
n. `bashbug' now requires that the subject be changed from the default.
o. configure has a new `--enable-largefile' option, like other GNU utilities.
p. `for' loops now allow empty word lists after `in', like the latest POSIX
drafts require.
q. The builtin `ulimit' now takes two new non-numeric arguments: `hard',
meaning the current hard limit, and `soft', meaning the current soft
limit, in addition to `unlimited'
r. `ulimit' now prints the option letter associated with a particular
resource when printing more than one limit.
s. `ulimit' prints `hard' or `soft' when a value is not `unlimited' but is
one of RLIM_SAVED_MAX or RLIM_SAVED_CUR, respectively.
t. The `printf' builtin now handles the %a and %A conversions if they're
implemented by printf(3).
u. The `printf' builtin now handles the %F conversion (just about like %f).
v. The `printf' builtin now handles the %n conversion like printf(3). The
corresponding argument is the name of a shell variable to which the
value is assigned.
2. New Features in Readline
a. Added extern declaration for rl_get_termcap to readline.h, making it a
public function (it was always there, just not in readline.h).
b. New #defines in readline.h: RL_READLINE_VERSION, currently 0x0402,
RL_VERSION_MAJOR, currently 4, and RL_VERSION_MINOR, currently 2.
c. New readline variable: rl_readline_version, mirrors RL_READLINE_VERSION.
d. New bindable boolean readline variable: match-hidden-files. Controls
completion of files beginning with a `.' (on Unix). Enabled by default.
e. The history expansion code now allows any character to terminate a
`:first-' modifier, like csh.
f. New bindable variable `history-preserve-point'. If set, the history
code attempts to place the user at the same location on each history
line retrived with previous-history or next-history.
-------------------------------------------------------------------------------
This is a terse description of the new features added to bash-2.05 since
the release of bash-2.04. As always, the manual page (doc/bash.1) is
the place to look for complete descriptions.
@ -87,7 +180,7 @@ e. The `help' builtin has a `-s' option to just print a builtin's usage
synopsis.
f. There are several new arithmetic operators: id++, id-- (variable
post-increment/decrement), ++id, --id (variabl pre-increment/decrement),
post-increment/decrement), ++id, --id (variable pre-increment/decrement),
expr1 , expr2 (comma operator).
g. There is a new ksh-93 style arithmetic for command:

24
NOTES
View File

@ -210,7 +210,7 @@ being built and linked against, but there is only a stub file in the archive.)
with libraries not being built and make reporting errors like
`cr: not found' when library construction is attempted.
11. Building a statically-linked bash on Solaris 2.5.x, 2.6, or 7 is
11. Building a statically-linked bash on Solaris 2.5.x, 2.6, 7, or 8 is
complicated.
It's not possible to build a completely statically-linked binary, since
@ -252,17 +252,20 @@ being built and linked against, but there is only a stub file in the archive.)
thor(2)$ ldd bash
libdl.so.1 => /etc/lib/libdl.so.1
On Solaris 7 (and presumably Solaris 8, though I do not run that), the
following recipe appears to work for gcc:
On Solaris 7 (Solaris 8, using the version of gcc on the free software
CD-ROM), the following recipe appears to work for gcc:
configure --enable-static-link
make STATIC_LD='-Wl,-Bstatic' LOCAL_LIBS='Wl,-Bdynamic -Wl,-R/etc/lib -ldl -Wl,-Bstatic'
make STATIC_LD='-Wl,-Bstatic' LOCAL_LIBS='-Wl,-Bdynamic -Wl,-R/etc/lib -ldl -Wl,-Bstatic'
thor.ins.cwru.edu(2)$ ldd bash
libdl.so.1 => /etc/lib/libdl.so.1
Make the analogous changes if you are running Sun's C Compiler.
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.
12. Configuring bash to build it in a cross environment. Currently only
two native versions can be compiled this way, cygwin32 and x86 BeOS.
For BeOS, you would configure it like this:
@ -309,4 +312,17 @@ being built and linked against, but there is only a stub file in the archive.)
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.
14. Building on Interix (nee OpenNT), which Microsoft bought from Softway
Systems and has seemingly abandoned (thanks to Kevin Moore for this item).
1. cp cross-build/opennt.cache config.cache
2. If desired, edit pathnames.h to set the values of SYS_PROFILE and
DEFAULT_HOSTS_FILE appropriately.
3. export CONFIG_SHELL=$INTERIX_ROOT/bin/sh
4. ./configure --prefix=$INTERIX_ROOT/usr/local (or wherever you
want it).
5. make; make install; enjoy

7
README
View File

@ -1,7 +1,7 @@
Introduction
============
This is GNU Bash, version 2.05. Bash is the GNU Project's Bourne
This is GNU Bash, version 2.05a. Bash is the GNU Project's Bourne
Again SHell, a complete implementation of the POSIX.2 shell spec,
but also with interactive command line editing, job control on
architectures that support it, csh-like features such as history
@ -19,8 +19,9 @@ of Bash and the previous widely-distributed version, bash-1.14.
For details, see the file COMPAT. The NEWS file tersely lists
features that are new in this release.
Bash is free software, distributed under the terms of the GNU Public
License, version 2. For more information, see the file COPYING.
Bash is free software, distributed under the terms of the [GNU]
General Public License, version 2. For more information, see the
file COPYING.
A number of frequently-asked questions are answered in the file
`doc/FAQ'.

1435
aclocal.m4 vendored

File diff suppressed because it is too large Load Diff

44
alias.c
View File

@ -31,6 +31,7 @@
#endif
#include <stdio.h>
#include "chartypes.h"
#include "bashansi.h"
#include "command.h"
#include "general.h"
@ -41,7 +42,18 @@
# include "pcomplete.h"
#endif
static int qsort_alias_compare ();
typedef int sh_alias_map_func_t __P((alias_t *));
static void free_alias_data __P((PTR_T));
static alias_t **map_over_aliases __P((sh_alias_map_func_t *));
static void sort_aliases __P((alias_t **));
static int qsort_alias_compare __P((alias_t **, alias_t **));
#if defined (READLINE)
static int skipquotes __P((char *, int));
static int skipws __P((char *, int));
static int rd_token __P((char *, int));
#endif
/* Non-zero means expand all words on the line. Otherwise, expand
after first expansion if the expansion ends in a space. */
@ -134,7 +146,7 @@ add_alias (name, value)
/* Delete a single alias structure. */
static void
free_alias_data (data)
char *data;
PTR_T data;
{
register alias_t *a;
@ -189,7 +201,7 @@ delete_all_aliases ()
If FUNCTION is NULL, return all aliases. */
static alias_t **
map_over_aliases (function)
Function *function;
sh_alias_map_func_t *function;
{
register int i;
register BUCKET_CONTENTS *tlist;
@ -208,8 +220,11 @@ map_over_aliases (function)
if (!function || (*function) (alias))
{
if (list_index + 1 >= list_size)
list = (alias_t **)
xrealloc ((char *)list, (list_size += 20) * sizeof (alias_t *));
{
list_size += 20;
list = (alias_t **)xrealloc (list,
list_size * sizeof (alias_t *));
}
list[list_index++] = alias;
list[list_index] = (alias_t *)NULL;
@ -224,7 +239,7 @@ static void
sort_aliases (array)
alias_t **array;
{
qsort (array, array_len ((char **)array), sizeof (alias_t *), qsort_alias_compare);
qsort (array, array_len ((char **)array), sizeof (alias_t *), (QSFUNC *)qsort_alias_compare);
}
static int
@ -248,7 +263,7 @@ all_aliases ()
if (!aliases)
return ((alias_t **)NULL);
list = map_over_aliases ((Function *)NULL);
list = map_over_aliases ((sh_alias_map_func_t *)NULL);
if (list)
sort_aliases (list);
return (list);
@ -324,12 +339,13 @@ skipws (string, start)
char *string;
int start;
{
register int i = 0;
int pass_next, backslash_quoted_word, peekc;
register int i;
int pass_next, backslash_quoted_word;
unsigned char peekc;
/* skip quoted strings, in ' or ", and words in which a character is quoted
with a `\'. */
backslash_quoted_word = pass_next = 0;
i = backslash_quoted_word = pass_next = 0;
/* Skip leading whitespace (or separator characters), and quoted words.
But save it in the output. */
@ -351,7 +367,7 @@ skipws (string, start)
if (string[i] == '\\')
{
peekc = string[i+1];
if (isletter (peekc))
if (ISLETTER (peekc))
backslash_quoted_word++; /* this is a backslash-quoted word */
else
pass_next++;
@ -372,7 +388,7 @@ skipws (string, start)
break;
peekc = string[i + 1];
if (isletter (peekc))
if (ISLETTER (peekc))
backslash_quoted_word++;
continue;
}
@ -452,8 +468,8 @@ alias_expand (string)
alias_t *alias;
line_len = strlen (string) + 1;
line = xmalloc (line_len);
token = xmalloc (line_len);
line = (char *)xmalloc (line_len);
token = (char *)xmalloc (line_len);
line[0] = i = 0;
expand_next = 0;

26
alias.h
View File

@ -21,9 +21,9 @@
#if !defined (_ALIAS_H_)
#define _ALIAS_H_
#include "hashlib.h"
#include "stdc.h"
extern char *xmalloc ();
#include "hashlib.h"
typedef struct alias {
char *name;
@ -38,33 +38,33 @@ typedef struct alias {
/* The list of known aliases. */
extern HASH_TABLE *aliases;
extern void initialize_aliases ();
extern void initialize_aliases __P((void));
/* Scan the list of aliases looking for one with NAME. Return NULL
if the alias doesn't exist, else a pointer to the alias. */
extern alias_t *find_alias ();
extern alias_t *find_alias __P((char *));
/* Return the value of the alias for NAME, or NULL if there is none. */
extern char *get_alias_value ();
extern char *get_alias_value __P((char *));
/* Make a new alias from NAME and VALUE. If NAME can be found,
then replace its value. */
extern void add_alias ();
extern void add_alias __P((char *, char *));
/* Remove the alias with name NAME from the alias list. Returns
the index of the removed alias, or -1 if the alias didn't exist. */
extern int remove_alias ();
extern int remove_alias __P((char *));
/* Remove all aliases. */
extern void delete_all_aliases ();
/* Return a new line, with any aliases expanded. */
extern char *alias_expand ();
extern void delete_all_aliases __P((void));
/* Return an array of all defined aliases. */
extern alias_t **all_aliases ();
extern alias_t **all_aliases __P((void));
/* Expand a single word for aliases. */
extern char *alias_expand_word ();
extern char *alias_expand_word __P((char *));
/* Return a new line, with any aliases expanded. */
extern char *alias_expand __P((char *));
#endif /* _ALIAS_H_ */

25
array.c
View File

@ -45,8 +45,6 @@
#include "array.h"
#include "builtins/common.h"
extern char *quote_string (); /* XXX */
#define ADD_BEFORE(ae, new) \
do { \
ae->prev->next = new; \
@ -66,7 +64,7 @@ char *value;
{
ARRAY_ELEMENT *r;
r = (ARRAY_ELEMENT *) xmalloc(sizeof(ARRAY_ELEMENT));
r = (ARRAY_ELEMENT *)xmalloc(sizeof(ARRAY_ELEMENT));
r->ind = indx;
r->value = value ? savestring(value) : (char *)NULL;
r->next = r->prev = (ARRAY_ELEMENT *) NULL;
@ -87,7 +85,7 @@ new_array()
ARRAY *r;
ARRAY_ELEMENT *head;
r =(ARRAY *) xmalloc(sizeof(ARRAY));
r =(ARRAY *)xmalloc(sizeof(ARRAY));
r->type = array_indexed;
r->max_index = r->max_size = -1;
r->num_elements = 0;
@ -159,7 +157,7 @@ ARRAY_ELEMENT *s, *e;
{
ARRAY *a;
ARRAY_ELEMENT *p, *n;
int i;
arrayind_t i;
a = new_array ();
a->type = array->type;
@ -280,7 +278,7 @@ arrayind_t i;
void
array_walk(a, func)
ARRAY *a;
Function *func;
sh_ae_map_func_t *func;
{
register ARRAY_ELEMENT *ae;
@ -309,9 +307,10 @@ int quoted;
return ((char *)NULL);
slen = strlen(sep);
result = NULL;
for (rsize = rlen = 0, ae = start; ae != end; ae = element_forw(ae)) {
if (rsize == 0)
result = xmalloc (rsize = 64);
result = (char *)xmalloc (rsize = 64);
if (element_value(ae)) {
t = quoted ? quote_string(element_value(ae)) : element_value(ae);
reg = strlen(t);
@ -330,7 +329,8 @@ int quoted;
}
}
}
result[rlen] = '\0'; /* XXX */
if (result)
result[rlen] = '\0'; /* XXX */
return(result);
}
@ -358,7 +358,7 @@ ARRAY *a;
if (a == 0 || array_empty (a))
return((char *)NULL);
result = xmalloc (rsize = 128);
result = (char *)xmalloc (rsize = 128);
result[0] = '(';
rlen = 1;
@ -525,10 +525,11 @@ ARRAY *array;
char *
array_subrange (a, start, end, quoted)
ARRAY *a;
int start, end, quoted;
arrayind_t start, end;
int quoted;
{
ARRAY_ELEMENT *h, *p;
int i;
arrayind_t i;
p = array_head (a);
if (p == 0 || array_empty (a) || start > array_num_elements (a))
@ -577,7 +578,7 @@ int mflags;
print_element(ae)
ARRAY_ELEMENT *ae;
{
printf("array[%d] = %s\n",(int)element_index(ae), element_value(ae));
printf("array[%ld] = %s\n", element_index(ae), element_value(ae));
}
print_array(a)

View File

@ -24,7 +24,7 @@
#include "stdc.h"
typedef int arrayind_t;
typedef long arrayind_t;
enum atype {array_indexed, array_assoc};
@ -40,6 +40,8 @@ typedef struct array_element {
struct array_element *next, *prev;
} ARRAY_ELEMENT;
typedef int sh_ae_map_func_t __P((ARRAY_ELEMENT *));
char *array_reference __P((ARRAY *, arrayind_t));
extern int array_add_element __P((ARRAY *, arrayind_t, char *));
@ -53,7 +55,6 @@ extern void empty_array __P((ARRAY *));
extern void dispose_array __P((ARRAY *));
extern ARRAY *dup_array __P((ARRAY *));
extern ARRAY *dup_array_subrange __P((ARRAY *, ARRAY_ELEMENT *, ARRAY_ELEMENT *));
extern ARRAY_ELEMENT *new_array_element __P((arrayind_t, char *));
extern ARRAY_ELEMENT *copy_array_element __P((ARRAY_ELEMENT *));
extern WORD_LIST *array_to_word_list __P((ARRAY *));
@ -67,7 +68,7 @@ extern char *quoted_array_assignment_string __P((ARRAY *));
extern char *array_to_string __P((ARRAY *, char *, int));
extern ARRAY *string_to_array __P((char *, char *));
extern char *array_subrange __P((ARRAY *, int, int, int));
extern char *array_subrange __P((ARRAY *, arrayind_t, arrayind_t, int));
extern char *array_pat_subst __P((ARRAY *, char *, char *, int));
extern ARRAY *array_quote __P((ARRAY *));

645
arrayfunc.c Normal file
View File

@ -0,0 +1,645 @@
/* arrayfunc.c -- High-level array functions used by other parts of the shell. */
/* Copyright (C) 2001 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
Bash is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along
with Bash; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#include "config.h"
#if defined (ARRAY_VARS)
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif
#include <stdio.h>
#include "shell.h"
#include "builtins/common.h"
extern char *this_command_name;
extern int last_command_exit_value;
static void quote_array_assignment_chars __P((WORD_LIST *));
static char *array_value_internal __P((char *, int, int));
/* **************************************************************** */
/* */
/* Functions to manipulate array variables and perform assignments */
/* */
/* **************************************************************** */
/* Convert a shell variable to an array variable. The original value is
saved as array[0]. */
SHELL_VAR *
convert_var_to_array (var)
SHELL_VAR *var;
{
char *oldval;
ARRAY *array;
oldval = value_cell (var);
array = new_array ();
array_add_element (array, 0, oldval);
FREE (value_cell (var));
var->value = (char *)array;
INVALIDATE_EXPORTSTR (var);
VSETATTR (var, att_array);
VUNSETATTR (var, att_invisible);
return var;
}
/* Perform an array assignment name[ind]=value. If NAME already exists and
is not an array, and IND is 0, perform name=value instead. If NAME exists
and is not an array, and IND is not 0, convert it into an array with the
existing value as name[0].
If NAME does not exist, just create an array variable, no matter what
IND's value may be. */
SHELL_VAR *
bind_array_variable (name, ind, value)
char *name;
arrayind_t ind;
char *value;
{
SHELL_VAR *entry;
char *newval;
entry = var_lookup (name, shell_variables);
if (entry == (SHELL_VAR *) 0)
entry = make_new_array_variable (name);
else if (readonly_p (entry) || noassign_p (entry))
{
if (readonly_p (entry))
report_error ("%s: readonly variable", name);
return (entry);
}
else if (array_p (entry) == 0)
entry = convert_var_to_array (entry);
/* ENTRY is an array variable, and ARRAY points to the value. */
newval = make_variable_value (entry, value);
if (entry->assign_func)
(*entry->assign_func) (entry, ind, newval);
else
array_add_element (array_cell (entry), ind, newval);
FREE (newval);
return (entry);
}
/* Parse NAME, a lhs of an assignment statement of the form v[s], and
assign VALUE to that array element by calling bind_array_variable(). */
SHELL_VAR *
assign_array_element (name, value)
char *name, *value;
{
char *sub, *vname;
arrayind_t ind;
int sublen;
SHELL_VAR *entry;
vname = array_variable_name (name, &sub, &sublen);
if (vname == 0)
return ((SHELL_VAR *)NULL);
if ((ALL_ELEMENT_SUB (sub[0]) && sub[1] == ']') || (sublen <= 1))
{
free (vname);
report_error ("%s: bad array subscript", name);
return ((SHELL_VAR *)NULL);
}
ind = array_expand_index (sub, sublen);
if (ind < 0)
{
free (vname);
report_error ("%s: bad array subscript", name);
return ((SHELL_VAR *)NULL);
}
entry = bind_array_variable (vname, ind, value);
free (vname);
return (entry);
}
/* Find the array variable corresponding to NAME. If there is no variable,
create a new array variable. If the variable exists but is not an array,
convert it to an indexed array. If CHECK_FLAGS is non-zero, an existing
variable is checked for the readonly or noassign attribute in preparation
for assignment (e.g., by the `read' builtin). */
SHELL_VAR *
find_or_make_array_variable (name, check_flags)
char *name;
int check_flags;
{
SHELL_VAR *var;
var = find_variable (name);
if (var == 0)
var = make_new_array_variable (name);
else if (check_flags && (readonly_p (var) || noassign_p (var)))
{
if (readonly_p (var))
report_error ("%s: readonly variable", name);
return ((SHELL_VAR *)NULL);
}
else if (array_p (var) == 0)
var = convert_var_to_array (var);
return (var);
}
/* Perform a compound assignment statement for array NAME, where VALUE is
the text between the parens: NAME=( VALUE ) */
SHELL_VAR *
assign_array_from_string (name, value)
char *name, *value;
{
SHELL_VAR *var;
var = find_or_make_array_variable (name, 1);
if (var == 0)
return ((SHELL_VAR *)NULL);
return (assign_array_var_from_string (var, value));
}
/* Sequentially assign the indices of indexed array variable VAR from the
words in LIST. */
SHELL_VAR *
assign_array_var_from_word_list (var, list)
SHELL_VAR *var;
WORD_LIST *list;
{
register arrayind_t i;
register WORD_LIST *l;
ARRAY *a;
for (a = array_cell (var), l = list, i = 0; l; l = l->next, i++)
if (var->assign_func)
(*var->assign_func) (var, i, l->word->word);
else
array_add_element (a, i, l->word->word);
return var;
}
/* 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)
SHELL_VAR *var;
char *value;
{
ARRAY *a;
WORD_LIST *list, *nlist;
char *w, *val, *nval;
int ni, len;
arrayind_t ind, last_ind;
if (value == 0)
return var;
/* If this is called from declare_builtin, value[0] == '(' and
strchr(value, ')') != 0. In this case, we need to extract
the value from between the parens before going on. */
if (*value == '(') /*)*/
{
ni = 1;
val = extract_array_assignment_list (value, &ni);
if (val == 0)
return var;
}
else
val = value;
/* Expand the value string into a list of words, performing all the
shell expansions including pathname generation and word splitting. */
/* First we split the string on whitespace, using the shell parser
(ksh93 seems to do this). */
list = parse_string_to_word_list (val, "array assign");
/* If we're using [subscript]=value, we need to quote each [ and ] to
prevent unwanted filename expansion. */
if (list)
quote_array_assignment_chars (list);
/* Now that we've split it, perform the shell expansions on each
word in the list. */
nlist = list ? expand_words_no_vars (list) : (WORD_LIST *)NULL;
dispose_words (list);
if (val != value)
free (val);
a = array_cell (var);
/* Now that we are ready to assign values to the array, kill the existing
value. */
if (a)
empty_array (a);
for (last_ind = 0, list = nlist; list; list = list->next)
{
w = list->word->word;
/* We have a word of the form [ind]=value */
if (w[0] == '[')
{
len = skipsubscript (w, 0);
if (w[len] != ']' || w[len+1] != '=')
{
nval = make_variable_value (var, w);
if (var->assign_func)
(*var->assign_func) (var, last_ind, nval);
else
array_add_element (a, last_ind, nval);
FREE (nval);
last_ind++;
continue;
}
if (len == 1)
{
report_error ("%s: bad array subscript", w);
continue;
}
if (ALL_ELEMENT_SUB (w[1]) && len == 2)
{
report_error ("%s: cannot assign to non-numeric index", w);
continue;
}
ind = array_expand_index (w + 1, len);
if (ind < 0)
{
report_error ("%s: bad array subscript", w);
continue;
}
last_ind = ind;
val = w + len + 2;
}
else /* No [ind]=value, just a stray `=' */
{
ind = last_ind;
val = w;
}
if (integer_p (var))
this_command_name = (char *)NULL; /* no command name for errors */
nval = make_variable_value (var, val);
if (var->assign_func)
(*var->assign_func) (var, ind, nval);
else
array_add_element (a, ind, nval);
FREE (nval);
last_ind++;
}
dispose_words (nlist);
return (var);
}
/* For each word in a compound array assignment, if the word looks like
[ind]=value, quote the `[' and `]' before the `=' to protect them from
unwanted filename expansion. */
static void
quote_array_assignment_chars (list)
WORD_LIST *list;
{
char *s, *t, *nword;
int saw_eq;
WORD_LIST *l;
for (l = list; l; l = l->next)
{
if (l->word == 0 || l->word->word == 0 || l->word->word[0] == '\0')
continue; /* should not happen, but just in case... */
/* Don't bother if it doesn't look like [ind]=value */
if (l->word->word[0] != '[' || strchr (l->word->word, '=') == 0) /* ] */
continue;
s = nword = (char *)xmalloc (strlen (l->word->word) * 2 + 1);
saw_eq = 0;
for (t = l->word->word; *t; )
{
if (*t == '=')
saw_eq = 1;
if (saw_eq == 0 && (*t == '[' || *t == ']'))
*s++ = '\\';
*s++ = *t++;
}
*s = '\0';
free (l->word->word);
l->word->word = nword;
}
}
/* This function assumes s[i] == '['; returns with s[ret] == ']' if
an array subscript is correctly parsed. */
int
skipsubscript (s, i)
const char *s;
int i;
{
int count, c;
for (count = 1; count && (c = s[++i]); )
{
if (c == '[')
count++;
else if (c == ']')
count--;
}
return i;
}
/* This function is called with SUB pointing to just after the beginning
`[' of an array subscript and removes the array element to which SUB
expands from array VAR. A subscript of `*' or `@' unsets the array. */
int
unbind_array_element (var, sub)
SHELL_VAR *var;
char *sub;
{
int len;
arrayind_t ind;
ARRAY_ELEMENT *ae;
len = skipsubscript (sub, 0);
if (sub[len] != ']' || len == 0)
{
builtin_error ("%s[%s: bad array subscript", var->name, sub);
return -1;
}
sub[len] = '\0';
if (ALL_ELEMENT_SUB (sub[0]) && sub[1] == 0)
{
makunbound (var->name, shell_variables);
return (0);
}
ind = array_expand_index (sub, len+1);
if (ind < 0)
{
builtin_error ("[%s]: bad array subscript", sub);
return -1;
}
ae = array_delete_element (array_cell (var), ind);
if (ae)
destroy_array_element (ae);
return 0;
}
/* Format and output an array assignment in compound form VAR=(VALUES),
suitable for re-use as input. */
void
print_array_assignment (var, quoted)
SHELL_VAR *var;
int quoted;
{
char *vstr;
if (quoted)
vstr = quoted_array_assignment_string (array_cell (var));
else
vstr = array_to_assignment_string (array_cell (var));
if (vstr == 0)
printf ("%s=%s\n", var->name, quoted ? "'()'" : "()");
else
{
printf ("%s=%s\n", var->name, vstr);
free (vstr);
}
}
/***********************************************************************/
/* */
/* Utility functions to manage arrays and their contents for expansion */
/* */
/***********************************************************************/
/* Return 1 if NAME is a properly-formed array reference v[sub]. */
int
valid_array_reference (name)
char *name;
{
char *t;
int r, len;
t = strchr (name, '['); /* ] */
if (t)
{
*t = '\0';
r = legal_identifier (name);
*t = '[';
if (r == 0)
return 0;
/* Check for a properly-terminated non-blank subscript. */
len = skipsubscript (t, 0);
if (t[len] != ']' || len == 1)
return 0;
for (r = 1; r < len; r++)
if (whitespace (t[r]) == 0)
return 1;
return 0;
}
return 0;
}
/* Expand the array index beginning at S and extending LEN characters. */
arrayind_t
array_expand_index (s, len)
char *s;
int len;
{
char *exp, *t;
int expok;
arrayind_t val;
exp = (char *)xmalloc (len);
strncpy (exp, s, len - 1);
exp[len - 1] = '\0';
t = expand_string_to_string (exp, 0);
this_command_name = (char *)NULL;
val = evalexp (t, &expok);
free (t);
free (exp);
if (expok == 0)
{
last_command_exit_value = EXECUTION_FAILURE;
jump_to_top_level (DISCARD);
}
return val;
}
/* Return the name of the variable specified by S without any subscript.
If SUBP is non-null, return a pointer to the start of the subscript
in *SUBP. If LENP is non-null, the length of the subscript is returned
in *LENP. This returns newly-allocated memory. */
char *
array_variable_name (s, subp, lenp)
char *s, **subp;
int *lenp;
{
char *t, *ret;
int ind, ni;
t = strchr (s, '[');
if (t == 0)
return ((char *)NULL);
ind = t - s;
ni = skipsubscript (s, ind);
if (ni <= ind + 1 || s[ni] != ']')
{
report_error ("%s: bad array subscript", s);
return ((char *)NULL);
}
*t = '\0';
ret = savestring (s);
*t++ = '['; /* ] */
if (subp)
*subp = t;
if (lenp)
*lenp = ni - ind;
return ret;
}
/* Return the variable specified by S without any subscript. If SUBP is
non-null, return a pointer to the start of the subscript in *SUBP.
If LENP is non-null, the length of the subscript is returned in *LENP. */
SHELL_VAR *
array_variable_part (s, subp, lenp)
char *s, **subp;
int *lenp;
{
char *t;
SHELL_VAR *var;
t = array_variable_name (s, subp, lenp);
if (t == 0)
return ((SHELL_VAR *)NULL);
var = find_variable (t);
free (t);
return var;
}
/* Return a string containing the elements in the array and subscript
described by S. If the subscript is * or @, obeys quoting rules akin
to the expansion of $* and $@ including double quoting. */
static char *
array_value_internal (s, quoted, allow_all)
char *s;
int quoted, allow_all;
{
int len;
arrayind_t ind;
char *retval, *t, *temp;
WORD_LIST *l;
SHELL_VAR *var;
var = array_variable_part (s, &t, &len);
if (var == 0)
return (char *)NULL;
/* [ */
if (ALL_ELEMENT_SUB (t[0]) && t[1] == ']')
{
if (allow_all == 0)
{
report_error ("%s: bad array subscript", s);
return ((char *)NULL);
}
else if (array_p (var) == 0)
{
l = (WORD_LIST *)NULL;
l = add_string_to_list (value_cell (var), l);
}
else
{
l = array_to_word_list (array_cell (var));
if (l == (WORD_LIST *)NULL)
return ((char *) NULL);
}
if (t[0] == '*' && (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)))
{
temp = string_list_dollar_star (l);
retval = quote_string (temp);
free (temp);
}
else /* ${name[@]} or unquoted ${name[*]} */
retval = string_list_dollar_at (l, quoted);
dispose_words (l);
}
else
{
ind = array_expand_index (t, len);
if (ind < 0)
{
report_error ("%s: bad array subscript", var->name);
return ((char *)NULL);
}
if (array_p (var) == 0)
return (ind == 0 ? savestring (value_cell (var)) : (char *)NULL);
retval = array_reference (array_cell (var), ind);
if (retval)
retval = quote_escapes (retval);
}
return retval;
}
/* Return a string containing the elements described by the array and
subscript contained in S, obeying quoting for subscripts * and @. */
char *
array_value (s, quoted)
char *s;
int quoted;
{
return (array_value_internal (s, quoted, 1));
}
/* Return the value of the array indexing expression S as a single string.
If ALLOW_ALL is 0, do not allow `@' and `*' subscripts. This is used
by other parts of the shell such as the arithmetic expression evaluator
in expr.c. */
char *
get_array_value (s, allow_all)
char *s;
int allow_all;
{
return (array_value_internal (s, 0, allow_all));
}
#endif /* ARRAY_VARS */

53
arrayfunc.h Normal file
View File

@ -0,0 +1,53 @@
/* arrayfunc.h -- declarations for miscellaneous array functions in arrayfunc.c */
/* Copyright (C) 2001 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
Bash is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
License for more details.
You should have received a copy of the GNU General Public License
along with Bash; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#if !defined (_ARRAYFUNC_H_)
#define _ARRAYFUNC_H_
/* Must include variables.h before including this file. */
#if defined (ARRAY_VARS)
extern SHELL_VAR *convert_var_to_array __P((SHELL_VAR *));
extern SHELL_VAR *bind_array_variable __P((char *, arrayind_t, char *));
extern SHELL_VAR *assign_array_element __P((char *, char *));
extern SHELL_VAR *find_or_make_array_variable __P((char *, int));
extern SHELL_VAR *assign_array_from_string __P((char *, char *));
extern SHELL_VAR *assign_array_var_from_word_list __P((SHELL_VAR *, WORD_LIST *));
extern SHELL_VAR *assign_array_var_from_string __P((SHELL_VAR *, char *));
extern int unbind_array_element __P((SHELL_VAR *, char *));
extern int skipsubscript __P((const char *, int));
extern void print_array_assignment __P((SHELL_VAR *, int));
extern arrayind_t array_expand_index __P((char *, int));
extern int valid_array_reference __P((char *));
extern char *array_value __P((char *, int));
extern char *get_array_value __P((char *, int));
extern char *array_variable_name __P((char *, char **, int *));
extern SHELL_VAR *array_variable_part __P((char *, char **, int *));
#endif
#endif /* !_ARRAYFUNC_H_ */

View File

@ -22,11 +22,16 @@
#define _BASHANSI_H_
#if defined (HAVE_STRING_H)
# if ! defined (STDC_HEADERS) && defined (HAVE_MEMORY_H)
# include <memory.h>
# endif
# include <string.h>
#else
# include <strings.h>
#endif /* !HAVE_STRING_H */
#if defined (HAVE_STRINGS_H)
# include <strings.h>
#endif /* !HAVE_STRINGS_H */
#if defined (HAVE_STDLIB_H)
# include <stdlib.h>
#else

View File

@ -41,10 +41,12 @@
#include "input.h"
#include "parser.h" /* for the struct dstack stuff. */
#include "pathexp.h" /* for the struct ignorevar stuff */
#include "bashhist.h" /* matching prototypes and declarations */
#include "builtins/common.h"
#include <readline/history.h>
#include <glob/fnmatch.h>
#include <glob/glob.h>
#include <glob/strmatch.h>
#if defined (READLINE)
# include "bashline.h"
@ -54,9 +56,7 @@
extern int errno;
#endif
extern int glob_pattern_p ();
static int histignore_item_func ();
static int histignore_item_func __P((struct ign *));
static struct ignorevar histignore =
{
@ -64,7 +64,7 @@ static struct ignorevar histignore =
(struct ign *)0,
0,
(char *)0,
(Function *)histignore_item_func,
(sh_iv_item_func_t *)histignore_item_func,
};
#define HIGN_EXPAND 0x01
@ -148,18 +148,24 @@ int hist_verify;
#endif /* READLINE */
/* Non-zero means to not save function definitions in the history list. */
int dont_save_function_defs;
/* Variables declared in other files used here. */
extern int interactive;
extern int current_command_line_count;
extern struct dstack dstack;
extern char *extract_colon_unit ();
extern char *history_delimiting_chars ();
extern void maybe_add_history (); /* forward declaration */
extern void bash_add_history (); /* forward declaration */
static int history_should_ignore ();
static int bash_history_inhibit_expansion __P((char *, int));
#if defined (READLINE)
static void re_edit __P((char *));
#endif
static int history_expansion_p __P((char *));
static int shell_comment __P((char *));
static int should_expand __P((char *));
static HIST_ENTRY *last_history_entry __P((void));
static char *expand_histignore_pattern __P((char *));
static int history_should_ignore __P((char *));
/* Is the history expansion starting at string[i] one that should not
be expanded? */
@ -470,6 +476,7 @@ shell_comment (line)
return (p && *p == '#');
}
#ifdef INCLUDE_UNUSED
/* Remove shell comments from LINE. A `#' and anything after it is a comment.
This isn't really useful yet, since it doesn't handle quoting. */
static char *
@ -484,6 +491,7 @@ filter_comments (line)
*p = '\0';
return (line);
}
#endif
/* Add LINE to the history list depending on the value of HISTORY_CONTROL. */
void
@ -580,10 +588,10 @@ bash_add_history (line)
chars_to_add = "";
}
new_line = (char *) xmalloc (1
+ curlen
+ strlen (line)
+ strlen (chars_to_add));
new_line = (char *)xmalloc (1
+ curlen
+ strlen (line)
+ strlen (chars_to_add));
sprintf (new_line, "%s%s%s", current->line, chars_to_add, line);
offset = where_history ();
old = replace_history_entry (offset, new_line, current->data);
@ -704,7 +712,7 @@ history_should_ignore (line)
else
npat = histignore.ignores[i].val;
match = fnmatch (npat, line, FNMATCH_EXTFLAG) != FNM_NOMATCH;
match = strmatch (npat, line, FNMATCH_EXTFLAG) != FNM_NOMATCH;
if (histignore.ignores[i].flags & HIGN_EXPAND)
free (npat);

View File

@ -21,6 +21,8 @@
#if !defined (_BASHHIST_H_)
#define _BASHHIST_H_
#include "stdc.h"
extern int remember_on_history;
extern int history_lines_this_session;
extern int history_lines_in_file;
@ -33,21 +35,21 @@ extern int hist_last_line_added;
extern int history_expansion_inhibited;
# endif /* BANG_HISTORY */
extern void bash_initialize_history ();
extern void bash_history_reinit ();
extern void bash_history_disable ();
extern void bash_history_enable ();
extern void load_history ();
extern void save_history ();
extern int maybe_append_history ();
extern int maybe_save_shell_history ();
extern char *pre_process_line ();
extern int history_number ();
extern void maybe_add_history ();
extern void bash_add_history ();
extern void bash_initialize_history __P((void));
extern void bash_history_reinit __P((int));
extern void bash_history_disable __P((void));
extern void bash_history_enable __P((void));
extern void load_history __P((void));
extern void save_history __P((void));
extern int maybe_append_history __P((char *));
extern int maybe_save_shell_history __P((void));
extern char *pre_process_line __P((char *, int, int));
extern void maybe_add_history __P((char *));
extern void bash_add_history __P((char *));
extern int history_number __P((void));
extern void setup_history_ignore ();
extern void setup_history_ignore __P((char *));
extern char *last_history_line ();
extern char *last_history_line __P((void));
#endif /* _BASHHIST_H_ */

View File

@ -29,7 +29,12 @@
# include <unistd.h>
#endif
#if defined (HAVE_GRP_H)
# include <grp.h>
#endif
#include <stdio.h>
#include "chartypes.h"
#include "bashansi.h"
#include "shell.h"
#include "builtins.h"
@ -59,8 +64,6 @@ extern int bash_brace_completion __P((int, int));
/* Forward declarations */
extern char *command_word_completion_function __P((const char *, int));
/* Functions bound to keys in Readline for Bash users. */
static int shell_expand_line __P((int, int));
static int display_shell_version __P((int, int));
@ -69,10 +72,8 @@ static int operate_and_get_next __P((int, int));
static int bash_ignore_filenames __P((char **));
static int bash_ignore_everything __P((char **));
static void cleanup_expansion_error __P((void));
static void set_up_new_line __P((char *));
#if defined (BANG_HISTORY)
static char *history_expand_line_internal __P((char *));
static int history_expand_line __P((int, int));
static int tcsh_magic_space __P((int, int));
#endif /* BANG_HISTORY */
@ -84,37 +85,59 @@ static int history_and_alias_expand_line __P((int, int));
#endif
/* Helper functions for Readline. */
static int bash_directory_completion_hook ();
static int filename_completion_ignore ();
static int bash_directory_completion_hook __P((char **));
static int filename_completion_ignore __P((char **));
static int bash_push_line __P((void));
static void cleanup_expansion_error __P((void));
static void maybe_make_readline_line __P((char *));
static void set_up_new_line __P((char *));
static int check_redir __P((int));
static char **attempt_shell_completion __P((const char *, int, int));
static char *variable_completion_function __P((const char *, int));
static char *hostname_completion_function __P((const char *, int));
static char *command_subst_completion_function __P((const char *, int));
static void build_history_completion_array __P((void));
static char *history_completion_generator __P((const char *, int));
static int dynamic_complete_history __P((int, int));
static char *glob_complete_word __P((const char *, int));
static int bash_glob_expand_word __P((int, int));
static int bash_glob_list_expansions __P((int, int));
static void snarf_hosts_from_file __P((char *));
static void initialize_hostname_list __P((void));
static void add_host_name __P((char *));
static void snarf_hosts_from_file __P((char *));
static char **hostnames_matching __P((char *));
static void _ignore_completion_names __P((char **, sh_ignore_func_t *));
static int name_is_acceptable __P((const char *));
static int test_for_directory __P((const char *));
static int return_zero __P((const char *));
static char *bash_dequote_filename __P((char *, int));
static char *quote_word_break_chars __P((char *));
static char *bash_quote_filename __P((char *, int, char *));
static int bash_execute_unix_command __P((int, int));
static void init_unix_command_map __P((void));
static int isolate_sequence __P((char *, int, int, int *));
static int set_saved_history __P((void));
#if defined (ALIAS)
static int posix_edit_macros __P((int, int));
#endif
#if defined (PROGRAMMABLE_COMPLETION)
static int find_cmd_start __P((int));
static int find_cmd_end __P((int));
static char *find_cmd_name __P((int));
static char *prog_complete_return __P((const char *, int));
static char **prog_complete_matches;
static int old_rl_completion_append_character;
#endif
/* Variables used here but defined in other files. */
extern int current_command_line_count;
extern int posixly_correct, no_symbolic_links;
extern char *current_prompt_string, *ps1_prompt;
extern STRING_INT_ALIST word_token_alist[];
@ -144,6 +167,11 @@ static int bash_complete_variable __P((int, int));
static int bash_possible_variable_completions __P((int, int));
static int bash_complete_command __P((int, int));
static int bash_possible_command_completions __P((int, int));
static char *glob_complete_word __P((const char *, int));
static int bash_glob_completion_internal __P((int));
static int bash_glob_expand_word __P((int, int));
static int bash_glob_list_expansions __P((int, int));
#endif /* SPECIFIC_COMPLETION_FUNCTIONS */
#if defined (VI_MODE)
@ -189,10 +217,14 @@ posix_readline_initialize (on_or_off)
#endif
}
void
int
enable_hostname_completion (on_or_off)
int on_or_off;
{
int old_value;
old_value = perform_hostname_completion;
if (on_or_off)
{
perform_hostname_completion = 1;
@ -205,6 +237,8 @@ enable_hostname_completion (on_or_off)
rl_special_prefixes = "$";
rl_completer_word_break_characters = bash_nohostname_word_break_characters;
}
return (old_value);
}
/* Called once from parse.y if we are going to use readline. */
@ -457,7 +491,7 @@ static void
add_host_name (name)
char *name;
{
long size;
size_t size;
if (hostname_list_length + 2 > hostname_list_size)
{
@ -514,7 +548,7 @@ snarf_hosts_from_file (filename)
}
/* Skip internet address if present. */
if (digit (buffer[i]))
if (DIGIT (buffer[i]))
for (; buffer[i] && cr_whitespace (buffer[i]) == 0; i++);
/* Gobble up names. Each name is separated with whitespace. */
@ -619,6 +653,7 @@ set_saved_history ()
rl_get_previous_history (history_length - saved_history_line_to_use, 0);
saved_history_line_to_use = -1;
rl_startup_hook = old_rl_startup_hook;
return (0);
}
static int
@ -657,14 +692,17 @@ vi_edit_and_execute_command (count, c)
int count, c;
{
char *command;
int r;
int r, cclc, rrs;
rrs = rl_readline_state;
cclc = current_command_line_count;
/* Accept the current line. */
rl_newline (1, c);
if (rl_explicit_arg)
{
command = xmalloc (strlen (VI_EDIT_COMMAND) + 8);
command = (char *)xmalloc (strlen (VI_EDIT_COMMAND) + 8);
sprintf (command, "%s %d", VI_EDIT_COMMAND, count);
}
else
@ -681,7 +719,18 @@ vi_edit_and_execute_command (count, c)
command = savestring (VI_EDIT_COMMAND);
}
r = parse_and_execute (command, "v", SEVAL_NOHIST);
current_command_line_count = cclc;
/* Now erase the contents of the current line and undo the effects of the
rl_accept_line() above. We don't even want to make the text we just
executed available for undoing. */
rl_line_buffer[0] = '\0'; /* XXX */
rl_point = rl_end = 0;
rl_done = 0;
rl_readline_state = rrs;
rl_forced_update_display ();
return r;
}
@ -739,6 +788,11 @@ check_redir (ti)
}
#if defined (PROGRAMMABLE_COMPLETION)
/*
* XXX - because of the <= start test, and setting os = s+1, this can
* potentially return os > start. This is probably not what we want to
* happen, but fix later after 2.05a-release.
*/
static int
find_cmd_start (start)
int start;
@ -782,7 +836,7 @@ find_cmd_name (start)
static char *
prog_complete_return (text, matchnum)
char *text;
const char *text;
int matchnum;
{
static int ind;
@ -886,7 +940,10 @@ attempt_shell_completion (text, start, end)
s = find_cmd_start (start);
e = find_cmd_end (end);
n = find_cmd_name (s);
prog_complete_matches = programmable_completions (n, text, s, e, &foundcs);
if (e > s)
prog_complete_matches = programmable_completions (n, text, s, e, &foundcs);
else
foundcs = 0;
FREE (n);
/* XXX - if we found a COMPSPEC for the command, just return whatever
the programmable completion code returns, and disable the default
@ -895,7 +952,7 @@ attempt_shell_completion (text, start, end)
if (foundcs)
{
/* If the user specified that the compspec returns filenames, make
sure that readline knows it.
sure that readline knows it. */
if (foundcs & COPT_FILENAMES)
rl_filename_completion_desired = 1;
/* Turn what the programmable completion code returns into what
@ -953,7 +1010,7 @@ attempt_shell_completion (text, start, end)
/* This could be a globbing pattern, so try to expand it using pathname
expansion. */
if (!matches && glob_pattern_p ((char *)text)) /* XXX fix const later */
if (!matches && glob_pattern_p (text))
{
matches = rl_completion_matches (text, glob_complete_word);
/* A glob expression that matches more than one filename is problematic.
@ -1002,12 +1059,12 @@ command_word_completion_function (hint_text, state)
aliases, reserved words, functions or builtins. We must check
whether or not it is unique, and, if so, whether that filename
is executable. */
if (absolute_program ((char *)hint_text))
if (absolute_program (hint_text))
{
/* Perform tilde expansion on what's passed, so we don't end up
passing filenames with tildes directly to stat(). */
if (*hint_text == '~')
hint = bash_tilde_expand ((char *)hint_text);
hint = bash_tilde_expand (hint_text);
else
hint = savestring (hint_text);
hint_len = strlen (hint);
@ -1146,7 +1203,7 @@ command_word_completion_function (hint_text, state)
if (filename_hint)
free (filename_hint);
filename_hint = xmalloc (2 + strlen (current_path) + hint_len);
filename_hint = (char *)xmalloc (2 + strlen (current_path) + hint_len);
sprintf (filename_hint, "%s/%s", current_path, hint);
free (current_path);
@ -1181,7 +1238,7 @@ command_word_completion_function (hint_text, state)
vl = strlen (val);
tl = strlen (hint_text);
l = vl - hint_len; /* # of chars added */
temp = xmalloc (l + 2 + tl);
temp = (char *)xmalloc (l + 2 + tl);
strcpy (temp, hint_text);
strcpy (temp + tl, val + vl - l);
}
@ -1258,7 +1315,7 @@ command_subst_completion_function (text, state)
}
else
{
value = xmalloc (1 + start_len + strlen (matches[cmd_index]));
value = (char *)xmalloc (1 + start_len + strlen (matches[cmd_index]));
if (start_len == 1)
value[0] = *orig_start;
@ -1314,7 +1371,9 @@ variable_completion_function (text, state)
}
else
{
char *value = xmalloc (4 + strlen (varlist[varlist_index]));
char *value;
value = (char *)xmalloc (4 + strlen (varlist[varlist_index]));
if (first_char_loc)
{
@ -1355,7 +1414,7 @@ hostname_completion_function (text, state)
if (first_char == '@')
first_char_loc++;
list = hostnames_matching (&text[first_char_loc]);
list = hostnames_matching ((char *)text+first_char_loc);
list_index = 0;
}
@ -1363,7 +1422,7 @@ hostname_completion_function (text, state)
{
char *t;
t = xmalloc (2 + strlen (list[list_index]));
t = (char *)xmalloc (2 + strlen (list[list_index]));
*t = first_char;
strcpy (t + first_char_loc, list[list_index]);
list_index++;
@ -1373,6 +1432,45 @@ hostname_completion_function (text, state)
return ((char *)NULL);
}
char *
bash_groupname_completion_function (text, state)
const char *text;
int state;
{
#if defined (__WIN32__) || defined (__OPENNT) || !defined (HAVE_GRP_H)
return ((char *)NULL);
#else
static char *gname = (char *)NULL;
static struct group *grent;
static int gnamelen;
char *value;
if (state == 0)
{
FREE (gname);
gname = savestring (text);
gnamelen = strlen (gname);
setgrent ();
}
while (grent = getgrent ())
{
if (gnamelen == 0 || (STREQN (gname, grent->gr_name, gnamelen)))
break;
}
if (grent == 0)
{
endgrent ();
return ((char *)NULL);
}
value = savestring (grent->gr_name);
return (value);
#endif
}
/* Functions to perform history and alias expansions on the current line. */
#if defined (BANG_HISTORY)
@ -1429,8 +1527,10 @@ static void
set_up_new_line (new_line)
char *new_line;
{
int old_point = rl_point;
int at_end = rl_point == rl_end;
int old_point, at_end;
old_point = rl_point;
at_end = rl_point == rl_end;
/* If the line was history and alias expanded, then make that
be one thing to undo. */
@ -1594,7 +1694,7 @@ shell_expand_line (count, ignore)
FREE (new_line);
if (expanded_string == 0)
{
new_line = xmalloc (1);
new_line = (char *)xmalloc (1);
new_line[0] = '\0';
}
else
@ -1642,13 +1742,13 @@ static struct ignorevar fignore =
(struct ign *)0,
0,
(char *)0,
(Function *) 0,
(sh_iv_item_func_t *) 0,
};
static void
_ignore_completion_names (names, name_func)
char **names;
Function *name_func;
sh_ignore_func_t *name_func;
{
char **newnames;
int idx, nidx;
@ -1737,7 +1837,7 @@ _ignore_completion_names (names, name_func)
static int
name_is_acceptable (name)
char *name;
const char *name;
{
struct ign *p;
int nlen;
@ -1782,7 +1882,7 @@ filename_completion_ignore (names)
/* Return 1 if NAME is a directory. */
static int
test_for_directory (name)
char *name;
const char *name;
{
struct stat finfo;
char *fn;
@ -1808,7 +1908,7 @@ bash_ignore_filenames (names)
static int
return_zero (name)
char *name;
const char *name;
{
return 0;
}
@ -1866,7 +1966,7 @@ bash_directory_completion_hook (dirname)
{
free (new_dirname);
free (local_dirname);
*dirname = xmalloc (1);
*dirname = (char *)xmalloc (1);
**dirname = '\0';
return 1;
}
@ -1891,7 +1991,7 @@ bash_directory_completion_hook (dirname)
if (temp1[len1 - 1] == '/')
{
len2 = strlen (temp2);
temp2 = xrealloc (temp2, len2 + 2);
temp2 = (char *)xrealloc (temp2, len2 + 2);
temp2[len2] = '/';
temp2[len2 + 1] = '\0';
}
@ -1942,7 +2042,7 @@ build_history_completion_array ()
if (harry_len + 2 > harry_size)
{
harry_size += 10;
history_completion_array = (char **) xrealloc
history_completion_array = (char **)xrealloc
(history_completion_array, harry_size * sizeof (char *));
}
@ -1953,17 +2053,17 @@ build_history_completion_array ()
}
/* Sort the complete list of tokens. */
qsort (history_completion_array, harry_len, sizeof (char *), (Function *)qsort_string_compare);
qsort (history_completion_array, harry_len, sizeof (char *), (QSFUNC *)qsort_string_compare);
}
}
static char *
history_completion_generator (hint_text, state)
char *hint_text;
const char *hint_text;
int state;
{
static int local_index, len;
static char *text;
static const char *text;
/* If this is the first call to the generator, then initialize the
list of strings to complete over. */
@ -1987,6 +2087,8 @@ static int
dynamic_complete_history (count, key)
int count, key;
{
int r;
rl_compentry_func_t *orig_func;
rl_completion_func_t *orig_attempt_func;
@ -1996,12 +2098,13 @@ dynamic_complete_history (count, key)
rl_attempted_completion_function = (rl_completion_func_t *)NULL;
if (rl_last_func == dynamic_complete_history)
rl_complete_internal ('?');
r = rl_complete_internal ('?');
else
rl_complete_internal (TAB);
r = rl_complete_internal (TAB);
rl_completion_entry_function = orig_func;
rl_attempted_completion_function = orig_attempt_func;
return r;
}
#if defined (SPECIFIC_COMPLETION_FUNCTIONS)
@ -2215,7 +2318,7 @@ bash_dequote_filename (text, quote_char)
int l, quoted;
l = strlen (text);
ret = xmalloc (l + 1);
ret = (char *)xmalloc (l + 1);
for (quoted = quote_char, p = text, r = ret; p && *p; p++)
{
/* Allow backslash-quoted characters to pass through unscathed. */
@ -2255,7 +2358,7 @@ quote_word_break_chars (text)
int l;
l = strlen (text);
ret = xmalloc ((2 * l) + 1);
ret = (char *)xmalloc ((2 * l) + 1);
for (s = text, r = ret; *s; s++)
{
/* Pass backslash-quoted characters through, including the backslash. */
@ -2358,7 +2461,7 @@ bash_quote_filename (s, rtype, qcp)
/* Leave the opening quote intact. The readline completion code takes
care of avoiding doubled opening quotes. */
rlen = strlen (rtext);
ret = xmalloc (rlen + 1);
ret = (char *)xmalloc (rlen + 1);
strcpy (ret, rtext);
/* If there are multiple matches, cut off the closing quote. */
@ -2484,7 +2587,7 @@ bind_keyseq_to_unix_command (line)
{
Keymap kmap;
char *kseq, *value;
int i, kstart, len, ok;
int i, kstart;
if (cmd_xmap == 0)
init_unix_command_map ();

View File

@ -26,6 +26,7 @@
extern int bash_readline_initialized;
extern void posix_readline_initialize __P((int));
extern int enable_hostname_completion __P((int));
extern void initialize_readline __P((void));
extern void bashline_reinitialize __P((void));
extern int bash_re_edit __P((char *));
@ -34,6 +35,7 @@ extern int bind_keyseq_to_unix_command __P((char *));
/* Used by programmable completion code. */
extern char *command_word_completion_function __P((const char *, int));
extern char *bash_groupname_completion_function __P((const char *, int));
extern char **get_hostname_list __P((void));
extern void clear_hostname_list __P((void));

View File

@ -39,8 +39,6 @@
#include "shell.h"
#include <readline/readline.h>
extern char *sh_backslash_quote ();
/* Find greatest common prefix of two strings. */
static int
string_gcd (s1, s2)
@ -78,7 +76,7 @@ really_munge_braces (array, real_start, real_end, gcd_zero)
return x;
}
result = xmalloc (result_size = 16);
result = (char *)xmalloc (result_size = 16);
*result = '\0';
for (start = real_start; start < real_end; start = end + 1)
@ -102,7 +100,7 @@ really_munge_braces (array, real_start, real_end, gcd_zero)
/* In this case, add in a leading '{', because we are at
top level, and there isn't a consistent prefix. */
result_size += 1;
result = xrealloc (result, result_size);
result = (char *)xrealloc (result, result_size);
result[0] = '{'; result[1] = '\0';
flag++;
}
@ -121,13 +119,13 @@ really_munge_braces (array, real_start, real_end, gcd_zero)
/* If there is more than one element in the subarray,
insert the (quoted) prefix and an opening brace. */
tlen = gcd - gcd_zero;
x = xmalloc (tlen + 1);
x = (char *)xmalloc (tlen + 1);
strncpy (x, array[start] + gcd_zero, tlen);
x[tlen] = '\0';
subterm = sh_backslash_quote (x);
free (x);
result_size += strlen (subterm) + 1;
result = xrealloc (result, result_size);
result = (char *)xrealloc (result, result_size);
strcat (result, subterm);
free (subterm);
strcat (result, "{");
@ -136,7 +134,7 @@ really_munge_braces (array, real_start, real_end, gcd_zero)
}
result_size += strlen (subterm) + 1;
result = xrealloc (result, result_size);
result = (char *)xrealloc (result, result_size);
strcat (result, subterm);
strcat (result, ",");
free (subterm);

View File

@ -40,10 +40,6 @@
#include "general.h"
#define brace_whitespace(c) (!(c) || (c) == ' ' || (c) == '\t' || (c) == '\n')
#if defined (SHELL)
extern char *extract_command_subst ();
#endif
/* Basic idea:
Segregate the text into 3 sections: preamble (stuff before an open brace),
@ -56,8 +52,15 @@ extern char *extract_command_subst ();
/* The character which is used to separate arguments. */
int brace_arg_separator = ',';
#if defined (__P)
static int brace_gobbler __P((char *, int *, int));
static char **expand_amble __P((char *));
static char **array_concat __P((char **, char **));
#else
static int brace_gobbler ();
static char **expand_amble (), **array_concat ();
static char **expand_amble ();
static char **array_concat ();
#endif
/* Return an array of strings; the brace expansion of TEXT. */
char **

View File

@ -44,7 +44,7 @@
/* The thing that we build the array of builtins out of. */
struct builtin {
char *name; /* The name that the user types. */
Function *function; /* The address of the invoked function. */
sh_builtin_func_t *function; /* The address of the invoked function. */
int flags; /* One of the #defines above. */
char **long_doc; /* NULL terminated array of strings. */
char *short_doc; /* Short version of documenation. */

View File

View File

@ -36,7 +36,7 @@ BUILD_DIR = @BUILD_DIR@
PROFILE_FLAGS = @PROFILE_FLAGS@
CFLAGS = @CFLAGS@
LOCAL_CFLAGS = @LOCAL_CFLAGS@
LOCAL_CFLAGS = @LOCAL_CFLAGS@ ${DEBUG}
CPPFLAGS = @CPPFLAGS@
DEFS = @DEFS@
LOCAL_DEFS = @LOCAL_DEFS@
@ -46,10 +46,18 @@ LIBS = @LIBS@
BASHINCDIR = ${topdir}/include
RL_INCLUDEDIR = @RL_INCLUDEDIR@
INCLUDES = -I. -I.. @RL_INCLUDE@ -I$(topdir) -I$(BASHINCDIR) -I$(topdir)/lib -I$(srcdir)
CCFLAGS = ${PROFILE_FLAGS} $(DEFS) $(LOCAL_DEFS) $(SYSTEM_FLAGS) $(CPPFLAGS) \
${INCLUDES} $(LOCAL_CFLAGS) $(CFLAGS)
CCFLAGS_FOR_BUILD = ${PROFILE_FLAGS} $(DEFS) $(LOCAL_DEFS) $(SYSTEM_FLAGS) \
$(CPPFLAGS) ${INCLUDES} $(LOCAL_CFLAGS)
CCFLAGS = $(CCFLAGS_FOR_BUILD) $(CFLAGS)
GCC_LINT_FLAGS = -Wall -Wshadow -Wpointer-arith -Wcast-qual \
-Wcast-align -Wstrict-prototypes -Wconversion \
-Wmissing-prototypes -Wtraditional -Wredundant-decls -pedantic
MKBUILTINS = mkbuiltins$(EXEEXT)
DIRECTDEFINE = -D $(srcdir)
@ -131,7 +139,7 @@ builtext.h builtins.c: $(MKBUILTINS) $(DEFSRC)
mkbuiltins.o: ../config.h
mkbuiltins.o: mkbuiltins.c
$(RM) $@
$(CC_FOR_BUILD) -c $(CCFLAGS) $<
$(CC_FOR_BUILD) -c $(CCFLAGS_FOR_BUILD) $<
mkbuiltins$(EXEEXT): mkbuiltins.o
$(CC_FOR_BUILD) $(PROFILE_FLAGS) $(LDFLAGS) -o $(MKBUILTINS) mkbuiltins.o $(LIBS)
@ -151,7 +159,7 @@ pipesize.h: psize.aux
$(SHELL) $(srcdir)/psize.sh > $@
psize.aux: psize.c
$(CC_FOR_BUILD) $(CCFLAGS) -o $@ $(srcdir)/psize.c
$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) -o $@ $(srcdir)/psize.c
documentation: builtins.texi
@ -214,26 +222,28 @@ complete.o: complete.def
# C files
bashgetopt.o: ../config.h $(topdir)/bashansi.h $(BASHINCDIR)/ansi_stdlib.h
bashgetopt.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/bashjmp.h
bashgetopt.o: $(topdir)/command.h $(topdir)/general.h $(topdir)/error.h
bashgetopt.o: $(topdir)/variables.h $(topdir)/quit.h $(BASHINCDIR)/maxpath.h
bashgetopt.o: $(topdir)/command.h $(topdir)/general.h $(topdir)/xmalloc.h $(topdir)/error.h
bashgetopt.o: $(topdir)/variables.h $(topdir)/conftypes.h $(topdir)/quit.h $(BASHINCDIR)/maxpath.h
bashgetopt.o: $(topdir)/unwind_prot.h $(topdir)/dispose_cmd.h
bashgetopt.o: $(topdir)/make_cmd.h $(topdir)/subst.h $(topdir)/sig.h
bashgetopt.o: $(topdir)/pathnames.h $(topdir)/externs.h $(srcdir)/common.h
bashgetopt.o: $(BASHINCDIR)/chartypes.h
common.o: $(topdir)/bashtypes.h $(BASHINCDIR)/posixstat.h $(topdir)/bashansi.h $(BASHINCDIR)/ansi_stdlib.h
common.o: $(topdir)/shell.h $(topdir)/syntax.h ../config.h $(topdir)/bashjmp.h $(BASHINCDIR)/posixjmp.h
common.o: $(topdir)/sig.h $(topdir)/command.h
common.o: $(topdir)/general.h $(BASHINCDIR)/stdc.h $(BASHINCDIR)/memalloc.h
common.o: $(topdir)/variables.h $(topdir)/input.h
common.o: $(topdir)/general.h $(topdir)/xmalloc.h $(BASHINCDIR)/stdc.h $(BASHINCDIR)/memalloc.h
common.o: $(topdir)/variables.h $(topdir)/conftypes.h $(topdir)/input.h
common.o: $(topdir)/siglist.h $(topdir)/bashhist.h $(topdir)/quit.h
common.o: $(topdir)/unwind_prot.h $(BASHINCDIR)/maxpath.h $(topdir)/jobs.h
common.o: $(topdir)/builtins.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
common.o: $(topdir)/subst.h $(topdir)/execute_cmd.h $(topdir)/error.h
common.o: $(topdir)/externs.h $(topdir)/pathnames.h ./builtext.h
common.o: $(BASHINCDIR)/chartypes.h
evalfile.o: $(topdir)/bashtypes.h $(BASHINCDIR)/posixstat.h ${BASHINCDIR}/filecntl.h
evalfile.o: $(topdir)/bashansi.h $(BASHINCDIR)/ansi_stdlib.h
evalfile.o: $(topdir)/shell.h $(topdir)/syntax.h ../config.h $(topdir)/bashjmp.h
evalfile.o: $(topdir)/command.h $(topdir)/general.h $(topdir)/error.h
evalfile.o: $(topdir)/variables.h $(topdir)/quit.h $(BASHINCDIR)/maxpath.h
evalfile.o: $(topdir)/command.h $(topdir)/general.h $(topdir)/xmalloc.h $(topdir)/error.h
evalfile.o: $(topdir)/variables.h $(topdir)/conftypes.h $(topdir)/quit.h $(BASHINCDIR)/maxpath.h
evalfile.o: $(topdir)/unwind_prot.h $(topdir)/dispose_cmd.h
evalfile.o: $(topdir)/make_cmd.h $(topdir)/subst.h $(topdir)/sig.h
evalfile.o: $(topdir)/pathnames.h $(topdir)/externs.h
@ -243,16 +253,17 @@ evalfile.o: $(topdir)/bashhist.h $(srcdir)/common.h
evalstring.o: ../config.h $(topdir)/bashansi.h $(BASHINCDIR)/ansi_stdlib.h
evalstring.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/bashjmp.h $(BASHINCDIR)/posixjmp.h
evalstring.o: $(topdir)/sig.h $(topdir)/command.h $(topdir)/siglist.h
evalstring.o: $(BASHINCDIR)/memalloc.h $(topdir)/variables.h $(topdir)/input.h
evalstring.o: $(BASHINCDIR)/memalloc.h $(topdir)/variables.h $(topdir)/conftypes.h $(topdir)/input.h
evalstring.o: $(topdir)/quit.h $(topdir)/unwind_prot.h
evalstring.o: $(BASHINCDIR)/maxpath.h $(topdir)/jobs.h $(topdir)/builtins.h
evalstring.o: $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h $(topdir)/subst.h
evalstring.o: $(topdir)/externs.h $(topdir)/jobs.h $(topdir)/builtins.h
evalstring.o: $(topdir)/flags.h $(topdir)/input.h $(topdir)/execute_cmd.h
evalstring.o: $(topdir)/bashhist.h $(srcdir)/common.h
evalstring.o: $(topdir)/trap.h $(topdir)/redir.h
getopt.o: ../config.h $(BASHINCDIR)/memalloc.h
getopt.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/bashjmp.h $(topdir)/command.h
getopt.o: $(topdir)/general.h $(topdir)/error.h $(topdir)/variables.h
getopt.o: $(topdir)/general.h $(topdir)/xmalloc.h $(topdir)/error.h $(topdir)/variables.h $(topdir)/conftypes.h
getopt.o: $(topdir)/quit.h $(BASHINCDIR)/maxpath.h $(topdir)/unwind_prot.h
getopt.o: $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h $(topdir)/subst.h
getopt.o: $(topdir)/sig.h $(topdir)/pathnames.h $(topdir)/externs.h
@ -263,224 +274,232 @@ mkbuiltins.o: $(topdir)/bashansi.h $(BASHINCDIR)/ansi_stdlib.h
# def files
alias.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
alias.o: $(topdir)/error.h $(topdir)/general.h $(BASHINCDIR)/maxpath.h
alias.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h $(BASHINCDIR)/maxpath.h
alias.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
alias.o: $(topdir)/subst.h $(topdir)/externs.h $(srcdir)/common.h
alias.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h
alias.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
bind.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h $(topdir)/error.h
bind.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
bind.o: $(topdir)/subst.h $(topdir)/externs.h $(srcdir)/bashgetopt.h
bind.o: $(topdir)/general.h $(BASHINCDIR)/maxpath.h $(topdir)/bashline.h
bind.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h
bind.o: $(topdir)/general.h $(topdir)/xmalloc.h $(BASHINCDIR)/maxpath.h $(topdir)/bashline.h
bind.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
break.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
break.o: $(topdir)/error.h $(topdir)/general.h
break.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
break.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
break.o: $(topdir)/subst.h $(topdir)/externs.h $(BASHINCDIR)/maxpath.h
break.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h
break.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
builtin.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
builtin.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/externs.h
builtin.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h $(topdir)/externs.h
builtin.o: $(topdir)/quit.h $(srcdir)/common.h $(BASHINCDIR)/maxpath.h
builtin.o: $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h $(topdir)/subst.h
builtin.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h
builtin.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
cd.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h $(topdir)/error.h
cd.o: $(topdir)/general.h $(topdir)/quit.h $(topdir)/dispose_cmd.h
cd.o: $(topdir)/general.h $(topdir)/xmalloc.h $(topdir)/quit.h $(topdir)/dispose_cmd.h
cd.o: $(topdir)/make_cmd.h $(topdir)/subst.h $(topdir)/externs.h
cd.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h
cd.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
cd.o: $(srcdir)/common.h $(BASHINCDIR)/maxpath.h
command.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
command.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/externs.h
command.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h $(topdir)/externs.h
command.o: $(topdir)/quit.h $(srcdir)/bashgetopt.h $(BASHINCDIR)/maxpath.h
command.o: $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h $(topdir)/subst.h
command.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h
command.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
declare.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
declare.o: $(topdir)/error.h $(topdir)/general.h
declare.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
declare.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
declare.o: $(topdir)/subst.h $(topdir)/externs.h $(BASHINCDIR)/maxpath.h
declare.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h
declare.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
declare.o: $(topdir)/arrayfunc.h
echo.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h $(topdir)/error.h
echo.o: $(topdir)/general.h $(topdir)/subst.h $(topdir)/externs.h
echo.o: $(topdir)/general.h $(topdir)/xmalloc.h $(topdir)/subst.h $(topdir)/externs.h
echo.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
echo.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h
echo.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
echo.o: $(BASHINCDIR)/maxpath.h
enable.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
enable.o: $(topdir)/error.h $(topdir)/general.h
enable.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
enable.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
enable.o: $(topdir)/subst.h $(topdir)/externs.h
enable.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h
enable.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
enable.o: $(BASHINCDIR)/maxpath.h
enable.o: $(topdir)/pcomplete.h
eval.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
eval.o: $(topdir)/error.h $(topdir)/general.h
eval.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
eval.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
eval.o: $(topdir)/subst.h $(topdir)/externs.h
eval.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h
eval.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
eval.o: $(BASHINCDIR)/maxpath.h
exec.o: $(topdir)/bashtypes.h
exec.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
exec.o: $(topdir)/error.h $(topdir)/general.h
exec.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
exec.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
exec.o: $(topdir)/subst.h $(topdir)/externs.h $(topdir)/flags.h
exec.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h
exec.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
exec.o: $(srcdir)/common.h $(topdir)/execute_cmd.h $(BASHINCDIR)/maxpath.h
exec.o: $(topdir)/findcmd.h
exit.o: $(topdir)/bashtypes.h
exit.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
exit.o: $(topdir)/error.h $(topdir)/general.h
exit.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
exit.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
exit.o: $(topdir)/subst.h $(topdir)/externs.h
exit.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h
exit.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
exit.o: $(BASHINCDIR)/maxpath.h ./builtext.h
fc.o: $(topdir)/bashtypes.h $(BASHINCDIR)/posixstat.h
fc.o: $(topdir)/builtins.h $(topdir)/command.h $(srcdir)/bashgetopt.h
fc.o: $(topdir)/bashhist.h
fc.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h $(topdir)/error.h
fc.o: $(topdir)/general.h $(BASHINCDIR)/maxpath.h
fc.o: $(topdir)/general.h $(topdir)/xmalloc.h $(BASHINCDIR)/maxpath.h
fc.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
fc.o: $(topdir)/subst.h $(topdir)/externs.h $(topdir)/shell.h $(topdir)/syntax.h
fc.o: $(topdir)/flags.h $(topdir)/unwind_prot.h $(topdir)/variables.h
fc.o: $(topdir)/bashansi.h $(BASHINCDIR)/ansi_stdlib.h
fc.o: $(topdir)/flags.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
fc.o: $(topdir)/bashansi.h $(BASHINCDIR)/ansi_stdlib.h $(BASHINCDIR)/chartypes.h
fg_bg.o: $(topdir)/bashtypes.h
fg_bg.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
fg_bg.o: $(topdir)/error.h $(topdir)/general.h
fg_bg.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
fg_bg.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
fg_bg.o: $(topdir)/subst.h $(topdir)/externs.h $(BASHINCDIR)/maxpath.h
fg_bg.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h
fg_bg.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
getopts.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
getopts.o: $(topdir)/error.h $(topdir)/general.h
getopts.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
getopts.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
getopts.o: $(topdir)/subst.h $(topdir)/externs.h $(BASHINCDIR)/maxpath.h
getopts.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h
getopts.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
hash.o: $(topdir)/builtins.h $(topdir)/command.h $(topdir)/quit.h
hash.o: $(topdir)/findcmd.h $(topdir)/hashlib.h
hash.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
hash.o: $(topdir)/error.h $(topdir)/general.h
hash.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h
hash.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
hash.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
hash.o: $(srcdir)/common.h $(BASHINCDIR)/maxpath.h
help.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
help.o: $(topdir)/error.h $(topdir)/general.h
help.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
help.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
help.o: $(topdir)/subst.h $(topdir)/externs.h $(BASHINCDIR)/maxpath.h
help.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h
help.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
help.o: ${srcdir}/common.h ../version.h
history.o: $(topdir)/bashtypes.h
history.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
history.o: $(topdir)/error.h $(topdir)/general.h
history.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
history.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
history.o: $(topdir)/subst.h $(topdir)/externs.h
history.o: ${BASHINCDIR}/filecntl.h $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h
history.o: $(topdir)/variables.h $(topdir)/bashhist.h $(BASHINCDIR)/maxpath.h
history.o: $(topdir)/variables.h $(topdir)/conftypes.h $(topdir)/bashhist.h $(BASHINCDIR)/maxpath.h
inlib.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
inlib.o: $(topdir)/error.h $(topdir)/general.h
inlib.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h
inlib.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
inlib.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
inlib.o: $(BASHINCDIR)/maxpath.h $(topdir)/subst.h $(topdir)/externs.h
inlib.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
jobs.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h $(topdir)/error.h
jobs.o: $(topdir)/general.h $(topdir)/quit.h $(srcdir)/bashgetopt.h
jobs.o: $(topdir)/general.h $(topdir)/xmalloc.h $(topdir)/quit.h $(srcdir)/bashgetopt.h
jobs.o: $(BASHINCDIR)/maxpath.h $(topdir)/externs.h
jobs.o: $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h $(topdir)/subst.h
jobs.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h
jobs.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
kill.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h $(topdir)/error.h
kill.o: $(topdir)/general.h $(topdir)/subst.h $(topdir)/externs.h
kill.o: $(topdir)/general.h $(topdir)/xmalloc.h $(topdir)/subst.h $(topdir)/externs.h
kill.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
kill.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/trap.h $(topdir)/unwind_prot.h
kill.o: $(topdir)/variables.h $(BASHINCDIR)/maxpath.h
kill.o: $(topdir)/variables.h $(topdir)/conftypes.h $(BASHINCDIR)/maxpath.h
let.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
let.o: $(topdir)/error.h $(topdir)/general.h
let.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
let.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
let.o: $(topdir)/subst.h $(topdir)/externs.h $(BASHINCDIR)/maxpath.h
let.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h
let.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
printf.o: ../config.h $(BASHINCDIR)/memalloc.h $(topdir)/bashjmp.h
printf.o: $(topdir)/command.h $(topdir)/error.h $(topdir)/general.h
printf.o: $(topdir)/command.h $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
printf.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
printf.o: $(topdir)/subst.h $(topdir)/externs.h $(topdir)/sig.h
printf.o: $(topdir)/pathnames.h $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h
printf.o: $(topdir)/variables.h $(BASHINCDIR)/stdc.h $(srcdir)/bashgetopt.h
printf.o: $(topdir)/variables.h $(topdir)/conftypes.h $(BASHINCDIR)/stdc.h $(srcdir)/bashgetopt.h
printf.o: $(topdir)/bashtypes.h ${srcdir}/common.h $(BASHINCDIR)/chartypes.h
pushd.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
pushd.o: $(topdir)/error.h $(topdir)/general.h
pushd.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
pushd.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
pushd.o: $(topdir)/subst.h $(topdir)/externs.h
pushd.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h
pushd.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
pushd.o: $(BASHINCDIR)/maxpath.h $(srcdir)/common.h ./builtext.h
read.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
read.o: $(topdir)/error.h $(topdir)/general.h
read.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
read.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
read.o: $(topdir)/subst.h $(topdir)/externs.h $(BASHINCDIR)/maxpath.h
read.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h
read.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
read.o: $(BASHINCDIR)/shtty.h
read.o: $(topdir)/arrayfunc.h
return.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
return.o: $(topdir)/error.h $(topdir)/general.h
return.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
return.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
return.o: $(topdir)/subst.h $(topdir)/externs.h $(BASHINCDIR)/maxpath.h
return.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h
return.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
set.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
set.o: $(topdir)/general.h $(topdir)/subst.h $(topdir)/externs.h
set.o: $(topdir)/general.h $(topdir)/xmalloc.h $(topdir)/subst.h $(topdir)/externs.h
set.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
set.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h
set.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
set.o: $(BASHINCDIR)/maxpath.h $(topdir)/error.h
set.o: $(topdir)/arrayfunc.h
setattr.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
setattr.o: $(topdir)/error.h $(topdir)/general.h $(BASHINCDIR)/maxpath.h
setattr.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h $(BASHINCDIR)/maxpath.h
setattr.o: $(topdir)/quit.h $(srcdir)/common.h $(srcdir)/bashgetopt.h
setattr.o: $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h $(topdir)/subst.h
setattr.o: $(topdir)/externs.h
setattr.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h
setattr.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
setattr.o: $(topdir)/arrayfunc.h
shift.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
shift.o: $(topdir)/error.h $(topdir)/general.h
shift.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
shift.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
shift.o: $(topdir)/subst.h $(topdir)/externs.h $(BASHINCDIR)/maxpath.h
shift.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h
shift.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
source.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
source.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/findcmd.h
source.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h $(topdir)/findcmd.h
source.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
source.o: $(topdir)/subst.h $(topdir)/externs.h $(BASHINCDIR)/maxpath.h
source.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h
source.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
suspend.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
suspend.o: $(topdir)/error.h $(topdir)/general.h
suspend.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
suspend.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
suspend.o: $(topdir)/subst.h $(topdir)/externs.h $(BASHINCDIR)/maxpath.h
suspend.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h
suspend.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
test.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
test.o: $(topdir)/error.h $(topdir)/general.h
test.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
test.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
test.o: $(topdir)/subst.h $(topdir)/externs.h $(BASHINCDIR)/maxpath.h
test.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h
test.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
test.o: $(topdir)/test.h
times.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
times.o: $(topdir)/error.h $(topdir)/general.h
times.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
times.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
times.o: $(topdir)/subst.h $(topdir)/externs.h $(BASHINCDIR)/maxpath.h
times.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h
times.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
times.o: $(BASHINCDIR)/posixtime.h
trap.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
trap.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/externs.h
trap.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h $(topdir)/externs.h
trap.o: $(topdir)/quit.h $(srcdir)/common.h $(BASHINCDIR)/maxpath.h
trap.o: $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h $(topdir)/subst.h
trap.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h
trap.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
trap.o: $(topdir)/findcmd.h
type.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
type.o: $(topdir)/error.h $(topdir)/general.h
type.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
type.o: $(topdir)/quit.h $(srcdir)/common.h $(BASHINCDIR)/maxpath.h
type.o: $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h $(topdir)/subst.h
type.o: $(topdir)/externs.h $(topdir)/hashcmd.h
type.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h
type.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
ulimit.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
ulimit.o: $(topdir)/error.h $(topdir)/general.h
ulimit.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
ulimit.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
ulimit.o: $(topdir)/subst.h $(topdir)/externs.h $(BASHINCDIR)/maxpath.h
ulimit.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h
ulimit.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
umask.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
umask.o: $(topdir)/error.h $(topdir)/general.h
umask.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
umask.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
umask.o: $(topdir)/subst.h $(topdir)/externs.h $(BASHINCDIR)/maxpath.h
umask.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h
umask.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
umask.o: $(BASHINCDIR)/chartypes.h
wait.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
wait.o: $(topdir)/error.h $(topdir)/general.h
wait.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
wait.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
wait.o: $(topdir)/subst.h $(topdir)/externs.h $(BASHINCDIR)/maxpath.h
wait.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h
wait.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
wait.o: $(BASHINCDIR)/chartypes.h
shopt.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
shopt.o: $(topdir)/error.h $(topdir)/general.h
shopt.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
shopt.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
shopt.o: $(topdir)/subst.h $(topdir)/externs.h $(BASHINCDIR)/maxpath.h
shopt.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h
shopt.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
shopt.o: $(srcdir)/common.h $(srcdir)/bashgetopt.h
complete.o: ../config.h

View File

@ -51,8 +51,7 @@ $END
# include "common.h"
# include "bashgetopt.h"
extern int interactive;
static void print_alias ();
static void print_alias __P((alias_t *));
/* Hack the alias command in a Korn shell way. */
int

View File

@ -25,6 +25,7 @@ Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#endif
#include "../bashansi.h"
#include <chartypes.h>
#include <errno.h>
#include "../shell.h"
@ -124,7 +125,7 @@ char *opts;
} else if (*cp == '#') {
/* optional numeric argument */
if (lcurrent->word->word[sp+1]) {
if (digit(lcurrent->word->word[sp+1])) {
if (DIGIT(lcurrent->word->word[sp+1])) {
list_optarg = lcurrent->word->word + sp + 1;
lcurrent = lcurrent->next;
} else

View File

@ -23,6 +23,8 @@
#if !defined (__BASH_GETOPT_H)
# define __BASH_GETOPT_H
#include <stdc.h>
extern char *list_optarg;
extern int list_optopt;
@ -30,8 +32,8 @@ extern int list_optopt;
extern WORD_LIST *lcurrent;
extern WORD_LIST *loptend;
extern int internal_getopt ();
extern void reset_internal_getopt ();
extern void report_bad_option ();
extern int internal_getopt __P((WORD_LIST *, char *));
extern void reset_internal_getopt __P((void));
extern void report_bad_option __P((void));
#endif /* !__BASH_GETOPT_H */

View File

@ -76,8 +76,8 @@ extern int errno;
#include "bashgetopt.h"
#include "common.h"
static int query_bindings ();
static int unbind_command ();
static int query_bindings __P((char *));
static int unbind_command __P((char *));
extern int no_line_editing;
@ -102,7 +102,6 @@ bind_builtin (list)
WORD_LIST *list;
{
int return_code;
FILE *old_rl_outstream;
Keymap kmap, saved_keymap;
int flags, opt;
char *initfile, *map_name, *fun_name, *unbind_name, *remove_seq, *cmd_seq;
@ -118,10 +117,9 @@ bind_builtin (list)
if (!bash_readline_initialized)
initialize_readline ();
/* Cannot use unwind_protect_pointer () on "FILE *", it is only
guaranteed to work for strings. */
/* XXX -- see if we can use unwind_protect here */
old_rl_outstream = rl_outstream;
begin_unwind_frame ("bind_builtin");
unwind_protect_var (rl_outstream);
rl_outstream = stdout;
reset_internal_getopt ();
@ -242,7 +240,7 @@ bind_builtin (list)
if ((flags & RFLAG) && remove_seq)
{
if (rl_set_key (remove_seq, (Function *)NULL, rl_get_keymap ()) != 0)
if (rl_set_key (remove_seq, (rl_command_func_t *)NULL, rl_get_keymap ()) != 0)
{
builtin_error ("cannot unbind %s", remove_seq);
BIND_RETURN (EXECUTION_FAILURE);
@ -263,7 +261,8 @@ bind_builtin (list)
if (saved_keymap)
rl_set_keymap (saved_keymap);
rl_outstream = old_rl_outstream;
run_unwind_frame ("bind_builtin");
return (return_code);
}
@ -271,7 +270,7 @@ static int
query_bindings (name)
char *name;
{
Function *function;
rl_command_func_t *function;
char **keyseqs;
int j;
@ -303,7 +302,7 @@ static int
unbind_command (name)
char *name;
{
Function *function;
rl_command_func_t *function;
function = rl_named_function (name);
if (function == 0)

View File

@ -42,7 +42,7 @@ $END
extern char *this_command_name;
extern int posixly_correct;
static int check_loop_level ();
static int check_loop_level __P((void));
/* The depth of while's and until's. */
int loop_level = 0;
@ -59,7 +59,7 @@ int
break_builtin (list)
WORD_LIST *list;
{
int newbreak;
long newbreak;
if (check_loop_level () == 0)
return (EXECUTION_SUCCESS);
@ -94,7 +94,7 @@ int
continue_builtin (list)
WORD_LIST *list;
{
int newcont;
long newcont;
if (check_loop_level () == 0)
return (EXECUTION_SUCCESS);

View File

@ -48,7 +48,7 @@ int
builtin_builtin (list)
WORD_LIST *list;
{
Function *function;
sh_builtin_func_t *function;
register char *command;
if (!list)

View File

@ -53,13 +53,14 @@ $PRODUCES cd.c
extern int errno;
#endif /* !errno */
extern int posixly_correct, interactive;
extern int posixly_correct;
extern int array_needs_making;
extern char *bash_getcwd_errstr;
static int change_to_directory ();
static int bindpwd __P((int));
static int change_to_directory __P((char *, int));
static char *cdspell ();
static char *cdspell __P((char *));
/* Change this to 1 to get cd spelling correction by default. */
int cdspelling = 0;
@ -87,7 +88,7 @@ bindpwd (no_symlinks)
int no_symlinks;
{
char *dirname, *pwdvar;
int old_symlinks, old_anm;
int old_anm;
SHELL_VAR *tvar;
#define tcwd the_current_working_directory
@ -424,7 +425,7 @@ cdspell (dirname)
char *guess;
n = (strlen (dirname) * 3 + 1) / 2 + 1;
guess = xmalloc (n);
guess = (char *)xmalloc (n);
switch (spname (dirname, guess))
{

View File

@ -49,10 +49,14 @@ $END
#include "bashgetopt.h"
#include "common.h"
#if defined (_CS_PATH) && defined (HAVE_CONFSTR) && !HAVE_DECL_CONFSTR
extern size_t confstr __P((int, char *, size_t));
#endif
extern int subshell_environment;
static void restore_path ();
static char *get_standard_path ();
static void restore_path __P((char *));
static char *get_standard_path __P((void));
/* Run the commands mentioned in LIST without paying attention to shell
functions. */
@ -131,11 +135,13 @@ command_builtin (list)
FREE (standard_path);
}
#define COMMAND_BUILTIN_FLAGS (CMD_NO_FUNCTIONS | CMD_INHIBIT_EXPANSION | CMD_COMMAND_BUILTIN)
command = make_bare_simple_command ();
command->value.Simple->words = (WORD_LIST *)copy_word_list (list);
command->value.Simple->redirects = (REDIRECT *)NULL;
command->flags |= (CMD_NO_FUNCTIONS | CMD_INHIBIT_EXPANSION);
command->value.Simple->flags |= (CMD_NO_FUNCTIONS | CMD_INHIBIT_EXPANSION);
command->flags |= COMMAND_BUILTIN_FLAGS;
command->value.Simple->flags |= COMMAND_BUILTIN_FLAGS;
#if 0
/* This breaks for things like ( cd /tmp ; command z ababa ; echo next )
or $(command echo a ; command echo b;) or even
@ -184,7 +190,7 @@ get_standard_path ()
len = (size_t)confstr (_CS_PATH, (char *)NULL, (size_t)0);
if (len > 0)
{
p = xmalloc ((int)len + 2);
p = (char *)xmalloc (len + 2);
*p = '\0';
confstr (_CS_PATH, p, len);
return (p);

View File

@ -26,6 +26,7 @@
#endif
#include <stdio.h>
#include <chartypes.h>
#include "../bashtypes.h"
#include "posixstat.h"
#include <signal.h>
@ -63,26 +64,18 @@
extern int errno;
#endif /* !errno */
#ifdef __STDC__
typedef int QSFUNC (const void *, const void *);
#else
typedef int QSFUNC ();
#endif
extern int no_symbolic_links, interactive, interactive_shell;
extern int no_symbolic_links;
extern int indirection_level, startup_state, subshell_environment;
extern int line_number;
extern int last_command_exit_value;
extern int running_trap;
extern int variable_context;
extern int posixly_correct;
extern char *this_command_name, *shell_name;
extern COMMAND *global_command;
extern char *bash_getcwd_errstr;
/* Used by some builtins and the mainline code. */
Function *last_shell_builtin = (Function *)NULL;
Function *this_shell_builtin = (Function *)NULL;
sh_builtin_func_t *last_shell_builtin = (sh_builtin_func_t *)NULL;
sh_builtin_func_t *this_shell_builtin = (sh_builtin_func_t *)NULL;
/* **************************************************************** */
/* */
@ -337,7 +330,7 @@ set_dollar_vars_changed ()
follow. If FATAL is true, call throw_to_top_level, which exits the
shell; if not, call jump_to_top_level (DISCARD), which aborts the
current command. */
int
long
get_numeric_arg (list, fatal)
WORD_LIST *list;
int fatal;
@ -359,9 +352,31 @@ get_numeric_arg (list, fatal)
}
no_args (list->next);
}
return (count);
}
/* Get an eight-bit status value from LIST */
int
get_exitstat (list)
WORD_LIST *list;
{
int status;
long sval;
char *arg;
arg = list->word->word;
if (arg == 0 || legal_number (arg, &sval) == 0)
{
builtin_error ("bad non-numeric arg `%s'", list->word->word);
return 255;
}
no_args (list->next);
status = sval & 255;
return status;
}
/* Return the octal number parsed from STRING, or -1 to indicate
that the string contained a bad number. */
int
@ -375,9 +390,11 @@ read_octal (string)
{
digits++;
result = (result * 8) + (*string++ - '0');
if (result > 0777)
return -1;
}
if (!digits || result > 0777 || *string)
if (digits == 0 || *string)
result = -1;
return (result);
@ -409,7 +426,7 @@ get_working_directory (for_whom)
if (the_current_working_directory == 0)
{
the_current_working_directory = xmalloc (PATH_MAX);
the_current_working_directory = (char *)xmalloc (PATH_MAX);
the_current_working_directory[0] = '\0';
directory = getcwd (the_current_working_directory, PATH_MAX);
if (directory == 0)
@ -449,7 +466,7 @@ get_job_spec (list)
WORD_LIST *list;
{
register char *word;
int job, substring;
int job, substring_search;
if (list == 0)
return (current_job);
@ -462,13 +479,13 @@ get_job_spec (list)
if (*word == '%')
word++;
if (digit (*word) && all_digits (word))
if (DIGIT (*word) && all_digits (word))
{
job = atoi (word);
return (job >= job_slots ? NO_JOB : job - 1);
}
substring = 0;
substring_search = 0;
switch (*word)
{
case 0:
@ -480,7 +497,7 @@ get_job_spec (list)
return (previous_job);
case '?': /* Substring search requested. */
substring++;
substring_search++;
word++;
/* FALLTHROUGH */
@ -498,15 +515,17 @@ get_job_spec (list)
p = jobs[i]->pipe;
do
{
if ((substring && strindex (p->command, word)) ||
if ((substring_search && strindex (p->command, word)) ||
(STREQN (p->command, word, wl)))
if (job != NO_JOB)
{
builtin_error ("ambigious job spec: %s", word);
return (DUP_JOB);
}
else
job = i;
{
if (job != NO_JOB)
{
builtin_error ("ambigious job spec: %s", word);
return (DUP_JOB);
}
else
job = i;
}
p = p->next;
}
@ -658,33 +677,33 @@ builtin_address_internal (name, disabled_okay)
}
/* Return the pointer to the function implementing builtin command NAME. */
Function *
sh_builtin_func_t *
find_shell_builtin (name)
char *name;
{
current_builtin = builtin_address_internal (name, 0);
return (current_builtin ? current_builtin->function : (Function *)NULL);
return (current_builtin ? current_builtin->function : (sh_builtin_func_t *)NULL);
}
/* Return the address of builtin with NAME, whether it is enabled or not. */
Function *
sh_builtin_func_t *
builtin_address (name)
char *name;
{
current_builtin = builtin_address_internal (name, 1);
return (current_builtin ? current_builtin->function : (Function *)NULL);
return (current_builtin ? current_builtin->function : (sh_builtin_func_t *)NULL);
}
/* Return the function implementing the builtin NAME, but only if it is a
POSIX.2 special builtin. */
Function *
sh_builtin_func_t *
find_special_builtin (name)
char *name;
{
current_builtin = builtin_address_internal (name, 0);
return ((current_builtin && (current_builtin->flags & SPECIAL_BUILTIN)) ?
current_builtin->function :
(Function *)NULL);
(sh_builtin_func_t *)NULL);
}
static int

View File

@ -31,7 +31,7 @@
#define SEVAL_NOHIST 0x04
/* Functions from common.c */
extern void builtin_error __P((const char *, ...));
extern void builtin_error __P((const char *, ...)) __attribute__((__format__ (printf, 1, 2)));
extern void builtin_usage __P((void));
extern void no_args __P((WORD_LIST *));
extern void bad_option __P((char *));
@ -49,7 +49,8 @@ extern int dollar_vars_changed __P((void));
extern void set_dollar_vars_unchanged __P((void));
extern void set_dollar_vars_changed __P((void));
extern int get_numeric_arg __P((WORD_LIST *, int));
extern long get_numeric_arg __P((WORD_LIST *, int));
extern int get_exitstat __P((WORD_LIST *));
extern int read_octal __P((char *));
/* Keeps track of the current working directory. */
@ -65,23 +66,35 @@ extern int display_signal_list __P((WORD_LIST *, int));
/* It's OK to declare a function as returning a Function * without
providing a definition of what a `Function' is. */
extern struct builtin *builtin_address_internal __P((char *, int));
extern Function *find_shell_builtin __P((char *));
extern Function *builtin_address __P((char *));
extern Function *find_special_builtin __P((char *));
extern sh_builtin_func_t *find_shell_builtin __P((char *));
extern sh_builtin_func_t *builtin_address __P((char *));
extern sh_builtin_func_t *find_special_builtin __P((char *));
extern void initialize_shell_builtins __P((void));
/* Functions from getopts.def */
extern void getopts_reset __P((int));
/* Functions from set.def */
extern void initialize_shell_options __P((int));
extern void list_minus_o_opts __P((int, int));
extern int set_minus_o_option __P((int, char *));
extern int minus_o_option_value __P((char *));
extern void reset_shell_options __P((void));
extern void list_minus_o_opts __P((int, int));
extern char **get_minus_o_opts __P((void));
extern int set_minus_o_option __P((int, char *));
extern void set_shellopts __P((void));
extern void parse_shellopts __P((char *));
extern void initialize_shell_options __P((int));
extern void reset_shell_options __P((void));
/* Functions from shopt.def */
extern void reset_shopt_options __P((void));
extern char **get_shopt_options __P((void));
extern int shopt_setopt __P((char *, int));
extern int shopt_listopt __P((char *, int));
extern int set_login_shell __P((int));
/* Functions from type.def */
extern int describe_command __P((char *, int, int));
@ -93,17 +106,17 @@ extern void set_var_attribute __P((char *, int, int));
/* Functions from pushd.def */
extern char *get_dirstack_from_string __P((char *));
extern char *get_dirstack_element __P((int, int));
extern void set_dirstack_element __P((int, int, char *));
extern char *get_dirstack_element __P((long, int));
extern void set_dirstack_element __P((long, int, char *));
extern WORD_LIST *get_directory_stack __P((void));
/* Functions from evalstring.c */
extern int parse_and_execute __P((char *, char *, int));
extern int parse_and_execute __P((char *, const char *, int));
extern void parse_and_execute_cleanup __P((void));
/* Functions from evalfile.c */
extern int maybe_execute_file __P((char *, int));
extern int source_file __P((char *));
extern int fc_execute_file __P((char *));
extern int maybe_execute_file __P((const char *, int));
extern int source_file __P((const char *));
extern int fc_execute_file __P((const char *));
#endif /* !__COMMON_H */

View File

@ -24,7 +24,7 @@ $PRODUCES complete.c
$BUILTIN complete
$DEPENDS_ON PROGRAMMABLE_COMPLETION
$FUNCTION complete_builtin
$SHORT_DOC complete [-abcdefjkvu] [-pr] [-o option] [-A action] [-G globpat] [-W wordlist] [-P prefix] [-S suffix] [-X filterpat] [-F function] [-C command] [name ...]
$SHORT_DOC complete [-abcdefgjkvu] [-pr] [-o option] [-A action] [-G globpat] [-W wordlist] [-P prefix] [-S suffix] [-X filterpat] [-F function] [-C command] [name ...]
For each NAME, specify how arguments are to be completed.
If the -p option is supplied, or if no options are supplied, existing
completion specifications are printed in a way that allows them to be
@ -51,12 +51,20 @@ $END
#include "common.h"
#include "bashgetopt.h"
#include <readline/readline.h>
#define STRDUP(x) ((x) ? savestring (x) : (char *)NULL)
static int remove_cmd_completions ();
static int find_compact __P((char *));
static int find_compopt __P((char *));
static void print_all_completions ();
static int print_cmd_completions ();
static int build_actions __P((WORD_LIST *, int *, int *, unsigned long *, unsigned long *));
static int remove_cmd_completions __P((WORD_LIST *));
static void print_one_completion __P((char *, COMPSPEC *));
static void print_all_completions __P((void));
static int print_cmd_completions __P((WORD_LIST *));
static char *Aarg, *Garg, *Warg, *Parg, *Sarg, *Xarg, *Farg, *Carg;
@ -78,6 +86,7 @@ static struct _compacts {
{ "function", CA_FUNCTION, 0 },
{ "helptopic", CA_BUILTIN, 0 }, /* for now */
{ "hostname", CA_HOSTNAME, 0 },
{ "group", CA_GROUP, 'g' },
{ "job", CA_JOB, 'j' },
{ "keyword", CA_KEYWORD, 'k' },
{ "running", CA_RUNNING, 0 },
@ -144,14 +153,14 @@ build_actions (list, pp, rp, actp, optp)
int *pp, *rp;
unsigned long *actp, *optp;
{
int opt, ind, pflag, rflag, opt_given;
int opt, ind, opt_given;
unsigned long acts, copts;
acts = copts = (unsigned long)0L;
opt_given = 0;
reset_internal_getopt ();
while ((opt = internal_getopt (list, "abcdefjko:pruvA:G:W:P:S:X:F:C:")) != -1)
while ((opt = internal_getopt (list, "abcdefgjko:pruvA:G:W:P:S:X:F:C:")) != -1)
{
opt_given = 1;
switch (opt)
@ -200,6 +209,9 @@ build_actions (list, pp, rp, actp, optp)
case 'f':
acts |= CA_FILE;
break;
case 'g':
acts |= CA_GROUP;
break;
case 'j':
acts |= CA_JOB;
break;
@ -424,6 +436,7 @@ print_one_completion (cmd, cs)
PRINTOPT (CA_DIRECTORY, "-d");
PRINTOPT (CA_EXPORT, "-e");
PRINTOPT (CA_FILE, "-f");
PRINTOPT (CA_GROUP, "-g");
PRINTOPT (CA_KEYWORD, "-k");
PRINTOPT (CA_JOB, "-j");
PRINTOPT (CA_USER, "-u");
@ -490,7 +503,7 @@ print_cmd_completions (list)
$BUILTIN compgen
$DEPENDS_ON PROGRAMMABLE_COMPLETION
$FUNCTION compgen_builtin
$SHORT_DOC compgen [-abcdefjkvu] [-o option] [-A action] [-G globpat] [-W wordlist] [-P prefix] [-S suffix] [-X filterpat] [-F function] [-C command] [word]
$SHORT_DOC compgen [-abcdefgjkvu] [-o option] [-A action] [-G globpat] [-W wordlist] [-P prefix] [-S suffix] [-X filterpat] [-F function] [-C command] [word]
Display the possible completions depending on the options. Intended
to be used from within a shell function generating possible completions.
If the optional WORD argument is supplied, matches against WORD are
@ -547,9 +560,21 @@ compgen_builtin (list)
rval = EXECUTION_FAILURE;
sl = gen_compspec_completions (cs, "compgen", word, 0, 0);
/* This isn't perfect, but it's the best we can do, given what readline
exports from its set of completion utility functions. */
if ((sl == 0 || sl->list_len == 0) && (copts & COPT_DEFAULT))
{
char **matches;
matches = rl_completion_matches (word, rl_filename_completion_function);
sl = completions_to_stringlist (matches);
free_array (matches);
}
if (sl)
{
if (sl->list)
if (sl->list && sl->list_len)
{
rval = EXECUTION_SUCCESS;
print_stringlist (sl, (char *)NULL);

View File

@ -71,9 +71,9 @@ $END
#include "common.h"
#include "builtext.h"
extern int variable_context, array_needs_making;
extern int array_needs_making;
static int declare_internal ();
static int declare_internal __P((register WORD_LIST *, int));
/* Declare or change variable attributes. */
int
@ -110,7 +110,7 @@ declare_internal (list, local_var)
int local_var;
{
int flags_on, flags_off, *flags, any_failed, assign_error, pflag, nodefs;
char *t;
char *t, *subscript_start;
SHELL_VAR *var;
flags_on = flags_off = any_failed = assign_error = pflag = nodefs = 0;
@ -215,7 +215,7 @@ declare_internal (list, local_var)
char *value, *name;
int offset;
#if defined (ARRAY_VARS)
int making_array_special, assigning_array_special;
int making_array_special, compound_array_assign, simple_array_assign;
#endif
name = savestring (list->word->word);
@ -230,9 +230,11 @@ declare_internal (list, local_var)
value = "";
#if defined (ARRAY_VARS)
assigning_array_special = 0;
if (t = strchr (name, '['))
compound_array_assign = simple_array_assign = 0;
subscript_start = (char *)NULL;
if (t = strchr (name, '[')) /* ] */
{
subscript_start = t;
*t = '\0';
making_array_special = 1;
}
@ -344,18 +346,12 @@ declare_internal (list, local_var)
}
#if defined (ARRAY_VARS)
/* declare -a name=value does not work; declare name=value when
name is already an array does not work. */
if ((making_array_special || (flags_on & att_array) || array_p (var)) && offset)
{
if (value[0] == '(' && strchr (value, ')'))
assigning_array_special = 1;
compound_array_assign = 1;
else
{
builtin_error ("%s: cannot assign to array variables in this way", name);
assign_error++;
NEXT_VARIABLE ();
}
simple_array_assign = 1;
}
/* Cannot use declare +a name to remove an array variable. */
@ -375,8 +371,18 @@ declare_internal (list, local_var)
VUNSETATTR (var, flags_off);
#if defined (ARRAY_VARS)
if (offset && assigning_array_special)
if (offset && compound_array_assign)
assign_array_var_from_string (var, value);
else if (simple_array_assign && subscript_start)
{
/* declare [-a] name[N]=value */
*subscript_start = '['; /* ] */
var = assign_array_element (name, value);
*subscript_start = '\0';
}
else if (simple_array_assign)
/* let bind_array_variable take care of this. */
bind_array_variable (name, 0, value);
else
#endif
/* bind_variable_value duplicates the essential internals of

View File

@ -60,14 +60,6 @@ $END
# include "../pcomplete.h"
#endif
#if defined (HAVE_DLOPEN) && defined (HAVE_DLSYM)
static int dyn_load_builtin ();
#endif
#if defined (HAVE_DLCLOSE)
static int dyn_unload_builtin ();
#endif
#define ENABLED 1
#define DISABLED 2
#define SPECIAL 4
@ -79,8 +71,18 @@ static int dyn_unload_builtin ();
#define PFLAG 0x10
#define SFLAG 0x20
static int enable_shell_command ();
static void list_some_builtins ();
#if defined (HAVE_DLOPEN) && defined (HAVE_DLSYM)
static int dyn_load_builtin __P((WORD_LIST *, int, char *));
#endif
#if defined (HAVE_DLCLOSE)
static int dyn_unload_builtin __P((char *));
static void delete_builtin __P((struct builtin *));
static int local_dlclose __P((void *));
#endif
static void list_some_builtins __P((int));
static int enable_shell_command __P((char *, int));
/* Enable/disable shell commands present in LIST. If list is not specified,
then print out a list of shell commands showing which are enabled and
@ -305,7 +307,7 @@ dyn_load_builtin (list, flags, filename)
name = list->word->word;
size = strlen (name);
struct_name = xmalloc (size + 8);
struct_name = (char *)xmalloc (size + 8);
strcpy (struct_name, name);
strcpy (struct_name + size, "_struct");
@ -355,7 +357,7 @@ dyn_load_builtin (list, flags, filename)
sizeof (struct builtin));
new_shell_builtins[total].name = (char *)0;
new_shell_builtins[total].function = (Function *)0;
new_shell_builtins[total].function = (sh_builtin_func_t *)0;
new_shell_builtins[total].flags = 0;
if (shell_builtins != static_shell_builtins)
@ -427,7 +429,6 @@ dyn_unload_builtin (name)
struct builtin *b;
void *handle;
int ref, i;
char *uerror;
b = builtin_address_internal (name, 1);
if (b == 0)

View File

@ -57,8 +57,9 @@ extern int errno;
#define FEVAL_LONGJMP 0x010
#define FEVAL_HISTORY 0x020
#define FEVAL_CHECKBINARY 0x040
#define FEVAL_REGFILE 0x080
extern int interactive, interactive_shell, posixly_correct;
extern int posixly_correct;
extern int indirection_level, startup_state, subshell_environment;
extern int return_catch_flag, return_catch_value;
extern int last_command_exit_value;
@ -68,7 +69,7 @@ int sourcelevel = 0;
static int
_evalfile (filename, flags)
char *filename;
const char *filename;
int flags;
{
volatile int old_interactive;
@ -77,7 +78,9 @@ _evalfile (filename, flags)
char *string;
struct stat finfo;
size_t file_size;
VFunction *errfunc;
sh_vmsg_func_t *errfunc;
USE_VAR(pflags);
fd = open (filename, O_RDONLY);
@ -97,14 +100,14 @@ file_error_and_exit:
: ((errno == ENOENT) ? 0 : -1));
}
errfunc = (VFunction *)((flags & FEVAL_BUILTIN) ? builtin_error : internal_error);
errfunc = ((flags & FEVAL_BUILTIN) ? builtin_error : internal_error);
if (S_ISDIR (finfo.st_mode))
{
(*errfunc) ("%s: is a directory", filename);
return ((flags & FEVAL_BUILTIN) ? EXECUTION_FAILURE : -1);
}
else if (S_ISREG (finfo.st_mode) == 0)
else if ((flags & FEVAL_REGFILE) && S_ISREG (finfo.st_mode) == 0)
{
(*errfunc) ("%s: not a regular file", filename);
return ((flags & FEVAL_BUILTIN) ? EXECUTION_FAILURE : -1);
@ -122,7 +125,7 @@ file_error_and_exit:
setmode (fd, O_TEXT);
#endif
string = xmalloc (1 + file_size);
string = (char *)xmalloc (1 + file_size);
result = read (fd, string, file_size);
string[result] = '\0';
@ -143,7 +146,7 @@ file_error_and_exit:
}
if ((flags & FEVAL_CHECKBINARY) &&
check_binary_file ((unsigned char *)string, (result > 80) ? 80 : result))
check_binary_file (string, (result > 80) ? 80 : result))
{
free (string);
(*errfunc) ("%s: cannot execute binary file", filename);
@ -207,7 +210,7 @@ file_error_and_exit:
int
maybe_execute_file (fname, force_noninteractive)
char *fname;
const char *fname;
int force_noninteractive;
{
char *filename;
@ -225,20 +228,20 @@ maybe_execute_file (fname, force_noninteractive)
#if defined (HISTORY)
int
fc_execute_file (filename)
char *filename;
const char *filename;
{
int flags;
/* We want these commands to show up in the history list if
remember_on_history is set. */
flags = FEVAL_ENOENTOK|FEVAL_HISTORY;
flags = FEVAL_ENOENTOK|FEVAL_HISTORY|FEVAL_REGFILE;
return (_evalfile (filename, flags));
}
#endif /* HISTORY */
int
source_file (filename)
char *filename;
const char *filename;
{
int flags;

View File

@ -40,6 +40,7 @@
#include "../input.h"
#include "../execute_cmd.h"
#include "../redir.h"
#include "../trap.h"
#if defined (HISTORY)
# include "../bashhist.h"
@ -53,20 +54,15 @@ extern int errno;
#define IS_BUILTIN(s) (builtin_address_internal(s, 0) != (struct builtin *)NULL)
extern void run_trap_cleanup ();
extern int zwrite ();
extern int interactive, interactive_shell;
extern int indirection_level, startup_state, subshell_environment;
extern int line_number;
extern int last_command_exit_value;
extern int running_trap;
extern int posixly_correct;
extern COMMAND *global_command;
int parse_and_execute_level = 0;
static int cat_file ();
static int cat_file __P((REDIRECT *));
/* How to force parse_and_execute () to clean up after itself. */
void
@ -92,7 +88,7 @@ parse_and_execute_cleanup ()
int
parse_and_execute (string, from_file, flags)
char *string;
char *from_file;
const char *from_file;
int flags;
{
int code, x;
@ -297,7 +293,8 @@ cat_file (r)
REDIRECT *r;
{
char lbuf[128], *fn;
int nr, fd, rval;
int fd, rval;
ssize_t nr;
if (r->instruction != r_input_direction)
return -1;
@ -344,5 +341,5 @@ cat_file (r)
free (fn);
close (fd);
return (0);
return (rval);
}

View File

@ -66,7 +66,7 @@ $END
extern int errno;
#endif /* !errno */
extern int interactive, interactive_shell, subshell_environment;
extern int subshell_environment;
extern REDIRECT *redirection_undo_list;
int no_exit_on_failed_exec;
@ -79,7 +79,7 @@ mkdashname (name)
{
char *ret;
ret = xmalloc (2 + strlen (name));
ret = (char *)xmalloc (2 + strlen (name));
ret[0] = '-';
strcpy (ret + 1, name);
return ret;

View File

@ -43,12 +43,12 @@ $END
#include "common.h"
#include "builtext.h" /* for jobs_builtin */
extern int interactive, login_shell;
extern int last_command_exit_value;
extern Function *this_shell_builtin;
extern Function *last_shell_builtin;
extern int subshell_environment;
extern sh_builtin_func_t *this_shell_builtin;
extern sh_builtin_func_t *last_shell_builtin;
static int exit_or_logout ();
static int exit_or_logout __P((WORD_LIST *));
static int sourced_logout;
int
@ -119,10 +119,10 @@ exit_or_logout (list)
/* Get return value if present. This means that you can type
`logout 5' to a shell, and it returns 5. */
exit_value = list ? get_numeric_arg (list, 1) : last_command_exit_value;
exit_value = list ? get_exitstat (list) : last_command_exit_value;
/* Run our `~/.bash_logout' file if it exists, and this is a login shell. */
if (login_shell && sourced_logout++ == 0)
if (login_shell && sourced_logout++ == 0 && subshell_environment == 0)
{
maybe_execute_file ("~/.bash_logout", 1);
#ifdef SYS_BASH_LOGOUT

View File

@ -63,6 +63,7 @@ $END
#endif
#include <stdio.h>
#include <chartypes.h>
#include "../bashansi.h"
#include <errno.h>
@ -84,7 +85,7 @@ extern int echo_input_at_read;
extern int current_command_line_count;
extern int literal_history;
extern int unlink ();
extern int unlink __P((const char *));
extern FILE *sh_mktmpfp __P((char *, int, char **));
@ -117,10 +118,6 @@ extern FILE *sh_mktmpfp __P((char *, int, char **));
Equivalent to !command:sg/pat/rep execpt there can be multiple PAT=REP's.
*/
static char *fc_dosubs (), *fc_gethist (), *fc_readline ();
static int fc_gethnum (), fc_number ();
static void fc_replhist (), fc_addhist ();
/* Data structure describing a list of global replacements to perform. */
typedef struct repl {
struct repl *next;
@ -146,6 +143,16 @@ typedef struct repl {
} \
} while (0)
static char *fc_dosubs __P((char *, REPL *));
static char *fc_gethist __P((char *, HIST_ENTRY **));
static int fc_gethnum __P((char *, HIST_ENTRY **));
static int fc_number __P((WORD_LIST *));
static void fc_replhist __P((char *));
#ifdef INCLUDE_UNUSED
static char *fc_readline __P((FILE *));
static void fc_addhist __P((char *));
#endif
/* String to execute on a file that we want to edit. */
#define FC_EDIT_COMMAND "${FCEDIT:-${EDITOR:-vi}}"
@ -159,7 +166,7 @@ fc_builtin (list)
int histbeg, histend, last_hist, retval, opt;
FILE *stream;
REPL *rlist, *rl;
char *ename, *command, *newcom, *line;
char *ename, *command, *newcom;
HIST_ENTRY **hlist;
char *fn;
@ -445,7 +452,7 @@ fc_gethnum (command, hlist)
s++;
}
if (s && digit(*s))
if (s && DIGIT(*s))
{
n = atoi (s);
n *= sign;
@ -494,6 +501,7 @@ fc_gethist (command, hlist)
return ((char *)NULL);
}
#ifdef INCLUDE_UNUSED
/* Read the edited history lines from STREAM and return them
one at a time. This can read unlimited length lines. The
caller should free the storage. */
@ -508,7 +516,7 @@ fc_readline (stream)
while ((c = getc (stream)) != EOF)
{
if ((lindex + 2) >= line_len)
line = (char *) xrealloc (line, (line_len += 128));
line = (char *)xrealloc (line, (line_len += 128));
if (c == '\n')
{
@ -535,6 +543,7 @@ fc_readline (stream)
line[lindex++] = '\0';
return (line);
}
#endif
/* Perform the SUBS on COMMAND.
SUBS is a list of substitutions, and COMMAND is a simple string.
@ -604,6 +613,7 @@ fc_replhist (command)
}
}
#ifdef INCLUDE_UNUSED
/* Add LINE to the history, after removing a single trailing newline. */
static void
fc_addhist (line)
@ -619,4 +629,6 @@ fc_addhist (line)
if (line && *line)
maybe_add_history (line);
}
#endif
#endif /* HISTORY */

View File

@ -46,7 +46,7 @@ $END
#if defined (JOB_CONTROL)
extern char *this_command_name;
static int fg_bg ();
static int fg_bg __P((WORD_LIST *, int));
/* How to bring a job into the foreground. */
int

View File

@ -20,6 +20,8 @@
#ifndef _SH_GETOPT_H
#define _SH_GETOPT_H 1
#include "stdc.h"
/* For communication from `getopt' to the caller.
When `getopt' finds an option that takes an argument,
the argument value is returned here.
@ -54,7 +56,7 @@ extern int sh_optopt;
/* Set to 1 when an unrecognized option is encountered. */
extern int sh_badopt;
extern int sh_getopt ();
extern void sh_getopt_restore_state ();
extern int sh_getopt __P((int, char *const *, const char *));
extern void sh_getopt_restore_state __P((char **));
#endif /* _SH_GETOPT_H */

View File

@ -79,7 +79,6 @@ $END
#define G_ARG_MISSING -3
extern char *this_command_name;
extern WORD_LIST *rest_of_args;
/* getopts_reset is magic code for when OPTIND is reset. N is the
value that has just been assigned to OPTIND. */
@ -304,14 +303,10 @@ getopts_builtin (list)
}
reset_internal_getopt ();
while ((ret = internal_getopt (list, "")) != -1)
if (internal_getopt (list, "") != -1)
{
switch (ret)
{
default:
builtin_usage ();
return (EX_USAGE);
}
builtin_usage ();
return (EX_USAGE);
}
list = loptend;

View File

@ -23,12 +23,15 @@ $PRODUCES hash.c
$BUILTIN hash
$FUNCTION hash_builtin
$SHORT_DOC hash [-r] [-p pathname] [name ...]
$SHORT_DOC hash [-r] [-p pathname] [-t] [name ...]
For each NAME, the full pathname of the command is determined and
remembered. If the -p option is supplied, PATHNAME is used as the
full pathname of NAME, and no path search is performed. The -r
option causes the shell to forget all remembered locations. If no
arguments are given, information about remembered commands is displayed.
option causes the shell to forget all remembered locations.
If the -t option is supplied the full pathname to which each NAME
corresponds is printed. If multiple NAME arguments are supplied with
-t, the NAME is printed before the hashed full pathname. If no arguments
are given, information about remembered commands is displayed.
$END
#include <config.h>
@ -56,8 +59,9 @@ $END
extern int dot_found_in_search;
extern char *this_command_name;
static int add_hashed_command ();
static int print_hashed_commands ();
static int add_hashed_command __P((char *, int));
static int print_hashed_commands __P((void));
static int list_hashed_filename_targets __P((WORD_LIST *));
/* Print statistics on the current state of hashed commands. If LIST is
not empty, then rehash (or hash in the first place) the specified
@ -66,7 +70,7 @@ int
hash_builtin (list)
WORD_LIST *list;
{
int expunge_hash_table, opt;
int expunge_hash_table, list_targets, opt;
char *w, *pathname;
if (hashing_enabled == 0)
@ -75,10 +79,10 @@ hash_builtin (list)
return (EXECUTION_FAILURE);
}
expunge_hash_table = 0;
expunge_hash_table = list_targets = 0;
pathname = (char *)NULL;
reset_internal_getopt ();
while ((opt = internal_getopt (list, "rp:")) != -1)
while ((opt = internal_getopt (list, "rp:t")) != -1)
{
switch (opt)
{
@ -88,6 +92,9 @@ hash_builtin (list)
case 'p':
pathname = list_optarg;
break;
case 't':
list_targets = 1;
break;
default:
builtin_usage ();
return (EX_USAGE);
@ -95,6 +102,13 @@ hash_builtin (list)
}
list = loptend;
/* hash -t requires at least one argument. */
if (list == 0 && list_targets)
{
builtin_error("-t: argument required");
return (EXECUTION_FAILURE);
}
/* We want hash -r to be silent, but hash -- to print hashing info. That
is the reason for the test of expunge_hash_table. */
if (list == 0 && expunge_hash_table == 0)
@ -108,6 +122,12 @@ hash_builtin (list)
if (expunge_hash_table)
flush_hashed_filenames ();
/* If someone runs `hash -r -t xyz' he will be disappointed. */
if (list_targets)
{
return (list_hashed_filename_targets (list));
}
#if defined (RESTRICTED_SHELL)
if (restricted && pathname && strchr (pathname, '/'))
{
@ -198,3 +218,31 @@ print_hashed_commands ()
}
return (any_printed);
}
static int
list_hashed_filename_targets (list)
WORD_LIST *list;
{
int all_found, multiple;
char *target;
WORD_LIST *l;
all_found = 1;
multiple = list->next != 0;
for (l = list; l; l = l->next)
{
target = find_hashed_filename (l->word->word);
if (target == 0)
{
all_found = 0;
builtin_error ("%s: not found", l->word->word);
continue;
}
if (multiple)
printf ("%s\t", l->word->word);
printf ("%s\n", target);
}
return (all_found ? EXECUTION_SUCCESS : EXECUTION_FAILURE);
}

View File

@ -47,15 +47,13 @@ $END
#include "../shell.h"
#include "../builtins.h"
#include "../pathexp.h"
#include "common.h"
#include "bashgetopt.h"
#include <glob/fnmatch.h>
#include <glob/strmatch.h>
#include <glob/glob.h>
extern void builtin_error ();
extern void builtin_usage ();
static void show_builtin_command_help ();
static void show_builtin_command_help __P((void));
/* Print out a list of the known functions in the shell, and what they do.
If LIST is supplied, print out the list which matches for each pattern
@ -109,7 +107,7 @@ help_builtin (list)
{
QUIT;
if ((strncmp (pattern, name, plen) == 0) ||
(fnmatch (pattern, name, FNMATCH_EXTFLAG) != FNM_NOMATCH))
(strmatch (pattern, name, FNMATCH_EXTFLAG) != FNM_NOMATCH))
{
printf ("%s: %s\n", name, shell_builtins[i].short_doc);

View File

@ -70,10 +70,11 @@ $END
extern int errno;
#endif
static void display_history ();
static void push_history ();
static int expand_and_print_history ();
static int delete_histent ();
static void display_history __P((WORD_LIST *));
static int delete_histent __P((int));
static int delete_last_history __P((void));
static void push_history __P((WORD_LIST *));
static int expand_and_print_history __P((WORD_LIST *));
#define AFLAG 0x01
#define RFLAG 0x02
@ -163,17 +164,14 @@ history_builtin (list)
#endif
else if (flags & DFLAG)
{
if (legal_number (delete_arg, &delete_offset) == 0)
if ((legal_number (delete_arg, &delete_offset) == 0)
|| (delete_offset < history_base)
|| (delete_offset > (history_base + history_length)))
{
builtin_error ("%s: not a valid history position", delete_arg);
return (EXECUTION_FAILURE);
}
opt = delete_offset;
if (opt < history_base || opt < 0 || opt > (history_base + history_length))
{
builtin_error ("%d: not a valid history position", opt);
return (EXECUTION_FAILURE);
}
result = delete_histent (opt - history_base);
/* Since remove_history changes history_length, this can happen if
we delete the last history entry. */
@ -217,16 +215,17 @@ display_history (list)
WORD_LIST *list;
{
register int i;
int limited, limit;
long limit;
HIST_ENTRY **hlist;
if (list)
{
limited = 1;
limit = get_numeric_arg (list, 0);
if (limit < 0)
limit = -limit;
}
else
limited = limit = 0;
limit = -1;
hlist = history_list ();
@ -235,10 +234,9 @@ display_history (list)
for (i = 0; hlist[i]; i++)
;
if (limit < 0)
limit = -limit;
if ((limited == 0) || ((i -= limit) < 0))
if (0 <= limit && limit < i)
i -= limit;
else
i = 0;
while (hlist[i])

View File

@ -57,8 +57,7 @@ $END
#define JSTATE_RUNNING 0x1
#define JSTATE_STOPPED 0x2
extern int job_control, interactive_shell;
static int execute_list_with_replacements ();
static int execute_list_with_replacements __P((WORD_LIST *));
/* The `jobs' command. Prints outs a list of active jobs. If the
argument `-l' is given, then the process id's are printed also.
@ -220,6 +219,7 @@ disown_builtin (list)
{
int opt, job, retval, nohup_only, running_jobs, all_jobs;
sigset_t set, oset;
long pid_value;
nohup_only = running_jobs = all_jobs = 0;
reset_internal_getopt ();
@ -257,8 +257,8 @@ disown_builtin (list)
do
{
BLOCK_CHILD (set, oset);
job = (list && all_digits(list->word->word))
? get_job_by_pid (atoi(list->word->word), 0)
job = (list && legal_number (list->word->word, &pid_value) && pid_value == (pid_t) pid_value)
? get_job_by_pid ((pid_t) pid_value, 0)
: get_job_spec (list);
if (job == NO_JOB || jobs == 0 || job < 0 || job >= job_slots || jobs[job] == 0)

View File

@ -58,8 +58,6 @@ extern int errno;
#endif /* !errno */
#if defined (JOB_CONTROL)
extern int interactive;
extern int job_control;
extern int posixly_correct;
#if !defined (CONTINUE_AFTER_KILL_ERROR)
@ -78,6 +76,7 @@ kill_builtin (list)
int signal, any_succeeded, listing, saw_signal;
char *sigspec, *word;
pid_t pid;
long pid_value;
if (list == 0)
{
@ -164,10 +163,10 @@ kill_builtin (list)
if (*word == '-')
word++;
if (*word && all_digits (word))
if (*word && legal_number (word, &pid_value) && (pid_value == (pid_t)pid_value))
{
/* Use the entire argument in case of minus sign presence. */
pid = (pid_t) atoi (list->word->word);
pid = (pid_t) pid_value;
if (kill_pid (pid, signal, 0) < 0)
goto signal_error;
@ -207,12 +206,10 @@ kill_builtin (list)
if (kill_pid (pid, signal, 1) < 0)
{
signal_error:
if (errno == EPERM)
builtin_error ("(%d) - Not owner", (int)pid);
else if (errno == ESRCH)
builtin_error ("(%d) - No such pid", (int)pid);
else
if (errno == EINVAL)
builtin_error ("Invalid signal %d", signal);
else
builtin_error ("(%ld) - %s", (long)pid, strerror (errno));
CONTINUE_OR_FAIL;
}
else

View File

@ -93,7 +93,7 @@ let_builtin (list)
return (EXECUTION_FAILURE);
}
return ((ret == 0L) ? EXECUTION_FAILURE : EXECUTION_SUCCESS);
return ((ret == 0) ? EXECUTION_FAILURE : EXECUTION_SUCCESS);
}
#ifdef INCLUDE_UNUSED
@ -113,6 +113,6 @@ exp_builtin (list)
exp = string_list (list);
ret = evalexp (exp, &expok);
(void)free (exp);
return (((ret == 0L) || (expok == 0)) ? EXECUTION_FAILURE : EXECUTION_SUCCESS);
return (((ret == 0) || (expok == 0)) ? EXECUTION_FAILURE : EXECUTION_SUCCESS);
}
#endif

View File

@ -39,6 +39,8 @@ Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#include "../bashansi.h"
#include <stdio.h>
#include "stdc.h"
#define DOCFILE "builtins.texi"
static char *xmalloc (), *xrealloc ();
@ -223,7 +225,7 @@ main (argc, argv)
if (struct_filename)
{
temp_struct_filename = xmalloc (15);
sprintf (temp_struct_filename, "mk-%d", (int) getpid ());
sprintf (temp_struct_filename, "mk-%ld", (long) getpid ());
structfile = fopen (temp_struct_filename, "w");
if (!structfile)
@ -378,17 +380,22 @@ array_free (array)
/* The definition of a function. */
typedef int Function ();
typedef int mk_handler_func_t __P((char *, DEF_FILE *, char *));
/* Structure handles processor directives. */
typedef struct {
char *directive;
Function *function;
mk_handler_func_t *function;
} HANDLER_ENTRY;
extern int
builtin_handler (), function_handler (), short_doc_handler (),
comment_handler (), depends_on_handler (), produces_handler (),
end_handler (), docname_handler ();
extern int builtin_handler __P((char *, DEF_FILE *, char *));
extern int function_handler __P((char *, DEF_FILE *, char *));
extern int short_doc_handler __P((char *, DEF_FILE *, char *));
extern int comment_handler __P((char *, DEF_FILE *, char *));
extern int depends_on_handler __P((char *, DEF_FILE *, char *));
extern int produces_handler __P((char *, DEF_FILE *, char *));
extern int end_handler __P((char *, DEF_FILE *, char *));
extern int docname_handler __P((char *, DEF_FILE *, char *));
HANDLER_ENTRY handlers[] = {
{ "BUILTIN", builtin_handler },
@ -400,7 +407,7 @@ HANDLER_ENTRY handlers[] = {
{ "DEPENDS_ON", depends_on_handler },
{ "PRODUCES", produces_handler },
{ "END", end_handler },
{ (char *)NULL, (Function *)NULL }
{ (char *)NULL, (mk_handler_func_t *)NULL }
};
/* Return the entry in the table of handlers for NAME. */
@ -724,8 +731,9 @@ add_documentation (defs, line)
/* How to handle the $BUILTIN directive. */
int
builtin_handler (self, defs, arg)
char *self, *arg;
char *self;
DEF_FILE *defs;
char *arg;
{
BUILTIN_DESC *new;
char *name;
@ -769,8 +777,9 @@ builtin_handler (self, defs, arg)
/* How to handle the $FUNCTION directive. */
int
function_handler (self, defs, arg)
char *self, *arg;
char *self;
DEF_FILE *defs;
char *arg;
{
register BUILTIN_DESC *builtin;
@ -793,8 +802,9 @@ function_handler (self, defs, arg)
/* How to handle the $DOCNAME directive. */
int
docname_handler (self, defs, arg)
char *self, *arg;
char *self;
DEF_FILE *defs;
char *arg;
{
register BUILTIN_DESC *builtin;
@ -812,8 +822,9 @@ docname_handler (self, defs, arg)
/* How to handle the $SHORT_DOC directive. */
int
short_doc_handler (self, defs, arg)
char *self, *arg;
char *self;
DEF_FILE *defs;
char *arg;
{
register BUILTIN_DESC *builtin;
@ -830,9 +841,10 @@ short_doc_handler (self, defs, arg)
/* How to handle the $COMMENT directive. */
int
comment_handler (self, defs)
comment_handler (self, defs, arg)
char *self;
DEF_FILE *defs;
char *arg;
{
return (0);
}
@ -840,8 +852,9 @@ comment_handler (self, defs)
/* How to handle the $DEPENDS_ON directive. */
int
depends_on_handler (self, defs, arg)
char *self, *arg;
char *self;
DEF_FILE *defs;
char *arg;
{
register BUILTIN_DESC *builtin;
char *dependent;
@ -860,8 +873,9 @@ depends_on_handler (self, defs, arg)
/* How to handle the $PRODUCES directive. */
int
produces_handler (self, defs, arg)
char *self, *arg;
char *self;
DEF_FILE *defs;
char *arg;
{
/* If just hacking documentation, don't change any of the production
files. */
@ -893,8 +907,9 @@ produces_handler (self, defs, arg)
/* How to handle the $END directive. */
int
end_handler (self, defs, arg)
char *self, *arg;
char *self;
DEF_FILE *defs;
char *arg;
{
must_be_building (self, defs);
building_builtin = 0;
@ -1056,7 +1071,7 @@ char *structfile_header[] = {
"",
" Functions which need to look at only the simple commands (e.g.",
" the enable_builtin ()), should ignore entries where",
" (array[i].function == (Function *)NULL). Such entries are for",
" (array[i].function == (sh_builtin_func_t *)NULL). Such entries are for",
" the list of shell reserved control structures, like `if' and `while'.",
" The end of the list is denoted with a NULL name field. */",
"",
@ -1065,7 +1080,7 @@ char *structfile_header[] = {
};
char *structfile_footer[] = {
" { (char *)0x0, (Function *)0x0, 0, (char **)0x0, (char *)0x0 }",
" { (char *)0x0, (sh_builtin_func_t *)0x0, 0, (char **)0x0, (char *)0x0 }",
"};",
"",
"struct builtin *shell_builtins = static_shell_builtins;",
@ -1147,7 +1162,7 @@ write_builtins (defs, structfile, externfile)
if (externfile)
{
if (builtin->function)
fprintf (externfile, "extern int %s ();\n",
fprintf (externfile, "extern int %s __P((WORD_LIST *));\n",
builtin->function);
fprintf (externfile, "extern char *%s_doc[];\n",
@ -1162,7 +1177,7 @@ write_builtins (defs, structfile, externfile)
if (builtin->function)
fprintf (structfile, "%s, ", builtin->function);
else
fprintf (structfile, "(Function *)0x0, ");
fprintf (structfile, "(sh_builtin_func_t *)0x0, ");
fprintf (structfile, "%s%s%s, %s_doc,\n",
"BUILTIN_ENABLED | STATIC_BUILTIN",

View File

@ -42,20 +42,33 @@ $END
#if defined (HAVE_LIMITS_H)
# include <limits.h>
#else
/* Assume 32-bit ints and longs. */
# define LONG_MAX 2147483647L
# define LONG_MIN (-2147483647L-1)
/* Assume 32-bit ints. */
# define INT_MAX 2147483647
# define INT_MIN (-2147483647-1)
#endif
#include <stdio.h>
#include <ctype.h>
#include <chartypes.h>
#ifdef HAVE_INTTYPES_H
# include <inttypes.h>
#endif
#include "../bashansi.h"
#define NEED_STRTOIMAX_DECL
#include "../shell.h"
#include "stdc.h"
#include "bashgetopt.h"
#include "common.h"
/* This should use the ISO C constant format strings; I'll do that later. */
#if SIZEOF_LONG < SIZEOF_LONG_LONG
# define INTMAX_CONV "ll"
#else
# define INTMAX_CONV "l"
#endif
#if !defined (errno)
extern int errno;
@ -63,57 +76,78 @@ extern int errno;
#define PF(f, func) \
do { \
if (fieldwidth && precision) \
(void)printf(f, fieldwidth, precision, func); \
else if (fieldwidth && precision == 0) \
(void)printf(f, fieldwidth, func); \
else if (precision) \
(void)printf(f, precision, func); \
if (have_fieldwidth && have_precision) \
tw += printf(f, fieldwidth, precision, func); \
else if (have_fieldwidth) \
tw += printf(f, fieldwidth, func); \
else if (have_precision) \
tw += printf(f, precision, func); \
else \
(void)printf(f, func); \
tw += printf(f, func); \
} while (0)
/* We free the buffer used by mklong() if it's `too big'. */
#define PRETURN(value) \
do { /* free (format); */ fflush (stdout); return (value); } while (0)
do \
{ \
if (conv_bufsize > 4096 ) \
{ \
free(conv_buf); \
conv_bufsize = 0; \
conv_buf = 0; \
} \
fflush (stdout); \
return (value); \
} \
while (0)
#define SKIP1 "#-+ 0"
#define SKIP2 "*0123456789"
#define SKIP1 "#'-+ 0"
#define LENMODS "hjlLtz"
static void printstr __P((char *, char *, int, int, int));
static int tescape __P((char *, int, char *, int *));
static char *bexpand __P((char *, int, int *, int *));
static char *mklong __P((char *, int));
static char *mklong __P((char *, char *));
static int getchr __P((void));
static char *getstr __P((void));
static int getint __P((void));
static int getlong __P((long *));
static int getulong __P((unsigned long *));
static int getdouble __P((double *));
static long getlong __P((void));
static unsigned long getulong __P((void));
#if defined (HAVE_LONG_LONG)
static long long getllong __P((void));
static unsigned long long getullong __P((void));
#endif
static intmax_t getintmax __P((void));
static uintmax_t getuintmax __P((void));
static double getdouble __P((void));
#if defined (HAVE_LONG_DOUBLE) && HAVE_DECL_STRTOLD
static long double getldouble __P((void));
#endif
static int asciicode __P((void));
static WORD_LIST *garglist;
static int retval;
static int conversion_error;
extern char *sh_backslash_quote ();
static char *conv_buf;
static size_t conv_bufsize;
int
printf_builtin (list)
WORD_LIST *list;
{
int ch, end, fieldwidth, precision, foundmod, fmtlen;
char convch, nextch, *format, *fmt, *start;
int ch, fieldwidth, precision;
int have_fieldwidth, have_precision;
long tw;
char convch, thisch, nextch, *format, *modstart, *fmt, *start;
conversion_error = 0;
retval = EXECUTION_SUCCESS;
reset_internal_getopt ();
while ((ch = internal_getopt (list, "")) != -1)
if (internal_getopt (list, "") != -1)
{
switch (ch)
{
case '?':
default:
builtin_usage();
return (EX_USAGE);
}
builtin_usage();
return (EX_USAGE);
}
list = loptend;
@ -140,18 +174,20 @@ printf_builtin (list)
format strings are reused as necessary to use up the provided
arguments, arguments of zero/null string are provided to use
up the format string. */
do
{
tw = 0;
/* find next format specification */
for (fmt = format; *fmt; fmt++)
{
precision = fieldwidth = foundmod = 0;
precision = fieldwidth = 0;
have_fieldwidth = have_precision = 0;
if (*fmt == '\\')
{
fmt++;
/* A NULL third argument to tescape means to not do special
/* A NULL fourth argument to tescape means to not do special
processing for \c. */
fmt += tescape (fmt, 1, &nextch, (int *)NULL);
putchar (nextch);
@ -177,27 +213,37 @@ printf_builtin (list)
/* found format specification, skip to field width */
for (; *fmt && strchr(SKIP1, *fmt); ++fmt)
;
fieldwidth = (*fmt == '*') ? getint () : 0;
/* skip to possible '.', get following precision */
for (; *fmt && strchr(SKIP2, *fmt); ++fmt)
;
/* Skip optional field width. */
if (*fmt == '*')
{
fmt++;
have_fieldwidth = 1;
fieldwidth = getint ();
}
else
while (DIGIT (*fmt))
fmt++;
/* Skip optional '.' and precision */
if (*fmt == '.')
{
++fmt;
precision = (*fmt == '*') ? getint () : 0;
if (*fmt == '*')
{
fmt++;
have_precision = 1;
precision = getint ();
}
else
while (DIGIT (*fmt))
fmt++;
}
/* skip to conversion char */
for (; *fmt && strchr(SKIP2, *fmt); ++fmt)
;
/* skip possible format modifiers */
if (*fmt == 'l' || *fmt == 'L' || *fmt == 'h')
{
fmt++;
foundmod = 1;
}
modstart = fmt;
while (*fmt && strchr (LENMODS, *fmt))
fmt++;
if (*fmt == 0)
{
@ -206,8 +252,11 @@ printf_builtin (list)
}
convch = *fmt;
nextch = fmt[1];
fmt[1] = '\0';
thisch = modstart[0];
nextch = modstart[1];
modstart[0] = convch;
modstart[1] = '\0';
switch(convch)
{
case 'c':
@ -228,6 +277,24 @@ printf_builtin (list)
break;
}
case 'n':
{
char *var;
var = getstr ();
if (var && *var)
{
if (legal_identifier (var))
bind_var_to_int (var, tw);
else
{
builtin_error ("%s: invalid variable name", var);
PRETURN (EXECUTION_FAILURE);
}
}
break;
}
case 'b': /* expand escapes in argument */
{
char *p, *xp;
@ -268,16 +335,34 @@ printf_builtin (list)
case 'd':
case 'i':
{
long p;
char *f;
#if defined (HAVE_LONG_LONG)
if (thisch == 'l' && nextch == 'l')
{
long long p;
if (foundmod == 0 && ((f = mklong (start, convch)) == NULL))
PRETURN (EXECUTION_FAILURE);
p = getllong ();
f = mklong (start, "ll");
PF(f, p);
}
else
f = start;
if (getlong (&p))
PRETURN (EXECUTION_FAILURE);
PF(f, p);
#endif
if (thisch == 'j')
{
intmax_t p;
p = getintmax ();
f = mklong (start, INTMAX_CONV);
PF(f, p);
}
else
{
long p;
p = getlong ();
f = mklong (start, "l");
PF(f, p);
}
break;
}
@ -286,30 +371,67 @@ printf_builtin (list)
case 'x':
case 'X':
{
unsigned long p;
char *f;
#if defined (HAVE_LONG_LONG)
if (thisch == 'l' && nextch == 'l')
{
unsigned long long p;
if (foundmod == 0 && ((f = mklong (start, convch)) == NULL))
PRETURN (EXECUTION_FAILURE);
p = getullong ();
f = mklong (start, "ll");
PF(f, p);
}
else
f = start;
if (getulong (&p))
PRETURN (EXECUTION_FAILURE);
PF (f, p);
#endif
if (thisch == 'j')
{
uintmax_t p;
p = getuintmax ();
f = mklong (start, INTMAX_CONV);
PF(f, p);
}
else
{
unsigned long p;
p = getulong ();
f = mklong (start, "l");
PF (f, p);
}
break;
}
case 'e':
case 'E':
case 'f':
case 'F':
case 'g':
case 'G':
#if defined (HAVE_PRINTF_A_FORMAT)
case 'a':
case 'A':
#endif
{
double p;
char *f;
#if defined (HAVE_LONG_DOUBLE) && HAVE_DECL_STRTOLD
if (thisch == 'L')
{
long double p;
if (getdouble (&p))
PRETURN (EXECUTION_FAILURE);
PF(start, p);
p = getldouble ();
f = mklong (start, "L");
PF (f, p);
}
else
#endif
{
double p;
p = getdouble ();
f = mklong (start, "");
PF (f, p);
}
break;
}
@ -320,11 +442,15 @@ printf_builtin (list)
PRETURN (EXECUTION_FAILURE);
}
fmt[1] = nextch;
modstart[0] = thisch;
modstart[1] = nextch;
}
}
while (garglist && garglist != list->next);
if (conversion_error)
retval = EXECUTION_FAILURE;
PRETURN (retval);
}
@ -352,10 +478,11 @@ printstr (fmt, string, len, fieldwidth, precision)
if (*fmt == '%')
fmt++;
ljust = fw = pr = 0;
ljust = fw = 0;
pr = -1;
/* skip flags */
while (*fmt == '#' || *fmt == '-' || *fmt == '+' || *fmt == ' ' || *fmt == '0')
while (strchr (SKIP1, *fmt))
{
if (*fmt == '-')
ljust = 1;
@ -367,11 +494,16 @@ printstr (fmt, string, len, fieldwidth, precision)
{
fmt++;
fw = fieldwidth;
if (fw < 0)
{
fw = -fw;
ljust = 1;
}
}
else if (isdigit (*fmt))
else if (DIGIT (*fmt))
{
fw = *fmt++ - '0';
while (isdigit (*fmt))
while (DIGIT (*fmt))
fw = (fw * 10) + (*fmt++ - '0');
}
@ -384,10 +516,10 @@ printstr (fmt, string, len, fieldwidth, precision)
fmt++;
pr = precision;
}
else if (isdigit (*fmt))
else if (DIGIT (*fmt))
{
pr = *fmt++ - '0';
while (isdigit (*fmt))
while (DIGIT (*fmt))
pr = (pr * 10) + (*fmt++ - '0');
}
}
@ -402,7 +534,7 @@ printstr (fmt, string, len, fieldwidth, precision)
#endif
/* chars from string to print */
nc = (pr > 0 && pr <= len) ? pr : len;
nc = (pr >= 0 && pr <= len) ? pr : len;
padlen = fw - nc;
if (padlen < 0)
@ -428,21 +560,6 @@ printstr (fmt, string, len, fieldwidth, precision)
recognize `\c' and use that as a string terminator. If we see \c, set
*SAWC to 1 before returning. LEN is the length of STRING. */
#ifdef isoctal
#undef isoctal
#endif
#define isoctal(c) ((c) >= '0' && (c) <= '7')
#define OCTVALUE(c) ((c) - '0')
#ifndef isxdigit
# define isxdigit(c) (isdigit((c)) || ((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F'))
#endif
#define HEXVALUE(c) \
((c) >= 'a' && (c) <= 'f' ? (c)-'a'+10 : (c) >= 'A' && (c) <= 'F' ? (c)-'A'+10 : (c)-'0')
/* Translate a single backslash-escape sequence starting at ESTART (the
character after the backslash) and return the number of characters
consumed by the sequence. CP is the place to return the translated
@ -488,32 +605,32 @@ tescape (estart, trans_squote, cp, sawc)
/* %b octal constants are `\0' followed by one, two, or three
octal digits... */
case '0':
for (temp = 3, evalue = 0; isoctal (*p) && temp--; p++)
for (temp = 3, evalue = 0; ISOCTAL (*p) && temp--; p++)
evalue = (evalue * 8) + OCTVALUE (*p);
*cp = evalue;
*cp = evalue & 0xFF;
break;
/* but, as an extension, the other echo-like octal escape
sequences are supported as well. */
case '1': case '2': case '3': case '4':
case '5': case '6': case '7':
for (temp = 2, evalue = c - '0'; isoctal (*p) && temp--; p++)
for (temp = 2, evalue = c - '0'; ISOCTAL (*p) && temp--; p++)
evalue = (evalue * 8) + OCTVALUE (*p);
*cp = evalue;
*cp = evalue & 0xFF;
break;
/* And, as another extension, we allow \xNNN, where each N is a
hex digit. */
case 'x':
for (temp = 3, evalue = 0; isxdigit (*p) && temp--; p++)
for (temp = 2, evalue = 0; ISXDIGIT ((unsigned char)*p) && temp--; p++)
evalue = (evalue * 16) + HEXVALUE (*p);
if (temp == 3)
if (temp == 2)
{
builtin_error ("missing hex digit for \\x");
*cp = '\\';
return 0;
}
*cp = evalue;
*cp = evalue & 0xFF;
break;
case '\\': /* \\ -> \ */
@ -561,7 +678,7 @@ bexpand (string, len, sawc, lenp)
return ((char *)NULL);
}
ret = xmalloc (len + 1);
ret = (char *)xmalloc (len + 1);
for (r = ret, s = string; s && *s; )
{
c = *s++;
@ -589,19 +706,28 @@ bexpand (string, len, sawc, lenp)
}
static char *
mklong (str, ch)
mklong (str, modifiers)
char *str;
int ch;
char *modifiers;
{
static char copy[64];
int len;
size_t len, slen, mlen;
len = strlen (str) + 2;
FASTCOPY (str, copy, len - 3);
copy[len - 3] = 'l';
copy[len - 2] = ch;
copy[len - 1] = '\0';
return (copy);
slen = strlen (str);
mlen = strlen (modifiers);
len = slen + mlen + 1;
if (len > conv_bufsize)
{
conv_bufsize = (((len + 1023) >> 10) << 10);
conv_buf = (char *)xrealloc (conv_buf, conv_bufsize);
}
FASTCOPY (str, conv_buf, slen - 1);
FASTCOPY (modifiers, conv_buf + slen - 1, mlen);
conv_buf[len - 2] = str[slen - 1];
conv_buf[len - 1] = '\0';
return (conv_buf);
}
static int
@ -635,8 +761,7 @@ getint ()
{
long ret;
if (getlong (&ret))
return (0);
ret = getlong ();
if (ret > INT_MAX)
{
@ -652,62 +777,50 @@ getint ()
return ((int)ret);
}
static int
getlong (lp)
long *lp;
static long
getlong ()
{
long ret;
char *ep;
if (garglist == 0)
{
*lp = 0L;
return (0);
}
return (0);
if (garglist->word->word[0] == '\'' || garglist->word->word[0] == '"')
{
*lp = (long)asciicode ();
return (0);
}
return asciicode ();
errno = 0;
/* If we use 0 as the third argument, we can handle octal and hex, which
legal_number does not. (This was
if (legal_number (garglist->word->word, &ret) == 0)
) */
ret = strtol (garglist->word->word, &ep, 0);
if (*ep != '\0')
if (*ep)
{
builtin_error ("%s: invalid number", garglist->word->word);
return (1);
/* POSIX.2 says ``...a diagnostic message shall be written to standard
error, and the utility shall not exit with a zero exit status, but
shall continue processing any remaining operands and shall write the
value accumulated at the time the error was detected to standard
output.'' Yecch. */
ret = 0;
conversion_error = 1;
}
else if (errno == ERANGE)
builtin_error ("warning: %s: %s", garglist->word->word, strerror(ERANGE));
*lp = ret;
garglist = garglist->next;
return (0);
return (ret);
}
static int
getulong (ulp)
unsigned long *ulp;
static unsigned long
getulong ()
{
unsigned long ret;
char *ep;
if (garglist == 0)
{
*ulp = (unsigned long)0;
return (0);
}
return (0);
if (garglist->word->word[0] == '\'' || garglist->word->word[0] == '"')
{
*ulp = (unsigned long)asciicode ();
return (0);
}
return asciicode ();
errno = 0;
ret = strtoul (garglist->word->word, &ep, 0);
@ -715,50 +828,205 @@ getulong (ulp)
if (*ep)
{
builtin_error ("%s: invalid number", garglist->word->word);
return (1);
/* Same thing about POSIX.2 conversion error requirements as getlong(). */
ret = 0;
conversion_error = 1;
}
else if (errno == ERANGE)
builtin_error ("warning: %s: %s", garglist->word->word, strerror(ERANGE));
*ulp = ret;
garglist = garglist->next;
return (0);
return (ret);
}
static int
getdouble (dp)
double *dp;
#if defined (HAVE_LONG_LONG)
static long long
getllong ()
{
long long ret;
char *ep;
if (garglist == 0)
return (0);
if (garglist->word->word[0] == '\'' || garglist->word->word[0] == '"')
return asciicode ();
errno = 0;
ret = strtoll (garglist->word->word, &ep, 0);
if (*ep)
{
builtin_error ("%s: invalid number", garglist->word->word);
/* POSIX.2 says ``...a diagnostic message shall be written to standard
error, and the utility shall not exit with a zero exit status, but
shall continue processing any remaining operands and shall write the
value accumulated at the time the error was detected to standard
output.'' Yecch. */
ret = 0;
conversion_error = 1;
}
else if (errno == ERANGE)
builtin_error ("warning: %s: %s", garglist->word->word, strerror(ERANGE));
garglist = garglist->next;
return (ret);
}
static unsigned long long
getullong ()
{
unsigned long long ret;
char *ep;
if (garglist == 0)
return (0);
if (garglist->word->word[0] == '\'' || garglist->word->word[0] == '"')
return asciicode ();
errno = 0;
ret = strtoull (garglist->word->word, &ep, 0);
if (*ep)
{
builtin_error ("%s: invalid number", garglist->word->word);
/* Same thing about POSIX.2 conversion error requirements as getlong(). */
ret = 0;
conversion_error = 1;
}
else if (errno == ERANGE)
builtin_error ("warning: %s: %s", garglist->word->word, strerror(ERANGE));
garglist = garglist->next;
return (ret);
}
#endif /* HAVE_LONG_LONG */
static intmax_t
getintmax ()
{
intmax_t ret;
char *ep;
if (garglist == 0)
return (0);
if (garglist->word->word[0] == '\'' || garglist->word->word[0] == '"')
return asciicode ();
errno = 0;
ret = strtoimax (garglist->word->word, &ep, 0);
if (*ep)
{
builtin_error ("%s: invalid number", garglist->word->word);
/* POSIX.2 says ``...a diagnostic message shall be written to standard
error, and the utility shall not exit with a zero exit status, but
shall continue processing any remaining operands and shall write the
value accumulated at the time the error was detected to standard
output.'' Yecch. */
ret = 0;
conversion_error = 1;
}
else if (errno == ERANGE)
builtin_error ("warning: %s: %s", garglist->word->word, strerror(ERANGE));
garglist = garglist->next;
return (ret);
}
static uintmax_t
getuintmax ()
{
uintmax_t ret;
char *ep;
if (garglist == 0)
return (0);
if (garglist->word->word[0] == '\'' || garglist->word->word[0] == '"')
return asciicode ();
errno = 0;
ret = strtoumax (garglist->word->word, &ep, 0);
if (*ep)
{
builtin_error ("%s: invalid number", garglist->word->word);
/* Same thing about POSIX.2 conversion error requirements as getlong(). */
ret = 0;
conversion_error = 1;
}
else if (errno == ERANGE)
builtin_error ("warning: %s: %s", garglist->word->word, strerror(ERANGE));
garglist = garglist->next;
return (ret);
}
static double
getdouble ()
{
double ret;
char *ep;
if (garglist == 0)
{
*dp = (double)0;
return (0);
}
return (0);
if (garglist->word->word[0] == '\'' || garglist->word->word[0] == '"')
{
*dp = (double)asciicode ();
return (0);
}
return asciicode ();
errno = 0;
ret = strtod (garglist->word->word, &ep);
if (*ep)
{
builtin_error ("%s: invalid number", garglist->word->word);
return (1);
/* Same thing about POSIX.2 conversion error requirements. */
ret = 0;
conversion_error = 1;
}
else if (errno == ERANGE)
builtin_error ("warning: %s: %s", garglist->word->word, strerror(ERANGE));
*dp = ret;
garglist = garglist->next;
return (0);
return (ret);
}
#if defined (HAVE_LONG_DOUBLE) && HAVE_DECL_STRTOLD
static long double
getldouble ()
{
long double ret;
char *ep;
if (garglist == 0)
return (0);
if (garglist->word->word[0] == '\'' || garglist->word->word[0] == '"')
return (asciicode ());
errno = 0;
ret = strtold (garglist->word->word, &ep);
if (*ep)
{
builtin_error ("%s: invalid number", garglist->word->word);
/* Same thing about POSIX.2 conversion error requirements. */
ret = 0;
conversion_error = 1;
}
else if (errno == ERANGE)
builtin_error ("warning: %s: %s", garglist->word->word, strerror(ERANGE));
garglist = garglist->next;
return (ret);
}
#endif /* HAVE_LONG_DOUBLE && HAVE_DECL_STRTOLD */
/* NO check is needed for garglist here. */
static int
asciicode ()

25
builtins/psize.sh Executable file → Normal file
View File

@ -4,10 +4,18 @@
# pipesize.h so ulimit.c can use it.
: ${TMPDIR:=/tmp}
TMPNAME=pipsize.$$
TMPFILE=$TMPDIR/$TMPNAME
# try to use mktemp(1) if the system supports it
{ TMPFILE="`mktemp $TMPDIR/pipsize.XXXXXX 2>/dev/null`"; } 2>/dev/null
used_mktemp=true
trap 'rm -f $TMPFILE' 0 1 2 3 6 15
if [ -z "$TMPFILE" ]; then
TMPNAME=pipsize.$$
TMPFILE=$TMPDIR/$TMPNAME
used_mktemp=false
fi
trap 'rm -f "$TMPFILE" ; exit 1' 1 2 3 6 15
trap 'rm -f "$TMPFILE"' 0
echo "/*"
echo " * pipesize.h"
@ -21,14 +29,15 @@ echo ""
# Try to avoid tempfile races. We can't really check for the file's
# existance before we run psize.aux, because `test -e' is not portable,
# `test -h' (test for symlinks) is not portable, and `test -f' only
# checks for regular files
# checks for regular files. If we used mktemp(1), we're ahead of the
# game.
#
rm -f $TMPFILE
$used_mktemp || rm -f "$TMPFILE"
./psize.aux 2>$TMPFILE | sleep 3
./psize.aux 2>"$TMPFILE" | sleep 3
if [ -s $TMPFILE ]; then
echo "#define PIPESIZE `cat $TMPFILE`"
if [ -s "$TMPFILE" ]; then
echo "#define PIPESIZE `cat "$TMPFILE"`"
else
echo "#define PIPESIZE 512"
fi

View File

@ -136,12 +136,12 @@ static int directory_list_size;
/* Offset to the end of the list. */
static int directory_list_offset;
static void pushd_error ();
static void clear_directory_stack ();
static int cd_to_string ();
static int change_to_temp ();
static int get_dirstack_index ();
static void add_dirstack_element ();
static void pushd_error __P((int, char *));
static void clear_directory_stack __P((void));
static int cd_to_string __P((char *));
static int change_to_temp __P((char *));
static void add_dirstack_element __P((char *));
static int get_dirstack_index __P((long, int, int *));
#define NOCD 0x01
#define ROTATE 0x02
@ -293,7 +293,7 @@ popd_builtin (list)
char *which_word;
which_word = (char *)NULL;
for (flags = 0, which = 0L, direction = '+'; list; list = list->next)
for (flags = 0, which = 0, direction = '+'; list; list = list->next)
{
if (ISOPTION (list->word->word, 'n'))
{
@ -537,7 +537,8 @@ add_dirstack_element (dir)
static int
get_dirstack_index (ind, sign, indexp)
int ind, sign, *indexp;
long ind;
int sign, *indexp;
{
if (indexp)
*indexp = sign > 0 ? 1 : 2;
@ -552,8 +553,10 @@ get_dirstack_index (ind, sign, indexp)
*indexp = sign > 0 ? 2 : 1;
return 0;
}
else
else if (ind >= 0 && ind <= directory_list_offset)
return (sign > 0 ? directory_list_offset - ind : ind);
else
return -1;
}
/* Used by the tilde expansion code. */
@ -586,7 +589,8 @@ get_dirstack_from_string (string)
#ifdef INCLUDE_UNUSED
char *
get_dirstack_element (ind, sign)
int ind, sign;
long ind;
int sign;
{
int i;
@ -598,7 +602,8 @@ get_dirstack_element (ind, sign)
void
set_dirstack_element (ind, sign, value)
int ind, sign;
long ind;
int sign;
char *value;
{
int i;

View File

@ -83,15 +83,18 @@ extern int errno;
extern int interrupt_immediately;
#if defined (READLINE)
static char *edit_line ();
static void set_eol_delim ();
static void reset_eol_delim ();
static char *edit_line __P((char *));
static void set_eol_delim __P((int));
static void reset_eol_delim __P((char *));
#endif
static SHELL_VAR *bind_read_variable ();
static SHELL_VAR *bind_read_variable __P((char *, char *));
static sighandler sigalrm __P((int));
static void reset_alarm __P((void));
static procenv_t alrmbuf;
static SigHandler *old_alrm;
static int delim;
static unsigned char delim;
static sighandler
sigalrm (s)
@ -120,7 +123,8 @@ read_builtin (list)
register char *varname;
int size, i, pass_next, saw_escape, eof, opt, retval, code;
int input_is_tty, input_is_pipe, unbuffered_read;
int raw, edit, tmout, nchars, silent;
int raw, edit, nchars, silent, have_timeout;
unsigned int tmout;
long timeoutval, ncharsval;
char c;
char *input_string, *orig_input_string, *ifs_chars, *prompt, *arrayname;
@ -135,6 +139,25 @@ read_builtin (list)
int rlind;
#endif
USE_VAR(size);
USE_VAR(i);
USE_VAR(pass_next);
USE_VAR(saw_escape);
USE_VAR(input_is_pipe);
/* USE_VAR(raw); */
USE_VAR(edit);
USE_VAR(tmout);
USE_VAR(nchars);
USE_VAR(silent);
USE_VAR(ifs_chars);
USE_VAR(prompt);
USE_VAR(arrayname);
#if defined (READLINE)
USE_VAR(rlbuf);
USE_VAR(rlind);
#endif
USE_VAR(list);
i = 0; /* Index into the string that we are reading. */
raw = edit = 0; /* Not reading raw input by default. */
silent = 0;
@ -145,8 +168,8 @@ read_builtin (list)
rlind = 0;
#endif
tmout = -1; /* no timeout */
nchars = input_is_tty = input_is_pipe = unbuffered_read = 0;
tmout = 0; /* no timeout */
nchars = input_is_tty = input_is_pipe = unbuffered_read = have_timeout = 0;
delim = '\n'; /* read until newline */
reset_internal_getopt ();
@ -175,17 +198,20 @@ read_builtin (list)
#endif
case 't':
code = legal_number (list_optarg, &timeoutval);
if (code == 0 || timeoutval < 0)
if (code == 0 || timeoutval < 0 || timeoutval != (unsigned int)timeoutval)
{
builtin_error ("%s: invalid timeout specification", list_optarg);
return (EXECUTION_FAILURE);
}
else
tmout = timeoutval;
{
have_timeout = 1;
tmout = timeoutval;
}
break;
case 'n':
code = legal_number (list_optarg, &ncharsval);
if (code == 0 || ncharsval < 0)
if (code == 0 || ncharsval < 0 || ncharsval != (int)ncharsval)
{
builtin_error ("%s: invalid number specification", list_optarg);
return (EXECUTION_FAILURE);
@ -204,7 +230,7 @@ read_builtin (list)
list = loptend;
/* `read -t 0 var' returns failure immediately. */
if (tmout == 0)
if (have_timeout && tmout == 0)
return (EXECUTION_FAILURE);
/* IF IFS is unset, we use the default of " \t\n". */
@ -213,7 +239,7 @@ read_builtin (list)
if (ifs_chars == 0) /* XXX */
ifs_chars = ""; /* XXX */
input_string = xmalloc (size = 128);
input_string = (char *)xmalloc (size = 128);
begin_unwind_frame ("read_builtin");
#if defined (READLINE)
@ -250,7 +276,7 @@ read_builtin (list)
/* Turn off the timeout if stdin is a regular file (e.g. from
input redirection). */
if ((fstat (0, &tsb) < 0) || S_ISREG (tsb.st_mode))
tmout = -1;
tmout = 0;
}
if (tmout > 0)
@ -358,7 +384,7 @@ read_builtin (list)
if (i + 2 >= size)
{
input_string = xrealloc (input_string, size += 128);
input_string = (char *)xrealloc (input_string, size += 128);
remove_unwind_protect ();
add_unwind_protect (xfree, input_string);
}
@ -383,7 +409,7 @@ read_builtin (list)
continue;
}
if (c == delim)
if ((unsigned char)c == delim)
break;
if (c == CTLESC || c == CTLNUL)
@ -410,7 +436,7 @@ read_builtin (list)
if (nchars > 0)
rl_num_chars_to_read = 0;
if (delim != '\n')
reset_eol_delim ();
reset_eol_delim ((char *)NULL);
}
else
#endif
@ -433,12 +459,9 @@ read_builtin (list)
an assign them to `arrayname' in turn. */
if (arrayname)
{
var = find_variable (arrayname);
var = find_or_make_array_variable (arrayname, 1);
if (var == 0)
var = make_new_array_variable (arrayname);
else if (array_p (var) == 0)
var = convert_var_to_array (var);
return EXECUTION_FAILURE; /* readonly or noassign */
empty_array (array_cell (var));
alist = list_string (input_string, ifs_chars, 0);
@ -504,7 +527,7 @@ read_builtin (list)
#endif
{
builtin_error ("`%s': not a valid identifier", varname);
free (orig_input_string);
xfree (orig_input_string);
return (EXECUTION_FAILURE);
}
@ -522,7 +545,7 @@ read_builtin (list)
{
t1 = dequote_string (t);
var = bind_read_variable (varname, t1);
free (t1);
xfree (t1);
}
else
var = bind_read_variable (varname, t);
@ -536,7 +559,7 @@ read_builtin (list)
FREE (t);
if (var == 0)
{
free (orig_input_string);
xfree (orig_input_string);
return (EXECUTION_FAILURE);
}
@ -552,7 +575,7 @@ read_builtin (list)
#endif
{
builtin_error ("`%s': not a valid identifier", list->word->word);
free (orig_input_string);
xfree (orig_input_string);
return (EXECUTION_FAILURE);
}
@ -565,14 +588,14 @@ read_builtin (list)
{
t = dequote_string (input_string);
var = bind_read_variable (list->word->word, t);
free (t);
xfree (t);
}
else
var = bind_read_variable (list->word->word, input_string);
stupidly_hack_special_variables (list->word->word);
if (var)
VUNSETATTR (var, att_invisible);
free (orig_input_string);
xfree (orig_input_string);
return (retval);
}
@ -583,21 +606,12 @@ bind_read_variable (name, value)
{
#if defined (ARRAY_VARS)
if (valid_array_reference (name) == 0)
{
#if 0
if (legal_identifier (name) == 0)
{
builtin_error ("`%s': not a valid identifier", name);
return ((SHELL_VAR *)NULL);
}
#endif
return (bind_variable (name, value));
}
return (bind_variable (name, value));
else
return (do_array_element_assignment (name, value));
#else
return (assign_array_element (name, value));
#else /* !ARRAY_VARS */
return bind_variable (name, value);
#endif
#endif /* !ARRAY_VARS */
}
#if defined (READLINE)
@ -614,18 +628,18 @@ edit_line (p)
if (ret == 0)
return ret;
len = strlen (ret);
ret = xrealloc (ret, len + 2);
ret = (char *)xrealloc (ret, len + 2);
ret[len++] = delim;
ret[len] = '\0';
return ret;
}
static int old_delim_ctype;
static Function *old_delim_func;
static rl_command_func_t *old_delim_func;
static int old_newline_ctype;
static Function *old_newline_func;
static rl_command_func_t *old_newline_func;
static int delim_char;
static unsigned char delim_char;
static void
set_eol_delim (c)
@ -653,8 +667,8 @@ set_eol_delim (c)
}
static void
reset_eol_delim (c)
int c;
reset_eol_delim (cp)
char *cp;
{
Keymap cmap;

View File

@ -159,6 +159,6 @@ histchars Characters controlling history expansion and quick
third is the `history comment' character, usually `#'.
# endif /* BANG_HISTORY */
HISTIGNORE A colon-separated list of patterns used to decide which
command should be saved on the history list.
commands should be saved on the history list.
#endif /* HISTORY */
$END

View File

@ -52,7 +52,7 @@ int
return_builtin (list)
WORD_LIST *list;
{
return_catch_value = list ? get_numeric_arg (list, 1) : last_command_exit_value;
return_catch_value = list ? get_exitstat (list) : last_command_exit_value;
if (return_catch_flag)
longjmp (return_catch, 1);

View File

@ -49,8 +49,10 @@ $PRODUCES set.c
# include "../bashhist.h"
#endif
extern int interactive;
extern int noclobber, posixly_correct, ignoreeof, eof_encountered_limit;
#if defined (HISTORY)
extern int dont_save_function_defs;
#endif
#if defined (READLINE)
extern int no_line_editing;
#endif /* READLINE */
@ -92,6 +94,7 @@ $SHORT_DOC set [--abefhkmnptuvxBCHP] [-o option] [arg ...]
noclobber same as -C
noexec same as -n
noglob same as -f
nolog currently accepted but ignored
notify same as -b
nounset same as -u
onecmd same as -t
@ -132,16 +135,19 @@ parameters and are assigned, in order, to $1, $2, .. $n. If no
ARGs are given, all shell variables are printed.
$END
static int set_ignoreeof ();
static int set_posix_mode ();
static void print_minus_o_option __P((char *, int, int));
static void print_all_shell_variables __P((void));
static int set_ignoreeof __P((int, char *));
static int set_posix_mode __P((int, char *));
#if defined (READLINE)
static int set_edit_mode ();
static int get_edit_mode ();
static int set_edit_mode __P((int, char *));
static int get_edit_mode __P((char *));
#endif
#if defined (HISTORY)
static int bash_set_history ();
static int bash_set_history __P((int, char *));
#endif
static char *on = "on";
@ -179,23 +185,29 @@ struct {
{(char *)NULL, 0 },
};
typedef int setopt_set_func_t __P((int, char *));
typedef int setopt_get_func_t __P((char *));
struct {
char *name;
int *variable;
Function *set_func;
Function *get_func;
setopt_set_func_t *set_func;
setopt_get_func_t *get_func;
} binary_o_options[] = {
#if defined (HISTORY)
{ "history", &remember_on_history, bash_set_history, (Function *)NULL },
{ "history", &remember_on_history, bash_set_history, (setopt_get_func_t *)NULL },
#endif
{ "ignoreeof", &ignoreeof, set_ignoreeof, (Function *)NULL },
{ "interactive-comments", &interactive_comments, (Function *)NULL, (Function *)NULL },
{ "posix", &posixly_correct, set_posix_mode, (Function *)NULL },
{ "ignoreeof", &ignoreeof, set_ignoreeof, (setopt_get_func_t *)NULL },
{ "interactive-comments", &interactive_comments, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
#if defined (HISTORY)
{ "nolog", &dont_save_function_defs, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
#endif
{ "posix", &posixly_correct, set_posix_mode, (setopt_get_func_t *)NULL },
#if defined (READLINE)
{ "emacs", (int *)NULL, set_edit_mode, get_edit_mode },
{ "vi", (int *)NULL, set_edit_mode, get_edit_mode },
#endif
{ (char *)NULL, (int *)NULL }
{ (char *)NULL, (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }
};
#define GET_BINARY_O_OPTION_VALUE(i, name) \
@ -375,7 +387,6 @@ set_minus_o_option (on_or_off, option_name)
char *option_name;
{
int option_char;
VFunction *set_func;
register int i;
for (i = 0; binary_o_options[i].name; i++)
@ -387,7 +398,7 @@ set_minus_o_option (on_or_off, option_name)
}
}
for (i = 0, option_char = -1, set_func = 0; o_options[i].name; i++)
for (i = 0, option_char = -1; o_options[i].name; i++)
{
if (STREQ (option_name, o_options[i].name))
{
@ -450,7 +461,7 @@ set_shellopts ()
if (GET_BINARY_O_OPTION_VALUE (i, binary_o_options[i].name))
vsize += strlen (binary_o_options[i].name) + 1;
value = xmalloc (vsize + 1);
value = (char *)xmalloc (vsize + 1);
for (i = vptr = 0; o_options[i].name; i++)
{
@ -752,6 +763,7 @@ unset_builtin (list)
name = list->word->word;
#if defined (ARRAY_VARS)
unset_array = 0;
if (!unset_function && valid_array_reference (name))
{
t = strchr (name, '[');

View File

@ -40,7 +40,7 @@ $PRODUCES setattr.c
extern int posixly_correct;
extern int array_needs_making;
extern char *this_command_name;
extern Function *this_shell_builtin;
extern sh_builtin_func_t *this_shell_builtin;
#ifdef ARRAY_VARS
extern int declare_builtin ();
@ -248,7 +248,11 @@ set_or_show_attributes (list, attribute, nodefs)
if (arrays_only && array_p (var) == 0)
continue;
#endif
#if 0
if ((var->attributes & attribute) && invisible_p (var) == 0)
#else
if ((var->attributes & attribute))
#endif
show_var_attributes (var, READONLY_OR_EXPORT, nodefs);
}
free (variable_list);
@ -327,6 +331,8 @@ show_var_attributes (var, pattr, nodefs)
printf ("%s\n", var->name);
else if (function_p (var))
printf ("%s\n", named_function_string (var->name, function_cell (var), 1));
else if (invisible_p (var))
printf ("%s\n", var->name);
else
{
x = sh_double_quote (value_cell (var) ? value_cell (var) : "");
@ -342,7 +348,6 @@ show_name_attributes (name, nodefs)
int nodefs;
{
SHELL_VAR *var;
int ret;
var = find_tempenv_variable (name);
if (var == 0)

View File

@ -52,7 +52,7 @@ int
shift_builtin (list)
WORD_LIST *list;
{
int times;
long times;
register int count;
WORD_LIST *temp;

View File

@ -78,7 +78,7 @@ extern int force_append_history;
#if defined (READLINE)
extern int hist_verify, history_reediting, perform_hostname_completion;
extern int no_empty_command_completion;
extern void enable_hostname_completion ();
extern int enable_hostname_completion __P((int));
#endif
#if defined (PROGRAMMABLE_COMPLETION)
@ -90,72 +90,80 @@ extern int restricted_shell;
extern char *shell_name;
#endif
extern void set_shellopts ();
static int set_interactive_comments ();
static int set_interactive_comments __P((int));
#if defined (RESTRICTED_SHELL)
static int set_restricted_shell ();
static int set_restricted_shell __P((int));
#endif
static int shopt_login_shell;
typedef int shopt_set_func_t __P((int));
static struct {
char *name;
int *value;
Function *set_func;
shopt_set_func_t *set_func;
} shopt_vars[] = {
{ "cdable_vars", &cdable_vars, (Function *)NULL },
{ "cdspell", &cdspelling, (Function *)NULL },
{ "checkhash", &check_hashed_filenames, (Function *)NULL },
{ "checkwinsize", &check_window_size, (Function *)NULL },
{ "cdable_vars", &cdable_vars, (shopt_set_func_t *)NULL },
{ "cdspell", &cdspelling, (shopt_set_func_t *)NULL },
{ "checkhash", &check_hashed_filenames, (shopt_set_func_t *)NULL },
{ "checkwinsize", &check_window_size, (shopt_set_func_t *)NULL },
#if defined (HISTORY)
{ "cmdhist", &command_oriented_history, (Function *)NULL },
{ "cmdhist", &command_oriented_history, (shopt_set_func_t *)NULL },
#endif
{ "dotglob", &glob_dot_filenames, (Function *)NULL },
{ "execfail", &no_exit_on_failed_exec, (Function *)NULL },
{ "expand_aliases", &expand_aliases, (Function *)NULL },
{ "dotglob", &glob_dot_filenames, (shopt_set_func_t *)NULL },
{ "execfail", &no_exit_on_failed_exec, (shopt_set_func_t *)NULL },
{ "expand_aliases", &expand_aliases, (shopt_set_func_t *)NULL },
#if defined (EXTENDED_GLOB)
{ "extglob", &extended_glob, (Function *)NULL },
{ "extglob", &extended_glob, (shopt_set_func_t *)NULL },
#endif
#if defined (READLINE)
{ "histreedit", &history_reediting, (Function *)NULL },
{ "histreedit", &history_reediting, (shopt_set_func_t *)NULL },
#endif
#if defined (HISTORY)
{ "histappend", &force_append_history, (Function *)NULL },
{ "histappend", &force_append_history, (shopt_set_func_t *)NULL },
#endif
#if defined (READLINE)
{ "histverify", &hist_verify, (Function *)NULL },
{ "hostcomplete", &perform_hostname_completion, (Function *)enable_hostname_completion },
{ "histverify", &hist_verify, (shopt_set_func_t *)NULL },
{ "hostcomplete", &perform_hostname_completion, enable_hostname_completion },
#endif
{ "huponexit", &hup_on_exit, (Function *)NULL },
{ "huponexit", &hup_on_exit, (shopt_set_func_t *)NULL },
{ "interactive_comments", &interactive_comments, set_interactive_comments },
#if defined (HISTORY)
{ "lithist", &literal_history, (Function *)NULL },
{ "lithist", &literal_history, (shopt_set_func_t *)NULL },
#endif
{ "mailwarn", &mail_warning, (Function *)NULL },
{ "login_shell", &shopt_login_shell, set_login_shell },
{ "mailwarn", &mail_warning, (shopt_set_func_t *)NULL },
#if defined (READLINE)
{ "no_empty_cmd_completion", &no_empty_command_completion, (Function *)NULL },
{ "no_empty_cmd_completion", &no_empty_command_completion, (shopt_set_func_t *)NULL },
#endif
{ "nocaseglob", &glob_ignore_case, (Function *)NULL },
{ "nullglob", &allow_null_glob_expansion, (Function *)NULL },
{ "nocaseglob", &glob_ignore_case, (shopt_set_func_t *)NULL },
{ "nullglob", &allow_null_glob_expansion, (shopt_set_func_t *)NULL },
#if defined (PROGRAMMABLE_COMPLETION)
{ "progcomp", &prog_completion_enabled, (Function *)NULL },
{ "progcomp", &prog_completion_enabled, (shopt_set_func_t *)NULL },
#endif
{ "promptvars", &promptvars, (Function *)NULL },
{ "promptvars", &promptvars, (shopt_set_func_t *)NULL },
#if defined (RESTRICTED_SHELL)
{ "restricted_shell", &restricted_shell, set_restricted_shell },
#endif
{ "shift_verbose", &print_shift_error, (Function *)NULL },
{ "sourcepath", &source_uses_path, (Function *)NULL },
{ "xpg_echo", &xpg_echo, (Function *)NULL },
{ (char *)0, (int *)0, (Function *)NULL }
{ "shift_verbose", &print_shift_error, (shopt_set_func_t *)NULL },
{ "sourcepath", &source_uses_path, (shopt_set_func_t *)NULL },
{ "xpg_echo", &xpg_echo, (shopt_set_func_t *)NULL },
{ (char *)0, (int *)0, (shopt_set_func_t *)NULL }
};
static char *on = "on";
static char *off = "off";
static int list_shopt_o_options ();
static int list_some_o_options (), list_some_shopts ();
static int toggle_shopts (), list_shopts (), set_shopt_o_options ();
static int find_shopt __P((char *));
static int toggle_shopts __P((int, WORD_LIST *, int));
static void print_shopt __P((char *, int, int));
static int list_shopts __P((WORD_LIST *, int));
static int list_some_shopts __P((int, int));
static int list_shopt_o_options __P((WORD_LIST *, int));
static int list_some_o_options __P((int, int));
static int set_shopt_o_options __P((int, WORD_LIST *, int));
#define SFLAG 0x01
#define UFLAG 0x02
@ -244,6 +252,8 @@ reset_shopt_options ()
hist_verify = history_reediting = 0;
perform_hostname_completion = 1;
#endif
shopt_login_shell = login_shell;
}
static int
@ -444,6 +454,15 @@ set_restricted_shell (mode)
}
#endif /* RESTRICTED_SHELL */
/* Not static so shell.c can call it to initialize shopt_login_shell */
int
set_login_shell (mode)
int mode;
{
shopt_login_shell = login_shell != 0;
return (0);
}
char **
get_shopt_options ()
{
@ -457,3 +476,43 @@ get_shopt_options ()
ret[i] = (char *)NULL;
return ret;
}
/*
* External interface for other parts of the shell. NAME is a string option;
* MODE is 0 if we want to unset an option; 1 if we want to set an option.
* REUSABLE is 1 if we want to print output in a form that may be reused.
*/
int
shopt_setopt (name, mode)
char *name;
int mode;
{
WORD_LIST *wl;
int r;
wl = add_string_to_list (name, (WORD_LIST *)NULL);
r = toggle_shopts (mode, wl, 0);
dispose_words (wl);
return r;
}
int
shopt_listopt (name, reusable)
char *name;
int reusable;
{
int i;
if (name == 0)
return (list_shopts ((WORD_LIST *)NULL, reusable ? PFLAG : 0));
i = find_shopt (name);
if (i < 0)
{
SHOPT_ERROR (name);
return (EXECUTION_FAILURE);
}
print_shopt (name, *shopt_vars[i].value, reusable ? PFLAG : 0);
return (EXECUTION_SUCCESS);
}

View File

@ -47,8 +47,6 @@ $END
#include "common.h"
#include "bashgetopt.h"
extern int job_control;
static SigHandler *old_cont;
#if 0
static SigHandler *old_stop;

View File

@ -31,6 +31,7 @@ are string operators as well, and numeric comparison operators.
File operators:
-a FILE True if file exists.
-b FILE True if file is block special.
-c FILE True if file is character special.
-d FILE True if file is a directory.

View File

@ -58,7 +58,8 @@ $END
#include "common.h"
#include "bashgetopt.h"
static int display_traps ();
static void showtrap __P((int));
static int display_traps __P((WORD_LIST *));
/* The trap command:
@ -79,7 +80,7 @@ static int display_traps ();
#define REVERT 1 /* Revert to this signals original value. */
#define IGNORE 2 /* Ignore this signal. */
extern int interactive, posixly_correct;
extern int posixly_correct;
int
trap_builtin (list)
@ -228,7 +229,7 @@ display_traps (list)
if (list == 0)
{
for (i = 0; i <= NSIG; i++)
for (i = 0; i < BASH_NSIG; i++)
showtrap (i);
return (EXECUTION_SUCCESS);
}

View File

@ -64,7 +64,7 @@ $END
#include "common.h"
#include "bashgetopt.h"
extern int find_reserved_word ();
extern int find_reserved_word __P((char *));
extern char *this_command_name;
@ -213,7 +213,7 @@ describe_command (command, verbose, all)
int verbose, all;
{
int found, i, found_file, f;
char *full_path, *x, *cwd;
char *full_path, *x;
SHELL_VAR *func;
#if defined (ALIAS)
alias_t *alias;

View File

@ -44,7 +44,9 @@ option is given, it is interpreted as follows:
-u the maximum number of user processes
-v the size of virtual memory
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 current soft limit, the current hard limit, and no limit, respectively.
Otherwise, the current value of the specified resource is printed.
If no option is given, then -f is assumed. Values are in 1024-byte
increments, except for -t, which is in seconds, -p, which is in
@ -109,8 +111,6 @@ extern int errno;
# define print_rlimtype(num, nl) printf ("%ld%s", num, nl ? "\n" : "")
#endif
#define DESCFMT "%-28s"
/* Some systems use RLIMIT_NOFILE, others use RLIMIT_OFILE */
#if defined (HAVE_RESOURCE) && defined (RLIMIT_OFILE) && !defined (RLIMIT_NOFILE)
# define RLIMIT_NOFILE RLIMIT_OFILE
@ -154,58 +154,72 @@ extern int errno;
# define RLIM_INFINITY 0x7fffffff
#endif
#if !defined (RLIM_SAVED_CUR)
# define RLIM_SAVED_CUR RLIM_INFINITY
#endif
#if !defined (RLIM_SAVED_MAX)
# define RLIM_SAVED_MAX RLIM_INFINITY
#endif
#define LIMIT_HARD 0x01
#define LIMIT_SOFT 0x02
static int _findlim __P((int));
static int ulimit_internal __P((int, char *, int, int));
static int get_limit __P((int, RLIMTYPE *, RLIMTYPE *));
static int set_limit __P((int, RLIMTYPE, int));
static void printone __P((int, RLIMTYPE, int));
static void print_all_limits __P((int));
static int get_limit __P((int, int, RLIMTYPE *));
static int set_limit __P((int, RLIMTYPE, int));
static int set_all_limits __P((int, RLIMTYPE));
static int filesize __P((RLIMTYPE *));
static int pipesize __P((RLIMTYPE *));
static int getmaxuprc __P((int, RLIMTYPE *));
static int getmaxvm __P((int, RLIMTYPE *));
static int getmaxuprc __P((RLIMTYPE *));
static int getmaxvm __P((RLIMTYPE *, RLIMTYPE *));
typedef struct {
int option; /* The ulimit option for this limit. */
int parameter; /* Parameter to pass to get_limit (). */
int block_factor; /* Blocking factor for specific limit. */
char *description; /* Descriptive string to output. */
char *units; /* scale */
} RESOURCE_LIMITS;
static RESOURCE_LIMITS limits[] = {
#ifdef RLIMIT_CORE
{ 'c', RLIMIT_CORE, 1024, "core file size (blocks)" },
{ 'c', RLIMIT_CORE, 1024, "core file size", "blocks" },
#endif
#ifdef RLIMIT_DATA
{ 'd', RLIMIT_DATA, 1024, "data seg size (kbytes)" },
{ 'd', RLIMIT_DATA, 1024, "data seg size", "kbytes" },
#endif
{ 'f', RLIMIT_FILESIZE, 1024, "file size (blocks)" },
{ 'f', RLIMIT_FILESIZE, 1024, "file size", "blocks" },
#ifdef RLIMIT_MEMLOCK
{ 'l', RLIMIT_MEMLOCK, 1024, "max locked memory (kbytes)" },
{ 'l', RLIMIT_MEMLOCK, 1024, "max locked memory", "kbytes" },
#endif
#ifdef RLIMIT_RSS
{ 'm', RLIMIT_RSS, 1024, "max memory size (kbytes)" },
{ 'm', RLIMIT_RSS, 1024, "max memory size", "kbytes" },
#endif /* RLIMIT_RSS */
{ 'n', RLIMIT_OPENFILES, 1, "open files" },
{ 'p', RLIMIT_PIPESIZE, 512, "pipe size (512 bytes)" },
{ 'n', RLIMIT_OPENFILES, 1, "open files", (char *)NULL},
{ 'p', RLIMIT_PIPESIZE, 512, "pipe size", "512 bytes" },
#ifdef RLIMIT_STACK
{ 's', RLIMIT_STACK, 1024, "stack size (kbytes)" },
{ 's', RLIMIT_STACK, 1024, "stack size", "kbytes" },
#endif
#ifdef RLIMIT_CPU
{ 't', RLIMIT_CPU, 1, "cpu time (seconds)" },
{ 't', RLIMIT_CPU, 1, "cpu time", "seconds" },
#endif /* RLIMIT_CPU */
{ 'u', RLIMIT_MAXUPROC, 1, "max user processes" },
{ 'u', RLIMIT_MAXUPROC, 1, "max user processes", (char *)NULL },
#if defined (HAVE_RESOURCE)
{ 'v', RLIMIT_VIRTMEM, RLIMIT_VMBLKSZ, "virtual memory (kbytes)" },
{ 'v', RLIMIT_VIRTMEM, RLIMIT_VMBLKSZ, "virtual memory", "kbytes" },
#endif
#ifdef RLIMIT_SWAP
{ 'w', RLIMIT_SWAP, 1024, "swap size (kbytes)" },
{ 'w', RLIMIT_SWAP, 1024, "swap size", "kbytes" },
#endif
{ -1, -1, -1, (char *)NULL }
{ -1, -1, -1, (char *)NULL, (char *)NULL }
};
#define NCMDS (sizeof(limits) / sizeof(limits[0]))
@ -308,6 +322,17 @@ ulimit_builtin (list)
if (all_limits)
{
#ifdef NOTYET
if (list) /* setting */
{
if (STREQ (list->word->word, "unlimited") == 0)
{
builtin_error ("invalid limit argument: %s", list->word->word);
return (EXECUTION_FAILURE);
}
return (set_all_limits (mode == 0 ? LIMIT_SOFT|LIMIT_HARD : mode, RLIM_INFINITY));
}
#endif
print_all_limits (mode == 0 ? LIMIT_SOFT : mode);
return (EXECUTION_SUCCESS);
}
@ -347,58 +372,66 @@ ulimit_internal (cmd, cmdarg, mode, multiple)
int mode, multiple;
{
int opt, limind, setting;
long block_factor;
RLIMTYPE current_limit, real_limit, limit;
int block_factor;
RLIMTYPE soft_limit, hard_limit, real_limit, limit;
setting = cmdarg != 0;
limind = _findlim (cmd);
if (mode == 0)
mode = setting ? (LIMIT_HARD|LIMIT_SOFT) : LIMIT_SOFT;
opt = get_limit (limind, mode, &current_limit);
opt = get_limit (limind, &soft_limit, &hard_limit);
if (opt < 0)
{
builtin_error ("cannot get limit: %s", strerror (errno));
builtin_error ("cannot get %s limit: %s", limits[limind].description,
strerror (errno));
return (EXECUTION_FAILURE);
}
if (setting == 0) /* print the value of the specified limit */
{
printone (limind, current_limit, multiple);
printone (limind, (mode & LIMIT_SOFT) ? soft_limit : hard_limit, multiple);
return (EXECUTION_SUCCESS);
}
/* Setting the limit. */
if (STREQ (cmdarg, "unlimited"))
limit = RLIM_INFINITY;
if (STREQ (cmdarg, "hard"))
real_limit = hard_limit;
else if (STREQ (cmdarg, "soft"))
real_limit = soft_limit;
else if (STREQ (cmdarg, "unlimited"))
real_limit = RLIM_INFINITY;
else if (all_digits (cmdarg))
limit = string_to_rlimtype (cmdarg);
{
limit = string_to_rlimtype (cmdarg);
block_factor = limits[limind].block_factor;
real_limit = limit * block_factor;
if ((real_limit / block_factor) != limit)
{
builtin_error ("limit out of range: %s", cmdarg);
return (EXECUTION_FAILURE);
}
}
else
{
builtin_error ("bad non-numeric arg `%s'", cmdarg);
return (EXECUTION_FAILURE);
}
block_factor = (limit == RLIM_INFINITY) ? 1 : limits[limind].block_factor;
real_limit = limit * block_factor;
if (real_limit < 0 || (real_limit == 0 && limit != 0))
{
builtin_error ("limit out of range: %d", limit);
return (EXECUTION_FAILURE);
}
if (set_limit (limind, real_limit, mode) < 0)
{
builtin_error ("cannot modify limit: %s", strerror (errno));
builtin_error ("cannot modify %s limit: %s", limits[limind].description,
strerror (errno));
return (EXECUTION_FAILURE);
}
return (EXECUTION_SUCCESS);
}
static int
get_limit (ind, mode, limptr)
int ind, mode;
RLIMTYPE *limptr;
get_limit (ind, softlim, hardlim)
int ind;
RLIMTYPE *softlim, *hardlim;
{
RLIMTYPE value;
#if defined (HAVE_RESOURCE)
@ -421,18 +454,16 @@ get_limit (ind, mode, limptr)
value = (RLIMTYPE)getdtablesize ();
break;
case RLIMIT_VIRTMEM:
if (getmaxvm (mode, &value) < 0)
return -1;
break;
return (getmaxvm (softlim, hardlim));
case RLIMIT_MAXUPROC:
if (getmaxuprc (mode, &value) < 0)
if (getmaxuprc (&value) < 0)
return -1;
break;
default:
errno = EINVAL;
return -1;
}
*limptr = value;
*softlim = *hardlim = value;
return (0);
}
else
@ -440,13 +471,16 @@ get_limit (ind, mode, limptr)
#if defined (HAVE_RESOURCE)
if (getrlimit (limits[ind].parameter, &limit) < 0)
return -1;
value = (mode & LIMIT_SOFT) ? limit.rlim_cur : limit.rlim_max;
*softlim = limit.rlim_cur;
*hardlim = limit.rlim_max;
# if defined (HPUX9)
if (limits[ind].parameter == RLIMIT_FILESIZE)
*limptr = value * 512; /* Ugh. */
{
*softlim *= 512;
*hardlim *= 512; /* Ugh. */
}
else
# endif /* HPUX9 */
*limptr = value;
return 0;
#else
errno = EINVAL;
@ -521,26 +555,21 @@ set_limit (ind, newlim, mode)
}
static int
getmaxvm (mode, valuep)
int mode;
RLIMTYPE *valuep;
getmaxvm (softlim, hardlim)
RLIMTYPE *softlim, *hardlim;
{
#if defined (HAVE_RESOURCE)
struct rlimit rl;
RLIMTYPE maxdata, maxstack;
struct rlimit datalim, stacklim;
if (getrlimit (RLIMIT_DATA, &rl) < 0)
if (getrlimit (RLIMIT_DATA, &datalim) < 0)
return -1;
else
maxdata = (mode & LIMIT_SOFT) ? rl.rlim_cur : rl.rlim_max;
if (getrlimit (RLIMIT_STACK, &rl) < 0)
if (getrlimit (RLIMIT_STACK, &stacklim) < 0)
return -1;
else
maxstack = (mode & LIMIT_SOFT) ? rl.rlim_cur : rl.rlim_max;
/* Protect against overflow. */
*valuep = (maxdata / 1024L) + (maxstack / 1024L);
*softlim = (datalim.rlim_cur / 1024L) + (stacklim.rlim_cur / 1024L);
*hardlim = (datalim.rlim_max / 1024L) + (stacklim.rlim_max / 1024L);
return 0;
#else
errno = EINVAL;
@ -557,11 +586,7 @@ filesize(valuep)
if ((result = ulimit (1, 0L)) < 0)
return -1;
else
# if 0
*valuep = (RLIMTYPE) result;
# else
*valuep = (RLIMTYPE) result * 512L;
# endif
*valuep = (RLIMTYPE) result * 512;
return 0;
#else
errno = EINVAL;
@ -590,8 +615,7 @@ pipesize (valuep)
}
static int
getmaxuprc (mode, valuep)
int mode;
getmaxuprc (valuep)
RLIMTYPE *valuep;
{
# if defined (HAVE_SYSCONF) && defined (_SC_CHILD_MAX)
@ -618,20 +642,17 @@ print_all_limits (mode)
int mode;
{
register int i;
RLIMTYPE value;
RLIMTYPE softlim, hardlim;
if (mode == 0)
mode |= LIMIT_SOFT;
for (i = 0; limits[i].option > 0; i++)
{
if (get_limit (i, mode, &value) < 0)
{
fprintf (stderr, DESCFMT, limits[i].description);
builtin_error ("cannot get limit: %s", strerror (errno));
}
if (get_limit (i, &softlim, &hardlim) < 0)
builtin_error ("cannot get %s limit: %s", limits[i].description, strerror (errno));
else
printone (i, value, 1);
printone (i, (mode & LIMIT_SOFT) ? softlim : hardlim, 1);
}
}
@ -641,11 +662,65 @@ printone (limind, curlim, pdesc)
RLIMTYPE curlim;
int pdesc;
{
char unitstr[64];
if (pdesc)
printf (DESCFMT, limits[limind].description);
{
if (limits[limind].units)
sprintf (unitstr, "(%s, -%c) ", limits[limind].units, limits[limind].option);
else
sprintf (unitstr, "(-%c) ", limits[limind].option);
printf ("%-18s %16s", limits[limind].description, unitstr);
}
if (curlim == RLIM_INFINITY)
puts ("unlimited");
else if (curlim == RLIM_SAVED_MAX)
puts ("hard");
else if (curlim == RLIM_SAVED_CUR)
puts ("soft");
else
print_rlimtype ((curlim / limits[limind].block_factor), 1);
}
/* Set all limits to NEWLIM. NEWLIM currently must be RLIM_INFINITY, which
causes all limits to be set as high as possible depending on mode (like
csh `unlimit'). Returns -1 if NEWLIM is invalid, 0 if all limits
were set successfully, and 1 if at least one limit could not be set.
To raise all soft limits to their corresponding hard limits, use
ulimit -S -a unlimited
To attempt to raise all hard limits to infinity (superuser-only), use
ulimit -H -a unlimited
To attempt to raise all soft and hard limits to infinity, use
ulimit -a unlimited
*/
static int
set_all_limits (mode, newlim)
int mode;
RLIMTYPE newlim;
{
register int i;
int retval = 0;
if (newlim != RLIM_INFINITY)
{
errno = EINVAL;
return -1;
}
if (mode == 0)
mode = LIMIT_SOFT|LIMIT_HARD;
for (retval = i = 0; limits[i].option > 0; i++)
if (set_limit (i, newlim, mode) < 0)
{
builtin_error ("cannot modify %s limit: %s", limits[i].description,
strerror (errno));
retval = 1;
}
return retval;
}
#endif /* !_MINIX */

View File

@ -46,20 +46,25 @@ $END
#endif
#include <stdio.h>
#include <chartypes.h>
#include "../shell.h"
#include "posixstat.h"
#include "common.h"
#include "bashgetopt.h"
#ifdef __LCC__
#define mode_t int
#endif
/* **************************************************************** */
/* */
/* UMASK Builtin and Helpers */
/* */
/* **************************************************************** */
static void print_symbolic_umask ();
static int symbolic_umask ();
static void print_symbolic_umask __P((mode_t));
static int symbolic_umask __P((WORD_LIST *));
/* Set or display the mask used by the system when creating files. Flag
of -S means display the umask in a symbolic mode. */
@ -92,7 +97,7 @@ umask_builtin (list)
if (list)
{
if (digit (*list->word->word))
if (DIGIT (*list->word->word))
{
umask_value = read_octal (list->word->word);
@ -128,7 +133,7 @@ umask_builtin (list)
if (print_symbolically)
print_symbolic_umask (umask_arg);
else
printf ("%03o\n", umask_arg);
printf ("%04lo\n", (unsigned long)umask_arg);
}
fflush (stdout);
@ -179,12 +184,12 @@ parse_symbolic_mode (mode, initial_bits)
char *mode;
int initial_bits;
{
int who, op, perm, mask, bits, c;
int who, op, perm, bits, c;
char *s;
for (s = mode, bits = initial_bits;;)
{
who = op = perm = mask = 0;
who = op = perm = 0;
/* Parse the `who' portion of the symbolic mode clause. */
while (member (*s, "agou"))

View File

@ -50,6 +50,8 @@ $END
# include <unistd.h>
#endif
#include <chartypes.h>
#include "../bashansi.h"
#include "../shell.h"
@ -81,6 +83,8 @@ wait_builtin (list)
int status, code;
volatile int old_interrupt_immediately;
USE_VAR(list);
if (no_options (list))
return (EX_USAGE);
if (list != loptend)
@ -120,13 +124,14 @@ wait_builtin (list)
{
pid_t pid;
char *w;
long pid_value;
w = list->word->word;
if (digit (*w))
if (DIGIT (*w))
{
if (all_digits (w + 1))
if (legal_number (w, &pid_value) && pid_value == (pid_t)pid_value)
{
pid = (pid_t)atoi (w);
pid = (pid_t)pid_value;
status = wait_for_single_pid (pid);
}
else

View File

@ -95,14 +95,18 @@ typedef struct word_list {
/* */
/* **************************************************************** */
/* What a redirection descriptor looks like. If FLAGS is IS_DESCRIPTOR,
then we use REDIRECTEE.DEST, else we use the file specified. */
/* What a redirection descriptor looks like. If the redirection instruction
is ri_duplicating_input or ri_duplicating_output, use DEST, otherwise
use the file in FILENAME. Out-of-range descriptors are identified by a
negative DEST. */
typedef union {
long dest; /* Place to redirect REDIRECTOR to, or ... */
int dest; /* Place to redirect REDIRECTOR to, or ... */
WORD_DESC *filename; /* filename to redirect to. */
} REDIRECTEE;
/* Structure describing a redirection. If REDIRECTOR is negative, the parser
(or translator in redir.c) encountered an out-of-range file descriptor. */
typedef struct redirect {
struct redirect *next; /* Next element, or NULL. */
int redirector; /* Descriptor to be redirected. */
@ -131,6 +135,7 @@ typedef struct element {
#define CMD_TIME_POSIX 0x100 /* time -p; use POSIX.2 time output spec. */
#define CMD_AMPERSAND 0x200 /* command & */
#define CMD_STDIN_REDIR 0x400 /* async command needs implicit </dev/null */
#define CMD_COMMAND_BUILTIN 0x0800 /* command executed by `command' builtin */
/* What a command looks like. */
typedef struct command {

View File

@ -57,3 +57,7 @@
/* Define this to make non-interactive shells begun with argv[0][0] == '-'
run the startup files when not in posix mode. */
/* #define NON_INTERACTIVE_LOGIN_SHELLS */
/* Define this if you want bash to try to check whether it's being run by
sshd and source the .bashrc if so (like the rshd behavior). */
/* #define SSH_SOURCE_BASHRC */

View File

@ -1,6 +1,6 @@
/* config.h -- Configuration file for bash. */
/* Copyright (C) 1987,1991 Free Software Foundation, Inc.
/* Copyright (C) 1987-2001 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@ -21,7 +21,7 @@
#ifndef _CONFIG_H_
#define _CONFIG_H_
/* Configuration settings controllable by autoconf. */
/* Configuration feature settings controllable by autoconf. */
/* Define JOB_CONTROL if your operating system supports
BSD-like job control. */
@ -142,8 +142,61 @@
/* Beginning of autoconf additions. */
/* Characteristics of the C compiler */
#undef const
#undef inline
/* Define if cpp supports the ANSI-C stringizing `#' operator */
#undef HAVE_STRINGIZE
/* Define if the compiler supports `long double' variables. */
#undef HAVE_LONG_DOUBLE
#undef PROTOTYPES
#undef __CHAR_UNSIGNED__
/* Define if the compiler supports `long long' variables. */
#undef HAVE_LONG_LONG
#undef HAVE_UNSIGNED_LONG_LONG
/* The number of bytes in a int. */
#undef SIZEOF_INT
/* The number of bytes in a long. */
#undef SIZEOF_LONG
/* The number of bytes in a pointer to char. */
#undef SIZEOF_CHAR_P
/* The number of bytes in a double (hopefully 8). */
#undef SIZEOF_DOUBLE
/* The number of bytes in a `long long', if we have one. */
#undef SIZEOF_LONG_LONG
/* System paths */
#define DEFAULT_MAIL_DIRECTORY "/usr/spool/mail"
/* Characteristics of the system's header files and libraries that affect
the compilation environment. */
/* Define if the system does not provide POSIX.1 features except
with this defined. */
#undef _POSIX_1_SOURCE
/* Define if you need to in order for stat and other things to work. */
#undef _POSIX_SOURCE
/* Define to use GNU libc extensions */
#undef _GNU_SOURCE
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Memory management functions. */
/* Define if using the bash version of malloc in lib/malloc/malloc.c */
@ -165,18 +218,6 @@
/* SYSTEM TYPES */
/* The number of bytes in a int. */
#undef SIZEOF_INT
/* The number of bytes in a long. */
#undef SIZEOF_LONG
/* The number of bytes in a pointer to char. */
#undef SIZEOF_CHAR_P
/* The number of bytes in a double (hopefully 8). */
#undef SIZEOF_DOUBLE
/* Define to `long' if <sys/types.h> doesn't define. */
#undef off_t
@ -204,18 +245,27 @@
/* Define to `double' if <sys/types.h> doesn't define. */
#undef bits64_t
/* Define to `int' if <sys/types.h> doesn't define. */
#undef ptrdiff_t
/* Define to `unsigned int' if <sys/types.h> doesn't define. */
#undef u_int
/* Define to `unsigned long' if <sys/types.h> doesn't define. */
#undef u_long
/* Define to `int' if <sys/types.h> doesn't define. */
#undef ptrdiff_t
/* Define to `unsigned' if <sys/types.h> doesn't define. */
#undef size_t
/* Define to `int' if <sys/types.h> doesn't define. */
#undef ssize_t
/* Define to `long' if <stdint.h> doesn't define. */
#undef intmax_t
/* Define to `unsigned long' if <stdint.h> doesn't define. */
#undef uintmax_t
/* Define to `int' if <sys/types.h> doesn't define. */
#undef uid_t
@ -228,6 +278,9 @@
/* Define to `int' if <sys/types.h> doesn't define. */
#undef gid_t
/* Define to `unsigned int' if <sys/socket.h> doesn't define. */
#undef socklen_t
/* Define if you have quad_t in <sys/types.h>. */
#undef HAVE_QUAD_T
@ -237,13 +290,6 @@
Usually this is either `int' or `gid_t'. */
#undef GETGROUPS_T
/* Define if the system does not provide POSIX.1 features except
with this defined. */
#undef _POSIX_1_SOURCE
/* Define if you need to in order for stat and other things to work. */
#undef _POSIX_SOURCE
/* Characteristics of the machine archictecture. */
/* If using the C implementation of alloca, define if you know the
@ -258,9 +304,6 @@
/* Define if the machine architecture is big-endian. */
#undef WORDS_BIGENDIAN
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Check for the presence of certain non-function symbols in the system
libraries. */
@ -301,6 +344,7 @@
#undef TERMIO_LDISC
#undef HAVE_STRUCT_STAT_ST_BLOCKS
/* Characteristics of definitions in the system header files. */
@ -308,9 +352,26 @@
#undef HAVE_RESOURCE
#undef SBRK_DECLARED
#undef HAVE_LIBC_FNM_EXTMATCH
#undef PRINTF_DECLARED
#undef HAVE_DECL_CONFSTR
#undef HAVE_DECL_STRTOLD
#undef HAVE_DECL_SBRK
#undef HAVE_DECL_PRINTF
#undef HAVE_DECL_STRSIGNAL
/* These are checked with BASH_CHECK_DECL */
#undef HAVE_DECL_STRTOIMAX
#undef HAVE_DECL_STRTOL
#undef HAVE_DECL_STRTOLL
#undef HAVE_DECL_STRTOUL
#undef HAVE_DECL_STRTOULL
#undef HAVE_DECL_STRTOUMAX
/* Characteristics of system calls and C library functions. */
@ -334,6 +395,7 @@
#undef CAN_REDEFINE_GETENV
#undef HAVE_PRINTF_A_FORMAT
/* Characteristics of properties exported by the kernel. */
@ -360,10 +422,6 @@
#undef MUST_REINSTALL_SIGHANDLERS
/* Define if system calls automatically restart after interruption
by a signal. */
#undef HAVE_RESTARTABLE_SYSCALLS
#undef HAVE_BSD_SIGNALS
#undef HAVE_POSIX_SIGNALS
@ -375,6 +433,9 @@
/* Presence of system and C library functions. */
/* Define if you have the asprintf function. */
#undef HAVE_ASPRINTF
/* Define if you have the bcopy function. */
#undef HAVE_BCOPY
@ -402,6 +463,9 @@
/* Define if you have the dup2 function. */
#undef HAVE_DUP2
/* Define if you have the getaddrinfo function. */
#undef HAVE_GETADDRINFO
/* Define if you have the getcwd function. */
#undef HAVE_GETCWD
@ -444,6 +508,24 @@
/* Define if you have the inet_aton function. */
#undef HAVE_INET_ATON
/* Define if you have the isascii function. */
#undef HAVE_ISASCII
/* Define if you have the isblank function. */
#undef HAVE_ISBLANK
/* Define if you have the isgraph function. */
#undef HAVE_ISGRAPH
/* Define if you have the isprint function. */
#undef HAVE_ISPRINT
/* Define if you have the isspace function. */
#undef HAVE_ISSPACE
/* Define if you have the isxdigit function. */
#undef HAVE_ISXDIGIT
/* Define if you have the killpg function. */
#undef HAVE_KILLPG
@ -498,6 +580,9 @@
/* Define if you have the POSIX.1-style sigsetjmp function. */
#undef HAVE_POSIX_SIGSETJMP
/* Define if you have the snprintf function. */
#undef HAVE_SNPRINTF
/* Define if you have the strcasecmp function. */
#undef HAVE_STRCASECMP
@ -516,12 +601,24 @@
/* Define if you have the strtod function. */
#undef HAVE_STRTOD
/* Define if you have the strtoimax function. */
#undef HAVE_STRTOIMAX
/* Define if you have the strtol function. */
#undef HAVE_STRTOL
/* Define if you have the strtoll function. */
#undef HAVE_STRTOLL
/* Define if you have the strtoul function. */
#undef HAVE_STRTOUL
/* Define if you have the strtoull function. */
#undef HAVE_STRTOULL
/* Define if you have the strtoumax function. */
#undef HAVE_STRTOUMAX
/* Define if you have the strsignal function or macro. */
#undef HAVE_STRSIGNAL
@ -552,16 +649,21 @@
/* Define if you have the uname function. */
#undef HAVE_UNAME
/* Define if you have the vasprintf function. */
#undef HAVE_VASPRINTF
/* Define if you have the vprintf function. */
#undef HAVE_VPRINTF
/* Define if you have the vsnprintf function. */
#undef HAVE_VSNPRINTF
/* Define if you have the waitpid function. */
#undef HAVE_WAITPID
/* Define if you have the wait3 function. */
#undef HAVE_WAIT3
/* Presence of certain system include files. */
/* Define if you have the <arpa/inet.h> header file. */
@ -573,6 +675,12 @@
/* Define if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define if you have the <grp.h> header file. */
#undef HAVE_GRP_H
/* Define if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define if you have the <libintl.h> header file. */
#undef HAVE_LIBINTL_H
@ -600,12 +708,18 @@
/* Define if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define if you have the <stddef.h> header file. */
#undef HAVE_STDDEF_H
/* Define if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define if you have the <sys/dir.h> header file. */
#undef HAVE_SYS_DIR_H
@ -690,6 +804,12 @@
<sys/resource.h>? */
#undef RLIMIT_NEEDS_KERNEL
/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS
/* Define for large files on AIX-style hosts. */
#undef _LARGE_FILES
/* Do strcoll(3) and strcmp(3) give different results in the default locale? */
#undef STRCOLL_BROKEN

16023
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -5,17 +5,37 @@ dnl report bugs to chet@po.cwru.edu
dnl
dnl Process this file with autoconf to produce a configure script.
dnl checks for version info
AC_REVISION([for Bash 2.05, version 2.90, from autoconf version] AC_ACVERSION)dnl
# Copyright (C) 1987-2001 Free Software Foundation, Inc.
AC_INIT(shell.h)
AC_CONFIG_HEADER(config.h)
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
AC_REVISION([for Bash 2.05a, version 2.128, from autoconf version] AC_ACVERSION)dnl
AC_INIT(bash, 2.05a, bug-bash@gnu.org)
dnl make sure we are using a recent autoconf version
AC_PREREQ(2.12)
AC_PREREQ(2.50)
AC_CONFIG_SRCDIR(shell.h)
dnl where to find install.sh, config.sub, and config.guess
AC_CONFIG_AUX_DIR(./support)
AC_CONFIG_HEADERS(config.h)
dnl checks for version info
BASHVERS=2.05a
dnl canonicalize the host and os so we can do some tricky things before
dnl parsing options
@ -23,7 +43,6 @@ AC_CANONICAL_HOST
dnl configure defaults
opt_bash_malloc=yes
opt_glibc_malloc=no
opt_purify=no
opt_purecov=no
opt_afs=no
@ -45,6 +64,7 @@ mips-irix6*) opt_bash_malloc=no ;; # needs 8-byte alignment
m68k-sysv) opt_bash_malloc=no ;; # fixes file descriptor leak in closedir
sparc-linux*) opt_bash_malloc=no ;; # sparc running linux; requires ELF
#*-freebsd*) opt_bash_malloc=no ;; # they claim it's better
*-openbsd*) opt_bash_malloc=no ;; # they claim it needs eight-bit alignment
*-aix*) opt_bash_malloc=no ;; # AIX machines
*-nextstep*) opt_bash_malloc=no ;; # NeXT machines running NeXTstep
*-macos*) opt_bash_malloc=no ;; # Apple MacOS X
@ -64,23 +84,26 @@ dnl packages
AC_ARG_WITH(afs, --with-afs if you are running AFS, opt_afs=$withval)
AC_ARG_WITH(bash-malloc, --with-bash-malloc use the Bash version of malloc,opt_bash_malloc=$withval)
AC_ARG_WITH(curses, --with-curses use the curses library instead of the termcap library,opt_curses=$withval)
AC_ARG_WITH(glibc-malloc, --with-glibc-malloc use the GNU C library version of malloc,opt_glibc_malloc=$withval)
AC_ARG_WITH(gnu-malloc, --with-gnu-malloc synonym for --with-bash-malloc,opt_bash_malloc=$withval)
AC_ARG_WITH(installed-readline, --with-installed-readline use a version of the readline library that is already installed, opt_with_installed_readline=$withval)
AC_ARG_WITH(purecov, --with-purecov configure to postprocess with pure coverage, opt_purecov=$withval)
AC_ARG_WITH(purify, --with-purify configure to postprocess with purify, opt_purify=$withval)
dnl test for glibc malloc first because it can override the default
if test "$opt_glibc_malloc" = yes; then
MALLOC_TARGET=gmalloc
MALLOC_SRC=gmalloc.c
elif test "$opt_bash_malloc" = yes; then
if test "$opt_bash_malloc" = yes; then
MALLOC_TARGET=malloc
MALLOC_SRC=malloc.c
MALLOC_LIB='-lmalloc'
MALLOC_LIBRARY='$(ALLOC_LIBDIR)/libmalloc.a'
MALLOC_LDFLAGS='-L$(ALLOC_LIBDIR)'
MALLOC_DEP='$(MALLOC_LIBRARY)'
AC_DEFINE(USING_BASH_MALLOC)
else
MALLOC_TARGET=stubmalloc
MALLOC_SRC=stub.c
MALLOC_LIB=
MALLOC_LIBRARY=
MALLOC_LDFLAGS=
MALLOC_DEP=
fi
if test "$opt_purify" = yes; then
@ -126,6 +149,7 @@ opt_cond_command=yes
opt_arith_for_command=yes
opt_net_redirs=yes
opt_progcomp=yes
opt_largefile=yes
dnl options that affect how bash is compiled and linked
opt_static_link=no
@ -160,6 +184,7 @@ AC_ARG_ENABLE(extended-glob, --enable-extended-glob include ksh-style extended p
AC_ARG_ENABLE(help-builtin, --enable-help-builtin include the help builtin, opt_help=$enableval)
AC_ARG_ENABLE(history, --enable-history turn on command history, opt_history=$enableval)
AC_ARG_ENABLE(job-control, --enable-job-control enable job control features, opt_job_control=$enableval)
AC_ARG_ENABLE(largefile, --enable-largefile enable support for large files, opt_largefile=$enableval)
AC_ARG_ENABLE(net-redirections, --enable-net-redirections enable /dev/tcp/host/port redirection, opt_net_redirs=$enableval)
AC_ARG_ENABLE(process-substitution, --enable-process-substitution enable process substitution, opt_process_subst=$enableval)
AC_ARG_ENABLE(progcomp, --enable-progcomp enable programmable completion and the complete builtin, opt_progcomp=$enableval)
@ -247,22 +272,21 @@ AC_SUBST(PURIFY)
AC_SUBST(MALLOC_TARGET)
AC_SUBST(MALLOC_SRC)
AC_SUBST(MALLOC_LIB)
AC_SUBST(MALLOC_LIBRARY)
AC_SUBST(MALLOC_LDFLAGS)
AC_SUBST(MALLOC_DEP)
AC_SUBST(htmldir)
dnl Use GNU m4 macros to get the distribution and patchlevel information
dnl into configure without requiring the files to be distributed
[BASHVERS=]dnl
esyscmd(cat _distribution)dnl
[BASHPATCH=]dnl
esyscmd(cat _patchlevel)dnl
echo ""
echo "Beginning configuration for bash-$BASHVERS for ${host_cpu}-${host_vendor}-${host_os}"
echo ""
dnl compilation checks
dnl AC_PROG_CC sets $cross_compiling to `yes' if cross-compiling for a
dnl different environment
AC_PROG_CC
BASH_LARGE_FILE_SUPPORT
dnl test for Unix variants
AC_ISC_POSIX
@ -271,7 +295,8 @@ AC_MINIX
dnl test for non-Unix variants
AC_CYGWIN
AC_MINGW32
AC_EXEEXT
AC_SYS_LARGEFILE
dnl BEGIN changes for cross-building for cygwin and BeOS
@ -333,10 +358,13 @@ if test "$opt_profiling" = "yes"; then
fi
if test "$opt_static_link" = yes; then
# if we're using gcc, add `-static' to LDFLAGS
# if we're using gcc, add `-static' to LDFLAGS, except on Solaris >= 2
if test -n "$GCC" || test "$ac_cv_prog_gcc" = "yes"; then
STATIC_LD="-static"
LDFLAGS="$LDFLAGS -static" # XXX experimental
STATIC_LD="-static"
case "$host_os" in
solaris2*) ;;
*) LDFLAGS="$LDFLAGS -static" ;; # XXX experimental
esac
fi
fi
@ -351,40 +379,33 @@ dnl BEGIN READLINE and HISTORY LIBRARY SECTION
dnl prepare to allow bash to be linked against an already-installed readline
dnl first test that the readline version is new enough to link bash against
if test "$opt_readline" = yes && test "$opt_with_installed_readline" = "yes"
if test "$opt_readline" = yes && test "$opt_with_installed_readline" != "no"
then
echo opt_with_installed_readline = $opt_with_installed_readline
# If the user specified --with-installed-readline=PREFIX and PREFIX
# is not `yes', set ac_cv_rl_prefix to PREFIX
test $opt_with_installed_readline != "yes" && ac_cv_rl_prefix=$opt_with_installed_readline
dnl we duplicate some work that's done later here so we can look in
dnl the correct directory for the readline library
RL_LIB_READLINE_VERSION
if test -z "$TERMCAP_LIB" ; then
BASH_CHECK_LIB_TERMCAP
fi
test "x$prefix" = xNONE && _rl_prefix=$ac_default_prefix || _rl_prefix=${prefix}
test "x$exec_prefix" = xNONE && _rl_exec_prefix=${_rl_prefix} || _rl_exec_prefix=${exec_prefix}
AC_MSG_CHECKING(version of installed readline library)
_rl_version=`exec_prefix=${_rl_exec_prefix} ${CONFIG_SHELL-/bin/sh} ${srcdir}/support/rlvers.sh -C "${CC}" -L ${libdir} -I ${includedir} -T ${TERMCAP_LIB}`
AC_MSG_RESULT($_rl_version)
case "$_rl_version" in
case "$ac_cv_rl_version" in
4.[[2-9]]*|5*|6*|7*|8*|9*) ;;
*) opt_with_installed_readline=no
AC_MSG_WARN(installed readline library is too old to be linked with bash)
AC_MSG_WARN(using private bash version)
;;
esac
unset _rl_version _rl_prefix _rl_exec_prefix
fi
if test $opt_readline = yes; then
AC_DEFINE(READLINE)
READLINE_LIB=-lreadline
if test "$opt_with_installed_readline" = "yes" ; then
RL_LIBDIR='$(libdir)'
if test "$opt_with_installed_readline" != "no" ; then
case "$RL_INCLUDEDIR" in
/usr/include) ;;
*) RL_INCLUDE='-I${RL_INCLUDEDIR}'
esac
READLINE_DEP=
RL_INCLUDE='-I$(includedir)'
else
RL_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
READLINE_DEP='$(READLINE_LIBRARY)'
@ -401,10 +422,13 @@ if test $opt_history = yes || test $opt_bang_history = yes; then
AC_DEFINE(BANG_HISTORY)
fi
HISTORY_LIB=-lhistory
if test "$opt_with_installed_readline" = "yes"; then
HIST_LIBDIR='$(libdir)'
if test "$opt_with_installed_readline" != "no"; then
HIST_LIBDIR=$RL_LIBDIR
HISTORY_DEP=
RL_INCLUDE='-I$(includedir)'
case "$RL_INCLUDEDIR" in
/usr/include) ;;
*) RL_INCLUDE='-I${RL_INCLUDEDIR}'
esac
else
HIST_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
HISTORY_DEP='$(HISTORY_LIBRARY)'
@ -416,6 +440,7 @@ fi
AC_SUBST(READLINE_LIB)
AC_SUBST(READLINE_DEP)
AC_SUBST(RL_LIBDIR)
AC_SUBST(RL_INCLUDEDIR)
AC_SUBST(RL_INCLUDE)
AC_SUBST(HISTORY_LIB)
AC_SUBST(HISTORY_DEP)
@ -425,7 +450,7 @@ dnl END READLINE and HISTORY LIBRARY SECTION
dnl programs needed by the build and install process
AC_PROG_INSTALL
AC_CHECK_PROG(AR, ar, ar)
AC_CHECK_PROG(AR, ar, , ar)
dnl Set default for ARFLAGS, since autoconf does not have a macro for it.
dnl This allows people to set it when running configure or make
test -n "$ARFLAGS" || ARFLAGS="cr"
@ -439,14 +464,52 @@ opennt*|interix*) MAKE_SHELL="$INTERIX_ROOT/bin/sh" ;;
esac
AC_SUBST(MAKE_SHELL)
dnl Turn on any extensions available in the GNU C library.
AC_DEFINE(_GNU_SOURCE, 1)
dnl C compiler characteristics
AC_C_CONST
AC_C_INLINE
AC_C_BIGENDIAN
AC_C_STRINGIZE
AC_C_LONG_DOUBLE
AC_C_PROTOTYPES
AC_C_CHAR_UNSIGNED
dnl header files
AC_HEADER_DIRENT
AC_HEADER_TIME
BASH_HEADER_INTTYPES
AC_CHECK_HEADERS(unistd.h stdlib.h stdarg.h varargs.h limits.h string.h \
memory.h locale.h termcap.h termio.h termios.h dlfcn.h \
stddef.h stdint.h netdb.h grp.h strings.h)
AC_CHECK_HEADERS(sys/ptem.h sys/pte.h sys/stream.h sys/select.h sys/file.h \
sys/resource.h sys/param.h sys/socket.h \
sys/time.h sys/times.h sys/wait.h)
AC_CHECK_HEADERS(netinet/in.h arpa/inet.h)
dnl special checks for libc functions
AC_FUNC_ALLOCA
AC_FUNC_GETPGRP
AC_FUNC_SETVBUF_REVERSED
AC_FUNC_VPRINTF
AC_FUNC_WAIT3
AC_FUNC_STRCOLL
dnl if we're not using the bash malloc but require the C alloca, set things
dnl up to build a libmalloc.a containing only alloca.o
if test "$ac_cv_func_alloca_works" = "no" && test "$opt_bash_malloc" = "no"; then
MALLOC_TARGET=alloca
MALLOC_SRC=alloca.c
MALLOC_LIB='-lmalloc'
MALLOC_LIBRARY='$(ALLOC_LIBDIR)/libmalloc.a'
MALLOC_LDFLAGS='-L$(ALLOC_LIBDIR)'
MALLOC_DEP='$(MALLOC_LIBRARY)'
fi
dnl if vprintf is not in libc, see if it's defined in stdio.h
if test "$ac_cv_func_vprintf" = no; then
AC_MSG_CHECKING(for declaration of vprintf in stdio.h)
@ -457,8 +520,12 @@ if test "$ac_cv_func_vprintf" = no; then
fi
fi
if test "$ac_cv_func_vprintf" = no && test "$ac_cv_func__doprnt" = "yes"; then
AC_LIBOBJ(vprint)
fi
dnl signal stuff
AC_RETSIGTYPE
AC_TYPE_SIGNAL
dnl checks for certain version-specific system calls and libc functions
AC_CHECK_FUNC(__setostype, AC_DEFINE(HAVE_SETOSTYPE))
@ -471,14 +538,31 @@ dnl checks for system calls
AC_CHECK_FUNCS(dup2 select getdtablesize getgroups gethostname \
setdtablesize getpagesize killpg lstat getpeername sbrk \
getrlimit getrusage gettimeofday waitpid tcgetpgrp \
readlink rename)
readlink)
AC_REPLACE_FUNCS(rename)
dnl checks for c library functions
AC_CHECK_FUNCS(bcopy bzero confstr getcwd strcasecmp setenv putenv \
setlinebuf setlocale strchr strerror strtod strtol \
strtoul tcgetattr uname sysconf ulimit times tzset \
siginterrupt memmove ttyname gethostbyname getservbyname \
inet_aton strpbrk setvbuf pathconf)
AC_CHECK_FUNCS(bcopy bzero confstr sysconf pathconf setenv putenv \
setlinebuf setvbuf setlocale strchr tcgetattr uname \
ulimit tzset siginterrupt memmove ttyname times \
getaddrinfo gethostbyname getservbyname inet_aton \
vsnprintf snprintf vasprintf asprintf fnmatch)
AC_CHECK_FUNCS(isascii isblank isgraph isprint isspace isxdigit)
AC_REPLACE_FUNCS(getcwd strcasecmp strerror strpbrk strtod)
AC_REPLACE_FUNCS(strtol strtoul strtoll strtoull strtoimax strtoumax)
AC_CHECK_DECLS([strtold])
AC_CHECK_DECLS([confstr])
AC_CHECK_DECLS([sbrk])
AC_CHECK_DECLS([printf])
AC_CHECK_DECLS([strsignal])
BASH_CHECK_DECL(strtoimax)
BASH_CHECK_DECL(strtol)
BASH_CHECK_DECL(strtoll)
BASH_CHECK_DECL(strtoul)
BASH_CHECK_DECL(strtoull)
BASH_CHECK_DECL(strtoumax)
dnl checks for locale functions
AC_CHECK_HEADERS(libintl.h)
@ -502,18 +586,6 @@ fi
dnl this defines SYS_SIGLIST_DECLARED
AC_DECL_SYS_SIGLIST
dnl header files
AC_HEADER_DIRENT
AC_HEADER_TIME
AC_CHECK_HEADERS(unistd.h stdlib.h stdarg.h varargs.h limits.h string.h \
memory.h locale.h termcap.h termio.h termios.h dlfcn.h \
stddef.h netdb.h)
AC_CHECK_HEADERS(sys/ptem.h sys/pte.h sys/stream.h sys/select.h sys/file.h \
sys/resource.h sys/param.h sys/socket.h \
sys/time.h sys/times.h sys/wait.h)
AC_CHECK_HEADERS(netinet/in.h arpa/inet.h)
dnl network functions -- check for inet_aton again
if test "$ac_cv_func_inet_aton" != 'yes'; then
BASH_FUNC_INET_ATON
@ -527,7 +599,7 @@ esac
dnl check for getpeername in the socket library only if it's not in libc
if test "$ac_cv_func_getpeername" = no; then
BASH_CHECK_SOCKLIB
BASH_CHECK_LIB_SOCKET
fi
dnl check for gethostbyname in socket libraries if it's not in libc
if test "$ac_cv_func_gethostbyname" = no; then
@ -541,8 +613,12 @@ AC_TYPE_MODE_T
AC_TYPE_UID_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_CHECK_TYPE(ssize_t, int)
AC_CHECK_TYPE(time_t, long)
BASH_TYPE_LONG_LONG
BASH_TYPE_UNSIGNED_LONG_LONG
AC_TYPE_SIGNAL
AC_CHECK_SIZEOF(char, 1)
@ -551,9 +627,10 @@ AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(long, 4)
AC_CHECK_SIZEOF(char *, 4)
AC_CHECK_SIZEOF(double, 8)
AC_CHECK_SIZEOF([long long], 8)
AC_CHECK_TYPE(u_int, unsigned int)
AC_CHECK_TYPE(u_long, unsigned long)
AC_CHECK_TYPE(u_int, [unsigned int])
AC_CHECK_TYPE(u_long, [unsigned long])
BASH_TYPE_BITS16_T
BASH_TYPE_U_BITS16_T
@ -566,16 +643,11 @@ BASH_TYPE_PTRDIFF_T
dnl structures
AC_HEADER_STAT
dnl C compiler characteristics
AC_C_BIGENDIAN
dnl system services
AC_SYS_INTERPRETER
if test $ac_cv_sys_interpreter = yes; then
AC_DEFINE(HAVE_HASH_BANG_EXEC)
fi
dnl we use NO_READ_RESTART_ON_SIGNAL
AC_SYS_RESTARTABLE_SYSCALLS
dnl Miscellaneous Bash tests
if test "$ac_cv_func_lstat" = "no"; then
@ -583,13 +655,9 @@ BASH_FUNC_LSTAT
fi
dnl behavior of system calls and library functions
BASH_DUP2_CLOEXEC_CHECK
BASH_PGRP_SYNC
BASH_SIGNAL_CHECK
if test "$ac_cv_sys_restartable_syscalls" = "no"; then
BASH_SYS_RESTARTABLE_SYSCALLS
fi
BASH_FUNC_DUP2_CLOEXEC_CHECK
BASH_SYS_PGRP_SYNC
BASH_SYS_SIGNAL_VINTAGE
dnl checking for the presence of certain library symbols
BASH_SYS_ERRLIST
@ -601,7 +669,12 @@ BASH_TYPE_SIGHANDLER
BASH_CHECK_TYPE(clock_t, [#include <sys/times.h>], long)
BASH_CHECK_TYPE(sigset_t, [#include <signal.h>], int)
BASH_CHECK_TYPE(quad_t, , long, HAVE_QUAD_T)
BASH_RLIMIT_TYPE
BASH_CHECK_TYPE(intmax_t, , $bash_cv_type_long_long)
BASH_CHECK_TYPE(uintmax_t, , $bash_cv_type_unsigned_long_long)
if test "$ac_cv_header_sys_socket_h" = "yes"; then
BASH_CHECK_TYPE(socklen_t, [#include <sys/socket.h>], int, HAVE_SOCKLEN_T)
fi
BASH_TYPE_RLIMIT
dnl presence and contents of structures used by system calls
BASH_STRUCT_TERMIOS_LDISC
@ -610,36 +683,52 @@ BASH_STRUCT_DIRENT_D_INO
BASH_STRUCT_DIRENT_D_FILENO
BASH_STRUCT_WINSIZE
BASH_STRUCT_TIMEVAL
AC_CHECK_MEMBERS([struct stat.st_blocks])
dnl presence and behavior of C library functions
BASH_FUNC_STRSIGNAL
BASH_FUNC_OPENDIR_CHECK
BASH_FUNC_PRINTF
BASH_FUNC_ULIMIT_MAXFDS
BASH_FUNC_GETENV
if test "$ac_func_getcwd" = "yes"; then
BASH_FUNC_GETCWD
BASH_FUNC_SBRK_DECLARED
fi
BASH_FUNC_POSIX_SETJMP
BASH_FUNC_STRCOLL
dnl I have removed this check. The existing libc FNM_EXTMATCH implementation
dnl (glibc-2.2.4) disagrees with bash on the matching of incorrectly-formed
dnl patterns (bash treats them as strings or characters to be matched without
dnl any special meaning) and has one outright bug: a[X-]b should match
dnl both a-b and aXb.
dnl
dnl Once Ulrich and I get together on this, the check can return
dnl
dnl chet 10/31/2001
dnl
dnl BASH_FUNC_FNMATCH_EXTMATCH
BASH_FUNC_PRINTF_A_FORMAT
dnl presence and behavior of OS functions
BASH_REINSTALL_SIGHANDLERS
BASH_JOB_CONTROL_MISSING
BASH_SYS_REINSTALL_SIGHANDLERS
BASH_SYS_JOB_CONTROL_MISSING
BASH_SYS_NAMED_PIPES
dnl presence of certain CPP defines
BASH_HAVE_TIOCGWINSZ
AC_HEADER_TIOCGWINSZ
BASH_HAVE_TIOCSTAT
BASH_HAVE_FIONREAD
dnl miscellaneous
BASH_MISC_SPEED_T
BASH_CHECK_SPEED_T
BASH_CHECK_GETPW_FUNCS
BASH_CHECK_RTSIGS
BASH_CHECK_SYS_SIGLIST
dnl special checks
case "$host_os" in
hpux*) BASH_KERNEL_RLIMIT_CHECK ;;
hpux*) BASH_CHECK_KERNEL_RLIMIT ;;
esac
if test "$opt_readline" = yes; then
@ -654,7 +743,7 @@ AC_SUBST(TERMCAP_DEP)
BASH_CHECK_DEV_FD
BASH_CHECK_DEV_STDIN
BASH_DEFAULT_MAIL_DIR
BASH_SYS_DEFAULT_MAIL_DIR
if test "$bash_cv_job_control_missing" = missing; then
opt_job_control=no
@ -689,6 +778,7 @@ hpux*) LOCAL_CFLAGS=-DHPUX ;;
dgux*) LOCAL_CFLAGS=-D_DGUX_SOURCE; LOCAL_LIBS=-ldgc ;;
isc*) LOCAL_CFLAGS=-Disc386 ;;
rhapsody*) LOCAL_CFLAGS=-DRHAPSODY ;;
darwin*) LOCAL_CFLAGS=-DMACOSX ;;
sco3.2v5*) LOCAL_CFLAGS="-b elf -DWAITPID_BROKEN -DNO_MEMSCRAMBLE -DPATH_MAX=1024" ;;
sco3.2v4*) LOCAL_CFLAGS="-DMUST_UNBLOCK_CHLD -DNO_MEMSCRAMBLE -DPATH_MAX=1024" ;;
sco3.2*) LOCAL_CFLAGS=-DMUST_UNBLOCK_CHLD ;;
@ -699,7 +789,7 @@ linux*) LOCAL_LDFLAGS=-rdynamic ;; # allow dynamic loading
*qnx*) LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s -lunix -lncurses" ;;
powerux*) LOCAL_LIBS="-lgen" ;;
cygwin*) LOCAL_LIBS="-luser32" ;;
opennt*|interix*) LOCAL_CFLAGS="-DNO_MAIN_ENV_ARG" ;;
opennt*|interix*) LOCAL_CFLAGS="-DNO_MAIN_ENV_ARG -DBROKEN_DIRENT_D_INO" ;;
esac
dnl Stanza for OS/compiler pair-specific flags
@ -776,7 +866,6 @@ AC_SUBST(AR)
AC_SUBST(ARFLAGS)
AC_SUBST(BASHVERS)
AC_SUBST(BASHPATCH)
AC_SUBST(host_cpu)
AC_SUBST(host_vendor)

58
conftypes.h Normal file
View File

@ -0,0 +1,58 @@
/* conftypes.h -- defines for build and host system. */
/* Copyright (C) 2001 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
Bash is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
License for more details.
You should have received a copy of the GNU General Public License
along with Bash; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#if !defined (_CONFTYPES_H_)
#define _CONFTYPES_H_
/* Placeholder for future modifications if cross-compiling or building a
`fat' binary, e.g. on Apple Rhapsody. These values are used in multiple
files, so they appear here. */
#if !defined (RHAPSODY)
# define HOSTTYPE CONF_HOSTTYPE
# define OSTYPE CONF_OSTYPE
# define MACHTYPE CONF_MACHTYPE
#else /* RHAPSODY */
# if defined(__powerpc__) || defined(__ppc__)
# define HOSTTYPE "powerpc"
# elif defined(__i386__)
# define HOSTTYPE "i386"
# else
# define HOSTTYPE CONF_HOSTTYPE
# endif
# define OSTYPE CONF_OSTYPE
# define VENDOR CONF_VENDOR
# define MACHTYPE HOSTTYPE "-" VENDOR "-" OSTYPE
#endif /* RHAPSODY */
#ifndef HOSTTYPE
# define HOSTTYPE "unknown"
#endif
#ifndef OSTYPE
# define OSTYPE "unknown"
#endif
#ifndef MACHTYPE
# define MACHTYPE "unknown"
#endif
#endif /* _CONFTYPES_H_ */

View File

@ -32,6 +32,26 @@
#include "shell.h"
static PATTERN_LIST *copy_case_clause __P((PATTERN_LIST *));
static PATTERN_LIST *copy_case_clauses __P((PATTERN_LIST *));
static FOR_COM *copy_for_command __P((FOR_COM *));
#if defined (ARITH_FOR_COMMAND)
static ARITH_FOR_COM *copy_arith_for_command __P((ARITH_FOR_COM *));
#endif
static GROUP_COM *copy_group_command __P((GROUP_COM *));
static SUBSHELL_COM *copy_subshell_command __P((SUBSHELL_COM *));
static CASE_COM *copy_case_command __P((CASE_COM *));
static WHILE_COM *copy_while_command __P((WHILE_COM *));
static IF_COM *copy_if_command __P((IF_COM *));
#if defined (DPAREN_ARITHMETIC)
static ARITH_COM *copy_arith_command __P((ARITH_COM *));
#endif
#if defined (COND_COMMAND)
static COND_COM *copy_cond_command __P((COND_COM *));
#endif
static SIMPLE_COM *copy_simple_command __P((SIMPLE_COM *));
static FUNCTION_DEF *copy_function_def __P((FUNCTION_DEF *));
WORD_DESC *
copy_word (w)
WORD_DESC *w;

View File

@ -8,7 +8,7 @@
Use gcc labelled initializers to set up the array. Note that
some entries might wind up being NULL. */
char *signal_names[NSIG + 2] = {
char *signal_names[NSIG + 3] = {
[0] "EXIT",
[SIGHUP] "SIGHUP",
[SIGINT] "SIGINT",
@ -32,5 +32,6 @@ char *signal_names[NSIG + 2] = {
[SIGWINCH] "SIGWINCH",
[SIGKILLTHR] "SIGKILLTHR",
[NSIG] "DEBUG",
[NSIG + 1] (char *)0x0,
[NSIG + 1] "ERR",
[NSIG + 2] (char *)0x0,
};

View File

@ -1,42 +1,251 @@
# This file is a shell script that caches the results of configure
# tests for CYGWIN32 so they don't need to be done when cross-compiling.
# tests run on this system so they can be shared between configure
# scripts and configure runs, see configure's option --config-cache.
# It is not useful on other systems. If it contains results you don't
# want to keep, you may remove or edit it.
#
# config.status only pays attention to the cache file if you give it
# the --recheck option to rerun configure.
#
# `ac_cv_env_foo' variables (set or unset) will be overriden when
# loading this file, other *unset* `ac_cv_foo' will be assigned the
# following values.
# AC_FUNC_GETPGRP should also define GETPGRP_VOID
ac_cv_build=${ac_cv_build='i686-pc-cygwin'}
ac_cv_build_alias=${ac_cv_build_alias='i686-pc-cygwin'}
ac_cv_c_bigendian=${ac_cv_c_bigendian='no'}
ac_cv_c_char_unsigned=${ac_cv_c_char_unsigned='no'}
ac_cv_c_compiler_gnu=${ac_cv_c_compiler_gnu='yes'}
ac_cv_c_const=${ac_cv_c_const='yes'}
ac_cv_c_inline=${ac_cv_c_inline='inline'}
ac_cv_c_long_double=${ac_cv_c_long_double='yes'}
ac_cv_c_stringize=${ac_cv_c_stringize='yes'}
ac_cv_decl_sys_siglist=${ac_cv_decl_sys_siglist='no'}
ac_cv_exeext=${ac_cv_exeext='.exe'}
ac_cv_func___setostype=${ac_cv_func___setostype='no'}
ac_cv_func__doprnt=${ac_cv_func__doprnt='no'}
ac_cv_func_alloca_works=${ac_cv_func_alloca_works='yes'}
ac_cv_func_asprintf=${ac_cv_func_asprintf='no'}
ac_cv_func_bcopy=${ac_cv_func_bcopy='yes'}
ac_cv_func_bindtextdomain=${ac_cv_func_bindtextdomain='no'}
ac_cv_func_bzero=${ac_cv_func_bzero='yes'}
ac_cv_func_confstr=${ac_cv_func_confstr='no'}
ac_cv_func_dlclose=${ac_cv_func_dlclose='yes'}
ac_cv_func_dlopen=${ac_cv_func_dlopen='yes'}
ac_cv_func_dlsym=${ac_cv_func_dlsym='yes'}
ac_cv_func_dup2=${ac_cv_func_dup2='yes'}
ac_cv_func_fnmatch=${ac_cv_func_fnmatch='no'}
ac_cv_func_getaddrinfo=${ac_cv_func_getaddrinfo='no'}
ac_cv_func_getcwd=${ac_cv_func_getcwd='yes'}
ac_cv_func_getdtablesize=${ac_cv_func_getdtablesize='yes'}
ac_cv_func_getgroups=${ac_cv_func_getgroups='yes'}
ac_cv_func_gethostbyname=${ac_cv_func_gethostbyname='yes'}
ac_cv_func_gethostname=${ac_cv_func_gethostname='yes'}
ac_cv_func_getpagesize=${ac_cv_func_getpagesize='yes'}
ac_cv_func_getpeername=${ac_cv_func_getpeername='yes'}
ac_cv_func_getpgrp_void=${ac_cv_func_getpgrp_void='yes'}
# AC_FUNC_SETVBUF_REVERSED should not define anything else
ac_cv_func_getrlimit=${ac_cv_func_getrlimit='yes'}
ac_cv_func_getrusage=${ac_cv_func_getrusage='yes'}
ac_cv_func_getservbyname=${ac_cv_func_getservbyname='yes'}
ac_cv_func_gettext=${ac_cv_func_gettext='no'}
ac_cv_func_gettimeofday=${ac_cv_func_gettimeofday='yes'}
ac_cv_func_inet_aton=${ac_cv_func_inet_aton='yes'}
ac_cv_func_isascii=${ac_cv_func_isascii='yes'}
ac_cv_func_isblank=${ac_cv_func_isblank='no'}
ac_cv_func_isgraph=${ac_cv_func_isgraph='yes'}
ac_cv_func_isprint=${ac_cv_func_isprint='yes'}
ac_cv_func_isspace=${ac_cv_func_isspace='yes'}
ac_cv_func_isxdigit=${ac_cv_func_isxdigit='yes'}
ac_cv_func_killpg=${ac_cv_func_killpg='yes'}
ac_cv_func_lstat=${ac_cv_func_lstat='yes'}
ac_cv_func_memmove=${ac_cv_func_memmove='yes'}
ac_cv_func_mkfifo=${ac_cv_func_mkfifo='yes'}
ac_cv_func_pathconf=${ac_cv_func_pathconf='yes'}
ac_cv_func_putenv=${ac_cv_func_putenv='yes'}
ac_cv_func_readlink=${ac_cv_func_readlink='yes'}
ac_cv_func_rename=${ac_cv_func_rename='yes'}
ac_cv_func_sbrk=${ac_cv_func_sbrk='yes'}
ac_cv_func_select=${ac_cv_func_select='yes'}
ac_cv_func_setdtablesize=${ac_cv_func_setdtablesize='yes'}
ac_cv_func_setenv=${ac_cv_func_setenv='yes'}
ac_cv_func_setlinebuf=${ac_cv_func_setlinebuf='no'}
ac_cv_func_setlocale=${ac_cv_func_setlocale='yes'}
ac_cv_func_setvbuf=${ac_cv_func_setvbuf='yes'}
ac_cv_func_setvbuf_reversed=${ac_cv_func_setvbuf_reversed='no'}
# on CYGWIN32, system calls do not restart
ac_cv_sys_restartable_syscalls=${ac_cv_sys_restartable_syscalls='no'}
bash_cv_sys_restartable_syscalls=${bash_cv_sys_restartable_syscalls='no'}
# these may be necessary, but they are currently commented out
#ac_cv_c_bigendian=${ac_cv_c_bigendian='no'}
ac_cv_func_siginterrupt=${ac_cv_func_siginterrupt='no'}
ac_cv_func_snprintf=${ac_cv_func_snprintf='yes'}
ac_cv_func_strcasecmp=${ac_cv_func_strcasecmp='yes'}
ac_cv_func_strchr=${ac_cv_func_strchr='yes'}
ac_cv_func_strcoll_works=${ac_cv_func_strcoll_works='yes'}
ac_cv_func_strerror=${ac_cv_func_strerror='yes'}
ac_cv_func_strpbrk=${ac_cv_func_strpbrk='yes'}
ac_cv_func_strtod=${ac_cv_func_strtod='yes'}
ac_cv_func_strtoimax=${ac_cv_func_strtoimax='no'}
ac_cv_func_strtol=${ac_cv_func_strtol='yes'}
ac_cv_func_strtoll=${ac_cv_func_strtoll='no'}
ac_cv_func_strtoul=${ac_cv_func_strtoul='yes'}
ac_cv_func_strtoull=${ac_cv_func_strtoull='no'}
ac_cv_func_strtoumax=${ac_cv_func_strtoumax='no'}
ac_cv_func_sysconf=${ac_cv_func_sysconf='yes'}
ac_cv_func_tcgetattr=${ac_cv_func_tcgetattr='yes'}
ac_cv_func_tcgetpgrp=${ac_cv_func_tcgetpgrp='yes'}
ac_cv_func_textdomain=${ac_cv_func_textdomain='no'}
ac_cv_func_times=${ac_cv_func_times='yes'}
ac_cv_func_ttyname=${ac_cv_func_ttyname='yes'}
ac_cv_func_tzset=${ac_cv_func_tzset='yes'}
ac_cv_func_ulimit=${ac_cv_func_ulimit='no'}
ac_cv_func_uname=${ac_cv_func_uname='yes'}
ac_cv_func_vasprintf=${ac_cv_func_vasprintf='no'}
ac_cv_func_vprintf=${ac_cv_func_vprintf='yes'}
ac_cv_func_vsnprintf=${ac_cv_func_vsnprintf='yes'}
ac_cv_func_wait3=${ac_cv_func_wait3='yes'}
ac_cv_func_waitpid=${ac_cv_func_waitpid='yes'}
ac_cv_have_decl_confstr=${ac_cv_have_decl_confstr='no'}
ac_cv_have_decl_printf=${ac_cv_have_decl_printf='yes'}
ac_cv_have_decl_sbrk=${ac_cv_have_decl_sbrk='yes'}
ac_cv_have_decl_strsignal=${ac_cv_have_decl_strsignal='yes'}
ac_cv_have_decl_strtold=${ac_cv_have_decl_strtold='no'}
ac_cv_header_arpa_inet_h=${ac_cv_header_arpa_inet_h='yes'}
ac_cv_header_dirent_dirent_h=${ac_cv_header_dirent_dirent_h='yes'}
ac_cv_header_dlfcn_h=${ac_cv_header_dlfcn_h='yes'}
ac_cv_header_grp_h=${ac_cv_header_grp_h='yes'}
ac_cv_header_inttypes_h=${ac_cv_header_inttypes_h='no'}
ac_cv_header_libintl_h=${ac_cv_header_libintl_h='yes'}
ac_cv_header_limits_h=${ac_cv_header_limits_h='yes'}
ac_cv_header_locale_h=${ac_cv_header_locale_h='yes'}
ac_cv_header_memory_h=${ac_cv_header_memory_h='yes'}
ac_cv_header_minix_config_h=${ac_cv_header_minix_config_h='no'}
ac_cv_header_netdb_h=${ac_cv_header_netdb_h='yes'}
ac_cv_header_netinet_in_h=${ac_cv_header_netinet_in_h='yes'}
ac_cv_header_stat_broken=${ac_cv_header_stat_broken='no'}
ac_cv_header_stdarg_h=${ac_cv_header_stdarg_h='yes'}
ac_cv_header_stdc=${ac_cv_header_stdc='yes'}
ac_cv_header_stddef_h=${ac_cv_header_stddef_h='yes'}
ac_cv_header_stdint_h=${ac_cv_header_stdint_h='no'}
ac_cv_header_stdlib_h=${ac_cv_header_stdlib_h='yes'}
ac_cv_header_string_h=${ac_cv_header_string_h='yes'}
ac_cv_header_strings_h=${ac_cv_header_strings_h='yes'}
ac_cv_header_sys_file_h=${ac_cv_header_sys_file_h='yes'}
ac_cv_header_sys_param_h=${ac_cv_header_sys_param_h='yes'}
ac_cv_header_sys_pte_h=${ac_cv_header_sys_pte_h='no'}
ac_cv_header_sys_ptem_h=${ac_cv_header_sys_ptem_h='no'}
ac_cv_header_sys_resource_h=${ac_cv_header_sys_resource_h='yes'}
ac_cv_header_sys_select_h=${ac_cv_header_sys_select_h='yes'}
ac_cv_header_sys_socket_h=${ac_cv_header_sys_socket_h='yes'}
ac_cv_header_sys_stat_h=${ac_cv_header_sys_stat_h='yes'}
ac_cv_header_sys_stream_h=${ac_cv_header_sys_stream_h='no'}
ac_cv_header_sys_time_h=${ac_cv_header_sys_time_h='yes'}
ac_cv_header_sys_times_h=${ac_cv_header_sys_times_h='yes'}
ac_cv_header_sys_types_h=${ac_cv_header_sys_types_h='yes'}
ac_cv_header_sys_wait_h=${ac_cv_header_sys_wait_h='yes'}
ac_cv_header_termcap_h=${ac_cv_header_termcap_h='yes'}
ac_cv_header_termio_h=${ac_cv_header_termio_h='yes'}
ac_cv_header_termios_h=${ac_cv_header_termios_h='yes'}
ac_cv_header_time=${ac_cv_header_time='yes'}
ac_cv_header_unistd_h=${ac_cv_header_unistd_h='yes'}
ac_cv_header_varargs_h=${ac_cv_header_varargs_h='yes'}
ac_cv_host=${ac_cv_host='i686-pc-cygwin'}
ac_cv_host_alias=${ac_cv_host_alias='i686-pc-cygwin'}
ac_cv_lib_dir_opendir=${ac_cv_lib_dir_opendir='no'}
ac_cv_lib_dl_dlopen=${ac_cv_lib_dl_dlopen='no'}
ac_cv_lib_intl_bindtextdomain=${ac_cv_lib_intl_bindtextdomain='yes'}
ac_cv_lib_termcap_tgetent=${ac_cv_lib_termcap_tgetent='yes'}
ac_cv_member_struct_stat_st_blocks=${ac_cv_member_struct_stat_st_blocks='yes'}
ac_cv_member_struct_termio_c_line=${ac_cv_member_struct_termio_c_line='yes'}
ac_cv_member_struct_termios_c_line=${ac_cv_member_struct_termios_c_line='yes'}
ac_cv_objext=${ac_cv_objext='o'}
ac_cv_path_install=${ac_cv_path_install='/usr/bin/install -c'}
ac_cv_prog_AR=${ac_cv_prog_AR='ar'}
ac_cv_prog_CPP=${ac_cv_prog_CPP='gcc -E'}
ac_cv_prog_YACC=${ac_cv_prog_YACC='bison -y'}
ac_cv_prog_ac_ct_CC=${ac_cv_prog_ac_ct_CC='gcc'}
ac_cv_prog_ac_ct_RANLIB=${ac_cv_prog_ac_ct_RANLIB='ranlib'}
ac_cv_prog_cc_g=${ac_cv_prog_cc_g='yes'}
ac_cv_prog_cc_stdc=${ac_cv_prog_cc_stdc=''}
ac_cv_prog_gcc_traditional=${ac_cv_prog_gcc_traditional='no'}
ac_cv_prog_make_make_set=${ac_cv_prog_make_make_set='yes'}
ac_cv_sizeof_char=${ac_cv_sizeof_char='1'}
ac_cv_sizeof_char_p=${ac_cv_sizeof_char_p='4'}
ac_cv_sizeof_double=${ac_cv_sizeof_double='8'}
ac_cv_sizeof_int=${ac_cv_sizeof_int='4'}
ac_cv_sizeof_long=${ac_cv_sizeof_long='4'}
ac_cv_sizeof_double=${ac_cv_sizeof_double='8'}
bash_cv_dup2_broken=${bash_cv_dup2_broken='no'}
bash_cv_pgrp_pipe=${bash_cv_pgrp_pipe='no'}
bash_cv_type_rlimit=${bash_cv_type_rlimit='long'}
bash_cv_decl_under_sys_siglist=${bash_cv_decl_under_sys_siglist='no'}
bash_cv_under_sys_siglist=${bash_cv_under_sys_siglist='no'}
bash_cv_sys_siglist=${bash_cv_sys_siglist='no'}
bash_cv_opendir_not_robust=${bash_cv_opendir_not_robust='no'}
bash_cv_getenv_redef=${bash_cv_getenv_redef='yes'}
bash_cv_printf_declared=${bash_cv_printf_declared='yes'}
bash_cv_ulimit_maxfds=${bash_cv_ulimit_maxfds='no'}
bash_cv_getcwd_calls_popen=${bash_cv_getcwd_calls_popen='no'}
bash_cv_must_reinstall_sighandlers=${bash_cv_must_reinstall_sighandlers='no'}
bash_cv_job_control_missing=${bash_cv_job_control_missing='present'}
bash_cv_sys_named_pipes=${bash_cv_sys_named_pipes='missing'}
bash_cv_func_sigsetjmp=${bash_cv_func_sigsetjmp='missing'}
bash_cv_mail_dir=${bash_cv_mail_dir='unknown'}
bash_cv_func_strcoll_broken=${bash_cv_func_strcoll_broken='no'}
bash_cv_type_int32_t=${bash_cv_type_int32_t='int'}
bash_cv_type_u_int32_t=${bash_cv_type_u_int32_t='int'}
ac_cv_sizeof_long_long=${ac_cv_sizeof_long_long='8'}
ac_cv_sizeof_short=${ac_cv_sizeof_short='2'}
ac_cv_sys_file_offset_bits=${ac_cv_sys_file_offset_bits='no'}
ac_cv_sys_interpreter=${ac_cv_sys_interpreter='yes'}
ac_cv_sys_large_files=${ac_cv_sys_large_files='no'}
ac_cv_sys_largefile_CC=${ac_cv_sys_largefile_CC='no'}
ac_cv_sys_posix_termios=${ac_cv_sys_posix_termios='yes'}
ac_cv_sys_tiocgwinsz_in_termios_h=${ac_cv_sys_tiocgwinsz_in_termios_h='yes'}
ac_cv_type_bits16_t=${ac_cv_type_bits16_t='no'}
ac_cv_type_bits32_t=${ac_cv_type_bits32_t='no'}
ac_cv_type_bits64_t=${ac_cv_type_bits64_t='no'}
ac_cv_type_char=${ac_cv_type_char='yes'}
ac_cv_type_char_p=${ac_cv_type_char_p='yes'}
ac_cv_type_double=${ac_cv_type_double='yes'}
ac_cv_type_getgroups=${ac_cv_type_getgroups='gid_t'}
ac_cv_type_int=${ac_cv_type_int='yes'}
ac_cv_type_long=${ac_cv_type_long='yes'}
ac_cv_type_long_long=${ac_cv_type_long_long='yes'}
ac_cv_type_mode_t=${ac_cv_type_mode_t='yes'}
ac_cv_type_off_t=${ac_cv_type_off_t='yes'}
ac_cv_type_pid_t=${ac_cv_type_pid_t='yes'}
ac_cv_type_ptrdiff_t=${ac_cv_type_ptrdiff_t='yes'}
ac_cv_type_short=${ac_cv_type_short='yes'}
ac_cv_type_signal=${ac_cv_type_signal='void'}
ac_cv_type_size_t=${ac_cv_type_size_t='yes'}
ac_cv_type_ssize_t=${ac_cv_type_ssize_t='yes'}
ac_cv_type_time_t=${ac_cv_type_time_t='yes'}
ac_cv_type_u_bits16_t=${ac_cv_type_u_bits16_t='no'}
ac_cv_type_u_bits32_t=${ac_cv_type_u_bits32_t='no'}
ac_cv_type_u_int=${ac_cv_type_u_int='yes'}
ac_cv_type_u_long=${ac_cv_type_u_long='yes'}
ac_cv_type_uid_t=${ac_cv_type_uid_t='yes'}
ac_cv_working_alloca_h=${ac_cv_working_alloca_h='no'}
# end of cross-build/cygwin32.cache
bash_cv_decl_strtoimax=${bash_cv_decl_strtoimax='no'}
bash_cv_decl_strtol=${bash_cv_decl_strtol='yes'}
bash_cv_decl_strtoll=${bash_cv_decl_strtoll='no'}
bash_cv_decl_strtoul=${bash_cv_decl_strtoul='yes'}
bash_cv_decl_strtoull=${bash_cv_decl_strtoull='no'}
bash_cv_decl_strtoumax=${bash_cv_decl_strtoumax='no'}
bash_cv_decl_under_sys_siglist=${bash_cv_decl_under_sys_siglist='no'}
bash_cv_dev_fd=${bash_cv_dev_fd='absent'}
bash_cv_dev_stdin=${bash_cv_dev_stdin='absent'}
bash_cv_dirent_has_d_fileno=${bash_cv_dirent_has_d_fileno='no'}
bash_cv_dirent_has_dino=${bash_cv_dirent_has_dino='yes'}
bash_cv_dup2_broken=${bash_cv_dup2_broken='no'}
bash_cv_fionread_in_ioctl=${bash_cv_fionread_in_ioctl='no'}
bash_cv_func_sigsetjmp=${bash_cv_func_sigsetjmp='present'}
bash_cv_func_strcoll_broken=${bash_cv_func_strcoll_broken='no'}
bash_cv_getenv_redef=${bash_cv_getenv_redef='yes'}
bash_cv_getpw_declared=${bash_cv_getpw_declared='yes'}
bash_cv_have_strsignal=${bash_cv_have_strsignal='yes'}
bash_cv_job_control_missing=${bash_cv_job_control_missing='present'}
bash_cv_mail_dir=${bash_cv_mail_dir='unknown'}
bash_cv_must_reinstall_sighandlers=${bash_cv_must_reinstall_sighandlers='no'}
bash_cv_opendir_not_robust=${bash_cv_opendir_not_robust='no'}
bash_cv_pgrp_pipe=${bash_cv_pgrp_pipe='no'}
bash_cv_printf_a_format=${bash_cv_printf_a_format='no'}
bash_cv_signal_vintage=${bash_cv_signal_vintage='posix'}
bash_cv_speed_t_in_sys_types=${bash_cv_speed_t_in_sys_types='no'}
bash_cv_struct_timeval=${bash_cv_struct_timeval='yes'}
bash_cv_struct_winsize_header=${bash_cv_struct_winsize_header='termios_h'}
bash_cv_sys_errlist=${bash_cv_sys_errlist='no'}
bash_cv_sys_named_pipes=${bash_cv_sys_named_pipes='present'}
bash_cv_sys_siglist=${bash_cv_sys_siglist='no'}
bash_cv_termcap_lib=${bash_cv_termcap_lib='libtermcap'}
bash_cv_tiocstat_in_ioctl=${bash_cv_tiocstat_in_ioctl='no'}
bash_cv_type_clock_t=${bash_cv_type_clock_t='yes'}
bash_cv_type_intmax_t=${bash_cv_type_intmax_t='no'}
bash_cv_type_long_long=${bash_cv_type_long_long='long long'}
bash_cv_type_quad_t=${bash_cv_type_quad_t='no'}
bash_cv_type_rlimit=${bash_cv_type_rlimit='rlim_t'}
bash_cv_type_sigset_t=${bash_cv_type_sigset_t='yes'}
bash_cv_type_socklen_t=${bash_cv_type_socklen_t='no'}
bash_cv_type_uintmax_t=${bash_cv_type_uintmax_t='no'}
bash_cv_type_unsigned_long_long=${bash_cv_type_unsigned_long_long='unsigned long long'}
bash_cv_ulimit_maxfds=${bash_cv_ulimit_maxfds='no'}
bash_cv_under_sys_siglist=${bash_cv_under_sys_siglist='no'}
bash_cv_unusable_rtsigs=${bash_cv_unusable_rtsigs='no'}
bash_cv_void_sighandler=${bash_cv_void_sighandler='yes'}

View File

@ -102,7 +102,7 @@ ac_cv_lib_dir_opendir=${ac_cv_lib_dir_opendir=no}
ac_cv_lib_dl_dlopen=${ac_cv_lib_dl_dlopen=no}
ac_cv_lib_intl_bindtextdomain=${ac_cv_lib_intl_bindtextdomain=no}
ac_cv_lib_termcap_tgetent=${ac_cv_lib_termcap_tgetent=yes}
ac_cv_path_install=${ac_cv_path_install='//C/OpenNT21b3/bin/install -c'}
ac_cv_path_install=${ac_cv_path_install='$INTERIX_ROOT/bin/install -c'}
ac_cv_prog_AR=${ac_cv_prog_AR=ar}
ac_cv_prog_CC=${ac_cv_prog_CC=gcc}
ac_cv_prog_CPP=${ac_cv_prog_CPP='cc -E'}

View File

@ -1,5 +1,5 @@
/* This file is used when cross-compiling for the CYGWIN32 environment on
a Unix machine. */
a Unix machine. It gets copied to signames.h in the build directory. */
#include <sys/types.h>
#include <signal.h>
@ -11,7 +11,7 @@
labelled initializers to set up the array. Note that some entries
might wind up being NULL. */
char *signal_names[NSIG + 2] = {
char *signal_names[NSIG + 3] = {
[0] "EXIT",
#ifdef SIGLOST
@ -250,5 +250,7 @@ char *signal_names[NSIG + 2] = {
[NSIG] "DEBUG",
[NSIG + 1] (char *)0x0
[NSIG + 1] "ERR",
[NSIG + 2] (char *)0x0
};

229
doc/FAQ
View File

@ -1,4 +1,4 @@
This is the Bash FAQ, version 3.11, for Bash version 2.05.
This is the Bash FAQ, version 3.17, for Bash version 2.05a.
This document contains a set of frequently-asked questions concerning
Bash, the GNU Bourne-Again Shell. Bash is a freely-available command
@ -36,8 +36,8 @@ A10) What is the bash `posix mode'?
Section B: The latest version
B1) What's new in version 2.05?
B2) Are there any user-visible incompatibilities between bash-2.05 and
B1) What's new in version 2.05a?
B2) Are there any user-visible incompatibilities between bash-2.05a and
bash-1.14.7?
Section C: Differences from other Unix shells
@ -134,22 +134,23 @@ of Case Western Reserve University.
A2) What's the latest version?
The latest version is 2.05, first made available on Monday, 9 April 2001.
The latest version is 2.05a, first made available on Thursday, 15
November, 2001.
A3) Where can I get it?
Bash is the GNU project's shell, and so is available from the
master GNU archive site, ftp.gnu.org, and its mirrors. The
latest version is also available for FTP from ftp.cwru.edu.
The following URLs tell how to get version 2.05:
The following URLs tell how to get version 2.05a:
ftp://ftp.gnu.org/pub/gnu/bash/bash-2.05.tar.gz
ftp://ftp.cwru.edu/pub/bash/bash-2.05.tar.gz
ftp://ftp.gnu.org/pub/gnu/bash/bash-2.05a.tar.gz
ftp://ftp.cwru.edu/pub/bash/bash-2.05a.tar.gz
Formatted versions of the documentation are available with the URLs:
ftp://ftp.gnu.org/pub/gnu/bash/bash-doc-2.05.tar.gz
ftp://ftp.cwru.edu/pub/bash/bash-doc-2.05.tar.gz
ftp://ftp.gnu.org/pub/gnu/bash/bash-doc-2.05a.tar.gz
ftp://ftp.cwru.edu/pub/bash/bash-doc-2.05a.tar.gz
A4) On what machines will bash run?
@ -161,13 +162,17 @@ itself accordingly, using a script created by GNU autoconf.
More information appears in the file `INSTALL' in the distribution.
The Bash web page (http://cnswww.cns.cwru.edu/~chet/bash/bashtop.html)
explains how to obtain binary versions of bash for most of the major
commercial Unix systems.
A5) Will bash run on operating systems other than Unix?
Configuration specifics for Unix-like systems such as QNX and
LynxOS are included in the distribution. Bash-2.05 should
compile and run on Minix 2.0 (patches were contributed), but I
don't believe anyone has built bash-2.x on earlier Minix versions
yet.
LynxOS are included in the distribution. Bash-2.05 and later
versions should compile and run on Minix 2.0 (patches were
contributed), but I don't believe anyone has built bash-2.x on
earlier Minix versions yet.
Bash has been ported to versions of Windows implementing the Win32
programming interface. This includes Windows 95 and Windows NT.
@ -179,10 +184,10 @@ http://sourceware.cygnus.com/cygwin
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 a
port of bash-2.04 to the CYGWIN environment, and it is available as
port of bash-2.05 to the CYGWIN environment, and it is available as
part of their current release.
Bash-2.05 should require no local Cygnus changes to build and run under
Bash-2.05a should require no local Cygnus changes to build and run under
CYGWIN.
The Cygnus port works only on Intel machines. There is a port of bash
@ -190,30 +195,21 @@ The Cygnus port works only on Intel machines. There is a port of bash
ftp://ftp.gnustep.org//pub/win32/bash-alpha-nt-1.01.tar.gz
DJ Delorie has a port of bash-1.14.7 which runs under MS-DOS, as part
DJ Delorie has a port of bash-2.x which runs under MS-DOS, as part
of the DJGPP project. For more information on the project, see
http://www.delorie.com/djgpp/
I have been told that the original DJGPP port was done by Daisuke Aoyama.
I picked up a binary of bash-1.14.7 that is purported to work with
the DJGPP V2 environment from
Mark Elbrecht <snowball3@bigfoot.com> has sent me notice that bash-2.04
is available for DJGPP V2. The files are available as:
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/bsh1147b.zip
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/bsh204b.zip binary
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/bsh204d.zip documentation
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/bsh204s.zip source
The corresponding source is
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/bsh1147s.zip
Mark Elbrecht <snowball3@bigfoot.com> has sent me notice that bash-2.03
has become available for DJGPP V2. The files are available as:
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/bsh203b.zip binary
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/bsh203d.zip documentation
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/bsh203s.zip source
Mark has begun to work with bash-2.04.
Mark has begun to work with bash-2.05, but I don't know the status.
Ports of bash-1.12 and bash-2.0 are available for OS/2 from
@ -285,8 +281,9 @@ slightly different.
If you cannot change your login shell in the password file to bash, you
will have to (apparently) live with CDE using the shell in the password
file to run its startup scripts. If you have changed your shell to bash,
there is code in the CDE startup files (on Solaris, at least) to do the
right thing.
there is code in the CDE startup files (on Solaris, at least) that attempts
to do the right thing. It is, however, often broken, and may require that
you use the $BASH_ENV trick described below.
`dtterm' claims to use $SHELL as the default program to start, so if you
can change $SHELL in the CDE startup files, you should be able to use bash
@ -304,6 +301,16 @@ CDE by testing the value of the DT variable:
[ -f /usr/gnu/bin/bash ] && exec /usr/gnu/bin/bash --login
fi
If CDE starts its shells non-interactively during login, the login shell
startup files (~/.profile, ~/.bash_profile) will not be sourced at login.
To get around this problem, append a line similar to the following to your
~/.dtprofile:
BASH_ENV=${HOME}/.bash_profile ; export BASH_ENV
and add the following line to the beginning of ~/.bash_profile:
unset BASH_ENV
A8) I just changed my login shell to bash, and now I can't FTP into my
machine. Why not?
@ -350,6 +357,12 @@ line editing. Only vi-style line editing commands have been
standardized; emacs editing commands were left out due to
objections.
The Open Group has made an older version of its Single Unix
Specification (version 2), which is very similar to POSIX.2,
available on the web at
http://www.opengroup.org/onlinepubs/007908799/
A10) What is the bash `posix mode'?
Although bash is an implementation of the POSIX.2 shell
@ -367,12 +380,48 @@ Reference Manual.
Section B: The latest version
B1) What's new in version 2.05?
B1) What's new in version 2.05a?
Bash-2.05 contains the following new features (see the manual page for
complete descriptions and the CHANGES and NEWS files in the bash-2.05
The raison d'etre for bash-2.05a is to make an intermediate release
containing principally bug fixes (some very good work was done and
contributed after bash-2.05 was released) available before I start to
work on the major new features to be available in the next release
(bash-2.06 or bash-3.0 or whatever I tag it). As such, there are
only a few relatively minor new features.
Bash-2.05a contains the following new features (see the manual page for
complete descriptions and the CHANGES and NEWS files in the bash-2.05a
distribution):
o The `printf' builtin has undergone major work
o There is a new read-only `shopt' option: login_shell, which is set by
login shells and unset otherwise
o New `\A' prompt string escape sequence; expanding to time in 24-hour
HH:MM format
o New `-A group/-g' option to complete and compgen; goes group name
completion
o New [+-]O invocation option to set and unset `shopt' options at startup
o ksh-like `ERR' trap
o `for' loops now allow empty word lists after the `in' reserved word
o new `hard' and `soft' arguments for the `ulimit' builtin
o Readline can be configured to place the user at the same point on the line
when retrieving commands from the history list
o Readline can be configured to skip `hidden' files (filenames with a leading
`.' on Unix) when performing completion
A short feature history dating from bash-2.0:
Bash-2.05 introduced the following new features:
o This version has once again reverted to using locales and strcoll(3) when
processing pattern matching bracket expressions, as POSIX requires.
o Added a new `--init-file' invocation argument as a synonym for `--rcfile',
@ -396,8 +445,6 @@ o When `set' is called without options, it prints function defintions in a
`declare -p' as well. This only happens when the shell is not in POSIX
mode, since POSIX.2 forbids this behavior.
A short feature history dating from bash-2.0:
Bash-2.04 introduced the following new features:
o Programmable word completion with the new `complete' and `compgen' builtins;
@ -523,11 +570,13 @@ grammar tighter and smaller (66 reduce-reduce conflicts gone)
lots of code now smaller and faster
test suite greatly expanded
B2) Are there any user-visible incompatibilities between bash-2.05 and
B2) Are there any user-visible incompatibilities between bash-2.05a and
bash-1.14.7?
There are a few incompatibilities between version 1.14.7 and version 2.05.
They are detailed in the file COMPAT in the bash-2.05 distribution.
There are a few incompatibilities between version 1.14.7 and version 2.05a.
They are detailed in the file COMPAT in the bash-2.05a distribution. That
file is not meant to be all-encompassing; send mail to bash-maintainers@gnu.org
if you find something that's not mentioned there.
Section C: Differences from other Unix shells
@ -539,6 +588,7 @@ completely.
Things bash has that sh does not:
long invocation options
[+-]O invocation option
`!' reserved word to invert pipeline return value
`time' reserved word to time pipelines and shell builtins
the `function' reserved word
@ -564,13 +614,14 @@ Things bash has that sh does not:
SHELLOPTS, OPTERR, HOSTFILE, TMOUT, FUNCNAME, histchars,
auto_resume
DEBUG trap
ERR trap
variable arrays with new compound assignment syntax
redirections: <>, &>, >|
prompt string special char translation and variable expansion
auto-export of variables in initial environment
command search finds functions before builtins
bash return builtin will exit a file sourced with `.'
builtins: cd -/-L/-P, exec -l/-c/-a, echo -e/-E, hash -p.
builtins: cd -/-L/-P, exec -l/-c/-a, echo -e/-E, hash -p/-t.
export -n/-f/-p/name=value, pwd -L/-P,
read -e/-p/-a/-t/-n/-d/-s,
readonly -a/-f/name=value, trap -l, set +o,
@ -638,6 +689,7 @@ C2) How does bash differ from the Korn shell, version ksh88?
Things bash has or uses that ksh88 does not:
long invocation options
[-+]O invocation option
`!' reserved word
arithmetic for command: for ((expr1 ; expr2; expr3 )); do list; done
posix mode and posix conformance
@ -674,11 +726,11 @@ Things bash has or uses that ksh88 does not:
case-insensitive pattern matching and globbing
`**' arithmetic operator to do exponentiation
redirection to /dev/fd/N, /dev/stdin, /dev/stdout, /dev/stderr
arrays of unlimited size
Things ksh88 has or uses that bash does not:
tracked aliases
tracked aliases (alias -t)
variables: ERRNO, FPATH, EDITOR, VISUAL
trap on ERR
co-processes (|&, >&p, <&p)
weirdly-scoped functions
typeset +f to list all function names without definitions
@ -686,7 +738,10 @@ Things ksh88 has or uses that bash does not:
builtins: alias -x, cd old new, fc -e -, newgrp, print,
read -p/-s/-u/var?prompt, set -A/-o gmacs/
-o bgnice/-o markdirs/-o nolog/-o trackall/-o viraw/-s,
typeset -H/-L/-R/-A/-ft/-fu/-fx/-l/-u/-t, whence
typeset -H/-L/-R/-Z/-A/-ft/-fu/-fx/-l/-u/-t, whence
using environment to pass attributes of exported variables
arithmetic evaluation done on arguments to some builtins
reads .profile from $PWD when invoked as login shell
Implementation differences:
ksh runs last command of a pipeline in parent shell context
@ -694,12 +749,14 @@ Implementation differences:
bash has fixed startup file for all interactive shells; ksh reads $ENV
bash has exported functions
bash command search finds functions before builtins
bash waits for all commands in pipeline to exit before returning status
emacs-mode editing has some slightly different key bindings
C3) Which new features in ksh-93 are not in bash, and which are?
New things in ksh-93 not in bash-2.05:
New things in ksh-93 not in bash-2.05a:
associative arrays
floating point arithmetic
floating point arithmetic and variables
math library functions
${!name[sub]} name of subscript for associative array
`.' is allowed in variable names to create a hierarchical namespace
@ -709,13 +766,24 @@ New things in ksh-93 not in bash-2.05:
typeset -n and `nameref' variables
KEYBD trap
variables: .sh.edchar, .sh.edmode, .sh.edcol, .sh.edtext, .sh.version,
.sh.name, .sh.subscript, .sh.value, HISTEDIT
backreferences in pattern matching
.sh.name, .sh.subscript, .sh.value, .sh.match, HISTEDIT
backreferences in pattern matching (\N)
`&' operator in pattern lists for matching
print -f (bash uses printf)
`fc' has been renamed to `hist'
`.' can execute shell functions
exit statuses between 0 and 255
set -o pipefail
`+=' variable assignment operator
TMOUT is default timeout for `read' and `select'
<&N- and >&N- redirections (combination dup and close)
FPATH and PATH mixing
getopts -a
-I invocation option
DEBUG trap now executed before each simple command, instead of after
printf %H, %P, %T, %Z modifiers, output base for %d
New things in ksh-93 present in bash-2.04:
New things in ksh-93 present in bash-2.05a:
for (( expr1; expr2; expr3 )) ; do list; done - arithmetic for command
?:, ++, --, `expr1 , expr2' arithmetic operators
expansions: ${!param}, ${param:offset[:len]}, ${param/pat[/str]},
@ -1041,6 +1109,16 @@ this.
This is the general approach -- in most cases you will not need to
set $IFS to a different value.
Some other user-supplied alternatives include:
read A B C D << HERE
$(IFS=.; echo $(/usr/local/bin/ipaddr))
HERE
and, where process substitution is available,
read A B C D < <(IFS=.; echo $(/usr/local/bin/ipaddr))
E5) I have a bunch of shell scripts that use backslash-escaped characters
in arguments to `echo'. Bash doesn't interpret these characters. Why
not, and how can I make it understand them?
@ -1057,7 +1135,7 @@ them.
There is a configuration option that will make bash behave like
the System V echo and interpret things like `\t' by default. Run
configure with the --enable-usg-echo-default option to turn this
configure with the --enable-xpg-echo-default option to turn this
on. Be aware that this will cause some of the tests run when you
type `make tests' to fail.
@ -1101,11 +1179,12 @@ bash:
( cd $d && ${MAKE} ${MFLAGS} clean )
done
This is a syntax error. If the reserved word `in' is present, a word must
follow it before the semicolon or newline. The language in the manual page
referring to the list of words being empty refers to the list after it is
expanded. There must be at least one word following the `in' when the
construct is parsed.
In versions of bash before bash-2.05a, this was a syntax error. If the
reserved word `in' was present, a word must follow it before the semicolon
or newline. The language in the manual page referring to the list of words
being empty referred to the list after it is expanded. These versions of
bash required that there be at least one word following the `in' when the
construct was parsed.
The idiomatic Makefile solution is something like:
@ -1116,11 +1195,9 @@ subdirs-clean:
( cd $$d && ${MAKE} ${MFLAGS} clean ) \
done
The POSIX.2 interpretation committee has considered this issue and declared
that the bash implemenation is correct, according to the standard:
http://www.pasc.org/interps/unofficial/db/p1003.2/pasc-1003.2-169.html
The latest drafts of the updated POSIX standard have changed this: the
word list is no longer required. Bash versions 2.05a and later accept
the new syntax.
E8) Why does the arithmetic evaluation code complain about `08'?
@ -1143,11 +1220,12 @@ honoring the current locale setting when processing ranges within pattern
matching bracket expressions ([A-Z]). This is what POSIX.2 and SUSv2/XPG5
specify.
The behavior of the matcher in bash-2.05 depends on the current LC_COLLATE
setting. Setting this variable to `C' or `POSIX' will result in the
traditional behavior ([A-Z] matches all uppercase ASCII characters).
Many other locales, including the en_US locale (the default on many US
versions of Linux) collate the upper and lower case letters like this:
The behavior of the matcher in bash-2.05 and later versions depends on the
current LC_COLLATE setting. Setting this variable to `C' or `POSIX' will
result in the traditional behavior ([A-Z] matches all uppercase ASCII
characters). Many other locales, including the en_US locale (the default
on many US versions of Linux) collate the upper and lower case letters like
this:
AaBb...Zz
@ -1279,7 +1357,7 @@ comp.unix.shell). While most commands of the form
can be converted to `< file command', shell control structures such as
loops and subshells require `command < file'.
The file CWRU/sh-redir-hack in the bash-2.05 distribution is an
The file CWRU/sh-redir-hack in the bash-2.05a distribution is an
(unofficial) patch to parse.y that will modify the grammar to
support this construct. It will not apply with `patch'; you must
modify parse.y by hand. Note that if you apply this, you must
@ -1396,6 +1474,9 @@ before `eval' is executed. In versions of bash later than bash-2.0,
does the same thing.
This is not the same thing as ksh93 `nameref' variables, though the syntax
is similar. I may add namerefs in a future bash version.
G4) How can I make the bash `time' reserved word print timing output that
looks like the output from my system's /usr/bin/time?
@ -1524,14 +1605,14 @@ or on the web.
H3) What's coming in future versions?
These are features I plan to include in a future version of bash.
These are features I hope to include in a future version of bash.
a bash debugger (a minimally-tested version is included with bash-2.05)
a better bash debugger (a minimally-tested version is included with bash-2.05a)
associative arrays
changes to the DEBUG trap to be compatible with ksh93 (which runs the
trap before each simple command, instead of after each one like previous
versions)
an implementation of the ksh-like ERR trap
co-processes, but with a new-style syntax that looks like function declaration
H4) What's on the bash `wish list' for future versions?
@ -1545,11 +1626,15 @@ date-stamped command history
a bash programmer's guide with a chapter on creating loadable builtins
a better loadable interface to perl with access to the shell builtins and
variables (contributions gratefully accepted)
ksh93-like `nameref' variables
ksh93-like `+=' variable assignment operator
ksh93-like `xx.yy' variables (including some of the .sh.* variables) and
associated disipline functions
Some of the new ksh93 pattern matching operators, like backreferencing
H5) When will the next release appear?
The next version will appear sometime in 2001 or 2002. Never make
predictions.
The next version will appear sometime in 2002. Never make predictions.
This document is Copyright 1995-2001 by Chester Ramey.

View File

@ -32,13 +32,16 @@ infodir = @infodir@
# set this to a directory name to have the HTML files installed
htmldir = @htmldir@
# Support an alternate destination root directory for package building
DESTDIR =
mandir = @mandir@
manpfx = man
man1ext = 1
man1dir = $(mandir)/$(manpfx)$(man1ext)
man3ext = 3
man3dir = $(mandir)/$(manpfx)$(man3ext)
man1ext = .1
man1dir = $(mandir)/$(manpfx)1
man3ext = .3
man3dir = $(mandir)/$(manpfx)3
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
@ -167,6 +170,51 @@ article.ps: article.ms
$(MAN2HTML): ${topdir}/support/man2html.c
-( cd ${BUILD_DIR}/support ; ${MAKE} ${MFLAGS} man2html)
clean:
$(RM) *.aux *.bak *.cp *.fn *.ky *.log *.pg *.toc *.tp *.vr *.cps \
*.pgs *.bt *.bts *.rw *.rws *.fns *.kys *.tps *.vrs *.o
${RM} core *.core
distclean mostlyclean: clean
$(RM) Makefile
maintainer-clean: clean
${RM} ${PSFILES} ${DVIFILES} ${INFOFILES} ${MAN0FILES} ${HTMLFILES}
${RM} ${CREATED_FAQ}
$(RM) Makefile
installdirs:
-test -d $(man1dir) || $(SHELL) ${MKDIRS} $(DESTDIR)$(man1dir)
-test -d $(infodir) || $(SHELL) ${MKDIRS} $(DESTDIR)$(infodir)
-if test -n "$(htmldir)" ; then \
test -d $(htmldir) || $(SHELL) ${MKDIRS} $(DESTDIR)$(htmldir) ; \
fi
install: info installdirs
-$(INSTALL_DATA) $(srcdir)/bash.1 $(DESTDIR)$(man1dir)/bash${man1ext}
-$(INSTALL_DATA) $(srcdir)/bashbug.1 $(DESTDIR)$(man1dir)/bashbug${man1ext}
# uncomment the next line to install the builtins man page
# -$(INSTALL_DATA) $(srcdir)/builtins.1 $(DESTDIR)$(man1dir)/bash_builtins${man1ext}
-$(INSTALL_DATA) $(srcdir)/bashref.info $(DESTDIR)$(infodir)/bash.info
# run install-info if it is present to update the info directory
if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
install-info --dir-file=$(DESTDIR)$(infodir)/dir $(DESTDIR)$(infodir)/bash.info; \
else true; fi
# if htmldir is set, install the html files into that directory
-if test -n "${htmldir}" ; then \
$(INSTALL_DATA) $(srcdir)/bash.html $(DESTDIR)$(htmldir) ; \
$(INSTALL_DATA) $(srcdir)/bashref.html $(DESTDIR)$(htmldir) ; \
fi
uninstall:
-$(RM) $(DESTDIR)$(man1dir)/bash${man1ext} $(DESTDIR)$(man1dir)/bashbug${man1ext}
$(RM) $(DESTDIR)$(infodir)/bash.info
-if test -n "$(htmldir)" ; then \
$(RM) $(DESTDIR)$(htmldir)/bash.html ; \
$(RM) $(DESTDIR)$(htmldir)/bashref.html ; \
fi
# for use by chet
CREATED_FAQ = faq.news faq.news2 faq.mail faq.version
faq: ${CREATED_FAQ}
@ -195,51 +243,6 @@ faq.mail: FAQ faq.headers.mail faq.version
$(RM) $@
cat faq.headers.mail faq.version FAQ > $@
clean:
$(RM) *.aux *.bak *.cp *.fn *.ky *.log *.pg *.toc *.tp *.vr *.cps \
*.pgs *.bt *.bts *.rw *.rws *.fns *.kys *.tps *.vrs *.o
${RM} core *.core
distclean mostlyclean: clean
$(RM) Makefile
maintainer-clean: clean
${RM} ${PSFILES} ${DVIFILES} ${INFOFILES} ${MAN0FILES} ${HTMLFILES}
${RM} ${CREATED_FAQ}
$(RM) Makefile
installdirs:
-test -d $(man1dir) || $(SHELL) ${MKDIRS} $(man1dir)
-test -d $(infodir) || $(SHELL) ${MKDIRS} $(infodir)
-if [ -n "$(htmldir)" ]; then \
test -d $(htmldir) || $(SHELL) ${MKDIRS} $(htmldir) ; \
fi
install: info installdirs
-$(INSTALL_DATA) $(srcdir)/bash.1 $(man1dir)/bash.${man1ext}
-$(INSTALL_DATA) $(srcdir)/bashbug.1 $(man1dir)/bashbug.${man1ext}
# uncomment the next line to install the builtins man page
# $(INSTALL_DATA) $(srcdir)/builtins.1 $(man1dir)/bash_builtins.${man1ext}
-$(INSTALL_DATA) $(srcdir)/bashref.info $(infodir)/bash.info
# run install-info if it is present to update the info directory
if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
install-info --dir-file=$(infodir)/dir $(infodir)/bash.info; \
else true; fi
# if htmldir is set, install the html files into that directory
-if [ -n "${htmldir}" ]; then \
$(INSTALL_DATA) $(srcdir)/bash.html $(htmldir) ; \
$(INSTALL_DATA) $(srcdir)/bashref.html $(htmldir) ; \
fi
uninstall:
-$(RM) $(man1dir)/bash.${man1ext} $(man1dir)/bashbug.${man1ext}
$(RM) $(infodir)/bash.info
-if [ -n "$(htmldir)" ]; then \
$(RM) $(htmldir)/bash.html ; \
$(RM) $(htmldir)/bashref.html ; \
fi
# for use by chet
inst: bashref.texi
$(SHELL) ./mkinstall
cmp -s INSTALL ../INSTALL || mv INSTALL ../INSTALL

1135
doc/bash.1

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -5,13 +5,13 @@
@c %**end of header
@ignore
Last Change: Wed Mar 28 14:48:38 EST 2001
Last Change: Tue Nov 13 12:48:51 EST 2001
@end ignore
@set EDITION 2.5
@set VERSION 2.05
@set UPDATED 28 Mar 2001
@set UPDATE-MONTH Mar 2001
@set EDITION 2.5a
@set VERSION 2.05a
@set UPDATED 13 November 2001
@set UPDATE-MONTH November 2001
@iftex
@finalout
@ -36,7 +36,7 @@ This is Edition @value{EDITION}, last updated @value{UPDATED},
of @cite{The GNU Bash Reference Manual},
for @code{Bash}, Version @value{VERSION}.
Copyright (C) 1991-1999 Free Software Foundation, Inc.
Copyright (C) 1991-2001 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@ -267,7 +267,8 @@ or one of the following:
@item exit status
@cindex exit status
The value returned by a command to its caller.
The value returned by a command to its caller. The value is restricted
to eight bits, so the maximum value is 255.
@item field
@cindex field
@ -542,11 +543,11 @@ backslash
@item \'
single quote
@item \@var{nnn}
the character whose @code{ASCII} code is the octal value @var{nnn}
(one to three digits)
@item \x@var{nnn}
the character whose @code{ASCII} code is the hexadecimal value @var{nnn}
the eight-bit character whose value is the octal value @var{nnn}
(one to three digits)
@item \x@var{HH}
the eight-bit character whose value is the hexadecimal value @var{HH}
(one or two hex digits)
@end table
@noindent
@ -556,6 +557,9 @@ been present.
@node Locale Translation
@subsubsection Locale-Specific Translation
@cindex localization
@cindex internationalization
@cindex native languages
@cindex translation, native languages
A double-quoted string preceded by a dollar sign (@samp{$}) will cause
the string to be translated according to the current locale.
@ -564,12 +568,17 @@ is ignored.
If the string is translated and replaced, the replacement is
double-quoted.
@vindex LC_MESSAGES
@vindex TEXTDOMAIN
@vindex TEXTDOMAINDIR
Some systems use the message catalog selected by the @env{LC_MESSAGES}
shell variable. Others create the name of the message catalog from the
value of the @env{TEXTDOMAIN} shell variable, possibly adding a
suffix of @samp{.mo}. If you use the @env{TEXTDOMAIN} variable, you
may need to set the @env{TEXTDOMAINDIR} variable to the location of
the message catalog files.
the message catalog files. Still others use both variables in this
fashion:
@env{TEXTDOMAINDIR}/@env{LC_MESSAGES}/LC_MESSAGES/@env{TEXTDOMAIN}.mo.
@node Comments
@subsection Comments
@ -640,9 +649,9 @@ The format for a pipeline is
@end example
@noindent
The output of each command in the pipeline is connected to the input of
the next command. That is, each command reads the previous command's
output.
The output of each command in the pipeline is connected via a pipe
to the input of the next command.
That is, each command reads the previous command's output.
The reserved word @code{time} causes timing statistics
to be printed for the pipeline once it finishes.
@ -891,7 +900,7 @@ Any other value read causes @var{name} to be set to null.
The line read is saved in the variable @env{REPLY}.
The @var{commands} are executed after each selection until a
@code{break} or @code{return} command is executed, at which
@code{break} command is executed, at which
point the @code{select} command completes.
Here is an example that allows the user to pick a filename from the
@ -1063,7 +1072,7 @@ call. When a function completes, the values of the
positional parameters and the special parameter @samp{#}
are restored to the values they had prior to the function's
execution. If a numeric argument is given to @code{return},
that is the function's return status; otherwise the functions's
that is the function's return status; otherwise the function's
return status is the exit status of the last command executed
before the @code{return}.
@ -1090,6 +1099,9 @@ It can be a @code{name}, a number, or one of the special characters
listed below.
For the shell's purposes, a @var{variable} is a parameter denoted by a
@code{name}.
A variable has a @var{value} and zero or more @var{attributes}.
Attributes are assigned using the @code{declare} builtin command
(see the description of the @code{declare} builtin in @ref{Bash Builtins}).
A parameter is set if it has been assigned a value. The null string is
a valid value. Once a variable is set, it may be unset only by using
@ -1105,13 +1117,15 @@ is not given, the variable is assigned the null string. All
@var{value}s undergo tilde expansion, parameter and variable expansion,
command substitution, arithmetic expansion, and quote
removal (detailed below). If the variable has its @code{integer}
attribute set (see the description of the @code{declare} builtin in
@ref{Bash Builtins}), then @var{value}
attribute set, then @var{value}
is subject to arithmetic expansion even if the @code{$((@dots{}))}
expansion is not used (@pxref{Arithmetic Expansion}).
Word splitting is not performed, with the exception
of @code{"$@@"} as explained below.
Filename expansion is not performed.
Assignment statements may also appear as arguments to the
@code{declare}, @code{typeset}, @code{export}, @code{readonly},
and @code{local} builtin commands.
@node Positional Parameters
@subsection Positional Parameters
@ -1870,13 +1884,13 @@ File descriptor 2 is duplicated.
@item /dev/tcp/@var{host}/@var{port}
If @var{host} is a valid hostname or Internet address, and @var{port}
is an integer port number, Bash attempts to open a TCP connection
to the corresponding socket.
is an integer port number or service name, Bash attempts to open a TCP
connection to the corresponding socket.
@item /dev/udp/@var{host}/@var{port}
If @var{host} is a valid hostname or Internet address, and @var{port}
is an integer port number, Bash attempts to open a UDP connection
to the corresponding socket.
is an integer port number or service name, Bash attempts to open a UDP
connection to the corresponding socket.
@end table
@ -2230,6 +2244,11 @@ commands that are invoked as part of a pipeline are also executed
in a subshell environment. Changes made to the subshell environment
cannot affect the shell's execution environment.
If a command is followed by a @samp{&} and job control is not active, the
default standard input for the command is the empty file @file{/dev/null}.
Otherwise, the invoked command inherits the file descriptors of the calling
shell as modified by redirections.
@node Environment
@subsection Environment
@cindex environment
@ -2319,8 +2338,8 @@ command substitution ignore the keyboard-generated job control signals
@code{SIGTTIN}, @code{SIGTTOU}, and @code{SIGTSTP}.
The shell exits by default upon receipt of a @code{SIGHUP}.
Before exiting, it resends the @code{SIGHUP} to all jobs, running
or stopped.
Before exiting, an interactive shell resends the @code{SIGHUP} to
all jobs, running or stopped.
Stopped jobs are sent @code{SIGCONT} to ensure that they receive
the @code{SIGHUP}.
To prevent the shell from sending the @code{SIGHUP} signal to a
@ -2351,7 +2370,11 @@ a file is used as the first non-option argument when invoking Bash,
and neither the @option{-c} nor @option{-s} option is supplied
(@pxref{Invoking Bash}),
Bash reads and executes commands from the file, then exits. This
mode of operation creates a non-interactive shell. When Bash runs
mode of operation creates a non-interactive shell. The shell first
searches for the file in the current directory, and looks in the
directories in @env{$PATH} if not found there.
When Bash runs
a shell script, it sets the special parameter @code{0} to the name
of the file, rather than the name of the shell, and the positional
parameters are set to the remaining arguments, if any are given.
@ -2614,7 +2637,7 @@ If @code{getopts} is silent, then a colon (@samp{:}) is placed in
@item hash
@btindex hash
@example
hash [-r] [-p @var{filename}] [@var{name}]
hash [-r] [-p @var{filename}] [-t] [@var{name}]
@end example
Remember the full pathnames of commands specified as @var{name} arguments,
so they need not be searched for on subsequent invocations.
@ -2623,6 +2646,10 @@ The commands are found by searching through the directories listed in
The @option{-p} option inhibits the path search, and @var{filename} is
used as the location of @var{name}.
The @option{-r} option causes the shell to forget all remembered locations.
If the @option{-t} option is supplied, the full pathname to which each
@var{name} corresponds is printed. If multiple @var{name} arguments are
supplied with @option{-t} the @var{name} is printed before the hashed
full pathname.
If no arguments are given, information about remembered commands is printed.
The return status is zero unless a @var{name} is not found or an invalid
option is supplied.
@ -2671,7 +2698,7 @@ This may also be used to terminate execution of a script being executed
with the @code{.} (or @code{source}) builtin, returning either @var{n} or
the exit status of the last command executed within the script as the exit
status of the script.
The return status is false if @code{return} is used outside a function
The return status is non-zero if @code{return} is used outside a function
and not during the execution of a script by @code{.} or @code{source}.
@item shift
@ -2795,6 +2822,12 @@ If a @var{sigspec}
is @code{0} or @code{EXIT}, @var{arg} is executed when the shell exits.
If a @var{sigspec} is @code{DEBUG}, the command @var{arg} is executed
after every simple command.
If a @var{sigspec} is @code{ERR}, the command @var{arg}
is executed whenever a simple command has a non-zero exit status.
The @code{ERR} trap is not executed if the failed command is part of an
@code{until} or @code{while} loop, part of an @code{if} statement,
part of a @code{&&} or @code{||} list, or if the command's return
status is being inverted using @code{!}.
The @option{-l} option causes the shell to print a list of signal names
and their corresponding numbers.
@ -3074,11 +3107,11 @@ vertical tab
@item \\
backslash
@item \@var{nnn}
the character whose @code{ASCII} code is the octal value @var{nnn}
(one to three digits)
@item \x@var{nnn}
the character whose @code{ASCII} code is the hexadecimal value @var{nnn}
the eight-bit character whose value is the octal value @var{nnn}
(one to three digits)
@item \x@var{HH}
the eight-bit character whose value is the hexadecimal value @var{HH}
(one or two hex digits)
@end table
@item enable
@ -3377,6 +3410,11 @@ If enabled, and the @code{cmdhist}
option is enabled, multi-line commands are saved to the history with
embedded newlines rather than using semicolon separators where possible.
@item login_shell
The shell sets this option if it is started as a login shell
(@pxref{Invoking Bash}).
The value may not be changed.
@item mailwarn
If set, and a file that Bash is checking for mail has been
accessed since the last time it was checked, the message
@ -3531,7 +3569,10 @@ The maximum amount of virtual memory available to the process.
@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;
the special @var{limit} values @code{hard}, @code{soft}, and
@code{unlimited} stand for the current hard limit, the current soft limit,
and no limit, respectively.
Otherwise, the current value of the soft limit for the specified resource
is printed, unless the @option{-H} option is supplied.
When setting new limits, if neither @option{-H} nor @option{-S} is supplied,
@ -3541,9 +3582,8 @@ increments, except for @option{-t}, which is in seconds, @option{-p},
which is in units of 512-byte blocks, and @option{-n} and @option{-u}, which
are unscaled values.
The return status is zero unless an invalid option is supplied, a
non-numeric argument other than @code{unlimited} is supplied as a
@var{limit}, or an error occurs while setting a new limit.
The return status is zero unless an invalid option or argument is supplied,
or an error occurs while setting a new limit.
@item unalias
@btindex unalias
@ -3591,6 +3631,7 @@ with a non-zero status, unless the command that fails is part of an
@code{until} or @code{while} loop, part of an @code{if} statement,
part of a @code{&&} or @code{||} list, or if the command's return
status is being inverted using @code{!}.
A trap on @code{ERR}, if set, is executed before the shell exits.
@item -f
Disable file name generation (globbing).
@ -3657,6 +3698,9 @@ Same as @code{-n}.
@item noglob
Same as @code{-f}.
@item nolog
Currently ignored.
@item notify
Same as @code{-b}.
@ -3927,11 +3971,10 @@ The value of @env{MACHTYPE}.
@end table
@item COMP_WORDS
An array variable consisting of the individual
words in the current command line.
This variable is available only in shell functions invoked by the
programmable completion facilities (@pxref{Programmable Completion}).
@item COLUMNS
Used by the @code{select} builtin command to determine the terminal width
when printing selection lists. Automatically set upon receipt of a
@code{SIGWINCH}.
@item COMP_CWORD
An index into @env{$@{COMP_WORDS@}} of the word containing the current
@ -3954,6 +3997,12 @@ This variable is available only in shell functions and external
commands invoked by the
programmable completion facilities (@pxref{Programmable Completion}).
@item COMP_WORDS
An array variable consisting of the individual
words in the current command line.
This variable is available only in shell functions invoked by the
programmable completion facilities (@pxref{Programmable Completion}).
@item COMPREPLY
An array variable from which Bash reads the possible completions
generated by a shell function invoked by the programmable completion
@ -3986,6 +4035,13 @@ A file name whose suffix matches one of the entries in
is excluded from the list of matched file names. A sample
value is @samp{.o:~}
@item FUNCNAME
The name of any currently-executing shell function.
This variable exists only when a shell function is executing.
Assignments to @env{FUNCNAME} have no effect and return an error status.
If @env{FUNCNAME} is unset, it loses its special properties, even if
it is subsequently reset.
@item GLOBIGNORE
A colon-separated list of patterns defining the set of filenames to
be ignored by filename expansion.
@ -4019,13 +4075,6 @@ The history number, or index in the history list, of the current
command. If @env{HISTCMD} is unset, it loses its special properties,
even if it is subsequently reset.
@item FUNCNAME
The name of any currently-executing shell function.
This variable exists only when a shell function is executing.
Assignments to @env{FUNCNAME} have no effect and return an error status.
If @env{FUNCNAME} is unset, it loses its special properties, even if
it is subsequently reset.
@item HISTCONTROL
A value of @samp{ignorespace} means to not enter lines which
begin with a space or tab into the history list.
@ -4038,6 +4087,18 @@ The second and subsequent lines of a multi-line compound command are
not tested, and are added to the history regardless of the value of
@env{HISTCONTROL}.
@item HISTFILE
The name of the file to which the command history is saved. The
default value is @file{~/.bash_history}.
@item HISTFILESIZE
The maximum number of lines contained in the history file. When this
variable is assigned a value, the history file is truncated, if
necessary, to contain no more than that number of lines.
The history file is also truncated to this size after
writing it when an interactive shell exits.
The default value is 500.
@item HISTIGNORE
A colon-separated list of patterns used to decide which command
lines should be saved on the history list. Each pattern is
@ -4058,22 +4119,10 @@ pattern of @samp{[ ]*} is identical to @code{ignorespace}.
Combining these two patterns, separating them with a colon,
provides the functionality of @code{ignoreboth}.
@item HISTFILE
The name of the file to which the command history is saved. The
default value is @file{~/.bash_history}.
@item HISTSIZE
The maximum number of commands to remember on the history list.
The default value is 500.
@item HISTFILESIZE
The maximum number of lines contained in the history file. When this
variable is assigned a value, the history file is truncated, if
necessary, to contain no more than that number of lines.
The history file is also truncated to this size after
writing it when an interactive shell exits.
The default value is 500.
@item HOSTFILE
Contains the name of a file in the same format as @file{/etc/hosts} that
should be read when the shell needs to complete a hostname.
@ -4133,19 +4182,14 @@ strings preceded by a @samp{$} (@pxref{Locale Translation}).
@item LC_NUMERIC
This variable determines the locale category used for number formatting.
@item LINENO
The line number in the script or shell function currently executing.
@item LINES
Used by the @code{select} builtin command to determine the column length
for printing selection lists. Automatically set upon receipt of a
@code{SIGWINCH}.
@item COLUMNS
Used by the @code{select} builtin command to determine the terminal width
when printing selection lists. Automatically set upon receipt of a
@code{SIGWINCH}.
@item LINENO
The line number in the script or shell function currently executing.
@item MACHTYPE
A string that fully describes the system type on which Bash
is executing, in the standard @sc{gnu} @var{cpu-company-system} format.
@ -4174,6 +4218,18 @@ containing a list of exit status values from the processes
in the most-recently-executed foreground pipeline (which may
contain only a single command).
@item POSIXLY_CORRECT
If this variable is in the environment when @code{bash} starts, the shell
enters @sc{posix} mode (@pxref{Bash POSIX Mode}) before reading the
startup files, as if the @option{--posix} invocation option had been supplied.
If it is set while the shell is running, @code{bash} enables @sc{posix} mode,
as if the command
@example
@code{set -o posix}
@end example
@noindent
had been executed.
@item PPID
The process @sc{id} of the shell's parent process. This variable
is readonly.
@ -4310,9 +4366,9 @@ This section describes features unique to Bash.
@section Invoking Bash
@example
bash [long-opt] [-ir] [-abefhkmnptuvxdBCDHP] [-o @var{option}] [@var{argument} @dots{}]
bash [long-opt] [-abefhkmnptuvxdBCDHP] [-o @var{option}] -c @var{string} [@var{argument} @dots{}]
bash [long-opt] -s [-abefhkmnptuvxdBCDHP] [-o @var{option}] [@var{argument} @dots{}]
bash [long-opt] [-ir] [-abefhkmnptuvxdBCDHP] [-o @var{option}] [-O @var{shopt_option}] [@var{argument} @dots{}]
bash [long-opt] [-abefhkmnptuvxdBCDHP] [-o @var{option}] [-O @var{shopt_option}] -c @var{string} [@var{argument} @dots{}]
bash [long-opt] -s [-abefhkmnptuvxdBCDHP] [-o @var{option}] [-O @var{shopt_option}] [@var{argument} @dots{}]
@end example
In addition to the single-character shell command-line options
@ -4414,6 +4470,16 @@ are subject to language translation when the current locale
is not @code{C} or @code{POSIX} (@pxref{Locale Translation}).
This implies the @option{-n} option; no commands will be executed.
@item [-+]O [@var{shopt_option}]
@var{shopt_option} is one of the shell options accepted by the
@code{shopt} builtin (@pxref{Shell Builtin Commands}).
If @var{shopt_option} is present, @option{-O} sets the value of that option;
@option{+O} unsets it.
If @var{shopt_option} is not supplied, the names and values of the shell
options accepted by @code{shopt} are printed on the standard output.
If the invocation option is @option{+O}, the output is displayed in a format
that may be reused as input.
@item --
A @code{--} signals the end of options and disables further option
processing.
@ -4421,6 +4487,10 @@ Any arguments after the @code{--} are treated as filenames and arguments.
@end table
@cindex login shell
A @emph{login} shell is one whose first character of argument zero is
@samp{-}, or one invoked with the @option{--login} option.
@cindex interactive shell
An @emph{interactive} shell is one started without non-option arguments,
unless @option{-s} is specified,
@ -4930,7 +5000,7 @@ is a decimal number between 2 and 64 representing the arithmetic
base, and @var{n} is a number in that base. If @var{base}@code{#} is
omitted, then base 10 is used.
The digits greater than 9 are represented by the lowercase letters,
the uppercase letters, @samp{_}, and @samp{@@}, in that order.
the uppercase letters, @samp{@@}, and @samp{_}, in that order.
If @var{base} is less than or equal to 36, lowercase and uppercase
letters may be used interchangably to represent numbers between 10
and 35.
@ -5065,7 +5135,7 @@ Referencing an array variable without a subscript is equivalent to
referencing element zero.
The @code{unset} builtin is used to destroy arrays.
@code{unset} @var{name[subscript]}
@code{unset} @var{name}[@var{subscript}]
destroys the array element at index @var{subscript}.
@code{unset} @var{name}, where @var{name} is an array, removes the
entire array. A subscript of @samp{*} or @samp{@@} also removes the
@ -5230,6 +5300,8 @@ The time, in 24-hour HH:MM:SS format.
The time, in 12-hour HH:MM:SS format.
@item \@@
The time, in 12-hour am/pm format.
@item \A
The time, in 24-hour HH:MM format.
@item \u
The username of the current user.
@item \v
@ -5462,6 +5534,10 @@ Alias expansion is always enabled, even in non-interactive shells.
When the @code{set} builtin is invoked without options, it does not display
shell function names and definitions.
@item
When the @code{set} builtin is invoked without options, it displays
variable values without quotes, unless they contain shell metacharacters,
even if the result contains nonprinting characters.
@end enumerate
There is other @sc{posix} 1003.2 behavior that Bash does not implement.
@ -5585,9 +5661,11 @@ job 1 in the background, equivalent to @samp{bg %1}
The shell learns immediately whenever a job changes state.
Normally, Bash waits until it is about to print a prompt
before reporting changes in a job's status so as to not interrupt
any other output. If the
the @option{-b} option to the @code{set} builtin is enabled,
any other output.
If the @option{-b} option to the @code{set} builtin is enabled,
Bash reports such changes immediately (@pxref{The Set Builtin}).
Any trap on @code{SIGCHLD} is executed for each child process
that exits.
If an attempt to exit Bash is while jobs are stopped, the
shell prints a message warning that there are stopped jobs.
@ -5867,18 +5945,9 @@ The file @file{configure.in} is used to create @code{configure}
by a program called Autoconf. You only need
@file{configure.in} if you want to change it or regenerate
@code{configure} using a newer version of Autoconf. If
you do this, make sure you are using Autoconf version 2.10 or
you do this, make sure you are using Autoconf version 2.50 or
newer.
If you need to change @file{configure.in} or regenerate
@code{configure}, you will need to create two files:
@file{_distribution} and @file{_patchlevel}. @file{_distribution}
should contain the major and minor version numbers of the Bash
distribution, for example @samp{2.01}. @file{_patchlevel} should
contain the patch level of the Bash distribution, @samp{0} for
example. The script @file{support/mkconffiles} has been provided
to automate the creation of these files.
You can remove the program binaries and object files from the
source code directory by typing @samp{make clean}. To also remove the
files that @code{configure} created (so you can compile Bash for
@ -5947,7 +6016,9 @@ directories for other architectures.
By default, @samp{make install} will install into
@file{/usr/local/bin}, @file{/usr/local/man}, etc. You can
specify an installation prefix other than @file{/usr/local} by
giving @code{configure} the option @option{--prefix=@var{PATH}}.
giving @code{configure} the option @option{--prefix=@var{PATH}},
or by specifying a value for the @code{DESTDIR} @samp{make}
variable when running @samp{make install}.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files.
@ -5960,13 +6031,13 @@ Documentation and other data files will still use the regular prefix.
@section Specifying the System Type
There may be some features @code{configure} can not figure out
automatically, but needs to determine by the type of host Bash
automatically, but need to determine by the type of host Bash
will run on. Usually @code{configure} can figure that
out, but if it prints a message saying it can not guess the host
type, give it the @option{--host=TYPE} option. @samp{TYPE} can
either be a short name for the system type, such as @samp{sun4},
or a canonical name with three fields: @samp{CPU-COMPANY-SYSTEM}
(e.g., @samp{sparc-sun-sunos4.1.2}).
(e.g., @samp{i386-unknown-freebsd4.2}).
See the file @file{support/config.sub} for the possible
values of each field.
@ -6052,22 +6123,24 @@ Use the curses library instead of the termcap library. This should
be supplied if your system has an inadequate or incomplete termcap
database.
@item --with-glibc-malloc
Use the @sc{gnu} libc version of @code{malloc} in
@file{lib/malloc/gmalloc.c}. This is not the version of @code{malloc}
that appears in glibc version 2, but a modified version of the
@code{malloc} from glibc version 1. This is somewhat slower than the
default @code{malloc}, but wastes less space on a per-allocation
basis, and will return memory to the operating system under
certain circumstances.
@item --with-gnu-malloc
A synonym for @code{--with-bash-malloc}.
@item --with-installed-readline
@item --with-installed-readline[=@var{PREFIX}]
Define this to make Bash link with a locally-installed version of Readline
rather than the version in @file{lib/readline}. This works only with
Readline 4.1 and later versions.
Readline 4.2 and later versions. If @var{PREFIX} is @code{yes} or not
supplied, @code{configure} uses the values of the make variables
@code{includedir} and @code{libdir}, which are subdirectories of @code{prefix}
by default, to find the installed version of Readline if it is not in
the standard system include and library directories.
If @var{PREFIX} is @code{no}, Bash links with the version in
@file{lib/readline}.
If @var{PREFIX} is set to any other value, @code{configure} treats it as
a directory pathname and looks for
the installed version of Readline in subdirectories of that directory
(include files in @var{PREFIX}/@code{include} and the library in
@var{PREFIX}/@code{lib}).
@item --with-purify
Define this to use the Purify memory allocation checker from Rational
@ -6082,6 +6155,11 @@ There are several @option{--enable-} options that alter how Bash is
compiled and linked, rather than changing run-time features.
@table @code
@item --enable-largefile
Enable support for @uref{http://www.sas.com/standards/large_file/x_open.20Mar96.html,
large files} if the operating system requires special compiler options
to build programs which can access large files.
@item --enable-profiling
This builds a Bash binary that produces profiling information to be
processed by @code{gprof} each time it is executed.
@ -6533,7 +6611,8 @@ executed with the @code{.} or @code{source} builtins
@item
Bash includes the @code{shopt} builtin, for finer control of shell
optional capabilities (@pxref{Bash Builtins}).
optional capabilities (@pxref{Bash Builtins}), and allows these options
to be set and unset at shell invocation (@pxref{Invoking Bash}).
@item
Bash has much more optional behavior controllable with the @code{set}
@ -6545,11 +6624,17 @@ is slightly different, as it implements the @sc{posix} algorithm,
which specifies the behavior based on the number of arguments.
@item
The @code{trap} builtin (@pxref{Bourne Shell Builtins})
allows a @code{DEBUG} pseudo-signal specification,
similar to @code{EXIT}. Commands specified with a @code{DEBUG} trap are
executed after every simple command. The @code{DEBUG} trap is not
inherited by shell functions.
The @code{trap} builtin (@pxref{Bourne Shell Builtins}) allows a
@code{DEBUG} pseudo-signal specification, similar to @code{EXIT}.
Commands specified with a @code{DEBUG} trap are executed after every
simple command.
The @code{DEBUG} trap is not inherited by shell functions.
The @code{trap} builtin (@pxref{Bourne Shell Builtins}) allows an
@code{ERR} pseudo-signal specification, similar to @code{EXIT} and @code{DEBUG}.
Commands specified with an @code{ERR} trap are executed after a simple
command fails, with a few exceptions.
The @code{ERR} trap is not inherited by shell functions.
@item
The Bash @code{type} builtin is more extensive and gives more information

View File

@ -1,11 +1,12 @@
.\" This is a hack to force bash builtins into the whatis database
.\" and to get the list of builtins to come up with the man command.
.TH BASH_BUILTINS 1 "1996 Mar 20" GNU
.TH BASH_BUILTINS 1 "2001 October 29" "GNU Bash-2.05a"
.SH NAME
bash, :, ., alias, bg, bind, break, builtin, case, cd, command,
bash, :, ., [, alias, bg, bind, break, builtin, case, cd, command, compgen,
complete,
continue, declare, dirs, disown, echo, enable, eval, exec, exit,
export, fc, fg, for, getopts, hash, help, history, if, jobs, kill,
let, local, logout, popd, pushd, pwd, read, readonly, return, set,
let, local, logout, popd, printf, pushd, pwd, read, readonly, return, set,
shift, shopt, source, suspend, test, times, trap, type, typeset,
ulimit, umask, unalias, unset, until, wait, while \- bash built-in commands, see \fBbash\fR(1)
.SH BASH BUILTIN COMMANDS

10
error.c
View File

@ -58,7 +58,7 @@ extern char *dollar_vars[];
extern char *shell_name;
#if defined (JOB_CONTROL)
extern pid_t shell_pgrp;
extern int give_terminal_to ();
extern int give_terminal_to __P((pid_t, int));
#endif /* JOB_CONTROL */
/* The current maintainer of the shell. You change this in the
@ -95,7 +95,7 @@ get_name_for_error ()
format string. */
void
file_error (filename)
char *filename;
const char *filename;
{
report_error ("%s: %s", filename, strerror (errno));
}
@ -227,7 +227,7 @@ programming_error (format, va_alist)
char *h;
#if defined (JOB_CONTROL)
give_terminal_to (shell_pgrp);
give_terminal_to (shell_pgrp, 0);
#endif /* JOB_CONTROL */
#if defined (PREFER_STDARG)
@ -446,7 +446,7 @@ itrace (format, va_alist)
{
va_list args;
fprintf(stderr, "TRACE: pid %d: ", (int)getpid());
fprintf(stderr, "TRACE: pid %ld: ", (long)getpid());
#if defined (PREFER_STDARG)
va_start (args, format);
@ -484,7 +484,7 @@ trace (format, va_alist)
else
fcntl (fileno (tracefp), F_SETFD, 1); /* close-on-exec */
fprintf(tracefp, "TRACE: pid %d: ", getpid());
fprintf(tracefp, "TRACE: pid %ld: ", (long)getpid());
#if defined (PREFER_STDARG)
va_start (args, format);

21
error.h
View File

@ -24,35 +24,38 @@
#include "stdc.h"
/* Get the name of the shell or shell script for an error message. */
extern char *get_name_for_error ();
extern char *get_name_for_error __P((void));
/* Report an error having to do with FILENAME. */
extern void file_error __P((char *));
extern void file_error __P((const char *));
/* Report a programmer's error, and abort. Pass REASON, and ARG1 ... ARG5. */
extern void programming_error __P((const char *, ...));
extern void programming_error __P((const char *, ...)) __attribute__((__format__ (printf, 1, 2)));
/* General error reporting. Pass FORMAT and ARG1 ... ARG5. */
extern void report_error __P((const char *, ...));
extern void report_error __P((const char *, ...)) __attribute__((__format__ (printf, 1, 2)));
/* Error messages for parts of the parser that don't call report_syntax_error */
extern void parser_error __P((int, const char *, ...));
extern void parser_error __P((int, const char *, ...)) __attribute__((__format__ (printf, 2, 3)));
/* Report an unrecoverable error and exit. Pass FORMAT and ARG1 ... ARG5. */
extern void fatal_error __P((const char *, ...));
extern void fatal_error __P((const char *, ...)) __attribute__((__format__ (printf, 1, 2)));
/* Report a system error, like BSD warn(3). */
extern void sys_error __P((const char *, ...));
extern void sys_error __P((const char *, ...)) __attribute__((__format__ (printf, 1, 2)));
/* Report an internal error. */
extern void internal_error __P((const char *, ...));
extern void internal_error __P((const char *, ...)) __attribute__((__format__ (printf, 1, 2)));
/* Report an internal warning. */
extern void internal_warning __P((const char *, ...));
extern void internal_warning __P((const char *, ...)) __attribute__((__format__ (printf, 1, 2)));
/* Report an error having to do with command parsing or execution. */
extern void command_error __P((const char *, int, int, int));
extern char *command_errstr __P((int));
/* Debugging function, not enabled in released version. */
extern void itrace __P((const char *, ...)) __attribute__ ((__format__ (printf, 1, 2)));
#endif /* !_ERROR_H_ */

8
eval.c
View File

@ -43,10 +43,8 @@
# include "bashhist.h"
#endif
extern int yyparse ();
extern int EOF_reached;
extern int indirection_level, interactive, interactive_shell;
extern int indirection_level;
extern int posixly_correct;
extern int subshell_environment, running_under_emacs;
extern int last_command_exit_value, stdin_redir;
@ -62,6 +60,8 @@ reader_loop ()
int our_indirection_level;
COMMAND *current_command = (COMMAND *)NULL;
USE_VAR(current_command);
our_indirection_level = ++indirection_level;
while (EOF_Reached == 0)
@ -234,11 +234,11 @@ read_command ()
/* Only do timeouts if interactive. */
tmout_var = (SHELL_VAR *)NULL;
tmout_len = 0;
old_alrm = (SigHandler *)NULL;
if (interactive)
{
tmout_var = find_variable ("TMOUT");
old_alrm = (SigHandler *)NULL;
if (tmout_var && tmout_var->value)
{

View File

@ -476,6 +476,7 @@ complete -A hostname rsh telnet rlogin ftp ping xping host traceroute nslookup
complete -A hostname rxterm rxterm3 rxvt2
complete -u su
complete -g newgrp groupdel groupmod
complete -f -X '!*.+(ps|PS)' gs gv ghostview psselect pswrap
complete -f -X '!*.+(dvi|DVI)' dvips xdvi dviselect dvitype catdvi

View File

@ -0,0 +1,43 @@
#
# Originally from:
#
#Message-ID: <3B13EC65.179451AE@wanadoo.fr>
#Date: Tue, 29 May 2001 20:37:25 +0200
#From: Manu Rouat <emmanuel.rouat@wanadoo.fr>
#Subject: [bash] Universal command options completion?
#
#
#In the recent versions of bash (after 2.04) programmable
#completion is available. A useful completion function
#is , for a particular command, to enumerate all flags
#that can be used in the command. Now, most GNU unix
#commands have so-called 'long options' for example:
#
#ls --color=always --no-group --size
#
#and these are all listed when you issue a '--help' flag.
#So the idea is to use that, then parse the output of the
#'--help' and reinject this to compgen. The basis of the
#following 'universal' completion funtion was the _configure_func'
#written by Ian McDonnald (or is it Chet Ramey ?)
#A dedicated function will always be better, but this is quite
#convenient. I chose to use 'long options' because they are
#easy to parse and explicit too (it's the point I guess...)
#Lots of room for improvement !
_longopt_func ()
{
case "$2" in
-*) ;;
*) return ;;
esac
case "$1" in
\~*) eval cmd=$1 ;;
*) cmd="$1" ;;
esac
COMPREPLY=( $("$cmd" --help | sed -e '/--/!d' -e 's/.*--\([^ ]*\).*/--\1/'| \
grep ^"$2" |sort -u) )
}
complete -o default -F _longopt_func ldd wget bash id info # some examples that work

View File

@ -51,7 +51,7 @@ autoload()
# yet defined, but we don't have enough information to do that here.
#
if [ $# -eq 0 ] ; then
echo "usage: autoload function [function...]"
echo "usage: autoload function [function...]" >&2
return 1
fi
@ -60,7 +60,7 @@ autoload()
#
if [ -z "$FPATH" ] ; then
echo autoload: FPATH not set
echo autoload: FPATH not set or null >&2
return 1
fi
@ -71,17 +71,25 @@ autoload()
# The path splitting command is taken from Kernighan and Pike
#
fp=$(echo $FPATH | sed 's/^:/.:/
s/::/:.:/g
s/:$/:./
s/:/ /g')
# fp=$(echo $FPATH | sed 's/^:/.:/
# s/::/:.:/g
# s/:$/:./
# s/:/ /g')
# replaced with builtin mechanisms 2001 Oct 10
fp=${FPATH/#:/.:}
fp=${fp//::/:.:}
fp=${fp/%:/:.}
fp=${fp//:/ }
for FUNC in $args ; do
#
# We're blowing away the arguments to autoload here...
# We have to; there are no arrays.
# We have to; there are no arrays (well, there are, but
# this doesn't use them yet).
#
set $fp
set -- $fp
while [ $# -ne 0 ] ; do
if [ -f $1/$FUNC ] ; then
@ -91,7 +99,7 @@ autoload()
done
if [ $# -eq 0 ] ; then
echo "$FUNC: autoload function not found"
echo "$FUNC: autoload function not found" >&2
continue
fi

View File

@ -18,7 +18,7 @@
# -p print in a format that can be reused as input
# -u unset each function and remove it from the autoload list
#
# The first cut of this was by Bill Trost, trost@reed.bitnet
# The first cut of this was by Bill Trost, trost@reed.edu
#
# Chet Ramey
# chet@ins.CWRU.Edu

View File

@ -0,0 +1,109 @@
# coprocess.bash
#
# vi:set sts=2 sw=2 ai:
#
coprocess_pid=
#
# coprocess - Start, control, and end coprocesses.
#
function coprocess ()
{
while (( $# > 0 )) ; do
case "$1" in
#
# coprocess close
#
c|cl|clo|clos|close)
shift
exec 61>&- 62<&-
coprocess_pid=
if [ "$1" = "-SIGPIPE" ] ; then
# Only print message in an interactive shell
case "$-" in
*i*)
echo 'SIGPIPE' >&2
;;
esac
return 1
fi
return 0
;;
#
# coprocess open
#
o|op|ope|open)
shift
local fifo="/var/tmp/coprocess.$$.$RANDOM"
local cmd="/bin/bash"
if (( $# > 0 )) ; then
cmd="$@"
fi
mkfifo "$fifo.in" || return $?
mkfifo "$fifo.out" || {
ret=$?
rm -f "$fifo.in"
return $?
}
( "$@" <$fifo.in >$fifo.out ; rm -f "$fifo.in" "$fifo.out" ) &
coprocess_pid=$!
exec 61>$fifo.in 62<$fifo.out
return 0
;;
#
# coprocess print - write to the coprocess
#
p|pr|pri|prin|print)
shift
local old_trap=$(trap -p SIGPIPE)
trap 'coprocess close -SIGPIPE' SIGPIPE
if [ $# -eq 1 -a "$1" = "--stdin" ] ; then
cat >&61
else
echo "$@" >&61
fi
local ret=$?
eval "$old_trap"
return $ret
;;
#
# coprocess read - read from the coprocess
#
r|re|rea|read)
shift
local old_trap=$(trap -p SIGPIPE)
trap '_coprocess_close -SIGPIPE' SIGPIPE
builtin read "$@" <&62
local ret=$?
eval "$old_trap"
return $ret
;;
s|st|sta|stat|statu|status)
if [ -z "$coprocess_pid" ] ; then
echo 'no active coprocess'
return 1
else
echo " coprocess is active [$coprocess_pid]"
return 0
fi
;;
*)
coprocess print "$@"
return $?
;;
esac
shift
done
coprocess status
return $?
}

View File

@ -0,0 +1,53 @@
Date: Fri, 21 Sep 2001 14:50:29 -0400
From: "Jason M. Felice" <jfelice@cronosys.com>
To: bash-maintainers@gnu.org, chet@po.cwru.edu
Subject: Bash co-processes functions
Message-ID: <20010921145029.A6093@argo.eraserhead.net>
Mime-Version: 1.0
Attached to this message you will find coprocess.bash and coshell.bash.
Here's a brief synopsis of use:
coprocess open telnet localhost
while coprocess read il ; do
echo "$il"
case "$il" in
*ogin:*)
coprocess print 'user'
;;
*ord:*)
echo 'pass' |coprocess print --stdin
;;
*$ *)
coprocess print 'exit'
break
;;
esac
done
coprocess close
And here's an example of the coshell function:
coshell open ssh -l root otherbox
coshell eval hostname
coshell ls -l
if coshell test -d /tmp ; then echo 'otherbox has a /tmp!' ; fi
coshell sendfile /var/lib/upgrade.rpm /tmp/test.rpm || exit $?
coshell eval rpm -ivh /tmp/test.rpm || exit $?
coshell eval rm -f /tmp/test.rpm || exit $?
coshell close
exit 0
There are a few minor issues that I'd like to work out, but it works well
enough for me ;-) The issues are:
- Shell quoting issue with 'coshell eval' commands - need to somehow
re-quote words.
- Interactive commands hang 'coshell eval', tried redirecting in </dev/null
to executed command, but it caused strange shell exit problems.
- Some way to copy stdin from local coshell eval to remote shell. Probably
logically impossible, but would be wonderfully useful.
I'm using it for writing scripts to publish websites and other scripts to
co-located servers.

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