mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-09 13:10:50 +02:00
commit bash-20140131 snapshot
This commit is contained in:
@@ -65,6 +65,8 @@ d. Fixed a bug that caused effects made by undoing changes to a history line to
|
||||
|
||||
4. New Features in Readline
|
||||
|
||||
a. When creating shared libraries on Mac OS X, the pathname written into the
|
||||
library (install_name) no longer includes the minor version number.
|
||||
------------------------------------------------------------------------------
|
||||
This document details the changes between this version, bash-4.3-rc1, and the
|
||||
previous version, bash-4.3-beta2.
|
||||
|
||||
@@ -65,6 +65,9 @@ d. Fixed a bug that caused effects made by undoing changes to a history line to
|
||||
|
||||
4. New Features in Readline
|
||||
|
||||
a. When creating shared libraries on Mac OS X, the pathname written into the
|
||||
library (install_name) no longer includes the minor version number.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
This document details the changes between this version, bash-4.3-rc1, and the
|
||||
previous version, bash-4.3-beta2.
|
||||
|
||||
@@ -5707,3 +5707,75 @@ support/shobj-conf
|
||||
- darwin: combine the stanzas into one that will not require them to
|
||||
be updated on each Mac OS X release. Report and fix from Max Horn
|
||||
<max@quendi.de>
|
||||
|
||||
1/27
|
||||
----
|
||||
support/shobj-conf
|
||||
- darwin: changed the install_name embedded into the shared library
|
||||
to contain only the major version number, not the minor one. The
|
||||
idea is that the minor versions should all be API/ABI compatible,
|
||||
and it is better to link automatically with the latest one. Idea
|
||||
from Max Horn <max@quendi.de>
|
||||
|
||||
1/29
|
||||
----
|
||||
[bash-4.3-rc2 released]
|
||||
|
||||
1/30
|
||||
----
|
||||
lib/readline/readline.h
|
||||
- rl_clear_history, rl_free_keymap: add extern declarations. Report
|
||||
from Hiroo Hayashi <hiroo.hayashi@computer.org>
|
||||
|
||||
general.c
|
||||
- include trap.h for any_signals_trapped() prototype
|
||||
|
||||
lib/sh/unicode.c
|
||||
- include <stdio.h> for sprintf prototype
|
||||
|
||||
1/31
|
||||
----
|
||||
execute_cmd.c
|
||||
- execute_simple_command: only posix-mode shells should exit on an
|
||||
assignment failure in the temporary environment preceding a special
|
||||
builtin. This is what the documentation and code comments have
|
||||
always said
|
||||
- execute_simple_command: make sure redirection errors, word expansion
|
||||
errors, and assignment errors to Posix special builtins cause a
|
||||
non-interactive posix mode shell to exit. Previously the shell
|
||||
would not exit if the failed special builtin was on the LHS of ||
|
||||
or &&
|
||||
|
||||
pathexp.c
|
||||
- quote_string_for_globbing: when quoting a regular expression
|
||||
(QGLOB_REGEXP), allow an unquoted backslash to pass through
|
||||
unaltered. Don't use it as a quote character or quote it. More
|
||||
investigation from 1/24 and report by Mike Frysinger
|
||||
<vapier@gentoo.org>
|
||||
- quote_string_for_globbing: when quoting a regular expression
|
||||
(QGLOB_REGEXP), turn CTLESC CTLESC into CTLESC without adding a
|
||||
backslash to quote it. We should not have to quote it because it is
|
||||
not a character special to EREs. More investigation from 1/24
|
||||
|
||||
lib/glob/glob.c
|
||||
- glob_testdir: now takes a second flags argument (currently unused);
|
||||
changed prototype and callers
|
||||
|
||||
2/1
|
||||
---
|
||||
lib/glob/glob.c
|
||||
- glob_testdir: if flags argument includes GX_ALLDIRS (globstar), use
|
||||
lstat so we skip symlinks when traversing the directory tree.
|
||||
Originally reported by Chris Down <chris@chrisdown.name>
|
||||
|
||||
2/2
|
||||
---
|
||||
lib/readline/undo.c
|
||||
- rl_do_undo: make sure CUR is non-zero before dereferencing it to
|
||||
check cur->data against rl_undo_list. Report and fix from
|
||||
Andreas Schwab <schwab@linux-m68k.org>
|
||||
|
||||
doc/{bash.1,bashref.texi}
|
||||
- added slight clarifying language to the description of $*,
|
||||
describing what happens when the expansion is not within double
|
||||
quotes
|
||||
|
||||
@@ -5702,3 +5702,75 @@ builtins/gen-helpfiles.c
|
||||
Makefile.in
|
||||
- variables.o: add dependency on builtins/builtext.h; helps with
|
||||
parallel builds. Report from Linda Walsh <bash@tlinx.org>
|
||||
|
||||
support/shobj-conf
|
||||
- darwin: combine the stanzas into one that will not require them to
|
||||
be updated on each Mac OS X release. Report and fix from Max Horn
|
||||
<max@quendi.de>
|
||||
|
||||
1/27
|
||||
----
|
||||
support/shobj-conf
|
||||
- darwin: changed the install_name embedded into the shared library
|
||||
to contain only the major version number, not the minor one. The
|
||||
idea is that the minor versions should all be API/ABI compatible,
|
||||
and it is better to link automatically with the latest one. Idea
|
||||
from Max Horn <max@quendi.de>
|
||||
|
||||
1/29
|
||||
----
|
||||
[bash-4.3-rc2 released]
|
||||
|
||||
1/30
|
||||
----
|
||||
lib/readline/readline.h
|
||||
- rl_clear_history, rl_free_keymap: add extern declarations. Report
|
||||
from Hiroo Hayashi <hiroo.hayashi@computer.org>
|
||||
|
||||
general.c
|
||||
- include trap.h for any_signals_trapped() prototype
|
||||
|
||||
lib/sh/unicode.c
|
||||
- include <stdio.h> for sprintf prototype
|
||||
|
||||
1/31
|
||||
----
|
||||
execute_cmd.c
|
||||
- execute_simple_command: only posix-mode shells should exit on an
|
||||
assignment failure in the temporary environment preceding a special
|
||||
builtin. This is what the documentation and code comments have
|
||||
always said
|
||||
- execute_simple_command: make sure redirection errors, word expansion
|
||||
errors, and assignment errors to Posix special builtins cause a
|
||||
non-interactive posix mode shell to exit. Previously the shell
|
||||
would not exit if the failed special builtin was on the LHS of ||
|
||||
or &&
|
||||
|
||||
pathexp.c
|
||||
- quote_string_for_globbing: when quoting a regular expression
|
||||
(QGLOB_REGEXP), allow an unquoted backslash to pass through
|
||||
unaltered. Don't use it as a quote character or quote it. More
|
||||
investigation from 1/24 and report by Mike Frysinger
|
||||
<vapier@gentoo.org>
|
||||
- quote_string_for_globbing: when quoting a regular expression
|
||||
(QGLOB_REGEXP), turn CTLESC CTLESC into CTLESC without adding a
|
||||
backslash to quote it. We should not have to quote it because it is
|
||||
not a character special to EREs. More investigation from 1/24
|
||||
|
||||
lib/glob/glob.c
|
||||
- glob_testdir: now takes a second flags argument (currently unused);
|
||||
changed prototype and callers
|
||||
|
||||
2/1
|
||||
---
|
||||
lib/glob/glob.c
|
||||
- glob_testdir: if flags argument includes GX_ALLDIRS (globstar), use
|
||||
lstat so we skip symlinks when traversing the directory tree.
|
||||
Originally reported by Chris Down <chris@chrisdown.name>
|
||||
|
||||
2/2
|
||||
---
|
||||
lib/readline/undo.c
|
||||
- rl_do_undo: make sure CUR is non-zero before dereferencing it to
|
||||
check cur->data against rl_undo_list. Report and fix from
|
||||
Andreas Schwab <schwab@linux-m68k.org>
|
||||
|
||||
@@ -891,6 +891,7 @@ tests/errors.tests f
|
||||
tests/errors.right f
|
||||
tests/errors1.sub f
|
||||
tests/errors2.sub f
|
||||
tests/errors3.sub f
|
||||
tests/execscript f
|
||||
tests/exec.right f
|
||||
tests/exec1.sub f 755
|
||||
|
||||
+9
-5
@@ -5,12 +5,12 @@
|
||||
.\" Case Western Reserve University
|
||||
.\" chet.ramey@case.edu
|
||||
.\"
|
||||
.\" Last Change: Mon Jan 6 16:40:31 EST 2014
|
||||
.\" Last Change: Sun Feb 2 16:21:40 EST 2014
|
||||
.\"
|
||||
.\" bash_builtins, strip all but Built-Ins section
|
||||
.if \n(zZ=1 .ig zZ
|
||||
.if \n(zY=1 .ig zY
|
||||
.TH BASH 1 "2014 January 6" "GNU Bash 4.3"
|
||||
.TH BASH 1 "2014 February 2" "GNU Bash 4.3"
|
||||
.\"
|
||||
.\" There's some problem with having a `@'
|
||||
.\" in a tagged paragraph with the BSD man macros.
|
||||
@@ -881,7 +881,7 @@ The exit status is zero if no
|
||||
pattern matches. Otherwise, it is the exit status of the
|
||||
last command executed in \fIlist\fP.
|
||||
.TP
|
||||
\fBif\fP \fIlist\fP; \fBthen\fP \fIlist;\fP \
|
||||
\fBif\fP \fIlist\fP; \fBthen\fP \fIlist\fP; \
|
||||
[ \fBelif\fP \fIlist\fP; \fBthen\fP \fIlist\fP; ] ... \
|
||||
[ \fBelse\fP \fIlist\fP; ] \fBfi\fP
|
||||
The
|
||||
@@ -1305,8 +1305,12 @@ only be referenced; assignment to them is not allowed.
|
||||
.PD 0
|
||||
.TP
|
||||
.B *
|
||||
Expands to the positional parameters, starting from one. When the
|
||||
expansion occurs within double quotes, it expands to a single word
|
||||
Expands to the positional parameters, starting from one.
|
||||
When the expansion is not within double quotes, each positional parameter
|
||||
expands to a separate word.
|
||||
In contexts where it is performed, those words
|
||||
are subject to further word splitting and pathname expansion.
|
||||
When the expansion occurs within double quotes, it expands to a single word
|
||||
with the value of each parameter separated by the first character
|
||||
of the
|
||||
.SM
|
||||
|
||||
+10326
File diff suppressed because it is too large
Load Diff
+6
-3
@@ -1566,8 +1566,12 @@ only be referenced; assignment to them is not allowed.
|
||||
|
||||
@item *
|
||||
@vindex $*
|
||||
($*) Expands to the positional parameters, starting from one. When the
|
||||
expansion occurs within double quotes, it expands to a single word
|
||||
($*) Expands to the positional parameters, starting from one.
|
||||
When the expansion is not within double quotes, each positional parameter
|
||||
expands to a separate word.
|
||||
In contexts where it is performed, those words
|
||||
are subject to further word splitting and pathname expansion.
|
||||
When the expansion occurs within double quotes, it expands to a single word
|
||||
with the value of each parameter separated by the first character
|
||||
of the @env{IFS}
|
||||
special variable. That is, @code{"$*"} is equivalent
|
||||
@@ -1578,7 +1582,6 @@ If @env{IFS} is unset, the parameters are separated by spaces.
|
||||
If @env{IFS} is null, the parameters are joined without intervening
|
||||
separators.
|
||||
|
||||
|
||||
@item @@
|
||||
@vindex $@@
|
||||
($@@) Expands to the positional parameters, starting from one. When the
|
||||
|
||||
+8737
File diff suppressed because it is too large
Load Diff
+3
-3
@@ -2,9 +2,9 @@
|
||||
Copyright (C) 1988-2014 Free Software Foundation, Inc.
|
||||
@end ignore
|
||||
|
||||
@set LASTCHANGE Mon Jan 6 16:46:33 EST 2014
|
||||
@set LASTCHANGE Sun Feb 2 16:22:00 EST 2014
|
||||
|
||||
@set EDITION 4.3
|
||||
@set VERSION 4.3
|
||||
@set UPDATED 6 January 2014
|
||||
@set UPDATED-MONTH January 2014
|
||||
@set UPDATED 2 February 2014
|
||||
@set UPDATED-MONTH February 2014
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
@ignore
|
||||
Copyright (C) 1988-2014 Free Software Foundation, Inc.
|
||||
@end ignore
|
||||
|
||||
@set LASTCHANGE Mon Jan 6 16:46:33 EST 2014
|
||||
|
||||
@set EDITION 4.3
|
||||
@set VERSION 4.3
|
||||
@set UPDATED 6 January 2014
|
||||
@set UPDATED-MONTH January 2014
|
||||
+13
-1
@@ -4044,7 +4044,7 @@ execute_simple_command (simple_command, pipe_in, pipe_out, async, fds_to_close)
|
||||
|
||||
/* In POSIX mode, assignment errors in the temporary environment cause a
|
||||
non-interactive shell to exit. */
|
||||
if (builtin_is_special && interactive_shell == 0 && tempenv_assign_error)
|
||||
if (posixly_correct && builtin_is_special && interactive_shell == 0 && tempenv_assign_error)
|
||||
{
|
||||
last_command_exit_value = EXECUTION_FAILURE;
|
||||
jump_to_top_level (ERREXIT);
|
||||
@@ -4165,6 +4165,18 @@ run_builtin:
|
||||
{
|
||||
if (result > EX_SHERRBASE)
|
||||
{
|
||||
switch (result)
|
||||
{
|
||||
case EX_REDIRFAIL:
|
||||
case EX_BADASSIGN:
|
||||
case EX_EXPFAIL:
|
||||
/* These errors cause non-interactive posix mode shells to exit */
|
||||
if (posixly_correct && builtin_is_special && interactive_shell == 0)
|
||||
{
|
||||
last_command_exit_value = EXECUTION_FAILURE;
|
||||
jump_to_top_level (ERREXIT);
|
||||
}
|
||||
}
|
||||
result = builtin_status (result);
|
||||
if (builtin_is_special)
|
||||
special_builtin_failed = 1;
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
|
||||
#include "shell.h"
|
||||
#include "test.h"
|
||||
#include "trap.h"
|
||||
|
||||
#include <tilde/tilde.h>
|
||||
|
||||
|
||||
+15
-8
@@ -116,7 +116,7 @@ static void wdequote_pathname __P((char *));
|
||||
# define dequote_pathname udequote_pathname
|
||||
#endif
|
||||
static void dequote_pathname __P((char *));
|
||||
static int glob_testdir __P((char *));
|
||||
static int glob_testdir __P((char *, int));
|
||||
static char **glob_dir_to_array __P((char *, char **, int));
|
||||
|
||||
/* Make sure these names continue to agree with what's in smatch.c */
|
||||
@@ -443,13 +443,20 @@ dequote_pathname (pathname)
|
||||
|
||||
/* Return 0 if DIR is a directory, -1 otherwise. */
|
||||
static int
|
||||
glob_testdir (dir)
|
||||
glob_testdir (dir, flags)
|
||||
char *dir;
|
||||
int flags;
|
||||
{
|
||||
struct stat finfo;
|
||||
int r;
|
||||
|
||||
/*itrace("glob_testdir: testing %s", dir);*/
|
||||
if (stat (dir, &finfo) < 0)
|
||||
/*itrace("glob_testdir: testing %s" flags = %d, dir, flags);*/
|
||||
#if defined (HAVE_LSTAT)
|
||||
r = (flags & GX_ALLDIRS) ? lstat (dir, &finfo) : stat (dir, &finfo);
|
||||
#else
|
||||
r = stat (dir, &finfo);
|
||||
#endif
|
||||
if (r < 0)
|
||||
return (-1);
|
||||
|
||||
if (S_ISDIR (finfo.st_mode) == 0)
|
||||
@@ -573,7 +580,7 @@ glob_vector (pat, dir, flags)
|
||||
/* If PAT is empty, skip the loop, but return one (empty) filename. */
|
||||
if (pat == 0 || *pat == '\0')
|
||||
{
|
||||
if (glob_testdir (dir) < 0)
|
||||
if (glob_testdir (dir, 0) < 0)
|
||||
return ((char **) &glob_error_return);
|
||||
|
||||
nextlink = (struct globval *)alloca (sizeof (struct globval));
|
||||
@@ -606,7 +613,7 @@ glob_vector (pat, dir, flags)
|
||||
int dirlen;
|
||||
struct stat finfo;
|
||||
|
||||
if (glob_testdir (dir) < 0)
|
||||
if (glob_testdir (dir, 0) < 0)
|
||||
return ((char **) &glob_error_return);
|
||||
|
||||
dirlen = strlen (dir);
|
||||
@@ -660,7 +667,7 @@ glob_vector (pat, dir, flags)
|
||||
is not robust (i.e., it opens non-directories successfully), test
|
||||
that DIR is a directory and punt if it's not. */
|
||||
#if defined (OPENDIR_NOT_ROBUST)
|
||||
if (glob_testdir (dir) < 0)
|
||||
if (glob_testdir (dir, 0) < 0)
|
||||
return ((char **) &glob_error_return);
|
||||
#endif
|
||||
|
||||
@@ -728,7 +735,7 @@ glob_vector (pat, dir, flags)
|
||||
if (flags & GX_NULLDIR)
|
||||
pflags |= MP_IGNDOT;
|
||||
subdir = sh_makepath (dir, dp->d_name, pflags);
|
||||
isdir = glob_testdir (subdir);
|
||||
isdir = glob_testdir (subdir, flags);
|
||||
if (isdir < 0 && (flags & GX_MATCHDIRS))
|
||||
{
|
||||
free (subdir);
|
||||
|
||||
+1365
File diff suppressed because it is too large
Load Diff
@@ -342,6 +342,7 @@ extern Keymap rl_make_bare_keymap PARAMS((void));
|
||||
extern Keymap rl_copy_keymap PARAMS((Keymap));
|
||||
extern Keymap rl_make_keymap PARAMS((void));
|
||||
extern void rl_discard_keymap PARAMS((Keymap));
|
||||
extern void rl_free_keymap PARAMS((Keymap));
|
||||
|
||||
extern Keymap rl_get_keymap_by_name PARAMS((const char *));
|
||||
extern char *rl_get_keymap_name PARAMS((Keymap));
|
||||
@@ -439,6 +440,10 @@ extern void rl_echo_signal_char PARAMS((int));
|
||||
|
||||
extern int rl_set_paren_blink_timeout PARAMS((int));
|
||||
|
||||
/* History management functions. */
|
||||
|
||||
extern void rl_clear_history PARAMS((void));
|
||||
|
||||
/* Undocumented. */
|
||||
extern int rl_maybe_save_line PARAMS((void));
|
||||
extern int rl_maybe_unsave_line PARAMS((void));
|
||||
|
||||
+1
-1
@@ -237,7 +237,7 @@ rl_do_undo ()
|
||||
/* If we are editing a history entry, make sure the change is replicated
|
||||
in the history entry's line */
|
||||
cur = current_history ();
|
||||
if ((UNDO_LIST *)cur->data == release)
|
||||
if (cur && cur->data && (UNDO_LIST *)cur->data == release)
|
||||
{
|
||||
temp = replace_history_entry (where_history (), rl_line_buffer, (histdata_t)rl_undo_list);
|
||||
xfree (temp->line);
|
||||
|
||||
@@ -0,0 +1,354 @@
|
||||
/* readline.c -- a general facility for reading lines of input
|
||||
with emacs style editing and completion. */
|
||||
|
||||
/* Copyright (C) 1987-2012 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library (Readline), a library
|
||||
for reading lines of text with interactive input and history editing.
|
||||
|
||||
Readline 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.
|
||||
|
||||
Readline 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 Readline. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#define READLINE_LIBRARY
|
||||
|
||||
#if defined (HAVE_CONFIG_H)
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# include <unistd.h> /* for _POSIX_VERSION */
|
||||
#endif /* HAVE_UNISTD_H */
|
||||
|
||||
#if defined (HAVE_STDLIB_H)
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
# include "ansi_stdlib.h"
|
||||
#endif /* HAVE_STDLIB_H */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* System-specific feature definitions and include files. */
|
||||
#include "rldefs.h"
|
||||
|
||||
/* Some standard library routines. */
|
||||
#include "readline.h"
|
||||
#include "history.h"
|
||||
|
||||
#include "rlprivate.h"
|
||||
#include "xmalloc.h"
|
||||
|
||||
extern void replace_history_data PARAMS((int, histdata_t *, histdata_t *));
|
||||
|
||||
/* Non-zero tells rl_delete_text and rl_insert_text to not add to
|
||||
the undo list. */
|
||||
int _rl_doing_an_undo = 0;
|
||||
|
||||
/* How many unclosed undo groups we currently have. */
|
||||
int _rl_undo_group_level = 0;
|
||||
|
||||
/* The current undo list for THE_LINE. */
|
||||
UNDO_LIST *rl_undo_list = (UNDO_LIST *)NULL;
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Undo, and Undoing */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
static UNDO_LIST *
|
||||
alloc_undo_entry (what, start, end, text)
|
||||
enum undo_code what;
|
||||
int start, end;
|
||||
char *text;
|
||||
{
|
||||
UNDO_LIST *temp;
|
||||
|
||||
temp = (UNDO_LIST *)xmalloc (sizeof (UNDO_LIST));
|
||||
temp->what = what;
|
||||
temp->start = start;
|
||||
temp->end = end;
|
||||
temp->text = text;
|
||||
|
||||
temp->next = (UNDO_LIST *)NULL;
|
||||
return temp;
|
||||
}
|
||||
|
||||
/* Remember how to undo something. Concatenate some undos if that
|
||||
seems right. */
|
||||
void
|
||||
rl_add_undo (what, start, end, text)
|
||||
enum undo_code what;
|
||||
int start, end;
|
||||
char *text;
|
||||
{
|
||||
UNDO_LIST *temp;
|
||||
|
||||
temp = alloc_undo_entry (what, start, end, text);
|
||||
temp->next = rl_undo_list;
|
||||
rl_undo_list = temp;
|
||||
}
|
||||
|
||||
/* Free an UNDO_LIST */
|
||||
void
|
||||
_rl_free_undo_list (ul)
|
||||
UNDO_LIST *ul;
|
||||
{
|
||||
UNDO_LIST *release;
|
||||
|
||||
while (ul)
|
||||
{
|
||||
release = ul;
|
||||
ul = ul->next;
|
||||
|
||||
if (release->what == UNDO_DELETE)
|
||||
xfree (release->text);
|
||||
|
||||
xfree (release);
|
||||
}
|
||||
}
|
||||
|
||||
/* Free the existing undo list. */
|
||||
void
|
||||
rl_free_undo_list ()
|
||||
{
|
||||
UNDO_LIST *release, *orig_list;
|
||||
|
||||
orig_list = rl_undo_list;
|
||||
_rl_free_undo_list (rl_undo_list);
|
||||
rl_undo_list = (UNDO_LIST *)NULL;
|
||||
replace_history_data (-1, (histdata_t *)orig_list, (histdata_t *)NULL);
|
||||
}
|
||||
|
||||
UNDO_LIST *
|
||||
_rl_copy_undo_entry (entry)
|
||||
UNDO_LIST *entry;
|
||||
{
|
||||
UNDO_LIST *new;
|
||||
|
||||
new = alloc_undo_entry (entry->what, entry->start, entry->end, (char *)NULL);
|
||||
new->text = entry->text ? savestring (entry->text) : 0;
|
||||
return new;
|
||||
}
|
||||
|
||||
UNDO_LIST *
|
||||
_rl_copy_undo_list (head)
|
||||
UNDO_LIST *head;
|
||||
{
|
||||
UNDO_LIST *list, *new, *roving, *c;
|
||||
|
||||
if (head == 0)
|
||||
return head;
|
||||
|
||||
list = head;
|
||||
new = 0;
|
||||
while (list)
|
||||
{
|
||||
c = _rl_copy_undo_entry (list);
|
||||
if (new == 0)
|
||||
roving = new = c;
|
||||
else
|
||||
{
|
||||
roving->next = c;
|
||||
roving = roving->next;
|
||||
}
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
roving->next = 0;
|
||||
return new;
|
||||
}
|
||||
|
||||
/* Undo the next thing in the list. Return 0 if there
|
||||
is nothing to undo, or non-zero if there was. */
|
||||
int
|
||||
rl_do_undo ()
|
||||
{
|
||||
UNDO_LIST *release;
|
||||
int waiting_for_begin, start, end;
|
||||
HIST_ENTRY *cur, *temp;
|
||||
|
||||
#define TRANS(i) ((i) == -1 ? rl_point : ((i) == -2 ? rl_end : (i)))
|
||||
|
||||
start = end = waiting_for_begin = 0;
|
||||
do
|
||||
{
|
||||
if (rl_undo_list == 0)
|
||||
return (0);
|
||||
|
||||
_rl_doing_an_undo = 1;
|
||||
RL_SETSTATE(RL_STATE_UNDOING);
|
||||
|
||||
/* To better support vi-mode, a start or end value of -1 means
|
||||
rl_point, and a value of -2 means rl_end. */
|
||||
if (rl_undo_list->what == UNDO_DELETE || rl_undo_list->what == UNDO_INSERT)
|
||||
{
|
||||
start = TRANS (rl_undo_list->start);
|
||||
end = TRANS (rl_undo_list->end);
|
||||
}
|
||||
|
||||
switch (rl_undo_list->what)
|
||||
{
|
||||
/* Undoing deletes means inserting some text. */
|
||||
case UNDO_DELETE:
|
||||
rl_point = start;
|
||||
rl_insert_text (rl_undo_list->text);
|
||||
xfree (rl_undo_list->text);
|
||||
break;
|
||||
|
||||
/* Undoing inserts means deleting some text. */
|
||||
case UNDO_INSERT:
|
||||
rl_delete_text (start, end);
|
||||
rl_point = start;
|
||||
break;
|
||||
|
||||
/* Undoing an END means undoing everything 'til we get to a BEGIN. */
|
||||
case UNDO_END:
|
||||
waiting_for_begin++;
|
||||
break;
|
||||
|
||||
/* Undoing a BEGIN means that we are done with this group. */
|
||||
case UNDO_BEGIN:
|
||||
if (waiting_for_begin)
|
||||
waiting_for_begin--;
|
||||
else
|
||||
rl_ding ();
|
||||
break;
|
||||
}
|
||||
|
||||
_rl_doing_an_undo = 0;
|
||||
RL_UNSETSTATE(RL_STATE_UNDOING);
|
||||
|
||||
release = rl_undo_list;
|
||||
rl_undo_list = rl_undo_list->next;
|
||||
|
||||
/* If we are editing a history entry, make sure the change is replicated
|
||||
in the history entry's line */
|
||||
cur = current_history ();
|
||||
if ((UNDO_LIST *)cur->data == release)
|
||||
{
|
||||
temp = replace_history_entry (where_history (), rl_line_buffer, (histdata_t)rl_undo_list);
|
||||
xfree (temp->line);
|
||||
FREE (temp->timestamp);
|
||||
xfree (temp);
|
||||
}
|
||||
|
||||
replace_history_data (-1, (histdata_t *)release, (histdata_t *)rl_undo_list);
|
||||
|
||||
xfree (release);
|
||||
}
|
||||
while (waiting_for_begin);
|
||||
|
||||
return (1);
|
||||
}
|
||||
#undef TRANS
|
||||
|
||||
int
|
||||
_rl_fix_last_undo_of_type (type, start, end)
|
||||
int type, start, end;
|
||||
{
|
||||
UNDO_LIST *rl;
|
||||
|
||||
for (rl = rl_undo_list; rl; rl = rl->next)
|
||||
{
|
||||
if (rl->what == type)
|
||||
{
|
||||
rl->start = start;
|
||||
rl->end = end;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Begin a group. Subsequent undos are undone as an atomic operation. */
|
||||
int
|
||||
rl_begin_undo_group ()
|
||||
{
|
||||
rl_add_undo (UNDO_BEGIN, 0, 0, 0);
|
||||
_rl_undo_group_level++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* End an undo group started with rl_begin_undo_group (). */
|
||||
int
|
||||
rl_end_undo_group ()
|
||||
{
|
||||
rl_add_undo (UNDO_END, 0, 0, 0);
|
||||
_rl_undo_group_level--;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Save an undo entry for the text from START to END. */
|
||||
int
|
||||
rl_modifying (start, end)
|
||||
int start, end;
|
||||
{
|
||||
if (start > end)
|
||||
{
|
||||
SWAP (start, end);
|
||||
}
|
||||
|
||||
if (start != end)
|
||||
{
|
||||
char *temp = rl_copy_text (start, end);
|
||||
rl_begin_undo_group ();
|
||||
rl_add_undo (UNDO_DELETE, start, end, temp);
|
||||
rl_add_undo (UNDO_INSERT, start, end, (char *)NULL);
|
||||
rl_end_undo_group ();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Revert the current line to its previous state. */
|
||||
int
|
||||
rl_revert_line (count, key)
|
||||
int count, key;
|
||||
{
|
||||
if (rl_undo_list == 0)
|
||||
rl_ding ();
|
||||
else
|
||||
{
|
||||
while (rl_undo_list)
|
||||
rl_do_undo ();
|
||||
#if defined (VI_MODE)
|
||||
if (rl_editing_mode == vi_mode)
|
||||
rl_point = rl_mark = 0; /* rl_end should be set correctly */
|
||||
#endif
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Do some undoing of things that were done. */
|
||||
int
|
||||
rl_undo_command (count, key)
|
||||
int count, key;
|
||||
{
|
||||
if (count < 0)
|
||||
return 0; /* Nothing to do. */
|
||||
|
||||
while (count)
|
||||
{
|
||||
if (rl_do_undo ())
|
||||
count--;
|
||||
else
|
||||
{
|
||||
rl_ding ();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -28,6 +28,7 @@
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
|
||||
#if HAVE_ICONV
|
||||
|
||||
@@ -183,7 +183,7 @@ quote_string_for_globbing (pathname, qflags)
|
||||
{
|
||||
char *temp;
|
||||
register int i, j;
|
||||
int brack, cclass, collsym, equiv, c;
|
||||
int brack, cclass, collsym, equiv, c, last_was_backslash;
|
||||
|
||||
temp = (char *)xmalloc (2 * strlen (pathname) + 1);
|
||||
|
||||
@@ -193,7 +193,7 @@ quote_string_for_globbing (pathname, qflags)
|
||||
return temp;
|
||||
}
|
||||
|
||||
brack = cclass = collsym = equiv = 0;
|
||||
brack = cclass = collsym = equiv = last_was_backslash = 0;
|
||||
for (i = j = 0; pathname[i]; i++)
|
||||
{
|
||||
/* Fix for CTLESC at the end of the string? */
|
||||
@@ -202,10 +202,19 @@ quote_string_for_globbing (pathname, qflags)
|
||||
temp[j++] = pathname[i++];
|
||||
break;
|
||||
}
|
||||
/* If we are parsing regexp, turn CTLESC CTLESC into CTLESC. It's not an
|
||||
ERE special character, so we should just be able to pass it through. */
|
||||
else if ((qflags & QGLOB_REGEXP) && pathname[i] == CTLESC && pathname[i+1] == CTLESC)
|
||||
{
|
||||
i++;
|
||||
temp[j++] = pathname[i];
|
||||
continue;
|
||||
}
|
||||
else if (pathname[i] == CTLESC)
|
||||
{
|
||||
if ((qflags & QGLOB_FILENAME) && pathname[i+1] == '/')
|
||||
continue;
|
||||
/* What to do if preceding char is backslash? */
|
||||
if (pathname[i+1] != CTLESC && (qflags & QGLOB_REGEXP) && ere_char (pathname[i+1]) == 0)
|
||||
continue;
|
||||
temp[j++] = '\\';
|
||||
@@ -278,21 +287,22 @@ quote_string_for_globbing (pathname, qflags)
|
||||
i--; /* increment will happen above in loop */
|
||||
continue; /* skip double assignment below */
|
||||
}
|
||||
else if (pathname[i] == '\\')
|
||||
else if (pathname[i] == '\\' && (qflags & QGLOB_REGEXP) == 0)
|
||||
{
|
||||
/* If we want to pass through backslash unaltered, comment out these
|
||||
lines. */
|
||||
temp[j++] = '\\';
|
||||
/* XXX - if not quoting regexp, use backslash as quote char. Should
|
||||
we just pass it through without treating it as special? That is
|
||||
what ksh93 seems to do. */
|
||||
if ((qflags & QGLOB_REGEXP) == 0)
|
||||
{
|
||||
i++;
|
||||
if (pathname[i] == '\0')
|
||||
break;
|
||||
}
|
||||
|
||||
/* If we want to pass through backslash unaltered, comment out these
|
||||
lines. */
|
||||
temp[j++] = '\\';
|
||||
|
||||
i++;
|
||||
if (pathname[i] == '\0')
|
||||
break;
|
||||
}
|
||||
else if (pathname[i] == '\\' && (qflags & QGLOB_REGEXP))
|
||||
last_was_backslash = 1;
|
||||
temp[j++] = pathname[i];
|
||||
}
|
||||
endpat:
|
||||
|
||||
+5
-2
@@ -180,18 +180,21 @@ darwin*)
|
||||
SHLIB_LIBVERSION='$(SHLIB_MAJOR)$(SHLIB_MINOR).$(SHLIB_LIBSUFF)'
|
||||
SHLIB_LIBSUFF='dylib'
|
||||
|
||||
# unused at this time
|
||||
SHLIB_SONAME='$(libdir)/`echo $@ | sed "s:\\..*::"`.$(SHLIB_MAJOR).$(SHLIB_LIBSUFF)'
|
||||
|
||||
case "${host_os}" in
|
||||
# Darwin versions 1, 5, 6, 7 correspond to Mac OS X 10.0, 10.1, 10.2,
|
||||
# and 10.3, respectively.
|
||||
darwin[1-7].*)
|
||||
SHOBJ_STATUS=unsupported
|
||||
SHOBJ_LDFLAGS='-dynamic'
|
||||
SHLIB_XLDFLAGS='-arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
|
||||
SHLIB_XLDFLAGS='-arch_only `/usr/bin/arch` -install_name $(libdir)/`echo $@ | sed "s:\\..*::"`.$(SHLIB_MAJOR).$(SHLIB_LIBSUFF) -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
|
||||
;;
|
||||
# Darwin 8 == Mac OS X 10.4; Mac OS X 10.N == Darwin N+4
|
||||
*)
|
||||
SHOBJ_LDFLAGS='-dynamiclib -dynamic -undefined dynamic_lookup -arch_only `/usr/bin/arch`'
|
||||
SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
|
||||
SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/`echo $@ | sed "s:\\..*::"`.$(SHLIB_MAJOR).$(SHLIB_LIBSUFF) -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
@@ -50,6 +50,13 @@ bs='\'
|
||||
[[ x =~ $'\\'x ]] ; echo $?
|
||||
[[ x =~ '\'x ]] ; echo $?
|
||||
|
||||
v='a\-b'
|
||||
[[ a-b =~ ${v} ]] ; echo $?
|
||||
[[ a-b =~ a\-b ]]; echo $?
|
||||
[[ a-b =~ a${bs}-b ]]; echo $?
|
||||
[[ a-b =~ a\\-b ]] ; echo $?
|
||||
[[ a-b =~ "a\-b" ]] ; echo $?
|
||||
|
||||
c=$'\001'
|
||||
|
||||
recho $c "$c"
|
||||
|
||||
+8
-3
@@ -89,15 +89,15 @@ argv[1] = <\^?>
|
||||
1
|
||||
1
|
||||
[[ $'\001' =~ $'\001' ]] -> 0
|
||||
[[ $'\001' =~ $'\\\001' ]] -> 1
|
||||
[[ $'\001' =~ $'\\\001' ]] -> 0
|
||||
[[ $'\001' =~ $'\\[\001]' ]] -> 1
|
||||
---
|
||||
[[ $'\a' =~ $'\a' ]] -> 0
|
||||
[[ $'\a' =~ $'\\\a' ]] -> 1
|
||||
[[ $'\a' =~ $'\\\a' ]] -> 0
|
||||
[[ $'\a' =~ $'\\[\a]' ]] -> 1
|
||||
---
|
||||
[[ $'\177' =~ $'\177' ]] -> 0
|
||||
[[ $'\177' =~ $'\\\177' ]] -> 1
|
||||
[[ $'\177' =~ $'\\\177' ]] -> 0
|
||||
[[ $'\177' =~ $'\\[\177]' ]] -> 1
|
||||
---
|
||||
0
|
||||
@@ -111,8 +111,13 @@ argv[1] = <\^?>
|
||||
1
|
||||
0
|
||||
1
|
||||
0
|
||||
1
|
||||
1
|
||||
0
|
||||
0
|
||||
0
|
||||
1
|
||||
1
|
||||
argv[1] = <^A>
|
||||
argv[2] = <^A>
|
||||
|
||||
+4
-1
@@ -107,4 +107,7 @@ kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill
|
||||
after f
|
||||
./errors2.sub: line 3: ${$NO_SUCH_VAR}: bad substitution
|
||||
1
|
||||
./errors.tests: line 270: `!!': not a valid identifier
|
||||
./errors3.sub: line 5: no_such_file: No such file or directory
|
||||
TEST
|
||||
./errors3.sub: line 7: no_such_file: No such file or directory
|
||||
./errors.tests: line 271: `!!': not a valid identifier
|
||||
|
||||
@@ -261,6 +261,7 @@ echo $?
|
||||
|
||||
${THIS_SH} ./errors1.sub
|
||||
${THIS_SH} ./errors2.sub
|
||||
${THIS_SH} ./errors3.sub
|
||||
|
||||
# this must be last!
|
||||
# in posix mode, a function name must be a valid identifier
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
# redirection errors with special builtins should exit the shell when in
|
||||
# Posix mode, not otherwise; being on the LHS of || or && should not make
|
||||
# a difference
|
||||
|
||||
exec 9<no_such_file || echo TEST
|
||||
set -o posix
|
||||
exec 9<no_such_file || echo TEST
|
||||
Reference in New Issue
Block a user