mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-30 08:59:56 +02:00
commit bash-20040512 snapshot
This commit is contained in:
@@ -17,6 +17,56 @@ d. Fixed a bug that caused `pwd' to not display anything in physical mode
|
||||
e. Fixed a bug in the pre- and post- increment and decrement parsing in the
|
||||
expression evaluator that caused errors when the operands and corresponding
|
||||
operators were separated by whitespace.
|
||||
|
||||
f. Fixed a bug that caused `history -p' to add an entry to the history list,
|
||||
counter to the documentation. (Keeps the history expansions invoked by
|
||||
emacs-mode command line editing from doing that as well.)
|
||||
|
||||
g. Fixed a bug that could cause a core dump if `cd' is asked to print out a
|
||||
pathname longer than PATH_MAX characters.
|
||||
|
||||
h. Fixed a bug that caused jobs to be put into the wrong process group under
|
||||
some circumstances after enabling job control with `set -m'.
|
||||
|
||||
i. `unalias' now returns failure if no alias name arguments are supplied.
|
||||
|
||||
j. Documented the characters not allowed to appear in an alias name.
|
||||
|
||||
k. $* is no longer expanded as if in double quotes when it appears in the
|
||||
body of a here document, as the SUS seems to require.
|
||||
|
||||
l. The `bashbug' script now uses a directory in $TMPDIR for exclusive
|
||||
access rather than trying to guess how the underlying OS provides for
|
||||
secure temporary file creation.
|
||||
|
||||
m. Fixed a few problems with `cd' and `pwd' when asked to operate on pathnames
|
||||
longer than PATH_MAX characters.
|
||||
|
||||
n. Fixed a memory leak caused when creating multiple local array variables
|
||||
with identical names.
|
||||
|
||||
2. Changes to Readline
|
||||
|
||||
a. Fixed a problem that could cause readline to refer to freed memory when
|
||||
moving between history lines while doing searches.
|
||||
|
||||
b. Improvements to the code that expands and displays prompt strings
|
||||
containing multibyte characters.
|
||||
|
||||
c. Fixed a problem with vi-mode not correctly remembering the numeric argument
|
||||
to the last `c'hange command for later use with `.'.
|
||||
|
||||
d. Fixed a bug in vi-mode that caused multi-digit count arguments to work
|
||||
incorrectly.
|
||||
|
||||
e. Fixed a problem in vi-mode that caused the last text modification command
|
||||
to not be remembered across different command lines.
|
||||
|
||||
3. New Features in Bash
|
||||
|
||||
a. The `jobs', `kill', and `wait' builtins now accept job control notation
|
||||
even if job control is not enabled.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
This document details the changes between this version, bash-3.0-beta1,
|
||||
and the previous version, bash-3.0-alpha.
|
||||
|
||||
+10
-1
@@ -9329,7 +9329,7 @@ builtins/cd.def
|
||||
4/12
|
||||
----
|
||||
print_cmd.c
|
||||
- new functionto print out assignment statements when `set -x' has
|
||||
- new function to print out assignment statements when `set -x' has
|
||||
been enabled: xtrace_print_assignment
|
||||
|
||||
externs.h
|
||||
@@ -9448,4 +9448,13 @@ lib/readline/text.c
|
||||
(_rl_vi_last_command) is not a text modification command. This lets
|
||||
the last-command and last-argument work across command lines
|
||||
|
||||
5/13
|
||||
----
|
||||
builtins/common.c
|
||||
- use getcwd(0,0) rather than providing a fixed pathname with a fixed
|
||||
length (PATH_MAX) so getcwd() will allocate sufficient memory
|
||||
|
||||
aclocal.m4
|
||||
- change BASH_FUNC_GETCWD to check whether or not getcwd(0,0) will
|
||||
allocate memory for the returned value -- nobody implements that
|
||||
and getcwd-via-popen, so it should capture the old test as well
|
||||
|
||||
+13
-2
@@ -9329,7 +9329,7 @@ builtins/cd.def
|
||||
4/12
|
||||
----
|
||||
print_cmd.c
|
||||
- new functionto print out assignment statements when `set -x' has
|
||||
- new function to print out assignment statements when `set -x' has
|
||||
been enabled: xtrace_print_assignment
|
||||
|
||||
externs.h
|
||||
@@ -9445,5 +9445,16 @@ lib/readline/rlprivate.h
|
||||
|
||||
lib/readline/text.c
|
||||
- change rl_newline to only call _rl_vi_reset_last if the last command
|
||||
(_rl_vi_last_command) is not a text modification command
|
||||
(_rl_vi_last_command) is not a text modification command. This lets
|
||||
the last-command and last-argument work across command lines
|
||||
|
||||
5/13
|
||||
----
|
||||
builtins/common.c
|
||||
- use getcwd(0,0) rather than providing a fixed pathname with a fixed
|
||||
length (PATH_MAX)
|
||||
|
||||
aclocal.m4
|
||||
- change BASH_FUNC_GETCWD to check whether or not getcwd(0,0) will
|
||||
allocate memory for the returned value -- nobody implements that
|
||||
and getcwd-via-popen
|
||||
|
||||
@@ -137,6 +137,9 @@ nn. The parameter pattern removal and substitution expansions are now much
|
||||
oo. Fixed a bug in the `shift' builtin that could cause core dumps when
|
||||
reporting an out-of-range argument.
|
||||
|
||||
pp. The `jobs', `kill', and `wait' builtins now accept job control notation
|
||||
even if job control is not enabled.
|
||||
|
||||
2. New Features in Readline
|
||||
|
||||
a. History expansion has a new `a' modifier equivalent to the `g' modifier
|
||||
|
||||
Vendored
+10
-49
@@ -685,65 +685,26 @@ fi
|
||||
])
|
||||
|
||||
AC_DEFUN(BASH_FUNC_GETCWD,
|
||||
[AC_MSG_CHECKING([if getcwd() calls popen()])
|
||||
AC_CACHE_VAL(bash_cv_getcwd_calls_popen,
|
||||
[AC_MSG_CHECKING([if getcwd() will dynamically allocate memory])
|
||||
AC_CACHE_VAL(bash_cv_getcwd_malloc,
|
||||
[AC_TRY_RUN([
|
||||
#include <stdio.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifndef __STDC__
|
||||
#ifndef const
|
||||
#define const
|
||||
#endif
|
||||
#endif
|
||||
|
||||
int popen_called;
|
||||
|
||||
FILE *
|
||||
popen(command, type)
|
||||
const char *command;
|
||||
const char *type;
|
||||
{
|
||||
popen_called = 1;
|
||||
return (FILE *)NULL;
|
||||
}
|
||||
|
||||
FILE *_popen(command, type)
|
||||
const char *command;
|
||||
const char *type;
|
||||
{
|
||||
return (popen (command, type));
|
||||
}
|
||||
|
||||
int
|
||||
pclose(stream)
|
||||
FILE *stream;
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
_pclose(stream)
|
||||
FILE *stream;
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
main()
|
||||
{
|
||||
char lbuf[32];
|
||||
popen_called = 0;
|
||||
getcwd(lbuf, 32);
|
||||
exit (popen_called);
|
||||
char *xpwd;
|
||||
xpwd = getcwd(0, 0);
|
||||
exit (xpwd == 0);
|
||||
}
|
||||
], bash_cv_getcwd_calls_popen=no, bash_cv_getcwd_calls_popen=yes,
|
||||
[AC_MSG_WARN(cannot check whether getcwd calls popen if cross compiling -- defaulting to no)
|
||||
bash_cv_getcwd_calls_popen=no]
|
||||
], bash_cv_getcwd_malloc=yes, bash_cv_getcwd_malloc=no,
|
||||
[AC_MSG_WARN(cannot check whether getcwd allocates memory when cross-compiling -- defaulting to no)
|
||||
bash_cv_getcwd_malloc=no]
|
||||
)])
|
||||
AC_MSG_RESULT($bash_cv_getcwd_calls_popen)
|
||||
if test $bash_cv_getcwd_calls_popen = yes; then
|
||||
AC_MSG_RESULT($bash_cv_getcwd_malloc)
|
||||
if test $bash_cv_getcwd_malloc = no; then
|
||||
AC_DEFINE(GETCWD_BROKEN)
|
||||
AC_LIBOBJ(getcwd)
|
||||
fi
|
||||
|
||||
Vendored
+3952
File diff suppressed because it is too large
Load Diff
+24
-63
@@ -1,7 +1,7 @@
|
||||
@%:@! /bin/sh
|
||||
@%:@ From configure.in for Bash 3.0, version 3.163, from autoconf version AC_ACVERSION.
|
||||
@%:@ Guess values for system-dependent variables and create Makefiles.
|
||||
@%:@ Generated by GNU Autoconf 2.57 for bash 3.0-beta1.
|
||||
@%:@ Generated by GNU Autoconf 2.57 for bash 3.0-rc1.
|
||||
@%:@
|
||||
@%:@ 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-beta1'
|
||||
PACKAGE_STRING='bash 3.0-beta1'
|
||||
PACKAGE_VERSION='3.0-rc1'
|
||||
PACKAGE_STRING='bash 3.0-rc1'
|
||||
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-beta1 to adapt to many kinds of systems.
|
||||
\`configure' configures bash 3.0-rc1 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-beta1:";;
|
||||
short | recursive ) echo "Configuration of bash 3.0-rc1:";;
|
||||
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-beta1
|
||||
bash configure 3.0-rc1
|
||||
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-beta1, which was
|
||||
It was created by bash $as_me 3.0-rc1, 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=beta1
|
||||
RELSTATUS=rc1
|
||||
|
||||
case "$RELSTATUS" in
|
||||
alp*|bet*|dev*|rc*) DEBUG='-DDEBUG' MALLOC_DEBUG='-DMALLOC_DEBUG' ;;
|
||||
@@ -22430,15 +22430,15 @@ _ACEOF
|
||||
fi
|
||||
|
||||
if test "$ac_cv_func_getcwd" = "yes"; then
|
||||
echo "$as_me:$LINENO: checking if getcwd() calls popen()" >&5
|
||||
echo $ECHO_N "checking if getcwd() calls popen()... $ECHO_C" >&6
|
||||
if test "${bash_cv_getcwd_calls_popen+set}" = set; then
|
||||
echo "$as_me:$LINENO: checking if getcwd() will dynamically allocate memory" >&5
|
||||
echo $ECHO_N "checking if getcwd() will dynamically allocate memory... $ECHO_C" >&6
|
||||
if test "${bash_cv_getcwd_malloc+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
if test "$cross_compiling" = yes; then
|
||||
{ echo "$as_me:$LINENO: WARNING: cannot check whether getcwd calls popen if cross compiling -- defaulting to no" >&5
|
||||
echo "$as_me: WARNING: cannot check whether getcwd calls popen if cross compiling -- defaulting to no" >&2;}
|
||||
bash_cv_getcwd_calls_popen=no
|
||||
{ echo "$as_me:$LINENO: WARNING: cannot check whether getcwd allocates memory when cross-compiling -- defaulting to no" >&5
|
||||
echo "$as_me: WARNING: cannot check whether getcwd allocates memory when cross-compiling -- defaulting to no" >&2;}
|
||||
bash_cv_getcwd_malloc=no
|
||||
|
||||
else
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
@@ -22454,50 +22454,11 @@ cat >>conftest.$ac_ext <<_ACEOF
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifndef __STDC__
|
||||
#ifndef const
|
||||
#define const
|
||||
#endif
|
||||
#endif
|
||||
|
||||
int popen_called;
|
||||
|
||||
FILE *
|
||||
popen(command, type)
|
||||
const char *command;
|
||||
const char *type;
|
||||
{
|
||||
popen_called = 1;
|
||||
return (FILE *)NULL;
|
||||
}
|
||||
|
||||
FILE *_popen(command, type)
|
||||
const char *command;
|
||||
const char *type;
|
||||
{
|
||||
return (popen (command, type));
|
||||
}
|
||||
|
||||
int
|
||||
pclose(stream)
|
||||
FILE *stream;
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
_pclose(stream)
|
||||
FILE *stream;
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
main()
|
||||
{
|
||||
char lbuf[32];
|
||||
popen_called = 0;
|
||||
getcwd(lbuf, 32);
|
||||
exit (popen_called);
|
||||
char *xpwd;
|
||||
xpwd = getcwd(0, 0);
|
||||
exit (xpwd == 0);
|
||||
}
|
||||
|
||||
_ACEOF
|
||||
@@ -22512,22 +22473,22 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
bash_cv_getcwd_calls_popen=no
|
||||
bash_cv_getcwd_malloc=yes
|
||||
else
|
||||
echo "$as_me: program exited with status $ac_status" >&5
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
( exit $ac_status )
|
||||
bash_cv_getcwd_calls_popen=yes
|
||||
bash_cv_getcwd_malloc=no
|
||||
fi
|
||||
rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "$as_me:$LINENO: result: $bash_cv_getcwd_calls_popen" >&5
|
||||
echo "${ECHO_T}$bash_cv_getcwd_calls_popen" >&6
|
||||
if test $bash_cv_getcwd_calls_popen = yes; then
|
||||
echo "$as_me:$LINENO: result: $bash_cv_getcwd_malloc" >&5
|
||||
echo "${ECHO_T}$bash_cv_getcwd_malloc" >&6
|
||||
if test $bash_cv_getcwd_malloc = no; then
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
@%:@define GETCWD_BROKEN 1
|
||||
_ACEOF
|
||||
@@ -24642,7 +24603,7 @@ _ASBOX
|
||||
} >&5
|
||||
cat >&5 <<_CSEOF
|
||||
|
||||
This file was extended by bash $as_me 3.0-beta1, which was
|
||||
This file was extended by bash $as_me 3.0-rc1, which was
|
||||
generated by GNU Autoconf 2.57. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
@@ -24705,7 +24666,7 @@ _ACEOF
|
||||
|
||||
cat >>$CONFIG_STATUS <<_ACEOF
|
||||
ac_cs_version="\\
|
||||
bash config.status 3.0-beta1
|
||||
bash config.status 3.0-rc1
|
||||
configured by $0, generated by GNU Autoconf 2.57,
|
||||
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
|
||||
|
||||
|
||||
+86
-86
@@ -15,96 +15,96 @@
|
||||
'configure.in'
|
||||
],
|
||||
{
|
||||
'AC_FUNC_STRCOLL' => 1,
|
||||
'AC_FUNC_STRTOD' => 1,
|
||||
'AC_PROG_LIBTOOL' => 1,
|
||||
'AC_HEADER_STDC' => 1,
|
||||
'AC_PROG_CXX' => 1,
|
||||
'AC_FUNC_ALLOCA' => 1,
|
||||
'AC_FUNC_ERROR_AT_LINE' => 1,
|
||||
'AM_AUTOMAKE_VERSION' => 1,
|
||||
'm4_pattern_allow' => 1,
|
||||
'AC_PROG_MAKE_SET' => 1,
|
||||
'AC_FUNC_GETGROUPS' => 1,
|
||||
'AC_C_VOLATILE' => 1,
|
||||
'AC_FUNC_STRFTIME' => 1,
|
||||
'AC_PATH_X' => 1,
|
||||
'AC_CHECK_TYPES' => 1,
|
||||
'AC_FUNC_MKTIME' => 1,
|
||||
'AH_OUTPUT' => 1,
|
||||
'AC_CONFIG_SUBDIRS' => 1,
|
||||
'AC_HEADER_MAJOR' => 1,
|
||||
'AM_INIT_AUTOMAKE' => 1,
|
||||
'AC_TYPE_MODE_T' => 1,
|
||||
'm4_pattern_forbid' => 1,
|
||||
'AC_INIT' => 1,
|
||||
'AC_PROG_RANLIB' => 1,
|
||||
'AC_STRUCT_TIMEZONE' => 1,
|
||||
'AC_FUNC_OBSTACK' => 1,
|
||||
'AC_DECL_SYS_SIGLIST' => 1,
|
||||
'AC_TYPE_UID_T' => 1,
|
||||
'm4_include' => 1,
|
||||
'AC_FUNC_FORK' => 1,
|
||||
'AC_PROG_CPP' => 1,
|
||||
'AC_PROG_GCC_TRADITIONAL' => 1,
|
||||
'AC_PROG_LN_S' => 1,
|
||||
'AM_CONDITIONAL' => 1,
|
||||
'AC_FUNC_SETVBUF_REVERSED' => 1,
|
||||
'include' => 1,
|
||||
'AC_FUNC_GETPGRP' => 1,
|
||||
'AC_FUNC_SELECT_ARGTYPES' => 1,
|
||||
'AC_FUNC_FSEEKO' => 1,
|
||||
'AC_FUNC_UTIME_NULL' => 1,
|
||||
'AC_CONFIG_AUX_DIR' => 1,
|
||||
'AC_FUNC_STRERROR_R' => 1,
|
||||
'AC_FUNC_WAIT3' => 1,
|
||||
'AC_CONFIG_FILES' => 1,
|
||||
'AC_TYPE_SIZE_T' => 1,
|
||||
'AC_PROG_YACC' => 1,
|
||||
'AC_HEADER_STAT' => 1,
|
||||
'AC_FUNC_LSTAT' => 1,
|
||||
'AC_FUNC_MMAP' => 1,
|
||||
'AC_CHECK_HEADERS' => 1,
|
||||
'AC_C_CONST' => 1,
|
||||
'AC_PROG_AWK' => 1,
|
||||
'AC_TYPE_SIGNAL' => 1,
|
||||
'AC_HEADER_SYS_WAIT' => 1,
|
||||
'AC_FUNC_REALLOC' => 1,
|
||||
'AC_LIBSOURCE' => 1,
|
||||
'AC_DEFINE_TRACE_LITERAL' => 1,
|
||||
'AC_CONFIG_HEADERS' => 1,
|
||||
'AC_FUNC_STAT' => 1,
|
||||
'AC_CHECK_LIB' => 1,
|
||||
'AC_REPLACE_FNMATCH' => 1,
|
||||
'AC_C_INLINE' => 1,
|
||||
'AC_FUNC_GETMNTENT' => 1,
|
||||
'AC_TYPE_OFF_T' => 1,
|
||||
'AC_CANONICAL_SYSTEM' => 1,
|
||||
'AC_FUNC_SETPGRP' => 1,
|
||||
'AC_STRUCT_ST_BLOCKS' => 1,
|
||||
'AC_FUNC_MEMCMP' => 1,
|
||||
'AC_CHECK_FUNCS' => 1,
|
||||
'AC_HEADER_TIME' => 1,
|
||||
'AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK' => 1,
|
||||
'AC_FUNC_STRNLEN' => 1,
|
||||
'AM_MAINTAINER_MODE' => 1,
|
||||
'AC_TYPE_PID_T' => 1,
|
||||
'AC_PROG_INSTALL' => 1,
|
||||
'AC_PROG_LEX' => 1,
|
||||
'AC_FUNC_MBRTOWC' => 1,
|
||||
'AM_PROG_CC_C_O' => 1,
|
||||
'AC_FUNC_MALLOC' => 1,
|
||||
'AC_PROG_CC' => 1,
|
||||
'AC_FUNC_CHOWN' => 1,
|
||||
'AC_STRUCT_TM' => 1,
|
||||
'AC_FUNC_GETLOADAVG' => 1,
|
||||
'AC_HEADER_STAT' => 1,
|
||||
'AC_CONFIG_AUX_DIR' => 1,
|
||||
'AC_TYPE_MODE_T' => 1,
|
||||
'AC_HEADER_SYS_WAIT' => 1,
|
||||
'AC_CANONICAL_HOST' => 1,
|
||||
'AC_FUNC_VPRINTF' => 1,
|
||||
'AC_FUNC_CLOSEDIR_VOID' => 1,
|
||||
'AM_GNU_GETTEXT' => 1,
|
||||
'AC_CHECK_MEMBERS' => 1,
|
||||
'AC_REPLACE_FNMATCH' => 1,
|
||||
'AC_STRUCT_TM' => 1,
|
||||
'm4_pattern_allow' => 1,
|
||||
'AC_FUNC_SETVBUF_REVERSED' => 1,
|
||||
'AC_PROG_INSTALL' => 1,
|
||||
'AC_TYPE_OFF_T' => 1,
|
||||
'AC_FUNC_FSEEKO' => 1,
|
||||
'AC_PROG_LIBTOOL' => 1,
|
||||
'AC_FUNC_SETPGRP' => 1,
|
||||
'AC_DECL_SYS_SIGLIST' => 1,
|
||||
'AC_HEADER_DIRENT' => 1,
|
||||
'AC_SUBST' => 1
|
||||
'AC_FUNC_VPRINTF' => 1,
|
||||
'AC_CHECK_LIB' => 1,
|
||||
'AC_CHECK_MEMBERS' => 1,
|
||||
'AC_FUNC_STRTOD' => 1,
|
||||
'AC_HEADER_MAJOR' => 1,
|
||||
'AC_FUNC_REALLOC' => 1,
|
||||
'AC_PROG_CC' => 1,
|
||||
'AC_TYPE_PID_T' => 1,
|
||||
'AC_FUNC_STRFTIME' => 1,
|
||||
'AC_FUNC_GETGROUPS' => 1,
|
||||
'AC_CHECK_TYPES' => 1,
|
||||
'AC_C_CONST' => 1,
|
||||
'AC_FUNC_STAT' => 1,
|
||||
'AC_TYPE_SIGNAL' => 1,
|
||||
'AC_FUNC_STRCOLL' => 1,
|
||||
'AH_OUTPUT' => 1,
|
||||
'AC_HEADER_TIME' => 1,
|
||||
'AM_MAINTAINER_MODE' => 1,
|
||||
'AC_FUNC_ERROR_AT_LINE' => 1,
|
||||
'AC_FUNC_LSTAT' => 1,
|
||||
'AC_SUBST' => 1,
|
||||
'AC_TYPE_UID_T' => 1,
|
||||
'AC_FUNC_GETPGRP' => 1,
|
||||
'm4_include' => 1,
|
||||
'AC_FUNC_ALLOCA' => 1,
|
||||
'AC_FUNC_MMAP' => 1,
|
||||
'AC_C_INLINE' => 1,
|
||||
'AC_CONFIG_FILES' => 1,
|
||||
'AC_C_VOLATILE' => 1,
|
||||
'AC_FUNC_SELECT_ARGTYPES' => 1,
|
||||
'AC_STRUCT_ST_BLOCKS' => 1,
|
||||
'AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK' => 1,
|
||||
'AC_FUNC_WAIT3' => 1,
|
||||
'AC_PROG_LN_S' => 1,
|
||||
'AC_FUNC_MKTIME' => 1,
|
||||
'AC_LIBSOURCE' => 1,
|
||||
'AC_PROG_CXX' => 1,
|
||||
'AC_FUNC_MBRTOWC' => 1,
|
||||
'AM_GNU_GETTEXT' => 1,
|
||||
'AC_CONFIG_HEADERS' => 1,
|
||||
'AC_FUNC_STRNLEN' => 1,
|
||||
'AC_CANONICAL_SYSTEM' => 1,
|
||||
'm4_pattern_forbid' => 1,
|
||||
'AC_PROG_GCC_TRADITIONAL' => 1,
|
||||
'AC_INIT' => 1,
|
||||
'AC_PATH_X' => 1,
|
||||
'AC_PROG_YACC' => 1,
|
||||
'AC_PROG_LEX' => 1,
|
||||
'AC_PROG_CPP' => 1,
|
||||
'AM_INIT_AUTOMAKE' => 1,
|
||||
'AC_CHECK_HEADERS' => 1,
|
||||
'AC_TYPE_SIZE_T' => 1,
|
||||
'AC_FUNC_MALLOC' => 1,
|
||||
'AC_FUNC_CLOSEDIR_VOID' => 1,
|
||||
'AC_FUNC_GETLOADAVG' => 1,
|
||||
'AC_CHECK_FUNCS' => 1,
|
||||
'include' => 1,
|
||||
'AC_PROG_AWK' => 1,
|
||||
'AM_AUTOMAKE_VERSION' => 1,
|
||||
'AM_PROG_CC_C_O' => 1,
|
||||
'AC_HEADER_STDC' => 1,
|
||||
'AC_PROG_RANLIB' => 1,
|
||||
'AC_FUNC_OBSTACK' => 1,
|
||||
'AM_CONDITIONAL' => 1,
|
||||
'AC_FUNC_MEMCMP' => 1,
|
||||
'AC_FUNC_GETMNTENT' => 1,
|
||||
'AC_PROG_MAKE_SET' => 1,
|
||||
'AC_FUNC_UTIME_NULL' => 1,
|
||||
'AC_STRUCT_TIMEZONE' => 1,
|
||||
'AC_DEFINE_TRACE_LITERAL' => 1,
|
||||
'AC_FUNC_FORK' => 1,
|
||||
'AC_FUNC_STRERROR_R' => 1
|
||||
}
|
||||
], 'Request' )
|
||||
);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
m4trace:configure.in:30: -1- AC_INIT([bash], [3.0-beta1], [bug-bash@gnu.org])
|
||||
m4trace:configure.in:30: -1- AC_INIT([bash], [3.0-rc1], [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'])
|
||||
|
||||
+3
-2
@@ -107,15 +107,16 @@ bindpwd (no_symlinks)
|
||||
array_needs_making = 0;
|
||||
}
|
||||
|
||||
tvar = bind_variable ("PWD", dirname);
|
||||
tvar = bind_variable ("PWD", dirname ? dirname : "");
|
||||
if (old_anm == 0 && array_needs_making && exported_p (tvar))
|
||||
{
|
||||
update_export_env_inplace ("PWD=", 4, dirname);
|
||||
update_export_env_inplace ("PWD=", 4, dirname ? dirname : "");
|
||||
array_needs_making = 0;
|
||||
}
|
||||
|
||||
if (dirname && dirname != the_current_working_directory)
|
||||
free (dirname);
|
||||
|
||||
return (EXECUTION_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
+1
-4
@@ -433,10 +433,7 @@ change_to_directory (newdir, nolinks)
|
||||
set_working_directory (tdir);
|
||||
}
|
||||
else
|
||||
{
|
||||
FREE (the_current_working_directory);
|
||||
the_current_working_directory = tdir;
|
||||
}
|
||||
set_working_directory (tdir);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
+2
-13
@@ -472,23 +472,12 @@ get_working_directory (for_whom)
|
||||
|
||||
if (the_current_working_directory == 0)
|
||||
{
|
||||
#if defined (HAVE_PATHCONF)
|
||||
dsize = pathconf (".", _PC_PATH_MAX);
|
||||
#else
|
||||
dsize = PATH_MAX;
|
||||
#endif
|
||||
|
||||
the_current_working_directory = (char *)xmalloc (dsize+1);
|
||||
the_current_working_directory[0] = '\0';
|
||||
directory = getcwd (the_current_working_directory, dsize);
|
||||
if (directory == 0)
|
||||
the_current_working_directory = getcwd (0, 0);
|
||||
if (the_current_working_directory == 0)
|
||||
{
|
||||
fprintf (stderr, _("%s: error retrieving current directory: %s: %s\n"),
|
||||
(for_whom && *for_whom) ? for_whom : get_name_for_error (),
|
||||
_(bash_getcwd_errstr), strerror (errno));
|
||||
|
||||
free (the_current_working_directory);
|
||||
the_current_working_directory = (char *)NULL;
|
||||
return (char *)NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,815 @@
|
||||
/* 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. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# ifdef _MINIX
|
||||
# include <sys/types.h>
|
||||
# endif
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <chartypes.h>
|
||||
#include "../bashtypes.h"
|
||||
#include "posixstat.h"
|
||||
#include <signal.h>
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#if defined (PREFER_STDARG)
|
||||
# include <stdarg.h>
|
||||
#else
|
||||
# include <varargs.h>
|
||||
#endif
|
||||
|
||||
#include "../bashansi.h"
|
||||
#include "../bashintl.h"
|
||||
|
||||
#include "../shell.h"
|
||||
#include "maxpath.h"
|
||||
#include "../flags.h"
|
||||
#include "../jobs.h"
|
||||
#include "../builtins.h"
|
||||
#include "../input.h"
|
||||
#include "../execute_cmd.h"
|
||||
#include "../trap.h"
|
||||
#include "bashgetopt.h"
|
||||
#include "common.h"
|
||||
#include "builtext.h"
|
||||
#include <tilde/tilde.h>
|
||||
|
||||
#if defined (HISTORY)
|
||||
# include "../bashhist.h"
|
||||
#endif
|
||||
|
||||
#if !defined (errno)
|
||||
extern int errno;
|
||||
#endif /* !errno */
|
||||
|
||||
extern int indirection_level, subshell_environment;
|
||||
extern int line_number;
|
||||
extern int last_command_exit_value;
|
||||
extern int running_trap;
|
||||
extern int posixly_correct;
|
||||
extern char *this_command_name, *shell_name;
|
||||
extern char *bash_getcwd_errstr;
|
||||
|
||||
/* Used by some builtins and the mainline code. */
|
||||
sh_builtin_func_t *last_shell_builtin = (sh_builtin_func_t *)NULL;
|
||||
sh_builtin_func_t *this_shell_builtin = (sh_builtin_func_t *)NULL;
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Error reporting, usage, and option processing */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* This is a lot like report_error (), but it is for shell builtins
|
||||
instead of shell control structures, and it won't ever exit the
|
||||
shell. */
|
||||
void
|
||||
#if defined (PREFER_STDARG)
|
||||
builtin_error (const char *format, ...)
|
||||
#else
|
||||
builtin_error (format, va_alist)
|
||||
const char *format;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list args;
|
||||
char *name;
|
||||
|
||||
name = get_name_for_error ();
|
||||
fprintf (stderr, "%s: ", name);
|
||||
|
||||
if (interactive_shell == 0)
|
||||
fprintf (stderr, "line %d: ", executing_line_number ());
|
||||
|
||||
if (this_command_name && *this_command_name)
|
||||
fprintf (stderr, "%s: ", this_command_name);
|
||||
|
||||
SH_VA_START (args, format);
|
||||
|
||||
vfprintf (stderr, format, args);
|
||||
va_end (args);
|
||||
fprintf (stderr, "\n");
|
||||
}
|
||||
|
||||
/* Print a usage summary for the currently-executing builtin command. */
|
||||
void
|
||||
builtin_usage ()
|
||||
{
|
||||
if (this_command_name && *this_command_name)
|
||||
fprintf (stderr, "%s: usage: ", this_command_name);
|
||||
fprintf (stderr, "%s\n", current_builtin->short_doc);
|
||||
fflush (stderr);
|
||||
}
|
||||
|
||||
/* Return if LIST is NULL else barf and jump to top_level. Used by some
|
||||
builtins that do not accept arguments. */
|
||||
void
|
||||
no_args (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
if (list)
|
||||
{
|
||||
builtin_error (_("too many arguments"));
|
||||
jump_to_top_level (DISCARD);
|
||||
}
|
||||
}
|
||||
|
||||
/* Check that no options were given to the currently-executing builtin,
|
||||
and return 0 if there were options. */
|
||||
int
|
||||
no_options (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
reset_internal_getopt ();
|
||||
if (internal_getopt (list, "") != -1)
|
||||
{
|
||||
builtin_usage ();
|
||||
return (1);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
sh_needarg (s)
|
||||
char *s;
|
||||
{
|
||||
builtin_error (_("%s: option requires an argument"), s);
|
||||
}
|
||||
|
||||
void
|
||||
sh_neednumarg (s)
|
||||
char *s;
|
||||
{
|
||||
builtin_error (_("%s: numeric argument required"), s);
|
||||
}
|
||||
|
||||
void
|
||||
sh_notfound (s)
|
||||
char *s;
|
||||
{
|
||||
builtin_error (_("%s: not found"), s);
|
||||
}
|
||||
|
||||
/* Function called when one of the builtin commands detects an invalid
|
||||
option. */
|
||||
void
|
||||
sh_invalidopt (s)
|
||||
char *s;
|
||||
{
|
||||
builtin_error (_("%s: invalid option"), s);
|
||||
}
|
||||
|
||||
void
|
||||
sh_invalidoptname (s)
|
||||
char *s;
|
||||
{
|
||||
builtin_error (_("%s: invalid option name"), s);
|
||||
}
|
||||
|
||||
void
|
||||
sh_invalidid (s)
|
||||
char *s;
|
||||
{
|
||||
builtin_error (_("`%s': not a valid identifier"), s);
|
||||
}
|
||||
|
||||
void
|
||||
sh_invalidnum (s)
|
||||
char *s;
|
||||
{
|
||||
builtin_error (_("%s: invalid number"), s);
|
||||
}
|
||||
|
||||
void
|
||||
sh_invalidsig (s)
|
||||
char *s;
|
||||
{
|
||||
builtin_error (_("%s: invalid signal specification"), s);
|
||||
}
|
||||
|
||||
void
|
||||
sh_badpid (s)
|
||||
char *s;
|
||||
{
|
||||
builtin_error (_("`%s': not a pid or valid job spec"), s);
|
||||
}
|
||||
|
||||
void
|
||||
sh_readonly (s)
|
||||
const char *s;
|
||||
{
|
||||
builtin_error (_("%s: readonly variable"), s);
|
||||
}
|
||||
|
||||
void
|
||||
sh_erange (s, desc)
|
||||
char *s, *desc;
|
||||
{
|
||||
if (s)
|
||||
builtin_error (_("%s: %s out of range"), s, desc ? desc : _("argument"));
|
||||
else
|
||||
builtin_error (_("%s out of range"), desc ? desc : _("argument"));
|
||||
}
|
||||
|
||||
#if defined (JOB_CONTROL)
|
||||
void
|
||||
sh_badjob (s)
|
||||
char *s;
|
||||
{
|
||||
builtin_error (_("%s: no such job"), s);
|
||||
}
|
||||
|
||||
void
|
||||
sh_nojobs (s)
|
||||
char *s;
|
||||
{
|
||||
if (s)
|
||||
builtin_error (_("%s: no job control"), s);
|
||||
else
|
||||
builtin_error (_("no job control"));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined (RESTRICTED_SHELL)
|
||||
void
|
||||
sh_restricted (s)
|
||||
char *s;
|
||||
{
|
||||
if (s)
|
||||
builtin_error (_("%s: restricted"), s);
|
||||
else
|
||||
builtin_error (_("restricted"));
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
sh_notbuiltin (s)
|
||||
char *s;
|
||||
{
|
||||
builtin_error (_("%s: not a shell builtin"), s);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Shell positional parameter manipulation */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Convert a WORD_LIST into a C-style argv. Return the number of elements
|
||||
in the list in *IP, if IP is non-null. A convenience function for
|
||||
loadable builtins; also used by `test'. */
|
||||
char **
|
||||
make_builtin_argv (list, ip)
|
||||
WORD_LIST *list;
|
||||
int *ip;
|
||||
{
|
||||
char **argv;
|
||||
|
||||
argv = strvec_from_word_list (list, 0, 1, ip);
|
||||
argv[0] = this_command_name;
|
||||
return argv;
|
||||
}
|
||||
|
||||
/* Remember LIST in $0 ... $9, and REST_OF_ARGS. If DESTRUCTIVE is
|
||||
non-zero, then discard whatever the existing arguments are, else
|
||||
only discard the ones that are to be replaced. */
|
||||
void
|
||||
remember_args (list, destructive)
|
||||
WORD_LIST *list;
|
||||
int destructive;
|
||||
{
|
||||
register int i;
|
||||
|
||||
for (i = 1; i < 10; i++)
|
||||
{
|
||||
if ((destructive || list) && dollar_vars[i])
|
||||
{
|
||||
free (dollar_vars[i]);
|
||||
dollar_vars[i] = (char *)NULL;
|
||||
}
|
||||
|
||||
if (list)
|
||||
{
|
||||
dollar_vars[i] = savestring (list->word->word);
|
||||
list = list->next;
|
||||
}
|
||||
}
|
||||
|
||||
/* If arguments remain, assign them to REST_OF_ARGS.
|
||||
Note that copy_word_list (NULL) returns NULL, and
|
||||
that dispose_words (NULL) does nothing. */
|
||||
if (destructive || list)
|
||||
{
|
||||
dispose_words (rest_of_args);
|
||||
rest_of_args = copy_word_list (list);
|
||||
}
|
||||
|
||||
if (destructive)
|
||||
set_dollar_vars_changed ();
|
||||
}
|
||||
|
||||
static int changed_dollar_vars;
|
||||
|
||||
/* Have the dollar variables been reset to new values since we last
|
||||
checked? */
|
||||
int
|
||||
dollar_vars_changed ()
|
||||
{
|
||||
return (changed_dollar_vars);
|
||||
}
|
||||
|
||||
void
|
||||
set_dollar_vars_unchanged ()
|
||||
{
|
||||
changed_dollar_vars = 0;
|
||||
}
|
||||
|
||||
void
|
||||
set_dollar_vars_changed ()
|
||||
{
|
||||
if (variable_context)
|
||||
changed_dollar_vars |= ARGS_FUNC;
|
||||
else if (this_shell_builtin == set_builtin)
|
||||
changed_dollar_vars |= ARGS_SETBLTIN;
|
||||
else
|
||||
changed_dollar_vars |= ARGS_INVOC;
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Validating numeric input and arguments */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Read a numeric arg for this_command_name, the name of the shell builtin
|
||||
that wants it. LIST is the word list that the arg is to come from.
|
||||
Accept only the numeric argument; report an error if other arguments
|
||||
follow. If FATAL is true, call throw_to_top_level, which exits the
|
||||
shell; if not, call jump_to_top_level (DISCARD), which aborts the
|
||||
current command. */
|
||||
intmax_t
|
||||
get_numeric_arg (list, fatal)
|
||||
WORD_LIST *list;
|
||||
int fatal;
|
||||
{
|
||||
intmax_t count = 1;
|
||||
|
||||
if (list && list->word && ISOPTION (list->word->word, '-'))
|
||||
list = list->next;
|
||||
|
||||
if (list)
|
||||
{
|
||||
register char *arg;
|
||||
|
||||
arg = list->word->word;
|
||||
if (arg == 0 || (legal_number (arg, &count) == 0))
|
||||
{
|
||||
sh_neednumarg (list->word->word);
|
||||
if (fatal)
|
||||
throw_to_top_level ();
|
||||
else
|
||||
jump_to_top_level (DISCARD);
|
||||
}
|
||||
no_args (list->next);
|
||||
}
|
||||
|
||||
return (count);
|
||||
}
|
||||
|
||||
/* Get an eight-bit status value from LIST */
|
||||
int
|
||||
get_exitstat (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
int status;
|
||||
intmax_t sval;
|
||||
char *arg;
|
||||
|
||||
if (list && list->word && ISOPTION (list->word->word, '-'))
|
||||
list = list->next;
|
||||
|
||||
if (list == 0)
|
||||
return (last_command_exit_value);
|
||||
|
||||
arg = list->word->word;
|
||||
if (arg == 0 || legal_number (arg, &sval) == 0)
|
||||
{
|
||||
sh_neednumarg (list->word->word ? list->word->word : "`'");
|
||||
return 255;
|
||||
}
|
||||
no_args (list->next);
|
||||
|
||||
status = sval & 255;
|
||||
return status;
|
||||
}
|
||||
|
||||
/* Return the octal number parsed from STRING, or -1 to indicate
|
||||
that the string contained a bad number. */
|
||||
int
|
||||
read_octal (string)
|
||||
char *string;
|
||||
{
|
||||
int result, digits;
|
||||
|
||||
result = digits = 0;
|
||||
while (*string && ISOCTAL (*string))
|
||||
{
|
||||
digits++;
|
||||
result = (result * 8) + (*string++ - '0');
|
||||
if (result > 0777)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (digits == 0 || *string)
|
||||
result = -1;
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Manipulating the current working directory */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Return a consed string which is the current working directory.
|
||||
FOR_WHOM is the name of the caller for error printing. */
|
||||
char *the_current_working_directory = (char *)NULL;
|
||||
|
||||
char *
|
||||
get_working_directory (for_whom)
|
||||
char *for_whom;
|
||||
{
|
||||
char *directory;
|
||||
size_t dsize;
|
||||
|
||||
if (no_symbolic_links)
|
||||
{
|
||||
FREE (the_current_working_directory);
|
||||
the_current_working_directory = (char *)NULL;
|
||||
}
|
||||
|
||||
if (the_current_working_directory == 0)
|
||||
{
|
||||
#if defined (HAVE_PATHCONF)
|
||||
dsize = pathconf (".", _PC_PATH_MAX);
|
||||
#else
|
||||
dsize = PATH_MAX;
|
||||
#endif
|
||||
|
||||
the_current_working_directory = (char *)xmalloc (dsize+1);
|
||||
the_current_working_directory[0] = '\0';
|
||||
directory = getcwd (the_current_working_directory, dsize);
|
||||
if (directory == 0)
|
||||
{
|
||||
fprintf (stderr, _("%s: error retrieving current directory: %s: %s\n"),
|
||||
(for_whom && *for_whom) ? for_whom : get_name_for_error (),
|
||||
_(bash_getcwd_errstr), strerror (errno));
|
||||
|
||||
free (the_current_working_directory);
|
||||
the_current_working_directory = (char *)NULL;
|
||||
return (char *)NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return (savestring (the_current_working_directory));
|
||||
}
|
||||
|
||||
/* Make NAME our internal idea of the current working directory. */
|
||||
void
|
||||
set_working_directory (name)
|
||||
char *name;
|
||||
{
|
||||
FREE (the_current_working_directory);
|
||||
the_current_working_directory = savestring (name);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Job control support functions */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
#if defined (JOB_CONTROL)
|
||||
int
|
||||
get_job_by_name (name, flags)
|
||||
const char *name;
|
||||
int flags;
|
||||
{
|
||||
register int i, wl, cl, match, job;
|
||||
register PROCESS *p;
|
||||
|
||||
job = NO_JOB;
|
||||
wl = strlen (name);
|
||||
for (i = job_slots - 1; i >= 0; i--)
|
||||
{
|
||||
if (jobs[i] == 0 || ((flags & JM_STOPPED) && JOBSTATE(i) != JSTOPPED))
|
||||
continue;
|
||||
|
||||
p = jobs[i]->pipe;
|
||||
do
|
||||
{
|
||||
if (flags & JM_EXACT)
|
||||
{
|
||||
cl = strlen (p->command);
|
||||
match = STREQN (p->command, name, cl);
|
||||
}
|
||||
else if (flags & JM_SUBSTRING)
|
||||
match = strindex (p->command, name) != (char *)0;
|
||||
else
|
||||
match = STREQN (p->command, name, wl);
|
||||
|
||||
if (match == 0)
|
||||
{
|
||||
p = p->next;
|
||||
continue;
|
||||
}
|
||||
else if (flags & JM_FIRSTMATCH)
|
||||
return i; /* return first match */
|
||||
else if (job != NO_JOB)
|
||||
{
|
||||
if (this_shell_builtin)
|
||||
builtin_error (_("%s: ambiguous job spec"), name);
|
||||
else
|
||||
report_error (_("%s: ambiguous job spec"), name);
|
||||
return (DUP_JOB);
|
||||
}
|
||||
else
|
||||
job = i;
|
||||
}
|
||||
while (p != jobs[i]->pipe);
|
||||
}
|
||||
|
||||
return (job);
|
||||
}
|
||||
|
||||
/* Return the job spec found in LIST. */
|
||||
int
|
||||
get_job_spec (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
register char *word;
|
||||
int job, jflags;
|
||||
|
||||
if (list == 0)
|
||||
return (current_job);
|
||||
|
||||
word = list->word->word;
|
||||
|
||||
if (*word == '\0')
|
||||
return (NO_JOB);
|
||||
|
||||
if (*word == '%')
|
||||
word++;
|
||||
|
||||
if (DIGIT (*word) && all_digits (word))
|
||||
{
|
||||
job = atoi (word);
|
||||
return (job > job_slots ? NO_JOB : job - 1);
|
||||
}
|
||||
|
||||
jflags = 0;
|
||||
switch (*word)
|
||||
{
|
||||
case 0:
|
||||
return NO_JOB;
|
||||
case '%':
|
||||
case '+':
|
||||
return (current_job);
|
||||
|
||||
case '-':
|
||||
return (previous_job);
|
||||
|
||||
case '?': /* Substring search requested. */
|
||||
jflags |= JM_SUBSTRING;
|
||||
word++;
|
||||
/* FALLTHROUGH */
|
||||
|
||||
default:
|
||||
return get_job_by_name (word, jflags);
|
||||
}
|
||||
}
|
||||
#endif /* JOB_CONTROL */
|
||||
|
||||
/*
|
||||
* NOTE: `kill' calls this function with forcecols == 0
|
||||
*/
|
||||
int
|
||||
display_signal_list (list, forcecols)
|
||||
WORD_LIST *list;
|
||||
int forcecols;
|
||||
{
|
||||
register int i, column;
|
||||
char *name;
|
||||
int result, signum, dflags;
|
||||
intmax_t lsignum;
|
||||
|
||||
result = EXECUTION_SUCCESS;
|
||||
if (!list)
|
||||
{
|
||||
for (i = 1, column = 0; i < NSIG; i++)
|
||||
{
|
||||
name = signal_name (i);
|
||||
if (STREQN (name, "SIGJUNK", 7) || STREQN (name, "Unknown", 7))
|
||||
continue;
|
||||
|
||||
if (posixly_correct && !forcecols)
|
||||
{
|
||||
/* This is for the kill builtin. POSIX.2 says the signal names
|
||||
are displayed without the `SIG' prefix. */
|
||||
if (STREQN (name, "SIG", 3))
|
||||
name += 3;
|
||||
printf ("%s%s", name, (i == NSIG - 1) ? "" : " ");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf ("%2d) %s", i, name);
|
||||
|
||||
if (++column < 4)
|
||||
printf ("\t");
|
||||
else
|
||||
{
|
||||
printf ("\n");
|
||||
column = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((posixly_correct && !forcecols) || column != 0)
|
||||
printf ("\n");
|
||||
return result;
|
||||
}
|
||||
|
||||
/* List individual signal names or numbers. */
|
||||
while (list)
|
||||
{
|
||||
if (legal_number (list->word->word, &lsignum))
|
||||
{
|
||||
/* This is specified by Posix.2 so that exit statuses can be
|
||||
mapped into signal numbers. */
|
||||
if (lsignum > 128)
|
||||
lsignum -= 128;
|
||||
if (lsignum < 0 || lsignum >= NSIG)
|
||||
{
|
||||
sh_invalidsig (list->word->word);
|
||||
result = EXECUTION_FAILURE;
|
||||
list = list->next;
|
||||
continue;
|
||||
}
|
||||
|
||||
signum = lsignum;
|
||||
name = signal_name (signum);
|
||||
if (STREQN (name, "SIGJUNK", 7) || STREQN (name, "Unknown", 7))
|
||||
{
|
||||
list = list->next;
|
||||
continue;
|
||||
}
|
||||
#if defined (JOB_CONTROL)
|
||||
/* POSIX.2 says that `kill -l signum' prints the signal name without
|
||||
the `SIG' prefix. */
|
||||
printf ("%s\n", (this_shell_builtin == kill_builtin) ? name + 3 : name);
|
||||
#else
|
||||
printf ("%s\n", name);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
dflags = DSIG_NOCASE;
|
||||
if (posixly_correct == 0 || this_shell_builtin != kill_builtin)
|
||||
dflags |= DSIG_SIGPREFIX;
|
||||
signum = decode_signal (list->word->word, dflags);
|
||||
if (signum == NO_SIG)
|
||||
{
|
||||
sh_invalidsig (list->word->word);
|
||||
result = EXECUTION_FAILURE;
|
||||
list = list->next;
|
||||
continue;
|
||||
}
|
||||
printf ("%d\n", signum);
|
||||
}
|
||||
list = list->next;
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Finding builtin commands and their functions */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Perform a binary search and return the address of the builtin function
|
||||
whose name is NAME. If the function couldn't be found, or the builtin
|
||||
is disabled or has no function associated with it, return NULL.
|
||||
Return the address of the builtin.
|
||||
DISABLED_OKAY means find it even if the builtin is disabled. */
|
||||
struct builtin *
|
||||
builtin_address_internal (name, disabled_okay)
|
||||
char *name;
|
||||
int disabled_okay;
|
||||
{
|
||||
int hi, lo, mid, j;
|
||||
|
||||
hi = num_shell_builtins - 1;
|
||||
lo = 0;
|
||||
|
||||
while (lo <= hi)
|
||||
{
|
||||
mid = (lo + hi) / 2;
|
||||
|
||||
j = shell_builtins[mid].name[0] - name[0];
|
||||
|
||||
if (j == 0)
|
||||
j = strcmp (shell_builtins[mid].name, name);
|
||||
|
||||
if (j == 0)
|
||||
{
|
||||
/* It must have a function pointer. It must be enabled, or we
|
||||
must have explicitly allowed disabled functions to be found,
|
||||
and it must not have been deleted. */
|
||||
if (shell_builtins[mid].function &&
|
||||
((shell_builtins[mid].flags & BUILTIN_DELETED) == 0) &&
|
||||
((shell_builtins[mid].flags & BUILTIN_ENABLED) || disabled_okay))
|
||||
return (&shell_builtins[mid]);
|
||||
else
|
||||
return ((struct builtin *)NULL);
|
||||
}
|
||||
if (j > 0)
|
||||
hi = mid - 1;
|
||||
else
|
||||
lo = mid + 1;
|
||||
}
|
||||
return ((struct builtin *)NULL);
|
||||
}
|
||||
|
||||
/* Return the pointer to the function implementing builtin command NAME. */
|
||||
sh_builtin_func_t *
|
||||
find_shell_builtin (name)
|
||||
char *name;
|
||||
{
|
||||
current_builtin = builtin_address_internal (name, 0);
|
||||
return (current_builtin ? current_builtin->function : (sh_builtin_func_t *)NULL);
|
||||
}
|
||||
|
||||
/* Return the address of builtin with NAME, whether it is enabled or not. */
|
||||
sh_builtin_func_t *
|
||||
builtin_address (name)
|
||||
char *name;
|
||||
{
|
||||
current_builtin = builtin_address_internal (name, 1);
|
||||
return (current_builtin ? current_builtin->function : (sh_builtin_func_t *)NULL);
|
||||
}
|
||||
|
||||
/* Return the function implementing the builtin NAME, but only if it is a
|
||||
POSIX.2 special builtin. */
|
||||
sh_builtin_func_t *
|
||||
find_special_builtin (name)
|
||||
char *name;
|
||||
{
|
||||
current_builtin = builtin_address_internal (name, 0);
|
||||
return ((current_builtin && (current_builtin->flags & SPECIAL_BUILTIN)) ?
|
||||
current_builtin->function :
|
||||
(sh_builtin_func_t *)NULL);
|
||||
}
|
||||
|
||||
static int
|
||||
shell_builtin_compare (sbp1, sbp2)
|
||||
struct builtin *sbp1, *sbp2;
|
||||
{
|
||||
int result;
|
||||
|
||||
if ((result = sbp1->name[0] - sbp2->name[0]) == 0)
|
||||
result = strcmp (sbp1->name, sbp2->name);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
/* Sort the table of shell builtins so that the binary search will work
|
||||
in find_shell_builtin. */
|
||||
void
|
||||
initialize_shell_builtins ()
|
||||
{
|
||||
qsort (shell_builtins, num_shell_builtins, sizeof (struct builtin),
|
||||
(QSFUNC *)shell_builtin_compare);
|
||||
}
|
||||
+1
-1
@@ -483,7 +483,7 @@ get_working_directory (for_whom)
|
||||
directory = getcwd (the_current_working_directory, dsize);
|
||||
if (directory == 0)
|
||||
{
|
||||
fprintf (stderr, _("%s: could not get current directory: %s: %s\n"),
|
||||
fprintf (stderr, _("%s: error retrieving current directory: %s: %s\n"),
|
||||
(for_whom && *for_whom) ? for_whom : get_name_for_error (),
|
||||
_(bash_getcwd_errstr), strerror (errno));
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#! /bin/sh
|
||||
# From configure.in for Bash 3.0, version 3.163, from autoconf version AC_ACVERSION.
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.57 for bash 3.0-beta1.
|
||||
# Generated by GNU Autoconf 2.57 for bash 3.0-rc1.
|
||||
#
|
||||
# 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-beta1'
|
||||
PACKAGE_STRING='bash 3.0-beta1'
|
||||
PACKAGE_VERSION='3.0-rc1'
|
||||
PACKAGE_STRING='bash 3.0-rc1'
|
||||
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-beta1 to adapt to many kinds of systems.
|
||||
\`configure' configures bash 3.0-rc1 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-beta1:";;
|
||||
short | recursive ) echo "Configuration of bash 3.0-rc1:";;
|
||||
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-beta1
|
||||
bash configure 3.0-rc1
|
||||
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-beta1, which was
|
||||
It was created by bash $as_me 3.0-rc1, 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=beta1
|
||||
RELSTATUS=rc1
|
||||
|
||||
case "$RELSTATUS" in
|
||||
alp*|bet*|dev*|rc*) DEBUG='-DDEBUG' MALLOC_DEBUG='-DMALLOC_DEBUG' ;;
|
||||
@@ -22430,15 +22430,15 @@ _ACEOF
|
||||
fi
|
||||
|
||||
if test "$ac_cv_func_getcwd" = "yes"; then
|
||||
echo "$as_me:$LINENO: checking if getcwd() calls popen()" >&5
|
||||
echo $ECHO_N "checking if getcwd() calls popen()... $ECHO_C" >&6
|
||||
if test "${bash_cv_getcwd_calls_popen+set}" = set; then
|
||||
echo "$as_me:$LINENO: checking if getcwd() will dynamically allocate memory" >&5
|
||||
echo $ECHO_N "checking if getcwd() will dynamically allocate memory... $ECHO_C" >&6
|
||||
if test "${bash_cv_getcwd_malloc+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
if test "$cross_compiling" = yes; then
|
||||
{ echo "$as_me:$LINENO: WARNING: cannot check whether getcwd calls popen if cross compiling -- defaulting to no" >&5
|
||||
echo "$as_me: WARNING: cannot check whether getcwd calls popen if cross compiling -- defaulting to no" >&2;}
|
||||
bash_cv_getcwd_calls_popen=no
|
||||
{ echo "$as_me:$LINENO: WARNING: cannot check whether getcwd allocates memory when cross-compiling -- defaulting to no" >&5
|
||||
echo "$as_me: WARNING: cannot check whether getcwd allocates memory when cross-compiling -- defaulting to no" >&2;}
|
||||
bash_cv_getcwd_malloc=no
|
||||
|
||||
else
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
@@ -22454,50 +22454,11 @@ cat >>conftest.$ac_ext <<_ACEOF
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifndef __STDC__
|
||||
#ifndef const
|
||||
#define const
|
||||
#endif
|
||||
#endif
|
||||
|
||||
int popen_called;
|
||||
|
||||
FILE *
|
||||
popen(command, type)
|
||||
const char *command;
|
||||
const char *type;
|
||||
{
|
||||
popen_called = 1;
|
||||
return (FILE *)NULL;
|
||||
}
|
||||
|
||||
FILE *_popen(command, type)
|
||||
const char *command;
|
||||
const char *type;
|
||||
{
|
||||
return (popen (command, type));
|
||||
}
|
||||
|
||||
int
|
||||
pclose(stream)
|
||||
FILE *stream;
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
_pclose(stream)
|
||||
FILE *stream;
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
main()
|
||||
{
|
||||
char lbuf[32];
|
||||
popen_called = 0;
|
||||
getcwd(lbuf, 32);
|
||||
exit (popen_called);
|
||||
char *xpwd;
|
||||
xpwd = getcwd(0, 0);
|
||||
exit (xpwd == 0);
|
||||
}
|
||||
|
||||
_ACEOF
|
||||
@@ -22512,22 +22473,22 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
bash_cv_getcwd_calls_popen=no
|
||||
bash_cv_getcwd_malloc=yes
|
||||
else
|
||||
echo "$as_me: program exited with status $ac_status" >&5
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
( exit $ac_status )
|
||||
bash_cv_getcwd_calls_popen=yes
|
||||
bash_cv_getcwd_malloc=no
|
||||
fi
|
||||
rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "$as_me:$LINENO: result: $bash_cv_getcwd_calls_popen" >&5
|
||||
echo "${ECHO_T}$bash_cv_getcwd_calls_popen" >&6
|
||||
if test $bash_cv_getcwd_calls_popen = yes; then
|
||||
echo "$as_me:$LINENO: result: $bash_cv_getcwd_malloc" >&5
|
||||
echo "${ECHO_T}$bash_cv_getcwd_malloc" >&6
|
||||
if test $bash_cv_getcwd_malloc = no; then
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define GETCWD_BROKEN 1
|
||||
_ACEOF
|
||||
@@ -24642,7 +24603,7 @@ _ASBOX
|
||||
} >&5
|
||||
cat >&5 <<_CSEOF
|
||||
|
||||
This file was extended by bash $as_me 3.0-beta1, which was
|
||||
This file was extended by bash $as_me 3.0-rc1, which was
|
||||
generated by GNU Autoconf 2.57. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
@@ -24705,7 +24666,7 @@ _ACEOF
|
||||
|
||||
cat >>$CONFIG_STATUS <<_ACEOF
|
||||
ac_cs_version="\\
|
||||
bash config.status 3.0-beta1
|
||||
bash config.status 3.0-rc1
|
||||
configured by $0, generated by GNU Autoconf 2.57,
|
||||
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
|
||||
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ dnl Process this file with autoconf to produce a configure script.
|
||||
AC_REVISION([for Bash 3.0, version 3.163, from autoconf version] AC_ACVERSION)dnl
|
||||
|
||||
define(bashvers, 3.0)
|
||||
define(relstatus, beta1)
|
||||
define(relstatus, rc1)
|
||||
|
||||
AC_INIT(bash, bashvers-relstatus, bug-bash@gnu.org)
|
||||
|
||||
|
||||
+1168
-1161
File diff suppressed because it is too large
Load Diff
+4
-2
@@ -3546,9 +3546,11 @@ builtin below.
|
||||
.B \-z \fIstring\fP
|
||||
True if the length of \fIstring\fP is zero.
|
||||
.TP
|
||||
.B \-n \fIstring\fP
|
||||
.TP
|
||||
\fIstring\fP
|
||||
.PD 0
|
||||
.TP
|
||||
.B \-n \fIstring\fP
|
||||
.PD
|
||||
True if the length of
|
||||
.I string
|
||||
is non-zero.
|
||||
|
||||
+1
-1
@@ -355,7 +355,7 @@ case "${THIS_SH}" in
|
||||
esac
|
||||
|
||||
if ln -s ${SHNAME} /tmp/test.symlink 2>/dev/null; then
|
||||
chgrp ${GROUPS[0]} /tmp/test.symlink
|
||||
chgrp ${GROUPS[0]} /tmp/test.symlink 2>/dev/null
|
||||
echo 't -h /tmp/test.symlink'
|
||||
t -h /tmp/test.symlink
|
||||
# some systems don't let you remove this
|
||||
|
||||
Reference in New Issue
Block a user