summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/readline/display.c7
-rw-r--r--lib/readline/doc/history.texi2
-rw-r--r--lib/readline/doc/hstech.texi2
-rw-r--r--lib/readline/doc/hsuser.texi2
-rw-r--r--lib/readline/doc/rlman.texi2
-rw-r--r--lib/readline/doc/rltech.texi2
-rw-r--r--lib/readline/doc/rluser.texi16
-rw-r--r--lib/readline/doc/rluserman.texi2
-rw-r--r--lib/readline/doc/version.texi8
-rw-r--r--lib/readline/histexpand.c2
-rw-r--r--lib/readline/parse-colors.c20
-rw-r--r--lib/readline/search.c5
-rw-r--r--lib/readline/signals.c2
-rw-r--r--lib/readline/undo.c13
-rw-r--r--lib/sh/Makefile.in2
-rw-r--r--lib/sh/itos.c12
-rw-r--r--lib/sh/strdup.c42
-rw-r--r--lib/sh/stringvec.c16
18 files changed, 132 insertions, 25 deletions
diff --git a/lib/readline/display.c b/lib/readline/display.c
index 8f04b3a2..913e0da0 100644
--- a/lib/readline/display.c
+++ b/lib/readline/display.c
@@ -748,10 +748,9 @@ rl_redisplay ()
/* Now account for invisible characters in the current line. */
/* XXX - this assumes that the invisible characters may be split, but only
between the first and the last lines. */
- temp += ((local_prompt_prefix == 0) ? ((newlines == 0) ? prompt_invis_chars_first_line
- : ((newlines == prompt_lines_estimate) ? wrap_offset : prompt_invis_chars_first_line))
- : ((newlines == 0) ? wrap_offset : 0));
-
+ temp += (newlines == 0) ? prompt_invis_chars_first_line
+ : ((newlines == prompt_lines_estimate) ? wrap_offset : prompt_invis_chars_first_line);
+
inv_lbreaks[++newlines] = temp;
#if defined (HANDLE_MULTIBYTE)
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0 && prompt_multibyte_chars > 0)
diff --git a/lib/readline/doc/history.texi b/lib/readline/doc/history.texi
index afbb6db6..a991fe5b 100644
--- a/lib/readline/doc/history.texi
+++ b/lib/readline/doc/history.texi
@@ -12,7 +12,7 @@ This document describes the GNU History library
a programming tool that provides a consistent user interface for
recalling lines of previously typed input.
-Copyright @copyright{} 1988--2012 Free Software Foundation, Inc.
+Copyright @copyright{} 1988--2014 Free Software Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document
diff --git a/lib/readline/doc/hstech.texi b/lib/readline/doc/hstech.texi
index a87974bc..6487f20b 100644
--- a/lib/readline/doc/hstech.texi
+++ b/lib/readline/doc/hstech.texi
@@ -1,7 +1,7 @@
@ignore
This file documents the user interface to the GNU History library.
-Copyright (C) 1988-2012 Free Software Foundation, Inc.
+Copyright (C) 1988-2014 Free Software Foundation, Inc.
Authored by Brian Fox and Chet Ramey.
Permission is granted to make and distribute verbatim copies of this manual
diff --git a/lib/readline/doc/hsuser.texi b/lib/readline/doc/hsuser.texi
index c398787b..69a50163 100644
--- a/lib/readline/doc/hsuser.texi
+++ b/lib/readline/doc/hsuser.texi
@@ -1,7 +1,7 @@
@ignore
This file documents the user interface to the GNU History library.
-Copyright (C) 1988--2012 Free Software Foundation, Inc.
+Copyright (C) 1988--2014 Free Software Foundation, Inc.
Authored by Brian Fox and Chet Ramey.
Permission is granted to make and distribute verbatim copies of this manual
diff --git a/lib/readline/doc/rlman.texi b/lib/readline/doc/rlman.texi
index 7dc9611b..17a8292b 100644
--- a/lib/readline/doc/rlman.texi
+++ b/lib/readline/doc/rlman.texi
@@ -13,7 +13,7 @@ This manual describes the GNU Readline Library
consistency of user interface across discrete programs which provide
a command line interface.
-Copyright @copyright{} 1988--2012 Free Software Foundation, Inc.
+Copyright @copyright{} 1988--2014 Free Software Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document
diff --git a/lib/readline/doc/rltech.texi b/lib/readline/doc/rltech.texi
index 5bfde171..178296be 100644
--- a/lib/readline/doc/rltech.texi
+++ b/lib/readline/doc/rltech.texi
@@ -7,7 +7,7 @@ This document describes the GNU Readline Library, a utility for aiding
in the consistency of user interface across discrete programs that need
to provide a command line interface.
-Copyright (C) 1988--2012 Free Software Foundation, Inc.
+Copyright (C) 1988--2014 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
diff --git a/lib/readline/doc/rluser.texi b/lib/readline/doc/rluser.texi
index 1b5654f8..9c915242 100644
--- a/lib/readline/doc/rluser.texi
+++ b/lib/readline/doc/rluser.texi
@@ -9,7 +9,7 @@ use these features. There is a document entitled "readline.texinfo"
which contains both end-user and programmer documentation for the
GNU Readline Library.
-Copyright (C) 1988--2012 Free Software Foundation, Inc.
+Copyright (C) 1988--2014 Free Software Foundation, Inc.
Authored by Brian Fox and Chet Ramey.
@@ -1189,11 +1189,17 @@ as if the @samp{!$} history expansion had been specified.
@subsection Commands For Changing Text
@ftable @code
+
+@item @i{end-of-file} (usually C-d)
+The character indicating end-of-file as set, for example, by
+@code{stty}. If this character is read when there are no characters
+on the line, and point is at the beginning of the line, Readline
+interprets it as the end of input and returns @sc{eof}.
+
@item delete-char (C-d)
-Delete the character at point. If point is at the
-beginning of the line, there are no characters in the line, and
-the last character typed was not bound to @code{delete-char}, then
-return @sc{eof}.
+Delete the character at point. If this function is bound to the
+same character as the tty @sc{eof} character, as @kbd{C-d}
+commonly is, see above for the effects.
@item backward-delete-char (Rubout)
Delete the character behind the cursor. A numeric argument means
diff --git a/lib/readline/doc/rluserman.texi b/lib/readline/doc/rluserman.texi
index 2281a1a9..ba6b0ad8 100644
--- a/lib/readline/doc/rluserman.texi
+++ b/lib/readline/doc/rluserman.texi
@@ -12,7 +12,7 @@ This manual describes the end user interface of the GNU Readline Library
consistency of user interface across discrete programs which provide
a command line interface.
-Copyright @copyright{} 1988--2012 Free Software Foundation, Inc.
+Copyright @copyright{} 1988--2014 Free Software Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document
diff --git a/lib/readline/doc/version.texi b/lib/readline/doc/version.texi
index db450183..70b66582 100644
--- a/lib/readline/doc/version.texi
+++ b/lib/readline/doc/version.texi
@@ -1,10 +1,10 @@
@ignore
-Copyright (C) 1988-2013 Free Software Foundation, Inc.
+Copyright (C) 1988-2014 Free Software Foundation, Inc.
@end ignore
@set EDITION 6.3
@set VERSION 6.3
-@set UPDATED 26 May 2013
-@set UPDATED-MONTH May 2013
+@set UPDATED 6 January 2014
+@set UPDATED-MONTH January 2014
-@set LASTCHANGE Sat May 25 17:02:56 EDT 2013
+@set LASTCHANGE Mon Jan 6 16:26:51 EST 2014
diff --git a/lib/readline/histexpand.c b/lib/readline/histexpand.c
index 6164e27c..4899b9d3 100644
--- a/lib/readline/histexpand.c
+++ b/lib/readline/histexpand.c
@@ -272,6 +272,8 @@ get_history_event (string, caller_index, delimiting_quote)
if (local_index == 0 || substring_okay)
{
entry = current_history ();
+ if (entry == 0)
+ FAIL_SEARCH ();
history_offset = history_length;
/* If this was a substring search, then remember the
diff --git a/lib/readline/parse-colors.c b/lib/readline/parse-colors.c
index 06eb25ac..98b2e9d1 100644
--- a/lib/readline/parse-colors.c
+++ b/lib/readline/parse-colors.c
@@ -283,7 +283,9 @@ get_funky_string (char **dest, const char **src, bool equals_end, size_t *output
default:
/* should we ? */
- abort ();
+ /* abort (); no, we should not */
+ state = ST_ERROR;
+ break;
}
}
@@ -387,7 +389,16 @@ void _rl_parse_colors()
}
}
if (state == -1)
- _rl_errmsg ("LS_COLORS: unrecognized prefix: %s", label);
+ {
+ _rl_errmsg ("LS_COLORS: unrecognized prefix: %s", label);
+ /* recover from an unrecognized prefix */
+ while (p && *p && *p != ':')
+ p++;
+ if (p && *p == ':')
+ state = 1;
+ else if (p && *p == 0)
+ state = 0;
+ }
}
break;
@@ -400,6 +411,9 @@ void _rl_parse_colors()
}
else
state = -1;
+ /* XXX - recover here as with an unrecognized prefix? */
+ if (state == -1 && ext->ext.string)
+ _rl_errmsg ("LS_COLORS: syntax error: %s", ext->ext.string);
break;
}
}
@@ -417,6 +431,8 @@ void _rl_parse_colors()
e = e->next;
free (e2);
}
+ _rl_color_ext_list = NULL;
+ _rl_colored_stats = 0; /* can't have colored stats without colors */
}
#else /* !COLOR_SUPPORT */
;
diff --git a/lib/readline/search.c b/lib/readline/search.c
index 99b9c8d3..028c2505 100644
--- a/lib/readline/search.c
+++ b/lib/readline/search.c
@@ -172,7 +172,8 @@ noninc_dosearch (string, dir)
oldpos = where_history ();
history_set_pos (noninc_history_pos);
- entry = current_history ();
+ entry = current_history (); /* will never be NULL after successful search */
+
#if defined (VI_MODE)
if (rl_editing_mode != vi_mode)
#endif
@@ -477,7 +478,7 @@ rl_history_search_internal (count, dir)
rl_history_search_pos = ret;
oldpos = where_history ();
history_set_pos (rl_history_search_pos);
- temp = current_history ();
+ temp = current_history (); /* will never be NULL after successful search */
history_set_pos (oldpos);
/* Don't find multiple instances of the same line. */
diff --git a/lib/readline/signals.c b/lib/readline/signals.c
index d373ba14..61f02f9f 100644
--- a/lib/readline/signals.c
+++ b/lib/readline/signals.c
@@ -260,7 +260,7 @@ _rl_handle_signal (sig)
# endif /* HAVE_BSD_SIGNALS */
#endif /* !HAVE_POSIX_SIGNALS */
- rl_reset_after_signal ();
+ rl_reset_after_signal ();
}
RL_UNSETSTATE(RL_STATE_SIGHANDLER);
diff --git a/lib/readline/undo.c b/lib/readline/undo.c
index 32873d27..a3d40447 100644
--- a/lib/readline/undo.c
+++ b/lib/readline/undo.c
@@ -178,6 +178,7 @@ 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)))
@@ -232,6 +233,18 @@ rl_do_undo ()
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);
diff --git a/lib/sh/Makefile.in b/lib/sh/Makefile.in
index 938c3721..36a83052 100644
--- a/lib/sh/Makefile.in
+++ b/lib/sh/Makefile.in
@@ -92,7 +92,7 @@ CSOURCES = clktck.c clock.c getcwd.c getenv.c oslib.c setlinebuf.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 wcsnwidth.c shmbchar.c
+ strchrnul.c unicode.c wcswidth.c wcsnwidth.c shmbchar.c strdup.c
# The header files for this library.
HSOURCES =
diff --git a/lib/sh/itos.c b/lib/sh/itos.c
index 12e9398d..cd36ef33 100644
--- a/lib/sh/itos.c
+++ b/lib/sh/itos.c
@@ -50,6 +50,18 @@ itos (i)
return (savestring (p));
}
+/* Integer to string conversion. This conses the string using strdup;
+ caller should free it and be prepared to deal with NULL return. */
+char *
+mitos (i)
+ intmax_t i;
+{
+ char *p, lbuf[INT_STRLEN_BOUND(intmax_t) + 1];
+
+ p = fmtumax (i, 10, lbuf, sizeof(lbuf), 0);
+ return (strdup (p));
+}
+
char *
uinttostr (i, buf, len)
uintmax_t i;
diff --git a/lib/sh/strdup.c b/lib/sh/strdup.c
new file mode 100644
index 00000000..90fa3532
--- /dev/null
+++ b/lib/sh/strdup.c
@@ -0,0 +1,42 @@
+/* strdup - return a copy of a string in newly-allocated memory. */
+
+/* Copyright (C) 2013 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>
+
+/* Get specification. */
+#include <string.h>
+#include <stdlib.h>
+
+/* Duplicate S, returning an identical malloc'd string. */
+char *
+strdup (s)
+ const char *s;
+{
+ size_t len;
+ void *new;
+
+ len = strlen (s) + 1;
+ if ((new = malloc (len)) == NULL)
+ return NULL;
+
+ memcpy (new, s, len);
+ return ((char *)new);
+}
diff --git a/lib/sh/stringvec.c b/lib/sh/stringvec.c
index b0ed4164..3bb4ab70 100644
--- a/lib/sh/stringvec.c
+++ b/lib/sh/stringvec.c
@@ -40,6 +40,14 @@ strvec_create (n)
return ((char **)xmalloc ((n) * sizeof (char *)));
}
+/* Allocate an array of strings with room for N members. */
+char **
+strvec_mcreate (n)
+ int n;
+{
+ return ((char **)malloc ((n) * sizeof (char *)));
+}
+
char **
strvec_resize (array, nsize)
char **array;
@@ -48,6 +56,14 @@ strvec_resize (array, nsize)
return ((char **)xrealloc (array, nsize * sizeof (char *)));
}
+char **
+strvec_mresize (array, nsize)
+ char **array;
+ int nsize;
+{
+ return ((char **)realloc (array, nsize * sizeof (char *)));
+}
+
/* Return the length of ARRAY, a NULL terminated array of char *. */
int
strvec_len (array)