Imported from ../bash-2.01.1.tar.gz.

This commit is contained in:
Jari Aalto 1997-09-22 20:22:27 +00:00
commit e8ce775db8
50 changed files with 2170 additions and 1502 deletions

103
CHANGES
View file

@ -1,3 +1,106 @@
This document details the changes between this version, bash-2.01.1-release,
and the previous version, bash-2.01-release.
1. Changes to Bash
a. The select command was fixed to check the validity of the user's
input more strenuously.
b. A bug was fixed that prevented `time' from timing commands correctly
when supplied as an argument to `bash -c'.
c. A fix was made to the mail checking code to keep from adding the same
mail file to the list of files to check multiple times when parsing
$MAILPATH.
d. Fixed an off-by-one error in the tilde expansion library.
e. When using the compound array assignment syntax, the old value of
the array is cleared before assigning the new value.
f. Fixed a bug that could cause a core dump when a trap handler was reset
to the default in the trap command associated with that signal.
g. Fixed a bug in the locale code that occurred when assigning a value
to LC_ALL.
h. A change was made to the parser so that words of the form xxx=(...)
are not considered compound assignment statements unless there are
characters before the `='.
i. A fix was made to the command tracing code to correctly quote each
word of output.
j. Some changes were made to the bash-specific autoconf tests to make them
more portable.
k. Completion of words with globbing characters now correctly quotes the
result.
l. The directory /var/spool/mail is now preferred to /usr/spool/mail when
configure is deciding on the default mail directory.
m. The brace completion code was fixed to not quote the `{' and `}'.
n. Some fixes were made to make $RANDOM more random in subshells.
o. System-specific changes were made to configure for: SVR4.2
p. Changes were made so that completion of words containing globbing chars
substitutes the result only if a single filename was matched.
q. The window size is now recomputed after a job is stopped with SIGTSTP if
the user has set `checkwinsize' with `shopt'.
r. When doing substring expansion, out-of-range substring specifiers now
cause nothing to be substituted rather than an expansion error.
s. A fix was made so that you can no longer trap `SIGEXIT' or `SIGDEBUG' --
only `EXIT' and `DEBUG' are accepted.
t. The display of trapped signals now uses the signal number if signals
for which bash does not know the name are trapped.
u. A fix was made so that `bash -r' does not turn on restricted mode until
after the startup files are executed.
v. A bug was fixed that occasionally caused a core dump when a variable
found in the temporary environment of export/declare/readonly had a
null value.
w. A bug that occasionally caused unallocated memory to be passed to free()
when doing arithmetic substitution was fixed.
x. A bug that caused a buffer overrun when expanding a prompt string
containing `\w' and ${#PWD} exceeded PATH_MAX was fixed.
y. A problem with the completion code that occasionally caused it to
refer to a character before the beginning of the readline line buffer
was fixed.
z. A bug was fixed so that the `read' builtin restarts reads when
interrupted by signals other than SIGINT.
aa. Fixed a bug that caused a command to be freed twice when there was
an evaluation error in the `eval' command.
2. Changes to Readline
a. Added a missing `extern' to a declaration in readline.h that kept
readline from compiling cleanly on some systems.
b. The history file is now opened with mode 0600 when it is written for
better security.
c. Changes were made to the SIGWINCH handling code so that prompt redisplay
is done better.
d. ^G now interrupts incremental searches correctly.
e. A bug that caused a core dump when the set of characters to be quoted
when completing words was empty was fixed.
------------------------------------------------------------------------------
This document details the changes between this version, bash-2.01-release, This document details the changes between this version, bash-2.01-release,
and the previous version, bash-2.01-beta2. and the previous version, bash-2.01-beta2.

35
aclocal.m4 vendored
View file

@ -197,8 +197,26 @@ fi
dnl dnl
dnl Check for sys_siglist[] or _sys_siglist[] dnl Check for sys_siglist[] or _sys_siglist[]
dnl dnl
AC_DEFUN(BASH_DECL_UNDER_SYS_SIGLIST,
[AC_MSG_CHECKING([for _sys_siglist in signal.h or unistd.h])
AC_CACHE_VAL(bash_cv_decl_under_sys_siglist,
[AC_TRY_COMPILE([
#include <sys/types.h>
#include <signal.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif], [ char *msg = _sys_siglist[2]; ],
bash_cv_decl_under_sys_siglist=yes, bash_cv_decl_under_sys_siglist=no,
AC_MSG_ERROR(cannot check for _sys_siglist[] if cross compiling))])dnl
AC_MSG_RESULT($bash_cv_decl_under_sys_siglist)
if test $bash_cv_decl_under_sys_siglist = yes; then
AC_DEFINE(UNDER_SYS_SIGLIST_DECLARED)
fi
])
AC_DEFUN(BASH_UNDER_SYS_SIGLIST, AC_DEFUN(BASH_UNDER_SYS_SIGLIST,
[AC_MSG_CHECKING([for _sys_siglist in system C library]) [AC_REQUIRE([BASH_DECL_UNDER_SYS_SIGLIST])
AC_MSG_CHECKING([for _sys_siglist in system C library])
AC_CACHE_VAL(bash_cv_under_sys_siglist, AC_CACHE_VAL(bash_cv_under_sys_siglist,
[AC_TRY_RUN([ [AC_TRY_RUN([
#include <sys/types.h> #include <sys/types.h>
@ -206,12 +224,12 @@ AC_CACHE_VAL(bash_cv_under_sys_siglist,
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif
#ifndef _sys_siglist #ifndef UNDER_SYS_SIGLIST_DECLARED
extern char *_sys_siglist[]; extern char *_sys_siglist[];
#endif #endif
main() main()
{ {
char *msg = _sys_siglist[2]; char *msg = (char *)_sys_siglist[2];
exit(msg == 0); exit(msg == 0);
}], }],
bash_cv_under_sys_siglist=yes, bash_cv_under_sys_siglist=no, bash_cv_under_sys_siglist=yes, bash_cv_under_sys_siglist=no,
@ -434,7 +452,7 @@ typedef int (*_bashfunc)();
main() main()
{ {
_bashfunc pf; _bashfunc pf;
pf = printf; pf = (_bashfunc) printf;
exit(pf == 0); exit(pf == 0);
} }
],bash_cv_printf_declared=yes, bash_cv_printf_declared=no, ],bash_cv_printf_declared=yes, bash_cv_printf_declared=no,
@ -911,7 +929,10 @@ AC_DEFUN(BASH_CHECK_GETPW_FUNCS,
AC_CACHE_VAL(bash_cv_can_redecl_getpw, AC_CACHE_VAL(bash_cv_can_redecl_getpw,
[AC_TRY_COMPILE([#include <sys/types.h> [AC_TRY_COMPILE([#include <sys/types.h>
#include <pwd.h> #include <pwd.h>
extern struct passwd *getpwent();], [struct passwd *z; z = getpwent();], extern struct passwd *getpwent();
extern struct passwd *getpwuid();
extern struct passwd *getpwnam();],
[struct passwd *z; z = getpwent(); z = getpwuid(0); z = getpwnam("root");],
bash_cv_can_redecl_getpw=yes,bash_cv_can_redecl_getpw=no)]) bash_cv_can_redecl_getpw=yes,bash_cv_can_redecl_getpw=no)])
AC_MSG_RESULT($bash_cv_can_redecl_getpw) AC_MSG_RESULT($bash_cv_can_redecl_getpw)
if test $bash_cv_can_redecl_getpw = no; then if test $bash_cv_can_redecl_getpw = no; then
@ -994,10 +1015,10 @@ AC_CACHE_VAL(bash_cv_mail_dir,
bash_cv_mail_dir=/var/mail bash_cv_mail_dir=/var/mail
elif test -d /usr/mail; then elif test -d /usr/mail; then
bash_cv_mail_dir=/usr/mail bash_cv_mail_dir=/usr/mail
elif test -d /usr/spool/mail; then
bash_cv_mail_dir=/usr/spool/mail
elif test -d /var/spool/mail; then elif test -d /var/spool/mail; then
bash_cv_mail_dir=/var/spool/mail bash_cv_mail_dir=/var/spool/mail
elif test -d /usr/spool/mail; then
bash_cv_mail_dir=/usr/spool/mail
else else
bash_cv_mail_dir=unknown bash_cv_mail_dir=unknown
fi fi

View file

@ -700,8 +700,8 @@ attempt_shell_completion (text, start, end)
/* Check that we haven't incorrectly flagged a closed command substitution /* Check that we haven't incorrectly flagged a closed command substitution
as indicating we're in a command position. */ as indicating we're in a command position. */
if (in_command_position && rl_line_buffer[ti] == '`' && *text != '`' && if (in_command_position && ti >= 0 && rl_line_buffer[ti] == '`' &&
unclosed_pair (rl_line_buffer, 0, "`") == 0) *text != '`' && unclosed_pair (rl_line_buffer, 0, "`") == 0)
in_command_position = 0; in_command_position = 0;
/* Special handling for command substitution. If *TEXT is a backquote, /* Special handling for command substitution. If *TEXT is a backquote,
@ -744,7 +744,16 @@ attempt_shell_completion (text, start, end)
/* This could be a globbing pattern, so try to expand it using pathname /* This could be a globbing pattern, so try to expand it using pathname
expansion. */ expansion. */
if (!matches && glob_pattern_p (text)) if (!matches && glob_pattern_p (text))
{
matches = completion_matches (text, glob_complete_word); matches = completion_matches (text, glob_complete_word);
/* A glob expression that matches more than one filename is problematic.
If we match more than one filename, punt. */
if (matches && matches[1])
{
free_array (matches);
matches = (char **)0;
}
}
return (matches); return (matches);
} }
@ -1801,6 +1810,7 @@ glob_complete_word (text, state)
if (state == 0) if (state == 0)
{ {
rl_filename_completion_desired = 1;
if (matches) if (matches)
free (matches); free (matches);
matches = shell_glob_filename (text); matches = shell_glob_filename (text);

View file

@ -36,6 +36,8 @@
#include "shell.h" #include "shell.h"
#include <readline/readline.h> #include <readline/readline.h>
extern char *backslash_quote ();
/* Find greatest common prefix of two strings. */ /* Find greatest common prefix of two strings. */
static int static int
string_gcd (s1, s2) string_gcd (s1, s2)
@ -61,20 +63,19 @@ really_munge_braces (array, real_start, real_end, gcd_zero)
int real_start, real_end, gcd_zero; int real_start, real_end, gcd_zero;
{ {
int start, end, gcd; int start, end, gcd;
char *result, *subterm; char *result, *subterm, *x;
int result_size, flag; int result_size, flag, tlen;
flag = 0; flag = 0;
if (real_start == real_end) if (real_start == real_end)
{ {
if (array[real_start]) x = array[real_start] ? backslash_quote (array[real_start] + gcd_zero)
return (savestring (array[real_start] + gcd_zero)); : backslash_quote (array[0]);
else return x;
return (savestring (array[0]));
} }
result = xmalloc (result_size = 1); result = xmalloc (result_size = 16);
*result = '\0'; *result = '\0';
for (start = real_start; start < real_end; start = end + 1) for (start = real_start; start < real_end; start = end + 1)
@ -103,15 +104,29 @@ really_munge_braces (array, real_start, real_end, gcd_zero)
flag++; flag++;
} }
/* Make sure we backslash quote every substring we insert into the
resultant brace expression. This is so the default filename
quoting function won't inappropriately quote the braces. */
if (start == end) if (start == end)
subterm = savestring (array[start] + gcd_zero); {
x = savestring (array[start] + gcd_zero);
subterm = backslash_quote (x);
free (x);
}
else else
{ {
/* If there is more than one element in the subarray, /* If there is more than one element in the subarray,
insert the prefix and an opening brace. */ insert the (quoted) prefix and an opening brace. */
result_size += gcd - gcd_zero + 1; tlen = gcd - gcd_zero;
x = xmalloc (tlen + 1);
strncpy (x, array[start] + gcd_zero, tlen);
x[tlen] = '\0';
subterm = backslash_quote (x);
free (x);
result_size += strlen (subterm) + 1;
result = xrealloc (result, result_size); result = xrealloc (result, result_size);
strncat (result, array[start] + gcd_zero, gcd - gcd_zero); strcat (result, subterm);
free (subterm);
strcat (result, "{"); strcat (result, "{");
subterm = really_munge_braces (array, start, end + 1, gcd); subterm = really_munge_braces (array, start, end + 1, gcd);
subterm[strlen (subterm) - 1] = '}'; subterm[strlen (subterm) - 1] = '}';
@ -146,25 +161,35 @@ hack_braces_completion (names)
names[0] = temp; names[0] = temp;
} }
/* We handle quoting ourselves within hack_braces_completion, so we turn off
rl_filename_quoting_desired and rl_filename_quoting_function. */
void void
bash_brace_completion () bash_brace_completion ()
{ {
Function *orig_ignore_func; Function *orig_ignore_func;
Function *orig_entry_func; Function *orig_entry_func;
CPFunction *orig_quoting_func;
CPPFunction *orig_attempt_func; CPPFunction *orig_attempt_func;
int orig_quoting_desired;
orig_ignore_func = rl_ignore_some_completions_function; orig_ignore_func = rl_ignore_some_completions_function;
orig_attempt_func = rl_attempted_completion_function; orig_attempt_func = rl_attempted_completion_function;
orig_entry_func = rl_completion_entry_function; orig_entry_func = rl_completion_entry_function;
orig_quoting_func = rl_filename_quoting_function;
orig_quoting_desired = rl_filename_quoting_desired;
rl_completion_entry_function = (Function *) filename_completion_function; rl_completion_entry_function = (Function *) filename_completion_function;
rl_attempted_completion_function = NULL; rl_attempted_completion_function = NULL;
rl_ignore_some_completions_function = (Function *) hack_braces_completion; rl_ignore_some_completions_function = (Function *) hack_braces_completion;
rl_filename_quoting_function = NULL;
rl_filename_quoting_desired = 0;
rl_complete_internal (TAB); rl_complete_internal (TAB);
rl_ignore_some_completions_function = orig_ignore_func; rl_ignore_some_completions_function = orig_ignore_func;
rl_attempted_completion_function = orig_attempt_func; rl_attempted_completion_function = orig_attempt_func;
rl_completion_entry_function = orig_entry_func; rl_completion_entry_function = orig_entry_func;
rl_filename_quoting_function = orig_quoting_func;
rl_filename_quoting_desired = orig_quoting_desired;
} }
#endif /* BRACE_EXPANSION && READLINE */ #endif /* BRACE_EXPANSION && READLINE */

View file

@ -97,8 +97,11 @@ mkbuiltins: $(srcdir)/mkbuiltins.c ../config.h
common.o: common.c common.o: common.c
bashgetopt.o: bashgetopt.c bashgetopt.o: bashgetopt.c
getopt.o: getopt.c getopt.o: getopt.c
evalstring.o: evalstring.c
evalfile.o: evalfile.c
ulimit.o: ulimit.def pipesize.h ulimit.o: ulimit.def
ulimit.o: pipesize.h
pipesize.h: psize.aux pipesize.h: psize.aux
$(SHELL) $(srcdir)/psize.sh > pipesize.h $(SHELL) $(srcdir)/psize.sh > pipesize.h
@ -149,6 +152,7 @@ return.o: return.def
set.o: set.def set.o: set.def
setattr.o: setattr.def setattr.o: setattr.def
shift.o: shift.def shift.o: shift.def
shopt.o: shopt.def
source.o: source.def source.o: source.def
suspend.o: suspend.def suspend.o: suspend.def
test.o: test.def test.o: test.def

View file

@ -369,8 +369,10 @@ declare_internal (list, local_var)
assign_array_var_from_string (var, value); assign_array_var_from_string (var, value);
else else
#endif #endif
/* This essentially duplicates the internals of bind_variable() */
if (offset) if (offset)
{ {
var->attributes &= ~att_invisible;
t = make_variable_value (var, value); t = make_variable_value (var, value);
FREE (var->value); FREE (var->value);
var->value = t; var->value = t;

View file

@ -160,7 +160,9 @@ parse_and_execute (string, from_file, flags)
} }
else else
{ {
dispose_command (command); /* XXX */ #if 0
dispose_command (command); /* pe_dispose does this */
#endif
continue; continue;
} }
@ -192,7 +194,8 @@ parse_and_execute (string, from_file, flags)
#if defined (ONESHOT) #if defined (ONESHOT)
if (startup_state == 2 && *bash_input.location.string == '\0' && if (startup_state == 2 && *bash_input.location.string == '\0' &&
command->type == cm_simple && !command->redirects && command->type == cm_simple && !command->redirects &&
!command->value.Simple->redirects) !command->value.Simple->redirects &&
((command->flags & CMD_TIME_PIPELINE) == 0))
{ {
command->flags |= CMD_NO_FORK; command->flags |= CMD_NO_FORK;
command->value.Simple->flags |= CMD_NO_FORK; command->value.Simple->flags |= CMD_NO_FORK;

View file

@ -46,6 +46,8 @@ $END
# include <unistd.h> # include <unistd.h>
#endif #endif
#include <errno.h>
#include "../shell.h" #include "../shell.h"
#include "common.h" #include "common.h"
#include "bashgetopt.h" #include "bashgetopt.h"
@ -55,6 +57,10 @@ $END
#include <readline/readline.h> #include <readline/readline.h>
#endif #endif
#if !defined(errno)
extern int errno;
#endif
#define issep(c) (strchr (ifs_chars, (c))) #define issep(c) (strchr (ifs_chars, (c)))
extern int interrupt_immediately; extern int interrupt_immediately;
@ -181,7 +187,10 @@ read_builtin (list)
} }
else else
#endif #endif
if (read (0, &c, 1) != 1)
while (((retval = read (0, &c, 1)) < 0) && errno == EINTR)
;
if (retval <= 0)
{ {
eof = 1; eof = 1;
break; break;

View file

@ -326,7 +326,7 @@ show_var_attributes (var, pattr, nodefs)
printf ("%s\n", named_function_string (var->name, function_cell (var), 1)); printf ("%s\n", named_function_string (var->name, function_cell (var), 1));
else else
{ {
x = double_quote (value_cell (var)); x = double_quote (value_cell (var) ? value_cell (var) : "");
printf ("%s=%s\n", var->name, x); printf ("%s=%s\n", var->name, x);
free (x); free (x);
} }
@ -366,7 +366,7 @@ set_var_attribute (name, attribute, undo)
{ {
if (tv = find_tempenv_variable (name)) if (tv = find_tempenv_variable (name))
{ {
var = bind_variable (tv->name, tv->value); var = bind_variable (tv->name, tv->value ? tv->value : "");
dispose_variable (tv); dispose_variable (tv);
} }
else else

View file

@ -191,7 +191,7 @@ static void
showtrap (i) showtrap (i)
int i; int i;
{ {
char *t, *p; char *t, *p, *sn;
p = trap_list[i]; p = trap_list[i];
@ -199,9 +199,15 @@ showtrap (i)
return; return;
t = (p == (char *)IGNORE_SIG) ? (char *)NULL : single_quote (p); t = (p == (char *)IGNORE_SIG) ? (char *)NULL : single_quote (p);
printf ("trap -- %s %s\n", t ? t : "''", signal_name (i)); sn = signal_name (i);
if (t) /* Make sure that signals whose names are unknown (for whatever reason)
free (t); are printed as signal numbers. */
if (STREQN (sn, "SIGJUNK", 7) || STREQN (sn, "unknown", 7))
printf ("trap -- %s %d\n", t ? t : "''", i);
else
printf ("trap -- %s %s\n", t ? t : "''", sn);
FREE (t);
} }
static int static int

View file

@ -215,6 +215,9 @@
/* Define if `sys_siglist' is declared by <signal.h>. */ /* Define if `sys_siglist' is declared by <signal.h>. */
#undef SYS_SIGLIST_DECLARED #undef SYS_SIGLIST_DECLARED
/* Define if `_sys_siglist' is declared by <signal.h> or <unistd.h>. */
#undef UNDER_SYS_SIGLIST_DECLARED
/* Define to `int' if <sys/types.h> doesn't define. */ /* Define to `int' if <sys/types.h> doesn't define. */
#undef uid_t #undef uid_t
@ -515,4 +518,3 @@
#include "config.h.bot" #include "config.h.bot"
#endif /* _CONFIG_H_ */ #endif /* _CONFIG_H_ */

656
configure vendored

File diff suppressed because it is too large Load diff

View file

@ -6,7 +6,7 @@ dnl
dnl Process this file with autoconf to produce a configure script. dnl Process this file with autoconf to produce a configure script.
dnl checks for version info dnl checks for version info
AC_REVISION([for Bash 2.01, version 1.26, from autoconf version] AC_ACVERSION)dnl AC_REVISION([for Bash 2.01, version 1.28, from autoconf version] AC_ACVERSION)dnl
AC_INIT(shell.h) AC_INIT(shell.h)
AC_CONFIG_HEADER(config.h) AC_CONFIG_HEADER(config.h)
@ -38,7 +38,7 @@ alpha-*) opt_gnu_malloc=no ;; # alpha running osf/1 or linux
*-osf1*) opt_gnu_malloc=no ;; # other osf/1 machines *-osf1*) opt_gnu_malloc=no ;; # other osf/1 machines
sparc-svr4*) opt_gnu_malloc=no ;; # sparc SVR4, SVR4.2 sparc-svr4*) opt_gnu_malloc=no ;; # sparc SVR4, SVR4.2
sparc-netbsd*) opt_gnu_malloc=no ;; # needs 8-byte alignment sparc-netbsd*) opt_gnu_malloc=no ;; # needs 8-byte alignment
*-sgi-irix6*) opt_gnu_malloc=no ;; # needs 8-byte alignment sgi-irix6*) opt_gnu_malloc=no ;; # needs 8-byte alignment
sparc-linux*) opt_gnu_malloc=no ;; # sparc running linux; requires ELF sparc-linux*) opt_gnu_malloc=no ;; # sparc running linux; requires ELF
*-freebsd*) opt_gnu_malloc=no ;; # they claim it's better *-freebsd*) opt_gnu_malloc=no ;; # they claim it's better
*-aix*) opt_gnu_malloc=no ;; # AIX machines *-aix*) opt_gnu_malloc=no ;; # AIX machines
@ -46,7 +46,7 @@ sparc-linux*) opt_gnu_malloc=no ;; # sparc running linux; requires ELF
*-dgux*) opt_gnu_malloc=no ;; # DG/UX machines *-dgux*) opt_gnu_malloc=no ;; # DG/UX machines
*-qnx*) opt_gnu_malloc=no ;; # QNX 4.2 *-qnx*) opt_gnu_malloc=no ;; # QNX 4.2
*-machten4) opt_gnu_malloc=no ;; # MachTen 4.x *-machten4) opt_gnu_malloc=no ;; # MachTen 4.x
*-bsdi2.1) opt_gnu_malloc=no ; : ${CC:=shlicc2} ;; # for loadable builtins *-bsdi2.1|*-bsdi3.0) opt_gnu_malloc=no ; : ${CC:=shlicc2} ;; # for loadable builtins
esac esac
dnl arguments to configure dnl arguments to configure
@ -456,7 +456,7 @@ dnl
dnl this should really go away someday dnl this should really go away someday
case "$host_os" in case "$host_os" in
sysv4.2) AC_DEFINE(SVR4_2) sysv4.2*) AC_DEFINE(SVR4_2)
AC_DEFINE(SVR4) ;; AC_DEFINE(SVR4) ;;
sysv4*) AC_DEFINE(SVR4) ;; sysv4*) AC_DEFINE(SVR4) ;;
hpux*) LOCAL_CFLAGS=-DHPUX ;; hpux*) LOCAL_CFLAGS=-DHPUX ;;

View file

@ -142,7 +142,8 @@ maintainer-clean: clean
installdirs: installdirs:
-test -d $(man1dir) || $(SHELL) ${MKDIRS} $(man1dir) -test -d $(man1dir) || $(SHELL) ${MKDIRS} $(man1dir)
-test -d $(man3dir) || $(SHELL) ${MKDIRS} $(man3dir) # uncomment the next line to create the directory for the readline man page
# -test -d $(man3dir) || $(SHELL) ${MKDIRS} $(man3dir)
-test -d $(infodir) || $(SHELL) ${MKDIRS} $(infodir) -test -d $(infodir) || $(SHELL) ${MKDIRS} $(infodir)
install: info installdirs install: info installdirs

View file

@ -1,5 +1,10 @@
This is Info file bashref.info, produced by Makeinfo-1.64 from the This is Info file bashref.info, produced by Makeinfo version 1.67 from
input file ./bashref.texi. the input file /usr/homes/chet/src/bash/bash-2.01.1/doc/bashref.texi.
INFO-DIR-SECTION Utilities
START-INFO-DIR-ENTRY
* Bash: (bash). GNU Bourne-Again SHell
END-INFO-DIR-ENTRY
This text is a brief description of the features that are present in This text is a brief description of the features that are present in
the Bash shell. the Bash shell.
@ -2412,7 +2417,7 @@ the `alias' and `unalias' builtin commands.
has an alias. If so, that word is replaced by the text of the alias. has an alias. If so, that word is replaced by the text of the alias.
The alias name and the replacement text may contain any valid shell The alias name and the replacement text may contain any valid shell
input, including shell metacharacters, with the exception that the input, including shell metacharacters, with the exception that the
alias name may not contain =. The first word of the replacement text alias name may not contain <=>. The first word of the replacement text
is tested for aliases, but a word that is identical to an alias being is tested for aliases, but a word that is identical to an alias being
expanded is not expanded a second time. This means that one may alias expanded is not expanded a second time. This means that one may alias
`ls' to `"ls -F"', for instance, and Bash does not try to recursively `ls' to `"ls -F"', for instance, and Bash does not try to recursively
@ -4464,7 +4469,7 @@ history list.
`!' `!'
Start a history substitution, except when followed by a space, tab, Start a history substitution, except when followed by a space, tab,
the end of the line, = or (. the end of the line, <=> or <(>.
`!N' `!N'
Refer to command line N. Refer to command line N.
@ -4610,21 +4615,22 @@ Introduction to Line Editing
The following paragraphs describe the notation used to represent The following paragraphs describe the notation used to represent
keystrokes. keystrokes.
The text C-k is read as `Control-K' and describes the character The text <C-k> is read as `Control-K' and describes the character
produced when the k key is pressed while the Control key is depressed. produced when the <k> key is pressed while the Control key is depressed.
The text M-k is read as `Meta-K' and describes the character The text <M-k> is read as `Meta-K' and describes the character
produced when the meta key (if you have one) is depressed, and the k produced when the meta key (if you have one) is depressed, and the <k>
key is pressed. If you do not have a meta key, the identical keystroke key is pressed. If you do not have a meta key, the identical keystroke
can be generated by typing ESC first, and then typing k. Either can be generated by typing <ESC> first, and then typing <k>. Either
process is known as "metafying" the k key. process is known as "metafying" the <k> key.
The text M-C-k is read as `Meta-Control-k' and describes the The text <M-C-k> is read as `Meta-Control-k' and describes the
character produced by "metafying" C-k. character produced by "metafying" <C-k>.
In addition, several keys have their own names. Specifically, DEL, In addition, several keys have their own names. Specifically,
ESC, LFD, SPC, RET, and TAB all stand for themselves when seen in this <DEL>, <ESC>, <LFD>, <SPC>, <RET>, and <TAB> all stand for themselves
text, or in an init file (*note Readline Init File::.). when seen in this text, or in an init file (*note Readline Init
File::.).
 
File: bashref.info, Node: Readline Interaction, Next: Readline Init File, Prev: Introduction and Notation, Up: Command Line Editing File: bashref.info, Node: Readline Interaction, Next: Readline Init File, Prev: Introduction and Notation, Up: Command Line Editing
@ -4639,9 +4645,9 @@ as you type it in, allowing you to just fix your typo, and not forcing
you to retype the majority of the line. Using these editing commands, you to retype the majority of the line. Using these editing commands,
you move the cursor to the place that needs correction, and delete or you move the cursor to the place that needs correction, and delete or
insert the text of the corrections. Then, when you are satisfied with insert the text of the corrections. Then, when you are satisfied with
the line, you simply press RETURN. You do not have to be at the end of the line, you simply press <RETURN>. You do not have to be at the end
the line to press RETURN; the entire line is accepted regardless of the of the line to press <RETURN>; the entire line is accepted regardless
location of the cursor within the line. of the location of the cursor within the line.
* Menu: * Menu:
@ -4664,9 +4670,9 @@ erase character to back up and delete the mistyped character.
Sometimes you may miss typing a character that you wanted to type, Sometimes you may miss typing a character that you wanted to type,
and not notice your error until you have typed several other and not notice your error until you have typed several other
characters. In that case, you can type C-b to move the cursor to the characters. In that case, you can type <C-b> to move the cursor to the
left, and then correct your mistake. Afterwards, you can move the left, and then correct your mistake. Afterwards, you can move the
cursor to the right with C-f. cursor to the right with <C-f>.
When you add text in the middle of a line, you will notice that When you add text in the middle of a line, you will notice that
characters to the right of the cursor are `pushed over' to make room characters to the right of the cursor are `pushed over' to make room
@ -4676,22 +4682,22 @@ back' to fill in the blank space created by the removal of the text. A
list of the basic bare essentials for editing the text of an input line list of the basic bare essentials for editing the text of an input line
follows. follows.
C-b <C-b>
Move back one character. Move back one character.
C-f <C-f>
Move forward one character. Move forward one character.
DEL <DEL>
Delete the character to the left of the cursor. Delete the character to the left of the cursor.
C-d <C-d>
Delete the character underneath the cursor. Delete the character underneath the cursor.
Printing characters Printing characters
Insert the character into the line at the cursor. Insert the character into the line at the cursor.
C-_ <C-_>
Undo the last thing that you did. You can undo all the way back Undo the last thing that you did. You can undo all the way back
to an empty line. to an empty line.
@ -4703,28 +4709,28 @@ Readline Movement Commands
The above table describes the most basic possible keystrokes that The above table describes the most basic possible keystrokes that
you need in order to do editing of the input line. For your you need in order to do editing of the input line. For your
convenience, many other commands have been added in addition to C-b, convenience, many other commands have been added in addition to <C-b>,
C-f, C-d, and DEL. Here are some commands for moving more rapidly <C-f>, <C-d>, and <DEL>. Here are some commands for moving more rapidly
about the line. about the line.
C-a <C-a>
Move to the start of the line. Move to the start of the line.
C-e <C-e>
Move to the end of the line. Move to the end of the line.
M-f <M-f>
Move forward a word. Move forward a word.
M-b <M-b>
Move backward a word. Move backward a word.
C-l <C-l>
Clear the screen, reprinting the current line at the top. Clear the screen, reprinting the current line at the top.
Notice how C-f moves forward a character, while M-f moves forward a Notice how <C-f> moves forward a character, while <M-f> moves
word. It is a loose convention that control keystrokes operate on forward a word. It is a loose convention that control keystrokes
characters while meta keystrokes operate on words. operate on characters while meta keystrokes operate on words.
 
File: bashref.info, Node: Readline Killing Commands, Next: Readline Arguments, Prev: Readline Movement Commands, Up: Readline Interaction File: bashref.info, Node: Readline Killing Commands, Next: Readline Arguments, Prev: Readline Movement Commands, Up: Readline Interaction
@ -4746,32 +4752,32 @@ available to be yanked back later, when you are typing another line.
Here is the list of commands for killing text. Here is the list of commands for killing text.
C-k <C-k>
Kill the text from the current cursor position to the end of the Kill the text from the current cursor position to the end of the
line. line.
M-d <M-d>
Kill from the cursor to the end of the current word, or if between Kill from the cursor to the end of the current word, or if between
words, to the end of the next word. words, to the end of the next word.
M-DEL <M-DEL>
Kill from the cursor the start of the previous word, or if between Kill from the cursor the start of the previous word, or if between
words, to the start of the previous word. words, to the start of the previous word.
C-w <C-w>
Kill from the cursor to the previous whitespace. This is Kill from the cursor to the previous whitespace. This is
different than M-DEL because the word boundaries differ. different than <M-DEL> because the word boundaries differ.
And, here is how to "yank" the text back into the line. Yanking And, here is how to "yank" the text back into the line. Yanking
means to copy the most-recently-killed text from the kill buffer. means to copy the most-recently-killed text from the kill buffer.
C-y <C-y>
Yank the most recently killed text back into the buffer at the Yank the most recently killed text back into the buffer at the
cursor. cursor.
M-y <M-y>
Rotate the kill-ring, and yank the new top. You can only do this Rotate the kill-ring, and yank the new top. You can only do this
if the prior command is C-y or M-y. if the prior command is <C-y> or <M-y>.
 
File: bashref.info, Node: Readline Arguments, Next: Searching, Prev: Readline Killing Commands, Up: Readline Interaction File: bashref.info, Node: Readline Arguments, Next: Searching, Prev: Readline Killing Commands, Up: Readline Interaction
@ -4788,10 +4794,10 @@ start of the line, you might type `M-- C-k'.
The general way to pass numeric arguments to a command is to type The general way to pass numeric arguments to a command is to type
meta digits before the command. If the first `digit' you type is a meta digits before the command. If the first `digit' you type is a
minus sign (-), then the sign of the argument will be negative. Once minus sign (<->), then the sign of the argument will be negative. Once
you have typed one meta digit to get the argument started, you can type you have typed one meta digit to get the argument started, you can type
the remainder of the digits, and then the command. For example, to give the remainder of the digits, and then the command. For example, to give
the C-d command an argument of 10, you could type `M-1 0 C-d'. the <C-d> command an argument of 10, you could type `M-1 0 C-d'.
 
File: bashref.info, Node: Searching, Prev: Readline Arguments, Up: Readline Interaction File: bashref.info, Node: Searching, Prev: Readline Arguments, Up: Readline Interaction
@ -4897,7 +4903,7 @@ Variable Settings
`convert-meta' `convert-meta'
If set to `on', Readline will convert characters with the If set to `on', Readline will convert characters with the
eigth bit set to an ASCII key sequence by stripping the eigth eigth bit set to an ASCII key sequence by stripping the eigth
bit and prepending an ESC character, converting them to a bit and prepending an <ESC> character, converting them to a
meta-prefixed key sequence. The default value is `on'. meta-prefixed key sequence. The default value is `on'.
`disable-completion' `disable-completion'
@ -5011,23 +5017,23 @@ Key Bindings
The following escape sequences are available when specifying The following escape sequences are available when specifying
key sequences: key sequences:
``\C-'' `\C-'
control prefix control prefix
``\M-'' `\M-'
meta prefix meta prefix
``\e'' `\e'
an escape character an escape character
``\\'' `\\'
backslash backslash
``\"'' `\"'
" <">
``\''' `\''
' <'>
When entering the text of a macro, single or double quotes When entering the text of a macro, single or double quotes
should be used to indicate a macro definition. Unquoted text should be used to indicate a macro definition. Unquoted text
@ -5331,7 +5337,7 @@ Commands For Changing Text
`quoted-insert (C-q, C-v)' `quoted-insert (C-q, C-v)'
Add the next character that you type to the line verbatim. This is Add the next character that you type to the line verbatim. This is
how to insert key sequences like C-q, for example. how to insert key sequences like <C-q>, for example.
`tab-insert (M-TAB)' `tab-insert (M-TAB)'
Insert a tab character. Insert a tab character.
@ -5432,7 +5438,7 @@ Specifying Numeric Arguments
`digit-argument (M-0, M-1, ... M--)' `digit-argument (M-0, M-1, ... M--)'
Add this digit to the argument already accumulating, or start a new Add this digit to the argument already accumulating, or start a new
argument. M- starts a negative argument. argument. <M-> starts a negative argument.
`universal-argument ()' `universal-argument ()'
This is another way to specify an argument. If this command is This is another way to specify an argument. If this command is
@ -5672,7 +5678,7 @@ modes, use the `set -o emacs' and `set -o vi' commands (*note The Set
Builtin::.). The Readline default is `emacs' mode. Builtin::.). The Readline default is `emacs' mode.
When you enter a line in `vi' mode, you are already placed in When you enter a line in `vi' mode, you are already placed in
`insertion' mode, as if you had typed an `i'. Pressing ESC switches `insertion' mode, as if you had typed an `i'. Pressing <ESC> switches
you into `command' mode, where you can edit the text of the line with you into `command' mode, where you can edit the text of the line with
the standard `vi' movement keys, move to previous history lines with the standard `vi' movement keys, move to previous history lines with
`k' and subsequent lines with `j', and so forth. `k' and subsequent lines with `j', and so forth.
@ -6146,8 +6152,6 @@ Shell Reserved Words
* Menu: * Menu:
* !: Pipelines. * !: Pipelines.
* {: Command Grouping.
* }: Command Grouping.
* case: Conditional Constructs. * case: Conditional Constructs.
* do: Looping Constructs. * do: Looping Constructs.
* done: Looping Constructs. * done: Looping Constructs.
@ -6164,6 +6168,8 @@ Shell Reserved Words
* time: Pipelines. * time: Pipelines.
* until: Looping Constructs. * until: Looping Constructs.
* while: Looping Constructs. * while: Looping Constructs.
* {: Command Grouping.
* }: Command Grouping.
 
File: bashref.info, Node: Variable Index, Next: Function Index, Prev: Reserved Word Index, Up: Top File: bashref.info, Node: Variable Index, Next: Function Index, Prev: Reserved Word Index, Up: Top
@ -6285,7 +6291,7 @@ Function Index
* copy-region-as-kill (): Commands For Killing. * copy-region-as-kill (): Commands For Killing.
* delete-char (C-d): Commands For Text. * delete-char (C-d): Commands For Text.
* delete-horizontal-space (): Commands For Killing. * delete-horizontal-space (): Commands For Killing.
* digit-argument (M-0, M-1, ... M-): Numeric Arguments. * digit-argument (M-0, M-1, ... M--): Numeric Arguments.
* do-uppercase-version (M-a, M-b, M-X, ...): Miscellaneous Commands. * do-uppercase-version (M-a, M-b, M-X, ...): Miscellaneous Commands.
* downcase-word (M-l): Commands For Text. * downcase-word (M-l): Commands For Text.
* dump-functions (): Miscellaneous Commands. * dump-functions (): Miscellaneous Commands.
@ -6445,123 +6451,123 @@ Concept Index
 
Tag Table: Tag Table:
Node: Top1005 Node: Top1179
Node: Introduction3109 Node: Introduction3283
Node: What is Bash?3334 Node: What is Bash?3508
Node: What is a shell?4418 Node: What is a shell?4592
Node: Definitions6299 Node: Definitions6473
Node: Basic Shell Features8960 Node: Basic Shell Features9134
Node: Shell Syntax10481 Node: Shell Syntax10655
Node: Shell Operation10771 Node: Shell Operation10945
Node: Quoting12005 Node: Quoting12179
Node: Escape Character13040 Node: Escape Character13214
Node: Single Quotes13471 Node: Single Quotes13645
Node: Double Quotes13800 Node: Double Quotes13974
Node: ANSI-C Quoting14496 Node: ANSI-C Quoting14670
Node: Locale Translation15228 Node: Locale Translation15402
Node: Comments15649 Node: Comments15823
Node: Simple Commands16173 Node: Simple Commands16347
Node: Pipelines16762 Node: Pipelines16936
Node: Lists17833 Node: Lists18007
Node: Looping Constructs19108 Node: Looping Constructs19282
Node: Conditional Constructs20285 Node: Conditional Constructs20459
Node: Command Grouping22352 Node: Command Grouping22526
Node: Shell Functions23738 Node: Shell Functions23912
Node: Shell Parameters25511 Node: Shell Parameters25685
Node: Positional Parameters26834 Node: Positional Parameters27008
Node: Special Parameters27528 Node: Special Parameters27702
Node: Shell Expansions30094 Node: Shell Expansions30268
Node: Shell Parameter Expansion32098 Node: Shell Parameter Expansion32272
Node: Command Substitution38106 Node: Command Substitution38280
Node: Process Substitution39106 Node: Process Substitution39280
Node: Word Splitting40012 Node: Word Splitting40186
Node: Filename Expansion41464 Node: Filename Expansion41638
Node: Quote Removal43830 Node: Quote Removal44004
Node: Redirections44116 Node: Redirections44290
Node: Executing Commands49857 Node: Executing Commands50031
Node: Command Search and Execution50312 Node: Command Search and Execution50486
Node: Environment52046 Node: Environment52220
Node: Exit Status53682 Node: Exit Status53856
Node: Signals54699 Node: Signals54873
Node: Shell Scripts55910 Node: Shell Scripts56084
Node: Bourne Shell Features57779 Node: Bourne Shell Features57953
Node: Bourne Shell Builtins58449 Node: Bourne Shell Builtins58623
Node: Bourne Shell Variables66803 Node: Bourne Shell Variables66977
Node: Other Bourne Shell Features68340 Node: Other Bourne Shell Features68514
Node: Major Differences From The Bourne Shell69097 Node: Major Differences From The Bourne Shell69271
Node: Csh Features79457 Node: Csh Features79631
Node: Brace Expansion80375 Node: Brace Expansion80549
Node: Tilde Expansion81930 Node: Tilde Expansion82104
Node: C Shell Builtins82562 Node: C Shell Builtins82736
Node: C Shell Variables87118 Node: C Shell Variables87292
Node: Korn Shell Features87526 Node: Korn Shell Features87700
Node: Korn Shell Constructs88254 Node: Korn Shell Constructs88428
Node: Korn Shell Builtins89969 Node: Korn Shell Builtins90143
Node: Korn Shell Variables92127 Node: Korn Shell Variables92301
Node: Aliases93686 Node: Aliases93860
Node: Alias Builtins96150 Node: Alias Builtins96326
Node: Bash Features96766 Node: Bash Features96942
Node: Invoking Bash97757 Node: Invoking Bash97933
Node: Bash Startup Files101622 Node: Bash Startup Files101798
Node: Is This Shell Interactive?105197 Node: Is This Shell Interactive?105373
Node: Bash Builtins106180 Node: Bash Builtins106356
Node: The Set Builtin122035 Node: The Set Builtin122211
Node: Bash Conditional Expressions127410 Node: Bash Conditional Expressions127586
Node: Bash Variables132061 Node: Bash Variables132237
Node: Shell Arithmetic142095 Node: Shell Arithmetic142271
Node: Arithmetic Evaluation142563 Node: Arithmetic Evaluation142739
Node: Arithmetic Expansion144593 Node: Arithmetic Expansion144769
Node: Arithmetic Builtins145397 Node: Arithmetic Builtins145573
Node: Arrays145868 Node: Arrays146044
Node: Printing a Prompt148895 Node: Printing a Prompt149071
Node: The Restricted Shell150493 Node: The Restricted Shell150669
Node: Bash POSIX Mode151723 Node: Bash POSIX Mode151899
Node: Job Control155407 Node: Job Control155583
Node: Job Control Basics155872 Node: Job Control Basics156048
Node: Job Control Builtins160015 Node: Job Control Builtins160191
Node: Job Control Variables162938 Node: Job Control Variables163114
Node: Using History Interactively164085 Node: Using History Interactively164261
Node: Bash History Facilities164674 Node: Bash History Facilities164850
Node: History Interaction167072 Node: History Interaction167248
Node: Event Designators169634 Node: Event Designators169810
Node: Word Designators170557 Node: Word Designators170737
Node: Modifiers171806 Node: Modifiers171986
Node: Command Line Editing173123 Node: Command Line Editing173303
Node: Introduction and Notation173783 Node: Introduction and Notation173963
Node: Readline Interaction174791 Node: Readline Interaction175001
Node: Readline Bare Essentials175979 Node: Readline Bare Essentials176193
Node: Readline Movement Commands177508 Node: Readline Movement Commands177736
Node: Readline Killing Commands178398 Node: Readline Killing Commands178648
Node: Readline Arguments180100 Node: Readline Arguments180368
Node: Searching181073 Node: Searching181345
Node: Readline Init File182709 Node: Readline Init File182981
Node: Readline Init File Syntax183765 Node: Readline Init File Syntax184037
Node: Conditional Init Constructs191554 Node: Conditional Init Constructs191820
Node: Sample Init File193835 Node: Sample Init File194101
Node: Bindable Readline Commands196868 Node: Bindable Readline Commands197134
Node: Commands For Moving197618 Node: Commands For Moving197884
Node: Commands For History198465 Node: Commands For History198731
Node: Commands For Text201138 Node: Commands For Text201404
Node: Commands For Killing202880 Node: Commands For Killing203148
Node: Numeric Arguments204906 Node: Numeric Arguments205174
Node: Commands For Completion206030 Node: Commands For Completion206300
Node: Keyboard Macros208992 Node: Keyboard Macros209262
Node: Miscellaneous Commands209550 Node: Miscellaneous Commands209820
Node: Readline vi Mode213766 Node: Readline vi Mode214036
Node: Installing Bash214642 Node: Installing Bash214914
Node: Basic Installation215711 Node: Basic Installation215983
Node: Compilers and Options218636 Node: Compilers and Options218908
Node: Compiling For Multiple Architectures219370 Node: Compiling For Multiple Architectures219642
Node: Installation Names221027 Node: Installation Names221299
Node: Specifying the System Type221749 Node: Specifying the System Type222021
Node: Sharing Defaults222460 Node: Sharing Defaults222732
Node: Operation Controls223125 Node: Operation Controls223397
Node: Optional Features224030 Node: Optional Features224302
Node: Reporting Bugs228913 Node: Reporting Bugs229185
Node: Builtin Index229993 Node: Builtin Index230265
Node: Reserved Word Index233406 Node: Reserved Word Index233732
Node: Variable Index234714 Node: Variable Index235059
Node: Function Index239899 Node: Function Index240327
Node: Concept Index244257 Node: Concept Index244750
 
End Tag Table End Tag Table

View file

@ -22,6 +22,11 @@ last change: Mon May 19 12:55:22 EDT 1997
@defcodeindex rw @defcodeindex rw
@set BashFeatures @set BashFeatures
@dircategory Utilities
@direntry
* Bash: (bash). GNU Bourne-Again SHell
@end direntry
@ifinfo @ifinfo
@format @format
This text is a brief description of the features that are present in This text is a brief description of the features that are present in

File diff suppressed because it is too large Load diff

View file

@ -586,8 +586,14 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
/* If this is a simple command, tell execute_disk_command that it /* If this is a simple command, tell execute_disk_command that it
might be able to get away without forking and simply exec. might be able to get away without forking and simply exec.
This means things like ( sleep 10 ) will only cause one fork. */ This means things like ( sleep 10 ) will only cause one fork.
If we're timing the command, however, we cannot do this
optimization. */
#if 0
if (user_subshell && command->type == cm_simple) if (user_subshell && command->type == cm_simple)
#else
if (user_subshell && command->type == cm_simple && (command->flags & CMD_TIME_PIPELINE) == 0)
#endif
{ {
command->flags |= CMD_NO_FORK; command->flags |= CMD_NO_FORK;
command->value.Simple->flags |= CMD_NO_FORK; command->value.Simple->flags |= CMD_NO_FORK;
@ -1068,7 +1074,8 @@ print_formatted_time (fp, format, rs, rsf, us, usf, ss, ssf, cpu)
{ {
int prec, lng, len; int prec, lng, len;
char *str, *s, ts[32]; char *str, *s, ts[32];
int sum, sum_frac; long sum;
int sum_frac;
int sindex, ssize; int sindex, ssize;
len = strlen (format); len = strlen (format);
@ -1716,15 +1723,16 @@ print_select_list (list, list_len, max_elem_len, indices_len)
/* Print the elements of LIST, one per line, preceded by an index from 1 to /* Print the elements of LIST, one per line, preceded by an index from 1 to
LIST_LEN. Then display PROMPT and wait for the user to enter a number. LIST_LEN. Then display PROMPT and wait for the user to enter a number.
If the number is between 1 and LIST_LEN, return that selection. If EOF If the number is between 1 and LIST_LEN, return that selection. If EOF
is read, return a null string. If a blank line is entered, the loop is is read, return a null string. If a blank line is entered, or an invalid
executed again. */ number is entered, the loop is executed again. */
static char * static char *
select_query (list, list_len, prompt) select_query (list, list_len, prompt)
WORD_LIST *list; WORD_LIST *list;
int list_len; int list_len;
char *prompt; char *prompt;
{ {
int max_elem_len, indices_len, len, reply; int max_elem_len, indices_len, len;
long reply;
WORD_LIST *l; WORD_LIST *l;
char *repl_string, *t; char *repl_string, *t;
@ -1767,7 +1775,8 @@ select_query (list, list_len, prompt)
repl_string = get_string_value ("REPLY"); repl_string = get_string_value ("REPLY");
if (*repl_string == 0) if (*repl_string == 0)
continue; continue;
reply = atoi (repl_string); if (legal_number (repl_string, &reply) == 0)
continue;
if (reply < 1 || reply > list_len) if (reply < 1 || reply > list_len)
return ""; return "";
@ -2138,7 +2147,7 @@ fix_assignment_words (words)
if (words == 0) if (words == 0)
return; return;
b = builtin_address_internal (words->word->word); b = builtin_address_internal (words->word->word, 0);
if (b == 0 || (b->flags & ASSIGNMENT_BUILTIN) == 0) if (b == 0 || (b->flags & ASSIGNMENT_BUILTIN) == 0)
return; return;

View file

@ -98,8 +98,8 @@ extern char *strerror __P((int));
#endif #endif
#if !defined (HAVE_STRCASECMP) #if !defined (HAVE_STRCASECMP)
extern int strncasecmp __P((char *, char *, int)); extern int strncasecmp __P((const char *, const char *, int));
extern int strcasecmp __P((char *, char *)); extern int strcasecmp __P((const char *, const char *));
#endif /* HAVE_STRCASECMP */ #endif /* HAVE_STRCASECMP */
extern int dup2 __P((int, int)); extern int dup2 __P((int, int));

View file

@ -133,8 +133,9 @@ int restricted = 0;
#endif /* RESTRICTED_SHELL */ #endif /* RESTRICTED_SHELL */
/* Non-zero means that this shell is running in `privileged' mode. This /* Non-zero means that this shell is running in `privileged' mode. This
mode is entered on startup if the real and effective uids or gids is required if the shell is to run setuid. If the `-p' option is
differ. */ not supplied at startup, and the real and effective uids or gids
differ, disable_priv_mode is called to relinquish setuid status. */
int privileged_mode = 0; int privileged_mode = 0;
#if defined (BRACE_EXPANSION) #if defined (BRACE_EXPANSION)

View file

@ -844,8 +844,9 @@ polite_directory_format (name)
l = home ? strlen (home) : 0; l = home ? strlen (home) : 0;
if (l > 1 && strncmp (home, name, l) == 0 && (!name[l] || name[l] == '/')) if (l > 1 && strncmp (home, name, l) == 0 && (!name[l] || name[l] == '/'))
{ {
strcpy (tdir + 1, name + l); strncpy (tdir + 1, name + l, sizeof(tdir) - 2);
tdir[0] = '~'; tdir[0] = '~';
tdir[sizeof(tdir) - 1] = '\0';
return (tdir); return (tdir);
} }
else else

15
jobs.c
View file

@ -1694,7 +1694,15 @@ wait_for (pid)
if (interactive_shell && subshell_environment == 0) if (interactive_shell && subshell_environment == 0)
{ {
if (WIFSIGNALED (child->status) || WIFSTOPPED (child->status)) if (WIFSIGNALED (child->status) || WIFSTOPPED (child->status))
{
set_tty_state (); set_tty_state ();
/* If the foreground job was suspended with ^Z (SIGTSTP), and
the user has requested it, get a new window size. */
if (check_window_size && WIFSTOPPED (child->status) &&
(WSTOPSIG (child->status) == SIGTSTP) &&
job == current_job)
get_new_window_size (0);
}
else else
get_tty_state (); get_tty_state ();
@ -2318,6 +2326,13 @@ waitchld (wpid, block)
the signal to ourselves. */ the signal to ourselves. */
SigHandler *temp_handler; SigHandler *temp_handler;
temp_handler = old_sigint_handler; temp_handler = old_sigint_handler;
/* Bogus. If we've reset the signal handler as the result
of a trap caught on SIGINT, then old_sigint_handler
will point to trap_handler, which now knows nothing about
SIGINT (if we reset the sighandler to the default).
In this case, we have to fix things up. What a crock. */
if (temp_handler == trap_handler && signal_is_trapped (SIGINT) == 0)
temp_handler = trap_to_sighandler (SIGINT);
restore_sigint_handler (); restore_sigint_handler ();
if (temp_handler == SIG_DFL) if (temp_handler == SIG_DFL)
termination_unwind_protect (SIGINT); termination_unwind_protect (SIGINT);

View file

@ -107,3 +107,7 @@ glob.o: $(BUILD_DIR)/config.h
glob.o: $(topdir)/bashtypes.h $(topdir)/ansi_stdlib.h $(topdir)/bashansi.h glob.o: $(topdir)/bashtypes.h $(topdir)/ansi_stdlib.h $(topdir)/bashansi.h
glob.o: $(topdir)/posixstat.h $(topdir)/memalloc.h glob.o: $(topdir)/posixstat.h $(topdir)/memalloc.h
glob.o: fnmatch.h glob.o: fnmatch.h
# Rules for deficient makes, like SunOS and Solaris
fnmatch.o: fnmatch.c
glob.o: glob.c

View file

@ -91,8 +91,8 @@ stubmalloc: ${STUB_OBJS}
${AR} cr libmalloc.a ${STUB_OBJS} ${AR} cr libmalloc.a ${STUB_OBJS}
-test -n "$(RANLIB)" && $(RANLIB) libmalloc.a -test -n "$(RANLIB)" && $(RANLIB) libmalloc.a
alloca.o: $(ALLOCA_SOURCE) alloca.o: $(srcdir)/$(ALLOCA_SOURCE)
$(CC) $(CCFLAGS) -c $(ALLOCA_SOURCE) $(CC) $(CCFLAGS) -c $(srcdir)/$(ALLOCA_SOURCE)
@- if test "$(ALLOCA_OBJECT)" != alloca.o ; then \ @- if test "$(ALLOCA_OBJECT)" != alloca.o ; then \
mv $(ALLOCA_OBJECT) alloca.o >/dev/null 2>&1 ; \ mv $(ALLOCA_OBJECT) alloca.o >/dev/null 2>&1 ; \
fi fi
@ -103,12 +103,14 @@ mostlyclean clean:
distclean realclean maintainer-clean: clean distclean realclean maintainer-clean: clean
$(RM) Makefile $(RM) Makefile
malloc.o: malloc.c
gmalloc.o: gmalloc.c
alloca.o: $(BUILD_DIR)/config.h alloca.o: $(BUILD_DIR)/config.h
malloc.o: $(BUILD_DIR)/config.h $(topdir)/bashtypes.h getpagesize.h malloc.o: $(BUILD_DIR)/config.h $(topdir)/bashtypes.h getpagesize.h
nmalloc.o: $(BUILD_DIR)/config.h $(topdir)/bashtypes.h getpagesize.h nmalloc.o: $(BUILD_DIR)/config.h $(topdir)/bashtypes.h getpagesize.h
nmalloc2.o: $(BUILD_DIR)/config.h $(topdir)/bashtypes.h getpagesize.h nmalloc2.o: $(BUILD_DIR)/config.h $(topdir)/bashtypes.h getpagesize.h
xmalloc.o: $(BUILD_DIR)/config.h $(topdir)/ansi_stdlib.h xmalloc.o: $(BUILD_DIR)/config.h $(topdir)/ansi_stdlib.h
gmalloc.o: $(BUILD_DIR)/config.h gmalloc.o: $(BUILD_DIR)/config.h
# Rules for deficient makes, like SunOS and Solaris
stub.o: stub.c
malloc.o: malloc.c
gmalloc.o: gmalloc.c

View file

@ -190,6 +190,7 @@ rltty.o: readline.h keymaps.h chardefs.h tilde.h
search.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h search.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
search.o: readline.h keymaps.h chardefs.h tilde.h search.o: readline.h keymaps.h chardefs.h tilde.h
search.o: ansi_stdlib.h history.h search.o: ansi_stdlib.h history.h
shell.o: ${BUILD_DIR}/config.h
signals.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h signals.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
signals.o: readline.h keymaps.h chardefs.h tilde.h signals.o: readline.h keymaps.h chardefs.h tilde.h
signals.o: history.h signals.o: history.h
@ -212,3 +213,32 @@ vi_mode.o: readline.h keymaps.h chardefs.h tilde.h
vi_mode.o: history.h ansi_stdlib.h vi_mode.o: history.h ansi_stdlib.h
xmalloc.o: ${BUILD_DIR}/config.h xmalloc.o: ${BUILD_DIR}/config.h
xmalloc.o: ansi_stdlib.h xmalloc.o: ansi_stdlib.h
# Rules for deficient makes, like SunOS and Solaris
bind.o: bind.c
callback.o: callback.c
complete.o: complete.c
display.o: display.c
funmap.o: funmap.c
histexpand.o: histexpand.c
histfile.o: histfile.c
history.o: history.c
histsearch.o: histsearch.c
input.o: input.c
isearch.o: isearch.c
keymaps.o: keymaps.c emacs_keymap.c vi_keymap.c
kill.o: kill.c
macro.o: macro.c
nls.o: nls.c
parens.o: parens.c
readline.o: readline.c
rltty.o: rltty.c
search.o: search.c
shell.o: shell.c
signals.o: signals.c
terminal.o: terminal.c
tilde.o: tilde.c
undo.o: undo.c
util.o: util.c
vi_mode.o: vi_mode.c
xmalloc.o: xmalloc.c

View file

@ -796,7 +796,9 @@ make_quoted_replacement (match, mtype, qc)
/* If there is a single match, see if we need to quote it. /* If there is a single match, see if we need to quote it.
This also checks whether the common prefix of several This also checks whether the common prefix of several
matches needs to be quoted. */ matches needs to be quoted. */
should_quote = rl_strpbrk (match, rl_filename_quote_characters) != 0; should_quote = rl_filename_quote_characters
? (rl_strpbrk (match, rl_filename_quote_characters) != 0)
: 0;
do_replace = should_quote ? mtype : NO_MATCH; do_replace = should_quote ? mtype : NO_MATCH;
/* Quote the replacement, since we found an embedded /* Quote the replacement, since we found an embedded

View file

@ -1482,7 +1482,7 @@ cr ()
void void
_rl_redisplay_after_sigwinch () _rl_redisplay_after_sigwinch ()
{ {
char *t, *oldp; char *t, *oldp, *oldl, *oldlprefix;
/* Clear the current line and put the cursor at column 0. Make sure /* Clear the current line and put the cursor at column 0. Make sure
the right thing happens if we have wrapped to a new screen line. */ the right thing happens if we have wrapped to a new screen line. */
@ -1508,9 +1508,14 @@ _rl_redisplay_after_sigwinch ()
if (t) if (t)
{ {
oldp = rl_display_prompt; oldp = rl_display_prompt;
oldl = local_prompt;
oldlprefix = local_prompt_prefix;
rl_display_prompt = ++t; rl_display_prompt = ++t;
local_prompt = local_prompt_prefix = (char *)NULL;
rl_forced_update_display (); rl_forced_update_display ();
rl_display_prompt = oldp; rl_display_prompt = oldp;
local_prompt = oldl;
local_prompt_prefix = oldlprefix;
} }
else else
rl_forced_update_display (); rl_forced_update_display ();

View file

@ -246,7 +246,7 @@ history_truncate_file (fname, lines)
/* Write only if there are more lines in the file than we want to /* Write only if there are more lines in the file than we want to
truncate to. */ truncate to. */
if (i && ((file = open (filename, O_WRONLY|O_TRUNC|O_BINARY, 0666)) != -1)) if (i && ((file = open (filename, O_WRONLY|O_TRUNC|O_BINARY, 0600)) != -1))
{ {
write (file, buffer + i, finfo.st_size - i); write (file, buffer + i, finfo.st_size - i);
close (file); close (file);
@ -275,7 +275,7 @@ history_do_write (filename, nelements, overwrite)
mode = overwrite ? O_WRONLY|O_CREAT|O_TRUNC|O_BINARY : O_WRONLY|O_APPEND|O_BINARY; mode = overwrite ? O_WRONLY|O_CREAT|O_TRUNC|O_BINARY : O_WRONLY|O_APPEND|O_BINARY;
output = history_filename (filename); output = history_filename (filename);
if ((file = open (output, mode, 0666)) == -1) if ((file = open (output, mode, 0600)) == -1)
{ {
FREE (output); FREE (output);
return (errno); return (errno);

View file

@ -262,7 +262,7 @@ rl_search_history (direction, invoking_key)
break; break;
} }
if (c >= 0 && (CTRL_CHAR (c) || META_CHAR (c) || c == RUBOUT)) if (c >= 0 && (CTRL_CHAR (c) || META_CHAR (c) || c == RUBOUT) && c != CTRL ('g'))
{ {
rl_execute_next (c); rl_execute_next (c);
break; break;

View file

@ -255,7 +255,7 @@ extern int rl_pending_input;
/* Non-zero if we called this function from _rl_dispatch(). It's present /* Non-zero if we called this function from _rl_dispatch(). It's present
so functions can find out whether they were called from a key binding so functions can find out whether they were called from a key binding
or directly from an application. */ or directly from an application. */
int rl_dispatching; extern int rl_dispatching;
/* The name of the terminal to use. */ /* The name of the terminal to use. */
extern char *rl_terminal_name; extern char *rl_terminal_name;

View file

@ -189,7 +189,7 @@ tilde_expand (string)
if (result = strchr (string, '~')) if (result = strchr (string, '~'))
result = xmalloc (result_size = (strlen (string) + 16)); result = xmalloc (result_size = (strlen (string) + 16));
else else
result = xmalloc (result_size = strlen (string)); result = xmalloc (result_size = (strlen (string) + 1));
/* Scan through STRING expanding tildes as we come to them. */ /* Scan through STRING expanding tildes as we come to them. */
while (1) while (1)

View file

@ -98,3 +98,6 @@ mostlyclean: clean
tilde.o: tilde.h $(topdir)/ansi_stdlib.h tilde.o: tilde.h $(topdir)/ansi_stdlib.h
tilde.o: $(BUILD_DIR)/config.h tilde.o: $(BUILD_DIR)/config.h
# Rules for deficient makes, like SunOS and Solaris
tilde.o: tilde.c

View file

@ -189,7 +189,7 @@ tilde_expand (string)
if (result = strchr (string, '~')) if (result = strchr (string, '~'))
result = xmalloc (result_size = (strlen (string) + 16)); result = xmalloc (result_size = (strlen (string) + 16));
else else
result = xmalloc (result_size = strlen (string)); result = xmalloc (result_size = (strlen (string) + 1));
/* Scan through STRING expanding tildes as we come to them. */ /* Scan through STRING expanding tildes as we come to them. */
while (1) while (1)

View file

@ -126,7 +126,15 @@ set_locale_var (var, value)
else if (var[3] == 'A') /* LC_ALL */ else if (var[3] == 'A') /* LC_ALL */
{ {
FREE (lc_all); FREE (lc_all);
lc_all = value ? savestring (value) : savestring (default_locale); if (value)
lc_all = savestring (value);
else if (default_locale)
lc_all = savestring (default_locale);
else
{
lc_all = xmalloc (1);
lc_all[0] = '\0';
}
#if defined (HAVE_SETLOCALE) #if defined (HAVE_SETLOCALE)
return (setlocale (LC_ALL, value) != 0); return (setlocale (LC_ALL, value) != 0);
#else #else

View file

@ -150,7 +150,7 @@ add_mail_file (file, msg)
int i; int i;
filename = full_pathname (file); filename = full_pathname (file);
i = find_mail_file (file); i = find_mail_file (filename);
if (i >= 0) if (i >= 0)
{ {
if (stat (filename, &finfo) == 0) if (stat (filename, &finfo) == 0)

12
oslib.c
View file

@ -112,7 +112,7 @@ strrchr (string, c)
doesn't matter. */ doesn't matter. */
int int
strncasecmp (string1, string2, count) strncasecmp (string1, string2, count)
char *string1, *string2; const char *string1, *string2;
int count; int count;
{ {
register char *s1, *s2; register char *s1, *s2;
@ -120,8 +120,8 @@ strncasecmp (string1, string2, count)
if (count > 0) if (count > 0)
{ {
s1 = string1; s1 = (char *)string1;
s2 = string2; s2 = (char *)string2;
do do
{ {
if ((r = to_lower (*s1) - to_lower (*s2)) != 0) if ((r = to_lower (*s1) - to_lower (*s2)) != 0)
@ -138,13 +138,13 @@ strncasecmp (string1, string2, count)
/* strcmp (), but caseless. */ /* strcmp (), but caseless. */
int int
strcasecmp (string1, string2) strcasecmp (string1, string2)
char *string1, *string2; const char *string1, *string2;
{ {
register char *s1, *s2; register char *s1, *s2;
register int r; register int r;
s1 = string1; s1 = (char *)string1;
s2 = string2; s2 = (char *)string2;
while ((r = to_lower (*s1) - to_lower (*s2)) == 0) while ((r = to_lower (*s1) - to_lower (*s2)) == 0)
{ {

17
parse.y
View file

@ -2529,7 +2529,7 @@ read_token_word (character)
#if defined (ARRAY_VARS) #if defined (ARRAY_VARS)
/* Identify possible compound array variable assignment. */ /* Identify possible compound array variable assignment. */
else if (character == '=') else if (character == '=' && token_index > 0)
{ {
peek_char = shell_getc (1); peek_char = shell_getc (1);
if (peek_char == '(') /* ) */ if (peek_char == '(') /* ) */
@ -3077,6 +3077,7 @@ decode_prompt_string (string)
{ {
/* Use the value of PWD because it is much more efficient. */ /* Use the value of PWD because it is much more efficient. */
char t_string[PATH_MAX]; char t_string[PATH_MAX];
int tlen;
temp = get_string_value ("PWD"); temp = get_string_value ("PWD");
@ -3085,11 +3086,17 @@ decode_prompt_string (string)
if (getcwd (t_string, sizeof(t_string)) == 0) if (getcwd (t_string, sizeof(t_string)) == 0)
{ {
t_string[0] = '.'; t_string[0] = '.';
t_string[1] = '\0'; tlen = 1;
}
} }
else else
strcpy (t_string, temp); tlen = strlen (t_string);
}
else
{
tlen = sizeof (t_string) - 1;
strncpy (t_string, temp, tlen);
}
t_string[tlen] = '\0';
if (c == 'W') if (c == 'W')
{ {
@ -3098,6 +3105,8 @@ decode_prompt_string (string)
strcpy (t_string, t + 1); strcpy (t_string, t + 1);
} }
else else
/* polite_directory_format is guaranteed to return a string
no longer than PATH_MAX - 1 characters. */
strcpy (t_string, polite_directory_format (t_string)); strcpy (t_string, polite_directory_format (t_string));
/* If we're going to be expanding the prompt string later, /* If we're going to be expanding the prompt string later,

View file

@ -276,7 +276,7 @@ xtrace_print_word_list (list)
WORD_LIST *list; WORD_LIST *list;
{ {
WORD_LIST *w; WORD_LIST *w;
char *t; char *t, *x;
fprintf (stderr, "%s", indirection_level_string ()); fprintf (stderr, "%s", indirection_level_string ());
for (w = list; w; w = w->next) for (w = list; w; w = w->next)
@ -285,7 +285,11 @@ xtrace_print_word_list (list)
if (t == 0 || *t == '\0') if (t == 0 || *t == '\0')
fprintf (stderr, "''%s", w->next ? " " : ""); fprintf (stderr, "''%s", w->next ? " " : "");
else if (contains_shell_metas (t)) else if (contains_shell_metas (t))
fprintf (stderr, "'%s'%s", t, w->next ? " " : ""); {
x = single_quote (t);
fprintf (stderr, "%s%s", x, w->next ? " " : "");
free (x);
}
else else
fprintf (stderr, "%s%s", t, w->next ? " " : ""); fprintf (stderr, "%s%s", t, w->next ? " " : "");
} }

14
shell.c
View file

@ -248,7 +248,7 @@ main (argc, argv, env)
char **argv, **env; char **argv, **env;
{ {
register int i; register int i;
int code; int code, saverst;
volatile int locally_skip_execution; volatile int locally_skip_execution;
volatile int arg_index, top_level_arg_index; volatile int arg_index, top_level_arg_index;
@ -459,6 +459,13 @@ main (argc, argv, env)
interactive = 1; interactive = 1;
} }
#if defined (RESTRICTED_SHELL)
/* If the `-r' option is supplied at invocation, make sure that the shell
is not in restricted mode when running the startup files. */
saverst = restricted;
restricted = 0;
#endif
if (locally_skip_execution == 0 && running_setuid == 0) if (locally_skip_execution == 0 && running_setuid == 0)
run_startup_files (); run_startup_files ();
@ -473,7 +480,10 @@ main (argc, argv, env)
} }
#if defined (RESTRICTED_SHELL) #if defined (RESTRICTED_SHELL)
/* Turn on the restrictions after parsing the startup files. */ /* Turn on the restrictions after parsing the startup files. This
means that `bash -r' or `set -r' invoked from a startup file will
turn on the restrictions after the startup files are executed. */
restricted = saverst || restricted;
maybe_make_restricted (shell_name); maybe_make_restricted (shell_name);
#endif /* RESTRICTED_SHELL */ #endif /* RESTRICTED_SHELL */

6
sig.c
View file

@ -75,9 +75,9 @@ initialize_signals ()
{ {
initialize_shell_signals (); initialize_shell_signals ();
initialize_job_signals (); initialize_job_signals ();
#if !defined (HAVE_SYS_SIGLIST) && !defined (HAVE_STRSIGNAL) #if !defined (HAVE_SYS_SIGLIST) && !defined (HAVE_UNDER_SYS_SIGLIST) && !defined (HAVE_STRSIGNAL)
initialize_siglist (); initialize_siglist ();
#endif #endif /* !HAVE_SYS_SIGLIST && !HAVE_UNDER_SYS_SIGLIST && !HAVE_STRSIGNAL */
} }
void void
@ -229,8 +229,10 @@ initialize_terminating_signals ()
sigaction (XSIG (i), &oact, &act); sigaction (XSIG (i), &oact, &act);
set_signal_ignored (XSIG (i)); set_signal_ignored (XSIG (i));
} }
#if defined (SIGPROF)
if (XSIG (i) == SIGPROF && XHANDLER (i) != SIG_DFL && XHANDLER (i) != SIG_IGN) if (XSIG (i) == SIGPROF && XHANDLER (i) != SIG_DFL && XHANDLER (i) != SIG_IGN)
sigaction (XSIG (i), &oact, (struct sigaction *)NULL); sigaction (XSIG (i), &oact, (struct sigaction *)NULL);
#endif /* SIGPROF */
} }
#else /* !HAVE_POSIX_SIGNALS */ #else /* !HAVE_POSIX_SIGNALS */

2
sig.h
View file

@ -118,5 +118,7 @@ extern void jump_to_top_level __P((int));
/* Functions defined in trap.c. */ /* Functions defined in trap.c. */
extern SigHandler *set_sigint_handler __P((void)); extern SigHandler *set_sigint_handler __P((void));
extern SigHandler *trap_to_sighandler __P((int));
extern sighandler trap_handler __P((int));
#endif /* _SIG_H_ */ #endif /* _SIG_H_ */

View file

@ -20,7 +20,7 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "config.h" #include "config.h"
#if !defined (HAVE_SYS_SIGLIST) && !defined (HAVE_STRSIGNAL) #if !defined (HAVE_SYS_SIGLIST) && !defined (HAVE_UNDER_SYS_SIGLIST) && !defined (HAVE_STRSIGNAL)
#include <stdio.h> #include <stdio.h>
#include "bashtypes.h" #include "bashtypes.h"
@ -225,4 +225,4 @@ initialize_siglist ()
} }
} }
} }
#endif /* !HAVE_SYS_SIGLIST && !HAVE_STRSIGNAL */ #endif /* !HAVE_SYS_SIGLIST && !HAVE_UNDER_SYS_SIGLIST && !HAVE_STRSIGNAL */

25
subst.c
View file

@ -3506,7 +3506,9 @@ parameter_brace_expand_length (name)
/* Verify and limit the start and end of the desired substring. If /* Verify and limit the start and end of the desired substring. If
VTYPE == 0, a regular shell variable is being used; if it is 1, VTYPE == 0, a regular shell variable is being used; if it is 1,
then the positional paramters are being used; if it is 2, then then the positional paramters are being used; if it is 2, then
VALUE is really a pointer to an array variable that should be used. */ VALUE is really a pointer to an array variable that should be used.
Return value is 1 if both values were OK, 0 if there was a problem
with an invalid expression, or -1 if the values were out of range. */
static int static int
verify_substring_values (value, substr, vtype, e1p, e2p) verify_substring_values (value, substr, vtype, e1p, e2p)
char *value, *substr; char *value, *substr;
@ -3548,7 +3550,7 @@ verify_substring_values (value, substr, vtype, e1p, e2p)
*e1p += len; *e1p += len;
if (*e1p >= len || *e1p < 0) if (*e1p >= len || *e1p < 0)
return (0); return (-1);
if (t) if (t)
{ {
@ -3672,7 +3674,7 @@ parameter_brace_substring (varname, value, substr, quoted)
char *varname, *value, *substr; char *varname, *value, *substr;
int quoted; int quoted;
{ {
int e1, e2, vtype; int e1, e2, vtype, r;
char *temp, *val; char *temp, *val;
SHELL_VAR *v; SHELL_VAR *v;
@ -3685,11 +3687,12 @@ parameter_brace_substring (varname, value, substr, quoted)
if (vtype == -1) if (vtype == -1)
return ((char *)NULL); return ((char *)NULL);
if (verify_substring_values (val, substr, vtype, &e1, &e2) == 0) r = verify_substring_values (val, substr, vtype, &e1, &e2);
if (r <= 0)
{ {
if (val && vtype == VT_ARRAYMEMBER) if (val && vtype == VT_ARRAYMEMBER)
free (val); free (val);
return (&expand_param_error); return ((r == 0) ? &expand_param_error : (char *)NULL);
} }
switch (vtype) switch (vtype)
@ -4506,11 +4509,14 @@ expand_word_internal (word, quoted, contains_dollar_at, expanded_something)
extract the expression and pass it to the evaluator. */ extract the expression and pass it to the evaluator. */
if (temp && *temp == '(') if (temp && *temp == '(')
{ {
char *temp2;
temp1 = temp + 1; temp1 = temp + 1;
t_index = strlen (temp1) - 1; temp2 = savestring (temp1);
t_index = strlen (temp2) - 1;
if (temp1[t_index] != ')') if (temp2[t_index] != ')')
{ {
free (temp2);
#if 0 #if 0
report_error ("%s: bad arithmetic substitution", temp); report_error ("%s: bad arithmetic substitution", temp);
free (temp); free (temp);
@ -4523,10 +4529,11 @@ expand_word_internal (word, quoted, contains_dollar_at, expanded_something)
} }
/* Cut off ending `)' */ /* Cut off ending `)' */
temp1[t_index] = '\0'; temp2[t_index] = '\0';
/* Expand variables found inside the expression. */ /* Expand variables found inside the expression. */
temp1 = maybe_expand_string (temp1, Q_DOUBLE_QUOTES, expand_string); temp1 = maybe_expand_string (temp2, Q_DOUBLE_QUOTES, expand_string);
free (temp2);
/* No error messages. */ /* No error messages. */
this_command_name = (char *)NULL; this_command_name = (char *)NULL;

11
support/config.guess vendored
View file

@ -206,7 +206,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# Japanese Language versions have a version number like `4.1.3-JL'. # Japanese Language versions have a version number like `4.1.3-JL'.
echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
exit 0 ;; exit 0 ;;
sun3*:SunOS:*:*) sun3*:SunOS:*:*|sun:SunOS:*:*)
echo m68k-sun-sunos${UNAME_RELEASE} echo m68k-sun-sunos${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
aushp:SunOS:*:*) aushp:SunOS:*:*)
@ -372,12 +372,15 @@ EOF
hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
echo m68k-hp-bsd4.4 echo m68k-hp-bsd4.4
exit 0 ;; exit 0 ;;
9000/[3478]??:HP-UX:*:*) 9000/[34678]??:HP-UX:*:*)
case "${UNAME_MACHINE}" in case "${UNAME_MACHINE}" in
9000/31? ) HP_ARCH=m68000 ;; 9000/31? ) HP_ARCH=m68000 ;;
9000/[34]?? ) HP_ARCH=m68k ;; 9000/[34]?? ) HP_ARCH=m68k ;;
9000/7?? | 9000/8?[1679] ) HP_ARCH=hppa1.1 ;; 9000/78? | 9000/80[24] | 9000/8[67]1 | 9000/8[78]9 | 9000/893 )
9000/8?? ) HP_ARCH=hppa1.0 ;; HP_ARCH=hppa2.0 ;;
9000/7?? | 9000/8?[13679] | 9000/892 )
HP_ARCH=hppa1.1 ;;
9000/[68]?? ) HP_ARCH=hppa1.0 ;;
esac esac
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
echo ${HP_ARCH}-hp-hpux${HPUX_REV} echo ${HP_ARCH}-hp-hpux${HPUX_REV}

10
test.c
View file

@ -42,6 +42,11 @@
# include <unistd.h> # include <unistd.h>
#endif #endif
#include <errno.h>
#if !defined (errno)
extern int errno;
#endif /* !errno */
#if !defined (_POSIX_VERSION) #if !defined (_POSIX_VERSION)
# include <sys/file.h> # include <sys/file.h>
#endif /* !_POSIX_VERSION */ #endif /* !_POSIX_VERSION */
@ -55,11 +60,6 @@
# define STRLEN(s) ((s)[0] ? ((s)[1] ? ((s)[2] ? strlen(s) : 2) : 1) : 0) # define STRLEN(s) ((s)[0] ? ((s)[1] ? ((s)[2] ? strlen(s) : 2) : 1) : 0)
#endif #endif
#include <errno.h>
#if !defined (errno)
extern int errno;
#endif /* !errno */
#if !defined (STREQ) #if !defined (STREQ)
# define STREQ(a, b) ((a)[0] == (b)[0] && strcmp (a, b) == 0) # define STREQ(a, b) ((a)[0] == (b)[0] && strcmp (a, b) == 0)
#endif /* !STREQ */ #endif /* !STREQ */

View file

@ -46,7 +46,7 @@ declare -a DIRSTACK='()'
declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")' declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
declare -a b='([0]="this" [1]="is" [2]="a" [3]="test" [4]="" [5]="/etc/passwd")' declare -a b='([0]="this" [1]="is" [2]="a" [3]="test" [4]="" [5]="/etc/passwd")'
declare -ar c='()' declare -ar c='()'
declare -a d='([1]="test test" [2]="bdef" [5]="hello world" [6]="test" [9]="ninth element")' declare -a d='([1]="test test")'
declare -a f='([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element")' declare -a f='([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element")'
./array.tests: unset: ps1: not an array variable ./array.tests: unset: ps1: not an array variable
./array.tests: declare: c: cannot destroy array variables in this way ./array.tests: declare: c: cannot destroy array variables in this way
@ -56,7 +56,7 @@ declare -a DIRSTACK='()'
declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")' declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
declare -a b='([0]="this" [1]="is" [2]="a" [3]="test" [4]="" [5]="/etc/passwd")' declare -a b='([0]="this" [1]="is" [2]="a" [3]="test" [4]="" [5]="/etc/passwd")'
declare -ar c='()' declare -ar c='()'
declare -a d='([1]="test test" [2]="bdef" [5]="hello world" [6]="test" [9]="ninth element")' declare -a d='([1]="test test")'
declare -a f='([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element")' declare -a f='([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element")'
declare -a rv='([0]="this" [1]="is" [2]="a" [3]="test" [4]="of" [5]="read" [6]="using" [7]="arrays")' declare -a rv='([0]="this" [1]="is" [2]="a" [3]="test" [4]="of" [5]="read" [6]="using" [7]="arrays")'
abde abde

26
trap.c
View file

@ -23,15 +23,15 @@
#include <stdio.h> #include <stdio.h>
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif
#include "bashtypes.h" #include "bashtypes.h"
#include "trap.h" #include "trap.h"
#include "bashansi.h" #include "bashansi.h"
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif
#include "shell.h" #include "shell.h"
#include "signames.h" #include "signames.h"
#include "builtins/common.h" #include "builtins/common.h"
@ -151,9 +151,11 @@ decode_signal (string)
if (legal_number (string, &sig)) if (legal_number (string, &sig))
return ((sig >= 0 && sig <= NSIG) ? (int)sig : NO_SIG); return ((sig >= 0 && sig <= NSIG) ? (int)sig : NO_SIG);
/* A leading `SIG' may be omitted. */
for (sig = 0; sig <= NSIG; sig++) for (sig = 0; sig <= NSIG; sig++)
if (strcasecmp (string, signal_names[sig]) == 0 || if (strcasecmp (string, signal_names[sig]) == 0 ||
strcasecmp (string, &(signal_names[sig])[3]) == 0) (STREQN (signal_names[sig], "SIG", 3) &&
strcasecmp (string, &(signal_names[sig])[3]) == 0))
return ((int)sig); return ((int)sig);
return (NO_SIG); return (NO_SIG);
@ -300,6 +302,20 @@ set_sigint_handler ()
return (set_signal_handler (SIGINT, termination_unwind_protect)); return (set_signal_handler (SIGINT, termination_unwind_protect));
} }
/* Return the correct handler for signal SIG according to the values in
sigmodes[SIG]. */
SigHandler *
trap_to_sighandler (sig)
int sig;
{
if (sigmodes[sig] & (SIG_IGNORED|SIG_HARD_IGNORE))
return (SIG_IGN);
else if (sigmodes[sig] & SIG_TRAPPED)
return (trap_handler);
else
return (SIG_DFL);
}
/* Set SIG to call STRING as a command. */ /* Set SIG to call STRING as a command. */
void void
set_signal (sig, string) set_signal (sig, string)

View file

@ -907,7 +907,11 @@ static int
brand () brand ()
{ {
rseed = rseed * 1103515245 + 12345; rseed = rseed * 1103515245 + 12345;
#if 0
return ((unsigned int)(rseed / 65536) % 32768); return ((unsigned int)(rseed / 65536) % 32768);
#else
return ((unsigned int)(rseed % 32768));
#endif
} }
/* Set the random number generator seed to SEED. */ /* Set the random number generator seed to SEED. */
@ -916,6 +920,7 @@ sbrand (seed)
int seed; int seed;
{ {
rseed = seed; rseed = seed;
last_random_value = 0;
} }
static SHELL_VAR * static SHELL_VAR *
@ -936,7 +941,7 @@ get_random (var)
/* Reset for command and process substitution. */ /* Reset for command and process substitution. */
if (subshell_environment) if (subshell_environment)
sbrand ((int)(getpid() + NOW)); sbrand (rseed + (int)(getpid() + NOW));
do do
rv = brand (); rv = brand ();
@ -1462,6 +1467,10 @@ assign_array_from_string (name, value)
} }
else if (array_p (var) == 0) else if (array_p (var) == 0)
var = convert_var_to_array (var); var = convert_var_to_array (var);
#if 0
else
empty_array (array_cell (var));
#endif
return (assign_array_var_from_string (var, value)); return (assign_array_var_from_string (var, value));
} }
@ -1509,6 +1518,13 @@ assign_array_var_from_string (var, value)
else else
nlist = expand_string (value, 0); nlist = expand_string (value, 0);
#if 1
/* Now that we are ready to assign values to the array, kill the existing
value. */
if (a)
empty_array (a);
#endif
for (last_ind = 0, list = nlist; list; list = list->next) for (last_ind = 0, list = nlist; list; list = list->next)
{ {
w = list->word->word; w = list->word->word;

View file

@ -63,5 +63,5 @@ show_shell_version (extended)
{ {
printf ("GNU bash, version %s (%s)\n", shell_version_string (), MACHTYPE); printf ("GNU bash, version %s (%s)\n", shell_version_string (), MACHTYPE);
if (extended) if (extended)
printf ("Copyright 1996 Free Software Foundation, Inc.\n"); printf ("Copyright 1997 Free Software Foundation, Inc.\n");
} }

249
y.tab.c
View file

@ -1,5 +1,5 @@
/* A Bison parser, made from ./parse.y /* A Bison parser, made from /usr/homes/chet/src/bash/bash-2.01.1/parse.y
by GNU Bison version 1.25 by GNU Bison version 1.25
*/ */
@ -39,7 +39,7 @@
#define GREATER_BAR 289 #define GREATER_BAR 289
#define yacc_EOF 290 #define yacc_EOF 290
#line 21 "./parse.y" #line 21 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
#include "config.h" #include "config.h"
@ -189,7 +189,7 @@ static int function_bstart;
static REDIRECTEE redir; static REDIRECTEE redir;
#line 171 "./parse.y" #line 171 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
typedef union { typedef union {
WORD_DESC *word; /* the word that we read. */ WORD_DESC *word; /* the word that we read. */
int number; /* the number that we read. */ int number; /* the number that we read. */
@ -1071,7 +1071,7 @@ yyreduce:
switch (yyn) { switch (yyn) {
case 1: case 1:
#line 215 "./parse.y" #line 215 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
/* Case of regular command. Discard the error /* Case of regular command. Discard the error
safety net,and return the command just parsed. */ safety net,and return the command just parsed. */
@ -1082,7 +1082,7 @@ case 1:
; ;
break;} break;}
case 2: case 2:
#line 224 "./parse.y" #line 224 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
/* Case of regular command, but not a very /* Case of regular command, but not a very
interesting one. Return a NULL command. */ interesting one. Return a NULL command. */
@ -1091,7 +1091,7 @@ case 2:
; ;
break;} break;}
case 3: case 3:
#line 231 "./parse.y" #line 231 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
/* Error during parsing. Return NULL command. */ /* Error during parsing. Return NULL command. */
global_command = (COMMAND *)NULL; global_command = (COMMAND *)NULL;
@ -1108,7 +1108,7 @@ case 3:
; ;
break;} break;}
case 4: case 4:
#line 246 "./parse.y" #line 246 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
/* Case of EOF seen by itself. Do ignoreeof or /* Case of EOF seen by itself. Do ignoreeof or
not. */ not. */
@ -1118,57 +1118,57 @@ case 4:
; ;
break;} break;}
case 5: case 5:
#line 256 "./parse.y" #line 256 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.word_list = make_word_list (yyvsp[0].word, (WORD_LIST *)NULL); ; { yyval.word_list = make_word_list (yyvsp[0].word, (WORD_LIST *)NULL); ;
break;} break;}
case 6: case 6:
#line 258 "./parse.y" #line 258 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.word_list = make_word_list (yyvsp[0].word, yyvsp[-1].word_list); ; { yyval.word_list = make_word_list (yyvsp[0].word, yyvsp[-1].word_list); ;
break;} break;}
case 7: case 7:
#line 262 "./parse.y" #line 262 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
redir.filename = yyvsp[0].word; redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (1, r_output_direction, redir); yyval.redirect = make_redirection (1, r_output_direction, redir);
; ;
break;} break;}
case 8: case 8:
#line 267 "./parse.y" #line 267 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
redir.filename = yyvsp[0].word; redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (0, r_input_direction, redir); yyval.redirect = make_redirection (0, r_input_direction, redir);
; ;
break;} break;}
case 9: case 9:
#line 272 "./parse.y" #line 272 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
redir.filename = yyvsp[0].word; redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (yyvsp[-2].number, r_output_direction, redir); yyval.redirect = make_redirection (yyvsp[-2].number, r_output_direction, redir);
; ;
break;} break;}
case 10: case 10:
#line 277 "./parse.y" #line 277 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
redir.filename = yyvsp[0].word; redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (yyvsp[-2].number, r_input_direction, redir); yyval.redirect = make_redirection (yyvsp[-2].number, r_input_direction, redir);
; ;
break;} break;}
case 11: case 11:
#line 282 "./parse.y" #line 282 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
redir.filename = yyvsp[0].word; redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (1, r_appending_to, redir); yyval.redirect = make_redirection (1, r_appending_to, redir);
; ;
break;} break;}
case 12: case 12:
#line 287 "./parse.y" #line 287 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
redir.filename = yyvsp[0].word; redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (yyvsp[-2].number, r_appending_to, redir); yyval.redirect = make_redirection (yyvsp[-2].number, r_appending_to, redir);
; ;
break;} break;}
case 13: case 13:
#line 292 "./parse.y" #line 292 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
redir.filename = yyvsp[0].word; redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (0, r_reading_until, redir); yyval.redirect = make_redirection (0, r_reading_until, redir);
@ -1176,7 +1176,7 @@ case 13:
; ;
break;} break;}
case 14: case 14:
#line 298 "./parse.y" #line 298 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
redir.filename = yyvsp[0].word; redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (yyvsp[-2].number, r_reading_until, redir); yyval.redirect = make_redirection (yyvsp[-2].number, r_reading_until, redir);
@ -1184,63 +1184,63 @@ case 14:
; ;
break;} break;}
case 15: case 15:
#line 304 "./parse.y" #line 304 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
redir.dest = yyvsp[0].number; redir.dest = yyvsp[0].number;
yyval.redirect = make_redirection (0, r_duplicating_input, redir); yyval.redirect = make_redirection (0, r_duplicating_input, redir);
; ;
break;} break;}
case 16: case 16:
#line 309 "./parse.y" #line 309 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
redir.dest = yyvsp[0].number; redir.dest = yyvsp[0].number;
yyval.redirect = make_redirection (yyvsp[-2].number, r_duplicating_input, redir); yyval.redirect = make_redirection (yyvsp[-2].number, r_duplicating_input, redir);
; ;
break;} break;}
case 17: case 17:
#line 314 "./parse.y" #line 314 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
redir.dest = yyvsp[0].number; redir.dest = yyvsp[0].number;
yyval.redirect = make_redirection (1, r_duplicating_output, redir); yyval.redirect = make_redirection (1, r_duplicating_output, redir);
; ;
break;} break;}
case 18: case 18:
#line 319 "./parse.y" #line 319 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
redir.dest = yyvsp[0].number; redir.dest = yyvsp[0].number;
yyval.redirect = make_redirection (yyvsp[-2].number, r_duplicating_output, redir); yyval.redirect = make_redirection (yyvsp[-2].number, r_duplicating_output, redir);
; ;
break;} break;}
case 19: case 19:
#line 324 "./parse.y" #line 324 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
redir.filename = yyvsp[0].word; redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (0, r_duplicating_input_word, redir); yyval.redirect = make_redirection (0, r_duplicating_input_word, redir);
; ;
break;} break;}
case 20: case 20:
#line 329 "./parse.y" #line 329 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
redir.filename = yyvsp[0].word; redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (yyvsp[-2].number, r_duplicating_input_word, redir); yyval.redirect = make_redirection (yyvsp[-2].number, r_duplicating_input_word, redir);
; ;
break;} break;}
case 21: case 21:
#line 334 "./parse.y" #line 334 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
redir.filename = yyvsp[0].word; redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (1, r_duplicating_output_word, redir); yyval.redirect = make_redirection (1, r_duplicating_output_word, redir);
; ;
break;} break;}
case 22: case 22:
#line 339 "./parse.y" #line 339 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
redir.filename = yyvsp[0].word; redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (yyvsp[-2].number, r_duplicating_output_word, redir); yyval.redirect = make_redirection (yyvsp[-2].number, r_duplicating_output_word, redir);
; ;
break;} break;}
case 23: case 23:
#line 344 "./parse.y" #line 344 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
redir.filename = yyvsp[0].word; redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection yyval.redirect = make_redirection
@ -1249,7 +1249,7 @@ case 23:
; ;
break;} break;}
case 24: case 24:
#line 351 "./parse.y" #line 351 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
redir.filename = yyvsp[0].word; redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection yyval.redirect = make_redirection
@ -1258,88 +1258,88 @@ case 24:
; ;
break;} break;}
case 25: case 25:
#line 358 "./parse.y" #line 358 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
redir.dest = 0L; redir.dest = 0L;
yyval.redirect = make_redirection (1, r_close_this, redir); yyval.redirect = make_redirection (1, r_close_this, redir);
; ;
break;} break;}
case 26: case 26:
#line 363 "./parse.y" #line 363 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
redir.dest = 0L; redir.dest = 0L;
yyval.redirect = make_redirection (yyvsp[-2].number, r_close_this, redir); yyval.redirect = make_redirection (yyvsp[-2].number, r_close_this, redir);
; ;
break;} break;}
case 27: case 27:
#line 368 "./parse.y" #line 368 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
redir.dest = 0L; redir.dest = 0L;
yyval.redirect = make_redirection (0, r_close_this, redir); yyval.redirect = make_redirection (0, r_close_this, redir);
; ;
break;} break;}
case 28: case 28:
#line 373 "./parse.y" #line 373 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
redir.dest = 0L; redir.dest = 0L;
yyval.redirect = make_redirection (yyvsp[-2].number, r_close_this, redir); yyval.redirect = make_redirection (yyvsp[-2].number, r_close_this, redir);
; ;
break;} break;}
case 29: case 29:
#line 378 "./parse.y" #line 378 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
redir.filename = yyvsp[0].word; redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (1, r_err_and_out, redir); yyval.redirect = make_redirection (1, r_err_and_out, redir);
; ;
break;} break;}
case 30: case 30:
#line 383 "./parse.y" #line 383 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
redir.filename = yyvsp[0].word; redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (yyvsp[-2].number, r_input_output, redir); yyval.redirect = make_redirection (yyvsp[-2].number, r_input_output, redir);
; ;
break;} break;}
case 31: case 31:
#line 388 "./parse.y" #line 388 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
redir.filename = yyvsp[0].word; redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (0, r_input_output, redir); yyval.redirect = make_redirection (0, r_input_output, redir);
; ;
break;} break;}
case 32: case 32:
#line 393 "./parse.y" #line 393 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
redir.filename = yyvsp[0].word; redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (1, r_output_force, redir); yyval.redirect = make_redirection (1, r_output_force, redir);
; ;
break;} break;}
case 33: case 33:
#line 398 "./parse.y" #line 398 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
redir.filename = yyvsp[0].word; redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (yyvsp[-2].number, r_output_force, redir); yyval.redirect = make_redirection (yyvsp[-2].number, r_output_force, redir);
; ;
break;} break;}
case 34: case 34:
#line 405 "./parse.y" #line 405 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.element.word = yyvsp[0].word; yyval.element.redirect = 0; ; { yyval.element.word = yyvsp[0].word; yyval.element.redirect = 0; ;
break;} break;}
case 35: case 35:
#line 407 "./parse.y" #line 407 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.element.word = yyvsp[0].word; yyval.element.redirect = 0; ; { yyval.element.word = yyvsp[0].word; yyval.element.redirect = 0; ;
break;} break;}
case 36: case 36:
#line 409 "./parse.y" #line 409 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.element.redirect = yyvsp[0].redirect; yyval.element.word = 0; ; { yyval.element.redirect = yyvsp[0].redirect; yyval.element.word = 0; ;
break;} break;}
case 37: case 37:
#line 413 "./parse.y" #line 413 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
yyval.redirect = yyvsp[0].redirect; yyval.redirect = yyvsp[0].redirect;
; ;
break;} break;}
case 38: case 38:
#line 417 "./parse.y" #line 417 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
register REDIRECT *t; register REDIRECT *t;
@ -1350,23 +1350,23 @@ case 38:
; ;
break;} break;}
case 39: case 39:
#line 428 "./parse.y" #line 428 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = make_simple_command (yyvsp[0].element, (COMMAND *)NULL); ; { yyval.command = make_simple_command (yyvsp[0].element, (COMMAND *)NULL); ;
break;} break;}
case 40: case 40:
#line 430 "./parse.y" #line 430 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = make_simple_command (yyvsp[0].element, yyvsp[-1].command); ; { yyval.command = make_simple_command (yyvsp[0].element, yyvsp[-1].command); ;
break;} break;}
case 41: case 41:
#line 434 "./parse.y" #line 434 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = clean_simple_command (yyvsp[0].command); ; { yyval.command = clean_simple_command (yyvsp[0].command); ;
break;} break;}
case 42: case 42:
#line 436 "./parse.y" #line 436 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = yyvsp[0].command; ; { yyval.command = yyvsp[0].command; ;
break;} break;}
case 43: case 43:
#line 438 "./parse.y" #line 438 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
COMMAND *tc; COMMAND *tc;
@ -1395,191 +1395,191 @@ case 43:
; ;
break;} break;}
case 44: case 44:
#line 467 "./parse.y" #line 467 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = yyvsp[0].command; ; { yyval.command = yyvsp[0].command; ;
break;} break;}
case 45: case 45:
#line 469 "./parse.y" #line 469 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = yyvsp[0].command; ; { yyval.command = yyvsp[0].command; ;
break;} break;}
case 46: case 46:
#line 471 "./parse.y" #line 471 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = make_while_command (yyvsp[-3].command, yyvsp[-1].command); ; { yyval.command = make_while_command (yyvsp[-3].command, yyvsp[-1].command); ;
break;} break;}
case 47: case 47:
#line 473 "./parse.y" #line 473 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = make_until_command (yyvsp[-3].command, yyvsp[-1].command); ; { yyval.command = make_until_command (yyvsp[-3].command, yyvsp[-1].command); ;
break;} break;}
case 48: case 48:
#line 475 "./parse.y" #line 475 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = yyvsp[0].command; ; { yyval.command = yyvsp[0].command; ;
break;} break;}
case 49: case 49:
#line 477 "./parse.y" #line 477 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = yyvsp[0].command; ; { yyval.command = yyvsp[0].command; ;
break;} break;}
case 50: case 50:
#line 479 "./parse.y" #line 479 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = yyvsp[0].command; ; { yyval.command = yyvsp[0].command; ;
break;} break;}
case 51: case 51:
#line 481 "./parse.y" #line 481 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = yyvsp[0].command; ; { yyval.command = yyvsp[0].command; ;
break;} break;}
case 52: case 52:
#line 483 "./parse.y" #line 483 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = yyvsp[0].command; ; { yyval.command = yyvsp[0].command; ;
break;} break;}
case 53: case 53:
#line 487 "./parse.y" #line 487 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = make_for_command (yyvsp[-4].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command); ; { yyval.command = make_for_command (yyvsp[-4].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command); ;
break;} break;}
case 54: case 54:
#line 489 "./parse.y" #line 489 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = make_for_command (yyvsp[-4].word, add_string_to_list ("$@", (WORD_LIST *)NULL), yyvsp[-1].command); ; { yyval.command = make_for_command (yyvsp[-4].word, add_string_to_list ("$@", (WORD_LIST *)NULL), yyvsp[-1].command); ;
break;} break;}
case 55: case 55:
#line 491 "./parse.y" #line 491 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = make_for_command (yyvsp[-5].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command); ; { yyval.command = make_for_command (yyvsp[-5].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command); ;
break;} break;}
case 56: case 56:
#line 493 "./parse.y" #line 493 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = make_for_command (yyvsp[-5].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command); ; { yyval.command = make_for_command (yyvsp[-5].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command); ;
break;} break;}
case 57: case 57:
#line 495 "./parse.y" #line 495 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = make_for_command (yyvsp[-8].word, REVERSE_LIST (yyvsp[-5].word_list, WORD_LIST *), yyvsp[-1].command); ; { yyval.command = make_for_command (yyvsp[-8].word, REVERSE_LIST (yyvsp[-5].word_list, WORD_LIST *), yyvsp[-1].command); ;
break;} break;}
case 58: case 58:
#line 497 "./parse.y" #line 497 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = make_for_command (yyvsp[-8].word, REVERSE_LIST (yyvsp[-5].word_list, WORD_LIST *), yyvsp[-1].command); ; { yyval.command = make_for_command (yyvsp[-8].word, REVERSE_LIST (yyvsp[-5].word_list, WORD_LIST *), yyvsp[-1].command); ;
break;} break;}
case 59: case 59:
#line 501 "./parse.y" #line 501 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
yyval.command = make_select_command (yyvsp[-4].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command); yyval.command = make_select_command (yyvsp[-4].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command);
; ;
break;} break;}
case 60: case 60:
#line 505 "./parse.y" #line 505 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
yyval.command = make_select_command (yyvsp[-4].word, add_string_to_list ("$@", (WORD_LIST *)NULL), yyvsp[-1].command); yyval.command = make_select_command (yyvsp[-4].word, add_string_to_list ("$@", (WORD_LIST *)NULL), yyvsp[-1].command);
; ;
break;} break;}
case 61: case 61:
#line 509 "./parse.y" #line 509 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
yyval.command = make_select_command (yyvsp[-5].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command); yyval.command = make_select_command (yyvsp[-5].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command);
; ;
break;} break;}
case 62: case 62:
#line 513 "./parse.y" #line 513 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
yyval.command = make_select_command (yyvsp[-5].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command); yyval.command = make_select_command (yyvsp[-5].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command);
; ;
break;} break;}
case 63: case 63:
#line 517 "./parse.y" #line 517 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
yyval.command = make_select_command (yyvsp[-8].word, (WORD_LIST *)reverse_list (yyvsp[-5].word_list), yyvsp[-1].command); yyval.command = make_select_command (yyvsp[-8].word, (WORD_LIST *)reverse_list (yyvsp[-5].word_list), yyvsp[-1].command);
; ;
break;} break;}
case 64: case 64:
#line 521 "./parse.y" #line 521 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
yyval.command = make_select_command (yyvsp[-8].word, (WORD_LIST *)reverse_list (yyvsp[-5].word_list), yyvsp[-1].command); yyval.command = make_select_command (yyvsp[-8].word, (WORD_LIST *)reverse_list (yyvsp[-5].word_list), yyvsp[-1].command);
; ;
break;} break;}
case 65: case 65:
#line 527 "./parse.y" #line 527 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = make_case_command (yyvsp[-4].word, (PATTERN_LIST *)NULL); ; { yyval.command = make_case_command (yyvsp[-4].word, (PATTERN_LIST *)NULL); ;
break;} break;}
case 66: case 66:
#line 529 "./parse.y" #line 529 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = make_case_command (yyvsp[-5].word, yyvsp[-2].pattern); ; { yyval.command = make_case_command (yyvsp[-5].word, yyvsp[-2].pattern); ;
break;} break;}
case 67: case 67:
#line 531 "./parse.y" #line 531 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = make_case_command (yyvsp[-4].word, yyvsp[-1].pattern); ; { yyval.command = make_case_command (yyvsp[-4].word, yyvsp[-1].pattern); ;
break;} break;}
case 68: case 68:
#line 535 "./parse.y" #line 535 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = make_function_def (yyvsp[-4].word, yyvsp[0].command, function_dstart, function_bstart); ; { yyval.command = make_function_def (yyvsp[-4].word, yyvsp[0].command, function_dstart, function_bstart); ;
break;} break;}
case 69: case 69:
#line 539 "./parse.y" #line 539 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = make_function_def (yyvsp[-4].word, yyvsp[0].command, function_dstart, function_bstart); ; { yyval.command = make_function_def (yyvsp[-4].word, yyvsp[0].command, function_dstart, function_bstart); ;
break;} break;}
case 70: case 70:
#line 542 "./parse.y" #line 542 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = make_function_def (yyvsp[-2].word, yyvsp[0].command, function_dstart, function_bstart); ; { yyval.command = make_function_def (yyvsp[-2].word, yyvsp[0].command, function_dstart, function_bstart); ;
break;} break;}
case 71: case 71:
#line 546 "./parse.y" #line 546 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyvsp[-1].command->flags |= CMD_WANT_SUBSHELL; yyval.command = yyvsp[-1].command; ; { yyvsp[-1].command->flags |= CMD_WANT_SUBSHELL; yyval.command = yyvsp[-1].command; ;
break;} break;}
case 72: case 72:
#line 550 "./parse.y" #line 550 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = make_if_command (yyvsp[-3].command, yyvsp[-1].command, (COMMAND *)NULL); ; { yyval.command = make_if_command (yyvsp[-3].command, yyvsp[-1].command, (COMMAND *)NULL); ;
break;} break;}
case 73: case 73:
#line 552 "./parse.y" #line 552 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = make_if_command (yyvsp[-5].command, yyvsp[-3].command, yyvsp[-1].command); ; { yyval.command = make_if_command (yyvsp[-5].command, yyvsp[-3].command, yyvsp[-1].command); ;
break;} break;}
case 74: case 74:
#line 554 "./parse.y" #line 554 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = make_if_command (yyvsp[-4].command, yyvsp[-2].command, yyvsp[-1].command); ; { yyval.command = make_if_command (yyvsp[-4].command, yyvsp[-2].command, yyvsp[-1].command); ;
break;} break;}
case 75: case 75:
#line 559 "./parse.y" #line 559 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = make_group_command (yyvsp[-1].command); ; { yyval.command = make_group_command (yyvsp[-1].command); ;
break;} break;}
case 76: case 76:
#line 563 "./parse.y" #line 563 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = make_if_command (yyvsp[-2].command, yyvsp[0].command, (COMMAND *)NULL); ; { yyval.command = make_if_command (yyvsp[-2].command, yyvsp[0].command, (COMMAND *)NULL); ;
break;} break;}
case 77: case 77:
#line 565 "./parse.y" #line 565 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = make_if_command (yyvsp[-4].command, yyvsp[-2].command, yyvsp[0].command); ; { yyval.command = make_if_command (yyvsp[-4].command, yyvsp[-2].command, yyvsp[0].command); ;
break;} break;}
case 78: case 78:
#line 567 "./parse.y" #line 567 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = make_if_command (yyvsp[-3].command, yyvsp[-1].command, yyvsp[0].command); ; { yyval.command = make_if_command (yyvsp[-3].command, yyvsp[-1].command, yyvsp[0].command); ;
break;} break;}
case 80: case 80:
#line 572 "./parse.y" #line 572 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyvsp[0].pattern->next = yyvsp[-1].pattern; yyval.pattern = yyvsp[0].pattern; ; { yyvsp[0].pattern->next = yyvsp[-1].pattern; yyval.pattern = yyvsp[0].pattern; ;
break;} break;}
case 81: case 81:
#line 576 "./parse.y" #line 576 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.pattern = make_pattern_list (yyvsp[-2].word_list, yyvsp[0].command); ; { yyval.pattern = make_pattern_list (yyvsp[-2].word_list, yyvsp[0].command); ;
break;} break;}
case 82: case 82:
#line 578 "./parse.y" #line 578 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.pattern = make_pattern_list (yyvsp[-2].word_list, (COMMAND *)NULL); ; { yyval.pattern = make_pattern_list (yyvsp[-2].word_list, (COMMAND *)NULL); ;
break;} break;}
case 83: case 83:
#line 580 "./parse.y" #line 580 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.pattern = make_pattern_list (yyvsp[-2].word_list, yyvsp[0].command); ; { yyval.pattern = make_pattern_list (yyvsp[-2].word_list, yyvsp[0].command); ;
break;} break;}
case 84: case 84:
#line 582 "./parse.y" #line 582 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.pattern = make_pattern_list (yyvsp[-2].word_list, (COMMAND *)NULL); ; { yyval.pattern = make_pattern_list (yyvsp[-2].word_list, (COMMAND *)NULL); ;
break;} break;}
case 86: case 86:
#line 587 "./parse.y" #line 587 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyvsp[-1].pattern->next = yyvsp[-2].pattern; yyval.pattern = yyvsp[-1].pattern; ; { yyvsp[-1].pattern->next = yyvsp[-2].pattern; yyval.pattern = yyvsp[-1].pattern; ;
break;} break;}
case 87: case 87:
#line 591 "./parse.y" #line 591 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.word_list = make_word_list (yyvsp[0].word, (WORD_LIST *)NULL); ; { yyval.word_list = make_word_list (yyvsp[0].word, (WORD_LIST *)NULL); ;
break;} break;}
case 88: case 88:
#line 593 "./parse.y" #line 593 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.word_list = make_word_list (yyvsp[0].word, yyvsp[-2].word_list); ; { yyval.word_list = make_word_list (yyvsp[0].word, yyvsp[-2].word_list); ;
break;} break;}
case 89: case 89:
#line 602 "./parse.y" #line 602 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
yyval.command = yyvsp[0].command; yyval.command = yyvsp[0].command;
if (need_here_doc) if (need_here_doc)
@ -1587,13 +1587,13 @@ case 89:
; ;
break;} break;}
case 91: case 91:
#line 611 "./parse.y" #line 611 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
yyval.command = yyvsp[0].command; yyval.command = yyvsp[0].command;
; ;
break;} break;}
case 93: case 93:
#line 618 "./parse.y" #line 618 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
if (yyvsp[-2].command->type == cm_connection) if (yyvsp[-2].command->type == cm_connection)
yyval.command = connect_async_list (yyvsp[-2].command, (COMMAND *)NULL, '&'); yyval.command = connect_async_list (yyvsp[-2].command, (COMMAND *)NULL, '&');
@ -1602,15 +1602,15 @@ case 93:
; ;
break;} break;}
case 95: case 95:
#line 629 "./parse.y" #line 629 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, AND_AND); ; { yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, AND_AND); ;
break;} break;}
case 96: case 96:
#line 631 "./parse.y" #line 631 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, OR_OR); ; { yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, OR_OR); ;
break;} break;}
case 97: case 97:
#line 633 "./parse.y" #line 633 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
if (yyvsp[-3].command->type == cm_connection) if (yyvsp[-3].command->type == cm_connection)
yyval.command = connect_async_list (yyvsp[-3].command, yyvsp[0].command, '&'); yyval.command = connect_async_list (yyvsp[-3].command, yyvsp[0].command, '&');
@ -1619,19 +1619,19 @@ case 97:
; ;
break;} break;}
case 98: case 98:
#line 640 "./parse.y" #line 640 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, ';'); ; { yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, ';'); ;
break;} break;}
case 99: case 99:
#line 642 "./parse.y" #line 642 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, ';'); ; { yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, ';'); ;
break;} break;}
case 100: case 100:
#line 644 "./parse.y" #line 644 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = yyvsp[0].command; ; { yyval.command = yyvsp[0].command; ;
break;} break;}
case 106: case 106:
#line 663 "./parse.y" #line 663 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
yyval.command = yyvsp[0].command; yyval.command = yyvsp[0].command;
if (need_here_doc) if (need_here_doc)
@ -1639,7 +1639,7 @@ case 106:
; ;
break;} break;}
case 107: case 107:
#line 669 "./parse.y" #line 669 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
if (yyvsp[-1].command->type == cm_connection) if (yyvsp[-1].command->type == cm_connection)
yyval.command = connect_async_list (yyvsp[-1].command, (COMMAND *)NULL, '&'); yyval.command = connect_async_list (yyvsp[-1].command, (COMMAND *)NULL, '&');
@ -1650,7 +1650,7 @@ case 107:
; ;
break;} break;}
case 108: case 108:
#line 678 "./parse.y" #line 678 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
yyval.command = yyvsp[-1].command; yyval.command = yyvsp[-1].command;
if (need_here_doc) if (need_here_doc)
@ -1658,15 +1658,15 @@ case 108:
; ;
break;} break;}
case 109: case 109:
#line 686 "./parse.y" #line 686 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, AND_AND); ; { yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, AND_AND); ;
break;} break;}
case 110: case 110:
#line 688 "./parse.y" #line 688 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, OR_OR); ; { yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, OR_OR); ;
break;} break;}
case 111: case 111:
#line 690 "./parse.y" #line 690 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
if (yyvsp[-2].command->type == cm_connection) if (yyvsp[-2].command->type == cm_connection)
yyval.command = connect_async_list (yyvsp[-2].command, yyvsp[0].command, '&'); yyval.command = connect_async_list (yyvsp[-2].command, yyvsp[0].command, '&');
@ -1675,59 +1675,59 @@ case 111:
; ;
break;} break;}
case 112: case 112:
#line 697 "./parse.y" #line 697 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = command_connect (yyvsp[-2].command, yyvsp[0].command, ';'); ; { yyval.command = command_connect (yyvsp[-2].command, yyvsp[0].command, ';'); ;
break;} break;}
case 113: case 113:
#line 700 "./parse.y" #line 700 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = yyvsp[0].command; ; { yyval.command = yyvsp[0].command; ;
break;} break;}
case 114: case 114:
#line 704 "./parse.y" #line 704 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = yyvsp[0].command; ; { yyval.command = yyvsp[0].command; ;
break;} break;}
case 115: case 115:
#line 706 "./parse.y" #line 706 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
yyvsp[0].command->flags |= CMD_INVERT_RETURN; yyvsp[0].command->flags |= CMD_INVERT_RETURN;
yyval.command = yyvsp[0].command; yyval.command = yyvsp[0].command;
; ;
break;} break;}
case 116: case 116:
#line 711 "./parse.y" #line 711 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
yyvsp[0].command->flags |= yyvsp[-1].number; yyvsp[0].command->flags |= yyvsp[-1].number;
yyval.command = yyvsp[0].command; yyval.command = yyvsp[0].command;
; ;
break;} break;}
case 117: case 117:
#line 716 "./parse.y" #line 716 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
yyvsp[0].command->flags |= yyvsp[-2].number; yyvsp[0].command->flags |= yyvsp[-2].number;
yyval.command = yyvsp[0].command; yyval.command = yyvsp[0].command;
; ;
break;} break;}
case 118: case 118:
#line 721 "./parse.y" #line 721 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ {
yyvsp[0].command->flags |= yyvsp[-1].number|CMD_INVERT_RETURN; yyvsp[0].command->flags |= yyvsp[-1].number|CMD_INVERT_RETURN;
yyval.command = yyvsp[0].command; yyval.command = yyvsp[0].command;
; ;
break;} break;}
case 119: case 119:
#line 729 "./parse.y" #line 729 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, '|'); ; { yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, '|'); ;
break;} break;}
case 120: case 120:
#line 731 "./parse.y" #line 731 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = yyvsp[0].command; ; { yyval.command = yyvsp[0].command; ;
break;} break;}
case 121: case 121:
#line 735 "./parse.y" #line 735 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.number = CMD_TIME_PIPELINE; ; { yyval.number = CMD_TIME_PIPELINE; ;
break;} break;}
case 122: case 122:
#line 737 "./parse.y" #line 737 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.number = CMD_TIME_PIPELINE|CMD_TIME_POSIX; ; { yyval.number = CMD_TIME_PIPELINE|CMD_TIME_POSIX; ;
break;} break;}
} }
@ -1928,7 +1928,7 @@ yyerrhandle:
yystate = yyn; yystate = yyn;
goto yynewstate; goto yynewstate;
} }
#line 739 "./parse.y" #line 739 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
/* Possible states for the parser that require it to do special things. */ /* Possible states for the parser that require it to do special things. */
@ -3722,7 +3722,7 @@ read_token_word (character)
#if defined (ARRAY_VARS) #if defined (ARRAY_VARS)
/* Identify possible compound array variable assignment. */ /* Identify possible compound array variable assignment. */
else if (character == '=') else if (character == '=' && token_index > 0)
{ {
peek_char = shell_getc (1); peek_char = shell_getc (1);
if (peek_char == '(') /* ) */ if (peek_char == '(') /* ) */
@ -4270,6 +4270,7 @@ decode_prompt_string (string)
{ {
/* Use the value of PWD because it is much more efficient. */ /* Use the value of PWD because it is much more efficient. */
char t_string[PATH_MAX]; char t_string[PATH_MAX];
int tlen;
temp = get_string_value ("PWD"); temp = get_string_value ("PWD");
@ -4278,11 +4279,17 @@ decode_prompt_string (string)
if (getcwd (t_string, sizeof(t_string)) == 0) if (getcwd (t_string, sizeof(t_string)) == 0)
{ {
t_string[0] = '.'; t_string[0] = '.';
t_string[1] = '\0'; tlen = 1;
}
} }
else else
strcpy (t_string, temp); tlen = strlen (t_string);
}
else
{
tlen = sizeof (t_string) - 1;
strncpy (t_string, temp, tlen);
}
t_string[tlen] = '\0';
if (c == 'W') if (c == 'W')
{ {
@ -4291,6 +4298,8 @@ decode_prompt_string (string)
strcpy (t_string, t + 1); strcpy (t_string, t + 1);
} }
else else
/* polite_directory_format is guaranteed to return a string
no longer than PATH_MAX - 1 characters. */
strcpy (t_string, polite_directory_format (t_string)); strcpy (t_string, polite_directory_format (t_string));
/* If we're going to be expanding the prompt string later, /* If we're going to be expanding the prompt string later,