Imported from ../bash-3.2.tar.gz.
This commit is contained in:
parent
95732b497d
commit
0628567a28
182 changed files with 17647 additions and 9477 deletions
|
|
@ -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); \
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 *));
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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++;
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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, " \"");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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."),
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -201,6 +203,9 @@ static RESOURCE_LIMITS limits[] = {
|
|||
#endif
|
||||
#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
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue