summaryrefslogtreecommitdiff
path: root/builtins
diff options
context:
space:
mode:
authorJari Aalto <jari.aalto@cante.net>2006-10-10 14:15:34 +0000
committerJari Aalto <jari.aalto@cante.net>2009-09-12 16:46:58 +0000
commit0628567a28f3510f506ae46cb9b24b73a6d2dc5d (patch)
treeda84934c41272cdc655694846c15c1c5db807445 /builtins
parent95732b497d12c98613bb3c5db16b61f377501a59 (diff)
downloadbash-0628567a28f3510f506ae46cb9b24b73a6d2dc5d.tar.gz
Imported from ../bash-3.2.tar.gz.
Diffstat (limited to 'builtins')
-rw-r--r--builtins/Makefile.in4
-rw-r--r--builtins/caller.def5
-rw-r--r--builtins/cd.def1
-rw-r--r--builtins/common.c3
-rw-r--r--builtins/common.h2
-rw-r--r--builtins/declare.def9
-rw-r--r--builtins/echo.def5
-rw-r--r--builtins/evalfile.c2
-rw-r--r--builtins/evalstring.c5
-rw-r--r--builtins/fc.def1
-rw-r--r--builtins/hash.def8
-rw-r--r--builtins/mkbuiltins.c29
-rw-r--r--builtins/printf.def18
-rw-r--r--builtins/pushd.def12
-rw-r--r--builtins/read.def33
-rw-r--r--builtins/reserved.def34
-rw-r--r--builtins/set.def1
-rw-r--r--builtins/source.def4
-rw-r--r--builtins/suspend.def4
-rw-r--r--builtins/trap.def11
-rw-r--r--builtins/ulimit.def16
-rw-r--r--builtins/wait.def1
22 files changed, 140 insertions, 68 deletions
diff --git a/builtins/Makefile.in b/builtins/Makefile.in
index 965b8bd8..e027f7aa 100644
--- a/builtins/Makefile.in
+++ b/builtins/Makefile.in
@@ -16,7 +16,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
-PACKAGE = @PACKAGE@
+PACKAGE = @PACKAGE_NAME@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
@@ -178,7 +178,7 @@ helpdoc: $(MKBUILTINS) $(DEFSRC)
install-help:
@-if test -n "${HELPDIR}" && test -d helpfiles ; then \
- test -d ${HELPDIR} || ${SHELL} ${MKDIRS} $(DESTDIR)$(HELPDIR) ;\
+ test -d $(DESTDIR)${HELPDIR} || ${SHELL} ${MKDIRS} $(DESTDIR)$(HELPDIR) ;\
( for f in helpfiles/*; do \
echo installing $$f; \
${INSTALL_DATA} $$f $(DESTDIR)$(HELPDIR); \
diff --git a/builtins/caller.def b/builtins/caller.def
index 5142cab9..f5f2c083 100644
--- a/builtins/caller.def
+++ b/builtins/caller.def
@@ -28,9 +28,9 @@ $SHORT_DOC caller [EXPR]
Returns the context of the current subroutine call.
-Without EXPR, returns returns "$line $filename". With EXPR,
+Without EXPR, returns "$line $filename". With EXPR,
returns "$line $subroutine $filename"; this extra information
-can be used used to provide a stack trace.
+can be used to provide a stack trace.
The value of EXPR indicates how many call frames to go back before the
current one; the top frame is frame 0.
@@ -76,7 +76,6 @@ caller_builtin (list)
SHELL_VAR *funcname_v, *bash_source_v, *bash_lineno_v;
ARRAY *funcname_a, *bash_source_a, *bash_lineno_a;
char *funcname_s, *source_s, *lineno_s;
- ARRAY_ELEMENT *ae;
intmax_t num;
GET_ARRAY_FROM_VAR ("FUNCNAME", funcname_v, funcname_a);
diff --git a/builtins/cd.def b/builtins/cd.def
index 025e4f5e..54e328e4 100644
--- a/builtins/cd.def
+++ b/builtins/cd.def
@@ -60,6 +60,7 @@ extern char *bash_getcwd_errstr;
static int bindpwd __P((int));
static void setpwd __P((char *));
+static char *resetpwd __P((char *));
static int change_to_directory __P((char *, int));
static char *cdspell __P((char *));
diff --git a/builtins/common.c b/builtins/common.c
index 9d8f09ab..7b9613e1 100644
--- a/builtins/common.c
+++ b/builtins/common.c
@@ -467,9 +467,6 @@ char *
get_working_directory (for_whom)
char *for_whom;
{
- char *directory;
- size_t dsize;
-
if (no_symbolic_links)
{
FREE (the_current_working_directory);
diff --git a/builtins/common.h b/builtins/common.h
index df303252..1233d667 100644
--- a/builtins/common.h
+++ b/builtins/common.h
@@ -149,7 +149,7 @@ extern void set_var_attribute __P((char *, int, int));
extern char *get_dirstack_from_string __P((char *));
extern char *get_dirstack_element __P((intmax_t, int));
extern void set_dirstack_element __P((intmax_t, int, char *));
-extern WORD_LIST *get_directory_stack __P((void));
+extern WORD_LIST *get_directory_stack __P((int));
/* Functions from evalstring.c */
extern int parse_and_execute __P((char *, const char *, int));
diff --git a/builtins/declare.def b/builtins/declare.def
index d94118f5..4d94face 100644
--- a/builtins/declare.def
+++ b/builtins/declare.def
@@ -76,6 +76,7 @@ $END
#include "bashgetopt.h"
extern int array_needs_making;
+extern int posixly_correct;
static int declare_internal __P((register WORD_LIST *, int));
@@ -256,8 +257,12 @@ declare_internal (list, local_var)
else
making_array_special = 0;
#endif
-
- if (legal_identifier (name) == 0)
+
+ /* If we're in posix mode or not looking for a shell function (since
+ shell function names don't have to be valid identifiers when the
+ shell's not in posix mode), check whether or not the argument is a
+ valid, well-formed shell identifier. */
+ if ((posixly_correct || (flags_on & att_function) == 0) && legal_identifier (name) == 0)
{
sh_invalidid (name);
assign_error++;
diff --git a/builtins/echo.def b/builtins/echo.def
index 6792659a..923c43a2 100644
--- a/builtins/echo.def
+++ b/builtins/echo.def
@@ -31,6 +31,8 @@ $PRODUCES echo.c
#include <stdio.h>
#include "../shell.h"
+#include "common.h"
+
$BUILTIN echo
$FUNCTION echo_builtin
$DEPENDS_ON V9_ECHO
@@ -48,7 +50,8 @@ following backslash-escaped characters is turned on:
\t horizontal tab
\v vertical tab
\\ backslash
- \num the character whose ASCII code is NUM (octal).
+ \0nnn the character whose ASCII code is NNN (octal). NNN can be
+ 0 to 3 octal digits
You can explicitly turn off the interpretation of the above characters
with the -E option.
diff --git a/builtins/evalfile.c b/builtins/evalfile.c
index 81be017b..d05bc7bb 100644
--- a/builtins/evalfile.c
+++ b/builtins/evalfile.c
@@ -63,7 +63,7 @@ extern int errno;
#define FEVAL_NOPUSHARGS 0x100
extern int posixly_correct;
-extern int indirection_level, startup_state, subshell_environment;
+extern int indirection_level, subshell_environment;
extern int return_catch_flag, return_catch_value;
extern int last_command_exit_value;
diff --git a/builtins/evalstring.c b/builtins/evalstring.c
index 04afac3d..36f0ad39 100644
--- a/builtins/evalstring.c
+++ b/builtins/evalstring.c
@@ -56,7 +56,7 @@ extern int errno;
#define IS_BUILTIN(s) (builtin_address_internal(s, 0) != (struct builtin *)NULL)
-extern int indirection_level, startup_state, subshell_environment;
+extern int indirection_level, subshell_environment;
extern int line_number;
extern int last_command_exit_value;
extern int running_trap;
@@ -316,9 +316,8 @@ static int
cat_file (r)
REDIRECT *r;
{
- char lbuf[128], *fn;
+ char *fn;
int fd, rval;
- ssize_t nr;
if (r->instruction != r_input_direction)
return -1;
diff --git a/builtins/fc.def b/builtins/fc.def
index ebe36832..101eb008 100644
--- a/builtins/fc.def
+++ b/builtins/fc.def
@@ -81,7 +81,6 @@ $END
extern int errno;
#endif /* !errno */
-extern int echo_input_at_read;
extern int current_command_line_count;
extern int literal_history;
extern int posixly_correct;
diff --git a/builtins/hash.def b/builtins/hash.def
index b2959521..697ffd0a 100644
--- a/builtins/hash.def
+++ b/builtins/hash.def
@@ -1,7 +1,7 @@
This file is hash.def, from which is created hash.c.
It implements the builtin "hash" in Bash.
-Copyright (C) 1987-2003 Free Software Foundation, Inc.
+Copyright (C) 1987-2006 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -59,6 +59,7 @@ $END
#include "common.h"
#include "bashgetopt.h"
+extern int posixly_correct;
extern int dot_found_in_search;
extern char *this_command_name;
@@ -124,8 +125,9 @@ hash_builtin (list)
we test expunge_hash_table. */
if (list == 0 && expunge_hash_table == 0)
{
- if (print_hashed_commands (list_portably) == 0)
- fprintf (stderr, _("%s: hash table empty\n"), this_command_name);
+ opt = print_hashed_commands (list_portably);
+ if (opt == 0 && posixly_correct == 0)
+ printf (_("%s: hash table empty\n"), this_command_name);
return (EXECUTION_SUCCESS);
}
diff --git a/builtins/mkbuiltins.c b/builtins/mkbuiltins.c
index 94953e6c..ff0bdc09 100644
--- a/builtins/mkbuiltins.c
+++ b/builtins/mkbuiltins.c
@@ -1,7 +1,7 @@
/* mkbuiltins.c - Create builtins.c, builtext.h, and builtdoc.c from
a single source file called builtins.def. */
-/* Copyright (C) 1987-2002 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2006 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -19,7 +19,16 @@ You should have received a copy of the GNU General Public License along
with Bash; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
-#include <config.h>
+#if !defined (CROSS_COMPILING)
+# include <config.h>
+#else /* CROSS_COMPILING */
+/* A conservative set of defines based on POSIX/SUS3/XPG6 */
+# define HAVE_UNISTD_H
+# define HAVE_STRING_H
+# define HAVE_STDLIB_H
+
+# define HAVE_RENAME
+#endif /* CROSS_COMPILING */
#if defined (HAVE_UNISTD_H)
# ifdef _MINIX
@@ -1360,7 +1369,7 @@ write_documentation (stream, documentation, indentation, flags)
register char *line;
int string_array, texinfo, base_indent, last_cpp, filename_p;
- if (!stream)
+ if (stream == 0)
return;
string_array = flags & STRING_ARRAY;
@@ -1372,7 +1381,12 @@ write_documentation (stream, documentation, indentation, flags)
if (single_longdoc_strings)
{
if (filename_p == 0)
- fprintf (stream, "N_(\" "); /* the empty string translates specially. */
+ {
+ if (documentation && documentation[0] && documentation[0][0])
+ fprintf (stream, "N_(\"");
+ else
+ fprintf (stream, "N_(\" "); /* the empty string translates specially. */
+ }
else
fprintf (stream, "\"");
}
@@ -1398,7 +1412,12 @@ write_documentation (stream, documentation, indentation, flags)
if (string_array && single_longdoc_strings == 0)
{
if (filename_p == 0)
- fprintf (stream, " N_(\" "); /* the empty string translates specially. */
+ {
+ if (line[0])
+ fprintf (stream, " N_(\"");
+ else
+ fprintf (stream, " N_(\" "); /* the empty string translates specially. */
+ }
else
fprintf (stream, " \"");
}
diff --git a/builtins/printf.def b/builtins/printf.def
index e4e31704..0e1d4aa9 100644
--- a/builtins/printf.def
+++ b/builtins/printf.def
@@ -91,6 +91,7 @@ extern int errno;
do { \
char *b = 0; \
int nw; \
+ clearerr (stdout); \
if (have_fieldwidth && have_precision) \
nw = asprintf(&b, f, fieldwidth, precision, func); \
else if (have_fieldwidth) \
@@ -106,6 +107,12 @@ extern int errno;
(void)vbadd (b, nw); \
else \
(void)fputs (b, stdout); \
+ if (ferror (stdout)) \
+ { \
+ sh_wrerror (); \
+ clearerr (stdout); \
+ return (EXECUTION_FAILURE); \
+ } \
free (b); \
} \
} while (0)
@@ -132,6 +139,11 @@ extern int errno;
vbuf = 0; \
} \
fflush (stdout); \
+ if (ferror (stdout)) \
+ { \
+ clearerr (stdout); \
+ return (EXECUTION_FAILURE); \
+ } \
return (value); \
} \
while (0)
@@ -407,7 +419,9 @@ printf_builtin (list)
r = 0;
p = getstr ();
- if (ansic_shouldquote (p))
+ if (p && *p == 0) /* XXX - getstr never returns null */
+ xp = savestring ("''");
+ else if (ansic_shouldquote (p))
xp = ansic_quote (p, 0, (int *)0);
else
xp = sh_backslash_quote (p);
@@ -816,7 +830,7 @@ vbadd (buf, blen)
#ifdef DEBUG
if (strlen (vbuf) != vblen)
- internal_error ("printf:vbadd: vblen (%d) != strlen (vbuf) (%d)", vblen, strlen (vbuf));
+ internal_error ("printf:vbadd: vblen (%d) != strlen (vbuf) (%d)", vblen, (int)strlen (vbuf));
#endif
return vbuf;
diff --git a/builtins/pushd.def b/builtins/pushd.def
index 0978fc93..86c0bddb 100644
--- a/builtins/pushd.def
+++ b/builtins/pushd.def
@@ -620,7 +620,8 @@ set_dirstack_element (ind, sign, value)
}
WORD_LIST *
-get_directory_stack ()
+get_directory_stack (flags)
+ int flags;
{
register int i;
WORD_LIST *ret;
@@ -628,7 +629,8 @@ get_directory_stack ()
for (ret = (WORD_LIST *)NULL, i = 0; i < directory_list_offset; i++)
{
- d = polite_directory_format (pushd_directory_list[i]);
+ d = (flags&1) ? polite_directory_format (pushd_directory_list[i])
+ : pushd_directory_list[i];
ret = make_word_list (make_word (d), ret);
}
/* Now the current directory. */
@@ -657,7 +659,7 @@ get_directory_stack ()
}
#ifdef LOADABLE_BUILTIN
-static char * const dirs_doc[] = {
+char * const dirs_doc[] = {
N_("Display the list of currently remembered directories. Directories"),
N_("find their way onto the list with the `pushd' command; you can get"),
N_("back up through the list with the `popd' command."),
@@ -678,7 +680,7 @@ static char * const dirs_doc[] = {
(char *)NULL
};
-static char * const pushd_doc[] = {
+char * const pushd_doc[] = {
N_("Adds a directory to the top of the directory stack, or rotates"),
N_("the stack, making the new top of the stack the current working"),
N_("directory. With no arguments, exchanges the top two directories."),
@@ -701,7 +703,7 @@ static char * const pushd_doc[] = {
(char *)NULL
};
-static char * const popd_doc[] = {
+char * const popd_doc[] = {
N_("Removes entries from the directory stack. With no arguments,"),
N_("removes the top directory from the stack, and cd's to the new"),
N_("top directory."),
diff --git a/builtins/read.def b/builtins/read.def
index 914ebd7d..21521db0 100644
--- a/builtins/read.def
+++ b/builtins/read.def
@@ -87,9 +87,8 @@ $END
extern int errno;
#endif
-extern int interrupt_immediately;
-
#if defined (READLINE)
+static void reset_attempted_completion_function __P((char *));
static char *edit_line __P((char *));
static void set_eol_delim __P((int));
static void reset_eol_delim __P((char *));
@@ -330,6 +329,10 @@ read_builtin (list)
}
old_alrm = set_signal_handler (SIGALRM, sigalrm);
add_unwind_protect (reset_alarm, (char *)NULL);
+#if defined (READLINE)
+ if (edit)
+ add_unwind_protect (reset_attempted_completion_function, (char *)NULL);
+#endif
alarm (tmout);
}
@@ -375,6 +378,7 @@ read_builtin (list)
of the unwind-protect stack after the realloc() works right. */
add_unwind_protect (xfree, input_string);
interrupt_immediately++;
+ terminate_immediately = 1;
unbuffered_read = (nchars > 0) || (delim != '\n') || input_is_pipe;
@@ -472,6 +476,7 @@ add_char:
if (retval < 0)
{
builtin_error (_("read error: %d: %s"), fd, strerror (errno));
+ run_unwind_frame ("read_builtin");
return (EXECUTION_FAILURE);
}
#endif
@@ -501,6 +506,7 @@ add_char:
zsyncfd (fd);
interrupt_immediately--;
+ terminate_immediately = 0;
discard_unwind_frame ("read_builtin");
retval = eof ? EXECUTION_FAILURE : EXECUTION_SUCCESS;
@@ -519,13 +525,19 @@ add_char:
var = find_or_make_array_variable (arrayname, 1);
if (var == 0)
- return EXECUTION_FAILURE; /* readonly or noassign */
+ {
+ xfree (input_string);
+ return EXECUTION_FAILURE; /* readonly or noassign */
+ }
array_flush (array_cell (var));
alist = list_string (input_string, ifs_chars, 0);
if (alist)
{
- word_list_remove_quoted_nulls (alist);
+ if (saw_escape)
+ dequote_list (alist);
+ else
+ word_list_remove_quoted_nulls (alist);
assign_array_var_from_word_list (var, alist, 0);
dispose_words (alist);
}
@@ -688,7 +700,15 @@ bind_read_variable (name, value)
}
#if defined (READLINE)
-static rl_completion_func_t *old_attempted_completion_function;
+static rl_completion_func_t *old_attempted_completion_function = 0;
+
+static void
+reset_attempted_completion_function (cp)
+ char *cp;
+{
+ if (rl_attempted_completion_function == 0 && old_attempted_completion_function)
+ rl_attempted_completion_function = old_attempted_completion_function;
+}
static char *
edit_line (p)
@@ -699,10 +719,13 @@ edit_line (p)
if (bash_readline_initialized == 0)
initialize_readline ();
+
old_attempted_completion_function = rl_attempted_completion_function;
rl_attempted_completion_function = (rl_completion_func_t *)NULL;
ret = readline (p);
rl_attempted_completion_function = old_attempted_completion_function;
+ old_attempted_completion_function = (rl_completion_func_t *)NULL;
+
if (ret == 0)
return ret;
len = strlen (ret);
diff --git a/builtins/reserved.def b/builtins/reserved.def
index 5482f5f3..e968ec7c 100644
--- a/builtins/reserved.def
+++ b/builtins/reserved.def
@@ -2,7 +2,7 @@ This file is reserved.def, in which the shell reserved words are defined.
It has no direct C file production, but defines builtins for the Bash
builtin help command.
-Copyright (C) 1987-2005 Free Software Foundation, Inc.
+Copyright (C) 1987-2006 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -146,21 +146,21 @@ $END
$BUILTIN variables
$DOCNAME variable_help
$SHORT_DOC variables - Some variable names and meanings
-BASH_VERSION Version information for this Bash.
-CDPATH A colon-separated list of directories to search
+BASH_VERSION Version information for this Bash.
+CDPATH A colon-separated list of directories to search
for directries given as arguments to `cd'.
GLOBIGNORE A colon-separated list of patterns describing filenames to
be ignored by pathname expansion.
#if defined (HISTORY)
-HISTFILE The name of the file where your command history is stored.
-HISTFILESIZE The maximum number of lines this file can contain.
-HISTSIZE The maximum number of history lines that a running
+HISTFILE The name of the file where your command history is stored.
+HISTFILESIZE The maximum number of lines this file can contain.
+HISTSIZE The maximum number of history lines that a running
shell can access.
#endif /* HISTORY */
-HOME The complete pathname to your login directory.
+HOME The complete pathname to your login directory.
HOSTNAME The name of the current host.
-HOSTTYPE The type of CPU this version of Bash is running under.
-IGNOREEOF Controls the action of the shell on receipt of an EOF
+HOSTTYPE The type of CPU this version of Bash is running under.
+IGNOREEOF Controls the action of the shell on receipt of an EOF
character as the sole input. If set, then the value
of it is the number of EOF characters that can be seen
in a row on an empty line before the shell will exit
@@ -169,19 +169,19 @@ MACHTYPE A string describing the current system Bash is running on.
MAILCHECK How often, in seconds, Bash checks for new mail.
MAILPATH A colon-separated list of filenames which Bash checks
for new mail.
-OSTYPE The version of Unix this version of Bash is running on.
-PATH A colon-separated list of directories to search when
+OSTYPE The version of Unix this version of Bash is running on.
+PATH A colon-separated list of directories to search when
looking for commands.
-PROMPT_COMMAND A command to be executed before the printing of each
+PROMPT_COMMAND A command to be executed before the printing of each
primary prompt.
-PS1 The primary prompt string.
-PS2 The secondary prompt string.
+PS1 The primary prompt string.
+PS2 The secondary prompt string.
PWD The full pathname of the current directory.
SHELLOPTS A colon-separated list of enabled shell options.
-TERM The name of the current terminal type.
+TERM The name of the current terminal type.
TIMEFORMAT The output format for timing statistics displayed by the
`time' reserved word.
-auto_resume Non-null means a command word appearing on a line by
+auto_resume Non-null means a command word appearing on a line by
itself is first looked for in the list of currently
stopped jobs. If found there, that job is foregrounded.
A value of `exact' means that the command word must
@@ -191,7 +191,7 @@ auto_resume Non-null means a command word appearing on a line by
the command must be a prefix of a stopped job.
#if defined (HISTORY)
# if defined (BANG_HISTORY)
-histchars Characters controlling history expansion and quick
+histchars Characters controlling history expansion and quick
substitution. The first character is the history
substitution character, usually `!'. The second is
the `quick substitution' character, usually `^'. The
diff --git a/builtins/set.def b/builtins/set.def
index 3bb32704..d1086695 100644
--- a/builtins/set.def
+++ b/builtins/set.def
@@ -578,7 +578,6 @@ set_builtin (list)
WORD_LIST *list;
{
int on_or_off, flag_name, force_assignment, opts_changed;
- WORD_LIST *l;
register char *arg;
char s[3];
diff --git a/builtins/source.def b/builtins/source.def
index f9f812f8..9576f09e 100644
--- a/builtins/source.def
+++ b/builtins/source.def
@@ -68,9 +68,7 @@ $END
extern int errno;
#endif /* !errno */
-#if defined (RESTRICTED_SHELL)
-extern int restricted;
-#endif
+static void maybe_pop_dollar_vars __P((void));
/* If non-zero, `.' uses $PATH to look up the script to be sourced. */
int source_uses_path = 1;
diff --git a/builtins/suspend.def b/builtins/suspend.def
index d616d775..ea86ae22 100644
--- a/builtins/suspend.def
+++ b/builtins/suspend.def
@@ -48,13 +48,15 @@ $END
#include "common.h"
#include "bashgetopt.h"
+static sighandler suspend_continue __P((int));
+
static SigHandler *old_cont;
#if 0
static SigHandler *old_stop;
#endif
/* Continue handler. */
-sighandler
+static sighandler
suspend_continue (sig)
int sig;
{
diff --git a/builtins/trap.def b/builtins/trap.def
index 669bea7a..2735791e 100644
--- a/builtins/trap.def
+++ b/builtins/trap.def
@@ -1,7 +1,7 @@
This file is trap.def, from which is created trap.c.
It implements the builtin "trap" in Bash.
-Copyright (C) 1987-2005 Free Software Foundation, Inc.
+Copyright (C) 1987-2006 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -87,7 +87,7 @@ int
trap_builtin (list)
WORD_LIST *list;
{
- int list_signal_names, display, result, opt, first_signal;
+ int list_signal_names, display, result, opt;
list_signal_names = display = 0;
result = EXECUTION_SUCCESS;
@@ -124,7 +124,10 @@ trap_builtin (list)
first_arg = list->word->word;
first_signal = first_arg && *first_arg && all_digits (first_arg) && signal_object_p (first_arg, opt);
- /* Backwards compatibility */
+ /* Backwards compatibility. XXX - question about whether or not we
+ should throw an error if an all-digit argument doesn't correspond
+ to a valid signal number (e.g., if it's `50' on a system with only
+ 32 signals). */
if (first_signal)
operation = REVERT;
/* When in posix mode, the historical behavior of looking for a
@@ -176,7 +179,7 @@ trap_builtin (list)
if (interactive)
set_signal_handler (SIGINT, sigint_sighandler);
else
- set_signal_handler (SIGINT, termination_unwind_protect);
+ set_signal_handler (SIGINT, termsig_sighandler);
break;
case SIGQUIT:
diff --git a/builtins/ulimit.def b/builtins/ulimit.def
index 8cfcd4fd..2d2e7b2b 100644
--- a/builtins/ulimit.def
+++ b/builtins/ulimit.def
@@ -34,18 +34,20 @@ option is given, it is interpreted as follows:
-a all current limits are reported
-c the maximum size of core files created
-d the maximum size of a process's data segment
- -f the maximum size of files created by the shell
- -i the maximum number of pending signals
+ -e the maximum scheduling priority (`nice')
+ -f the maximum size of files written by the shell and its children
+ -i the maximum number of pending signals
-l the maximum size a process may lock into memory
-m the maximum resident set size
-n the maximum number of open file descriptors
-p the pipe buffer size
- -q the maximum number of bytes in POSIX message queues
+ -q the maximum number of bytes in POSIX message queues
+ -r the maximum real-time scheduling priority
-s the maximum stack size
-t the maximum amount of cpu time in seconds
-u the maximum number of user processes
-v the size of virtual memory
- -x the maximum number of file locks
+ -x the maximum number of file locks
If LIMIT is given, it is the new value of the specified resource;
the special LIMIT values `soft', `hard', and `unlimited' stand for
@@ -202,6 +204,9 @@ static RESOURCE_LIMITS limits[] = {
#ifdef RLIMIT_DATA
{ 'd', RLIMIT_DATA, 1024, "data seg size", "kbytes" },
#endif
+#ifdef RLIMIT_NICE
+ { 'e', RLIMIT_NICE, 1, "scheduling priority", (char *)NULL },
+#endif
{ 'f', RLIMIT_FILESIZE, 1024, "file size", "blocks" },
#ifdef RLIMIT_SIGPENDING
{ 'i', RLIMIT_SIGPENDING, 1, "pending signals", (char *)NULL },
@@ -217,6 +222,9 @@ static RESOURCE_LIMITS limits[] = {
#ifdef RLIMIT_MSGQUEUE
{ 'q', RLIMIT_MSGQUEUE, 1, "POSIX message queues", "bytes" },
#endif
+#ifdef RLIMIT_RTPRIO
+ { 'r', RLIMIT_RTPRIO, 1, "real-time priority", (char *)NULL },
+#endif
#ifdef RLIMIT_STACK
{ 's', RLIMIT_STACK, 1024, "stack size", "kbytes" },
#endif
diff --git a/builtins/wait.def b/builtins/wait.def
index 22a92bea..a3095952 100644
--- a/builtins/wait.def
+++ b/builtins/wait.def
@@ -59,7 +59,6 @@ $END
#include "common.h"
#include "bashgetopt.h"
-extern int interrupt_immediately;
extern int wait_signal_received;
procenv_t wait_intr_buf;