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,
and the previous version, bash-2.01-beta2.

35
aclocal.m4 vendored
View file

@ -197,8 +197,26 @@ fi
dnl
dnl Check for sys_siglist[] or _sys_siglist[]
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_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_TRY_RUN([
#include <sys/types.h>
@ -206,12 +224,12 @@ AC_CACHE_VAL(bash_cv_under_sys_siglist,
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifndef _sys_siglist
#ifndef UNDER_SYS_SIGLIST_DECLARED
extern char *_sys_siglist[];
#endif
main()
{
char *msg = _sys_siglist[2];
char *msg = (char *)_sys_siglist[2];
exit(msg == 0);
}],
bash_cv_under_sys_siglist=yes, bash_cv_under_sys_siglist=no,
@ -434,7 +452,7 @@ typedef int (*_bashfunc)();
main()
{
_bashfunc pf;
pf = printf;
pf = (_bashfunc) printf;
exit(pf == 0);
}
],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_TRY_COMPILE([#include <sys/types.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)])
AC_MSG_RESULT($bash_cv_can_redecl_getpw)
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
elif test -d /usr/mail; then
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
bash_cv_mail_dir=/var/spool/mail
elif test -d /usr/spool/mail; then
bash_cv_mail_dir=/usr/spool/mail
else
bash_cv_mail_dir=unknown
fi

View file

@ -700,8 +700,8 @@ attempt_shell_completion (text, start, end)
/* Check that we haven't incorrectly flagged a closed command substitution
as indicating we're in a command position. */
if (in_command_position && rl_line_buffer[ti] == '`' && *text != '`' &&
unclosed_pair (rl_line_buffer, 0, "`") == 0)
if (in_command_position && ti >= 0 && rl_line_buffer[ti] == '`' &&
*text != '`' && unclosed_pair (rl_line_buffer, 0, "`") == 0)
in_command_position = 0;
/* 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
expansion. */
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);
}
@ -1801,6 +1810,7 @@ glob_complete_word (text, state)
if (state == 0)
{
rl_filename_completion_desired = 1;
if (matches)
free (matches);
matches = shell_glob_filename (text);

View file

@ -36,6 +36,8 @@
#include "shell.h"
#include <readline/readline.h>
extern char *backslash_quote ();
/* Find greatest common prefix of two strings. */
static int
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 start, end, gcd;
char *result, *subterm;
int result_size, flag;
char *result, *subterm, *x;
int result_size, flag, tlen;
flag = 0;
if (real_start == real_end)
{
if (array[real_start])
return (savestring (array[real_start] + gcd_zero));
else
return (savestring (array[0]));
x = array[real_start] ? backslash_quote (array[real_start] + gcd_zero)
: backslash_quote (array[0]);
return x;
}
result = xmalloc (result_size = 1);
result = xmalloc (result_size = 16);
*result = '\0';
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++;
}
/* 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)
subterm = savestring (array[start] + gcd_zero);
{
x = savestring (array[start] + gcd_zero);
subterm = backslash_quote (x);
free (x);
}
else
{
/* If there is more than one element in the subarray,
insert the prefix and an opening brace. */
result_size += gcd - gcd_zero + 1;
insert the (quoted) prefix and an opening brace. */
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);
strncat (result, array[start] + gcd_zero, gcd - gcd_zero);
strcat (result, subterm);
free (subterm);
strcat (result, "{");
subterm = really_munge_braces (array, start, end + 1, gcd);
subterm[strlen (subterm) - 1] = '}';
@ -146,25 +161,35 @@ hack_braces_completion (names)
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
bash_brace_completion ()
{
Function *orig_ignore_func;
Function *orig_entry_func;
CPFunction *orig_quoting_func;
CPPFunction *orig_attempt_func;
int orig_quoting_desired;
orig_ignore_func = rl_ignore_some_completions_function;
orig_attempt_func = rl_attempted_completion_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_attempted_completion_function = NULL;
rl_ignore_some_completions_function = (Function *) hack_braces_completion;
rl_filename_quoting_function = NULL;
rl_filename_quoting_desired = 0;
rl_complete_internal (TAB);
rl_ignore_some_completions_function = orig_ignore_func;
rl_attempted_completion_function = orig_attempt_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 */

View file

@ -97,8 +97,11 @@ mkbuiltins: $(srcdir)/mkbuiltins.c ../config.h
common.o: common.c
bashgetopt.o: bashgetopt.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
$(SHELL) $(srcdir)/psize.sh > pipesize.h
@ -149,6 +152,7 @@ return.o: return.def
set.o: set.def
setattr.o: setattr.def
shift.o: shift.def
shopt.o: shopt.def
source.o: source.def
suspend.o: suspend.def
test.o: test.def

View file

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

View file

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

View file

@ -46,6 +46,8 @@ $END
# include <unistd.h>
#endif
#include <errno.h>
#include "../shell.h"
#include "common.h"
#include "bashgetopt.h"
@ -55,6 +57,10 @@ $END
#include <readline/readline.h>
#endif
#if !defined(errno)
extern int errno;
#endif
#define issep(c) (strchr (ifs_chars, (c)))
extern int interrupt_immediately;
@ -180,8 +186,11 @@ read_builtin (list)
c = rlbuf[rlind++];
}
else
#endif
if (read (0, &c, 1) != 1)
#endif
while (((retval = read (0, &c, 1)) < 0) && errno == EINTR)
;
if (retval <= 0)
{
eof = 1;
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));
else
{
x = double_quote (value_cell (var));
x = double_quote (value_cell (var) ? value_cell (var) : "");
printf ("%s=%s\n", var->name, x);
free (x);
}
@ -366,7 +366,7 @@ set_var_attribute (name, attribute, undo)
{
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);
}
else

View file

@ -191,7 +191,7 @@ static void
showtrap (i)
int i;
{
char *t, *p;
char *t, *p, *sn;
p = trap_list[i];
@ -199,9 +199,15 @@ showtrap (i)
return;
t = (p == (char *)IGNORE_SIG) ? (char *)NULL : single_quote (p);
printf ("trap -- %s %s\n", t ? t : "''", signal_name (i));
if (t)
free (t);
sn = signal_name (i);
/* Make sure that signals whose names are unknown (for whatever reason)
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

View file

@ -215,6 +215,9 @@
/* Define if `sys_siglist' is declared by <signal.h>. */
#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. */
#undef uid_t
@ -515,4 +518,3 @@
#include "config.h.bot"
#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 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_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
sparc-svr4*) opt_gnu_malloc=no ;; # sparc SVR4, SVR4.2
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
*-freebsd*) opt_gnu_malloc=no ;; # they claim it's better
*-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
*-qnx*) opt_gnu_malloc=no ;; # QNX 4.2
*-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
dnl arguments to configure
@ -456,7 +456,7 @@ dnl
dnl this should really go away someday
case "$host_os" in
sysv4.2) AC_DEFINE(SVR4_2)
sysv4.2*) AC_DEFINE(SVR4_2)
AC_DEFINE(SVR4) ;;
sysv4*) AC_DEFINE(SVR4) ;;
hpux*) LOCAL_CFLAGS=-DHPUX ;;

View file

@ -142,7 +142,8 @@ maintainer-clean: clean
installdirs:
-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)
install: info installdirs

File diff suppressed because it is too large Load diff

View file

@ -22,6 +22,11 @@ last change: Mon May 19 12:55:22 EDT 1997
@defcodeindex rw
@set BashFeatures
@dircategory Utilities
@direntry
* Bash: (bash). GNU Bourne-Again SHell
@end direntry
@ifinfo
@format
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
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)
#else
if (user_subshell && command->type == cm_simple && (command->flags & CMD_TIME_PIPELINE) == 0)
#endif
{
command->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;
char *str, *s, ts[32];
int sum, sum_frac;
long sum;
int sum_frac;
int sindex, ssize;
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
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
is read, return a null string. If a blank line is entered, the loop is
executed again. */
is read, return a null string. If a blank line is entered, or an invalid
number is entered, the loop is executed again. */
static char *
select_query (list, list_len, prompt)
WORD_LIST *list;
int list_len;
char *prompt;
{
int max_elem_len, indices_len, len, reply;
int max_elem_len, indices_len, len;
long reply;
WORD_LIST *l;
char *repl_string, *t;
@ -1767,7 +1775,8 @@ select_query (list, list_len, prompt)
repl_string = get_string_value ("REPLY");
if (*repl_string == 0)
continue;
reply = atoi (repl_string);
if (legal_number (repl_string, &reply) == 0)
continue;
if (reply < 1 || reply > list_len)
return "";
@ -2138,7 +2147,7 @@ fix_assignment_words (words)
if (words == 0)
return;
b = builtin_address_internal (words->word->word);
b = builtin_address_internal (words->word->word, 0);
if (b == 0 || (b->flags & ASSIGNMENT_BUILTIN) == 0)
return;

View file

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

View file

@ -133,8 +133,9 @@ int restricted = 0;
#endif /* RESTRICTED_SHELL */
/* 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
differ. */
is required if the shell is to run setuid. If the `-p' option is
not supplied at startup, and the real and effective uids or gids
differ, disable_priv_mode is called to relinquish setuid status. */
int privileged_mode = 0;
#if defined (BRACE_EXPANSION)

View file

@ -844,8 +844,9 @@ polite_directory_format (name)
l = home ? strlen (home) : 0;
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[sizeof(tdir) - 1] = '\0';
return (tdir);
}
else

17
jobs.c
View file

@ -1694,7 +1694,15 @@ wait_for (pid)
if (interactive_shell && subshell_environment == 0)
{
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
get_tty_state ();
@ -2318,6 +2326,13 @@ waitchld (wpid, block)
the signal to ourselves. */
SigHandler *temp_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 ();
if (temp_handler == SIG_DFL)
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)/posixstat.h $(topdir)/memalloc.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}
-test -n "$(RANLIB)" && $(RANLIB) libmalloc.a
alloca.o: $(ALLOCA_SOURCE)
$(CC) $(CCFLAGS) -c $(ALLOCA_SOURCE)
alloca.o: $(srcdir)/$(ALLOCA_SOURCE)
$(CC) $(CCFLAGS) -c $(srcdir)/$(ALLOCA_SOURCE)
@- if test "$(ALLOCA_OBJECT)" != alloca.o ; then \
mv $(ALLOCA_OBJECT) alloca.o >/dev/null 2>&1 ; \
fi
@ -103,12 +103,14 @@ mostlyclean clean:
distclean realclean maintainer-clean: clean
$(RM) Makefile
malloc.o: malloc.c
gmalloc.o: gmalloc.c
alloca.o: $(BUILD_DIR)/config.h
malloc.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
xmalloc.o: $(BUILD_DIR)/config.h $(topdir)/ansi_stdlib.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: readline.h keymaps.h chardefs.h tilde.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: readline.h keymaps.h chardefs.h tilde.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
xmalloc.o: ${BUILD_DIR}/config.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.
This also checks whether the common prefix of several
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;
/* Quote the replacement, since we found an embedded

View file

@ -1482,7 +1482,7 @@ cr ()
void
_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
the right thing happens if we have wrapped to a new screen line. */
@ -1508,9 +1508,14 @@ _rl_redisplay_after_sigwinch ()
if (t)
{
oldp = rl_display_prompt;
oldl = local_prompt;
oldlprefix = local_prompt_prefix;
rl_display_prompt = ++t;
local_prompt = local_prompt_prefix = (char *)NULL;
rl_forced_update_display ();
rl_display_prompt = oldp;
local_prompt = oldl;
local_prompt_prefix = oldlprefix;
}
else
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
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);
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;
output = history_filename (filename);
if ((file = open (output, mode, 0666)) == -1)
if ((file = open (output, mode, 0600)) == -1)
{
FREE (output);
return (errno);

View file

@ -262,7 +262,7 @@ rl_search_history (direction, invoking_key)
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);
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
so functions can find out whether they were called from a key binding
or directly from an application. */
int rl_dispatching;
extern int rl_dispatching;
/* The name of the terminal to use. */
extern char *rl_terminal_name;

View file

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

View file

@ -98,3 +98,6 @@ mostlyclean: clean
tilde.o: tilde.h $(topdir)/ansi_stdlib.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, '~'))
result = xmalloc (result_size = (strlen (string) + 16));
else
result = xmalloc (result_size = strlen (string));
result = xmalloc (result_size = (strlen (string) + 1));
/* Scan through STRING expanding tildes as we come to them. */
while (1)

View file

@ -126,7 +126,15 @@ set_locale_var (var, value)
else if (var[3] == 'A') /* 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)
return (setlocale (LC_ALL, value) != 0);
#else

View file

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

12
oslib.c
View file

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

15
parse.y
View file

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

View file

@ -276,18 +276,22 @@ xtrace_print_word_list (list)
WORD_LIST *list;
{
WORD_LIST *w;
char *t;
char *t, *x;
fprintf (stderr, "%s", indirection_level_string ());
for (w = list; w; w = w->next)
{
t = w->word->word;
if (t == 0 || *t == '\0')
fprintf (stderr, "''%s", w->next ? " " : "");
fprintf (stderr, "''%s", w->next ? " " : "");
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
fprintf (stderr, "%s%s", t, w->next ? " " : "");
fprintf (stderr, "%s%s", t, w->next ? " " : "");
}
fprintf (stderr, "\n");
}

14
shell.c
View file

@ -248,7 +248,7 @@ main (argc, argv, env)
char **argv, **env;
{
register int i;
int code;
int code, saverst;
volatile int locally_skip_execution;
volatile int arg_index, top_level_arg_index;
@ -459,6 +459,13 @@ main (argc, argv, env)
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)
run_startup_files ();
@ -473,7 +480,10 @@ main (argc, argv, env)
}
#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);
#endif /* RESTRICTED_SHELL */

6
sig.c
View file

@ -75,9 +75,9 @@ initialize_signals ()
{
initialize_shell_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 ();
#endif
#endif /* !HAVE_SYS_SIGLIST && !HAVE_UNDER_SYS_SIGLIST && !HAVE_STRSIGNAL */
}
void
@ -229,8 +229,10 @@ initialize_terminating_signals ()
sigaction (XSIG (i), &oact, &act);
set_signal_ignored (XSIG (i));
}
#if defined (SIGPROF)
if (XSIG (i) == SIGPROF && XHANDLER (i) != SIG_DFL && XHANDLER (i) != SIG_IGN)
sigaction (XSIG (i), &oact, (struct sigaction *)NULL);
#endif /* SIGPROF */
}
#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. */
extern SigHandler *set_sigint_handler __P((void));
extern SigHandler *trap_to_sighandler __P((int));
extern sighandler trap_handler __P((int));
#endif /* _SIG_H_ */

View file

@ -20,7 +20,7 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#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 "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
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
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
verify_substring_values (value, substr, vtype, e1p, e2p)
char *value, *substr;
@ -3548,7 +3550,7 @@ verify_substring_values (value, substr, vtype, e1p, e2p)
*e1p += len;
if (*e1p >= len || *e1p < 0)
return (0);
return (-1);
if (t)
{
@ -3672,7 +3674,7 @@ parameter_brace_substring (varname, value, substr, quoted)
char *varname, *value, *substr;
int quoted;
{
int e1, e2, vtype;
int e1, e2, vtype, r;
char *temp, *val;
SHELL_VAR *v;
@ -3685,11 +3687,12 @@ parameter_brace_substring (varname, value, substr, quoted)
if (vtype == -1)
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)
free (val);
return (&expand_param_error);
return ((r == 0) ? &expand_param_error : (char *)NULL);
}
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. */
if (temp && *temp == '(')
{
char *temp2;
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
report_error ("%s: bad arithmetic substitution", temp);
free (temp);
@ -4523,10 +4529,11 @@ expand_word_internal (word, quoted, contains_dollar_at, expanded_something)
}
/* Cut off ending `)' */
temp1[t_index] = '\0';
temp2[t_index] = '\0';
/* 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. */
this_command_name = (char *)NULL;

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

10
test.c
View file

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

View file

@ -46,7 +46,7 @@ declare -a DIRSTACK='()'
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 -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")'
./array.tests: unset: ps1: not an array variable
./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 -a b='([0]="this" [1]="is" [2]="a" [3]="test" [4]="" [5]="/etc/passwd")'
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 rv='([0]="this" [1]="is" [2]="a" [3]="test" [4]="of" [5]="read" [6]="using" [7]="arrays")'
abde

26
trap.c
View file

@ -23,15 +23,15 @@
#include <stdio.h>
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif
#include "bashtypes.h"
#include "trap.h"
#include "bashansi.h"
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif
#include "shell.h"
#include "signames.h"
#include "builtins/common.h"
@ -151,9 +151,11 @@ decode_signal (string)
if (legal_number (string, &sig))
return ((sig >= 0 && sig <= NSIG) ? (int)sig : NO_SIG);
/* A leading `SIG' may be omitted. */
for (sig = 0; sig <= NSIG; sig++)
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 (NO_SIG);
@ -300,6 +302,20 @@ set_sigint_handler ()
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. */
void
set_signal (sig, string)

View file

@ -907,7 +907,11 @@ static int
brand ()
{
rseed = rseed * 1103515245 + 12345;
#if 0
return ((unsigned int)(rseed / 65536) % 32768);
#else
return ((unsigned int)(rseed % 32768));
#endif
}
/* Set the random number generator seed to SEED. */
@ -916,6 +920,7 @@ sbrand (seed)
int seed;
{
rseed = seed;
last_random_value = 0;
}
static SHELL_VAR *
@ -936,7 +941,7 @@ get_random (var)
/* Reset for command and process substitution. */
if (subshell_environment)
sbrand ((int)(getpid() + NOW));
sbrand (rseed + (int)(getpid() + NOW));
do
rv = brand ();
@ -1462,6 +1467,10 @@ assign_array_from_string (name, value)
}
else if (array_p (var) == 0)
var = convert_var_to_array (var);
#if 0
else
empty_array (array_cell (var));
#endif
return (assign_array_var_from_string (var, value));
}
@ -1509,6 +1518,13 @@ assign_array_var_from_string (var, value)
else
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)
{
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);
if (extended)
printf ("Copyright 1996 Free Software Foundation, Inc.\n");
printf ("Copyright 1997 Free Software Foundation, Inc.\n");
}

247
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
*/
@ -39,7 +39,7 @@
#define GREATER_BAR 289
#define yacc_EOF 290
#line 21 "./parse.y"
#line 21 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
#include "config.h"
@ -189,7 +189,7 @@ static int function_bstart;
static REDIRECTEE redir;
#line 171 "./parse.y"
#line 171 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
typedef union {
WORD_DESC *word; /* the word that we read. */
int number; /* the number that we read. */
@ -1071,7 +1071,7 @@ yyreduce:
switch (yyn) {
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
safety net,and return the command just parsed. */
@ -1082,7 +1082,7 @@ case 1:
;
break;}
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
interesting one. Return a NULL command. */
@ -1091,7 +1091,7 @@ case 2:
;
break;}
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. */
global_command = (COMMAND *)NULL;
@ -1108,7 +1108,7 @@ case 3:
;
break;}
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
not. */
@ -1118,57 +1118,57 @@ case 4:
;
break;}
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); ;
break;}
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); ;
break;}
case 7:
#line 262 "./parse.y"
#line 262 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{
redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (1, r_output_direction, redir);
;
break;}
case 8:
#line 267 "./parse.y"
#line 267 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{
redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (0, r_input_direction, redir);
;
break;}
case 9:
#line 272 "./parse.y"
#line 272 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{
redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (yyvsp[-2].number, r_output_direction, redir);
;
break;}
case 10:
#line 277 "./parse.y"
#line 277 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{
redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (yyvsp[-2].number, r_input_direction, redir);
;
break;}
case 11:
#line 282 "./parse.y"
#line 282 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{
redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (1, r_appending_to, redir);
;
break;}
case 12:
#line 287 "./parse.y"
#line 287 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{
redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (yyvsp[-2].number, r_appending_to, redir);
;
break;}
case 13:
#line 292 "./parse.y"
#line 292 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{
redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (0, r_reading_until, redir);
@ -1176,7 +1176,7 @@ case 13:
;
break;}
case 14:
#line 298 "./parse.y"
#line 298 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{
redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (yyvsp[-2].number, r_reading_until, redir);
@ -1184,63 +1184,63 @@ case 14:
;
break;}
case 15:
#line 304 "./parse.y"
#line 304 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{
redir.dest = yyvsp[0].number;
yyval.redirect = make_redirection (0, r_duplicating_input, redir);
;
break;}
case 16:
#line 309 "./parse.y"
#line 309 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{
redir.dest = yyvsp[0].number;
yyval.redirect = make_redirection (yyvsp[-2].number, r_duplicating_input, redir);
;
break;}
case 17:
#line 314 "./parse.y"
#line 314 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{
redir.dest = yyvsp[0].number;
yyval.redirect = make_redirection (1, r_duplicating_output, redir);
;
break;}
case 18:
#line 319 "./parse.y"
#line 319 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{
redir.dest = yyvsp[0].number;
yyval.redirect = make_redirection (yyvsp[-2].number, r_duplicating_output, redir);
;
break;}
case 19:
#line 324 "./parse.y"
#line 324 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{
redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (0, r_duplicating_input_word, redir);
;
break;}
case 20:
#line 329 "./parse.y"
#line 329 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{
redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (yyvsp[-2].number, r_duplicating_input_word, redir);
;
break;}
case 21:
#line 334 "./parse.y"
#line 334 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{
redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (1, r_duplicating_output_word, redir);
;
break;}
case 22:
#line 339 "./parse.y"
#line 339 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{
redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (yyvsp[-2].number, r_duplicating_output_word, redir);
;
break;}
case 23:
#line 344 "./parse.y"
#line 344 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{
redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection
@ -1249,7 +1249,7 @@ case 23:
;
break;}
case 24:
#line 351 "./parse.y"
#line 351 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{
redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection
@ -1258,88 +1258,88 @@ case 24:
;
break;}
case 25:
#line 358 "./parse.y"
#line 358 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{
redir.dest = 0L;
yyval.redirect = make_redirection (1, r_close_this, redir);
;
break;}
case 26:
#line 363 "./parse.y"
#line 363 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{
redir.dest = 0L;
yyval.redirect = make_redirection (yyvsp[-2].number, r_close_this, redir);
;
break;}
case 27:
#line 368 "./parse.y"
#line 368 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{
redir.dest = 0L;
yyval.redirect = make_redirection (0, r_close_this, redir);
;
break;}
case 28:
#line 373 "./parse.y"
#line 373 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{
redir.dest = 0L;
yyval.redirect = make_redirection (yyvsp[-2].number, r_close_this, redir);
;
break;}
case 29:
#line 378 "./parse.y"
#line 378 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{
redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (1, r_err_and_out, redir);
;
break;}
case 30:
#line 383 "./parse.y"
#line 383 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{
redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (yyvsp[-2].number, r_input_output, redir);
;
break;}
case 31:
#line 388 "./parse.y"
#line 388 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{
redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (0, r_input_output, redir);
;
break;}
case 32:
#line 393 "./parse.y"
#line 393 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{
redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (1, r_output_force, redir);
;
break;}
case 33:
#line 398 "./parse.y"
#line 398 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{
redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (yyvsp[-2].number, r_output_force, redir);
;
break;}
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; ;
break;}
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; ;
break;}
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; ;
break;}
case 37:
#line 413 "./parse.y"
#line 413 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{
yyval.redirect = yyvsp[0].redirect;
;
break;}
case 38:
#line 417 "./parse.y"
#line 417 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{
register REDIRECT *t;
@ -1350,23 +1350,23 @@ case 38:
;
break;}
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); ;
break;}
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); ;
break;}
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); ;
break;}
case 42:
#line 436 "./parse.y"
#line 436 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = yyvsp[0].command; ;
break;}
case 43:
#line 438 "./parse.y"
#line 438 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{
COMMAND *tc;
@ -1395,191 +1395,191 @@ case 43:
;
break;}
case 44:
#line 467 "./parse.y"
#line 467 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = yyvsp[0].command; ;
break;}
case 45:
#line 469 "./parse.y"
#line 469 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = yyvsp[0].command; ;
break;}
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); ;
break;}
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); ;
break;}
case 48:
#line 475 "./parse.y"
#line 475 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = yyvsp[0].command; ;
break;}
case 49:
#line 477 "./parse.y"
#line 477 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = yyvsp[0].command; ;
break;}
case 50:
#line 479 "./parse.y"
#line 479 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = yyvsp[0].command; ;
break;}
case 51:
#line 481 "./parse.y"
#line 481 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = yyvsp[0].command; ;
break;}
case 52:
#line 483 "./parse.y"
#line 483 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = yyvsp[0].command; ;
break;}
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); ;
break;}
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); ;
break;}
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); ;
break;}
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); ;
break;}
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); ;
break;}
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); ;
break;}
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);
;
break;}
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);
;
break;}
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);
;
break;}
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);
;
break;}
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);
;
break;}
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);
;
break;}
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); ;
break;}
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); ;
break;}
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); ;
break;}
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); ;
break;}
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); ;
break;}
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); ;
break;}
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; ;
break;}
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); ;
break;}
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); ;
break;}
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); ;
break;}
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); ;
break;}
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); ;
break;}
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); ;
break;}
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); ;
break;}
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; ;
break;}
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); ;
break;}
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); ;
break;}
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); ;
break;}
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); ;
break;}
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; ;
break;}
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); ;
break;}
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); ;
break;}
case 89:
#line 602 "./parse.y"
#line 602 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{
yyval.command = yyvsp[0].command;
if (need_here_doc)
@ -1587,13 +1587,13 @@ case 89:
;
break;}
case 91:
#line 611 "./parse.y"
#line 611 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{
yyval.command = yyvsp[0].command;
;
break;}
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)
yyval.command = connect_async_list (yyvsp[-2].command, (COMMAND *)NULL, '&');
@ -1602,15 +1602,15 @@ case 93:
;
break;}
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); ;
break;}
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); ;
break;}
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)
yyval.command = connect_async_list (yyvsp[-3].command, yyvsp[0].command, '&');
@ -1619,19 +1619,19 @@ case 97:
;
break;}
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, ';'); ;
break;}
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, ';'); ;
break;}
case 100:
#line 644 "./parse.y"
#line 644 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = yyvsp[0].command; ;
break;}
case 106:
#line 663 "./parse.y"
#line 663 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{
yyval.command = yyvsp[0].command;
if (need_here_doc)
@ -1639,7 +1639,7 @@ case 106:
;
break;}
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)
yyval.command = connect_async_list (yyvsp[-1].command, (COMMAND *)NULL, '&');
@ -1650,7 +1650,7 @@ case 107:
;
break;}
case 108:
#line 678 "./parse.y"
#line 678 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{
yyval.command = yyvsp[-1].command;
if (need_here_doc)
@ -1658,15 +1658,15 @@ case 108:
;
break;}
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); ;
break;}
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); ;
break;}
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)
yyval.command = connect_async_list (yyvsp[-2].command, yyvsp[0].command, '&');
@ -1675,59 +1675,59 @@ case 111:
;
break;}
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, ';'); ;
break;}
case 113:
#line 700 "./parse.y"
#line 700 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = yyvsp[0].command; ;
break;}
case 114:
#line 704 "./parse.y"
#line 704 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = yyvsp[0].command; ;
break;}
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;
yyval.command = yyvsp[0].command;
;
break;}
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;
yyval.command = yyvsp[0].command;
;
break;}
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;
yyval.command = yyvsp[0].command;
;
break;}
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;
yyval.command = yyvsp[0].command;
;
break;}
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, '|'); ;
break;}
case 120:
#line 731 "./parse.y"
#line 731 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.command = yyvsp[0].command; ;
break;}
case 121:
#line 735 "./parse.y"
#line 735 "/usr/homes/chet/src/bash/bash-2.01.1/parse.y"
{ yyval.number = CMD_TIME_PIPELINE; ;
break;}
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; ;
break;}
}
@ -1928,7 +1928,7 @@ yyerrhandle:
yystate = yyn;
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. */
@ -3722,7 +3722,7 @@ read_token_word (character)
#if defined (ARRAY_VARS)
/* Identify possible compound array variable assignment. */
else if (character == '=')
else if (character == '=' && token_index > 0)
{
peek_char = shell_getc (1);
if (peek_char == '(') /* ) */
@ -4270,6 +4270,7 @@ decode_prompt_string (string)
{
/* Use the value of PWD because it is much more efficient. */
char t_string[PATH_MAX];
int tlen;
temp = get_string_value ("PWD");
@ -4278,11 +4279,17 @@ decode_prompt_string (string)
if (getcwd (t_string, sizeof(t_string)) == 0)
{
t_string[0] = '.';
t_string[1] = '\0';
tlen = 1;
}
else
tlen = strlen (t_string);
}
else
strcpy (t_string, temp);
{
tlen = sizeof (t_string) - 1;
strncpy (t_string, temp, tlen);
}
t_string[tlen] = '\0';
if (c == 'W')
{
@ -4291,6 +4298,8 @@ decode_prompt_string (string)
strcpy (t_string, t + 1);
}
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));
/* If we're going to be expanding the prompt string later,