mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-01 16:03:39 +02:00
commit bash-20111007 snapshot
This commit is contained in:
+57
-2
@@ -9148,7 +9148,7 @@ parse.y
|
||||
----
|
||||
variables.c
|
||||
- fix bind_variable_internal to call a variable's dynamic 'set function'
|
||||
with the right arguments depending on whether its an associative
|
||||
with the right arguments depending on whether it's an associative
|
||||
array, an indexed array, or a scalar. Fixes Ubuntu bug #471504
|
||||
https://bugs.launchpad.net/ubuntu/+source/bash/+bug/471504 reported
|
||||
by AJ Slater <aj.slater@gmail.com>
|
||||
@@ -10383,7 +10383,7 @@ support/signames.c
|
||||
|
||||
shell.c
|
||||
- instead of closing all fds 3-20 at shell startup, just set them to
|
||||
be close-on-exec. Report from Rainer Müller<raimue@macports.org>
|
||||
be close-on-exec. Report from Rainer Mülle <raimue@macports.org>
|
||||
|
||||
lib/readline/isearch.c
|
||||
- in _rl_isearch_dispatch, if the current character maps to ISKMAP,
|
||||
@@ -12287,3 +12287,58 @@ pcomplete.c
|
||||
Having it on causes readline to quote the matches as if they
|
||||
were filenames. Adds functionality requested by many,
|
||||
including Clark Wang <dearvoid@gmail.com>
|
||||
|
||||
assoc.[ch]
|
||||
- assoc_replace: new function, takes the same arguments as
|
||||
assoc_insert, but returns the old data instead of freeing it
|
||||
- assoc_insert: if the object returned by hash_insert doesn't have
|
||||
the same value for its key as the key passed as an argument, we
|
||||
are overwriting an existing value. In this case, we can free the
|
||||
key. Fixes bug reported by David Parks <davidparks21@yahoo.com>
|
||||
|
||||
10/5
|
||||
----
|
||||
print_cmd.c
|
||||
- indirection_level_string: small change to only re-enable `x'
|
||||
option after calling decode_prompt_string if it was on before. In
|
||||
normal mode, it will be, but John Reiser <jreiser@bitwagon.com>
|
||||
has a novel use for that code in conjunction with a pre-loaded
|
||||
shared library that traces system call usage in shell scripts
|
||||
|
||||
10/10
|
||||
-----
|
||||
Makefile.in
|
||||
- Fix from Mike Frysinger <vapier@gentoo.org> to avoid trying to
|
||||
build y.tab.c and y.tab.h with two separate runs of yacc if
|
||||
parse.y changes. Problem with parallel makes
|
||||
- Fix from Mike Frysinger <vapier@gentoo.org> to avoid subdirectory
|
||||
builds each trying to make version.h (and all its dependencies)
|
||||
|
||||
lib/sh/Makefile.in
|
||||
- remove some dependencies on version.h where it doesn't make sense
|
||||
|
||||
variables.c
|
||||
- initialize_shell_variables: while reading the environment, a shell
|
||||
running in posix mode now checks for SHELLOPTS being readonly (it
|
||||
gets set early on in main()) before trying to assign to it. It
|
||||
saves an error message and the variable gets parsed as it should.
|
||||
Fixes bug reported by Len Giambrone <Len.Giambrone@intersystems.com>
|
||||
|
||||
10/14
|
||||
-----
|
||||
doc/{bash.1,bashref.texi}
|
||||
- add to the "duplicating file descriptors" description that >&word
|
||||
doesn't redirect stdout and stderr if word expands to `-'
|
||||
- add to the "appending standard output and standard error"
|
||||
description a note that >&word, where word is a number or `-',
|
||||
causes other redirection operators to apply for sh and Posix
|
||||
compatibility reasons. Suggested by Greg Wooledge
|
||||
<wooledg@eeg.ccf.org>
|
||||
|
||||
10/15
|
||||
-----
|
||||
pcomplete.c
|
||||
- change pcomp_filename_completion_function to only run the filename
|
||||
dequoting function in the cases (as best as it can figure) where
|
||||
readline won't do it via rl_filename_completion_function. Based
|
||||
on reports from <lolilolicon@gmail.com>
|
||||
|
||||
+51
-3
@@ -9148,7 +9148,7 @@ parse.y
|
||||
----
|
||||
variables.c
|
||||
- fix bind_variable_internal to call a variable's dynamic 'set function'
|
||||
with the right arguments depending on whether its an associative
|
||||
with the right arguments depending on whether it's an associative
|
||||
array, an indexed array, or a scalar. Fixes Ubuntu bug #471504
|
||||
https://bugs.launchpad.net/ubuntu/+source/bash/+bug/471504 reported
|
||||
by AJ Slater <aj.slater@gmail.com>
|
||||
@@ -10383,7 +10383,7 @@ support/signames.c
|
||||
|
||||
shell.c
|
||||
- instead of closing all fds 3-20 at shell startup, just set them to
|
||||
be close-on-exec. Report from Rainer Müller<raimue@macports.org>
|
||||
be close-on-exec. Report from Rainer Mülle <raimue@macports.org>
|
||||
|
||||
lib/readline/isearch.c
|
||||
- in _rl_isearch_dispatch, if the current character maps to ISKMAP,
|
||||
@@ -12285,4 +12285,52 @@ pcomplete.c
|
||||
rl_filename_completion_desired if it was off before we called
|
||||
rl_filename_completion_function and we didn't get any matches.
|
||||
Having it on causes readline to quote the matches as if they
|
||||
were filenames.
|
||||
were filenames. Adds functionality requested by many,
|
||||
including Clark Wang <dearvoid@gmail.com>
|
||||
|
||||
assoc.[ch]
|
||||
- assoc_replace: new function, takes the same arguments as
|
||||
assoc_insert, but returns the old data instead of freeing it
|
||||
- assoc_insert: if the object returned by hash_insert doesn't have
|
||||
the same value for its key as the key passed as an argument, we
|
||||
are overwriting an existing value. In this case, we can free the
|
||||
key. Fixes bug reported by David Parks <davidparks21@yahoo.com>
|
||||
|
||||
10/5
|
||||
----
|
||||
print_cmd.c
|
||||
- indirection_level_string: small change to only re-enable `x'
|
||||
option after calling decode_prompt_string if it was on before. In
|
||||
normal mode, it will be, but John Reiser <jreiser@bitwagon.com>
|
||||
has a novel use for that code in conjunction with a pre-loaded
|
||||
shared library that traces system call usage in shell scripts
|
||||
|
||||
10/10
|
||||
-----
|
||||
Makefile.in
|
||||
- Fix from Mike Frysinger <vapier@gentoo.org> to avoid trying to
|
||||
build y.tab.c and y.tab.h with two separate runs of yacc if
|
||||
parse.y changes. Problem with parallel makes
|
||||
- Fix from Mike Frysinger <vapier@gentoo.org> to avoid subdirectory
|
||||
builds each trying to make version.h (and all its dependencies)
|
||||
|
||||
lib/sh/Makefile.in
|
||||
- remove some dependencies on version.h where it doesn't make sense
|
||||
|
||||
variables.c
|
||||
- initialize_shell_variables: while reading the environment, a shell
|
||||
running in posix mode now checks for SHELLOPTS being readonly (it
|
||||
gets set early on in main()) before trying to assign to it. It
|
||||
saves an error message and the variable gets parsed as it should.
|
||||
Fixes bug reported by Len Giambrone <Len.Giambrone@intersystems.com>
|
||||
|
||||
10/14
|
||||
-----
|
||||
doc/{bash.1,bashref.texi}
|
||||
- add to the "duplicating file descriptors" description that >&word
|
||||
doesn't redirect stdout and stderr if word expands to `-'
|
||||
- add to the "appending standard output and standard error"
|
||||
description a note that >&word, where word is a number or `-',
|
||||
causes other redirection operators to apply for sh and Posix
|
||||
compatibility reasons. Suggested by Greg Wooledge
|
||||
<wooledg@eeg.ccf.org>
|
||||
|
||||
@@ -1005,6 +1005,7 @@ tests/redir6.sub f
|
||||
tests/redir7.sub f
|
||||
tests/redir8.sub f
|
||||
tests/redir9.sub f
|
||||
tests/redir10.sub f
|
||||
tests/rhs-exp.tests f
|
||||
tests/rhs-exp.right f
|
||||
tests/rhs-exp1.sub f
|
||||
|
||||
+14
-10
@@ -1,6 +1,6 @@
|
||||
# Makefile for bash-4.2, version 4.5
|
||||
# Makefile for bash-4.2, version 4.6
|
||||
#
|
||||
# Copyright (C) 1996-2010 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-2011 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -579,23 +579,27 @@ buildversion.o: version.h conftypes.h patchlevel.h $(srcdir)/version.c
|
||||
|
||||
# old rules
|
||||
GRAM_H = parser-built
|
||||
y.tab.o: y.tab.c ${GRAM_H} command.h ${BASHINCDIR}/stdc.h input.h
|
||||
y.tab.o: y.tab.h y.tab.c ${GRAM_H} command.h ${BASHINCDIR}/stdc.h input.h
|
||||
${GRAM_H}: y.tab.h
|
||||
@-if test -f y.tab.h ; then \
|
||||
cmp -s $@ y.tab.h 2>/dev/null || cp -p y.tab.h $@; \
|
||||
fi
|
||||
y.tab.c y.tab.h: parse.y
|
||||
|
||||
y.tab.c: parse.y
|
||||
# -if test -f y.tab.h; then mv -f y.tab.h old-y.tab.h; fi
|
||||
$(YACC) -d $(srcdir)/parse.y
|
||||
touch parser-built
|
||||
# -if cmp -s old-y.tab.h y.tab.h; then mv old-y.tab.h y.tab.h; else cp -p y.tab.h ${GRAM_H}; fi
|
||||
|
||||
# experimental new rules - work with GNU make but not BSD (or OSF) make
|
||||
#y.tab.o: y.tab.c y.tab.h
|
||||
#y.tab.c y.tab.h: parse.y command.h ${BASHINCDIR}/stdc.h input.h
|
||||
# -if test -f y.tab.h; then mv -f y.tab.h old-y.tab.h; fi
|
||||
# $(YACC) -d $(srcdir)/parse.y
|
||||
# -if cmp -s old-y.tab.h y.tab.h; then mv old-y.tab.h y.tab.h; fi
|
||||
y.tab.h: y.tab.c
|
||||
@true
|
||||
|
||||
|
||||
# Subdirs will often times want version.h, so they'll change back up to
|
||||
# the top level and try to create it. This causes parallel build issues
|
||||
# so just force top level sanity before we descend.
|
||||
$(LIBDEP): .build
|
||||
#$(LIBDEP): version.h
|
||||
|
||||
$(READLINE_LIBRARY): config.h $(READLINE_SOURCE)
|
||||
@echo making $@ in ${RL_LIBDIR}
|
||||
|
||||
+1534
File diff suppressed because it is too large
Load Diff
@@ -7,7 +7,7 @@
|
||||
* chet@ins.cwru.edu
|
||||
*/
|
||||
|
||||
/* Copyright (C) 2008,2009 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 2008,2009,2011 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -65,7 +65,7 @@ assoc_flush (hash)
|
||||
{
|
||||
hash_flush (hash, 0);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
assoc_insert (hash, key, value)
|
||||
HASH_TABLE *hash;
|
||||
@@ -77,11 +77,39 @@ assoc_insert (hash, key, value)
|
||||
b = hash_search (key, hash, HASH_CREATE);
|
||||
if (b == 0)
|
||||
return -1;
|
||||
/* If we are overwriting an existing element's value, we're not going to
|
||||
use the key. Nothing in the array assignment code path frees the key
|
||||
string, so we can free it here to avoid a memory leak. */
|
||||
if (b->key != key)
|
||||
free (key);
|
||||
FREE (b->data);
|
||||
b->data = value ? savestring (value) : (char *)0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Like assoc_insert, but returns b->data instead of freeing it */
|
||||
PTR_T
|
||||
assoc_replace (hash, key, value)
|
||||
HASH_TABLE *hash;
|
||||
char *key;
|
||||
char *value;
|
||||
{
|
||||
BUCKET_CONTENTS *b;
|
||||
PTR_T t;
|
||||
|
||||
b = hash_search (key, hash, HASH_CREATE);
|
||||
if (b == 0)
|
||||
return (PTR_T)0;
|
||||
/* If we are overwriting an existing element's value, we're not going to
|
||||
use the key. Nothing in the array assignment code path frees the key
|
||||
string, so we can free it here to avoid a memory leak. */
|
||||
if (b->key != key)
|
||||
free (key);
|
||||
t = b->data;
|
||||
b->data = value ? savestring (value) : (char *)0;
|
||||
return t;
|
||||
}
|
||||
|
||||
void
|
||||
assoc_remove (hash, string)
|
||||
HASH_TABLE *hash;
|
||||
|
||||
@@ -38,6 +38,7 @@ extern void assoc_dispose __P((HASH_TABLE *));
|
||||
extern void assoc_flush __P((HASH_TABLE *));
|
||||
|
||||
extern int assoc_insert __P((HASH_TABLE *, char *, char *));
|
||||
extern PTR_T assoc_replace __P((HASH_TABLE *, char *, char *));
|
||||
extern void assoc_remove __P((HASH_TABLE *, char *));
|
||||
|
||||
extern char *assoc_reference __P((HASH_TABLE *, char *));
|
||||
|
||||
@@ -0,0 +1,892 @@
|
||||
/* common.c - utility functions for all builtins */
|
||||
|
||||
/* Copyright (C) 1987-2010 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
Bash is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bash. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# ifdef _MINIX
|
||||
# include <sys/types.h>
|
||||
# endif
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <chartypes.h>
|
||||
#include "../bashtypes.h"
|
||||
#include "posixstat.h"
|
||||
#include <signal.h>
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#if defined (PREFER_STDARG)
|
||||
# include <stdarg.h>
|
||||
#else
|
||||
# include <varargs.h>
|
||||
#endif
|
||||
|
||||
#include "../bashansi.h"
|
||||
#include "../bashintl.h"
|
||||
|
||||
#define NEED_FPURGE_DECL
|
||||
|
||||
#include "../shell.h"
|
||||
#include "maxpath.h"
|
||||
#include "../flags.h"
|
||||
#include "../jobs.h"
|
||||
#include "../builtins.h"
|
||||
#include "../input.h"
|
||||
#include "../execute_cmd.h"
|
||||
#include "../trap.h"
|
||||
#include "bashgetopt.h"
|
||||
#include "common.h"
|
||||
#include "builtext.h"
|
||||
#include <tilde/tilde.h>
|
||||
|
||||
#if defined (HISTORY)
|
||||
# include "../bashhist.h"
|
||||
#endif
|
||||
|
||||
#if !defined (errno)
|
||||
extern int errno;
|
||||
#endif /* !errno */
|
||||
|
||||
extern int indirection_level, subshell_environment;
|
||||
extern int line_number;
|
||||
extern int last_command_exit_value;
|
||||
extern int running_trap;
|
||||
extern int posixly_correct;
|
||||
extern char *this_command_name, *shell_name;
|
||||
extern const char * const bash_getcwd_errstr;
|
||||
|
||||
/* Used by some builtins and the mainline code. */
|
||||
sh_builtin_func_t *last_shell_builtin = (sh_builtin_func_t *)NULL;
|
||||
sh_builtin_func_t *this_shell_builtin = (sh_builtin_func_t *)NULL;
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Error reporting, usage, and option processing */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* This is a lot like report_error (), but it is for shell builtins
|
||||
instead of shell control structures, and it won't ever exit the
|
||||
shell. */
|
||||
|
||||
static void
|
||||
builtin_error_prolog ()
|
||||
{
|
||||
char *name;
|
||||
|
||||
name = get_name_for_error ();
|
||||
fprintf (stderr, "%s: ", name);
|
||||
|
||||
if (interactive_shell == 0)
|
||||
fprintf (stderr, _("line %d: "), executing_line_number ());
|
||||
|
||||
if (this_command_name && *this_command_name)
|
||||
fprintf (stderr, "%s: ", this_command_name);
|
||||
}
|
||||
|
||||
void
|
||||
#if defined (PREFER_STDARG)
|
||||
builtin_error (const char *format, ...)
|
||||
#else
|
||||
builtin_error (format, va_alist)
|
||||
const char *format;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list args;
|
||||
|
||||
builtin_error_prolog ();
|
||||
|
||||
SH_VA_START (args, format);
|
||||
|
||||
vfprintf (stderr, format, args);
|
||||
va_end (args);
|
||||
fprintf (stderr, "\n");
|
||||
}
|
||||
|
||||
void
|
||||
#if defined (PREFER_STDARG)
|
||||
builtin_warning (const char *format, ...)
|
||||
#else
|
||||
builtin_warning (format, va_alist)
|
||||
const char *format;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list args;
|
||||
|
||||
builtin_error_prolog ();
|
||||
fprintf (stderr, _("warning: "));
|
||||
|
||||
SH_VA_START (args, format);
|
||||
|
||||
vfprintf (stderr, format, args);
|
||||
va_end (args);
|
||||
fprintf (stderr, "\n");
|
||||
}
|
||||
|
||||
/* Print a usage summary for the currently-executing builtin command. */
|
||||
void
|
||||
builtin_usage ()
|
||||
{
|
||||
if (this_command_name && *this_command_name)
|
||||
fprintf (stderr, _("%s: usage: "), this_command_name);
|
||||
fprintf (stderr, "%s\n", _(current_builtin->short_doc));
|
||||
fflush (stderr);
|
||||
}
|
||||
|
||||
/* Return if LIST is NULL else barf and jump to top_level. Used by some
|
||||
builtins that do not accept arguments. */
|
||||
void
|
||||
no_args (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
if (list)
|
||||
{
|
||||
builtin_error (_("too many arguments"));
|
||||
top_level_cleanup ();
|
||||
jump_to_top_level (DISCARD);
|
||||
}
|
||||
}
|
||||
|
||||
/* Check that no options were given to the currently-executing builtin,
|
||||
and return 0 if there were options. */
|
||||
int
|
||||
no_options (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
reset_internal_getopt ();
|
||||
if (internal_getopt (list, "") != -1)
|
||||
{
|
||||
builtin_usage ();
|
||||
return (1);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
sh_needarg (s)
|
||||
char *s;
|
||||
{
|
||||
builtin_error (_("%s: option requires an argument"), s);
|
||||
}
|
||||
|
||||
void
|
||||
sh_neednumarg (s)
|
||||
char *s;
|
||||
{
|
||||
builtin_error (_("%s: numeric argument required"), s);
|
||||
}
|
||||
|
||||
void
|
||||
sh_notfound (s)
|
||||
char *s;
|
||||
{
|
||||
builtin_error (_("%s: not found"), s);
|
||||
}
|
||||
|
||||
/* Function called when one of the builtin commands detects an invalid
|
||||
option. */
|
||||
void
|
||||
sh_invalidopt (s)
|
||||
char *s;
|
||||
{
|
||||
builtin_error (_("%s: invalid option"), s);
|
||||
}
|
||||
|
||||
void
|
||||
sh_invalidoptname (s)
|
||||
char *s;
|
||||
{
|
||||
builtin_error (_("%s: invalid option name"), s);
|
||||
}
|
||||
|
||||
void
|
||||
sh_invalidid (s)
|
||||
char *s;
|
||||
{
|
||||
builtin_error (_("`%s': not a valid identifier"), s);
|
||||
}
|
||||
|
||||
void
|
||||
sh_invalidnum (s)
|
||||
char *s;
|
||||
{
|
||||
char *msg;
|
||||
|
||||
if (*s == '0' && isdigit (s[1]))
|
||||
msg = _("invalid octal number");
|
||||
else if (*s == '0' && s[1] == 'x')
|
||||
msg = _("invalid hex number");
|
||||
else
|
||||
msg = _("invalid number");
|
||||
builtin_error ("%s: %s", s, msg);
|
||||
}
|
||||
|
||||
void
|
||||
sh_invalidsig (s)
|
||||
char *s;
|
||||
{
|
||||
builtin_error (_("%s: invalid signal specification"), s);
|
||||
}
|
||||
|
||||
void
|
||||
sh_badpid (s)
|
||||
char *s;
|
||||
{
|
||||
builtin_error (_("`%s': not a pid or valid job spec"), s);
|
||||
}
|
||||
|
||||
void
|
||||
sh_readonly (s)
|
||||
const char *s;
|
||||
{
|
||||
builtin_error (_("%s: readonly variable"), s);
|
||||
itrace("sh_readonly: %d", getpid());
|
||||
sleep (200);
|
||||
}
|
||||
|
||||
void
|
||||
sh_erange (s, desc)
|
||||
char *s, *desc;
|
||||
{
|
||||
if (s)
|
||||
builtin_error (_("%s: %s out of range"), s, desc ? desc : _("argument"));
|
||||
else
|
||||
builtin_error (_("%s out of range"), desc ? desc : _("argument"));
|
||||
}
|
||||
|
||||
#if defined (JOB_CONTROL)
|
||||
void
|
||||
sh_badjob (s)
|
||||
char *s;
|
||||
{
|
||||
builtin_error (_("%s: no such job"), s);
|
||||
}
|
||||
|
||||
void
|
||||
sh_nojobs (s)
|
||||
char *s;
|
||||
{
|
||||
if (s)
|
||||
builtin_error (_("%s: no job control"), s);
|
||||
else
|
||||
builtin_error (_("no job control"));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined (RESTRICTED_SHELL)
|
||||
void
|
||||
sh_restricted (s)
|
||||
char *s;
|
||||
{
|
||||
if (s)
|
||||
builtin_error (_("%s: restricted"), s);
|
||||
else
|
||||
builtin_error (_("restricted"));
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
sh_notbuiltin (s)
|
||||
char *s;
|
||||
{
|
||||
builtin_error (_("%s: not a shell builtin"), s);
|
||||
}
|
||||
|
||||
void
|
||||
sh_wrerror ()
|
||||
{
|
||||
#if defined (DONT_REPORT_BROKEN_PIPE_WRITE_ERRORS) && defined (EPIPE)
|
||||
if (errno != EPIPE)
|
||||
#endif /* DONT_REPORT_BROKEN_PIPE_WRITE_ERRORS && EPIPE */
|
||||
builtin_error (_("write error: %s"), strerror (errno));
|
||||
}
|
||||
|
||||
void
|
||||
sh_ttyerror (set)
|
||||
int set;
|
||||
{
|
||||
if (set)
|
||||
builtin_error (_("error setting terminal attributes: %s"), strerror (errno));
|
||||
else
|
||||
builtin_error (_("error getting terminal attributes: %s"), strerror (errno));
|
||||
}
|
||||
|
||||
int
|
||||
sh_chkwrite (s)
|
||||
int s;
|
||||
{
|
||||
fflush (stdout);
|
||||
if (ferror (stdout))
|
||||
{
|
||||
sh_wrerror ();
|
||||
fpurge (stdout);
|
||||
clearerr (stdout);
|
||||
return (EXECUTION_FAILURE);
|
||||
}
|
||||
return (s);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Shell positional parameter manipulation */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Convert a WORD_LIST into a C-style argv. Return the number of elements
|
||||
in the list in *IP, if IP is non-null. A convenience function for
|
||||
loadable builtins; also used by `test'. */
|
||||
char **
|
||||
make_builtin_argv (list, ip)
|
||||
WORD_LIST *list;
|
||||
int *ip;
|
||||
{
|
||||
char **argv;
|
||||
|
||||
argv = strvec_from_word_list (list, 0, 1, ip);
|
||||
argv[0] = this_command_name;
|
||||
return argv;
|
||||
}
|
||||
|
||||
/* Remember LIST in $1 ... $9, and REST_OF_ARGS. If DESTRUCTIVE is
|
||||
non-zero, then discard whatever the existing arguments are, else
|
||||
only discard the ones that are to be replaced. */
|
||||
void
|
||||
remember_args (list, destructive)
|
||||
WORD_LIST *list;
|
||||
int destructive;
|
||||
{
|
||||
register int i;
|
||||
|
||||
for (i = 1; i < 10; i++)
|
||||
{
|
||||
if ((destructive || list) && dollar_vars[i])
|
||||
{
|
||||
free (dollar_vars[i]);
|
||||
dollar_vars[i] = (char *)NULL;
|
||||
}
|
||||
|
||||
if (list)
|
||||
{
|
||||
dollar_vars[i] = savestring (list->word->word);
|
||||
list = list->next;
|
||||
}
|
||||
}
|
||||
|
||||
/* If arguments remain, assign them to REST_OF_ARGS.
|
||||
Note that copy_word_list (NULL) returns NULL, and
|
||||
that dispose_words (NULL) does nothing. */
|
||||
if (destructive || list)
|
||||
{
|
||||
dispose_words (rest_of_args);
|
||||
rest_of_args = copy_word_list (list);
|
||||
}
|
||||
|
||||
if (destructive)
|
||||
set_dollar_vars_changed ();
|
||||
}
|
||||
|
||||
static int changed_dollar_vars;
|
||||
|
||||
/* Have the dollar variables been reset to new values since we last
|
||||
checked? */
|
||||
int
|
||||
dollar_vars_changed ()
|
||||
{
|
||||
return (changed_dollar_vars);
|
||||
}
|
||||
|
||||
void
|
||||
set_dollar_vars_unchanged ()
|
||||
{
|
||||
changed_dollar_vars = 0;
|
||||
}
|
||||
|
||||
void
|
||||
set_dollar_vars_changed ()
|
||||
{
|
||||
if (variable_context)
|
||||
changed_dollar_vars |= ARGS_FUNC;
|
||||
else if (this_shell_builtin == set_builtin)
|
||||
changed_dollar_vars |= ARGS_SETBLTIN;
|
||||
else
|
||||
changed_dollar_vars |= ARGS_INVOC;
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Validating numeric input and arguments */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Read a numeric arg for this_command_name, the name of the shell builtin
|
||||
that wants it. LIST is the word list that the arg is to come from.
|
||||
Accept only the numeric argument; report an error if other arguments
|
||||
follow. If FATAL is 1, call throw_to_top_level, which exits the
|
||||
shell; if it's 2, call jump_to_top_level (DISCARD), which aborts the
|
||||
current command; if FATAL is 0, return an indication of an invalid
|
||||
number by setting *NUMOK == 0 and return -1. */
|
||||
int
|
||||
get_numeric_arg (list, fatal, count)
|
||||
WORD_LIST *list;
|
||||
int fatal;
|
||||
intmax_t *count;
|
||||
{
|
||||
char *arg;
|
||||
|
||||
if (count)
|
||||
*count = 1;
|
||||
|
||||
if (list && list->word && ISOPTION (list->word->word, '-'))
|
||||
list = list->next;
|
||||
|
||||
if (list)
|
||||
{
|
||||
arg = list->word->word;
|
||||
if (arg == 0 || (legal_number (arg, count) == 0))
|
||||
{
|
||||
sh_neednumarg (list->word->word ? list->word->word : "`'");
|
||||
if (fatal == 0)
|
||||
return 0;
|
||||
else if (fatal == 1) /* fatal == 1; abort */
|
||||
throw_to_top_level ();
|
||||
else /* fatal == 2; discard current command */
|
||||
{
|
||||
top_level_cleanup ();
|
||||
jump_to_top_level (DISCARD);
|
||||
}
|
||||
}
|
||||
no_args (list->next);
|
||||
}
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
/* Get an eight-bit status value from LIST */
|
||||
int
|
||||
get_exitstat (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
int status;
|
||||
intmax_t sval;
|
||||
char *arg;
|
||||
|
||||
if (list && list->word && ISOPTION (list->word->word, '-'))
|
||||
list = list->next;
|
||||
|
||||
if (list == 0)
|
||||
return (last_command_exit_value);
|
||||
|
||||
arg = list->word->word;
|
||||
if (arg == 0 || legal_number (arg, &sval) == 0)
|
||||
{
|
||||
sh_neednumarg (list->word->word ? list->word->word : "`'");
|
||||
return EX_BADUSAGE;
|
||||
}
|
||||
no_args (list->next);
|
||||
|
||||
status = sval & 255;
|
||||
return status;
|
||||
}
|
||||
|
||||
/* Return the octal number parsed from STRING, or -1 to indicate
|
||||
that the string contained a bad number. */
|
||||
int
|
||||
read_octal (string)
|
||||
char *string;
|
||||
{
|
||||
int result, digits;
|
||||
|
||||
result = digits = 0;
|
||||
while (*string && ISOCTAL (*string))
|
||||
{
|
||||
digits++;
|
||||
result = (result * 8) + (*string++ - '0');
|
||||
if (result > 0777)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (digits == 0 || *string)
|
||||
result = -1;
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Manipulating the current working directory */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Return a consed string which is the current working directory.
|
||||
FOR_WHOM is the name of the caller for error printing. */
|
||||
char *the_current_working_directory = (char *)NULL;
|
||||
|
||||
char *
|
||||
get_working_directory (for_whom)
|
||||
char *for_whom;
|
||||
{
|
||||
if (no_symbolic_links)
|
||||
{
|
||||
FREE (the_current_working_directory);
|
||||
the_current_working_directory = (char *)NULL;
|
||||
}
|
||||
|
||||
if (the_current_working_directory == 0)
|
||||
{
|
||||
#if defined (GETCWD_BROKEN)
|
||||
the_current_working_directory = getcwd (0, PATH_MAX);
|
||||
#else
|
||||
the_current_working_directory = getcwd (0, 0);
|
||||
#endif
|
||||
if (the_current_working_directory == 0)
|
||||
{
|
||||
fprintf (stderr, _("%s: error retrieving current directory: %s: %s\n"),
|
||||
(for_whom && *for_whom) ? for_whom : get_name_for_error (),
|
||||
_(bash_getcwd_errstr), strerror (errno));
|
||||
return (char *)NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return (savestring (the_current_working_directory));
|
||||
}
|
||||
|
||||
/* Make NAME our internal idea of the current working directory. */
|
||||
void
|
||||
set_working_directory (name)
|
||||
char *name;
|
||||
{
|
||||
FREE (the_current_working_directory);
|
||||
the_current_working_directory = savestring (name);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Job control support functions */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
#if defined (JOB_CONTROL)
|
||||
int
|
||||
get_job_by_name (name, flags)
|
||||
const char *name;
|
||||
int flags;
|
||||
{
|
||||
register int i, wl, cl, match, job;
|
||||
register PROCESS *p;
|
||||
register JOB *j;
|
||||
|
||||
job = NO_JOB;
|
||||
wl = strlen (name);
|
||||
for (i = js.j_jobslots - 1; i >= 0; i--)
|
||||
{
|
||||
j = get_job_by_jid (i);
|
||||
if (j == 0 || ((flags & JM_STOPPED) && J_JOBSTATE(j) != JSTOPPED))
|
||||
continue;
|
||||
|
||||
p = j->pipe;
|
||||
do
|
||||
{
|
||||
if (flags & JM_EXACT)
|
||||
{
|
||||
cl = strlen (p->command);
|
||||
match = STREQN (p->command, name, cl);
|
||||
}
|
||||
else if (flags & JM_SUBSTRING)
|
||||
match = strcasestr (p->command, name) != (char *)0;
|
||||
else
|
||||
match = STREQN (p->command, name, wl);
|
||||
|
||||
if (match == 0)
|
||||
{
|
||||
p = p->next;
|
||||
continue;
|
||||
}
|
||||
else if (flags & JM_FIRSTMATCH)
|
||||
return i; /* return first match */
|
||||
else if (job != NO_JOB)
|
||||
{
|
||||
if (this_shell_builtin)
|
||||
builtin_error (_("%s: ambiguous job spec"), name);
|
||||
else
|
||||
report_error (_("%s: ambiguous job spec"), name);
|
||||
return (DUP_JOB);
|
||||
}
|
||||
else
|
||||
job = i;
|
||||
}
|
||||
while (p != j->pipe);
|
||||
}
|
||||
|
||||
return (job);
|
||||
}
|
||||
|
||||
/* Return the job spec found in LIST. */
|
||||
int
|
||||
get_job_spec (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
register char *word;
|
||||
int job, jflags;
|
||||
|
||||
if (list == 0)
|
||||
return (js.j_current);
|
||||
|
||||
word = list->word->word;
|
||||
|
||||
if (*word == '\0')
|
||||
return (NO_JOB);
|
||||
|
||||
if (*word == '%')
|
||||
word++;
|
||||
|
||||
if (DIGIT (*word) && all_digits (word))
|
||||
{
|
||||
job = atoi (word);
|
||||
return (job > js.j_jobslots ? NO_JOB : job - 1);
|
||||
}
|
||||
|
||||
jflags = 0;
|
||||
switch (*word)
|
||||
{
|
||||
case 0:
|
||||
case '%':
|
||||
case '+':
|
||||
return (js.j_current);
|
||||
|
||||
case '-':
|
||||
return (js.j_previous);
|
||||
|
||||
case '?': /* Substring search requested. */
|
||||
jflags |= JM_SUBSTRING;
|
||||
word++;
|
||||
/* FALLTHROUGH */
|
||||
|
||||
default:
|
||||
return get_job_by_name (word, jflags);
|
||||
}
|
||||
}
|
||||
#endif /* JOB_CONTROL */
|
||||
|
||||
/*
|
||||
* NOTE: `kill' calls this function with forcecols == 0
|
||||
*/
|
||||
int
|
||||
display_signal_list (list, forcecols)
|
||||
WORD_LIST *list;
|
||||
int forcecols;
|
||||
{
|
||||
register int i, column;
|
||||
char *name;
|
||||
int result, signum, dflags;
|
||||
intmax_t lsignum;
|
||||
|
||||
result = EXECUTION_SUCCESS;
|
||||
if (!list)
|
||||
{
|
||||
for (i = 1, column = 0; i < NSIG; i++)
|
||||
{
|
||||
name = signal_name (i);
|
||||
if (STREQN (name, "SIGJUNK", 7) || STREQN (name, "Unknown", 7))
|
||||
continue;
|
||||
|
||||
if (posixly_correct && !forcecols)
|
||||
{
|
||||
/* This is for the kill builtin. POSIX.2 says the signal names
|
||||
are displayed without the `SIG' prefix. */
|
||||
if (STREQN (name, "SIG", 3))
|
||||
name += 3;
|
||||
printf ("%s%s", name, (i == NSIG - 1) ? "" : " ");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf ("%2d) %s", i, name);
|
||||
|
||||
if (++column < 5)
|
||||
printf ("\t");
|
||||
else
|
||||
{
|
||||
printf ("\n");
|
||||
column = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((posixly_correct && !forcecols) || column != 0)
|
||||
printf ("\n");
|
||||
return result;
|
||||
}
|
||||
|
||||
/* List individual signal names or numbers. */
|
||||
while (list)
|
||||
{
|
||||
if (legal_number (list->word->word, &lsignum))
|
||||
{
|
||||
/* This is specified by Posix.2 so that exit statuses can be
|
||||
mapped into signal numbers. */
|
||||
if (lsignum > 128)
|
||||
lsignum -= 128;
|
||||
if (lsignum < 0 || lsignum >= NSIG)
|
||||
{
|
||||
sh_invalidsig (list->word->word);
|
||||
result = EXECUTION_FAILURE;
|
||||
list = list->next;
|
||||
continue;
|
||||
}
|
||||
|
||||
signum = lsignum;
|
||||
name = signal_name (signum);
|
||||
if (STREQN (name, "SIGJUNK", 7) || STREQN (name, "Unknown", 7))
|
||||
{
|
||||
list = list->next;
|
||||
continue;
|
||||
}
|
||||
#if defined (JOB_CONTROL)
|
||||
/* POSIX.2 says that `kill -l signum' prints the signal name without
|
||||
the `SIG' prefix. */
|
||||
printf ("%s\n", (this_shell_builtin == kill_builtin) ? name + 3 : name);
|
||||
#else
|
||||
printf ("%s\n", name);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
dflags = DSIG_NOCASE;
|
||||
if (posixly_correct == 0 || this_shell_builtin != kill_builtin)
|
||||
dflags |= DSIG_SIGPREFIX;
|
||||
signum = decode_signal (list->word->word, dflags);
|
||||
if (signum == NO_SIG)
|
||||
{
|
||||
sh_invalidsig (list->word->word);
|
||||
result = EXECUTION_FAILURE;
|
||||
list = list->next;
|
||||
continue;
|
||||
}
|
||||
printf ("%d\n", signum);
|
||||
}
|
||||
list = list->next;
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Finding builtin commands and their functions */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Perform a binary search and return the address of the builtin function
|
||||
whose name is NAME. If the function couldn't be found, or the builtin
|
||||
is disabled or has no function associated with it, return NULL.
|
||||
Return the address of the builtin.
|
||||
DISABLED_OKAY means find it even if the builtin is disabled. */
|
||||
struct builtin *
|
||||
builtin_address_internal (name, disabled_okay)
|
||||
char *name;
|
||||
int disabled_okay;
|
||||
{
|
||||
int hi, lo, mid, j;
|
||||
|
||||
hi = num_shell_builtins - 1;
|
||||
lo = 0;
|
||||
|
||||
while (lo <= hi)
|
||||
{
|
||||
mid = (lo + hi) / 2;
|
||||
|
||||
j = shell_builtins[mid].name[0] - name[0];
|
||||
|
||||
if (j == 0)
|
||||
j = strcmp (shell_builtins[mid].name, name);
|
||||
|
||||
if (j == 0)
|
||||
{
|
||||
/* It must have a function pointer. It must be enabled, or we
|
||||
must have explicitly allowed disabled functions to be found,
|
||||
and it must not have been deleted. */
|
||||
if (shell_builtins[mid].function &&
|
||||
((shell_builtins[mid].flags & BUILTIN_DELETED) == 0) &&
|
||||
((shell_builtins[mid].flags & BUILTIN_ENABLED) || disabled_okay))
|
||||
return (&shell_builtins[mid]);
|
||||
else
|
||||
return ((struct builtin *)NULL);
|
||||
}
|
||||
if (j > 0)
|
||||
hi = mid - 1;
|
||||
else
|
||||
lo = mid + 1;
|
||||
}
|
||||
return ((struct builtin *)NULL);
|
||||
}
|
||||
|
||||
/* Return the pointer to the function implementing builtin command NAME. */
|
||||
sh_builtin_func_t *
|
||||
find_shell_builtin (name)
|
||||
char *name;
|
||||
{
|
||||
current_builtin = builtin_address_internal (name, 0);
|
||||
return (current_builtin ? current_builtin->function : (sh_builtin_func_t *)NULL);
|
||||
}
|
||||
|
||||
/* Return the address of builtin with NAME, whether it is enabled or not. */
|
||||
sh_builtin_func_t *
|
||||
builtin_address (name)
|
||||
char *name;
|
||||
{
|
||||
current_builtin = builtin_address_internal (name, 1);
|
||||
return (current_builtin ? current_builtin->function : (sh_builtin_func_t *)NULL);
|
||||
}
|
||||
|
||||
/* Return the function implementing the builtin NAME, but only if it is a
|
||||
POSIX.2 special builtin. */
|
||||
sh_builtin_func_t *
|
||||
find_special_builtin (name)
|
||||
char *name;
|
||||
{
|
||||
current_builtin = builtin_address_internal (name, 0);
|
||||
return ((current_builtin && (current_builtin->flags & SPECIAL_BUILTIN)) ?
|
||||
current_builtin->function :
|
||||
(sh_builtin_func_t *)NULL);
|
||||
}
|
||||
|
||||
static int
|
||||
shell_builtin_compare (sbp1, sbp2)
|
||||
struct builtin *sbp1, *sbp2;
|
||||
{
|
||||
int result;
|
||||
|
||||
if ((result = sbp1->name[0] - sbp2->name[0]) == 0)
|
||||
result = strcmp (sbp1->name, sbp2->name);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
/* Sort the table of shell builtins so that the binary search will work
|
||||
in find_shell_builtin. */
|
||||
void
|
||||
initialize_shell_builtins ()
|
||||
{
|
||||
qsort (shell_builtins, num_shell_builtins, sizeof (struct builtin),
|
||||
(QSFUNC *)shell_builtin_compare);
|
||||
}
|
||||
@@ -0,0 +1,859 @@
|
||||
This file is set.def, from which is created set.c.
|
||||
It implements the "set" and "unset" builtins in Bash.
|
||||
|
||||
Copyright (C) 1987-2009 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
Bash is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bash. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
$PRODUCES set.c
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# ifdef _MINIX
|
||||
# include <sys/types.h>
|
||||
# endif
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "../bashansi.h"
|
||||
#include "../bashintl.h"
|
||||
|
||||
#include "../shell.h"
|
||||
#include "../flags.h"
|
||||
#include "common.h"
|
||||
#include "bashgetopt.h"
|
||||
|
||||
#if defined (READLINE)
|
||||
# include "../input.h"
|
||||
# include "../bashline.h"
|
||||
# include <readline/readline.h>
|
||||
#endif
|
||||
|
||||
#if defined (HISTORY)
|
||||
# include "../bashhist.h"
|
||||
#endif
|
||||
|
||||
extern int posixly_correct, ignoreeof, eof_encountered_limit;
|
||||
#if defined (HISTORY)
|
||||
extern int dont_save_function_defs;
|
||||
#endif
|
||||
#if defined (READLINE)
|
||||
extern int no_line_editing;
|
||||
#endif /* READLINE */
|
||||
|
||||
$BUILTIN set
|
||||
$FUNCTION set_builtin
|
||||
$SHORT_DOC set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
|
||||
Set or unset values of shell options and positional parameters.
|
||||
|
||||
Change the value of shell attributes and positional parameters, or
|
||||
display the names and values of shell variables.
|
||||
|
||||
Options:
|
||||
-a Mark variables which are modified or created for export.
|
||||
-b Notify of job termination immediately.
|
||||
-e Exit immediately if a command exits with a non-zero status.
|
||||
-f Disable file name generation (globbing).
|
||||
-h Remember the location of commands as they are looked up.
|
||||
-k All assignment arguments are placed in the environment for a
|
||||
command, not just those that precede the command name.
|
||||
-m Job control is enabled.
|
||||
-n Read commands but do not execute them.
|
||||
-o option-name
|
||||
Set the variable corresponding to option-name:
|
||||
allexport same as -a
|
||||
braceexpand same as -B
|
||||
#if defined (READLINE)
|
||||
emacs use an emacs-style line editing interface
|
||||
#endif /* READLINE */
|
||||
errexit same as -e
|
||||
errtrace same as -E
|
||||
functrace same as -T
|
||||
hashall same as -h
|
||||
#if defined (BANG_HISTORY)
|
||||
histexpand same as -H
|
||||
#endif /* BANG_HISTORY */
|
||||
#if defined (HISTORY)
|
||||
history enable command history
|
||||
#endif
|
||||
ignoreeof the shell will not exit upon reading EOF
|
||||
interactive-comments
|
||||
allow comments to appear in interactive commands
|
||||
keyword same as -k
|
||||
monitor same as -m
|
||||
noclobber same as -C
|
||||
noexec same as -n
|
||||
noglob same as -f
|
||||
nolog currently accepted but ignored
|
||||
notify same as -b
|
||||
nounset same as -u
|
||||
onecmd same as -t
|
||||
physical same as -P
|
||||
pipefail the return value of a pipeline is the status of
|
||||
the last command to exit with a non-zero status,
|
||||
or zero if no command exited with a non-zero status
|
||||
posix change the behavior of bash where the default
|
||||
operation differs from the Posix standard to
|
||||
match the standard
|
||||
privileged same as -p
|
||||
verbose same as -v
|
||||
#if defined (READLINE)
|
||||
vi use a vi-style line editing interface
|
||||
#endif /* READLINE */
|
||||
xtrace same as -x
|
||||
-p Turned on whenever the real and effective user ids do not match.
|
||||
Disables processing of the $ENV file and importing of shell
|
||||
functions. Turning this option off causes the effective uid and
|
||||
gid to be set to the real uid and gid.
|
||||
-t Exit after reading and executing one command.
|
||||
-u Treat unset variables as an error when substituting.
|
||||
-v Print shell input lines as they are read.
|
||||
-x Print commands and their arguments as they are executed.
|
||||
#if defined (BRACE_EXPANSION)
|
||||
-B the shell will perform brace expansion
|
||||
#endif /* BRACE_EXPANSION */
|
||||
-C If set, disallow existing regular files to be overwritten
|
||||
by redirection of output.
|
||||
-E If set, the ERR trap is inherited by shell functions.
|
||||
#if defined (BANG_HISTORY)
|
||||
-H Enable ! style history substitution. This flag is on
|
||||
by default when the shell is interactive.
|
||||
#endif /* BANG_HISTORY */
|
||||
-P If set, do not follow symbolic links when executing commands
|
||||
such as cd which change the current directory.
|
||||
-T If set, the DEBUG trap is inherited by shell functions.
|
||||
-- Assign any remaining arguments to the positional parameters.
|
||||
If there are no remaining arguments, the positional parameters
|
||||
are unset.
|
||||
- Assign any remaining arguments to the positional parameters.
|
||||
The -x and -v options are turned off.
|
||||
|
||||
Using + rather than - causes these flags to be turned off. The
|
||||
flags can also be used upon invocation of the shell. The current
|
||||
set of flags may be found in $-. The remaining n ARGs are positional
|
||||
parameters and are assigned, in order, to $1, $2, .. $n. If no
|
||||
ARGs are given, all shell variables are printed.
|
||||
|
||||
Exit Status:
|
||||
Returns success unless an invalid option is given.
|
||||
$END
|
||||
|
||||
typedef int setopt_set_func_t __P((int, char *));
|
||||
typedef int setopt_get_func_t __P((char *));
|
||||
|
||||
static void print_minus_o_option __P((char *, int, int));
|
||||
static void print_all_shell_variables __P((void));
|
||||
|
||||
static int set_ignoreeof __P((int, char *));
|
||||
static int set_posix_mode __P((int, char *));
|
||||
|
||||
#if defined (READLINE)
|
||||
static int set_edit_mode __P((int, char *));
|
||||
static int get_edit_mode __P((char *));
|
||||
#endif
|
||||
|
||||
#if defined (HISTORY)
|
||||
static int bash_set_history __P((int, char *));
|
||||
#endif
|
||||
|
||||
static const char * const on = "on";
|
||||
static const char * const off = "off";
|
||||
|
||||
/* A struct used to match long options for set -o to the corresponding
|
||||
option letter or internal variable. The functions can be called to
|
||||
dynamically generate values. */
|
||||
const struct {
|
||||
char *name;
|
||||
int letter;
|
||||
int *variable;
|
||||
setopt_set_func_t *set_func;
|
||||
setopt_get_func_t *get_func;
|
||||
} o_options[] = {
|
||||
{ "allexport", 'a', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
|
||||
#if defined (BRACE_EXPANSION)
|
||||
{ "braceexpand",'B', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
|
||||
#endif
|
||||
#if defined (READLINE)
|
||||
{ "emacs", '\0', (int *)NULL, set_edit_mode, get_edit_mode },
|
||||
#endif
|
||||
{ "errexit", 'e', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
|
||||
{ "errtrace", 'E', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
|
||||
{ "functrace", 'T', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
|
||||
{ "hashall", 'h', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
|
||||
#if defined (BANG_HISTORY)
|
||||
{ "histexpand", 'H', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
|
||||
#endif /* BANG_HISTORY */
|
||||
#if defined (HISTORY)
|
||||
{ "history", '\0', &enable_history_list, bash_set_history, (setopt_get_func_t *)NULL },
|
||||
#endif
|
||||
{ "ignoreeof", '\0', &ignoreeof, set_ignoreeof, (setopt_get_func_t *)NULL },
|
||||
{ "interactive-comments", '\0', &interactive_comments, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
|
||||
{ "keyword", 'k', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
|
||||
{ "monitor", 'm', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
|
||||
{ "noclobber", 'C', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
|
||||
{ "noexec", 'n', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
|
||||
{ "noglob", 'f', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
|
||||
#if defined (HISTORY)
|
||||
{ "nolog", '\0', &dont_save_function_defs, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
|
||||
#endif
|
||||
#if defined (JOB_CONTROL)
|
||||
{ "notify", 'b', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
|
||||
#endif /* JOB_CONTROL */
|
||||
{ "nounset", 'u', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
|
||||
{ "onecmd", 't', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
|
||||
{ "physical", 'P', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
|
||||
{ "pipefail", '\0', &pipefail_opt, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
|
||||
{ "posix", '\0', &posixly_correct, set_posix_mode, (setopt_get_func_t *)NULL },
|
||||
{ "privileged", 'p', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
|
||||
{ "verbose", 'v', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
|
||||
#if defined (READLINE)
|
||||
{ "vi", '\0', (int *)NULL, set_edit_mode, get_edit_mode },
|
||||
#endif
|
||||
{ "xtrace", 'x', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
|
||||
{(char *)NULL, 0 , (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
|
||||
};
|
||||
|
||||
#define N_O_OPTIONS (sizeof (o_options) / sizeof (o_options[0]))
|
||||
|
||||
#define GET_BINARY_O_OPTION_VALUE(i, name) \
|
||||
((o_options[i].get_func) ? (*o_options[i].get_func) (name) \
|
||||
: (*o_options[i].variable))
|
||||
|
||||
#define SET_BINARY_O_OPTION_VALUE(i, onoff, name) \
|
||||
((o_options[i].set_func) ? (*o_options[i].set_func) (onoff, name) \
|
||||
: (*o_options[i].variable = (onoff == FLAG_ON)))
|
||||
|
||||
int
|
||||
minus_o_option_value (name)
|
||||
char *name;
|
||||
{
|
||||
register int i;
|
||||
int *on_or_off;
|
||||
|
||||
for (i = 0; o_options[i].name; i++)
|
||||
{
|
||||
if (STREQ (name, o_options[i].name))
|
||||
{
|
||||
if (o_options[i].letter)
|
||||
{
|
||||
on_or_off = find_flag (o_options[i].letter);
|
||||
return ((on_or_off == FLAG_UNKNOWN) ? -1 : *on_or_off);
|
||||
}
|
||||
else
|
||||
return (GET_BINARY_O_OPTION_VALUE (i, name));
|
||||
}
|
||||
}
|
||||
|
||||
return (-1);
|
||||
}
|
||||
|
||||
#define MINUS_O_FORMAT "%-15s\t%s\n"
|
||||
|
||||
static void
|
||||
print_minus_o_option (name, value, pflag)
|
||||
char *name;
|
||||
int value, pflag;
|
||||
{
|
||||
if (pflag == 0)
|
||||
printf (MINUS_O_FORMAT, name, value ? on : off);
|
||||
else
|
||||
printf ("set %co %s\n", value ? '-' : '+', name);
|
||||
}
|
||||
|
||||
void
|
||||
list_minus_o_opts (mode, reusable)
|
||||
int mode, reusable;
|
||||
{
|
||||
register int i;
|
||||
int *on_or_off, value;
|
||||
|
||||
for (i = 0; o_options[i].name; i++)
|
||||
{
|
||||
if (o_options[i].letter)
|
||||
{
|
||||
value = 0;
|
||||
on_or_off = find_flag (o_options[i].letter);
|
||||
if (on_or_off == FLAG_UNKNOWN)
|
||||
on_or_off = &value;
|
||||
if (mode == -1 || mode == *on_or_off)
|
||||
print_minus_o_option (o_options[i].name, *on_or_off, reusable);
|
||||
}
|
||||
else
|
||||
{
|
||||
value = GET_BINARY_O_OPTION_VALUE (i, o_options[i].name);
|
||||
if (mode == -1 || mode == value)
|
||||
print_minus_o_option (o_options[i].name, value, reusable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
char **
|
||||
get_minus_o_opts ()
|
||||
{
|
||||
char **ret;
|
||||
int i;
|
||||
|
||||
ret = strvec_create (N_O_OPTIONS + 1);
|
||||
for (i = 0; o_options[i].name; i++)
|
||||
ret[i] = o_options[i].name;
|
||||
ret[i] = (char *)NULL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
set_ignoreeof (on_or_off, option_name)
|
||||
int on_or_off;
|
||||
char *option_name;
|
||||
{
|
||||
ignoreeof = on_or_off == FLAG_ON;
|
||||
unbind_variable ("ignoreeof");
|
||||
if (ignoreeof)
|
||||
bind_variable ("IGNOREEOF", "10", 0);
|
||||
else
|
||||
unbind_variable ("IGNOREEOF");
|
||||
sv_ignoreeof ("IGNOREEOF");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
set_posix_mode (on_or_off, option_name)
|
||||
int on_or_off;
|
||||
char *option_name;
|
||||
{
|
||||
posixly_correct = on_or_off == FLAG_ON;
|
||||
if (posixly_correct == 0)
|
||||
unbind_variable ("POSIXLY_CORRECT");
|
||||
else
|
||||
bind_variable ("POSIXLY_CORRECT", "y", 0);
|
||||
sv_strict_posix ("POSIXLY_CORRECT");
|
||||
return (0);
|
||||
}
|
||||
|
||||
#if defined (READLINE)
|
||||
/* Magic. This code `knows' how readline handles rl_editing_mode. */
|
||||
static int
|
||||
set_edit_mode (on_or_off, option_name)
|
||||
int on_or_off;
|
||||
char *option_name;
|
||||
{
|
||||
int isemacs;
|
||||
|
||||
if (on_or_off == FLAG_ON)
|
||||
{
|
||||
rl_variable_bind ("editing-mode", option_name);
|
||||
|
||||
if (interactive)
|
||||
with_input_from_stdin ();
|
||||
no_line_editing = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
isemacs = rl_editing_mode == 1;
|
||||
if ((isemacs && *option_name == 'e') || (!isemacs && *option_name == 'v'))
|
||||
{
|
||||
if (interactive)
|
||||
with_input_from_stream (stdin, "stdin");
|
||||
no_line_editing = 1;
|
||||
}
|
||||
}
|
||||
return 1-no_line_editing;
|
||||
}
|
||||
|
||||
static int
|
||||
get_edit_mode (name)
|
||||
char *name;
|
||||
{
|
||||
return (*name == 'e' ? no_line_editing == 0 && rl_editing_mode == 1
|
||||
: no_line_editing == 0 && rl_editing_mode == 0);
|
||||
}
|
||||
#endif /* READLINE */
|
||||
|
||||
#if defined (HISTORY)
|
||||
static int
|
||||
bash_set_history (on_or_off, option_name)
|
||||
int on_or_off;
|
||||
char *option_name;
|
||||
{
|
||||
if (on_or_off == FLAG_ON)
|
||||
{
|
||||
enable_history_list = 1;
|
||||
bash_history_enable ();
|
||||
if (history_lines_this_session == 0)
|
||||
load_history ();
|
||||
}
|
||||
else
|
||||
{
|
||||
enable_history_list = 0;
|
||||
bash_history_disable ();
|
||||
}
|
||||
return (1 - enable_history_list);
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
set_minus_o_option (on_or_off, option_name)
|
||||
int on_or_off;
|
||||
char *option_name;
|
||||
{
|
||||
register int i;
|
||||
|
||||
for (i = 0; o_options[i].name; i++)
|
||||
{
|
||||
if (STREQ (option_name, o_options[i].name))
|
||||
{
|
||||
if (o_options[i].letter == 0)
|
||||
{
|
||||
SET_BINARY_O_OPTION_VALUE (i, on_or_off, option_name);
|
||||
return (EXECUTION_SUCCESS);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (change_flag (o_options[i].letter, on_or_off) == FLAG_ERROR)
|
||||
{
|
||||
sh_invalidoptname (option_name);
|
||||
return (EXECUTION_FAILURE);
|
||||
}
|
||||
else
|
||||
return (EXECUTION_SUCCESS);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
sh_invalidoptname (option_name);
|
||||
return (EX_USAGE);
|
||||
}
|
||||
|
||||
static void
|
||||
print_all_shell_variables ()
|
||||
{
|
||||
SHELL_VAR **vars;
|
||||
|
||||
vars = all_shell_variables ();
|
||||
if (vars)
|
||||
{
|
||||
print_var_list (vars);
|
||||
free (vars);
|
||||
}
|
||||
|
||||
/* POSIX.2 does not allow function names and definitions to be output when
|
||||
`set' is invoked without options (PASC Interp #202). */
|
||||
if (posixly_correct == 0)
|
||||
{
|
||||
vars = all_shell_functions ();
|
||||
if (vars)
|
||||
{
|
||||
print_func_list (vars);
|
||||
free (vars);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
set_shellopts ()
|
||||
{
|
||||
char *value;
|
||||
char tflag[N_O_OPTIONS];
|
||||
int vsize, i, vptr, *ip, exported;
|
||||
SHELL_VAR *v;
|
||||
|
||||
itrace("set_shellopts: entry");
|
||||
for (vsize = i = 0; o_options[i].name; i++)
|
||||
{
|
||||
tflag[i] = 0;
|
||||
if (o_options[i].letter)
|
||||
{
|
||||
ip = find_flag (o_options[i].letter);
|
||||
if (ip && *ip)
|
||||
{
|
||||
vsize += strlen (o_options[i].name) + 1;
|
||||
tflag[i] = 1;
|
||||
}
|
||||
}
|
||||
else if (GET_BINARY_O_OPTION_VALUE (i, o_options[i].name))
|
||||
{
|
||||
vsize += strlen (o_options[i].name) + 1;
|
||||
tflag[i] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
value = (char *)xmalloc (vsize + 1);
|
||||
|
||||
for (i = vptr = 0; o_options[i].name; i++)
|
||||
{
|
||||
if (tflag[i])
|
||||
{
|
||||
strcpy (value + vptr, o_options[i].name);
|
||||
vptr += strlen (o_options[i].name);
|
||||
value[vptr++] = ':';
|
||||
}
|
||||
}
|
||||
|
||||
if (vptr)
|
||||
vptr--; /* cut off trailing colon */
|
||||
value[vptr] = '\0';
|
||||
|
||||
v = find_variable ("SHELLOPTS");
|
||||
itrace("set_shellopts: v = %p", v);
|
||||
/* Turn off the read-only attribute so we can bind the new value, and
|
||||
note whether or not the variable was exported. */
|
||||
if (v)
|
||||
{
|
||||
VUNSETATTR (v, att_readonly);
|
||||
exported = exported_p (v);
|
||||
}
|
||||
else
|
||||
exported = 0;
|
||||
|
||||
v = bind_variable ("SHELLOPTS", value, 0);
|
||||
|
||||
/* Turn the read-only attribute back on, and turn off the export attribute
|
||||
if it was set implicitly by mark_modified_vars and SHELLOPTS was not
|
||||
exported before we bound the new value. */
|
||||
VSETATTR (v, att_readonly);
|
||||
if (mark_modified_vars && exported == 0 && exported_p (v))
|
||||
VUNSETATTR (v, att_exported);
|
||||
|
||||
free (value);
|
||||
itrace("set_shellopts: return");
|
||||
}
|
||||
|
||||
void
|
||||
parse_shellopts (value)
|
||||
char *value;
|
||||
{
|
||||
char *vname;
|
||||
int vptr;
|
||||
|
||||
vptr = 0;
|
||||
while (vname = extract_colon_unit (value, &vptr))
|
||||
{
|
||||
set_minus_o_option (FLAG_ON, vname);
|
||||
free (vname);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
initialize_shell_options (no_shellopts)
|
||||
int no_shellopts;
|
||||
{
|
||||
char *temp;
|
||||
SHELL_VAR *var;
|
||||
|
||||
if (no_shellopts == 0)
|
||||
{
|
||||
var = find_variable ("SHELLOPTS");
|
||||
/* set up any shell options we may have inherited. */
|
||||
if (var && imported_p (var))
|
||||
{
|
||||
temp = (array_p (var) || assoc_p (var)) ? (char *)NULL : savestring (value_cell (var));
|
||||
if (temp)
|
||||
{
|
||||
parse_shellopts (temp);
|
||||
free (temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Set up the $SHELLOPTS variable. */
|
||||
set_shellopts ();
|
||||
}
|
||||
|
||||
/* Reset the values of the -o options that are not also shell flags. This is
|
||||
called from execute_cmd.c:initialize_subshell() when setting up a subshell
|
||||
to run an executable shell script without a leading `#!'. */
|
||||
void
|
||||
reset_shell_options ()
|
||||
{
|
||||
#if defined (HISTORY)
|
||||
remember_on_history = enable_history_list = 1;
|
||||
#endif
|
||||
ignoreeof = 0;
|
||||
}
|
||||
|
||||
/* Set some flags from the word values in the input list. If LIST is empty,
|
||||
then print out the values of the variables instead. If LIST contains
|
||||
non-flags, then set $1 - $9 to the successive words of LIST. */
|
||||
int
|
||||
set_builtin (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
int on_or_off, flag_name, force_assignment, opts_changed, rv, r;
|
||||
register char *arg;
|
||||
char s[3];
|
||||
|
||||
if (list == 0)
|
||||
{
|
||||
print_all_shell_variables ();
|
||||
return (sh_chkwrite (EXECUTION_SUCCESS));
|
||||
}
|
||||
|
||||
/* Check validity of flag arguments. */
|
||||
rv = EXECUTION_SUCCESS;
|
||||
reset_internal_getopt ();
|
||||
while ((flag_name = internal_getopt (list, optflags)) != -1)
|
||||
{
|
||||
switch (flag_name)
|
||||
{
|
||||
case '?':
|
||||
builtin_usage ();
|
||||
return (list_optopt == '?' ? EXECUTION_SUCCESS : EX_USAGE);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Do the set command. While the list consists of words starting with
|
||||
'-' or '+' treat them as flags, otherwise, start assigning them to
|
||||
$1 ... $n. */
|
||||
for (force_assignment = opts_changed = 0; list; )
|
||||
{
|
||||
arg = list->word->word;
|
||||
|
||||
/* If the argument is `--' or `-' then signal the end of the list
|
||||
and remember the remaining arguments. */
|
||||
if (arg[0] == '-' && (!arg[1] || (arg[1] == '-' && !arg[2])))
|
||||
{
|
||||
list = list->next;
|
||||
|
||||
/* `set --' unsets the positional parameters. */
|
||||
if (arg[1] == '-')
|
||||
force_assignment = 1;
|
||||
|
||||
/* Until told differently, the old shell behaviour of
|
||||
`set - [arg ...]' being equivalent to `set +xv [arg ...]'
|
||||
stands. Posix.2 says the behaviour is marked as obsolescent. */
|
||||
else
|
||||
{
|
||||
change_flag ('x', '+');
|
||||
change_flag ('v', '+');
|
||||
opts_changed = 1;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if ((on_or_off = *arg) && (on_or_off == '-' || on_or_off == '+'))
|
||||
{
|
||||
while (flag_name = *++arg)
|
||||
{
|
||||
if (flag_name == '?')
|
||||
{
|
||||
builtin_usage ();
|
||||
return (EXECUTION_SUCCESS);
|
||||
}
|
||||
else if (flag_name == 'o') /* -+o option-name */
|
||||
{
|
||||
char *option_name;
|
||||
WORD_LIST *opt;
|
||||
|
||||
opt = list->next;
|
||||
|
||||
if (opt == 0)
|
||||
{
|
||||
list_minus_o_opts (-1, (on_or_off == '+'));
|
||||
rv = sh_chkwrite (rv);
|
||||
continue;
|
||||
}
|
||||
|
||||
option_name = opt->word->word;
|
||||
|
||||
if (option_name == 0 || *option_name == '\0' ||
|
||||
*option_name == '-' || *option_name == '+')
|
||||
{
|
||||
list_minus_o_opts (-1, (on_or_off == '+'));
|
||||
continue;
|
||||
}
|
||||
list = list->next; /* Skip over option name. */
|
||||
|
||||
opts_changed = 1;
|
||||
if ((r = set_minus_o_option (on_or_off, option_name)) != EXECUTION_SUCCESS)
|
||||
{
|
||||
set_shellopts ();
|
||||
return (r);
|
||||
}
|
||||
}
|
||||
else if (change_flag (flag_name, on_or_off) == FLAG_ERROR)
|
||||
{
|
||||
s[0] = on_or_off;
|
||||
s[1] = flag_name;
|
||||
s[2] = '\0';
|
||||
sh_invalidopt (s);
|
||||
builtin_usage ();
|
||||
set_shellopts ();
|
||||
return (EXECUTION_FAILURE);
|
||||
}
|
||||
opts_changed = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
/* Assigning $1 ... $n */
|
||||
if (list || force_assignment)
|
||||
remember_args (list, 1);
|
||||
/* Set up new value of $SHELLOPTS */
|
||||
if (opts_changed)
|
||||
set_shellopts ();
|
||||
return (rv);
|
||||
}
|
||||
|
||||
$BUILTIN unset
|
||||
$FUNCTION unset_builtin
|
||||
$SHORT_DOC unset [-f] [-v] [name ...]
|
||||
Unset values and attributes of shell variables and functions.
|
||||
|
||||
For each NAME, remove the corresponding variable or function.
|
||||
|
||||
Options:
|
||||
-f treat each NAME as a shell function
|
||||
-v treat each NAME as a shell variable
|
||||
|
||||
Without options, unset first tries to unset a variable, and if that fails,
|
||||
tries to unset a function.
|
||||
|
||||
Some variables cannot be unset; also see `readonly'.
|
||||
|
||||
Exit Status:
|
||||
Returns success unless an invalid option is given or a NAME is read-only.
|
||||
$END
|
||||
|
||||
#define NEXT_VARIABLE() any_failed++; list = list->next; continue;
|
||||
|
||||
int
|
||||
unset_builtin (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
int unset_function, unset_variable, unset_array, opt, any_failed;
|
||||
char *name;
|
||||
|
||||
unset_function = unset_variable = unset_array = any_failed = 0;
|
||||
|
||||
reset_internal_getopt ();
|
||||
while ((opt = internal_getopt (list, "fv")) != -1)
|
||||
{
|
||||
switch (opt)
|
||||
{
|
||||
case 'f':
|
||||
unset_function = 1;
|
||||
break;
|
||||
case 'v':
|
||||
unset_variable = 1;
|
||||
break;
|
||||
default:
|
||||
builtin_usage ();
|
||||
return (EX_USAGE);
|
||||
}
|
||||
}
|
||||
|
||||
list = loptend;
|
||||
|
||||
if (unset_function && unset_variable)
|
||||
{
|
||||
builtin_error (_("cannot simultaneously unset a function and a variable"));
|
||||
return (EXECUTION_FAILURE);
|
||||
}
|
||||
|
||||
while (list)
|
||||
{
|
||||
SHELL_VAR *var;
|
||||
int tem;
|
||||
#if defined (ARRAY_VARS)
|
||||
char *t;
|
||||
#endif
|
||||
|
||||
name = list->word->word;
|
||||
|
||||
#if defined (ARRAY_VARS)
|
||||
unset_array = 0;
|
||||
if (!unset_function && valid_array_reference (name))
|
||||
{
|
||||
t = strchr (name, '[');
|
||||
*t++ = '\0';
|
||||
unset_array++;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Bash allows functions with names which are not valid identifiers
|
||||
to be created when not in posix mode, so check only when in posix
|
||||
mode when unsetting a function. */
|
||||
if (((unset_function && posixly_correct) || !unset_function) && legal_identifier (name) == 0)
|
||||
{
|
||||
sh_invalidid (name);
|
||||
NEXT_VARIABLE ();
|
||||
}
|
||||
|
||||
var = unset_function ? find_function (name) : find_variable (name);
|
||||
|
||||
if (var && !unset_function && non_unsettable_p (var))
|
||||
{
|
||||
builtin_error (_("%s: cannot unset"), name);
|
||||
NEXT_VARIABLE ();
|
||||
}
|
||||
|
||||
/* Posix.2 says that unsetting readonly variables is an error. */
|
||||
if (var && readonly_p (var))
|
||||
{
|
||||
builtin_error (_("%s: cannot unset: readonly %s"),
|
||||
name, unset_function ? "function" : "variable");
|
||||
NEXT_VARIABLE ();
|
||||
}
|
||||
|
||||
/* Unless the -f option is supplied, the name refers to a variable. */
|
||||
#if defined (ARRAY_VARS)
|
||||
if (var && unset_array)
|
||||
{
|
||||
if (array_p (var) == 0 && assoc_p (var) == 0)
|
||||
{
|
||||
builtin_error (_("%s: not an array variable"), name);
|
||||
NEXT_VARIABLE ();
|
||||
}
|
||||
else
|
||||
{
|
||||
tem = unbind_array_element (var, t);
|
||||
if (tem == -1)
|
||||
any_failed++;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif /* ARRAY_VARS */
|
||||
tem = unset_function ? unbind_func (name) : unbind_variable (name);
|
||||
|
||||
/* This is what Posix.2 draft 11+ says. ``If neither -f nor -v
|
||||
is specified, the name refers to a variable; if a variable by
|
||||
that name does not exist, a function by that name, if any,
|
||||
shall be unset.'' */
|
||||
if (tem == -1 && !unset_function && !unset_variable)
|
||||
tem = unbind_func (name);
|
||||
|
||||
/* SUSv3, POSIX.1-2001 say: ``Unsetting a variable or function that
|
||||
was not previously set shall not be considered an error.'' */
|
||||
|
||||
if (unset_function == 0)
|
||||
stupidly_hack_special_variables (name);
|
||||
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
return (any_failed ? EXECUTION_FAILURE : EXECUTION_SUCCESS);
|
||||
}
|
||||
+12
-2
@@ -3560,7 +3560,10 @@ This is semantically equivalent to
|
||||
\fB>\fP\fIword\fP 2\fB>&\fP1
|
||||
.RE
|
||||
.PP
|
||||
(see \fBDuplicating File Descriptors\fP below).
|
||||
When using the second form, \fIword\fP may not expand to a number or
|
||||
\fB\-\fP. If it does, other redirection operators apply
|
||||
(see \fBDuplicating File Descriptors\fP below) for compatibility
|
||||
reasons.
|
||||
.SS Appending Standard Output and Standard Error
|
||||
.PP
|
||||
This construct allows both the
|
||||
@@ -3688,8 +3691,15 @@ is not specified, the standard output (file descriptor 1) is used.
|
||||
If the digits in
|
||||
.I word
|
||||
do not specify a file descriptor open for output, a redirection error occurs.
|
||||
If
|
||||
.I word
|
||||
evaluates to
|
||||
.BR \- ,
|
||||
file descriptor
|
||||
.I n
|
||||
is closed.
|
||||
As a special case, if \fIn\fP is omitted, and \fIword\fP does not
|
||||
expand to one or more digits, the standard output and standard
|
||||
expand to one or more digits or \fB\-\fP, the standard output and standard
|
||||
error are redirected as described previously.
|
||||
.SS "Moving File Descriptors"
|
||||
.PP
|
||||
|
||||
+10
-1
@@ -965,6 +965,8 @@ That command is usually a \fIlist\fP of commands between { and }, but
|
||||
may be any command listed under \fBCompound Commands\fP above.
|
||||
\fIcompound\-command\fP is executed whenever \fIname\fP is specified as the
|
||||
name of a simple command.
|
||||
When in \fIposix mode\fP, \fIname\fP may not be the name of one of the
|
||||
POSIX \fIspecial builtins\fP.
|
||||
Any redirections (see
|
||||
.SM
|
||||
.B REDIRECTION
|
||||
@@ -3686,8 +3688,15 @@ is not specified, the standard output (file descriptor 1) is used.
|
||||
If the digits in
|
||||
.I word
|
||||
do not specify a file descriptor open for output, a redirection error occurs.
|
||||
If
|
||||
.I word
|
||||
evaluates to
|
||||
.BR \- ,
|
||||
file descriptor
|
||||
.I n
|
||||
is closed.
|
||||
As a special case, if \fIn\fP is omitted, and \fIword\fP does not
|
||||
expand to one or more digits, the standard output and standard
|
||||
expand to one or more digits or \fB\-\fP, the standard output and standard
|
||||
error are redirected as described previously.
|
||||
.SS "Moving File Descriptors"
|
||||
.PP
|
||||
|
||||
+8
-4
@@ -2358,7 +2358,9 @@ This is semantically equivalent to
|
||||
@example
|
||||
>@var{word} 2>&1
|
||||
@end example
|
||||
(see Duplicating File Descriptors below).
|
||||
When using the second form, @var{word} may not expand to a number or
|
||||
@samp{-}. If it does, other redirection operators apply
|
||||
(see Duplicating File Descriptors below) for compatibility reasons.
|
||||
|
||||
@subsection Appending Standard Output and Standard Error
|
||||
This construct allows both the
|
||||
@@ -2436,8 +2438,8 @@ is made to be a copy of that file descriptor.
|
||||
If the digits in @var{word} do not specify a file descriptor open for
|
||||
input, a redirection error occurs.
|
||||
If @var{word}
|
||||
evaluates to @samp{-}, file descriptor @var{n} is closed. If
|
||||
@var{n} is not specified, the standard input (file descriptor 0) is used.
|
||||
evaluates to @samp{-}, file descriptor @var{n} is closed.
|
||||
If @var{n} is not specified, the standard input (file descriptor 0) is used.
|
||||
|
||||
The operator
|
||||
@example
|
||||
@@ -2448,8 +2450,10 @@ is used similarly to duplicate output file descriptors. If
|
||||
@var{n} is not specified, the standard output (file descriptor 1) is used.
|
||||
If the digits in @var{word} do not specify a file descriptor open for
|
||||
output, a redirection error occurs.
|
||||
If @var{word}
|
||||
evaluates to @samp{-}, file descriptor @var{n} is closed.
|
||||
As a special case, if @var{n} is omitted, and @var{word} does not
|
||||
expand to one or more digits, the standard output and standard
|
||||
expand to one or more digits or @samp{-}, the standard output and standard
|
||||
error are redirected as described previously.
|
||||
|
||||
@subsection Moving File Descriptors
|
||||
|
||||
+8
-3
@@ -1262,6 +1262,9 @@ That command is usually a @var{list} enclosed between @{ and @}, but
|
||||
may be any compound command listed above.
|
||||
@var{compound-command} is executed whenever @var{name} is specified as the
|
||||
name of a command.
|
||||
When the shell is in @sc{posix} mode (@pxref{Bash POSIX Mode}),
|
||||
@var{name} may not be the same as one of the special builtins
|
||||
(@pxref{Special Builtins}).
|
||||
Any redirections (@pxref{Redirections}) associated with the shell function
|
||||
are performed when the function is executed.
|
||||
|
||||
@@ -2433,8 +2436,8 @@ is made to be a copy of that file descriptor.
|
||||
If the digits in @var{word} do not specify a file descriptor open for
|
||||
input, a redirection error occurs.
|
||||
If @var{word}
|
||||
evaluates to @samp{-}, file descriptor @var{n} is closed. If
|
||||
@var{n} is not specified, the standard input (file descriptor 0) is used.
|
||||
evaluates to @samp{-}, file descriptor @var{n} is closed.
|
||||
If @var{n} is not specified, the standard input (file descriptor 0) is used.
|
||||
|
||||
The operator
|
||||
@example
|
||||
@@ -2445,8 +2448,10 @@ is used similarly to duplicate output file descriptors. If
|
||||
@var{n} is not specified, the standard output (file descriptor 1) is used.
|
||||
If the digits in @var{word} do not specify a file descriptor open for
|
||||
output, a redirection error occurs.
|
||||
If @var{word}
|
||||
evaluates to @samp{-}, file descriptor @var{n} is closed.
|
||||
As a special case, if @var{n} is omitted, and @var{word} does not
|
||||
expand to one or more digits, the standard output and standard
|
||||
expand to one or more digits or @samp{-}, the standard output and standard
|
||||
error are redirected as described previously.
|
||||
|
||||
@subsection Moving File Descriptors
|
||||
|
||||
+3
-3
@@ -2,9 +2,9 @@
|
||||
Copyright (C) 1988-2011 Free Software Foundation, Inc.
|
||||
@end ignore
|
||||
|
||||
@set LASTCHANGE Sun Sep 25 22:01:31 EDT 2011
|
||||
@set LASTCHANGE Fri Oct 14 13:18:35 EDT 2011
|
||||
|
||||
@set EDITION 4.2
|
||||
@set VERSION 4.2
|
||||
@set UPDATED 25 September 2011
|
||||
@set UPDATED-MONTH September 2011
|
||||
@set UPDATED 14 October 2011
|
||||
@set UPDATED-MONTH October 2011
|
||||
|
||||
+2
-2
@@ -2,9 +2,9 @@
|
||||
Copyright (C) 1988-2011 Free Software Foundation, Inc.
|
||||
@end ignore
|
||||
|
||||
@set LASTCHANGE Mon Sep 19 21:46:24 EDT 2011
|
||||
@set LASTCHANGE Sun Sep 25 22:01:31 EDT 2011
|
||||
|
||||
@set EDITION 4.2
|
||||
@set VERSION 4.2
|
||||
@set UPDATED 19 September 2011
|
||||
@set UPDATED 25 September 2011
|
||||
@set UPDATED-MONTH September 2011
|
||||
|
||||
@@ -0,0 +1,457 @@
|
||||
/* error.c -- Functions for handling errors. */
|
||||
|
||||
/* Copyright (C) 1993-2009 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
Bash is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bash. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "bashtypes.h"
|
||||
#include <fcntl.h>
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if defined (PREFER_STDARG)
|
||||
# include <stdarg.h>
|
||||
#else
|
||||
# include <varargs.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <errno.h>
|
||||
#if !defined (errno)
|
||||
extern int errno;
|
||||
#endif /* !errno */
|
||||
|
||||
#include "bashansi.h"
|
||||
#include "bashintl.h"
|
||||
|
||||
#include "shell.h"
|
||||
#include "flags.h"
|
||||
#include "input.h"
|
||||
|
||||
#if defined (HISTORY)
|
||||
# include "bashhist.h"
|
||||
#endif
|
||||
|
||||
extern int executing_line_number __P((void));
|
||||
|
||||
extern int last_command_exit_value;
|
||||
extern char *shell_name;
|
||||
#if defined (JOB_CONTROL)
|
||||
extern pid_t shell_pgrp;
|
||||
extern int give_terminal_to __P((pid_t, int));
|
||||
#endif /* JOB_CONTROL */
|
||||
|
||||
#if defined (ARRAY_VARS)
|
||||
extern const char * const bash_badsub_errmsg;
|
||||
#endif
|
||||
|
||||
static void error_prolog __P((int));
|
||||
|
||||
/* The current maintainer of the shell. You change this in the
|
||||
Makefile. */
|
||||
#if !defined (MAINTAINER)
|
||||
#define MAINTAINER "bash-maintainers@gnu.org"
|
||||
#endif
|
||||
|
||||
const char * const the_current_maintainer = MAINTAINER;
|
||||
|
||||
int gnu_error_format = 0;
|
||||
|
||||
static void
|
||||
error_prolog (print_lineno)
|
||||
int print_lineno;
|
||||
{
|
||||
char *ename;
|
||||
int line;
|
||||
|
||||
ename = get_name_for_error ();
|
||||
line = (print_lineno && interactive_shell == 0) ? executing_line_number () : -1;
|
||||
|
||||
if (line > 0)
|
||||
fprintf (stderr, "%s:%s%d: ", ename, gnu_error_format ? "" : _(" line "), line);
|
||||
else
|
||||
fprintf (stderr, "%s: ", ename);
|
||||
}
|
||||
|
||||
/* Return the name of the shell or the shell script for error reporting. */
|
||||
char *
|
||||
get_name_for_error ()
|
||||
{
|
||||
char *name;
|
||||
#if defined (ARRAY_VARS)
|
||||
SHELL_VAR *bash_source_v;
|
||||
ARRAY *bash_source_a;
|
||||
#endif
|
||||
|
||||
name = (char *)NULL;
|
||||
if (interactive_shell == 0)
|
||||
{
|
||||
#if defined (ARRAY_VARS)
|
||||
bash_source_v = find_variable ("BASH_SOURCE");
|
||||
if (bash_source_v && array_p (bash_source_v) &&
|
||||
(bash_source_a = array_cell (bash_source_v)))
|
||||
name = array_reference (bash_source_a, 0);
|
||||
if (name == 0 || *name == '\0') /* XXX - was just name == 0 */
|
||||
#endif
|
||||
name = dollar_vars[0];
|
||||
}
|
||||
if (name == 0 && shell_name && *shell_name)
|
||||
name = base_pathname (shell_name);
|
||||
if (name == 0)
|
||||
#if defined (PROGRAM)
|
||||
name = PROGRAM;
|
||||
#else
|
||||
name = "bash";
|
||||
#endif
|
||||
|
||||
return (name);
|
||||
}
|
||||
|
||||
/* Report an error having to do with FILENAME. This does not use
|
||||
sys_error so the filename is not interpreted as a printf-style
|
||||
format string. */
|
||||
void
|
||||
file_error (filename)
|
||||
const char *filename;
|
||||
{
|
||||
report_error ("%s: %s", filename, strerror (errno));
|
||||
}
|
||||
|
||||
void
|
||||
#if defined (PREFER_STDARG)
|
||||
programming_error (const char *format, ...)
|
||||
#else
|
||||
programming_error (format, va_alist)
|
||||
const char *format;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list args;
|
||||
char *h;
|
||||
|
||||
#if defined (JOB_CONTROL)
|
||||
give_terminal_to (shell_pgrp, 0);
|
||||
#endif /* JOB_CONTROL */
|
||||
|
||||
SH_VA_START (args, format);
|
||||
|
||||
vfprintf (stderr, format, args);
|
||||
fprintf (stderr, "\n");
|
||||
va_end (args);
|
||||
|
||||
#if defined (HISTORY)
|
||||
if (remember_on_history)
|
||||
{
|
||||
h = last_history_line ();
|
||||
fprintf (stderr, _("last command: %s\n"), h ? h : "(null)");
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
fprintf (stderr, "Report this to %s\n", the_current_maintainer);
|
||||
#endif
|
||||
|
||||
fprintf (stderr, _("Aborting..."));
|
||||
fflush (stderr);
|
||||
|
||||
abort ();
|
||||
}
|
||||
|
||||
/* Print an error message and, if `set -e' has been executed, exit the
|
||||
shell. Used in this file by file_error and programming_error. Used
|
||||
outside this file mostly to report substitution and expansion errors,
|
||||
and for bad invocation options. */
|
||||
void
|
||||
#if defined (PREFER_STDARG)
|
||||
report_error (const char *format, ...)
|
||||
#else
|
||||
report_error (format, va_alist)
|
||||
const char *format;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list args;
|
||||
|
||||
error_prolog (1);
|
||||
|
||||
SH_VA_START (args, format);
|
||||
|
||||
vfprintf (stderr, format, args);
|
||||
fprintf (stderr, "\n");
|
||||
|
||||
va_end (args);
|
||||
if (exit_immediately_on_error)
|
||||
exit_shell (1);
|
||||
}
|
||||
|
||||
void
|
||||
#if defined (PREFER_STDARG)
|
||||
fatal_error (const char *format, ...)
|
||||
#else
|
||||
fatal_error (format, va_alist)
|
||||
const char *format;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list args;
|
||||
|
||||
error_prolog (0);
|
||||
|
||||
SH_VA_START (args, format);
|
||||
|
||||
vfprintf (stderr, format, args);
|
||||
fprintf (stderr, "\n");
|
||||
|
||||
va_end (args);
|
||||
sh_exit (2);
|
||||
}
|
||||
|
||||
void
|
||||
#if defined (PREFER_STDARG)
|
||||
internal_error (const char *format, ...)
|
||||
#else
|
||||
internal_error (format, va_alist)
|
||||
const char *format;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list args;
|
||||
|
||||
error_prolog (1);
|
||||
|
||||
SH_VA_START (args, format);
|
||||
|
||||
vfprintf (stderr, format, args);
|
||||
fprintf (stderr, "\n");
|
||||
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
void
|
||||
#if defined (PREFER_STDARG)
|
||||
internal_warning (const char *format, ...)
|
||||
#else
|
||||
internal_warning (format, va_alist)
|
||||
const char *format;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list args;
|
||||
|
||||
error_prolog (1);
|
||||
fprintf (stderr, _("warning: "));
|
||||
|
||||
SH_VA_START (args, format);
|
||||
|
||||
vfprintf (stderr, format, args);
|
||||
fprintf (stderr, "\n");
|
||||
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
void
|
||||
#if defined (PREFER_STDARG)
|
||||
sys_error (const char *format, ...)
|
||||
#else
|
||||
sys_error (format, va_alist)
|
||||
const char *format;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
int e;
|
||||
va_list args;
|
||||
|
||||
e = errno;
|
||||
error_prolog (0);
|
||||
|
||||
SH_VA_START (args, format);
|
||||
|
||||
vfprintf (stderr, format, args);
|
||||
fprintf (stderr, ": %s\n", strerror (e));
|
||||
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
/* An error from the parser takes the general form
|
||||
|
||||
shell_name: input file name: line number: message
|
||||
|
||||
The input file name and line number are omitted if the shell is
|
||||
currently interactive. If the shell is not currently interactive,
|
||||
the input file name is inserted only if it is different from the
|
||||
shell name. */
|
||||
void
|
||||
#if defined (PREFER_STDARG)
|
||||
parser_error (int lineno, const char *format, ...)
|
||||
#else
|
||||
parser_error (lineno, format, va_alist)
|
||||
int lineno;
|
||||
const char *format;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list args;
|
||||
char *ename, *iname;
|
||||
|
||||
ename = get_name_for_error ();
|
||||
iname = yy_input_name ();
|
||||
|
||||
if (interactive)
|
||||
fprintf (stderr, "%s: ", ename);
|
||||
else if (interactive_shell)
|
||||
fprintf (stderr, "%s: %s:%s%d: ", ename, iname, gnu_error_format ? "" : _(" line "), lineno);
|
||||
else if (STREQ (ename, iname))
|
||||
fprintf (stderr, "%s:%s%d: ", ename, gnu_error_format ? "" : _(" line "), lineno);
|
||||
else
|
||||
fprintf (stderr, "%s: %s:%s%d: ", ename, iname, gnu_error_format ? "" : _(" line "), lineno);
|
||||
|
||||
SH_VA_START (args, format);
|
||||
|
||||
vfprintf (stderr, format, args);
|
||||
fprintf (stderr, "\n");
|
||||
|
||||
va_end (args);
|
||||
|
||||
if (exit_immediately_on_error)
|
||||
exit_shell (last_command_exit_value = 2);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void
|
||||
#if defined (PREFER_STDARG)
|
||||
itrace (const char *format, ...)
|
||||
#else
|
||||
itrace (format, va_alist)
|
||||
const char *format;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list args;
|
||||
|
||||
fprintf(stderr, "TRACE: pid %ld: ", (long)getpid());
|
||||
|
||||
SH_VA_START (args, format);
|
||||
|
||||
vfprintf (stderr, format, args);
|
||||
fprintf (stderr, "\n");
|
||||
|
||||
va_end (args);
|
||||
|
||||
fflush(stderr);
|
||||
}
|
||||
|
||||
/* A trace function for silent debugging -- doesn't require a control
|
||||
terminal. */
|
||||
void
|
||||
#if defined (PREFER_STDARG)
|
||||
trace (const char *format, ...)
|
||||
#else
|
||||
trace (format, va_alist)
|
||||
const char *format;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list args;
|
||||
static FILE *tracefp = (FILE *)NULL;
|
||||
|
||||
if (tracefp == NULL)
|
||||
tracefp = fopen("/tmp/bash-trace.log", "a+");
|
||||
|
||||
if (tracefp == NULL)
|
||||
tracefp = stderr;
|
||||
else
|
||||
fcntl (fileno (tracefp), F_SETFD, 1); /* close-on-exec */
|
||||
|
||||
fprintf(tracefp, "TRACE: pid %ld: ", (long)getpid());
|
||||
|
||||
SH_VA_START (args, format);
|
||||
|
||||
vfprintf (tracefp, format, args);
|
||||
fprintf (tracefp, "\n");
|
||||
|
||||
va_end (args);
|
||||
|
||||
fflush(tracefp);
|
||||
}
|
||||
|
||||
#endif /* DEBUG */
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Common error reporting */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
|
||||
static const char * const cmd_error_table[] = {
|
||||
N_("unknown command error"), /* CMDERR_DEFAULT */
|
||||
N_("bad command type"), /* CMDERR_BADTYPE */
|
||||
N_("bad connector"), /* CMDERR_BADCONN */
|
||||
N_("bad jump"), /* CMDERR_BADJUMP */
|
||||
0
|
||||
};
|
||||
|
||||
void
|
||||
command_error (func, code, e, flags)
|
||||
const char *func;
|
||||
int code, e, flags; /* flags currently unused */
|
||||
{
|
||||
if (code > CMDERR_LAST)
|
||||
code = CMDERR_DEFAULT;
|
||||
|
||||
programming_error ("%s: %s: %d", func, _(cmd_error_table[code]), e);
|
||||
}
|
||||
|
||||
char *
|
||||
command_errstr (code)
|
||||
int code;
|
||||
{
|
||||
if (code > CMDERR_LAST)
|
||||
code = CMDERR_DEFAULT;
|
||||
|
||||
return (_(cmd_error_table[code]));
|
||||
}
|
||||
|
||||
#ifdef ARRAY_VARS
|
||||
void
|
||||
err_badarraysub (s)
|
||||
const char *s;
|
||||
{
|
||||
report_error ("%s: %s", s, _(bash_badsub_errmsg));
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
err_unboundvar (s)
|
||||
const char *s;
|
||||
{
|
||||
report_error (_("%s: unbound variable"), s);
|
||||
}
|
||||
|
||||
void
|
||||
err_readonly (s)
|
||||
const char *s;
|
||||
{
|
||||
report_error (_("%s: readonly variable"), s);
|
||||
itrace("err_readonly: %d", getpid());
|
||||
sleep (60);
|
||||
}
|
||||
@@ -250,7 +250,6 @@ change_flag (flag, on_or_off)
|
||||
return (FLAG_ERROR);
|
||||
|
||||
old_value = *value;
|
||||
|
||||
*value = (on_or_off == FLAG_ON) ? 1 : 0;
|
||||
|
||||
/* Special cases for a few flags. */
|
||||
|
||||
@@ -45,7 +45,9 @@
|
||||
|
||||
#include "filecntl.h"
|
||||
#include <sys/ioctl.h>
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
|
||||
#if defined (BUFFERED_INPUT)
|
||||
# include "input.h"
|
||||
|
||||
+23
-12
@@ -291,7 +291,7 @@ getenv.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h
|
||||
getenv.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h
|
||||
getenv.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
|
||||
getenv.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h
|
||||
getenv.o: ${BUILD_DIR}/version.h
|
||||
#getenv.o: ${BUILD_DIR}/version.h
|
||||
|
||||
inet_aton.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
|
||||
inet_aton.o: ${BASHINCDIR}/stdc.h
|
||||
@@ -303,7 +303,8 @@ itos.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${topdir
|
||||
itos.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h
|
||||
itos.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h
|
||||
itos.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
|
||||
itos.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h
|
||||
itos.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h
|
||||
#itos.o: ${BUILD_DIR}/version.h
|
||||
|
||||
makepath.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
|
||||
makepath.o: ${topdir}/shell.h ${topdir}/syntax.h ${topdir}/bashjmp.h ${BASHINCDIR}/posixjmp.h
|
||||
@@ -312,7 +313,8 @@ makepath.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${to
|
||||
makepath.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h
|
||||
makepath.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h
|
||||
makepath.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
|
||||
makepath.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h
|
||||
makepath.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h
|
||||
#makepath.o: ${BUILD_DIR}/version.h
|
||||
|
||||
netconn.o: ${BASHINCDIR}/posixstat.h ${BASHINCDIR}/filecntl.h
|
||||
netconn.o: ${topdir}/bashtypes.h
|
||||
@@ -324,8 +326,9 @@ netopen.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${top
|
||||
netopen.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h
|
||||
netopen.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h
|
||||
netopen.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
|
||||
netopen.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h
|
||||
netopen.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h
|
||||
netopen.o: ${topdir}/bashintl.h ${LIBINTL_H} $(BASHINCDIR)/gettext.h
|
||||
#netopen.o: ${BUILD_DIR}/version.h
|
||||
|
||||
oslib.o: ${topdir}/bashtypes.h ${topdir}/bashansi.h ${BASHINCDIR}/maxpath.h
|
||||
oslib.o: ${topdir}/shell.h ${topdir}/syntax.h ${topdir}/bashjmp.h ${BASHINCDIR}/posixjmp.h
|
||||
@@ -334,9 +337,10 @@ oslib.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${topdi
|
||||
oslib.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h
|
||||
oslib.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h
|
||||
oslib.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
|
||||
oslib.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h
|
||||
oslib.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h
|
||||
oslib.o: ${BASHINCDIR}/posixstat.h ${BASHINCDIR}/filecntl.h
|
||||
oslib.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/chartypes.h
|
||||
#oslib.o: ${BUILD_DIR}/version.h
|
||||
|
||||
pathcanon.o: ${topdir}/bashtypes.h ${topdir}/bashansi.h ${BASHINCDIR}/maxpath.h
|
||||
pathcanon.o: ${topdir}/shell.h ${topdir}/syntax.h ${topdir}/bashjmp.h ${BASHINCDIR}/posixjmp.h
|
||||
@@ -345,9 +349,10 @@ pathcanon.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${t
|
||||
pathcanon.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h
|
||||
pathcanon.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h
|
||||
pathcanon.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
|
||||
pathcanon.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h
|
||||
pathcanon.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h
|
||||
pathcanon.o: ${BASHINCDIR}/posixstat.h ${BASHINCDIR}/filecntl.h
|
||||
pathcanon.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/chartypes.h
|
||||
#pathcanon.o: ${BUILD_DIR}/version.h
|
||||
|
||||
pathphys.o: ${topdir}/bashtypes.h ${topdir}/bashansi.h ${BASHINCDIR}/maxpath.h
|
||||
pathphys.o: ${topdir}/shell.h ${topdir}/syntax.h ${topdir}/bashjmp.h ${BASHINCDIR}/posixjmp.h
|
||||
@@ -356,9 +361,10 @@ pathphys.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${to
|
||||
pathphys.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h
|
||||
pathphys.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h
|
||||
pathphys.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
|
||||
pathphys.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h
|
||||
pathphys.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h
|
||||
pathphys.o: ${BASHINCDIR}/posixstat.h ${BASHINCDIR}/filecntl.h
|
||||
pathphys.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/chartypes.h
|
||||
#pathphys.o: ${BUILD_DIR}/version.h
|
||||
|
||||
rename.o: ${topdir}/bashtypes.h ${BASHINCDIR}/stdc.h
|
||||
rename.o: ${BASHINCDIR}/posixstat.h
|
||||
@@ -377,7 +383,8 @@ eaccess.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${top
|
||||
eaccess.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h
|
||||
eaccess.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h
|
||||
eaccess.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
|
||||
eaccess.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h
|
||||
eaccess.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h
|
||||
#eaccess.o: ${BUILD_DIR}/version.h
|
||||
|
||||
shquote.o: ${BASHINCDIR}/stdc.h ${topdir}/bashansi.h
|
||||
shquote.o: ${BASHINCDIR}/ansi_stdlib.h ${topdir}/xmalloc.h
|
||||
@@ -403,7 +410,8 @@ strerror.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${to
|
||||
strerror.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h
|
||||
strerror.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h
|
||||
strerror.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
|
||||
strerror.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h
|
||||
strerror.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h
|
||||
#strerror.o: ${BUILD_DIR}/version.h
|
||||
|
||||
strcasestr.o: ${BASHINCDIR}/stdc.h ${topdir}/bashansi.h
|
||||
strcasestr.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/chartypes.h
|
||||
@@ -415,7 +423,8 @@ stringlist.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${
|
||||
stringlist.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h
|
||||
stringlist.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h
|
||||
stringlist.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
|
||||
stringlist.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h
|
||||
stringlist.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h
|
||||
#stringlist.o: ${BUILD_DIR}/version.h
|
||||
|
||||
stringvec.o: ${topdir}/bashansi.h ${BASHINCDIR}/chartypes.h
|
||||
stringvec.o: ${topdir}/shell.h ${topdir}/syntax.h ${topdir}/bashjmp.h ${BASHINCDIR}/posixjmp.h
|
||||
@@ -424,7 +433,8 @@ stringvec.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${t
|
||||
stringvec.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h
|
||||
stringvec.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h
|
||||
stringvec.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
|
||||
stringvec.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h
|
||||
stringvec.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h
|
||||
#stringvec.o: ${BUILD_DIR}/version.h
|
||||
|
||||
strnlen.o: ${BASHINCDIR}/stdc.h
|
||||
|
||||
@@ -461,7 +471,8 @@ strtrans.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${to
|
||||
strtrans.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h
|
||||
strtrans.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h
|
||||
strtrans.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
|
||||
strtrans.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h
|
||||
strtrans.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h
|
||||
#strtrans.o: ${BUILD_DIR}/version.h
|
||||
|
||||
times.o: ${BASHINCDIR}/systimes.h
|
||||
times.o: ${BASHINCDIR}/posixtime.h
|
||||
|
||||
@@ -0,0 +1,554 @@
|
||||
#
|
||||
# Makefile for the Bash library
|
||||
#
|
||||
#
|
||||
# Copyright (C) 1998-2010 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
PACKAGE = @PACKAGE_NAME@
|
||||
VERSION = @PACKAGE_VERSION@
|
||||
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = .:@srcdir@
|
||||
topdir = @top_srcdir@
|
||||
BUILD_DIR = @BUILD_DIR@
|
||||
|
||||
LIBBUILD = ${BUILD_DIR}/lib
|
||||
|
||||
BASHINCDIR = ${topdir}/include
|
||||
|
||||
INTL_LIBSRC = ${topdir}/lib/intl
|
||||
INTL_BUILDDIR = ${LIBBUILD}/intl
|
||||
INTL_INC = @INTL_INC@
|
||||
LIBINTL_H = @LIBINTL_H@
|
||||
|
||||
datarootdir = @datarootdir@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
|
||||
CC = @CC@
|
||||
RANLIB = @RANLIB@
|
||||
AR = @AR@
|
||||
ARFLAGS = @ARFLAGS@
|
||||
RM = rm -f
|
||||
CP = cp
|
||||
MV = mv
|
||||
|
||||
SHELL = @MAKE_SHELL@
|
||||
|
||||
CFLAGS = @CFLAGS@
|
||||
LOCAL_CFLAGS = @LOCAL_CFLAGS@ ${DEBUG}
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@ @LOCAL_LDFLAGS@
|
||||
|
||||
PROFILE_FLAGS = @PROFILE_FLAGS@
|
||||
|
||||
DEFS = @DEFS@
|
||||
LOCAL_DEFS = @LOCAL_DEFS@
|
||||
|
||||
INCLUDES = -I. -I../.. -I$(topdir) -I$(topdir)/lib -I$(BASHINCDIR) -I$(srcdir) $(INTL_INC)
|
||||
|
||||
CCFLAGS = ${PROFILE_FLAGS} ${INCLUDES} $(DEFS) $(LOCAL_DEFS) $(LOCAL_CFLAGS) \
|
||||
$(CFLAGS) $(CPPFLAGS)
|
||||
|
||||
GCC_LINT_FLAGS = -Wall -Wshadow -Wpointer-arith -Wcast-qual \
|
||||
-Wcast-align -Wstrict-prototypes -Wconversion \
|
||||
-Wmissing-prototypes -Wtraditional -Wredundant-decls -pedantic
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CCFLAGS) $<
|
||||
|
||||
# The name of the library target.
|
||||
LIBRARY_NAME = libsh.a
|
||||
|
||||
# The C code source files for this library.
|
||||
CSOURCES = clktck.c clock.c getcwd.c getenv.c oslib.c setlinebuf.c \
|
||||
strcasecmp.c strerror.c strtod.c strtol.c strtoul.c \
|
||||
vprint.c itos.c rename.c zread.c zwrite.c shtty.c \
|
||||
inet_aton.c netconn.c netopen.c strpbrk.c timeval.c makepath.c \
|
||||
pathcanon.c pathphys.c tmpfile.c stringlist.c stringvec.c spell.c \
|
||||
shquote.c strtrans.c strcasestr.c snprintf.c mailstat.c \
|
||||
fmtulong.c fmtullong.c fmtumax.c shmatch.c strnlen.c \
|
||||
strtoll.c strtoull.c strtoimax.c strtoumax.c memset.c strstr.c \
|
||||
mktime.c strftime.c mbschr.c zcatfd.c zmapfd.c winsize.c eaccess.c \
|
||||
wcsdup.c fpurge.c zgetline.c mbscmp.c uconvert.c ufuncs.c \
|
||||
casemod.c dprintf.c input_avail.c mbscasecmp.c fnxform.c \
|
||||
strchrnul.c unicode.c wcswidth.c shmbchar.c
|
||||
|
||||
# The header files for this library.
|
||||
HSOURCES =
|
||||
|
||||
# The object files contained in $(LIBRARY_NAME)
|
||||
LIBOBJS = @LIBOBJS@
|
||||
OBJECTS = clktck.o clock.o getenv.o oslib.o setlinebuf.o strnlen.o \
|
||||
itos.o zread.o zwrite.o shtty.o shmatch.o eaccess.o \
|
||||
netconn.o netopen.o timeval.o makepath.o pathcanon.o \
|
||||
pathphys.o tmpfile.o stringlist.o stringvec.o spell.o shquote.o \
|
||||
strtrans.o snprintf.o mailstat.o fmtulong.o \
|
||||
fmtullong.o fmtumax.o zcatfd.o zmapfd.o winsize.o wcsdup.o \
|
||||
fpurge.o zgetline.o mbscmp.o uconvert.o ufuncs.o casemod.o \
|
||||
input_avail.o mbscasecmp.o fnxform.o unicode.o shmbchar.o ${LIBOBJS}
|
||||
|
||||
SUPPORT = Makefile
|
||||
|
||||
all: $(LIBRARY_NAME)
|
||||
|
||||
$(LIBRARY_NAME): $(OBJECTS)
|
||||
$(RM) $@
|
||||
$(AR) $(ARFLAGS) $@ $(OBJECTS)
|
||||
-test -n "$(RANLIB)" && $(RANLIB) $@
|
||||
|
||||
force:
|
||||
|
||||
# The rule for 'includes' is written funny so that the if statement
|
||||
# always returns TRUE unless there really was an error installing the
|
||||
# include files.
|
||||
install:
|
||||
|
||||
clean:
|
||||
$(RM) $(OBJECTS) $(LIBRARY_NAME)
|
||||
|
||||
realclean distclean maintainer-clean: clean
|
||||
$(RM) Makefile
|
||||
|
||||
mostlyclean: clean
|
||||
|
||||
# Dependencies
|
||||
|
||||
${BUILD_DIR}/version.h: ${BUILD_DIR}/config.h ${BUILD_DIR}/Makefile Makefile
|
||||
-( cd ${BUILD_DIR} && ${MAKE} ${MFLAGS} version.h )
|
||||
|
||||
${BUILD_DIR}/pathnames.h: ${BUILD_DIR}/config.h ${BUILD_DIR}/Makefile Makefile
|
||||
-( cd ${BUILD_DIR} && ${MAKE} ${MFLAGS} pathnames.h )
|
||||
|
||||
# rules for losing makes, like SunOS
|
||||
casemod.o: casemod.c
|
||||
clktck.o: clktck.c
|
||||
clock.o: clock.c
|
||||
eaccess.o: eaccess.c
|
||||
dprintf.o: dprintf.c
|
||||
fmtullong.o: fmtullong.c
|
||||
fmtulong.o: fmtulong.c
|
||||
fmtumax.o: fmtumax.c
|
||||
fnxform.o: fnxform.c
|
||||
fpurge.o: fpurge.c
|
||||
getcwd.o: getcwd.c
|
||||
getenv.o: getenv.c
|
||||
inet_aton.o: inet_aton.c
|
||||
input_avail.o: input_avail.c
|
||||
itos.o: itos.c
|
||||
mailstat.o: mailstat.c
|
||||
makepath.o: makepath.c
|
||||
mbscasecmp.o: mbscasecmp.c
|
||||
mbscmp.o: mbscmp.c
|
||||
memset.o: memset.c
|
||||
mktime.o: mktime.c
|
||||
netconn.o: netconn.c
|
||||
netopen.o: netopen.c
|
||||
oslib.o: oslib.c
|
||||
pathcanon.o: pathcanon.c
|
||||
pathphys.o: pathphys.c
|
||||
rename.o: rename.c
|
||||
setlinebuf.o: setlinebuf.c
|
||||
shmbchar.o: shmbchar.c
|
||||
shquote.o: shquote.c
|
||||
shtty.o: shtty.c
|
||||
snprintf.o: snprintf.c
|
||||
spell.o: spell.c
|
||||
strcasecmp.o: strcasecmp.c
|
||||
strerror.o: strerror.c
|
||||
strftime.o: strftime.c
|
||||
strcasestr.o: strcasestr.c
|
||||
stringlist.o: stringlist.c
|
||||
stringvec.o: stringvec.c
|
||||
strnlen.o: strnlen.c
|
||||
strpbrk.o: strpbrk.c
|
||||
strtod.o: strtod.c
|
||||
strtoimax.o: strtoimax.c
|
||||
strtol.o: strtol.c
|
||||
strtoll.o: strtoll.c
|
||||
strtoul.o: strtoul.c
|
||||
strtoull.o: strtoull.c
|
||||
strtoumax.o: strtoumax.c
|
||||
strtrans.o: strtrans.c
|
||||
times.o: times.c
|
||||
timeval.o: timeval.c
|
||||
tmpfile.o: tmpfile.c
|
||||
uconvert.o: uconvert.c
|
||||
ufuncs.o: ufuncs.c
|
||||
vprint.o: vprint.c
|
||||
wcsdup.o: wcsdup.c
|
||||
wcswidth.o: wcswidth.c
|
||||
mbschr.o: mbschr.c
|
||||
zcatfd.o: zcatfd.c
|
||||
zmapfd.o: zmapfd.c
|
||||
zgetline.o: zgetline.c
|
||||
zread.o: zread.c
|
||||
zwrite.o: zwrite.c
|
||||
|
||||
# dependencies for c files that include other c files
|
||||
fmtullong.o: fmtulong.c
|
||||
fmtumax.o: fmtulong.c
|
||||
strtoll.o: strtol.c
|
||||
strtoul.o: strtol.c
|
||||
strtoull.o: strtol.c
|
||||
|
||||
# all files in the library depend on config.h
|
||||
casemod.o: ${BUILD_DIR}/config.h
|
||||
clktck.o: ${BUILD_DIR}/config.h
|
||||
clock.o: ${BUILD_DIR}/config.h
|
||||
eaccess.o: ${BUILD_DIR}/config.h
|
||||
dprintf.o: ${BUILD_DIR}/config.h
|
||||
fmtullong.o: ${BUILD_DIR}/config.h
|
||||
fmtulong.o: ${BUILD_DIR}/config.h
|
||||
fmtumax.o: ${BUILD_DIR}/config.h
|
||||
fnxform.o: ${BUILD_DIR}/config.h
|
||||
fpurge.o: ${BUILD_DIR}/config.h
|
||||
getcwd.o: ${BUILD_DIR}/config.h
|
||||
getenv.o: ${BUILD_DIR}/config.h
|
||||
inet_aton.o: ${BUILD_DIR}/config.h
|
||||
input_avail.o: ${BUILD_DIR}/config.h
|
||||
itos.o: ${BUILD_DIR}/config.h
|
||||
mailstat.o: ${BUILD_DIR}/config.h
|
||||
makepath.o: ${BUILD_DIR}/config.h
|
||||
mbscasecmp.o: ${BUILD_DIR}/config.h
|
||||
mbscmp.o: ${BUILD_DIR}/config.h
|
||||
memset.o: ${BUILD_DIR}/config.h
|
||||
mktime.o: ${BUILD_DIR}/config.h
|
||||
netconn.o: ${BUILD_DIR}/config.h
|
||||
netopen.o: ${BUILD_DIR}/config.h
|
||||
oslib.o: ${BUILD_DIR}/config.h
|
||||
pathcanon.o: ${BUILD_DIR}/config.h
|
||||
pathphys.o: ${BUILD_DIR}/config.h
|
||||
rename.o: ${BUILD_DIR}/config.h
|
||||
setlinebuf.o: ${BUILD_DIR}/config.h
|
||||
shmbchare.o: ${BUILD_DIR}/config.h
|
||||
shquote.o: ${BUILD_DIR}/config.h
|
||||
shtty.o: ${BUILD_DIR}/config.h
|
||||
snprintf.o: ${BUILD_DIR}/config.h
|
||||
spell.o: ${BUILD_DIR}/config.h
|
||||
strcasecmp.o: ${BUILD_DIR}/config.h
|
||||
strerror.o: ${BUILD_DIR}/config.h
|
||||
strftime.o: ${BUILD_DIR}/config.h
|
||||
strcasestr.o: ${BUILD_DIR}/config.h
|
||||
stringlist.o: ${BUILD_DIR}/config.h
|
||||
stringvec.o: ${BUILD_DIR}/config.h
|
||||
strnlen.o: ${BUILD_DIR}/config.h
|
||||
strpbrk.o: ${BUILD_DIR}/config.h
|
||||
strtod.o: ${BUILD_DIR}/config.h
|
||||
strtoimax.o: ${BUILD_DIR}/config.h
|
||||
strtol.o: ${BUILD_DIR}/config.h
|
||||
strtoll.o: ${BUILD_DIR}/config.h
|
||||
strtoul.o: ${BUILD_DIR}/config.h
|
||||
strtoull.o: ${BUILD_DIR}/config.h
|
||||
strtoumax.o: ${BUILD_DIR}/config.h
|
||||
strtrans.o: ${BUILD_DIR}/config.h
|
||||
times.o: ${BUILD_DIR}/config.h
|
||||
timeval.o: ${BUILD_DIR}/config.h
|
||||
tmpfile.o: ${BUILD_DIR}/config.h
|
||||
uconvert.o: ${BUILD_DIR}/config.h
|
||||
ufuncs.o: ${BUILD_DIR}/config.h
|
||||
vprint.o: ${BUILD_DIR}/config.h
|
||||
wcsdup.o: ${BUILD_DIR}/config.h
|
||||
wcswidth.o: ${BUILD_DIR}/config.h
|
||||
mbschr.o: ${BUILD_DIR}/config.h
|
||||
zcatfd.o: ${BUILD_DIR}/config.h
|
||||
zgetline.o: ${BUILD_DIR}/config.h
|
||||
zmapfd.o: ${BUILD_DIR}/config.h
|
||||
zread.o: ${BUILD_DIR}/config.h
|
||||
zwrite.o: ${BUILD_DIR}/config.h
|
||||
|
||||
clktck.o: ${topdir}/bashtypes.h
|
||||
|
||||
getcwd.o: ${topdir}/bashtypes.h ${topdir}/bashansi.h ${BASHINCDIR}/maxpath.h
|
||||
getcwd.o: ${BASHINCDIR}/posixstat.h ${BASHINCDIR}/posixdir.h
|
||||
getcwd.o: ${BASHINCDIR}/memalloc.h ${BASHINCDIR}/ansi_stdlib.h
|
||||
|
||||
getenv.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
|
||||
getenv.o: ${topdir}/shell.h ${topdir}/syntax.h ${topdir}/bashjmp.h ${BASHINCDIR}/posixjmp.h
|
||||
getenv.o: ${topdir}/command.h ${BASHINCDIR}/stdc.h ${topdir}/error.h
|
||||
getenv.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${topdir}/conftypes.h
|
||||
getenv.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h
|
||||
getenv.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h
|
||||
getenv.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
|
||||
getenv.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h
|
||||
getenv.o: ${BUILD_DIR}/version.h
|
||||
|
||||
inet_aton.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
|
||||
inet_aton.o: ${BASHINCDIR}/stdc.h
|
||||
|
||||
itos.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
|
||||
itos.o: ${topdir}/shell.h ${topdir}/syntax.h ${topdir}/bashjmp.h ${BASHINCDIR}/posixjmp.h
|
||||
itos.o: ${topdir}/command.h ${BASHINCDIR}/stdc.h ${topdir}/error.h
|
||||
itos.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${topdir}/conftypes.h
|
||||
itos.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h
|
||||
itos.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h
|
||||
itos.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
|
||||
itos.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h
|
||||
|
||||
makepath.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
|
||||
makepath.o: ${topdir}/shell.h ${topdir}/syntax.h ${topdir}/bashjmp.h ${BASHINCDIR}/posixjmp.h
|
||||
makepath.o: ${topdir}/command.h ${BASHINCDIR}/stdc.h ${topdir}/error.h
|
||||
makepath.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${topdir}/conftypes.h
|
||||
makepath.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h
|
||||
makepath.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h
|
||||
makepath.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
|
||||
makepath.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h
|
||||
|
||||
netconn.o: ${BASHINCDIR}/posixstat.h ${BASHINCDIR}/filecntl.h
|
||||
netconn.o: ${topdir}/bashtypes.h
|
||||
|
||||
netopen.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h ${topdir}/xmalloc.h
|
||||
netopen.o: ${topdir}/shell.h ${topdir}/syntax.h ${topdir}/bashjmp.h ${BASHINCDIR}/posixjmp.h
|
||||
netopen.o: ${topdir}/command.h ${BASHINCDIR}/stdc.h ${topdir}/error.h
|
||||
netopen.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${topdir}/conftypes.h
|
||||
netopen.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h
|
||||
netopen.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h
|
||||
netopen.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
|
||||
netopen.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h
|
||||
netopen.o: ${topdir}/bashintl.h ${LIBINTL_H} $(BASHINCDIR)/gettext.h
|
||||
|
||||
oslib.o: ${topdir}/bashtypes.h ${topdir}/bashansi.h ${BASHINCDIR}/maxpath.h
|
||||
oslib.o: ${topdir}/shell.h ${topdir}/syntax.h ${topdir}/bashjmp.h ${BASHINCDIR}/posixjmp.h
|
||||
oslib.o: ${topdir}/command.h ${BASHINCDIR}/stdc.h ${topdir}/error.h
|
||||
oslib.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${topdir}/conftypes.h
|
||||
oslib.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h
|
||||
oslib.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h
|
||||
oslib.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
|
||||
oslib.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h
|
||||
oslib.o: ${BASHINCDIR}/posixstat.h ${BASHINCDIR}/filecntl.h
|
||||
oslib.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/chartypes.h
|
||||
|
||||
pathcanon.o: ${topdir}/bashtypes.h ${topdir}/bashansi.h ${BASHINCDIR}/maxpath.h
|
||||
pathcanon.o: ${topdir}/shell.h ${topdir}/syntax.h ${topdir}/bashjmp.h ${BASHINCDIR}/posixjmp.h
|
||||
pathcanon.o: ${topdir}/command.h ${BASHINCDIR}/stdc.h ${topdir}/error.h
|
||||
pathcanon.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${topdir}/conftypes.h
|
||||
pathcanon.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h
|
||||
pathcanon.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h
|
||||
pathcanon.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
|
||||
pathcanon.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h
|
||||
pathcanon.o: ${BASHINCDIR}/posixstat.h ${BASHINCDIR}/filecntl.h
|
||||
pathcanon.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/chartypes.h
|
||||
|
||||
pathphys.o: ${topdir}/bashtypes.h ${topdir}/bashansi.h ${BASHINCDIR}/maxpath.h
|
||||
pathphys.o: ${topdir}/shell.h ${topdir}/syntax.h ${topdir}/bashjmp.h ${BASHINCDIR}/posixjmp.h
|
||||
pathphys.o: ${topdir}/command.h ${BASHINCDIR}/stdc.h ${topdir}/error.h
|
||||
pathphys.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${topdir}/conftypes.h
|
||||
pathphys.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h
|
||||
pathphys.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h
|
||||
pathphys.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
|
||||
pathphys.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h
|
||||
pathphys.o: ${BASHINCDIR}/posixstat.h ${BASHINCDIR}/filecntl.h
|
||||
pathphys.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/chartypes.h
|
||||
|
||||
rename.o: ${topdir}/bashtypes.h ${BASHINCDIR}/stdc.h
|
||||
rename.o: ${BASHINCDIR}/posixstat.h
|
||||
|
||||
setlinebuf.o: ${topdir}/xmalloc.h ${topdir}/bashansi.h
|
||||
setlinebuf.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/stdc.h
|
||||
|
||||
eaccess.o: ${topdir}/bashtypes.h
|
||||
eaccess.o: ${BASHINCDIR}/posixstat.h
|
||||
eaccess.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
|
||||
eaccess.o: ${BASHINCDIR}/filecntl.h
|
||||
eaccess.o: ${BASHINCDIR}/stdc.h
|
||||
eaccess.o: ${topdir}/shell.h ${topdir}/syntax.h ${topdir}/bashjmp.h ${BASHINCDIR}/posixjmp.h
|
||||
eaccess.o: ${topdir}/command.h ${BASHINCDIR}/stdc.h ${topdir}/error.h
|
||||
eaccess.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${topdir}/conftypes.h
|
||||
eaccess.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h
|
||||
eaccess.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h
|
||||
eaccess.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
|
||||
eaccess.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h
|
||||
|
||||
shquote.o: ${BASHINCDIR}/stdc.h ${topdir}/bashansi.h
|
||||
shquote.o: ${BASHINCDIR}/ansi_stdlib.h ${topdir}/xmalloc.h
|
||||
|
||||
shtty.o: ${BASHINCDIR}/shtty.h
|
||||
shtty.o: ${BASHINCDIR}/stdc.h
|
||||
|
||||
snprintf.o: ${BASHINCDIR}/stdc.h ${topdir}/bashansi.h ${topdir}/xmalloc.h
|
||||
snprintf.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/chartypes.h
|
||||
snprintf.o: ${BASHINCDIR}/typemax.h
|
||||
|
||||
spell.o: ${topdir}/bashtypes.h
|
||||
spell.o: ${BASHINCDIR}/posixstat.h ${BASHINCDIR}/posixdir.h
|
||||
spell.o: ${BASHINCDIR}/ansi_stdlib.h
|
||||
|
||||
strcasecmp.o: ${BASHINCDIR}/stdc.h ${topdir}/bashansi.h
|
||||
strcasecmp.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/chartypes.h
|
||||
|
||||
strerror.o: ${topdir}/bashtypes.h
|
||||
strerror.o: ${topdir}/shell.h ${topdir}/syntax.h ${topdir}/bashjmp.h ${BASHINCDIR}/posixjmp.h
|
||||
strerror.o: ${topdir}/command.h ${BASHINCDIR}/stdc.h ${topdir}/error.h
|
||||
strerror.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${topdir}/conftypes.h
|
||||
strerror.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h
|
||||
strerror.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h
|
||||
strerror.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
|
||||
strerror.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h
|
||||
|
||||
strcasestr.o: ${BASHINCDIR}/stdc.h ${topdir}/bashansi.h
|
||||
strcasestr.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/chartypes.h
|
||||
|
||||
stringlist.o: ${topdir}/bashansi.h
|
||||
stringlist.o: ${topdir}/shell.h ${topdir}/syntax.h ${topdir}/bashjmp.h ${BASHINCDIR}/posixjmp.h
|
||||
stringlist.o: ${topdir}/command.h ${BASHINCDIR}/stdc.h ${topdir}/error.h
|
||||
stringlist.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${topdir}/conftypes.h
|
||||
stringlist.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h
|
||||
stringlist.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h
|
||||
stringlist.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
|
||||
stringlist.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h
|
||||
|
||||
stringvec.o: ${topdir}/bashansi.h ${BASHINCDIR}/chartypes.h
|
||||
stringvec.o: ${topdir}/shell.h ${topdir}/syntax.h ${topdir}/bashjmp.h ${BASHINCDIR}/posixjmp.h
|
||||
stringvec.o: ${topdir}/command.h ${BASHINCDIR}/stdc.h ${topdir}/error.h
|
||||
stringvec.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${topdir}/conftypes.h
|
||||
stringvec.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h
|
||||
stringvec.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h
|
||||
stringvec.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
|
||||
stringvec.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h
|
||||
|
||||
strnlen.o: ${BASHINCDIR}/stdc.h
|
||||
|
||||
strpbrk.o: ${BASHINCDIR}/stdc.h
|
||||
|
||||
strtod.o: ${topdir}/bashansi.h
|
||||
strtod.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/chartypes.h
|
||||
|
||||
strtoimax.o: ${BASHINCDIR}/stdc.h
|
||||
|
||||
strtol.o: ${topdir}/bashansi.h
|
||||
strtol.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/chartypes.h
|
||||
strtol.o: ${BASHINCDIR}/typemax.h
|
||||
|
||||
strtoll.o: ${topdir}/bashansi.h
|
||||
strtoll.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/chartypes.h
|
||||
strtoll.o: ${BASHINCDIR}/typemax.h
|
||||
|
||||
strtoul.o: ${topdir}/bashansi.h
|
||||
strtoul.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/chartypes.h
|
||||
strtoul.o: ${BASHINCDIR}/typemax.h
|
||||
|
||||
strtoull.o: ${topdir}/bashansi.h
|
||||
strtoull.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/chartypes.h
|
||||
strtoull.o: ${BASHINCDIR}/typemax.h
|
||||
|
||||
strtoumax.o: ${BASHINCDIR}/stdc.h
|
||||
|
||||
strtrans.o: ${topdir}/bashansi.h
|
||||
strtrans.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/chartypes.h
|
||||
strtrans.o: ${topdir}/shell.h ${topdir}/syntax.h ${topdir}/bashjmp.h ${BASHINCDIR}/posixjmp.h
|
||||
strtrans.o: ${topdir}/command.h ${BASHINCDIR}/stdc.h ${topdir}/error.h
|
||||
strtrans.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${topdir}/conftypes.h
|
||||
strtrans.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h
|
||||
strtrans.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h
|
||||
strtrans.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
|
||||
strtrans.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h
|
||||
|
||||
times.o: ${BASHINCDIR}/systimes.h
|
||||
times.o: ${BASHINCDIR}/posixtime.h
|
||||
|
||||
timeval.o: ${BASHINCDIR}/posixtime.h
|
||||
|
||||
tmpfile.o: ${topdir}/bashtypes.h
|
||||
tmpfile.o: ${BASHINCDIR}/posixstat.h
|
||||
tmpfile.o: ${BASHINCDIR}/filecntl.h
|
||||
|
||||
uconvert.o: ${topdir}/bashtypes.h
|
||||
|
||||
ufuncs.o: ${topdir}/bashtypes.h
|
||||
|
||||
clock.o: ${BASHINCDIR}/posixtime.h
|
||||
|
||||
mailstat.o: ${topdir}/bashansi.h
|
||||
mailstat.o: ${topdir}/bashtypes.h
|
||||
mailstat.o: ${BASHINCDIR}/ansi_stdlib.h
|
||||
mailstat.o: ${BASHINCDIR}/posixstat.h
|
||||
mailstat.o: ${BASHINCDIR}/posixdir.h
|
||||
mailstat.o: ${BASHINCDIR}/maxpath.h
|
||||
|
||||
fmtulong.o: ${topdir}/bashansi.h
|
||||
fmtulong.o: ${BASHINCDIR}/ansi_stdlib.h
|
||||
fmtulong.o: ${BASHINCDIR}/chartypes.h
|
||||
fmtulong.o: ${BASHINCDIR}/stdc.h
|
||||
fmtulong.o: ${BASHINCDIR}/typemax.h
|
||||
fmtulong.o: ${topdir}/bashintl.h ${LIBINTL_H} ${BASHINCDIR}/gettext.h
|
||||
|
||||
fmtullong.o: ${topdir}/bashansi.h
|
||||
fmtullong.o: ${BASHINCDIR}/ansi_stdlib.h
|
||||
fmtullong.o: ${BASHINCDIR}/chartypes.h
|
||||
fmtullong.o: ${BASHINCDIR}/stdc.h
|
||||
fmtullong.o: ${BASHINCDIR}/typemax.h
|
||||
fmtullong.o: ${topdir}/bashintl.h ${LIBINTL_H} ${BASHINCDIR}/gettext.h
|
||||
|
||||
fmtumax.o: ${topdir}/bashansi.h
|
||||
fmtumax.o: ${BASHINCDIR}/ansi_stdlib.h
|
||||
fmtumax.o: ${BASHINCDIR}/chartypes.h
|
||||
fmtumax.o: ${BASHINCDIR}/stdc.h
|
||||
fmtumax.o: ${BASHINCDIR}/typemax.h
|
||||
fmtumax.o: ${topdir}/bashintl.h ${LIBINTL_H} ${BASHINCDIR}/gettext.h
|
||||
|
||||
wcsdup.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
|
||||
wcsdup.o: ${BASHINCDIR}/stdc.h
|
||||
wcsdup.o: ${topdir}/xmalloc.h
|
||||
|
||||
wcswidth.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
|
||||
wcswidth.o: ${BASHINCDIR}/stdc.h
|
||||
|
||||
mbschr.o: ${topdir}/bashansi.h
|
||||
mbschr.o: ${BASHINCDIR}/ansi_stdlib.h
|
||||
mbschr.o: ${BASHINCDIR}/shmbutil.h ${BASHINCDIR}/shmbchar.h
|
||||
|
||||
zgetline.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
|
||||
zgetline.o: ${BASHINCDIR}/stdc.h
|
||||
zgetline.o: ${topdir}/xmalloc.h
|
||||
zgetline.o: ${topdir}/bashtypes.h
|
||||
|
||||
mbscasecmp.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
|
||||
mbscasecmp.o: ${BASHINCDIR}/stdc.h
|
||||
mbscasecmp.o: ${topdir}/xmalloc.h
|
||||
|
||||
mbscmp.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
|
||||
mbscmp.o: ${BASHINCDIR}/stdc.h
|
||||
mbscmp.o: ${topdir}/xmalloc.h
|
||||
|
||||
casemod.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
|
||||
casemod.o: ${BASHINCDIR}/stdc.h
|
||||
casemod.o: ${topdir}/xmalloc.h
|
||||
casemod.o: ${topdir}/bashtypes.h
|
||||
casemod.o: ${BASHINCDIR}/shmbutil.h ${BASHINCDIR}/shmbchar.h
|
||||
casemod.o: ${topdir}/bashintl.h ${LIBINTL_H} ${BASHINCDIR}/gettext.h
|
||||
|
||||
dprintf.o: ${BASHINCDIR}/stdc.h
|
||||
|
||||
input_avail.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
|
||||
input_avail.o: ${BASHINCDIR}/stdc.h
|
||||
input_avail.o: ${topdir}/xmalloc.h ${BASHINCDIR}/posixselect.h
|
||||
|
||||
mktime.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
|
||||
mktime.o: ${BASHINCDIR}/stdc.h
|
||||
|
||||
fnxform.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
|
||||
fnxform.o: ${BASHINCDIR}/stdc.h
|
||||
fnxform.o: ${topdir}/bashtypes.h
|
||||
fnxform.o: ${topdir}/bashintl.h ${LIBINTL_H} ${BASHINCDIR}/gettext.h
|
||||
|
||||
shmbchar.o: ${BASHINCDIR}/shmbchar.h
|
||||
@@ -173,7 +173,9 @@ glob_char_p (s)
|
||||
removal has not been done (for example, before attempting to match a
|
||||
pattern while executing a case statement), flags should include
|
||||
QGLOB_CVTNULL. If flags includes QGLOB_FILENAME, appropriate quoting
|
||||
to match a filename should be performed. */
|
||||
to match a filename should be performed. QGLOB_REGEXP means we're
|
||||
quoting for a Posix ERE (for [[ string =~ pat ]]) and that requires
|
||||
some special handling. */
|
||||
char *
|
||||
quote_string_for_globbing (pathname, qflags)
|
||||
const char *pathname;
|
||||
|
||||
+19
-1
@@ -58,6 +58,7 @@
|
||||
|
||||
#include "builtins.h"
|
||||
#include "builtins/common.h"
|
||||
#include "builtins/builtext.h"
|
||||
|
||||
#include <glob/glob.h>
|
||||
#include <glob/strmatch.h>
|
||||
@@ -82,6 +83,7 @@ extern char *strpbrk __P((char *, char *));
|
||||
extern int array_needs_making;
|
||||
extern STRING_INT_ALIST word_token_alist[];
|
||||
extern char *signal_names[];
|
||||
extern sh_builtin_func_t *last_shell_builtin, *this_shell_builtin;
|
||||
|
||||
#if defined (DEBUG)
|
||||
#if defined (PREFER_STDARG)
|
||||
@@ -713,12 +715,28 @@ pcomp_filename_completion_function (text, state)
|
||||
{
|
||||
static char *dfn; /* dequoted filename */
|
||||
int qc;
|
||||
int iscompgen, iscompleting;
|
||||
|
||||
if (state == 0)
|
||||
{
|
||||
FREE (dfn);
|
||||
/* remove backslashes quoting special characters in filenames. */
|
||||
if (RL_ISSTATE (RL_STATE_COMPLETING) && rl_filename_dequoting_function)
|
||||
/* There are roughtly three paths we can follow to get here:
|
||||
1. complete -f
|
||||
2. compgen -f "$word" from a completion function
|
||||
3. compgen -f "$word" from the command line
|
||||
They all need to be handled.
|
||||
|
||||
In the first two cases, readline will run the filename dequoting
|
||||
function in rl_filename_completion_function if it found a filename
|
||||
quoting character in the word to be completed
|
||||
(rl_completion_found_quote). We run the dequoting function here
|
||||
if we're running compgen, we're not completing, and the
|
||||
rl_filename_completion_function won't dequote the filename
|
||||
(rl_completion_found_quote == 0). */
|
||||
iscompgen = this_shell_builtin == compgen_builtin;
|
||||
iscompleting = RL_ISSTATE (RL_STATE_COMPLETING);
|
||||
if (iscompgen && iscompleting == 0 && rl_completion_found_quote == 0)
|
||||
{
|
||||
/* Use rl_completion_quote_character because any single or
|
||||
double quotes have been removed by the time TEXT makes it
|
||||
|
||||
+22
-5
@@ -58,6 +58,7 @@
|
||||
|
||||
#include "builtins.h"
|
||||
#include "builtins/common.h"
|
||||
#include "builtins/builtext.h"
|
||||
|
||||
#include <glob/glob.h>
|
||||
#include <glob/strmatch.h>
|
||||
@@ -713,12 +714,28 @@ pcomp_filename_completion_function (text, state)
|
||||
{
|
||||
static char *dfn; /* dequoted filename */
|
||||
int qc;
|
||||
int iscompgen, iscompleting;
|
||||
|
||||
if (state == 0)
|
||||
{
|
||||
FREE (dfn);
|
||||
/* remove backslashes quoting special characters in filenames. */
|
||||
if (RL_ISSTATE (RL_STATE_COMPLETING) && rl_filename_dequoting_function)
|
||||
/* There are roughtly three paths we can follow to get here:
|
||||
1. complete -f
|
||||
2. compgen -f "$word" from a completion function
|
||||
3. compgen -f "$word" from the command line
|
||||
They all need to be handled.
|
||||
|
||||
In the first two cases, readline will run the filename dequoting
|
||||
function in rl_filename_completion_function if it found a filename
|
||||
quoting character in the word to be completed
|
||||
(rl_completion_found_quote). We run the dequoting function here
|
||||
if we're running compgen, we're not completing, and the
|
||||
rl_filename_completion_function won't dequote the filename
|
||||
(rl_completion_found_quote == 0). */
|
||||
iscompgen = this_shell_builtin == compgen_builtin;
|
||||
iscompleting = RL_ISSTATE (RL_STATE_COMPLETING);
|
||||
if (iscompgen && iscompleting == 0 && rl_completion_found_quote == 0)
|
||||
{
|
||||
/* Use rl_completion_quote_character because any single or
|
||||
double quotes have been removed by the time TEXT makes it
|
||||
@@ -801,15 +818,15 @@ gen_action_completions (cs, text)
|
||||
/* And lastly, the special case for directories */
|
||||
if (flags & CA_DIRECTORY)
|
||||
{
|
||||
t = rl_filename_quoting_desired;
|
||||
t = rl_filename_completion_desired;
|
||||
rl_completion_mark_symlink_dirs = 1; /* override user preference */
|
||||
cmatches = bash_directory_completion_matches (text);
|
||||
/* If we did not want filename completion before this, and there are
|
||||
no matches, turn off rl_filename_quoting_desired so whatever
|
||||
no matches, turn off rl_filename_completion_desired so whatever
|
||||
matches we get are not treated as filenames (it gets turned on by
|
||||
rl_filename_completion_function unconditionally). */
|
||||
if (t == 0 && cmatches == 0 && rl_filename_quoting_desired == 1)
|
||||
rl_filename_quoting_desired = 0;
|
||||
if (t == 0 && cmatches == 0 && rl_filename_completion_desired == 1)
|
||||
rl_filename_completion_desired = 0;
|
||||
tmatches = completions_to_stringlist (cmatches);
|
||||
ret = strlist_append (ret, tmatches);
|
||||
strvec_dispose (cmatches);
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
# Set of available languages.
|
||||
en@quot en@boldquot af bg ca cs da de eo es et fi fr ga gl hu id ja lt nl pl pt_BR ro ru sk sl sv tr uk vi zh_CN zh_TW
|
||||
en@quot en@boldquot af bg ca cs da de eo es et fi fr ga gl hu id it ja lt nl pl pt_BR ro ru sk sl sv tr uk vi zh_CN zh_TW
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
# Set of available languages.
|
||||
en@quot en@boldquot af bg ca cs da de eo es et fi fr ga gl hu id ja lt nl pl pt_BR ro ru sk sl sv tr uk vi zh_CN zh_TW
|
||||
@@ -1,4 +1,4 @@
|
||||
# Dutch translations GNU for bash.
|
||||
# Dutch translations for GNU bash.
|
||||
# Copyright (C) 2011 Free Software Foundation, Inc.
|
||||
# This file is distributed under the same license as the bash package.
|
||||
#
|
||||
@@ -24,7 +24,7 @@ msgstr ""
|
||||
"Project-Id-Version: bash-4.2\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2011-01-28 22:09-0500\n"
|
||||
"PO-Revision-Date: 2011-02-17 21:14+0100\n"
|
||||
"PO-Revision-Date: 2011-10-01 21:14+0100\n"
|
||||
"Last-Translator: Benno Schulenberg <benno@vertaalt.nl>\n"
|
||||
"Language-Team: Dutch <vertaling@vrijschrift.org>\n"
|
||||
"Language: nl\n"
|
||||
@@ -686,8 +686,8 @@ msgstr ""
|
||||
" de lijst getoond door 'dirs', beginned bij nul) bovenaan komt.\n"
|
||||
" -N Roteert de stapel zodat de N-de map (tellend vanaf rechts, van\n"
|
||||
" de lijst getoond door 'dirs', beginned bij nul) bovenaan komt.\n"
|
||||
" MAP Voegt deze map toe aan de top van de mappenstapel, het de nieuwe\n"
|
||||
" werkmap makend.\n"
|
||||
" MAP Voegt deze map toe aan de top van de mappenstapel, en maakt het\n"
|
||||
" de nieuwe werkmap.\n"
|
||||
"\n"
|
||||
" De opdracht 'dirs' toont de huidige mappenstapel."
|
||||
|
||||
@@ -2015,13 +2015,15 @@ msgstr "pwd [-LP]"
|
||||
msgid ":"
|
||||
msgstr ":"
|
||||
|
||||
# Dit is een commandonaam.
|
||||
#: builtins.c:70
|
||||
msgid "true"
|
||||
msgstr "waar"
|
||||
msgstr "true"
|
||||
|
||||
# Dit is een commandonaam.
|
||||
#: builtins.c:72
|
||||
msgid "false"
|
||||
msgstr "onwaar"
|
||||
msgstr "false"
|
||||
|
||||
#: builtins.c:74
|
||||
msgid "command [-pVv] command [arg ...]"
|
||||
@@ -2073,9 +2075,7 @@ msgstr "logout [N]"
|
||||
|
||||
#: builtins.c:103
|
||||
msgid "fc [-e ename] [-lnr] [first] [last] or fc -s [pat=rep] [command]"
|
||||
msgstr ""
|
||||
"fc [-e EDITORNAAM] [-lnr] [EERSTE] [LAATSTE]\n"
|
||||
"of: fc -s [PATROON=VERVANGING] [OPDRACHT]"
|
||||
msgstr "fc [-e EDITORNAAM] [-lnr] [EERSTE] [LAATSTE] of: fc -s [PATROON=VERVANGING] [OPDRACHT]"
|
||||
|
||||
#: builtins.c:107
|
||||
msgid "fg [job_spec]"
|
||||
@@ -2095,14 +2095,11 @@ msgstr "help [-dms] [PATROON...]"
|
||||
|
||||
#: builtins.c:121
|
||||
msgid "history [-c] [-d offset] [n] or history -anrw [filename] or history -ps arg [arg...]"
|
||||
msgstr ""
|
||||
"history [-c] [-d POSITIE] [N]\n"
|
||||
" of: history -anrw [BESTANDSNAAM]\n"
|
||||
" of: history -ps ARGUMENT..."
|
||||
msgstr "history [-c] [-d POSITIE] [N] of: history -anrw [BESTANDSNAAM] of: history -ps ARGUMENT..."
|
||||
|
||||
#: builtins.c:125
|
||||
msgid "jobs [-lnprs] [jobspec ...] or jobs -x command [args]"
|
||||
msgstr "jobs [-lnprs] [TAAKAANDUIDING...] of jobs -x OPDRACHT [ARGUMENT...]"
|
||||
msgstr "jobs [-lnprs] [TAAKAANDUIDING...] of: jobs -x OPDRACHT [ARGUMENT...]"
|
||||
|
||||
#: builtins.c:129
|
||||
msgid "disown [-h] [-ar] [jobspec ...]"
|
||||
@@ -2121,9 +2118,9 @@ msgstr "let ARGUMENT..."
|
||||
#: builtins.c:136
|
||||
msgid "read [-ers] [-a array] [-d delim] [-i text] [-n nchars] [-N nchars] [-p prompt] [-t timeout] [-u fd] [name ...]"
|
||||
msgstr ""
|
||||
"read [-ers] [-a ARRAY] [-d SCHEIDINGSTEKEN] [-i TEKST]\n"
|
||||
" [-n AANTAL_TEKENS] [-N AANTAL_TEKENS] [-p PROMPT]\n"
|
||||
" [-t TIJDSLIMIET] [-u BESTANDSDESCRIPTOR] [NAAM...]"
|
||||
"read [-ers] [-a ARRAY] [-d SCHEIDINGSTEKEN] [-i TEKST] [-p PROMPT]\n"
|
||||
" [-n AANTAL_TEKENS] [-N AANTAL_TEKENS] [-t TIJDSLIMIET]\n"
|
||||
" [-u BESTANDSDESCRIPTOR] [NAAM...]"
|
||||
|
||||
#: builtins.c:138
|
||||
msgid "return [n]"
|
||||
@@ -2167,7 +2164,7 @@ msgstr "test [EXPRESSIE]"
|
||||
|
||||
#: builtins.c:160
|
||||
msgid "[ arg... ]"
|
||||
msgstr "[ ARGUMENT... ]"
|
||||
msgstr "[ EXPRESSIE... ]"
|
||||
|
||||
#: builtins.c:162
|
||||
msgid "times"
|
||||
@@ -2219,10 +2216,7 @@ msgstr "case WOORD in [PATROON [| PATROON]...) OPDRACHTEN ;;]... esac"
|
||||
|
||||
#: builtins.c:192
|
||||
msgid "if COMMANDS; then COMMANDS; [ elif COMMANDS; then COMMANDS; ]... [ else COMMANDS; ] fi"
|
||||
msgstr ""
|
||||
"if OPDRACHTEN; then OPDRACHTEN;\n"
|
||||
" [ elif OPDRACHTEN; then OPDRACHTEN; ]...\n"
|
||||
" [ else OPDRACHTEN; ] fi"
|
||||
msgstr "if OPDRACHTEN; then OPDRACHTEN; [elif OPDRACHTEN; then OPDRACHTEN;]... [else OPDRACHTEN;] fi"
|
||||
|
||||
#: builtins.c:194
|
||||
msgid "while COMMANDS; do COMMANDS; done"
|
||||
@@ -2283,16 +2277,16 @@ msgstr "printf [-v VARIABELE] OPMAAK [ARGUMENTEN]"
|
||||
#: builtins.c:229
|
||||
msgid "complete [-abcdefgjksuv] [-pr] [-DE] [-o option] [-A action] [-G globpat] [-W wordlist] [-F function] [-C command] [-X filterpat] [-P prefix] [-S suffix] [name ...]"
|
||||
msgstr ""
|
||||
"complete [-abcdefgjksuv] [-pr] [-DE] [-o OPTIE] [-A ACTIE]\n"
|
||||
" [-C OPDRACHT] [-F FUNCTIE] [-G PATROON] [-P PREFIX]\n"
|
||||
" [-S SUFFIX] [-W WOORDENLIJST] [-X FILTERPATROON] [NAAM...]"
|
||||
"complete [-abcdefgjksuv] [-pr] [-DE] [-o OPTIE] [-A ACTIE] [-C OPDRACHT]\n"
|
||||
" [-F FUNCTIE] [-G PATROON] [-P PREFIX] [-S SUFFIX]\n"
|
||||
" [-W WOORDENLIJST] [-X FILTERPATROON] [NAAM...]"
|
||||
|
||||
#: builtins.c:233
|
||||
msgid "compgen [-abcdefgjksuv] [-o option] [-A action] [-G globpat] [-W wordlist] [-F function] [-C command] [-X filterpat] [-P prefix] [-S suffix] [word]"
|
||||
msgstr ""
|
||||
"compgen [-abcdefgjksuv] [-o OPTIE] [-A ACTIE] [-C OPDRACHT]\n"
|
||||
" [-F FUNCTIE] [-G PATROON] [-P PREFIX] [-S SUFFIX]\n"
|
||||
" [-W WOORDENLIJST] [-X FILTERPATROON] [WOORD]"
|
||||
"compgen [-abcdefgjksuv] [-o OPTIE] [-A ACTIE] [-C OPDRACHT] [-F FUNCTIE]\n"
|
||||
" [-G PATROON] [-P PREFIX] [-S SUFFIX]\n"
|
||||
" [-W WOORDENLIJST] [-X FILTERPATROON] [WOORD]"
|
||||
|
||||
#: builtins.c:237
|
||||
msgid "compopt [-o|+o option] [-DE] [name ...]"
|
||||
@@ -4637,7 +4631,7 @@ msgid ""
|
||||
" Exit Status:\n"
|
||||
" 0 or 1 depending on value of EXPRESSION."
|
||||
msgstr ""
|
||||
"Een voorwaardelijke opdracht uitveoren.\n"
|
||||
"Een voorwaardelijke opdracht uitvoeren.\n"
|
||||
"\n"
|
||||
" Evalueert de gegeven conditionele expressie; afhankelijk van het resultaat\n"
|
||||
" is de afsluitwaarde 0 (\"waar\") of 1 (\"onwaar\"). De expressies bestaan uit\n"
|
||||
@@ -5144,7 +5138,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Regels inlezen in een geïndexeerde array-variabele.\n"
|
||||
"\n"
|
||||
" Leest regels van standaardinvoer in in the array-variabele ARRAY.\n"
|
||||
" Leest regels van standaardinvoer in in de array-variabele ARRAY.\n"
|
||||
" De variabele MAPFILE wordt gebruikt als geen ARRAY gegeven is.\n"
|
||||
"\n"
|
||||
" Opties:\n"
|
||||
|
||||
+4
-3
@@ -419,7 +419,7 @@ indirection_level_string ()
|
||||
register int i, j;
|
||||
char *ps4;
|
||||
char ps4_firstc[MB_LEN_MAX+1];
|
||||
int ps4_firstc_len, ps4_len, ineed;
|
||||
int ps4_firstc_len, ps4_len, ineed, old;
|
||||
|
||||
ps4 = get_string_value ("PS4");
|
||||
if (indirection_string == 0)
|
||||
@@ -429,9 +429,10 @@ indirection_level_string ()
|
||||
if (ps4 == 0 || *ps4 == '\0')
|
||||
return (indirection_string);
|
||||
|
||||
change_flag ('x', FLAG_OFF);
|
||||
old = change_flag ('x', FLAG_OFF);
|
||||
ps4 = decode_prompt_string (ps4);
|
||||
change_flag ('x', FLAG_ON);
|
||||
if (old == FLAG_ON)
|
||||
change_flag ('x', FLAG_ON);
|
||||
|
||||
if (ps4 == 0 || *ps4 == '\0')
|
||||
return (indirection_string);
|
||||
|
||||
+4
-2
@@ -130,8 +130,10 @@ value = new1 new2 new3
|
||||
./array.tests: line 239: narray: unbound variable
|
||||
./array1.sub: line 1: syntax error near unexpected token `('
|
||||
./array1.sub: line 1: `printf "%s\n" -a a=(a 'b c')'
|
||||
./array2.sub: line 1: syntax error near unexpected token `('
|
||||
./array2.sub: line 1: `declare -a ''=(a 'b c')'
|
||||
./array2.sub: line 1: declare: `[]=asdf': not a valid identifier
|
||||
./array2.sub: line 2: a[]: bad array subscript
|
||||
./array2.sub: line 4: syntax error near unexpected token `('
|
||||
./array2.sub: line 4: `declare -a ''=(a 'b c')'
|
||||
9
|
||||
9
|
||||
|
||||
|
||||
@@ -1 +1,4 @@
|
||||
declare -r []=asdf
|
||||
declare -r a[]=asdf
|
||||
|
||||
declare -a ''=(a 'b c')
|
||||
|
||||
@@ -139,3 +139,4 @@ bix ()
|
||||
echo foo 2>&1 | cat
|
||||
}
|
||||
foo
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
|
||||
@@ -187,3 +187,5 @@ exec 2>&9
|
||||
exec 9>&-
|
||||
|
||||
${THIS_SH} ./redir9.sub
|
||||
|
||||
${THIS_SH} ./redir10.sub
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Out of file descriptors, because it forgets to close redirection. Only
|
||||
# happens in a shell function. Problem through bash-4.2.
|
||||
|
||||
ulimit -n 128
|
||||
|
||||
bug()
|
||||
{
|
||||
c=`ulimit -n`
|
||||
let c+=100
|
||||
while let c--
|
||||
do
|
||||
while read -ru3 x
|
||||
do
|
||||
echo -n :
|
||||
done 3< <(echo x)
|
||||
|
||||
done
|
||||
}
|
||||
|
||||
bug
|
||||
echo
|
||||
|
||||
exit 0
|
||||
+12
-2
@@ -1,6 +1,6 @@
|
||||
/* variables.c -- Functions for hacking shell variables. */
|
||||
|
||||
/* Copyright (C) 1987-2010 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1987-2011 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -310,7 +310,7 @@ initialize_shell_variables (env, privmode)
|
||||
int privmode;
|
||||
{
|
||||
char *name, *string, *temp_string;
|
||||
int c, char_index, string_index, string_length;
|
||||
int c, char_index, string_index, string_length, ro;
|
||||
SHELL_VAR *temp_var;
|
||||
|
||||
create_variable_tables ();
|
||||
@@ -386,6 +386,14 @@ initialize_shell_variables (env, privmode)
|
||||
else
|
||||
#endif
|
||||
{
|
||||
ro = 0;
|
||||
if (posixly_correct && STREQ (name, "SHELLOPTS"))
|
||||
{
|
||||
temp_var = find_variable ("SHELLOPTS");
|
||||
ro = temp_var && readonly_p (temp_var);
|
||||
if (temp_var)
|
||||
VUNSETATTR (temp_var, att_readonly);
|
||||
}
|
||||
temp_var = bind_variable (name, string, 0);
|
||||
if (temp_var)
|
||||
{
|
||||
@@ -393,6 +401,8 @@ initialize_shell_variables (env, privmode)
|
||||
VSETATTR (temp_var, (att_exported | att_imported));
|
||||
else
|
||||
VSETATTR (temp_var, (att_exported | att_imported | att_invisible));
|
||||
if (ro)
|
||||
VSETATTR (temp_var, att_readonly);
|
||||
array_needs_making = 1;
|
||||
}
|
||||
}
|
||||
|
||||
+4822
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user