commit bash-20050120 snapshot

This commit is contained in:
Chet Ramey
2011-12-03 13:42:25 -05:00
parent 6e70dbff65
commit 227f982e3d
33 changed files with 1753 additions and 1571 deletions
+98
View File
@@ -10826,3 +10826,101 @@ lib/readline/readline.c
and set things up to dispatch to rl_insert with the shadowed key
as the argument. Fixes the bug reported by Thomas Glanzmann
(sithglan@stud.uni-erlangen.de)
1/13
----
command.h
- new word flag: W_HASQUOTEDNULL
make_cmd.c
- new function to allocate a WORD_DESC * without doing anything with a
containing string: alloc_word_desc
make_cmd.h
- extern declaration for alloc_word_desc
dispose_cmd.c
- new function to just free a WORD_DESC * without freeing the contained
string: dispose_word_desc
dispose_cmd.h
- extern declaration for dispose_word_desc
subst.c
- change some places to use alloc_word_desc
- make same changes to word_list_quote_removal as were made to
word_list_split
- set W_HASQUOTEDNULL when a word is created with w->word[0] ==
CTLNUL and w->word[1] == '\0'
subst.c
- parameter_brace_expand_word now returns a WORD_DESC * -- changed
callers to understand
- parameter_brace_expand_indir now returns a WORD_DESC * -- changed
callers to understand
- parameter_brace_expand_rhs now returns a WORD_DESC * -- changed
callers to understand
- remove W_HASQUOTEDNULL from a word's flags when remove_quoted_nulls
is called on the word's enclosed string
1/15
----
subst.c
- param_expand now returns a WORD_DESC * -- changed callers to
understand
- parameter_brace_expand now returns a WORD_DESC * -- changed
callers to understand
- in expand_word_internal, only call remove_quoted_nulls after a word
is returned with W_HASQUOTEDNULL
- changes to pass W_HASQUOTEDNULL flag out of expand_word_internal;
changed callers to call remove_quoted_nulls only if return value has
W_HASQUOTEDNULL set. This is a mostly-complete fix for the
long-standing CTLNUL confusion between a quoted null expansion and
the expansion of a variable with a literal '\177' in its value
- change string_list_dollar_at to compute the separator character the
same way as string_list_dollar_star: using the already-computed
values generated in setifs()
- when expanding unquoted $*, if $IFS is empty, check whether or not
we're eventually going to split the results (e.g., on the rhs of an
assignment statement) and concatenate the positional parameters as
if the expansion were within double quotes if we're not going to
split
tests/iquote.tests
- test cases based on old bug reports about the quoted-null vs. 0177
problem the recent code fixes
1/16
----
dispose_cmd.c
- set w->word to 0 before putting a WORD_DESC * back in the cache in
dispose_word_desc; changed callers to delete those assignments
variables.c
- change assign_random and get_random_value so that the random number
generator only gets re-seeded once in a subshell environment, and
assigning a value to RANDOM counts as seeding the generator. This
makes the sequences a little more predictable
1/20
----
lib/readline/history.c
- fix replace_history_entry, remove_history to return NULL if
passed index is < 0
1/22
----
lib/sh/netconn.c
- fix isnetconn() to understand that getpeername can return ENOTCONN
to indicate that an fd is not a socket
configure.in
- set BUILD_DIR to contain backslashes to escape any spaces in the
directory name -- this is what make will accept in targets and
prerequisites, so it's better than trying to use double quotes
- set SIZE to the appropriate value if some cross-compiling tool
chain is being used; `size' by default (can be overridden by
SIZE environment variable)
Makefile.in
- use $(SIZE) instead of size; set SIZE from configure
+103
View File
@@ -10817,4 +10817,107 @@ pcomplete.c
execute_shell_function in gen_shell_function_matches. Fixes bug
reported by a050106.1.keeLae3x@captaincrumb.com (cute)
lib/readline/readline.c
- fix _rl_dispatch_subseq in the case where we're recursing back up
the chain (r == -2) and we encounter a key shadowed by a keymap,
but originally bound to self-insert. Calling rl_dispatch with
ANYOTHERKEY as the first argument will call rl_insert, but with
ANYOTHERKEY (256) as the char to insert. Use the shadow keymap
and set things up to dispatch to rl_insert with the shadowed key
as the argument. Fixes the bug reported by Thomas Glanzmann
(sithglan@stud.uni-erlangen.de)
1/13
----
command.h
- new word flag: W_HASQUOTEDNULL
make_cmd.c
- new function to allocate a WORD_DESC * without doing anything with a
containing string: alloc_word_desc
make_cmd.h
- extern declaration for alloc_word_desc
dispose_cmd.c
- new function to just free a WORD_DESC * without freeing the contained
string: dispose_word_desc
dispose_cmd.h
- extern declaration for dispose_word_desc
subst.c
- change some places to use alloc_word_desc
- make same changes to word_list_quote_removal as were made to
word_list_split
- set W_HASQUOTEDNULL when a word is created with w->word[0] ==
CTLNUL and w->word[1] == '\0'
subst.c
- parameter_brace_expand_word now returns a WORD_DESC * -- changed
callers to understand
- parameter_brace_expand_indir now returns a WORD_DESC * -- changed
callers to understand
- parameter_brace_expand_rhs now returns a WORD_DESC * -- changed
callers to understand
- remove W_HASQUOTEDNULL from a word's flags when remove_quoted_nulls
is called on the word's enclosed string
1/15
----
subst.c
- param_expand now returns a WORD_DESC * -- changed callers to
understand
- parameter_brace_expand now returns a WORD_DESC * -- changed
callers to understand
- in expand_word_internal, only call remove_quoted_nulls after a word
is returned with W_HASQUOTEDNULL
- changes to pass W_HASQUOTEDNULL flag out of expand_word_internal;
changed callers to call remove_quoted_nulls only if return value has
W_HASQUOTEDNULL set. This is a mostly-complete fix for the
long-standing CTLNUL confusion between a quoted null expansion and
the expansion of a variable with a literal '\177' in its value
- change string_list_dollar_at to compute the separator character the
same way as string_list_dollar_star: using the already-computed
values generated in setifs()
- when expanding unquoted $*, if $IFS is empty, check whether or not
we're eventually going to split the results (e.g., on the rhs of an
assignment statement) and concatenate the positional parameters as
if the expansion were within double quotes if we're not going to
split
tests/iquote.tests
- test cases based on old bug reports about the quoted-null vs. 0177
problem the recent code fixes
1/16
----
dispose_cmd.c
- set w->word to 0 before putting a WORD_DESC * back in the cache in
dispose_word_desc; changed callers to delete those assignments
variables.c
- change assign_random and get_random_value so that the random number
generator only gets re-seeded once in a subshell environment, and
assigning a value to RANDOM counts as seeding the generator. This
makes the sequences a little more predictable
1/20
----
lib/readline/history.c
- fix replace_history_entry, remove_history to return NULL if
passed index is < 0
1/22
----
lib/sh/netconn.c
- fix isnetconn() to understand that getpeername can return ENOTCONN
to indicate that an fd is not a socket
configure.in
- set BUILD_DIR to contain backslashes to escape any spaces in the
directory name -- this is what make will accept in targets and
prerequisites, so it's better than trying to use double quotes
Makefile.in
- use $(SIZE) instead of size; set SIZE from configure
+4
View File
@@ -714,6 +714,7 @@ tests/dollar-at-star f
tests/dollar-at1.sub f
tests/dollar-at2.sub f
tests/dollar-star1.sub f
tests/dollar-star2.sub f
tests/dollar.right f
tests/dstack.tests f
tests/dstack.right f
@@ -771,6 +772,8 @@ tests/input-line.sub f
tests/input.right f
tests/intl.tests f
tests/intl.right f
tests/iquote.tests f
tests/iquote.right f
tests/invert.tests f
tests/invert.right f
tests/jobs.tests f
@@ -863,6 +866,7 @@ tests/run-history f
tests/run-ifs f
tests/run-input-test f
tests/run-intl f
tests/run-iquote f
tests/run-invert f
tests/run-jobs f
tests/run-more-exp f
+5 -4
View File
@@ -1,6 +1,6 @@
# Makefile for bash-3.0, version 2.154
# Makefile for bash-3.0, version 2.155
#
# Copyright (C) 1996-2004 Free Software Foundation, Inc.
# Copyright (C) 1996-2005 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -67,6 +67,7 @@ RM = rm -f
AR = @AR@
ARFLAGS = @ARFLAGS@
RANLIB = @RANLIB@
SIZE = @SIZE@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -514,7 +515,7 @@ $(Program): .build $(OBJECTS) $(BUILTINS_DEP) $(LIBDEP)
$(RM) $@
$(PURIFY) $(CC) $(BUILTINS_LDFLAGS) $(LIBRARY_LDFLAGS) $(LDFLAGS) -o $(Program) $(OBJECTS) $(LIBS)
ls -l $(Program)
-size $(Program)
-$(SIZE) $(Program)
.build: $(SOURCES) config.h Makefile version.h $(VERSPROG)
@echo
@@ -536,7 +537,7 @@ bashbug: $(SUPPORT_SRC)bashbug.sh config.h Makefile $(VERSPROG)
strip: $(Program) .made
strip $(Program)
ls -l $(Program)
-size $(Program)
-$(SIZE) $(Program)
lint:
${MAKE} ${MFLAGS} CFLAGS='${GCC_LINT_FLAGS}' .made
+4 -3
View File
@@ -1,4 +1,4 @@
# Makefile for bash-3.0, version 2.153
# Makefile for bash-3.0, version 2.155
#
# Copyright (C) 1996-2004 Free Software Foundation, Inc.
@@ -67,6 +67,7 @@ RM = rm -f
AR = @AR@
ARFLAGS = @ARFLAGS@
RANLIB = @RANLIB@
SIZE = @SIZE@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -514,7 +515,7 @@ $(Program): .build $(OBJECTS) $(BUILTINS_DEP) $(LIBDEP)
$(RM) $@
$(PURIFY) $(CC) $(BUILTINS_LDFLAGS) $(LIBRARY_LDFLAGS) $(LDFLAGS) -o $(Program) $(OBJECTS) $(LIBS)
ls -l $(Program)
size $(Program)
-$(SIZE) $(Program)
.build: $(SOURCES) config.h Makefile version.h $(VERSPROG)
@echo
@@ -536,7 +537,7 @@ bashbug: $(SUPPORT_SRC)bashbug.sh config.h Makefile $(VERSPROG)
strip: $(Program) .made
strip $(Program)
ls -l $(Program)
size $(Program)
-$(SIZE) $(Program)
lint:
${MAKE} ${MFLAGS} CFLAGS='${GCC_LINT_FLAGS}' .made
+28 -2
View File
@@ -1,5 +1,5 @@
@%:@! /bin/sh
@%:@ From configure.in for Bash 3.0, version 3.172, from autoconf version AC_ACVERSION.
@%:@ From configure.in for Bash 3.1, version 3.173, from autoconf version AC_ACVERSION.
@%:@ Guess values for system-dependent variables and create Makefiles.
@%:@ Generated by GNU Autoconf 2.57 for bash 3.1-devel.
@%:@
@@ -311,7 +311,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os EMACS lispdir DEBUGGER_START_FILE TESTSCRIPT PURIFY MALLOC_TARGET MALLOC_SRC MALLOC_LIB MALLOC_LIBRARY MALLOC_LDFLAGS MALLOC_DEP htmldir HELPDIR HELPDIRDEFINE HELPINSTALL HELPSTRINGS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP SIGNAMES_H CC_FOR_BUILD STATIC_LD CFLAGS_FOR_BUILD CPPFLAGS_FOR_BUILD LDFLAGS_FOR_BUILD RL_VERSION RL_MAJOR RL_MINOR READLINE_LIB READLINE_DEP RL_LIBDIR RL_INCLUDEDIR RL_INCLUDE HISTORY_LIB HISTORY_DEP HIST_LIBDIR INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA AR RANLIB ac_ct_RANLIB YACC SET_MAKE MAKE_SHELL MKINSTALLDIRS USE_NLS MSGFMT GMSGFMT XGETTEXT MSGMERGE ALLOCA GLIBC21 LIBICONV LTLIBICONV INTLBISON BUILD_INCLUDED_LIBINTL USE_INCLUDED_LIBINTL CATOBJEXT DATADIRNAME INSTOBJEXT GENCAT INTLOBJS INTL_LIBTOOL_SUFFIX_PREFIX INTLLIBS LIBINTL LTLIBINTL POSUB LIB@&t@OBJS INTL_DEP INTL_INC LIBINTL_H SIGLIST_O TERMCAP_LIB TERMCAP_DEP JOBS_O SHOBJ_CC SHOBJ_CFLAGS SHOBJ_LD SHOBJ_LDFLAGS SHOBJ_XLDFLAGS SHOBJ_LIBS SHOBJ_STATUS PROFILE_FLAGS incdir BUILD_DIR ARFLAGS BASHVERS RELSTATUS DEBUG MALLOC_DEBUG LOCAL_LIBS LOCAL_CFLAGS LOCAL_LDFLAGS LOCAL_DEFS LTLIBOBJS'
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os EMACS lispdir DEBUGGER_START_FILE TESTSCRIPT PURIFY MALLOC_TARGET MALLOC_SRC MALLOC_LIB MALLOC_LIBRARY MALLOC_LDFLAGS MALLOC_DEP htmldir HELPDIR HELPDIRDEFINE HELPINSTALL HELPSTRINGS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP SIGNAMES_H CC_FOR_BUILD STATIC_LD CFLAGS_FOR_BUILD CPPFLAGS_FOR_BUILD LDFLAGS_FOR_BUILD RL_VERSION RL_MAJOR RL_MINOR READLINE_LIB READLINE_DEP RL_LIBDIR RL_INCLUDEDIR RL_INCLUDE HISTORY_LIB HISTORY_DEP HIST_LIBDIR INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA AR RANLIB ac_ct_RANLIB YACC SET_MAKE MAKE_SHELL SIZE MKINSTALLDIRS USE_NLS MSGFMT GMSGFMT XGETTEXT MSGMERGE ALLOCA GLIBC21 LIBICONV LTLIBICONV INTLBISON BUILD_INCLUDED_LIBINTL USE_INCLUDED_LIBINTL CATOBJEXT DATADIRNAME INSTOBJEXT GENCAT INTLOBJS INTL_LIBTOOL_SUFFIX_PREFIX INTLLIBS LIBINTL LTLIBINTL POSUB LIB@&t@OBJS INTL_DEP INTL_INC LIBINTL_H SIGLIST_O TERMCAP_LIB TERMCAP_DEP JOBS_O SHOBJ_CC SHOBJ_CFLAGS SHOBJ_LD SHOBJ_LDFLAGS SHOBJ_XLDFLAGS SHOBJ_LIBS SHOBJ_STATUS PROFILE_FLAGS incdir BUILD_DIR ARFLAGS BASHVERS RELSTATUS DEBUG MALLOC_DEBUG LOCAL_LIBS LOCAL_CFLAGS LOCAL_LDFLAGS LOCAL_DEFS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -4927,6 +4927,27 @@ opennt*|interix*) MAKE_SHELL="$INTERIX_ROOT/bin/sh" ;;
esac
if test x$SIZE = x; then
if test x$ac_tool_prefix = x; then
SIZE=size
else
SIZE=${ac_tool_prefix}size
save_IFS=$IFS ; IFS=:
size_found=0
for dir in $PATH; do
if test -x $dir/$SIZE ; then
size_found=1
break
fi
done
if test $size_found -eq 0; then
SIZE=size
fi
IFS=$save_IFS
fi
fi
cat >>confdefs.h <<\_ACEOF
@%:@define _GNU_SOURCE 1
_ACEOF
@@ -24146,6 +24167,10 @@ case "$srcdir" in
esac
BUILD_DIR=`pwd`
case "$BUILD_DIR" in
*\ *) BUILD_DIR=`echo "$BUILD_DIR" | sed 's: :\\\\ :g'` ;;
*) ;;
esac
@@ -24877,6 +24902,7 @@ s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
s,@YACC@,$YACC,;t t
s,@SET_MAKE@,$SET_MAKE,;t t
s,@MAKE_SHELL@,$MAKE_SHELL,;t t
s,@SIZE@,$SIZE,;t t
s,@MKINSTALLDIRS@,$MKINSTALLDIRS,;t t
s,@USE_NLS@,$USE_NLS,;t t
s,@MSGFMT@,$MSGFMT,;t t
+83 -83
View File
@@ -15,96 +15,96 @@
'configure.in'
],
{
'AC_PROG_RANLIB' => 1,
'AC_CHECK_LIB' => 1,
'AC_FUNC_MEMCMP' => 1,
'AC_C_VOLATILE' => 1,
'AC_HEADER_STDC' => 1,
'm4_pattern_forbid' => 1,
'AC_INIT' => 1,
'AC_FUNC_MALLOC' => 1,
'AC_FUNC_SETVBUF_REVERSED' => 1,
'AC_TYPE_MODE_T' => 1,
'AC_FUNC_STRCOLL' => 1,
'AC_CONFIG_FILES' => 1,
'include' => 1,
'AC_HEADER_MAJOR' => 1,
'AC_CANONICAL_HOST' => 1,
'AC_CHECK_MEMBERS' => 1,
'AC_PROG_LIBTOOL' => 1,
'AC_PROG_AWK' => 1,
'AM_CONDITIONAL' => 1,
'AC_FUNC_LSTAT' => 1,
'AC_PROG_CC' => 1,
'AC_FUNC_SETPGRP' => 1,
'AC_TYPE_PID_T' => 1,
'AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK' => 1,
'AC_FUNC_MKTIME' => 1,
'AC_FUNC_UTIME_NULL' => 1,
'AC_FUNC_WAIT3' => 1,
'AC_C_INLINE' => 1,
'AC_FUNC_STAT' => 1,
'AC_STRUCT_ST_BLOCKS' => 1,
'AC_CHECK_HEADERS' => 1,
'AM_MAINTAINER_MODE' => 1,
'AC_CONFIG_SUBDIRS' => 1,
'AM_INIT_AUTOMAKE' => 1,
'AC_FUNC_MMAP' => 1,
'AC_CONFIG_AUX_DIR' => 1,
'AC_FUNC_CLOSEDIR_VOID' => 1,
'AC_LIBSOURCE' => 1,
'AC_SUBST' => 1,
'AC_FUNC_STRFTIME' => 1,
'AC_CONFIG_HEADERS' => 1,
'AC_DEFINE_TRACE_LITERAL' => 1,
'AC_FUNC_GETMNTENT' => 1,
'AM_AUTOMAKE_VERSION' => 1,
'AC_PROG_YACC' => 1,
'AC_FUNC_VPRINTF' => 1,
'AC_FUNC_REALLOC' => 1,
'AC_TYPE_UID_T' => 1,
'AC_FUNC_GETLOADAVG' => 1,
'AC_CHECK_FUNCS' => 1,
'AC_PROG_LN_S' => 1,
'AC_FUNC_STRNLEN' => 1,
'AC_HEADER_SYS_WAIT' => 1,
'AC_DECL_SYS_SIGLIST' => 1,
'AC_FUNC_MBRTOWC' => 1,
'AC_FUNC_OBSTACK' => 1,
'AC_HEADER_DIRENT' => 1,
'AC_REPLACE_FNMATCH' => 1,
'AC_FUNC_SELECT_ARGTYPES' => 1,
'AC_PROG_CPP' => 1,
'AC_PROG_GCC_TRADITIONAL' => 1,
'AC_PROG_CXX' => 1,
'AC_HEADER_TIME' => 1,
'AC_CANONICAL_HOST' => 1,
'AC_FUNC_MALLOC' => 1,
'AC_FUNC_GETPGRP' => 1,
'AC_PROG_LEX' => 1,
'm4_pattern_allow' => 1,
'AC_FUNC_FSEEKO' => 1,
'AC_PROG_MAKE_SET' => 1,
'AC_FUNC_ERROR_AT_LINE' => 1,
'AM_PROG_CC_C_O' => 1,
'AC_STRUCT_TIMEZONE' => 1,
'AC_FUNC_FORK' => 1,
'AC_FUNC_GETGROUPS' => 1,
'AM_GNU_GETTEXT' => 1,
'AC_FUNC_STRERROR_R' => 1,
'AC_FUNC_LSTAT' => 1,
'AC_TYPE_SIZE_T' => 1,
'AC_PATH_X' => 1,
'AC_PROG_RANLIB' => 1,
'AC_HEADER_STAT' => 1,
'AC_CHECK_TYPES' => 1,
'AC_STRUCT_TM' => 1,
'AC_CANONICAL_SYSTEM' => 1,
'AC_FUNC_CHOWN' => 1,
'AC_TYPE_OFF_T' => 1,
'AC_C_CONST' => 1,
'AC_FUNC_ALLOCA' => 1,
'AH_OUTPUT' => 1,
'AC_PROG_INSTALL' => 1,
'AC_FUNC_STRTOD' => 1,
'AC_TYPE_SIGNAL' => 1,
'm4_include' => 1
'm4_include' => 1,
'AC_FUNC_STRTOD' => 1,
'AC_CHECK_TYPES' => 1,
'AC_HEADER_DIRENT' => 1,
'AC_FUNC_SETVBUF_REVERSED' => 1,
'AM_GNU_GETTEXT' => 1,
'AC_STRUCT_TM' => 1,
'AC_PROG_YACC' => 1,
'm4_pattern_allow' => 1,
'AC_PROG_CXX' => 1,
'AM_MAINTAINER_MODE' => 1,
'AC_PATH_X' => 1,
'AC_FUNC_GETMNTENT' => 1,
'AC_FUNC_FORK' => 1,
'AM_INIT_AUTOMAKE' => 1,
'AC_FUNC_CHOWN' => 1,
'AC_STRUCT_TIMEZONE' => 1,
'AC_FUNC_ERROR_AT_LINE' => 1,
'AC_HEADER_SYS_WAIT' => 1,
'AC_FUNC_ALLOCA' => 1,
'AC_FUNC_STRNLEN' => 1,
'AC_PROG_LEX' => 1,
'AC_INIT' => 1,
'AC_FUNC_FSEEKO' => 1,
'AC_LIBSOURCE' => 1,
'AC_C_INLINE' => 1,
'AM_AUTOMAKE_VERSION' => 1,
'AH_OUTPUT' => 1,
'AC_PROG_CPP' => 1,
'AC_FUNC_STRERROR_R' => 1,
'AC_CANONICAL_SYSTEM' => 1,
'AC_STRUCT_ST_BLOCKS' => 1,
'AC_HEADER_MAJOR' => 1,
'AC_REPLACE_FNMATCH' => 1,
'AC_CONFIG_SUBDIRS' => 1,
'AC_HEADER_STAT' => 1,
'AC_C_VOLATILE' => 1,
'AC_FUNC_STRFTIME' => 1,
'AM_PROG_CC_C_O' => 1,
'AC_PROG_MAKE_SET' => 1,
'AC_FUNC_REALLOC' => 1,
'AC_FUNC_UTIME_NULL' => 1,
'AC_PROG_LIBTOOL' => 1,
'AC_HEADER_STDC' => 1,
'AC_FUNC_MBRTOWC' => 1,
'AC_FUNC_SELECT_ARGTYPES' => 1,
'AC_PROG_LN_S' => 1,
'AC_TYPE_UID_T' => 1,
'AC_FUNC_GETGROUPS' => 1,
'AC_CHECK_FUNCS' => 1,
'AC_CONFIG_HEADERS' => 1,
'AC_FUNC_STAT' => 1,
'include' => 1,
'AC_FUNC_MMAP' => 1,
'AC_FUNC_MKTIME' => 1,
'AM_CONDITIONAL' => 1,
'AC_PROG_GCC_TRADITIONAL' => 1,
'AC_FUNC_CLOSEDIR_VOID' => 1,
'AC_C_CONST' => 1,
'AC_CONFIG_FILES' => 1,
'AC_TYPE_MODE_T' => 1,
'AC_CHECK_MEMBERS' => 1,
'AC_FUNC_GETLOADAVG' => 1,
'AC_DEFINE_TRACE_LITERAL' => 1,
'AC_SUBST' => 1,
'AC_PROG_INSTALL' => 1,
'AC_FUNC_VPRINTF' => 1,
'AC_DECL_SYS_SIGLIST' => 1,
'AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK' => 1,
'AC_TYPE_PID_T' => 1,
'AC_FUNC_OBSTACK' => 1,
'AC_FUNC_WAIT3' => 1,
'm4_pattern_forbid' => 1,
'AC_PROG_AWK' => 1,
'AC_TYPE_SIZE_T' => 1,
'AC_FUNC_STRCOLL' => 1,
'AC_CHECK_HEADERS' => 1,
'AC_CONFIG_AUX_DIR' => 1,
'AC_FUNC_MEMCMP' => 1
}
], 'Request' )
);
+620 -619
View File
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -96,6 +96,7 @@ GCC_LINT_FLAGS = -Wall -Wshadow -Wpointer-arith -Wcast-qual \
MKBUILTINS = mkbuiltins$(EXEEXT)
DIRECTDEFINE = -D $(srcdir)
HELPDIRDEFINE = @HELPDIRDEFINE@
HELPSTRINGS = @HELPSTRINGS@
# xxx this is bad style
RL_LIBSRC = $(topdir)/lib/readline
@@ -160,7 +161,7 @@ builtext.h builtins.c: $(MKBUILTINS) $(DEFSRC)
@-if test -f builtins.c; then mv -f builtins.c old-builtins.c; fi
@-if test -f builtext.h; then mv -f builtext.h old-builtext.h; fi
./$(MKBUILTINS) -externfile builtext.h -structfile builtins.c \
-noproduction $(DIRECTDEFINE) $(HELPDIRDEFINE) $(DEFSRC)
-noproduction $(DIRECTDEFINE) $(HELPDIRDEFINE) $(HELPSTRINGS) $(DEFSRC)
@-if cmp -s old-builtext.h builtext.h 2>/dev/null; then \
mv old-builtext.h builtext.h; \
else \
@@ -178,8 +179,7 @@ helpdoc: $(MKBUILTINS) $(DEFSRC)
install-help:
@-if test -n "${HELPDIR}" && test -d helpfiles ; then \
test -d ${HELPDIR} || ${SHELL} ${MKDIRS} $(DESTDIR)$(HELPDIR) ;\
( cd helpfiles ; \
for f in *; do \
( for f in helpfiles/*; do \
echo installing $$f; \
${INSTALL_DATA} $$f $(DESTDIR)$(HELPDIR); \
done; ) ; \
@@ -230,7 +230,7 @@ distclean maintainer-clean: clean
$(OFILES): $(MKBUILTINS) ../config.h
../version.h: ../config.h ../Makefile Makefile
-( cd ${BUILD_DIR} && ${MAKE} ${MFLAGS} version.h )
-( cd "${BUILD_DIR}" && ${MAKE} ${MFLAGS} version.h )
# maintainer special - for now
po: builtins.c
+1
View File
@@ -85,6 +85,7 @@ enum command_type { cm_for, cm_case, cm_while, cm_if, cm_simple, cm_select,
#define W_COMPASSIGN 0x08000 /* Compound assignment */
#define W_ASSNBLTIN 0x10000 /* word is a builtin command that takes assignments */
#define W_ASSIGNARG 0x20000 /* word is assignment argument to command */
#define W_HASQUOTEDNULL 0x40000 /* word contains a quoted null character */
/* Possible values for subshell_environment */
#define SUBSHELL_ASYNC 0x01 /* subshell caused by `command &' */
Vendored
+28 -2
View File
@@ -1,5 +1,5 @@
#! /bin/sh
# From configure.in for Bash 3.0, version 3.172, from autoconf version AC_ACVERSION.
# From configure.in for Bash 3.1, version 3.173, from autoconf version AC_ACVERSION.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.57 for bash 3.1-devel.
#
@@ -311,7 +311,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os EMACS lispdir DEBUGGER_START_FILE TESTSCRIPT PURIFY MALLOC_TARGET MALLOC_SRC MALLOC_LIB MALLOC_LIBRARY MALLOC_LDFLAGS MALLOC_DEP htmldir HELPDIR HELPDIRDEFINE HELPINSTALL HELPSTRINGS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP SIGNAMES_H CC_FOR_BUILD STATIC_LD CFLAGS_FOR_BUILD CPPFLAGS_FOR_BUILD LDFLAGS_FOR_BUILD RL_VERSION RL_MAJOR RL_MINOR READLINE_LIB READLINE_DEP RL_LIBDIR RL_INCLUDEDIR RL_INCLUDE HISTORY_LIB HISTORY_DEP HIST_LIBDIR INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA AR RANLIB ac_ct_RANLIB YACC SET_MAKE MAKE_SHELL MKINSTALLDIRS USE_NLS MSGFMT GMSGFMT XGETTEXT MSGMERGE ALLOCA GLIBC21 LIBICONV LTLIBICONV INTLBISON BUILD_INCLUDED_LIBINTL USE_INCLUDED_LIBINTL CATOBJEXT DATADIRNAME INSTOBJEXT GENCAT INTLOBJS INTL_LIBTOOL_SUFFIX_PREFIX INTLLIBS LIBINTL LTLIBINTL POSUB LIBOBJS INTL_DEP INTL_INC LIBINTL_H SIGLIST_O TERMCAP_LIB TERMCAP_DEP JOBS_O SHOBJ_CC SHOBJ_CFLAGS SHOBJ_LD SHOBJ_LDFLAGS SHOBJ_XLDFLAGS SHOBJ_LIBS SHOBJ_STATUS PROFILE_FLAGS incdir BUILD_DIR ARFLAGS BASHVERS RELSTATUS DEBUG MALLOC_DEBUG LOCAL_LIBS LOCAL_CFLAGS LOCAL_LDFLAGS LOCAL_DEFS LTLIBOBJS'
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os EMACS lispdir DEBUGGER_START_FILE TESTSCRIPT PURIFY MALLOC_TARGET MALLOC_SRC MALLOC_LIB MALLOC_LIBRARY MALLOC_LDFLAGS MALLOC_DEP htmldir HELPDIR HELPDIRDEFINE HELPINSTALL HELPSTRINGS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP SIGNAMES_H CC_FOR_BUILD STATIC_LD CFLAGS_FOR_BUILD CPPFLAGS_FOR_BUILD LDFLAGS_FOR_BUILD RL_VERSION RL_MAJOR RL_MINOR READLINE_LIB READLINE_DEP RL_LIBDIR RL_INCLUDEDIR RL_INCLUDE HISTORY_LIB HISTORY_DEP HIST_LIBDIR INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA AR RANLIB ac_ct_RANLIB YACC SET_MAKE MAKE_SHELL SIZE MKINSTALLDIRS USE_NLS MSGFMT GMSGFMT XGETTEXT MSGMERGE ALLOCA GLIBC21 LIBICONV LTLIBICONV INTLBISON BUILD_INCLUDED_LIBINTL USE_INCLUDED_LIBINTL CATOBJEXT DATADIRNAME INSTOBJEXT GENCAT INTLOBJS INTL_LIBTOOL_SUFFIX_PREFIX INTLLIBS LIBINTL LTLIBINTL POSUB LIBOBJS INTL_DEP INTL_INC LIBINTL_H SIGLIST_O TERMCAP_LIB TERMCAP_DEP JOBS_O SHOBJ_CC SHOBJ_CFLAGS SHOBJ_LD SHOBJ_LDFLAGS SHOBJ_XLDFLAGS SHOBJ_LIBS SHOBJ_STATUS PROFILE_FLAGS incdir BUILD_DIR ARFLAGS BASHVERS RELSTATUS DEBUG MALLOC_DEBUG LOCAL_LIBS LOCAL_CFLAGS LOCAL_LDFLAGS LOCAL_DEFS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -4927,6 +4927,27 @@ opennt*|interix*) MAKE_SHELL="$INTERIX_ROOT/bin/sh" ;;
esac
if test x$SIZE = x; then
if test x$ac_tool_prefix = x; then
SIZE=size
else
SIZE=${ac_tool_prefix}size
save_IFS=$IFS ; IFS=:
size_found=0
for dir in $PATH; do
if test -x $dir/$SIZE ; then
size_found=1
break
fi
done
if test $size_found -eq 0; then
SIZE=size
fi
IFS=$save_IFS
fi
fi
cat >>confdefs.h <<\_ACEOF
#define _GNU_SOURCE 1
_ACEOF
@@ -24146,6 +24167,10 @@ case "$srcdir" in
esac
BUILD_DIR=`pwd`
case "$BUILD_DIR" in
*\ *) BUILD_DIR=`echo "$BUILD_DIR" | sed 's: :\\\\ :g'` ;;
*) ;;
esac
@@ -24877,6 +24902,7 @@ s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
s,@YACC@,$YACC,;t t
s,@SET_MAKE@,$SET_MAKE,;t t
s,@MAKE_SHELL@,$MAKE_SHELL,;t t
s,@SIZE@,$SIZE,;t t
s,@MKINSTALLDIRS@,$MKINSTALLDIRS,;t t
s,@USE_NLS@,$USE_NLS,;t t
s,@MSGFMT@,$MSGFMT,;t t
+29 -3
View File
@@ -1,11 +1,11 @@
dnl
dnl Configure script for bash-3.0
dnl Configure script for bash-3.1
dnl
dnl report bugs to chet@po.cwru.edu
dnl
dnl Process this file with autoconf to produce a configure script.
# Copyright (C) 1987-2004 Free Software Foundation, Inc.
# Copyright (C) 1987-2005 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ dnl Process this file with autoconf to produce a configure script.
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
AC_REVISION([for Bash 3.0, version 3.172, from autoconf version] AC_ACVERSION)dnl
AC_REVISION([for Bash 3.1, version 3.173, from autoconf version] AC_ACVERSION)dnl
define(bashvers, 3.1)
define(relstatus, devel)
@@ -557,6 +557,28 @@ opennt*|interix*) MAKE_SHELL="$INTERIX_ROOT/bin/sh" ;;
esac
AC_SUBST(MAKE_SHELL)
dnl this is similar to the expanded AC_PROG_RANLIB
if test x$SIZE = x; then
if test x$ac_tool_prefix = x; then
SIZE=size
else
SIZE=${ac_tool_prefix}size
save_IFS=$IFS ; IFS=:
size_found=0
for dir in $PATH; do
if test -x $dir/$SIZE ; then
size_found=1
break
fi
done
if test $size_found -eq 0; then
SIZE=size
fi
IFS=$save_IFS
fi
fi
AC_SUBST(SIZE)
dnl Turn on any extensions available in the GNU C library.
AC_DEFINE(_GNU_SOURCE, 1)
@@ -1004,6 +1026,10 @@ case "$srcdir" in
esac
BUILD_DIR=`pwd`
case "$BUILD_DIR" in
*\ *) BUILD_DIR=`echo "$BUILD_DIR" | sed 's: :\\\\ :g'` ;;
*) ;;
esac
AC_SUBST(PROFILE_FLAGS)
+36 -4
View File
@@ -1,11 +1,11 @@
dnl
dnl Configure script for bash-3.0
dnl Configure script for bash-3.1
dnl
dnl report bugs to chet@po.cwru.edu
dnl
dnl Process this file with autoconf to produce a configure script.
# Copyright (C) 1987-2004 Free Software Foundation, Inc.
# Copyright (C) 1987-2005 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ dnl Process this file with autoconf to produce a configure script.
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
AC_REVISION([for Bash 3.0, version 3.171, from autoconf version] AC_ACVERSION)dnl
AC_REVISION([for Bash 3.1, version 3.173, from autoconf version] AC_ACVERSION)dnl
define(bashvers, 3.1)
define(relstatus, devel)
@@ -181,6 +181,7 @@ opt_progcomp=yes
opt_separate_help=no
opt_multibyte=yes
opt_debugger=yes
opt_single_longdoc_strings=yes
dnl options that affect how bash is compiled and linked
opt_static_link=no
@@ -227,6 +228,7 @@ AC_ARG_ENABLE(readline, AC_HELP_STRING([--enable-readline], [turn on command lin
AC_ARG_ENABLE(restricted, AC_HELP_STRING([--enable-restricted], [enable a restricted shell]), opt_restricted=$enableval)
AC_ARG_ENABLE(select, AC_HELP_STRING([--enable-select], [include select command]), opt_select=$enableval)
AC_ARG_ENABLE(separate-helpfiles, AC_HELP_STRING([--enable-separate-helpfiles], [use external files for help builtin documentation]), opt_separate_help=$enableval)
AC_ARG_ENABLE(single-help-strings, AC_HELP_STRING([--enable-single-help-strings], [store help documentation as a single string to ease translation]), opt_single_longdoc_strings=$enableval)
AC_ARG_ENABLE(usg-echo-default, AC_HELP_STRING([--enable-usg-echo-default], [a synonym for --enable-xpg-echo-default]), opt_xpg_echo=$enableval)
AC_ARG_ENABLE(xpg-echo-default, AC_HELP_STRING([--enable-xpg-echo-default], [make the echo builtin expand escape sequences by default]), opt_xpg_echo=$enableval)
@@ -325,6 +327,10 @@ if test "$opt_separate_help" != no; then
HELPDIRDEFINE='-H ${HELPDIR}'
HELPINSTALL='install-help'
fi
HELPSTRINGS=
if test "$opt_single_longdoc_strings" != "yes"; then
HELPSTRINGS='-S'
fi
dnl now substitute in the values generated by arguments
AC_SUBST(TESTSCRIPT)
@@ -342,6 +348,7 @@ AC_SUBST(htmldir)
AC_SUBST(HELPDIR)
AC_SUBST(HELPDIRDEFINE)
AC_SUBST(HELPINSTALL)
AC_SUBST(HELPSTRINGS)
echo ""
echo "Beginning configuration for bash-$BASHVERS-$RELSTATUS for ${host_cpu}-${host_vendor}-${host_os}"
@@ -550,6 +557,27 @@ opennt*|interix*) MAKE_SHELL="$INTERIX_ROOT/bin/sh" ;;
esac
AC_SUBST(MAKE_SHELL)
dnl this is similar to the expanded AC_PROG_RANLIB
if test x$SIZE = x; then
if test x$ac_tool_prefix = x; then
SIZE=size
else
SIZE=${ac_tool_prefix}size
save_IFS=$IFS ; IFS=:
size_found=0
for dir in $PATH; do
if test -x $dir/$SIZE ; then
size_found=1
break
fi
done
if test $size_found -eq 0; then
SIZE=size
fi
IFS=$save_IFS
fi
fi
dnl Turn on any extensions available in the GNU C library.
AC_DEFINE(_GNU_SOURCE, 1)
@@ -642,7 +670,7 @@ AC_REPLACE_FUNCS(rename)
dnl checks for c library functions
AC_CHECK_FUNCS(bcopy bzero confstr sysconf pathconf setenv putenv unsetenv \
setlinebuf setvbuf setlocale strchr tcgetattr uname \
ulimit tzset siginterrupt memmove ttyname times \
ulimit tzset siginterrupt memmove ttyname times raise \
getaddrinfo gethostbyname getservbyname getservent inet_aton \
vsnprintf snprintf vasprintf asprintf fnmatch regcomp regexec)
AC_CHECK_FUNCS(isascii isblank isgraph isprint isspace isxdigit)
@@ -997,6 +1025,10 @@ case "$srcdir" in
esac
BUILD_DIR=`pwd`
case "$BUILD_DIR" in
*\ *) BUILD_DIR=`echo "$BUILD_DIR" | sed 's: :\\\\ :g'` ;;
*) ;;
esac
AC_SUBST(PROFILE_FLAGS)
+131 -697
View File
@@ -1,711 +1,145 @@
*** ../bash-3.0-patched/variables.c Wed Sep 8 11:07:44 2004
--- variables.c Fri Nov 5 21:17:42 2004
*** ../bash-3.0-patched/lib/readline/display.c Wed Sep 8 11:07:51 2004
--- lib/readline/display.c Sat Jan 8 21:51:40 2005
***************
*** 200,204 ****
static SHELL_VAR *new_shell_variable __P((const char *));
static SHELL_VAR *make_new_variable __P((const char *, HASH_TABLE *));
! static SHELL_VAR *bind_variable_internal __P((const char *, char *, HASH_TABLE *, int));
*** 181,184 ****
--- 186,201 ----
static int prompt_physical_chars;
static void free_variable_hash_data __P((PTR_T));
--- 200,204 ----
static SHELL_VAR *new_shell_variable __P((const char *));
static SHELL_VAR *make_new_variable __P((const char *, HASH_TABLE *));
! static SHELL_VAR *bind_variable_internal __P((const char *, char *, HASH_TABLE *, int, int));
static void free_variable_hash_data __P((PTR_T));
***************
*** 321,325 ****
# if 0
/* Array variables may not yet be exported. */
! else if (*string == '(' && string[1] == '[' && xstrchr (string, ')'))
{
string_length = 1;
--- 321,325 ----
# if 0
/* Array variables may not yet be exported. */
! else if (*string == '(' && string[1] == '[' && string[strlen (string) - 1] == ')')
{
string_length = 1;
***************
*** 334,338 ****
else
{
! temp_var = bind_variable (name, string);
VSETATTR (temp_var, (att_exported | att_imported));
array_needs_making = 1;
--- 334,338 ----
else
{
! temp_var = bind_variable (name, string, 0);
VSETATTR (temp_var, (att_exported | att_imported));
array_needs_making = 1;
***************
*** 351,355 ****
/* Set up initial value of $_ */
! temp_var = bind_variable ("_", dollar_vars[0]);
/* Remember this pid. */
--- 351,355 ----
/* Set up initial value of $_ */
! temp_var = bind_variable ("_", dollar_vars[0], 0);
/* Remember this pid. */
***************
*** 373,377 ****
char node_name[22];
qnx_nidtostr (getnid (), node_name, sizeof (node_name));
! temp_var = bind_variable ("NODE", node_name);
set_auto_export (temp_var);
}
--- 373,377 ----
char node_name[22];
qnx_nidtostr (getnid (), node_name, sizeof (node_name));
! temp_var = bind_variable ("NODE", node_name, 0);
set_auto_export (temp_var);
}
***************
*** 393,397 ****
/* Don't allow IFS to be imported from the environment. */
! temp_var = bind_variable ("IFS", " \t\n");
setifs (temp_var);
--- 393,397 ----
/* Don't allow IFS to be imported from the environment. */
! temp_var = bind_variable ("IFS", " \t\n", 0);
setifs (temp_var);
***************
*** 412,418 ****
/* Initialize the `getopts' stuff. */
! bind_variable ("OPTIND", "1");
getopts_reset (0);
! bind_variable ("OPTERR", "1");
sh_opterr = 1;
--- 412,418 ----
/* Initialize the `getopts' stuff. */
! bind_variable ("OPTIND", "1", 0);
getopts_reset (0);
! bind_variable ("OPTERR", "1", 0);
sh_opterr = 1;
***************
*** 423,427 ****
to it. */
name = get_bash_name ();
! temp_var = bind_variable ("BASH", name);
free (name);
--- 423,427 ----
to it. */
name = get_bash_name ();
! temp_var = bind_variable ("BASH", name, 0);
free (name);
***************
*** 433,437 ****
/* Make a variable called BASH_VERSION which contains the version info. */
! bind_variable ("BASH_VERSION", shell_version_string ());
#if defined (ARRAY_VARS)
make_vers_array ();
--- 433,437 ----
/* Make a variable called BASH_VERSION which contains the version info. */
! bind_variable ("BASH_VERSION", shell_version_string (), 0);
#if defined (ARRAY_VARS)
make_vers_array ();
***************
*** 439,443 ****
if (command_execution_string)
! bind_variable ("BASH_EXECUTION_STRING", command_execution_string);
/* Find out if we're supposed to be in Posix.2 mode via an
--- 439,443 ----
if (command_execution_string)
! bind_variable ("BASH_EXECUTION_STRING", command_execution_string, 0);
/* Find out if we're supposed to be in Posix.2 mode via an
***************
*** 557,561 ****
temp_var = find_variable ("HOME");
if (temp_var == 0)
! temp_var = bind_variable ("HOME", sh_get_home_dir ());
#if 0
VSETATTR (temp_var, att_exported);
--- 557,561 ----
temp_var = find_variable ("HOME");
if (temp_var == 0)
! temp_var = bind_variable ("HOME", sh_get_home_dir (), 0);
#if 0
VSETATTR (temp_var, att_exported);
***************
*** 575,579 ****
if (current_user.shell == 0)
get_current_user_info ();
! temp_var = bind_variable ("SHELL", current_user.shell);
}
#if 0
--- 575,579 ----
if (current_user.shell == 0)
get_current_user_info ();
! temp_var = bind_variable ("SHELL", current_user.shell, 0);
}
#if 0
***************
*** 697,701 ****
}
! temp_var = bind_variable ("SHLVL", new_level);
set_auto_export (temp_var);
}
--- 697,701 ----
}
! temp_var = bind_variable ("SHLVL", new_level, 0);
set_auto_export (temp_var);
}
***************
*** 732,736 ****
{
set_working_directory (home_string);
! temp_var = bind_variable ("PWD", home_string);
set_auto_export (temp_var);
}
--- 732,736 ----
{
set_working_directory (home_string);
! temp_var = bind_variable ("PWD", home_string, 0);
set_auto_export (temp_var);
}
***************
*** 740,744 ****
if (temp_string)
{
! temp_var = bind_variable ("PWD", temp_string);
set_auto_export (temp_var);
free (temp_string);
--- 740,744 ----
if (temp_string)
{
! temp_var = bind_variable ("PWD", temp_string, 0);
set_auto_export (temp_var);
free (temp_string);
***************
*** 749,753 ****
`environment variable' and therefore should be auto-exported.
Make a dummy invisible variable for OLDPWD, and mark it as exported. */
! temp_var = bind_variable ("OLDPWD", (char *)NULL);
VSETATTR (temp_var, (att_exported | att_invisible));
}
--- 749,753 ----
`environment variable' and therefore should be auto-exported.
Make a dummy invisible variable for OLDPWD, and mark it as exported. */
! temp_var = bind_variable ("OLDPWD", (char *)NULL, 0);
VSETATTR (temp_var, (att_exported | att_invisible));
}
***************
*** 764,768 ****
if (temp_var)
VUNSETATTR (temp_var, (att_readonly | att_exported));
! temp_var = bind_variable ("PPID", name);
VSETATTR (temp_var, (att_readonly | att_integer));
}
--- 764,768 ----
if (temp_var)
VUNSETATTR (temp_var, (att_readonly | att_exported));
! temp_var = bind_variable ("PPID", name, 0);
VSETATTR (temp_var, (att_readonly | att_integer));
}
***************
*** 778,782 ****
if (v == 0)
{
! v = bind_variable ("UID", b);
VSETATTR (v, (att_readonly | att_integer));
}
--- 778,782 ----
if (v == 0)
{
! v = bind_variable ("UID", b, 0);
VSETATTR (v, (att_readonly | att_integer));
}
***************
*** 788,792 ****
if (v == 0)
{
! v = bind_variable ("EUID", b);
VSETATTR (v, (att_readonly | att_integer));
}
--- 788,792 ----
if (v == 0)
{
! v = bind_variable ("EUID", b, 0);
VSETATTR (v, (att_readonly | att_integer));
}
***************
*** 831,838 ****
v = inttostr (lines, val, sizeof (val));
! bind_variable ("LINES", v);
v = inttostr (cols, val, sizeof (val));
! bind_variable ("COLUMNS", v);
}
--- 831,838 ----
v = inttostr (lines, val, sizeof (val));
! bind_variable ("LINES", v, 0);
v = inttostr (cols, val, sizeof (val));
! bind_variable ("COLUMNS", v, 0);
}
***************
*** 984,988 ****
do \
{ \
! v = bind_variable (var, (val)); \
v->dynamic_value = gfunc; \
v->assign_func = afunc; \
--- 984,988 ----
do \
{ \
! v = bind_variable (var, (val), 0); \
v->dynamic_value = gfunc; \
v->assign_func = afunc; \
***************
*** 1229,1233 ****
char *p;
! p = savestring (the_printed_command_except_trap);
FREE (value_cell (var));
var_setvalue (var, p);
--- 1229,1240 ----
char *p;
!
! if (the_printed_command_except_trap)
! p = savestring (the_printed_command_except_trap);
! else
! {
! p = (char *)xmalloc (1);
! p[0] = '\0';
! }
FREE (value_cell (var));
var_setvalue (var, p);
***************
*** 1420,1428 ****
# if defined (DEBUGGER)
! v = init_dynamic_array_var ("BASH_ARGC", get_self, null_array_assign, att_noassign);
! v = init_dynamic_array_var ("BASH_ARGV", get_self, null_array_assign, att_noassign);
# endif /* DEBUGGER */
! v = init_dynamic_array_var ("BASH_SOURCE", get_self, null_array_assign, att_noassign);
! v = init_dynamic_array_var ("BASH_LINENO", get_self, null_array_assign, att_noassign);
#endif
--- 1427,1435 ----
# if defined (DEBUGGER)
! v = init_dynamic_array_var ("BASH_ARGC", get_self, null_array_assign, att_noassign|att_nounset);
! v = init_dynamic_array_var ("BASH_ARGV", get_self, null_array_assign, att_noassign|att_nounset);
# endif /* DEBUGGER */
! v = init_dynamic_array_var ("BASH_SOURCE", get_self, null_array_assign, att_noassign|att_nounset);
! v = init_dynamic_array_var ("BASH_LINENO", get_self, null_array_assign, att_noassign|att_nounset);
#endif
***************
*** 1583,1587 ****
v = find_variable (name);
if (v == 0)
! v = bind_variable_internal (name, value, global_variables->table, HASH_NOSRCH);
return (v);
}
--- 1590,1594 ----
v = find_variable (name);
if (v == 0)
! v = bind_variable_internal (name, value, global_variables->table, HASH_NOSRCH, 0);
return (v);
}
***************
*** 1637,1641 ****
if (old_var == 0)
! new_var = bind_variable_internal (name, "", vc->table, HASH_NOSRCH);
else
{
--- 1644,1648 ----
if (old_var == 0)
! new_var = bind_variable_internal (name, "", vc->table, HASH_NOSRCH, 0);
else
{
***************
*** 1752,1762 ****
char *
! make_variable_value (var, value)
SHELL_VAR *var;
char *value;
{
! char *retval;
! intmax_t lval;
! int expok;
/* If this variable has had its type set to integer (via `declare -i'),
--- 1759,1770 ----
char *
! make_variable_value (var, value, flags)
SHELL_VAR *var;
char *value;
+ int flags;
{
! char *retval, *oval;
! intmax_t lval, rval;
! int expok, olen;
/* If this variable has had its type set to integer (via `declare -i'),
***************
*** 1767,1778 ****
if (integer_p (var))
{
! lval = evalexp (value, &expok);
if (expok == 0)
jump_to_top_level (DISCARD);
! retval = itos (lval);
}
else if (value)
{
! if (*value)
retval = savestring (value);
else
--- 1775,1806 ----
if (integer_p (var))
{
! if (flags & ASS_APPEND)
! {
! oval = value_cell (var);
! lval = evalexp (oval, &expok); /* ksh93 seems to do this */
! if (expok == 0)
! jump_to_top_level (DISCARD);
! }
! rval = evalexp (value, &expok);
if (expok == 0)
jump_to_top_level (DISCARD);
! if (flags & ASS_APPEND)
! rval += lval;
! retval = itos (rval);
}
else if (value)
{
! if (flags & ASS_APPEND)
! {
! oval = value_cell (var);
! if (oval == 0) /* paranoia */
! oval = "";
! olen = STRLEN (oval);
! retval = (char *)xmalloc (olen + (value ? STRLEN (value) : 0) + 1);
! strcpy (retval, oval);
! if (value)
! strcpy (retval+olen, value);
! }
! else if (*value)
retval = savestring (value);
else
***************
*** 1791,1799 ****
temporary environment (but usually is not). */
static SHELL_VAR *
! bind_variable_internal (name, value, table, hflags)
const char *name;
char *value;
HASH_TABLE *table;
! int hflags;
{
char *newval;
--- 1819,1827 ----
temporary environment (but usually is not). */
static SHELL_VAR *
! bind_variable_internal (name, value, table, hflags, aflags)
const char *name;
char *value;
HASH_TABLE *table;
! int hflags, aflags;
{
char *newval;
***************
*** 1805,1809 ****
{
entry = make_new_variable (name, table);
! var_setvalue (entry, make_variable_value (entry, value));
}
else if (entry->assign_func) /* array vars have assign functions now */
--- 1833,1837 ----
{
entry = make_new_variable (name, table);
! var_setvalue (entry, make_variable_value (entry, value, 0)); /* XXX */
}
else if (entry->assign_func) /* array vars have assign functions now */
***************
*** 1824,1828 ****
VUNSETATTR (entry, att_invisible);
! newval = make_variable_value (entry, value);
/* Invalidate any cached export string */
--- 1852,1856 ----
VUNSETATTR (entry, att_invisible);
! newval = make_variable_value (entry, value, aflags); /* XXX */
/* Invalidate any cached export string */
***************
*** 1861,1867 ****
SHELL_VAR *
! bind_variable (name, value)
const char *name;
char *value;
{
SHELL_VAR *v;
--- 1889,1896 ----
SHELL_VAR *
! bind_variable (name, value, flags)
const char *name;
char *value;
+ int flags;
{
SHELL_VAR *v;
***************
*** 1890,1897 ****
v = hash_lookup (name, vc->table);
if (v)
! return (bind_variable_internal (name, value, vc->table, 0));
}
}
! return (bind_variable_internal (name, value, global_variables->table, 0));
}
--- 1919,1926 ----
v = hash_lookup (name, vc->table);
if (v)
! return (bind_variable_internal (name, value, vc->table, 0, flags));
}
}
! return (bind_variable_internal (name, value, global_variables->table, 0, flags));
}
***************
*** 1902,1908 ****
and note that the export environment needs to be recreated. */
SHELL_VAR *
! bind_variable_value (var, value)
SHELL_VAR *var;
char *value;
{
char *t;
--- 1931,1938 ----
and note that the export environment needs to be recreated. */
SHELL_VAR *
! bind_variable_value (var, value, aflags)
SHELL_VAR *var;
char *value;
+ int aflags;
{
char *t;
***************
*** 1910,1914 ****
VUNSETATTR (var, att_invisible);
! t = make_variable_value (var, value);
FREE (value_cell (var));
var_setvalue (var, t);
--- 1940,1944 ----
VUNSETATTR (var, att_invisible);
! t = make_variable_value (var, value, aflags);
FREE (value_cell (var));
var_setvalue (var, t);
***************
*** 1966,1973 ****
#if defined (ARRAY_VARS)
if (isarr)
! v = assign_array_element (lhs, rhs);
else
#endif
! v = bind_variable (lhs, rhs);
if (isint)
--- 1996,2003 ----
#if defined (ARRAY_VARS)
if (isarr)
! v = assign_array_element (lhs, rhs, 0);
else
#endif
! v = bind_variable (lhs, rhs, 0);
if (isint)
***************
*** 2068,2077 ****
temporary environments. The expansion code in subst.c calls this. */
int
! assign_in_env (string)
! const char *string;
{
int offset;
char *name, *temp, *value;
SHELL_VAR *var;
offset = assignment (string, 0);
--- 2098,2110 ----
temporary environments. The expansion code in subst.c calls this. */
int
! assign_in_env (word)
! WORD_DESC *word;
{
int offset;
char *name, *temp, *value;
SHELL_VAR *var;
+ const char *string;
+ /* Variables to save and restore prompt and display information. */
+
+ string = word->word;
offset = assignment (string, 0);
***************
*** 2083,2086 ****
--- 2116,2123 ----
name[offset] = 0;
+ /* ignore the `+' when assigning temporary environment */
+ if (name[offset - 1] == '+')
+ name[offset - 1] = '\0';
+ /* These are getting numerous enough that it's time to create a struct. */
+
var = find_variable (name);
if (var && (readonly_p (var) || noassign_p (var)))
+ static char *saved_local_prompt;
+ static char *saved_local_prefix;
+ static int saved_last_invisible;
+ static int saved_visible_length;
+ static int saved_prefix_length;
+ static int saved_invis_chars_first_line;
+ static int saved_physical_chars;
+
/* Expand the prompt string S and return the number of visible
characters in *LP, if LP is not null. This is currently more-or-less
***************
*** 2093,2100 ****
temp = name + offset + 1;
temp = (xstrchr (temp, '~') != 0) ? bash_tilde_expand (temp, 1) : savestring (temp);
*** 1797,1803 ****
return ((ISPRINT (uc)) ? 1 : 2);
}
-
value = expand_string_unsplit_to_string (temp, 0);
free (temp);
}
/* How to print things in the "echo-area". The prompt is treated as a
mini-modeline. */
--- 2130,2140 ----
temp = name + offset + 1;
+ #if 0
temp = (xstrchr (temp, '~') != 0) ? bash_tilde_expand (temp, 1) : savestring (temp);
value = expand_string_unsplit_to_string (temp, 0);
free (temp);
+ #else
+ value = expand_assignment_string_to_string (temp, 0);
+ #endif
}
#if defined (USE_VARARGS)
--- 1825,1831 ----
return ((ISPRINT (uc)) ? 1 : 2);
}
/* How to print things in the "echo-area". The prompt is treated as a
mini-modeline. */
+ static int msg_saved_prompt = 0;
#if defined (USE_VARARGS)
***************
*** 2306,2309 ****
--- 2346,2355 ----
if (old_var && local_p (old_var) && variable_context == old_var->context)
{
+ #if defined (ARRAY_VARS)
+ if (array_p (old_var))
+ array_dispose (array_cell (old_var));
+ else
+ #endif
+ FREE (value_cell (old_var));
/* Reset the attributes. Preserve the export attribute if the variable
came from a temporary environment. Make sure it stays local, and
***************
*** 2312,2316 ****
VSETATTR (old_var, att_local);
VSETATTR (old_var, att_invisible);
- FREE (value_cell (old_var));
var_setvalue (old_var, (char *)NULL);
INVALIDATE_EXPORTSTR (old_var);
--- 2358,2361 ----
***************
*** 2390,2394 ****
if (!entry) \
{ \
! entry = bind_variable (name, ""); \
if (!no_invisible_vars) entry->attributes |= att_invisible; \
} \
--- 2435,2439 ----
if (!entry) \
{ \
! entry = bind_variable (name, "", 0); \
if (!no_invisible_vars) entry->attributes |= att_invisible; \
} \
***************
*** 2832,2836 ****
}
*** 1830,1835 ****
--- 1858,1874 ----
va_end (args);
! v = bind_variable_internal (var->name, value_cell (var), binding_table, 0);
/* XXX - should we set the context here? It shouldn't matter because of how
--- 2877,2881 ----
}
! v = bind_variable_internal (var->name, value_cell (var), binding_table, 0, 0);
/* XXX - should we set the context here? It shouldn't matter because of how
+ if (saved_local_prompt == 0)
+ {
+ rl_save_prompt ();
+ msg_saved_prompt = 1;
+ }
rl_display_prompt = msg_buf;
+ local_prompt = expand_prompt (msg_buf, &prompt_visible_length,
+ &prompt_last_invisible,
+ &prompt_invis_chars_first_line,
+ &prompt_physical_chars);
+ local_prompt_prefix = (char *)NULL;
(*rl_redisplay_function) ();
+
return 0;
}
***************
*** 3350,3354 ****
{
/* XXX - should we set v->context here? */
! v = bind_variable_internal (var->name, value_cell (var), shell_variables->table, 0);
if (shell_variables == global_variables)
var->attributes &= ~(att_tempvar|att_propagate);
--- 3395,3399 ----
{
/* XXX - should we set v->context here? */
! v = bind_variable_internal (var->name, value_cell (var), shell_variables->table, 0, 0);
if (shell_variables == global_variables)
var->attributes &= ~(att_tempvar|att_propagate);
*** 1841,1846 ****
--- 1880,1897 ----
sprintf (msg_buf, format, arg1, arg2);
msg_buf[sizeof(msg_buf) - 1] = '\0'; /* overflow? */
+
rl_display_prompt = msg_buf;
+ if (saved_local_prompt == 0)
+ {
+ rl_save_prompt ();
+ msg_saved_prompt = 1;
+ }
+ local_prompt = expand_prompt (msg_buf, &prompt_visible_length,
+ &prompt_last_invisible,
+ &prompt_invis_chars_first_line,
+ &prompt_physical_chars);
+ local_prompt_prefix = (char *)NULL;
(*rl_redisplay_function) ();
+
return 0;
}
***************
*** 3429,3436 ****
/* If a temp var had its export attribute set, or it's marked to be
propagated, bind it in the previous scope before disposing it. */
if (exported_p (var) || (var->attributes & att_propagate))
{
var->attributes &= ~att_tempvar; /* XXX */
! v = bind_variable_internal (var->name, value_cell (var), shell_variables->table, 0);
if (shell_variables == global_variables)
var->attributes &= ~att_propagate;
--- 3474,3487 ----
/* If a temp var had its export attribute set, or it's marked to be
propagated, bind it in the previous scope before disposing it. */
+ /* XXX - This isn't exactly right, because all tempenv variables have the
+ export attribute set. */
+ #if 0
if (exported_p (var) || (var->attributes & att_propagate))
+ #else
+ if (tempvar_p (var) && exported_p (var) && (var->attributes & att_propagate))
+ #endif
{
var->attributes &= ~att_tempvar; /* XXX */
! v = bind_variable_internal (var->name, value_cell (var), shell_variables->table, 0, 0);
if (shell_variables == global_variables)
var->attributes &= ~att_propagate;
*** 1852,1855 ****
--- 1903,1911 ----
{
rl_display_prompt = rl_prompt;
+ if (msg_saved_prompt)
+ {
+ rl_restore_prompt ();
+ msg_saved_prompt = 0;
+ }
(*rl_redisplay_function) ();
return 0;
***************
*** 3650,3653 ****
--- 3701,3705 ----
{ "LC_MESSAGES", sv_locale },
{ "LC_NUMERIC", sv_locale },
+ { "LC_TIME", sv_locale },
*** 1866,1878 ****
}
- /* These are getting numerous enough that it's time to create a struct. */
-
- static char *saved_local_prompt;
- static char *saved_local_prefix;
- static int saved_last_invisible;
- static int saved_visible_length;
- static int saved_invis_chars_first_line;
- static int saved_physical_chars;
-
void
rl_save_prompt ()
--- 1922,1925 ----
***************
*** 1880,1883 ****
--- 1927,1931 ----
saved_local_prompt = local_prompt;
saved_local_prefix = local_prompt_prefix;
+ saved_prefix_length = prompt_prefix_length;
saved_last_invisible = prompt_last_invisible;
saved_visible_length = prompt_visible_length;
***************
*** 1886,1890 ****
local_prompt = local_prompt_prefix = (char *)0;
! prompt_last_invisible = prompt_visible_length = 0;
prompt_invis_chars_first_line = prompt_physical_chars = 0;
}
--- 1934,1938 ----
local_prompt = local_prompt_prefix = (char *)0;
! prompt_last_invisible = prompt_visible_length = prompt_prefix_length = 0;
prompt_invis_chars_first_line = prompt_physical_chars = 0;
}
***************
*** 1898,1905 ****
--- 1946,1959 ----
local_prompt = saved_local_prompt;
local_prompt_prefix = saved_local_prefix;
+ prompt_prefix_length = saved_prefix_length;
prompt_last_invisible = saved_last_invisible;
prompt_visible_length = saved_visible_length;
prompt_invis_chars_first_line = saved_invis_chars_first_line;
prompt_physical_chars = saved_physical_chars;
+
+ /* can test saved_local_prompt to see if prompt info has been saved. */
+ saved_local_prompt = saved_local_prefix = (char *)0;
+ saved_last_invisible = saved_visible_length = saved_prefix_length = 0;
+ saved_invis_chars_first_line = saved_physical_chars = 0;
}
{ "MAIL", sv_mail },
+9 -4
View File
@@ -239,11 +239,16 @@ dispose_word (w)
WORD_DESC *w;
{
FREE (w->word);
#if 0
free (w);
#else
ocache_free (wdcache, WORD_DESC, w);
#endif
}
/* Free a WORD_DESC, but not the word contained within. */
void
dispose_word_desc (w)
WORD_DESC *w;
{
w->word = 0;
ocache_free (wdcache, WORD_DESC, w);
}
/* How to get rid of a linked list of words. A WORD_LIST. */
+1
View File
@@ -24,6 +24,7 @@
#include "stdc.h"
extern void dispose_command __P((COMMAND *));
extern void dispose_word_desc __P((WORD_DESC *));
extern void dispose_word __P((WORD_DESC *));
extern void dispose_words __P((WORD_LIST *));
extern void dispose_word_array __P((char **));
+8 -10
View File
@@ -340,7 +340,7 @@ replace_history_entry (which, line, data)
{
HIST_ENTRY *temp, *old_value;
if (which >= history_length)
if (which < 0 || which >= history_length)
return ((HIST_ENTRY *)NULL);
temp = (HIST_ENTRY *)xmalloc (sizeof (HIST_ENTRY));
@@ -364,17 +364,15 @@ remove_history (which)
HIST_ENTRY *return_value;
register int i;
if (which >= history_length || !history_length)
return_value = (HIST_ENTRY *)NULL;
else
{
return_value = the_history[which];
if (which < 0 || which >= history_length || history_length == 0)
return ((HIST_ENTRY *)NULL);
for (i = which; i < history_length; i++)
the_history[i] = the_history[i + 1];
return_value = the_history[which];
history_length--;
}
for (i = which; i < history_length; i++)
the_history[i] = the_history[i + 1];
history_length--;
return (return_value);
}
+7 -4
View File
@@ -77,18 +77,20 @@ _rl_find_next_mbchar_internal (string, seed, count, find_non_zero)
char *string;
int seed, count, find_non_zero;
{
size_t tmp = 0;
size_t tmp;
mbstate_t ps;
int point = 0;
int point;
wchar_t wc;
tmp = 0;
memset(&ps, 0, sizeof (mbstate_t));
if (seed < 0)
seed = 0;
if (count <= 0)
return seed;
point = seed + _rl_adjust_point(string, seed, &ps);
point = seed + _rl_adjust_point (string, seed, &ps);
/* if this is true, means that seed was not pointed character
started byte. So correct the point and consume count */
if (seed < point)
@@ -134,7 +136,8 @@ _rl_find_next_mbchar_internal (string, seed, count, find_non_zero)
break;
}
}
return point;
return point;
}
static int
+3 -5
View File
@@ -314,12 +314,10 @@ _rl_is_mbchar_matched (string, seed, end, mbchar, length)
return 1;
}
#ifdef _rl_char_value
#error whoops
#endif
wchar_t
_rl_char_value (char *buf, int ind)
_rl_char_value (buf, ind)
char *buf;
int ind;
{
size_t tmp;
wchar_t wc;
+2 -2
View File
@@ -52,8 +52,8 @@ isnetconn (fd)
l = sizeof(sa);
rv = getpeername(fd, &sa, &l);
/* Solaris 2.5 getpeername() returns EINVAL if the fd is not a socket. */
return ((rv < 0 && (errno == ENOTSOCK || errno == EINVAL)) ? 0 : 1);
/* Posix.2 says getpeername can return these errors. */
return ((rv < 0 && (errno == ENOTSOCK || errno == ENOTCONN || errno == EINVAL)) ? 0 : 1);
#else /* !HAVE_GETPEERNAME || SVR4_2 || __BEOS__ */
# if defined (SVR4) || defined (SVR4_2)
/* Sockets on SVR4 and SVR4.2 are character special (streams) devices. */
+83
View File
@@ -0,0 +1,83 @@
/* netconn.c -- is a particular file descriptor a network connection?. */
/* Copyright (C) 2002 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>
#include <bashtypes.h>
#if ! defined(_MINIX) && defined (HAVE_SYS_FILE_H)
# include <sys/file.h>
#endif
#include <posixstat.h>
#include <filecntl.h>
#include <errno.h>
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif
/* The second and subsequent conditions must match those used to decide
whether or not to call getpeername() in isnetconn(). */
#if defined (HAVE_SYS_SOCKET_H) && defined (HAVE_GETPEERNAME) && !defined (SVR4_2)
# include <sys/socket.h>
#endif
/* Is FD a socket or network connection? */
int
isnetconn (fd)
int fd;
{
#if defined (HAVE_GETPEERNAME) && !defined (SVR4_2) && !defined (__BEOS__)
int rv;
socklen_t l;
struct sockaddr sa;
l = sizeof(sa);
rv = getpeername(fd, &sa, &l);
/* Solaris 2.5 getpeername() returns EINVAL if the fd is not a socket. */
return ((rv < 0 && (errno == ENOTSOCK || errno == EINVAL)) ? 0 : 1);
#else /* !HAVE_GETPEERNAME || SVR4_2 || __BEOS__ */
# if defined (SVR4) || defined (SVR4_2)
/* Sockets on SVR4 and SVR4.2 are character special (streams) devices. */
struct stat sb;
if (isatty (fd))
return (0);
if (fstat (fd, &sb) < 0)
return (0);
# if defined (S_ISFIFO)
if (S_ISFIFO (sb.st_mode))
return (0);
# endif /* S_ISFIFO */
return (S_ISCHR (sb.st_mode));
# else /* !SVR4 && !SVR4_2 */
# if defined (S_ISSOCK) && !defined (__BEOS__)
struct stat sb;
if (fstat (fd, &sb) < 0)
return (0);
return (S_ISSOCK (sb.st_mode));
# else /* !S_ISSOCK || __BEOS__ */
return (0);
# endif /* !S_ISSOCK || __BEOS__ */
# endif /* !SVR4 && !SVR4_2 */
#endif /* !HAVE_GETPEERNAME || SVR4_2 || __BEOS__ */
}
+14 -10
View File
@@ -76,16 +76,24 @@ cmd_init ()
ocache_create (wlcache, WORD_LIST, WLCACHESIZE);
}
WORD_DESC *
alloc_word_desc ()
{
WORD_DESC *temp;
ocache_alloc (wdcache, WORD_DESC, temp);
temp->flags = 0;
temp->word = 0;
return temp;
}
WORD_DESC *
make_bare_word (string)
const char *string;
{
WORD_DESC *temp;
#if 0
temp = (WORD_DESC *)xmalloc (sizeof (WORD_DESC));
#else
ocache_alloc (wdcache, WORD_DESC, temp);
#endif
temp = alloc_word_desc ();
if (*string)
temp->word = savestring (string);
@@ -95,7 +103,6 @@ make_bare_word (string)
temp->word[0] = '\0';
}
temp->flags = 0;
return (temp);
}
@@ -161,11 +168,8 @@ make_word_list (word, wlink)
{
WORD_LIST *temp;
#if 0
temp = (WORD_LIST *)xmalloc (sizeof (WORD_LIST));
#else
ocache_alloc (wlcache, WORD_LIST, temp);
#endif
temp->word = word;
temp->next = wlink;
return (temp);
+1
View File
@@ -25,6 +25,7 @@
extern void cmd_init __P((void));
extern WORD_DESC *alloc_word_desc __P((void));
extern WORD_DESC *make_bare_word __P((const char *));
extern WORD_DESC *make_word_flags __P((WORD_DESC *, const char *));
extern WORD_DESC *make_word __P((const char *));
+4 -3
View File
@@ -2918,9 +2918,10 @@ parse_dparen (c)
cmdtyp = parse_arith_cmd (&wval, 0);
if (cmdtyp == 1)
{
wd = alloc_word_desc ();
wd->word = wval;
wd = make_word (wval);
yylval.word_list = make_word_list (wd, (WORD_LIST *)NULL);
free (wval);
return (ARITH_FOR_EXPRS);
}
else
@@ -2936,10 +2937,10 @@ parse_dparen (c)
cmdtyp = parse_arith_cmd (&wval, 0);
if (cmdtyp == 1) /* arithmetic command */
{
wd = make_word (wval);
wd = alloc_word_desc ();
wd->word = wval;
wd->flags = W_QUOTED|W_NOSPLIT|W_NOGLOB;
yylval.word_list = make_word_list (wd, (WORD_LIST *)NULL);
free (wval); /* make_word copies it */
return (ARITH_CMD);
}
else if (cmdtyp == 0) /* nested subshell */
+254 -104
View File
@@ -163,6 +163,7 @@ static int glob_argv_flags_size;
#endif
static WORD_LIST expand_word_error, expand_word_fatal;
static WORD_DESC expand_wdesc_error, expand_wdesc_fatal;
static char expand_param_error, expand_param_fatal;
/* Tell the expansion functions to not longjmp back to top_level on fatal
@@ -259,9 +260,9 @@ static arrayind_t array_length_reference __P((char *));
static int valid_brace_expansion_word __P((char *, int));
static int chk_atstar __P((char *, int, int *, int *));
static char *parameter_brace_expand_word __P((char *, int, int));
static char *parameter_brace_expand_indir __P((char *, int, int, int *, int *));
static char *parameter_brace_expand_rhs __P((char *, char *, int, int, int *, int *));
static WORD_DESC *parameter_brace_expand_word __P((char *, int, int));
static WORD_DESC *parameter_brace_expand_indir __P((char *, int, int, int *, int *));
static WORD_DESC *parameter_brace_expand_rhs __P((char *, char *, int, int, int *, int *));
static void parameter_brace_expand_error __P((char *, char *));
static int valid_length_expression __P((char *));
@@ -277,8 +278,8 @@ static char *pos_params_pat_subst __P((char *, char *, char *, int));
static char *parameter_brace_patsub __P((char *, char *, char *, int));
static char *parameter_brace_expand __P((char *, int *, int, int *, int *));
static char *param_expand __P((char *, int *, int, int *, int *, int *, int *, int));
static WORD_DESC *parameter_brace_expand __P((char *, int *, int, int *, int *));
static WORD_DESC *param_expand __P((char *, int *, int, int *, int *, int *, int *, int));
static WORD_LIST *expand_word_internal __P((WORD_DESC *, int, int, int *, int *));
@@ -1799,7 +1800,7 @@ string_list_dollar_at (list, quoted)
WORD_LIST *list;
int quoted;
{
char *ifs;
char *ifs, *ret;
#if defined (HANDLE_MULTIBYTE)
char sep[MB_CUR_MAX + 1];
#else
@@ -1813,19 +1814,15 @@ string_list_dollar_at (list, quoted)
#if defined (HANDLE_MULTIBYTE)
if (ifs && *ifs)
{
size_t mblength;
mblength = MBLEN (ifs, strnlen (ifs, MB_CUR_MAX));
if (MB_INVALIDCH (mblength) || mblength == 1)
if (ifs_firstc_len == 1)
{
sep[0] = *ifs;
sep[0] = ifs_firstc[0];
sep[1] = '\0';
}
else if (mblength == 0)
sep[0] = '\0';
else
{
memcpy (sep, ifs, mblength);
sep[mblength] = '\0';
memcpy (sep, ifs_firstc, ifs_firstc_len);
sep[ifs_firstc_len] = '\0';
}
}
else
@@ -1929,10 +1926,9 @@ list_string (string, separators, quoted)
below. */
if (QUOTED_NULL (current_word))
{
t = make_bare_word ("");
t->flags |= W_QUOTED;
free (t->word);
t = alloc_word_desc ();
t->word = make_quoted_char ('\0');
t->flags |= W_QUOTED|W_HASQUOTEDNULL;
result = make_word_list (t, result);
}
else if (current_word[0] != '\0')
@@ -1941,6 +1937,7 @@ list_string (string, separators, quoted)
perform quoted null character removal on the current word. */
remove_quoted_nulls (current_word);
result = add_string_to_list (current_word, result);
result->word->flags &= ~W_HASQUOTEDNULL; /* just to be sure */
if (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT))
result->word->flags |= W_QUOTED;
}
@@ -1949,10 +1946,9 @@ list_string (string, separators, quoted)
Bourne shell style, then add a quoted null argument. */
else if (!sh_style_split && !spctabnl (string[sindex]))
{
t = make_bare_word ("");
t->flags |= W_QUOTED;
free (t->word);
t = alloc_word_desc ();
t->word = make_quoted_char ('\0');
t->flags |= W_QUOTED|W_HASQUOTEDNULL;
result = make_word_list (t, result);
}
@@ -2685,7 +2681,10 @@ expand_string_unsplit (string, quoted)
if (value)
{
if (value->word)
remove_quoted_nulls (value->word->word);
{
remove_quoted_nulls (value->word->word);
value->word->flags &= ~W_HASQUOTEDNULL;
}
dequote_list (value);
}
return (value);
@@ -2715,7 +2714,10 @@ expand_string_assignment (string, quoted)
if (value)
{
if (value->word)
remove_quoted_nulls (value->word->word);
{
remove_quoted_nulls (value->word->word);
value->word->flags &= ~W_HASQUOTEDNULL;
}
dequote_list (value);
}
return (value);
@@ -2753,7 +2755,10 @@ expand_prompt_string (string, quoted)
if (value)
{
if (value->word)
remove_quoted_nulls (value->word->word);
{
remove_quoted_nulls (value->word->word);
value->word->flags &= ~W_HASQUOTEDNULL;
}
dequote_list (value);
}
return (value);
@@ -3132,7 +3137,10 @@ word_list_remove_quoted_nulls (list)
register WORD_LIST *t;
for (t = list; t; t = t->next)
remove_quoted_nulls (t->word->word);
{
remove_quoted_nulls (t->word->word);
t->word->flags &= ~W_HASQUOTEDNULL;
}
}
/* **************************************************************** */
@@ -3738,8 +3746,13 @@ list_remove_pattern (list, pattern, patspec, itype, quoted)
for (new = (WORD_LIST *)NULL, l = list; l; l = l->next)
{
tword = remove_pattern (l->word->word, pattern, patspec);
#if 0
w = make_bare_word (tword);
FREE (tword);
#else
w = alloc_word_desc ();
w->word = tword ? tword : savestring ("");
#endif
new = make_word_list (w, new);
}
@@ -4720,18 +4733,21 @@ chk_atstar (name, quoted, quoted_dollar_atp, contains_dollar_at)
VAR_IS_SPECIAL is non-zero if NAME is one of the special variables in
the shell, e.g., "@", "$", "*", etc. QUOTED, if non-zero, means that
NAME was found inside of a double-quoted expression. */
static char *
static WORD_DESC *
parameter_brace_expand_word (name, var_is_special, quoted)
char *name;
int var_is_special, quoted;
{
WORD_DESC *ret;
char *temp, *tt;
intmax_t arg_index;
SHELL_VAR *var;
int atype;
/* Handle multiple digit arguments, as in ${11}. */
ret = 0;
temp = 0;
/* Handle multiple digit arguments, as in ${11}. */
if (legal_number (name, &arg_index))
{
tt = get_dollar_var_value (arg_index);
@@ -4750,8 +4766,8 @@ parameter_brace_expand_word (name, var_is_special, quoted)
tt[sindex = 0] = '$';
strcpy (tt + 1, name);
temp = param_expand (tt, &sindex, quoted, (int *)NULL, (int *)NULL,
(int *)NULL, (int *)NULL, 0);
ret = param_expand (tt, &sindex, quoted, (int *)NULL, (int *)NULL,
(int *)NULL, (int *)NULL, 0);
free (tt);
}
#if defined (ARRAY_VARS)
@@ -4785,20 +4801,27 @@ parameter_brace_expand_word (name, var_is_special, quoted)
else
temp = (char *)NULL;
return (temp);
if (ret == 0)
{
ret = alloc_word_desc ();
ret->word = temp;
}
return ret;
}
/* Expand an indirect reference to a variable: ${!NAME} expands to the
value of the variable whose name is the value of NAME. */
static char *
static WORD_DESC *
parameter_brace_expand_indir (name, var_is_special, quoted, quoted_dollar_atp, contains_dollar_at)
char *name;
int var_is_special, quoted;
int *quoted_dollar_atp, *contains_dollar_at;
{
char *temp, *t;
WORD_DESC *w;
t = parameter_brace_expand_word (name, var_is_special, quoted);
w = parameter_brace_expand_word (name, var_is_special, quoted);
t = w->word;
/* Have to dequote here if necessary */
if (t)
{
@@ -4808,23 +4831,28 @@ parameter_brace_expand_indir (name, var_is_special, quoted, quoted_dollar_atp, c
free (t);
t = temp;
}
dispose_word_desc (w);
chk_atstar (t, quoted, quoted_dollar_atp, contains_dollar_at);
if (t == 0)
return (t);
temp = parameter_brace_expand_word (t, SPECIAL_VAR(t, 0), quoted);
return (WORD_DESC *)NULL;
w = parameter_brace_expand_word (t, SPECIAL_VAR(t, 0), quoted);
free (t);
return temp;
return w;
}
/* Expand the right side of a parameter expansion of the form ${NAMEcVALUE},
depending on the value of C, the separating character. C can be one of
"-", "+", or "=". QUOTED is true if the entire brace expression occurs
between double quotes. */
static char *
static WORD_DESC *
parameter_brace_expand_rhs (name, value, c, quoted, qdollaratp, hasdollarat)
char *name, *value;
int c, quoted, *qdollaratp, *hasdollarat;
{
WORD_DESC *w;
WORD_LIST *l;
char *t, *t1, *temp;
int hasdol;
@@ -4840,6 +4868,7 @@ parameter_brace_expand_rhs (name, value, c, quoted, qdollaratp, hasdollarat)
else
temp = value;
w = alloc_word_desc ();
hasdol = 0;
/* XXX was 0 not quoted */
l = *temp ? expand_string_for_rhs (temp, quoted, &hasdol, (int *)NULL)
@@ -4873,12 +4902,16 @@ parameter_brace_expand_rhs (name, value, c, quoted, qdollaratp, hasdollarat)
temp = (char *)xmalloc (2);
temp[0] = CTLNUL;
temp[1] = '\0';
w->flags |= W_HASQUOTEDNULL;
}
else
temp = (char *)NULL;
if (c == '-' || c == '+')
return (temp);
{
w->word = temp;
return w;
}
/* c == '=' */
t = temp ? savestring (temp) : savestring ("");
@@ -4891,7 +4924,9 @@ parameter_brace_expand_rhs (name, value, c, quoted, qdollaratp, hasdollarat)
#endif /* ARRAY_VARS */
bind_variable (name, t1, 0);
free (t1);
return (temp);
w->word = temp;
return w;
}
/* Deal with the right hand side of a ${name:?value} expansion in the case
@@ -5266,7 +5301,6 @@ get_var_and_type (varname, value, quoted, varp, valp)
}
else
#endif
#if 1
{
if (value && vtype == VT_VARIABLE)
{
@@ -5278,9 +5312,6 @@ get_var_and_type (varname, value, quoted, varp, valp)
else
*valp = value;
}
#else
*valp = (value && vtype == VT_VARIABLE) ? dequote_escapes (value) : value;
#endif
return vtype;
}
@@ -5506,10 +5537,15 @@ pos_params_pat_subst (string, pat, rep, mflags)
for ( ; params; params = params->next)
{
ret = pat_subst (params->word->word, pat, rep, mflags);
#if 0
w = make_bare_word (ret);
FREE (ret);
#else
w = alloc_word_desc ();
w->word = ret ? ret : savestring ("");
#endif
dispose_word (params->word);
params->word = w;
FREE (ret);
}
if ((mflags & (MATCH_QUOTED|MATCH_STARSUB)) == (MATCH_QUOTED|MATCH_STARSUB))
@@ -5658,7 +5694,7 @@ parameter_brace_patsub (varname, value, patsub, quoted)
/****************************************************************/
/* ${[#][!]name[[:]#[#]%[%]-=?+[word][:e1[:e2]]]} */
static char *
static WORD_DESC *
parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_dollar_at)
char *string;
int *indexp, quoted, *quoted_dollar_atp, *contains_dollar_at;
@@ -5666,7 +5702,8 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll
int check_nullness, var_is_set, var_is_null, var_is_special;
int want_substring, want_indir, want_patsub;
char *name, *value, *temp, *temp1;
int t_index, sindex, c;
WORD_DESC *tdesc, *ret;
int t_index, sindex, c, tflag;
intmax_t number;
value = (char *)NULL;
@@ -5677,6 +5714,9 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll
t_index = ++sindex;
name = string_extract (string, &t_index, "#%:-=?+/}", EX_VARNAME);
ret = 0;
tflag = 0;
/* If the name really consists of a special variable, then make sure
that we have the entire name. We don't allow indirect references
to special variables except `#', `?', `@' and `*'. */
@@ -5779,7 +5819,14 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll
free (name);
*indexp = sindex;
return ((number < 0) ? &expand_param_error : itos (number));
if (number < 0)
return (&expand_wdesc_error);
else
{
ret = alloc_word_desc ();
ret->word = itos (number);
return ret;
}
}
/* ${@} is identical to $@. */
@@ -5819,7 +5866,10 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll
free (xlist);
free (temp1);
*indexp = sindex;
return (temp);
ret = alloc_word_desc ();
ret->word = temp;
return ret;
}
#if defined (ARRAY_VARS)
@@ -5845,7 +5895,10 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll
free (temp1);
*indexp = sindex;
return (temp);
ret = alloc_word_desc ();
ret->word = temp;
return ret;
}
free (temp1);
@@ -5861,9 +5914,18 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll
}
if (want_indir)
temp = parameter_brace_expand_indir (name + 1, var_is_special, quoted, quoted_dollar_atp, contains_dollar_at);
tdesc = parameter_brace_expand_indir (name + 1, var_is_special, quoted, quoted_dollar_atp, contains_dollar_at);
else
temp = parameter_brace_expand_word (name, var_is_special, quoted);
tdesc = parameter_brace_expand_word (name, var_is_special, quoted);
if (tdesc)
{
temp = tdesc->word;
tflag = tdesc->flags;
dispose_word_desc (tdesc);
}
else
temp = (char *)0;
#if defined (ARRAY_VARS)
if (valid_array_reference (name))
@@ -5896,7 +5958,15 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll
FREE (name);
FREE (value);
FREE (temp);
return (temp1);
if (temp1 == &expand_param_error)
return (&expand_wdesc_error);
else if (temp1 == &expand_param_fatal)
return (&expand_wdesc_fatal);
ret = alloc_word_desc ();
ret->word = temp1;
return ret;
}
else if (want_patsub)
{
@@ -5904,7 +5974,15 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll
FREE (name);
FREE (value);
FREE (temp);
return (temp1);
if (temp1 == &expand_param_error)
return (&expand_wdesc_error);
else if (temp1 == &expand_param_fatal)
return (&expand_wdesc_fatal);
ret = alloc_word_desc ();
ret->word = temp1;
return ret;
}
/* Do the right thing based on which character ended the variable name. */
@@ -5917,7 +5995,7 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll
FREE (value);
FREE (temp);
free (name);
return &expand_param_error;
return &expand_wdesc_error;
case RBRACE:
if (var_is_set == 0 && unbound_vars_is_error)
@@ -5927,7 +6005,7 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll
FREE (temp);
free (name);
last_command_exit_value = EXECUTION_FAILURE;
return (interactive_shell ? &expand_param_error : &expand_param_fatal);
return (interactive_shell ? &expand_wdesc_error : &expand_wdesc_fatal);
}
break;
@@ -5966,10 +6044,12 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll
FREE (temp);
if (value)
{
temp = parameter_brace_expand_rhs (name, value, c,
quoted,
quoted_dollar_atp,
contains_dollar_at);
ret = parameter_brace_expand_rhs (name, value, c,
quoted,
quoted_dollar_atp,
contains_dollar_at);
/* XXX - fix up later, esp. noting presence of
W_HASQUOTEDNULL in ret->flags */
free (value);
}
else
@@ -5990,12 +6070,12 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll
report_error (_("$%s: cannot assign in this way"), name);
free (name);
free (value);
return &expand_param_error;
return &expand_wdesc_error;
}
else if (c == '?')
{
parameter_brace_expand_error (name, value);
return (interactive_shell ? &expand_param_error : &expand_param_fatal);
return (interactive_shell ? &expand_wdesc_error : &expand_wdesc_fatal);
}
else if (c != '+')
{
@@ -6007,9 +6087,11 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll
if (contains_dollar_at)
*contains_dollar_at = 0;
temp = parameter_brace_expand_rhs (name, value, c, quoted,
quoted_dollar_atp,
contains_dollar_at);
ret = parameter_brace_expand_rhs (name, value, c, quoted,
quoted_dollar_atp,
contains_dollar_at);
/* XXX - fix up later, esp. noting presence of
W_HASQUOTEDNULL in tdesc->flags */
}
free (value);
}
@@ -6017,13 +6099,20 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll
break;
}
free (name);
return (temp);
if (ret == 0)
{
ret = alloc_word_desc ();
ret->flags = tflag;
ret->word = temp;
}
return (ret);
}
/* Expand a single ${xxx} expansion. The braces are optional. When
the braces are used, parameter_brace_expand() does the work,
possibly calling param_expand recursively. */
static char *
static WORD_DESC *
param_expand (string, sindex, quoted, expanded_something,
contains_dollar_at, quoted_dollar_at_p, had_quoted_null_p,
pflags)
@@ -6037,11 +6126,15 @@ param_expand (string, sindex, quoted, expanded_something,
intmax_t number;
SHELL_VAR *var;
WORD_LIST *list;
WORD_DESC *tdesc, *ret;
int tflag;
zindex = *sindex;
c = string[++zindex];
temp = (char *)NULL;
ret = tdesc = (WORD_DESC *)NULL;
tflag = 0;
/* Do simple cases first. Switch on what follows '$'. */
switch (c)
@@ -6065,18 +6158,15 @@ param_expand (string, sindex, quoted, expanded_something,
uerror[2] = '\0';
err_unboundvar (uerror);
last_command_exit_value = EXECUTION_FAILURE;
return (interactive_shell ? &expand_param_error : &expand_param_fatal);
return (interactive_shell ? &expand_wdesc_error : &expand_wdesc_fatal);
}
#if 1
if (temp1)
temp = (*temp1 && (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)))
? quote_string (temp1)
: quote_escapes (temp1);
else
temp = (char *)NULL;
#else
temp = temp1 ? quote_escapes (temp1) : (char *)NULL;
#endif
break;
/* $$ -- pid of the invoking shell. */
@@ -6116,7 +6206,7 @@ param_expand (string, sindex, quoted, expanded_something,
uerror[2] = '\0';
err_unboundvar (uerror);
last_command_exit_value = EXECUTION_FAILURE;
return (interactive_shell ? &expand_param_error : &expand_param_fatal);
return (interactive_shell ? &expand_wdesc_error : &expand_wdesc_fatal);
}
}
else
@@ -6141,13 +6231,30 @@ param_expand (string, sindex, quoted, expanded_something,
null, the parameters are concatenated. */
temp = (quoted & Q_DOUBLE_QUOTES) ? string_list_dollar_star (list) : string_list (list);
temp1 = quote_string (temp);
if (*temp == 0)
tflag |= W_HASQUOTEDNULL;
free (temp);
temp = temp1;
}
else
{
/* If the $* is not quoted it is identical to $@ */
/* We check whether or not we're eventually going to split $* here,
for example when IFS is empty and we are processing the rhs of
an assignment statement. In that case, we don't separate the
arguments at all. Otherwise, if the $* is not quoted it is
identical to $@ */
#if 1
# if defined (HANDLE_MULTIBYTE)
if (expand_no_split_dollar_star && ifs_firstc[0] == 0)
# else
if (expand_no_split_dollar_star && ifs_firstc == 0)
# endif
temp = string_list_dollar_star (list);
else
temp = string_list_dollar_at (list, quoted);
#else
temp = string_list_dollar_at (list, quoted);
#endif
if (expand_no_split_dollar_star == 0 && contains_dollar_at)
*contains_dollar_at = 1;
}
@@ -6183,11 +6290,14 @@ param_expand (string, sindex, quoted, expanded_something,
break;
case LBRACE:
temp = parameter_brace_expand (string, &zindex, quoted,
quoted_dollar_at_p,
contains_dollar_at);
if (temp == &expand_param_error || temp == &expand_param_fatal)
return (temp);
tdesc = parameter_brace_expand (string, &zindex, quoted,
quoted_dollar_at_p,
contains_dollar_at);
/* Fix this later when parameter_brace_expand returns a WORD_DESC * */
if (tdesc == &expand_wdesc_error || tdesc == &expand_wdesc_fatal)
return (tdesc);
temp = tdesc ? tdesc->word : (char *)0;
/* XXX */
/* Quoted nulls should be removed if there is anything else
@@ -6197,18 +6307,24 @@ param_expand (string, sindex, quoted, expanded_something,
in the string, discard TEMP, and go on. The exception to
this is when we have "${@}" and $1 is '', since $@ needs
special handling. */
/* XXX - fix this once parameter_brace_expand returns a WORD_DESC * */
#if 0
if (temp && QUOTED_NULL (temp))
#else
if (tdesc && tdesc->word && (tdesc->flags & W_HASQUOTEDNULL) && QUOTED_NULL (temp))
#endif
{
if (had_quoted_null_p)
*had_quoted_null_p = 1;
if (*quoted_dollar_at_p == 0)
{
free (temp);
temp = (char *)NULL;
tdesc->word = temp = (char *)NULL;
}
}
ret = tdesc;
goto return0;
/* Do command or arithmetic substitution. */
@@ -6251,10 +6367,10 @@ arithsub:
if (interactive_shell == 0 && posixly_correct)
{
last_command_exit_value = EXECUTION_FAILURE;
return (&expand_param_fatal);
return (&expand_wdesc_fatal);
}
else
return (&expand_param_error);
return (&expand_wdesc_error);
}
temp = itos (number);
break;
@@ -6348,8 +6464,8 @@ unbound_variable:
free (temp1);
last_command_exit_value = EXECUTION_FAILURE;
return ((unbound_vars_is_error && interactive_shell == 0)
? &expand_param_fatal
: &expand_param_error);
? &expand_wdesc_fatal
: &expand_wdesc_error);
}
if (string[zindex])
@@ -6357,7 +6473,14 @@ unbound_variable:
return0:
*sindex = zindex;
return (temp);
if (ret == 0)
{
ret = alloc_word_desc ();
ret->flags = tflag; /* XXX */
ret->word = temp;
}
return ret;
}
/* Make a word list which is the result of parameter and variable
@@ -6607,20 +6730,27 @@ add_string:
*expanded_something = 1;
has_dollar_at = 0;
temp = param_expand (string, &sindex, quoted, expanded_something,
tword = param_expand (string, &sindex, quoted, expanded_something,
&has_dollar_at, &quoted_dollar_at,
&had_quoted_null,
(word->flags & W_NOCOMSUB) ? PF_NOCOMSUB : 0);
if (temp == &expand_param_error || temp == &expand_param_fatal)
if (tword == &expand_wdesc_error || tword == &expand_wdesc_fatal)
{
free (string);
free (istring);
return ((temp == &expand_param_error) ? &expand_word_error
: &expand_word_fatal);
return ((tword == &expand_wdesc_error) ? &expand_word_error
: &expand_word_fatal);
}
if (contains_dollar_at && has_dollar_at)
*contains_dollar_at = 1;
if (tword && (tword->flags & W_HASQUOTEDNULL))
had_quoted_null = 1;
temp = tword->word;
dispose_word_desc (tword);
goto add_string;
break;
@@ -6702,11 +6832,13 @@ add_twochars:
if (temp && *temp)
{
tword = make_word (temp); /* XXX */
free (temp);
tword = alloc_word_desc ();
tword->word = temp;
temp = (char *)NULL;
has_dollar_at = 0;
/* Need to get W_HASQUOTEDNULL flag through this function. */
list = expand_word_internal (tword, Q_DOUBLE_QUOTES, 0, &has_dollar_at, (int *)NULL);
if (list == &expand_word_error || list == &expand_word_fatal)
@@ -6742,6 +6874,9 @@ add_twochars:
if (list)
dequote_list (list);
if (list && list->word && (list->word->flags & W_HASQUOTEDNULL))
had_quoted_null = 1;
if (has_dollar_at)
{
quoted_dollar_at++;
@@ -6781,8 +6916,9 @@ add_twochars:
else
{
temp = savestring (list->word->word);
tflag = list->word->flags;
dispose_words (list);
#if 1
/* If the string is not a quoted null string, we want
to remove any embedded unquoted CTLNUL characters.
We do not want to turn quoted null strings back into
@@ -6791,15 +6927,13 @@ add_twochars:
contain other characters. For example, if we have
x"$*"y or "x$*y" and there are no positional parameters,
the $* should expand into nothing. */
/* HOWEVER, this fails if the string contains a literal
CTLNUL or CTLNUL is contained in the (non-null) expansion
of some variable. I'm not sure what to do about this
yet. There has to be some way to indicate the difference
between the two. An auxiliary data structure might be
necessary. */
if (QUOTED_NULL (temp) == 0)
/* We use the W_HASQUOTEDNULL flag to differentiate the
cases: a quoted null character as above and when
CTLNUL is contained in the (non-null) expansion
of some variable. We use the had_quoted_null flag to
pass the value through this function to its return value. */
if ((tflag & W_HASQUOTEDNULL) && QUOTED_NULL (temp) == 0)
remove_quoted_nulls (temp); /* XXX */
#endif
}
}
else
@@ -6946,6 +7080,7 @@ finished_with_string:
istring[0] = CTLNUL;
istring[1] = '\0';
tword = make_bare_word (istring);
tword->flags |= W_HASQUOTEDNULL; /* XXX */
list = make_word_list (tword, (WORD_LIST *)NULL);
if (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES))
tword->flags |= W_QUOTED;
@@ -6959,9 +7094,9 @@ finished_with_string:
else
{
tword = make_bare_word (istring);
list = make_word_list (tword, (WORD_LIST *)NULL);
if (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES))
tword->flags |= W_QUOTED;
list = make_word_list (tword, (WORD_LIST *)NULL);
}
#else
else
@@ -6971,7 +7106,6 @@ finished_with_string:
else if (word->flags & W_NOSPLIT)
{
tword = make_bare_word (istring);
list = make_word_list (tword, (WORD_LIST *)NULL);
if (word->flags & W_ASSIGNMENT)
tword->flags |= W_ASSIGNMENT; /* XXX */
if (word->flags & W_COMPASSIGN)
@@ -6982,6 +7116,9 @@ finished_with_string:
tword->flags |= W_NOEXPAND; /* XXX */
if (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES))
tword->flags |= W_QUOTED;
if (had_quoted_null)
tword->flags |= W_HASQUOTEDNULL;
list = make_word_list (tword, (WORD_LIST *)NULL);
}
else
{
@@ -7000,7 +7137,6 @@ finished_with_string:
else
{
tword = make_bare_word (istring);
list = make_word_list (tword, (WORD_LIST *)NULL);
if ((quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)) || (quoted_state == WHOLLY_QUOTED))
tword->flags |= W_QUOTED;
if (word->flags & W_ASSIGNMENT)
@@ -7011,6 +7147,9 @@ finished_with_string:
tword->flags |= W_NOGLOB;
if (word->flags & W_NOEXPAND)
tword->flags |= W_NOEXPAND;
if (had_quoted_null)
tword->flags |= W_HASQUOTEDNULL; /* XXX */
list = make_word_list (tword, (WORD_LIST *)NULL);
}
}
@@ -7098,8 +7237,8 @@ word_quote_removal (word, quoted)
char *t;
t = string_quote_removal (word->word, quoted);
w = make_bare_word (t);
free (t);
w = alloc_word_desc ();
w->word = t ? t : savestring ("");
return (w);
}
@@ -7111,12 +7250,23 @@ word_list_quote_removal (list, quoted)
WORD_LIST *list;
int quoted;
{
WORD_LIST *result, *t, *tresult;
WORD_LIST *result, *t, *tresult, *e;
for (t = list, result = (WORD_LIST *)NULL; t; t = t->next)
{
tresult = make_word_list (word_quote_removal (t->word, quoted), (WORD_LIST *)NULL);
#if 0
result = (WORD_LIST *) list_append (result, tresult);
#else
if (result == 0)
result = e = tresult;
else
{
e->next = tresult;
while (e->next)
e = e->next;
}
#endif
}
return (result);
}
+4
View File
@@ -219,4 +219,8 @@ ${THIS_SH} ./dollar-at1.sub
# $@. Bugs through bash-2.05b
${THIS_SH} ./dollar-at2.sub
# tests for various expansions of $* in different contexts -- word split,
# no splitting, etc. when $IFS is NUL
${THIS_SH} ./dollar-star2.sub
exit 0
+26
View File
@@ -0,0 +1,26 @@
set A B
IFS=
x=$*
y="$*"
recho "$x"
recho "$y"
IFS=$' \t\n'
set 'A B' 'C D'
IFS=
x=$*
y="$*"
recho "$x"
recho "$y"
recho $x
recho $*
recho $y
recho "$*"
+9
View File
@@ -125,3 +125,12 @@ argv[2] = <2>
argv[1] = <echo 1 ; echo 1>
argv[1] = <echo 1 2 ; echo 1>
argv[2] = <2>
argv[1] = <AB>
argv[1] = <AB>
argv[1] = <A BC D>
argv[1] = <A BC D>
argv[1] = <A BC D>
argv[1] = <A B>
argv[2] = <C D>
argv[1] = <A BC D>
argv[1] = <A BC D>
+40
View File
@@ -0,0 +1,40 @@
argv[1] = <xxxyyy>
argv[1] = <xxx^?yyy>
argv[1] = <xy>
argv[1] = <x^?y>
argv[1] = <-->
argv[1] = <-^?->
argv[1] = <>
argv[1] = <>
argv[1] = <^?>
argv[1] = <^?yy>
0x7f
0x7f
0x7f
argv[1] = <^?>
argv[1] = <^?@>
argv[1] = <@^?@>
argv[1] = <@^?>
argv[1] = <^?>
argv[1] = <^?@>
argv[1] = <@^?@>
argv[1] = <@^?>
argv[1] = <1>
argv[2] = <^?>
argv[3] = <^?>
argv[1] = <2>
argv[2] = <^?a>
argv[3] = <^?a>
argv[1] = <2>
argv[2] = <^?a>
argv[3] = <^?a>
argv[1] = <3>
argv[2] = <^?aa>
argv[3] = <^?aa>
argv[1] = <>
argv[1] = <-->
argv[1] = <-->
argv[1] = <^?>
argv[1] = <-^?->
argv[1] = <^?>
argv[1] = <-^?->
+102
View File
@@ -0,0 +1,102 @@
# bug in bash up to and including bash-3.0 (including patches)
#
# problem is conflict between CTLNUL used internally to denote quoted null
# characters and its value (0x7f) appearing in the expansion of a variable
#
unset x
recho "xxx${x}yyy"
y=$'\177'
recho "xxx${y}yyy"
unset y
unset undef
set ""
recho ${undef-"x$*y"}
set $'\177'
recho ${undef-"x$*y"}
shift $#
f()
{
recho "-${*-x}-"
}
f ''
f $'\177'
unset -f f
x=12345
recho "${x:6:1}"
x=
recho "${x:0:1}"
y=$'\177'
recho "${y:0:1}"
y=xxx$'\177'yyy
recho "${y:3:3}"
unset x y
eval tmp=`printf "$'\\\\\x%x'\n" 127`
printf "%#1x\n" "'$tmp"
x=$'\177'
printf "%#1x\n" "'$x"
a=127
eval c=\$\'\\$(printf '%o' $a)\'
printf "%#1x\n" "'$c"
recho "$c"
recho "$c"@
recho @"$c"@
recho @"$c"
recho "$c"
recho "$c@"
recho "@$c@"
recho "@$c"
unset tmp x a c
qtest()
{
recho ${#q} "${q}" ${q}
}
q=$'\x7f'
qtest
q=${q}a
qtest
q=$'\x7fa'
qtest
q="${q}a"
qtest
unset -f qtest
unset q
set -- ''
recho "${*:1}"
recho ${*:1}
recho -${*:1}-
recho -"${*:1}"-
set $'\177'
recho "${*:1}"
recho "-${*:1}-"
recho ${*:1}
recho -${*:1}-
+2
View File
@@ -0,0 +1,2 @@
${THIS_SH} ./iquote.tests >/tmp/xx 2>&1
diff /tmp/xx iquote.right && rm -f /tmp/xx
+10 -4
View File
@@ -1106,6 +1106,7 @@ init_seconds_var ()
/* The random number seed. You can change this by setting RANDOM. */
static unsigned long rseed = 1;
static int last_random_value;
static int seeded_subshell = 0;
/* A linear congruential random number generator based on the example
one in the ANSI C standard. This one isn't very good, but a more
@@ -1135,6 +1136,8 @@ assign_random (self, value, unused)
arrayind_t unused;
{
sbrand (strtoul (value, (char **)NULL, 10));
if (subshell_environment)
seeded_subshell = 1;
return (self);
}
@@ -1144,8 +1147,11 @@ get_random_number ()
int rv;
/* Reset for command and process substitution. */
if (subshell_environment)
sbrand (rseed + getpid() + NOW);
if (subshell_environment && seeded_subshell == 0)
{
sbrand (rseed + getpid() + NOW);
seeded_subshell = 1;
}
do
rv = brand ();
@@ -3700,7 +3706,7 @@ struct name_and_function {
};
static struct name_and_function special_vars[] = {
#if defined (READLINE) && defined (PROGRAMMABLE_COMPLETION)
#if defined (READLINE)
{ "COMP_WORDBREAKS", sv_comp_wordbreaks },
#endif
@@ -3855,7 +3861,7 @@ sv_mail (name)
}
}
#if defined (READLINE) && defined (PROGRAMMABLE_COMPLETION)
#if defined (READLINE)
void
sv_comp_wordbreaks (name)
char *name;
-4
View File
@@ -134,7 +134,6 @@ xfree (string)
#ifdef USING_BASH_MALLOC
#include <malloc/shmalloc.h>
extern char *rl_completer_word_break_characters;
PTR_T
sh_xmalloc (bytes, file, line)
size_t bytes;
@@ -155,9 +154,6 @@ sh_xmalloc (bytes, file, line)
#endif /* !HAVE_SBRK */
}
if (temp == rl_completer_word_break_characters)
itrace("xmalloc:%s:%d: reallocating rl_completer_word_break_characters");
return (temp);
}