commit bash-20040715 snapshot

This commit is contained in:
Chet Ramey
2011-12-03 12:59:35 -05:00
parent 3ede1caab6
commit a5e25162c9
22 changed files with 2201 additions and 1201 deletions
+10
View File
@@ -14,11 +14,21 @@ c. Change the directory expansion portion of the completion code to not
expand embedded command substitutions if the directory name appears in
the file system.
d. Fixed a problem that caused `bash -r' to turn on restrictions before
reading the startup files.
e. Fixed a problem with the default operation of the `umask' builtin.
2. Changes to Readline
a. Fixed a problem with readline saving the contents of the current line
before beginning a non-interactive search.
b. Fixed a problem with EOF detection when using rl_event_hook.
c. Fixed a problem with the vi mode `p' and `P' commands ignoring numeric
arguments.
------------------------------------------------------------------------------
This document details the changes between this version, bash-3.0-rc1,
and the previous version, bash-3.0-beta1.
+29
View File
@@ -1,3 +1,32 @@
This document details the changes between this version, bash-3.0-release,
and the previous version, bash-3.0-rc1.
1. Changes to Bash
a. Fixed a boundary overrun that could cause segmentation faults when the
completion code hands an incomplete construct to the word expansion
functions.
b. Changed posix mode behavior so that an error in a variable assignment
preceding a special builtin causes a non-interactive shell to exit.
c. Change the directory expansion portion of the completion code to not
expand embedded command substitutions if the directory name appears in
the file system.
d. Fixed a problem with the default operation of the `umask' builtin.
2. Changes to Readline
a. Fixed a problem with readline saving the contents of the current line
before beginning a non-interactive search.
b. Fixed a problem with EOF detection when using rl_event_hook.
c. Fixed a problem with the vi mode `p' and `P' commands ignoring numeric
arguments.
------------------------------------------------------------------------------
This document details the changes between this version, bash-3.0-rc1,
and the previous version, bash-3.0-beta1.
+10 -6
View File
@@ -1,11 +1,12 @@
This document details the incompatibilites between this version of bash,
bash-2.05b, and the previous widely-available version, bash-1.14 (which
is still the `standard' version for many Linux distributions). These
were discovered by users of bash-2.x, so this list is not comprehensive.
Some of these incompatibilities occur between the current version and
versions 2.0 and above.
bash-3.0, and a previous widely-available version, bash-1.14 (which
is still the `standard' version for a few Linux distributions). These
were discovered by users of bash-2.x and 3.x, so this list is not
comprehensive. Some of these incompatibilities occur between the current
version and versions 2.0 and above. (The differences between bash-1.14
and bash-2.0 were significant.)
1. Bash now uses a new quoting syntax, $"...", to do locale-specific
1. Bash uses a new quoting syntax, $"...", to do locale-specific
string translation. Users who have relied on the (undocumented)
behavior of bash-1.14 will have to change their scripts. For
instance, if you are doing something like this to get the value of
@@ -208,3 +209,6 @@ versions 2.0 and above.
17. Bash no longer removes the export attribute from the SSH_CLIENT or
SSH2_CLIENT variables, and no longer attempts to discover whether or
not it has been invoked by sshd in order to run the startup files.
18. Bash no longer requires that the body of a function be a group command;
any compound command is accepted.
+216
View File
@@ -0,0 +1,216 @@
This document details the incompatibilites between this version of bash,
bash-3.0, and a previous widely-available version, bash-1.14 (which
is still the `standard' version for a few Linux distributions). These
were discovered by users of bash-2.x and 3.x, so this list is not
comprehensive. Some of these incompatibilities occur between the current
version and versions 2.0 and above. (The differences between bash-1.14
and bash-2.0 were significant.)
1. Bash uses a new quoting syntax, $"...", to do locale-specific
string translation. Users who have relied on the (undocumented)
behavior of bash-1.14 will have to change their scripts. For
instance, if you are doing something like this to get the value of
a variable whose name is the value of a second variable:
eval var2=$"$var1"
you will have to change to a different syntax.
This capability is directly supported by bash-2.0:
var2=${!var1}
This alternate syntax will work portably between bash-1.14 and bash-2.0:
eval var2=\$${var1}
2. One of the bugs fixed in the YACC grammar tightens up the rules
concerning group commands ( {...} ). The `list' that composes the
body of the group command must be terminated by a newline or
semicolon. That's because the braces are reserved words, and are
recognized as such only when a reserved word is legal. This means
that while bash-1.14 accepted shell function definitions like this:
foo() { : }
bash-2.0 requires this:
foo() { :; }
This is also an issue for commands like this:
mkdir dir || { echo 'could not mkdir' ; exit 1; }
The syntax required by bash-2.0 is also accepted by bash-1.14.
3. The options to `bind' have changed to make them more consistent with
the rest of the bash builtins. If you are using `bind -d' to list
the readline key bindings in a form that can be re-read, use `bind -p'
instead. If you were using `bind -v' to list the key bindings, use
`bind -P' instead.
4. The `long' invocation options must now be prefixed by `--' instead
of `-'. (The old form is still accepted, for the time being.)
5. There was a bug in the version of readline distributed with bash-1.14
that caused it to write badly-formatted key bindings when using
`bind -d'. The only key sequences that were affected are C-\ (which
should appear as \C-\\ in a key binding) and C-" (which should appear
as \C-\"). If these key sequences appear in your inputrc, as, for
example,
"\C-\": self-insert
they will need to be changed to something like the following:
"\C-\\": self-insert
6. A number of people complained about having to use ESC to terminate an
incremental search, and asked for an alternate mechanism. Bash-2.03
uses the value of the settable readline variable `isearch-terminators'
to decide which characters should terminate an incremental search. If
that variable has not been set, ESC and Control-J will terminate a
search.
7. Some variables have been removed: MAIL_WARNING, notify, history_control,
command_oriented_history, glob_dot_filenames, allow_null_glob_expansion,
nolinks, hostname_completion_file, noclobber, no_exit_on_failed_exec, and
cdable_vars. Most of them are now implemented with the new `shopt'
builtin; others were already implemented by `set'. Here is a list of
correspondences:
MAIL_WARNING shopt mailwarn
notify set -o notify
history_control HISTCONTROL
command_oriented_history shopt cmdhist
glob_dot_filenames shopt dotglob
allow_null_glob_expansion shopt nullglob
nolinks set -o physical
hostname_completion_file HOSTFILE
noclobber set -o noclobber
no_exit_on_failed_exec shopt execfail
cdable_vars shopt cdable_vars
8. `ulimit' now sets both hard and soft limits and reports the soft limit
by default (when neither -H nor -S is specified). This is compatible
with versions of sh and ksh that implement `ulimit'. The bash-1.14
behavior of, for example,
ulimit -c 0
can be obtained with
ulimit -S -c 0
It may be useful to define an alias:
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.
11. The <> redirection operator was changed to conform to the POSIX.2 spec.
In the absence of any file descriptor specification preceding the `<>',
file descriptor 0 is used. In bash-1.14, this was the behavior only
when in POSIX mode. The bash-1.14 behavior may be obtained with
<>filename 1>&0
12. The `alias' builtin now checks for invalid options and takes a `-p'
option to display output in POSIX mode. If you have old aliases beginning
with `-' or `+', you will have to add the `--' to the alias command
that declares them:
alias -x='chmod a-x' --> alias -- -x='chmod a-x'
13. The behavior of range specificiers within bracket matching expressions
in the pattern matcher (e.g., [A-Z]) depends on the current locale,
specifically the value of the LC_COLLATE environment variable. Setting
this variable to C or POSIX will result in the traditional ASCII behavior
for range comparisons. If the locale is set to something else, e.g.,
en_US (specified by the LANG or LC_ALL variables), collation order is
locale-dependent. For example, the en_US locale sorts the upper and
lower case letters like this:
AaBb...Zz
so a range specification like [A-Z] will match every letter except `z'.
Other locales collate like
aAbBcC...zZ
which means that [A-Z] matches every letter except `a'.
The portable way to specify upper case letters is [:upper:] instead of
A-Z; lower case may be specified as [:lower:] instead of a-z.
Look at the manual pages for setlocale(3), strcoll(3), and, if it is
present, locale(1).
You can find your current locale information by running locale(1):
caleb.ins.cwru.edu(2)$ locale
LANG=en_US
LC_CTYPE="en_US"
LC_NUMERIC="en_US"
LC_TIME="en_US"
LC_COLLATE="en_US"
LC_MONETARY="en_US"
LC_MESSAGES="en_US"
LC_ALL=en_US
My advice is to put
export LC_COLLATE=C
into /etc/profile and inspect any shell scripts run from cron for
constructs like [A-Z]. This will prevent things like
rm [A-Z]*
from removing every file in the current directory except those beginning
with `z' and still allow individual users to change the collation order.
Users may put the above command into their own profiles as well, of course.
14. Bash versions up to 1.14.7 included an undocumented `-l' operator to
the `test/[' builtin. It was a unary operator that expanded to the
length of its string argument. This let you do things like
test -l $variable -lt 20
for example.
This was included for backwards compatibility with old versions of the
Bourne shell, which did not provide an easy way to obtain the length of
the value of a shell variable.
This operator is not part of the POSIX standard, because one can (and
should) use ${#variable} to get the length of a variable's value.
Bash-2.x does not support it.
15. Bash no longer auto-exports the HOME, PATH, SHELL, TERM, HOSTNAME,
HOSTTYPE, MACHTYPE, or OSTYPE variables.
16. Bash no longer initializes the FUNCNAME, GROUPS, or DIRSTACK variables
to have special behavior if they appear in the initial environment.
17. Bash no longer removes the export attribute from the SSH_CLIENT or
SSH2_CLIENT variables, and no longer attempts to discover whether or
not it has been invoked by sshd in order to run the startup files.
18. Bash no longer requires that the body of a function be a group command.
Thus, the following is accepted:
foo() echo bar;
+26
View File
@@ -9612,3 +9612,29 @@ lib/readline/misc.c
what's already saved, free up the current saved line and save the
current contents of rl_line_buffer. Bug reported by
llattanzi@apple.com
7/12
----
lib/readline/input.c
- do better EOF detection in rl_gather_tyi -- if a read returns 0 when
the fd is in non-blocking mode, stuff an EOF into the input stream
(reported by mattias@virtutech.se)
7/13
----
lib/readline/vi_mode.c
- make sure rl_vi_put honors `count' arguments and yanks things
multiple times if requested
7/16
----
builtins/umask.def
- make sure that the `who' part of the umask symbolic mode argument
defaults to `a' if it's missing
flags.c
- make sure that maybe_make_restricted only gets called after the
shell is initialized, so `bash -r' doesn't result in inappropriate
error messages
[bash-3.0 frozen]
+40
View File
@@ -9596,3 +9596,43 @@ execute_cmd.c
POSIX mode to exit if an assignment to the temporary environment
preceding a special builtin fails (bug report from
llattanzi@apple.com)
7/5
---
bashline.c
- in bash_directory_completion_hook, don't perform word expansions
if the filename appears to have been completed from the file
system rather than typed in by the user. Bug reported by Tim
Waugh <twaugh@redhat.com>
7/7
---
lib/readline/misc.c
- if _rl_maybe_save_line is being asked to save a line other than
what's already saved, free up the current saved line and save the
current contents of rl_line_buffer. Bug reported by
llattanzi@apple.com
7/12
----
lib/readline/input.c
- do better EOF detection in rl_gather_tyi -- if a read returns 0 when
the fd is in non-blocking mode, stuff an EOF into the input stream
(reported by mattias@virtutech.se)
7/13
----
lib/readline/vi_mode.c
- make sure rl_vi_put honors `count' arguments and yanks things
multiple times if requested
7/16
----
builtins/umask.def
- make sure that the `who' part of the umask symbolic mode argument
defaults to `a' if it's missing
flags.c
- make sure that maybe_make_restricted only gets called after the
shell is initialized, so `bash -r' doesn't result in inappropriate
error messages
+2 -2
View File
@@ -11,11 +11,11 @@ type of shell, see the file `doc/bashref.texi'. There is also a
large Unix-style man page. The man page is the definitive description
of the shell's features.
See the file CWRU/POSIX.NOTES for a discussion of how Bash differs
See the file POSIX for a discussion of how the Bash defaults differ
from the POSIX.2 spec and a description of the Bash `posix mode'.
There are some user-visible incompatibilities between this version
of Bash and the previous widely-distributed version, bash-1.14.
of Bash and a previous widely-distributed version, bash-1.14.
For details, see the file COMPAT. The NEWS file tersely lists
features that are new in this release.
+1 -1
View File
@@ -1,7 +1,7 @@
Introduction
============
This is GNU Bash, version 3.0b. Bash is the GNU Project's Bourne
This is GNU Bash, version 3.0. Bash is the GNU Project's Bourne
Again SHell, a complete implementation of the POSIX.2 shell spec,
but also with interactive command line editing, job control on
architectures that support it, csh-like features such as history
+11 -11
View File
@@ -1,7 +1,7 @@
@%:@! /bin/sh
@%:@ From configure.in for Bash 3.0, version 3.164, from autoconf version AC_ACVERSION.
@%:@ From configure.in for Bash 3.0, version 3.165, from autoconf version AC_ACVERSION.
@%:@ Guess values for system-dependent variables and create Makefiles.
@%:@ Generated by GNU Autoconf 2.57 for bash 3.0-rc1.
@%:@ Generated by GNU Autoconf 2.57 for bash 3.0-release.
@%:@
@%:@ Report bugs to <bug-bash@gnu.org>.
@%:@
@@ -269,8 +269,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='bash'
PACKAGE_TARNAME='bash'
PACKAGE_VERSION='3.0-rc1'
PACKAGE_STRING='bash 3.0-rc1'
PACKAGE_VERSION='3.0-release'
PACKAGE_STRING='bash 3.0-release'
PACKAGE_BUGREPORT='bug-bash@gnu.org'
ac_unique_file="shell.h"
@@ -784,7 +784,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures bash 3.0-rc1 to adapt to many kinds of systems.
\`configure' configures bash 3.0-release to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -845,7 +845,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of bash 3.0-rc1:";;
short | recursive ) echo "Configuration of bash 3.0-release:";;
esac
cat <<\_ACEOF
@@ -1000,7 +1000,7 @@ fi
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
bash configure 3.0-rc1
bash configure 3.0-release
generated by GNU Autoconf 2.57
Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
@@ -1015,7 +1015,7 @@ cat >&5 <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by bash $as_me 3.0-rc1, which was
It was created by bash $as_me 3.0-release, which was
generated by GNU Autoconf 2.57. Invocation command line was
$ $0 $@
@@ -1384,7 +1384,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
BASHVERS=3.0
RELSTATUS=rc1
RELSTATUS=release
case "$RELSTATUS" in
alp*|bet*|dev*|rc*) DEBUG='-DDEBUG' MALLOC_DEBUG='-DMALLOC_DEBUG' ;;
@@ -24610,7 +24610,7 @@ _ASBOX
} >&5
cat >&5 <<_CSEOF
This file was extended by bash $as_me 3.0-rc1, which was
This file was extended by bash $as_me 3.0-release, which was
generated by GNU Autoconf 2.57. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -24673,7 +24673,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
bash config.status 3.0-rc1
bash config.status 3.0-release
configured by $0, generated by GNU Autoconf 2.57,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
+81 -81
View File
@@ -15,96 +15,96 @@
'configure.in'
],
{
'AC_FUNC_ALLOCA' => 1,
'AC_HEADER_MAJOR' => 1,
'AC_HEADER_DIRENT' => 1,
'AC_TYPE_SIZE_T' => 1,
'AM_GNU_GETTEXT' => 1,
'AC_FUNC_OBSTACK' => 1,
'AC_FUNC_GETGROUPS' => 1,
'AC_FUNC_ERROR_AT_LINE' => 1,
'AC_PROG_INSTALL' => 1,
'AC_FUNC_SELECT_ARGTYPES' => 1,
'AC_CANONICAL_HOST' => 1,
'AC_FUNC_CHOWN' => 1,
'AC_PROG_CC' => 1,
'AC_HEADER_STDC' => 1,
'AC_TYPE_PID_T' => 1,
'AC_FUNC_MALLOC' => 1,
'AC_FUNC_MBRTOWC' => 1,
'AC_FUNC_LSTAT' => 1,
'AC_HEADER_TIME' => 1,
'AH_OUTPUT' => 1,
'AC_FUNC_GETMNTENT' => 1,
'AC_PROG_CPP' => 1,
'AC_TYPE_MODE_T' => 1,
'm4_pattern_allow' => 1,
'AC_PROG_YACC' => 1,
'AC_FUNC_MKTIME' => 1,
'AC_CHECK_TYPES' => 1,
'AC_PROG_CXX' => 1,
'AC_HEADER_MAJOR' => 1,
'AC_CHECK_FUNCS' => 1,
'AC_CHECK_HEADERS' => 1,
'AC_INIT' => 1,
'AC_STRUCT_TIMEZONE' => 1,
'AM_MAINTAINER_MODE' => 1,
'AC_PROG_MAKE_SET' => 1,
'AC_FUNC_CHOWN' => 1,
'AC_FUNC_ERROR_AT_LINE' => 1,
'AC_CONFIG_FILES' => 1,
'AC_CANONICAL_HOST' => 1,
'AC_LIBSOURCE' => 1,
'AC_PROG_RANLIB' => 1,
'AC_FUNC_MMAP' => 1,
'AC_CHECK_MEMBERS' => 1,
'AC_FUNC_STRTOD' => 1,
'AM_PROG_CC_C_O' => 1,
'AC_FUNC_CLOSEDIR_VOID' => 1,
'AC_FUNC_VPRINTF' => 1,
'AC_PROG_LEX' => 1,
'AC_FUNC_STAT' => 1,
'AC_REPLACE_FNMATCH' => 1,
'AC_STRUCT_TM' => 1,
'AC_FUNC_STRCOLL' => 1,
'AC_FUNC_STRNLEN' => 1,
'm4_include' => 1,
'AC_CONFIG_AUX_DIR' => 1,
'AC_FUNC_STRERROR_R' => 1,
'AC_CANONICAL_SYSTEM' => 1,
'AC_CHECK_LIB' => 1,
'AC_STRUCT_ST_BLOCKS' => 1,
'AC_PATH_X' => 1,
'AC_FUNC_SELECT_ARGTYPES' => 1,
'AC_FUNC_MEMCMP' => 1,
'include' => 1,
'AC_DEFINE_TRACE_LITERAL' => 1,
'AC_C_VOLATILE' => 1,
'AM_GNU_GETTEXT' => 1,
'AC_DECL_SYS_SIGLIST' => 1,
'AC_FUNC_SETPGRP' => 1,
'AC_FUNC_OBSTACK' => 1,
'AM_CONDITIONAL' => 1,
'AC_FUNC_REALLOC' => 1,
'AC_FUNC_WAIT3' => 1,
'AC_FUNC_STRFTIME' => 1,
'AC_SUBST' => 1,
'AC_PROG_LIBTOOL' => 1,
'AC_FUNC_FSEEKO' => 1,
'AC_HEADER_STAT' => 1,
'AC_LIBSOURCE' => 1,
'AC_FUNC_MBRTOWC' => 1,
'AC_PROG_MAKE_SET' => 1,
'm4_include' => 1,
'AC_FUNC_UTIME_NULL' => 1,
'AC_FUNC_WAIT3' => 1,
'AC_FUNC_STAT' => 1,
'AC_CHECK_MEMBERS' => 1,
'AC_HEADER_TIME' => 1,
'AC_FUNC_VPRINTF' => 1,
'AC_CONFIG_SUBDIRS' => 1,
'AC_REPLACE_FNMATCH' => 1,
'AC_CONFIG_HEADERS' => 1,
'AM_CONDITIONAL' => 1,
'AC_DECL_SYS_SIGLIST' => 1,
'AC_CHECK_TYPES' => 1,
'AM_INIT_AUTOMAKE' => 1,
'AC_FUNC_STRCOLL' => 1,
'AC_PROG_AWK' => 1,
'AC_TYPE_UID_T' => 1,
'AC_TYPE_SIGNAL' => 1,
'AC_FUNC_CLOSEDIR_VOID' => 1,
'AC_FUNC_GETPGRP' => 1,
'AC_C_VOLATILE' => 1,
'AC_FUNC_LSTAT' => 1,
'AC_FUNC_GETMNTENT' => 1,
'AM_AUTOMAKE_VERSION' => 1,
'AC_SUBST' => 1,
'AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK' => 1,
'AM_MAINTAINER_MODE' => 1,
'AC_FUNC_MKTIME' => 1,
'AC_PROG_CPP' => 1,
'm4_pattern_allow' => 1,
'AC_PROG_LEX' => 1,
'AC_PATH_X' => 1,
'AC_PROG_RANLIB' => 1,
'AC_CHECK_LIB' => 1,
'AC_STRUCT_TM' => 1,
'AC_STRUCT_ST_BLOCKS' => 1,
'AC_FUNC_STRERROR_R' => 1,
'AC_STRUCT_TIMEZONE' => 1,
'AC_PROG_GCC_TRADITIONAL' => 1,
'AC_FUNC_MALLOC' => 1,
'AC_TYPE_OFF_T' => 1,
'm4_pattern_forbid' => 1,
'AH_OUTPUT' => 1,
'AC_PROG_YACC' => 1,
'AC_FUNC_STRNLEN' => 1,
'AC_TYPE_MODE_T' => 1,
'AC_PROG_LN_S' => 1,
'AM_PROG_CC_C_O' => 1,
'AC_CONFIG_FILES' => 1,
'AC_FUNC_STRTOD' => 1,
'AC_INIT' => 1,
'AC_HEADER_SYS_WAIT' => 1,
'AC_C_INLINE' => 1,
'AC_FUNC_REALLOC' => 1,
'AC_FUNC_MEMCMP' => 1,
'AC_CONFIG_AUX_DIR' => 1,
'AC_FUNC_SETVBUF_REVERSED' => 1,
'AC_DEFINE_TRACE_LITERAL' => 1,
'AC_FUNC_GETGROUPS' => 1,
'AC_FUNC_GETLOADAVG' => 1,
'AC_C_CONST' => 1,
'AC_PROG_INSTALL' => 1,
'm4_pattern_forbid' => 1,
'AC_FUNC_SETVBUF_REVERSED' => 1,
'AC_TYPE_SIGNAL' => 1,
'AC_PROG_GCC_TRADITIONAL' => 1,
'AC_PROG_LN_S' => 1,
'AM_INIT_AUTOMAKE' => 1,
'AM_AUTOMAKE_VERSION' => 1,
'AC_FUNC_ALLOCA' => 1,
'AC_PROG_AWK' => 1,
'AC_CONFIG_HEADERS' => 1,
'AC_FUNC_GETPGRP' => 1,
'AC_TYPE_OFF_T' => 1,
'AC_FUNC_UTIME_NULL' => 1,
'AC_TYPE_SIZE_T' => 1,
'AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK' => 1,
'AC_CONFIG_SUBDIRS' => 1,
'AC_FUNC_FORK' => 1,
'AC_FUNC_STRFTIME' => 1,
'AC_CANONICAL_SYSTEM' => 1,
'AC_TYPE_PID_T' => 1,
'AC_CHECK_HEADERS' => 1,
'AC_PROG_CXX' => 1,
'AC_PROG_LIBTOOL' => 1,
'AC_FUNC_MMAP' => 1,
'AC_CHECK_FUNCS' => 1
'AC_TYPE_UID_T' => 1,
'AC_HEADER_SYS_WAIT' => 1,
'AC_HEADER_STDC' => 1,
'AC_C_CONST' => 1
}
], 'Request' )
);
+1 -1
View File
@@ -1,4 +1,4 @@
m4trace:configure.in:30: -1- AC_INIT([bash], [3.0-rc1], [bug-bash@gnu.org])
m4trace:configure.in:30: -1- AC_INIT([bash], [3.0-release], [bug-bash@gnu.org])
m4trace:configure.in:30: -1- m4_pattern_forbid([^_?A[CHUM]_])
m4trace:configure.in:30: -1- m4_pattern_forbid([_AC_])
m4trace:configure.in:30: -1- m4_pattern_forbid([^LIBOBJS$], [do not use LIBOBJS directly, use AC_LIBOBJ (see section `AC_LIBOBJ vs LIBOBJS'])
+2
View File
@@ -262,6 +262,8 @@ parse_symbolic_mode (mode, initial_bits)
bits &= ~perm;
break;
case '=':
if (who == 0)
who = S_IRWXU | S_IRWXG | S_IRWXO;
bits &= ~who;
bits |= perm;
break;
+309
View File
@@ -0,0 +1,309 @@
This file is umask.def, from which is created umask.c.
It implements the builtin "umask" in Bash.
Copyright (C) 1987-2004 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
Bash is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along
with Bash; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA.
$PRODUCES umask.c
$BUILTIN umask
$FUNCTION umask_builtin
$SHORT_DOC umask [-p] [-S] [mode]
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'
option makes the output symbolic; otherwise an octal number is output.
If `-p' is supplied, and MODE is omitted, the output is in a form
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
#include <config.h>
#include "../bashtypes.h"
#include "filecntl.h"
#if ! defined(_MINIX) && defined (HAVE_SYS_FILE_H)
# include <sys/file.h>
#endif
#if defined (HAVE_UNISTD_H)
#include <unistd.h>
#endif
#include <stdio.h>
#include <chartypes.h>
#include "../bashintl.h"
#include "../shell.h"
#include "posixstat.h"
#include "common.h"
#include "bashgetopt.h"
#ifdef __LCC__
#define mode_t int
#endif
/* **************************************************************** */
/* */
/* UMASK Builtin and Helpers */
/* */
/* **************************************************************** */
static void print_symbolic_umask __P((mode_t));
static int symbolic_umask __P((WORD_LIST *));
/* Set or display the mask used by the system when creating files. Flag
of -S means display the umask in a symbolic mode. */
int
umask_builtin (list)
WORD_LIST *list;
{
int print_symbolically, opt, umask_value, pflag;
mode_t umask_arg;
print_symbolically = pflag = 0;
reset_internal_getopt ();
while ((opt = internal_getopt (list, "Sp")) != -1)
{
switch (opt)
{
case 'S':
print_symbolically++;
break;
case 'p':
pflag++;
break;
default:
builtin_usage ();
return (EX_USAGE);
}
}
list = loptend;
if (list)
{
if (DIGIT (*list->word->word))
{
umask_value = read_octal (list->word->word);
/* Note that other shells just let you set the umask to zero
by specifying a number out of range. This is a problem
with those shells. We don't change the umask if the input
is lousy. */
if (umask_value == -1)
{
sh_erange (list->word->word, _("octal number"));
return (EXECUTION_FAILURE);
}
}
else
{
umask_value = symbolic_umask (list);
if (umask_value == -1)
return (EXECUTION_FAILURE);
}
umask_arg = (mode_t)umask_value;
umask (umask_arg);
if (print_symbolically)
print_symbolic_umask (umask_arg);
}
else /* Display the UMASK for this user. */
{
umask_arg = umask (022);
umask (umask_arg);
if (pflag)
printf ("umask%s ", (print_symbolically ? " -S" : ""));
if (print_symbolically)
print_symbolic_umask (umask_arg);
else
printf ("%04lo\n", (unsigned long)umask_arg);
}
fflush (stdout);
return (EXECUTION_SUCCESS);
}
/* Print the umask in a symbolic form. In the output, a letter is
printed if the corresponding bit is clear in the umask. */
static void
print_symbolic_umask (um)
mode_t um;
{
char ubits[4], gbits[4], obits[4]; /* u=rwx,g=rwx,o=rwx */
int i;
i = 0;
if ((um & S_IRUSR) == 0)
ubits[i++] = 'r';
if ((um & S_IWUSR) == 0)
ubits[i++] = 'w';
if ((um & S_IXUSR) == 0)
ubits[i++] = 'x';
ubits[i] = '\0';
i = 0;
if ((um & S_IRGRP) == 0)
gbits[i++] = 'r';
if ((um & S_IWGRP) == 0)
gbits[i++] = 'w';
if ((um & S_IXGRP) == 0)
gbits[i++] = 'x';
gbits[i] = '\0';
i = 0;
if ((um & S_IROTH) == 0)
obits[i++] = 'r';
if ((um & S_IWOTH) == 0)
obits[i++] = 'w';
if ((um & S_IXOTH) == 0)
obits[i++] = 'x';
obits[i] = '\0';
printf ("u=%s,g=%s,o=%s\n", ubits, gbits, obits);
}
int
parse_symbolic_mode (mode, initial_bits)
char *mode;
int initial_bits;
{
int who, op, perm, bits, c;
char *s;
for (s = mode, bits = initial_bits;;)
{
who = op = perm = 0;
/* Parse the `who' portion of the symbolic mode clause. */
while (member (*s, "agou"))
{
switch (c = *s++)
{
case 'u':
who |= S_IRWXU;
continue;
case 'g':
who |= S_IRWXG;
continue;
case 'o':
who |= S_IRWXO;
continue;
case 'a':
who |= S_IRWXU | S_IRWXG | S_IRWXO;
continue;
default:
break;
}
}
/* The operation is now sitting in *s. */
op = *s++;
switch (op)
{
case '+':
case '-':
case '=':
break;
default:
builtin_error (_("`%c': invalid symbolic mode operator"), op);
return (-1);
}
/* Parse out the `perm' section of the symbolic mode clause. */
while (member (*s, "rwx"))
{
c = *s++;
switch (c)
{
case 'r':
perm |= S_IRUGO;
break;
case 'w':
perm |= S_IWUGO;
break;
case 'x':
perm |= S_IXUGO;
break;
}
}
/* Now perform the operation or return an error for a
bad permission string. */
if (!*s || *s == ',')
{
if (who)
perm &= who;
switch (op)
{
case '+':
bits |= perm;
break;
case '-':
bits &= ~perm;
break;
case '=':
bits &= ~who;
bits |= perm;
break;
/* No other values are possible. */
}
if (*s == '\0')
break;
else
s++; /* skip past ',' */
}
else
{
builtin_error (_("`%c': invalid symbolic mode character"), *s);
return (-1);
}
}
return (bits);
}
/* Set the umask from a symbolic mode string similar to that accepted
by chmod. If the -S argument is given, then print the umask in a
symbolic form. */
static int
symbolic_umask (list)
WORD_LIST *list;
{
int um, bits;
/* Get the initial umask. Don't change it yet. */
um = umask (022);
umask (um);
/* All work is done with the complement of the umask -- it's
more intuitive and easier to deal with. It is complemented
again before being returned. */
bits = parse_symbolic_mode (list->word->word, ~um & 0777);
if (bits == -1)
return (-1);
um = ~bits & 0777;
return (um);
}
Vendored
+11 -11
View File
@@ -1,7 +1,7 @@
#! /bin/sh
# From configure.in for Bash 3.0, version 3.164, from autoconf version AC_ACVERSION.
# From configure.in for Bash 3.0, version 3.165, from autoconf version AC_ACVERSION.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.57 for bash 3.0-rc1.
# Generated by GNU Autoconf 2.57 for bash 3.0-release.
#
# Report bugs to <bug-bash@gnu.org>.
#
@@ -269,8 +269,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='bash'
PACKAGE_TARNAME='bash'
PACKAGE_VERSION='3.0-rc1'
PACKAGE_STRING='bash 3.0-rc1'
PACKAGE_VERSION='3.0-release'
PACKAGE_STRING='bash 3.0-release'
PACKAGE_BUGREPORT='bug-bash@gnu.org'
ac_unique_file="shell.h"
@@ -784,7 +784,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures bash 3.0-rc1 to adapt to many kinds of systems.
\`configure' configures bash 3.0-release to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -845,7 +845,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of bash 3.0-rc1:";;
short | recursive ) echo "Configuration of bash 3.0-release:";;
esac
cat <<\_ACEOF
@@ -1000,7 +1000,7 @@ fi
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
bash configure 3.0-rc1
bash configure 3.0-release
generated by GNU Autoconf 2.57
Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
@@ -1015,7 +1015,7 @@ cat >&5 <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by bash $as_me 3.0-rc1, which was
It was created by bash $as_me 3.0-release, which was
generated by GNU Autoconf 2.57. Invocation command line was
$ $0 $@
@@ -1384,7 +1384,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
BASHVERS=3.0
RELSTATUS=rc1
RELSTATUS=release
case "$RELSTATUS" in
alp*|bet*|dev*|rc*) DEBUG='-DDEBUG' MALLOC_DEBUG='-DMALLOC_DEBUG' ;;
@@ -24610,7 +24610,7 @@ _ASBOX
} >&5
cat >&5 <<_CSEOF
This file was extended by bash $as_me 3.0-rc1, which was
This file was extended by bash $as_me 3.0-release, which was
generated by GNU Autoconf 2.57. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -24673,7 +24673,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
bash config.status 3.0-rc1
bash config.status 3.0-release
configured by $0, generated by GNU Autoconf 2.57,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
+6 -11
View File
@@ -147,7 +147,7 @@ A3) Where can I get it?
Bash is the GNU project's shell, and so is available from the
master GNU archive site, ftp.gnu.org, and its mirrors. The
latest version is also available for FTP from ftp.cwru.edu.
The following URLs tell how to get version 2.05b:
The following URLs tell how to get version 3.0:
ftp://ftp.gnu.org/pub/gnu/bash/bash-3.0.tar.gz
ftp://ftp.cwru.edu/pub/bash/bash-3.0.tar.gz
@@ -159,10 +159,10 @@ ftp://ftp.cwru.edu/pub/bash/bash-doc-3.0.tar.gz
A4) On what machines will bash run?
Bash has been ported to nearly every version of UNIX. All you
Bash has been ported to nearly every version of Unix. All you
should have to do to build it on a machine for which a port
exists is to type `configure' and then `make'. The build process
will attempt to discover the version of UNIX you have and tailor
will attempt to discover the version of Unix you have and tailor
itself accordingly, using a script created by GNU autoconf.
More information appears in the file `INSTALL' in the distribution.
@@ -195,11 +195,6 @@ part of their current release.
Bash-2.05b and later versions should require no local Cygnus changes to
build and run under CYGWIN.
The Cygnus port works only on Intel machines. There is a port of bash
(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
DJ Delorie has a port of bash-2.x which runs under MS-DOS, as part
of the DJGPP project. For more information on the project, see
@@ -214,7 +209,7 @@ ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/bsh204b.zip binary
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/bsh204d.zip documentation
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/bsh204s.zip source
Mark has begun to work with bash-2.05, but I don't know the status.
Mark began to work with bash-2.05, but I don't know the current status.
Bash-3.0 compiles and runs with no modifications under Microsoft's Services
for Unix (SFU), once known as Interix.
@@ -797,7 +792,7 @@ Things bash has or uses that ksh88 does not:
redirection to /dev/fd/N, /dev/stdin, /dev/stdout, /dev/stderr
arrays of unlimited size
TMOUT is default timeout for `read' and `select'
debugger support
debugger support, including the `caller' builtin
RETURN trap
Timestamps in history entries
{x..y} brace expansion
@@ -1758,7 +1753,7 @@ H3) What's coming in future versions?
These are features I hope to include in a future version of bash.
a better bash debugger (a minimally-tested version is included with bash-2.05b)
Rocky Bernstein's bash debugger (support is included with bash-3.0)
associative arrays
co-processes, but with a new-style syntax that looks like function declaration
+1073 -1073
View File
File diff suppressed because it is too large Load Diff
+1 -2
View File
@@ -487,7 +487,6 @@ command:
.if n ! case do done elif else esac fi for function if in select then until while { } time [[ ]]
.if t ! case do done elif else esac fi for function if in select then until while { } time [[ ]]
.if t .RE
.RE
.SH "SHELL GRAMMAR"
.SS Simple Commands
.PP
@@ -4164,7 +4163,7 @@ the username of the current user
the version of \fBbash\fP (e.g., 2.00)
.TP
.B \eV
the release of \fBbash\fP, version + patchelvel (e.g., 2.00.0)
the release of \fBbash\fP, version + patch level (e.g., 2.00.0)
.TP
.B \ew
the current working directory, with \fB$HOME\fP abbreviated with a tilde
+3 -1
View File
@@ -40,6 +40,8 @@ extern int set_job_control __P((int));
extern char *shell_name;
#endif
extern int shell_initialized;
/* -c, -s invocation options -- not really flags, but they show up in $- */
extern int want_pending_command, read_from_stdin;
@@ -280,7 +282,7 @@ change_flag (flag, on_or_off)
#if defined (RESTRICTED_SHELL)
case 'r':
if (on_or_off == FLAG_ON)
if (on_or_off == FLAG_ON && shell_initialized)
maybe_make_restricted (shell_name);
break;
#endif
+355
View File
@@ -0,0 +1,355 @@
/* flags.c -- Everything about flags except the `set' command. That
is in builtins.c */
/* Copyright (C) 1987,1989 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
Bash is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along
with Bash; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
/* Flags hacking. */
#include "config.h"
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif
#include "shell.h"
#include "flags.h"
#if defined (BANG_HISTORY)
# include "bashhist.h"
#endif
#if defined (JOB_CONTROL)
extern int set_job_control __P((int));
#endif
#if defined (RESTRICTED_SHELL)
extern char *shell_name;
#endif
extern int shell_intialized;
/* -c, -s invocation options -- not really flags, but they show up in $- */
extern int want_pending_command, read_from_stdin;
/* **************************************************************** */
/* */
/* The Standard Sh Flags. */
/* */
/* **************************************************************** */
/* Non-zero means automatically mark variables which are modified or created
as auto export variables. */
int mark_modified_vars = 0;
/* Non-zero causes asynchronous job notification. Otherwise, job state
notification only takes place just before a primary prompt is printed. */
int asynchronous_notification = 0;
/* Non-zero means exit immediately if a command exits with a non-zero
exit status. */
int exit_immediately_on_error = 0;
/* Non-zero means disable filename globbing. */
int disallow_filename_globbing = 0;
/* Non-zero means that all keyword arguments are placed into the environment
for a command, not just those that appear on the line before the command
name. */
int place_keywords_in_env = 0;
/* Non-zero means read commands, but don't execute them. This is useful
for debugging shell scripts that should do something hairy and possibly
destructive. */
int read_but_dont_execute = 0;
/* Non-zero means end of file is after one command. */
int just_one_command = 0;
/* Non-zero means don't overwrite existing files while doing redirections. */
int noclobber = 0;
/* Non-zero means trying to get the value of $i where $i is undefined
causes an error, instead of a null substitution. */
int unbound_vars_is_error = 0;
/* Non-zero means type out input lines after you read them. */
int echo_input_at_read = 0;
/* Non-zero means type out the command definition after reading, but
before executing. */
int echo_command_at_execute = 0;
/* Non-zero means turn on the job control features. */
int jobs_m_flag = 0;
/* Non-zero means this shell is interactive, even if running under a
pipe. */
int forced_interactive = 0;
/* By default, follow the symbolic links as if they were real directories
while hacking the `cd' command. This means that `cd ..' moves up in
the string of symbolic links that make up the current directory, instead
of the absolute directory. The shell variable `nolinks' also controls
this flag. */
int no_symbolic_links = 0;
/* **************************************************************** */
/* */
/* Non-Standard Flags Follow Here. */
/* */
/* **************************************************************** */
#if 0
/* Non-zero means do lexical scoping in the body of a FOR command. */
int lexical_scoping = 0;
#endif
/* Non-zero means no such thing as invisible variables. */
int no_invisible_vars = 0;
/* Non-zero means look up and remember command names in a hash table, */
int hashing_enabled = 1;
#if defined (BANG_HISTORY)
/* Non-zero means that we are doing history expansion. The default.
This means !22 gets the 22nd line of history. */
int history_expansion = 1;
#endif /* BANG_HISTORY */
/* Non-zero means that we allow comments to appear in interactive commands. */
int interactive_comments = 1;
#if defined (RESTRICTED_SHELL)
/* Non-zero means that this shell is `restricted'. A restricted shell
disallows: changing directories, command or path names containing `/',
unsetting or resetting the values of $PATH and $SHELL, and any type of
output redirection. */
int restricted = 0; /* currently restricted */
int restricted_shell = 0; /* shell was started in restricted mode. */
#endif /* RESTRICTED_SHELL */
/* Non-zero means that this shell is running in `privileged' mode. This
is required if the shell is to run setuid. If the `-p' option is
not supplied at startup, and the real and effective uids or gids
differ, disable_priv_mode is called to relinquish setuid status. */
int privileged_mode = 0;
#if defined (BRACE_EXPANSION)
/* Zero means to disable brace expansion: foo{a,b} -> fooa foob */
int brace_expansion = 1;
#endif
/* Non-zero means that shell functions inherit the DEBUG trap. */
int function_trace_mode = 0;
/* Non-zero means that shell functions inherit the ERR trap. */
int error_trace_mode = 0;
/* Non-zero means that the rightmost non-zero exit status in a pipeline
is the exit status of the entire pipeline. If each processes exits
with a 0 status, the status of the pipeline is 0. */
int pipefail_opt = 0;
/* **************************************************************** */
/* */
/* The Flags ALIST. */
/* */
/* **************************************************************** */
struct flags_alist shell_flags[] = {
/* Standard sh flags. */
{ 'a', &mark_modified_vars },
#if defined (JOB_CONTROL)
{ 'b', &asynchronous_notification },
#endif /* JOB_CONTROL */
{ 'e', &exit_immediately_on_error },
{ 'f', &disallow_filename_globbing },
{ 'h', &hashing_enabled },
{ 'i', &forced_interactive },
{ 'k', &place_keywords_in_env },
#if defined (JOB_CONTROL)
{ 'm', &jobs_m_flag },
#endif /* JOB_CONTROL */
{ 'n', &read_but_dont_execute },
{ 'p', &privileged_mode },
#if defined (RESTRICTED_SHELL)
{ 'r', &restricted },
#endif /* RESTRICTED_SHELL */
{ 't', &just_one_command },
{ 'u', &unbound_vars_is_error },
{ 'v', &echo_input_at_read },
{ 'x', &echo_command_at_execute },
/* New flags that control non-standard things. */
#if 0
{ 'l', &lexical_scoping },
#endif
#if defined (BRACE_EXPANSION)
{ 'B', &brace_expansion },
#endif
{ 'C', &noclobber },
{ 'E', &error_trace_mode },
#if defined (BANG_HISTORY)
{ 'H', &history_expansion },
#endif /* BANG_HISTORY */
{ 'I', &no_invisible_vars },
{ 'P', &no_symbolic_links },
{ 'T', &function_trace_mode },
{0, (int *)NULL}
};
#define NUM_SHELL_FLAGS (sizeof (shell_flags) / sizeof (struct flags_alist))
char optflags[NUM_SHELL_FLAGS+4] = { '+' };
int *
find_flag (name)
int name;
{
int i;
for (i = 0; shell_flags[i].name; i++)
{
if (shell_flags[i].name == name)
return (shell_flags[i].value);
}
return (FLAG_UNKNOWN);
}
/* Change the state of a flag, and return it's original value, or return
FLAG_ERROR if there is no flag FLAG. ON_OR_OFF must be either
FLAG_ON or FLAG_OFF. */
int
change_flag (flag, on_or_off)
int flag;
int on_or_off;
{
int *value, old_value;
#if defined (RESTRICTED_SHELL)
/* Don't allow "set +r" in a shell which is `restricted'. */
if (restricted && flag == 'r' && on_or_off == FLAG_OFF)
return (FLAG_ERROR);
#endif /* RESTRICTED_SHELL */
value = find_flag (flag);
if ((value == (int *)FLAG_UNKNOWN) || (on_or_off != FLAG_ON && on_or_off != FLAG_OFF))
return (FLAG_ERROR);
old_value = *value;
*value = (on_or_off == FLAG_ON) ? 1 : 0;
/* Special cases for a few flags. */
switch (flag)
{
#if defined (BANG_HISTORY)
case 'H':
if (on_or_off == FLAG_ON)
bash_initialize_history ();
break;
#endif
#if defined (JOB_CONTROL)
case 'm':
set_job_control (on_or_off == FLAG_ON);
break;
#endif /* JOB_CONTROL */
case 'n':
if (interactive_shell)
read_but_dont_execute = 0;
break;
case 'p':
if (on_or_off == FLAG_OFF)
disable_priv_mode ();
break;
#if defined (RESTRICTED_SHELL)
case 'r':
if (on_or_off == FLAG_ON && shell_initialized)
maybe_make_restricted (shell_name);
break;
#endif
}
return (old_value);
}
/* Return a string which is the names of all the currently
set shell flags. */
char *
which_set_flags ()
{
char *temp;
int i, string_index;
temp = (char *)xmalloc (1 + NUM_SHELL_FLAGS + read_from_stdin + want_pending_command);
for (i = string_index = 0; shell_flags[i].name; i++)
if (*(shell_flags[i].value))
temp[string_index++] = shell_flags[i].name;
if (want_pending_command)
temp[string_index++] = 'c';
if (read_from_stdin)
temp[string_index++] = 's';
temp[string_index] = '\0';
return (temp);
}
void
reset_shell_flags ()
{
mark_modified_vars = exit_immediately_on_error = disallow_filename_globbing = 0;
place_keywords_in_env = read_but_dont_execute = just_one_command = 0;
noclobber = unbound_vars_is_error = echo_input_at_read = 0;
echo_command_at_execute = jobs_m_flag = forced_interactive = 0;
no_symbolic_links = no_invisible_vars = privileged_mode = pipefail_opt = 0;
hashing_enabled = interactive_comments = 1;
#if defined (JOB_CONTROL)
asynchronous_notification = 0;
#endif
#if defined (BANG_HISTORY)
history_expansion = 1;
#endif
#if defined (BRACE_EXPANSION)
brace_expansion = 1;
#endif
#if defined (RESTRICTED_SHELL)
restricted = 0;
#endif
}
void
initialize_flags ()
{
register int i;
for (i = 0; shell_flags[i].name; i++)
optflags[i+1] = shell_flags[i].name;
optflags[++i] = 'o';
optflags[++i] = ';';
optflags[i+1] = '\0';
}
+5
View File
@@ -212,6 +212,11 @@ rl_gather_tyi ()
fcntl (tty, F_SETFL, tem);
if (chars_avail == -1 && errno == EAGAIN)
return 0;
if (chars_avail == 0) /* EOF */
{
rl_stuff_char (EOF);
return (0);
}
}
#endif /* O_NDELAY */
+6
View File
@@ -816,6 +816,12 @@ struct readline_state {
int catchsigs;
int catchsigwinch;
/* search state */
/* completion state */
/* options state */
/* reserved for future expansion, so the struct size doesn't change */
char reserved[64];
};
+3 -1
View File
@@ -784,7 +784,9 @@ rl_vi_put (count, key)
if (!_rl_uppercase_p (key) && (rl_point + 1 <= rl_end))
rl_point = _rl_find_next_mbchar (rl_line_buffer, rl_point, 1, MB_FIND_NONZERO);
rl_yank (1, key);
while (count--)
rl_yank (1, key);
rl_backward_char (1, key);
return (0);
}