mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-26 07:13:10 +02:00
commit bash-20070503 snapshot
This commit is contained in:
+41
-2
@@ -14537,6 +14537,45 @@ redir.c
|
||||
make sure all output is flushed before changing the underlying fd
|
||||
out from underneath stdio. Fix suggested by Eric Blake <ebb9@byu.net>
|
||||
|
||||
|
||||
4/30
|
||||
----
|
||||
|
||||
builtins/common.c
|
||||
- new function, sh_chkwrite(int), fflushes stdout and checks for error;
|
||||
printing an error message and returning a new exit status if there's
|
||||
an error on stdout. Takes exit status as argument; returns new exit
|
||||
status (EXECUTION_FAILURE if write error)
|
||||
|
||||
builtins/common.h
|
||||
- new extern declaration for sh_chkwrite
|
||||
|
||||
builtins/{alias,cd,complete,echo,fc,history,pushd,shopt,times,trap,type,ulimit,umask}.def
|
||||
- change to use sh_chkwrite to report write errors
|
||||
|
||||
builtins/fc.def
|
||||
- if an error occurs while writing commands from the history to a file
|
||||
to be executed, report a write error and return failure without
|
||||
attempting to execute any commands
|
||||
|
||||
5/1
|
||||
---
|
||||
builtins/{bind,declare,set,setattr}.def
|
||||
- change to use sh_chkwrite to report write errors
|
||||
|
||||
5/2
|
||||
---
|
||||
lib/readline/input.c
|
||||
- fix probable off-by-one error in ibuffer_space () prompted by bug
|
||||
report from Tom Bjorkholm <tom.bjorkholm@ericsson.com>
|
||||
- fix off-by-one errors in _rl_get_char (pop_index) and rl_stuff_char
|
||||
(push_index) that caused the 511th character in the buffer to be
|
||||
discarded. Fixes bug reported by Tom Bjorkholm <tom.bjorkholm@ericsson.com>
|
||||
|
||||
5/5
|
||||
---
|
||||
print_cmd.c
|
||||
- added logic (inside_pipeline variable) to print_connection code and
|
||||
print_redirection to handle the case of a command with a here
|
||||
document inside a pipeline. In that case, print_redirection prints
|
||||
the `|' before the here document text, so the parser knows the
|
||||
command is continued. Fixes problem with exporting functions with
|
||||
pipelines like this reported by Chris Lesner <chris.lesner@gmail.com>
|
||||
|
||||
@@ -14536,3 +14536,46 @@ redir.c
|
||||
is the same one used by the stdout stream, call fflush(stdout) to
|
||||
make sure all output is flushed before changing the underlying fd
|
||||
out from underneath stdio. Fix suggested by Eric Blake <ebb9@byu.net>
|
||||
|
||||
|
||||
4/30
|
||||
----
|
||||
|
||||
builtins/common.c
|
||||
- new function, sh_chkwrite(int), fflushes stdout and checks for error;
|
||||
printing an error message and returning a new exit status if there's
|
||||
an error on stdout. Takes exit status as argument; returns new exit
|
||||
status (EXECUTION_FAILURE if write error)
|
||||
|
||||
builtins/common.h
|
||||
- new extern declaration for sh_chkwrite
|
||||
|
||||
builtins/{alias,cd,complete,echo,fc,history,pushd,shopt,times,trap,type,ulimit,umask}.def
|
||||
- change to use sh_chkwrite to report write errors
|
||||
|
||||
builtins/fc.def
|
||||
- if an error occurs while writing commands from the history to a file
|
||||
to be executed, report a write error and return failure without
|
||||
attempting to execute any commands
|
||||
|
||||
5/1
|
||||
---
|
||||
builtins/{bind,declare,set,setattr}.def
|
||||
- change to use sh_chkwrite to report write errors
|
||||
|
||||
5/2
|
||||
---
|
||||
lib/readline/input.c
|
||||
- fix off-by-one errors in _rl_get_char (pop_index) and rl_stuff_char
|
||||
(push_index) that caused the 511th character in the buffer to be
|
||||
discarded. Fixes bug reported by Tom Bjorkholm <tom.bjorkholm@ericsson.com>
|
||||
|
||||
5/5
|
||||
---
|
||||
print_cmd.c
|
||||
- added logic (inside_pipeline variable) to print_connection code and
|
||||
print_redirection to handle the case of a command with a here
|
||||
document inside a pipeline. In that case, print_redirection prints
|
||||
the `|' before the here document text, so the parser knows the
|
||||
command is continued. Fixes problem reported by Chris Lesner
|
||||
<chris.lesner@gmail.com>
|
||||
|
||||
+1
-1
@@ -103,7 +103,7 @@ alias_builtin (list)
|
||||
free (alias_list); /* XXX - Do not free the strings. */
|
||||
|
||||
if (list == 0)
|
||||
return (EXECUTION_SUCCESS);
|
||||
return (sh_chkwrite (EXECUTION_SUCCESS));
|
||||
}
|
||||
|
||||
any_failed = 0;
|
||||
|
||||
+1
-1
@@ -266,7 +266,7 @@ bind_builtin (list)
|
||||
|
||||
run_unwind_frame ("bind_builtin");
|
||||
|
||||
return (return_code);
|
||||
return (sh_chkwrite (return_code));
|
||||
}
|
||||
|
||||
static int
|
||||
|
||||
+5
-11
@@ -108,9 +108,11 @@ bindpwd (no_symlinks)
|
||||
int no_symlinks;
|
||||
{
|
||||
char *dirname, *pwdvar;
|
||||
int old_anm;
|
||||
int old_anm, r;
|
||||
SHELL_VAR *tvar;
|
||||
|
||||
r = sh_chkwrite (EXECUTION_SUCCESS);
|
||||
|
||||
#define tcwd the_current_working_directory
|
||||
dirname = tcwd ? (no_symlinks ? sh_physpath (tcwd, 0) : tcwd)
|
||||
: get_working_directory ("cd");
|
||||
@@ -131,7 +133,7 @@ bindpwd (no_symlinks)
|
||||
if (dirname && dirname != the_current_working_directory)
|
||||
free (dirname);
|
||||
|
||||
return (EXECUTION_SUCCESS);
|
||||
return (r);
|
||||
}
|
||||
|
||||
/* Call get_working_directory to reset the value of
|
||||
@@ -375,15 +377,7 @@ pwd_builtin (list)
|
||||
setpwd (directory);
|
||||
if (directory != the_current_working_directory)
|
||||
free (directory);
|
||||
fflush (stdout);
|
||||
if (ferror (stdout))
|
||||
{
|
||||
sh_wrerror ();
|
||||
clearerr (stdout);
|
||||
return (EXECUTION_FAILURE);
|
||||
}
|
||||
|
||||
return (EXECUTION_SUCCESS);
|
||||
return (sh_chkwrite (EXECUTION_SUCCESS));
|
||||
}
|
||||
else
|
||||
return (EXECUTION_FAILURE);
|
||||
|
||||
@@ -277,6 +277,19 @@ sh_wrerror ()
|
||||
builtin_error (_("write error: %s"), strerror (errno));
|
||||
}
|
||||
|
||||
int
|
||||
sh_chkwrite (s)
|
||||
{
|
||||
fflush (stdout);
|
||||
if (ferror (stdout))
|
||||
{
|
||||
sh_wrerror ();
|
||||
clearerr (stdout);
|
||||
return (EXECUTION_FAILURE);
|
||||
}
|
||||
return (s);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Shell positional parameter manipulation */
|
||||
|
||||
@@ -78,6 +78,7 @@ extern void sh_nojobs __P((char *));
|
||||
extern void sh_restricted __P((char *));
|
||||
extern void sh_notbuiltin __P((char *));
|
||||
extern void sh_wrerror __P((void));
|
||||
extern int sh_chkwrite __P((int));
|
||||
|
||||
extern char **make_builtin_argv __P((WORD_LIST *, int *));
|
||||
extern void remember_args __P((WORD_LIST *, int));
|
||||
|
||||
@@ -528,7 +528,8 @@ print_cmd_completions (list)
|
||||
ret = EXECUTION_FAILURE;
|
||||
}
|
||||
}
|
||||
return (ret);
|
||||
|
||||
return (sh_chkwrite (ret));
|
||||
}
|
||||
|
||||
$BUILTIN compgen
|
||||
|
||||
@@ -191,16 +191,12 @@ declare_internal (list, local_var)
|
||||
free (vlist);
|
||||
}
|
||||
}
|
||||
else if (flags_on == 0)
|
||||
return (set_builtin ((WORD_LIST *)NULL));
|
||||
else
|
||||
{
|
||||
if (flags_on == 0)
|
||||
set_builtin ((WORD_LIST *)NULL);
|
||||
else
|
||||
set_or_show_attributes ((WORD_LIST *)NULL, flags_on, nodefs);
|
||||
}
|
||||
set_or_show_attributes ((WORD_LIST *)NULL, flags_on, nodefs);
|
||||
|
||||
fflush (stdout);
|
||||
return (EXECUTION_SUCCESS);
|
||||
return (sh_chkwrite (EXECUTION_SUCCESS));
|
||||
}
|
||||
|
||||
if (pflag) /* declare -p [-afFirtx] name [name...] */
|
||||
@@ -214,7 +210,7 @@ declare_internal (list, local_var)
|
||||
any_failed++;
|
||||
}
|
||||
}
|
||||
return (any_failed ? EXECUTION_FAILURE : EXECUTION_SUCCESS);
|
||||
return (sh_chkwrite (any_failed ? EXECUTION_FAILURE : EXECUTION_SUCCESS));
|
||||
}
|
||||
|
||||
#define NEXT_VARIABLE() free (name); list = list->next; continue
|
||||
@@ -338,6 +334,7 @@ declare_internal (list, local_var)
|
||||
t = nodefs ? var->name
|
||||
: named_function_string (name, function_cell (var), 1);
|
||||
printf ("%s\n", t);
|
||||
any_failed = sh_chkwrite (any_failed);
|
||||
}
|
||||
}
|
||||
else /* declare -[fF] -[rx] name [name...] */
|
||||
|
||||
+1
-8
@@ -177,12 +177,5 @@ just_echo:
|
||||
|
||||
if (display_return)
|
||||
putchar ('\n');
|
||||
fflush (stdout);
|
||||
if (ferror (stdout))
|
||||
{
|
||||
sh_wrerror ();
|
||||
clearerr (stdout);
|
||||
return (EXECUTION_FAILURE);
|
||||
}
|
||||
return (EXECUTION_SUCCESS);
|
||||
return (sh_chkwrite (EXECUTION_SUCCESS));
|
||||
}
|
||||
|
||||
+8
-1
@@ -368,8 +368,15 @@ fc_builtin (list)
|
||||
}
|
||||
|
||||
if (listing)
|
||||
return (EXECUTION_SUCCESS);
|
||||
return (sh_chkwrite (EXECUTION_SUCCESS));
|
||||
|
||||
fflush (stream);
|
||||
if (ferror (stream))
|
||||
{
|
||||
sh_wrerror ();
|
||||
fclose (stream);
|
||||
return (EXECUTION_FAILURE);
|
||||
}
|
||||
fclose (stream);
|
||||
|
||||
/* Now edit the file of commands. */
|
||||
|
||||
@@ -170,7 +170,7 @@ history_builtin (list)
|
||||
{
|
||||
if (list)
|
||||
return (expand_and_print_history (list));
|
||||
return (EXECUTION_SUCCESS);
|
||||
return (sh_chkwrite (EXECUTION_SUCCESS));
|
||||
}
|
||||
#endif
|
||||
else if (flags & DFLAG)
|
||||
@@ -193,7 +193,7 @@ history_builtin (list)
|
||||
else if ((flags & (AFLAG|RFLAG|NFLAG|WFLAG|CFLAG)) == 0)
|
||||
{
|
||||
display_history (list);
|
||||
return (EXECUTION_SUCCESS);
|
||||
return (sh_chkwrite (EXECUTION_SUCCESS));
|
||||
}
|
||||
|
||||
filename = list ? list->word->word : get_string_value ("HISTFILE");
|
||||
|
||||
+3
-3
@@ -448,7 +448,7 @@ dirs_builtin (list)
|
||||
if (index_flag)
|
||||
{
|
||||
putchar ('\n');
|
||||
return EXECUTION_SUCCESS;
|
||||
return (sh_chkwrite (EXECUTION_SUCCESS));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -473,8 +473,8 @@ dirs_builtin (list)
|
||||
printf ("%s%s", (vflag & 1) ? "\n" : " ", DIRSTACK_ENTRY (i));
|
||||
|
||||
putchar ('\n');
|
||||
fflush (stdout);
|
||||
return (EXECUTION_SUCCESS);
|
||||
|
||||
return (sh_chkwrite (EXECUTION_SUCCESS));
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
+5
-3
@@ -580,17 +580,18 @@ int
|
||||
set_builtin (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
int on_or_off, flag_name, force_assignment, opts_changed;
|
||||
int on_or_off, flag_name, force_assignment, opts_changed, rv;
|
||||
register char *arg;
|
||||
char s[3];
|
||||
|
||||
if (list == 0)
|
||||
{
|
||||
print_all_shell_variables ();
|
||||
return (EXECUTION_SUCCESS);
|
||||
return (sh_chkwrite (EXECUTION_SUCCESS));
|
||||
}
|
||||
|
||||
/* Check validity of flag arguments. */
|
||||
rv = EXECUTION_SUCCESS;
|
||||
reset_internal_getopt ();
|
||||
while ((flag_name = internal_getopt (list, optflags)) != -1)
|
||||
{
|
||||
@@ -653,6 +654,7 @@ set_builtin (list)
|
||||
if (opt == 0)
|
||||
{
|
||||
list_minus_o_opts (-1, (on_or_off == '+'));
|
||||
rv = sh_chkwrite (rv);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -699,7 +701,7 @@ set_builtin (list)
|
||||
/* Set up new value of $SHELLOPTS */
|
||||
if (opts_changed)
|
||||
set_shellopts ();
|
||||
return (EXECUTION_SUCCESS);
|
||||
return (rv);
|
||||
}
|
||||
|
||||
$BUILTIN unset
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
This file is setattr.def, from which is created setattr.c.
|
||||
It implements the builtins "export" and "readonly", in Bash.
|
||||
|
||||
Copyright (C) 1987-2006 Free Software Foundation, Inc.
|
||||
Copyright (C) 1987-2007 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -268,7 +268,11 @@ set_or_show_attributes (list, attribute, nodefs)
|
||||
continue;
|
||||
#endif
|
||||
if ((var->attributes & attribute))
|
||||
show_var_attributes (var, READONLY_OR_EXPORT, nodefs);
|
||||
{
|
||||
show_var_attributes (var, READONLY_OR_EXPORT, nodefs);
|
||||
if (any_failed = sh_chkwrite (any_failed))
|
||||
break;
|
||||
}
|
||||
}
|
||||
free (variable_list);
|
||||
}
|
||||
|
||||
+7
-7
@@ -352,7 +352,7 @@ list_shopts (list, flags)
|
||||
if ((flags & QFLAG) == 0)
|
||||
print_shopt (shopt_vars[i].name, val, flags);
|
||||
}
|
||||
return (EXECUTION_SUCCESS);
|
||||
return (sh_chkwrite (EXECUTION_SUCCESS));
|
||||
}
|
||||
|
||||
for (l = list, rval = EXECUTION_SUCCESS; l; l = l->next)
|
||||
@@ -371,7 +371,7 @@ list_shopts (list, flags)
|
||||
print_shopt (l->word->word, val, flags);
|
||||
}
|
||||
|
||||
return (rval);
|
||||
return (sh_chkwrite (rval));
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -386,7 +386,7 @@ list_some_shopts (mode, flags)
|
||||
if (((flags & QFLAG) == 0) && mode == val)
|
||||
print_shopt (shopt_vars[i].name, val, flags);
|
||||
}
|
||||
return (EXECUTION_SUCCESS);
|
||||
return (sh_chkwrite (EXECUTION_SUCCESS));
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -401,7 +401,7 @@ list_shopt_o_options (list, flags)
|
||||
{
|
||||
if ((flags & QFLAG) == 0)
|
||||
list_minus_o_opts (-1, (flags & PFLAG));
|
||||
return (EXECUTION_SUCCESS);
|
||||
return (sh_chkwrite (EXECUTION_SUCCESS));
|
||||
}
|
||||
|
||||
for (l = list, rval = EXECUTION_SUCCESS; l; l = l->next)
|
||||
@@ -423,7 +423,7 @@ list_shopt_o_options (list, flags)
|
||||
printf (OPTFMT, l->word->word, val ? on : off);
|
||||
}
|
||||
}
|
||||
return (rval);
|
||||
return (sh_chkwrite (rval));
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -432,7 +432,7 @@ list_some_o_options (mode, flags)
|
||||
{
|
||||
if ((flags & QFLAG) == 0)
|
||||
list_minus_o_opts (mode, (flags & PFLAG));
|
||||
return (EXECUTION_SUCCESS);
|
||||
return (sh_chkwrite (EXECUTION_SUCCESS));
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -540,5 +540,5 @@ shopt_listopt (name, reusable)
|
||||
}
|
||||
|
||||
print_shopt (name, *shopt_vars[i].value, reusable ? PFLAG : 0);
|
||||
return (EXECUTION_SUCCESS);
|
||||
return (sh_chkwrite (EXECUTION_SUCCESS));
|
||||
}
|
||||
|
||||
+1
-1
@@ -111,5 +111,5 @@ times_builtin (list)
|
||||
# endif /* HAVE_TIMES */
|
||||
#endif /* !HAVE_TIMES */
|
||||
|
||||
return (EXECUTION_SUCCESS);
|
||||
return (sh_chkwrite (EXECUTION_SUCCESS));
|
||||
}
|
||||
|
||||
+2
-2
@@ -112,9 +112,9 @@ trap_builtin (list)
|
||||
opt = DSIG_NOCASE|DSIG_SIGPREFIX; /* flags for decode_signal */
|
||||
|
||||
if (list_signal_names)
|
||||
return (display_signal_list ((WORD_LIST *)NULL, 1));
|
||||
return (sh_chkwrite (display_signal_list ((WORD_LIST *)NULL, 1)));
|
||||
else if (display || list == 0)
|
||||
return (display_traps (list));
|
||||
return (sh_chkwrite (display_traps (list)));
|
||||
else
|
||||
{
|
||||
char *first_arg;
|
||||
|
||||
+2
-3
@@ -185,9 +185,8 @@ type_builtin (list)
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
fflush (stdout);
|
||||
|
||||
return ((successful_finds != 0) ? EXECUTION_SUCCESS : EXECUTION_FAILURE);
|
||||
opt = (successful_finds != 0) ? EXECUTION_SUCCESS : EXECUTION_FAILURE;
|
||||
return (sh_chkwrite (opt));
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+1
-1
@@ -356,7 +356,7 @@ ulimit_builtin (list)
|
||||
}
|
||||
#endif
|
||||
print_all_limits (mode == 0 ? LIMIT_SOFT : mode);
|
||||
return (EXECUTION_SUCCESS);
|
||||
return (sh_chkwrite (EXECUTION_SUCCESS));
|
||||
}
|
||||
|
||||
/* default is `ulimit -f' */
|
||||
|
||||
+1
-2
@@ -137,8 +137,7 @@ umask_builtin (list)
|
||||
printf ("%04lo\n", (unsigned long)umask_arg);
|
||||
}
|
||||
|
||||
fflush (stdout);
|
||||
return (EXECUTION_SUCCESS);
|
||||
return (sh_chkwrite (EXECUTION_SUCCESS));
|
||||
}
|
||||
|
||||
/* Print the umask in a symbolic form. In the output, a letter is
|
||||
|
||||
+7
-5
@@ -5,12 +5,12 @@
|
||||
.\" Case Western Reserve University
|
||||
.\" chet@po.cwru.edu
|
||||
.\"
|
||||
.\" Last Change: Fri Jan 12 16:29:22 EST 2007
|
||||
.\" Last Change: Tue May 1 10:05:17 EDT 2007
|
||||
.\"
|
||||
.\" bash_builtins, strip all but Built-Ins section
|
||||
.if \n(zZ=1 .ig zZ
|
||||
.if \n(zY=1 .ig zY
|
||||
.TH BASH 1 "2007 January 12" "GNU Bash-3.2"
|
||||
.TH BASH 1 "2007 May 1" "GNU Bash-3.2"
|
||||
.\"
|
||||
.\" There's some problem with having a `@'
|
||||
.\" in a tagged paragraph with the BSD man macros.
|
||||
@@ -645,7 +645,8 @@ The return status is the exit status of
|
||||
Note that unlike the metacharacters \fB(\fP and \fB)\fP, \fB{\fP and
|
||||
\fB}\fP are \fIreserved words\fP and must occur where a reserved
|
||||
word is permitted to be recognized. Since they do not cause a word
|
||||
break, they must be separated from \fIlist\fP by whitespace.
|
||||
break, they must be separated from \fIlist\fP by whitespace or another
|
||||
shell metacharacter.
|
||||
.TP
|
||||
((\fIexpression\fP))
|
||||
The \fIexpression\fP is evaluated according to the rules described
|
||||
@@ -8318,6 +8319,7 @@ an argument of \fB\-\-\fP as signifying the end of options.
|
||||
.if n .sp 1
|
||||
Expressions may be combined using the following operators, listed
|
||||
in decreasing order of precedence.
|
||||
The evaluation depends on the number of arguments; see below.
|
||||
.RS
|
||||
.PD 0
|
||||
.TP
|
||||
@@ -8375,14 +8377,14 @@ under
|
||||
.BR "CONDITIONAL EXPRESSIONS" ,
|
||||
the result of the expression is the result of the binary test using
|
||||
the first and third arguments as operands.
|
||||
The \fB\-a\fP and \fB\-o\fP operators are considered binary operators
|
||||
when there are three arguments.
|
||||
If the first argument is \fB!\fP, the value is the negation of
|
||||
the two-argument test using the second and third arguments.
|
||||
If the first argument is exactly \fB(\fP and the third argument is
|
||||
exactly \fB)\fP, the result is the one-argument test of the second
|
||||
argument.
|
||||
Otherwise, the expression is false.
|
||||
The \fB\-a\fP and \fB\-o\fP operators are considered binary operators
|
||||
in this case.
|
||||
.TP
|
||||
4 arguments
|
||||
If the first argument is \fB!\fP, the result is the negation of
|
||||
|
||||
+7
-4
@@ -1041,7 +1041,8 @@ The semicolon (or newline) following @var{list} is required.
|
||||
In addition to the creation of a subshell, there is a subtle difference
|
||||
between these two constructs due to historical reasons. The braces
|
||||
are @code{reserved words}, so they must be separated from the @var{list}
|
||||
by @code{blank}s. The parentheses are @code{operators}, and are
|
||||
by @code{blank}s or other shell metacharacters.
|
||||
The parentheses are @code{operators}, and are
|
||||
recognized as separate tokens by the shell even if they are not separated
|
||||
from the @var{list} by whitespace.
|
||||
|
||||
@@ -1092,7 +1093,8 @@ Note that for historical reasons, in the most common usage the curly braces
|
||||
that surround the body of the function must be separated from the body by
|
||||
@code{blank}s or newlines.
|
||||
This is because the braces are reserved words and are only recognized
|
||||
as such when they are separated by whitespace.
|
||||
as such when they are separated from the command list
|
||||
by whitespace or another shell metacharacter.
|
||||
Also, when using the braces, the @var{list} must be terminated by a semicolon,
|
||||
a @samp{&}, or a newline.
|
||||
|
||||
@@ -2918,6 +2920,7 @@ be a @code{]}.
|
||||
|
||||
Expressions may be combined using the following operators, listed in
|
||||
decreasing order of precedence.
|
||||
The evaluation depends on the number of arguments; see below.
|
||||
|
||||
@table @code
|
||||
@item ! @var{expr}
|
||||
@@ -2958,14 +2961,14 @@ If the second argument is one of the binary conditional
|
||||
operators (@pxref{Bash Conditional Expressions}), the
|
||||
result of the expression is the result of the binary test using the
|
||||
first and third arguments as operands.
|
||||
The @samp{-a} and @samp{-o} operators are considered binary operators
|
||||
when there are three arguments.
|
||||
If the first argument is @samp{!}, the value is the negation of
|
||||
the two-argument test using the second and third arguments.
|
||||
If the first argument is exactly @samp{(} and the third argument is
|
||||
exactly @samp{)}, the result is the one-argument test of the second
|
||||
argument.
|
||||
Otherwise, the expression is false.
|
||||
The @samp{-a} and @samp{-o} operators are considered binary operators
|
||||
in this case.
|
||||
|
||||
@item 4 arguments
|
||||
If the first argument is @samp{!}, the result is the negation of
|
||||
|
||||
+3
-3
@@ -2,9 +2,9 @@
|
||||
Copyright (C) 1988-2007 Free Software Foundation, Inc.
|
||||
@end ignore
|
||||
|
||||
@set LASTCHANGE Fri Jan 12 16:29:58 EST 2007
|
||||
@set LASTCHANGE Tue May 1 10:05:36 EDT 2007
|
||||
|
||||
@set EDITION 3.2
|
||||
@set VERSION 3.2
|
||||
@set UPDATED 12 January 2007
|
||||
@set UPDATED-MONTH January 2007
|
||||
@set UPDATED 1 May 2007
|
||||
@set UPDATED-MONTH May 2007
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
N 3149) 5/1 To: peggy.gup@c Re: FW: Phone for Mike Dailey (2413 chars)N 3150) 5/1 Jason Cutcher RE: Phone for Mike Dailey (34705 chars)N 3151) 5/1 Wizards *****SPAM***** Relief (7291 chars)N 3152) 5/1 FCG Help Desk Case HD0000002533519, Medium, h (2537 chars)N 3153) 5/1 To: jrw11@case. HD0000002533519 (2247 chars)N 3154) 5/1 Peggy Watts Gup RE: [tis-staff] Boxes back to m (12903 chars)N 3155) 5/1 Debbie Andrews [firewall-changes] Firewa
|
||||
+11
-3
@@ -119,7 +119,7 @@ ibuffer_space ()
|
||||
if (pop_index > push_index)
|
||||
return (pop_index - push_index - 1);
|
||||
else
|
||||
return (ibuffer_len - (push_index - pop_index) - 1);
|
||||
return (ibuffer_len - (push_index - pop_index));
|
||||
}
|
||||
|
||||
/* Get a key from the buffer of characters to be read.
|
||||
@@ -133,8 +133,11 @@ rl_get_char (key)
|
||||
return (0);
|
||||
|
||||
*key = ibuffer[pop_index++];
|
||||
|
||||
#if 0
|
||||
if (pop_index >= ibuffer_len)
|
||||
#else
|
||||
if (pop_index > ibuffer_len)
|
||||
#endif
|
||||
pop_index = 0;
|
||||
|
||||
return (1);
|
||||
@@ -250,7 +253,8 @@ rl_gather_tyi ()
|
||||
while (chars_avail--)
|
||||
{
|
||||
k = (*rl_getc_function) (rl_instream);
|
||||
rl_stuff_char (k);
|
||||
if (rl_stuff_char (k) == 0)
|
||||
break; /* some problem; no more room */
|
||||
if (k == NEWLINE || k == RETURN)
|
||||
break;
|
||||
}
|
||||
@@ -373,7 +377,11 @@ rl_stuff_char (key)
|
||||
RL_SETSTATE (RL_STATE_INPUTPENDING);
|
||||
}
|
||||
ibuffer[push_index++] = key;
|
||||
#if 0
|
||||
if (push_index >= ibuffer_len)
|
||||
#else
|
||||
if (push_index > ibuffer_len)
|
||||
#endif
|
||||
push_index = 0;
|
||||
|
||||
return 1;
|
||||
|
||||
+35
-14
@@ -106,7 +106,15 @@ int command_string_index = 0;
|
||||
|
||||
/* Non-zero means the stuff being printed is inside of a function def. */
|
||||
static int inside_function_def;
|
||||
|
||||
/* Used to decide where to put the `|' if the command in the pipeline has
|
||||
here documents associated with it. If non-zero, print_redirection
|
||||
prints the `|' before the text of the here document and print_connection
|
||||
suppresses the `|'. */
|
||||
static int inside_pipeline;
|
||||
static int skip_this_indent;
|
||||
|
||||
/* Flag indicating we printed a here-document. */
|
||||
static int was_heredoc;
|
||||
|
||||
/* The depth of the group commands that we are currently printing. This
|
||||
@@ -133,7 +141,7 @@ char *
|
||||
make_command_string (command)
|
||||
COMMAND *command;
|
||||
{
|
||||
command_string_index = was_heredoc = 0;
|
||||
command_string_index = was_heredoc = inside_pipeline = 0;
|
||||
make_command_string_internal (command);
|
||||
return (the_printed_command);
|
||||
}
|
||||
@@ -215,7 +223,11 @@ make_command_string_internal (command)
|
||||
case cm_connection:
|
||||
|
||||
skip_this_indent++;
|
||||
if (command->value.Connection->connector == '|')
|
||||
inside_pipeline = 1;
|
||||
make_command_string_internal (command->value.Connection->first);
|
||||
if (command->value.Connection->connector == '|')
|
||||
inside_pipeline = 0;
|
||||
|
||||
switch (command->value.Connection->connector)
|
||||
{
|
||||
@@ -223,7 +235,10 @@ make_command_string_internal (command)
|
||||
case '|':
|
||||
{
|
||||
char c = command->value.Connection->connector;
|
||||
cprintf (" %c", c);
|
||||
if (c == '&' || was_heredoc == 0)
|
||||
cprintf (" %c", c);
|
||||
else
|
||||
was_heredoc = 0;
|
||||
if (c != '&' || command->value.Connection->second)
|
||||
{
|
||||
cprintf (" ");
|
||||
@@ -851,6 +866,10 @@ print_redirection_list (redirects)
|
||||
print the here documents. */
|
||||
if (heredocs)
|
||||
{
|
||||
if (inside_pipeline)
|
||||
{
|
||||
itrace("print_redirection_list: here documents inside pipeline");
|
||||
}
|
||||
cprintf (" ");
|
||||
for (hdtail = heredocs; hdtail; hdtail = hdtail->next)
|
||||
{
|
||||
@@ -868,6 +887,7 @@ print_redirection (redirect)
|
||||
{
|
||||
int kill_leading, redirector, redir_fd;
|
||||
WORD_DESC *redirectee;
|
||||
char *x;
|
||||
|
||||
kill_leading = 0;
|
||||
redirectee = redirect->redirectee.filename;
|
||||
@@ -905,17 +925,16 @@ print_redirection (redirect)
|
||||
if (redirector != 0)
|
||||
cprintf ("%d", redirector);
|
||||
/* If the here document delimiter is quoted, single-quote it. */
|
||||
if (redirect->redirectee.filename->flags & W_QUOTED)
|
||||
{
|
||||
char *x;
|
||||
x = sh_single_quote (redirect->here_doc_eof);
|
||||
cprintf ("<<%s%s\n", kill_leading? "-" : "", x);
|
||||
free (x);
|
||||
}
|
||||
else
|
||||
cprintf ("<<%s%s\n", kill_leading? "-" : "", redirect->here_doc_eof);
|
||||
cprintf ("%s%s",
|
||||
redirect->redirectee.filename->word, redirect->here_doc_eof);
|
||||
x = (redirect->redirectee.filename->flags & W_QUOTED)
|
||||
? sh_single_quote (redirect->here_doc_eof)
|
||||
: redirect->here_doc_eof;
|
||||
cprintf ("<<%s%s", kill_leading? "-" : "", x);
|
||||
if (x != redirect->here_doc_eof)
|
||||
free (x);
|
||||
if (inside_pipeline)
|
||||
cprintf (" |");
|
||||
cprintf ("\n");
|
||||
cprintf ("%s%s", redirect->redirectee.filename->word, redirect->here_doc_eof);
|
||||
break;
|
||||
|
||||
case r_reading_string:
|
||||
@@ -991,6 +1010,7 @@ reset_locals ()
|
||||
{
|
||||
inside_function_def = 0;
|
||||
indentation = 0;
|
||||
inside_pipeline = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1010,7 +1030,7 @@ print_function_def (func)
|
||||
inside_function_def++;
|
||||
indentation += indentation_amount;
|
||||
|
||||
cmdcopy = copy_command (func->command);
|
||||
cmdcopy = copy_command (func->command); /* possible mem leak on unwind-protect */
|
||||
if (cmdcopy->type == cm_group)
|
||||
{
|
||||
func_redirects = cmdcopy->redirects;
|
||||
@@ -1055,6 +1075,7 @@ named_function_string (name, command, multi_line)
|
||||
old_indent = indentation;
|
||||
old_amount = indentation_amount;
|
||||
command_string_index = was_heredoc = 0;
|
||||
inside_pipeline = 0;
|
||||
|
||||
if (name && *name)
|
||||
cprintf ("%s ", name);
|
||||
|
||||
+1322
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -1,4 +1,4 @@
|
||||
BUILD_DIR=/usr/local/build/chet/bash/bash-current
|
||||
BUILD_DIR=/usr/local/build/bash/bash-current
|
||||
THIS_SH=$BUILD_DIR/bash
|
||||
PATH=$PATH:$BUILD_DIR
|
||||
|
||||
|
||||
Reference in New Issue
Block a user