mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-27 07:43:07 +02:00
commit bash-20080221 snapshot
This commit is contained in:
@@ -15281,3 +15281,37 @@ bashline.c
|
||||
the text the user typed (this is what readline does for normal
|
||||
filename completion). Fixes issue reported by Jian Wang
|
||||
<jwang@a10networks.com.cn>.
|
||||
|
||||
2/18
|
||||
----
|
||||
builtins/source.def
|
||||
- if the filename passed as an argument contains a `/', don't search
|
||||
$PATH. Not sure why it wasn't like this before
|
||||
|
||||
2/21
|
||||
----
|
||||
lib/readline/terminal.c
|
||||
- change rl_crlf so that the MINT system on ATARI systems adds a
|
||||
carriage return before the \n
|
||||
|
||||
2/22
|
||||
----
|
||||
doc/{bash.1,bashref.texi}
|
||||
- added text to the EXIT STATUS section noting that exit statuses
|
||||
fall between 0 and 255, inclusive
|
||||
|
||||
support/mkversion.sh
|
||||
- output a #define for DEFAULT_COMPAT_LEVEL (${major}${minor}; e.g. 32)
|
||||
to version.h
|
||||
|
||||
version.c
|
||||
- int variable, shell_compatibility_level, set to DEFAULT_COMPAT_LEVEL
|
||||
by default
|
||||
|
||||
builtins/shopt.def
|
||||
- new shopt variable, compat31, sets shell_compatibility_level to 31
|
||||
(or back to default if unset)
|
||||
|
||||
execute_cmd.c
|
||||
- in execute_cond_node, restore bash-3.1 behavior of quoted rhs of
|
||||
regexp matches if shell_compatibility_level == 31
|
||||
|
||||
@@ -15271,3 +15271,47 @@ general.c
|
||||
builtins/*.def
|
||||
- changes to text and formatting suggested by Jan Schampera
|
||||
<jan.schampera@web.de>
|
||||
|
||||
2/16
|
||||
----
|
||||
bashline.c
|
||||
- change command_word_completion_function to use the word completion
|
||||
found by readline, which matters only when ignoring case is on
|
||||
and the completion found in the file system differs in case from
|
||||
the text the user typed (this is what readline does for normal
|
||||
filename completion). Fixes issue reported by Jian Wang
|
||||
<jwang@a10networks.com.cn>.
|
||||
|
||||
2/18
|
||||
----
|
||||
builtins/source.def
|
||||
- if the filename passed as an argument contains a `/', don't search
|
||||
$PATH. Not sure why it wasn't like this before
|
||||
|
||||
2/21
|
||||
----
|
||||
lib/readline/terminal.c
|
||||
- change rl_crlf so that the MINT system on ATARI systems adds a
|
||||
carriage return before the \n
|
||||
|
||||
2/22
|
||||
----
|
||||
doc/{bash.1,bashref.texi}
|
||||
- added text to the EXIT STATUS section noting that exit statuses
|
||||
fall between 0 and 255, inclusive
|
||||
|
||||
support/mkversion.sh
|
||||
- output a #define for DEFAULT_COMPAT_LEVEL (${major}${minor}; e.g. 32)
|
||||
to version.h
|
||||
|
||||
version.c
|
||||
- int variable, shell_compatibility_level, set to DEFAULT_COMPAT_LEVEL
|
||||
by default
|
||||
|
||||
builtins/shopt.def
|
||||
- new shopt variable, compat31, sets shell_compatibility_level to 31
|
||||
(or back to default if unset)
|
||||
|
||||
execute_cmd.c
|
||||
- in execute_cond_node, restore bash-3.1 behavior of quoted rhs of
|
||||
regexp matches if shell_compatibility_level == 31
|
||||
|
||||
@@ -1350,7 +1350,7 @@ Optional Features:
|
||||
include brace expansion
|
||||
--enable-command-timing enable the time reserved word and command timing
|
||||
--enable-cond-command enable the conditional command
|
||||
--enable-cond-regexp enable extgended regular expression matching in
|
||||
--enable-cond-regexp enable extended regular expression matching in
|
||||
conditional commands
|
||||
--enable-debugger enable support for bash debugger
|
||||
--enable-directory-stack
|
||||
|
||||
@@ -48,6 +48,8 @@ $END
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "version.h"
|
||||
|
||||
#include "../bashintl.h"
|
||||
|
||||
#include "../shell.h"
|
||||
@@ -106,11 +108,15 @@ static void shopt_error __P((char *));
|
||||
|
||||
static int set_shellopts_after_change __P((int));
|
||||
|
||||
static int set_compatibility_level __P((int));
|
||||
|
||||
#if defined (RESTRICTED_SHELL)
|
||||
static int set_restricted_shell __P((int));
|
||||
#endif
|
||||
|
||||
static int shopt_login_shell;
|
||||
static int shopt_compat31;
|
||||
static int shopt_compat32;
|
||||
|
||||
typedef int shopt_set_func_t __P((int));
|
||||
|
||||
@@ -128,6 +134,7 @@ static struct {
|
||||
#if defined (HISTORY)
|
||||
{ "cmdhist", &command_oriented_history, (shopt_set_func_t *)NULL },
|
||||
#endif
|
||||
{ "compat31", &shopt_compat31, set_compatibility_level },
|
||||
{ "dotglob", &glob_dot_filenames, (shopt_set_func_t *)NULL },
|
||||
{ "execfail", &no_exit_on_failed_exec, (shopt_set_func_t *)NULL },
|
||||
{ "expand_aliases", &expand_aliases, (shopt_set_func_t *)NULL },
|
||||
@@ -466,6 +473,20 @@ set_shellopts_after_change (mode)
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
set_compatibility_level (mode)
|
||||
int mode;
|
||||
{
|
||||
/* Need to change logic here as we add more compatibility levels */
|
||||
if (shopt_compat31)
|
||||
shell_compatibility_level = 31;
|
||||
else if (shopt_compat32)
|
||||
shell_compatibility_level = 32;
|
||||
else
|
||||
shell_compatibility_level = DEFAULT_COMPAT_LEVEL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined (RESTRICTED_SHELL)
|
||||
/* Don't allow the value of restricted_shell to be modified. */
|
||||
|
||||
|
||||
+15
-1
@@ -28,7 +28,6 @@ Set and unset shell options. Without any option arguments, list all
|
||||
shell options with an indication of whether or not each is set.
|
||||
|
||||
Options:
|
||||
|
||||
-o restrict OPTNAMEs to those defined for use with `set -o'
|
||||
-p print each shell option with an indication of its status
|
||||
-q suppress output
|
||||
@@ -49,6 +48,8 @@ $END
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "version.h"
|
||||
|
||||
#include "../bashintl.h"
|
||||
|
||||
#include "../shell.h"
|
||||
@@ -107,11 +108,14 @@ static void shopt_error __P((char *));
|
||||
|
||||
static int set_shellopts_after_change __P((int));
|
||||
|
||||
static int set_compatibility_level __P((int));
|
||||
|
||||
#if defined (RESTRICTED_SHELL)
|
||||
static int set_restricted_shell __P((int));
|
||||
#endif
|
||||
|
||||
static int shopt_login_shell;
|
||||
static int shopt_compat31;
|
||||
|
||||
typedef int shopt_set_func_t __P((int));
|
||||
|
||||
@@ -129,6 +133,7 @@ static struct {
|
||||
#if defined (HISTORY)
|
||||
{ "cmdhist", &command_oriented_history, (shopt_set_func_t *)NULL },
|
||||
#endif
|
||||
{ "compat31", &shopt_compat31, set_compatibility_level },
|
||||
{ "dotglob", &glob_dot_filenames, (shopt_set_func_t *)NULL },
|
||||
{ "execfail", &no_exit_on_failed_exec, (shopt_set_func_t *)NULL },
|
||||
{ "expand_aliases", &expand_aliases, (shopt_set_func_t *)NULL },
|
||||
@@ -467,6 +472,15 @@ set_shellopts_after_change (mode)
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
set_compatibility_level (mode)
|
||||
int mode;
|
||||
{
|
||||
/* Need to change logic here if we add more compatibility levels */
|
||||
shell_compatibility_level = shopt_compat31 ? 31 : DEFAULT_COMPAT_LEVEL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined (RESTRICTED_SHELL)
|
||||
/* Don't allow the value of restricted_shell to be modified. */
|
||||
|
||||
|
||||
+8
-1
@@ -67,6 +67,8 @@ $END
|
||||
extern int errno;
|
||||
#endif /* !errno */
|
||||
|
||||
extern int posixly_correct;
|
||||
|
||||
static void maybe_pop_dollar_vars __P((void));
|
||||
|
||||
/* If non-zero, `.' uses $PATH to look up the script to be sourced. */
|
||||
@@ -125,7 +127,12 @@ source_builtin (list)
|
||||
#endif
|
||||
|
||||
filename = (char *)NULL;
|
||||
if (source_uses_path)
|
||||
/* XXX -- should this be absolute_pathname? */
|
||||
if (posixly_correct && strchr (list->word->word, '/'))
|
||||
filename = savestring (list->word->word);
|
||||
else if (absolute_pathname (list->word->word))
|
||||
filename = savestring (list->word->word);
|
||||
else if (source_uses_path)
|
||||
filename = find_path_file (list->word->word);
|
||||
if (filename == 0)
|
||||
{
|
||||
|
||||
@@ -1350,7 +1350,7 @@ Optional Features:
|
||||
include brace expansion
|
||||
--enable-command-timing enable the time reserved word and command timing
|
||||
--enable-cond-command enable the conditional command
|
||||
--enable-cond-regexp enable extgended regular expression matching in
|
||||
--enable-cond-regexp enable extended regular expression matching in
|
||||
conditional commands
|
||||
--enable-debugger enable support for bash debugger
|
||||
--enable-directory-stack
|
||||
|
||||
+1
-1
@@ -211,7 +211,7 @@ AC_ARG_ENABLE(bang-history, AC_HELP_STRING([--enable-bang-history], [turn on csh
|
||||
AC_ARG_ENABLE(brace-expansion, AC_HELP_STRING([--enable-brace-expansion], [include brace expansion]), opt_brace_expansion=$enableval)
|
||||
AC_ARG_ENABLE(command-timing, AC_HELP_STRING([--enable-command-timing], [enable the time reserved word and command timing]), opt_command_timing=$enableval)
|
||||
AC_ARG_ENABLE(cond-command, AC_HELP_STRING([--enable-cond-command], [enable the conditional command]), opt_cond_command=$enableval)
|
||||
AC_ARG_ENABLE(cond-regexp, AC_HELP_STRING([--enable-cond-regexp], [enable extgended regular expression matching in conditional commands]), opt_cond_regexp=$enableval)
|
||||
AC_ARG_ENABLE(cond-regexp, AC_HELP_STRING([--enable-cond-regexp], [enable extended regular expression matching in conditional commands]), opt_cond_regexp=$enableval)
|
||||
AC_ARG_ENABLE(debugger, AC_HELP_STRING([--enable-debugger], [enable support for bash debugger]), opt_debugger=$enableval)
|
||||
AC_ARG_ENABLE(directory-stack, AC_HELP_STRING([--enable-directory-stack], [enable builtins pushd/popd/dirs]), opt_dirstack=$enableval)
|
||||
AC_ARG_ENABLE(disabled-builtins, AC_HELP_STRING([--enable-disabled-builtins], [allow disabled builtins to still be invoked]), opt_disabled_builtins=$enableval)
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ dnl Process this file with autoconf to produce a configure script.
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
AC_REVISION([for Bash 3.2, version 3.196])dnl
|
||||
AC_REVISION([for Bash 3.2, version 3.197])dnl
|
||||
|
||||
define(bashvers, 3.2)
|
||||
define(relstatus, maint)
|
||||
|
||||
@@ -1,42 +1,98 @@
|
||||
*** ../bash-3.2-patched/version.c 2005-05-16 11:58:34.000000000 -0400
|
||||
--- version.c 2007-11-23 16:03:40.000000000 -0500
|
||||
*** ../bash-3.2-patched/lib/sh/getcwd.c 2004-07-21 17:15:19.000000000 -0400
|
||||
--- lib/sh/getcwd.c 2007-12-31 19:26:36.000000000 -0500
|
||||
***************
|
||||
*** 34,46 ****
|
||||
*** 27,30 ****
|
||||
--- 27,34 ----
|
||||
#endif /* _AIX && RISC6000 && !__GNUC__ */
|
||||
|
||||
/* Defines from version.h */
|
||||
! const char *dist_version = DISTVERSION;
|
||||
! int patch_level = PATCHLEVEL;
|
||||
! int build_version = BUILDVERSION;
|
||||
#ifdef RELSTATUS
|
||||
! const char *release_status = RELSTATUS;
|
||||
#else
|
||||
! const char *release_status = (char *)0;
|
||||
#endif
|
||||
! const char *sccs_version = SCCSVERSION;
|
||||
|
||||
/* Functions for getting, setting, and displaying the shell version. */
|
||||
--- 34,46 ----
|
||||
|
||||
/* Defines from version.h */
|
||||
! const char * const dist_version = DISTVERSION;
|
||||
! const int patch_level = PATCHLEVEL;
|
||||
! const int build_version = BUILDVERSION;
|
||||
#ifdef RELSTATUS
|
||||
! const char * const release_status = RELSTATUS;
|
||||
#else
|
||||
! const char * const release_status = (char *)0;
|
||||
#endif
|
||||
! const char * const sccs_version = SCCSVERSION;
|
||||
|
||||
/* Functions for getting, setting, and displaying the shell version. */
|
||||
+ #if defined (__QNX__)
|
||||
+ # undef HAVE_LSTAT
|
||||
+ #endif
|
||||
+
|
||||
#include <bashtypes.h>
|
||||
#include <errno.h>
|
||||
***************
|
||||
*** 80,83 ****
|
||||
printf ("GNU bash, version %s (%s)\n", shell_version_string (), MACHTYPE);
|
||||
if (extended)
|
||||
! printf (_("Copyright (C) 2005 Free Software Foundation, Inc.\n"));
|
||||
}
|
||||
--- 80,83 ----
|
||||
printf ("GNU bash, version %s (%s)\n", shell_version_string (), MACHTYPE);
|
||||
if (extended)
|
||||
! printf (_("Copyright (C) 2007 Free Software Foundation, Inc.\n"));
|
||||
}
|
||||
*** 59,62 ****
|
||||
--- 63,93 ----
|
||||
#endif
|
||||
|
||||
+ /* If the d_fileno member of a struct dirent doesn't return anything useful,
|
||||
+ we need to check inode number equivalence the hard way. Return 1 if
|
||||
+ the inode corresponding to PATH/DIR is identical to THISINO. */
|
||||
+ #if defined (BROKEN_DIRENT_D_INO)
|
||||
+ static int
|
||||
+ _path_checkino (dotp, name, thisino)
|
||||
+ char *dotp;
|
||||
+ char *name;
|
||||
+ ino_t thisino;
|
||||
+ {
|
||||
+ char *fullpath;
|
||||
+ int r, e;
|
||||
+ struct stat st;
|
||||
+
|
||||
+ e = errno;
|
||||
+ fullpath = sh_makepath (dotp, name, MP_RMDOT);
|
||||
+ if (stat (fullpath, &st) < 0)
|
||||
+ {
|
||||
+ errno = e;
|
||||
+ return 0;
|
||||
+ }
|
||||
+ free (fullpath);
|
||||
+ errno = e;
|
||||
+ return (st.st_ino == thisino);
|
||||
+ }
|
||||
+ #endif
|
||||
+
|
||||
/* Get the pathname of the current working directory,
|
||||
and put it in SIZE bytes of BUF. Returns NULL if the
|
||||
***************
|
||||
*** 170,174 ****
|
||||
--- 201,209 ----
|
||||
(d->d_name[1] == '.' && d->d_name[2] == '\0')))
|
||||
continue;
|
||||
+ #if !defined (BROKEN_DIRENT_D_INO)
|
||||
if (mount_point || d->d_fileno == thisino)
|
||||
+ #else
|
||||
+ if (mount_point || _path_checkino (dotp, d->d_name, thisino))
|
||||
+ #endif
|
||||
{
|
||||
char *name;
|
||||
***************
|
||||
*** 252,268 ****
|
||||
{
|
||||
size_t len = pathbuf + pathsize - pathp;
|
||||
if (buf == NULL)
|
||||
{
|
||||
! if (len < (size_t) size)
|
||||
! len = size;
|
||||
! buf = (char *) malloc (len);
|
||||
if (buf == NULL)
|
||||
goto lose2;
|
||||
}
|
||||
! else if ((size_t) size < len)
|
||||
! {
|
||||
! errno = ERANGE;
|
||||
! goto lose2;
|
||||
! }
|
||||
(void) memcpy((PTR_T) buf, (PTR_T) pathp, len);
|
||||
}
|
||||
--- 287,305 ----
|
||||
{
|
||||
size_t len = pathbuf + pathsize - pathp;
|
||||
+ if (buf == NULL && size <= 0)
|
||||
+ size = len;
|
||||
+
|
||||
+ if ((size_t) size < len)
|
||||
+ {
|
||||
+ errno = ERANGE;
|
||||
+ goto lose2;
|
||||
+ }
|
||||
if (buf == NULL)
|
||||
{
|
||||
! buf = (char *) malloc (size);
|
||||
if (buf == NULL)
|
||||
goto lose2;
|
||||
}
|
||||
!
|
||||
(void) memcpy((PTR_T) buf, (PTR_T) pathp, len);
|
||||
}
|
||||
|
||||
+19
-4
@@ -5,12 +5,12 @@
|
||||
.\" Case Western Reserve University
|
||||
.\" chet@po.cwru.edu
|
||||
.\"
|
||||
.\" Last Change: Wed Dec 5 22:08:48 EST 2007
|
||||
.\" Last Change: Fri Feb 22 21:45:32 EST 2008
|
||||
.\"
|
||||
.\" bash_builtins, strip all but Built-Ins section
|
||||
.if \n(zZ=1 .ig zZ
|
||||
.if \n(zY=1 .ig zY
|
||||
.TH BASH 1 "2007 December 5" "GNU Bash-3.2"
|
||||
.TH BASH 1 "2008 February 22" "GNU Bash-3.2"
|
||||
.\"
|
||||
.\" There's some problem with having a `@'
|
||||
.\" in a tagged paragraph with the BSD man macros.
|
||||
@@ -50,8 +50,8 @@ bash \- GNU Bourne-Again SHell
|
||||
[options]
|
||||
[file]
|
||||
.SH COPYRIGHT
|
||||
.if n Bash is Copyright (C) 1989-2007 by the Free Software Foundation, Inc.
|
||||
.if t Bash is Copyright \(co 1989-2007 by the Free Software Foundation, Inc.
|
||||
.if n Bash is Copyright (C) 1989-2008 by the Free Software Foundation, Inc.
|
||||
.if t Bash is Copyright \(co 1989-2008 by the Free Software Foundation, Inc.
|
||||
.SH DESCRIPTION
|
||||
.B Bash
|
||||
is an \fBsh\fR-compatible command language interpreter that
|
||||
@@ -3950,6 +3950,15 @@ invokes an external command, the variable
|
||||
is set to the full file name of the command and passed to that
|
||||
command in its environment.
|
||||
.SH "EXIT STATUS"
|
||||
.PP
|
||||
The exit status of an executed command is the value returned by the
|
||||
\fIwaitpid\fP system call or equivalent function. Exit statuses
|
||||
fall between 0 and 255, though, as explained below, the shell may
|
||||
use values above 125 specially. Exit statuses from shell builtins and
|
||||
compound commands are also limited to this range. Under certain
|
||||
circumstances, the shell will use special values to indicate specific
|
||||
failure modes.
|
||||
.PP
|
||||
For the shell's purposes, a command which exits with a
|
||||
zero exit status has succeeded. An exit status of zero
|
||||
indicates success. A non-zero exit status indicates failure.
|
||||
@@ -8081,6 +8090,12 @@ attempts to save all lines of a multiple-line
|
||||
command in the same history entry. This allows
|
||||
easy re-editing of multi-line commands.
|
||||
.TP 8
|
||||
.B compat31
|
||||
If set,
|
||||
.B bash
|
||||
changes its behavior to that of version 3.1 with respect to quoted
|
||||
arguments to the conditional command's =~ operator.
|
||||
.TP 8
|
||||
.B dotglob
|
||||
If set,
|
||||
.B bash
|
||||
|
||||
+16
-6
@@ -5,12 +5,12 @@
|
||||
.\" Case Western Reserve University
|
||||
.\" chet@po.cwru.edu
|
||||
.\"
|
||||
.\" Last Change: Fri Sep 14 13:44:37 EDT 2007
|
||||
.\" Last Change: Wed Dec 5 22:08:48 EST 2007
|
||||
.\"
|
||||
.\" bash_builtins, strip all but Built-Ins section
|
||||
.if \n(zZ=1 .ig zZ
|
||||
.if \n(zY=1 .ig zY
|
||||
.TH BASH 1 "2007 November 21" "GNU Bash-3.2"
|
||||
.TH BASH 1 "2007 December 5" "GNU Bash-3.2"
|
||||
.\"
|
||||
.\" There's some problem with having a `@'
|
||||
.\" in a tagged paragraph with the BSD man macros.
|
||||
@@ -409,11 +409,12 @@ whose name is the expanded value.
|
||||
No other startup files are read.
|
||||
.PP
|
||||
.B Bash
|
||||
attempts to determine when it is being run by the remote shell
|
||||
daemon, usually \fIrshd\fP.
|
||||
attempts to determine when it is being run with its standard input
|
||||
connected to a a network connection, as if by the remote shell
|
||||
daemon, usually \fIrshd\fP, or the secure shell daemon \fIsshd\fP.
|
||||
If
|
||||
.B bash
|
||||
determines it is being run by \fIrshd\fP, it reads and executes
|
||||
determines it is being run in this fashion, it reads and executes
|
||||
commands from \fI~/.bashrc\fP, if that file exists and is readable.
|
||||
It will not do this if invoked as \fBsh\fP.
|
||||
The
|
||||
@@ -3949,6 +3950,15 @@ invokes an external command, the variable
|
||||
is set to the full file name of the command and passed to that
|
||||
command in its environment.
|
||||
.SH "EXIT STATUS"
|
||||
.PP
|
||||
The exit status of an executed command is the value returned by the
|
||||
\fIwaitpid\fP system call or equivalent function. Exit statuses
|
||||
fall between 0 and 255, though, as explained below, the shell may
|
||||
use values above 125 specially. Exit statuses from shell builtins and
|
||||
compound commands are also limited to this range. Under certain
|
||||
circumstances, the shell will use special values to indicate specific
|
||||
failure modes.
|
||||
.PP
|
||||
For the shell's purposes, a command which exits with a
|
||||
zero exit status has succeeded. An exit status of zero
|
||||
indicates success. A non-zero exit status indicates failure.
|
||||
@@ -7665,7 +7675,7 @@ or
|
||||
keyword,
|
||||
part of the test in an
|
||||
.B if
|
||||
statement, part of a
|
||||
statement, part of a command executed in a
|
||||
.B &&
|
||||
or
|
||||
.B \(bv\(bv
|
||||
|
||||
@@ -2454,6 +2454,14 @@ command in its environment.
|
||||
@subsection Exit Status
|
||||
@cindex exit status
|
||||
|
||||
The exit status of an executed command is the value returned by the
|
||||
@var{waitpid} system call or equivalent function. Exit statuses
|
||||
fall between 0 and 255, though, as explained below, the shell may
|
||||
use values above 125 specially. Exit statuses from shell builtins and
|
||||
compound commands are also limited to this range. Under certain
|
||||
circumstances, the shell will use special values to indicate specific
|
||||
failure modes.
|
||||
|
||||
For the shell's purposes, a command which exits with a
|
||||
zero exit status has succeeded.
|
||||
A non-zero exit status indicates failure.
|
||||
@@ -4052,6 +4060,11 @@ attempts to save all lines of a multiple-line
|
||||
command in the same history entry. This allows
|
||||
easy re-editing of multi-line commands.
|
||||
|
||||
@item compat31
|
||||
If set, Bash
|
||||
changes its behavior to that of version 3.1 with respect to quoted
|
||||
arguments to the conditional command's =~ operator.
|
||||
|
||||
@item dotglob
|
||||
If set, Bash includes filenames beginning with a `.' in
|
||||
the results of filename expansion.
|
||||
|
||||
+9
-1
@@ -2454,6 +2454,14 @@ command in its environment.
|
||||
@subsection Exit Status
|
||||
@cindex exit status
|
||||
|
||||
The exit status of an executed command is the value returned by the
|
||||
@var{waitpid} system call or equivalent function. Exit statuses
|
||||
fall between 0 and 255, though, as explained below, the shell may
|
||||
use values above 125 specially. Exit statuses from shell builtins and
|
||||
compound commands are also limited to this range. Under certain
|
||||
circumstances, the shell will use special values to indicate specific
|
||||
failure modes.
|
||||
|
||||
For the shell's purposes, a command which exits with a
|
||||
zero exit status has succeeded.
|
||||
A non-zero exit status indicates failure.
|
||||
@@ -3438,7 +3446,7 @@ parent.
|
||||
@item printf
|
||||
@btindex printf
|
||||
@example
|
||||
@code{printf} [-v @var{var}] @var{format} [@var{arguments}]
|
||||
printf [-v @var{var}] @var{format} [@var{arguments}]
|
||||
@end example
|
||||
Write the formatted @var{arguments} to the standard output under the
|
||||
control of the @var{format}.
|
||||
|
||||
+4
-4
@@ -1,10 +1,10 @@
|
||||
@ignore
|
||||
Copyright (C) 1988-2007 Free Software Foundation, Inc.
|
||||
Copyright (C) 1988-2008 Free Software Foundation, Inc.
|
||||
@end ignore
|
||||
|
||||
@set LASTCHANGE Fri Dec 14 23:10:36 EST 2007
|
||||
@set LASTCHANGE Fri Feb 22 21:45:01 EST 2008
|
||||
|
||||
@set EDITION 3.2
|
||||
@set VERSION 3.2
|
||||
@set UPDATED 14 December 2007
|
||||
@set UPDATED-MONTH December 2007
|
||||
@set UPDATED 22 February 2008
|
||||
@set UPDATED-MONTH February 2008
|
||||
|
||||
+2
-2
@@ -2,9 +2,9 @@
|
||||
Copyright (C) 1988-2007 Free Software Foundation, Inc.
|
||||
@end ignore
|
||||
|
||||
@set LASTCHANGE
|
||||
@set LASTCHANGE Fri Dec 14 23:10:36 EST 2007
|
||||
|
||||
@set EDITION 3.2
|
||||
@set VERSION 3.2
|
||||
@set UPDATED 5 December 2007
|
||||
@set UPDATED 14 December 2007
|
||||
@set UPDATED-MONTH December 2007
|
||||
|
||||
+2
-1
@@ -2551,7 +2551,8 @@ execute_cond_node (cond)
|
||||
arg1 = cond_expand_word (cond->left->op, 0);
|
||||
if (arg1 == 0)
|
||||
arg1 = nullstr;
|
||||
arg2 = cond_expand_word (cond->right->op, rmatch ? 2 : (patmatch ? 1 : 0));
|
||||
arg2 = cond_expand_word (cond->right->op,
|
||||
(rmatch && shell_compatibility_level > 31) ? 2 : (patmatch ? 1 : 0));
|
||||
if (arg2 == 0)
|
||||
arg2 = nullstr;
|
||||
|
||||
|
||||
+5
-2
@@ -619,7 +619,7 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
|
||||
cleanup_redirects (redirection_undo_list);
|
||||
redirection_undo_list = (REDIRECT *)NULL;
|
||||
dispose_exec_redirects ();
|
||||
return (EXECUTION_FAILURE);
|
||||
return (last_command_exit_value = EXECUTION_FAILURE);
|
||||
}
|
||||
|
||||
if (redirection_undo_list)
|
||||
@@ -2551,7 +2551,8 @@ execute_cond_node (cond)
|
||||
arg1 = cond_expand_word (cond->left->op, 0);
|
||||
if (arg1 == 0)
|
||||
arg1 = nullstr;
|
||||
arg2 = cond_expand_word (cond->right->op, rmatch ? 2 : (patmatch ? 1 : 0));
|
||||
arg2 = cond_expand_word (cond->right->op,
|
||||
(rmatch && shell_compatibility_level == 31) ? 2 : (patmatch ? 1 : 0));
|
||||
if (arg2 == 0)
|
||||
arg2 = nullstr;
|
||||
|
||||
@@ -3915,6 +3916,8 @@ initialize_subshell ()
|
||||
shell_variables = shell_variables->down;
|
||||
|
||||
clear_unwind_protect_list (0);
|
||||
/* XXX -- are there other things we should be resetting here? */
|
||||
parse_and_execute_level = 0; /* nothing left to restore it */
|
||||
|
||||
/* We're no longer inside a shell function. */
|
||||
variable_context = return_catch_flag = 0;
|
||||
|
||||
@@ -67,6 +67,10 @@ extern char *xstrchr __P((const char *, int));
|
||||
#define MBLEN(s, n) 1
|
||||
#define MBRLEN(s, n, p) 1
|
||||
|
||||
#ifndef wchar_t
|
||||
# define wchar_t int
|
||||
#endif
|
||||
|
||||
#endif /* !HANDLE_MULTIBYTE */
|
||||
|
||||
/* Declare and initialize a multibyte state. Call must be terminated
|
||||
|
||||
@@ -0,0 +1,445 @@
|
||||
/* shmbutil.h -- utility functions for multibyte characters. */
|
||||
|
||||
/* Copyright (C) 2002-2004 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 2, 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; see the file COPYING. If not, write to the Free Software
|
||||
Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
|
||||
|
||||
#if !defined (_SH_MBUTIL_H_)
|
||||
#define _SH_MBUTIL_H_
|
||||
|
||||
#include "stdc.h"
|
||||
|
||||
/* Include config.h for HANDLE_MULTIBYTE */
|
||||
#include <config.h>
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
|
||||
extern size_t xmbsrtowcs __P((wchar_t *, const char **, size_t, mbstate_t *));
|
||||
extern size_t xdupmbstowcs __P((wchar_t **, char ***, const char *));
|
||||
|
||||
extern size_t mbstrlen __P((const char *));
|
||||
|
||||
extern char *xstrchr __P((const char *, int));
|
||||
|
||||
#ifndef MB_INVALIDCH
|
||||
#define MB_INVALIDCH(x) ((x) == (size_t)-1 || (x) == (size_t)-2)
|
||||
#define MB_NULLWCH(x) ((x) == 0)
|
||||
#endif
|
||||
|
||||
#define MBSLEN(s) (((s) && (s)[0]) ? ((s)[1] ? mbstrlen (s) : 1) : 0)
|
||||
#define MB_STRLEN(s) ((MB_CUR_MAX > 1) ? MBSLEN (s) : STRLEN (s))
|
||||
|
||||
#define MBLEN(s, n) ((MB_CUR_MAX > 1) ? mblen ((s), (n)) : 1)
|
||||
#define MBRLEN(s, n, p) ((MB_CUR_MAX > 1) ? mbrlen ((s), (n), (p)) : 1)
|
||||
|
||||
#else /* !HANDLE_MULTIBYTE */
|
||||
|
||||
#undef MB_LEN_MAX
|
||||
#undef MB_CUR_MAX
|
||||
|
||||
#define MB_LEN_MAX 1
|
||||
#define MB_CUR_MAX 1
|
||||
|
||||
#undef xstrchr
|
||||
#define xstrchr(s, c) strchr(s, c)
|
||||
|
||||
#ifndef MB_INVALIDCH
|
||||
#define MB_INVALIDCH(x) (0)
|
||||
#define MB_NULLWCH(x) (0)
|
||||
#endif
|
||||
|
||||
#define MB_STRLEN(s) (STRLEN(s))
|
||||
|
||||
#define MBLEN(s, n) 1
|
||||
#define MBRLEN(s, n, p) 1
|
||||
|
||||
#endif /* !HANDLE_MULTIBYTE */
|
||||
|
||||
/* Declare and initialize a multibyte state. Call must be terminated
|
||||
with `;'. */
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
# define DECLARE_MBSTATE \
|
||||
mbstate_t state; \
|
||||
memset (&state, '\0', sizeof (mbstate_t))
|
||||
#else
|
||||
# define DECLARE_MBSTATE
|
||||
#endif /* !HANDLE_MULTIBYTE */
|
||||
|
||||
/* Initialize or reinitialize a multibyte state named `state'. Call must be
|
||||
terminated with `;'. */
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
# define INITIALIZE_MBSTATE memset (&state, '\0', sizeof (mbstate_t))
|
||||
#else
|
||||
# define INITIALIZE_MBSTATE
|
||||
#endif /* !HANDLE_MULTIBYTE */
|
||||
|
||||
/* Advance one (possibly multi-byte) character in string _STR of length
|
||||
_STRSIZE, starting at index _I. STATE must have already been declared. */
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
# define ADVANCE_CHAR(_str, _strsize, _i) \
|
||||
do \
|
||||
{ \
|
||||
if (MB_CUR_MAX > 1) \
|
||||
{ \
|
||||
mbstate_t state_bak; \
|
||||
size_t mblength; \
|
||||
\
|
||||
state_bak = state; \
|
||||
mblength = mbrlen ((_str) + (_i), (_strsize) - (_i), &state); \
|
||||
\
|
||||
if (mblength == (size_t)-2 || mblength == (size_t)-1) \
|
||||
{ \
|
||||
state = state_bak; \
|
||||
(_i)++; \
|
||||
} \
|
||||
else if (mblength == 0) \
|
||||
(_i)++; \
|
||||
else \
|
||||
(_i) += mblength; \
|
||||
} \
|
||||
else \
|
||||
(_i)++; \
|
||||
} \
|
||||
while (0)
|
||||
#else
|
||||
# define ADVANCE_CHAR(_str, _strsize, _i) (_i)++
|
||||
#endif /* !HANDLE_MULTIBYTE */
|
||||
|
||||
/* Advance one (possibly multibyte) character in the string _STR of length
|
||||
_STRSIZE.
|
||||
SPECIAL: assume that _STR will be incremented by 1 after this call. */
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
# define ADVANCE_CHAR_P(_str, _strsize) \
|
||||
do \
|
||||
{ \
|
||||
if (MB_CUR_MAX > 1) \
|
||||
{ \
|
||||
mbstate_t state_bak; \
|
||||
size_t mblength; \
|
||||
\
|
||||
state_bak = state; \
|
||||
mblength = mbrlen ((_str), (_strsize), &state); \
|
||||
\
|
||||
if (mblength == (size_t)-2 || mblength == (size_t)-1) \
|
||||
{ \
|
||||
state = state_bak; \
|
||||
mblength = 1; \
|
||||
} \
|
||||
else \
|
||||
(_str) += (mblength < 1) ? 0 : (mblength - 1); \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
#else
|
||||
# define ADVANCE_CHAR_P(_str, _strsize)
|
||||
#endif /* !HANDLE_MULTIBYTE */
|
||||
|
||||
/* Back up one (possibly multi-byte) character in string _STR of length
|
||||
_STRSIZE, starting at index _I. STATE must have already been declared. */
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
# define BACKUP_CHAR(_str, _strsize, _i) \
|
||||
do \
|
||||
{ \
|
||||
if (MB_CUR_MAX > 1) \
|
||||
{ \
|
||||
mbstate_t state_bak; \
|
||||
size_t mblength; \
|
||||
int _x, _p; /* _x == temp index into string, _p == prev index */ \
|
||||
\
|
||||
_x = _p = 0; \
|
||||
while (_x < (_i)) \
|
||||
{ \
|
||||
state_bak = state; \
|
||||
mblength = mbrlen ((_str) + (_x), (_strsize) - (_x), &state); \
|
||||
\
|
||||
if (mblength == (size_t)-2 || mblength == (size_t)-1) \
|
||||
{ \
|
||||
state = state_bak; \
|
||||
_x++; \
|
||||
} \
|
||||
else if (mblength == 0) \
|
||||
_x++; \
|
||||
else \
|
||||
{ \
|
||||
_p = _x; /* _p == start of prev mbchar */ \
|
||||
_x += mblength; \
|
||||
} \
|
||||
} \
|
||||
(_i) = _p; \
|
||||
} \
|
||||
else \
|
||||
(_i)--; \
|
||||
} \
|
||||
while (0)
|
||||
#else
|
||||
# define BACKUP_CHAR(_str, _strsize, _i) (_i)--
|
||||
#endif /* !HANDLE_MULTIBYTE */
|
||||
|
||||
/* Back up one (possibly multibyte) character in the string _BASE of length
|
||||
_STRSIZE starting at _STR (_BASE <= _STR <= (_BASE + _STRSIZE) ).
|
||||
SPECIAL: DO NOT assume that _STR will be decremented by 1 after this call. */
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
# define BACKUP_CHAR_P(_base, _strsize, _str) \
|
||||
do \
|
||||
{ \
|
||||
if (MB_CUR_MAX > 1) \
|
||||
{ \
|
||||
mbstate_t state_bak; \
|
||||
size_t mblength; \
|
||||
char *_x, _p; /* _x == temp pointer into string, _p == prev pointer */ \
|
||||
\
|
||||
_x = _p = _base; \
|
||||
while (_x < (_str)) \
|
||||
{ \
|
||||
state_bak = state; \
|
||||
mblength = mbrlen (_x, (_strsize) - _x, &state); \
|
||||
\
|
||||
if (mblength == (size_t)-2 || mblength == (size_t)-1) \
|
||||
{ \
|
||||
state = state_bak; \
|
||||
_x++; \
|
||||
} \
|
||||
else if (mblength == 0) \
|
||||
_x++; \
|
||||
else \
|
||||
{ \
|
||||
_p = _x; /* _p == start of prev mbchar */ \
|
||||
_x += mblength; \
|
||||
} \
|
||||
} \
|
||||
(_str) = _p; \
|
||||
} \
|
||||
else \
|
||||
(_str)--; \
|
||||
} \
|
||||
while (0)
|
||||
#else
|
||||
# define BACKUP_CHAR_P(_base, _strsize, _str) (_str)--
|
||||
#endif /* !HANDLE_MULTIBYTE */
|
||||
|
||||
/* Copy a single character from the string _SRC to the string _DST.
|
||||
_SRCEND is a pointer to the end of _SRC. */
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
# define COPY_CHAR_P(_dst, _src, _srcend) \
|
||||
do \
|
||||
{ \
|
||||
if (MB_CUR_MAX > 1) \
|
||||
{ \
|
||||
mbstate_t state_bak; \
|
||||
size_t mblength; \
|
||||
int _k; \
|
||||
\
|
||||
state_bak = state; \
|
||||
mblength = mbrlen ((_src), (_srcend) - (_src), &state); \
|
||||
if (mblength == (size_t)-2 || mblength == (size_t)-1) \
|
||||
{ \
|
||||
state = state_bak; \
|
||||
mblength = 1; \
|
||||
} \
|
||||
else \
|
||||
mblength = (mblength < 1) ? 1 : mblength; \
|
||||
\
|
||||
for (_k = 0; _k < mblength; _k++) \
|
||||
*(_dst)++ = *(_src)++; \
|
||||
} \
|
||||
else \
|
||||
*(_dst)++ = *(_src)++; \
|
||||
} \
|
||||
while (0)
|
||||
#else
|
||||
# define COPY_CHAR_P(_dst, _src, _srcend) *(_dst)++ = *(_src)++
|
||||
#endif /* !HANDLE_MULTIBYTE */
|
||||
|
||||
/* Copy a single character from the string _SRC at index _SI to the string
|
||||
_DST at index _DI. _SRCEND is a pointer to the end of _SRC. */
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
# define COPY_CHAR_I(_dst, _di, _src, _srcend, _si) \
|
||||
do \
|
||||
{ \
|
||||
if (MB_CUR_MAX > 1) \
|
||||
{ \
|
||||
mbstate_t state_bak; \
|
||||
size_t mblength; \
|
||||
int _k; \
|
||||
\
|
||||
state_bak = state; \
|
||||
mblength = mbrlen ((_src) + (_si), (_srcend) - ((_src)+(_si)), &state); \
|
||||
if (mblength == (size_t)-2 || mblength == (size_t)-1) \
|
||||
{ \
|
||||
state = state_bak; \
|
||||
mblength = 1; \
|
||||
} \
|
||||
else \
|
||||
mblength = (mblength < 1) ? 1 : mblength; \
|
||||
\
|
||||
for (_k = 0; _k < mblength; _k++) \
|
||||
_dst[_di++] = _src[_si++]; \
|
||||
} \
|
||||
else \
|
||||
_dst[_di++] = _src[_si++]; \
|
||||
} \
|
||||
while (0)
|
||||
#else
|
||||
# define COPY_CHAR_I(_dst, _di, _src, _srcend, _si) _dst[_di++] = _src[_si++]
|
||||
#endif /* !HANDLE_MULTIBYTE */
|
||||
|
||||
/****************************************************************
|
||||
* *
|
||||
* The following are only guaranteed to work in subst.c *
|
||||
* *
|
||||
****************************************************************/
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
# define SCOPY_CHAR_I(_dst, _escchar, _sc, _src, _si, _slen) \
|
||||
do \
|
||||
{ \
|
||||
if (MB_CUR_MAX > 1) \
|
||||
{ \
|
||||
mbstate_t state_bak; \
|
||||
size_t mblength; \
|
||||
int _i; \
|
||||
\
|
||||
state_bak = state; \
|
||||
mblength = mbrlen ((_src) + (_si), (_slen) - (_si), &state); \
|
||||
if (mblength == (size_t)-2 || mblength == (size_t)-1) \
|
||||
{ \
|
||||
state = state_bak; \
|
||||
mblength = 1; \
|
||||
} \
|
||||
else \
|
||||
mblength = (mblength < 1) ? 1 : mblength; \
|
||||
\
|
||||
temp = xmalloc (mblength + 2); \
|
||||
temp[0] = _escchar; \
|
||||
for (_i = 0; _i < mblength; _i++) \
|
||||
temp[_i + 1] = _src[_si++]; \
|
||||
temp[mblength + 1] = '\0'; \
|
||||
\
|
||||
goto add_string; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
_dst[0] = _escchar; \
|
||||
_dst[1] = _sc; \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
#else
|
||||
# define SCOPY_CHAR_I(_dst, _escchar, _sc, _src, _si, _slen) \
|
||||
_dst[0] = _escchar; \
|
||||
_dst[1] = _sc
|
||||
#endif /* !HANDLE_MULTIBYTE */
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
# define SCOPY_CHAR_M(_dst, _src, _srcend, _si) \
|
||||
do \
|
||||
{ \
|
||||
if (MB_CUR_MAX > 1) \
|
||||
{ \
|
||||
mbstate_t state_bak; \
|
||||
size_t mblength; \
|
||||
\
|
||||
state_bak = state; \
|
||||
mblength = mbrlen ((_src) + (_si), (_srcend) - ((_src) + (_si)), &state); \
|
||||
if (mblength == (size_t)-2 || mblength == (size_t)-1) \
|
||||
{ \
|
||||
state = state_bak; \
|
||||
mblength = 1; \
|
||||
} \
|
||||
else \
|
||||
mblength = (mblength < 1) ? 1 : mblength; \
|
||||
\
|
||||
FASTCOPY(((_src) + (_si)), (_dst), mblength); \
|
||||
\
|
||||
(_dst) += mblength; \
|
||||
(_si) += mblength; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
*(_dst)++ = _src[(_si)]; \
|
||||
(_si)++; \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
#else
|
||||
# define SCOPY_CHAR_M(_dst, _src, _srcend, _si) \
|
||||
*(_dst)++ = _src[(_si)]; \
|
||||
(_si)++
|
||||
#endif /* !HANDLE_MULTIBYTE */
|
||||
|
||||
#if HANDLE_MULTIBYTE
|
||||
# define SADD_MBCHAR(_dst, _src, _si, _srcsize) \
|
||||
do \
|
||||
{ \
|
||||
if (MB_CUR_MAX > 1) \
|
||||
{ \
|
||||
int i; \
|
||||
mbstate_t state_bak; \
|
||||
size_t mblength; \
|
||||
\
|
||||
state_bak = state; \
|
||||
mblength = mbrlen ((_src) + (_si), (_srcsize) - (_si), &state); \
|
||||
if (mblength == (size_t)-1 || mblength == (size_t)-2) \
|
||||
{ \
|
||||
state = state_bak; \
|
||||
mblength = 1; \
|
||||
} \
|
||||
if (mblength < 1) \
|
||||
mblength = 1; \
|
||||
\
|
||||
_dst = (char *)xmalloc (mblength + 1); \
|
||||
for (i = 0; i < mblength; i++) \
|
||||
(_dst)[i] = (_src)[(_si)++]; \
|
||||
(_dst)[mblength] = '\0'; \
|
||||
\
|
||||
goto add_string; \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#else
|
||||
# define SADD_MBCHAR(_dst, _src, _si, _srcsize)
|
||||
#endif
|
||||
|
||||
/* Watch out when using this -- it's just straight textual subsitution */
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
# define SADD_MBQCHAR_BODY(_dst, _src, _si, _srcsize) \
|
||||
\
|
||||
int i; \
|
||||
mbstate_t state_bak; \
|
||||
size_t mblength; \
|
||||
\
|
||||
state_bak = state; \
|
||||
mblength = mbrlen ((_src) + (_si), (_srcsize) - (_si), &state); \
|
||||
if (mblength == (size_t)-1 || mblength == (size_t)-2) \
|
||||
{ \
|
||||
state = state_bak; \
|
||||
mblength = 1; \
|
||||
} \
|
||||
if (mblength < 1) \
|
||||
mblength = 1; \
|
||||
\
|
||||
(_dst) = (char *)xmalloc (mblength + 2); \
|
||||
(_dst)[0] = CTLESC; \
|
||||
for (i = 0; i < mblength; i++) \
|
||||
(_dst)[i+1] = (_src)[(_si)++]; \
|
||||
(_dst)[mblength+1] = '\0'; \
|
||||
\
|
||||
goto add_string
|
||||
|
||||
#endif /* HANDLE_MULTIBYTE */
|
||||
#endif /* _SH_MBUTIL_H_ */
|
||||
@@ -641,10 +641,10 @@ _rl_backspace (count)
|
||||
int
|
||||
rl_crlf ()
|
||||
{
|
||||
#if defined (NEW_TTY_DRIVER)
|
||||
#if defined (NEW_TTY_DRIVER) || defined (__MINT__)
|
||||
if (_rl_term_cr)
|
||||
tputs (_rl_term_cr, 1, _rl_output_character_function);
|
||||
#endif /* NEW_TTY_DRIVER */
|
||||
#endif /* NEW_TTY_DRIVER || __MINT__ */
|
||||
putc ('\n', _rl_out_stream);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -361,13 +361,13 @@ rl_resize_terminal ()
|
||||
}
|
||||
|
||||
struct _tc_string {
|
||||
const char *tc_var;
|
||||
const char * const tc_var;
|
||||
char **tc_value;
|
||||
};
|
||||
|
||||
/* This should be kept sorted, just in case we decide to change the
|
||||
search algorithm to something smarter. */
|
||||
static struct _tc_string tc_strings[] =
|
||||
static const struct _tc_string tc_strings[] =
|
||||
{
|
||||
{ "@7", &_rl_term_at7 },
|
||||
{ "DC", &_rl_term_DC },
|
||||
|
||||
@@ -143,7 +143,7 @@ int hup_on_exit = 0;
|
||||
int check_jobs_at_exit = 0;
|
||||
|
||||
/* Non-zero means to change to a directory name supplied as a command name */
|
||||
int autocd = 1;
|
||||
int autocd = 0;
|
||||
|
||||
/* Tells what state the shell was in when it started:
|
||||
0 = non-interactive shell script
|
||||
@@ -185,6 +185,9 @@ int have_devfd = HAVE_DEV_FD;
|
||||
int have_devfd = 0;
|
||||
#endif
|
||||
|
||||
/* If == 31, shell compatible with bash-3.1, = =32 with bash-3.2, and so on */
|
||||
int shell_compatibility_level = DEFAULT_COMPAT_LEVEL;
|
||||
|
||||
/* The name of the .(shell)rc file. */
|
||||
static char *bashrc_file = "~/.bashrc";
|
||||
|
||||
|
||||
@@ -89,6 +89,7 @@ extern int debugging_mode;
|
||||
extern int executing, login_shell;
|
||||
extern int interactive, interactive_shell;
|
||||
extern int startup_state;
|
||||
extern int shell_compatibility_level;
|
||||
|
||||
/* Structure to pass around that holds a bitmap of file descriptors
|
||||
to close, and the size of that structure. Used in execute_cmd.c. */
|
||||
|
||||
@@ -0,0 +1,163 @@
|
||||
/* shell.h -- The data structures used by the shell */
|
||||
|
||||
/* Copyright (C) 1993-2002 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 2, 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; see the file COPYING. If not, write to the Free Software
|
||||
Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "bashjmp.h"
|
||||
|
||||
#include "command.h"
|
||||
#include "syntax.h"
|
||||
#include "general.h"
|
||||
#include "error.h"
|
||||
#include "variables.h"
|
||||
#include "arrayfunc.h"
|
||||
#include "quit.h"
|
||||
#include "maxpath.h"
|
||||
#include "unwind_prot.h"
|
||||
#include "dispose_cmd.h"
|
||||
#include "make_cmd.h"
|
||||
#include "ocache.h"
|
||||
#include "subst.h"
|
||||
#include "sig.h"
|
||||
#include "pathnames.h"
|
||||
#include "externs.h"
|
||||
|
||||
extern int EOF_Reached;
|
||||
|
||||
#define NO_PIPE -1
|
||||
#define REDIRECT_BOTH -2
|
||||
|
||||
#define NO_VARIABLE -1
|
||||
|
||||
/* Values that can be returned by execute_command (). */
|
||||
#define EXECUTION_FAILURE 1
|
||||
#define EXECUTION_SUCCESS 0
|
||||
|
||||
/* Usage messages by builtins result in a return status of 2. */
|
||||
#define EX_BADUSAGE 2
|
||||
|
||||
/* Special exit statuses used by the shell, internally and externally. */
|
||||
#define EX_BINARY_FILE 126
|
||||
#define EX_NOEXEC 126
|
||||
#define EX_NOINPUT 126
|
||||
#define EX_NOTFOUND 127
|
||||
|
||||
#define EX_SHERRBASE 256 /* all special error values are > this. */
|
||||
|
||||
#define EX_BADSYNTAX 257 /* shell syntax error */
|
||||
#define EX_USAGE 258 /* syntax error in usage */
|
||||
#define EX_REDIRFAIL 259 /* redirection failed */
|
||||
#define EX_BADASSIGN 260 /* variable assignment error */
|
||||
#define EX_EXPFAIL 261 /* word expansion failed */
|
||||
|
||||
/* Flag values that control parameter pattern substitution. */
|
||||
#define MATCH_ANY 0x000
|
||||
#define MATCH_BEG 0x001
|
||||
#define MATCH_END 0x002
|
||||
|
||||
#define MATCH_TYPEMASK 0x003
|
||||
|
||||
#define MATCH_GLOBREP 0x010
|
||||
#define MATCH_QUOTED 0x020
|
||||
#define MATCH_STARSUB 0x040
|
||||
|
||||
/* Some needed external declarations. */
|
||||
extern char **shell_environment;
|
||||
extern WORD_LIST *rest_of_args;
|
||||
|
||||
/* Generalized global variables. */
|
||||
extern int debugging_mode;
|
||||
extern int executing, login_shell;
|
||||
extern int interactive, interactive_shell;
|
||||
extern int startup_state;
|
||||
|
||||
/* Structure to pass around that holds a bitmap of file descriptors
|
||||
to close, and the size of that structure. Used in execute_cmd.c. */
|
||||
struct fd_bitmap {
|
||||
int size;
|
||||
char *bitmap;
|
||||
};
|
||||
|
||||
#define FD_BITMAP_SIZE 32
|
||||
|
||||
#define CTLESC '\001'
|
||||
#define CTLNUL '\177'
|
||||
|
||||
/* Information about the current user. */
|
||||
struct user_info {
|
||||
uid_t uid, euid;
|
||||
gid_t gid, egid;
|
||||
char *user_name;
|
||||
char *shell; /* shell from the password file */
|
||||
char *home_dir;
|
||||
};
|
||||
|
||||
extern struct user_info current_user;
|
||||
|
||||
/* Force gcc to not clobber X on a longjmp(). Old versions of gcc mangle
|
||||
this badly. */
|
||||
#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ > 8)
|
||||
# define USE_VAR(x) ((void) &(x))
|
||||
#else
|
||||
# define USE_VAR(x)
|
||||
#endif
|
||||
|
||||
/* Structure in which to save partial parsing state when doing things like
|
||||
PROMPT_COMMAND and bash_execute_unix_command execution. */
|
||||
|
||||
typedef struct _sh_parser_state_t {
|
||||
|
||||
/* parsing state */
|
||||
int parser_state;
|
||||
int *token_state;
|
||||
|
||||
/* input line state -- line number saved elsewhere */
|
||||
int input_line_terminator;
|
||||
int eof_encountered;
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
/* Nothing right now for multibyte state, but might want something later. */
|
||||
#endif
|
||||
|
||||
/* history state affecting or modified by the parser */
|
||||
int current_command_line_count;
|
||||
#if defined (HISTORY)
|
||||
int remember_on_history;
|
||||
int history_expansion_inhibited;
|
||||
#endif
|
||||
|
||||
/* execution state possibly modified by the parser */
|
||||
int last_command_exit_value;
|
||||
#if defined (ARRAY_VARS)
|
||||
ARRAY *pipestatus;
|
||||
#endif
|
||||
sh_builtin_func_t *last_shell_builtin, *this_shell_builtin;
|
||||
|
||||
/* flags state affecting the parser */
|
||||
int expand_aliases;
|
||||
int echo_input_at_read;
|
||||
|
||||
} sh_parser_state_t;
|
||||
|
||||
/* Let's try declaring these here. */
|
||||
extern sh_parser_state_t *save_parser_state __P((sh_parser_state_t *));
|
||||
extern void restore_parser_state __P((sh_parser_state_t *));
|
||||
@@ -140,6 +140,10 @@ echo
|
||||
echo "/* The release status of this shell. */"
|
||||
echo "#define RELSTATUS \"${rel_status}\""
|
||||
|
||||
echo
|
||||
echo "/* The default shell compatibility-level (the current version) */"
|
||||
echo "#define DEFAULT_COMPAT_LEVEL ${dist_major}${dist_minor}"
|
||||
|
||||
# Output the SCCS version string
|
||||
sccs_string="${float_dist}.${patch_level}(${build_ver}) ${rel_status} GNU"
|
||||
echo
|
||||
|
||||
@@ -0,0 +1,166 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Simple program to make new version numbers for the shell.
|
||||
# Big deal, but it was getting out of hand to do everything
|
||||
# in the makefile. This creates a file named by the -o option,
|
||||
# otherwise everything is echoed to the standard output.
|
||||
|
||||
# Copyright (C) 1996-2002 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 2, 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, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
||||
PROGNAME=`basename $0`
|
||||
USAGE="$PROGNAME [-b] [-S srcdir] -d version -p patchlevel [-s status] [-o outfile]"
|
||||
|
||||
source_dir="."
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
-o) shift; OUTFILE=$1; shift ;;
|
||||
-b) shift; inc_build=yes ;;
|
||||
-s) shift; rel_status=$1; shift ;;
|
||||
-p) shift; patch_level=$1; shift ;;
|
||||
-d) shift; dist_version=$1; shift ;;
|
||||
-S) shift; source_dir="$1"; shift ;;
|
||||
*) echo "$PROGNAME: usage: $USAGE" >&2 ; exit 2 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Required arguments
|
||||
if [ -z "$dist_version" ]; then
|
||||
echo "${PROGNAME}: required argument -d missing" >&2
|
||||
echo "$PROGNAME: usage: $USAGE" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#if [ -z "$patch_level" ]; then
|
||||
# echo "${PROGNAME}: required argument -p missing" >&2
|
||||
# echo "$PROGNAME: usage: $USAGE" >&2
|
||||
# exit 1
|
||||
#fi
|
||||
|
||||
# Defaults
|
||||
if [ -z "$rel_status" ]; then
|
||||
rel_status="release"
|
||||
fi
|
||||
|
||||
build_ver=
|
||||
if [ -r .build ]; then
|
||||
build_ver=`cat .build`
|
||||
fi
|
||||
if [ -z "$build_ver" ]; then
|
||||
build_ver=0
|
||||
fi
|
||||
|
||||
# increment the build version if that's what's required
|
||||
|
||||
if [ -n "$inc_build" ]; then
|
||||
build_ver=`expr 1 + $build_ver`
|
||||
fi
|
||||
|
||||
# what's the patch level?
|
||||
if [ -z "$patch_level" ]; then
|
||||
patchlevel_h=$source_dir/patchlevel.h
|
||||
if [ -s $patchlevel_h ]; then
|
||||
patch_level=`cat $patchlevel_h | grep '^#define[ ]*PATCHLEVEL' | awk '{print $NF}'`
|
||||
fi
|
||||
fi
|
||||
if [ -z "$patch_level" ]; then
|
||||
patch_level=0
|
||||
fi
|
||||
|
||||
# If we have an output file specified, make it the standard output
|
||||
if [ -n "$OUTFILE" ]; then
|
||||
if exec >$OUTFILE; then
|
||||
:
|
||||
else
|
||||
echo "${PROGNAME}: cannot redirect standard output to $OUTFILE" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Output the leading comment.
|
||||
echo "/* Version control for the shell. This file gets changed when you say"
|
||||
echo " \`make version.h' to the Makefile. It is created by mkversion. */"
|
||||
|
||||
# Output the distribution version. Single numbers are converted to x.00.
|
||||
# Allow, as a special case, `[:digit:].[:digit:][:alpha:]' for
|
||||
# intermediate versions (e.g., `2.5a').
|
||||
# Any characters other than digits and `.' are invalid.
|
||||
case "$dist_version" in
|
||||
[0-9].[0-9][a-z]) ;; # special case
|
||||
*[!0-9.]*) echo "mkversion.sh: ${dist_version}: bad distribution version" >&2
|
||||
exit 1 ;;
|
||||
*.*) ;;
|
||||
*) dist_version=${dist_version}.00 ;;
|
||||
esac
|
||||
|
||||
dist_major=`echo $dist_version | sed 's:\..*$::'`
|
||||
[ -z "${dist_major}" ] && dist_major=0
|
||||
|
||||
dist_minor=`echo $dist_version | sed 's:^.*\.::'`
|
||||
case "$dist_minor" in
|
||||
"") dist_minor=0 ;;
|
||||
[a-z]) dist_minor=0${dist_minor} ;;
|
||||
?) dist_minor=${dist_minor} ;;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
#float_dist=`echo $dist_version | awk '{printf "%.2f\n", $1}'`
|
||||
float_dist=${dist_major}.${dist_minor}
|
||||
|
||||
echo
|
||||
echo "/* The distribution version number of this shell. */"
|
||||
echo "#define DISTVERSION \"${float_dist}\""
|
||||
|
||||
# Output the patch level
|
||||
#echo
|
||||
#echo "/* The patch level of this version of the shell. */"
|
||||
#echo "#define PATCHLEVEL ${patch_level}"
|
||||
|
||||
# Output the build version
|
||||
echo
|
||||
echo "/* The last built version of this shell. */"
|
||||
echo "#define BUILDVERSION ${build_ver}"
|
||||
|
||||
# Output the release status
|
||||
echo
|
||||
echo "/* The release status of this shell. */"
|
||||
echo "#define RELSTATUS \"${rel_status}\""
|
||||
|
||||
echo "#define DEFAULT_COMPAT_LEVEL ${dist_major}${dist_minor}"
|
||||
|
||||
# Output the SCCS version string
|
||||
sccs_string="${float_dist}.${patch_level}(${build_ver}) ${rel_status} GNU"
|
||||
echo
|
||||
echo "/* A version string for use by sccs and the what command. */"
|
||||
echo "#define SCCSVERSION \"@(#)Bash version ${sccs_string}\""
|
||||
|
||||
# extern function declarations
|
||||
#echo
|
||||
#echo '/* Functions from version.c. */'
|
||||
#echo 'extern char *shell_version_string __P((void));'
|
||||
#echo 'extern void show_shell_version __P((int));'
|
||||
|
||||
if [ -n "$inc_build" ]; then
|
||||
# Make sure we can write to .build
|
||||
if [ -f .build ] && [ ! -w .build ]; then
|
||||
echo "$PROGNAME: cannot write to .build, not incrementing build version" >&2
|
||||
else
|
||||
echo "$build_ver" > .build
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
||||
+3
-2
@@ -1,7 +1,7 @@
|
||||
./shopt.tests: line 2: shopt: -z: invalid option
|
||||
shopt: usage: shopt [-pqsu] [-o] [optname ...]
|
||||
--
|
||||
shopt -s autocd
|
||||
shopt -u autocd
|
||||
shopt -u cdable_vars
|
||||
shopt -s cdspell
|
||||
shopt -u checkhash
|
||||
@@ -41,7 +41,6 @@ shopt -u huponexit
|
||||
shopt -u checkwinsize
|
||||
shopt -s sourcepath
|
||||
--
|
||||
shopt -s autocd
|
||||
shopt -s cdspell
|
||||
shopt -s cmdhist
|
||||
shopt -s expand_aliases
|
||||
@@ -53,6 +52,7 @@ shopt -s progcomp
|
||||
shopt -s promptvars
|
||||
shopt -s sourcepath
|
||||
--
|
||||
shopt -u autocd
|
||||
shopt -u cdable_vars
|
||||
shopt -u checkhash
|
||||
shopt -u checkjobs
|
||||
@@ -78,6 +78,7 @@ shopt -u restricted_shell
|
||||
shopt -u shift_verbose
|
||||
shopt -u xpg_echo
|
||||
--
|
||||
autocd off
|
||||
cdable_vars off
|
||||
checkhash off
|
||||
checkjobs off
|
||||
|
||||
@@ -43,6 +43,9 @@ const char * const release_status = (char *)0;
|
||||
#endif
|
||||
const char * const sccs_version = SCCSVERSION;
|
||||
|
||||
/* If == 31, shell compatible with bash-3.1, = =32 with bash-3.2, and so on */
|
||||
int shell_compatibility_level = DEFAULT_COMPAT_LEVEL;
|
||||
|
||||
/* Functions for getting, setting, and displaying the shell version. */
|
||||
|
||||
/* Forward declarations so we don't have to include externs.h */
|
||||
@@ -79,5 +82,5 @@ show_shell_version (extended)
|
||||
{
|
||||
printf (_("GNU bash, version %s (%s)\n"), shell_version_string (), MACHTYPE);
|
||||
if (extended)
|
||||
printf (_("Copyright (C) 2007 Free Software Foundation, Inc.\n"));
|
||||
printf (_("Copyright (C) 2008 Free Software Foundation, Inc.\n"));
|
||||
}
|
||||
|
||||
+1
-1
@@ -79,5 +79,5 @@ show_shell_version (extended)
|
||||
{
|
||||
printf (_("GNU bash, version %s (%s)\n"), shell_version_string (), MACHTYPE);
|
||||
if (extended)
|
||||
printf (_("Copyright (C) 2007 Free Software Foundation, Inc.\n"));
|
||||
printf (_("Copyright (C) 2008 Free Software Foundation, Inc.\n"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user