Imported from ../bash-2.02.tar.gz.
This commit is contained in:
parent
e8ce775db8
commit
cce855bc5b
323 changed files with 33916 additions and 12321 deletions
383
CHANGES
383
CHANGES
|
@ -1,3 +1,386 @@
|
||||||
|
This document details the changes between this version, bash-2.02-beta2,
|
||||||
|
and the previous version, bash-2.02-beta1.
|
||||||
|
|
||||||
|
1. Changes to Bash
|
||||||
|
|
||||||
|
a. A bug was fixed that caused the terminal process group to be set
|
||||||
|
incorrectly when performing command substitution of builtins in a
|
||||||
|
pipeline.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
This document details the changes between this version, bash-2.02-beta2,
|
||||||
|
and the previous version, bash-2.02-beta1.
|
||||||
|
|
||||||
|
1. Changes to Bash
|
||||||
|
|
||||||
|
a. Attempting to `wait' for stopped jobs now generates a warning message.
|
||||||
|
|
||||||
|
b. Pipelines which exit due to SIGPIPE in non-interactive shells are now
|
||||||
|
not reported if the shell is compiled -DDONT_REPORT_SIGPIPE.
|
||||||
|
|
||||||
|
c. Some changes were made to builtins/psize.sh and support/bashbug.sh to
|
||||||
|
attempt to avoid some /tmp file races and surreptitious file
|
||||||
|
substitutions.
|
||||||
|
|
||||||
|
d. Fixed a bug that caused the shell not to compile if configured with
|
||||||
|
dparen arithmetic but without aliases.
|
||||||
|
|
||||||
|
e. Fixed a bug that caused the input stream to be switched when assigning
|
||||||
|
empty arrays with `bash -c'.
|
||||||
|
|
||||||
|
f. A bug was fixed in the readline expansion glue code that caused bash to
|
||||||
|
dump core when expanding lines with an unclosed single quote.
|
||||||
|
|
||||||
|
g. A fix was made to the `cd' builtin so that using a non-empty directory
|
||||||
|
from $CDPATH results in an absolute pathname of the new current working
|
||||||
|
directory to be displayed after the current directory is changed.
|
||||||
|
|
||||||
|
h. Fixed a bug in the variable assignment code that caused the shell to
|
||||||
|
dump core when referencing an unset variable with `set -u' enabled in
|
||||||
|
an assignment statement preceding a command.
|
||||||
|
|
||||||
|
i. Fixed a bug in the exit trap code that caused reserved words to not be
|
||||||
|
recognized under certain circumstances.
|
||||||
|
|
||||||
|
j. Fixed a bug in the parameter pattern substitution code so that quote
|
||||||
|
removal is performed.
|
||||||
|
|
||||||
|
k. The shell should now configure correctly on Apple Rhapsody systems.
|
||||||
|
|
||||||
|
l. The `kill' builtin now prints a usage message if it is not passed any
|
||||||
|
arguments.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
This document details the changes between this version, bash-2.02-beta1,
|
||||||
|
and the previous version, bash-2.02-alpha1.
|
||||||
|
|
||||||
|
1. Changes to Bash
|
||||||
|
|
||||||
|
a. A few compilation bugs were fixed in the new extended globbing code.
|
||||||
|
|
||||||
|
b. Executing arithmetic commands now sets the command name to `((' so
|
||||||
|
error messages look right.
|
||||||
|
|
||||||
|
c. Fixed some build problems with various configuration options.
|
||||||
|
|
||||||
|
d. The `printf' builtin now aborts immediately if an illegal format
|
||||||
|
character is encountered.
|
||||||
|
|
||||||
|
e. The code that creates here-documents now behaves better if the file it's
|
||||||
|
trying to create already exists for some reason.
|
||||||
|
|
||||||
|
f. Fixed a problem with the extended globbing code that made patterns like
|
||||||
|
`x+*' expand incorrectly.
|
||||||
|
|
||||||
|
g. The prompt string expansion code no longer quotes tildes with backslashes.
|
||||||
|
|
||||||
|
h. The bash getcwd() implementation in lib/sh/getcwd.c now behaves better in
|
||||||
|
the presence of lstat(2) failures.
|
||||||
|
|
||||||
|
i. Fixed a bug with strsub() that caused core dumps when executing `fc -s'.
|
||||||
|
|
||||||
|
j. The mail checking code now ensures that it has a valid default mailpath.
|
||||||
|
|
||||||
|
k. A bug was fixed that caused local variables to be unset inappropriately
|
||||||
|
when sourcing a script from within another sourced script.
|
||||||
|
|
||||||
|
l. A bug was fixed in the history saving code so that functions are saved
|
||||||
|
in the history list correctly if `cmdhist' is enabled, but `lithist'
|
||||||
|
is not.
|
||||||
|
|
||||||
|
m. A bug was fixed that caused printf overflows when displaying error
|
||||||
|
messages.
|
||||||
|
|
||||||
|
n. It should be easier to build the loadble builtins in examples/loadables,
|
||||||
|
though some manual editing of the generated Makefile is still required.
|
||||||
|
|
||||||
|
o. The user's primary group is now always ${GROUPS[0]}.
|
||||||
|
|
||||||
|
p. Some updates were made to support/config.guess from the GNU master copy.
|
||||||
|
|
||||||
|
q. Some changes were made to the autoconf support for Solaris 2.6 large
|
||||||
|
files.
|
||||||
|
|
||||||
|
r. The `command' builtins now does the right thing when confstr(3) cannot
|
||||||
|
find a value for _CS_PATH.
|
||||||
|
|
||||||
|
s. Extended globbing expressions like `*.!(c)' are not history expanded if
|
||||||
|
`extglob' is enabled.
|
||||||
|
|
||||||
|
t. Using the `-P' option to `cd' will force the value that is assigned to
|
||||||
|
PWD to not contain any symbolic links.
|
||||||
|
|
||||||
|
2. Changes to Readline
|
||||||
|
|
||||||
|
a. The code that prints completion listings now behaves better if one or
|
||||||
|
more of the filenames contains non-printable characters.
|
||||||
|
|
||||||
|
b. The time delay when showing matching parentheses is now 0.5 seconds.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
This document details the changes between this version, bash-2.02-alpha1,
|
||||||
|
and the previous version, bash-2.01.1-release.
|
||||||
|
|
||||||
|
1. Changes to Bash
|
||||||
|
|
||||||
|
a. OS-specific configuration changes for: BSD/OS 3.x, Minix 2.x,
|
||||||
|
Solaris 2.6, SINIX SVR4.
|
||||||
|
|
||||||
|
b. Changes were made to the generated `info' files so that `install-info'
|
||||||
|
works correctly.
|
||||||
|
|
||||||
|
c. PWD is now auto-exported.
|
||||||
|
|
||||||
|
d. A fix was made to the pipeline code to make sure that the shell forks
|
||||||
|
to execute simple commands consisting solely of assignment statements.
|
||||||
|
|
||||||
|
e. Changes to the test suite for systems with 14-character filenames.
|
||||||
|
|
||||||
|
f. The default sizes of some internal hash tables have been made smaller
|
||||||
|
to reduce the shell's memory footprint.
|
||||||
|
|
||||||
|
g. The `((...))' arithmetic command is now executed directly instead of
|
||||||
|
being translated into `let "..."'.
|
||||||
|
|
||||||
|
h. Fixes were made to the expansion code so that "$*", "$@", "${array[@]}",
|
||||||
|
and "${array[@]}" expand correctly when IFS does not contain a space
|
||||||
|
character, is unset, or is set to NULL.
|
||||||
|
|
||||||
|
i. The indirect expansion code (${!var}) was changed so that the only
|
||||||
|
valid values of `var' are variable names, positional parameters, `#',
|
||||||
|
`@', and `*'.
|
||||||
|
|
||||||
|
j. An arithmetic expression error in a $((...)) expansion now causes a
|
||||||
|
non-interactive shell running in posix mode to exit.
|
||||||
|
|
||||||
|
k. Compound array assignment now splits the words within the parentheses
|
||||||
|
on shell metacharacters like the parser would before expansing them
|
||||||
|
and performing the assignment. This is for compatibility with ksh-93.
|
||||||
|
|
||||||
|
l. The internal shell backslash-quoting code (used in the output of `set'
|
||||||
|
and completion) now quotes tildes if they appear at the start of the
|
||||||
|
string or after a `=' or `:'.
|
||||||
|
|
||||||
|
m. A couple of bugs with `shopt -o' were fixed.
|
||||||
|
|
||||||
|
n. `bash +o' now displays the same output as `set +o' before starting an
|
||||||
|
interactive shell.
|
||||||
|
|
||||||
|
o. A bug that caused command substitution and the `eval' builtin to
|
||||||
|
occasionally free memory twice when an error was encountered was fixed.
|
||||||
|
|
||||||
|
p. The filename globbing code no longer requires read permission for a
|
||||||
|
directory when the filename to be matched does not contain any globbing
|
||||||
|
characters, as POSIX.2 specifies.
|
||||||
|
|
||||||
|
q. A bug was fixed so that the job containing the last asynchronous
|
||||||
|
process is not removed from the job table until a `wait' is executed
|
||||||
|
for that process or another asynchronous process is started. This
|
||||||
|
satisfies a POSIX.2 requirement.
|
||||||
|
|
||||||
|
r. A `select' bug was fixed so that a non-numeric user response is treated
|
||||||
|
the same as a numeric response that is out of range.
|
||||||
|
|
||||||
|
s. The shell no longer parses the value of SHELLOPTS from the environment
|
||||||
|
if it is restricted, running setuid, or running in `privileged mode'.
|
||||||
|
|
||||||
|
t. Fixes were made to enable large file support on systems such as
|
||||||
|
Solaris 2.6, where the size of a file may be larger than can be held
|
||||||
|
in an `int'.
|
||||||
|
|
||||||
|
u. The filename hashing code was fixed to not add `./' to the beginning of
|
||||||
|
filenames which already begin with `./'.
|
||||||
|
|
||||||
|
v. The configure script was changed so that the GNU termcap library is not
|
||||||
|
compiled in if `prefer-curses' has been specified.
|
||||||
|
|
||||||
|
w. HISTCONTROL and HISTIGNORE are no longer applied to the second and
|
||||||
|
subsequent lines of a multi-line command.
|
||||||
|
|
||||||
|
x. A fix was made to `disown' so that it does a better job of catching
|
||||||
|
out-of-range jobs.
|
||||||
|
|
||||||
|
y. Non-interactive shells no longer report the status of processes terminated
|
||||||
|
due to SIGINT, even if the standard output is a terminal.
|
||||||
|
|
||||||
|
z. A bug that caused the output of `jobs' to have extra carriage returns
|
||||||
|
was fixed.
|
||||||
|
|
||||||
|
aa. A bug that caused PIPESTATUS to not be set when builtins or shell
|
||||||
|
functions were executed in the foreground was fixed.
|
||||||
|
|
||||||
|
bb. Bash now attempts to detect when it is being run by sshd, and treats
|
||||||
|
that case identically to being run by rshd.
|
||||||
|
|
||||||
|
cc. A bug that caused `set -a' to export SHELLOPTS when one of the shell
|
||||||
|
options was changed was fixed.
|
||||||
|
|
||||||
|
dd. The `kill' builtin now disallows empty or missing process id arguments
|
||||||
|
instead of treating them as identical to `0', which means the current
|
||||||
|
process.
|
||||||
|
|
||||||
|
ee. `var=value declare -x var' now behaves identically to
|
||||||
|
`var=value export var'. Similarly for `var=value declare -r var' and
|
||||||
|
`var=value readonly var'.
|
||||||
|
|
||||||
|
ff. A few memory leaks were fixed.
|
||||||
|
|
||||||
|
gg. `alias' and `unalias' now print error messages when passed an argument
|
||||||
|
that is not an alias for printing or deletion, even when the shell is
|
||||||
|
not interactive, as POSIX.2 specifies.
|
||||||
|
|
||||||
|
hh. `alias' and `alias -p' now return a status of 0 when no aliases are
|
||||||
|
defined, as POSIX.2 specifes.
|
||||||
|
|
||||||
|
ii. `cd -' now prints the pathname of the new working directory if the shell
|
||||||
|
is interactive.
|
||||||
|
|
||||||
|
jj. A fix was made so that the code that binds $PWD now copes with getcwd()
|
||||||
|
returning NULL.
|
||||||
|
|
||||||
|
kk. `unset' now checks whether or not a function name it's trying to unset
|
||||||
|
is a valid shell identifier only when the shell is running in posix mode.
|
||||||
|
|
||||||
|
ll. A change was made to the code that generates filenames for here documents
|
||||||
|
to make them less prone to name collisions.
|
||||||
|
|
||||||
|
mm. The parser was changed so that `time' is recognized as a reserved word
|
||||||
|
only at the beginning of a pipeline.
|
||||||
|
|
||||||
|
nn. The pathname canonicalization code was changed so that `//' is converted
|
||||||
|
into `/', but all other pathnames beginning with `//' are left alone, as
|
||||||
|
POSIX.2 specifies.
|
||||||
|
|
||||||
|
oo. The `logout' builtin will no longer exit a non-interactive non-login
|
||||||
|
shell.
|
||||||
|
|
||||||
|
2. Changes to Readline
|
||||||
|
|
||||||
|
a. Fixed a problem in the readline test program rltest.c that caused a core
|
||||||
|
dump.
|
||||||
|
|
||||||
|
b. The code that handles parser directives in inputrc files now displays
|
||||||
|
more error messages.
|
||||||
|
|
||||||
|
c. The history expansion code was fixed so that the appearance of the
|
||||||
|
history comment character at the beginning of a word inhibits history
|
||||||
|
expansion for that word and the rest of the input line.
|
||||||
|
|
||||||
|
3. New Features in Bash
|
||||||
|
|
||||||
|
a. A new version of malloc, based on the older GNU malloc, that has many
|
||||||
|
changes, is more page-based, is more conservative with memory usage,
|
||||||
|
and does not `orphan' large blocks when they are freed.
|
||||||
|
|
||||||
|
b. A new version of gmalloc, based on the old GLIBC malloc, with many
|
||||||
|
changes and range checking included by default.
|
||||||
|
|
||||||
|
c. A new implementation of fnmatch(3) that includes full POSIX.2 Basic
|
||||||
|
Regular Expression matching, including character classes, collating
|
||||||
|
symbols, equivalence classes, and support for case-insensitive pattern
|
||||||
|
matching.
|
||||||
|
|
||||||
|
d. ksh-88 egrep-style extended pattern matching ([@+*?!](patlist)) has been
|
||||||
|
implemented, controlled by a new `shopt' option, `extglob'.
|
||||||
|
|
||||||
|
e. There is a new ksh-like `[[' compound command, which implements
|
||||||
|
extended `test' functionality.
|
||||||
|
|
||||||
|
f. There is a new `printf' builtin, implemented according to the POSIX.2
|
||||||
|
specification.
|
||||||
|
|
||||||
|
g. There is a new feature for command substitution: $(< filename) now expands
|
||||||
|
to the contents of `filename', with any trailing newlines removed
|
||||||
|
(equivalent to $(cat filename)).
|
||||||
|
|
||||||
|
h. There are new tilde prefixes which expand to directories from the
|
||||||
|
directory stack.
|
||||||
|
|
||||||
|
i. There is a new `**' arithmetic operator to do exponentiation.
|
||||||
|
|
||||||
|
j. There are new configuration options to control how bash is linked:
|
||||||
|
`--enable-profiling', to allow bash to be profiled with gprof, and
|
||||||
|
`--enable-static-link', to allow bash to be linked statically.
|
||||||
|
|
||||||
|
k. There is a new configuration option, `--enable-cond-command', which
|
||||||
|
controls whether or not the `[[' command is included. It is on by
|
||||||
|
default.
|
||||||
|
|
||||||
|
l. There is a new configuration option, `--enable-extended-glob', which
|
||||||
|
controls whether or not the ksh extended globbing feature is included.
|
||||||
|
It is enabled by default.
|
||||||
|
|
||||||
|
m. There is a new configuration #define in config.h.top that, when enabled,
|
||||||
|
will cause all login shells to source /etc/profile and one of the user-
|
||||||
|
specific login shell startup files, whether or not the shell is
|
||||||
|
interactive.
|
||||||
|
|
||||||
|
n. There is a new invocation option, `--dump-po-strings', to dump
|
||||||
|
a shell script's translatable strings ($"...") in GNU `po' format.
|
||||||
|
|
||||||
|
o. There is a new `shopt' option, `nocaseglob', to enable case-insensitive
|
||||||
|
pattern matching when globbing filenames and using the `case' construct.
|
||||||
|
|
||||||
|
p. There is a new `shopt' option, `huponexit', which, when enabled, causes
|
||||||
|
the shell to send SIGHUP to all jobs when an interactive login shell
|
||||||
|
exits.
|
||||||
|
|
||||||
|
q. `bind' has a new `-u' option, which takes a readline function name as an
|
||||||
|
argument and unbinds all key sequences bound to that function in a
|
||||||
|
specified keymap.
|
||||||
|
|
||||||
|
r. `disown' now has `-a' and `-r' options, to limit operation to all jobs
|
||||||
|
and running jobs, respectively.
|
||||||
|
|
||||||
|
s. The `shopt' `-p' option now causes output to be displayed in a reusable
|
||||||
|
format.
|
||||||
|
|
||||||
|
t. `test' has a new `-N' option, which returns true if the filename argument
|
||||||
|
has been modified since it was last accessed.
|
||||||
|
|
||||||
|
u. `umask' now has a `-p' option to print output in a reusable format.
|
||||||
|
|
||||||
|
v. A new escape sequence, `\xNNN', has been added to the `echo -e' and $'...'
|
||||||
|
translation code. It expands to the character whose ascii code is NNN
|
||||||
|
in hexadecimal.
|
||||||
|
|
||||||
|
w. The prompt string expansion code has a new `\r' escape sequence.
|
||||||
|
|
||||||
|
x. The shell may now be cross-compiled for the CYGWIN32 environment on
|
||||||
|
a Unix machine.
|
||||||
|
|
||||||
|
4. New Features in Readline
|
||||||
|
|
||||||
|
a. There is now an option for `iterative' yank-last-arg handline, so a user
|
||||||
|
can keep entering `M-.', yanking the last argument of successive history
|
||||||
|
lines.
|
||||||
|
|
||||||
|
b. New variable, `print-completions-horizontally', which causes completion
|
||||||
|
matches to be displayed across the screen (like `ls -x') rather than up
|
||||||
|
and down the screen (like `ls').
|
||||||
|
|
||||||
|
c. New variable, `completion-ignore-case', which causes filename completion
|
||||||
|
and matching to be performed case-insensitively.
|
||||||
|
|
||||||
|
d. There is a new bindable command, `magic-space', which causes history
|
||||||
|
expansion to be performed on the current readline buffer and a space to
|
||||||
|
be inserted into the result.
|
||||||
|
|
||||||
|
e. There is a new bindable command, `menu-complete', which enables tcsh-like
|
||||||
|
menu completion (successive executions of menu-complete insert a single
|
||||||
|
completion match, cycling through the list of possible completions).
|
||||||
|
|
||||||
|
f. There is a new bindable command, `paste-from-clipboard', for use on Win32
|
||||||
|
systems, to insert the text from the Win32 clipboard into the editing
|
||||||
|
buffer.
|
||||||
|
|
||||||
|
g. The key sequence translation code now understands printf-style backslash
|
||||||
|
escape sequences, including \NNN octal escapes. These escape sequences
|
||||||
|
may be used in key sequence definitions or macro values.
|
||||||
|
|
||||||
|
h. An `$include' inputrc file parser directive has been added.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
This document details the changes between this version, bash-2.01.1-release,
|
This document details the changes between this version, bash-2.01.1-release,
|
||||||
and the previous version, bash-2.01-release.
|
and the previous version, bash-2.01-release.
|
||||||
|
|
||||||
|
|
14
COMPAT
14
COMPAT
|
@ -101,3 +101,17 @@ encountered by a significant number of users.
|
||||||
|
|
||||||
alias ulimit="ulimit -S"
|
alias ulimit="ulimit -S"
|
||||||
|
|
||||||
|
9. Bash-2.01 uses a new quoting syntax, $'...' to do ANSI-C string
|
||||||
|
translation. Backslash-escaped characters in ... are expanded and
|
||||||
|
replaced as specified by the ANSI C standard.
|
||||||
|
|
||||||
|
10. The sourcing of startup files has changed somewhat. This is explained
|
||||||
|
more completely in the INVOCATION section of the manual page.
|
||||||
|
|
||||||
|
A non-interactive shell not named `sh' and not in posix mode reads
|
||||||
|
and executes commands from the file named by $BASH_ENV. A
|
||||||
|
non-interactive shell started by `su' and not in posix mode will read
|
||||||
|
startup files. No other non-interactive shells read any startup files.
|
||||||
|
|
||||||
|
An interactive shell started in posix mode reads and executes commands
|
||||||
|
from the file named by $ENV.
|
||||||
|
|
2
COPYING
2
COPYING
|
@ -2,7 +2,7 @@
|
||||||
Version 2, June 1991
|
Version 2, June 1991
|
||||||
|
|
||||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
of this license document, but changing it is not allowed.
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ By chet:
|
||||||
SunOS 4.1.4
|
SunOS 4.1.4
|
||||||
SunOS 5.5
|
SunOS 5.5
|
||||||
BSDI BSD/OS 2.1
|
BSDI BSD/OS 2.1
|
||||||
FreeBSD 2.1.7
|
FreeBSD 2.2
|
||||||
NetBSD 1.2
|
NetBSD 1.2
|
||||||
AIX 4.2
|
AIX 4.2
|
||||||
AIX 4.1.4
|
AIX 4.1.4
|
||||||
|
|
|
@ -21,8 +21,8 @@ The following list is what's changed when `POSIX mode' is in effect:
|
||||||
|
|
||||||
5. The POSIX.2 `PS1' and `PS2' expansions of `!' to the history
|
5. The POSIX.2 `PS1' and `PS2' expansions of `!' to the history
|
||||||
number and `!!' to `!' are enabled, and parameter expansion is
|
number and `!!' to `!' are enabled, and parameter expansion is
|
||||||
performed on the value regardless of the setting of the
|
performed on the values of `PS1' and `PS2' regardless of the
|
||||||
`promptvars' option.
|
setting of the `promptvars' option.
|
||||||
|
|
||||||
6. Interactive comments are enabled by default. (Note that Bash has
|
6. Interactive comments are enabled by default. (Note that Bash has
|
||||||
them on by default anyway.)
|
them on by default anyway.)
|
||||||
|
@ -42,42 +42,51 @@ The following list is what's changed when `POSIX mode' is in effect:
|
||||||
11. Non-interactive shells exit if FILENAME in `.' FILENAME is not
|
11. Non-interactive shells exit if FILENAME in `.' FILENAME is not
|
||||||
found.
|
found.
|
||||||
|
|
||||||
12. Redirection operators do not perform filename expansion on the word
|
12. Non-interactive shells exit if a syntax error in an arithmetic
|
||||||
|
expansion results in an invalid expression.
|
||||||
|
|
||||||
|
13. Redirection operators do not perform filename expansion on the word
|
||||||
in the redirection unless the shell is interactive.
|
in the redirection unless the shell is interactive.
|
||||||
|
|
||||||
13. Function names must be valid shell `name's. That is, they may not
|
14. Function names must be valid shell `name's. That is, they may not
|
||||||
contain characters other than letters, digits, and underscores, and
|
contain characters other than letters, digits, and underscores, and
|
||||||
may not start with a digit. Declaring a function with an illegal
|
may not start with a digit. Declaring a function with an invalid
|
||||||
name causes a fatal syntax error in non-interactive shells.
|
name causes a fatal syntax error in non-interactive shells.
|
||||||
|
|
||||||
14. POSIX.2 `special' builtins are found before shell functions during
|
15. POSIX.2 `special' builtins are found before shell functions during
|
||||||
command lookup.
|
command lookup.
|
||||||
|
|
||||||
15. If a POSIX.2 special builtin returns an error status, a
|
16. If a POSIX.2 special builtin returns an error status, a
|
||||||
non-interactive shell exits. The fatal errors are those listed in
|
non-interactive shell exits. The fatal errors are those listed in
|
||||||
the POSIX.2 standard, and include things like passing incorrect
|
the POSIX.2 standard, and include things like passing incorrect
|
||||||
options, redirection errors, variable assignment errors for
|
options, redirection errors, variable assignment errors for
|
||||||
assignments preceding the command name, and so on.
|
assignments preceding the command name, and so on.
|
||||||
|
|
||||||
16. If the `cd' builtin finds a directory to change to using
|
17. If the `cd' builtin finds a directory to change to using
|
||||||
`$CDPATH', the value it assigns to the `PWD' variable does not
|
`$CDPATH', the value it assigns to the `PWD' variable does not
|
||||||
contain any symbolic links, as if `cd -P' had been executed.
|
contain any symbolic links, as if `cd -P' had been executed.
|
||||||
|
|
||||||
17. A non-interactive shell exits with an error status if a variable
|
18. If `$CDPATH' is set, the `cd' builtin will not implicitly append
|
||||||
|
the current directory to it. This means that `cd' will fail if no
|
||||||
|
valid directory name can be constructed from any of the entries in
|
||||||
|
`$CDPATH', even if the a directory with the same name as the name
|
||||||
|
given as an argument to `cd' exists in the current directory.
|
||||||
|
|
||||||
|
19. A non-interactive shell exits with an error status if a variable
|
||||||
assignment error occurs when no command name follows the assignment
|
assignment error occurs when no command name follows the assignment
|
||||||
statements. A variable assignment error occurs, for example, when
|
statements. A variable assignment error occurs, for example, when
|
||||||
trying to assign a value to a read-only variable.
|
trying to assign a value to a readonly variable.
|
||||||
|
|
||||||
18. A non-interactive shell exits with an error status if the iteration
|
20. A non-interactive shell exits with an error status if the iteration
|
||||||
variable in a `for' statement or the selection variable in a
|
variable in a `for' statement or the selection variable in a
|
||||||
`select' statement is a read-only variable.
|
`select' statement is a readonly variable.
|
||||||
|
|
||||||
19. Process substitution is not available.
|
21. Process substitution is not available.
|
||||||
|
|
||||||
20. Assignment statements preceding POSIX.2 `special' builtins persist
|
22. Assignment statements preceding POSIX.2 special builtins persist
|
||||||
in the shell environment after the builtin completes.
|
in the shell environment after the builtin completes.
|
||||||
|
|
||||||
21. The `export' and `readonly' builtin commands display their output
|
23. The `export' and `readonly' builtin commands display their output
|
||||||
in the format required by POSIX.2.
|
in the format required by POSIX.2.
|
||||||
|
|
||||||
|
|
||||||
|
|
2015
CWRU/changelog
2015
CWRU/changelog
File diff suppressed because it is too large
Load diff
33
INSTALL
33
INSTALL
|
@ -197,17 +197,20 @@ the Bash `configure' recognizes.
|
||||||
|
|
||||||
`--with-glibc-malloc'
|
`--with-glibc-malloc'
|
||||||
Use the GNU libc version of `malloc' in `lib/malloc/gmalloc.c'.
|
Use the GNU libc version of `malloc' in `lib/malloc/gmalloc.c'.
|
||||||
This is somewhat slower than the default `malloc', but wastes
|
This is not the version of `malloc' that appears in glibc version
|
||||||
considerably less space.
|
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 some circumstances.
|
||||||
|
|
||||||
`--with-gnu-malloc'
|
`--with-gnu-malloc'
|
||||||
Use the GNU version of `malloc' in `lib/malloc/malloc.c'. This is
|
Use the GNU version of `malloc' in `lib/malloc/malloc.c'. This is
|
||||||
not the same `malloc' that appears in GNU libc, but an older
|
not the same `malloc' that appears in GNU libc, but an older
|
||||||
version derived from the 4.2 BSD `malloc'. This `malloc' is very
|
version derived from the 4.2 BSD `malloc'. This `malloc' is very
|
||||||
fast, but wastes a lot of space. This option is enabled by
|
fast, but wastes some space on each allocation. This option is
|
||||||
default. The `NOTES' file contains a list of systems for which
|
enabled by default. The `NOTES' file contains a list of systems
|
||||||
this should be turned off, and `configure' disables this option
|
for which this should be turned off, and `configure' disables this
|
||||||
automatically for a number of systems.
|
option automatically for a number of systems.
|
||||||
|
|
||||||
`--with-purify'
|
`--with-purify'
|
||||||
Define this to use the Purify memory allocation checker from Pure
|
Define this to use the Purify memory allocation checker from Pure
|
||||||
|
@ -217,6 +220,17 @@ the Bash `configure' recognizes.
|
||||||
This produces a shell with minimal features, close to the
|
This produces a shell with minimal features, close to the
|
||||||
historical Bourne shell.
|
historical Bourne shell.
|
||||||
|
|
||||||
|
There are several `--enable-' options that alter how Bash is compiled
|
||||||
|
and linked, rather than changing run-time features.
|
||||||
|
|
||||||
|
`--enable-profiling'
|
||||||
|
This builds a Bash binary that produces profiling information to be
|
||||||
|
processed by `gprof' each time it is executed.
|
||||||
|
|
||||||
|
`--enable-static-link'
|
||||||
|
This causes Bash to be linked statically, if `gcc' is being used.
|
||||||
|
This could be used to build a version to use as root's shell.
|
||||||
|
|
||||||
The `minimal-config' option can be used to disable all of the following
|
The `minimal-config' option can be used to disable all of the following
|
||||||
options, but it is processed first, so individual options may be
|
options, but it is processed first, so individual options may be
|
||||||
enabled using `enable-FEATURE'.
|
enabled using `enable-FEATURE'.
|
||||||
|
@ -244,6 +258,9 @@ does not provide the necessary support.
|
||||||
This allows pipelines as well as shell builtins and functions to
|
This allows pipelines as well as shell builtins and functions to
|
||||||
be timed.
|
be timed.
|
||||||
|
|
||||||
|
`--enable-cond-command'
|
||||||
|
Include support for the `[[' conditional command.
|
||||||
|
|
||||||
`--enable-directory-stack'
|
`--enable-directory-stack'
|
||||||
Include support for a `csh'-like directory stack and the `pushd',
|
Include support for a `csh'-like directory stack and the `pushd',
|
||||||
`popd', and `dirs' builtins.
|
`popd', and `dirs' builtins.
|
||||||
|
@ -257,6 +274,10 @@ does not provide the necessary support.
|
||||||
`--enable-dparen-arithmetic'
|
`--enable-dparen-arithmetic'
|
||||||
Include support for the `ksh' `((...))' command.
|
Include support for the `ksh' `((...))' command.
|
||||||
|
|
||||||
|
`--enable-extended-glob'
|
||||||
|
Include support for the extended pattern matching features
|
||||||
|
described above under *Note Pattern Matching::.
|
||||||
|
|
||||||
`--enable-help-builtin'
|
`--enable-help-builtin'
|
||||||
Include the `help' builtin, which displays help on shell builtins
|
Include the `help' builtin, which displays help on shell builtins
|
||||||
and variables.
|
and variables.
|
||||||
|
|
209
MANIFEST
209
MANIFEST
|
@ -7,6 +7,7 @@
|
||||||
CWRU d
|
CWRU d
|
||||||
CWRU/misc d
|
CWRU/misc d
|
||||||
builtins d
|
builtins d
|
||||||
|
cross-build d
|
||||||
doc d
|
doc d
|
||||||
examples d
|
examples d
|
||||||
examples/bashdb d
|
examples/bashdb d
|
||||||
|
@ -25,6 +26,7 @@ lib/posixheaders d
|
||||||
lib/readline d
|
lib/readline d
|
||||||
lib/readline/doc d
|
lib/readline/doc d
|
||||||
lib/readline/examples d
|
lib/readline/examples d
|
||||||
|
lib/sh d
|
||||||
lib/termcap d
|
lib/termcap d
|
||||||
lib/termcap/grot d
|
lib/termcap/grot d
|
||||||
lib/tilde d
|
lib/tilde d
|
||||||
|
@ -55,13 +57,11 @@ general.c f
|
||||||
list.c f
|
list.c f
|
||||||
locale.c f
|
locale.c f
|
||||||
stringlib.c f
|
stringlib.c f
|
||||||
oslib.c f
|
|
||||||
variables.c f
|
variables.c f
|
||||||
make_cmd.c f
|
make_cmd.c f
|
||||||
copy_cmd.c f
|
copy_cmd.c f
|
||||||
unwind_prot.c f
|
unwind_prot.c f
|
||||||
dispose_cmd.c f
|
dispose_cmd.c f
|
||||||
getcwd.c f
|
|
||||||
bashhist.c f
|
bashhist.c f
|
||||||
hashcmd.c f
|
hashcmd.c f
|
||||||
hashlib.c f
|
hashlib.c f
|
||||||
|
@ -81,11 +81,12 @@ test.c f
|
||||||
expr.c f
|
expr.c f
|
||||||
alias.c f
|
alias.c f
|
||||||
execute_cmd.c f
|
execute_cmd.c f
|
||||||
|
findcmd.c f
|
||||||
|
redir.c f
|
||||||
bashline.c f
|
bashline.c f
|
||||||
braces.c f
|
braces.c f
|
||||||
bracecomp.c f
|
bracecomp.c f
|
||||||
nojobs.c f
|
nojobs.c f
|
||||||
vprint.c f
|
|
||||||
error.c f
|
error.c f
|
||||||
xmalloc.c f
|
xmalloc.c f
|
||||||
alias.h f
|
alias.h f
|
||||||
|
@ -97,6 +98,7 @@ array.h f
|
||||||
jobs.h f
|
jobs.h f
|
||||||
maxpath.h f
|
maxpath.h f
|
||||||
filecntl.h f
|
filecntl.h f
|
||||||
|
findcmd.h f
|
||||||
hashlib.h f
|
hashlib.h f
|
||||||
quit.h f
|
quit.h f
|
||||||
flags.h f
|
flags.h f
|
||||||
|
@ -104,6 +106,7 @@ shell.h f
|
||||||
pathexp.h f
|
pathexp.h f
|
||||||
parser.h f
|
parser.h f
|
||||||
sig.h f
|
sig.h f
|
||||||
|
test.h f
|
||||||
trap.h f
|
trap.h f
|
||||||
general.h f
|
general.h f
|
||||||
unwind_prot.h f
|
unwind_prot.h f
|
||||||
|
@ -121,6 +124,7 @@ bashjmp.h f
|
||||||
bashintl.h f
|
bashintl.h f
|
||||||
make_cmd.h f
|
make_cmd.h f
|
||||||
execute_cmd.h f
|
execute_cmd.h f
|
||||||
|
redir.h f
|
||||||
bashtypes.h f
|
bashtypes.h f
|
||||||
mailcheck.h f
|
mailcheck.h f
|
||||||
pathnames.h f
|
pathnames.h f
|
||||||
|
@ -165,6 +169,7 @@ builtins/history.def f
|
||||||
builtins/jobs.def f
|
builtins/jobs.def f
|
||||||
builtins/kill.def f
|
builtins/kill.def f
|
||||||
builtins/mkbuiltins.c f
|
builtins/mkbuiltins.c f
|
||||||
|
builtins/printf.def f
|
||||||
builtins/pushd.def f
|
builtins/pushd.def f
|
||||||
builtins/read.def f
|
builtins/read.def f
|
||||||
builtins/reserved.def f
|
builtins/reserved.def f
|
||||||
|
@ -188,12 +193,15 @@ builtins/inlib.def f
|
||||||
builtins/bashgetopt.c f
|
builtins/bashgetopt.c f
|
||||||
builtins/common.h f
|
builtins/common.h f
|
||||||
builtins/bashgetopt.h f
|
builtins/bashgetopt.h f
|
||||||
|
cross-build/cygwin32.cache f
|
||||||
|
cross-build/win32sig.h f
|
||||||
lib/glob/ChangeLog f
|
lib/glob/ChangeLog f
|
||||||
lib/glob/Makefile.in f
|
lib/glob/Makefile.in f
|
||||||
lib/glob/fnmatch.c f
|
lib/glob/fnmatch.c f
|
||||||
lib/glob/fnmatch.h f
|
lib/glob/fnmatch.h f
|
||||||
lib/glob/glob.c f
|
lib/glob/glob.c f
|
||||||
lib/glob/glob.h f
|
lib/glob/glob.h f
|
||||||
|
lib/glob/collsyms.h f
|
||||||
lib/glob/doc/Makefile f
|
lib/glob/doc/Makefile f
|
||||||
lib/glob/doc/glob.texi f
|
lib/glob/doc/glob.texi f
|
||||||
lib/glob/ndir.h f
|
lib/glob/ndir.h f
|
||||||
|
@ -203,6 +211,8 @@ lib/malloc/alloca.c f
|
||||||
lib/malloc/malloc.c f
|
lib/malloc/malloc.c f
|
||||||
lib/malloc/gmalloc.c f
|
lib/malloc/gmalloc.c f
|
||||||
lib/malloc/xmalloc.c f
|
lib/malloc/xmalloc.c f
|
||||||
|
lib/malloc/ogmalloc.c f
|
||||||
|
lib/malloc/omalloc.c f
|
||||||
lib/malloc/stub.c f
|
lib/malloc/stub.c f
|
||||||
lib/malloc/i386-alloca.s f
|
lib/malloc/i386-alloca.s f
|
||||||
lib/malloc/x386-alloca.s f
|
lib/malloc/x386-alloca.s f
|
||||||
|
@ -251,6 +261,7 @@ lib/readline/tilde.h f
|
||||||
lib/readline/rldefs.h f
|
lib/readline/rldefs.h f
|
||||||
lib/readline/rlconf.h f
|
lib/readline/rlconf.h f
|
||||||
lib/readline/rltty.h f
|
lib/readline/rltty.h f
|
||||||
|
lib/readline/rlwinsize.h f
|
||||||
lib/readline/readline.h f
|
lib/readline/readline.h f
|
||||||
lib/readline/tcap.h f
|
lib/readline/tcap.h f
|
||||||
lib/readline/keymaps.h f
|
lib/readline/keymaps.h f
|
||||||
|
@ -275,6 +286,19 @@ lib/readline/examples/histexamp.c f
|
||||||
lib/readline/examples/rltest.c f
|
lib/readline/examples/rltest.c f
|
||||||
lib/readline/examples/rl.c f
|
lib/readline/examples/rl.c f
|
||||||
lib/readline/examples/Inputrc f
|
lib/readline/examples/Inputrc f
|
||||||
|
lib/sh/Makefile.in f
|
||||||
|
lib/sh/clktck.c f
|
||||||
|
lib/sh/getcwd.c f
|
||||||
|
lib/sh/getenv.c f
|
||||||
|
lib/sh/itos.c f
|
||||||
|
lib/sh/oslib.c f
|
||||||
|
lib/sh/setlinebuf.c f
|
||||||
|
lib/sh/strcasecmp.c f
|
||||||
|
lib/sh/strerror.c f
|
||||||
|
lib/sh/strtod.c f
|
||||||
|
lib/sh/strtol.c f
|
||||||
|
lib/sh/strtoul.c f
|
||||||
|
lib/sh/vprint.c f
|
||||||
lib/termcap/Makefile.in f
|
lib/termcap/Makefile.in f
|
||||||
lib/termcap/termcap.c f
|
lib/termcap/termcap.c f
|
||||||
lib/termcap/termcap.h f
|
lib/termcap/termcap.h f
|
||||||
|
@ -324,6 +348,8 @@ doc/bashref.texi f
|
||||||
doc/bashref.info f
|
doc/bashref.info f
|
||||||
doc/builtins.1 f
|
doc/builtins.1 f
|
||||||
doc/article.ms f
|
doc/article.ms f
|
||||||
|
doc/htmlpost.sh f 755
|
||||||
|
support/Makefile.in f
|
||||||
support/config.guess f
|
support/config.guess f
|
||||||
support/config.sub f
|
support/config.sub f
|
||||||
support/printenv.sh f 755
|
support/printenv.sh f 755
|
||||||
|
@ -335,6 +361,7 @@ support/mkdirs f 755
|
||||||
support/mkversion.sh f 755
|
support/mkversion.sh f 755
|
||||||
support/mksignames.c f
|
support/mksignames.c f
|
||||||
support/bashbug.sh f
|
support/bashbug.sh f
|
||||||
|
support/man2html.c f
|
||||||
support/recho.c f
|
support/recho.c f
|
||||||
support/zecho.c f
|
support/zecho.c f
|
||||||
support/SYMLINKS f
|
support/SYMLINKS f
|
||||||
|
@ -349,10 +376,9 @@ examples/bashdb/bashdb f
|
||||||
examples/bashdb/bashdb.fns f
|
examples/bashdb/bashdb.fns f
|
||||||
examples/bashdb/bashdb.pre f
|
examples/bashdb/bashdb.pre f
|
||||||
examples/loadables/README f
|
examples/loadables/README f
|
||||||
examples/loadables/Makefile f
|
examples/loadables/Makefile.in f
|
||||||
examples/loadables/necho.c f
|
examples/loadables/necho.c f
|
||||||
examples/loadables/hello.c f
|
examples/loadables/hello.c f
|
||||||
examples/loadables/printf.c f
|
|
||||||
examples/loadables/print.c f
|
examples/loadables/print.c f
|
||||||
examples/loadables/sprintf.c f
|
examples/loadables/sprintf.c f
|
||||||
examples/loadables/sleep.c f
|
examples/loadables/sleep.c f
|
||||||
|
@ -369,127 +395,159 @@ examples/loadables/pathchk.c f
|
||||||
examples/loadables/tee.c f
|
examples/loadables/tee.c f
|
||||||
examples/loadables/rmdir.c f
|
examples/loadables/rmdir.c f
|
||||||
examples/loadables/head.c f
|
examples/loadables/head.c f
|
||||||
examples/functions/substr f
|
|
||||||
examples/functions/kshenv f
|
|
||||||
examples/functions/autoload f
|
examples/functions/autoload f
|
||||||
examples/functions/autoload.v2 f
|
examples/functions/autoload.v2 f
|
||||||
|
examples/functions/basename f
|
||||||
|
examples/functions/basename2 f
|
||||||
examples/functions/csh-compat f
|
examples/functions/csh-compat f
|
||||||
|
examples/functions/dirfuncs f
|
||||||
|
examples/functions/dirname f
|
||||||
|
examples/functions/exitstat f
|
||||||
|
examples/functions/external f
|
||||||
|
examples/functions/fact f
|
||||||
|
examples/functions/fstty f
|
||||||
|
examples/functions/func f
|
||||||
|
examples/functions/getoptx.bash f
|
||||||
|
examples/functions/inetaddr f
|
||||||
|
examples/functions/inpath f
|
||||||
|
examples/functions/isnum.bash f
|
||||||
|
examples/functions/isnum2 f
|
||||||
|
examples/functions/jdate.bash f
|
||||||
|
examples/functions/jj.bash f
|
||||||
|
examples/functions/keep f
|
||||||
|
examples/functions/kshenv f
|
||||||
|
examples/functions/login f
|
||||||
|
examples/functions/lowercase f
|
||||||
|
examples/functions/manpage f
|
||||||
|
examples/functions/mhfold f
|
||||||
|
examples/functions/notify.bash f
|
||||||
|
examples/functions/pathfuncs f
|
||||||
|
examples/functions/repeat2 f
|
||||||
|
examples/functions/seq f
|
||||||
examples/functions/shcat f
|
examples/functions/shcat f
|
||||||
|
examples/functions/shcat2 f
|
||||||
|
examples/functions/substr f
|
||||||
examples/functions/substr2 f
|
examples/functions/substr2 f
|
||||||
examples/functions/term f
|
examples/functions/term f
|
||||||
examples/functions/whatis f
|
examples/functions/whatis f
|
||||||
examples/functions/whence f
|
examples/functions/whence f
|
||||||
examples/functions/func f
|
|
||||||
examples/functions/dirname f
|
|
||||||
examples/functions/dirfuncs f
|
|
||||||
examples/functions/basename f
|
|
||||||
examples/functions/exitstat f
|
|
||||||
examples/functions/external f
|
|
||||||
examples/functions/fact f
|
|
||||||
examples/functions/manpage f
|
|
||||||
examples/functions/fstty f
|
|
||||||
examples/functions/jj.bash f
|
|
||||||
examples/functions/notify.bash f
|
|
||||||
examples/functions/inpath f
|
|
||||||
examples/functions/login f
|
|
||||||
examples/functions/keep f
|
|
||||||
examples/functions/seq f
|
|
||||||
examples/functions/mhfold f
|
|
||||||
examples/functions/repeat2 f
|
|
||||||
examples/functions/lowercase f
|
|
||||||
examples/functions/xalias.bash f
|
examples/functions/xalias.bash f
|
||||||
examples/scripts/shprompt f
|
|
||||||
examples/scripts/adventure.sh f
|
examples/scripts/adventure.sh f
|
||||||
examples/scripts/precedence f
|
|
||||||
examples/scripts/bcsh.sh f
|
examples/scripts/bcsh.sh f
|
||||||
|
examples/scripts/fixfiles.bash f
|
||||||
|
examples/scripts/hanoi.bash f
|
||||||
examples/scripts/inpath f
|
examples/scripts/inpath f
|
||||||
|
examples/scripts/krand.bash f
|
||||||
examples/scripts/nohup.bash f
|
examples/scripts/nohup.bash f
|
||||||
|
examples/scripts/precedence f
|
||||||
|
examples/scripts/randomcard.bash f
|
||||||
|
examples/scripts/scrollbar f
|
||||||
|
examples/scripts/scrollbar2 f
|
||||||
|
examples/scripts/showperm.bash f
|
||||||
|
examples/scripts/shprompt f
|
||||||
|
examples/scripts/spin.bash f
|
||||||
|
examples/scripts/timeout f
|
||||||
examples/scripts/vtree2 f
|
examples/scripts/vtree2 f
|
||||||
examples/scripts/vtree3 f
|
examples/scripts/vtree3 f
|
||||||
examples/scripts/scrollbar f
|
|
||||||
examples/scripts/spin.bash f
|
|
||||||
examples/scripts/zprintf f
|
examples/scripts/zprintf f
|
||||||
examples/startup-files/README f
|
examples/startup-files/README f
|
||||||
examples/startup-files/Bashrc f
|
examples/startup-files/Bashrc.bfox f
|
||||||
examples/startup-files/Bash_aliases f
|
examples/startup-files/Bash_aliases f
|
||||||
examples/startup-files/Bash_profile f
|
examples/startup-files/Bash_profile f
|
||||||
examples/startup-files/bash-profile f
|
examples/startup-files/bash-profile f
|
||||||
examples/startup-files/bashrc f
|
examples/startup-files/bashrc f
|
||||||
examples/misc/suncmd.termcap f
|
examples/misc/suncmd.termcap f
|
||||||
examples/misc/alias-conv.sh f
|
examples/misc/aliasconv.sh f
|
||||||
examples/misc/alias-conv.bash f
|
examples/misc/aliasconv.bash f
|
||||||
examples/misc/cshtobash f
|
examples/misc/cshtobash f
|
||||||
tests/README f
|
tests/README f
|
||||||
tests/arith.tests f
|
tests/arith.tests f
|
||||||
tests/arith.right f
|
tests/arith.right f
|
||||||
tests/array.tests f
|
tests/array.tests f
|
||||||
tests/array.right f
|
tests/array.right f
|
||||||
|
tests/array-at-star f
|
||||||
|
tests/array2.right f
|
||||||
tests/braces-tests f
|
tests/braces-tests f
|
||||||
tests/braces.right f
|
tests/braces.right f
|
||||||
tests/builtins.tests f
|
tests/builtins.tests f
|
||||||
tests/builtins.right f
|
tests/builtins.right f
|
||||||
tests/builtins.sub1 f
|
tests/builtins.sub1 f
|
||||||
tests/source.sub1 f
|
tests/source1.sub f
|
||||||
tests/source.sub2 f
|
tests/source2.sub f
|
||||||
tests/source.sub3 f
|
tests/source3.sub f
|
||||||
tests/source.sub4 f
|
tests/source4.sub f
|
||||||
tests/dirstack.tests f
|
tests/source5.sub f
|
||||||
tests/dirstack.right f
|
tests/cond.tests f
|
||||||
tests/dollar-at.sh f
|
tests/cond.right f
|
||||||
tests/dollar-star.sh f
|
tests/dollar-at-star f
|
||||||
tests/dollar.right f
|
tests/dollar.right f
|
||||||
|
tests/dstack.tests f
|
||||||
|
tests/dstack.right f
|
||||||
|
tests/dstack2.tests f
|
||||||
|
tests/dstack2.right f
|
||||||
tests/errors.tests f
|
tests/errors.tests f
|
||||||
tests/errors.right f
|
tests/errors.right f
|
||||||
tests/execscript f
|
tests/execscript f
|
||||||
tests/execscript.right f
|
tests/exec.right f
|
||||||
tests/execscript.sub f 755
|
tests/exec1.sub f 755
|
||||||
tests/execscript.sub2 f
|
tests/exec2.sub f
|
||||||
tests/execscript.sub3 f
|
tests/exec3.sub f
|
||||||
tests/execscript.sub4 f
|
tests/exec4.sub f
|
||||||
|
tests/exec5.sub f
|
||||||
tests/exp-tests f
|
tests/exp-tests f
|
||||||
tests/exp.right f
|
tests/exp.right f
|
||||||
|
tests/extglob.tests f
|
||||||
|
tests/extglob.right f
|
||||||
tests/func.tests f
|
tests/func.tests f
|
||||||
tests/func.right f
|
tests/func.right f
|
||||||
tests/getopts.tests f
|
tests/getopts.tests f
|
||||||
tests/getopts.right f
|
tests/getopts.right f
|
||||||
tests/getopts.sub1 f
|
tests/getopts1.sub f
|
||||||
tests/getopts.sub2 f
|
tests/getopts2.sub f
|
||||||
tests/getopts.sub3 f
|
tests/getopts3.sub f
|
||||||
tests/getopts.sub4 f
|
tests/getopts4.sub f
|
||||||
tests/getopts.sub5 f
|
tests/getopts5.sub f
|
||||||
tests/getopts.sub6 f
|
tests/getopts6.sub f
|
||||||
tests/getopts.sub7 f
|
tests/getopts7.sub f
|
||||||
tests/glob-test f
|
tests/glob-test f
|
||||||
|
tests/glob1.sub f
|
||||||
tests/glob.right f
|
tests/glob.right f
|
||||||
tests/heredoc.tests f
|
tests/heredoc.tests f
|
||||||
tests/heredoc.right f
|
tests/heredoc.right f
|
||||||
tests/histexpand.tests f
|
tests/histexp.tests f
|
||||||
tests/histexpand.right f
|
tests/histexp.right f
|
||||||
tests/history.tests f
|
tests/history.tests f
|
||||||
tests/history.right f
|
tests/history.right f
|
||||||
tests/history.list f
|
tests/history.list f
|
||||||
tests/ifs-test-1.sh f
|
tests/ifs-1.test f
|
||||||
tests/ifs-test-2.sh f
|
tests/ifs-2.test f
|
||||||
tests/ifs-test-3.sh f
|
tests/ifs-3.test f
|
||||||
tests/ifs.1.right f
|
tests/ifs-1.right f
|
||||||
tests/ifs.2.right f
|
tests/ifs-2.right f
|
||||||
tests/ifs.3.right f
|
tests/ifs-3.right f
|
||||||
tests/input-line.sh f
|
tests/input-line.sh f
|
||||||
tests/input-line.sub f
|
tests/input-line.sub f
|
||||||
tests/input.right f
|
tests/input.right f
|
||||||
tests/jobs.tests f
|
tests/jobs.tests f
|
||||||
|
tests/jobs1.sub f
|
||||||
|
tests/jobs2.sub f
|
||||||
tests/jobs.right f
|
tests/jobs.right f
|
||||||
tests/more-exp.tests f
|
tests/more-exp.tests f
|
||||||
tests/more-exp.right f
|
tests/more-exp.right f
|
||||||
tests/new-exp.tests f
|
tests/new-exp.tests f
|
||||||
tests/new-exp.sub1 f
|
tests/new-exp1.sub f
|
||||||
|
tests/new-exp2.sub f
|
||||||
tests/new-exp.right f
|
tests/new-exp.right f
|
||||||
tests/nquote.tests f
|
tests/nquote.tests f
|
||||||
tests/nquote.right f
|
tests/nquote.right f
|
||||||
tests/posix2.tests f
|
tests/posix2.tests f
|
||||||
tests/posix2.right f
|
tests/posix2.right f
|
||||||
|
tests/posixpat.tests f
|
||||||
|
tests/posixpat.right f
|
||||||
tests/prec.right f
|
tests/prec.right f
|
||||||
tests/precedence f
|
tests/precedence f
|
||||||
|
tests/printf.tests f
|
||||||
|
tests/printf.right f
|
||||||
tests/quote.tests f
|
tests/quote.tests f
|
||||||
tests/quote.right f
|
tests/quote.right f
|
||||||
tests/read.tests f
|
tests/read.tests f
|
||||||
|
@ -511,13 +569,16 @@ tests/run-all f
|
||||||
tests/run-minimal f
|
tests/run-minimal f
|
||||||
tests/run-arith f
|
tests/run-arith f
|
||||||
tests/run-array f
|
tests/run-array f
|
||||||
|
tests/run-array2 f
|
||||||
tests/run-braces f
|
tests/run-braces f
|
||||||
tests/run-builtins f
|
tests/run-builtins f
|
||||||
|
tests/run-cond f
|
||||||
tests/run-dirstack f
|
tests/run-dirstack f
|
||||||
tests/run-dollars f
|
tests/run-dollars f
|
||||||
tests/run-errors f
|
tests/run-errors f
|
||||||
tests/run-execscript f
|
tests/run-execscript f
|
||||||
tests/run-exp-tests f
|
tests/run-exp-tests f
|
||||||
|
tests/run-extglob f
|
||||||
tests/run-func f
|
tests/run-func f
|
||||||
tests/run-getopts f
|
tests/run-getopts f
|
||||||
tests/run-glob-test f
|
tests/run-glob-test f
|
||||||
|
@ -531,13 +592,16 @@ tests/run-more-exp f
|
||||||
tests/run-new-exp f
|
tests/run-new-exp f
|
||||||
tests/run-nquote f
|
tests/run-nquote f
|
||||||
tests/run-posix2 f
|
tests/run-posix2 f
|
||||||
|
tests/run-posixpat f
|
||||||
tests/run-precedence f
|
tests/run-precedence f
|
||||||
|
tests/run-printf f
|
||||||
tests/run-quote f
|
tests/run-quote f
|
||||||
tests/run-read f
|
tests/run-read f
|
||||||
tests/run-redir f
|
tests/run-redir f
|
||||||
tests/run-rhs-exp f
|
tests/run-rhs-exp f
|
||||||
tests/run-rsh f
|
tests/run-rsh f
|
||||||
tests/run-set-e-test f
|
tests/run-set-e f
|
||||||
|
tests/run-shopt f
|
||||||
tests/run-strip f
|
tests/run-strip f
|
||||||
tests/run-test f
|
tests/run-test f
|
||||||
tests/run-tilde f
|
tests/run-tilde f
|
||||||
|
@ -546,6 +610,8 @@ tests/run-type f
|
||||||
tests/run-varenv f
|
tests/run-varenv f
|
||||||
tests/set-e-test f
|
tests/set-e-test f
|
||||||
tests/set-e.right f
|
tests/set-e.right f
|
||||||
|
tests/shopt.tests f
|
||||||
|
tests/shopt.right f
|
||||||
tests/strip.tests f
|
tests/strip.tests f
|
||||||
tests/strip.right f
|
tests/strip.right f
|
||||||
tests/test-tests f
|
tests/test-tests f
|
||||||
|
@ -554,27 +620,28 @@ tests/tilde-tests f
|
||||||
tests/tilde.right f
|
tests/tilde.right f
|
||||||
tests/trap.tests f
|
tests/trap.tests f
|
||||||
tests/trap.right f
|
tests/trap.right f
|
||||||
tests/trap.sub1 f 755
|
tests/trap1.sub f 755
|
||||||
tests/type.tests f
|
tests/type.tests f
|
||||||
tests/type.right f
|
tests/type.right f
|
||||||
tests/varenv.right f
|
tests/varenv.right f
|
||||||
tests/varenv.sh f
|
tests/varenv.sh f
|
||||||
tests/version f
|
tests/version f
|
||||||
tests/version.mini f
|
tests/version.mini f
|
||||||
tests/misc/haertel.perftest f
|
tests/misc/perftest f
|
||||||
tests/misc/perf-script f
|
tests/misc/perf-script f
|
||||||
tests/misc/redir.t2.sh f
|
tests/misc/redir-t2.sh f
|
||||||
tests/misc/run.r2.sh f
|
tests/misc/run-r2.sh f
|
||||||
tests/misc/sigint.t1.sh f
|
tests/misc/sigint-1.sh f
|
||||||
tests/misc/sigint.t2.sh f
|
tests/misc/sigint-2.sh f
|
||||||
tests/misc/sigint.t3.sh f
|
tests/misc/sigint-3.sh f
|
||||||
tests/misc/sigint.t4.sh f
|
tests/misc/sigint-4.sh f
|
||||||
tests/misc/test-minus-e.1 f
|
tests/misc/test-minus-e.1 f
|
||||||
tests/misc/test-minus-e.2 f
|
tests/misc/test-minus-e.2 f
|
||||||
examples/scripts.v2/PERMISSION f
|
examples/scripts.v2/PERMISSION f
|
||||||
examples/scripts.v2/README f
|
examples/scripts.v2/README f
|
||||||
examples/scripts.v2/arc2tarz f
|
examples/scripts.v2/arc2tarz f
|
||||||
examples/scripts.v2/bashrand f
|
examples/scripts.v2/bashrand f
|
||||||
|
examples/scripts.v2/cal2day.bash f
|
||||||
examples/scripts.v2/cdhist.bash f
|
examples/scripts.v2/cdhist.bash f
|
||||||
examples/scripts.v2/corename f
|
examples/scripts.v2/corename f
|
||||||
examples/scripts.v2/fman f
|
examples/scripts.v2/fman f
|
||||||
|
|
121
Makefile.in
121
Makefile.in
|
@ -1,4 +1,4 @@
|
||||||
# Makefile for bash-2.01, version 2.32
|
# Makefile for bash-2.02, version 2.84
|
||||||
#
|
#
|
||||||
# Make sure the first target in the makefile is the right one
|
# Make sure the first target in the makefile is the right one
|
||||||
all: .made
|
all: .made
|
||||||
|
@ -27,6 +27,7 @@ VPATH = .:@srcdir@
|
||||||
|
|
||||||
@SET_MAKE@
|
@SET_MAKE@
|
||||||
CC = @CC@
|
CC = @CC@
|
||||||
|
CC_FOR_BUILD = @CC_FOR_BUILD@
|
||||||
YACC = @YACC@
|
YACC = @YACC@
|
||||||
SHELL=/bin/sh
|
SHELL=/bin/sh
|
||||||
CP = cp
|
CP = cp
|
||||||
|
@ -68,12 +69,13 @@ THIS_SH = $(BUILD_DIR)/$(Program)
|
||||||
|
|
||||||
# PROFILE_FLAGS is either -pg, to generate profiling info for use
|
# PROFILE_FLAGS is either -pg, to generate profiling info for use
|
||||||
# with gprof, or nothing (the default).
|
# with gprof, or nothing (the default).
|
||||||
PROFILE_FLAGS=
|
PROFILE_FLAGS= @PROFILE_FLAGS@
|
||||||
|
|
||||||
# The GNU coding standards don't recognize the possibility that
|
# The GNU coding standards don't recognize the possibility that
|
||||||
# other information besides optimization and debugging might be
|
# other information besides optimization and debugging might be
|
||||||
# passed to cc. A different name should have been used.
|
# passed to cc. A different name should have been used.
|
||||||
CFLAGS = @CFLAGS@
|
CFLAGS = @CFLAGS@
|
||||||
|
CPPFLAGS = @CPPFLAGS@
|
||||||
LOCAL_CFLAGS = @LOCAL_CFLAGS@
|
LOCAL_CFLAGS = @LOCAL_CFLAGS@
|
||||||
DEFS = @DEFS@
|
DEFS = @DEFS@
|
||||||
LOCAL_DEFS = @LOCAL_DEFS@
|
LOCAL_DEFS = @LOCAL_DEFS@
|
||||||
|
@ -105,6 +107,27 @@ LIBSRC = $(srcdir)/$(LIBSUBDIR)
|
||||||
|
|
||||||
SUBDIR_INCLUDES = -I. -I$(topdir) -I$(topdir)/$(LIBSUBDIR) -I$(includedir)
|
SUBDIR_INCLUDES = -I. -I$(topdir) -I$(topdir)/$(LIBSUBDIR) -I$(includedir)
|
||||||
|
|
||||||
|
# the bash library
|
||||||
|
# the library is a mix of functions that the C library does not provide on
|
||||||
|
# some platforms and general shell utility functions
|
||||||
|
SH_LIBSRC = $(LIBSRC)/sh
|
||||||
|
SH_LIBDIR = $(dot)/${LIBSUBDIR}/sh
|
||||||
|
SH_ABSSRC = ${topdir}/${SH_LIBSRC}
|
||||||
|
|
||||||
|
SHLIB_SOURCE = ${SH_LIBSRC}/clktck.c ${SH_LIBSRC}/getcwd.c \
|
||||||
|
${SH_LIBSRC}/getenv.c ${SH_LIBSRC}/oslib.c \
|
||||||
|
${SH_LIBSRC}/setlinebuf.c \
|
||||||
|
${SH_LIBSRC}/strcasecmp.c ${SH_LIBSRC}/strerror.c \
|
||||||
|
${SH_LIBSRC}/strtod.c ${SH_LIBSRC}/strtol.c \
|
||||||
|
${SH_LIBSRC}/strtoul.c ${SH_LIBSRC}/vprint.c \
|
||||||
|
${SH_LIBSRC}/itos.c
|
||||||
|
|
||||||
|
SHLIB_LIB = -lsh
|
||||||
|
SHLIB_LIBNAME = libsh.a
|
||||||
|
SHLIB_LIBRARY = ${SH_LIBDIR}/${SHLIB_LIBNAME}
|
||||||
|
SHLIB_LDFLAGS = -L${SH_LIBDIR}
|
||||||
|
SHLIB_DEP = ${SHLIB_LIBRARY}
|
||||||
|
|
||||||
# we assume for now that readline source is being shipped with bash
|
# we assume for now that readline source is being shipped with bash
|
||||||
RL_LIBSRC = $(LIBSRC)/readline
|
RL_LIBSRC = $(LIBSRC)/readline
|
||||||
RL_LIBDOC = $(RL_LIBSRC)/doc
|
RL_LIBDOC = $(RL_LIBSRC)/doc
|
||||||
|
@ -240,13 +263,13 @@ BASHPOSIX_SUPPORT = $(BASHPOSIX_LIB)/posixstat.h $(BASHPOSIX_LIB)/ansi_stdlib.h
|
||||||
$(BASHPOSIX_LIB)/memalloc.h $(BASHPOSIX_LIB)/stdc.h
|
$(BASHPOSIX_LIB)/memalloc.h $(BASHPOSIX_LIB)/stdc.h
|
||||||
|
|
||||||
LIBRARIES = $(READLINE_LIB) $(HISTORY_LIB) $(TERMCAP_LIB) $(GLOB_LIB) \
|
LIBRARIES = $(READLINE_LIB) $(HISTORY_LIB) $(TERMCAP_LIB) $(GLOB_LIB) \
|
||||||
$(TILDE_LIB) $(MALLOC_LIB) $(LOCAL_LIBS)
|
$(TILDE_LIB) $(MALLOC_LIB) $(SHLIB_LIB) $(LOCAL_LIBS)
|
||||||
|
|
||||||
LIBDEP = $(READLINE_DEP) $(TERMCAP_DEP) $(GLOB_DEP) $(HISTORY_DEP) \
|
LIBDEP = $(READLINE_DEP) $(TERMCAP_DEP) $(GLOB_DEP) $(HISTORY_DEP) \
|
||||||
$(TILDE_DEP) $(MALLOC_DEP)
|
$(TILDE_DEP) $(MALLOC_DEP) $(SHLIB_DEP)
|
||||||
|
|
||||||
LIBRARY_LDFLAGS = $(READLINE_LDFLAGS) $(HISTORY_LDFLAGS) $(TILDE_LDFLAGS) \
|
LIBRARY_LDFLAGS = $(READLINE_LDFLAGS) $(HISTORY_LDFLAGS) $(TILDE_LDFLAGS) \
|
||||||
$(GLOB_LDFLAGS) $(MALLOC_LDFLAGS)
|
$(GLOB_LDFLAGS) $(MALLOC_LDFLAGS) $(SHLIB_LDFLAGS)
|
||||||
|
|
||||||
#
|
#
|
||||||
# The shell itself
|
# The shell itself
|
||||||
|
@ -257,9 +280,9 @@ 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 \
|
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 \
|
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 \
|
test.c trap.c alias.c jobs.c nojobs.c $(ALLOC_FILES) braces.c \
|
||||||
vprint.c input.c bashhist.c array.c sig.c pathexp.c oslib.c \
|
input.c bashhist.c array.c sig.c pathexp.c \
|
||||||
unwind_prot.c siglist.c getcwd.c bashline.c bracecomp.c error.c \
|
unwind_prot.c siglist.c bashline.c bracecomp.c error.c \
|
||||||
list.c stringlib.c locale.c xmalloc.c
|
list.c stringlib.c locale.c findcmd.c redir.c xmalloc.c
|
||||||
|
|
||||||
HSOURCES = shell.h flags.h trap.h hashcmd.h hashlib.h jobs.h builtins.h \
|
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 maxpath.h \
|
general.h variables.h config.h $(ALLOC_HEADERS) alias.h maxpath.h \
|
||||||
|
@ -272,6 +295,9 @@ HSOURCES = shell.h flags.h trap.h hashcmd.h hashlib.h jobs.h builtins.h \
|
||||||
|
|
||||||
SOURCES = $(CSOURCES) $(HSOURCES) $(BUILTIN_DEFS)
|
SOURCES = $(CSOURCES) $(HSOURCES) $(BUILTIN_DEFS)
|
||||||
|
|
||||||
|
# header files chosen based on running of configure
|
||||||
|
SIGNAMES_H = @SIGNAMES_H@
|
||||||
|
|
||||||
# object files chosen based on running of configure
|
# object files chosen based on running of configure
|
||||||
JOBS_O = @JOBS_O@
|
JOBS_O = @JOBS_O@
|
||||||
|
|
||||||
|
@ -281,8 +307,7 @@ OBJECTS = shell.o eval.o y.tab.o general.o make_cmd.o print_cmd.o $(GLOBO) \
|
||||||
expr.o flags.o $(JOBS_O) subst.o hashcmd.o hashlib.o mailcheck.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 \
|
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 \
|
alias.o array.o braces.o bracecomp.o bashhist.o bashline.o \
|
||||||
getcwd.o siglist.o vprint.o oslib.o list.o stringlib.o \
|
siglist.o list.o stringlib.o locale.o findcmd.o redir.o xmalloc.o
|
||||||
locale.o xmalloc.o
|
|
||||||
|
|
||||||
# Where the source code of the shell builtins resides.
|
# Where the source code of the shell builtins resides.
|
||||||
BUILTIN_SRCDIR=$(srcdir)/builtins
|
BUILTIN_SRCDIR=$(srcdir)/builtins
|
||||||
|
@ -303,7 +328,7 @@ BUILTIN_DEFS = $(DEFSRC)/alias.def $(DEFSRC)/bind.def $(DEFSRC)/break.def \
|
||||||
$(DEFSRC)/times.def $(DEFSRC)/trap.def $(DEFSRC)/type.def \
|
$(DEFSRC)/times.def $(DEFSRC)/trap.def $(DEFSRC)/type.def \
|
||||||
$(DEFSRC)/ulimit.def $(DEFSRC)/umask.def $(DEFSRC)/wait.def \
|
$(DEFSRC)/ulimit.def $(DEFSRC)/umask.def $(DEFSRC)/wait.def \
|
||||||
$(DEFSRC)/getopts.def $(DEFSRC)/reserved.def \
|
$(DEFSRC)/getopts.def $(DEFSRC)/reserved.def \
|
||||||
$(DEFSRC)/pushd.def $(DEFSRC)/shopt.def
|
$(DEFSRC)/pushd.def $(DEFSRC)/shopt.def $(DEFSRC)/printf.def
|
||||||
BUILTIN_C_SRC = $(DEFSRC)/mkbuiltins.c $(DEFSRC)/common.c \
|
BUILTIN_C_SRC = $(DEFSRC)/mkbuiltins.c $(DEFSRC)/common.c \
|
||||||
$(DEFSRC)/evalstring.c $(DEFSRC)/evalfile.c \
|
$(DEFSRC)/evalstring.c $(DEFSRC)/evalfile.c \
|
||||||
$(DEFSRC)/bashgetopt.c $(GETOPT_SOURCE)
|
$(DEFSRC)/bashgetopt.c $(GETOPT_SOURCE)
|
||||||
|
@ -317,7 +342,7 @@ BUILTIN_OBJS = $(DEFDIR)/alias.o $(DEFDIR)/bind.o $(DEFDIR)/break.o \
|
||||||
$(DEFDIR)/fg_bg.o $(DEFDIR)/hash.o $(DEFDIR)/help.o \
|
$(DEFDIR)/fg_bg.o $(DEFDIR)/hash.o $(DEFDIR)/help.o \
|
||||||
$(DEFDIR)/history.o $(DEFDIR)/jobs.o $(DEFDIR)/kill.o \
|
$(DEFDIR)/history.o $(DEFDIR)/jobs.o $(DEFDIR)/kill.o \
|
||||||
$(DEFDIR)/let.o $(DEFDIR)/pushd.o $(DEFDIR)/read.o \
|
$(DEFDIR)/let.o $(DEFDIR)/pushd.o $(DEFDIR)/read.o \
|
||||||
$(DEFDIR)/return.o $(DEFDIR)/shopt.o \
|
$(DEFDIR)/return.o $(DEFDIR)/shopt.o $(DEFDIR)/printf.o \
|
||||||
$(DEFDIR)/set.o $(DEFDIR)/setattr.o $(DEFDIR)/shift.o \
|
$(DEFDIR)/set.o $(DEFDIR)/setattr.o $(DEFDIR)/shift.o \
|
||||||
$(DEFDIR)/source.o $(DEFDIR)/suspend.o $(DEFDIR)/test.o \
|
$(DEFDIR)/source.o $(DEFDIR)/suspend.o $(DEFDIR)/test.o \
|
||||||
$(DEFDIR)/times.o $(DEFDIR)/trap.o $(DEFDIR)/type.o \
|
$(DEFDIR)/times.o $(DEFDIR)/trap.o $(DEFDIR)/type.o \
|
||||||
|
@ -342,13 +367,14 @@ SDIR = $(dot)/support/
|
||||||
|
|
||||||
TESTS_SUPPORT = recho zecho printenv
|
TESTS_SUPPORT = recho zecho printenv
|
||||||
CREATED_SUPPORT = signames.h recho zecho printenv tests/recho tests/zecho \
|
CREATED_SUPPORT = signames.h recho zecho printenv tests/recho tests/zecho \
|
||||||
tests/printenv mksignames
|
tests/printenv mksignames lsignames.h
|
||||||
CREATED_CONFIGURE = config.h config.cache config.status config.log \
|
CREATED_CONFIGURE = config.h config.cache config.status config.log \
|
||||||
stamp-h
|
stamp-h
|
||||||
CREATED_MAKEFILES = Makefile builtins/Makefile doc/Makefile \
|
CREATED_MAKEFILES = Makefile builtins/Makefile doc/Makefile \
|
||||||
lib/readline/Makefile lib/glob/Makefile \
|
lib/readline/Makefile lib/glob/Makefile \
|
||||||
lib/tilde/Makefile lib/malloc/Makefile \
|
lib/sh/Makefile lib/tilde/Makefile lib/malloc/Makefile \
|
||||||
lib/termcap/Makefile
|
lib/termcap/Makefile examples/loadables/Makefile \
|
||||||
|
support/Makefile
|
||||||
|
|
||||||
# Keep GNU Make from exporting the entire environment for small machines.
|
# Keep GNU Make from exporting the entire environment for small machines.
|
||||||
.NOEXPORT:
|
.NOEXPORT:
|
||||||
|
@ -358,7 +384,7 @@ CREATED_MAKEFILES = Makefile builtins/Makefile doc/Makefile \
|
||||||
|
|
||||||
$(Program): .build $(OBJECTS) $(BUILTINS_DEP) $(LIBDEP)
|
$(Program): .build $(OBJECTS) $(BUILTINS_DEP) $(LIBDEP)
|
||||||
$(RM) $@
|
$(RM) $@
|
||||||
$(PURIFY) $(CC) $(LDFLAGS) $(BUILTINS_LDFLAGS) $(LIBRARY_LDFLAGS) -o $(Program) $(OBJECTS) $(LIBS)
|
$(PURIFY) $(CC) $(BUILTINS_LDFLAGS) $(LIBRARY_LDFLAGS) $(LDFLAGS) -o $(Program) $(OBJECTS) $(LIBS)
|
||||||
ls -l $(Program)
|
ls -l $(Program)
|
||||||
size $(Program)
|
size $(Program)
|
||||||
|
|
||||||
|
@ -432,13 +458,24 @@ $(TERMCAP_LIBRARY): config.h ${TERMCAP_SOURCE}
|
||||||
@(cd ${TERM_LIBDIR} && \
|
@(cd ${TERM_LIBDIR} && \
|
||||||
$(MAKE) $(MFLAGS) libtermcap.a) || exit 1
|
$(MAKE) $(MFLAGS) libtermcap.a) || exit 1
|
||||||
|
|
||||||
|
$(SHLIB_LIBRARY): config.h ${SHLIB_SOURCE}
|
||||||
|
@echo making $@ in ${SH_LIBDIR}
|
||||||
|
@(cd ${SH_LIBDIR} && \
|
||||||
|
$(MAKE) $(MFLAGS) ${SHLIB_LIBNAME}) || exit 1
|
||||||
|
|
||||||
mksignames: $(SUPPORT_SRC)mksignames.c
|
mksignames: $(SUPPORT_SRC)mksignames.c
|
||||||
$(CC) $(CCFLAGS) $(CPPFLAGS) -o $@ $(SUPPORT_SRC)mksignames.c
|
$(CC) $(CCFLAGS) $(CPPFLAGS) -o $@ $(SUPPORT_SRC)mksignames.c
|
||||||
|
|
||||||
signames.h: mksignames
|
# make a list of signals for the local system -- this is done when we're
|
||||||
|
# *not* cross-compiling
|
||||||
|
lsignames.h: mksignames
|
||||||
$(RM) $@
|
$(RM) $@
|
||||||
./mksignames $@
|
./mksignames $@
|
||||||
|
|
||||||
|
# copy the correct signames header file to signames.h
|
||||||
|
signames.h: $(SIGNAMES_H)
|
||||||
|
-if cmp -s $(SIGNAMES_H) $@ ; then :; else $(RM) $@ ; $(CP) $(SIGNAMES_H) $@ ; fi
|
||||||
|
|
||||||
$(BUILTINS_LIBRARY): $(BUILTIN_DEFS) $(BUILTIN_C_SRC) config.h memalloc.h
|
$(BUILTINS_LIBRARY): $(BUILTIN_DEFS) $(BUILTIN_C_SRC) config.h memalloc.h
|
||||||
@(cd $(DEFDIR) && $(MAKE) $(MFLAGS) libbuiltins.a ) || exit 1
|
@(cd $(DEFDIR) && $(MAKE) $(MFLAGS) libbuiltins.a ) || exit 1
|
||||||
|
|
||||||
|
@ -587,7 +624,7 @@ test tests check: force $(Program) $(TESTS_SUPPORT)
|
||||||
@-test -d tests || mkdir tests
|
@-test -d tests || mkdir tests
|
||||||
@cp $(TESTS_SUPPORT) tests
|
@cp $(TESTS_SUPPORT) tests
|
||||||
@( cd $(srcdir)/tests && \
|
@( cd $(srcdir)/tests && \
|
||||||
PATH=$$PATH:$(BUILD_DIR)/tests THIS_SH=$(THIS_SH) sh ${TESTSCRIPT} )
|
PATH=$$PATH:$(BUILD_DIR)/tests THIS_SH=$(THIS_SH) $(SHELL) ${TESTSCRIPT} )
|
||||||
|
|
||||||
symlinks:
|
symlinks:
|
||||||
$(SHELL) $(SUPPORT_SRC)fixlinks -s $(srcdir)
|
$(SHELL) $(SUPPORT_SRC)fixlinks -s $(srcdir)
|
||||||
|
@ -633,8 +670,6 @@ dispose_cmd.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h
|
||||||
dispose_cmd.o: error.h general.h bashtypes.h variables.h array.h hashlib.h
|
dispose_cmd.o: error.h general.h bashtypes.h variables.h array.h hashlib.h
|
||||||
dispose_cmd.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
|
dispose_cmd.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
|
||||||
dispose_cmd.o: make_cmd.h subst.h sig.h pathnames.h externs.h
|
dispose_cmd.o: make_cmd.h subst.h sig.h pathnames.h externs.h
|
||||||
getcwd.o: config.h bashtypes.h bashansi.h
|
|
||||||
getcwd.o: maxpath.h posixstat.h posixdir.h memalloc.h
|
|
||||||
error.o: config.h bashtypes.h bashansi.h ansi_stdlib.h flags.h stdc.h error.h
|
error.o: config.h bashtypes.h bashansi.h ansi_stdlib.h flags.h stdc.h error.h
|
||||||
error.o: command.h general.h externs.h input.h bashhist.h
|
error.o: command.h general.h externs.h input.h bashhist.h
|
||||||
eval.o: config.h bashansi.h ansi_stdlib.h trap.h flags.h ${DEFSRC}/common.h
|
eval.o: config.h bashansi.h ansi_stdlib.h trap.h flags.h ${DEFSRC}/common.h
|
||||||
|
@ -649,13 +684,18 @@ execute_cmd.o: general.h bashtypes.h variables.h array.h hashlib.h
|
||||||
execute_cmd.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
|
execute_cmd.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
|
||||||
execute_cmd.o: make_cmd.h subst.h sig.h pathnames.h externs.h
|
execute_cmd.o: make_cmd.h subst.h sig.h pathnames.h externs.h
|
||||||
execute_cmd.o: memalloc.h ${GRAM_H} flags.h builtins.h jobs.h quit.h siglist.h
|
execute_cmd.o: memalloc.h ${GRAM_H} flags.h builtins.h jobs.h quit.h siglist.h
|
||||||
execute_cmd.o: execute_cmd.h trap.h pathexp.h $(DEFSRC)/common.h
|
execute_cmd.o: execute_cmd.h findcmd.h redir.h trap.h test.h pathexp.h
|
||||||
execute_cmd.o: ${DEFDIR}/builtext.h ${GLOB_LIBSRC}/fnmatch.h
|
execute_cmd.o: $(DEFSRC)/common.h ${DEFDIR}/builtext.h ${GLOB_LIBSRC}/fnmatch.h
|
||||||
expr.o: config.h bashansi.h ansi_stdlib.h
|
expr.o: config.h bashansi.h ansi_stdlib.h
|
||||||
expr.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
|
expr.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
|
||||||
expr.o: general.h bashtypes.h variables.h array.h hashlib.h
|
expr.o: general.h bashtypes.h variables.h array.h hashlib.h
|
||||||
expr.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
|
expr.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
|
||||||
expr.o: make_cmd.h subst.h sig.h pathnames.h externs.h
|
expr.o: make_cmd.h subst.h sig.h pathnames.h externs.h
|
||||||
|
findcmd.o: config.h bashtypes.h filecntl.h posixstat.h bashansi.h
|
||||||
|
findcmd.o: ansi_stdlib.h memalloc.h shell.h bashjmp.h posixjmp.h command.h
|
||||||
|
findcmd.o: stdc.h error.h general.h variables.h quit.h 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
|
||||||
flags.o: config.h flags.h
|
flags.o: config.h flags.h
|
||||||
flags.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
|
flags.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
|
||||||
flags.o: general.h bashtypes.h variables.h array.h hashlib.h
|
flags.o: general.h bashtypes.h variables.h array.h hashlib.h
|
||||||
|
@ -670,7 +710,7 @@ general.o: maxpath.h
|
||||||
hashcmd.o: config.h posixstat.h bashtypes.h bashansi.h ansi_stdlib.h
|
hashcmd.o: config.h posixstat.h bashtypes.h bashansi.h ansi_stdlib.h
|
||||||
hashcmd.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
|
hashcmd.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
|
||||||
hashcmd.o: general.h bashtypes.h variables.h array.h hashcmd.h
|
hashcmd.o: general.h bashtypes.h variables.h array.h hashcmd.h
|
||||||
hashcmd.o: execute_cmd.h stdc.h
|
hashcmd.o: execute_cmd.h findcmd.h stdc.h
|
||||||
hashlib.o: config.h bashansi.h ansi_stdlib.h
|
hashlib.o: config.h bashansi.h ansi_stdlib.h
|
||||||
hashlib.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
|
hashlib.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
|
||||||
hashlib.o: general.h bashtypes.h variables.h array.h hashlib.h
|
hashlib.o: general.h bashtypes.h variables.h array.h hashlib.h
|
||||||
|
@ -697,11 +737,6 @@ make_cmd.o: config.h bashtypes.h filecntl.h bashansi.h
|
||||||
make_cmd.o: command.h stdc.h general.h error.h flags.h make_cmd.h
|
make_cmd.o: command.h 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: variables.h array.h hashlib.h subst.h input.h externs.h
|
||||||
make_cmd.o: jobs.h quit.h siglist.h
|
make_cmd.o: jobs.h quit.h siglist.h
|
||||||
oslib.o: config.h bashtypes.h posixstat.h filecntl.h bashansi.h maxpath.h
|
|
||||||
oslib.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
|
|
||||||
oslib.o: general.h bashtypes.h variables.h array.h hashlib.h
|
|
||||||
oslib.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
|
|
||||||
oslib.o: make_cmd.h subst.h sig.h pathnames.h externs.h
|
|
||||||
y.tab.o: config.h bashtypes.h bashansi.h ansi_stdlib.h memalloc.h
|
y.tab.o: config.h bashtypes.h bashansi.h ansi_stdlib.h memalloc.h
|
||||||
y.tab.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
|
y.tab.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
|
||||||
y.tab.o: general.h bashtypes.h variables.h array.h hashlib.h
|
y.tab.o: general.h bashtypes.h variables.h array.h hashlib.h
|
||||||
|
@ -722,13 +757,18 @@ print_cmd.o: general.h bashtypes.h variables.h array.h hashlib.h
|
||||||
print_cmd.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
|
print_cmd.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
|
||||||
print_cmd.o: make_cmd.h subst.h sig.h pathnames.h externs.h
|
print_cmd.o: make_cmd.h subst.h sig.h pathnames.h externs.h
|
||||||
print_cmd.o: ${GRAM_H} $(DEFSRC)/common.h
|
print_cmd.o: ${GRAM_H} $(DEFSRC)/common.h
|
||||||
|
redir.o: config.h bashtypes.h posixstat.h bashansi.h ansi_stdlib.h filecntl.h
|
||||||
|
redir.o: memalloc.h shell.h bashjmp.h posixjmp.h command.h stdc.h error.h
|
||||||
|
redir.o: general.h variables.h array.h hashlib.h quit.h 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 posixstat.h bashansi.h ansi_stdlib.h filecntl.h
|
shell.o: config.h bashtypes.h posixstat.h bashansi.h ansi_stdlib.h filecntl.h
|
||||||
shell.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
|
shell.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
|
||||||
shell.o: general.h bashtypes.h variables.h array.h hashlib.h
|
shell.o: general.h bashtypes.h variables.h array.h hashlib.h
|
||||||
shell.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
|
shell.o: quit.h 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
|
||||||
shell.o: flags.h trap.h mailcheck.h builtins.h $(DEFSRC)/common.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 bashhist.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}/fnmatch.h
|
||||||
sig.o: config.h bashtypes.h
|
sig.o: config.h bashtypes.h
|
||||||
sig.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
|
sig.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
|
||||||
|
@ -754,7 +794,7 @@ test.o: bashtypes.h posixstat.h filecntl.h
|
||||||
test.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
|
test.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
|
||||||
test.o: general.h bashtypes.h variables.h array.h hashlib.h
|
test.o: general.h bashtypes.h variables.h array.h hashlib.h
|
||||||
test.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
|
test.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
|
||||||
test.o: make_cmd.h subst.h sig.h pathnames.h externs.h
|
test.o: make_cmd.h subst.h sig.h pathnames.h externs.h test.h
|
||||||
test.o: ${DEFSRC}/common.h
|
test.o: ${DEFSRC}/common.h
|
||||||
trap.o: config.h bashtypes.h trap.h bashansi.h ansi_stdlib.h
|
trap.o: config.h bashtypes.h trap.h bashansi.h ansi_stdlib.h
|
||||||
trap.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
|
trap.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
|
||||||
|
@ -769,10 +809,9 @@ variables.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
|
||||||
variables.o: general.h bashtypes.h variables.h array.h hashlib.h
|
variables.o: general.h bashtypes.h variables.h array.h hashlib.h
|
||||||
variables.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
|
variables.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
|
||||||
variables.o: make_cmd.h subst.h sig.h pathnames.h externs.h
|
variables.o: make_cmd.h subst.h sig.h pathnames.h externs.h
|
||||||
varibales.o: flags.h execute_cmd.h mailcheck.h input.h $(DEFSRC)/common.h
|
variables.o: flags.h execute_cmd.h mailcheck.h input.h $(DEFSRC)/common.h
|
||||||
variables.o: bashhist.h
|
variables.o: findcmd.h bashhist.h
|
||||||
version.o: version.h .build
|
version.o: version.h .build
|
||||||
vprint.o: config.h
|
|
||||||
xmalloc.o: config.h bashtypes.h ansi_stdlib.h error.h
|
xmalloc.o: config.h bashtypes.h ansi_stdlib.h error.h
|
||||||
|
|
||||||
# job control
|
# job control
|
||||||
|
@ -819,7 +858,7 @@ bashline.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
|
||||||
bashline.o: general.h bashtypes.h variables.h array.h hashlib.h
|
bashline.o: general.h bashtypes.h variables.h array.h hashlib.h
|
||||||
bashline.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
|
bashline.o: quit.h maxpath.h unwind_prot.h dispose_cmd.h
|
||||||
bashline.o: make_cmd.h subst.h sig.h pathnames.h externs.h
|
bashline.o: make_cmd.h subst.h sig.h pathnames.h externs.h
|
||||||
bashline.o: builtins.h bashhist.h bashline.h execute_cmd.h pathexp.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: $(DEFSRC)/common.h $(GLOB_LIBSRC)/glob.h alias.h
|
||||||
bracecomp.o: config.h bashansi.h ansi_stdlib.h
|
bracecomp.o: config.h bashansi.h ansi_stdlib.h
|
||||||
bracecomp.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
|
bracecomp.o: shell.h config.h bashjmp.h posixjmp.h command.h stdc.h error.h
|
||||||
|
@ -929,7 +968,7 @@ builtins/exec.o: bashtypes.h
|
||||||
builtins/exec.o: command.h config.h memalloc.h error.h general.h maxpath.h
|
builtins/exec.o: command.h config.h memalloc.h error.h general.h maxpath.h
|
||||||
builtins/exec.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h
|
builtins/exec.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h
|
||||||
builtins/exec.o: dispose_cmd.h make_cmd.h subst.h externs.h execute_cmd.h
|
builtins/exec.o: dispose_cmd.h make_cmd.h subst.h externs.h execute_cmd.h
|
||||||
builtins/exec.o: flags.h quit.h $(DEFSRC)/common.h stdc.h
|
builtins/exec.o: findcmd.h flags.h quit.h $(DEFSRC)/common.h stdc.h
|
||||||
builtins/exit.o: bashtypes.h
|
builtins/exit.o: bashtypes.h
|
||||||
builtins/exit.o: command.h config.h memalloc.h error.h general.h maxpath.h
|
builtins/exit.o: command.h config.h memalloc.h error.h general.h maxpath.h
|
||||||
builtins/exit.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h quit.h
|
builtins/exit.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h quit.h
|
||||||
|
@ -948,7 +987,7 @@ builtins/getopts.o: command.h config.h memalloc.h error.h general.h maxpath.h
|
||||||
builtins/getopts.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h quit.h
|
builtins/getopts.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h quit.h
|
||||||
builtins/getopts.o: dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
|
builtins/getopts.o: dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
|
||||||
builtins/hash.o: bashtypes.h
|
builtins/hash.o: bashtypes.h
|
||||||
builtins/hash.o: builtins.h command.h execute_cmd.h stdc.h $(DEFSRC)/common.h
|
builtins/hash.o: builtins.h command.h findcmd.h stdc.h $(DEFSRC)/common.h
|
||||||
builtins/hash.o: command.h config.h memalloc.h error.h general.h maxpath.h
|
builtins/hash.o: command.h config.h memalloc.h error.h general.h maxpath.h
|
||||||
builtins/hash.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h quit.h
|
builtins/hash.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h quit.h
|
||||||
builtins/help.o: command.h config.h memalloc.h error.h general.h maxpath.h
|
builtins/help.o: command.h config.h memalloc.h error.h general.h maxpath.h
|
||||||
|
@ -973,6 +1012,10 @@ builtins/kill.o: shell.h bashjmp.h posixjmp.h sig.h trap.h unwind_prot.h variabl
|
||||||
builtins/let.o: command.h config.h memalloc.h error.h general.h maxpath.h
|
builtins/let.o: command.h config.h memalloc.h error.h general.h maxpath.h
|
||||||
builtins/let.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
|
builtins/let.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
|
||||||
builtins/let.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h
|
builtins/let.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h
|
||||||
|
builtins/printf.o: config.h 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: externs.h sig.h pathnames.h shell.h unwind_prot.h
|
||||||
|
builtins/printf.o: variables.h stdc.h $(DEFSRC)/bashgetopt.h
|
||||||
builtins/pushd.o: command.h config.h memalloc.h error.h general.h maxpath.h
|
builtins/pushd.o: command.h config.h memalloc.h error.h general.h maxpath.h
|
||||||
builtins/pushd.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
|
builtins/pushd.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
|
||||||
builtins/pushd.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h
|
builtins/pushd.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h
|
||||||
|
@ -1000,13 +1043,15 @@ builtins/shopt.o: shell.h bashjmp.h posixjmp.h unwind_prot.h variables.h maxpath
|
||||||
builtins/shopt.o: $(DEFSRC)/common.h $(DEFSRC)/bashgetopt.h
|
builtins/shopt.o: $(DEFSRC)/common.h $(DEFSRC)/bashgetopt.h
|
||||||
builtins/source.o: command.h config.h memalloc.h error.h general.h maxpath.h
|
builtins/source.o: command.h config.h memalloc.h error.h general.h maxpath.h
|
||||||
builtins/source.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
|
builtins/source.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
|
||||||
builtins/source.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h
|
builtins/source.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h
|
||||||
|
builtins/source.o: findcmd.h
|
||||||
builtins/suspend.o: command.h config.h memalloc.h error.h general.h maxpath.h
|
builtins/suspend.o: command.h config.h memalloc.h error.h general.h maxpath.h
|
||||||
builtins/suspend.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
|
builtins/suspend.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
|
||||||
builtins/suspend.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h
|
builtins/suspend.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h
|
||||||
builtins/test.o: command.h config.h memalloc.h error.h general.h maxpath.h
|
builtins/test.o: command.h config.h memalloc.h error.h general.h maxpath.h
|
||||||
builtins/test.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
|
builtins/test.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
|
||||||
builtins/test.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h
|
builtins/test.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h
|
||||||
|
builtins/test.o: test.h
|
||||||
builtins/times.o: command.h config.h memalloc.h error.h general.h maxpath.h
|
builtins/times.o: command.h config.h memalloc.h error.h general.h maxpath.h
|
||||||
builtins/times.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
|
builtins/times.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
|
||||||
builtins/times.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h
|
builtins/times.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h
|
||||||
|
@ -1015,7 +1060,7 @@ builtins/trap.o: quit.h $(DEFSRC)/common.h
|
||||||
builtins/trap.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h
|
builtins/trap.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h
|
||||||
builtins/trap.o: dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
|
builtins/trap.o: dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
|
||||||
builtins/type.o: command.h config.h memalloc.h error.h general.h maxpath.h
|
builtins/type.o: command.h config.h memalloc.h error.h general.h maxpath.h
|
||||||
builtins/type.o: quit.h $(DEFSRC)/common.h execute_cmd.h
|
builtins/type.o: quit.h $(DEFSRC)/common.h findcmd.h
|
||||||
builtins/type.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h
|
builtins/type.o: shell.h bashjmp.h posixjmp.h sig.h unwind_prot.h variables.h
|
||||||
builtins/type.o: dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
|
builtins/type.o: dispose_cmd.h make_cmd.h subst.h externs.h stdc.h
|
||||||
builtins/ulimit.o: command.h config.h memalloc.h error.h general.h maxpath.h
|
builtins/ulimit.o: command.h config.h memalloc.h error.h general.h maxpath.h
|
||||||
|
|
119
NEWS
119
NEWS
|
@ -1,3 +1,122 @@
|
||||||
|
This is a terse description of the new features added to bash-2.02 since
|
||||||
|
the release of bash-2.01.1. As always, the manual page (doc/bash.1) is
|
||||||
|
the place to look for complete descriptions.
|
||||||
|
|
||||||
|
1. New Features in Bash
|
||||||
|
|
||||||
|
a. A new version of malloc, based on the older GNU malloc, that has many
|
||||||
|
changes, is more page-based, is more conservative with memory usage,
|
||||||
|
and does not `orphan' large blocks when they are freed.
|
||||||
|
|
||||||
|
b. A new version of gmalloc, based on the old GLIBC malloc, with many
|
||||||
|
changes and range checking included by default.
|
||||||
|
|
||||||
|
c. A new implementation of fnmatch(3) that includes full POSIX.2 Basic
|
||||||
|
Regular Expression matching, including character classes, collating
|
||||||
|
symbols, equivalence classes, and support for case-insensitive pattern
|
||||||
|
matching.
|
||||||
|
|
||||||
|
d. ksh-88 egrep-style extended pattern matching ([@+*?!](patlist)) has been
|
||||||
|
implemented, controlled by a new `shopt' option, `extglob'.
|
||||||
|
|
||||||
|
e. There is a new ksh-like `[[' compound command, which implements
|
||||||
|
extended `test' functionality.
|
||||||
|
|
||||||
|
f. There is a new `printf' builtin, implemented according to the POSIX.2
|
||||||
|
specification.
|
||||||
|
|
||||||
|
g. There is a new feature for command substitution: $(< filename) now expands
|
||||||
|
to the contents of `filename', with any trailing newlines removed
|
||||||
|
(equivalent to $(cat filename)).
|
||||||
|
|
||||||
|
h. There are new tilde prefixes which expand to directories from the
|
||||||
|
directory stack.
|
||||||
|
|
||||||
|
i. There is a new `**' arithmetic operator to do exponentiation.
|
||||||
|
|
||||||
|
j. There are new configuration options to control how bash is linked:
|
||||||
|
`--enable-profiling', to allow bash to be profiled with gprof, and
|
||||||
|
`--enable-static-link', to allow bash to be linked statically.
|
||||||
|
|
||||||
|
k. There is a new configuration option, `--enable-cond-command', which
|
||||||
|
controls whether or not the `[[' command is included. It is on by
|
||||||
|
default.
|
||||||
|
|
||||||
|
l. There is a new configuration option, `--enable-extended-glob', which
|
||||||
|
controls whether or not the ksh extended globbing feature is included.
|
||||||
|
It is enabled by default.
|
||||||
|
|
||||||
|
m. There is a new configuration #define in config.h.top that, when enabled,
|
||||||
|
will cause all login shells to source /etc/profile and one of the user-
|
||||||
|
specific login shell startup files, whether or not the shell is
|
||||||
|
interactive.
|
||||||
|
|
||||||
|
n. There is a new invocation option, `--dump-po-strings', to dump
|
||||||
|
a shell script's translatable strings ($"...") in GNU `po' format.
|
||||||
|
|
||||||
|
o. There is a new `shopt' option, `nocaseglob', to enable case-insensitive
|
||||||
|
pattern matching when globbing filenames and using the `case' construct.
|
||||||
|
|
||||||
|
p. There is a new `shopt' option, `huponexit', which, when enabled, causes
|
||||||
|
the shell to send SIGHUP to all jobs when an interactive login shell
|
||||||
|
exits.
|
||||||
|
|
||||||
|
q. `bind' has a new `-u' option, which takes a readline function name as an
|
||||||
|
argument and unbinds all key sequences bound to that function in a
|
||||||
|
specified keymap.
|
||||||
|
|
||||||
|
r. `disown' now has `-a' and `-r' options, to limit operation to all jobs
|
||||||
|
and running jobs, respectively.
|
||||||
|
|
||||||
|
s. The `shopt' `-p' option now causes output to be displayed in a reusable
|
||||||
|
format.
|
||||||
|
|
||||||
|
t. `test' has a new `-N' option, which returns true if the filename argument
|
||||||
|
has been modified since it was last accessed.
|
||||||
|
|
||||||
|
u. `umask' now has a `-p' option to print output in a reusable format.
|
||||||
|
|
||||||
|
v. A new escape sequence, `\xNNN', has been added to the `echo -e' and $'...'
|
||||||
|
translation code. It expands to the character whose ascii code is NNN
|
||||||
|
in hexadecimal.
|
||||||
|
|
||||||
|
w. The prompt string expansion code has a new `\r' escape sequence.
|
||||||
|
|
||||||
|
x. The shell may now be cross-compiled for the CYGWIN32 environment on
|
||||||
|
a Unix machine.
|
||||||
|
|
||||||
|
2. New Features in Readline
|
||||||
|
|
||||||
|
a. There is now an option for `iterative' yank-last-arg handline, so a user
|
||||||
|
can keep entering `M-.', yanking the last argument of successive history
|
||||||
|
lines.
|
||||||
|
|
||||||
|
b. New variable, `print-completions-horizontally', which causes completion
|
||||||
|
matches to be displayed across the screen (like `ls -x') rather than up
|
||||||
|
and down the screen (like `ls').
|
||||||
|
|
||||||
|
c. New variable, `completion-ignore-case', which causes filename completion
|
||||||
|
and matching to be performed case-insensitively.
|
||||||
|
|
||||||
|
d. There is a new bindable command, `magic-space', which causes history
|
||||||
|
expansion to be performed on the current readline buffer and a space to
|
||||||
|
be inserted into the result.
|
||||||
|
|
||||||
|
e. There is a new bindable command, `menu-complete', which enables tcsh-like
|
||||||
|
menu completion (successive executions of menu-complete insert a single
|
||||||
|
completion match, cycling through the list of possible completions).
|
||||||
|
|
||||||
|
f. There is a new bindable command, `paste-from-clipboard', for use on Win32
|
||||||
|
systems, to insert the text from the Win32 clipboard into the editing
|
||||||
|
buffer.
|
||||||
|
|
||||||
|
g. The key sequence translation code now understands printf-style backslash
|
||||||
|
escape sequences, including \NNN octal escapes. These escape sequences
|
||||||
|
may be used in key sequence definitions or macro values.
|
||||||
|
|
||||||
|
h. An `$include' inputrc file parser directive has been added.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
This is a terse description of the new features added to bash-2.01 since
|
This is a terse description of the new features added to bash-2.01 since
|
||||||
the release of bash-2.0. As always, the manual page (doc/bash.1) is the
|
the release of bash-2.0. As always, the manual page (doc/bash.1) is the
|
||||||
place to look for complete descriptions.
|
place to look for complete descriptions.
|
||||||
|
|
57
NOTES
57
NOTES
|
@ -137,3 +137,60 @@ being built and linked against, but there is only a stub file in the archive.)
|
||||||
|
|
||||||
/* Need to get the argument to a -c option processed in the
|
/* Need to get the argument to a -c option processed in the
|
||||||
|
|
||||||
|
8. Some people have asked about binding all of the keys in a PC-keyboard-
|
||||||
|
style numeric keypad to readline functions. Here's something I
|
||||||
|
received from the gnu-win32 list that may help. Insert the following
|
||||||
|
lines into ~/.inputrc:
|
||||||
|
|
||||||
|
# home key
|
||||||
|
"\e[1~":beginning-of-line
|
||||||
|
# insert key
|
||||||
|
"\e[2~":kill-whole-line
|
||||||
|
# del key
|
||||||
|
"\e[3~":delete-char
|
||||||
|
# end key
|
||||||
|
"\e[4~":end-of-line
|
||||||
|
# pgup key
|
||||||
|
"\e[5~":history-search-forward
|
||||||
|
# pgdn key
|
||||||
|
"\e[6~":history-search-backward
|
||||||
|
|
||||||
|
9. Hints for building under Minix 2.0 (Contributed by Terry R. McConnell,
|
||||||
|
<tmc@barnyard.syr.edu>)
|
||||||
|
|
||||||
|
The version of /bin/sh distributed with Minix is not up to the job of
|
||||||
|
running the configure script. The easiest solution is to swap /bin/sh
|
||||||
|
with /usr/bin/ash. Then use chmem(1) to increase the memory allocated
|
||||||
|
to /bin/sh. The following settings are known to work:
|
||||||
|
|
||||||
|
text data bss stack memory
|
||||||
|
63552 9440 3304 65536 141832 /bin/sh
|
||||||
|
|
||||||
|
If you have problems with make or yacc it may be worthwhile first to
|
||||||
|
install the GNU versions of these utilities before attempting to build
|
||||||
|
bash. (As of this writing, all of these utilities are available for the
|
||||||
|
i386 as pre-built binaries via anonymous ftp at math.syr.edu in the
|
||||||
|
pub/mcconnell/minix directory. Note that the GNU version of yacc is called
|
||||||
|
bison.)
|
||||||
|
|
||||||
|
Unless you want to see lots of warnings about old-style declarations,
|
||||||
|
do LOCAL_CFLAGS=-wo; export LOCAL_CFLAGS before running configure.
|
||||||
|
(These warnings are harmless, but annoying.)
|
||||||
|
|
||||||
|
configure will insist that you supply a host type. For example, do
|
||||||
|
./configure --host=i386-pc-minix.
|
||||||
|
|
||||||
|
Minix does not support the system calls required for a proper
|
||||||
|
implementation of ulimit(). The `ulimit' builtin will not be available.
|
||||||
|
|
||||||
|
Configure will fail to notice that many things like uid_t are indeed
|
||||||
|
typedef'd in <sys/types.h>, because it uses egrep for this purpose
|
||||||
|
and minix has no egrep. You could try making a link /usr/bin/egrep -->
|
||||||
|
/usr/bin/grep. Better is to install the GNU version of grep in
|
||||||
|
/usr/local/bin and make the link /usr/local/bin/egrep -->/usr/local/bin/grep.
|
||||||
|
(These must be hard links, of course, since Minix does not support
|
||||||
|
symbolic links.)
|
||||||
|
|
||||||
|
You will see many warnings of the form:
|
||||||
|
warning: unknown s_type: 98
|
||||||
|
I have no idea what this means, but it doesn't seem to matter.
|
||||||
|
|
317
aclocal.m4
vendored
317
aclocal.m4
vendored
|
@ -26,7 +26,8 @@ main()
|
||||||
exit(fl != 1);
|
exit(fl != 1);
|
||||||
}
|
}
|
||||||
], bash_cv_dup2_broken=yes, bash_cv_dup2_broken=no,
|
], bash_cv_dup2_broken=yes, bash_cv_dup2_broken=no,
|
||||||
AC_MSG_ERROR(cannot check dup2 if cross compiling))
|
[AC_MSG_ERROR(cannot check dup2 if cross compiling -- defaulting to no)
|
||||||
|
bash_cv_dup2_broken=no])
|
||||||
])
|
])
|
||||||
AC_MSG_RESULT($bash_cv_dup2_broken)
|
AC_MSG_RESULT($bash_cv_dup2_broken)
|
||||||
if test $bash_cv_dup2_broken = yes; then
|
if test $bash_cv_dup2_broken = yes; then
|
||||||
|
@ -128,7 +129,8 @@ main()
|
||||||
exit(ok ? 0 : 5);
|
exit(ok ? 0 : 5);
|
||||||
}
|
}
|
||||||
], bash_cv_pgrp_pipe=no,bash_cv_pgrp_pipe=yes,
|
], bash_cv_pgrp_pipe=no,bash_cv_pgrp_pipe=yes,
|
||||||
AC_MSG_ERROR(cannot check pgrp synchronization if cross compiling))
|
[AC_MSG_ERROR(cannot check pgrp synchronization if cross compiling -- defaulting to no)
|
||||||
|
bash_cv_pgrp_pipe=no])
|
||||||
])
|
])
|
||||||
AC_MSG_RESULT($bash_cv_pgrp_pipe)
|
AC_MSG_RESULT($bash_cv_pgrp_pipe)
|
||||||
if test $bash_cv_pgrp_pipe = yes; then
|
if test $bash_cv_pgrp_pipe = yes; then
|
||||||
|
@ -169,7 +171,8 @@ dnl
|
||||||
AC_DEFUN(BASH_RLIMIT_TYPE,
|
AC_DEFUN(BASH_RLIMIT_TYPE,
|
||||||
[AC_MSG_CHECKING(for size and type of struct rlimit fields)
|
[AC_MSG_CHECKING(for size and type of struct rlimit fields)
|
||||||
AC_CACHE_VAL(bash_cv_type_rlimit,
|
AC_CACHE_VAL(bash_cv_type_rlimit,
|
||||||
[AC_TRY_COMPILE([#include <sys/types.h>],
|
[AC_TRY_COMPILE([#include <sys/types.h>
|
||||||
|
#include <sys/resource.h>],
|
||||||
[rlim_t xxx;], bash_cv_type_rlimit=rlim_t,[
|
[rlim_t xxx;], bash_cv_type_rlimit=rlim_t,[
|
||||||
AC_TRY_RUN([
|
AC_TRY_RUN([
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -184,7 +187,8 @@ main()
|
||||||
#endif
|
#endif
|
||||||
exit(1);
|
exit(1);
|
||||||
}], bash_cv_type_rlimit=quad_t, bash_cv_type_rlimit=long,
|
}], bash_cv_type_rlimit=quad_t, bash_cv_type_rlimit=long,
|
||||||
AC_MSG_ERROR(cannot check quad_t if cross compiling))])
|
[AC_MSG_ERROR(cannot check quad_t if cross compiling -- defaulting to long)
|
||||||
|
bash_cv_type_rlimit=long])])
|
||||||
])
|
])
|
||||||
AC_MSG_RESULT($bash_cv_type_rlimit)
|
AC_MSG_RESULT($bash_cv_type_rlimit)
|
||||||
if test $bash_cv_type_rlimit = quad_t; then
|
if test $bash_cv_type_rlimit = quad_t; then
|
||||||
|
@ -207,7 +211,7 @@ AC_CACHE_VAL(bash_cv_decl_under_sys_siglist,
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif], [ char *msg = _sys_siglist[2]; ],
|
#endif], [ char *msg = _sys_siglist[2]; ],
|
||||||
bash_cv_decl_under_sys_siglist=yes, bash_cv_decl_under_sys_siglist=no,
|
bash_cv_decl_under_sys_siglist=yes, bash_cv_decl_under_sys_siglist=no,
|
||||||
AC_MSG_ERROR(cannot check for _sys_siglist[] if cross compiling))])dnl
|
[AC_MSG_ERROR(cannot check for _sys_siglist[] if cross compiling -- defaulting to no)])])dnl
|
||||||
AC_MSG_RESULT($bash_cv_decl_under_sys_siglist)
|
AC_MSG_RESULT($bash_cv_decl_under_sys_siglist)
|
||||||
if test $bash_cv_decl_under_sys_siglist = yes; then
|
if test $bash_cv_decl_under_sys_siglist = yes; then
|
||||||
AC_DEFINE(UNDER_SYS_SIGLIST_DECLARED)
|
AC_DEFINE(UNDER_SYS_SIGLIST_DECLARED)
|
||||||
|
@ -232,8 +236,9 @@ main()
|
||||||
char *msg = (char *)_sys_siglist[2];
|
char *msg = (char *)_sys_siglist[2];
|
||||||
exit(msg == 0);
|
exit(msg == 0);
|
||||||
}],
|
}],
|
||||||
bash_cv_under_sys_siglist=yes, bash_cv_under_sys_siglist=no,
|
bash_cv_under_sys_siglist=yes, bash_cv_under_sys_siglist=no,
|
||||||
AC_MSG_ERROR(cannot check for _sys_siglist[] if cross compiling))])dnl
|
[AC_MSG_ERROR(cannot check for _sys_siglist[] if cross compiling -- defaulting to no)
|
||||||
|
bash_cv_under_sys_siglist=no])])
|
||||||
AC_MSG_RESULT($bash_cv_under_sys_siglist)
|
AC_MSG_RESULT($bash_cv_under_sys_siglist)
|
||||||
if test $bash_cv_under_sys_siglist = yes; then
|
if test $bash_cv_under_sys_siglist = yes; then
|
||||||
AC_DEFINE(HAVE_UNDER_SYS_SIGLIST)
|
AC_DEFINE(HAVE_UNDER_SYS_SIGLIST)
|
||||||
|
@ -258,8 +263,9 @@ main()
|
||||||
char *msg = sys_siglist[2];
|
char *msg = sys_siglist[2];
|
||||||
exit(msg == 0);
|
exit(msg == 0);
|
||||||
}],
|
}],
|
||||||
bash_cv_sys_siglist=yes, bash_cv_sys_siglist=no,
|
bash_cv_sys_siglist=yes, bash_cv_sys_siglist=no,
|
||||||
AC_MSG_ERROR(cannot check for sys_siglist if cross compiling))])dnl
|
[AC_MSG_ERROR(cannot check for sys_siglist if cross compiling -- defaulting to no)
|
||||||
|
bash_cv_sys_siglist=no])])
|
||||||
AC_MSG_RESULT($bash_cv_sys_siglist)
|
AC_MSG_RESULT($bash_cv_sys_siglist)
|
||||||
if test $bash_cv_sys_siglist = yes; then
|
if test $bash_cv_sys_siglist = yes; then
|
||||||
AC_DEFINE(HAVE_SYS_SIGLIST)
|
AC_DEFINE(HAVE_SYS_SIGLIST)
|
||||||
|
@ -319,7 +325,9 @@ dir = opendir("/tmp/not_a_directory");
|
||||||
unlink("/tmp/not_a_directory");
|
unlink("/tmp/not_a_directory");
|
||||||
exit (dir == 0);
|
exit (dir == 0);
|
||||||
}], bash_cv_opendir_not_robust=yes,bash_cv_opendir_not_robust=no,
|
}], bash_cv_opendir_not_robust=yes,bash_cv_opendir_not_robust=no,
|
||||||
AC_MSG_ERROR(cannot check opendir if cross compiling))])
|
[AC_MSG_ERROR(cannot check opendir if cross compiling -- defaulting to no)
|
||||||
|
bash_cv_opendir_not_robust=no]
|
||||||
|
)])
|
||||||
AC_MSG_RESULT($bash_cv_opendir_not_robust)
|
AC_MSG_RESULT($bash_cv_opendir_not_robust)
|
||||||
if test $bash_cv_opendir_not_robust = yes; then
|
if test $bash_cv_opendir_not_robust = yes; then
|
||||||
AC_DEFINE(OPENDIR_NOT_ROBUST)
|
AC_DEFINE(OPENDIR_NOT_ROBUST)
|
||||||
|
@ -346,8 +354,116 @@ AC_DEFINE(VOID_SIGHANDLER)
|
||||||
fi
|
fi
|
||||||
])
|
])
|
||||||
|
|
||||||
|
AC_DEFUN(BASH_TYPE_INT32_T,
|
||||||
|
[
|
||||||
|
if test "X$bash_cv_type_int32_t" = "X"; then
|
||||||
|
_bash_needmsg=yes
|
||||||
|
else
|
||||||
|
AC_MSG_CHECKING(which builtin C type is 32 bits wide)
|
||||||
|
_bash_needmsg=
|
||||||
|
fi
|
||||||
|
AC_CACHE_VAL(bash_cv_type_int32_t,
|
||||||
|
[AC_TRY_RUN([
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
#if SIZEOF_INT == 4
|
||||||
|
exit (0);
|
||||||
|
#else
|
||||||
|
# if SIZEOF_LONG == 4
|
||||||
|
exit (1);
|
||||||
|
# else
|
||||||
|
# error cannot find 32 bit type...
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
}], bash_cv_type_int32_t=int, bash_cv_type_int32_t=long,
|
||||||
|
[AC_MSG_ERROR(cannot check type sizes if cross-compiling -- defaulting to int)
|
||||||
|
bash_cv_type_int32_t=int]
|
||||||
|
)])
|
||||||
|
if test "X$_bash_needmsg" = "Xyes"; then
|
||||||
|
AC_MSG_CHECKING(which builtin C type is 32 bits wide)
|
||||||
|
fi
|
||||||
|
AC_MSG_RESULT($bash_cv_type_int32_t);
|
||||||
|
if test "$bash_cv_type_int32_t" = "int"; then
|
||||||
|
AC_DEFINE(int32_t, int)
|
||||||
|
else
|
||||||
|
AC_DEFINE(int32_t, long)
|
||||||
|
fi
|
||||||
|
])
|
||||||
|
|
||||||
|
AC_DEFUN(BASH_TYPE_U_INT32_T,
|
||||||
|
[
|
||||||
|
if test "X$bash_cv_type_u_int32_t" = "X"; then
|
||||||
|
_bash_needmsg=yes
|
||||||
|
else
|
||||||
|
AC_MSG_CHECKING(which unsigned builtin C type is 32 bits wide)
|
||||||
|
_bash_needmsg=
|
||||||
|
fi
|
||||||
|
AC_CACHE_VAL(bash_cv_type_u_int32_t,
|
||||||
|
[AC_TRY_RUN([
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
#if SIZEOF_INT == 4
|
||||||
|
exit (0);
|
||||||
|
#else
|
||||||
|
# if SIZEOF_LONG == 4
|
||||||
|
exit (1);
|
||||||
|
# else
|
||||||
|
# error cannot find 32 bit type...
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
}], bash_cv_type_u_int32_t=int, bash_cv_type_u_int32_t=long,
|
||||||
|
[AC_MSG_ERROR(cannot check type sizes if cross-compiling -- defaulting to int)
|
||||||
|
bash_cv_type_u_int32_t=int]
|
||||||
|
)])
|
||||||
|
if test "X$_bash_needmsg" = "Xyes"; then
|
||||||
|
AC_MSG_CHECKING(which unsigned builtin C type is 32 bits wide)
|
||||||
|
fi
|
||||||
|
AC_MSG_RESULT($bash_cv_type_u_int32_t);
|
||||||
|
if test "$bash_cv_type_u_int32_t" = "int"; then
|
||||||
|
AC_DEFINE(u_int32_t, unsigned int)
|
||||||
|
else
|
||||||
|
AC_DEFINE(u_int32_t, unsigned long)
|
||||||
|
fi
|
||||||
|
])
|
||||||
|
|
||||||
|
AC_DEFUN(BASH_TYPE_PTRDIFF_T,
|
||||||
|
[
|
||||||
|
if test "X$bash_cv_type_ptrdiff_t" = "X"; then
|
||||||
|
_bash_needmsg=yes
|
||||||
|
else
|
||||||
|
AC_MSG_CHECKING(which builtin C type is correct for ptrdiff_t)
|
||||||
|
_bash_needmsg=
|
||||||
|
fi
|
||||||
|
AC_CACHE_VAL(bash_cv_type_ptrdiff_t,
|
||||||
|
[AC_TRY_RUN([
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
#if SIZEOF_CHAR_P == SIZEOF_INT
|
||||||
|
exit (0);
|
||||||
|
#else
|
||||||
|
# if SIZEOF_CHAR_P == SIZEOF_LONG
|
||||||
|
exit (1);
|
||||||
|
# else
|
||||||
|
# error cannot find type for pointer arithmetic...
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
}], bash_cv_type_ptrdiff_t=int, bash_cv_type_ptrdiff_t=long,
|
||||||
|
[AC_MSG_ERROR(cannot check type sizes if cross-compiling -- defaulting to int)
|
||||||
|
bash_cv_type_ptrdiff_t=int]
|
||||||
|
)])
|
||||||
|
if test "X$_bash_needmsg" = "Xyes"; then
|
||||||
|
AC_MSG_CHECKING(which builtin C type is correct for ptrdiff_t)
|
||||||
|
fi
|
||||||
|
AC_MSG_RESULT($bash_cv_type_ptrdiff_t);
|
||||||
|
if test "$bash_cv_type_ptrdiff_t" = "int"; then
|
||||||
|
AC_DEFINE(ptrdiff_t, int)
|
||||||
|
else
|
||||||
|
AC_DEFINE(ptrdiff_t, long)
|
||||||
|
fi
|
||||||
|
])
|
||||||
|
|
||||||
AC_DEFUN(BASH_FUNC_STRSIGNAL,
|
AC_DEFUN(BASH_FUNC_STRSIGNAL,
|
||||||
[AC_MSG_CHECKING([for the existance of strsignal])
|
[AC_MSG_CHECKING([for the existence of strsignal])
|
||||||
AC_CACHE_VAL(bash_cv_have_strsignal,
|
AC_CACHE_VAL(bash_cv_have_strsignal,
|
||||||
[AC_TRY_LINK([#include <sys/types.h>
|
[AC_TRY_LINK([#include <sys/types.h>
|
||||||
#include <signal.h>],
|
#include <signal.h>],
|
||||||
|
@ -366,7 +482,7 @@ AC_CACHE_CHECK([for lstat], bash_cv_func_lstat,
|
||||||
[AC_TRY_LINK([
|
[AC_TRY_LINK([
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
],[ lstat("",(struct stat *)0); ],
|
],[ lstat(".",(struct stat *)0); ],
|
||||||
bash_cv_func_lstat=yes, bash_cv_func_lstat=no)])
|
bash_cv_func_lstat=yes, bash_cv_func_lstat=no)])
|
||||||
if test $bash_cv_func_lstat = yes; then
|
if test $bash_cv_func_lstat = yes; then
|
||||||
AC_DEFINE(HAVE_LSTAT)
|
AC_DEFINE(HAVE_LSTAT)
|
||||||
|
@ -432,7 +548,9 @@ s = getenv("ABCDE");
|
||||||
exit(s == 0); /* force optimizer to leave getenv in */
|
exit(s == 0); /* force optimizer to leave getenv in */
|
||||||
}
|
}
|
||||||
], bash_cv_getenv_redef=yes, bash_cv_getenv_redef=no,
|
], bash_cv_getenv_redef=yes, bash_cv_getenv_redef=no,
|
||||||
AC_MSG_ERROR(cannot check getenv redefinition if cross compiling))])
|
[AC_MSG_ERROR(cannot check getenv redefinition if cross compiling -- defaulting to yes)
|
||||||
|
bash_cv_getenv_redef=yes]
|
||||||
|
)])
|
||||||
AC_MSG_RESULT($bash_cv_getenv_redef)
|
AC_MSG_RESULT($bash_cv_getenv_redef)
|
||||||
if test $bash_cv_getenv_redef = yes; then
|
if test $bash_cv_getenv_redef = yes; then
|
||||||
AC_DEFINE(CAN_REDEFINE_GETENV)
|
AC_DEFINE(CAN_REDEFINE_GETENV)
|
||||||
|
@ -455,8 +573,10 @@ _bashfunc pf;
|
||||||
pf = (_bashfunc) printf;
|
pf = (_bashfunc) printf;
|
||||||
exit(pf == 0);
|
exit(pf == 0);
|
||||||
}
|
}
|
||||||
],bash_cv_printf_declared=yes, bash_cv_printf_declared=no,
|
], bash_cv_printf_declared=yes, bash_cv_printf_declared=no,
|
||||||
AC_MSG_ERROR(cannot check printf declaration if cross compiling))])
|
[AC_MSG_ERROR(cannot check printf declaration if cross compiling -- defaulting to yes)
|
||||||
|
bash_cv_printf_declared=yes]
|
||||||
|
)])
|
||||||
AC_MSG_RESULT($bash_cv_printf_declared)
|
AC_MSG_RESULT($bash_cv_printf_declared)
|
||||||
if test $bash_cv_printf_declared = yes; then
|
if test $bash_cv_printf_declared = yes; then
|
||||||
AC_DEFINE(PRINTF_DECLARED)
|
AC_DEFINE(PRINTF_DECLARED)
|
||||||
|
@ -472,8 +592,10 @@ main()
|
||||||
long maxfds = ulimit(4, 0L);
|
long maxfds = ulimit(4, 0L);
|
||||||
exit (maxfds == -1L);
|
exit (maxfds == -1L);
|
||||||
}
|
}
|
||||||
],bash_cv_ulimit_maxfds=yes, bash_cv_ulimit_maxfds=no,
|
], bash_cv_ulimit_maxfds=yes, bash_cv_ulimit_maxfds=no,
|
||||||
AC_MSG_ERROR(cannot check ulimit if cross compiling))])
|
[AC_MSG_ERROR(cannot check ulimit if cross compiling -- defaulting to no)
|
||||||
|
bash_cv_ulimit_maxfds=no]
|
||||||
|
)])
|
||||||
AC_MSG_RESULT($bash_cv_ulimit_maxfds)
|
AC_MSG_RESULT($bash_cv_ulimit_maxfds)
|
||||||
if test $bash_cv_ulimit_maxfds = yes; then
|
if test $bash_cv_ulimit_maxfds = yes; then
|
||||||
AC_DEFINE(ULIMIT_MAXFDS)
|
AC_DEFINE(ULIMIT_MAXFDS)
|
||||||
|
@ -497,7 +619,7 @@ if test "X$_bash_needmsg" = "Xyes"; then
|
||||||
AC_MSG_CHECKING(which library has the termcap functions)
|
AC_MSG_CHECKING(which library has the termcap functions)
|
||||||
fi
|
fi
|
||||||
AC_MSG_RESULT(using $bash_cv_termcap_lib)
|
AC_MSG_RESULT(using $bash_cv_termcap_lib)
|
||||||
if test $bash_cv_termcap_lib = gnutermcap; then
|
if test $bash_cv_termcap_lib = gnutermcap && test -z "$prefer_curses"; then
|
||||||
LDFLAGS="$LDFLAGS -L./lib/termcap"
|
LDFLAGS="$LDFLAGS -L./lib/termcap"
|
||||||
TERMCAP_LIB="./lib/termcap/libtermcap.a"
|
TERMCAP_LIB="./lib/termcap/libtermcap.a"
|
||||||
TERMCAP_DEP="./lib/termcap/libtermcap.a"
|
TERMCAP_DEP="./lib/termcap/libtermcap.a"
|
||||||
|
@ -568,7 +690,9 @@ main()
|
||||||
exit (popen_called);
|
exit (popen_called);
|
||||||
}
|
}
|
||||||
], bash_cv_getcwd_calls_popen=no, bash_cv_getcwd_calls_popen=yes,
|
], bash_cv_getcwd_calls_popen=no, bash_cv_getcwd_calls_popen=yes,
|
||||||
AC_MSG_ERROR(cannot check whether getcwd calls popen if cross compiling))])
|
[AC_MSG_ERROR(cannot check whether getcwd calls popen if cross compiling -- defaulting to no)
|
||||||
|
bash_cv_getcwd_calls_popen=no]
|
||||||
|
)])
|
||||||
AC_MSG_RESULT($bash_cv_getcwd_calls_popen)
|
AC_MSG_RESULT($bash_cv_getcwd_calls_popen)
|
||||||
if test $bash_cv_getcwd_calls_popen = yes; then
|
if test $bash_cv_getcwd_calls_popen = yes; then
|
||||||
AC_DEFINE(GETCWD_BROKEN)
|
AC_DEFINE(GETCWD_BROKEN)
|
||||||
|
@ -690,7 +814,9 @@ main()
|
||||||
exit(nsigint != 2);
|
exit(nsigint != 2);
|
||||||
}
|
}
|
||||||
], bash_cv_must_reinstall_sighandlers=no, bash_cv_must_reinstall_sighandlers=yes,
|
], bash_cv_must_reinstall_sighandlers=no, bash_cv_must_reinstall_sighandlers=yes,
|
||||||
AC_MSG_ERROR(cannot check signal handling if cross compiling))])
|
[AC_MSG_ERROR(cannot check signal handling if cross compiling -- defaulting to no)
|
||||||
|
bash_cv_must_reinstall_sighandlers=no]
|
||||||
|
)])
|
||||||
AC_MSG_RESULT($bash_cv_must_reinstall_sighandlers)
|
AC_MSG_RESULT($bash_cv_must_reinstall_sighandlers)
|
||||||
if test $bash_cv_must_reinstall_sighandlers = yes; then
|
if test $bash_cv_must_reinstall_sighandlers = yes; then
|
||||||
AC_DEFINE(MUST_REINSTALL_SIGHANDLERS)
|
AC_DEFINE(MUST_REINSTALL_SIGHANDLERS)
|
||||||
|
@ -756,9 +882,10 @@ exit(1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}],bash_cv_job_control_missing=present, bash_cv_job_control_missing=missing,
|
}], bash_cv_job_control_missing=present, bash_cv_job_control_missing=missing,
|
||||||
AC_MSG_ERROR(cannot check job control if cross-compiling))
|
[AC_MSG_ERROR(cannot check job control if cross-compiling -- defaulting to missing)
|
||||||
])
|
bash_cv_job_control_missing=missing]
|
||||||
|
)])
|
||||||
AC_MSG_RESULT($bash_cv_job_control_missing)
|
AC_MSG_RESULT($bash_cv_job_control_missing)
|
||||||
if test $bash_cv_job_control_missing = missing; then
|
if test $bash_cv_job_control_missing = missing; then
|
||||||
AC_DEFINE(JOB_CONTROL_MISSING)
|
AC_DEFINE(JOB_CONTROL_MISSING)
|
||||||
|
@ -800,9 +927,10 @@ if (fd == -1)
|
||||||
close(fd);
|
close(fd);
|
||||||
unlink ("/tmp/sh-np-autoconf");
|
unlink ("/tmp/sh-np-autoconf");
|
||||||
exit(0);
|
exit(0);
|
||||||
}],bash_cv_sys_named_pipes=present, bash_cv_sys_named_pipes=missing,
|
}], bash_cv_sys_named_pipes=present, bash_cv_sys_named_pipes=missing,
|
||||||
AC_MSG_ERROR(cannot check for named pipes if cross-compiling))
|
[AC_MSG_ERROR(cannot check for named pipes if cross-compiling -- defaulting to missing)
|
||||||
])
|
bash_cv_sys_named_pipes=missing]
|
||||||
|
)])
|
||||||
AC_MSG_RESULT($bash_cv_sys_named_pipes)
|
AC_MSG_RESULT($bash_cv_sys_named_pipes)
|
||||||
if test $bash_cv_sys_named_pipes = missing; then
|
if test $bash_cv_sys_named_pipes = missing; then
|
||||||
AC_DEFINE(NAMED_PIPES_MISSING)
|
AC_DEFINE(NAMED_PIPES_MISSING)
|
||||||
|
@ -850,9 +978,10 @@ sigprocmask(SIG_BLOCK, &set, (sigset_t *)NULL);
|
||||||
siglongjmp(xx, 10);
|
siglongjmp(xx, 10);
|
||||||
exit(1);
|
exit(1);
|
||||||
#endif
|
#endif
|
||||||
}],bash_cv_func_sigsetjmp=present, bash_cv_func_sigsetjmp=missing,
|
}], bash_cv_func_sigsetjmp=present, bash_cv_func_sigsetjmp=missing,
|
||||||
AC_MSG_ERROR(cannot check for sigsetjmp/siglongjmp if cross-compiling))
|
[AC_MSG_ERROR(cannot check for sigsetjmp/siglongjmp if cross-compiling -- defaulting to missing)
|
||||||
])
|
bash_cv_func_sigsetjmp=missing]
|
||||||
|
)])
|
||||||
AC_MSG_RESULT($bash_cv_func_sigsetjmp)
|
AC_MSG_RESULT($bash_cv_func_sigsetjmp)
|
||||||
if test $bash_cv_func_sigsetjmp = present; then
|
if test $bash_cv_func_sigsetjmp = present; then
|
||||||
AC_DEFINE(HAVE_POSIX_SIGSETJMP)
|
AC_DEFINE(HAVE_POSIX_SIGSETJMP)
|
||||||
|
@ -872,14 +1001,23 @@ fi
|
||||||
])
|
])
|
||||||
|
|
||||||
AC_DEFUN(BASH_STRUCT_WINSIZE,
|
AC_DEFUN(BASH_STRUCT_WINSIZE,
|
||||||
[AC_MSG_CHECKING(for struct winsize in sys/ioctl.h)
|
[AC_MSG_CHECKING(for struct winsize in sys/ioctl.h and termios.h)
|
||||||
AC_CACHE_VAL(bash_cv_struct_winsize_in_ioctl,
|
AC_CACHE_VAL(bash_cv_struct_winsize_header,
|
||||||
[AC_TRY_COMPILE([#include <sys/types.h>
|
[AC_TRY_COMPILE([#include <sys/types.h>
|
||||||
#include <sys/ioctl.h>], [struct winsize x;],
|
#include <sys/ioctl.h>], [struct winsize x;],
|
||||||
bash_cv_struct_winsize_in_ioctl=yes,bash_cv_struct_winsize_in_ioctl=no)])
|
bash_cv_struct_winsize_header=ioctl_h,
|
||||||
AC_MSG_RESULT($bash_cv_struct_winsize_in_ioctl)
|
[AC_TRY_COMPILE([#include <sys/types.h>
|
||||||
if test $bash_cv_struct_winsize_in_ioctl = yes; then
|
#include <termios.h>], [struct winsize x;],
|
||||||
AC_DEFINE(STRUCT_WINSIZE_IN_SYS_IOCTL)
|
bash_cv_struct_winsize_header=termios_h, bash_cv_struct_winsize_header=other)
|
||||||
|
])])
|
||||||
|
if test $bash_cv_struct_winsize_header = ioctl_h; then
|
||||||
|
AC_MSG_RESULT(sys/ioctl.h)
|
||||||
|
AC_DEFINE(STRUCT_WINSIZE_IN_SYS_IOCTL)
|
||||||
|
elif test $bash_cv_struct_winsize_header = termios_h; then
|
||||||
|
AC_MSG_RESULT(termios.h)
|
||||||
|
AC_DEFINE(STRUCT_WINSIZE_IN_TERMIOS)
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT(not found)
|
||||||
fi
|
fi
|
||||||
])
|
])
|
||||||
|
|
||||||
|
@ -1051,16 +1189,16 @@ AC_CACHE_VAL(bash_cv_kernel_rlimit,
|
||||||
int f;
|
int f;
|
||||||
f = RLIMIT_DATA;
|
f = RLIMIT_DATA;
|
||||||
], bash_cv_kernel_rlimit=no,
|
], bash_cv_kernel_rlimit=no,
|
||||||
[AC_TRY_COMPILE([
|
[AC_TRY_COMPILE([
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#define _KERNEL
|
#define _KERNEL
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#undef _KERNEL
|
#undef _KERNEL
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
int f;
|
int f;
|
||||||
f = RLIMIT_DATA;
|
f = RLIMIT_DATA;
|
||||||
], bash_cv_kernel_rlimit=yes, bash_cv_kernel_rlimit=no)]
|
], bash_cv_kernel_rlimit=yes, bash_cv_kernel_rlimit=no)]
|
||||||
)])
|
)])
|
||||||
AC_MSG_RESULT($bash_cv_kernel_rlimit)
|
AC_MSG_RESULT($bash_cv_kernel_rlimit)
|
||||||
if test $bash_cv_kernel_rlimit = yes; then
|
if test $bash_cv_kernel_rlimit = yes; then
|
||||||
|
@ -1108,10 +1246,99 @@ char *v[];
|
||||||
exit (r1 > 0 && r2 > 0);
|
exit (r1 > 0 && r2 > 0);
|
||||||
}
|
}
|
||||||
], bash_cv_func_strcoll_broken=yes, bash_cv_func_strcoll_broken=no,
|
], bash_cv_func_strcoll_broken=yes, bash_cv_func_strcoll_broken=no,
|
||||||
AC_MSG_ERROR(cannot check strcoll if cross compiling))
|
[AC_MSG_ERROR(cannot check strcoll if cross compiling -- defaulting to no)
|
||||||
])
|
bash_cv_func_strcoll_broken=no]
|
||||||
|
)])
|
||||||
AC_MSG_RESULT($bash_cv_func_strcoll_broken)
|
AC_MSG_RESULT($bash_cv_func_strcoll_broken)
|
||||||
if test $bash_cv_func_strcoll_broken = yes; then
|
if test $bash_cv_func_strcoll_broken = yes; then
|
||||||
AC_DEFINE(STRCOLL_BROKEN)
|
AC_DEFINE(STRCOLL_BROKEN)
|
||||||
fi
|
fi
|
||||||
])
|
])
|
||||||
|
|
||||||
|
dnl
|
||||||
|
dnl If available, use support for large files unless the user specified
|
||||||
|
dnl one of the CPPFLAGS, LDFLAGS, or LIBS variables (<eggert@twinsun.com>
|
||||||
|
dnl via GNU patch 2.5)
|
||||||
|
dnl
|
||||||
|
AC_DEFUN(BASH_LARGE_FILE_SUPPORT,
|
||||||
|
[AC_MSG_CHECKING(whether large file support needs explicit enabling)
|
||||||
|
ac_getconfs=''
|
||||||
|
ac_result=yes
|
||||||
|
ac_set=''
|
||||||
|
ac_shellvars='CPPFLAGS LDFLAGS LIBS'
|
||||||
|
for ac_shellvar in $ac_shellvars; do
|
||||||
|
case $ac_shellvar in
|
||||||
|
CPPFLAGS) ac_lfsvar=LFS_CFLAGS ac_lfs64var=LFS64_CFLAGS ;;
|
||||||
|
*) ac_lfsvar=LFS_$ac_shellvar ac_lfs64var=LFS64_$ac_shellvar ;;
|
||||||
|
esac
|
||||||
|
eval test '"${'$ac_shellvar'+set}"' = set && ac_set=$ac_shellvar
|
||||||
|
(getconf $ac_lfsvar) >/dev/null 2>&1 || { ac_result=no; break; }
|
||||||
|
ac_getconf=`getconf $ac_lfsvar`
|
||||||
|
ac_getconf64=`getconf $ac_lfs64var`
|
||||||
|
ac_getconfs=$ac_getconfs$ac_getconf\ $ac_getconf64
|
||||||
|
eval ac_test_$ac_shellvar="\$ac_getconf\ \$ac_getconf64"
|
||||||
|
done
|
||||||
|
case "$ac_result$ac_getconfs" in
|
||||||
|
yes) ac_result=no ;;
|
||||||
|
esac
|
||||||
|
case "$ac_result$ac_set" in
|
||||||
|
yes?*) ac_result="yes, but $ac_set is already set, so use its settings"
|
||||||
|
esac
|
||||||
|
AC_MSG_RESULT($ac_result)
|
||||||
|
case $ac_result in
|
||||||
|
yes)
|
||||||
|
for ac_shellvar in $ac_shellvars; do
|
||||||
|
eval $ac_shellvar=\$ac_test_$ac_shellvar
|
||||||
|
done ;;
|
||||||
|
esac
|
||||||
|
])
|
||||||
|
|
||||||
|
dnl
|
||||||
|
dnl AC_SYS_RESTARTABLE_SYSCALLS tests only for restarted system calls
|
||||||
|
dnl after a signal handler has been installed with signal(). Since
|
||||||
|
dnl Bash uses sigaction() if it is available, we need to check whether
|
||||||
|
dnl or not a signal handler installed with sigaction and SA_RESTART
|
||||||
|
dnl causes system calls to be restarted after the signal is caught
|
||||||
|
dnl
|
||||||
|
AC_DEFUN(BASH_SYS_RESTARTABLE_SYSCALLS,
|
||||||
|
[AC_REQUIRE([BASH_SIGNAL_CHECK])
|
||||||
|
AC_CACHE_CHECK(for restartable system calls with posix sigaction,
|
||||||
|
bash_cv_sys_restartable_syscalls,
|
||||||
|
[AC_TRY_RUN(
|
||||||
|
[/* Exit 0 (true) if wait returns something other than -1,
|
||||||
|
i.e. the pid of the child, which means that wait was restarted
|
||||||
|
after getting the signal. */
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <signal.h>
|
||||||
|
static int caught = 0;
|
||||||
|
void ucatch (isig) int isig; { caught = 1; }
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
#if !defined (_POSIX_VERSION) || !defined (HAVE_POSIX_SIGNALS)
|
||||||
|
exit (1);
|
||||||
|
#else
|
||||||
|
struct sigaction act, oact;
|
||||||
|
int i, status;
|
||||||
|
|
||||||
|
act.sa_handler = ucatch;
|
||||||
|
/* Might want to add SA_RESTART here, but bash's set_signal_handler
|
||||||
|
does not. */
|
||||||
|
act.sa_flags = 0;
|
||||||
|
sigemptyset(&act.sa_mask);
|
||||||
|
sigemptyset(&oact.sa_mask);
|
||||||
|
i = fork ();
|
||||||
|
/* A possible race condition here, but in practice it never happens. */
|
||||||
|
if (i == 0) { sleep (3); kill (getppid (), SIGINT); sleep (3); exit (0); }
|
||||||
|
sigaction(SIGINT, &act, &oact);
|
||||||
|
status = wait(&i);
|
||||||
|
if (status == -1) wait(&i);
|
||||||
|
exit (status == -1);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
], bash_cv_sys_restartable_syscalls=yes, bash_cv_sys_restartable_syscalls=no,
|
||||||
|
AC_MSG_ERROR(cannot check restartable syscalls if cross compiling))
|
||||||
|
])
|
||||||
|
if test $bash_cv_sys_restartable_syscalls = yes; then
|
||||||
|
AC_DEFINE(HAVE_RESTARTABLE_SYSCALLS)
|
||||||
|
fi
|
||||||
|
])
|
||||||
|
|
9
alias.c
9
alias.c
|
@ -24,6 +24,9 @@
|
||||||
#if defined (ALIAS)
|
#if defined (ALIAS)
|
||||||
|
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
|
# ifdef _MINIX
|
||||||
|
# include <sys/types.h>
|
||||||
|
# endif
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -411,6 +414,12 @@ rd_token (string, start)
|
||||||
if (quote_char (string[i]))
|
if (quote_char (string[i]))
|
||||||
{
|
{
|
||||||
i = skipquotes (string, i);
|
i = skipquotes (string, i);
|
||||||
|
/* This could be a line that contains a single quote character,
|
||||||
|
in which case skipquotes () terminates with string[i] == '\0'
|
||||||
|
(the end of the string). Check for that here. */
|
||||||
|
if (string[i] == '\0')
|
||||||
|
break;
|
||||||
|
|
||||||
/* Now string[i] is the matching quote character, and the
|
/* Now string[i] is the matching quote character, and the
|
||||||
quoted portion of the token has been scanned. */
|
quoted portion of the token has been scanned. */
|
||||||
continue;
|
continue;
|
||||||
|
|
7
array.c
7
array.c
|
@ -13,6 +13,9 @@
|
||||||
#if defined (ARRAY_VARS)
|
#if defined (ARRAY_VARS)
|
||||||
|
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
|
# ifdef _MINIX
|
||||||
|
# include <sys/types.h>
|
||||||
|
# endif
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -151,6 +154,7 @@ ARRAY_ELEMENT *s, *e;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef INCLUDE_UNUSED
|
||||||
ARRAY_ELEMENT *
|
ARRAY_ELEMENT *
|
||||||
copy_array_element(ae)
|
copy_array_element(ae)
|
||||||
ARRAY_ELEMENT *ae;
|
ARRAY_ELEMENT *ae;
|
||||||
|
@ -158,6 +162,7 @@ ARRAY_ELEMENT *ae;
|
||||||
return(ae ? new_array_element(element_index(ae), element_value(ae))
|
return(ae ? new_array_element(element_index(ae), element_value(ae))
|
||||||
: (ARRAY_ELEMENT *) NULL);
|
: (ARRAY_ELEMENT *) NULL);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add a new element with index I and value V to array A (a[i] = v).
|
* Add a new element with index I and value V to array A (a[i] = v).
|
||||||
|
@ -248,6 +253,7 @@ arrayind_t i;
|
||||||
return((char *) NULL);
|
return((char *) NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef TEST_ARRAY
|
||||||
/*
|
/*
|
||||||
* Walk the array, calling FUNC once for each element, with the array
|
* Walk the array, calling FUNC once for each element, with the array
|
||||||
* element as the argument.
|
* element as the argument.
|
||||||
|
@ -264,6 +270,7 @@ Function *func;
|
||||||
for (ae = element_forw(a->head); ae != a->head; ae = element_forw(ae))
|
for (ae = element_forw(a->head); ae != a->head; ae = element_forw(ae))
|
||||||
(*func)(ae);
|
(*func)(ae);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return a string that is the concatenation of all the elements in A,
|
* Return a string that is the concatenation of all the elements in A,
|
||||||
|
|
19
bashhist.c
19
bashhist.c
|
@ -23,6 +23,9 @@
|
||||||
#if defined (HISTORY)
|
#if defined (HISTORY)
|
||||||
|
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
|
# ifdef _MINIX
|
||||||
|
# include <sys/types.h>
|
||||||
|
# endif
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -174,6 +177,10 @@ bash_history_inhibit_expansion (string, i)
|
||||||
else if (i > 1 && string[i - 1] == '{' && string[i - 2] == '$' &&
|
else if (i > 1 && string[i - 1] == '{' && string[i - 2] == '$' &&
|
||||||
member ('}', string + i + 1))
|
member ('}', string + i + 1))
|
||||||
return (1);
|
return (1);
|
||||||
|
#if defined (EXTENDED_GLOB)
|
||||||
|
else if (extended_glob && i > 1 && string[i+1] == '(' && member (')', string + i + 2))
|
||||||
|
return (1);
|
||||||
|
#endif
|
||||||
else
|
else
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
@ -399,7 +406,7 @@ pre_process_line (line, print_changes, addit)
|
||||||
if (print_changes)
|
if (print_changes)
|
||||||
{
|
{
|
||||||
if (expanded < 0)
|
if (expanded < 0)
|
||||||
internal_error (history_value);
|
internal_error ("%s", history_value);
|
||||||
#if defined (READLINE)
|
#if defined (READLINE)
|
||||||
else if (hist_verify == 0)
|
else if (hist_verify == 0)
|
||||||
#else
|
#else
|
||||||
|
@ -461,9 +468,13 @@ maybe_add_history (line)
|
||||||
should_add = hist_last_line_added = 0;
|
should_add = hist_last_line_added = 0;
|
||||||
|
|
||||||
/* Don't use the value of history_control to affect the second
|
/* Don't use the value of history_control to affect the second
|
||||||
and subsequent lines of a multi-line command when
|
and subsequent lines of a multi-line command (old code did
|
||||||
command_oriented_history is enabled. */
|
this only when command_oriented_history is enabled). */
|
||||||
|
#if 0
|
||||||
if (command_oriented_history && current_command_line_count > 1)
|
if (command_oriented_history && current_command_line_count > 1)
|
||||||
|
#else
|
||||||
|
if (current_command_line_count > 1)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
bash_add_history (line);
|
bash_add_history (line);
|
||||||
return;
|
return;
|
||||||
|
@ -693,7 +704,7 @@ history_should_ignore (line)
|
||||||
else
|
else
|
||||||
npat = histignore.ignores[i].val;
|
npat = histignore.ignores[i].val;
|
||||||
|
|
||||||
match = fnmatch (npat, line, 0) != FNM_NOMATCH;
|
match = fnmatch (npat, line, FNMATCH_EXTFLAG) != FNM_NOMATCH;
|
||||||
|
|
||||||
if (histignore.ignores[i].flags & HIGN_EXPAND)
|
if (histignore.ignores[i].flags & HIGN_EXPAND)
|
||||||
free (npat);
|
free (npat);
|
||||||
|
|
143
bashline.c
143
bashline.c
|
@ -36,6 +36,7 @@
|
||||||
#include "bashhist.h"
|
#include "bashhist.h"
|
||||||
#include "bashline.h"
|
#include "bashline.h"
|
||||||
#include "execute_cmd.h"
|
#include "execute_cmd.h"
|
||||||
|
#include "findcmd.h"
|
||||||
#include "pathexp.h"
|
#include "pathexp.h"
|
||||||
#include "builtins/common.h"
|
#include "builtins/common.h"
|
||||||
#include <readline/rlconf.h>
|
#include <readline/rlconf.h>
|
||||||
|
@ -55,13 +56,20 @@ extern void bash_brace_completion ();
|
||||||
/* Functions bound to keys in Readline for Bash users. */
|
/* Functions bound to keys in Readline for Bash users. */
|
||||||
static void shell_expand_line ();
|
static void shell_expand_line ();
|
||||||
static void display_shell_version (), operate_and_get_next ();
|
static void display_shell_version (), operate_and_get_next ();
|
||||||
static void history_expand_line (), bash_ignore_filenames ();
|
static void bash_ignore_filenames ();
|
||||||
#ifdef ALIAS
|
|
||||||
static void alias_expand_line ();
|
|
||||||
#endif
|
|
||||||
static void history_and_alias_expand_line ();
|
|
||||||
static void cleanup_expansion_error (), set_up_new_line ();
|
static void cleanup_expansion_error (), set_up_new_line ();
|
||||||
|
|
||||||
|
#if defined (BANG_HISTORY)
|
||||||
|
static int history_expand_line ();
|
||||||
|
static int tcsh_magic_space ();
|
||||||
|
#endif /* BANG_HISTORY */
|
||||||
|
#ifdef ALIAS
|
||||||
|
static int alias_expand_line ();
|
||||||
|
#endif
|
||||||
|
#if defined (BANG_HISTORY) && defined (ALIAS)
|
||||||
|
static int history_and_alias_expand_line ();
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Helper functions for Readline. */
|
/* Helper functions for Readline. */
|
||||||
static int bash_directory_completion_hook ();
|
static int bash_directory_completion_hook ();
|
||||||
static void filename_completion_ignore ();
|
static void filename_completion_ignore ();
|
||||||
|
@ -196,9 +204,13 @@ initialize_readline ()
|
||||||
rl_bind_key_in_map (CTRL('E'), (Function *)shell_expand_line, emacs_meta_keymap);
|
rl_bind_key_in_map (CTRL('E'), (Function *)shell_expand_line, emacs_meta_keymap);
|
||||||
|
|
||||||
/* Bind up our special shell functions. */
|
/* Bind up our special shell functions. */
|
||||||
|
#ifdef BANG_HISTORY
|
||||||
rl_add_defun ("history-expand-line", (Function *)history_expand_line, -1);
|
rl_add_defun ("history-expand-line", (Function *)history_expand_line, -1);
|
||||||
rl_bind_key_in_map ('^', (Function *)history_expand_line, emacs_meta_keymap);
|
rl_bind_key_in_map ('^', (Function *)history_expand_line, emacs_meta_keymap);
|
||||||
|
|
||||||
|
rl_add_defun ("magic-space", (Function *)tcsh_magic_space, -1);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef ALIAS
|
#ifdef ALIAS
|
||||||
rl_add_defun ("alias-expand-line", (Function *)alias_expand_line, -1);
|
rl_add_defun ("alias-expand-line", (Function *)alias_expand_line, -1);
|
||||||
rl_add_defun ("history-and-alias-expand-line", (Function *)history_and_alias_expand_line, -1);
|
rl_add_defun ("history-and-alias-expand-line", (Function *)history_and_alias_expand_line, -1);
|
||||||
|
@ -1030,7 +1042,7 @@ command_subst_completion_function (text, state)
|
||||||
orig_start = text;
|
orig_start = text;
|
||||||
if (*text == '`')
|
if (*text == '`')
|
||||||
text++;
|
text++;
|
||||||
else if (*text == '$' && text[1] == '(')
|
else if (*text == '$' && text[1] == '(') /* ) */
|
||||||
text += 2;
|
text += 2;
|
||||||
start_len = text - orig_start;
|
start_len = text - orig_start;
|
||||||
filename_text = savestring (text);
|
filename_text = savestring (text);
|
||||||
|
@ -1173,7 +1185,12 @@ hostname_completion_function (text, state)
|
||||||
return ((char *)NULL);
|
return ((char *)NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* History and alias expand the line. */
|
/* Functions to perform history and alias expansions on the current line. */
|
||||||
|
|
||||||
|
#if defined (BANG_HISTORY)
|
||||||
|
/* Perform history expansion on the current line. If no history expansion
|
||||||
|
is done, pre_process_line() returns what it was passed, so we need to
|
||||||
|
allocate a new line here. */
|
||||||
static char *
|
static char *
|
||||||
history_expand_line_internal (line)
|
history_expand_line_internal (line)
|
||||||
char *line;
|
char *line;
|
||||||
|
@ -1183,22 +1200,6 @@ history_expand_line_internal (line)
|
||||||
new_line = pre_process_line (line, 0, 0);
|
new_line = pre_process_line (line, 0, 0);
|
||||||
return (new_line == line) ? savestring (line) : new_line;
|
return (new_line == line) ? savestring (line) : new_line;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined (ALIAS)
|
|
||||||
/* Expand aliases in the current readline line. */
|
|
||||||
static void
|
|
||||||
alias_expand_line (ignore)
|
|
||||||
int ignore;
|
|
||||||
{
|
|
||||||
char *new_line;
|
|
||||||
|
|
||||||
new_line = alias_expand (rl_line_buffer);
|
|
||||||
|
|
||||||
if (new_line)
|
|
||||||
set_up_new_line (new_line);
|
|
||||||
else
|
|
||||||
cleanup_expansion_error ();
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* There was an error in expansion. Let the preprocessor print
|
/* There was an error in expansion. Let the preprocessor print
|
||||||
|
@ -1259,8 +1260,32 @@ set_up_new_line (new_line)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined (ALIAS)
|
||||||
|
/* Expand aliases in the current readline line. */
|
||||||
|
static int
|
||||||
|
alias_expand_line (ignore)
|
||||||
|
int ignore;
|
||||||
|
{
|
||||||
|
char *new_line;
|
||||||
|
|
||||||
|
new_line = alias_expand (rl_line_buffer);
|
||||||
|
|
||||||
|
if (new_line)
|
||||||
|
{
|
||||||
|
set_up_new_line (new_line);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cleanup_expansion_error ();
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined (BANG_HISTORY)
|
||||||
/* History expand the line. */
|
/* History expand the line. */
|
||||||
static void
|
static int
|
||||||
history_expand_line (ignore)
|
history_expand_line (ignore)
|
||||||
int ignore;
|
int ignore;
|
||||||
{
|
{
|
||||||
|
@ -1269,13 +1294,35 @@ history_expand_line (ignore)
|
||||||
new_line = history_expand_line_internal (rl_line_buffer);
|
new_line = history_expand_line_internal (rl_line_buffer);
|
||||||
|
|
||||||
if (new_line)
|
if (new_line)
|
||||||
set_up_new_line (new_line);
|
{
|
||||||
|
set_up_new_line (new_line);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
cleanup_expansion_error ();
|
{
|
||||||
|
cleanup_expansion_error ();
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Expand history substitutions in the current line and then insert a
|
||||||
|
space wherever set_up_new_line decided to put rl_point. */
|
||||||
|
static int
|
||||||
|
tcsh_magic_space (ignore)
|
||||||
|
int ignore;
|
||||||
|
{
|
||||||
|
if (history_expand_line (ignore) == 0)
|
||||||
|
{
|
||||||
|
rl_insert (1, ' ');
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* History and alias expand the line. */
|
/* History and alias expand the line. */
|
||||||
static void
|
static int
|
||||||
history_and_alias_expand_line (ignore)
|
history_and_alias_expand_line (ignore)
|
||||||
int ignore;
|
int ignore;
|
||||||
{
|
{
|
||||||
|
@ -1297,13 +1344,21 @@ history_and_alias_expand_line (ignore)
|
||||||
#endif /* ALIAS */
|
#endif /* ALIAS */
|
||||||
|
|
||||||
if (new_line)
|
if (new_line)
|
||||||
set_up_new_line (new_line);
|
{
|
||||||
|
set_up_new_line (new_line);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
cleanup_expansion_error ();
|
{
|
||||||
|
cleanup_expansion_error ();
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* History and alias expand the line, then perform the shell word
|
/* History and alias expand the line, then perform the shell word
|
||||||
expansions by calling expand_string. */
|
expansions by calling expand_string. This can't use set_up_new_line()
|
||||||
|
because we want the variable expansions as a separate undo'able
|
||||||
|
set of operations. */
|
||||||
static void
|
static void
|
||||||
shell_expand_line (ignore)
|
shell_expand_line (ignore)
|
||||||
int ignore;
|
int ignore;
|
||||||
|
@ -1369,6 +1424,10 @@ shell_expand_line (ignore)
|
||||||
cleanup_expansion_error ();
|
cleanup_expansion_error ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Define NO_FORCE_FIGNORE if you want to match filenames that would
|
||||||
|
otherwise be ignored if they are the only possible matches. */
|
||||||
|
/* #define NO_FORCE_FIGNORE */
|
||||||
|
|
||||||
/* If FIGNORE is set, then don't match files with the given suffixes when
|
/* If FIGNORE is set, then don't match files with the given suffixes when
|
||||||
completing filenames. If only one of the possibilities has an acceptable
|
completing filenames. If only one of the possibilities has an acceptable
|
||||||
suffix, delete the others, else just return and let the completer
|
suffix, delete the others, else just return and let the completer
|
||||||
|
@ -1393,6 +1452,10 @@ _ignore_completion_names (names, name_func)
|
||||||
{
|
{
|
||||||
char **newnames;
|
char **newnames;
|
||||||
int idx, nidx;
|
int idx, nidx;
|
||||||
|
#ifdef NO_FORCE_FIGNORE
|
||||||
|
char **oldnames;
|
||||||
|
int oidx;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* If there is only one completion, see if it is acceptable. If it is
|
/* If there is only one completion, see if it is acceptable. If it is
|
||||||
not, free it up. In any case, short-circuit and return. This is a
|
not, free it up. In any case, short-circuit and return. This is a
|
||||||
|
@ -1400,11 +1463,13 @@ _ignore_completion_names (names, name_func)
|
||||||
if there is only one completion; it is the completion itself. */
|
if there is only one completion; it is the completion itself. */
|
||||||
if (names[1] == (char *)0)
|
if (names[1] == (char *)0)
|
||||||
{
|
{
|
||||||
|
#ifndef NO_FORCE_FIGNORE
|
||||||
if ((*name_func) (names[0]) == 0)
|
if ((*name_func) (names[0]) == 0)
|
||||||
{
|
{
|
||||||
free (names[0]);
|
free (names[0]);
|
||||||
names[0] = (char *)NULL;
|
names[0] = (char *)NULL;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1413,6 +1478,10 @@ _ignore_completion_names (names, name_func)
|
||||||
for (nidx = 1; names[nidx]; nidx++)
|
for (nidx = 1; names[nidx]; nidx++)
|
||||||
;
|
;
|
||||||
newnames = (char **)xmalloc ((nidx + 1) * (sizeof (char *)));
|
newnames = (char **)xmalloc ((nidx + 1) * (sizeof (char *)));
|
||||||
|
#ifdef NO_FORCE_FIGNORE
|
||||||
|
oldnames = (char **)xmalloc ((nidx - 1) * (sizeof (char *)));
|
||||||
|
oidx = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
newnames[0] = names[0];
|
newnames[0] = names[0];
|
||||||
for (idx = nidx = 1; names[idx]; idx++)
|
for (idx = nidx = 1; names[idx]; idx++)
|
||||||
|
@ -1420,7 +1489,11 @@ _ignore_completion_names (names, name_func)
|
||||||
if ((*name_func) (names[idx]))
|
if ((*name_func) (names[idx]))
|
||||||
newnames[nidx++] = names[idx];
|
newnames[nidx++] = names[idx];
|
||||||
else
|
else
|
||||||
|
#ifndef NO_FORCE_FIGNORE
|
||||||
free (names[idx]);
|
free (names[idx]);
|
||||||
|
#else
|
||||||
|
oldnames[oidx++] = names[idx];
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
newnames[nidx] = (char *)NULL;
|
newnames[nidx] = (char *)NULL;
|
||||||
|
@ -1428,12 +1501,22 @@ _ignore_completion_names (names, name_func)
|
||||||
/* If none are acceptable then let the completer handle it. */
|
/* If none are acceptable then let the completer handle it. */
|
||||||
if (nidx == 1)
|
if (nidx == 1)
|
||||||
{
|
{
|
||||||
|
#ifndef NO_FORCE_FIGNORE
|
||||||
free (names[0]);
|
free (names[0]);
|
||||||
names[0] = (char *)NULL;
|
names[0] = (char *)NULL;
|
||||||
|
#else
|
||||||
|
free (oldnames);
|
||||||
|
#endif
|
||||||
free (newnames);
|
free (newnames);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef NO_FORCE_FIGNORE
|
||||||
|
while (oidx)
|
||||||
|
free (oldnames[--oidx]);
|
||||||
|
free (oldnames);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* If only one is acceptable, copy it to names[0] and return. */
|
/* If only one is acceptable, copy it to names[0] and return. */
|
||||||
if (nidx == 2)
|
if (nidx == 2)
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,6 +28,9 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
|
# ifdef _MINIX
|
||||||
|
# include <sys/types.h>
|
||||||
|
# endif
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
3
braces.c
3
braces.c
|
@ -25,6 +25,9 @@
|
||||||
#if defined (BRACE_EXPANSION)
|
#if defined (BRACE_EXPANSION)
|
||||||
|
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
|
# ifdef _MINIX
|
||||||
|
# include <sys/types.h>
|
||||||
|
# endif
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,9 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
|
# ifdef _MINIX
|
||||||
|
# include <sys/types.h>
|
||||||
|
# endif
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
SHELL = /bin/sh
|
SHELL = /bin/sh
|
||||||
RANLIB = @RANLIB@
|
RANLIB = @RANLIB@
|
||||||
CC = @CC@
|
CC = @CC@
|
||||||
|
CC_FOR_BUILD = @CC_FOR_BUILD@
|
||||||
AR = @AR@
|
AR = @AR@
|
||||||
RM = rm -f
|
RM = rm -f
|
||||||
CP = cp
|
CP = cp
|
||||||
|
@ -11,13 +12,16 @@ srcdir = @srcdir@
|
||||||
VPATH = .:@srcdir@
|
VPATH = .:@srcdir@
|
||||||
topdir = @top_srcdir@
|
topdir = @top_srcdir@
|
||||||
includedir = @includedir@
|
includedir = @includedir@
|
||||||
|
BUILD_DIR = @BUILD_DIR@
|
||||||
|
|
||||||
PROFILE_FLAGS =
|
PROFILE_FLAGS = @PROFILE_FLAGS@
|
||||||
CFLAGS = @CFLAGS@
|
CFLAGS = @CFLAGS@
|
||||||
LOCAL_CFLAGS = @LOCAL_CFLAGS@
|
LOCAL_CFLAGS = @LOCAL_CFLAGS@
|
||||||
CPPFLAGS = @CPPFLAGS@
|
CPPFLAGS = @CPPFLAGS@
|
||||||
DEFS = @DEFS@
|
DEFS = @DEFS@
|
||||||
LOCAL_DEFS = @LOCAL_DEFS@
|
LOCAL_DEFS = @LOCAL_DEFS@
|
||||||
|
LDFLAGS = @LDFLAGS@ $(LOCAL_LDFLAGS) $(CFLAGS)
|
||||||
|
LOCAL_LDFLAGS = @LOCAL_LDFLAGS@
|
||||||
LIBS = @LIBS@
|
LIBS = @LIBS@
|
||||||
|
|
||||||
INCLUDES = -I. -I.. -I$(topdir) -I$(topdir)/lib -I$(srcdir)
|
INCLUDES = -I. -I.. -I$(topdir) -I$(topdir)/lib -I$(srcdir)
|
||||||
|
@ -62,7 +66,8 @@ DEFSRC = $(srcdir)/alias.def $(srcdir)/bind.def $(srcdir)/break.def \
|
||||||
$(srcdir)/source.def $(srcdir)/suspend.def $(srcdir)/test.def \
|
$(srcdir)/source.def $(srcdir)/suspend.def $(srcdir)/test.def \
|
||||||
$(srcdir)/times.def $(srcdir)/trap.def $(srcdir)/type.def \
|
$(srcdir)/times.def $(srcdir)/trap.def $(srcdir)/type.def \
|
||||||
$(srcdir)/ulimit.def $(srcdir)/umask.def $(srcdir)/wait.def \
|
$(srcdir)/ulimit.def $(srcdir)/umask.def $(srcdir)/wait.def \
|
||||||
$(srcdir)/reserved.def $(srcdir)/pushd.def $(srcdir)/shopt.def
|
$(srcdir)/reserved.def $(srcdir)/pushd.def $(srcdir)/shopt.def \
|
||||||
|
$(srcdir)/printf.def
|
||||||
|
|
||||||
STATIC_SOURCE = common.c evalstring.c evalfile.c getopt.c bashgetopt.c \
|
STATIC_SOURCE = common.c evalstring.c evalfile.c getopt.c bashgetopt.c \
|
||||||
getopt.h
|
getopt.h
|
||||||
|
@ -74,40 +79,57 @@ OFILES = builtins.o \
|
||||||
exit.o fc.o fg_bg.o hash.o help.o history.o jobs.o kill.o let.o \
|
exit.o fc.o fg_bg.o hash.o help.o history.o jobs.o kill.o let.o \
|
||||||
pushd.o read.o return.o set.o setattr.o shift.o source.o \
|
pushd.o read.o return.o set.o setattr.o shift.o source.o \
|
||||||
suspend.o test.o times.o trap.o type.o ulimit.o umask.o \
|
suspend.o test.o times.o trap.o type.o ulimit.o umask.o \
|
||||||
wait.o getopts.o shopt.o getopt.o bashgetopt.o
|
wait.o getopts.o shopt.o printf.o getopt.o bashgetopt.o
|
||||||
|
|
||||||
CREATED_FILES = builtext.h builtins.c psize.aux pipesize.h
|
CREATED_FILES = builtext.h builtins.c psize.aux pipesize.h
|
||||||
|
|
||||||
all: $(MKBUILTINS) libbuiltins.a
|
all: $(MKBUILTINS) libbuiltins.a
|
||||||
|
|
||||||
libbuiltins.a: $(MKBUILTINS) $(OFILES)
|
libbuiltins.a: $(MKBUILTINS) $(OFILES) builtins.o
|
||||||
$(RM) $@
|
$(RM) $@
|
||||||
$(AR) cr $@ $(OFILES)
|
$(AR) cr $@ $(OFILES)
|
||||||
-$(RANLIB) $@
|
-$(RANLIB) $@
|
||||||
|
|
||||||
builtext.h builtins.c: $(MKBUILTINS) $(DEFSRC)
|
builtext.h builtins.c: $(MKBUILTINS) $(DEFSRC)
|
||||||
$(RM) builtext.h builtins.c
|
@-if test -f builtins.c; then mv -f builtins.c old-builtins.c; fi
|
||||||
|
@-if test -f builtext.h; then mv -f builtext.h old-builtext.h; fi
|
||||||
./$(MKBUILTINS) -externfile builtext.h -structfile builtins.c \
|
./$(MKBUILTINS) -externfile builtext.h -structfile builtins.c \
|
||||||
-noproduction $(DIRECTDEFINE) $(DEFSRC)
|
-noproduction $(DIRECTDEFINE) $(DEFSRC)
|
||||||
|
@-if cmp -s old-builtext.h builtext.h; then \
|
||||||
|
mv old-builtext.h builtext.h; \
|
||||||
|
else \
|
||||||
|
$(RM) old-builtext.h; \
|
||||||
|
fi
|
||||||
|
@-if cmp -s old-builtins.c builtins.c; then \
|
||||||
|
mv old-builtins.c builtins.c; \
|
||||||
|
else \
|
||||||
|
$(RM) old-builtins.c; \
|
||||||
|
fi
|
||||||
|
|
||||||
mkbuiltins: $(srcdir)/mkbuiltins.c ../config.h
|
mkbuiltins.o: ../config.h
|
||||||
$(CC) $(CCFLAGS) -o $(MKBUILTINS) $(srcdir)/mkbuiltins.c $(LIBS)
|
mkbuiltins.o: mkbuiltins.c
|
||||||
|
$(RM) $@
|
||||||
|
$(CC_FOR_BUILD) -c $(CCFLAGS) $<
|
||||||
|
|
||||||
|
mkbuiltins: mkbuiltins.o
|
||||||
|
$(CC_FOR_BUILD) $(LDFLAGS) -o $(MKBUILTINS) mkbuiltins.o $(LIBS)
|
||||||
|
|
||||||
# rules for deficient makes, like SunOS
|
# rules for deficient makes, like SunOS
|
||||||
|
mkbuiltins.o: mkbuiltins.c
|
||||||
|
builtins.o: builtins.c
|
||||||
common.o: common.c
|
common.o: common.c
|
||||||
bashgetopt.o: bashgetopt.c
|
bashgetopt.o: bashgetopt.c
|
||||||
getopt.o: getopt.c
|
getopt.o: getopt.c
|
||||||
evalstring.o: evalstring.c
|
evalstring.o: evalstring.c
|
||||||
evalfile.o: evalfile.c
|
evalfile.o: evalfile.c
|
||||||
|
|
||||||
ulimit.o: ulimit.def
|
|
||||||
ulimit.o: pipesize.h
|
ulimit.o: pipesize.h
|
||||||
|
|
||||||
pipesize.h: psize.aux
|
pipesize.h: psize.aux
|
||||||
$(SHELL) $(srcdir)/psize.sh > pipesize.h
|
$(SHELL) $(srcdir)/psize.sh > pipesize.h
|
||||||
|
|
||||||
psize.aux: psize.c
|
psize.aux: psize.c
|
||||||
$(CC) $(CCFLAGS) -o $@ $(srcdir)/psize.c
|
$(CC_FOR_BUILD) $(CCFLAGS) -o $@ $(srcdir)/psize.c
|
||||||
|
|
||||||
documentation: builtins.texi
|
documentation: builtins.texi
|
||||||
|
|
||||||
|
@ -146,6 +168,7 @@ history.o: history.def
|
||||||
jobs.o: jobs.def
|
jobs.o: jobs.def
|
||||||
kill.o: kill.def
|
kill.o: kill.def
|
||||||
let.o: let.def
|
let.o: let.def
|
||||||
|
printf.o: printf.def
|
||||||
pushd.o: pushd.def
|
pushd.o: pushd.def
|
||||||
read.o: read.def
|
read.o: read.def
|
||||||
return.o: return.def
|
return.o: return.def
|
||||||
|
@ -159,6 +182,7 @@ test.o: test.def
|
||||||
times.o: times.def
|
times.o: times.def
|
||||||
trap.o: trap.def
|
trap.o: trap.def
|
||||||
type.o: type.def
|
type.o: type.def
|
||||||
|
ulimit.o: ulimit.def
|
||||||
umask.o: umask.def
|
umask.o: umask.def
|
||||||
wait.o: wait.def
|
wait.o: wait.def
|
||||||
getopts.o: getopts.def
|
getopts.o: getopts.def
|
||||||
|
@ -274,6 +298,7 @@ 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)/subst.h $(topdir)/externs.h $(topdir)/flags.h
|
||||||
exec.o: $(topdir)/shell.h $(topdir)/unwind_prot.h $(topdir)/variables.h
|
exec.o: $(topdir)/shell.h $(topdir)/unwind_prot.h $(topdir)/variables.h
|
||||||
exec.o: $(srcdir)/common.h $(topdir)/execute_cmd.h $(topdir)/maxpath.h
|
exec.o: $(srcdir)/common.h $(topdir)/execute_cmd.h $(topdir)/maxpath.h
|
||||||
|
exec.o: $(topdir)/findcmd.h
|
||||||
exit.o: $(topdir)/bashtypes.h
|
exit.o: $(topdir)/bashtypes.h
|
||||||
exit.o: $(topdir)/command.h ../config.h $(topdir)/memalloc.h
|
exit.o: $(topdir)/command.h ../config.h $(topdir)/memalloc.h
|
||||||
exit.o: $(topdir)/error.h $(topdir)/general.h
|
exit.o: $(topdir)/error.h $(topdir)/general.h
|
||||||
|
@ -302,7 +327,7 @@ getopts.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
|
||||||
getopts.o: $(topdir)/subst.h $(topdir)/externs.h $(topdir)/maxpath.h
|
getopts.o: $(topdir)/subst.h $(topdir)/externs.h $(topdir)/maxpath.h
|
||||||
getopts.o: $(topdir)/shell.h $(topdir)/unwind_prot.h $(topdir)/variables.h
|
getopts.o: $(topdir)/shell.h $(topdir)/unwind_prot.h $(topdir)/variables.h
|
||||||
hash.o: $(topdir)/builtins.h $(topdir)/command.h $(topdir)/quit.h
|
hash.o: $(topdir)/builtins.h $(topdir)/command.h $(topdir)/quit.h
|
||||||
hash.o: $(topdir)/execute_cmd.h $(topdir)/hashlib.h
|
hash.o: $(topdir)/findcmd.h $(topdir)/hashlib.h
|
||||||
hash.o: $(topdir)/command.h ../config.h $(topdir)/memalloc.h
|
hash.o: $(topdir)/command.h ../config.h $(topdir)/memalloc.h
|
||||||
hash.o: $(topdir)/error.h $(topdir)/general.h
|
hash.o: $(topdir)/error.h $(topdir)/general.h
|
||||||
hash.o: $(topdir)/shell.h $(topdir)/unwind_prot.h $(topdir)/variables.h
|
hash.o: $(topdir)/shell.h $(topdir)/unwind_prot.h $(topdir)/variables.h
|
||||||
|
@ -339,6 +364,12 @@ let.o: $(topdir)/error.h $(topdir)/general.h
|
||||||
let.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
|
let.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
|
||||||
let.o: $(topdir)/subst.h $(topdir)/externs.h $(topdir)/maxpath.h
|
let.o: $(topdir)/subst.h $(topdir)/externs.h $(topdir)/maxpath.h
|
||||||
let.o: $(topdir)/shell.h $(topdir)/unwind_prot.h $(topdir)/variables.h
|
let.o: $(topdir)/shell.h $(topdir)/unwind_prot.h $(topdir)/variables.h
|
||||||
|
printf.o: ../config.h $(topdir)/memalloc.h $(topdir)/bashjmp.h
|
||||||
|
printf.o: $(topdir)/command.h $(topdir)/error.h $(topdir)/general.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)/unwind_prot.h
|
||||||
|
printf.o: $(topdir)/variables.h $(topdir)/stdc.h $(srcdir)/bashgetopt.h
|
||||||
pushd.o: $(topdir)/command.h ../config.h $(topdir)/memalloc.h
|
pushd.o: $(topdir)/command.h ../config.h $(topdir)/memalloc.h
|
||||||
pushd.o: $(topdir)/error.h $(topdir)/general.h
|
pushd.o: $(topdir)/error.h $(topdir)/general.h
|
||||||
pushd.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
|
pushd.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
|
||||||
|
@ -372,7 +403,7 @@ shift.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
|
||||||
shift.o: $(topdir)/subst.h $(topdir)/externs.h $(topdir)/maxpath.h
|
shift.o: $(topdir)/subst.h $(topdir)/externs.h $(topdir)/maxpath.h
|
||||||
shift.o: $(topdir)/shell.h $(topdir)/unwind_prot.h $(topdir)/variables.h
|
shift.o: $(topdir)/shell.h $(topdir)/unwind_prot.h $(topdir)/variables.h
|
||||||
source.o: $(topdir)/command.h ../config.h $(topdir)/memalloc.h
|
source.o: $(topdir)/command.h ../config.h $(topdir)/memalloc.h
|
||||||
source.o: $(topdir)/error.h $(topdir)/general.h
|
source.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/findcmd.h
|
||||||
source.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
|
source.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
|
||||||
source.o: $(topdir)/subst.h $(topdir)/externs.h $(topdir)/maxpath.h
|
source.o: $(topdir)/subst.h $(topdir)/externs.h $(topdir)/maxpath.h
|
||||||
source.o: $(topdir)/shell.h $(topdir)/unwind_prot.h $(topdir)/variables.h
|
source.o: $(topdir)/shell.h $(topdir)/unwind_prot.h $(topdir)/variables.h
|
||||||
|
@ -386,6 +417,7 @@ test.o: $(topdir)/error.h $(topdir)/general.h
|
||||||
test.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
|
test.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
|
||||||
test.o: $(topdir)/subst.h $(topdir)/externs.h $(topdir)/maxpath.h
|
test.o: $(topdir)/subst.h $(topdir)/externs.h $(topdir)/maxpath.h
|
||||||
test.o: $(topdir)/shell.h $(topdir)/unwind_prot.h $(topdir)/variables.h
|
test.o: $(topdir)/shell.h $(topdir)/unwind_prot.h $(topdir)/variables.h
|
||||||
|
test.o: $(topdir)/test.h
|
||||||
times.o: $(topdir)/command.h ../config.h $(topdir)/memalloc.h
|
times.o: $(topdir)/command.h ../config.h $(topdir)/memalloc.h
|
||||||
times.o: $(topdir)/error.h $(topdir)/general.h
|
times.o: $(topdir)/error.h $(topdir)/general.h
|
||||||
times.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
|
times.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
|
||||||
|
@ -396,7 +428,7 @@ trap.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/externs.h
|
||||||
trap.o: $(topdir)/quit.h $(srcdir)/common.h $(topdir)/maxpath.h
|
trap.o: $(topdir)/quit.h $(srcdir)/common.h $(topdir)/maxpath.h
|
||||||
trap.o: $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h $(topdir)/subst.h
|
trap.o: $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h $(topdir)/subst.h
|
||||||
trap.o: $(topdir)/shell.h $(topdir)/unwind_prot.h $(topdir)/variables.h
|
trap.o: $(topdir)/shell.h $(topdir)/unwind_prot.h $(topdir)/variables.h
|
||||||
trap.o: $(topdir)/execute_cmd.h
|
trap.o: $(topdir)/findcmd.h
|
||||||
type.o: $(topdir)/command.h ../config.h $(topdir)/memalloc.h
|
type.o: $(topdir)/command.h ../config.h $(topdir)/memalloc.h
|
||||||
type.o: $(topdir)/error.h $(topdir)/general.h
|
type.o: $(topdir)/error.h $(topdir)/general.h
|
||||||
type.o: $(topdir)/quit.h $(srcdir)/common.h $(topdir)/maxpath.h
|
type.o: $(topdir)/quit.h $(srcdir)/common.h $(topdir)/maxpath.h
|
||||||
|
|
|
@ -37,6 +37,9 @@ $END
|
||||||
#if defined (ALIAS)
|
#if defined (ALIAS)
|
||||||
|
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
|
# ifdef _MINIX
|
||||||
|
# include <sys/types.h>
|
||||||
|
# endif
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -80,12 +83,12 @@ alias_builtin (list)
|
||||||
if (list == 0 || pflag)
|
if (list == 0 || pflag)
|
||||||
{
|
{
|
||||||
if (aliases == 0)
|
if (aliases == 0)
|
||||||
return (EXECUTION_FAILURE);
|
return (EXECUTION_SUCCESS);
|
||||||
|
|
||||||
alias_list = all_aliases ();
|
alias_list = all_aliases ();
|
||||||
|
|
||||||
if (alias_list == 0)
|
if (alias_list == 0)
|
||||||
return (EXECUTION_FAILURE);
|
return (EXECUTION_SUCCESS);
|
||||||
|
|
||||||
for (offset = 0; alias_list[offset]; offset++)
|
for (offset = 0; alias_list[offset]; offset++)
|
||||||
print_alias (alias_list[offset]);
|
print_alias (alias_list[offset]);
|
||||||
|
@ -118,8 +121,7 @@ alias_builtin (list)
|
||||||
print_alias (t);
|
print_alias (t);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (interactive)
|
builtin_error ("`%s' not found", name);
|
||||||
builtin_error ("`%s' not found", name);
|
|
||||||
any_failed++;
|
any_failed++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -179,9 +181,7 @@ unalias_builtin (list)
|
||||||
remove_alias (alias->name);
|
remove_alias (alias->name);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (interactive)
|
builtin_error ("`%s': not an alias", list->word->word);
|
||||||
builtin_error ("`%s': not an alias", list->word->word);
|
|
||||||
|
|
||||||
aflag++;
|
aflag++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -161,6 +161,7 @@ reset_internal_getopt ()
|
||||||
sp = 1;
|
sp = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef INCLUDE_UNUSED
|
||||||
void
|
void
|
||||||
report_bad_option ()
|
report_bad_option ()
|
||||||
{
|
{
|
||||||
|
@ -171,3 +172,4 @@ report_bad_option ()
|
||||||
s[2] = '\0';
|
s[2] = '\0';
|
||||||
bad_option (s);
|
bad_option (s);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -26,7 +26,7 @@ $PRODUCES bind.c
|
||||||
$BUILTIN bind
|
$BUILTIN bind
|
||||||
$DEPENDS_ON READLINE
|
$DEPENDS_ON READLINE
|
||||||
$FUNCTION bind_builtin
|
$FUNCTION bind_builtin
|
||||||
$SHORT_DOC bind [-lpvsPVS] [-m keymap] [-f filename] [-q name] [-r keyseq] [keyseq:readline-function]
|
$SHORT_DOC bind [-lpvsPVS] [-m keymap] [-f filename] [-q name] [-u name] [-r keyseq] [keyseq:readline-function]
|
||||||
Bind a key sequence to a Readline function, or to a macro. The
|
Bind a key sequence to a Readline function, or to a macro. The
|
||||||
syntax is equivalent to that found in ~/.inputrc, but must be
|
syntax is equivalent to that found in ~/.inputrc, but must be
|
||||||
passed as a single argument: bind '"\C-x\C-r": re-read-init-file'.
|
passed as a single argument: bind '"\C-x\C-r": re-read-init-file'.
|
||||||
|
@ -42,6 +42,7 @@ Arguments we accept:
|
||||||
-r keyseq Remove the binding for KEYSEQ.
|
-r keyseq Remove the binding for KEYSEQ.
|
||||||
-f filename Read key bindings from FILENAME.
|
-f filename Read key bindings from FILENAME.
|
||||||
-q function-name Query about which keys invoke the named function.
|
-q function-name Query about which keys invoke the named function.
|
||||||
|
-u function-name Unbind all keys which are bound to the named function.
|
||||||
-V List variable names and values
|
-V List variable names and values
|
||||||
-v List variable names and values in a form that can
|
-v List variable names and values in a form that can
|
||||||
be reused as input.
|
be reused as input.
|
||||||
|
@ -53,6 +54,9 @@ $END
|
||||||
#if defined (READLINE)
|
#if defined (READLINE)
|
||||||
|
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
|
# ifdef _MINIX
|
||||||
|
# include <sys/types.h>
|
||||||
|
# endif
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -71,22 +75,24 @@ extern int errno;
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
static int query_bindings ();
|
static int query_bindings ();
|
||||||
|
static int unbind_command ();
|
||||||
|
|
||||||
extern int no_line_editing;
|
extern int no_line_editing;
|
||||||
|
|
||||||
#define BIND_RETURN(x) do { return_code = x; goto bind_exit; } while (0)
|
#define BIND_RETURN(x) do { return_code = x; goto bind_exit; } while (0)
|
||||||
|
|
||||||
#define LFLAG 0x01
|
#define LFLAG 0x0001
|
||||||
#define PFLAG 0x02
|
#define PFLAG 0x0002
|
||||||
#define FFLAG 0x04
|
#define FFLAG 0x0004
|
||||||
#define VFLAG 0x08
|
#define VFLAG 0x0008
|
||||||
#define QFLAG 0x10
|
#define QFLAG 0x0010
|
||||||
#define MFLAG 0x20
|
#define MFLAG 0x0020
|
||||||
#define RFLAG 0x40
|
#define RFLAG 0x0040
|
||||||
#define PPFLAG 0x80
|
#define PPFLAG 0x0080
|
||||||
#define VVFLAG 0x100
|
#define VVFLAG 0x0100
|
||||||
#define SFLAG 0x200
|
#define SFLAG 0x0200
|
||||||
#define SSFLAG 0x400
|
#define SSFLAG 0x0400
|
||||||
|
#define UFLAG 0x0800
|
||||||
|
|
||||||
int
|
int
|
||||||
bind_builtin (list)
|
bind_builtin (list)
|
||||||
|
@ -96,14 +102,14 @@ bind_builtin (list)
|
||||||
FILE *old_rl_outstream;
|
FILE *old_rl_outstream;
|
||||||
Keymap kmap, saved_keymap;
|
Keymap kmap, saved_keymap;
|
||||||
int flags, opt;
|
int flags, opt;
|
||||||
char *initfile, *map_name, *fun_name, *remove_seq;
|
char *initfile, *map_name, *fun_name, *unbind_name, *remove_seq;
|
||||||
|
|
||||||
if (no_line_editing)
|
if (no_line_editing)
|
||||||
return (EXECUTION_FAILURE);
|
return (EXECUTION_FAILURE);
|
||||||
|
|
||||||
kmap = saved_keymap = (Keymap) NULL;
|
kmap = saved_keymap = (Keymap) NULL;
|
||||||
flags = 0;
|
flags = 0;
|
||||||
initfile = map_name = fun_name = remove_seq = (char *)NULL;
|
initfile = map_name = fun_name = unbind_name = remove_seq = (char *)NULL;
|
||||||
return_code = EXECUTION_SUCCESS;
|
return_code = EXECUTION_SUCCESS;
|
||||||
|
|
||||||
if (!bash_readline_initialized)
|
if (!bash_readline_initialized)
|
||||||
|
@ -116,7 +122,7 @@ bind_builtin (list)
|
||||||
rl_outstream = stdout;
|
rl_outstream = stdout;
|
||||||
|
|
||||||
reset_internal_getopt ();
|
reset_internal_getopt ();
|
||||||
while ((opt = internal_getopt (list, "lvpVPsSf:q:m:r:")) != EOF)
|
while ((opt = internal_getopt (list, "lvpVPsSf:q:u:m:r:")) != EOF)
|
||||||
{
|
{
|
||||||
switch (opt)
|
switch (opt)
|
||||||
{
|
{
|
||||||
|
@ -141,6 +147,10 @@ bind_builtin (list)
|
||||||
flags |= QFLAG;
|
flags |= QFLAG;
|
||||||
fun_name = list_optarg;
|
fun_name = list_optarg;
|
||||||
break;
|
break;
|
||||||
|
case 'u':
|
||||||
|
flags |= UFLAG;
|
||||||
|
unbind_name = list_optarg;
|
||||||
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
flags |= RFLAG;
|
flags |= RFLAG;
|
||||||
remove_seq = list_optarg;
|
remove_seq = list_optarg;
|
||||||
|
@ -220,6 +230,9 @@ bind_builtin (list)
|
||||||
if ((flags & QFLAG) && fun_name)
|
if ((flags & QFLAG) && fun_name)
|
||||||
return_code = query_bindings (fun_name);
|
return_code = query_bindings (fun_name);
|
||||||
|
|
||||||
|
if ((flags & UFLAG) && unbind_name)
|
||||||
|
return_code = unbind_command (unbind_name);
|
||||||
|
|
||||||
if ((flags & RFLAG) && remove_seq)
|
if ((flags & RFLAG) && remove_seq)
|
||||||
{
|
{
|
||||||
if (rl_set_key (remove_seq, (Function *)NULL, rl_get_keymap ()) != 0)
|
if (rl_set_key (remove_seq, (Function *)NULL, rl_get_keymap ()) != 0)
|
||||||
|
@ -253,7 +266,7 @@ query_bindings (name)
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
function = rl_named_function (name);
|
function = rl_named_function (name);
|
||||||
if (!function)
|
if (function == 0)
|
||||||
{
|
{
|
||||||
builtin_error ("unknown function name `%s'", name);
|
builtin_error ("unknown function name `%s'", name);
|
||||||
return EXECUTION_FAILURE;
|
return EXECUTION_FAILURE;
|
||||||
|
@ -275,4 +288,21 @@ query_bindings (name)
|
||||||
free_array (keyseqs);
|
free_array (keyseqs);
|
||||||
return EXECUTION_SUCCESS;
|
return EXECUTION_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
unbind_command (name)
|
||||||
|
char *name;
|
||||||
|
{
|
||||||
|
Function *function;
|
||||||
|
|
||||||
|
function = rl_named_function (name);
|
||||||
|
if (function == 0)
|
||||||
|
{
|
||||||
|
builtin_error ("unknown function name `%s'", name);
|
||||||
|
return EXECUTION_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
rl_unbind_function_in_map (function, rl_get_keymap ());
|
||||||
|
return EXECUTION_SUCCESS;
|
||||||
|
}
|
||||||
#endif /* READLINE */
|
#endif /* READLINE */
|
||||||
|
|
|
@ -30,7 +30,10 @@ $END
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
#include <unistd.h>
|
# ifdef _MINIX
|
||||||
|
# include <sys/types.h>
|
||||||
|
# endif
|
||||||
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "../shell.h"
|
#include "../shell.h"
|
||||||
|
|
|
@ -31,6 +31,9 @@ $END
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
|
# ifdef _MINIX
|
||||||
|
# include <sys/types.h>
|
||||||
|
# endif
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -23,13 +23,18 @@ $PRODUCES cd.c
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
|
# ifdef _MINIX
|
||||||
|
# include <sys/types.h>
|
||||||
|
# endif
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "../bashtypes.h"
|
#include "../bashtypes.h"
|
||||||
#include "../posixdir.h"
|
#include "../posixdir.h"
|
||||||
#include "../posixstat.h"
|
#include "../posixstat.h"
|
||||||
|
#ifndef _MINIX
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
@ -66,11 +71,11 @@ $BUILTIN cd
|
||||||
$FUNCTION cd_builtin
|
$FUNCTION cd_builtin
|
||||||
$SHORT_DOC cd [-PL] [dir]
|
$SHORT_DOC cd [-PL] [dir]
|
||||||
Change the current directory to DIR. The variable $HOME is the
|
Change the current directory to DIR. The variable $HOME is the
|
||||||
default DIR. The variable $CDPATH defines the search path for
|
default DIR. The variable CDPATH defines the search path for
|
||||||
the directory containing DIR. Alternative directory names in CDPATH
|
the directory containing DIR. Alternative directory names in CDPATH
|
||||||
are separated by a colon (:). A null directory name is the same as
|
are separated by a colon (:). A null directory name is the same as
|
||||||
the current directory, i.e. `.'. If DIR begins with a slash (/),
|
the current directory, i.e. `.'. If DIR begins with a slash (/),
|
||||||
then $CDPATH is not used. If the directory is not found, and the
|
then CDPATH is not used. If the directory is not found, and the
|
||||||
shell option `cdable_vars' is set, then try the word as a variable
|
shell option `cdable_vars' is set, then try the word as a variable
|
||||||
name. If that variable has a value, then cd to the value of that
|
name. If that variable has a value, then cd to the value of that
|
||||||
variable. The -P option says to use the physical directory structure
|
variable. The -P option says to use the physical directory structure
|
||||||
|
@ -146,9 +151,10 @@ bindpwd (no_symlinks)
|
||||||
needing a remake. */
|
needing a remake. */
|
||||||
if (old_anm == 0 && array_needs_making && exported_p (tvar))
|
if (old_anm == 0 && array_needs_making && exported_p (tvar))
|
||||||
{
|
{
|
||||||
pwdvar = xmalloc (strlen (dirname) + 5); /* 5 = "PWD" + '=' + '\0' */
|
pwdvar = xmalloc (STRLEN (dirname) + 5); /* 5 = "PWD" + '=' + '\0' */
|
||||||
strcpy (pwdvar, "PWD=");
|
strcpy (pwdvar, "PWD=");
|
||||||
strcpy (pwdvar + 4, dirname);
|
if (dirname)
|
||||||
|
strcpy (pwdvar + 4, dirname);
|
||||||
add_or_supercede_exported_var (pwdvar, 0);
|
add_or_supercede_exported_var (pwdvar, 0);
|
||||||
array_needs_making = 0;
|
array_needs_making = 0;
|
||||||
}
|
}
|
||||||
|
@ -226,6 +232,8 @@ cd_builtin (list)
|
||||||
builtin_error ("%s: %s", dirname, strerror (errno));
|
builtin_error ("%s: %s", dirname, strerror (errno));
|
||||||
return (EXECUTION_FAILURE);
|
return (EXECUTION_FAILURE);
|
||||||
}
|
}
|
||||||
|
if (interactive)
|
||||||
|
printf ("%s\n", dirname);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -237,6 +245,8 @@ cd_builtin (list)
|
||||||
path_index = 0;
|
path_index = 0;
|
||||||
while ((path = extract_colon_unit (cdpath, &path_index)))
|
while ((path = extract_colon_unit (cdpath, &path_index)))
|
||||||
{
|
{
|
||||||
|
/* OPT is 1 if the path element is non-empty */
|
||||||
|
opt = path[0] != '\0';
|
||||||
temp = mkpath (path, dirname, 1);
|
temp = mkpath (path, dirname, 1);
|
||||||
free (path);
|
free (path);
|
||||||
|
|
||||||
|
@ -248,17 +258,30 @@ cd_builtin (list)
|
||||||
|
|
||||||
if (change_to_directory (temp, no_symlinks))
|
if (change_to_directory (temp, no_symlinks))
|
||||||
{
|
{
|
||||||
if (temp[0] != '.' || temp[1] != '/')
|
/* POSIX.2 says that if a nonempty directory from CDPATH
|
||||||
printf ("%s\n", temp);
|
is used to find the directory to change to, the new
|
||||||
|
directory name is echoed to stdout, whether or not
|
||||||
|
the shell is interactive. */
|
||||||
|
if (opt)
|
||||||
|
printf ("%s\n", the_current_working_directory);
|
||||||
|
|
||||||
free (temp);
|
free (temp);
|
||||||
/* Posix.2 says that after using CDPATH, the resultant
|
/* Posix.2 says that after using CDPATH, the resultant
|
||||||
value of $PWD will not contain symlinks. */
|
value of $PWD will not contain symlinks. */
|
||||||
return (bindpwd (posixly_correct));
|
return (bindpwd (posixly_correct || no_symlinks));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
free (temp);
|
free (temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* POSIX.2 says that if `.' does not appear in $CDPATH, we don't
|
||||||
|
try the current directory, so we just punt now with an error
|
||||||
|
message if POSIXLY_CORRECT is non-zero. */
|
||||||
|
if (posixly_correct)
|
||||||
|
{
|
||||||
|
builtin_error ("%s: %s", dirname, strerror (ENOENT));
|
||||||
|
return (EXECUTION_FAILURE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (change_to_directory (dirname, no_symlinks))
|
if (change_to_directory (dirname, no_symlinks))
|
||||||
|
|
|
@ -35,6 +35,9 @@ $END
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
|
# ifdef _MINIX
|
||||||
|
# include <sys/types.h>
|
||||||
|
# endif
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -179,11 +182,16 @@ get_standard_path ()
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
len = (size_t)confstr (_CS_PATH, (char *)NULL, (size_t)0);
|
len = (size_t)confstr (_CS_PATH, (char *)NULL, (size_t)0);
|
||||||
p = xmalloc ((int)len + 2);
|
if (len > 0)
|
||||||
*p = '\0';
|
{
|
||||||
confstr (_CS_PATH, p, len);
|
p = xmalloc ((int)len + 2);
|
||||||
return (p);
|
*p = '\0';
|
||||||
#else /* !_CSPATH || !HAVE_CONFSTR */
|
confstr (_CS_PATH, p, len);
|
||||||
|
return (p);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return (savestring (STANDARD_UTILS_PATH));
|
||||||
|
#else /* !_CS_PATH || !HAVE_CONFSTR */
|
||||||
# if defined (CS_PATH)
|
# if defined (CS_PATH)
|
||||||
return (savestring (CS_PATH));
|
return (savestring (CS_PATH));
|
||||||
# else
|
# else
|
||||||
|
|
|
@ -19,6 +19,9 @@
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
|
# ifdef _MINIX
|
||||||
|
# include <sys/types.h>
|
||||||
|
# endif
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -27,6 +30,8 @@
|
||||||
#include "../posixstat.h"
|
#include "../posixstat.h"
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#if defined (PREFER_STDARG)
|
#if defined (PREFER_STDARG)
|
||||||
# include <stdarg.h>
|
# include <stdarg.h>
|
||||||
#else
|
#else
|
||||||
|
@ -54,6 +59,10 @@
|
||||||
# include "../bashhist.h"
|
# include "../bashhist.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined (errno)
|
||||||
|
extern int errno;
|
||||||
|
#endif /* !errno */
|
||||||
|
|
||||||
extern int no_symbolic_links, interactive, interactive_shell;
|
extern int no_symbolic_links, interactive, interactive_shell;
|
||||||
extern int indirection_level, startup_state, subshell_environment;
|
extern int indirection_level, startup_state, subshell_environment;
|
||||||
extern int line_number;
|
extern int line_number;
|
||||||
|
@ -399,11 +408,12 @@ get_working_directory (for_whom)
|
||||||
directory = getcwd (the_current_working_directory, PATH_MAX);
|
directory = getcwd (the_current_working_directory, PATH_MAX);
|
||||||
if (directory == 0)
|
if (directory == 0)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "%s: could not get current directory: %s\n",
|
fprintf (stderr, "%s: could not get current directory: %s: %s\n",
|
||||||
(for_whom && *for_whom) ? for_whom : get_name_for_error (),
|
(for_whom && *for_whom) ? for_whom : get_name_for_error (),
|
||||||
the_current_working_directory[0]
|
the_current_working_directory[0]
|
||||||
? the_current_working_directory
|
? the_current_working_directory
|
||||||
: bash_getcwd_errstr);
|
: bash_getcwd_errstr,
|
||||||
|
strerror (errno));
|
||||||
|
|
||||||
free (the_current_working_directory);
|
free (the_current_working_directory);
|
||||||
the_current_working_directory = (char *)NULL;
|
the_current_working_directory = (char *)NULL;
|
||||||
|
@ -691,8 +701,13 @@ shell_builtin_compare (sbp1, sbp2)
|
||||||
void
|
void
|
||||||
initialize_shell_builtins ()
|
initialize_shell_builtins ()
|
||||||
{
|
{
|
||||||
|
#ifdef _MINIX
|
||||||
|
qsort (shell_builtins, num_shell_builtins, sizeof (struct builtin),
|
||||||
|
(int (*)(const void *, const void *))shell_builtin_compare);
|
||||||
|
#else
|
||||||
qsort (shell_builtins, num_shell_builtins, sizeof (struct builtin),
|
qsort (shell_builtins, num_shell_builtins, sizeof (struct builtin),
|
||||||
shell_builtin_compare);
|
shell_builtin_compare);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* **************************************************************** */
|
/* **************************************************************** */
|
||||||
|
@ -791,10 +806,14 @@ backslash_quote (string)
|
||||||
*r++ = '\\';
|
*r++ = '\\';
|
||||||
*r++ = c;
|
*r++ = c;
|
||||||
break;
|
break;
|
||||||
case '#': /* comment char */
|
|
||||||
#if 0
|
#if 0
|
||||||
case '~': /* tilde expansion */
|
case '~': /* tilde expansion */
|
||||||
|
if (s == string || s[-1] == '=' || s[-1] == ':')
|
||||||
|
*r++ = '\\';
|
||||||
|
*r++ = c;
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
case '#': /* comment char */
|
||||||
if (s == string)
|
if (s == string)
|
||||||
*r++ = '\\';
|
*r++ = '\\';
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
|
@ -827,6 +846,9 @@ contains_shell_metas (string)
|
||||||
case '^':
|
case '^':
|
||||||
case '$': case '`': /* expansion chars */
|
case '$': case '`': /* expansion chars */
|
||||||
return (1);
|
return (1);
|
||||||
|
case '~': /* tilde expansion */
|
||||||
|
if (s == string || s[-1] == '=' || s[-1] == ':')
|
||||||
|
return (1);
|
||||||
case '#':
|
case '#':
|
||||||
if (s == string) /* comment char */
|
if (s == string) /* comment char */
|
||||||
return (1);
|
return (1);
|
||||||
|
|
|
@ -30,77 +30,79 @@
|
||||||
#define SEVAL_INTERACT 0x02
|
#define SEVAL_INTERACT 0x02
|
||||||
#define SEVAL_NOHIST 0x04
|
#define SEVAL_NOHIST 0x04
|
||||||
|
|
||||||
|
/* Functions from common.c */
|
||||||
extern void builtin_error __P((const char *, ...));
|
extern void builtin_error __P((const char *, ...));
|
||||||
extern void builtin_usage ();
|
extern void builtin_usage __P((void));
|
||||||
extern void bad_option ();
|
extern void no_args __P((WORD_LIST *));
|
||||||
|
extern void bad_option __P((char *));
|
||||||
|
extern int no_options __P((WORD_LIST *));
|
||||||
|
|
||||||
extern char **make_builtin_argv ();
|
extern char **make_builtin_argv __P((WORD_LIST *, int *));
|
||||||
|
extern void remember_args __P((WORD_LIST *, int));
|
||||||
|
|
||||||
extern int get_numeric_arg ();
|
extern void push_context __P((void));
|
||||||
extern void remember_args ();
|
extern void pop_context __P((void));
|
||||||
extern void no_args ();
|
extern void push_dollar_vars __P((void));
|
||||||
extern int no_options ();
|
extern void pop_dollar_vars __P((void));
|
||||||
|
extern void dispose_saved_dollar_vars __P((void));
|
||||||
|
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 read_octal ();
|
extern int get_numeric_arg __P((WORD_LIST *, int));
|
||||||
|
extern int read_octal __P((char *));
|
||||||
extern void push_context (), pop_context ();
|
|
||||||
extern void push_dollar_vars (), pop_dollar_vars ();
|
|
||||||
extern void dispose_saved_dollar_vars ();
|
|
||||||
extern int dollar_vars_changed ();
|
|
||||||
extern void set_dollar_vars_unchanged (), set_dollar_vars_changed ();
|
|
||||||
|
|
||||||
/* Keeps track of the current working directory. */
|
/* Keeps track of the current working directory. */
|
||||||
extern char *the_current_working_directory;
|
extern char *the_current_working_directory;
|
||||||
extern char *get_working_directory ();
|
extern char *get_working_directory __P((char *));
|
||||||
extern void set_working_directory ();
|
extern void set_working_directory __P((char *));
|
||||||
|
|
||||||
#if defined (JOB_CONTROL)
|
#if defined (JOB_CONTROL)
|
||||||
extern int get_job_spec ();
|
extern int get_job_spec __P((WORD_LIST *));
|
||||||
#endif
|
#endif
|
||||||
|
extern int display_signal_list __P((WORD_LIST *, int));
|
||||||
extern int display_signal_list ();
|
|
||||||
|
|
||||||
/* It's OK to declare a function as returning a Function * without
|
/* It's OK to declare a function as returning a Function * without
|
||||||
providing a definition of what a `Function' is. */
|
providing a definition of what a `Function' is. */
|
||||||
extern struct builtin *builtin_address_internal ();
|
extern struct builtin *builtin_address_internal __P((char *, int));
|
||||||
extern Function *find_shell_builtin ();
|
extern Function *find_shell_builtin __P((char *));
|
||||||
extern Function *builtin_address ();
|
extern Function *builtin_address __P((char *));
|
||||||
extern Function *find_special_builtin ();
|
extern Function *find_special_builtin __P((char *));
|
||||||
|
extern void initialize_shell_builtins __P((void));
|
||||||
|
|
||||||
extern void initialize_shell_builtins ();
|
extern char *single_quote __P((char *));
|
||||||
|
extern char *double_quote __P((char *));
|
||||||
extern char *single_quote ();
|
extern char *backslash_quote __P((char *));
|
||||||
extern char *double_quote ();
|
extern int contains_shell_metas __P((char *));
|
||||||
extern char *backslash_quote ();
|
|
||||||
extern int contains_shell_metas ();
|
|
||||||
|
|
||||||
/* Functions from set.def */
|
/* Functions from set.def */
|
||||||
extern void initialize_shell_options ();
|
extern void initialize_shell_options __P((int));
|
||||||
extern void list_minus_o_opts ();
|
extern void list_minus_o_opts __P((int, int));
|
||||||
extern int set_minus_o_option ();
|
extern int set_minus_o_option __P((int, char *));
|
||||||
extern int minus_o_option_value ();
|
extern int minus_o_option_value __P((char *));
|
||||||
extern void reset_shell_options ();
|
extern void reset_shell_options __P((void));
|
||||||
|
|
||||||
/* Functions from shopt.def */
|
/* Functions from shopt.def */
|
||||||
extern void reset_shopt_options ();
|
extern void reset_shopt_options __P((void));
|
||||||
|
|
||||||
/* Functions from type.def */
|
/* Functions from type.def */
|
||||||
extern int describe_command ();
|
extern int describe_command __P((char *, int, int));
|
||||||
|
|
||||||
/* Functions from setattr.def */
|
/* Functions from setattr.def */
|
||||||
extern int set_or_show_attributes ();
|
extern int set_or_show_attributes __P((WORD_LIST *, int, int));
|
||||||
extern int show_var_attributes ();
|
extern int show_var_attributes __P((SHELL_VAR *, int, int));
|
||||||
extern int show_name_attributes ();
|
extern int show_name_attributes __P((char *, int));
|
||||||
extern void set_var_attribute ();
|
extern void set_var_attribute __P((char *, int, int));
|
||||||
|
|
||||||
/* Functions from pushd.def */
|
/* Functions from pushd.def */
|
||||||
extern char *get_dirstack_element ();
|
extern char *get_dirstack_from_string __P((char *));
|
||||||
extern void set_dirstack_element ();
|
extern char *get_dirstack_element __P((int, int));
|
||||||
extern WORD_LIST *get_directory_stack ();
|
extern void set_dirstack_element __P((int, int, char *));
|
||||||
|
extern WORD_LIST *get_directory_stack __P((void));
|
||||||
|
|
||||||
/* Functions from evalstring.c */
|
/* Functions from evalstring.c */
|
||||||
extern int parse_and_execute ();
|
extern int parse_and_execute __P((char *, char *, int));
|
||||||
extern void parse_and_execute_cleanup ();
|
extern void parse_and_execute_cleanup __P((void));
|
||||||
|
|
||||||
/* Functions from evalfile.c */
|
/* Functions from evalfile.c */
|
||||||
extern int maybe_execute_file __P((char *, int));
|
extern int maybe_execute_file __P((char *, int));
|
||||||
|
|
|
@ -57,6 +57,9 @@ $END
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
|
# ifdef _MINIX
|
||||||
|
# include <sys/types.h>
|
||||||
|
# endif
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -377,6 +380,18 @@ declare_internal (list, local_var)
|
||||||
FREE (var->value);
|
FREE (var->value);
|
||||||
var->value = t;
|
var->value = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If we found this variable in the temporary environment, as with
|
||||||
|
`var=value declare -x var', make sure it is treated identically
|
||||||
|
to `var=value export var'. Do the same for `declare -r' and
|
||||||
|
`readonly'. Preserve the attributes, except for att_tempvar. */
|
||||||
|
if ((flags_on & (att_exported|att_readonly)) && tempvar_p (var))
|
||||||
|
{
|
||||||
|
SHELL_VAR *tv;
|
||||||
|
tv = bind_variable (var->name, var->value ? var->value : "");
|
||||||
|
tv->attributes = var->attributes & ~att_tempvar;
|
||||||
|
dispose_variable (var);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stupidly_hack_special_variables (name);
|
stupidly_hack_special_variables (name);
|
||||||
|
|
|
@ -42,6 +42,9 @@ $END
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
|
# ifdef _MINIX
|
||||||
|
# include <sys/types.h>
|
||||||
|
# endif
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,10 @@ $END
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
#include <unistd.h>
|
# ifdef _MINIX
|
||||||
|
# include <sys/types.h>
|
||||||
|
# endif
|
||||||
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "../shell.h"
|
#include "../shell.h"
|
||||||
|
|
|
@ -75,6 +75,7 @@ _evalfile (filename, flags)
|
||||||
int return_val, fd, result, pflags;
|
int return_val, fd, result, pflags;
|
||||||
char *string;
|
char *string;
|
||||||
struct stat finfo;
|
struct stat finfo;
|
||||||
|
size_t file_size;
|
||||||
VFunction *errfunc;
|
VFunction *errfunc;
|
||||||
|
|
||||||
fd = open (filename, O_RDONLY);
|
fd = open (filename, O_RDONLY);
|
||||||
|
@ -108,20 +109,33 @@ file_error_and_exit:
|
||||||
return ((flags & FEVAL_BUILTIN) ? EXECUTION_FAILURE : -1);
|
return ((flags & FEVAL_BUILTIN) ? EXECUTION_FAILURE : -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
string = xmalloc (1 + (int)finfo.st_size);
|
file_size = (size_t)finfo.st_size;
|
||||||
result = read (fd, string, finfo.st_size);
|
/* Check for overflow with large files. */
|
||||||
|
if (file_size != finfo.st_size || file_size + 1 < file_size)
|
||||||
|
{
|
||||||
|
(*errfunc) ("%s: file is too large", filename);
|
||||||
|
return ((flags & FEVAL_BUILTIN) ? EXECUTION_FAILURE : -1);
|
||||||
|
}
|
||||||
|
string = xmalloc (1 + file_size);
|
||||||
|
result = read (fd, string, file_size);
|
||||||
string[result] = '\0';
|
string[result] = '\0';
|
||||||
|
|
||||||
return_val = errno;
|
return_val = errno;
|
||||||
close (fd);
|
close (fd);
|
||||||
errno = return_val;
|
errno = return_val;
|
||||||
|
|
||||||
if (result != (int)finfo.st_size)
|
if (result < 0) /* XXX was != file_size, not < 0 */
|
||||||
{
|
{
|
||||||
free (string);
|
free (string);
|
||||||
goto file_error_and_exit;
|
goto file_error_and_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (result == 0)
|
||||||
|
{
|
||||||
|
free (string);
|
||||||
|
return ((flags & FEVAL_BUILTIN) ? EXECUTION_SUCCESS : 1);
|
||||||
|
}
|
||||||
|
|
||||||
if (check_binary_file ((unsigned char *)string, (result > 80) ? 80 : result))
|
if (check_binary_file ((unsigned char *)string, (result > 80) ? 80 : result))
|
||||||
{
|
{
|
||||||
free (string);
|
free (string);
|
||||||
|
|
|
@ -19,12 +19,18 @@
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
|
# ifdef _MINIX
|
||||||
|
# include <sys/types.h>
|
||||||
|
# endif
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include "../filecntl.h"
|
||||||
#include "../bashansi.h"
|
#include "../bashansi.h"
|
||||||
|
|
||||||
#include "../shell.h"
|
#include "../shell.h"
|
||||||
|
@ -33,6 +39,7 @@
|
||||||
#include "../flags.h"
|
#include "../flags.h"
|
||||||
#include "../input.h"
|
#include "../input.h"
|
||||||
#include "../execute_cmd.h"
|
#include "../execute_cmd.h"
|
||||||
|
#include "../redir.h"
|
||||||
|
|
||||||
#if defined (HISTORY)
|
#if defined (HISTORY)
|
||||||
# include "../bashhist.h"
|
# include "../bashhist.h"
|
||||||
|
@ -40,6 +47,10 @@
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
#if !defined (errno)
|
||||||
|
extern int errno;
|
||||||
|
#endif
|
||||||
|
|
||||||
extern void run_trap_cleanup ();
|
extern void run_trap_cleanup ();
|
||||||
|
|
||||||
extern int interactive, interactive_shell;
|
extern int interactive, interactive_shell;
|
||||||
|
@ -47,10 +58,13 @@ extern int indirection_level, startup_state, subshell_environment;
|
||||||
extern int line_number;
|
extern int line_number;
|
||||||
extern int last_command_exit_value;
|
extern int last_command_exit_value;
|
||||||
extern int running_trap;
|
extern int running_trap;
|
||||||
|
extern int posixly_correct;
|
||||||
extern COMMAND *global_command;
|
extern COMMAND *global_command;
|
||||||
|
|
||||||
int parse_and_execute_level = 0;
|
int parse_and_execute_level = 0;
|
||||||
|
|
||||||
|
static int cat_file ();
|
||||||
|
|
||||||
/* How to force parse_and_execute () to clean up after itself. */
|
/* How to force parse_and_execute () to clean up after itself. */
|
||||||
void
|
void
|
||||||
parse_and_execute_cleanup ()
|
parse_and_execute_cleanup ()
|
||||||
|
@ -202,7 +216,23 @@ parse_and_execute (string, from_file, flags)
|
||||||
}
|
}
|
||||||
#endif /* ONESHOT */
|
#endif /* ONESHOT */
|
||||||
|
|
||||||
last_result = execute_command_internal
|
/* See if this is a candidate for $( <file ). */
|
||||||
|
if (startup_state == 2 &&
|
||||||
|
subshell_environment == SUBSHELL_COMSUB &&
|
||||||
|
*bash_input.location.string == '\0' &&
|
||||||
|
command->type == cm_simple && !command->redirects &&
|
||||||
|
(command->flags & CMD_TIME_PIPELINE) == 0 &&
|
||||||
|
command->value.Simple->words == 0 &&
|
||||||
|
command->value.Simple->redirects &&
|
||||||
|
command->value.Simple->redirects->next == 0 &&
|
||||||
|
command->value.Simple->redirects->instruction == r_input_direction)
|
||||||
|
{
|
||||||
|
int r;
|
||||||
|
r = cat_file (command->value.Simple->redirects);
|
||||||
|
last_result = (r < 0) ? EXECUTION_FAILURE : EXECUTION_SUCCESS;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
last_result = execute_command_internal
|
||||||
(command, 0, NO_PIPE, NO_PIPE, bitmap);
|
(command, 0, NO_PIPE, NO_PIPE, bitmap);
|
||||||
|
|
||||||
dispose_command (command);
|
dispose_command (command);
|
||||||
|
@ -238,3 +268,94 @@ parse_and_execute (string, from_file, flags)
|
||||||
|
|
||||||
return (last_result);
|
return (last_result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Write NB bytes from BUF to file descriptor FD, retrying the write if
|
||||||
|
it is interrupted. We retry three times if we get a zero-length
|
||||||
|
write. Any other signal causes this function to return prematurely. */
|
||||||
|
static int
|
||||||
|
zwrite (fd, buf, nb)
|
||||||
|
int fd;
|
||||||
|
unsigned char *buf;
|
||||||
|
int nb;
|
||||||
|
{
|
||||||
|
int n, i, nt;
|
||||||
|
|
||||||
|
for (n = nb, nt = 0;;)
|
||||||
|
{
|
||||||
|
i = write (fd, buf, n);
|
||||||
|
if (i > 0)
|
||||||
|
{
|
||||||
|
n -= i;
|
||||||
|
if (n <= 0)
|
||||||
|
return nb;
|
||||||
|
}
|
||||||
|
else if (i == 0)
|
||||||
|
{
|
||||||
|
if (++nt > 3)
|
||||||
|
return (nb - n);
|
||||||
|
}
|
||||||
|
else if (errno != EINTR)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Handle a $( < file ) command substitution. This expands the filename,
|
||||||
|
returning errors as appropriate, then just cats the file to the standard
|
||||||
|
output. */
|
||||||
|
static int
|
||||||
|
cat_file (r)
|
||||||
|
REDIRECT *r;
|
||||||
|
{
|
||||||
|
char lbuf[128], *fn;
|
||||||
|
int nr, fd, rval;
|
||||||
|
|
||||||
|
if (r->instruction != r_input_direction)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
/* Get the filename. */
|
||||||
|
if (posixly_correct && !interactive_shell)
|
||||||
|
disallow_filename_globbing++;
|
||||||
|
fn = redirection_expand (r->redirectee.filename);
|
||||||
|
if (posixly_correct && !interactive_shell)
|
||||||
|
disallow_filename_globbing--;
|
||||||
|
|
||||||
|
if (fn == 0)
|
||||||
|
{
|
||||||
|
redirection_error (r, AMBIGUOUS_REDIRECT);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
fd = open(fn, O_RDONLY);
|
||||||
|
if (fd < 0)
|
||||||
|
{
|
||||||
|
file_error (fn);
|
||||||
|
free (fn);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
rval = 0;
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
/* Retry the reads on EINTR. Any other error causes a break from the
|
||||||
|
loop. */
|
||||||
|
while ((nr = read (fd, lbuf, sizeof(lbuf))) < 0 && errno == EINTR)
|
||||||
|
;
|
||||||
|
if (nr == 0)
|
||||||
|
break;
|
||||||
|
else if (nr < 0)
|
||||||
|
{
|
||||||
|
rval = -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (zwrite (1, lbuf, nr) < 0)
|
||||||
|
{
|
||||||
|
rval = -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
free (fn);
|
||||||
|
close (fd);
|
||||||
|
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
|
@ -49,6 +49,7 @@ $END
|
||||||
|
|
||||||
#include "../shell.h"
|
#include "../shell.h"
|
||||||
#include "../execute_cmd.h"
|
#include "../execute_cmd.h"
|
||||||
|
#include "../findcmd.h"
|
||||||
#if defined (JOB_CONTROL)
|
#if defined (JOB_CONTROL)
|
||||||
# include "../jobs.h"
|
# include "../jobs.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -75,7 +75,7 @@ int
|
||||||
logout_builtin (list)
|
logout_builtin (list)
|
||||||
WORD_LIST *list;
|
WORD_LIST *list;
|
||||||
{
|
{
|
||||||
if (login_shell == 0 && interactive)
|
if (login_shell == 0 /* && interactive */)
|
||||||
{
|
{
|
||||||
builtin_error ("not login shell: use `exit'");
|
builtin_error ("not login shell: use `exit'");
|
||||||
return (EXECUTION_FAILURE);
|
return (EXECUTION_FAILURE);
|
||||||
|
|
|
@ -49,10 +49,14 @@ $END
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#if defined (HISTORY)
|
#if defined (HISTORY)
|
||||||
#include <sys/param.h>
|
#ifndef _MINIX
|
||||||
|
# include <sys/param.h>
|
||||||
|
#endif
|
||||||
#include "../bashtypes.h"
|
#include "../bashtypes.h"
|
||||||
#include "../posixstat.h"
|
#include "../posixstat.h"
|
||||||
#include <sys/file.h>
|
#ifndef _MINIX
|
||||||
|
# include <sys/file.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
|
|
|
@ -20,6 +20,9 @@
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
|
# ifdef _MINIX
|
||||||
|
# include <sys/types.h>
|
||||||
|
# endif
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,9 @@ $END
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
|
# ifdef _MINIX
|
||||||
|
# include <sys/types.h>
|
||||||
|
# endif
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,8 @@ $END
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "../bashtypes.h"
|
||||||
|
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -43,8 +45,8 @@ $END
|
||||||
|
|
||||||
#include "../shell.h"
|
#include "../shell.h"
|
||||||
#include "../builtins.h"
|
#include "../builtins.h"
|
||||||
#include "../execute_cmd.h"
|
|
||||||
#include "../flags.h"
|
#include "../flags.h"
|
||||||
|
#include "../findcmd.h"
|
||||||
#include "../hashcmd.h"
|
#include "../hashcmd.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "bashgetopt.h"
|
#include "bashgetopt.h"
|
||||||
|
@ -63,7 +65,7 @@ hash_builtin (list)
|
||||||
WORD_LIST *list;
|
WORD_LIST *list;
|
||||||
{
|
{
|
||||||
int expunge_hash_table, opt;
|
int expunge_hash_table, opt;
|
||||||
char *word, *pathname;
|
char *w, *pathname;
|
||||||
|
|
||||||
if (hashing_enabled == 0)
|
if (hashing_enabled == 0)
|
||||||
{
|
{
|
||||||
|
@ -107,12 +109,12 @@ hash_builtin (list)
|
||||||
for (opt = EXECUTION_SUCCESS; list; list = list->next)
|
for (opt = EXECUTION_SUCCESS; list; list = list->next)
|
||||||
{
|
{
|
||||||
/* Add or rehash the specified commands. */
|
/* Add or rehash the specified commands. */
|
||||||
word = list->word->word;
|
w = list->word->word;
|
||||||
if (pathname)
|
if (pathname)
|
||||||
remember_filename (word, pathname, 0, 0);
|
remember_filename (w, pathname, 0, 0);
|
||||||
else if (absolute_program (word))
|
else if (absolute_program (w))
|
||||||
continue;
|
continue;
|
||||||
else if (add_hashed_command (word, 0))
|
else if (add_hashed_command (w, 0))
|
||||||
opt = EXECUTION_FAILURE;
|
opt = EXECUTION_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,23 +123,23 @@ hash_builtin (list)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
add_hashed_command (word, quiet)
|
add_hashed_command (w, quiet)
|
||||||
char *word;
|
char *w;
|
||||||
int quiet;
|
int quiet;
|
||||||
{
|
{
|
||||||
int rv;
|
int rv;
|
||||||
char *full_path;
|
char *full_path;
|
||||||
|
|
||||||
rv = 0;
|
rv = 0;
|
||||||
if (find_function (word) == 0 && find_shell_builtin (word) == 0)
|
if (find_function (w) == 0 && find_shell_builtin (w) == 0)
|
||||||
{
|
{
|
||||||
full_path = find_user_command (word);
|
full_path = find_user_command (w);
|
||||||
if (full_path && executable_file (full_path))
|
if (full_path && executable_file (full_path))
|
||||||
remember_filename (word, full_path, dot_found_in_search, 0);
|
remember_filename (w, full_path, dot_found_in_search, 0);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (quiet == 0)
|
if (quiet == 0)
|
||||||
builtin_error ("%s: not found", word);
|
builtin_error ("%s: not found", w);
|
||||||
rv++;
|
rv++;
|
||||||
}
|
}
|
||||||
if (full_path)
|
if (full_path)
|
||||||
|
|
|
@ -36,11 +36,15 @@ $END
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
|
# ifdef _MINIX
|
||||||
|
# include <sys/types.h>
|
||||||
|
# endif
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "../shell.h"
|
#include "../shell.h"
|
||||||
#include "../builtins.h"
|
#include "../builtins.h"
|
||||||
|
#include "../pathexp.h"
|
||||||
#include "bashgetopt.h"
|
#include "bashgetopt.h"
|
||||||
|
|
||||||
#include <glob/fnmatch.h>
|
#include <glob/fnmatch.h>
|
||||||
|
@ -100,7 +104,7 @@ help_builtin (list)
|
||||||
{
|
{
|
||||||
QUIT;
|
QUIT;
|
||||||
if ((strncmp (pattern, name, plen) == 0) ||
|
if ((strncmp (pattern, name, plen) == 0) ||
|
||||||
(fnmatch (pattern, name, 0) != FNM_NOMATCH))
|
(fnmatch (pattern, name, FNMATCH_EXTFLAG) != FNM_NOMATCH))
|
||||||
{
|
{
|
||||||
printf ("%s: %s\n", name, shell_builtins[i].short_doc);
|
printf ("%s: %s\n", name, shell_builtins[i].short_doc);
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,9 @@ $END
|
||||||
|
|
||||||
#if defined (HISTORY)
|
#if defined (HISTORY)
|
||||||
#include "../bashtypes.h"
|
#include "../bashtypes.h"
|
||||||
#include <sys/file.h>
|
#ifndef _MINIX
|
||||||
|
# include <sys/file.h>
|
||||||
|
#endif
|
||||||
#include "../posixstat.h"
|
#include "../posixstat.h"
|
||||||
#include "../filecntl.h"
|
#include "../filecntl.h"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
|
@ -205,11 +205,12 @@ execute_list_with_replacements (list)
|
||||||
$BUILTIN disown
|
$BUILTIN disown
|
||||||
$FUNCTION disown_builtin
|
$FUNCTION disown_builtin
|
||||||
$DEPENDS_ON JOB_CONTROL
|
$DEPENDS_ON JOB_CONTROL
|
||||||
$SHORT_DOC disown [-h] [jobspec ...]
|
$SHORT_DOC disown [-h] [-ar] [jobspec ...]
|
||||||
By default, removes each JOBSPEC argument from the table of active jobs.
|
By default, removes each JOBSPEC argument from the table of active jobs.
|
||||||
If the -h option is given, the job is not removed from the table, but is
|
If the -h option is given, the job is not removed from the table, but is
|
||||||
marked so that SIGHUP is not sent to the job if the shell receives a
|
marked so that SIGHUP is not sent to the job if the shell receives a
|
||||||
SIGHUP.
|
SIGHUP. The -a option, when JOBSPEC is not supplied, means to remove all
|
||||||
|
jobs from the job table; the -r option means to remove only running jobs.
|
||||||
$END
|
$END
|
||||||
|
|
||||||
#if defined (JOB_CONTROL)
|
#if defined (JOB_CONTROL)
|
||||||
|
@ -217,18 +218,24 @@ int
|
||||||
disown_builtin (list)
|
disown_builtin (list)
|
||||||
WORD_LIST *list;
|
WORD_LIST *list;
|
||||||
{
|
{
|
||||||
int opt, job, retval, nohup_only;
|
int opt, job, retval, nohup_only, running_jobs, all_jobs;
|
||||||
sigset_t set, oset;
|
sigset_t set, oset;
|
||||||
|
|
||||||
nohup_only = 0;
|
nohup_only = running_jobs = all_jobs = 0;
|
||||||
reset_internal_getopt ();
|
reset_internal_getopt ();
|
||||||
while ((opt = internal_getopt (list, "h")) != -1)
|
while ((opt = internal_getopt (list, "ahr")) != -1)
|
||||||
{
|
{
|
||||||
switch (opt)
|
switch (opt)
|
||||||
{
|
{
|
||||||
|
case 'a':
|
||||||
|
all_jobs = 1;
|
||||||
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
nohup_only = 1;
|
nohup_only = 1;
|
||||||
break;
|
break;
|
||||||
|
case 'r':
|
||||||
|
running_jobs = 1;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
builtin_usage ();
|
builtin_usage ();
|
||||||
return (EX_USAGE);
|
return (EX_USAGE);
|
||||||
|
@ -237,17 +244,15 @@ disown_builtin (list)
|
||||||
list = loptend;
|
list = loptend;
|
||||||
retval = EXECUTION_SUCCESS;
|
retval = EXECUTION_SUCCESS;
|
||||||
|
|
||||||
#if 0
|
/* `disown -a' or `disown -r' */
|
||||||
/* For the future `disown -a' */
|
if (list == 0 && (all_jobs || running_jobs))
|
||||||
if (list == 0)
|
|
||||||
{
|
{
|
||||||
if (nohup_only)
|
if (nohup_only)
|
||||||
nohup_all_jobs ();
|
nohup_all_jobs (running_jobs);
|
||||||
else
|
else
|
||||||
delete_all_jobs ();
|
delete_all_jobs (running_jobs);
|
||||||
return (EXECUTION_SUCCESS);
|
return (EXECUTION_SUCCESS);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -256,7 +261,7 @@ disown_builtin (list)
|
||||||
? get_job_by_pid (atoi(list->word->word), 0)
|
? get_job_by_pid (atoi(list->word->word), 0)
|
||||||
: get_job_spec (list);
|
: get_job_spec (list);
|
||||||
|
|
||||||
if (job == NO_JOB || jobs == 0 || jobs[job] == 0)
|
if (job == NO_JOB || jobs == 0 || job < 0 || job >= job_slots || jobs[job] == 0)
|
||||||
{
|
{
|
||||||
builtin_error ("%s: no such job", list ? list->word->word : "current");
|
builtin_error ("%s: no such job", list ? list->word->word : "current");
|
||||||
retval = EXECUTION_FAILURE;
|
retval = EXECUTION_FAILURE;
|
||||||
|
@ -264,7 +269,7 @@ disown_builtin (list)
|
||||||
else if (nohup_only)
|
else if (nohup_only)
|
||||||
nohup_job (job);
|
nohup_job (job);
|
||||||
else
|
else
|
||||||
delete_job (job);
|
delete_job (job, 1);
|
||||||
UNBLOCK_CHILD (oset);
|
UNBLOCK_CHILD (oset);
|
||||||
|
|
||||||
if (list)
|
if (list)
|
||||||
|
|
|
@ -39,6 +39,9 @@ $END
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
|
# ifdef _MINIX
|
||||||
|
# include <sys/types.h>
|
||||||
|
# endif
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -77,7 +80,10 @@ kill_builtin (list)
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
|
||||||
if (list == 0)
|
if (list == 0)
|
||||||
return (EXECUTION_SUCCESS);
|
{
|
||||||
|
builtin_usage ();
|
||||||
|
return (EXECUTION_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
any_succeeded = listing = saw_signal = 0;
|
any_succeeded = listing = saw_signal = 0;
|
||||||
signal = SIGTERM;
|
signal = SIGTERM;
|
||||||
|
@ -145,6 +151,12 @@ kill_builtin (list)
|
||||||
return (EXECUTION_FAILURE);
|
return (EXECUTION_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (list == 0)
|
||||||
|
{
|
||||||
|
builtin_usage ();
|
||||||
|
return (EXECUTION_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
while (list)
|
while (list)
|
||||||
{
|
{
|
||||||
word = list->word->word;
|
word = list->word->word;
|
||||||
|
@ -152,7 +164,7 @@ kill_builtin (list)
|
||||||
if (*word == '-')
|
if (*word == '-')
|
||||||
word++;
|
word++;
|
||||||
|
|
||||||
if (all_digits (word))
|
if (*word && all_digits (word))
|
||||||
{
|
{
|
||||||
/* Use the entire argument in case of minus sign presence. */
|
/* Use the entire argument in case of minus sign presence. */
|
||||||
pid = (pid_t) atoi (list->word->word);
|
pid = (pid_t) atoi (list->word->word);
|
||||||
|
@ -162,12 +174,12 @@ kill_builtin (list)
|
||||||
else
|
else
|
||||||
any_succeeded++;
|
any_succeeded++;
|
||||||
}
|
}
|
||||||
else if (*list->word->word != '%')
|
else if (*list->word->word && *list->word->word != '%')
|
||||||
{
|
{
|
||||||
builtin_error ("%s: no such pid", list->word->word);
|
builtin_error ("%s: no such pid", list->word->word);
|
||||||
CONTINUE_OR_FAIL;
|
CONTINUE_OR_FAIL;
|
||||||
}
|
}
|
||||||
else if (interactive || job_control)
|
else if (*word && (interactive || job_control))
|
||||||
/* Posix.2 says you can kill without job control active (4.32.4) */
|
/* Posix.2 says you can kill without job control active (4.32.4) */
|
||||||
{ /* Must be a job spec. Check it out. */
|
{ /* Must be a job spec. Check it out. */
|
||||||
int job;
|
int job;
|
||||||
|
@ -208,7 +220,7 @@ kill_builtin (list)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
builtin_error ("`%s' is not a pid or valid job spec", list->word->word);
|
builtin_error ("`%s': not a pid or valid job spec", list->word->word);
|
||||||
CONTINUE_OR_FAIL;
|
CONTINUE_OR_FAIL;
|
||||||
}
|
}
|
||||||
continue_killing:
|
continue_killing:
|
||||||
|
|
|
@ -63,6 +63,9 @@ $END
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
|
# ifdef _MINIX
|
||||||
|
# include <sys/types.h>
|
||||||
|
# endif
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -22,18 +22,20 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
|
# ifdef _MINIX
|
||||||
|
# include <sys/types.h>
|
||||||
|
# endif
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef _MINIX
|
||||||
#include "../bashtypes.h"
|
#include "../bashtypes.h"
|
||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "../posixstat.h"
|
#include "../posixstat.h"
|
||||||
#include "../filecntl.h"
|
#include "../filecntl.h"
|
||||||
|
|
||||||
#if defined (HAVE_UNISTD_H)
|
|
||||||
# include <unistd.h>
|
|
||||||
#endif /* HAVE_UNISTD_H */
|
|
||||||
|
|
||||||
#include "../bashansi.h"
|
#include "../bashansi.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
@ -437,8 +439,9 @@ extract_info (filename, structfile, externfile)
|
||||||
register int i;
|
register int i;
|
||||||
DEF_FILE *defs;
|
DEF_FILE *defs;
|
||||||
struct stat finfo;
|
struct stat finfo;
|
||||||
|
size_t file_size;
|
||||||
char *buffer, *line;
|
char *buffer, *line;
|
||||||
int fd;
|
int fd, nr;
|
||||||
|
|
||||||
if (stat (filename, &finfo) == -1)
|
if (stat (filename, &finfo) == -1)
|
||||||
file_error (filename);
|
file_error (filename);
|
||||||
|
@ -448,13 +451,20 @@ extract_info (filename, structfile, externfile)
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
file_error (filename);
|
file_error (filename);
|
||||||
|
|
||||||
buffer = xmalloc (1 + (int)finfo.st_size);
|
file_size = (size_t)finfo.st_size;
|
||||||
|
buffer = xmalloc (1 + file_size);
|
||||||
|
|
||||||
if (read (fd, buffer, finfo.st_size) != finfo.st_size)
|
if ((nr = read (fd, buffer, file_size)) < 0)
|
||||||
file_error (filename);
|
file_error (filename);
|
||||||
|
|
||||||
close (fd);
|
close (fd);
|
||||||
|
|
||||||
|
if (nr == 0)
|
||||||
|
{
|
||||||
|
fprintf (stderr, "mkbuiltins: %s: skipping zero-length file\n", filename);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Create and fill in the initial structure describing this file. */
|
/* Create and fill in the initial structure describing this file. */
|
||||||
defs = (DEF_FILE *)xmalloc (sizeof (DEF_FILE));
|
defs = (DEF_FILE *)xmalloc (sizeof (DEF_FILE));
|
||||||
defs->filename = filename;
|
defs->filename = filename;
|
||||||
|
@ -466,11 +476,11 @@ extract_info (filename, structfile, externfile)
|
||||||
|
|
||||||
/* Build the array of lines. */
|
/* Build the array of lines. */
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < finfo.st_size)
|
while (i < file_size)
|
||||||
{
|
{
|
||||||
array_add (&buffer[i], defs->lines);
|
array_add (&buffer[i], defs->lines);
|
||||||
|
|
||||||
while (buffer[i] != '\n' && i < finfo.st_size)
|
while (buffer[i] != '\n' && i < file_size)
|
||||||
i++;
|
i++;
|
||||||
buffer[i++] = '\0';
|
buffer[i++] = '\0';
|
||||||
}
|
}
|
||||||
|
@ -676,7 +686,10 @@ current_builtin (directive, defs)
|
||||||
DEF_FILE *defs;
|
DEF_FILE *defs;
|
||||||
{
|
{
|
||||||
must_be_building (directive, defs);
|
must_be_building (directive, defs);
|
||||||
return ((BUILTIN_DESC *)defs->builtins->array[defs->builtins->sindex - 1]);
|
if (defs->builtins)
|
||||||
|
return ((BUILTIN_DESC *)defs->builtins->array[defs->builtins->sindex - 1]);
|
||||||
|
else
|
||||||
|
return ((BUILTIN_DESC *)NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add LINE to the long documentation for the current builtin.
|
/* Add LINE to the long documentation for the current builtin.
|
||||||
|
@ -756,6 +769,11 @@ function_handler (self, defs, arg)
|
||||||
|
|
||||||
builtin = current_builtin (self, defs);
|
builtin = current_builtin (self, defs);
|
||||||
|
|
||||||
|
if (builtin == 0)
|
||||||
|
{
|
||||||
|
line_error (defs, "syntax error: no current builtin for $FUNCTION directive");
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
if (builtin->function)
|
if (builtin->function)
|
||||||
line_error (defs, "%s already has a function (%s)",
|
line_error (defs, "%s already has a function (%s)",
|
||||||
builtin->name, builtin->function);
|
builtin->name, builtin->function);
|
||||||
|
|
693
builtins/printf.def
Normal file
693
builtins/printf.def
Normal file
|
@ -0,0 +1,693 @@
|
||||||
|
This file is printf.def, from which is created printf.c.
|
||||||
|
It implements the builtin "printf" in Bash.
|
||||||
|
|
||||||
|
Copyright (C) 1997 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 1, 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, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||||
|
|
||||||
|
$PRODUCES printf.c
|
||||||
|
|
||||||
|
$BUILTIN printf
|
||||||
|
$FUNCTION printf_builtin
|
||||||
|
$SHORT_DOC printf format [arguments]
|
||||||
|
printf formats and prints ARGUMENTS under control of the FORMAT. FORMAT
|
||||||
|
is a character string which contains three types of objects: plain
|
||||||
|
characters, which are simply copied to standard output, character escape
|
||||||
|
sequences which are converted and copied to the standard output, and
|
||||||
|
format specifications, each of which causes printing of the next successive
|
||||||
|
argument. In addition to the standard printf(1) formats, %b means to
|
||||||
|
expand backslash escape sequences in the corresponding argument, and %q
|
||||||
|
means to quote the argument in a way that can be reused as shell input.
|
||||||
|
$END
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
#include "../bashtypes.h"
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#if defined (HAVE_LIMITS_H)
|
||||||
|
# include <limits.h>
|
||||||
|
#else
|
||||||
|
/* Assume 32-bit ints and longs. */
|
||||||
|
# define LONG_MAX 2147483647L
|
||||||
|
# define LONG_MIN (-2147483647L-1)
|
||||||
|
# define INT_MAX 2147483647
|
||||||
|
# define INT_MIN (-2147483647-1)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#include "../bashansi.h"
|
||||||
|
#include "../shell.h"
|
||||||
|
#include "../stdc.h"
|
||||||
|
#include "bashgetopt.h"
|
||||||
|
|
||||||
|
#if !defined (errno)
|
||||||
|
extern int errno;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#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); \
|
||||||
|
else \
|
||||||
|
(void)printf(f, func); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define PRETURN(value) \
|
||||||
|
do { free (format); fflush (stdout); return (value); } while (0)
|
||||||
|
|
||||||
|
#define SKIP1 "#-+ 0"
|
||||||
|
#define SKIP2 "*0123456789"
|
||||||
|
|
||||||
|
static void printstr __P((char *, char *, int, int, int));
|
||||||
|
static char *bexpand __P((char *, int, int *, int *));
|
||||||
|
static char *mklong __P((char *, int));
|
||||||
|
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 double getdouble __P((void));
|
||||||
|
static int asciicode __P((void));
|
||||||
|
|
||||||
|
static WORD_LIST *garglist;
|
||||||
|
static int retval;
|
||||||
|
|
||||||
|
extern char *backslash_quote ();
|
||||||
|
|
||||||
|
int
|
||||||
|
printf_builtin (list)
|
||||||
|
WORD_LIST *list;
|
||||||
|
{
|
||||||
|
int ch, end, fieldwidth, precision, foundmod;
|
||||||
|
char convch, nextch, *format, *fmt, *start;
|
||||||
|
|
||||||
|
retval = EXECUTION_SUCCESS;
|
||||||
|
reset_internal_getopt ();
|
||||||
|
while ((ch = internal_getopt (list, "")) != -1)
|
||||||
|
{
|
||||||
|
switch (ch)
|
||||||
|
{
|
||||||
|
case '?':
|
||||||
|
default:
|
||||||
|
builtin_usage();
|
||||||
|
return (EX_USAGE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
list = loptend;
|
||||||
|
|
||||||
|
if (list == 0)
|
||||||
|
{
|
||||||
|
builtin_usage ();
|
||||||
|
return (EX_USAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (list->word->word == 0 || list->word->word[0] == '\0')
|
||||||
|
return (EXECUTION_SUCCESS);
|
||||||
|
|
||||||
|
format = ansicstr (list->word->word, strlen (list->word->word), (int *)NULL, (int *)NULL);
|
||||||
|
|
||||||
|
garglist = list->next;
|
||||||
|
|
||||||
|
/* Basic algorithm is to scan the format string for conversion
|
||||||
|
specifications -- once one is found, find out if the field
|
||||||
|
width or precision is a '*'; if it is, gather up value. Note,
|
||||||
|
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
|
||||||
|
{
|
||||||
|
/* find next format specification */
|
||||||
|
for (fmt = format; *fmt; fmt++)
|
||||||
|
{
|
||||||
|
precision = fieldwidth = foundmod = 0;
|
||||||
|
|
||||||
|
if (*fmt != '%')
|
||||||
|
{
|
||||||
|
putchar (*fmt);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ASSERT(*fmt == '%') */
|
||||||
|
start = fmt++;
|
||||||
|
|
||||||
|
if (*fmt == '%') /* %% prints a % */
|
||||||
|
{
|
||||||
|
putchar ('%');
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 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)
|
||||||
|
;
|
||||||
|
if (*fmt == '.')
|
||||||
|
{
|
||||||
|
++fmt;
|
||||||
|
precision = (*fmt == '*') ? getint () : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* skip to conversion char */
|
||||||
|
for (; *fmt && strchr(SKIP2, *fmt); ++fmt)
|
||||||
|
;
|
||||||
|
if (*fmt == 0)
|
||||||
|
{
|
||||||
|
builtin_error ("`%s': missing format character", start);
|
||||||
|
PRETURN (EXECUTION_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* skip possible format modifiers */
|
||||||
|
if (*fmt == 'l' || *fmt == 'L' || *fmt == 'h')
|
||||||
|
{
|
||||||
|
fmt++;
|
||||||
|
foundmod = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
convch = *fmt;
|
||||||
|
nextch = fmt[1];
|
||||||
|
fmt[1] = '\0';
|
||||||
|
switch(convch)
|
||||||
|
{
|
||||||
|
case 'c':
|
||||||
|
{
|
||||||
|
char p;
|
||||||
|
|
||||||
|
p = getchr ();
|
||||||
|
PF(start, p);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 's':
|
||||||
|
{
|
||||||
|
char *p;
|
||||||
|
|
||||||
|
p = getstr ();
|
||||||
|
PF(start, p);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 'b': /* expand escapes in argument */
|
||||||
|
{
|
||||||
|
char *p, *xp;
|
||||||
|
int rlen;
|
||||||
|
|
||||||
|
p = getstr ();
|
||||||
|
ch = rlen = 0;
|
||||||
|
xp = bexpand (p, strlen (p), &ch, &rlen);
|
||||||
|
|
||||||
|
if (xp)
|
||||||
|
{
|
||||||
|
/* Have to use printstr because of possible NUL bytes
|
||||||
|
in XP -- printf does not handle that well. */
|
||||||
|
printstr (start, xp, rlen, fieldwidth, precision);
|
||||||
|
free (xp);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ch)
|
||||||
|
PRETURN (retval);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 'q': /* print with shell quoting */
|
||||||
|
{
|
||||||
|
char *p, *xp;
|
||||||
|
|
||||||
|
p = getstr ();
|
||||||
|
xp = backslash_quote (p);
|
||||||
|
if (xp)
|
||||||
|
{
|
||||||
|
/* Use printstr to get fieldwidth and precision right. */
|
||||||
|
printstr (start, xp, strlen (xp), fieldwidth, precision);
|
||||||
|
free (xp);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 'd':
|
||||||
|
case 'i':
|
||||||
|
{
|
||||||
|
long p;
|
||||||
|
char *f;
|
||||||
|
|
||||||
|
if (foundmod == 0 && ((f = mklong (start, convch)) == NULL))
|
||||||
|
PRETURN (EXECUTION_FAILURE);
|
||||||
|
else
|
||||||
|
f = start;
|
||||||
|
if (getlong (&p))
|
||||||
|
PRETURN (EXECUTION_FAILURE);
|
||||||
|
PF(f, p);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 'o':
|
||||||
|
case 'u':
|
||||||
|
case 'x':
|
||||||
|
case 'X':
|
||||||
|
{
|
||||||
|
unsigned long p;
|
||||||
|
char *f;
|
||||||
|
|
||||||
|
if (foundmod == 0 && ((f = mklong (start, convch)) == NULL))
|
||||||
|
PRETURN (EXECUTION_FAILURE);
|
||||||
|
else
|
||||||
|
f = start;
|
||||||
|
if (getulong (&p))
|
||||||
|
PRETURN (EXECUTION_FAILURE);
|
||||||
|
PF (f, p);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 'e':
|
||||||
|
case 'E':
|
||||||
|
case 'f':
|
||||||
|
case 'g':
|
||||||
|
case 'G':
|
||||||
|
{
|
||||||
|
double p;
|
||||||
|
|
||||||
|
p = getdouble ();
|
||||||
|
PF(start, p);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* We output unrecognized format characters, but we print a
|
||||||
|
warning message and return a failure exit status. */
|
||||||
|
default:
|
||||||
|
builtin_error ("`%c': illegal format character", convch);
|
||||||
|
PRETURN (EXECUTION_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt[1] = nextch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (garglist);
|
||||||
|
|
||||||
|
PRETURN (retval);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* We duplicate a lot of what printf(3) does here. */
|
||||||
|
static void
|
||||||
|
printstr (fmt, string, len, fieldwidth, precision)
|
||||||
|
char *fmt; /* format */
|
||||||
|
char *string; /* expanded string argument */
|
||||||
|
int len; /* length of expanded string */
|
||||||
|
int fieldwidth; /* argument for width of `*' */
|
||||||
|
int precision; /* argument for precision of `*' */
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
char *s;
|
||||||
|
#endif
|
||||||
|
int padlen, nc, ljust, i;
|
||||||
|
int fw, pr; /* fieldwidth and precision */
|
||||||
|
|
||||||
|
if (string == 0 || *string == '\0')
|
||||||
|
return;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
s = fmt;
|
||||||
|
#endif
|
||||||
|
if (*fmt == '%')
|
||||||
|
fmt++;
|
||||||
|
|
||||||
|
ljust = fw = pr = 0;
|
||||||
|
|
||||||
|
/* skip flags */
|
||||||
|
while (*fmt == '#' || *fmt == '-' || *fmt == '+' || *fmt == ' ' || *fmt == '0')
|
||||||
|
{
|
||||||
|
if (*fmt == '-')
|
||||||
|
ljust = 1;
|
||||||
|
fmt++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* get fieldwidth, if present */
|
||||||
|
if (*fmt == '*')
|
||||||
|
{
|
||||||
|
fmt++;
|
||||||
|
fw = fieldwidth;
|
||||||
|
}
|
||||||
|
else if (isdigit (*fmt))
|
||||||
|
{
|
||||||
|
fw = *fmt++ - '0';
|
||||||
|
while (isdigit (*fmt))
|
||||||
|
fw = (fw * 10) + (*fmt++ - '0');
|
||||||
|
}
|
||||||
|
|
||||||
|
/* get precision, if present */
|
||||||
|
if (*fmt == '.')
|
||||||
|
{
|
||||||
|
fmt++;
|
||||||
|
if (*fmt == '*')
|
||||||
|
{
|
||||||
|
fmt++;
|
||||||
|
pr = precision;
|
||||||
|
}
|
||||||
|
else if (isdigit (*fmt))
|
||||||
|
{
|
||||||
|
pr = *fmt++ - '0';
|
||||||
|
while (isdigit (*fmt))
|
||||||
|
pr = (pr * 10) + (*fmt++ - '0');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/* If we remove this, get rid of `s'. */
|
||||||
|
if (*fmt != 'b' && *fmt != 'q')
|
||||||
|
{
|
||||||
|
internal_error ("format parsing problem: %s", s);
|
||||||
|
fw = pr = 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* chars from string to print */
|
||||||
|
nc = (pr > 0 && pr <= len) ? pr : len;
|
||||||
|
|
||||||
|
padlen = fw - nc;
|
||||||
|
if (padlen < 0)
|
||||||
|
padlen = 0;
|
||||||
|
if (ljust)
|
||||||
|
padlen = -padlen;
|
||||||
|
|
||||||
|
/* leading pad characters */
|
||||||
|
for (; padlen > 0; padlen--)
|
||||||
|
putchar (' ');
|
||||||
|
|
||||||
|
/* output NC characters from STRING */
|
||||||
|
for (i = 0; i < nc; i++)
|
||||||
|
putchar (string[i]);
|
||||||
|
|
||||||
|
/* output any necessary trailing padding */
|
||||||
|
for (; padlen < 0; padlen++)
|
||||||
|
putchar (' ');
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Convert STRING by expanding the escape sequences specified by the
|
||||||
|
POSIX standard for printf's `%b' format string. If SAWC is non-null,
|
||||||
|
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')
|
||||||
|
|
||||||
|
static char *
|
||||||
|
bexpand (string, len, sawc, lenp)
|
||||||
|
char *string;
|
||||||
|
int len, *sawc, *lenp;
|
||||||
|
{
|
||||||
|
int c, temp;
|
||||||
|
char *ret, *r, *s;
|
||||||
|
|
||||||
|
if (string == 0 || *string == '\0')
|
||||||
|
{
|
||||||
|
if (sawc)
|
||||||
|
*sawc = 0;
|
||||||
|
if (lenp)
|
||||||
|
*lenp = 0;
|
||||||
|
return ((char *)NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = xmalloc (len + 1);
|
||||||
|
for (r = ret, s = string; s && *s; )
|
||||||
|
{
|
||||||
|
c = *s++;
|
||||||
|
if (c != '\\' || *s == '\0')
|
||||||
|
{
|
||||||
|
*r++ = c;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (c = *s++)
|
||||||
|
{
|
||||||
|
#if defined (__STDC__)
|
||||||
|
case 'a': c = '\a'; break;
|
||||||
|
#else
|
||||||
|
case 'a': c = '\007'; break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
case 'b': c = '\b'; break;
|
||||||
|
|
||||||
|
case 'e': c = '\033'; break; /* ESC -- non-ANSI */
|
||||||
|
|
||||||
|
case 'f': c = '\f'; break;
|
||||||
|
|
||||||
|
case 'n': c = '\n'; break;
|
||||||
|
|
||||||
|
case 'r': c = '\r'; break;
|
||||||
|
|
||||||
|
case 't': c = '\t'; break;
|
||||||
|
|
||||||
|
case 'v': c = '\v'; break;
|
||||||
|
|
||||||
|
/* %b octal constants are `\0' followed by one, two, or three
|
||||||
|
octal digits... */
|
||||||
|
case '0':
|
||||||
|
for (temp = 3, c = 0; isoctal (*s) && temp--; s++)
|
||||||
|
c = (c * 8) + OCTVALUE (*s);
|
||||||
|
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, c -= '0'; isoctal (*s) && temp--; s++)
|
||||||
|
c = (c * 8) + OCTVALUE (*s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* And, as another extension, we allow \xNNN, where each N is a
|
||||||
|
hex digit. */
|
||||||
|
case 'x':
|
||||||
|
for (temp = 3, c = 0; isxdigit (*s) && temp--; s++)
|
||||||
|
c = (c * 16) + HEXVALUE (*s);
|
||||||
|
if (temp == 3)
|
||||||
|
{
|
||||||
|
builtin_error ("missing hex digit for \\x");
|
||||||
|
*r++ = '\\';
|
||||||
|
c = 'x';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '\\':
|
||||||
|
#if 0
|
||||||
|
case '\'': /* XXX */
|
||||||
|
case '"': /* XXX */
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'c':
|
||||||
|
if (sawc)
|
||||||
|
*sawc = 1;
|
||||||
|
*r = '\0';
|
||||||
|
if (lenp)
|
||||||
|
*lenp = r - ret;
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
/* other backslash escapes are passed through unaltered */
|
||||||
|
default: *r++ = '\\'; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
*r++ = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
*r = '\0';
|
||||||
|
if (lenp)
|
||||||
|
*lenp = r - ret;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *
|
||||||
|
mklong (str, ch)
|
||||||
|
char *str;
|
||||||
|
int ch;
|
||||||
|
{
|
||||||
|
static char copy[64];
|
||||||
|
int len;
|
||||||
|
|
||||||
|
len = strlen (str) + 2;
|
||||||
|
FASTCOPY (str, copy, len - 3);
|
||||||
|
copy[len - 3] = 'l';
|
||||||
|
copy[len - 2] = ch;
|
||||||
|
copy[len - 1] = '\0';
|
||||||
|
return (copy);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
getchr ()
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (garglist == 0)
|
||||||
|
return ('\0');
|
||||||
|
|
||||||
|
ret = (int)garglist->word->word[0];
|
||||||
|
garglist = garglist->next;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *
|
||||||
|
getstr ()
|
||||||
|
{
|
||||||
|
char *ret;
|
||||||
|
|
||||||
|
if (garglist == 0)
|
||||||
|
return ("");
|
||||||
|
|
||||||
|
ret = garglist->word->word;
|
||||||
|
garglist = garglist->next;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
getint ()
|
||||||
|
{
|
||||||
|
long ret;
|
||||||
|
|
||||||
|
if (getlong (&ret))
|
||||||
|
return (0);
|
||||||
|
|
||||||
|
if (ret > INT_MAX)
|
||||||
|
{
|
||||||
|
builtin_error ("%s: %s", garglist->word->word, strerror(ERANGE));
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ((int)ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
getlong (lp)
|
||||||
|
long *lp;
|
||||||
|
{
|
||||||
|
long ret;
|
||||||
|
|
||||||
|
if (garglist == 0)
|
||||||
|
{
|
||||||
|
*lp = 0L;
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (garglist->word->word[0] == '\'' || garglist->word->word[0] == '"')
|
||||||
|
{
|
||||||
|
*lp = (long)asciicode ();
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
errno = 0;
|
||||||
|
/* legal_number does not currently detect overflow, but it should.
|
||||||
|
Someday it will. */
|
||||||
|
if (legal_number (garglist->word->word, &ret) == 0)
|
||||||
|
{
|
||||||
|
builtin_error ("%s: illegal number", garglist->word->word);
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
else if (errno == ERANGE)
|
||||||
|
{
|
||||||
|
builtin_error ("%s: %s", garglist->word->word, strerror(ERANGE));
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
*lp = ret;
|
||||||
|
garglist = garglist->next;
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
getulong (ulp)
|
||||||
|
unsigned long *ulp;
|
||||||
|
{
|
||||||
|
unsigned long ret;
|
||||||
|
char *ep;
|
||||||
|
|
||||||
|
if (garglist == 0)
|
||||||
|
{
|
||||||
|
*ulp = (unsigned long)0;
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (garglist->word->word[0] == '\'' || garglist->word->word[0] == '"')
|
||||||
|
{
|
||||||
|
*ulp = (unsigned long)asciicode ();
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
errno = 0;
|
||||||
|
ret = strtoul (garglist->word->word, &ep, 0);
|
||||||
|
|
||||||
|
if (*ep)
|
||||||
|
{
|
||||||
|
builtin_error ("%s: illegal number", garglist->word->word);
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
else if (errno == ERANGE)
|
||||||
|
{
|
||||||
|
builtin_error ("%s: %s", garglist->word->word, strerror(ERANGE));
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
*ulp = ret;
|
||||||
|
garglist = garglist->next;
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static double
|
||||||
|
getdouble ()
|
||||||
|
{
|
||||||
|
double ret;
|
||||||
|
|
||||||
|
if (garglist == 0)
|
||||||
|
return ((double)0);
|
||||||
|
|
||||||
|
if (garglist->word->word[0] == '\'' || garglist->word->word[0] == '"')
|
||||||
|
return ((double)asciicode ());
|
||||||
|
|
||||||
|
/* This should use strtod if it is available. */
|
||||||
|
ret = atof (garglist->word->word);
|
||||||
|
garglist = garglist->next;
|
||||||
|
return (ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* NO check is needed for garglist here. */
|
||||||
|
static int
|
||||||
|
asciicode ()
|
||||||
|
{
|
||||||
|
register int ch;
|
||||||
|
|
||||||
|
ch = garglist->word->word[1];
|
||||||
|
garglist = garglist->next;
|
||||||
|
return (ch);
|
||||||
|
}
|
|
@ -24,11 +24,16 @@
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
|
# ifdef _MINIX
|
||||||
|
# include <sys/types.h>
|
||||||
|
# endif
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#ifndef _MINIX
|
||||||
#include "../bashtypes.h"
|
#include "../bashtypes.h"
|
||||||
|
#endif
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,12 @@
|
||||||
# psize.sh -- determine this system's pipe size, and write a define to
|
# psize.sh -- determine this system's pipe size, and write a define to
|
||||||
# pipesize.h so ulimit.c can use it.
|
# pipesize.h so ulimit.c can use it.
|
||||||
|
|
||||||
|
TMPDIR=/tmp
|
||||||
|
TMPNAME=pipsize.$$
|
||||||
|
TMPFILE=$TMPDIR/$TMPNAME
|
||||||
|
|
||||||
|
trap 'rm -f $TMPFILE' 0 1 2 3 6 15
|
||||||
|
|
||||||
echo "/*"
|
echo "/*"
|
||||||
echo " * pipesize.h"
|
echo " * pipesize.h"
|
||||||
echo " *"
|
echo " *"
|
||||||
|
@ -11,14 +17,20 @@ echo " * Do not edit!"
|
||||||
echo " */"
|
echo " */"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
./psize.aux 2>/tmp/pipesize | sleep 3
|
#
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
rm -f $TMPFILE
|
||||||
|
|
||||||
if [ -s /tmp/pipesize ]; then
|
./psize.aux 2>$TMPFILE | sleep 3
|
||||||
echo "#define PIPESIZE `cat /tmp/pipesize`"
|
|
||||||
|
if [ -s $TMPFILE ]; then
|
||||||
|
echo "#define PIPESIZE `cat $TMPFILE`"
|
||||||
else
|
else
|
||||||
echo "#define PIPESIZE 512"
|
echo "#define PIPESIZE 512"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f /tmp/pipesize
|
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -95,9 +95,14 @@ $END
|
||||||
|
|
||||||
#if defined (PUSHD_AND_POPD)
|
#if defined (PUSHD_AND_POPD)
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/param.h>
|
#ifndef _MINIX
|
||||||
|
# include <sys/param.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
|
# ifdef _MINIX
|
||||||
|
# include <sys/types.h>
|
||||||
|
# endif
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -547,6 +552,34 @@ get_dirstack_index (ind, sign, indexp)
|
||||||
return (sign > 0 ? directory_list_offset - ind : ind);
|
return (sign > 0 ? directory_list_offset - ind : ind);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Used by the tilde expansion code. */
|
||||||
|
char *
|
||||||
|
get_dirstack_from_string (string)
|
||||||
|
char *string;
|
||||||
|
{
|
||||||
|
int ind, sign, index_flag;
|
||||||
|
long i;
|
||||||
|
|
||||||
|
sign = 1;
|
||||||
|
if (*string == '-' || *string == '+')
|
||||||
|
{
|
||||||
|
sign = (*string == '-') ? -1 : 1;
|
||||||
|
string++;
|
||||||
|
}
|
||||||
|
if (legal_number (string, &i) == 0)
|
||||||
|
return ((char *)NULL);
|
||||||
|
|
||||||
|
index_flag = 0;
|
||||||
|
ind = get_dirstack_index (i, sign, &index_flag);
|
||||||
|
if (index_flag && (ind < 0 || ind > directory_list_offset))
|
||||||
|
return ((char *)NULL);
|
||||||
|
if (index_flag == 0 || (index_flag == 1 && ind == 0))
|
||||||
|
return (get_string_value ("PWD"));
|
||||||
|
else
|
||||||
|
return (pushd_directory_list[ind]);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef INCLUDE_UNUSED
|
||||||
char *
|
char *
|
||||||
get_dirstack_element (ind, sign)
|
get_dirstack_element (ind, sign)
|
||||||
int ind, sign;
|
int ind, sign;
|
||||||
|
@ -557,6 +590,7 @@ get_dirstack_element (ind, sign)
|
||||||
return (i < 0 || i > directory_list_offset) ? (char *)NULL
|
return (i < 0 || i > directory_list_offset) ? (char *)NULL
|
||||||
: pushd_directory_list[i];
|
: pushd_directory_list[i];
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
set_dirstack_element (ind, sign, value)
|
set_dirstack_element (ind, sign, value)
|
||||||
|
|
|
@ -43,6 +43,9 @@ $END
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
|
# ifdef _MINIX
|
||||||
|
# include <sys/types.h>
|
||||||
|
# endif
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -395,11 +398,13 @@ bind_read_variable (name, value)
|
||||||
#if defined (ARRAY_VARS)
|
#if defined (ARRAY_VARS)
|
||||||
if (valid_array_reference (name) == 0)
|
if (valid_array_reference (name) == 0)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
if (legal_identifier (name) == 0)
|
if (legal_identifier (name) == 0)
|
||||||
{
|
{
|
||||||
builtin_error ("`%s': not a valid identifier", name);
|
builtin_error ("`%s': not a valid identifier", name);
|
||||||
return ((SHELL_VAR *)NULL);
|
return ((SHELL_VAR *)NULL);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return (bind_variable (name, value));
|
return (bind_variable (name, value));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -32,6 +32,9 @@ $END
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
|
# ifdef _MINIX
|
||||||
|
# include <sys/types.h>
|
||||||
|
# endif
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,9 @@ $PRODUCES set.c
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
|
# ifdef _MINIX
|
||||||
|
# include <sys/types.h>
|
||||||
|
# endif
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -229,9 +232,20 @@ minus_o_option_value (name)
|
||||||
|
|
||||||
#define MINUS_O_FORMAT "%-15s\t%s\n"
|
#define MINUS_O_FORMAT "%-15s\t%s\n"
|
||||||
|
|
||||||
|
static void
|
||||||
|
print_minus_o_option (name, value, pflag)
|
||||||
|
char *name;
|
||||||
|
int value, pflag;
|
||||||
|
{
|
||||||
|
if (pflag == 0)
|
||||||
|
printf (MINUS_O_FORMAT, name, value ? on : off);
|
||||||
|
else
|
||||||
|
printf ("set %co %s\n", value ? '-' : '+', name);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
list_minus_o_opts (mode)
|
list_minus_o_opts (mode, reusable)
|
||||||
int mode;
|
int mode, reusable;
|
||||||
{
|
{
|
||||||
register int i;
|
register int i;
|
||||||
int *on_or_off, value;
|
int *on_or_off, value;
|
||||||
|
@ -242,33 +256,13 @@ list_minus_o_opts (mode)
|
||||||
if (on_or_off == FLAG_UNKNOWN)
|
if (on_or_off == FLAG_UNKNOWN)
|
||||||
on_or_off = &value;
|
on_or_off = &value;
|
||||||
if (mode == -1 || mode == *on_or_off)
|
if (mode == -1 || mode == *on_or_off)
|
||||||
printf (MINUS_O_FORMAT, o_options[i].name, *on_or_off ? on : off);
|
print_minus_o_option (o_options[i].name, *on_or_off, reusable);
|
||||||
}
|
}
|
||||||
for (i = 0; binary_o_options[i].name; i++)
|
for (i = 0; binary_o_options[i].name; i++)
|
||||||
{
|
{
|
||||||
value = GET_BINARY_O_OPTION_VALUE (i, binary_o_options[i].name);
|
value = GET_BINARY_O_OPTION_VALUE (i, binary_o_options[i].name);
|
||||||
if (mode == -1 || mode == value)
|
if (mode == -1 || mode == value)
|
||||||
printf (MINUS_O_FORMAT, binary_o_options[i].name, value ? on : off);
|
print_minus_o_option (binary_o_options[i].name, value, reusable);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
minus_o_option_commands ()
|
|
||||||
{
|
|
||||||
register int i;
|
|
||||||
int *on_or_off, value;
|
|
||||||
|
|
||||||
for (value = i = 0; o_options[i].name; i++)
|
|
||||||
{
|
|
||||||
on_or_off = find_flag (o_options[i].letter);
|
|
||||||
if (on_or_off == FLAG_UNKNOWN)
|
|
||||||
on_or_off = &value;
|
|
||||||
printf ("set %co %s\n", *on_or_off ? '-' : '+', o_options[i].name);
|
|
||||||
}
|
|
||||||
for (i = 0; binary_o_options[i].name; i++)
|
|
||||||
{
|
|
||||||
value = GET_BINARY_O_OPTION_VALUE (i, binary_o_options[i].name);
|
|
||||||
printf ("set %co %s\n", value ? '-' : '+', binary_o_options[i].name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -421,7 +415,7 @@ void
|
||||||
set_shellopts ()
|
set_shellopts ()
|
||||||
{
|
{
|
||||||
char *value;
|
char *value;
|
||||||
int vsize, i, vptr, *ip;
|
int vsize, i, vptr, *ip, exported;
|
||||||
SHELL_VAR *v;
|
SHELL_VAR *v;
|
||||||
|
|
||||||
for (vsize = i = 0; o_options[i].name; i++)
|
for (vsize = i = 0; o_options[i].name; i++)
|
||||||
|
@ -458,10 +452,25 @@ set_shellopts ()
|
||||||
value[vptr] = '\0';
|
value[vptr] = '\0';
|
||||||
|
|
||||||
v = find_variable ("SHELLOPTS");
|
v = find_variable ("SHELLOPTS");
|
||||||
|
|
||||||
|
/* Turn off the read-only attribute so we can bind the new value, and
|
||||||
|
note whether or not the variable was exported. */
|
||||||
if (v)
|
if (v)
|
||||||
v->attributes &= ~att_readonly;
|
{
|
||||||
|
v->attributes &= ~att_readonly;
|
||||||
|
exported = exported_p (v);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
exported = 0;
|
||||||
|
|
||||||
v = bind_variable ("SHELLOPTS", value);
|
v = bind_variable ("SHELLOPTS", value);
|
||||||
|
|
||||||
|
/* Turn the read-only attribute back on, and turn off the export attribute
|
||||||
|
if it was set implicitly by mark_modified_vars and SHELLOPTS was not
|
||||||
|
exported before we bound the new value. */
|
||||||
v->attributes |= att_readonly;
|
v->attributes |= att_readonly;
|
||||||
|
if (mark_modified_vars && exported == 0 && exported_p (v))
|
||||||
|
v->attributes &= ~att_exported;
|
||||||
|
|
||||||
free (value);
|
free (value);
|
||||||
}
|
}
|
||||||
|
@ -482,20 +491,24 @@ parse_shellopts (value)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
initialize_shell_options ()
|
initialize_shell_options (no_shellopts)
|
||||||
|
int no_shellopts;
|
||||||
{
|
{
|
||||||
char *temp;
|
char *temp;
|
||||||
SHELL_VAR *var;
|
SHELL_VAR *var;
|
||||||
|
|
||||||
var = find_variable ("SHELLOPTS");
|
if (no_shellopts == 0)
|
||||||
/* set up any shell options we may have inherited. */
|
|
||||||
if (var && imported_p (var))
|
|
||||||
{
|
{
|
||||||
temp = (array_p (var)) ? (char *)NULL : savestring (value_cell (var));
|
var = find_variable ("SHELLOPTS");
|
||||||
if (temp)
|
/* set up any shell options we may have inherited. */
|
||||||
|
if (var && imported_p (var))
|
||||||
{
|
{
|
||||||
parse_shellopts (temp);
|
temp = (array_p (var)) ? (char *)NULL : savestring (value_cell (var));
|
||||||
free (temp);
|
if (temp)
|
||||||
|
{
|
||||||
|
parse_shellopts (temp);
|
||||||
|
free (temp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -607,10 +620,7 @@ set_builtin (list)
|
||||||
|
|
||||||
if (opt == 0)
|
if (opt == 0)
|
||||||
{
|
{
|
||||||
if (on_or_off == '-')
|
list_minus_o_opts (-1, (on_or_off == '+'));
|
||||||
list_minus_o_opts (-1);
|
|
||||||
else
|
|
||||||
minus_o_option_commands ();
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -619,10 +629,7 @@ set_builtin (list)
|
||||||
if (option_name == 0 || *option_name == '\0' ||
|
if (option_name == 0 || *option_name == '\0' ||
|
||||||
*option_name == '-' || *option_name == '+')
|
*option_name == '-' || *option_name == '+')
|
||||||
{
|
{
|
||||||
if (on_or_off == '-')
|
list_minus_o_opts (-1, (on_or_off == '+'));
|
||||||
list_minus_o_opts (-1);
|
|
||||||
else
|
|
||||||
minus_o_option_commands ();
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
list = list->next; /* Skip over option name. */
|
list = list->next; /* Skip over option name. */
|
||||||
|
@ -730,7 +737,10 @@ unset_builtin (list)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (legal_identifier (name) == 0)
|
/* Bash allows functions with names which are not valid identifiers
|
||||||
|
to be created when not in posix mode, so check only when in posix
|
||||||
|
mode when unsetting a function. */
|
||||||
|
if (((unset_function && posixly_correct) || !unset_function) && legal_identifier (name) == 0)
|
||||||
{
|
{
|
||||||
builtin_error ("`%s': not a valid identifier", name);
|
builtin_error ("`%s': not a valid identifier", name);
|
||||||
NEXT_VARIABLE ();
|
NEXT_VARIABLE ();
|
||||||
|
|
|
@ -24,6 +24,9 @@ $PRODUCES setattr.c
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
|
# ifdef _MINIX
|
||||||
|
# include <sys/types.h>
|
||||||
|
# endif
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -339,6 +342,7 @@ show_name_attributes (name, nodefs)
|
||||||
int nodefs;
|
int nodefs;
|
||||||
{
|
{
|
||||||
SHELL_VAR *var;
|
SHELL_VAR *var;
|
||||||
|
int ret;
|
||||||
|
|
||||||
var = find_tempenv_variable (name);
|
var = find_tempenv_variable (name);
|
||||||
if (var == 0)
|
if (var == 0)
|
||||||
|
@ -347,6 +351,8 @@ show_name_attributes (name, nodefs)
|
||||||
if (var && invisible_p (var) == 0)
|
if (var && invisible_p (var) == 0)
|
||||||
{
|
{
|
||||||
show_var_attributes (var, READONLY_OR_EXPORT, nodefs);
|
show_var_attributes (var, READONLY_OR_EXPORT, nodefs);
|
||||||
|
if (tempvar_p (var))
|
||||||
|
dispose_variable (var);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -24,6 +24,9 @@ $PRODUCES shift.c
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
|
# ifdef _MINIX
|
||||||
|
# include <sys/types.h>
|
||||||
|
# endif
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,9 @@ $END
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
|
# ifdef _MINIX
|
||||||
|
# include <sys/types.h>
|
||||||
|
# endif
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -59,6 +62,12 @@ extern int no_exit_on_failed_exec, print_shift_error;
|
||||||
extern int check_hashed_filenames, promptvars, interactive_comments;
|
extern int check_hashed_filenames, promptvars, interactive_comments;
|
||||||
extern int cdspelling, expand_aliases;
|
extern int cdspelling, expand_aliases;
|
||||||
extern int check_window_size;
|
extern int check_window_size;
|
||||||
|
extern int glob_ignore_case;
|
||||||
|
extern int hup_on_exit;
|
||||||
|
|
||||||
|
#if defined (EXTENDED_GLOB)
|
||||||
|
extern int extended_glob;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined (HISTORY)
|
#if defined (HISTORY)
|
||||||
extern int literal_history, command_oriented_history;
|
extern int literal_history, command_oriented_history;
|
||||||
|
@ -89,6 +98,9 @@ static struct {
|
||||||
{ "dotglob", &glob_dot_filenames, (Function *)NULL },
|
{ "dotglob", &glob_dot_filenames, (Function *)NULL },
|
||||||
{ "execfail", &no_exit_on_failed_exec, (Function *)NULL },
|
{ "execfail", &no_exit_on_failed_exec, (Function *)NULL },
|
||||||
{ "expand_aliases", &expand_aliases, (Function *)NULL },
|
{ "expand_aliases", &expand_aliases, (Function *)NULL },
|
||||||
|
#if defined (EXTENDED_GLOB)
|
||||||
|
{ "extglob", &extended_glob, (Function *)NULL },
|
||||||
|
#endif
|
||||||
#if defined (READLINE)
|
#if defined (READLINE)
|
||||||
{ "histreedit", &history_reediting, (Function *)NULL },
|
{ "histreedit", &history_reediting, (Function *)NULL },
|
||||||
#endif
|
#endif
|
||||||
|
@ -99,11 +111,13 @@ static struct {
|
||||||
{ "histverify", &hist_verify, (Function *)NULL },
|
{ "histverify", &hist_verify, (Function *)NULL },
|
||||||
{ "hostcomplete", &perform_hostname_completion, (Function *)enable_hostname_completion },
|
{ "hostcomplete", &perform_hostname_completion, (Function *)enable_hostname_completion },
|
||||||
#endif
|
#endif
|
||||||
|
{ "huponexit", &hup_on_exit, (Function *)NULL },
|
||||||
{ "interactive_comments", &interactive_comments, set_interactive_comments },
|
{ "interactive_comments", &interactive_comments, set_interactive_comments },
|
||||||
#if defined (HISTORY)
|
#if defined (HISTORY)
|
||||||
{ "lithist", &literal_history, (Function *)NULL },
|
{ "lithist", &literal_history, (Function *)NULL },
|
||||||
#endif
|
#endif
|
||||||
{ "mailwarn", &mail_warning, (Function *)NULL },
|
{ "mailwarn", &mail_warning, (Function *)NULL },
|
||||||
|
{ "nocaseglob", &glob_ignore_case, (Function *)NULL },
|
||||||
{ "nullglob", &allow_null_glob_expansion, (Function *)NULL },
|
{ "nullglob", &allow_null_glob_expansion, (Function *)NULL },
|
||||||
{ "promptvars", &promptvars, (Function *)NULL },
|
{ "promptvars", &promptvars, (Function *)NULL },
|
||||||
{ "shift_verbose", &print_shift_error, (Function *)NULL },
|
{ "shift_verbose", &print_shift_error, (Function *)NULL },
|
||||||
|
@ -166,17 +180,17 @@ shopt_builtin (list)
|
||||||
|
|
||||||
rval = EXECUTION_SUCCESS;
|
rval = EXECUTION_SUCCESS;
|
||||||
if ((flags & OFLAG) && ((flags & (SFLAG|UFLAG)) == 0)) /* shopt -o */
|
if ((flags & OFLAG) && ((flags & (SFLAG|UFLAG)) == 0)) /* shopt -o */
|
||||||
rval = list_shopt_o_options (list, flags & QFLAG);
|
rval = list_shopt_o_options (list, flags);
|
||||||
else if (list && (flags & OFLAG)) /* shopt -so args */
|
else if (list && (flags & OFLAG)) /* shopt -so args */
|
||||||
rval = set_shopt_o_options ((flags & SFLAG) ? FLAG_ON : FLAG_OFF, list, flags & QFLAG);
|
rval = set_shopt_o_options ((flags & SFLAG) ? FLAG_ON : FLAG_OFF, list, flags & QFLAG);
|
||||||
else if (flags & OFLAG) /* shopt -so */
|
else if (flags & OFLAG) /* shopt -so */
|
||||||
rval = list_some_o_options ((flags & SFLAG) ? FLAG_ON : FLAG_OFF, flags & QFLAG);
|
rval = list_some_o_options ((flags & SFLAG) ? 1 : 0, flags);
|
||||||
else if (list && (flags & (SFLAG|UFLAG))) /* shopt -su args */
|
else if (list && (flags & (SFLAG|UFLAG))) /* shopt -su args */
|
||||||
rval = toggle_shopts ((flags & SFLAG) ? SETOPT : UNSETOPT, list, flags & QFLAG);
|
rval = toggle_shopts ((flags & SFLAG) ? SETOPT : UNSETOPT, list, flags & QFLAG);
|
||||||
else if ((flags & (SFLAG|UFLAG)) == 0) /* shopt [args] */
|
else if ((flags & (SFLAG|UFLAG)) == 0) /* shopt [args] */
|
||||||
rval = list_shopts (list, flags & QFLAG);
|
rval = list_shopts (list, flags);
|
||||||
else /* shopt -su */
|
else /* shopt -su */
|
||||||
rval = list_some_shopts ((flags & SFLAG) ? SETOPT : UNSETOPT, flags & QFLAG);
|
rval = list_some_shopts ((flags & SFLAG) ? SETOPT : UNSETOPT, flags);
|
||||||
return (rval);
|
return (rval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,6 +206,10 @@ reset_shopt_options ()
|
||||||
|
|
||||||
source_uses_path = promptvars = 1;
|
source_uses_path = promptvars = 1;
|
||||||
|
|
||||||
|
#if defined (EXTENDED_GLOB)
|
||||||
|
extended_glob = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined (HISTORY)
|
#if defined (HISTORY)
|
||||||
literal_history = force_append_history = 0;
|
literal_history = force_append_history = 0;
|
||||||
command_oriented_history = 1;
|
command_oriented_history = 1;
|
||||||
|
@ -244,12 +262,23 @@ toggle_shopts (mode, list, quiet)
|
||||||
return (rval);
|
return (rval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
print_shopt (name, val, flags)
|
||||||
|
char *name;
|
||||||
|
int val, flags;
|
||||||
|
{
|
||||||
|
if (flags & PFLAG)
|
||||||
|
printf ("shopt %s %s\n", val ? "-s" : "-u", name);
|
||||||
|
else
|
||||||
|
printf (OPTFMT, name, val ? on : off);
|
||||||
|
}
|
||||||
|
|
||||||
/* List the values of all or any of the `shopt' options. Returns 0 if
|
/* List the values of all or any of the `shopt' options. Returns 0 if
|
||||||
all were listed or all variables queried were on; 1 otherwise. */
|
all were listed or all variables queried were on; 1 otherwise. */
|
||||||
static int
|
static int
|
||||||
list_shopts (list, quiet)
|
list_shopts (list, flags)
|
||||||
WORD_LIST *list;
|
WORD_LIST *list;
|
||||||
int quiet;
|
int flags;
|
||||||
{
|
{
|
||||||
WORD_LIST *l;
|
WORD_LIST *l;
|
||||||
int i, val, rval;
|
int i, val, rval;
|
||||||
|
@ -259,8 +288,8 @@ list_shopts (list, quiet)
|
||||||
for (i = 0; shopt_vars[i].name; i++)
|
for (i = 0; shopt_vars[i].name; i++)
|
||||||
{
|
{
|
||||||
val = *shopt_vars[i].value;
|
val = *shopt_vars[i].value;
|
||||||
if (quiet == 0)
|
if ((flags & QFLAG) == 0)
|
||||||
printf (OPTFMT, shopt_vars[i].name, val ? on : off);
|
print_shopt (shopt_vars[i].name, val, flags);
|
||||||
}
|
}
|
||||||
return (EXECUTION_SUCCESS);
|
return (EXECUTION_SUCCESS);
|
||||||
}
|
}
|
||||||
|
@ -277,39 +306,39 @@ list_shopts (list, quiet)
|
||||||
val = *shopt_vars[i].value;
|
val = *shopt_vars[i].value;
|
||||||
if (val == 0)
|
if (val == 0)
|
||||||
rval = EXECUTION_FAILURE;
|
rval = EXECUTION_FAILURE;
|
||||||
if (quiet == 0)
|
if ((flags & QFLAG) == 0)
|
||||||
printf (OPTFMT, l->word->word, val ? on : off);
|
print_shopt (l->word->word, val, flags);
|
||||||
}
|
}
|
||||||
return (rval);
|
return (rval);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
list_some_shopts (mode, quiet)
|
list_some_shopts (mode, flags)
|
||||||
int mode, quiet;
|
int mode, flags;
|
||||||
{
|
{
|
||||||
int val, i;
|
int val, i;
|
||||||
|
|
||||||
for (i = 0; shopt_vars[i].name; i++)
|
for (i = 0; shopt_vars[i].name; i++)
|
||||||
{
|
{
|
||||||
val = *shopt_vars[i].value;
|
val = *shopt_vars[i].value;
|
||||||
if (quiet == 0 && mode == val)
|
if (((flags & QFLAG) == 0) && mode == val)
|
||||||
printf (OPTFMT, shopt_vars[i].name, val ? on : off);
|
print_shopt (shopt_vars[i].name, val, flags);
|
||||||
}
|
}
|
||||||
return (EXECUTION_SUCCESS);
|
return (EXECUTION_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
list_shopt_o_options (list, quiet)
|
list_shopt_o_options (list, flags)
|
||||||
WORD_LIST *list;
|
WORD_LIST *list;
|
||||||
int quiet;
|
int flags;
|
||||||
{
|
{
|
||||||
WORD_LIST *l;
|
WORD_LIST *l;
|
||||||
int val, rval;
|
int val, rval;
|
||||||
|
|
||||||
if (list == 0)
|
if (list == 0)
|
||||||
{
|
{
|
||||||
if (quiet == 0)
|
if ((flags & QFLAG) == 0)
|
||||||
list_minus_o_opts (-1);
|
list_minus_o_opts (-1, (flags & PFLAG));
|
||||||
return (EXECUTION_SUCCESS);
|
return (EXECUTION_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,18 +353,23 @@ list_shopt_o_options (list, quiet)
|
||||||
}
|
}
|
||||||
if (val == 0)
|
if (val == 0)
|
||||||
rval = EXECUTION_FAILURE;
|
rval = EXECUTION_FAILURE;
|
||||||
if (quiet == 0)
|
if ((flags & QFLAG) == 0)
|
||||||
printf (OPTFMT, l->word->word, val ? "on" : "off");
|
{
|
||||||
|
if (flags & PFLAG)
|
||||||
|
printf ("set %co %s\n", val ? '-' : '+', l->word->word);
|
||||||
|
else
|
||||||
|
printf (OPTFMT, l->word->word, val ? on : off);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return (rval);
|
return (rval);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
list_some_o_options (mode, quiet)
|
list_some_o_options (mode, flags)
|
||||||
int mode, quiet;
|
int mode, flags;
|
||||||
{
|
{
|
||||||
if (quiet == 0)
|
if ((flags & QFLAG) == 0)
|
||||||
list_minus_o_opts (mode);
|
list_minus_o_opts (mode, (flags & PFLAG));
|
||||||
return (EXECUTION_SUCCESS);
|
return (EXECUTION_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,9 @@ $END
|
||||||
#include "../bashtypes.h"
|
#include "../bashtypes.h"
|
||||||
#include "../posixstat.h"
|
#include "../posixstat.h"
|
||||||
#include "../filecntl.h"
|
#include "../filecntl.h"
|
||||||
#include <sys/file.h>
|
#ifndef _MINIX
|
||||||
|
# include <sys/file.h>
|
||||||
|
#endif
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
|
@ -51,7 +53,7 @@ $END
|
||||||
#include "../bashansi.h"
|
#include "../bashansi.h"
|
||||||
|
|
||||||
#include "../shell.h"
|
#include "../shell.h"
|
||||||
#include "../execute_cmd.h"
|
#include "../findcmd.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#if !defined (errno)
|
#if !defined (errno)
|
||||||
|
|
|
@ -34,6 +34,9 @@ $END
|
||||||
|
|
||||||
#if defined (JOB_CONTROL)
|
#if defined (JOB_CONTROL)
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
|
# ifdef _MINIX
|
||||||
|
# include <sys/types.h>
|
||||||
|
# endif
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -50,9 +50,10 @@ File operators:
|
||||||
-x FILE True if the file is executable by you.
|
-x FILE True if the file is executable by you.
|
||||||
-O FILE True if the file is effectively owned by you.
|
-O FILE True if the file is effectively owned by you.
|
||||||
-G FILE True if the file is effectively owned by your group.
|
-G FILE True if the file is effectively owned by your group.
|
||||||
|
-N FILE True if the file has been modified since it was last read.
|
||||||
|
|
||||||
FILE1 -nt FILE2 True if file1 is newer than (according to
|
FILE1 -nt FILE2 True if file1 is newer than file2 (according to
|
||||||
modification date) file2.
|
modification date).
|
||||||
|
|
||||||
FILE1 -ot FILE2 True if file1 is older than file2.
|
FILE1 -ot FILE2 True if file1 is older than file2.
|
||||||
|
|
||||||
|
@ -70,12 +71,13 @@ String operators:
|
||||||
STRING1 != STRING2
|
STRING1 != STRING2
|
||||||
True if the strings are not equal.
|
True if the strings are not equal.
|
||||||
STRING1 < STRING2
|
STRING1 < STRING2
|
||||||
True if STRING1 sorts before STRING2 lexicographically
|
True if STRING1 sorts before STRING2 lexicographically.
|
||||||
STRING1 > STRING2
|
STRING1 > STRING2
|
||||||
True if STRING1 sorts after STRING2 lexicographically
|
True if STRING1 sorts after STRING2 lexicographically.
|
||||||
|
|
||||||
Other operators:
|
Other operators:
|
||||||
|
|
||||||
|
-o OPTION True if the shell option OPTION is enabled.
|
||||||
! EXPR True if expr is false.
|
! EXPR True if expr is false.
|
||||||
EXPR1 -a EXPR2 True if both expr1 AND expr2 are true.
|
EXPR1 -a EXPR2 True if both expr1 AND expr2 are true.
|
||||||
EXPR1 -o EXPR2 True if either expr1 OR expr2 is true.
|
EXPR1 -o EXPR2 True if either expr1 OR expr2 is true.
|
||||||
|
@ -99,12 +101,16 @@ $END
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
|
# ifdef _MINIX
|
||||||
|
# include <sys/types.h>
|
||||||
|
# endif
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "../bashansi.h"
|
#include "../bashansi.h"
|
||||||
|
|
||||||
#include "../shell.h"
|
#include "../shell.h"
|
||||||
|
#include "../test.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
extern char *this_command_name;
|
extern char *this_command_name;
|
||||||
|
|
|
@ -31,6 +31,9 @@ $END
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
|
# ifdef _MINIX
|
||||||
|
# include <sys/types.h>
|
||||||
|
# endif
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -53,7 +56,7 @@ $END
|
||||||
# include <sys/times.h>
|
# include <sys/times.h>
|
||||||
#endif /* HAVE_SYS_TIMES_H */
|
#endif /* HAVE_SYS_TIMES_H */
|
||||||
|
|
||||||
#if defined (HAVE_SYS_RESOURCE_H)
|
#if defined (HAVE_SYS_RESOURCE_H) && !defined (RLIMTYPE)
|
||||||
# include <sys/resource.h>
|
# include <sys/resource.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,9 @@ $END
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
|
# ifdef _MINIX
|
||||||
|
# include <sys/types.h>
|
||||||
|
# endif
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -27,20 +27,18 @@ $SHORT_DOC type [-apt] name [name ...]
|
||||||
For each NAME, indicate how it would be interpreted if used as a
|
For each NAME, indicate how it would be interpreted if used as a
|
||||||
command name.
|
command name.
|
||||||
|
|
||||||
If the -t option is used, returns a single word which is one of
|
If the -t option is used, `type' outputs a single word which is one of
|
||||||
`alias', `keyword', `function', `builtin', `file' or `', if NAME is an
|
`alias', `keyword', `function', `builtin', `file' or `', if NAME is an
|
||||||
alias, shell reserved word, shell function, shell builtin, disk file,
|
alias, shell reserved word, shell function, shell builtin, disk file,
|
||||||
or unfound, respectively.
|
or unfound, respectively.
|
||||||
|
|
||||||
If the -p flag is used, either returns the name of the disk file
|
If the -p flag is used, `type' either returns the name of the disk
|
||||||
that would be executed, or nothing if -t would not return `file'.
|
file that would be executed, or nothing if `type -t NAME' would not
|
||||||
|
return `file'.
|
||||||
|
|
||||||
If the -a flag is used, displays all of the places that contain an
|
If the -a flag is used, `type' displays all of the places that contain
|
||||||
executable named `file'. This includes aliases and functions, if and
|
an executable named `file'. This includes aliases and functions, if
|
||||||
only if the -p flag is not also used.
|
and only if the -p flag is not also used.
|
||||||
|
|
||||||
Type accepts -all, -path, and -type in place of -a, -p, and -t,
|
|
||||||
respectively.
|
|
||||||
$END
|
$END
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
@ -56,7 +54,7 @@ $END
|
||||||
#include "../bashansi.h"
|
#include "../bashansi.h"
|
||||||
|
|
||||||
#include "../shell.h"
|
#include "../shell.h"
|
||||||
#include "../execute_cmd.h"
|
#include "../findcmd.h"
|
||||||
#include "../hashcmd.h"
|
#include "../hashcmd.h"
|
||||||
|
|
||||||
#if defined (ALIAS)
|
#if defined (ALIAS)
|
||||||
|
|
|
@ -23,7 +23,7 @@ $PRODUCES ulimit.c
|
||||||
|
|
||||||
$BUILTIN ulimit
|
$BUILTIN ulimit
|
||||||
$FUNCTION ulimit_builtin
|
$FUNCTION ulimit_builtin
|
||||||
$DEPENDS_ON !MINIX
|
$DEPENDS_ON !_MINIX
|
||||||
$SHORT_DOC ulimit [-SHacdflmnpstuv] [limit]
|
$SHORT_DOC ulimit [-SHacdflmnpstuv] [limit]
|
||||||
Ulimit provides control over the resources available to processes
|
Ulimit provides control over the resources available to processes
|
||||||
started by the shell, on systems that allow such control. If an
|
started by the shell, on systems that allow such control. If an
|
||||||
|
@ -52,10 +52,14 @@ increments of 512 bytes, and -u, which is an unscaled number of
|
||||||
processes.
|
processes.
|
||||||
$END
|
$END
|
||||||
|
|
||||||
|
#if !defined (_MINIX)
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include "../bashtypes.h"
|
#include "../bashtypes.h"
|
||||||
#include <sys/param.h>
|
#ifndef _MINIX
|
||||||
|
# include <sys/param.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
|
@ -101,7 +105,7 @@ extern int errno;
|
||||||
|
|
||||||
#if !defined (RLIMTYPE)
|
#if !defined (RLIMTYPE)
|
||||||
# define RLIMTYPE long
|
# define RLIMTYPE long
|
||||||
# define string_to_rlimtype string_to_long
|
# define string_to_rlimtype(s) strtol(s, (char **)NULL, 10)
|
||||||
# define print_rlimtype(num, nl) printf ("%ld%s", num, nl ? "\n" : "")
|
# define print_rlimtype(num, nl) printf ("%ld%s", num, nl ? "\n" : "")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -597,7 +601,8 @@ printone (limind, curlim, pdesc)
|
||||||
if (curlim == RLIM_INFINITY)
|
if (curlim == RLIM_INFINITY)
|
||||||
puts ("unlimited");
|
puts ("unlimited");
|
||||||
else if (curlim == RLIM_INVALID)
|
else if (curlim == RLIM_INVALID)
|
||||||
printf ("cannot get limit: %s\n", strerror (errno));
|
builtin_error ("cannot get limit: %s\n", strerror (errno));
|
||||||
else
|
else
|
||||||
print_rlimtype ((curlim / limits[limind].block_factor), 1);
|
print_rlimtype ((curlim / limits[limind].block_factor), 1);
|
||||||
}
|
}
|
||||||
|
#endif /* !_MINIX */
|
||||||
|
|
|
@ -23,19 +23,23 @@ $PRODUCES umask.c
|
||||||
|
|
||||||
$BUILTIN umask
|
$BUILTIN umask
|
||||||
$FUNCTION umask_builtin
|
$FUNCTION umask_builtin
|
||||||
$SHORT_DOC umask [-S] [mode]
|
$SHORT_DOC umask [-p] [-S] [mode]
|
||||||
The user file-creation mask is set to MODE. If MODE is omitted, or if
|
The user file-creation mask is set to MODE. If MODE is omitted, or if
|
||||||
`-S' is supplied, the current value of the mask is printed. The `-S'
|
`-S' is supplied, the current value of the mask is printed. The `-S'
|
||||||
option makes the output symbolic; otherwise an octal number is output.
|
option makes the output symbolic; otherwise an octal number is output.
|
||||||
If MODE begins with a digit, it is interpreted as an octal number,
|
If `-p' is supplied, and MODE is omitted, the output is in a form
|
||||||
otherwise it is a symbolic mode string like that accepted by chmod(1).
|
that may be used as input. If MODE begins with a digit, it is
|
||||||
|
interpreted as an octal number, otherwise it is a symbolic mode string
|
||||||
|
like that accepted by chmod(1).
|
||||||
$END
|
$END
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include "../bashtypes.h"
|
#include "../bashtypes.h"
|
||||||
#include "../filecntl.h"
|
#include "../filecntl.h"
|
||||||
#include <sys/file.h>
|
#ifndef _MINIX
|
||||||
|
# include <sys/file.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -63,18 +67,21 @@ int
|
||||||
umask_builtin (list)
|
umask_builtin (list)
|
||||||
WORD_LIST *list;
|
WORD_LIST *list;
|
||||||
{
|
{
|
||||||
int print_symbolically, opt, umask_value;
|
int print_symbolically, opt, umask_value, pflag;
|
||||||
mode_t umask_arg;
|
mode_t umask_arg;
|
||||||
|
|
||||||
print_symbolically = 0;
|
print_symbolically = pflag = 0;
|
||||||
reset_internal_getopt ();
|
reset_internal_getopt ();
|
||||||
while ((opt = internal_getopt (list, "S")) != -1)
|
while ((opt = internal_getopt (list, "Sp")) != -1)
|
||||||
{
|
{
|
||||||
switch (opt)
|
switch (opt)
|
||||||
{
|
{
|
||||||
case 'S':
|
case 'S':
|
||||||
print_symbolically++;
|
print_symbolically++;
|
||||||
break;
|
break;
|
||||||
|
case 'p':
|
||||||
|
pflag++;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
builtin_usage ();
|
builtin_usage ();
|
||||||
return (EX_USAGE);
|
return (EX_USAGE);
|
||||||
|
@ -116,6 +123,8 @@ umask_builtin (list)
|
||||||
umask_arg = umask (022);
|
umask_arg = umask (022);
|
||||||
umask (umask_arg);
|
umask (umask_arg);
|
||||||
|
|
||||||
|
if (pflag)
|
||||||
|
printf ("umask%s ", (print_symbolically ? " -S" : ""));
|
||||||
if (print_symbolically)
|
if (print_symbolically)
|
||||||
print_symbolic_umask (umask_arg);
|
print_symbolic_umask (umask_arg);
|
||||||
else
|
else
|
||||||
|
|
|
@ -136,6 +136,12 @@ wait_builtin (list)
|
||||||
UNBLOCK_CHILD (oset);
|
UNBLOCK_CHILD (oset);
|
||||||
status = wait_for_job (job);
|
status = wait_for_job (job);
|
||||||
}
|
}
|
||||||
|
else if (job_control == 0 && *w == '%')
|
||||||
|
{
|
||||||
|
/* can't use jobspecs as arguments if job control is not active. */
|
||||||
|
builtin_error ("job control not enabled");
|
||||||
|
status = EXECUTION_FAILURE;
|
||||||
|
}
|
||||||
#endif /* JOB_CONTROL */
|
#endif /* JOB_CONTROL */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
39
command.h
39
command.h
|
@ -54,7 +54,8 @@ enum r_instruction {
|
||||||
|
|
||||||
/* Command Types: */
|
/* Command Types: */
|
||||||
enum command_type { cm_for, cm_case, cm_while, cm_if, cm_simple, cm_select,
|
enum command_type { cm_for, cm_case, cm_while, cm_if, cm_simple, cm_select,
|
||||||
cm_connection, cm_function_def, cm_until, cm_group };
|
cm_connection, cm_function_def, cm_until, cm_group,
|
||||||
|
cm_arith, cm_cond };
|
||||||
|
|
||||||
/* Possible values for the `flags' field of a WORD_DESC. */
|
/* Possible values for the `flags' field of a WORD_DESC. */
|
||||||
#define W_HASDOLLAR 0x01 /* Dollar sign present. */
|
#define W_HASDOLLAR 0x01 /* Dollar sign present. */
|
||||||
|
@ -142,6 +143,12 @@ typedef struct command {
|
||||||
struct group_com *Group;
|
struct group_com *Group;
|
||||||
#if defined (SELECT_COMMAND)
|
#if defined (SELECT_COMMAND)
|
||||||
struct select_com *Select;
|
struct select_com *Select;
|
||||||
|
#endif
|
||||||
|
#if defined (DPAREN_ARITHMETIC)
|
||||||
|
struct arith_com *Arith;
|
||||||
|
#endif
|
||||||
|
#if defined (COND_COMMAND)
|
||||||
|
struct cond_com *Cond;
|
||||||
#endif
|
#endif
|
||||||
} value;
|
} value;
|
||||||
} COMMAND;
|
} COMMAND;
|
||||||
|
@ -207,6 +214,34 @@ typedef struct while_com {
|
||||||
COMMAND *action; /* Thing to do while test is non-zero. */
|
COMMAND *action; /* Thing to do while test is non-zero. */
|
||||||
} WHILE_COM;
|
} WHILE_COM;
|
||||||
|
|
||||||
|
#if defined (DPAREN_ARITHMETIC)
|
||||||
|
/* The arithmetic evaluation command, ((...)). Just a set of flags and
|
||||||
|
a WORD_LIST, of which the first element is the only one used, for the
|
||||||
|
time being. */
|
||||||
|
typedef struct arith_com {
|
||||||
|
int flags;
|
||||||
|
WORD_LIST *exp;
|
||||||
|
int line;
|
||||||
|
} ARITH_COM;
|
||||||
|
#endif /* DPAREN_ARITHMETIC */
|
||||||
|
|
||||||
|
/* The conditional command, [[...]]. This is a binary tree -- we slippped
|
||||||
|
a recursive-descent parser into the YACC grammar to parse it. */
|
||||||
|
#define COND_AND 1
|
||||||
|
#define COND_OR 2
|
||||||
|
#define COND_UNARY 3
|
||||||
|
#define COND_BINARY 4
|
||||||
|
#define COND_TERM 5
|
||||||
|
#define COND_EXPR 6
|
||||||
|
|
||||||
|
typedef struct cond_com {
|
||||||
|
int flags;
|
||||||
|
int line;
|
||||||
|
int type;
|
||||||
|
WORD_DESC *op;
|
||||||
|
struct cond_com *left, *right;
|
||||||
|
} COND_COM;
|
||||||
|
|
||||||
/* The "simple" command. Just a collection of words and redirects. */
|
/* The "simple" command. Just a collection of words and redirects. */
|
||||||
typedef struct simple_com {
|
typedef struct simple_com {
|
||||||
int flags; /* See description of CMD flags. */
|
int flags; /* See description of CMD flags. */
|
||||||
|
@ -218,7 +253,7 @@ typedef struct simple_com {
|
||||||
|
|
||||||
/* The "function definition" command. */
|
/* The "function definition" command. */
|
||||||
typedef struct function_def {
|
typedef struct function_def {
|
||||||
int ignore; /* See description of CMD flags. */
|
int flags; /* See description of CMD flags. */
|
||||||
WORD_DESC *name; /* The name of the function. */
|
WORD_DESC *name; /* The name of the function. */
|
||||||
COMMAND *command; /* The parsed execution tree. */
|
COMMAND *command; /* The parsed execution tree. */
|
||||||
int line; /* Line number the function def starts on. */
|
int line; /* Line number the function def starts on. */
|
||||||
|
|
66
config.h.in
66
config.h.in
|
@ -110,6 +110,14 @@
|
||||||
evaluation command. */
|
evaluation command. */
|
||||||
#undef DPAREN_ARITHMETIC
|
#undef DPAREN_ARITHMETIC
|
||||||
|
|
||||||
|
/* Define EXTENDED_GLOB if you want the ksh-style [*+@?!](patlist) extended
|
||||||
|
pattern matching. */
|
||||||
|
#undef EXTENDED_GLOB
|
||||||
|
|
||||||
|
/* Define COND_COMMAND if you want the ksh-style [[...]] conditional
|
||||||
|
command. */
|
||||||
|
#undef COND_COMMAND
|
||||||
|
|
||||||
/* Define AFS if you are using Transarc's AFS. */
|
/* Define AFS if you are using Transarc's AFS. */
|
||||||
#undef AFS
|
#undef AFS
|
||||||
|
|
||||||
|
@ -170,6 +178,15 @@
|
||||||
/* Define if on MINIX. */
|
/* Define if on MINIX. */
|
||||||
#undef _MINIX
|
#undef _MINIX
|
||||||
|
|
||||||
|
/* 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
|
||||||
|
|
||||||
/* Define to `long' if <sys/types.h> doesn't define. */
|
/* Define to `long' if <sys/types.h> doesn't define. */
|
||||||
#undef off_t
|
#undef off_t
|
||||||
|
|
||||||
|
@ -182,6 +199,27 @@
|
||||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
#undef pid_t
|
#undef pid_t
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
#undef int32_t
|
||||||
|
|
||||||
|
/* Define to `unsigned int' if <sys/types.h> doesn't define. */
|
||||||
|
#undef u_int32_t
|
||||||
|
|
||||||
|
/* 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 uid_t
|
||||||
|
|
||||||
|
/* Define to `long' if <sys/types.h> doesn't define. */
|
||||||
|
#undef clock_t
|
||||||
|
|
||||||
|
/* Define to `long' if <sys/types.h> doesn't define. */
|
||||||
|
#undef time_t
|
||||||
|
|
||||||
/* Define if the system does not provide POSIX.1 features except
|
/* Define if the system does not provide POSIX.1 features except
|
||||||
with this defined. */
|
with this defined. */
|
||||||
#undef _POSIX_1_SOURCE
|
#undef _POSIX_1_SOURCE
|
||||||
|
@ -197,9 +235,6 @@
|
||||||
before release 3. */
|
before release 3. */
|
||||||
#undef SETVBUF_REVERSED
|
#undef SETVBUF_REVERSED
|
||||||
|
|
||||||
/* Define to `unsigned' if <sys/types.h> doesn't define. */
|
|
||||||
#undef size_t
|
|
||||||
|
|
||||||
/* If using the C implementation of alloca, define if you know the
|
/* If using the C implementation of alloca, define if you know the
|
||||||
direction of stack growth for your system; otherwise it will be
|
direction of stack growth for your system; otherwise it will be
|
||||||
automatically deduced at run-time.
|
automatically deduced at run-time.
|
||||||
|
@ -212,21 +247,12 @@
|
||||||
/* Define if you have the ANSI C header files. */
|
/* Define if you have the ANSI C header files. */
|
||||||
#undef STDC_HEADERS
|
#undef STDC_HEADERS
|
||||||
|
|
||||||
/* Define if `sys_siglist' is declared by <signal.h>. */
|
/* Define if `sys_siglist' is declared by <signal.h> or <unistd.h>. */
|
||||||
#undef SYS_SIGLIST_DECLARED
|
#undef SYS_SIGLIST_DECLARED
|
||||||
|
|
||||||
/* Define if `_sys_siglist' is declared by <signal.h> or <unistd.h>. */
|
/* Define if `_sys_siglist' is declared by <signal.h> or <unistd.h>. */
|
||||||
#undef UNDER_SYS_SIGLIST_DECLARED
|
#undef UNDER_SYS_SIGLIST_DECLARED
|
||||||
|
|
||||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
|
||||||
#undef uid_t
|
|
||||||
|
|
||||||
/* Define to `long' if <sys/types.h> doesn't define. */
|
|
||||||
#undef clock_t
|
|
||||||
|
|
||||||
/* Define to `long' if <sys/types.h> doesn't define. */
|
|
||||||
#undef time_t
|
|
||||||
|
|
||||||
#undef DUP2_BROKEN
|
#undef DUP2_BROKEN
|
||||||
|
|
||||||
#undef HAVE_GETRLIMIT
|
#undef HAVE_GETRLIMIT
|
||||||
|
@ -307,6 +333,8 @@
|
||||||
|
|
||||||
#undef STRUCT_WINSIZE_IN_SYS_IOCTL
|
#undef STRUCT_WINSIZE_IN_SYS_IOCTL
|
||||||
|
|
||||||
|
#undef STRUCT_WINSIZE_IN_TERMIOS
|
||||||
|
|
||||||
#undef SPEED_T_IN_SYS_TYPES
|
#undef SPEED_T_IN_SYS_TYPES
|
||||||
|
|
||||||
#undef CAN_REDEFINE_GETENV
|
#undef CAN_REDEFINE_GETENV
|
||||||
|
@ -395,6 +423,15 @@
|
||||||
/* Define if you have the strerror function. */
|
/* Define if you have the strerror function. */
|
||||||
#undef HAVE_STRERROR
|
#undef HAVE_STRERROR
|
||||||
|
|
||||||
|
/* Define if you have the strtod function. */
|
||||||
|
#undef HAVE_STRTOD
|
||||||
|
|
||||||
|
/* Define if you have the strtol function. */
|
||||||
|
#undef HAVE_STRTOL
|
||||||
|
|
||||||
|
/* Define if you have the strtoul function. */
|
||||||
|
#undef HAVE_STRTOUL
|
||||||
|
|
||||||
/* Define if you have the tcgetattr function. */
|
/* Define if you have the tcgetattr function. */
|
||||||
#undef HAVE_TCGETATTR
|
#undef HAVE_TCGETATTR
|
||||||
|
|
||||||
|
@ -496,6 +533,9 @@
|
||||||
/* Define if you have the <libintl.h> header file. */
|
/* Define if you have the <libintl.h> header file. */
|
||||||
#undef HAVE_LIBINTL_H
|
#undef HAVE_LIBINTL_H
|
||||||
|
|
||||||
|
/* Define if you have the <stddef.h> header file. */
|
||||||
|
#undef HAVE_STDDEF_H
|
||||||
|
|
||||||
#undef HAVE_LIBDL
|
#undef HAVE_LIBDL
|
||||||
|
|
||||||
#undef HAVE_LIBSUN
|
#undef HAVE_LIBSUN
|
||||||
|
|
132
configure.in
132
configure.in
|
@ -1,12 +1,12 @@
|
||||||
dnl
|
dnl
|
||||||
dnl Configure script for bash-2.01
|
dnl Configure script for bash-2.02
|
||||||
dnl
|
dnl
|
||||||
dnl report bugs to chet@po.cwru.edu
|
dnl report bugs to chet@po.cwru.edu
|
||||||
dnl
|
dnl
|
||||||
dnl Process this file with autoconf to produce a configure script.
|
dnl Process this file with autoconf to produce a configure script.
|
||||||
dnl checks for version info
|
dnl checks for version info
|
||||||
|
|
||||||
AC_REVISION([for Bash 2.01, version 1.28, from autoconf version] AC_ACVERSION)dnl
|
AC_REVISION([for Bash 2.02, version 2.19, from autoconf version] AC_ACVERSION)dnl
|
||||||
|
|
||||||
AC_INIT(shell.h)
|
AC_INIT(shell.h)
|
||||||
AC_CONFIG_HEADER(config.h)
|
AC_CONFIG_HEADER(config.h)
|
||||||
|
@ -34,19 +34,20 @@ dnl and some need a special compiler or loader
|
||||||
dnl look in the NOTES file for more
|
dnl look in the NOTES file for more
|
||||||
case "${host_cpu}-${host_os}" in
|
case "${host_cpu}-${host_os}" in
|
||||||
alpha-*) opt_gnu_malloc=no ;; # alpha running osf/1 or linux
|
alpha-*) opt_gnu_malloc=no ;; # alpha running osf/1 or linux
|
||||||
*cray*-*) opt_gnu_malloc=no ;; # Crays
|
*[Cc]ray*-*) opt_gnu_malloc=no ;; # Crays
|
||||||
*-osf1*) opt_gnu_malloc=no ;; # other osf/1 machines
|
*-osf1*) opt_gnu_malloc=no ;; # other osf/1 machines
|
||||||
sparc-svr4*) opt_gnu_malloc=no ;; # sparc SVR4, SVR4.2
|
sparc-svr4*) opt_gnu_malloc=no ;; # sparc SVR4, SVR4.2
|
||||||
sparc-netbsd*) opt_gnu_malloc=no ;; # needs 8-byte alignment
|
sparc-netbsd*) opt_gnu_malloc=no ;; # needs 8-byte alignment
|
||||||
sgi-irix6*) opt_gnu_malloc=no ;; # needs 8-byte alignment
|
sgi-irix6*) opt_gnu_malloc=no ;; # needs 8-byte alignment
|
||||||
sparc-linux*) opt_gnu_malloc=no ;; # sparc running linux; requires ELF
|
sparc-linux*) opt_gnu_malloc=no ;; # sparc running linux; requires ELF
|
||||||
*-freebsd*) opt_gnu_malloc=no ;; # they claim it's better
|
#*-freebsd*) opt_gnu_malloc=no ;; # they claim it's better
|
||||||
*-aix*) opt_gnu_malloc=no ;; # AIX machines
|
*-aix*) opt_gnu_malloc=no ;; # AIX machines
|
||||||
*-nextstep*) opt_gnu_malloc=no ;; # NeXT machines running NeXTstep
|
*-nextstep*) opt_gnu_malloc=no ;; # NeXT machines running NeXTstep
|
||||||
*-dgux*) opt_gnu_malloc=no ;; # DG/UX machines
|
*-dgux*) opt_gnu_malloc=no ;; # DG/UX machines
|
||||||
*-qnx*) opt_gnu_malloc=no ;; # QNX 4.2
|
*-qnx*) opt_gnu_malloc=no ;; # QNX 4.2
|
||||||
*-machten4) opt_gnu_malloc=no ;; # MachTen 4.x
|
*-machten4) opt_gnu_malloc=no ;; # MachTen 4.x
|
||||||
*-bsdi2.1|*-bsdi3.0) opt_gnu_malloc=no ; : ${CC:=shlicc2} ;; # for loadable builtins
|
*-bsdi2.1|*-bsdi3.?) opt_gnu_malloc=no ; : ${CC:=shlicc2} ;; # for loadable builtins
|
||||||
|
*-cygwin32*) opt_gnu_malloc=no ;; # Cygnus's CYGWIN32 environment
|
||||||
esac
|
esac
|
||||||
|
|
||||||
dnl arguments to configure
|
dnl arguments to configure
|
||||||
|
@ -104,10 +105,16 @@ opt_select=yes
|
||||||
opt_help=yes
|
opt_help=yes
|
||||||
opt_array_variables=yes
|
opt_array_variables=yes
|
||||||
opt_dparen_arith=yes
|
opt_dparen_arith=yes
|
||||||
|
opt_extended_glob=yes
|
||||||
opt_brace_expansion=yes
|
opt_brace_expansion=yes
|
||||||
opt_disabled_builtins=no
|
opt_disabled_builtins=no
|
||||||
opt_command_timing=yes
|
opt_command_timing=yes
|
||||||
opt_usg_echo=no
|
opt_usg_echo=no
|
||||||
|
opt_cond_command=yes
|
||||||
|
|
||||||
|
dnl options that affect how bash is compiled and linked
|
||||||
|
opt_static_link=no
|
||||||
|
opt_profiling=no
|
||||||
|
|
||||||
dnl argument parsing for optional features
|
dnl argument parsing for optional features
|
||||||
AC_ARG_ENABLE(minimal-config, --enable-minimal-config a minimal sh-like configuration, opt_minimal_config=$enableval)
|
AC_ARG_ENABLE(minimal-config, --enable-minimal-config a minimal sh-like configuration, opt_minimal_config=$enableval)
|
||||||
|
@ -120,6 +127,7 @@ if test $opt_minimal_config = yes; then
|
||||||
opt_restricted=no opt_process_subst=no opt_prompt_decoding=no
|
opt_restricted=no opt_process_subst=no opt_prompt_decoding=no
|
||||||
opt_select=no opt_help=no opt_array_variables=no opt_dparen_arith=no
|
opt_select=no opt_help=no opt_array_variables=no opt_dparen_arith=no
|
||||||
opt_brace_expansion=no opt_disabled_builtins=no opt_command_timing=no
|
opt_brace_expansion=no opt_disabled_builtins=no opt_command_timing=no
|
||||||
|
opt_extended_glob=no opt_cond_command=no
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_ARG_ENABLE(alias, --enable-alias enable shell aliases, opt_alias=$enableval)
|
AC_ARG_ENABLE(alias, --enable-alias enable shell aliases, opt_alias=$enableval)
|
||||||
|
@ -127,9 +135,11 @@ AC_ARG_ENABLE(array-variables, --enable-array-variables include shell array vari
|
||||||
AC_ARG_ENABLE(bang-history, --enable-bang-history turn on csh-style history substitution, opt_bang_history=$enableval)
|
AC_ARG_ENABLE(bang-history, --enable-bang-history turn on csh-style history substitution, opt_bang_history=$enableval)
|
||||||
AC_ARG_ENABLE(brace-expansion, --enable-brace-expansion include brace expansion, opt_brace_expansion=$enableval)
|
AC_ARG_ENABLE(brace-expansion, --enable-brace-expansion include brace expansion, opt_brace_expansion=$enableval)
|
||||||
AC_ARG_ENABLE(command-timing, --enable-command-timing enable the time reserved word and command timing, opt_command_timing=$enableval)
|
AC_ARG_ENABLE(command-timing, --enable-command-timing enable the time reserved word and command timing, opt_command_timing=$enableval)
|
||||||
|
AC_ARG_ENABLE(cond-command, --enable-cond-command enable the conditional command, opt_cond_command=$enableval)
|
||||||
AC_ARG_ENABLE(directory-stack, --enable-directory-stack enable builtins pushd/popd/dirs, opt_dirstack=$enableval)
|
AC_ARG_ENABLE(directory-stack, --enable-directory-stack enable builtins pushd/popd/dirs, opt_dirstack=$enableval)
|
||||||
AC_ARG_ENABLE(disabled-builtins, --enable-disabled-builtins allow disabled builtins to still be invoked, opt_disabled_builtins=$enableval)
|
AC_ARG_ENABLE(disabled-builtins, --enable-disabled-builtins allow disabled builtins to still be invoked, opt_disabled_builtins=$enableval)
|
||||||
AC_ARG_ENABLE(dparen-arithmetic, [--enable-dparen-arithmetic include ((...)) command], opt_dparen_arith=$enableval)
|
AC_ARG_ENABLE(dparen-arithmetic, [--enable-dparen-arithmetic include ((...)) command], opt_dparen_arith=$enableval)
|
||||||
|
AC_ARG_ENABLE(extended-glob, --enable-extended-glob include ksh-style extended pattern matching, opt_extended_glob=$enableval)
|
||||||
AC_ARG_ENABLE(help-builtin, --enable-help-builtin include the help builtin, opt_help=$enableval)
|
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(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(job-control, --enable-job-control enable job control features, opt_job_control=$enableval)
|
||||||
|
@ -140,6 +150,10 @@ AC_ARG_ENABLE(restricted, --enable-restricted enable a restricted shell, opt_res
|
||||||
AC_ARG_ENABLE(select, --enable-select include select command, opt_select=$enableval)
|
AC_ARG_ENABLE(select, --enable-select include select command, opt_select=$enableval)
|
||||||
AC_ARG_ENABLE(usg-echo-default, --enable-usg-echo-default make the echo builtin expand escape sequences by default, opt_usg_echo=$enableval)
|
AC_ARG_ENABLE(usg-echo-default, --enable-usg-echo-default make the echo builtin expand escape sequences by default, opt_usg_echo=$enableval)
|
||||||
|
|
||||||
|
dnl options that alter how bash is compiled and linked
|
||||||
|
AC_ARG_ENABLE(profiling, --enable-profiling allow profiling with gprof, opt_profiling=$enableval)
|
||||||
|
AC_ARG_ENABLE(static-link, --enable-static-link [link bash statically, for use as a root shell], opt_static_link=$enableval)
|
||||||
|
|
||||||
dnl opt_job_control is handled later, after BASH_JOB_CONTROL_MISSING runs
|
dnl opt_job_control is handled later, after BASH_JOB_CONTROL_MISSING runs
|
||||||
|
|
||||||
if test $opt_alias = yes; then
|
if test $opt_alias = yes; then
|
||||||
|
@ -202,6 +216,12 @@ fi
|
||||||
if test $opt_usg_echo = yes ; then
|
if test $opt_usg_echo = yes ; then
|
||||||
AC_DEFINE(DEFAULT_ECHO_TO_USG)
|
AC_DEFINE(DEFAULT_ECHO_TO_USG)
|
||||||
fi
|
fi
|
||||||
|
if test $opt_extended_glob = yes ; then
|
||||||
|
AC_DEFINE(EXTENDED_GLOB)
|
||||||
|
fi
|
||||||
|
if test $opt_cond_command = yes ; then
|
||||||
|
AC_DEFINE(COND_COMMAND)
|
||||||
|
fi
|
||||||
|
|
||||||
if test "$opt_minimal_config" = yes; then
|
if test "$opt_minimal_config" = yes; then
|
||||||
TESTSCRIPT=run-minimal
|
TESTSCRIPT=run-minimal
|
||||||
|
@ -226,19 +246,74 @@ esyscmd(cat _distribution)dnl
|
||||||
[BASHPATCH=]dnl
|
[BASHPATCH=]dnl
|
||||||
esyscmd(cat _patchlevel)dnl
|
esyscmd(cat _patchlevel)dnl
|
||||||
|
|
||||||
echo "Beginning configuration for bash-$BASHVERS"
|
echo "Beginning configuration for bash-$BASHVERS for ${host_cpu}-${host_vendor}-${host_os}"
|
||||||
|
|
||||||
dnl compilation checks
|
dnl compilation checks
|
||||||
|
dnl AC_PROG_CC sets $cross_compiling to `yes' if cross-compiling for a
|
||||||
|
dnl different environment
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
|
BASH_LARGE_FILE_SUPPORT
|
||||||
AC_ISC_POSIX
|
AC_ISC_POSIX
|
||||||
AC_MINIX
|
AC_MINIX
|
||||||
|
|
||||||
|
dnl BEGIN changes for CYGNUS cross-building for cygwin32
|
||||||
|
|
||||||
|
dnl load up the cross-building cache file -- add more cases and cache
|
||||||
|
dnl files as necessary
|
||||||
|
if test "x$cross_compiling" = "xyes"; then
|
||||||
|
case "${host}" in
|
||||||
|
*-cygwin32*)
|
||||||
|
cross_cache=${srcdir}/cross-build/cygwin32.cache
|
||||||
|
if test -r "${cross_cache}"; then
|
||||||
|
echo "loading cross-build cache file ${cross_cache}"
|
||||||
|
. ${cross_cache}
|
||||||
|
fi
|
||||||
|
unset cross_cache
|
||||||
|
;;
|
||||||
|
*) echo "configure: cross-compiling for a non-cygwin32 target is not supported" >&2
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test -z "$CC_FOR_BUILD"; then
|
||||||
|
if test "x$cross_compiling" = "xno"; then
|
||||||
|
CC_FOR_BUILD='$(CC)'
|
||||||
|
else
|
||||||
|
CC_FOR_BUILD=gcc
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
AC_SUBST(CC_FOR_BUILD)
|
||||||
|
|
||||||
|
dnl Set SIGNAMES_H based on whether or not we're cross-compiling
|
||||||
|
if test "x$cross_compiling" = "xno"; then
|
||||||
|
SIGNAMES_H=lsignames.h
|
||||||
|
else
|
||||||
|
SIGNAMES_H='$(srcdir)/cross-build/win32sig.h'
|
||||||
|
fi
|
||||||
|
AC_SUBST(SIGNAMES_H)
|
||||||
|
|
||||||
|
dnl END changes for CYGNUS cross-building for cygwin32
|
||||||
|
|
||||||
dnl We want these before the checks, so the checks can modify their values.
|
dnl We want these before the checks, so the checks can modify their values.
|
||||||
test -z "$CFLAGS" && CFLAGS=-g auto_cflags=1
|
test -z "$CFLAGS" && CFLAGS=-g auto_cflags=1
|
||||||
|
|
||||||
dnl If we're using gcc and the user hasn't specified CFLAGS, add -O2 to CFLAGS.
|
dnl If we're using gcc and the user hasn't specified CFLAGS, add -O2 to CFLAGS.
|
||||||
test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O2"
|
test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O2"
|
||||||
|
|
||||||
|
dnl handle options that alter how bash is compiled and linked
|
||||||
|
dnl these must come after the test for cc/gcc
|
||||||
|
if test "$opt_profiling" = "yes"; then
|
||||||
|
PROFILE_FLAGS=-pg
|
||||||
|
opt_static_link=yes
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "$opt_static_link" = yes; then
|
||||||
|
# if we're using gcc, add `-static' to LDFLAGS
|
||||||
|
if test -n "$GCC" || test "$ac_cv_prog_gcc" = "yes"; then
|
||||||
|
LDFLAGS="$LDFLAGS -static"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
AC_SUBST(CFLAGS)
|
AC_SUBST(CFLAGS)
|
||||||
AC_SUBST(CPPFLAGS)
|
AC_SUBST(CPPFLAGS)
|
||||||
AC_SUBST(LDFLAGS)
|
AC_SUBST(LDFLAGS)
|
||||||
|
@ -287,8 +362,9 @@ AC_CHECK_FUNCS(dup2 select getdtablesize getgroups gethostname \
|
||||||
|
|
||||||
dnl checks for c library functions
|
dnl checks for c library functions
|
||||||
AC_CHECK_FUNCS(bcopy bzero confstr getcwd strcasecmp setenv putenv \
|
AC_CHECK_FUNCS(bcopy bzero confstr getcwd strcasecmp setenv putenv \
|
||||||
setlinebuf setlocale strchr strerror tcgetattr uname \
|
setlinebuf setlocale strchr strerror strtod strtol \
|
||||||
sysconf ulimit times tzset siginterrupt memmove)
|
strtoul tcgetattr uname sysconf ulimit times tzset \
|
||||||
|
siginterrupt memmove)
|
||||||
|
|
||||||
dnl checks for locale functions
|
dnl checks for locale functions
|
||||||
AC_CHECK_HEADERS(libintl.h)
|
AC_CHECK_HEADERS(libintl.h)
|
||||||
|
@ -304,8 +380,10 @@ if test "$ac_cv_func_bindtextdomain" = "no"; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl checks for the dynamic loading library functions in libc and libdl
|
dnl checks for the dynamic loading library functions in libc and libdl
|
||||||
|
if test "$opt_static_link" != yes; then
|
||||||
AC_CHECK_LIB(dl, dlopen)
|
AC_CHECK_LIB(dl, dlopen)
|
||||||
AC_CHECK_FUNCS(dlopen dlclose dlsym)
|
AC_CHECK_FUNCS(dlopen dlclose dlsym)
|
||||||
|
fi
|
||||||
|
|
||||||
dnl this defines SYS_SIGLIST_DECLARED
|
dnl this defines SYS_SIGLIST_DECLARED
|
||||||
AC_DECL_SYS_SIGLIST
|
AC_DECL_SYS_SIGLIST
|
||||||
|
@ -315,7 +393,8 @@ AC_HEADER_DIRENT
|
||||||
AC_HEADER_TIME
|
AC_HEADER_TIME
|
||||||
|
|
||||||
AC_CHECK_HEADERS(unistd.h stdlib.h stdarg.h varargs.h limits.h string.h \
|
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)
|
memory.h locale.h termcap.h termio.h termios.h dlfcn.h \
|
||||||
|
stddef.h)
|
||||||
AC_CHECK_HEADERS(sys/ptem.h sys/pte.h sys/stream.h sys/select.h sys/file.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/resource.h sys/param.h sys/socket.h \
|
||||||
sys/time.h sys/times.h sys/wait.h)
|
sys/time.h sys/times.h sys/wait.h)
|
||||||
|
@ -339,6 +418,24 @@ AC_CHECK_TYPE(time_t, long)
|
||||||
|
|
||||||
AC_TYPE_SIGNAL
|
AC_TYPE_SIGNAL
|
||||||
|
|
||||||
|
AC_CHECK_SIZEOF(int)
|
||||||
|
AC_CHECK_SIZEOF(long)
|
||||||
|
AC_CHECK_SIZEOF(char *)
|
||||||
|
|
||||||
|
AC_CHECK_TYPE(int32_t)
|
||||||
|
if test "$ac_cv_type_int32_t" = "no"; then
|
||||||
|
BASH_TYPE_INT32_T
|
||||||
|
fi
|
||||||
|
AC_CHECK_TYPE(u_int32_t)
|
||||||
|
if test "$ac_cv_type_u_int32_t" = "no"; then
|
||||||
|
BASH_TYPE_U_INT32_T
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_CHECK_TYPE(ptrdiff_t)
|
||||||
|
if test "$ac_cv_type_ptrdiff_t" = "no"; then
|
||||||
|
BASH_TYPE_PTRDIFF_T
|
||||||
|
fi
|
||||||
|
|
||||||
dnl structures
|
dnl structures
|
||||||
AC_HEADER_STAT
|
AC_HEADER_STAT
|
||||||
AC_HEADER_EGREP(struct timeval, sys/time.h, bash_cv_struct_timeval=yes, )
|
AC_HEADER_EGREP(struct timeval, sys/time.h, bash_cv_struct_timeval=yes, )
|
||||||
|
@ -370,6 +467,10 @@ BASH_DUP2_CLOEXEC_CHECK
|
||||||
BASH_PGRP_SYNC
|
BASH_PGRP_SYNC
|
||||||
BASH_SIGNAL_CHECK
|
BASH_SIGNAL_CHECK
|
||||||
|
|
||||||
|
if test "$ac_cv_sys_restartable_syscalls" = "no"; then
|
||||||
|
BASH_SYS_RESTARTABLE_SYSCALLS
|
||||||
|
fi
|
||||||
|
|
||||||
dnl checking for the presence of certain library symbols
|
dnl checking for the presence of certain library symbols
|
||||||
BASH_SYS_ERRLIST
|
BASH_SYS_ERRLIST
|
||||||
BASH_SYS_SIGLIST
|
BASH_SYS_SIGLIST
|
||||||
|
@ -471,6 +572,7 @@ linux*) LOCAL_LDFLAGS=-rdynamic ;; # allow dynamic loading
|
||||||
aix4.2*) LOCAL_LDFLAGS="-bexpall -brtl" ;;# allow dynamic loading
|
aix4.2*) LOCAL_LDFLAGS="-bexpall -brtl" ;;# allow dynamic loading
|
||||||
*qnx*) LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s -lunix -lncurses" ;;
|
*qnx*) LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s -lunix -lncurses" ;;
|
||||||
powerux) LOCAL_LIBS="-lgen" ;;
|
powerux) LOCAL_LIBS="-lgen" ;;
|
||||||
|
cygwin32*) LOCAL_LIBS="-luser32" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
case "$host_cpu" in
|
case "$host_cpu" in
|
||||||
|
@ -490,17 +592,20 @@ esac
|
||||||
# this should be packaged into a script accessible via ${srcdir}/support
|
# this should be packaged into a script accessible via ${srcdir}/support
|
||||||
case "$srcdir" in
|
case "$srcdir" in
|
||||||
.) ;;
|
.) ;;
|
||||||
*) for d in doc tests support lib ; do # dirs
|
*) for d in doc tests support lib examples; do # dirs
|
||||||
test -d $d || mkdir $d
|
test -d $d || mkdir $d
|
||||||
done
|
done
|
||||||
for ld in readline glob tilde malloc termcap; do # libdirs
|
for ld in readline glob tilde malloc sh termcap; do # libdirs
|
||||||
test -d lib/$ld || mkdir lib/$ld
|
test -d lib/$ld || mkdir lib/$ld
|
||||||
done
|
done
|
||||||
|
test -d examples/loadables || mkdir examples/loadables # loadable builtins
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
BUILD_DIR=`pwd`
|
BUILD_DIR=`pwd`
|
||||||
|
|
||||||
|
AC_SUBST(PROFILE_FLAGS)
|
||||||
|
|
||||||
AC_SUBST(incdir)
|
AC_SUBST(incdir)
|
||||||
AC_SUBST(BUILD_DIR)
|
AC_SUBST(BUILD_DIR)
|
||||||
|
|
||||||
|
@ -522,8 +627,9 @@ AC_SUBST(LOCAL_DEFS)
|
||||||
#AC_SUBST(ALLOCA_OBJECT)
|
#AC_SUBST(ALLOCA_OBJECT)
|
||||||
|
|
||||||
AC_OUTPUT([Makefile builtins/Makefile lib/readline/Makefile lib/glob/Makefile \
|
AC_OUTPUT([Makefile builtins/Makefile lib/readline/Makefile lib/glob/Makefile \
|
||||||
lib/malloc/Makefile lib/termcap/Makefile lib/tilde/Makefile \
|
lib/malloc/Makefile lib/sh/Makefile lib/termcap/Makefile \
|
||||||
doc/Makefile],
|
lib/tilde/Makefile doc/Makefile support/Makefile \
|
||||||
|
examples/loadables/Makefile],
|
||||||
[
|
[
|
||||||
# Makefile uses this timestamp file to record whether config.h is up to date.
|
# Makefile uses this timestamp file to record whether config.h is up to date.
|
||||||
echo timestamp > stamp-h
|
echo timestamp > stamp-h
|
||||||
|
|
61
copy_cmd.c
61
copy_cmd.c
|
@ -22,23 +22,25 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include "bashtypes.h"
|
||||||
|
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "shell.h"
|
#include "shell.h"
|
||||||
|
|
||||||
WORD_DESC *
|
WORD_DESC *
|
||||||
copy_word (word)
|
copy_word (w)
|
||||||
WORD_DESC *word;
|
WORD_DESC *w;
|
||||||
{
|
{
|
||||||
WORD_DESC *new_word;
|
WORD_DESC *new_word;
|
||||||
|
|
||||||
new_word = (WORD_DESC *)xmalloc (sizeof (WORD_DESC));
|
new_word = (WORD_DESC *)xmalloc (sizeof (WORD_DESC));
|
||||||
FASTCOPY ((char *)word, (char *)new_word, sizeof (WORD_DESC));
|
FASTCOPY ((char *)w, (char *)new_word, sizeof (WORD_DESC));
|
||||||
new_word->word = savestring (word->word);
|
new_word->word = savestring (w->word);
|
||||||
return (new_word);
|
return (new_word);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,12 +203,47 @@ copy_if_command (com)
|
||||||
return (new_if);
|
return (new_if);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined (DPAREN_ARITHMETIC)
|
||||||
|
static ARITH_COM *
|
||||||
|
copy_arith_command (com)
|
||||||
|
ARITH_COM *com;
|
||||||
|
{
|
||||||
|
ARITH_COM *new_arith;
|
||||||
|
|
||||||
|
new_arith = (ARITH_COM *)xmalloc (sizeof (ARITH_COM));
|
||||||
|
new_arith->flags = com->flags;
|
||||||
|
new_arith->exp = copy_word_list (com->exp);
|
||||||
|
new_arith->line = com->line;
|
||||||
|
|
||||||
|
return (new_arith);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined (COND_COMMAND)
|
||||||
|
static COND_COM *
|
||||||
|
copy_cond_command (com)
|
||||||
|
COND_COM *com;
|
||||||
|
{
|
||||||
|
COND_COM *new_cond;
|
||||||
|
|
||||||
|
new_cond = (COND_COM *)xmalloc (sizeof (COND_COM));
|
||||||
|
new_cond->flags = com->flags;
|
||||||
|
new_cond->line = com->line;
|
||||||
|
new_cond->op = copy_word (com->op);
|
||||||
|
new_cond->left = com->left ? copy_cond_command (com->left) : (COND_COM *)NULL;
|
||||||
|
new_cond->right = com->right ? copy_cond_command (com->right) : (COND_COM *)NULL;
|
||||||
|
|
||||||
|
return (new_cond);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static SIMPLE_COM *
|
static SIMPLE_COM *
|
||||||
copy_simple_command (com)
|
copy_simple_command (com)
|
||||||
SIMPLE_COM *com;
|
SIMPLE_COM *com;
|
||||||
{
|
{
|
||||||
SIMPLE_COM *new_simple = (SIMPLE_COM *)xmalloc (sizeof (SIMPLE_COM));
|
SIMPLE_COM *new_simple;
|
||||||
|
|
||||||
|
new_simple = (SIMPLE_COM *)xmalloc (sizeof (SIMPLE_COM));
|
||||||
new_simple->flags = com->flags;
|
new_simple->flags = com->flags;
|
||||||
new_simple->words = copy_word_list (com->words);
|
new_simple->words = copy_word_list (com->words);
|
||||||
new_simple->redirects = copy_redirects (com->redirects);
|
new_simple->redirects = copy_redirects (com->redirects);
|
||||||
|
@ -276,6 +313,18 @@ copy_command (command)
|
||||||
new_command->value.If = copy_if_command (command->value.If);
|
new_command->value.If = copy_if_command (command->value.If);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#if defined (DPAREN_ARITHMETIC)
|
||||||
|
case cm_arith:
|
||||||
|
new_command->value.Arith = copy_arith_command (command->value.Arith);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined (COND_COMMAND)
|
||||||
|
case cm_cond:
|
||||||
|
new_command->value.Cond = copy_cond_command (command->value.Cond);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
case cm_simple:
|
case cm_simple:
|
||||||
new_command->value.Simple = copy_simple_command (command->value.Simple);
|
new_command->value.Simple = copy_simple_command (command->value.Simple);
|
||||||
break;
|
break;
|
||||||
|
|
39
cross-build/cygwin32.cache
Normal file
39
cross-build/cygwin32.cache
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
# AC_FUNC_GETPGRP should also define GETPGRP_VOID
|
||||||
|
ac_cv_func_getpgrp_void=${ac_cv_func_getpgrp_void='yes'}
|
||||||
|
# AC_FUNC_SETVBUF_REVERSED should not define anything else
|
||||||
|
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_sizeof_char_p=${ac_cv_sizeof_char_p='4'}
|
||||||
|
ac_cv_sizeof_int=${ac_cv_sizeof_int='4'}
|
||||||
|
ac_cv_sizeof_long=${ac_cv_sizeof_long='4'}
|
||||||
|
|
||||||
|
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'}
|
||||||
|
|
||||||
|
# end of cross-build/cygwin32.cache
|
254
cross-build/win32sig.h
Normal file
254
cross-build/win32sig.h
Normal file
|
@ -0,0 +1,254 @@
|
||||||
|
/* This file is used when cross-compiling for the CYGWIN32 environment on
|
||||||
|
a Unix machine. */
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
|
#ifndef __GNUC__
|
||||||
|
# error cross compiling requires gcc
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* A translation list so we can be polite to our users. Use gcc
|
||||||
|
labelled initializers to set up the array. Note that some entries
|
||||||
|
might wind up being NULL. */
|
||||||
|
|
||||||
|
char *signal_names[NSIG + 2] = {
|
||||||
|
[0] "EXIT",
|
||||||
|
|
||||||
|
#ifdef SIGLOST
|
||||||
|
[SIGLOST] "SIGLOST",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGMSG
|
||||||
|
[SIGMSG] "SIGMSG",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGDANGER
|
||||||
|
[SIGDANGER] "SIGDANGER",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGMIGRATE
|
||||||
|
[SIGMIGRATE] "SIGMIGRATE",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGPRE
|
||||||
|
[SIGPRE] "SIGPRE",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGVIRT
|
||||||
|
[SIGVIRT] "SIGVIRT",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGALRM1
|
||||||
|
[SIGALRM1] "SIGALRM1",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGWAITING
|
||||||
|
[SIGWAITING] "SIGWAITING",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGGRANT
|
||||||
|
[SIGGRANT] "SIGGRANT",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGKAP
|
||||||
|
[SIGKAP] "SIGKAP",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGRETRACT
|
||||||
|
[SIGRETRACT] "SIGRETRACT",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGSOUND
|
||||||
|
[SIGSOUND] "SIGSOUND",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGSAK
|
||||||
|
[SIGSAK] "SIGSAK",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGLWP
|
||||||
|
[SIGLWP] "SIGLWP",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGFREEZE
|
||||||
|
[SIGFREEZE] "SIGFREEZE",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGTHAW
|
||||||
|
[SIGTHAW] "SIGTHAW",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGCANCEL
|
||||||
|
[SIGCANCEL] "SIGCANCEL",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGDIL
|
||||||
|
[SIGDIL] "SIGDIL",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGCLD
|
||||||
|
#ifndef SIGCHLD
|
||||||
|
[SIGCLD] "SIGCLD",
|
||||||
|
#else
|
||||||
|
#if SIGCHLD != SIGCLD
|
||||||
|
[SIGCLD] "SIGCLD",
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGPWR
|
||||||
|
[SIGPWR] "SIGPWR",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGPOLL
|
||||||
|
#ifndef SIGIO
|
||||||
|
[SIGPOLL] "SIGPOLL",
|
||||||
|
#else
|
||||||
|
#if SIGIO != SIGPOLL
|
||||||
|
[SIGPOLL] "SIGPOLL",
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGWINDOW
|
||||||
|
[SIGWINDOW] "SIGWINDOW",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGHUP
|
||||||
|
[SIGHUP] "SIGHUP",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGINT
|
||||||
|
[SIGINT] "SIGINT",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGQUIT
|
||||||
|
[SIGQUIT] "SIGQUIT",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGILL
|
||||||
|
[SIGILL] "SIGILL",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGTRAP
|
||||||
|
[SIGTRAP] "SIGTRAP",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGIOT
|
||||||
|
#ifndef SIGABRT
|
||||||
|
[SIGIOT] "SIGIOT",
|
||||||
|
#else
|
||||||
|
#if SIGABRT != SIGIOT
|
||||||
|
[SIGIOT] "SIGIOT",
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGABRT
|
||||||
|
[SIGABRT] "SIGABRT",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGEMT
|
||||||
|
[SIGEMT] "SIGEMT",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGFPE
|
||||||
|
[SIGFPE] "SIGFPE",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGKILL
|
||||||
|
[SIGKILL] "SIGKILL",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGBUS
|
||||||
|
[SIGBUS] "SIGBUS",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGSEGV
|
||||||
|
[SIGSEGV] "SIGSEGV",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGSYS
|
||||||
|
[SIGSYS] "SIGSYS",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGPIPE
|
||||||
|
[SIGPIPE] "SIGPIPE",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGALRM
|
||||||
|
[SIGALRM] "SIGALRM",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGTERM
|
||||||
|
[SIGTERM] "SIGTERM",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGURG
|
||||||
|
[SIGURG] "SIGURG",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGSTOP
|
||||||
|
[SIGSTOP] "SIGSTOP",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGTSTP
|
||||||
|
[SIGTSTP] "SIGTSTP",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGCONT
|
||||||
|
[SIGCONT] "SIGCONT",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGCHLD
|
||||||
|
[SIGCHLD] "SIGCHLD",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGTTIN
|
||||||
|
[SIGTTIN] "SIGTTIN",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGTTOU
|
||||||
|
[SIGTTOU] "SIGTTOU",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGIO
|
||||||
|
[SIGIO] "SIGIO",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGXCPU
|
||||||
|
[SIGXCPU] "SIGXCPU",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGXFSZ
|
||||||
|
[SIGXFSZ] "SIGXFSZ",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGVTALRM
|
||||||
|
[SIGVTALRM] "SIGVTALRM",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGPROF
|
||||||
|
[SIGPROF] "SIGPROF",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGWINCH
|
||||||
|
[SIGWINCH] "SIGWINCH",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGINFO
|
||||||
|
[SIGINFO] "SIGINFO",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGUSR1
|
||||||
|
[SIGUSR1] "SIGUSR1",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SIGUSR2
|
||||||
|
[SIGUSR2] "SIGUSR2",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
[NSIG] "DEBUG",
|
||||||
|
|
||||||
|
[NSIG + 1] (char *)0x0
|
||||||
|
};
|
|
@ -20,6 +20,8 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#include "bashtypes.h"
|
||||||
|
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -132,6 +134,29 @@ dispose_command (command)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined (DPAREN_ARITHMETIC)
|
||||||
|
case cm_arith:
|
||||||
|
{
|
||||||
|
register ARITH_COM *c;
|
||||||
|
|
||||||
|
c = command->value.Arith;
|
||||||
|
dispose_words (c->exp);
|
||||||
|
free (c);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif /* DPAREN_ARITHMETIC */
|
||||||
|
|
||||||
|
#if defined (COND_COMMAND)
|
||||||
|
case cm_cond:
|
||||||
|
{
|
||||||
|
register COND_COM *c;
|
||||||
|
|
||||||
|
c = command->value.Cond;
|
||||||
|
dispose_cond_node (c);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif /* COND_COMMAND */
|
||||||
|
|
||||||
case cm_function_def:
|
case cm_function_def:
|
||||||
{
|
{
|
||||||
register FUNCTION_DEF *c;
|
register FUNCTION_DEF *c;
|
||||||
|
@ -150,13 +175,32 @@ dispose_command (command)
|
||||||
free (command);
|
free (command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined (COND_COMMAND)
|
||||||
|
/* How to free a node in a conditional command. */
|
||||||
|
void
|
||||||
|
dispose_cond_node (cond)
|
||||||
|
COND_COM *cond;
|
||||||
|
{
|
||||||
|
if (cond)
|
||||||
|
{
|
||||||
|
if (cond->left)
|
||||||
|
dispose_cond_node (cond->left);
|
||||||
|
if (cond->right)
|
||||||
|
dispose_cond_node (cond->right);
|
||||||
|
if (cond->op)
|
||||||
|
dispose_word (cond->op);
|
||||||
|
free (cond);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* COND_COMMAND */
|
||||||
|
|
||||||
/* How to free a WORD_DESC. */
|
/* How to free a WORD_DESC. */
|
||||||
void
|
void
|
||||||
dispose_word (word)
|
dispose_word (w)
|
||||||
WORD_DESC *word;
|
WORD_DESC *w;
|
||||||
{
|
{
|
||||||
FREE (word->word);
|
FREE (w->word);
|
||||||
free (word);
|
free (w);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* How to get rid of a linked list of words. A WORD_LIST. */
|
/* How to get rid of a linked list of words. A WORD_LIST. */
|
||||||
|
|
|
@ -29,4 +29,8 @@ extern void dispose_words __P((WORD_LIST *));
|
||||||
extern void dispose_word_array __P((char **));
|
extern void dispose_word_array __P((char **));
|
||||||
extern void dispose_redirects __P((REDIRECT *));
|
extern void dispose_redirects __P((REDIRECT *));
|
||||||
|
|
||||||
|
#if defined (COND_COMMAND)
|
||||||
|
extern void dispose_cond_node __P((COND_COM *));
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* !_DISPOSE_CMD_H_ */
|
#endif /* !_DISPOSE_CMD_H_ */
|
||||||
|
|
131
doc/FAQ
131
doc/FAQ
|
@ -1,4 +1,4 @@
|
||||||
This is the Bash FAQ, version 2.5, for Bash version 2.01.
|
This is the Bash FAQ, version 2.11, for Bash version 2.02.
|
||||||
|
|
||||||
This document contains a set of frequently-asked questions concerning
|
This document contains a set of frequently-asked questions concerning
|
||||||
Bash, the GNU Bourne-Again Shell. Bash is a freely-available command
|
Bash, the GNU Bourne-Again Shell. Bash is a freely-available command
|
||||||
|
@ -13,7 +13,7 @@ chet@po.cwru.edu.
|
||||||
|
|
||||||
This document is available for anonymous FTP with the URL
|
This document is available for anonymous FTP with the URL
|
||||||
|
|
||||||
ftp://slc2.ins.cwru.edu/pub/bash/FAQ
|
ftp://ftp.cwru.edu/pub/bash/FAQ
|
||||||
|
|
||||||
----------
|
----------
|
||||||
Contents:
|
Contents:
|
||||||
|
@ -34,8 +34,8 @@ Section A: The Basics
|
||||||
|
|
||||||
Section B: The latest version
|
Section B: The latest version
|
||||||
|
|
||||||
11) What's new in version 2.01?
|
11) What's new in version 2.02?
|
||||||
12) Are there any user-visible incompatibilities between bash-2.01 and
|
12) Are there any user-visible incompatibilities between bash-2.02 and
|
||||||
bash-1.14.7?
|
bash-1.14.7?
|
||||||
|
|
||||||
Section C: Differences from other Unix shells
|
Section C: Differences from other Unix shells
|
||||||
|
@ -120,23 +120,22 @@ of Case Western Reserve University.
|
||||||
|
|
||||||
2) What's the latest version?
|
2) What's the latest version?
|
||||||
|
|
||||||
The latest version is 2.01, first made available on June 6, 1997.
|
The latest version is 2.02, first made available on Monday, 20 April, 1998.
|
||||||
|
|
||||||
3) Where can I get it?
|
3) Where can I get it?
|
||||||
|
|
||||||
Bash is the GNU project's shell, and so is available from the
|
Bash is the GNU project's shell, and so is available from the
|
||||||
master GNU archive site, prep.ai.mit.edu, and its mirrors. The
|
master GNU archive site, prep.ai.mit.edu, and its mirrors. The
|
||||||
latest version is also available for FTP from slc2.ins.cwru.edu,
|
latest version is also available for FTP from ftp.cwru.edu.
|
||||||
the maintainer's machine. The following URLs tell how to get
|
The following URLs tell how to get version 2.02:
|
||||||
version 2.01:
|
|
||||||
|
|
||||||
ftp://prep.ai.mit.edu/pub/gnu/bash-2.01.tar.gz
|
ftp://prep.ai.mit.edu/pub/gnu/bash-2.02.tar.gz
|
||||||
ftp://slc2.ins.cwru.edu/pub/dist/bash-2.01.tar.gz
|
ftp://ftp.cwru.edu/pub/bash/bash-2.02.tar.gz
|
||||||
|
|
||||||
Formatted versions of the documentation are available with the URLs:
|
Formatted versions of the documentation are available with the URLs:
|
||||||
|
|
||||||
ftp://prep.ai.mit.edu/pub/gnu/bash-doc-2.01.tar.gz
|
ftp://prep.ai.mit.edu/pub/gnu/bash-doc-2.02.tar.gz
|
||||||
ftp://slc2.ins.cwru.edu/pub/dist/bash-doc-2.01.tar.gz
|
ftp://ftp.cwru.edu/pub/bash/bash-doc-2.02.tar.gz
|
||||||
|
|
||||||
4) On what machines will bash run?
|
4) On what machines will bash run?
|
||||||
|
|
||||||
|
@ -162,8 +161,22 @@ project. For more information about the project, look at the URL
|
||||||
|
|
||||||
http://www.cygnus.com/misc/gnu-win32
|
http://www.cygnus.com/misc/gnu-win32
|
||||||
|
|
||||||
Cygnus has ported bash-1.14.7. Maybe someday they (or I) will port
|
Cygnus has ported bash-1.14.7, and their port is part of the current
|
||||||
bash-2.01 (or later) to the GNU-Win32 environment.
|
gnu-win32 release. Cygnus has also done a port of bash-2.01 to the
|
||||||
|
GNU-Win32 environment, and it should be available as part of their next
|
||||||
|
release.
|
||||||
|
|
||||||
|
Bash-2.02 should require no local Cygnus changes to build and run under
|
||||||
|
GNU-WIN32.
|
||||||
|
|
||||||
|
The Cygnus port works only on Intel machines. There is a port of bash
|
||||||
|
(I don't know which version) to the alpha/NT environment available from
|
||||||
|
|
||||||
|
ftp://ftp.gnustep.org//pub/win32/bash-alpha-nt-1.01.tar.gz
|
||||||
|
|
||||||
|
Softway Systems has ported bash-2.01.1 to their OpenNT system, a
|
||||||
|
Unix subsystem for NT that replaces the Microsoft POSIX subsystem.
|
||||||
|
Check out http://www.opennt.com for more information.
|
||||||
|
|
||||||
D. J. Delorie has ported bash-1.14.7 to run under MS-DOS, as part of
|
D. J. Delorie has ported bash-1.14.7 to run under MS-DOS, as part of
|
||||||
the DJGPP project. For more information on the project, see
|
the DJGPP project. For more information on the project, see
|
||||||
|
@ -179,11 +192,13 @@ The corresponding source is
|
||||||
|
|
||||||
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/bsh1147s.zip
|
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/bsh1147s.zip
|
||||||
|
|
||||||
A port of bash-1.12 is available for OS/2 from
|
Ports of bash-1.12 and bash-2.0 are available for OS/2 from
|
||||||
|
|
||||||
ftp://hobbes.nmsu.edu/os2/unix/bash_112.zip
|
ftp://hobbes.nmsu.edu/pub/os2/util/shell/bash_112.zip
|
||||||
|
ftp://hobbes.nmsu.edu/pub/os2/util/shell/bash-2.0(253).zip
|
||||||
|
|
||||||
I haven't looked at it.
|
I haven't looked at either, but the second appears to be a binary-only
|
||||||
|
distribution. Beware.
|
||||||
|
|
||||||
6) How can I build bash with gcc?
|
6) How can I build bash with gcc?
|
||||||
|
|
||||||
|
@ -193,11 +208,11 @@ file INSTALL in the distribution for more information.
|
||||||
7) How can I make bash my login shell?
|
7) How can I make bash my login shell?
|
||||||
|
|
||||||
Some machines let you use `chsh' to change your login shell. Other
|
Some machines let you use `chsh' to change your login shell. Other
|
||||||
systems use `passwd -s'. If one of these works for you, that's all
|
systems use `passwd -s' or `passwd -e'. If one of these works for
|
||||||
you need. Note that many systems require the full pathname to a shell
|
you, that's all you need. Note that many systems require the full
|
||||||
to appear in /etc/shells before you can make it your login shell. For
|
pathname to a shell to appear in /etc/shells before you can make it
|
||||||
this, you may need the assistance of your friendly local system
|
your login shell. For this, you may need the assistance of your
|
||||||
administrator.
|
friendly local system administrator.
|
||||||
|
|
||||||
If you cannot do this, you can still use bash as your login shell, but
|
If you cannot do this, you can still use bash as your login shell, but
|
||||||
you need to perform some tricks. The basic idea is to add a command
|
you need to perform some tricks. The basic idea is to add a command
|
||||||
|
@ -298,15 +313,37 @@ Reference Manual.
|
||||||
|
|
||||||
Section B: The latest version
|
Section B: The latest version
|
||||||
|
|
||||||
11) What's new in version 2.01?
|
11) What's new in version 2.02?
|
||||||
|
|
||||||
Bash-2.01 contains only a few new features.
|
Bash-2.02 has a number of new features. Here's a short list:
|
||||||
|
|
||||||
|
a new version of malloc (based on the old GNU malloc code in previous
|
||||||
|
bash versions) that is more page-oriented, more conservative
|
||||||
|
with memory usage, does not `orphan' large blocks when they
|
||||||
|
are freed, is usable on 64-bit machines, and has allocation
|
||||||
|
checking turned on unconditionally
|
||||||
|
POSIX.2-style globbing character classes ([:alpha:], [:alnum:], etc.)
|
||||||
|
POSIX.2-style globbing equivalence classes
|
||||||
|
POSIX.2-style globbing collating symbols
|
||||||
|
the ksh [[...]] extended conditional command
|
||||||
|
the ksh egrep-style extended pattern matching operators
|
||||||
|
a new `printf' builtin
|
||||||
|
the ksh-like $(<filename) command substitution, which is equivalent to
|
||||||
|
$(cat filename)
|
||||||
|
new tilde prefixes that expand to directories from the directory stack
|
||||||
|
new `**' arithmetic operator to do exponentiation
|
||||||
|
case-insensitive globbing (filename expansion)
|
||||||
|
menu completion a la tcsh
|
||||||
|
`magic-space' history expansion function like tcsh
|
||||||
|
the readline inputrc `language' has a new file inclusion directive ($include)
|
||||||
|
|
||||||
|
Bash-2.01 contained only a few new features:
|
||||||
|
|
||||||
new `GROUPS' builtin array variable containing the user's group list
|
new `GROUPS' builtin array variable containing the user's group list
|
||||||
new bindable readline commands: history-and-alias-expand-line and
|
new bindable readline commands: history-and-alias-expand-line and
|
||||||
alias-expand-line
|
alias-expand-line
|
||||||
|
|
||||||
Bash-2.0 contains extensive changes and new features from bash-1.14.7.
|
Bash-2.0 contained extensive changes and new features from bash-1.14.7.
|
||||||
Here's a short list:
|
Here's a short list:
|
||||||
|
|
||||||
new `time' reserved word to time pipelines, shell builtins, and
|
new `time' reserved word to time pipelines, shell builtins, and
|
||||||
|
@ -344,11 +381,11 @@ grammar tighter and smaller (66 reduce-reduce conflicts gone)
|
||||||
lots of code now smaller and faster
|
lots of code now smaller and faster
|
||||||
test suite greatly expanded
|
test suite greatly expanded
|
||||||
|
|
||||||
12) Are there any user-visible incompatibilities between bash-2.01 and
|
12) Are there any user-visible incompatibilities between bash-2.02 and
|
||||||
bash-1.14.7?
|
bash-1.14.7?
|
||||||
|
|
||||||
There are a few incompatibilities between version 1.14.7 and version 2.01.
|
There are a few incompatibilities between version 1.14.7 and version 2.02.
|
||||||
They are detailed in the file COMPAT in the bash-2.01 distribution.
|
They are detailed in the file COMPAT in the bash-2.02 distribution.
|
||||||
|
|
||||||
Section C: Differences from other Unix shells
|
Section C: Differences from other Unix shells
|
||||||
|
|
||||||
|
@ -494,7 +531,7 @@ Implementation differences:
|
||||||
|
|
||||||
15) Which new features in ksh-93 are not in bash, and which are?
|
15) Which new features in ksh-93 are not in bash, and which are?
|
||||||
|
|
||||||
New things in ksh-93 not in bash-2.01:
|
New things in ksh-93 not in bash-2.02:
|
||||||
associative arrays
|
associative arrays
|
||||||
floating point arithmetic
|
floating point arithmetic
|
||||||
++, --, comma arithmetic operators
|
++, --, comma arithmetic operators
|
||||||
|
@ -510,12 +547,12 @@ New things in ksh-93 not in bash-2.01:
|
||||||
variables: .sh.edchar, .sh.edmode, .sh.edcol, .sh.edtext, HISTEDIT,
|
variables: .sh.edchar, .sh.edmode, .sh.edcol, .sh.edtext, HISTEDIT,
|
||||||
.sh.version, .sh.name, .sh.subscript, .sh.value
|
.sh.version, .sh.name, .sh.subscript, .sh.value
|
||||||
backreferences in pattern matching
|
backreferences in pattern matching
|
||||||
print -f and printf (bash has loadable versions)
|
print -f (bash has a loadable version)
|
||||||
`fc' has been renamed to `hist'
|
`fc' has been renamed to `hist'
|
||||||
read -t/-d
|
read -t/-d
|
||||||
`.' can execute shell functions
|
`.' can execute shell functions
|
||||||
|
|
||||||
New things in ksh-93 present in bash-2.01:
|
New things in ksh-93 present in bash-2.02:
|
||||||
?: arithmetic operator
|
?: arithmetic operator
|
||||||
expansions: ${!param}, ${param:offset[:len]}, ${param/pat[/str]}
|
expansions: ${!param}, ${param:offset[:len]}, ${param/pat[/str]}
|
||||||
compound array assignment
|
compound array assignment
|
||||||
|
@ -808,7 +845,7 @@ and the \] escape to signal the end of such a sequence.
|
||||||
27) How can I find the value of a shell variable whose name is the value
|
27) How can I find the value of a shell variable whose name is the value
|
||||||
of another shell variable?
|
of another shell variable?
|
||||||
|
|
||||||
Bash-2.01 supports this directly. You can use
|
Bash-2.02 supports this directly. You can use
|
||||||
|
|
||||||
${!var}
|
${!var}
|
||||||
|
|
||||||
|
@ -830,7 +867,7 @@ parameter:
|
||||||
|
|
||||||
The expansion of the quoted portions of this expression will be
|
The expansion of the quoted portions of this expression will be
|
||||||
deferred until `eval' runs, while the `$#' will be expanded
|
deferred until `eval' runs, while the `$#' will be expanded
|
||||||
before `eval' is executed. In bash-2.01,
|
before `eval' is executed. In bash-2.02,
|
||||||
|
|
||||||
echo ${!#}
|
echo ${!#}
|
||||||
|
|
||||||
|
@ -1055,7 +1092,7 @@ is, in fact, a syntax error. Redirections may only precede `simple
|
||||||
commands'. A subshell construct such as the above is one of the shell's
|
commands'. A subshell construct such as the above is one of the shell's
|
||||||
`compound commands'. A redirection may only follow a compound command.
|
`compound commands'. A redirection may only follow a compound command.
|
||||||
|
|
||||||
The file CWRU/sh-redir-hack in the bash-2.01 distribution is an
|
The file CWRU/sh-redir-hack in the bash-2.02 distribution is an
|
||||||
(unofficial) patch to parse.y that will modify the grammar to
|
(unofficial) patch to parse.y that will modify the grammar to
|
||||||
support this construct. It will not apply with `patch'; you must
|
support this construct. It will not apply with `patch'; you must
|
||||||
modify parse.y by hand. Note that if you apply this, you must
|
modify parse.y by hand. Note that if you apply this, you must
|
||||||
|
@ -1100,34 +1137,30 @@ Postscript files created from the above source are available in
|
||||||
the documentation distribution.
|
the documentation distribution.
|
||||||
|
|
||||||
There is additional documentation available for anonymous FTP from host
|
There is additional documentation available for anonymous FTP from host
|
||||||
slc2.ins.cwru.edu in the `pub/bash' directory.
|
ftp.cwru.edu in the `pub/bash' directory.
|
||||||
|
|
||||||
Cameron Newham and Bill Rosenblatt have written a book on bash, published
|
Cameron Newham and Bill Rosenblatt have written a book on bash, published
|
||||||
by O'Reilly and Associates. The book is based on Bill Rosenblatt's Korn
|
by O'Reilly and Associates. The book is based on Bill Rosenblatt's Korn
|
||||||
Shell book. The title is ``Learning the Bash Shell'', and the ISBN number
|
Shell book. The title is ``Learning the Bash Shell'', and the ISBN number
|
||||||
is 1-56592-147-X. Look for it in fine bookstores near you. This book
|
is 1-56592-147-X. Look for it in fine bookstores near you. This book
|
||||||
covers bash-1.14, but has an appendix describing some of the new features
|
covers bash-1.14, but has an appendix describing some of the new features
|
||||||
in bash-2.0. There are rumors of a second edition of this book, describing
|
in bash-2.0.
|
||||||
bash-2.0 (and 2.01). I do not know what ORA's publication schedule for
|
|
||||||
this edition is.
|
A second edition of this book is available, just published in January, 1998.
|
||||||
|
The ISBN number is 1-56592-347-2. Look for it in the same fine bookstores
|
||||||
|
or on the web.
|
||||||
|
|
||||||
39) What's coming in future versions?
|
39) What's coming in future versions?
|
||||||
|
|
||||||
These are features I plan to include in a future version of bash.
|
These are features I plan to include in a future version of bash.
|
||||||
|
|
||||||
POSIX.2-style globbing character classes ([:alpha:], [:alnum:], etc.)
|
a bash debugger (a minimally-tested version is included with bash-2.02)
|
||||||
POSIX.2-style globbing equivalence classes
|
Programmable completion a la zsh
|
||||||
POSIX.2-style globbing collating symbols
|
|
||||||
a bash debugger (a minimally-tested version is included with bash-2.01)
|
|
||||||
|
|
||||||
40) What's on the bash `wish list' for future versions?
|
40) What's on the bash `wish list' for future versions?
|
||||||
|
|
||||||
These are features that may or may not appear in a future version of bash.
|
These are features that may or may not appear in a future version of bash.
|
||||||
|
|
||||||
Programmable completion a la zsh
|
|
||||||
menu completion a la tcsh
|
|
||||||
the ksh [[...]] extended test command
|
|
||||||
the ksh egrep-style extended pattern matching operators
|
|
||||||
associative arrays (not really all that hard)
|
associative arrays (not really all that hard)
|
||||||
breaking some of the shell functionality into embeddable libraries
|
breaking some of the shell functionality into embeddable libraries
|
||||||
better internationalization using GNU `gettext'
|
better internationalization using GNU `gettext'
|
||||||
|
@ -1135,13 +1168,15 @@ an option to use external files for the long `help' text
|
||||||
timeouts for the `read' builtin
|
timeouts for the `read' builtin
|
||||||
the ksh-93 ${!prefix*} and ${!prefix@} operators
|
the ksh-93 ${!prefix*} and ${!prefix@} operators
|
||||||
arithmetic ++ and -- prefix and postfix operators
|
arithmetic ++ and -- prefix and postfix operators
|
||||||
|
date-stamped command history
|
||||||
|
|
||||||
41) When will the next release appear?
|
41) When will the next release appear?
|
||||||
|
|
||||||
The next version will appear sometime in 1997. Never make predictions.
|
The next version will appear sometime in 1998. Never make
|
||||||
|
predictions.
|
||||||
|
|
||||||
|
|
||||||
This document is Copyright 1995, 1996 by Chester Ramey.
|
This document is Copyright 1995, 1996, 1998 by Chester Ramey.
|
||||||
|
|
||||||
Permission is hereby granted, without written agreement and
|
Permission is hereby granted, without written agreement and
|
||||||
without license or royalty fees, to use, copy, and distribute
|
without license or royalty fees, to use, copy, and distribute
|
||||||
|
|
|
@ -30,6 +30,8 @@ TEX = tex
|
||||||
MAKEINFO = makeinfo
|
MAKEINFO = makeinfo
|
||||||
TEXI2DVI = ${topdir}/support/texi2dvi
|
TEXI2DVI = ${topdir}/support/texi2dvi
|
||||||
TEXI2HTML = ${topdir}/support/texi2html
|
TEXI2HTML = ${topdir}/support/texi2html
|
||||||
|
MAN2HTML = ${BUILD_DIR}/support/man2html
|
||||||
|
HTMLPOST = ${srcdir}/htmlpost.sh
|
||||||
QUIETPS = #set this to -q to shut up dvips
|
QUIETPS = #set this to -q to shut up dvips
|
||||||
DVIPS = dvips -D 300 $(QUIETPS) -o $@ # tricky
|
DVIPS = dvips -D 300 $(QUIETPS) -o $@ # tricky
|
||||||
TEXINPUTDIR = $(RL_LIBDIR)/doc
|
TEXINPUTDIR = $(RL_LIBDIR)/doc
|
||||||
|
@ -45,7 +47,7 @@ GROFF = groff
|
||||||
HSUSER = $(RL_LIBDIR)/doc/hsuser.texinfo
|
HSUSER = $(RL_LIBDIR)/doc/hsuser.texinfo
|
||||||
RLUSER = $(RL_LIBDIR)/doc/rluser.texinfo
|
RLUSER = $(RL_LIBDIR)/doc/rluser.texinfo
|
||||||
|
|
||||||
.SUFFIXES: .0 .1 .3 .ms .ps .txt .dvi
|
.SUFFIXES: .0 .1 .3 .ms .ps .txt .dvi .html
|
||||||
|
|
||||||
.1.ps:
|
.1.ps:
|
||||||
$(RM) $@
|
$(RM) $@
|
||||||
|
@ -55,6 +57,10 @@ RLUSER = $(RL_LIBDIR)/doc/rluser.texinfo
|
||||||
$(RM) $@
|
$(RM) $@
|
||||||
-${NROFF} -man $< > $@
|
-${NROFF} -man $< > $@
|
||||||
|
|
||||||
|
.1.html:
|
||||||
|
$(RM) $@
|
||||||
|
-${MAN2HTML} $< | ${HTMLPOST} > $@
|
||||||
|
|
||||||
.ms.ps:
|
.ms.ps:
|
||||||
$(RM) $@
|
$(RM) $@
|
||||||
-${GROFF} -ms $< > $@
|
-${GROFF} -ms $< > $@
|
||||||
|
@ -71,6 +77,10 @@ RLUSER = $(RL_LIBDIR)/doc/rluser.texinfo
|
||||||
$(RM) $@
|
$(RM) $@
|
||||||
-${NROFF} -man $< > $@
|
-${NROFF} -man $< > $@
|
||||||
|
|
||||||
|
.3.html:
|
||||||
|
$(RM) $@
|
||||||
|
-${MAN2HTML} $< > $@
|
||||||
|
|
||||||
all: ps info dvi text html
|
all: ps info dvi text html
|
||||||
nodvi: ps info text html
|
nodvi: ps info text html
|
||||||
|
|
||||||
|
@ -78,7 +88,7 @@ ps: bash.ps bashbug.ps readline.ps article.ps builtins.ps
|
||||||
dvi: bashref.dvi bashref.ps
|
dvi: bashref.dvi bashref.ps
|
||||||
info: bashref.info
|
info: bashref.info
|
||||||
text: bash.0 bashbug.0 builtins.0 readline.0
|
text: bash.0 bashbug.0 builtins.0 readline.0
|
||||||
html: bashref.html
|
html: bashref.html bash.html
|
||||||
|
|
||||||
bashref.dvi: $(srcdir)/bashref.texi $(HSUSER) $(RLUSER)
|
bashref.dvi: $(srcdir)/bashref.texi $(HSUSER) $(RLUSER)
|
||||||
TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2DVI) $(srcdir)/bashref.texi
|
TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2DVI) $(srcdir)/bashref.texi
|
||||||
|
@ -102,6 +112,7 @@ bashman.ps: bash.dvi
|
||||||
|
|
||||||
bash.txt: bash.1
|
bash.txt: bash.1
|
||||||
bash.ps: bash.1
|
bash.ps: bash.1
|
||||||
|
bash.html: bash.1 $(MAN2HTML)
|
||||||
bashbug.ps: bashbug.1
|
bashbug.ps: bashbug.1
|
||||||
builtins.ps: builtins.1 bash.1
|
builtins.ps: builtins.1 bash.1
|
||||||
bash.0: bash.1
|
bash.0: bash.1
|
||||||
|
@ -111,6 +122,9 @@ readline.0: readline.3
|
||||||
readline.ps: readline.3
|
readline.ps: readline.3
|
||||||
article.ps: article.ms
|
article.ps: article.ms
|
||||||
|
|
||||||
|
$(MAN2HTML): ${topdir}/support/man2html.c
|
||||||
|
-( cd ${BUILD_DIR}/support ; ${MAKE} ${MFLAGS} man2html)
|
||||||
|
|
||||||
faq: faq.news faq.news2 faq.mail faq.version
|
faq: faq.news faq.news2 faq.mail faq.version
|
||||||
|
|
||||||
faq.version: FAQ.version FAQ
|
faq.version: FAQ.version FAQ
|
||||||
|
|
1515
doc/bash.1
1515
doc/bash.1
File diff suppressed because it is too large
Load diff
4354
doc/bashref.info
4354
doc/bashref.info
File diff suppressed because it is too large
Load diff
3537
doc/bashref.texi
3537
doc/bashref.texi
File diff suppressed because it is too large
Load diff
19
doc/htmlpost.sh
Executable file
19
doc/htmlpost.sh
Executable file
|
@ -0,0 +1,19 @@
|
||||||
|
#! /bin/sh
|
||||||
|
#
|
||||||
|
# Some of these should really be done by man2html
|
||||||
|
#
|
||||||
|
# The ~/xxx links don't really work -- netscape doesn't expand the home
|
||||||
|
# directory of the user running navigator
|
||||||
|
#
|
||||||
|
|
||||||
|
sed -e 's|<B>gnu.bash.bug</B>|<A HREF="news:gnu.bash.bug">gnu.bash.bug</A>|' \
|
||||||
|
-e 's|<I>/bin/bash</I>|<A HREF="file:/bin/bash"><I>/bin/bash</I></A>|' \
|
||||||
|
-e 's|<I>/etc/profile</I>|<A HREF="file:/etc/profile"><I>/etc/profile</I></A>|' \
|
||||||
|
-e 's|<I>~/.bash_profile</I>|<A HREF="file:~/.bash_profile"><I>~/.bash_profile</I></A>|' \
|
||||||
|
-e 's|<I>~/.bash_login</I>|<A HREF="file:~/.bash_login"><I>~/.bash_login</I></A>|' \
|
||||||
|
-e 's|<I>~/.profile</I>|<A HREF="file:~/.profile"><I>~/.profile</I></A>|' \
|
||||||
|
-e 's|<I>~/.bashrc</I>|<A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>|' \
|
||||||
|
-e 's|<I>~/.bash_logout</I>|<A HREF="file:~/.bash_logout"><I>~/.bash_logout</I></A>|' \
|
||||||
|
-e 's|<I>~/.bash_history</I>|<A HREF="file:~/.bash_history"><I>~/.bash_history</I></A>|' \
|
||||||
|
-e 's|<I>~/.inputrc</I>|<A HREF="file:~/.inputrc"><I>~/.inputrc</I></A>|' \
|
||||||
|
-e 's|<I>/etc/inputrc</I>|<A HREF="file:/etc/inputrc"><I>/etc/inputrc</I></A>|'
|
127
doc/readline.3
127
doc/readline.3
|
@ -6,9 +6,9 @@
|
||||||
.\" Case Western Reserve University
|
.\" Case Western Reserve University
|
||||||
.\" chet@ins.CWRU.Edu
|
.\" chet@ins.CWRU.Edu
|
||||||
.\"
|
.\"
|
||||||
.\" Last Change: Wed Feb 5 14:13:22 EST 1997
|
.\" Last Change: Thu Feb 19 10:26:47 EST 1998
|
||||||
.\"
|
.\"
|
||||||
.TH READLINE 3 "1997 Feb 5" GNU
|
.TH READLINE 3 "1998 Feb 19" GNU
|
||||||
.\"
|
.\"
|
||||||
.\" File Name macro. This used to be `.PN', for Path Name,
|
.\" File Name macro. This used to be `.PN', for Path Name,
|
||||||
.\" but Sun doesn't seem to like that very much.
|
.\" but Sun doesn't seem to like that very much.
|
||||||
|
@ -159,7 +159,7 @@ command or the text of a macro and a key sequence to which
|
||||||
it should be bound. The name may be specified in one of two ways:
|
it should be bound. The name may be specified in one of two ways:
|
||||||
as a symbolic key name, possibly with \fIMeta\-\fP or \fIControl\-\fP
|
as a symbolic key name, possibly with \fIMeta\-\fP or \fIControl\-\fP
|
||||||
prefixes, or as a key sequence.
|
prefixes, or as a key sequence.
|
||||||
When using the form \fBkeyname\fP:\fIfunction-name\fP or \fImacro\fP,
|
When using the form \fBkeyname\fP:\^\fIfunction-name\fP or \fImacro\fP,
|
||||||
.I keyname
|
.I keyname
|
||||||
is the name of a key spelled out in English. For example:
|
is the name of a key spelled out in English. For example:
|
||||||
.sp
|
.sp
|
||||||
|
@ -185,7 +185,7 @@ expressed on the right hand side (that is, to insert the text
|
||||||
.I >&output
|
.I >&output
|
||||||
into the line).
|
into the line).
|
||||||
.PP
|
.PP
|
||||||
In the second form, \fB"keyseq"\fP:\fIfunction\-name\fP or \fImacro\fP,
|
In the second form, \fB"keyseq"\fP:\^\fIfunction\-name\fP or \fImacro\fP,
|
||||||
.B keyseq
|
.B keyseq
|
||||||
differs from
|
differs from
|
||||||
.B keyname
|
.B keyname
|
||||||
|
@ -213,8 +213,9 @@ and
|
||||||
.I "ESC [ 1 1 ~"
|
.I "ESC [ 1 1 ~"
|
||||||
is bound to insert the text
|
is bound to insert the text
|
||||||
.BR "Function Key 1" .
|
.BR "Function Key 1" .
|
||||||
The full set of escape sequences is
|
The full set of GNU Emacs style escape sequences is
|
||||||
.RS
|
.RS
|
||||||
|
.PD 0
|
||||||
.TP
|
.TP
|
||||||
.B \eC\-
|
.B \eC\-
|
||||||
control prefix
|
control prefix
|
||||||
|
@ -234,11 +235,53 @@ literal "
|
||||||
.B \e'
|
.B \e'
|
||||||
literal '
|
literal '
|
||||||
.RE
|
.RE
|
||||||
|
.PD
|
||||||
|
.PP
|
||||||
|
In addition to the GNU Emacs style escape sequences, a second
|
||||||
|
set of backslash escapes is available:
|
||||||
|
.RS
|
||||||
|
.PD 0
|
||||||
|
.TP
|
||||||
|
.B \ea
|
||||||
|
alert (bell)
|
||||||
|
.TP
|
||||||
|
.B \eb
|
||||||
|
backspace
|
||||||
|
.TP
|
||||||
|
.B \ed
|
||||||
|
delete
|
||||||
|
.TP
|
||||||
|
.B \ef
|
||||||
|
form feed
|
||||||
|
.TP
|
||||||
|
.B \en
|
||||||
|
newline
|
||||||
|
.TP
|
||||||
|
.B \er
|
||||||
|
carriage return
|
||||||
|
.TP
|
||||||
|
.B \et
|
||||||
|
horizontal tab
|
||||||
|
.TP
|
||||||
|
.B \ev
|
||||||
|
vertical tab
|
||||||
|
.TP
|
||||||
|
.B \e\fInnn\fP
|
||||||
|
the character whose ASCII code is the octal value \fInnn\fP
|
||||||
|
(one to three digits)
|
||||||
|
.TP
|
||||||
|
.B \ex\fInnn\fP
|
||||||
|
the character whose ASCII code is the hexadecimal value \fInnn\fP
|
||||||
|
(one to three digits)
|
||||||
|
.RE
|
||||||
|
.PD
|
||||||
.PP
|
.PP
|
||||||
When entering the text of a macro, single or double quotes should
|
When entering the text of a macro, single or double quotes should
|
||||||
be used to indicate a macro definition. Unquoted text
|
be used to indicate a macro definition. Unquoted text
|
||||||
is assumed to be a function name. Backslash
|
is assumed to be a function name.
|
||||||
will quote any character in the macro text, including " and '.
|
In the macro body, the backslash escapes described above are expanded.
|
||||||
|
Backslash will quote any other character in the macro text,
|
||||||
|
including " and '.
|
||||||
.PP
|
.PP
|
||||||
.B Bash
|
.B Bash
|
||||||
allows the current readline key bindings to be displayed or modified
|
allows the current readline key bindings to be displayed or modified
|
||||||
|
@ -288,6 +331,10 @@ This command is bound to
|
||||||
in emacs mode and to
|
in emacs mode and to
|
||||||
.B #
|
.B #
|
||||||
in vi command mode.
|
in vi command mode.
|
||||||
|
.TP
|
||||||
|
.B completion\-ignore\-case (Off)
|
||||||
|
If set to \fBOn\fP, readline performs filename matching and completion
|
||||||
|
in a case\-insensitive fashion.
|
||||||
.TP
|
.TP
|
||||||
.B completion\-query\-items (100)
|
.B completion\-query\-items (100)
|
||||||
This determines when the user is queried about viewing
|
This determines when the user is queried about viewing
|
||||||
|
@ -346,7 +393,7 @@ the value of
|
||||||
also affects the default keymap.
|
also affects the default keymap.
|
||||||
.TP
|
.TP
|
||||||
.B mark\-directories (On)
|
.B mark\-directories (On)
|
||||||
If set to \fBOn\fP, completed directory names have a slash
|
If set to \fBOn\fP, complete<d directory names have a slash
|
||||||
appended.
|
appended.
|
||||||
.TP
|
.TP
|
||||||
.B mark\-modified\-lines (Off)
|
.B mark\-modified\-lines (Off)
|
||||||
|
@ -363,6 +410,10 @@ If set to \fBOn\fP, readline will display characters with the
|
||||||
eighth bit set directly rather than as a meta-prefixed escape
|
eighth bit set directly rather than as a meta-prefixed escape
|
||||||
sequence.
|
sequence.
|
||||||
.TP
|
.TP
|
||||||
|
.B print\-completions\-horizontally (Off)
|
||||||
|
If set to \fBOn\fP, readline will display completions with matches
|
||||||
|
sorted horizontally in alphabetical order, rather than down the screen.
|
||||||
|
.TP
|
||||||
.B show\-all\-if\-ambiguous (Off)
|
.B show\-all\-if\-ambiguous (Off)
|
||||||
This alters the default behavior of the completion functions. If
|
This alters the default behavior of the completion functions. If
|
||||||
set to
|
set to
|
||||||
|
@ -380,7 +431,7 @@ completions.
|
||||||
Readline implements a facility similar in spirit to the conditional
|
Readline implements a facility similar in spirit to the conditional
|
||||||
compilation features of the C preprocessor which allows key
|
compilation features of the C preprocessor which allows key
|
||||||
bindings and variable settings to be performed as the result
|
bindings and variable settings to be performed as the result
|
||||||
of tests. There are three parser directives used.
|
of tests. There are four parser directives used.
|
||||||
.IP \fB$if\fP
|
.IP \fB$if\fP
|
||||||
The
|
The
|
||||||
.B $if
|
.B $if
|
||||||
|
@ -417,6 +468,7 @@ file can test for a particular value.
|
||||||
This could be used to bind key sequences to functions useful for
|
This could be used to bind key sequences to functions useful for
|
||||||
a specific program. For instance, the following command adds a
|
a specific program. For instance, the following command adds a
|
||||||
key sequence that quotes the current or previous word in Bash:
|
key sequence that quotes the current or previous word in Bash:
|
||||||
|
.sp 1
|
||||||
.RS
|
.RS
|
||||||
.nf
|
.nf
|
||||||
\fB$if\fP bash
|
\fB$if\fP bash
|
||||||
|
@ -427,11 +479,21 @@ key sequence that quotes the current or previous word in Bash:
|
||||||
.RE
|
.RE
|
||||||
.RE
|
.RE
|
||||||
.IP \fB$endif\fP
|
.IP \fB$endif\fP
|
||||||
This command, as you saw in the previous example, terminates an
|
This command, as seen in the previous example, terminates an
|
||||||
\fB$if\fP command.
|
\fB$if\fP command.
|
||||||
.IP \fB$else\fP
|
.IP \fB$else\fP
|
||||||
Commands in this branch of the \fB$if\fP directive are executed if
|
Commands in this branch of the \fB$if\fP directive are executed if
|
||||||
the test fails.
|
the test fails.
|
||||||
|
.IP \fB$include\fP
|
||||||
|
This directive takes a single filename as an argument and reads commands
|
||||||
|
and bindings from that file. For example, the following directive
|
||||||
|
would read \fI/etc/inputrc\fP:
|
||||||
|
.sp 1
|
||||||
|
.RS
|
||||||
|
.nf
|
||||||
|
\fB$include\fP \^ \fI/etc/inputrc\fP
|
||||||
|
.fi
|
||||||
|
.RE
|
||||||
.SH SEARCHING
|
.SH SEARCHING
|
||||||
.PP
|
.PP
|
||||||
Readline provides commands for searching through the command history
|
Readline provides commands for searching through the command history
|
||||||
|
@ -464,7 +526,7 @@ the line, thereby executing the command from the history list.
|
||||||
.PP
|
.PP
|
||||||
Non-incremental searches read the entire search string before starting
|
Non-incremental searches read the entire search string before starting
|
||||||
to search for matching history lines. The search string may be
|
to search for matching history lines. The search string may be
|
||||||
typed by the user or part of the contents of the current line.
|
typed by the user or be part of the contents of the current line.
|
||||||
.SH EDITING COMMANDS
|
.SH EDITING COMMANDS
|
||||||
.PP
|
.PP
|
||||||
The following is a list of the names of the commands and the default
|
The following is a list of the names of the commands and the default
|
||||||
|
@ -567,6 +629,8 @@ yank\-last\-arg (M\-.\^, M\-_\^)
|
||||||
Insert the last argument to the previous command (the last word of
|
Insert the last argument to the previous command (the last word of
|
||||||
the previous history entry). With an argument,
|
the previous history entry). With an argument,
|
||||||
behave exactly like \fByank\-nth\-arg\fP.
|
behave exactly like \fByank\-nth\-arg\fP.
|
||||||
|
Successive calls to \fByank\-last\-arg\fP move back through the history
|
||||||
|
list, inserting the last argument of each line in turn.
|
||||||
.PD
|
.PD
|
||||||
.SS Commands for Changing Text
|
.SS Commands for Changing Text
|
||||||
.PP
|
.PP
|
||||||
|
@ -575,9 +639,7 @@ behave exactly like \fByank\-nth\-arg\fP.
|
||||||
.B delete\-char (C\-d)
|
.B delete\-char (C\-d)
|
||||||
Delete the character under the cursor. If point is at the
|
Delete the character under the cursor. If point is at the
|
||||||
beginning of the line, there are no characters in the line, and
|
beginning of the line, there are no characters in the line, and
|
||||||
the last character typed was not
|
the last character typed was not bound to \fBBdelete\-char\fP, then return
|
||||||
.BR C\-d ,
|
|
||||||
then return
|
|
||||||
.SM
|
.SM
|
||||||
.BR EOF .
|
.BR EOF .
|
||||||
.TP
|
.TP
|
||||||
|
@ -606,15 +668,15 @@ moving the cursor over that word as well.
|
||||||
.TP
|
.TP
|
||||||
.B upcase\-word (M\-u)
|
.B upcase\-word (M\-u)
|
||||||
Uppercase the current (or following) word. With a negative argument,
|
Uppercase the current (or following) word. With a negative argument,
|
||||||
do the previous word, but do not move point.
|
uppercase the previous word, but do not move point.
|
||||||
.TP
|
.TP
|
||||||
.B downcase\-word (M\-l)
|
.B downcase\-word (M\-l)
|
||||||
Lowercase the current (or following) word. With a negative argument,
|
Lowercase the current (or following) word. With a negative argument,
|
||||||
do the previous word, but do not move point.
|
lowercase the previous word, but do not move point.
|
||||||
.TP
|
.TP
|
||||||
.B capitalize\-word (M\-c)
|
.B capitalize\-word (M\-c)
|
||||||
Capitalize the current (or following) word. With a negative argument,
|
Capitalize the current (or following) word. With a negative argument,
|
||||||
do the previous word, but do not move point.
|
capitalize the previous word, but do not move point.
|
||||||
.PD
|
.PD
|
||||||
.SS Killing and Yanking
|
.SS Killing and Yanking
|
||||||
.PP
|
.PP
|
||||||
|
@ -628,6 +690,7 @@ Kill backward to the beginning of the line.
|
||||||
.TP
|
.TP
|
||||||
.B unix\-line\-discard (C\-u)
|
.B unix\-line\-discard (C\-u)
|
||||||
Kill backward from point to the beginning of the line.
|
Kill backward from point to the beginning of the line.
|
||||||
|
The killed text is saved on the kill-ring.
|
||||||
.\" There is no real difference between this and backward-kill-line
|
.\" There is no real difference between this and backward-kill-line
|
||||||
.TP
|
.TP
|
||||||
.B kill\-whole\-line
|
.B kill\-whole\-line
|
||||||
|
@ -660,9 +723,11 @@ Copy the text in the region to the kill buffer.
|
||||||
.TP
|
.TP
|
||||||
.B copy\-backward\-word
|
.B copy\-backward\-word
|
||||||
Copy the word before point to the kill buffer.
|
Copy the word before point to the kill buffer.
|
||||||
|
The word boundaries are the same as \fBbackward\-word\fP.
|
||||||
.TP
|
.TP
|
||||||
.B copy\-forward\-word
|
.B copy\-forward\-word
|
||||||
Copy the word following point to the kill buffer.
|
Copy the word following point to the kill buffer.
|
||||||
|
The word boundaries are the same as \fBforward\-word\fP.
|
||||||
.TP
|
.TP
|
||||||
.B yank (C\-y)
|
.B yank (C\-y)
|
||||||
Yank the top of the kill ring into the buffer at the cursor.
|
Yank the top of the kill ring into the buffer at the cursor.
|
||||||
|
@ -720,6 +785,19 @@ List the possible completions of the text before point.
|
||||||
Insert all completions of the text before point
|
Insert all completions of the text before point
|
||||||
that would have been generated by
|
that would have been generated by
|
||||||
\fBpossible\-completions\fP.
|
\fBpossible\-completions\fP.
|
||||||
|
.TP
|
||||||
|
.B menu\-complete
|
||||||
|
Similar to \fBcomplete\fP, but replaces the word to be completed
|
||||||
|
with a single match from the list of possible completions.
|
||||||
|
Repeated execution of \fBmenu\-complete\fP steps through the list
|
||||||
|
of possible completions, inserting each match in turn.
|
||||||
|
At the end of the list of completions, the bell is rung and the
|
||||||
|
original text is restored.
|
||||||
|
An argument of \fIn\fP moves \fIn\fP positions forward in the list
|
||||||
|
of matches; a negative argument may be used to move backward
|
||||||
|
through the list.
|
||||||
|
This command is intended to be bound to \fBTAB\fP, but is unbound
|
||||||
|
by default.
|
||||||
.PD
|
.PD
|
||||||
.SS Keyboard Macros
|
.SS Keyboard Macros
|
||||||
.PP
|
.PP
|
||||||
|
@ -765,7 +843,7 @@ is equivalent to
|
||||||
Incremental undo, separately remembered for each line.
|
Incremental undo, separately remembered for each line.
|
||||||
.TP
|
.TP
|
||||||
.B revert\-line (M\-r)
|
.B revert\-line (M\-r)
|
||||||
Undo all changes made to this line. This is like typing the
|
Undo all changes made to this line. This is like executing the
|
||||||
.B undo
|
.B undo
|
||||||
command enough times to return the line to its initial state.
|
command enough times to return the line to its initial state.
|
||||||
.TP
|
.TP
|
||||||
|
@ -795,15 +873,6 @@ variable is inserted at the beginning of the current line, and the line
|
||||||
is accepted as if a newline had been typed. This makes the current line
|
is accepted as if a newline had been typed. This makes the current line
|
||||||
a shell comment.
|
a shell comment.
|
||||||
.TP
|
.TP
|
||||||
.B glob\-expand\-word (C\-x *)
|
|
||||||
The word before point is treated as a pattern for pathname expansion,
|
|
||||||
and the list of matching file names is inserted, replacing the word.
|
|
||||||
.TP
|
|
||||||
.B glob\-list\-expansions (C\-x g)
|
|
||||||
The list of expansions that would have been generated by
|
|
||||||
.B glob\-expand\-word
|
|
||||||
is inserted into the line, replacing the word before point.
|
|
||||||
.TP
|
|
||||||
.B dump\-functions
|
.B dump\-functions
|
||||||
Print all of the functions and their key bindings to the
|
Print all of the functions and their key bindings to the
|
||||||
readline output stream. If a numeric argument is supplied,
|
readline output stream. If a numeric argument is supplied,
|
||||||
|
@ -1097,10 +1166,10 @@ version of the
|
||||||
library that you have.
|
library that you have.
|
||||||
.PP
|
.PP
|
||||||
Once you have determined that a bug actually exists, mail a
|
Once you have determined that a bug actually exists, mail a
|
||||||
bug report to \fIbug\-readline\fP@\fIprep.ai.MIT.Edu\fP.
|
bug report to \fIbug\-readline\fP@\fIgnu.org\fP.
|
||||||
If you have a fix, you are welcome to mail that
|
If you have a fix, you are welcome to mail that
|
||||||
as well! Suggestions and `philosophical' bug reports may be mailed
|
as well! Suggestions and `philosophical' bug reports may be mailed
|
||||||
to \fPbug-readline\fP@\fIprep.ai.MIT.Edu\fP or posted to the Usenet
|
to \fPbug-readline\fP@\fIgnu.org\fP or posted to the Usenet
|
||||||
newsgroup
|
newsgroup
|
||||||
.BR gnu.bash.bug .
|
.BR gnu.bash.bug .
|
||||||
.PP
|
.PP
|
||||||
|
|
35
error.c
35
error.c
|
@ -189,6 +189,16 @@ internal_error (format, arg1, arg2, arg3, arg4, arg5)
|
||||||
fprintf (stderr, "\n");
|
fprintf (stderr, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
internal_warning (format, arg1, arg2, arg3, arg4, arg5)
|
||||||
|
char *format;
|
||||||
|
{
|
||||||
|
fprintf (stderr, "%s: warning: ", get_name_for_error ());
|
||||||
|
|
||||||
|
fprintf (stderr, format, arg1, arg2, arg3, arg4, arg5);
|
||||||
|
fprintf (stderr, "\n");
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sys_error (format, arg1, arg2, arg3, arg4, arg5)
|
sys_error (format, arg1, arg2, arg3, arg4, arg5)
|
||||||
char *format;
|
char *format;
|
||||||
|
@ -320,6 +330,31 @@ internal_error (format, va_alist)
|
||||||
va_end (args);
|
va_end (args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
#if defined (PREFER_STDARG)
|
||||||
|
internal_warning (const char *format, ...)
|
||||||
|
#else
|
||||||
|
internal_warning (format, va_alist)
|
||||||
|
const char *format;
|
||||||
|
va_dcl
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
|
||||||
|
fprintf (stderr, "%s: warning: ", get_name_for_error ());
|
||||||
|
|
||||||
|
#if defined (PREFER_STDARG)
|
||||||
|
va_start (args, format);
|
||||||
|
#else
|
||||||
|
va_start (args);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
vfprintf (stderr, format, args);
|
||||||
|
fprintf (stderr, "\n");
|
||||||
|
|
||||||
|
va_end (args);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
#if defined (PREFER_STDARG)
|
#if defined (PREFER_STDARG)
|
||||||
sys_error (const char *format, ...)
|
sys_error (const char *format, ...)
|
||||||
|
|
3
error.h
3
error.h
|
@ -47,4 +47,7 @@ extern void sys_error __P((const char *, ...));
|
||||||
/* Report an internal error. */
|
/* Report an internal error. */
|
||||||
extern void internal_error __P((const char *, ...));
|
extern void internal_error __P((const char *, ...));
|
||||||
|
|
||||||
|
/* Report an internal warning. */
|
||||||
|
extern void internal_warning __P((const char *, ...));
|
||||||
|
|
||||||
#endif /* !_ERROR_H_ */
|
#endif /* !_ERROR_H_ */
|
||||||
|
|
38
eval.c
38
eval.c
|
@ -23,6 +23,9 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#if defined (HAVE_UNISTD_H)
|
#if defined (HAVE_UNISTD_H)
|
||||||
|
# ifdef _MINIX
|
||||||
|
# include <sys/types.h>
|
||||||
|
# endif
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -257,3 +260,38 @@ read_command ()
|
||||||
|
|
||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Take a string and run it through the shell parser, returning the
|
||||||
|
resultant word list. Used by compound array assignment. */
|
||||||
|
WORD_LIST *
|
||||||
|
parse_string_to_word_list (s, whom)
|
||||||
|
char *s, *whom;
|
||||||
|
{
|
||||||
|
WORD_LIST *wl;
|
||||||
|
COMMAND *saved_global;
|
||||||
|
|
||||||
|
push_stream (1);
|
||||||
|
|
||||||
|
saved_global = global_command;
|
||||||
|
global_command = (COMMAND *)0;
|
||||||
|
|
||||||
|
with_input_from_string (s, whom);
|
||||||
|
if (parse_command () != 0 || global_command == 0 || global_command->type != cm_simple)
|
||||||
|
{
|
||||||
|
if (global_command)
|
||||||
|
dispose_command (global_command);
|
||||||
|
wl = (WORD_LIST *)NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wl = global_command->value.Simple->words;
|
||||||
|
free (global_command->value.Simple);
|
||||||
|
free (global_command);
|
||||||
|
}
|
||||||
|
|
||||||
|
global_command = saved_global;
|
||||||
|
|
||||||
|
pop_stream ();
|
||||||
|
|
||||||
|
return (wl);
|
||||||
|
}
|
||||||
|
|
43
examples/functions/basename2
Normal file
43
examples/functions/basename2
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
#From: "Grigoriy Strokin" <grg@philol.msu.ru>
|
||||||
|
#Newsgroups: comp.unix.shell
|
||||||
|
#Subject: fast basename and dirname functions for BASH/SH
|
||||||
|
#Date: Sat, 27 Dec 1997 21:18:40 +0300
|
||||||
|
#
|
||||||
|
#Please send your comments to grg@philol.msu.ru
|
||||||
|
|
||||||
|
function basename()
|
||||||
|
{
|
||||||
|
local name="${1##*/}"
|
||||||
|
echo "${name%$2}"
|
||||||
|
}
|
||||||
|
|
||||||
|
function dirname()
|
||||||
|
{
|
||||||
|
local dir="${1%${1##*/}}"
|
||||||
|
[ "${dir:=./}" != "/" ] && dir="${dir%?}"
|
||||||
|
echo "$dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Two additional functions:
|
||||||
|
# 1) namename prints the basename without extension
|
||||||
|
# 2) ext prints extension of a file, including "."
|
||||||
|
|
||||||
|
function namename()
|
||||||
|
{
|
||||||
|
local name=${1##*/}
|
||||||
|
local name0="${name%.*}"
|
||||||
|
echo "${name0:-$name}"
|
||||||
|
}
|
||||||
|
function ext()
|
||||||
|
{
|
||||||
|
local name=${1##*/}
|
||||||
|
local name0="${name%.*}"
|
||||||
|
local ext=${name0:+${name#$name0}}
|
||||||
|
echo "${ext:-.}"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
302
examples/functions/getoptx.bash
Normal file
302
examples/functions/getoptx.bash
Normal file
|
@ -0,0 +1,302 @@
|
||||||
|
#From: "Grigoriy Strokin" <grg@philol.msu.ru>
|
||||||
|
#Newsgroups: comp.unix.shell
|
||||||
|
#Subject: BASH: getopt function that parses long-named options
|
||||||
|
#Date: Mon, 22 Dec 1997 20:35:18 +0300
|
||||||
|
|
||||||
|
#Hi, I have written a BASH function named getoptex, that is like bash builtin
|
||||||
|
#"getopts", but does parse long-named options and optional arguments. It only
|
||||||
|
#uses builtin bash commands, so it is very fast. In order to use it in your
|
||||||
|
#bash scripts, include a command ". getopt.sh" (<dot> getopt.sh) to the file
|
||||||
|
#containing your script, and that will define functions getopt, getoptex, and
|
||||||
|
#optlistex (the file getopt.sh with its detailed description is listed
|
||||||
|
#below).
|
||||||
|
|
||||||
|
#*** file getopt.sh ***
|
||||||
|
|
||||||
|
#! /bin/bash
|
||||||
|
#
|
||||||
|
# getopt.sh:
|
||||||
|
# functions like getopts but do long-named options parsing
|
||||||
|
# and support optional arguments
|
||||||
|
#
|
||||||
|
# Version 1.0 1997 by Grigoriy Strokin (grg@philol.msu.ru), Public Domain
|
||||||
|
# Date created: December 21, 1997
|
||||||
|
# Date modified: December 21, 1997
|
||||||
|
#
|
||||||
|
# IMPORTANT FEATURES
|
||||||
|
#
|
||||||
|
# 1) Parses both short and long-named options
|
||||||
|
# 2) Supports optional arguments
|
||||||
|
# 3) Only uses bash builtins, thus no calls to external
|
||||||
|
# utilities such as expr or sed is done. Therefore,
|
||||||
|
# parsing speed is high enough
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# DESCRIPTION
|
||||||
|
#
|
||||||
|
# FUNCTION getopt
|
||||||
|
# Usage: getopt OPTLIST {"$@"|ALTERNATIVE_PARAMETERS}
|
||||||
|
#
|
||||||
|
# like getopts, but parse options with both required and optional arguments,
|
||||||
|
# Options with optional arguments must have "." instead of ":" after them.
|
||||||
|
# Furthemore, a variable name to place option name cannot be specified
|
||||||
|
# and is always placed in OPTOPT variable
|
||||||
|
#
|
||||||
|
# This function is provided for compatibility with getopts()
|
||||||
|
# OPTLIST style, and it actually calls getoptex (see bellow)
|
||||||
|
#
|
||||||
|
# NOTE that a list of parameters is required and must be either "$@",
|
||||||
|
# if processing command line arguments, or some alternative parameters.
|
||||||
|
#
|
||||||
|
# FUNCTION getoptex
|
||||||
|
# Usage: getoptex OPTION_LIST {"$@"|ALTERNATIVE_PARAMETERS}
|
||||||
|
#
|
||||||
|
# like getopts, but parse long-named options.
|
||||||
|
#
|
||||||
|
# Both getopt and getoptex return 0 if an option has been parsed,
|
||||||
|
# and 1 if all options are already parsed or an error occured
|
||||||
|
#
|
||||||
|
# Both getopt and getoptex set or test the following variables:
|
||||||
|
#
|
||||||
|
# OPTERR -- tested for whether error messages must be given for invalid
|
||||||
|
options
|
||||||
|
#
|
||||||
|
# OPTOPT -- set to the name of an option parsed,
|
||||||
|
# or to "?" if no more options or error
|
||||||
|
# OPTARG -- set to the option argument, if any;
|
||||||
|
# unset if ther is no argument;
|
||||||
|
# on error, set to the erroneous option name
|
||||||
|
#
|
||||||
|
# OPTIND -- Initialized to 1.
|
||||||
|
# Then set to the number of the next parameter to be parsed
|
||||||
|
# when getopt or getoptex will be called next time.
|
||||||
|
# When all options are parsed, contains a number of
|
||||||
|
# the first non-option argument.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# OPTOFS -- If a parameter number $OPTIND containg an option parsed
|
||||||
|
# does not contain any more options, OPTOFS is unset;
|
||||||
|
# otherwise, OPTOFS is set to such a number of "?" signs
|
||||||
|
# which is equal to the number of options parsed
|
||||||
|
#
|
||||||
|
# You might not set variables OPTIND and OPTOFS yourself
|
||||||
|
# unless you want to parse a list of parameters more than once.
|
||||||
|
# Otherwise, you whould unset OPTIND (or set it to 1)
|
||||||
|
# and unset OPTOFS each time you want to parse a new parameters
|
||||||
|
list
|
||||||
|
#
|
||||||
|
# Option list format is DIFFERENT from one for getopts or getopt.
|
||||||
|
getopts-style
|
||||||
|
# option list can be converted to getoptex-style using a function optlistex
|
||||||
|
# (see bellow)
|
||||||
|
#
|
||||||
|
# DESCRIPTION of option list used with getoptex:
|
||||||
|
# Option names are separated by whitespace. Options consiting of
|
||||||
|
# more than one character are treated as long-named (--option)
|
||||||
|
#
|
||||||
|
# Special characters can appear at the and of option names specifying
|
||||||
|
# whether an argument is required (default is ";"):
|
||||||
|
# ";" (default) -- no argument
|
||||||
|
# ":" -- required argument
|
||||||
|
# "," -- optional argument
|
||||||
|
#
|
||||||
|
# For example, an option list "a b c help version f: file: separator."
|
||||||
|
# defines the following options:
|
||||||
|
# -a, -b, -c, --help, --version -- no argument
|
||||||
|
# -f, --file -- argument required
|
||||||
|
# --separator -- optional argument
|
||||||
|
#
|
||||||
|
# FUNCTION optlistex
|
||||||
|
# Usage new_style_optlist=`optlistex OLD_STYLE_OPTLIST`
|
||||||
|
#
|
||||||
|
# Converts getopts-style option list in a format suitable for use with getoptex
|
||||||
|
# Namely, it inserts spaces after each option name.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# HOW TO USE
|
||||||
|
#
|
||||||
|
# In order o use in your bash scripts the functions described,
|
||||||
|
# include a command ". getopt.sh" to the file containing the script,
|
||||||
|
# which will define functions getopt, getoptex, and optlistex
|
||||||
|
#
|
||||||
|
# EXAMPLES
|
||||||
|
#
|
||||||
|
# See files 'getopt1' and 'getopt2' that contain sample scripts that use
|
||||||
|
# getopt and getoptex functions respectively
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Please send your comments to grg@philol.msu.ru
|
||||||
|
|
||||||
|
function getoptex()
|
||||||
|
{
|
||||||
|
let $# || return 1
|
||||||
|
local optlist="${1#;}"
|
||||||
|
let OPTIND || OPTIND=1
|
||||||
|
[ $OPTIND -lt $# ] || return 1
|
||||||
|
shift $OPTIND
|
||||||
|
if [ "$1" != "-" -a "$1" != "${1#-}" ]
|
||||||
|
then OPTIND=$[OPTIND+1]; if [ "$1" != "--" ]
|
||||||
|
then
|
||||||
|
local o
|
||||||
|
o="-${1#-$OPTOFS}"
|
||||||
|
for opt in ${optlist#;}
|
||||||
|
do
|
||||||
|
OPTOPT="${opt%[;.:]}"
|
||||||
|
unset OPTARG
|
||||||
|
local opttype="${opt##*[^;:.]}"
|
||||||
|
[ -z "$opttype" ] && opttype=";"
|
||||||
|
if [ ${#OPTOPT} -gt 1 ]
|
||||||
|
then # long-named option
|
||||||
|
case $o in
|
||||||
|
"--$OPTOPT")
|
||||||
|
if [ "$opttype" != ":" ]; then return 0; fi
|
||||||
|
OPTARG="$2"
|
||||||
|
if [ -z "$OPTARG" ];
|
||||||
|
then # error: must have an agrument
|
||||||
|
let OPTERR && echo "$0: error: $OPTOPT must have an argument" >&2
|
||||||
|
OPTARG="$OPTOPT";
|
||||||
|
OPTOPT="?"
|
||||||
|
return 1;
|
||||||
|
fi
|
||||||
|
OPTIND=$[OPTIND+1] # skip option's argument
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
"--$OPTOPT="*)
|
||||||
|
if [ "$opttype" = ";" ];
|
||||||
|
then # error: must not have arguments
|
||||||
|
let OPTERR && echo "$0: error: $OPTOPT must not have arguments" >&2
|
||||||
|
OPTARG="$OPTOPT"
|
||||||
|
OPTOPT="?"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
OPTARG=${o#"--$OPTOPT="}
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
else # short-named option
|
||||||
|
case "$o" in
|
||||||
|
"-$OPTOPT")
|
||||||
|
unset OPTOFS
|
||||||
|
[ "$opttype" != ":" ] && return 0
|
||||||
|
OPTARG="$2"
|
||||||
|
if [ -z "$OPTARG" ]
|
||||||
|
then
|
||||||
|
echo "$0: error: -$OPTOPT must have an argument" >&2
|
||||||
|
OPTARG="$OPTOPT"
|
||||||
|
OPTOPT="?"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
OPTIND=$[OPTIND+1] # skip option's argument
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
"-$OPTOPT"*)
|
||||||
|
if [ $opttype = ";" ]
|
||||||
|
then # an option with no argument is in a chain of options
|
||||||
|
OPTOFS="$OPTOFS?" # move to the next option in the chain
|
||||||
|
OPTIND=$[OPTIND-1] # the chain still has other options
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
unset OPTOFS
|
||||||
|
OPTARG="${o#-$OPTOPT}"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "$0: error: invalid option: $o"
|
||||||
|
fi; fi
|
||||||
|
OPTOPT="?"
|
||||||
|
unset OPTARG
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
function optlistex
|
||||||
|
{
|
||||||
|
local l="$1"
|
||||||
|
local m # mask
|
||||||
|
local r # to store result
|
||||||
|
while [ ${#m} -lt $[${#l}-1] ]; do m="$m?"; done # create a "???..." mask
|
||||||
|
while [ -n "$l" ]
|
||||||
|
do
|
||||||
|
r="${r:+"$r "}${l%$m}" # append the first character of $l to $r
|
||||||
|
l="${l#?}" # cut the first charecter from $l
|
||||||
|
m="${m#?}" # cut one "?" sign from m
|
||||||
|
if [ -n "${l%%[^:.;]*}" ]
|
||||||
|
then # a special character (";", ".", or ":") was found
|
||||||
|
r="$r${l%$m}" # append it to $r
|
||||||
|
l="${l#?}" # cut the special character from l
|
||||||
|
m="${m#?}" # cut one more "?" sign
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo $r
|
||||||
|
}
|
||||||
|
function getopt()
|
||||||
|
{
|
||||||
|
local optlist=`optlistex "$1"`
|
||||||
|
shift
|
||||||
|
getoptex "$optlist" "$@"
|
||||||
|
return $?
|
||||||
|
}
|
||||||
|
|
||||||
|
#**************************************
|
||||||
|
# cut here
|
||||||
|
#**************************************
|
||||||
|
#*** (end of getopt.sh) ***
|
||||||
|
|
||||||
|
|
||||||
|
#*** file getopt1 ***
|
||||||
|
|
||||||
|
#! /bin/bash
|
||||||
|
# getopt1:
|
||||||
|
# Sample script using the function getopt
|
||||||
|
#
|
||||||
|
# Type something like "getopt1 -ab -d 10 -e20 text1 text2"
|
||||||
|
# on the command line to see how it works
|
||||||
|
#
|
||||||
|
# See getopt.sh for more information
|
||||||
|
#. getopt.sh
|
||||||
|
#echo Using getopt to parse arguments:
|
||||||
|
#while getopt "abcd:e." "$@"
|
||||||
|
#do
|
||||||
|
# echo "Option <$OPTOPT> ${OPTARG:+has an arg <$OPTARG>}"
|
||||||
|
#done
|
||||||
|
#shift $[OPTIND-1]
|
||||||
|
#for arg in "$@"
|
||||||
|
#do
|
||||||
|
# echo "Non option argument <$arg>"
|
||||||
|
#done
|
||||||
|
#
|
||||||
|
#**************************************
|
||||||
|
# cut here
|
||||||
|
#**************************************
|
||||||
|
#*** (end of getopt1) ***
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#*** file getopt2 ***
|
||||||
|
#
|
||||||
|
#! /bin/bash
|
||||||
|
# getopt2:
|
||||||
|
# Sample script using the function getoptex
|
||||||
|
#
|
||||||
|
# Type something like "getopt2 -ab -d 10 -e20 --opt1 --opt4=100 text1 text2"
|
||||||
|
# to see how it works
|
||||||
|
#
|
||||||
|
# See getopt.sh for more information
|
||||||
|
. getopt.sh
|
||||||
|
#echo Using getoptex to parse arguments:
|
||||||
|
#while getoptex "a; b; c; d: e. opt1 opt2 opt3 opt4: opt5." "$@"
|
||||||
|
#do
|
||||||
|
# echo "Option <$OPTOPT> ${OPTARG:+has an arg <$OPTARG>}"
|
||||||
|
#done
|
||||||
|
#shift $[OPTIND-1]
|
||||||
|
#for arg in "$@"
|
||||||
|
#do
|
||||||
|
# echo "Non option argument <$arg>"
|
||||||
|
#done
|
||||||
|
#
|
||||||
|
#**************************************
|
||||||
|
# cut here
|
||||||
|
#**************************************
|
||||||
|
#*** (end of getopt2) ***
|
||||||
|
|
||||||
|
|
44
examples/functions/inetaddr
Normal file
44
examples/functions/inetaddr
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
#
|
||||||
|
# inet2hex - Internet address conversion, dotted-decimal to hex
|
||||||
|
#
|
||||||
|
inet2hex ()
|
||||||
|
{
|
||||||
|
local IFS
|
||||||
|
|
||||||
|
IFS=.
|
||||||
|
set -- $1
|
||||||
|
|
||||||
|
if (( $# != 4 )); then
|
||||||
|
echo "inet2hex: incorrect input format: $1" >&2
|
||||||
|
echo "inet2hex: usage: inet2hex XX.XX.XX.XX" >&2
|
||||||
|
return 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf "0x%02x%02x%02x%02x\n" $1 $2 $3 $4
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# hex2inet - Internet address conversion, hex to dotted-decimal
|
||||||
|
#
|
||||||
|
hex2inet ()
|
||||||
|
{
|
||||||
|
local x1 x2 x3 x4
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
0x*) h=${1#??} ;;
|
||||||
|
*) h=$1 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if (( ${#h} != 8 )); then
|
||||||
|
echo "hex2inet: $h not in inet format" >&2
|
||||||
|
echo "hex2inet: usage: hex2inet [0x]XXXXXXXX" >&2
|
||||||
|
return 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
x1=$(( 0x${h:0:2} ))
|
||||||
|
x2=$(( 0x${h:2:2} ))
|
||||||
|
x3=$(( 0x${h:4:2} ))
|
||||||
|
x4=$(( 0x${h:6:2} ))
|
||||||
|
|
||||||
|
printf "%d.%d.%d.%d\n" $x1 $x2 $x3 $x4
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
inpath()
|
inpath()
|
||||||
{
|
{
|
||||||
|
local PROG
|
||||||
path=$(echo $PATH | sed 's/^:/.:/
|
path=$(echo $PATH | sed 's/^:/.:/
|
||||||
s/::/:.:/g
|
s/::/:.:/g
|
||||||
s/:$/:./
|
s/:$/:./
|
||||||
|
@ -9,7 +10,5 @@ inpath()
|
||||||
do
|
do
|
||||||
[ -x $x/$1 ] && { PROG=$x/$1; break; }
|
[ -x $x/$1 ] && { PROG=$x/$1; break; }
|
||||||
done
|
done
|
||||||
[ -z "$PROG" ]
|
[ -n "$PROG" ]
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
23
examples/functions/isnum.bash
Normal file
23
examples/functions/isnum.bash
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
#From: jrmartin@rainey.blueneptune.com (James R. Martin)
|
||||||
|
#Newsgroups: comp.unix.shell
|
||||||
|
#Subject: Re: testing user input on numeric or character value
|
||||||
|
#Date: 26 Nov 1997 01:28:43 GMT
|
||||||
|
|
||||||
|
# isnum returns True if its argument is a valid number,
|
||||||
|
# and False (retval=1) if it is any other string.
|
||||||
|
# The first pattern requires a digit before the decimal
|
||||||
|
# point, and the second after the decimal point.
|
||||||
|
|
||||||
|
# BASH NOTE: make sure you have executed `shopt -s extglob' before
|
||||||
|
# trying to use this function, or it will not work
|
||||||
|
|
||||||
|
function isnum # string
|
||||||
|
{
|
||||||
|
case $1 in
|
||||||
|
?([-+])+([0-9])?(.)*([0-9])?([Ee]?([-+])+([0-9])) )
|
||||||
|
return 0;;
|
||||||
|
?([-+])*([0-9])?(.)+([0-9])?([Ee]?([-+])+([0-9])) )
|
||||||
|
return 0;;
|
||||||
|
*) return 1;;
|
||||||
|
esac
|
||||||
|
}
|
22
examples/functions/isnum2
Normal file
22
examples/functions/isnum2
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
isnum2()
|
||||||
|
{
|
||||||
|
case "$1" in
|
||||||
|
'[-+]' | '') return 1;; # empty or bare `-' or `+'
|
||||||
|
[-+]*[!0-9]*) return 1;; # non-digit with leading sign
|
||||||
|
[-+]*) return 0;; # OK
|
||||||
|
*[!0-9]*) return 1;; # non-digit
|
||||||
|
*) return 0;; # OK
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
# this one handles floating point
|
||||||
|
isnum3()
|
||||||
|
{
|
||||||
|
case "$1" in
|
||||||
|
'') return 1;; # empty
|
||||||
|
*[!0-9.+-]*) return 1;; # non-digit, +, -, or .
|
||||||
|
*?[-+]*) return 1;; # sign as second or later char
|
||||||
|
*.*.*) return 1;; # multiple decimal points
|
||||||
|
*) return 0;; # OK
|
||||||
|
esac
|
||||||
|
}
|
78
examples/functions/jdate.bash
Normal file
78
examples/functions/jdate.bash
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
#From: damatex@CAM.ORG (Mario Boudreault)
|
||||||
|
#Newsgroups: comp.unix.shell
|
||||||
|
#Subject: JULIAN DATE CONVERSION SUB
|
||||||
|
#Date: 4 Aug 1995 10:23:28 -0400
|
||||||
|
#Message-ID: <3vtah0$jb3@ocean.CAM.ORG>
|
||||||
|
|
||||||
|
#For those using shells and who want to convert dates to a julian number
|
||||||
|
#here is a shell script (wihtout validation) that can be used as a base
|
||||||
|
#program for your shell scripts.
|
||||||
|
|
||||||
|
#Special thanks to Ed Ferguson@ti.com who sent me the algorithm to compute
|
||||||
|
#that date.
|
||||||
|
|
||||||
|
#
|
||||||
|
# MODIFIED BY CHET RAMEY TO CONVERT TO bash v2 SYNTAX
|
||||||
|
#
|
||||||
|
|
||||||
|
# cnvdate - Conversion de dates en julienne et vice et versa...
|
||||||
|
#
|
||||||
|
# Par : Mario Boudreault Damatex Inc Montreal, Canada
|
||||||
|
# Date: 2 Aout 1995
|
||||||
|
# Rev.: 2 Aout 1995
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
# cvdate [-j] YYYMMDD pour convertir en nbre de jours
|
||||||
|
# cvdate -d {julian number} pour convertir en AAAAMMJJ
|
||||||
|
#
|
||||||
|
|
||||||
|
jul_date()
|
||||||
|
{
|
||||||
|
#
|
||||||
|
# Separe ANNEE, MOIS et JOUR...
|
||||||
|
#
|
||||||
|
YEAR=`echo $DATE | awk ' { print substr($0,1,4) } '`
|
||||||
|
MONTH=`echo $DATE | awk ' { print substr($0,5,2) } '`
|
||||||
|
DAY=`echo $DATE | awk ' { print substr($0,7,2) } '`
|
||||||
|
#
|
||||||
|
# Execute la formule magique...
|
||||||
|
#
|
||||||
|
A=$(( $DAY - 32075 + 1461 * ( $YEAR + 4800 - ( 14 - $MONTH ) / 12 ) \
|
||||||
|
/ 4 + 367 * ( $MONTH - 2 + ( 14 - $MONTH ) / 12 * 12 ) / 12 - \
|
||||||
|
3 * ( ( $YEAR + 4900 - ( 14 - $MONTH ) / 12 ) / 100 ) / 4 ))
|
||||||
|
echo $A
|
||||||
|
}
|
||||||
|
|
||||||
|
day_date()
|
||||||
|
{
|
||||||
|
TEMP1=$(( $DATE + 68569 ))
|
||||||
|
TEMP2=$(( 4 * $TEMP1 / 146097 ))
|
||||||
|
TEMP1=$(( $TEMP1 - ( 146097 * $TEMP2 + 3 ) / 4 ))
|
||||||
|
Y=$(( 4000 * ( $TEMP1 + 1 ) / 1461001 ))
|
||||||
|
TEMP1=$(( $TEMP1 - 1461 * $Y / 4 + 31 ))
|
||||||
|
M=$(( 80 * $TEMP1 / 2447 ))
|
||||||
|
D=$(( $TEMP1 - 2447 * $M / 80 ))
|
||||||
|
TEMP1=$(( $M / 11 ))
|
||||||
|
M=$(( $M + 2 - 12 * $TEMP1 ))
|
||||||
|
Y=$(( 100 * ( $TEMP2 - 49 ) + $Y + $TEMP1 ))
|
||||||
|
M=`echo $M | awk ' { M=$0 ; if ( length($0) == 1 ) M="0"$0 } END { print M } '`
|
||||||
|
D=`echo $D | awk ' { D=$0 ; if ( length($0) == 1 ) D="0"$0 } END { print D } '`
|
||||||
|
echo $Y$M$D
|
||||||
|
}
|
||||||
|
|
||||||
|
# main()
|
||||||
|
|
||||||
|
if [ $# -eq 1 ]; then
|
||||||
|
DATE=$1
|
||||||
|
jul_date
|
||||||
|
elif [ "$1" = '-j' ]; then
|
||||||
|
DATE=$2
|
||||||
|
jul_date
|
||||||
|
elif [ "$1" = '-d' ]; then
|
||||||
|
DATE=$2
|
||||||
|
day_date
|
||||||
|
fi
|
||||||
|
#
|
||||||
|
# Termine
|
||||||
|
#
|
||||||
|
exit 0
|
48
examples/functions/pathfuncs
Normal file
48
examples/functions/pathfuncs
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
#From: "Simon J. Gerraty" <sjg@zen.void.oz.au>
|
||||||
|
#Message-Id: <199510091130.VAA01188@zen.void.oz.au>
|
||||||
|
#Subject: Re: a shell idea?
|
||||||
|
#Date: Mon, 09 Oct 1995 21:30:20 +1000
|
||||||
|
|
||||||
|
|
||||||
|
# NAME:
|
||||||
|
# add_path.sh - add dir to path
|
||||||
|
#
|
||||||
|
# DESCRIPTION:
|
||||||
|
# These functions originated in /etc/profile and ksh.kshrc, but
|
||||||
|
# are more useful in a separate file.
|
||||||
|
#
|
||||||
|
# SEE ALSO:
|
||||||
|
# /etc/profile
|
||||||
|
#
|
||||||
|
# AUTHOR:
|
||||||
|
# Simon J. Gerraty <sjg@zen.void.oz.au>
|
||||||
|
|
||||||
|
# RCSid:
|
||||||
|
# $Id: add_path.sh,v 1.1 1995/09/30 12:45:23 sjg Exp $
|
||||||
|
#
|
||||||
|
# @(#)Copyright (c) 1991 Simon J. Gerraty
|
||||||
|
#
|
||||||
|
# This file is provided in the hope that it will
|
||||||
|
# be of use. There is absolutely NO WARRANTY.
|
||||||
|
# Permission to copy, redistribute or otherwise
|
||||||
|
# use this file is hereby granted provided that
|
||||||
|
# the above copyright notice and this notice are
|
||||||
|
# left intact.
|
||||||
|
|
||||||
|
# is $1 missing from $2 (or PATH) ?
|
||||||
|
no_path() {
|
||||||
|
eval "case :\$${2-PATH}: in *:$1:*) return 1;; *) return 0;; esac"
|
||||||
|
}
|
||||||
|
# if $1 exists and is not in path, append it
|
||||||
|
add_path () {
|
||||||
|
[ -d ${1:-.} ] && no_path $* && eval ${2:-PATH}="\$${2:-PATH}:$1"
|
||||||
|
}
|
||||||
|
# if $1 exists and is not in path, prepend it
|
||||||
|
pre_path () {
|
||||||
|
[ -d ${1:-.} ] && no_path $* && eval ${2:-PATH}="$1:\$${2:-PATH}"
|
||||||
|
}
|
||||||
|
# if $1 is in path, remove it
|
||||||
|
del_path () {
|
||||||
|
no_path $* || eval ${2:-PATH}=`eval echo :'$'${2:-PATH}: |
|
||||||
|
sed -e "s;:$1:;:;g" -e "s;^:;;" -e "s;:\$;;"`
|
||||||
|
}
|
19
examples/functions/shcat2
Normal file
19
examples/functions/shcat2
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
shcat()
|
||||||
|
{
|
||||||
|
while read -r line
|
||||||
|
do
|
||||||
|
echo "$line"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
shcat2()
|
||||||
|
{
|
||||||
|
while [ $# -ge 1 ]; do
|
||||||
|
case "$1" in
|
||||||
|
-) shcat ;;
|
||||||
|
*) shcat < "$1" ;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
exit 0
|
||||||
|
}
|
|
@ -1,41 +1,64 @@
|
||||||
#
|
#
|
||||||
# Simple makefile for the sample loadable builtins
|
# Simple makefile for the sample loadable builtins
|
||||||
#
|
#
|
||||||
CC = cc
|
# This includes some boilerplate definitions added by configure, but will
|
||||||
|
# still need hand-editing
|
||||||
|
#
|
||||||
|
# Include some boilerplate Gnu makefile definitions.
|
||||||
|
prefix = @prefix@
|
||||||
|
|
||||||
|
exec_prefix = @exec_prefix@
|
||||||
|
bindir = @bindir@
|
||||||
|
libdir = @libdir@
|
||||||
|
infodir = @infodir@
|
||||||
|
includedir = @includedir@
|
||||||
|
|
||||||
|
topdir = @top_srcdir@
|
||||||
|
BUILD_DIR = @BUILD_DIR@
|
||||||
|
srcdir = @srcdir@
|
||||||
|
VPATH = .:@srcdir@
|
||||||
|
|
||||||
|
@SET_MAKE@
|
||||||
|
CC = @CC@
|
||||||
|
RM = rm -f
|
||||||
|
|
||||||
|
SHELL = /bin/sh
|
||||||
|
|
||||||
# SunOS 4
|
# SunOS 4
|
||||||
PICFLAG = -pic
|
#PICFLAG = -pic
|
||||||
# Some versions of gcc, esp. on NetBSD and FreeBSD
|
# Some versions of gcc, esp. on NetBSD and FreeBSD
|
||||||
#PICFLAG = -fpic
|
PICFLAG = -fpic
|
||||||
# Linux -- could also be -fpic
|
# Linux -- could also be -fpic
|
||||||
#PICFLAG = -fPIC
|
#PICFLAG = -fPIC
|
||||||
# SunOS 5
|
# SunOS 5
|
||||||
#PICFLAG = -K pic
|
#PICFLAG = -K pic
|
||||||
# SVR4, SVR4.2, Irix
|
# SVR4, SVR4.2, Irix
|
||||||
#PICFLAG = -K PIC
|
#PICFLAG = -K PIC
|
||||||
# BSD/OS 2.1
|
# BSD/OS 2.1, BSD/OS 3.x
|
||||||
#PICFLAG =
|
#PICFLAG =
|
||||||
# AIX 4.2
|
# AIX 4.2
|
||||||
#PICFLAG = -K
|
#PICFLAG = -K
|
||||||
|
|
||||||
# SunOS 4, BSD/OS 2.1, SVR4.2, SVR4, Linux, AIX 4.2, etc.
|
# SunOS 4, BSD/OS 2.1, BSD/OS 3.x, SVR4.2, SVR4, Linux, AIX 4.2, etc.
|
||||||
LD = ld
|
LD = ld
|
||||||
# SunOS 5, Linux
|
# SunOS 5, Linux
|
||||||
#LD = cc
|
#LD = ${CC}
|
||||||
|
|
||||||
# SunOS 4
|
# SunOS 4
|
||||||
LDOPT = -assert pure-text
|
#LDOPT = -assert pure-text
|
||||||
# OSF/1, Digital UNIX
|
# OSF/1, Digital UNIX
|
||||||
#LDOPT = -shared -soname $@ -expect_unresolved '*'
|
#LDOPT = -shared -soname $@ -expect_unresolved '*'
|
||||||
# SunOS 5
|
# SunOS 5 using sun cc
|
||||||
#LDOPT = -dy -z text -G -i -h $@
|
#LDOPT = -dy -z text -G -i -h $@
|
||||||
|
# SunOS 5 using gcc with Sun ld
|
||||||
|
#LDOPT = -shared -Wl,-dy -Wl,-G -Wl,-i
|
||||||
# SVR4, SVR4.2
|
# SVR4, SVR4.2
|
||||||
#LDOPT = -dy -z text -G -h $@
|
#LDOPT = -dy -z text -G -h $@
|
||||||
# NetBSD, FreeBSD -- might also need -r
|
# NetBSD, FreeBSD -- might also need -r
|
||||||
#LDOPT = -x -Bshareable
|
LDOPT = -x -Bshareable
|
||||||
# Linux
|
# Linux
|
||||||
#LDOPT = -shared
|
#LDOPT = -shared
|
||||||
# BSD/OS 2.1
|
# BSD/OS 2.1, BSD/OS 3.x
|
||||||
#LDOPT = -r
|
#LDOPT = -r
|
||||||
# AIX 4.2
|
# AIX 4.2
|
||||||
#LDOPT = -bdynamic -bnoentry -bexpall -G
|
#LDOPT = -bdynamic -bnoentry -bexpall -G
|
||||||
|
@ -43,19 +66,25 @@ LDOPT = -assert pure-text
|
||||||
# other libraries to link the shared object against
|
# other libraries to link the shared object against
|
||||||
# BSD/OS 2.1
|
# BSD/OS 2.1
|
||||||
#LDLIBS = -lc_s.2.1.0
|
#LDLIBS = -lc_s.2.1.0
|
||||||
|
# BSD/OS 3.0, BSD/OS 3.1
|
||||||
|
#LDLIBS = -lc_s.3.0.0
|
||||||
|
|
||||||
srcdir = ../..
|
|
||||||
INC= -I$(srcdir) -I$(srcdir)/builtins -I$(srcdir)/lib
|
INC = -I. -I.. -I$(topdir) -I$(topdir)/lib -I$(topdir)/builtins \
|
||||||
|
-I$(BUILD_DIR) -I$(BUILD_DIR)/lib -I$(BUILD_DIR)/builtins
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
$(CC) $(PICFLAG) $(CFLAGS) $(INC) -c -o $@ $<
|
$(CC) $(PICFLAG) $(CFLAGS) $(INC) -c -o $@ $<
|
||||||
|
|
||||||
all: printf print truefalse sleep pushd finfo logname basename dirname \
|
|
||||||
tty pathchk tee head rmdir sprintf
|
|
||||||
others: necho getconf hello cat
|
|
||||||
|
|
||||||
printf: printf.o
|
ALLPROG = print truefalse sleep pushd finfo logname basename dirname \
|
||||||
$(LD) $(LDOPT) -o $@ printf.o $(LDLIBS)
|
tty pathchk tee head rmdir sprintf
|
||||||
|
OTHERPROG = necho getconf hello cat
|
||||||
|
|
||||||
|
all: $(ALLPROG)
|
||||||
|
others: $(OTHERPROG)
|
||||||
|
|
||||||
|
everything: all others
|
||||||
|
|
||||||
sprintf: sprintf.o
|
sprintf: sprintf.o
|
||||||
$(LD) $(LDOPT) -o $@ sprintf.o $(LDLIBS)
|
$(LD) $(LDOPT) -o $@ sprintf.o $(LDLIBS)
|
||||||
|
@ -110,3 +139,31 @@ rmdir: rmdir.o
|
||||||
|
|
||||||
head: head.o
|
head: head.o
|
||||||
$(LD) $(LDOPT) -o $@ head.o $(LDLIBS)
|
$(LD) $(LDOPT) -o $@ head.o $(LDLIBS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(RM) $(ALLPROG) $(OTHERPROG) *.o
|
||||||
|
|
||||||
|
mostlyclean: clean
|
||||||
|
|
||||||
|
distclean maintainer-clean: clean
|
||||||
|
$(RM) Makefile
|
||||||
|
|
||||||
|
print.o: print.c
|
||||||
|
truefalse.o: truefalse.c
|
||||||
|
sleep.o: sleep.c
|
||||||
|
pushd.o: pushd.c
|
||||||
|
finfo.o: finfo.c
|
||||||
|
logname.o: logname.c
|
||||||
|
basename.o: basename.c
|
||||||
|
dirname.o: dirname.c
|
||||||
|
tty.o: tty.c
|
||||||
|
pathchk.o: pathchk.c
|
||||||
|
tee.o: tee.c
|
||||||
|
head.o: head.c
|
||||||
|
rmdir.o: rmdir.c
|
||||||
|
sprintf.o: sprintf.c
|
||||||
|
necho.o: necho.c
|
||||||
|
getconf.o: getconf.c
|
||||||
|
hello.o: hello.c
|
||||||
|
cat.o: cat.c
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
/*
|
/*
|
||||||
|
* ORIGINAL COPYRIGHT STATEMENT:
|
||||||
|
*
|
||||||
* Copyright (c) 1994 Winning Strategies, Inc.
|
* Copyright (c) 1994 Winning Strategies, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
|
@ -31,14 +33,13 @@
|
||||||
/*
|
/*
|
||||||
* POSIX.2 getconf utility
|
* POSIX.2 getconf utility
|
||||||
*
|
*
|
||||||
* Written by:
|
* Originally Written by:
|
||||||
* J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
|
* J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
|
||||||
|
*
|
||||||
|
* Heavily modified for inclusion in bash by
|
||||||
|
* Chet Ramey <chet@po.cwru.edu>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
|
||||||
static char rcsid[] = "$Id: getconf.c,v 1.2 1994/05/10 00:04:12 jtc Exp $";
|
|
||||||
#endif /* not lint */
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
@ -48,7 +49,8 @@ static char rcsid[] = "$Id: getconf.c,v 1.2 1994/05/10 00:04:12 jtc Exp $";
|
||||||
#include "shell.h"
|
#include "shell.h"
|
||||||
#include "builtins.h"
|
#include "builtins.h"
|
||||||
#include "stdc.h"
|
#include "stdc.h"
|
||||||
|
#include "common.h"
|
||||||
|
#include "bashgetopt.h"
|
||||||
|
|
||||||
struct conf_variable
|
struct conf_variable
|
||||||
{
|
{
|
||||||
|
@ -57,25 +59,66 @@ struct conf_variable
|
||||||
long value;
|
long value;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* BSD/OS does not define this; use Posix.2 recommended minimum value. */
|
/* Some systems do not define these; use POSIX.2 minimum recommended values. */
|
||||||
#ifndef _POSIX2_COLL_WEIGHTS_MAX
|
#ifndef _POSIX2_COLL_WEIGHTS_MAX
|
||||||
#define _POSIX2_COLL_WEIGHTS_MAX 2
|
# define _POSIX2_COLL_WEIGHTS_MAX 2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const struct conf_variable conf_table[] =
|
static const struct conf_variable conf_table[] =
|
||||||
{
|
{
|
||||||
|
/* POSIX.2 Configurable Variable Values */
|
||||||
{ "PATH", CONFSTR, _CS_PATH },
|
{ "PATH", CONFSTR, _CS_PATH },
|
||||||
|
{ "CS_PATH", CONFSTR, _CS_PATH },
|
||||||
|
|
||||||
/* Utility Limit Minimum Values */
|
/* POSIX.1 Configurable Variable Values (only Solaris?) */
|
||||||
|
#if defined (_CS_LFS_CFLAGS)
|
||||||
|
{ "LFS_CFLAGS", CONFSTR, _CS_LFS_CFLAGS },
|
||||||
|
{ "LFS_LDFLAGS", CONFSTR, _CS_LFS_LDFLAGS },
|
||||||
|
{ "LFS_LIBS", CONFSTR, _CS_LFS_LIBS },
|
||||||
|
{ "LFS_LINTFLAGS", CONFSTR, _CS_LFS_LINTFLAGS },
|
||||||
|
#endif
|
||||||
|
#if defined (_CS_LFS64_CFLAGS)
|
||||||
|
{ "LFS64_CFLAGS", CONFSTR, _CS_LFS64_CFLAGS },
|
||||||
|
{ "LFS64_LDFLAGS", CONFSTR, _CS_LFS64_LDFLAGS },
|
||||||
|
{ "LFS64_LIBS", CONFSTR, _CS_LFS64_LIBS },
|
||||||
|
{ "LFS64_LINTFLAGS", CONFSTR, _CS_LFS64_LINTFLAGS },
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Single UNIX Specification version 2 Configurable Variable Values */
|
||||||
|
#if defined (_CS_XBS5_ILP32_OFF32_CFLAGS)
|
||||||
|
{ "XBS5_ILP32_OFF32_CFLAGS", CONFSTR, _CS_XBS5_ILP32_OFF32_CFLAGS },
|
||||||
|
{ "XBS5_ILP32_OFF32_LDFLAGS", CONFSTR, _CS_XBS5_ILP32_OFF32_LDFLAGS },
|
||||||
|
{ "XBS5_ILP32_OFF32_LIBS", CONFSTR, _CS_XBS5_ILP32_OFF32_LIBS },
|
||||||
|
{ "XBS5_ILP32_OFF32_LINTFLAGS", CONFSTR, _CS_XBS5_ILP32_OFF32_LINTFLAGS },
|
||||||
|
{ "XBS5_ILP32_OFFBIG_CFLAGS", CONFSTR, _CS_XBS5_ILP32_OFFBIG_CFLAGS },
|
||||||
|
{ "XBS5_ILP32_OFFBIG_LDFLAGS", CONFSTR, _CS_XBS5_ILP32_OFFBIG_LDFLAGS },
|
||||||
|
{ "XBS5_ILP32_OFFBIG_LIBS", CONFSTR, _CS_XBS5_ILP32_OFFBIG_LIBS },
|
||||||
|
{ "XBS5_ILP32_OFFBIG_LINTFLAGS", CONFSTR, _CS_XBS5_ILP32_OFFBIG_LINTFLAGS },
|
||||||
|
{ "XBS5_LP64_OFF64_CFLAGS", CONFSTR, _CS_XBS5_LP64_OFF64_CFLAGS },
|
||||||
|
{ "XBS5_LP64_OFF64_LDFLAGS", CONFSTR, _CS_XBS5_LP64_OFF64_LDFLAGS },
|
||||||
|
{ "XBS5_LP64_OFF64_LIBS", CONFSTR, _CS_XBS5_LP64_OFF64_LIBS },
|
||||||
|
{ "XBS5_LP64_OFF64_LINTFLAGS", CONFSTR, _CS_XBS5_LP64_OFF64_LINTFLAGS },
|
||||||
|
{ "XBS5_LPBIG_OFFBIG_CFLAGS", CONFSTR, _CS_XBS5_LPBIG_OFFBIG_CFLAGS },
|
||||||
|
{ "XBS5_LPBIG_OFFBIG_LDFLAGS", CONFSTR, _CS_XBS5_LPBIG_OFFBIG_LDFLAGS },
|
||||||
|
{ "XBS5_LPBIG_OFFBIG_LIBS", CONFSTR, _CS_XBS5_LPBIG_OFFBIG_LIBS },
|
||||||
|
{ "XBS5_LPBIG_OFFBIG_LINTFLAGS", CONFSTR, _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS },
|
||||||
|
#endif /* _CS_XBS5_ILP32_OFF32_CFLAGS */
|
||||||
|
|
||||||
|
/* POSIX.2 Utility Limit Minimum Values */
|
||||||
{ "POSIX2_BC_BASE_MAX", CONSTANT, _POSIX2_BC_BASE_MAX },
|
{ "POSIX2_BC_BASE_MAX", CONSTANT, _POSIX2_BC_BASE_MAX },
|
||||||
{ "POSIX2_BC_DIM_MAX", CONSTANT, _POSIX2_BC_DIM_MAX },
|
{ "POSIX2_BC_DIM_MAX", CONSTANT, _POSIX2_BC_DIM_MAX },
|
||||||
{ "POSIX2_BC_SCALE_MAX", CONSTANT, _POSIX2_BC_SCALE_MAX },
|
{ "POSIX2_BC_SCALE_MAX", CONSTANT, _POSIX2_BC_SCALE_MAX },
|
||||||
{ "POSIX2_BC_STRING_MAX", CONSTANT, _POSIX2_BC_STRING_MAX },
|
{ "POSIX2_BC_STRING_MAX", CONSTANT, _POSIX2_BC_STRING_MAX },
|
||||||
{ "POSIX2_COLL_WEIGHTS_MAX", CONSTANT, _POSIX2_COLL_WEIGHTS_MAX },
|
{ "POSIX2_COLL_WEIGHTS_MAX", CONSTANT, _POSIX2_COLL_WEIGHTS_MAX },
|
||||||
|
#if defined (_POSIX2_EQUIV_CLASS_MAX)
|
||||||
|
{ "POSIX2_EQUIV_CLASS_MAX", CONSTANT, _POSIX2_EQUIV_CLASS_MAX },
|
||||||
|
#endif
|
||||||
{ "POSIX2_EXPR_NEST_MAX", CONSTANT, _POSIX2_EXPR_NEST_MAX },
|
{ "POSIX2_EXPR_NEST_MAX", CONSTANT, _POSIX2_EXPR_NEST_MAX },
|
||||||
{ "POSIX2_LINE_MAX", CONSTANT, _POSIX2_LINE_MAX },
|
{ "POSIX2_LINE_MAX", CONSTANT, _POSIX2_LINE_MAX },
|
||||||
{ "POSIX2_RE_DUP_MAX", CONSTANT, _POSIX2_RE_DUP_MAX },
|
{ "POSIX2_RE_DUP_MAX", CONSTANT, _POSIX2_RE_DUP_MAX },
|
||||||
|
#if defined (_POSIX2_VERSION)
|
||||||
{ "POSIX2_VERSION", CONSTANT, _POSIX2_VERSION },
|
{ "POSIX2_VERSION", CONSTANT, _POSIX2_VERSION },
|
||||||
|
#endif
|
||||||
|
|
||||||
/* POSIX.1 Minimum Values */
|
/* POSIX.1 Minimum Values */
|
||||||
{ "_POSIX_ARG_MAX", CONSTANT, _POSIX_ARG_MAX },
|
{ "_POSIX_ARG_MAX", CONSTANT, _POSIX_ARG_MAX },
|
||||||
|
@ -92,7 +135,7 @@ static const struct conf_variable conf_table[] =
|
||||||
{ "_POSIX_STREAM_MAX", CONSTANT, _POSIX_STREAM_MAX },
|
{ "_POSIX_STREAM_MAX", CONSTANT, _POSIX_STREAM_MAX },
|
||||||
{ "_POSIX_TZNAME_MAX", CONSTANT, _POSIX_TZNAME_MAX },
|
{ "_POSIX_TZNAME_MAX", CONSTANT, _POSIX_TZNAME_MAX },
|
||||||
|
|
||||||
/* Symbolic Utility Limits */
|
/* POSIX.2 Symbolic Utility Limits */
|
||||||
{ "BC_BASE_MAX", SYSCONF, _SC_BC_BASE_MAX },
|
{ "BC_BASE_MAX", SYSCONF, _SC_BC_BASE_MAX },
|
||||||
{ "BC_DIM_MAX", SYSCONF, _SC_BC_DIM_MAX },
|
{ "BC_DIM_MAX", SYSCONF, _SC_BC_DIM_MAX },
|
||||||
{ "BC_SCALE_MAX", SYSCONF, _SC_BC_SCALE_MAX },
|
{ "BC_SCALE_MAX", SYSCONF, _SC_BC_SCALE_MAX },
|
||||||
|
@ -102,15 +145,25 @@ static const struct conf_variable conf_table[] =
|
||||||
{ "LINE_MAX", SYSCONF, _SC_LINE_MAX },
|
{ "LINE_MAX", SYSCONF, _SC_LINE_MAX },
|
||||||
{ "RE_DUP_MAX", SYSCONF, _SC_RE_DUP_MAX },
|
{ "RE_DUP_MAX", SYSCONF, _SC_RE_DUP_MAX },
|
||||||
|
|
||||||
/* Optional Facility Configuration Values */
|
/* POSIX.2 Optional Facility Configuration Values */
|
||||||
{ "POSIX2_C_BIND", SYSCONF, _SC_2_C_BIND },
|
{ "POSIX2_C_BIND", SYSCONF, _SC_2_C_BIND },
|
||||||
{ "POSIX2_C_DEV", SYSCONF, _SC_2_C_DEV },
|
{ "POSIX2_C_DEV", SYSCONF, _SC_2_C_DEV },
|
||||||
|
#if defined (_SC_2_C_VERSION)
|
||||||
|
{ "POSIX2_C_VERSION", SYSCONF, _SC_2_C_VERSION },
|
||||||
|
#endif
|
||||||
|
#if defined (_SC_2_CHAR_TERM)
|
||||||
{ "POSIX2_CHAR_TERM", SYSCONF, _SC_2_CHAR_TERM },
|
{ "POSIX2_CHAR_TERM", SYSCONF, _SC_2_CHAR_TERM },
|
||||||
|
#endif
|
||||||
{ "POSIX2_FORT_DEV", SYSCONF, _SC_2_FORT_DEV },
|
{ "POSIX2_FORT_DEV", SYSCONF, _SC_2_FORT_DEV },
|
||||||
{ "POSIX2_FORT_RUN", SYSCONF, _SC_2_FORT_RUN },
|
{ "POSIX2_FORT_RUN", SYSCONF, _SC_2_FORT_RUN },
|
||||||
{ "POSIX2_LOCALEDEF", SYSCONF, _SC_2_LOCALEDEF },
|
{ "POSIX2_LOCALEDEF", SYSCONF, _SC_2_LOCALEDEF },
|
||||||
{ "POSIX2_SW_DEV", SYSCONF, _SC_2_SW_DEV },
|
{ "POSIX2_SW_DEV", SYSCONF, _SC_2_SW_DEV },
|
||||||
|
#if defined (_SC2_UPE)
|
||||||
{ "POSIX2_UPE", SYSCONF, _SC_2_UPE },
|
{ "POSIX2_UPE", SYSCONF, _SC_2_UPE },
|
||||||
|
#endif
|
||||||
|
#if !defined (_POSIX2_VERSION) && defined (_SC_2_VERSION)
|
||||||
|
{ "POSIX2_VERSION" SYSCONF, _SC_2_VERSION },
|
||||||
|
#endif
|
||||||
|
|
||||||
/* POSIX.1 Configurable System Variables */
|
/* POSIX.1 Configurable System Variables */
|
||||||
{ "ARG_MAX", SYSCONF, _SC_ARG_MAX },
|
{ "ARG_MAX", SYSCONF, _SC_ARG_MAX },
|
||||||
|
@ -124,6 +177,140 @@ static const struct conf_variable conf_table[] =
|
||||||
{ "_POSIX_SAVED_IDS", SYSCONF, _SC_SAVED_IDS },
|
{ "_POSIX_SAVED_IDS", SYSCONF, _SC_SAVED_IDS },
|
||||||
{ "_POSIX_VERSION", SYSCONF, _SC_VERSION },
|
{ "_POSIX_VERSION", SYSCONF, _SC_VERSION },
|
||||||
|
|
||||||
|
/* POSIX.1 Optional Facility Configuration Values */
|
||||||
|
#if defined (_SC_ASYNCHRONOUS_IO)
|
||||||
|
{ "_POSIX_ASYNCHRONOUS_IO", SYSCONF, _SC_ASYNCHRONOUS_IO },
|
||||||
|
#endif
|
||||||
|
#if defined (_SC_FSYNC)
|
||||||
|
{ "_POSIX_FSYNC", SYSCONF, _SC_FSYNC },
|
||||||
|
#endif
|
||||||
|
#if defined (_SC_MAPPED_FILES)
|
||||||
|
{ "_POSIX_MAPPED_FILES", SYSCONF, _SC_MAPPED_FILES },
|
||||||
|
#endif
|
||||||
|
#if defined (_SC_MEMLOCK)
|
||||||
|
{ "_POSIX_MEMLOCK", SYSCONF, _SC_MEMLOCK },
|
||||||
|
#endif
|
||||||
|
#if defined (_SC_MEMLOCK_RANGE)
|
||||||
|
{ "_POSIX_MEMLOCK_RANGE", SYSCONF, _SC_MEMLOCK_RANGE },
|
||||||
|
#endif
|
||||||
|
#if defined (_SC_MEMORY_PROTECTION)
|
||||||
|
{ "_POSIX_MEMORY_PROTECTION", SYSCONF, _SC_MEMORY_PROTECTION },
|
||||||
|
#endif
|
||||||
|
#if defined (_SC_MESSAGE_PASSING)
|
||||||
|
{ "_POSIX_MESSAGE_PASSING", SYSCONF, _SC_MESSAGE_PASSING },
|
||||||
|
#endif
|
||||||
|
#if defined (SC_PRIORITIZED_IO)
|
||||||
|
{ "_POSIX_PRIORITIZED_IO", SYSCONF, _SC_PRIORITIZED_IO },
|
||||||
|
#endif
|
||||||
|
#if defined (_SC_PRIORITY_SCHEDULING)
|
||||||
|
{ "_POSIX_PRIORITY_SCHEDULING", SYSCONF, _SC_PRIORITY_SCHEDULING },
|
||||||
|
#endif
|
||||||
|
#if defined (_SC_REALTIME_SIGNALS)
|
||||||
|
{ "_POSIX_REALTIME_SIGNALS", SYSCONF, _SC_REALTIME_SIGNALS },
|
||||||
|
#endif
|
||||||
|
#if defined (_SC_SEMAPHORES)
|
||||||
|
{ "_POSIX_SEMAPHORES", SYSCONF, _SC_SEMAPHORES },
|
||||||
|
#endif
|
||||||
|
#if defined (_SC_SHARED_MEMORY_OBJECTS)
|
||||||
|
{ "_POSIX_SHARED_MEMORY_OBJECTS", SYSCONF, _SC_SHARED_MEMORY_OBJECTS },
|
||||||
|
#endif
|
||||||
|
#if defined (_SC_SYNCHRONIZED_IO)
|
||||||
|
{ "_POSIX_SYNCHRONIZED_IO", SYSCONF, _SC_SYNCHRONIZED_IO },
|
||||||
|
#endif
|
||||||
|
#if defined (_SC_TIMERS)
|
||||||
|
{ "_POSIX_TIMERS", SYSCONF, _SC_TIMERS },
|
||||||
|
#endif
|
||||||
|
#if defined (_SC_THREADS)
|
||||||
|
{ "_POSIX_THREADS", SYSCONF, _SC_THREADS },
|
||||||
|
{ "_POSIX_THREAD_ATTR_STACKADDR", SYSCONF, _SC_THREAD_ATTR_STACKADDR },
|
||||||
|
{ "_POSIX_THREAD_ATTR_STACKSIZE", SYSCONF, _SC_THREAD_ATTR_STACKSIZE },
|
||||||
|
{ "_POSIX_THREAD_PRIORITY_SCHEDULING", SYSCONF, _SC_THREAD_PRIORITY_SCHEDULING },
|
||||||
|
{ "_POSIX_THREAD_PRIO_INHERIT", SYSCONF, _SC_THREAD_PRIO_INHERIT },
|
||||||
|
{ "_POSIX_THREAD_PRIO_PROTECT", SYSCONF, _SC_THREAD_PRIO_PROTECT },
|
||||||
|
{ "_POSIX_THREAD_PROCESS_SHARED", SYSCONF, _SC_THREAD_PROCESS_SHARED },
|
||||||
|
# if defined (_SC_THREAD_SAFE_FUNCTIONS)
|
||||||
|
{ "_POSIX_THREAD_SAFE_FUNCTIONS", SYSCONF, _SC_THREAD_SAFE_FUNCTIONS },
|
||||||
|
# endif
|
||||||
|
#endif /* _SC_THREADS */
|
||||||
|
|
||||||
|
/* XPG 4.2 Configurable System Variables. */
|
||||||
|
#if defined (_SC_ATEXIT_MAX)
|
||||||
|
{ "ATEXIT_MAX", SYSCONF, _SC_ATEXIT_MAX },
|
||||||
|
#endif
|
||||||
|
#if defined (_SC_IOV_MAX)
|
||||||
|
{ "IOV_MAX", SYSCONF, _SC_IOV_MAX },
|
||||||
|
#endif
|
||||||
|
#if defined (_SC_PAGESIZE)
|
||||||
|
{ "PAGESIZE", SYSCONF, _SC_PAGESIZE },
|
||||||
|
#endif
|
||||||
|
#if defined (_SC_PAGE_SIZE)
|
||||||
|
{ "PAGE_SIZE", SYSCONF, _SC_PAGE_SIZE },
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined (_SC_AIO_LISTIO_MAX)
|
||||||
|
{ "AIO_LISTIO_MAX", SYSCONF, _SC_AIO_LISTIO_MAX },
|
||||||
|
{ "AIO_MAX", SYSCONF, _SC_AIO_MAX },
|
||||||
|
{ "AIO_PRIO_DELTA_MAX", SYSCONF, _SC_AIO_PRIO_DELTA_MAX },
|
||||||
|
{ "DELAYTIMER_MAX", SYSCONF, _SC_DELAYTIMER_MAX },
|
||||||
|
#if defined (_SC_GETGR_R_SIZE_MAX)
|
||||||
|
{ "GETGR_R_SIZE_MAX", SYSCONF, _SC_GETGR_R_SIZE_MAX },
|
||||||
|
#endif
|
||||||
|
#if defined (_SC_GETPW_R_SIZE_MAX)
|
||||||
|
{ "GETPW_R_SIZE_MAX", SYSCONF, _SC_GETPW_R_SIZE_MAX },
|
||||||
|
#endif
|
||||||
|
{ "MQ_OPEN_MAX", SYSCONF, _SC_MQ_OPEN_MAX },
|
||||||
|
{ "MQ_PRIO_MAX", SYSCONF, _SC_MQ_PRIO_MAX },
|
||||||
|
{ "RTSIG_MAX", SYSCONF, _SC_RTSIG_MAX },
|
||||||
|
{ "SEM_NSEMS_MAX", SYSCONF, _SC_SEM_NSEMS_MAX },
|
||||||
|
{ "SEM_VALUE_MAX", SYSCONF, _SC_SEM_VALUE_MAX },
|
||||||
|
{ "SIGQUEUE_MAX", SYSCONF, _SC_SIGQUEUE_MAX },
|
||||||
|
{ "TIMER_MAX", SYSCONF, _SC_TIMER_MAX },
|
||||||
|
#endif /* _SC_AIO_LISTIO_MAX */
|
||||||
|
#if defined (_SC_LOGIN_NAME_MAX)
|
||||||
|
{ "LOGIN_NAME_MAX", SYSCONF, _SC_LOGIN_NAME_MAX },
|
||||||
|
#endif
|
||||||
|
#if defined (_SC_LOGNAME_MAX)
|
||||||
|
{ "LOGNAME_MAX", SYSCONF, _SC_LOGNAME_MAX },
|
||||||
|
#endif
|
||||||
|
#if defined (_SC_TTY_NAME_MAX)
|
||||||
|
{ "TTY_NAME_MAX", SYSCONF, _SC_TTY_NAME_MAX },
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined (_SC_PTHREAD_DESTRUCTOR_ITERATIONS)
|
||||||
|
{ "PTHREAD_DESTRUCTOR_ITERATIONS", SYSCONF, _SC_THREAD_DESTRUCTOR_ITERATIONS },
|
||||||
|
{ "PTHREAD_KEYS_MAX", SYSCONF, _SC_THREAD_KEYS_MAX },
|
||||||
|
{ "PTHREAD_STACK_MIN", SYSCONF, _SC_THREAD_STACK_MIN },
|
||||||
|
{ "PTHREAD_THREADS_MAX", SYSCONF, _SC_THREAD_THREADS_MAX },
|
||||||
|
#endif /* _SC_PTHREAD_DESTRUCTOR_ITERATIONS */
|
||||||
|
|
||||||
|
/* XPG 4.2 Optional Facility Configuration Values */
|
||||||
|
#if defined (_SC_XOPEN_UNIX)
|
||||||
|
{ "_XOPEN_UNIX", SYSCONF, _SC_XOPEN_UNIX },
|
||||||
|
{ "_XOPEN_CRYPT", SYSCONF, _SC_XOPEN_CRYPT },
|
||||||
|
{ "_XOPEN_ENH_I18N", SYSCONF, _SC_XOPEN_ENH_I18N },
|
||||||
|
{ "_XOPEN_SHM", SYSCONF, _SC_XOPEN_SHM },
|
||||||
|
{ "_XOPEN_VERSION", SYSCONF, _SC_XOPEN_VERSION },
|
||||||
|
# if defined (_SC_XOPEN_XCU_VERSION)
|
||||||
|
{ "_XOPEN_XCU_VERSION", SYSCONF, _SC_XOPEN_XCU_VERSION },
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
#if defined (_SC_XOPEN_REALTIME)
|
||||||
|
{ "_XOPEN_REALTIME", SYSCONF, _SC_XOPEN_REALTIME },
|
||||||
|
{ "_XOPEN_REALTIME_THREADS", SYSCONF, _SC_XOPEN_REALTIME_THREADS },
|
||||||
|
#endif
|
||||||
|
#if defined (_SC_XOPEN_LEGACY)
|
||||||
|
{ "_XOPEN_LEGACY", SYSCONF, _SC_XOPEN_LEGACY },
|
||||||
|
#endif /* _SC_XOPEN_LEGACY */
|
||||||
|
|
||||||
|
/* Single UNIX Specification version 2 Optional Facility Configuration Values */
|
||||||
|
#if defined (_SC_XBS5_ILP32_OFF32)
|
||||||
|
{ "_XBS5_ILP32_OFF32", SYSCONF, _SC_XBS5_ILP32_OFF32 },
|
||||||
|
{ "_XBS5_ILP32_OFFBIG", SYSCONF, _SC_XBS5_ILP32_OFFBIG },
|
||||||
|
{ "_XBS5_LP64_OFF64", SYSCONF, _SC_XBS5_LP64_OFF64 },
|
||||||
|
{ "_XBS5_LPBIG_OFFBIG", SYSCONF, _SC_XBS5_LPBIG_OFFBIG },
|
||||||
|
#endif /* _SC_XBS5_ILP32_OFF32 */
|
||||||
|
|
||||||
|
/* POSIX.1 Configurable Pathname Values */
|
||||||
{ "LINK_MAX", PATHCONF, _PC_LINK_MAX },
|
{ "LINK_MAX", PATHCONF, _PC_LINK_MAX },
|
||||||
{ "MAX_CANON", PATHCONF, _PC_MAX_CANON },
|
{ "MAX_CANON", PATHCONF, _PC_MAX_CANON },
|
||||||
{ "MAX_INPUT", PATHCONF, _PC_MAX_INPUT },
|
{ "MAX_INPUT", PATHCONF, _PC_MAX_INPUT },
|
||||||
|
@ -134,81 +321,93 @@ static const struct conf_variable conf_table[] =
|
||||||
{ "_POSIX_NO_TRUNC", PATHCONF, _PC_NO_TRUNC },
|
{ "_POSIX_NO_TRUNC", PATHCONF, _PC_NO_TRUNC },
|
||||||
{ "_POSIX_VDISABLE", PATHCONF, _PC_VDISABLE },
|
{ "_POSIX_VDISABLE", PATHCONF, _PC_VDISABLE },
|
||||||
|
|
||||||
|
/* XPG 4.2 Configurable Pathname Values */
|
||||||
|
#if defined (_PC_FILESIZEBITS)
|
||||||
|
{ "FILESIZEBITS", PATHCONF, _PC_FILESIZEBITS },
|
||||||
|
#endif
|
||||||
|
#if defined (_PC_ASYNC_IO)
|
||||||
|
{ "_POSIX_ASYNC_IO", PATHCONF, _PC_ASYNC_IO },
|
||||||
|
#endif
|
||||||
|
#if defined (_PC_PRIO_IO)
|
||||||
|
{ "_POSIX_PRIO_IO", PATHCONF, _PC_PRIO_IO },
|
||||||
|
#endif
|
||||||
|
#if defined (_PC_SYNC_IO)
|
||||||
|
{ "_POSIX_SYNC_IO", PATHCONF, _PC_SYNC_IO },
|
||||||
|
#endif
|
||||||
|
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static int num_getconf_variables = sizeof(conf_table) / sizeof(struct conf_variable) - 1;
|
||||||
|
|
||||||
extern char *this_command_name;
|
extern char *this_command_name;
|
||||||
extern char *xmalloc ();
|
extern char *xmalloc ();
|
||||||
extern char **make_builtin_argv ();
|
extern char **make_builtin_argv ();
|
||||||
static int getconf_main ();
|
|
||||||
|
static void getconf_help ();
|
||||||
|
static int getconf_print ();
|
||||||
|
static int getconf_one ();
|
||||||
|
static int getconf_all ();
|
||||||
|
|
||||||
int
|
int
|
||||||
getconf_builtin (list)
|
getconf_builtin (list)
|
||||||
WORD_LIST *list;
|
WORD_LIST *list;
|
||||||
{
|
{
|
||||||
int c, r;
|
int c, r, opt, aflag;
|
||||||
char **v;
|
char **v;
|
||||||
WORD_LIST *l;
|
|
||||||
|
|
||||||
v = make_builtin_argv (list, &c);
|
aflag = 0;
|
||||||
r = getconf_main (c, v);
|
reset_internal_getopt();
|
||||||
free (v);
|
while ((opt = internal_getopt (list, "ah")) != -1) {
|
||||||
|
switch (opt) {
|
||||||
|
case 'a':
|
||||||
|
aflag = 1;
|
||||||
|
break;
|
||||||
|
case 'h':
|
||||||
|
getconf_help();
|
||||||
|
return(EXECUTION_SUCCESS);
|
||||||
|
default:
|
||||||
|
builtin_usage();
|
||||||
|
return(EX_USAGE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
list = loptend;
|
||||||
|
if ((aflag == 0 && list == 0) || (aflag && list) || list_length(list) > 2) {
|
||||||
|
builtin_usage();
|
||||||
|
return(EX_USAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
r = aflag ? getconf_all() : getconf_one(list);
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static void
|
||||||
getconf_main(argc, argv)
|
getconf_help()
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
int ch;
|
|
||||||
const struct conf_variable *cp;
|
const struct conf_variable *cp;
|
||||||
|
register int i, column;
|
||||||
|
|
||||||
long val;
|
builtin_usage();
|
||||||
size_t slen;
|
printf("Acceptable variable names are:\n");
|
||||||
char *sval;
|
|
||||||
|
|
||||||
setlocale(LC_ALL, "");
|
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "")) != -1) {
|
|
||||||
switch (ch) {
|
|
||||||
case '?':
|
|
||||||
default:
|
|
||||||
builtin_usage();
|
|
||||||
return(EX_USAGE);
|
|
||||||
/* NOTREACHED */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
argc -= optind;
|
|
||||||
argv += optind;
|
|
||||||
|
|
||||||
if (argc < 1 || argc > 2) {
|
|
||||||
builtin_usage();
|
|
||||||
return(EX_USAGE);
|
|
||||||
/* NOTREACHED */
|
|
||||||
}
|
|
||||||
|
|
||||||
for (cp = conf_table; cp->name != NULL; cp++) {
|
for (cp = conf_table; cp->name != NULL; cp++) {
|
||||||
if (strcmp(*argv, cp->name) == 0)
|
if (cp->type == PATHCONF)
|
||||||
break;
|
printf("%s pathname\n", cp->name);
|
||||||
}
|
else
|
||||||
if (cp->name == NULL) {
|
printf("%s\n", cp->name);
|
||||||
builtin_error ("%s: unknown variable", *argv);
|
|
||||||
return (EXECUTION_FAILURE);
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (cp->type == PATHCONF) {
|
static int
|
||||||
if (argc != 2) {
|
getconf_print(cp, vpath, all)
|
||||||
builtin_usage();
|
struct conf_variable *cp;
|
||||||
return(EX_USAGE);
|
char *vpath;
|
||||||
}
|
int all;
|
||||||
} else {
|
{
|
||||||
if (argc != 1) {
|
long val;
|
||||||
builtin_usage();
|
char *sval;
|
||||||
return(EX_USAGE);
|
size_t slen;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (cp->type) {
|
switch (cp->type) {
|
||||||
case CONSTANT:
|
case CONSTANT:
|
||||||
|
@ -216,19 +415,33 @@ getconf_main(argc, argv)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CONFSTR:
|
case CONFSTR:
|
||||||
|
errno = 0;
|
||||||
slen = confstr (cp->value, (char *) 0, (size_t) 0);
|
slen = confstr (cp->value, (char *) 0, (size_t) 0);
|
||||||
|
if (slen == 0) {
|
||||||
|
if (errno != 0) {
|
||||||
|
if (all)
|
||||||
|
printf ("getconf: %s\n", strerror(errno));
|
||||||
|
else
|
||||||
|
builtin_error ("%s", strerror(errno));
|
||||||
|
} else
|
||||||
|
printf ("undefined\n");
|
||||||
|
return (EXECUTION_FAILURE);
|
||||||
|
}
|
||||||
sval = xmalloc(slen);
|
sval = xmalloc(slen);
|
||||||
|
|
||||||
confstr(cp->value, sval, slen);
|
confstr(cp->value, sval, slen);
|
||||||
printf("%s\n", sval);
|
printf("%s\n", sval);
|
||||||
|
free(sval);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SYSCONF:
|
case SYSCONF:
|
||||||
errno = 0;
|
errno = 0;
|
||||||
if ((val = sysconf(cp->value)) == -1) {
|
if ((val = sysconf(cp->value)) == -1) {
|
||||||
if (errno != 0) {
|
if (errno != 0) {
|
||||||
builtin_error ("%s", strerror (errno));
|
if (all)
|
||||||
|
printf("getconf: %s\n", strerror (errno));
|
||||||
|
else
|
||||||
|
builtin_error ("%s", strerror (errno));
|
||||||
return (EXECUTION_FAILURE);
|
return (EXECUTION_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,9 +453,12 @@ getconf_main(argc, argv)
|
||||||
|
|
||||||
case PATHCONF:
|
case PATHCONF:
|
||||||
errno = 0;
|
errno = 0;
|
||||||
if ((val = pathconf(argv[1], cp->value)) == -1) {
|
if ((val = pathconf(vpath, cp->value)) == -1) {
|
||||||
if (errno != 0) {
|
if (errno != 0) {
|
||||||
builtin_error ("%s: %s", argv[1], strerror (errno));
|
if (all)
|
||||||
|
printf("getconf: %s: %s\n", vpath, strerror (errno));
|
||||||
|
else
|
||||||
|
builtin_error ("%s: %s", vpath, strerror (errno));
|
||||||
return (EXECUTION_FAILURE);
|
return (EXECUTION_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,6 +472,56 @@ getconf_main(argc, argv)
|
||||||
return (ferror(stdout) ? EXECUTION_FAILURE : EXECUTION_SUCCESS);
|
return (ferror(stdout) ? EXECUTION_FAILURE : EXECUTION_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
getconf_all()
|
||||||
|
{
|
||||||
|
const struct conf_variable *cp;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = EXECUTION_SUCCESS;
|
||||||
|
for (cp = conf_table; cp->name != NULL; cp++) {
|
||||||
|
printf("%-35s", cp->name);
|
||||||
|
if (getconf_print(cp, ".", 1) == EXECUTION_FAILURE)
|
||||||
|
ret = EXECUTION_FAILURE;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
getconf_one(list)
|
||||||
|
WORD_LIST *list;
|
||||||
|
{
|
||||||
|
const struct conf_variable *cp;
|
||||||
|
char *vname, *vpath;
|
||||||
|
|
||||||
|
vname = list->word->word;
|
||||||
|
vpath = (list->next && list->next->word) ? list->next->word->word
|
||||||
|
: (char *)NULL;
|
||||||
|
|
||||||
|
for (cp = conf_table; cp->name != NULL; cp++) {
|
||||||
|
if (strcmp(vname, cp->name) == 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (cp->name == NULL) {
|
||||||
|
builtin_error ("%s: unknown variable", vname);
|
||||||
|
return (EXECUTION_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cp->type == PATHCONF) {
|
||||||
|
if (list->next == 0) {
|
||||||
|
builtin_usage();
|
||||||
|
return(EX_USAGE);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (list->next) {
|
||||||
|
builtin_usage();
|
||||||
|
return(EX_USAGE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (getconf_print(cp, vpath, 0));
|
||||||
|
}
|
||||||
|
|
||||||
static char *getconf_doc[] = {
|
static char *getconf_doc[] = {
|
||||||
"getconf writes the current value of a configurable system limit or",
|
"getconf writes the current value of a configurable system limit or",
|
||||||
"option variable to the standard output.",
|
"option variable to the standard output.",
|
||||||
|
@ -267,6 +533,6 @@ struct builtin getconf_struct = {
|
||||||
getconf_builtin,
|
getconf_builtin,
|
||||||
BUILTIN_ENABLED,
|
BUILTIN_ENABLED,
|
||||||
getconf_doc,
|
getconf_doc,
|
||||||
"getconf sysvar or getconf pathvar pathname",
|
"getconf -a or getconf -h or getconf sysvar or getconf pathvar pathname",
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,37 +1,4 @@
|
||||||
/*
|
#include "bashtypes.h"
|
||||||
* Copyright (c) 1989, 1993
|
|
||||||
* The Regents of the University of California. All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. All advertising materials mentioning features or use of this software
|
|
||||||
* must display the following acknowledgement:
|
|
||||||
* This product includes software developed by the University of
|
|
||||||
* California, Berkeley and its contributors.
|
|
||||||
* 4. Neither the name of the University nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
||||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
||||||
* SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
@ -47,44 +14,15 @@
|
||||||
extern int errno;
|
extern int errno;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PF(f, func) { \
|
|
||||||
if (fieldwidth) \
|
|
||||||
if (precision) \
|
|
||||||
(void)fprintf(ofp, f, fieldwidth, precision, func); \
|
|
||||||
else \
|
|
||||||
(void)fprintf(ofp, f, fieldwidth, func); \
|
|
||||||
else if (precision) \
|
|
||||||
(void)fprintf(ofp, f, precision, func); \
|
|
||||||
else \
|
|
||||||
(void)fprintf(ofp, f, func); \
|
|
||||||
}
|
|
||||||
|
|
||||||
static int asciicode __P((void));
|
|
||||||
static void escape __P((char *));
|
|
||||||
static int getchr __P((void));
|
|
||||||
static double getdouble __P((void));
|
|
||||||
static int getint __P((int *));
|
|
||||||
static int getlong __P((long *));
|
|
||||||
static char *getstr __P((void));
|
|
||||||
static char *mklong __P((char *, int));
|
|
||||||
static void usage __P((void));
|
|
||||||
|
|
||||||
static char **gargv;
|
|
||||||
|
|
||||||
int print_builtin ();
|
int print_builtin ();
|
||||||
static int printf_main ();
|
|
||||||
static int printargs ();
|
static int printargs ();
|
||||||
|
|
||||||
static FILE *ofp;
|
static FILE *ofp;
|
||||||
|
|
||||||
extern char *ansicstr ();
|
extern char *ansicstr ();
|
||||||
extern char *single_quote ();
|
|
||||||
extern char **make_builtin_argv ();
|
|
||||||
|
|
||||||
extern char *this_command_name;
|
extern char *this_command_name;
|
||||||
|
|
||||||
extern int optind;
|
|
||||||
|
|
||||||
static char *print_doc[] = {
|
static char *print_doc[] = {
|
||||||
"Output the arguments. The -f option means to use the argument as a",
|
"Output the arguments. The -f option means to use the argument as a",
|
||||||
"format string as would be supplied to printf(1). The rest of the",
|
"format string as would be supplied to printf(1). The rest of the",
|
||||||
|
@ -168,12 +106,15 @@ opt_end:
|
||||||
|
|
||||||
if (pfmt)
|
if (pfmt)
|
||||||
{
|
{
|
||||||
v = word_list_to_argv (list, 0, 2, &c);
|
WORD_DESC *w;
|
||||||
v[0] = this_command_name;
|
WORD_LIST *nlist;
|
||||||
v[1] = pfmt;
|
|
||||||
r = printf_main (c, v);
|
w = make_word (pfmt);
|
||||||
free (v);
|
nlist = make_word_list (w, list);
|
||||||
return r;
|
r = printf_builtin (nlist);
|
||||||
|
nlist->next = (WORD_LIST *)NULL;
|
||||||
|
dispose_words (nlist);
|
||||||
|
return (r);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (raw)
|
if (raw)
|
||||||
|
@ -198,7 +139,8 @@ opt_end:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int printargs (list, ofp)
|
static int
|
||||||
|
printargs (list, ofp)
|
||||||
WORD_LIST *list;
|
WORD_LIST *list;
|
||||||
FILE *ofp;
|
FILE *ofp;
|
||||||
{
|
{
|
||||||
|
@ -208,7 +150,7 @@ static int printargs (list, ofp)
|
||||||
|
|
||||||
for (sawc = 0, l = list; l; l = l->next)
|
for (sawc = 0, l = list; l; l = l->next)
|
||||||
{
|
{
|
||||||
ostr = ansicstr (l->word->word, strlen (l->word->word), &sawc);
|
ostr = ansicstr (l->word->word, strlen (l->word->word), &sawc, (int *)0);
|
||||||
fprintf (ofp, "%s", ostr);
|
fprintf (ofp, "%s", ostr);
|
||||||
free (ostr);
|
free (ostr);
|
||||||
if (sawc)
|
if (sawc)
|
||||||
|
@ -219,335 +161,3 @@ static int printargs (list, ofp)
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
printf_main(argc, argv)
|
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
|
||||||
static char *skip1, *skip2;
|
|
||||||
int ch, end, fieldwidth, precision;
|
|
||||||
char convch, nextch, *format, *fmt, *start;
|
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "")) != EOF)
|
|
||||||
switch (ch) {
|
|
||||||
case '?':
|
|
||||||
default:
|
|
||||||
usage();
|
|
||||||
return (1);
|
|
||||||
}
|
|
||||||
argc -= optind;
|
|
||||||
argv += optind;
|
|
||||||
|
|
||||||
if (argc < 1) {
|
|
||||||
usage();
|
|
||||||
return (1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Basic algorithm is to scan the format string for conversion
|
|
||||||
* specifications -- once one is found, find out if the field
|
|
||||||
* width or precision is a '*'; if it is, gather up value. Note,
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
skip1 = "#-+ 0";
|
|
||||||
skip2 = "*0123456789";
|
|
||||||
|
|
||||||
escape(fmt = format = *argv); /* backslash interpretation */
|
|
||||||
gargv = ++argv;
|
|
||||||
for (;;) {
|
|
||||||
end = 0;
|
|
||||||
/* find next format specification */
|
|
||||||
next: for (start = fmt;; ++fmt) {
|
|
||||||
if (!*fmt) {
|
|
||||||
/* avoid infinite loop */
|
|
||||||
if (end == 1) {
|
|
||||||
warnx("missing format character",
|
|
||||||
NULL, NULL);
|
|
||||||
return (1);
|
|
||||||
}
|
|
||||||
end = 1;
|
|
||||||
if (fmt > start)
|
|
||||||
(void)printf("%s", start);
|
|
||||||
if (!*gargv)
|
|
||||||
return (0);
|
|
||||||
fmt = format;
|
|
||||||
goto next;
|
|
||||||
}
|
|
||||||
/* %% prints a % */
|
|
||||||
if (*fmt == '%') {
|
|
||||||
if (*++fmt != '%')
|
|
||||||
break;
|
|
||||||
*fmt++ = '\0';
|
|
||||||
(void)printf("%s", start);
|
|
||||||
goto next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* skip to field width */
|
|
||||||
for (; strchr(skip1, *fmt); ++fmt);
|
|
||||||
if (*fmt == '*') {
|
|
||||||
if (getint(&fieldwidth))
|
|
||||||
return (1);
|
|
||||||
} else
|
|
||||||
fieldwidth = 0;
|
|
||||||
|
|
||||||
/* skip to possible '.', get following precision */
|
|
||||||
for (; strchr(skip2, *fmt); ++fmt);
|
|
||||||
if (*fmt == '.')
|
|
||||||
++fmt;
|
|
||||||
if (*fmt == '*') {
|
|
||||||
if (getint(&precision))
|
|
||||||
return (1);
|
|
||||||
} else
|
|
||||||
precision = 0;
|
|
||||||
|
|
||||||
/* skip to conversion char */
|
|
||||||
for (; strchr(skip2, *fmt); ++fmt);
|
|
||||||
if (!*fmt) {
|
|
||||||
warnx("missing format character", NULL, NULL);
|
|
||||||
return (1);
|
|
||||||
}
|
|
||||||
|
|
||||||
convch = *fmt;
|
|
||||||
nextch = *++fmt;
|
|
||||||
*fmt = '\0';
|
|
||||||
switch(convch) {
|
|
||||||
case 'c': {
|
|
||||||
char p;
|
|
||||||
|
|
||||||
p = getchr();
|
|
||||||
PF(start, p);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 's': {
|
|
||||||
char *p;
|
|
||||||
|
|
||||||
p = getstr();
|
|
||||||
PF(start, p);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'b': { /* expand escapes in argument */
|
|
||||||
char *p;
|
|
||||||
|
|
||||||
p = getstr();
|
|
||||||
escape(p);
|
|
||||||
PF(start, p);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'q': { /* print with shell single quoting */
|
|
||||||
char *p, *p2;
|
|
||||||
|
|
||||||
p = getstr();
|
|
||||||
p2 = single_quote(p);
|
|
||||||
PF(start, p2);
|
|
||||||
free(p2);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'd': case 'i': case 'o': case 'u': case 'x': case 'X': {
|
|
||||||
long p;
|
|
||||||
char *f;
|
|
||||||
|
|
||||||
if ((f = mklong(start, convch)) == NULL)
|
|
||||||
return (1);
|
|
||||||
if (getlong(&p))
|
|
||||||
return (1);
|
|
||||||
PF(f, p);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'e': case 'E': case 'f': case 'g': case 'G': {
|
|
||||||
double p;
|
|
||||||
|
|
||||||
p = getdouble();
|
|
||||||
PF(start, p);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
warnx("illegal format character", NULL, NULL);
|
|
||||||
return (1);
|
|
||||||
}
|
|
||||||
*fmt = nextch;
|
|
||||||
}
|
|
||||||
/* NOTREACHED */
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *
|
|
||||||
mklong(str, ch)
|
|
||||||
char *str;
|
|
||||||
int ch;
|
|
||||||
{
|
|
||||||
static char copy[64];
|
|
||||||
int len;
|
|
||||||
|
|
||||||
len = strlen(str) + 2;
|
|
||||||
memmove(copy, str, len - 3);
|
|
||||||
copy[len - 3] = 'l';
|
|
||||||
copy[len - 2] = ch;
|
|
||||||
copy[len - 1] = '\0';
|
|
||||||
return (copy);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
escape(fmt)
|
|
||||||
register char *fmt;
|
|
||||||
{
|
|
||||||
register char *store;
|
|
||||||
register int value, c;
|
|
||||||
|
|
||||||
for (store = fmt; c = *fmt; ++fmt, ++store) {
|
|
||||||
if (c != '\\') {
|
|
||||||
*store = c;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
switch (*++fmt) {
|
|
||||||
case '\0': /* EOS, user error */
|
|
||||||
*store = '\\';
|
|
||||||
*++store = '\0';
|
|
||||||
return;
|
|
||||||
case '\\': /* backslash */
|
|
||||||
case '\'': /* single quote */
|
|
||||||
*store = *fmt;
|
|
||||||
break;
|
|
||||||
case 'a': /* bell/alert */
|
|
||||||
*store = '\7';
|
|
||||||
break;
|
|
||||||
case 'b': /* backspace */
|
|
||||||
*store = '\b';
|
|
||||||
break;
|
|
||||||
case 'c':
|
|
||||||
return;
|
|
||||||
case 'e':
|
|
||||||
case 'E':
|
|
||||||
*store = '\033';
|
|
||||||
break;
|
|
||||||
case 'f': /* form-feed */
|
|
||||||
*store = '\f';
|
|
||||||
break;
|
|
||||||
case 'n': /* newline */
|
|
||||||
*store = '\n';
|
|
||||||
break;
|
|
||||||
case 'r': /* carriage-return */
|
|
||||||
*store = '\r';
|
|
||||||
break;
|
|
||||||
case 't': /* horizontal tab */
|
|
||||||
*store = '\t';
|
|
||||||
break;
|
|
||||||
case 'v': /* vertical tab */
|
|
||||||
*store = '\13';
|
|
||||||
break;
|
|
||||||
/* octal constant */
|
|
||||||
case '0': case '1': case '2': case '3':
|
|
||||||
case '4': case '5': case '6': case '7':
|
|
||||||
for (c = 3, value = 0;
|
|
||||||
c-- && *fmt >= '0' && *fmt <= '7'; ++fmt) {
|
|
||||||
value <<= 3;
|
|
||||||
value += *fmt - '0';
|
|
||||||
}
|
|
||||||
--fmt;
|
|
||||||
*store = value;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
*store = *fmt;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*store = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
getchr()
|
|
||||||
{
|
|
||||||
if (!*gargv)
|
|
||||||
return ('\0');
|
|
||||||
return ((int)**gargv++);
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *
|
|
||||||
getstr()
|
|
||||||
{
|
|
||||||
if (!*gargv)
|
|
||||||
return ("");
|
|
||||||
return (*gargv++);
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *Number = "+-.0123456789";
|
|
||||||
static int
|
|
||||||
getint(ip)
|
|
||||||
int *ip;
|
|
||||||
{
|
|
||||||
long val;
|
|
||||||
|
|
||||||
if (getlong(&val))
|
|
||||||
return (1);
|
|
||||||
if (val > INT_MAX) {
|
|
||||||
warnx("%s: %s", *gargv, strerror(ERANGE));
|
|
||||||
return (1);
|
|
||||||
}
|
|
||||||
*ip = val;
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
getlong(lp)
|
|
||||||
long *lp;
|
|
||||||
{
|
|
||||||
long val;
|
|
||||||
char *ep;
|
|
||||||
|
|
||||||
if (!*gargv) {
|
|
||||||
*lp = 0;
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
if (strchr(Number, **gargv)) {
|
|
||||||
errno = 0;
|
|
||||||
val = strtol(*gargv, &ep, 0);
|
|
||||||
if (*ep != '\0') {
|
|
||||||
warnx("%s: illegal number", *gargv, NULL);
|
|
||||||
return (1);
|
|
||||||
}
|
|
||||||
if (errno == ERANGE)
|
|
||||||
if (val == LONG_MAX) {
|
|
||||||
warnx("%s: %s", *gargv, strerror(ERANGE));
|
|
||||||
return (1);
|
|
||||||
}
|
|
||||||
if (val == LONG_MIN) {
|
|
||||||
warnx("%s: %s", *gargv, strerror(ERANGE));
|
|
||||||
return (1);
|
|
||||||
}
|
|
||||||
|
|
||||||
*lp = val;
|
|
||||||
++gargv;
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
*lp = (long)asciicode();
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static double
|
|
||||||
getdouble()
|
|
||||||
{
|
|
||||||
if (!*gargv)
|
|
||||||
return ((double)0);
|
|
||||||
if (strchr(Number, **gargv))
|
|
||||||
return (atof(*gargv++));
|
|
||||||
return ((double)asciicode());
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
asciicode()
|
|
||||||
{
|
|
||||||
register int ch;
|
|
||||||
|
|
||||||
ch = **gargv;
|
|
||||||
if (ch == '\'' || ch == '"')
|
|
||||||
ch = (*gargv)[1];
|
|
||||||
++gargv;
|
|
||||||
return (ch);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
usage()
|
|
||||||
{
|
|
||||||
(void)fprintf(stderr, "usage: print [-Rnprs] [-u unit] [-f format] [arg ...]\n");
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,460 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 1989, 1993
|
|
||||||
* The Regents of the University of California. All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. All advertising materials mentioning features or use of this software
|
|
||||||
* must display the following acknowledgement:
|
|
||||||
* This product includes software developed by the University of
|
|
||||||
* California, Berkeley and its contributors.
|
|
||||||
* 4. Neither the name of the University nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
||||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
||||||
* SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if !defined(BUILTIN) && !defined(SHELL)
|
|
||||||
#ifndef lint
|
|
||||||
static char copyright[] =
|
|
||||||
"@(#) Copyright (c) 1989, 1993\n\
|
|
||||||
The Regents of the University of California. All rights reserved.\n";
|
|
||||||
#endif /* not lint */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef lint
|
|
||||||
static char sccsid[] = "@(#)printf.c 8.1 (Berkeley) 7/20/93";
|
|
||||||
#endif /* not lint */
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <limits.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "bashansi.h"
|
|
||||||
#include "shell.h"
|
|
||||||
#include "builtins.h"
|
|
||||||
#include "stdc.h"
|
|
||||||
|
|
||||||
#if !defined (errno)
|
|
||||||
extern int errno;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define PF(f, func) { \
|
|
||||||
if (fieldwidth) \
|
|
||||||
if (precision) \
|
|
||||||
(void)printf(f, fieldwidth, precision, func); \
|
|
||||||
else \
|
|
||||||
(void)printf(f, fieldwidth, func); \
|
|
||||||
else if (precision) \
|
|
||||||
(void)printf(f, precision, func); \
|
|
||||||
else \
|
|
||||||
(void)printf(f, func); \
|
|
||||||
}
|
|
||||||
|
|
||||||
static int asciicode __P((void));
|
|
||||||
static void escape __P((char *));
|
|
||||||
static int getchr __P((void));
|
|
||||||
static double getdouble __P((void));
|
|
||||||
static int getint __P((int *));
|
|
||||||
static int getlong __P((long *));
|
|
||||||
static char *getstr __P((void));
|
|
||||||
static char *mklong __P((char *, int));
|
|
||||||
static void usage __P((void));
|
|
||||||
|
|
||||||
static char **gargv;
|
|
||||||
|
|
||||||
int printf_builtin ();
|
|
||||||
static int printf_main ();
|
|
||||||
extern char *this_command_name;
|
|
||||||
extern char *single_quote ();
|
|
||||||
extern char **make_builtin_argv ();
|
|
||||||
|
|
||||||
static char *printf_doc[] = {
|
|
||||||
"printf formats and prints its arguments, after the first, under control",
|
|
||||||
"of the format. The format is a character string which contains three",
|
|
||||||
"types of objects: plain characters, which are simply copied to standard",
|
|
||||||
"output, character escape sequences which are converted and copied to the",
|
|
||||||
"standard output, and format specifications, each of which causes printing",
|
|
||||||
"of the next successive argument. In addition to the standard printf(1)",
|
|
||||||
"formats, %%b means to expand escapes in the corresponding argument, and",
|
|
||||||
"%%q means to quote the argument in a way that can be reused as shell input.",
|
|
||||||
(char *)NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
struct builtin printf_struct = {
|
|
||||||
"printf",
|
|
||||||
printf_builtin,
|
|
||||||
BUILTIN_ENABLED,
|
|
||||||
printf_doc,
|
|
||||||
"printf format [arguments]",
|
|
||||||
(char *)0
|
|
||||||
};
|
|
||||||
|
|
||||||
int
|
|
||||||
printf_builtin (list)
|
|
||||||
WORD_LIST *list;
|
|
||||||
{
|
|
||||||
int c, r;
|
|
||||||
char **v;
|
|
||||||
WORD_LIST *l;
|
|
||||||
|
|
||||||
v = make_builtin_argv (list, &c);
|
|
||||||
r = printf_main (c, v);
|
|
||||||
free (v);
|
|
||||||
fflush(stdout);
|
|
||||||
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
printf_main(argc, argv)
|
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
|
||||||
extern int optind;
|
|
||||||
static char *skip1, *skip2;
|
|
||||||
int ch, end, fieldwidth, precision;
|
|
||||||
char convch, nextch, *format, *fmt, *start;
|
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "")) != EOF)
|
|
||||||
switch (ch) {
|
|
||||||
case '?':
|
|
||||||
default:
|
|
||||||
usage();
|
|
||||||
return (1);
|
|
||||||
}
|
|
||||||
argc -= optind;
|
|
||||||
argv += optind;
|
|
||||||
|
|
||||||
if (argc < 1) {
|
|
||||||
usage();
|
|
||||||
return (1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Basic algorithm is to scan the format string for conversion
|
|
||||||
* specifications -- once one is found, find out if the field
|
|
||||||
* width or precision is a '*'; if it is, gather up value. Note,
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
skip1 = "#-+ 0";
|
|
||||||
skip2 = "*0123456789";
|
|
||||||
|
|
||||||
escape(fmt = format = *argv); /* backslash interpretation */
|
|
||||||
gargv = ++argv;
|
|
||||||
for (;;) {
|
|
||||||
end = 0;
|
|
||||||
/* find next format specification */
|
|
||||||
next: for (start = fmt;; ++fmt) {
|
|
||||||
if (!*fmt) {
|
|
||||||
/* avoid infinite loop */
|
|
||||||
if (end == 1) {
|
|
||||||
warnx("missing format character",
|
|
||||||
NULL, NULL);
|
|
||||||
return (1);
|
|
||||||
}
|
|
||||||
end = 1;
|
|
||||||
if (fmt > start)
|
|
||||||
(void)printf("%s", start);
|
|
||||||
if (!*gargv)
|
|
||||||
return (0);
|
|
||||||
fmt = format;
|
|
||||||
goto next;
|
|
||||||
}
|
|
||||||
/* %% prints a % */
|
|
||||||
if (*fmt == '%') {
|
|
||||||
if (*++fmt != '%')
|
|
||||||
break;
|
|
||||||
*fmt++ = '\0';
|
|
||||||
(void)printf("%s", start);
|
|
||||||
goto next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* skip to field width */
|
|
||||||
for (; strchr(skip1, *fmt); ++fmt);
|
|
||||||
if (*fmt == '*') {
|
|
||||||
if (getint(&fieldwidth))
|
|
||||||
return (1);
|
|
||||||
} else
|
|
||||||
fieldwidth = 0;
|
|
||||||
|
|
||||||
/* skip to possible '.', get following precision */
|
|
||||||
for (; strchr(skip2, *fmt); ++fmt);
|
|
||||||
if (*fmt == '.')
|
|
||||||
++fmt;
|
|
||||||
if (*fmt == '*') {
|
|
||||||
if (getint(&precision))
|
|
||||||
return (1);
|
|
||||||
} else
|
|
||||||
precision = 0;
|
|
||||||
|
|
||||||
/* skip to conversion char */
|
|
||||||
for (; strchr(skip2, *fmt); ++fmt);
|
|
||||||
if (!*fmt) {
|
|
||||||
warnx("missing format character", NULL, NULL);
|
|
||||||
return (1);
|
|
||||||
}
|
|
||||||
|
|
||||||
convch = *fmt;
|
|
||||||
nextch = *++fmt;
|
|
||||||
*fmt = '\0';
|
|
||||||
switch(convch) {
|
|
||||||
case 'c': {
|
|
||||||
char p;
|
|
||||||
|
|
||||||
p = getchr();
|
|
||||||
PF(start, p);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 's': {
|
|
||||||
char *p;
|
|
||||||
|
|
||||||
p = getstr();
|
|
||||||
PF(start, p);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'b': { /* expand escapes in argument */
|
|
||||||
char *p;
|
|
||||||
|
|
||||||
p = getstr();
|
|
||||||
escape(p);
|
|
||||||
PF("%s", p);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'q': { /* print with shell single quoting */
|
|
||||||
char *p, *p2;
|
|
||||||
|
|
||||||
p = getstr();
|
|
||||||
p2 = single_quote(p);
|
|
||||||
PF("%s", p2);
|
|
||||||
free(p2);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'd': case 'i': case 'o': case 'u': case 'x': case 'X': {
|
|
||||||
long p;
|
|
||||||
char *f;
|
|
||||||
|
|
||||||
if ((f = mklong(start, convch)) == NULL)
|
|
||||||
return (1);
|
|
||||||
if (getlong(&p))
|
|
||||||
return (1);
|
|
||||||
PF(f, p);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'e': case 'E': case 'f': case 'g': case 'G': {
|
|
||||||
double p;
|
|
||||||
|
|
||||||
p = getdouble();
|
|
||||||
PF(start, p);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
warnx("illegal format character", NULL, NULL);
|
|
||||||
return (1);
|
|
||||||
}
|
|
||||||
*fmt = nextch;
|
|
||||||
}
|
|
||||||
/* NOTREACHED */
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *
|
|
||||||
mklong(str, ch)
|
|
||||||
char *str;
|
|
||||||
int ch;
|
|
||||||
{
|
|
||||||
static char copy[64];
|
|
||||||
int len;
|
|
||||||
|
|
||||||
len = strlen(str) + 2;
|
|
||||||
memmove(copy, str, len - 3);
|
|
||||||
copy[len - 3] = 'l';
|
|
||||||
copy[len - 2] = ch;
|
|
||||||
copy[len - 1] = '\0';
|
|
||||||
return (copy);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
escape(fmt)
|
|
||||||
register char *fmt;
|
|
||||||
{
|
|
||||||
register char *store;
|
|
||||||
register int value, c;
|
|
||||||
|
|
||||||
for (store = fmt; c = *fmt; ++fmt, ++store) {
|
|
||||||
if (c != '\\') {
|
|
||||||
*store = c;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
switch (*++fmt) {
|
|
||||||
case '\0': /* EOS, user error */
|
|
||||||
*store = '\\';
|
|
||||||
*++store = '\0';
|
|
||||||
return;
|
|
||||||
case '\\': /* backslash */
|
|
||||||
case '\'': /* single quote */
|
|
||||||
*store = *fmt;
|
|
||||||
break;
|
|
||||||
case 'a': /* bell/alert */
|
|
||||||
*store = '\7';
|
|
||||||
break;
|
|
||||||
case 'b': /* backspace */
|
|
||||||
*store = '\b';
|
|
||||||
break;
|
|
||||||
case 'c':
|
|
||||||
return;
|
|
||||||
case 'e':
|
|
||||||
case 'E':
|
|
||||||
*store = '\033';
|
|
||||||
break;
|
|
||||||
case 'f': /* form-feed */
|
|
||||||
*store = '\f';
|
|
||||||
break;
|
|
||||||
case 'n': /* newline */
|
|
||||||
*store = '\n';
|
|
||||||
break;
|
|
||||||
case 'r': /* carriage-return */
|
|
||||||
*store = '\r';
|
|
||||||
break;
|
|
||||||
case 't': /* horizontal tab */
|
|
||||||
*store = '\t';
|
|
||||||
break;
|
|
||||||
case 'v': /* vertical tab */
|
|
||||||
*store = '\13';
|
|
||||||
break;
|
|
||||||
/* octal constant */
|
|
||||||
case '0': case '1': case '2': case '3':
|
|
||||||
case '4': case '5': case '6': case '7':
|
|
||||||
for (c = 3, value = 0;
|
|
||||||
c-- && *fmt >= '0' && *fmt <= '7'; ++fmt) {
|
|
||||||
value <<= 3;
|
|
||||||
value += *fmt - '0';
|
|
||||||
}
|
|
||||||
--fmt;
|
|
||||||
*store = value;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
*store = *fmt;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*store = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
getchr()
|
|
||||||
{
|
|
||||||
if (!*gargv)
|
|
||||||
return ('\0');
|
|
||||||
return ((int)**gargv++);
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *
|
|
||||||
getstr()
|
|
||||||
{
|
|
||||||
if (!*gargv)
|
|
||||||
return ("");
|
|
||||||
return (*gargv++);
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *Number = "+-.0123456789";
|
|
||||||
static int
|
|
||||||
getint(ip)
|
|
||||||
int *ip;
|
|
||||||
{
|
|
||||||
long val;
|
|
||||||
|
|
||||||
if (getlong(&val))
|
|
||||||
return (1);
|
|
||||||
if (val > INT_MAX) {
|
|
||||||
warnx("%s: %s", *gargv, strerror(ERANGE));
|
|
||||||
return (1);
|
|
||||||
}
|
|
||||||
*ip = val;
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
getlong(lp)
|
|
||||||
long *lp;
|
|
||||||
{
|
|
||||||
long val;
|
|
||||||
char *ep;
|
|
||||||
|
|
||||||
if (!*gargv) {
|
|
||||||
*lp = 0;
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
if (strchr(Number, **gargv)) {
|
|
||||||
errno = 0;
|
|
||||||
val = strtol(*gargv, &ep, 0);
|
|
||||||
if (*ep != '\0') {
|
|
||||||
warnx("%s: illegal number", *gargv, NULL);
|
|
||||||
return (1);
|
|
||||||
}
|
|
||||||
if (errno == ERANGE)
|
|
||||||
if (val == LONG_MAX) {
|
|
||||||
warnx("%s: %s", *gargv, strerror(ERANGE));
|
|
||||||
return (1);
|
|
||||||
}
|
|
||||||
if (val == LONG_MIN) {
|
|
||||||
warnx("%s: %s", *gargv, strerror(ERANGE));
|
|
||||||
return (1);
|
|
||||||
}
|
|
||||||
|
|
||||||
*lp = val;
|
|
||||||
++gargv;
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
*lp = (long)asciicode();
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static double
|
|
||||||
getdouble()
|
|
||||||
{
|
|
||||||
if (!*gargv)
|
|
||||||
return ((double)0);
|
|
||||||
if (strchr(Number, **gargv))
|
|
||||||
return (atof(*gargv++));
|
|
||||||
return ((double)asciicode());
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
asciicode()
|
|
||||||
{
|
|
||||||
register int ch;
|
|
||||||
|
|
||||||
ch = **gargv;
|
|
||||||
if (ch == '\'' || ch == '"')
|
|
||||||
ch = (*gargv)[1];
|
|
||||||
++gargv;
|
|
||||||
return (ch);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
usage()
|
|
||||||
{
|
|
||||||
(void)fprintf(stderr, "usage: printf format [arg ...]\n");
|
|
||||||
}
|
|
49
examples/scripts.v2/cal2day.bash
Normal file
49
examples/scripts.v2/cal2day.bash
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# cal2day - "parse" appropriate calendar output to match date number
|
||||||
|
# with day name.
|
||||||
|
#
|
||||||
|
# usage: cal2day month day [year]
|
||||||
|
#
|
||||||
|
# ORIGINAL *TAG:33239 3:Dec 9 1997:0755:sh.d/cal2day:
|
||||||
|
#
|
||||||
|
# Obtained from usenet
|
||||||
|
#
|
||||||
|
# Converted to bash v2 syntax by Chet Ramey <chet@po.cwru.edu>
|
||||||
|
|
||||||
|
#1 PARSE OPTIONS
|
||||||
|
while getopts :dls _inst
|
||||||
|
do case $_inst in
|
||||||
|
(d) format='%1d%.0s\n' ;; # 0, 1, ..., 7
|
||||||
|
(l) format='%0.s%-s\n' ;; # Sunday, Monday, ..., Saturday
|
||||||
|
(s) format='%0.s%-.3s\n' ;; # Sun, Mon, ..., Sat
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
shift $((OPTIND-1))
|
||||||
|
|
||||||
|
#2 PARAMETER VALUES
|
||||||
|
((!$#)) && set -- $(date '+%m %d')
|
||||||
|
: ${format:='%0.s%-.3s\n'}
|
||||||
|
: ${1:?missing month parameter [1-12]}
|
||||||
|
: ${2:?missing day parameter [1-31]}
|
||||||
|
|
||||||
|
#3 CALCULATE DAY-OF-WEEK FROM DATE
|
||||||
|
cal $1 ${3:-$(date +%Y)} | gawk -FX '
|
||||||
|
BEGIN { day="Sunday Monday Tuesday WednesdayThursday Friday Saturday"
|
||||||
|
sub(/^0/, "", daynum)
|
||||||
|
dayre="(^| )" daynum "( |$)"
|
||||||
|
}
|
||||||
|
#NR==2 { print length($0) }
|
||||||
|
NR==1 || NR==2 \
|
||||||
|
{ next }
|
||||||
|
dayre { if (match($0, dayre))
|
||||||
|
{ #print RSTART, RLENGTH, substr($0, RSTART, RLENGTH)
|
||||||
|
if (daynum<=9 || RSTART==1) RSTART-=1
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
END { # 20/21 char width assumed
|
||||||
|
printf format, RSTART/3, substr(day, RSTART*3+1, 9)
|
||||||
|
}
|
||||||
|
' daynum=$2 format=$format -
|
||||||
|
|
||||||
|
exit 0
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue