commit bash-20070503 snapshot

This commit is contained in:
Chet Ramey
2011-12-07 09:07:29 -05:00
parent b709b946e4
commit 641d8f00ab
29 changed files with 1539 additions and 90 deletions
+1 -1
View File
@@ -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
View File
@@ -266,7 +266,7 @@ bind_builtin (list)
run_unwind_frame ("bind_builtin");
return (return_code);
return (sh_chkwrite (return_code));
}
static int
+5 -11
View File
@@ -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);
+13
View File
@@ -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 */
+1
View File
@@ -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));
+2 -1
View File
@@ -528,7 +528,8 @@ print_cmd_completions (list)
ret = EXECUTION_FAILURE;
}
}
return (ret);
return (sh_chkwrite (ret));
}
$BUILTIN compgen
+6 -9
View File
@@ -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
View File
@@ -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
View File
@@ -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. */
+2 -2
View File
@@ -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
View File
@@ -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
View File
@@ -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
+6 -2
View File
@@ -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
View File
@@ -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
View File
@@ -111,5 +111,5 @@ times_builtin (list)
# endif /* HAVE_TIMES */
#endif /* !HAVE_TIMES */
return (EXECUTION_SUCCESS);
return (sh_chkwrite (EXECUTION_SUCCESS));
}
+2 -2
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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