]> git.pld-linux.org Git - packages/gdb.git/blame - gdb-bz701131-readline62-1of3.patch
- added devel deps for gdb-lib
[packages/gdb.git] / gdb-bz701131-readline62-1of3.patch
CommitLineData
6ed6bacf
AM
1archer-jankratochvil-readline62
2b13706abbee9646f4de522c0552ddd68d1a4f43a
3
4Index: gdb-7.2.90.20110703/gdb/config.in
5===================================================================
6--- gdb-7.2.90.20110703.orig/gdb/config.in 2011-07-03 10:40:53.000000000 +0200
7+++ gdb-7.2.90.20110703/gdb/config.in 2011-07-03 10:41:21.000000000 +0200
8@@ -953,9 +953,6 @@
9 /* Define to `int' if <sys/types.h> does not define. */
10 #undef pid_t
11
12-/* readline-6.0 started to use different name. */
13-#undef readline_echoing_p
14-
15 /* Define to the equivalent of the C99 'restrict' keyword, or to
16 nothing if this is not supported. Do not define if restrict is
17 supported directly. */
18Index: gdb-7.2.90.20110703/gdb/configure
19===================================================================
20--- gdb-7.2.90.20110703.orig/gdb/configure 2011-07-03 10:40:53.000000000 +0200
21+++ gdb-7.2.90.20110703/gdb/configure 2011-07-03 10:41:21.000000000 +0200
22@@ -10235,39 +10235,6 @@ if test "$with_system_readline" = yes; t
23 READLINE_DEPS=
24 READLINE_CFLAGS=
25 READLINE_TEXI_INCFLAG=
26-
27- # readline-6.0 started to use the name `_rl_echoing_p'.
28- # `$(READLINE_DIR)/' of bundled readline would not resolve in configure.
29-
30- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for readline_echoing_p" >&5
31-$as_echo_n "checking for readline_echoing_p... " >&6; }
32- save_LIBS=$LIBS
33- LIBS="$LIBS $READLINE"
34- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
35-/* end confdefs.h. */
36-
37-int
38-main ()
39-{
40-extern int readline_echoing_p;
41- return readline_echoing_p;
42- ;
43- return 0;
44-}
45-_ACEOF
46-if ac_fn_c_try_link "$LINENO"; then :
47- READLINE_ECHOING_P=yes
48-else
49- READLINE_ECHOING_P=no
50-
51-$as_echo "#define readline_echoing_p _rl_echoing_p" >>confdefs.h
52-
53-fi
54-rm -f core conftest.err conftest.$ac_objext \
55- conftest$ac_exeext conftest.$ac_ext
56- LIBS="$save_LIBS"
57- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $READLINE_ECHOING_P" >&5
58-$as_echo "$READLINE_ECHOING_P" >&6; }
59 else
60 READLINE='$(READLINE_DIR)/libreadline.a'
61 READLINE_DEPS='$(READLINE)'
62Index: gdb-7.2.90.20110703/gdb/configure.ac
63===================================================================
64--- gdb-7.2.90.20110703.orig/gdb/configure.ac 2011-07-03 10:40:53.000000000 +0200
65+++ gdb-7.2.90.20110703/gdb/configure.ac 2011-07-03 10:41:21.000000000 +0200
66@@ -732,21 +732,6 @@ if test "$with_system_readline" = yes; t
67 READLINE_DEPS=
68 READLINE_CFLAGS=
69 READLINE_TEXI_INCFLAG=
70-
71- # readline-6.0 started to use the name `_rl_echoing_p'.
72- # `$(READLINE_DIR)/' of bundled readline would not resolve in configure.
73-
74- AC_MSG_CHECKING([for readline_echoing_p])
75- save_LIBS=$LIBS
76- LIBS="$LIBS $READLINE"
77- AC_LINK_IFELSE(AC_LANG_PROGRAM(,[[extern int readline_echoing_p;
78- return readline_echoing_p;]]),
79- [READLINE_ECHOING_P=yes],
80- [READLINE_ECHOING_P=no
81- AC_DEFINE([readline_echoing_p], [_rl_echoing_p],
82- [readline-6.0 started to use different name.])])
83- LIBS="$save_LIBS"
84- AC_MSG_RESULT([$READLINE_ECHOING_P])
85 else
86 READLINE='$(READLINE_DIR)/libreadline.a'
87 READLINE_DEPS='$(READLINE)'
88Index: gdb-7.2.90.20110703/gdb/tui/tui-io.c
89===================================================================
90--- gdb-7.2.90.20110703.orig/gdb/tui/tui-io.c 2011-07-03 10:40:53.000000000 +0200
91+++ gdb-7.2.90.20110703/gdb/tui/tui-io.c 2011-07-03 10:41:21.000000000 +0200
92@@ -133,7 +133,7 @@ static Function *tui_old_rl_getc_functio
93 static VFunction *tui_old_rl_redisplay_function;
94 static VFunction *tui_old_rl_prep_terminal;
95 static VFunction *tui_old_rl_deprep_terminal;
96-static int tui_old_readline_echoing_p;
97+static int tui_old_rl_echoing_p;
98
99 /* Readline output stream.
100 Should be removed when readline is clean. */
101@@ -506,8 +506,8 @@ tui_rl_display_match_list (char **matche
102 void
103 tui_setup_io (int mode)
104 {
105- extern int readline_echoing_p;
106-
107+ extern int _rl_echoing_p;
108+
109 if (mode)
110 {
111 /* Redirect readline to TUI. */
112@@ -516,12 +516,12 @@ tui_setup_io (int mode)
113 tui_old_rl_prep_terminal = rl_prep_term_function;
114 tui_old_rl_getc_function = rl_getc_function;
115 tui_old_rl_outstream = rl_outstream;
116- tui_old_readline_echoing_p = readline_echoing_p;
117+ tui_old_rl_echoing_p = _rl_echoing_p;
118 rl_redisplay_function = tui_redisplay_readline;
119 rl_deprep_term_function = tui_deprep_terminal;
120 rl_prep_term_function = tui_prep_terminal;
121 rl_getc_function = tui_getc;
122- readline_echoing_p = 0;
123+ _rl_echoing_p = 0;
124 rl_outstream = tui_rl_outstream;
125 rl_prompt = 0;
126 rl_completion_display_matches_hook = tui_rl_display_match_list;
127@@ -560,7 +560,7 @@ tui_setup_io (int mode)
128 rl_getc_function = tui_old_rl_getc_function;
129 rl_outstream = tui_old_rl_outstream;
130 rl_completion_display_matches_hook = 0;
131- readline_echoing_p = tui_old_readline_echoing_p;
132+ _rl_echoing_p = tui_old_rl_echoing_p;
133 rl_already_prompted = 0;
134
135 /* Save tty for SIGCONT. */
136Index: gdb-7.2.90.20110703/readline/CHANGELOG
137===================================================================
138--- gdb-7.2.90.20110703.orig/readline/CHANGELOG 2011-07-03 10:40:53.000000000 +0200
139+++ gdb-7.2.90.20110703/readline/CHANGELOG 2011-07-03 10:41:21.000000000 +0200
140@@ -918,3 +918,178 @@ configure.in
141 - changed release status to `release'
142
143 [readline-5.1 frozen]
144+
145+ 12/9
146+ ----
147+[readline-5.1 released]
148+
149+ 12/14
150+ -----
151+examples/rlfe/Makefile.in
152+ - add @LIBS@ to LIBS assignment to pick up extra libraries from
153+ configure
154+
155+ 1/3/2006
156+ --------
157+support/shlib-install
158+ - Install shared libraries with execute bit set on Linux
159+
160+ 6/9
161+ ---
162+[readline-5.2-alpha frozen]
163+
164+ 6/26
165+ ----
166+configure.in
167+ - set CROSS_COMPILE to the empty string by default, so we don't inherit
168+ a random value from the environment
169+
170+ 7/8
171+ ---
172+[readline-5.2-alpha released]
173+
174+
175+[readline-5.2-beta released]
176+
177+ 9/12
178+ ----
179+config.h.in
180+ - add defines for wcscoll, iswctype, iswupper, iswlower, towupper,
181+ towlower functions
182+ - replace define for wctomb with one for wcrtomb
183+ - add defines for wchar_t, wint_t, wctype_t types
184+
185+ 10/11
186+ -----
187+[readline-5.2 released]
188+
189+ 11/9
190+ ----
191+examples/rlfe/{configure.in,Makefile.in,config.h.in,rlfe.c,pty.c}
192+ - portability fixes from Mike Frysinger <vapier@gentoo.org>
193+
194+ 11/21
195+ -----
196+Makefile.in
197+ - add `install-examples' and `uninstall-examples' targets
198+
199+examples/Makefile.in
200+ - add correct variables to build examples on Windows
201+ - add appropriate rules to install and uninstall example sources in
202+ $(datadir)/readline
203+
204+ 11/27
205+ -----
206+config.h.in
207+ - move #undef of HAVE_STRCOLL out of config.h.in, since autoconf tries
208+ to substitute it based on configure tests
209+
210+ 4/27/2007
211+ ---------
212+examples/autoconf
213+ - new directory with example autoconf macros to detect readline and
214+ return information about the installed version
215+
216+ 6/13
217+ ----
218+support/shlib-install
219+ - changes to support AIX 5.x shared library installation
220+
221+ 3/20/2008
222+ ---------
223+support/shlib-install
224+ - add support for NetBSD and Interix shared library installation
225+
226+ 4/22
227+ ----
228+support/wcwidth.c
229+ - updated implementation from 2007-05
230+
231+ 7/18
232+ ----
233+support/shlib-install
234+ - support for mingw32, contributed by Carlo Bramix <carlo.bramix@libero.it>
235+
236+ 8/4
237+ ---
238+configure.in
239+ - changed to readline-6.0
240+
241+ 8/18
242+ ----
243+support/config.{guess,sub}
244+ - updated to newer versions from autoconf-2.62 distribution
245+
246+ 3/5/2009
247+ --------
248+support/shlib-install
249+ - take a new -V host_vendor argument
250+ - add ${host_vendor} to string tested in case statement for symlink
251+ creation section
252+ - add support for FreeBSD/gentoo, which uses Linux library naming
253+ scheme
254+ - change FreeBSD symlink rules, since FreeBSD 7+ has only ELF shared
255+ libraries. DragonflyBSD rules are the same. Fix from Timothy
256+ Redaelli <drizzt@gentoo.org>
257+
258+shlib/Makefile.in
259+ - add definition of host_vendor, substituted by configure
260+ - add -V host_vendor argument to all invocations of shlib-install.
261+ Fix from Timothy Redaelli <drizzt@gentoo.org>
262+
263+ 3/10
264+ ----
265+configure.in
266+ - add call to AC_SYS_LARGEFILE for readdir and largefile support on
267+ Linux
268+
269+config.h.in
270+ - add _FILE_OFFSET_BITS define
271+
272+ 4/19
273+ ----
274+Makefile.in
275+ - add targets for making and installing documentation required by GNU
276+ coding standards. Fix from Joseph Myers <joseph@codesourcery.com>
277+
278+posixselect.h
279+ - pick up from bash. Inspired by Mike Frysinger <vapier@gentoo.org>
280+
281+ 10/28
282+ -----
283+support/shlib-install
284+ - decrease the default version of FreeBSD that installs shared libraries
285+ to 4.x. Advice from Peter Jeremy <peterjeremy@acm.org>
286+
287+ 12/18
288+ -----
289+[readline-6.1-rc1 released]
290+
291+ 12/23
292+ -----
293+doc/Makefile.in
294+ - make sure $(topdir) is not ".." before removing all of the formatted
295+ documentation in `make distclean'. $(topdir) is set to `..' if
296+ readline is being built in the source directory. Fixes problem
297+ noticed by THOUMIN Damien <thoumin@ipanematech.com>
298+
299+ 12/29
300+ -----
301+[readline-6.1 frozen]
302+
303+ 2/5/2010
304+ --------
305+examples/Makefile.in
306+ - make sure to install example C files using $(srcdir)/$$f in case
307+ we're building outside the source directory. Bug report and fix
308+ from Peter Breitenlohner <peb@mppmu.mpg.de>
309+
310+ 7/25
311+ ----
312+xfree.c
313+ - new file with xfree() implementation, moved from xmalloc.c
314+
315+ 12/28
316+ -----
317+{examples,shlib}/Makefile.in
318+ - Cygwin-based changes from Eric Blake <eblake@redhat.com>
319Index: gdb-7.2.90.20110703/readline/CHANGES
320===================================================================
321--- gdb-7.2.90.20110703.orig/readline/CHANGES 2011-07-03 10:40:53.000000000 +0200
322+++ gdb-7.2.90.20110703/readline/CHANGES 2011-07-03 10:41:21.000000000 +0200
323@@ -1,3 +1,320 @@
324+This document details the changes between this version, readline-6.2,
325+and the previous version, readline-6.1.
326+
327+1. Changes to Readline
328+
329+a. Fixed a bug that caused the unconverted filename to be added to the list of
330+ completions when the application specified filename conversion functions.
331+
332+b. Fixed a bug that caused the wrong filename to be passed to opendir when the
333+ application has specified a filename dequoting function.
334+
335+c. Fixed a bug when repeating a character search in vi mode in the case where
336+ there was no search to repeat.
337+
338+d. When show-all-if-ambiguous is set, the completion routines no longer insert
339+ a common match prefix that is shorter than the text being completed.
340+
341+e. The full set of vi editing commands may now be used in callback mode.
342+
343+f. Fixed a bug that caused readline to not update its idea of the terminal
344+ dimensions while running in `no-echo' mode.
345+
346+h. Fixed a bug that caused readline to dump core if an application called
347+ rl_prep_terminal without setting rl_instream.
348+
349+i. Fixed a bug that caused meta-prefixed characters bound to incremental
350+ search forward or backward to not be recognized if they were typed
351+ subsequently.
352+
353+j. The incremental search code treats key sequences that map to the same
354+ functions as (default) ^G, ^W, and ^Y as equivalent to those characters.
355+
356+k. Fixed a bug in menu-complete that caused it to misbehave with large
357+ negative argument.
358+
359+l. Fixed a bug that caused vi-mode yank-last-arg to ring the bell when invoked
360+ at the end of the line.
361+
362+m. Fixed a bug that made an explicit argument of 0 to yank-last-arg behave
363+ as if it were a negative argument.
364+
365+n. Fixed a bug that caused directory names in words to be completed to not
366+ be dequoted correctly.
367+
368+2. New Features in Readline
369+
370+a. The history library does not try to write the history filename in the
371+ current directory if $HOME is unset. This closes a potential security
372+ problem if the application does not specify a history filename.
373+
374+b. New bindable variable `completion-display-width' to set the number of
375+ columns used when displaying completions.
376+
377+c. New bindable variable `completion-case-map' to cause case-insensitive
378+ completion to treat `-' and `_' as identical.
379+
380+d. There are new bindable vi-mode command names to avoid readline's case-
381+ insensitive matching not allowing them to be bound separately.
382+
383+e. New bindable variable `menu-complete-display-prefix' causes the menu
384+ completion code to display the common prefix of the possible completions
385+ before cycling through the list, instead of after.
386+
387+-------------------------------------------------------------------------------
388+This document details the changes between this version, readline-6.1,
389+and the previous version, readline-6.0.
390+
391+1. Changes to Readline
392+
393+a. The SIGWINCH signal handler now avoids calling the redisplay code if
394+ one arrives while in the middle of redisplay.
395+
396+b. Changes to the timeout code to make sure that timeout values greater
397+ than one second are handled better.
398+
399+c. Fixed a bug in the redisplay code that was triggered by a prompt
400+ containing invisible characters exactly the width of the screen.
401+
402+d. Fixed a bug in the redisplay code encountered when running in horizontal
403+ scroll mode.
404+
405+e. Fixed a bug that prevented menu completion from properly completing
406+ filenames.
407+
408+f. Fixed a redisplay bug caused by a multibyte character causing a line to
409+ wrap.
410+
411+g. Fixed a bug that caused key sequences of two characters to not be
412+ recognized when a longer sequence identical in the first two characters
413+ was bound.
414+
415+h. Fixed a bug that caused history expansion to be attempted on $'...'
416+ single-quoted strings.
417+
418+i. Fixed a bug that caused incorrect redisplay when the prompt contained
419+ multibyte characters in an `invisible' sequence bracketed by \[ and
420+ \].
421+
422+j. Fixed a bug that caused history expansion to short-circuit after
423+ encountering a multibyte character.
424+
425+k. Fixed a bug that caused applications using the callback interface to not
426+ react to SIGINT (or other signals) until another character arrived.
427+
428+2. New Features in Readline
429+
430+a. New bindable function: menu-complete-backward.
431+
432+b. In the vi insertion keymap, C-n is now bound to menu-complete by default,
433+ and C-p to menu-complete-backward.
434+
435+c. When in vi command mode, repeatedly hitting ESC now does nothing, even
436+ when ESC introduces a bound key sequence. This is closer to how
437+ historical vi behaves.
438+
439+d. New bindable function: skip-csi-sequence. Can be used as a default to
440+ consume key sequences generated by keys like Home and End without having
441+ to bind all keys.
442+
443+e. New application-settable function: rl_filename_rewrite_hook. Can be used
444+ to rewite or modify filenames read from the file system before they are
445+ compared to the word to be completed.
446+
447+f. New bindable variable: skip-completed-text, active when completing in the
448+ middle of a word. If enabled, it means that characters in the completion
449+ that match characters in the remainder of the word are "skipped" rather
450+ than inserted into the line.
451+
452+g. The pre-readline-6.0 version of menu completion is available as
453+ "old-menu-complete" for users who do not like the readline-6.0 version.
454+
455+h. New bindable variable: echo-control-characters. If enabled, and the
456+ tty ECHOCTL bit is set, controls the echoing of characters corresponding
457+ to keyboard-generated signals.
458+
459+i. New bindable variable: enable-meta-key. Controls whether or not readline
460+ sends the smm/rmm sequences if the terminal indicates it has a meta key
461+ that enables eight-bit characters.
462+
463+-------------------------------------------------------------------------------
464+This document details the changes between this version, readline-6.0,
465+and the previous version, readline-5.2.
466+
467+1. Changes to Readline
468+
469+a. Fixed a number of redisplay errors in environments supporting multibyte
470+ characters.
471+
472+b. Fixed bugs in vi command mode that caused motion commands to inappropriately
473+ set the mark.
474+
475+c. When using the arrow keys in vi insertion mode, readline allows movement
476+ beyond the current end of the line (unlike command mode).
477+
478+d. Fixed bugs that caused readline to loop when the terminal has been taken
479+ away and reads return -1/EIO.
480+
481+e. Fixed bugs in redisplay occurring when displaying prompts containing
482+ invisible characters.
483+
484+f. Fixed a bug that caused the completion append character to not be reset to
485+ the default after an application-specified completion function changed it.
486+
487+g. Fixed a problem that caused incorrect positioning of the cursor while in
488+ emacs editing mode when moving forward at the end of a line while using
489+ a locale supporting multibyte characters.
490+
491+h. Fixed an off-by-one error that caused readline to drop every 511th
492+ character of buffered input.
493+
494+i. Fixed a bug that resulted in SIGTERM not being caught or cleaned up.
495+
496+j. Fixed redisplay bugs caused by multiline prompts with invisible characters
497+ or no characters following the final newline.
498+
499+k. Fixed redisplay bug caused by prompts consisting solely of invisible
500+ characters.
501+
502+l. Fixed a bug in the code that buffers characters received very quickly in
503+ succession which caused characters to be dropped.
504+
505+m. Fixed a bug that caused readline to reference uninitialized data structures
506+ if it received a SIGWINCH before completing initialzation.
507+
508+n. Fixed a bug that caused the vi-mode `last command' to be set incorrectly
509+ and therefore unrepeatable.
510+
511+o. Fixed a bug that caused readline to disable echoing when it was being used
512+ with an output file descriptor that was not a terminal.
513+
514+p. Readline now blocks SIGINT while manipulating internal data structures
515+ during redisplay.
516+
517+q. Fixed a bug in redisplay that caused readline to segfault when pasting a
518+ very long line (over 130,000 characters).
519+
520+r. Fixed bugs in redisplay when using prompts with no visible printing
521+ characters.
522+
523+s. Fixed a bug that caused redisplay errors when using prompts with invisible
524+ characters and numeric arguments to a command in a multibyte locale.
525+
526+t. Fixed a bug that caused redisplay errors when using prompts with invisible
527+ characters spanning more than two physical screen lines.
528+
529+2. New Features in Readline
530+
531+a. A new variable, rl_sort_completion_matches; allows applications to inhibit
532+ match list sorting (but beware: some things don't work right if
533+ applications do this).
534+
535+b. A new variable, rl_completion_invoking_key; allows applications to discover
536+ the key that invoked rl_complete or rl_menu_complete.
537+
538+c. The functions rl_block_sigint and rl_release_sigint are now public and
539+ available to calling applications who want to protect critical sections
540+ (like redisplay).
541+
542+d. The functions rl_save_state and rl_restore_state are now public and
543+ available to calling applications; documented rest of readline's state
544+ flag values.
545+
546+e. A new user-settable variable, `history-size', allows setting the maximum
547+ number of entries in the history list.
548+
549+f. There is a new implementation of menu completion, with several improvements
550+ over the old; the most notable improvement is a better `completions
551+ browsing' mode.
552+
553+g. The menu completion code now uses the rl_menu_completion_entry_function
554+ variable, allowing applications to provide their own menu completion
555+ generators.
556+
557+h. There is support for replacing a prefix of a pathname with a `...' when
558+ displaying possible completions. This is controllable by setting the
559+ `completion-prefix-display-length' variable. Matches with a common prefix
560+ longer than this value have the common prefix replaced with `...'.
561+
562+i. There is a new `revert-all-at-newline' variable. If enabled, readline will
563+ undo all outstanding changes to all history lines when `accept-line' is
564+ executed.
565+
566+-------------------------------------------------------------------------------
567+This document details the changes between this version, readline-5.2,
568+and the previous version, readline-5.1.
569+
570+1. Changes to Readline
571+
572+a. Fixed a problem that caused segmentation faults when using readline in
573+ callback mode and typing consecutive DEL characters on an empty line.
574+
575+b. Fixed several redisplay problems with multibyte characters, all having to
576+ do with the different code paths and variable meanings between single-byte
577+ and multibyte character redisplay.
578+
579+c. Fixed a problem with key sequence translation when presented with the
580+ sequence \M-\C-x.
581+
582+d. Fixed a problem that prevented the `a' command in vi mode from being
583+ undone and redone properly.
584+
585+e. Fixed a problem that prevented empty inserts in vi mode from being undone
586+ properly.
587+
588+f. Fixed a problem that caused readline to initialize with an incorrect idea
589+ of whether or not the terminal can autowrap.
590+
591+g. Fixed output of key bindings (like bash `bind -p') to honor the setting of
592+ convert-meta and use \e where appropriate.
593+
594+h. Changed the default filename completion function to call the filename
595+ dequoting function if the directory completion hook isn't set. This means
596+ that any directory completion hooks need to dequote the directory name,
597+ since application-specific hooks need to know how the word was quoted,
598+ even if no other changes are made.
599+
600+i. Fixed a bug with creating the prompt for a non-interactive search string
601+ when there are non-printing characters in the primary prompt.
602+
603+j. Fixed a bug that caused prompts with invisible characters to be redrawn
604+ multiple times in a multibyte locale.
605+
606+k. Fixed a bug that could cause the key sequence scanning code to return the
607+ wrong function.
608+
609+l. Fixed a problem with the callback interface that caused it to fail when
610+ using multi-character keyboard macros.
611+
612+m. Fixed a bug that could cause a core dump when an edited history entry was
613+ re-executed under certain conditions.
614+
615+n. Fixed a bug that caused readline to reference freed memory when attmpting
616+ to display a portion of the prompt.
617+
618+o. Fixed a bug with prompt redisplay in a multi-byte locale to avoid redrawing
619+ the prompt and input line multiple times.
620+
621+p. Fixed history expansion to not be confused by here-string redirection.
622+
623+q. Readline no longer treats read errors by converting them to newlines, as
624+ it does with EOF. This caused partial lines to be returned from readline().
625+
626+r. Fixed a redisplay bug that occurred in multibyte-capable locales when the
627+ prompt was one character longer than the screen width.
628+
629+2. New Features in Readline
630+
631+a. Calling applications can now set the keyboard timeout to 0, allowing
632+ poll-like behavior.
633+
634+b. The value of SYS_INPUTRC (configurable at compilation time) is now used as
635+ the default last-ditch startup file.
636+
637+c. The history file reading functions now allow windows-like \r\n line
638+ terminators.
639+
640+-------------------------------------------------------------------------------
641 This document details the changes between this version, readline-5.1,
642 and the previous version, readline-5.0.
643
644Index: gdb-7.2.90.20110703/readline/COPYING
645===================================================================
646--- gdb-7.2.90.20110703.orig/readline/COPYING 2011-07-03 10:40:53.000000000 +0200
647+++ gdb-7.2.90.20110703/readline/COPYING 2011-07-03 10:41:21.000000000 +0200
648@@ -1,285 +1,626 @@
649- GNU GENERAL PUBLIC LICENSE
650- Version 2, June 1991
651+ GNU GENERAL PUBLIC LICENSE
652+ Version 3, 29 June 2007
653
654- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
655- 59 Temple Place, Suite 330, Boston, MA 02111 USA
656+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
657 Everyone is permitted to copy and distribute verbatim copies
658 of this license document, but changing it is not allowed.
659
660- Preamble
661+ Preamble
662
663- The licenses for most software are designed to take away your
664-freedom to share and change it. By contrast, the GNU General Public
665-License is intended to guarantee your freedom to share and change free
666-software--to make sure the software is free for all its users. This
667-General Public License applies to most of the Free Software
668-Foundation's software and to any other program whose authors commit to
669-using it. (Some other Free Software Foundation software is covered by
670-the GNU Library General Public License instead.) You can apply it to
671+ The GNU General Public License is a free, copyleft license for
672+software and other kinds of works.
673+
674+ The licenses for most software and other practical works are designed
675+to take away your freedom to share and change the works. By contrast,
676+the GNU General Public License is intended to guarantee your freedom to
677+share and change all versions of a program--to make sure it remains free
678+software for all its users. We, the Free Software Foundation, use the
679+GNU General Public License for most of our software; it applies also to
680+any other work released this way by its authors. You can apply it to
681 your programs, too.
682
683 When we speak of free software, we are referring to freedom, not
684 price. Our General Public Licenses are designed to make sure that you
685 have the freedom to distribute copies of free software (and charge for
686-this service if you wish), that you receive source code or can get it
687-if you want it, that you can change the software or use pieces of it
688-in new free programs; and that you know you can do these things.
689-
690- To protect your rights, we need to make restrictions that forbid
691-anyone to deny you these rights or to ask you to surrender the rights.
692-These restrictions translate to certain responsibilities for you if you
693-distribute copies of the software, or if you modify it.
694+them if you wish), that you receive source code or can get it if you
695+want it, that you can change the software or use pieces of it in new
696+free programs, and that you know you can do these things.
697+
698+ To protect your rights, we need to prevent others from denying you
699+these rights or asking you to surrender the rights. Therefore, you have
700+certain responsibilities if you distribute copies of the software, or if
701+you modify it: responsibilities to respect the freedom of others.
702
703 For example, if you distribute copies of such a program, whether
704-gratis or for a fee, you must give the recipients all the rights that
705-you have. You must make sure that they, too, receive or can get the
706-source code. And you must show them these terms so they know their
707-rights.
708-
709- We protect your rights with two steps: (1) copyright the software, and
710-(2) offer you this license which gives you legal permission to copy,
711-distribute and/or modify the software.
712-
713- Also, for each author's protection and ours, we want to make certain
714-that everyone understands that there is no warranty for this free
715-software. If the software is modified by someone else and passed on, we
716-want its recipients to know that what they have is not the original, so
717-that any problems introduced by others will not reflect on the original
718-authors' reputations.
719-
720- Finally, any free program is threatened constantly by software
721-patents. We wish to avoid the danger that redistributors of a free
722-program will individually obtain patent licenses, in effect making the
723-program proprietary. To prevent this, we have made it clear that any
724-patent must be licensed for everyone's free use or not licensed at all.
725+gratis or for a fee, you must pass on to the recipients the same
726+freedoms that you received. You must make sure that they, too, receive
727+or can get the source code. And you must show them these terms so they
728+know their rights.
729+
730+ Developers that use the GNU GPL protect your rights with two steps:
731+(1) assert copyright on the software, and (2) offer you this License
732+giving you legal permission to copy, distribute and/or modify it.
733+
734+ For the developers' and authors' protection, the GPL clearly explains
735+that there is no warranty for this free software. For both users' and
736+authors' sake, the GPL requires that modified versions be marked as
737+changed, so that their problems will not be attributed erroneously to
738+authors of previous versions.
739+
740+ Some devices are designed to deny users access to install or run
741+modified versions of the software inside them, although the manufacturer
742+can do so. This is fundamentally incompatible with the aim of
743+protecting users' freedom to change the software. The systematic
744+pattern of such abuse occurs in the area of products for individuals to
745+use, which is precisely where it is most unacceptable. Therefore, we
746+have designed this version of the GPL to prohibit the practice for those
747+products. If such problems arise substantially in other domains, we
748+stand ready to extend this provision to those domains in future versions
749+of the GPL, as needed to protect the freedom of users.
750+
751+ Finally, every program is threatened constantly by software patents.
752+States should not allow patents to restrict development and use of
753+software on general-purpose computers, but in those that do, we wish to
754+avoid the special danger that patents applied to a free program could
755+make it effectively proprietary. To prevent this, the GPL assures that
756+patents cannot be used to render the program non-free.
757
758 The precise terms and conditions for copying, distribution and
759 modification follow.
760-\f
761- GNU GENERAL PUBLIC LICENSE
762- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
763-
764- 0. This License applies to any program or other work which contains
765-a notice placed by the copyright holder saying it may be distributed
766-under the terms of this General Public License. The "Program", below,
767-refers to any such program or work, and a "work based on the Program"
768-means either the Program or any derivative work under copyright law:
769-that is to say, a work containing the Program or a portion of it,
770-either verbatim or with modifications and/or translated into another
771-language. (Hereinafter, translation is included without limitation in
772-the term "modification".) Each licensee is addressed as "you".
773-
774-Activities other than copying, distribution and modification are not
775-covered by this License; they are outside its scope. The act of
776-running the Program is not restricted, and the output from the Program
777-is covered only if its contents constitute a work based on the
778-Program (independent of having been made by running the Program).
779-Whether that is true depends on what the Program does.
780-
781- 1. You may copy and distribute verbatim copies of the Program's
782-source code as you receive it, in any medium, provided that you
783-conspicuously and appropriately publish on each copy an appropriate
784-copyright notice and disclaimer of warranty; keep intact all the
785-notices that refer to this License and to the absence of any warranty;
786-and give any other recipients of the Program a copy of this License
787-along with the Program.
788-
789-You may charge a fee for the physical act of transferring a copy, and
790-you may at your option offer warranty protection in exchange for a fee.
791-
792- 2. You may modify your copy or copies of the Program or any portion
793-of it, thus forming a work based on the Program, and copy and
794-distribute such modifications or work under the terms of Section 1
795-above, provided that you also meet all of these conditions:
796-
797- a) You must cause the modified files to carry prominent notices
798- stating that you changed the files and the date of any change.
799-
800- b) You must cause any work that you distribute or publish, that in
801- whole or in part contains or is derived from the Program or any
802- part thereof, to be licensed as a whole at no charge to all third
803- parties under the terms of this License.
804-
805- c) If the modified program normally reads commands interactively
806- when run, you must cause it, when started running for such
807- interactive use in the most ordinary way, to print or display an
808- announcement including an appropriate copyright notice and a
809- notice that there is no warranty (or else, saying that you provide
810- a warranty) and that users may redistribute the program under
811- these conditions, and telling the user how to view a copy of this
812- License. (Exception: if the Program itself is interactive but
813- does not normally print such an announcement, your work based on
814- the Program is not required to print an announcement.)
815-\f
816-These requirements apply to the modified work as a whole. If
817-identifiable sections of that work are not derived from the Program,
818-and can be reasonably considered independent and separate works in
819-themselves, then this License, and its terms, do not apply to those
820-sections when you distribute them as separate works. But when you
821-distribute the same sections as part of a whole which is a work based
822-on the Program, the distribution of the whole must be on the terms of
823-this License, whose permissions for other licensees extend to the
824-entire whole, and thus to each and every part regardless of who wrote it.
825-
826-Thus, it is not the intent of this section to claim rights or contest
827-your rights to work written entirely by you; rather, the intent is to
828-exercise the right to control the distribution of derivative or
829-collective works based on the Program.
830-
831-In addition, mere aggregation of another work not based on the Program
832-with the Program (or with a work based on the Program) on a volume of
833-a storage or distribution medium does not bring the other work under
834-the scope of this License.
835-
836- 3. You may copy and distribute the Program (or a work based on it,
837-under Section 2) in object code or executable form under the terms of
838-Sections 1 and 2 above provided that you also do one of the following:
839-
840- a) Accompany it with the complete corresponding machine-readable
841- source code, which must be distributed under the terms of Sections
842- 1 and 2 above on a medium customarily used for software interchange; or,
843-
844- b) Accompany it with a written offer, valid for at least three
845- years, to give any third party, for a charge no more than your
846- cost of physically performing source distribution, a complete
847- machine-readable copy of the corresponding source code, to be
848- distributed under the terms of Sections 1 and 2 above on a medium
849- customarily used for software interchange; or,
850-
851- c) Accompany it with the information you received as to the offer
852- to distribute corresponding source code. (This alternative is
853- allowed only for noncommercial distribution and only if you
854- received the program in object code or executable form with such
855- an offer, in accord with Subsection b above.)
856-
857-The source code for a work means the preferred form of the work for
858-making modifications to it. For an executable work, complete source
859-code means all the source code for all modules it contains, plus any
860-associated interface definition files, plus the scripts used to
861-control compilation and installation of the executable. However, as a
862-special exception, the source code distributed need not include
863-anything that is normally distributed (in either source or binary
864-form) with the major components (compiler, kernel, and so on) of the
865-operating system on which the executable runs, unless that component
866-itself accompanies the executable.
867-
868-If distribution of executable or object code is made by offering
869-access to copy from a designated place, then offering equivalent
870-access to copy the source code from the same place counts as
871-distribution of the source code, even though third parties are not
872-compelled to copy the source along with the object code.
873-\f
874- 4. You may not copy, modify, sublicense, or distribute the Program
875-except as expressly provided under this License. Any attempt
876-otherwise to copy, modify, sublicense or distribute the Program is
877-void, and will automatically terminate your rights under this License.
878-However, parties who have received copies, or rights, from you under
879-this License will not have their licenses terminated so long as such
880-parties remain in full compliance.
881-
882- 5. You are not required to accept this License, since you have not
883-signed it. However, nothing else grants you permission to modify or
884-distribute the Program or its derivative works. These actions are
885-prohibited by law if you do not accept this License. Therefore, by
886-modifying or distributing the Program (or any work based on the
887-Program), you indicate your acceptance of this License to do so, and
888-all its terms and conditions for copying, distributing or modifying
889-the Program or works based on it.
890-
891- 6. Each time you redistribute the Program (or any work based on the
892-Program), the recipient automatically receives a license from the
893-original licensor to copy, distribute or modify the Program subject to
894-these terms and conditions. You may not impose any further
895-restrictions on the recipients' exercise of the rights granted herein.
896-You are not responsible for enforcing compliance by third parties to
897+
898+ TERMS AND CONDITIONS
899+
900+ 0. Definitions.
901+
902+ "This License" refers to version 3 of the GNU General Public License.
903+
904+ "Copyright" also means copyright-like laws that apply to other kinds of
905+works, such as semiconductor masks.
906+
907+ "The Program" refers to any copyrightable work licensed under this
908+License. Each licensee is addressed as "you". "Licensees" and
909+"recipients" may be individuals or organizations.
910+
911+ To "modify" a work means to copy from or adapt all or part of the work
912+in a fashion requiring copyright permission, other than the making of an
913+exact copy. The resulting work is called a "modified version" of the
914+earlier work or a work "based on" the earlier work.
915+
916+ A "covered work" means either the unmodified Program or a work based
917+on the Program.
918+
919+ To "propagate" a work means to do anything with it that, without
920+permission, would make you directly or secondarily liable for
921+infringement under applicable copyright law, except executing it on a
922+computer or modifying a private copy. Propagation includes copying,
923+distribution (with or without modification), making available to the
924+public, and in some countries other activities as well.
925+
926+ To "convey" a work means any kind of propagation that enables other
927+parties to make or receive copies. Mere interaction with a user through
928+a computer network, with no transfer of a copy, is not conveying.
929+
930+ An interactive user interface displays "Appropriate Legal Notices"
931+to the extent that it includes a convenient and prominently visible
932+feature that (1) displays an appropriate copyright notice, and (2)
933+tells the user that there is no warranty for the work (except to the
934+extent that warranties are provided), that licensees may convey the
935+work under this License, and how to view a copy of this License. If
936+the interface presents a list of user commands or options, such as a
937+menu, a prominent item in the list meets this criterion.
938+
939+ 1. Source Code.
940+
941+ The "source code" for a work means the preferred form of the work
942+for making modifications to it. "Object code" means any non-source
943+form of a work.
944+
945+ A "Standard Interface" means an interface that either is an official
946+standard defined by a recognized standards body, or, in the case of
947+interfaces specified for a particular programming language, one that
948+is widely used among developers working in that language.
949+
950+ The "System Libraries" of an executable work include anything, other
951+than the work as a whole, that (a) is included in the normal form of
952+packaging a Major Component, but which is not part of that Major
953+Component, and (b) serves only to enable use of the work with that
954+Major Component, or to implement a Standard Interface for which an
955+implementation is available to the public in source code form. A
956+"Major Component", in this context, means a major essential component
957+(kernel, window system, and so on) of the specific operating system
958+(if any) on which the executable work runs, or a compiler used to
959+produce the work, or an object code interpreter used to run it.
960+
961+ The "Corresponding Source" for a work in object code form means all
962+the source code needed to generate, install, and (for an executable
963+work) run the object code and to modify the work, including scripts to
964+control those activities. However, it does not include the work's
965+System Libraries, or general-purpose tools or generally available free
966+programs which are used unmodified in performing those activities but
967+which are not part of the work. For example, Corresponding Source
968+includes interface definition files associated with source files for
969+the work, and the source code for shared libraries and dynamically
970+linked subprograms that the work is specifically designed to require,
971+such as by intimate data communication or control flow between those
972+subprograms and other parts of the work.
973+
974+ The Corresponding Source need not include anything that users
975+can regenerate automatically from other parts of the Corresponding
976+Source.
977+
978+ The Corresponding Source for a work in source code form is that
979+same work.
980+
981+ 2. Basic Permissions.
982+
983+ All rights granted under this License are granted for the term of
984+copyright on the Program, and are irrevocable provided the stated
985+conditions are met. This License explicitly affirms your unlimited
986+permission to run the unmodified Program. The output from running a
987+covered work is covered by this License only if the output, given its
988+content, constitutes a covered work. This License acknowledges your
989+rights of fair use or other equivalent, as provided by copyright law.
990+
991+ You may make, run and propagate covered works that you do not
992+convey, without conditions so long as your license otherwise remains
993+in force. You may convey covered works to others for the sole purpose
994+of having them make modifications exclusively for you, or provide you
995+with facilities for running those works, provided that you comply with
996+the terms of this License in conveying all material for which you do
997+not control copyright. Those thus making or running the covered works
998+for you must do so exclusively on your behalf, under your direction
999+and control, on terms that prohibit them from making any copies of
1000+your copyrighted material outside their relationship with you.
1001+
1002+ Conveying under any other circumstances is permitted solely under
1003+the conditions stated below. Sublicensing is not allowed; section 10
1004+makes it unnecessary.
1005+
1006+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
1007+
1008+ No covered work shall be deemed part of an effective technological
1009+measure under any applicable law fulfilling obligations under article
1010+11 of the WIPO copyright treaty adopted on 20 December 1996, or
1011+similar laws prohibiting or restricting circumvention of such
1012+measures.
1013+
1014+ When you convey a covered work, you waive any legal power to forbid
1015+circumvention of technological measures to the extent such circumvention
1016+is effected by exercising rights under this License with respect to
1017+the covered work, and you disclaim any intention to limit operation or
1018+modification of the work as a means of enforcing, against the work's
1019+users, your or third parties' legal rights to forbid circumvention of
1020+technological measures.
1021+
1022+ 4. Conveying Verbatim Copies.
1023+
1024+ You may convey verbatim copies of the Program's source code as you
1025+receive it, in any medium, provided that you conspicuously and
1026+appropriately publish on each copy an appropriate copyright notice;
1027+keep intact all notices stating that this License and any
1028+non-permissive terms added in accord with section 7 apply to the code;
1029+keep intact all notices of the absence of any warranty; and give all
1030+recipients a copy of this License along with the Program.
1031+
1032+ You may charge any price or no price for each copy that you convey,
1033+and you may offer support or warranty protection for a fee.
1034+
1035+ 5. Conveying Modified Source Versions.
1036+
1037+ You may convey a work based on the Program, or the modifications to
1038+produce it from the Program, in the form of source code under the
1039+terms of section 4, provided that you also meet all of these conditions:
1040+
1041+ a) The work must carry prominent notices stating that you modified
1042+ it, and giving a relevant date.
1043+
1044+ b) The work must carry prominent notices stating that it is
1045+ released under this License and any conditions added under section
1046+ 7. This requirement modifies the requirement in section 4 to
1047+ "keep intact all notices".
1048+
1049+ c) You must license the entire work, as a whole, under this
1050+ License to anyone who comes into possession of a copy. This
1051+ License will therefore apply, along with any applicable section 7
1052+ additional terms, to the whole of the work, and all its parts,
1053+ regardless of how they are packaged. This License gives no
1054+ permission to license the work in any other way, but it does not
1055+ invalidate such permission if you have separately received it.
1056+
1057+ d) If the work has interactive user interfaces, each must display
1058+ Appropriate Legal Notices; however, if the Program has interactive
1059+ interfaces that do not display Appropriate Legal Notices, your
1060+ work need not make them do so.
1061+
1062+ A compilation of a covered work with other separate and independent
1063+works, which are not by their nature extensions of the covered work,
1064+and which are not combined with it such as to form a larger program,
1065+in or on a volume of a storage or distribution medium, is called an
1066+"aggregate" if the compilation and its resulting copyright are not
1067+used to limit the access or legal rights of the compilation's users
1068+beyond what the individual works permit. Inclusion of a covered work
1069+in an aggregate does not cause this License to apply to the other
1070+parts of the aggregate.
1071+
1072+ 6. Conveying Non-Source Forms.
1073+
1074+ You may convey a covered work in object code form under the terms
1075+of sections 4 and 5, provided that you also convey the
1076+machine-readable Corresponding Source under the terms of this License,
1077+in one of these ways:
1078+
1079+ a) Convey the object code in, or embodied in, a physical product
1080+ (including a physical distribution medium), accompanied by the
1081+ Corresponding Source fixed on a durable physical medium
1082+ customarily used for software interchange.
1083+
1084+ b) Convey the object code in, or embodied in, a physical product
1085+ (including a physical distribution medium), accompanied by a
1086+ written offer, valid for at least three years and valid for as
1087+ long as you offer spare parts or customer support for that product
1088+ model, to give anyone who possesses the object code either (1) a
1089+ copy of the Corresponding Source for all the software in the
1090+ product that is covered by this License, on a durable physical
1091+ medium customarily used for software interchange, for a price no
1092+ more than your reasonable cost of physically performing this
1093+ conveying of source, or (2) access to copy the
1094+ Corresponding Source from a network server at no charge.
1095+
1096+ c) Convey individual copies of the object code with a copy of the
1097+ written offer to provide the Corresponding Source. This
1098+ alternative is allowed only occasionally and noncommercially, and
1099+ only if you received the object code with such an offer, in accord
1100+ with subsection 6b.
1101+
1102+ d) Convey the object code by offering access from a designated
1103+ place (gratis or for a charge), and offer equivalent access to the
1104+ Corresponding Source in the same way through the same place at no
1105+ further charge. You need not require recipients to copy the
1106+ Corresponding Source along with the object code. If the place to
1107+ copy the object code is a network server, the Corresponding Source
1108+ may be on a different server (operated by you or a third party)
1109+ that supports equivalent copying facilities, provided you maintain
1110+ clear directions next to the object code saying where to find the
1111+ Corresponding Source. Regardless of what server hosts the
1112+ Corresponding Source, you remain obligated to ensure that it is
1113+ available for as long as needed to satisfy these requirements.
1114+
1115+ e) Convey the object code using peer-to-peer transmission, provided
1116+ you inform other peers where the object code and Corresponding
1117+ Source of the work are being offered to the general public at no
1118+ charge under subsection 6d.
1119+
1120+ A separable portion of the object code, whose source code is excluded
1121+from the Corresponding Source as a System Library, need not be
1122+included in conveying the object code work.
1123+
1124+ A "User Product" is either (1) a "consumer product", which means any
1125+tangible personal property which is normally used for personal, family,
1126+or household purposes, or (2) anything designed or sold for incorporation
1127+into a dwelling. In determining whether a product is a consumer product,
1128+doubtful cases shall be resolved in favor of coverage. For a particular
1129+product received by a particular user, "normally used" refers to a
1130+typical or common use of that class of product, regardless of the status
1131+of the particular user or of the way in which the particular user
1132+actually uses, or expects or is expected to use, the product. A product
1133+is a consumer product regardless of whether the product has substantial
1134+commercial, industrial or non-consumer uses, unless such uses represent
1135+the only significant mode of use of the product.
1136+
1137+ "Installation Information" for a User Product means any methods,
1138+procedures, authorization keys, or other information required to install
1139+and execute modified versions of a covered work in that User Product from
1140+a modified version of its Corresponding Source. The information must
1141+suffice to ensure that the continued functioning of the modified object
1142+code is in no case prevented or interfered with solely because
1143+modification has been made.
1144+
1145+ If you convey an object code work under this section in, or with, or
1146+specifically for use in, a User Product, and the conveying occurs as
1147+part of a transaction in which the right of possession and use of the
1148+User Product is transferred to the recipient in perpetuity or for a
1149+fixed term (regardless of how the transaction is characterized), the
1150+Corresponding Source conveyed under this section must be accompanied
1151+by the Installation Information. But this requirement does not apply
1152+if neither you nor any third party retains the ability to install
1153+modified object code on the User Product (for example, the work has
1154+been installed in ROM).
1155+
1156+ The requirement to provide Installation Information does not include a
1157+requirement to continue to provide support service, warranty, or updates
1158+for a work that has been modified or installed by the recipient, or for
1159+the User Product in which it has been modified or installed. Access to a
1160+network may be denied when the modification itself materially and
1161+adversely affects the operation of the network or violates the rules and
1162+protocols for communication across the network.
1163+
1164+ Corresponding Source conveyed, and Installation Information provided,
1165+in accord with this section must be in a format that is publicly
1166+documented (and with an implementation available to the public in
1167+source code form), and must require no special password or key for
1168+unpacking, reading or copying.
1169+
1170+ 7. Additional Terms.
1171+
1172+ "Additional permissions" are terms that supplement the terms of this
1173+License by making exceptions from one or more of its conditions.
1174+Additional permissions that are applicable to the entire Program shall
1175+be treated as though they were included in this License, to the extent
1176+that they are valid under applicable law. If additional permissions
1177+apply only to part of the Program, that part may be used separately
1178+under those permissions, but the entire Program remains governed by
1179+this License without regard to the additional permissions.
1180+
1181+ When you convey a copy of a covered work, you may at your option
1182+remove any additional permissions from that copy, or from any part of
1183+it. (Additional permissions may be written to require their own
1184+removal in certain cases when you modify the work.) You may place
1185+additional permissions on material, added by you to a covered work,
1186+for which you have or can give appropriate copyright permission.
1187+
1188+ Notwithstanding any other provision of this License, for material you
1189+add to a covered work, you may (if authorized by the copyright holders of
1190+that material) supplement the terms of this License with terms:
1191+
1192+ a) Disclaiming warranty or limiting liability differently from the
1193+ terms of sections 15 and 16 of this License; or
1194+
1195+ b) Requiring preservation of specified reasonable legal notices or
1196+ author attributions in that material or in the Appropriate Legal
1197+ Notices displayed by works containing it; or
1198+
1199+ c) Prohibiting misrepresentation of the origin of that material, or
1200+ requiring that modified versions of such material be marked in
1201+ reasonable ways as different from the original version; or
1202+
1203+ d) Limiting the use for publicity purposes of names of licensors or
1204+ authors of the material; or
1205+
1206+ e) Declining to grant rights under trademark law for use of some
1207+ trade names, trademarks, or service marks; or
1208+
1209+ f) Requiring indemnification of licensors and authors of that
1210+ material by anyone who conveys the material (or modified versions of
1211+ it) with contractual assumptions of liability to the recipient, for
1212+ any liability that these contractual assumptions directly impose on
1213+ those licensors and authors.
1214+
1215+ All other non-permissive additional terms are considered "further
1216+restrictions" within the meaning of section 10. If the Program as you
1217+received it, or any part of it, contains a notice stating that it is
1218+governed by this License along with a term that is a further
1219+restriction, you may remove that term. If a license document contains
1220+a further restriction but permits relicensing or conveying under this
1221+License, you may add to a covered work material governed by the terms
1222+of that license document, provided that the further restriction does
1223+not survive such relicensing or conveying.
1224+
1225+ If you add terms to a covered work in accord with this section, you
1226+must place, in the relevant source files, a statement of the
1227+additional terms that apply to those files, or a notice indicating
1228+where to find the applicable terms.
1229+
1230+ Additional terms, permissive or non-permissive, may be stated in the
1231+form of a separately written license, or stated as exceptions;
1232+the above requirements apply either way.
1233+
1234+ 8. Termination.
1235+
1236+ You may not propagate or modify a covered work except as expressly
1237+provided under this License. Any attempt otherwise to propagate or
1238+modify it is void, and will automatically terminate your rights under
1239+this License (including any patent licenses granted under the third
1240+paragraph of section 11).
1241+
1242+ However, if you cease all violation of this License, then your
1243+license from a particular copyright holder is reinstated (a)
1244+provisionally, unless and until the copyright holder explicitly and
1245+finally terminates your license, and (b) permanently, if the copyright
1246+holder fails to notify you of the violation by some reasonable means
1247+prior to 60 days after the cessation.
1248+
1249+ Moreover, your license from a particular copyright holder is
1250+reinstated permanently if the copyright holder notifies you of the
1251+violation by some reasonable means, this is the first time you have
1252+received notice of violation of this License (for any work) from that
1253+copyright holder, and you cure the violation prior to 30 days after
1254+your receipt of the notice.
1255+
1256+ Termination of your rights under this section does not terminate the
1257+licenses of parties who have received copies or rights from you under
1258+this License. If your rights have been terminated and not permanently
1259+reinstated, you do not qualify to receive new licenses for the same
1260+material under section 10.
1261+
1262+ 9. Acceptance Not Required for Having Copies.
1263+
1264+ You are not required to accept this License in order to receive or
1265+run a copy of the Program. Ancillary propagation of a covered work
1266+occurring solely as a consequence of using peer-to-peer transmission
1267+to receive a copy likewise does not require acceptance. However,
1268+nothing other than this License grants you permission to propagate or
1269+modify any covered work. These actions infringe copyright if you do
1270+not accept this License. Therefore, by modifying or propagating a
1271+covered work, you indicate your acceptance of this License to do so.
1272+
1273+ 10. Automatic Licensing of Downstream Recipients.
1274+
1275+ Each time you convey a covered work, the recipient automatically
1276+receives a license from the original licensors, to run, modify and
1277+propagate that work, subject to this License. You are not responsible
1278+for enforcing compliance by third parties with this License.
1279+
1280+ An "entity transaction" is a transaction transferring control of an
1281+organization, or substantially all assets of one, or subdividing an
1282+organization, or merging organizations. If propagation of a covered
1283+work results from an entity transaction, each party to that
1284+transaction who receives a copy of the work also receives whatever
1285+licenses to the work the party's predecessor in interest had or could
1286+give under the previous paragraph, plus a right to possession of the
1287+Corresponding Source of the work from the predecessor in interest, if
1288+the predecessor has it or can get it with reasonable efforts.
1289+
1290+ You may not impose any further restrictions on the exercise of the
1291+rights granted or affirmed under this License. For example, you may
1292+not impose a license fee, royalty, or other charge for exercise of
1293+rights granted under this License, and you may not initiate litigation
1294+(including a cross-claim or counterclaim in a lawsuit) alleging that
1295+any patent claim is infringed by making, using, selling, offering for
1296+sale, or importing the Program or any portion of it.
1297+
1298+ 11. Patents.
1299+
1300+ A "contributor" is a copyright holder who authorizes use under this
1301+License of the Program or a work on which the Program is based. The
1302+work thus licensed is called the contributor's "contributor version".
1303+
1304+ A contributor's "essential patent claims" are all patent claims
1305+owned or controlled by the contributor, whether already acquired or
1306+hereafter acquired, that would be infringed by some manner, permitted
1307+by this License, of making, using, or selling its contributor version,
1308+but do not include claims that would be infringed only as a
1309+consequence of further modification of the contributor version. For
1310+purposes of this definition, "control" includes the right to grant
1311+patent sublicenses in a manner consistent with the requirements of
1312 this License.
1313
1314- 7. If, as a consequence of a court judgment or allegation of patent
1315-infringement or for any other reason (not limited to patent issues),
1316-conditions are imposed on you (whether by court order, agreement or
1317+ Each contributor grants you a non-exclusive, worldwide, royalty-free
1318+patent license under the contributor's essential patent claims, to
1319+make, use, sell, offer for sale, import and otherwise run, modify and
1320+propagate the contents of its contributor version.
1321+
1322+ In the following three paragraphs, a "patent license" is any express
1323+agreement or commitment, however denominated, not to enforce a patent
1324+(such as an express permission to practice a patent or covenant not to
1325+sue for patent infringement). To "grant" such a patent license to a
1326+party means to make such an agreement or commitment not to enforce a
1327+patent against the party.
1328+
1329+ If you convey a covered work, knowingly relying on a patent license,
1330+and the Corresponding Source of the work is not available for anyone
1331+to copy, free of charge and under the terms of this License, through a
1332+publicly available network server or other readily accessible means,
1333+then you must either (1) cause the Corresponding Source to be so
1334+available, or (2) arrange to deprive yourself of the benefit of the
1335+patent license for this particular work, or (3) arrange, in a manner
1336+consistent with the requirements of this License, to extend the patent
1337+license to downstream recipients. "Knowingly relying" means you have
1338+actual knowledge that, but for the patent license, your conveying the
1339+covered work in a country, or your recipient's use of the covered work
1340+in a country, would infringe one or more identifiable patents in that
1341+country that you have reason to believe are valid.
1342+
1343+ If, pursuant to or in connection with a single transaction or
1344+arrangement, you convey, or propagate by procuring conveyance of, a
1345+covered work, and grant a patent license to some of the parties
1346+receiving the covered work authorizing them to use, propagate, modify
1347+or convey a specific copy of the covered work, then the patent license
1348+you grant is automatically extended to all recipients of the covered
1349+work and works based on it.
1350+
1351+ A patent license is "discriminatory" if it does not include within
1352+the scope of its coverage, prohibits the exercise of, or is
1353+conditioned on the non-exercise of one or more of the rights that are
1354+specifically granted under this License. You may not convey a covered
1355+work if you are a party to an arrangement with a third party that is
1356+in the business of distributing software, under which you make payment
1357+to the third party based on the extent of your activity of conveying
1358+the work, and under which the third party grants, to any of the
1359+parties who would receive the covered work from you, a discriminatory
1360+patent license (a) in connection with copies of the covered work
1361+conveyed by you (or copies made from those copies), or (b) primarily
1362+for and in connection with specific products or compilations that
1363+contain the covered work, unless you entered into that arrangement,
1364+or that patent license was granted, prior to 28 March 2007.
1365+
1366+ Nothing in this License shall be construed as excluding or limiting
1367+any implied license or other defenses to infringement that may
1368+otherwise be available to you under applicable patent law.
1369+
1370+ 12. No Surrender of Others' Freedom.
1371+
1372+ If conditions are imposed on you (whether by court order, agreement or
1373 otherwise) that contradict the conditions of this License, they do not
1374-excuse you from the conditions of this License. If you cannot
1375-distribute so as to satisfy simultaneously your obligations under this
1376-License and any other pertinent obligations, then as a consequence you
1377-may not distribute the Program at all. For example, if a patent
1378-license would not permit royalty-free redistribution of the Program by
1379-all those who receive copies directly or indirectly through you, then
1380-the only way you could satisfy both it and this License would be to
1381-refrain entirely from distribution of the Program.
1382-
1383-If any portion of this section is held invalid or unenforceable under
1384-any particular circumstance, the balance of the section is intended to
1385-apply and the section as a whole is intended to apply in other
1386-circumstances.
1387-
1388-It is not the purpose of this section to induce you to infringe any
1389-patents or other property right claims or to contest validity of any
1390-such claims; this section has the sole purpose of protecting the
1391-integrity of the free software distribution system, which is
1392-implemented by public license practices. Many people have made
1393-generous contributions to the wide range of software distributed
1394-through that system in reliance on consistent application of that
1395-system; it is up to the author/donor to decide if he or she is willing
1396-to distribute software through any other system and a licensee cannot
1397-impose that choice.
1398-
1399-This section is intended to make thoroughly clear what is believed to
1400-be a consequence of the rest of this License.
1401-\f
1402- 8. If the distribution and/or use of the Program is restricted in
1403-certain countries either by patents or by copyrighted interfaces, the
1404-original copyright holder who places the Program under this License
1405-may add an explicit geographical distribution limitation excluding
1406-those countries, so that distribution is permitted only in or among
1407-countries not thus excluded. In such case, this License incorporates
1408-the limitation as if written in the body of this License.
1409+excuse you from the conditions of this License. If you cannot convey a
1410+covered work so as to satisfy simultaneously your obligations under this
1411+License and any other pertinent obligations, then as a consequence you may
1412+not convey it at all. For example, if you agree to terms that obligate you
1413+to collect a royalty for further conveying from those to whom you convey
1414+the Program, the only way you could satisfy both those terms and this
1415+License would be to refrain entirely from conveying the Program.
1416+
1417+ 13. Use with the GNU Affero General Public License.
1418+
1419+ Notwithstanding any other provision of this License, you have
1420+permission to link or combine any covered work with a work licensed
1421+under version 3 of the GNU Affero General Public License into a single
1422+combined work, and to convey the resulting work. The terms of this
1423+License will continue to apply to the part which is the covered work,
1424+but the special requirements of the GNU Affero General Public License,
1425+section 13, concerning interaction through a network will apply to the
1426+combination as such.
1427+
1428+ 14. Revised Versions of this License.
1429
1430- 9. The Free Software Foundation may publish revised and/or new versions
1431-of the General Public License from time to time. Such new versions will
1432+ The Free Software Foundation may publish revised and/or new versions of
1433+the GNU General Public License from time to time. Such new versions will
1434 be similar in spirit to the present version, but may differ in detail to
1435 address new problems or concerns.
1436
1437-Each version is given a distinguishing version number. If the Program
1438-specifies a version number of this License which applies to it and "any
1439-later version", you have the option of following the terms and conditions
1440-either of that version or of any later version published by the Free
1441-Software Foundation. If the Program does not specify a version number of
1442-this License, you may choose any version ever published by the Free Software
1443-Foundation.
1444-
1445- 10. If you wish to incorporate parts of the Program into other free
1446-programs whose distribution conditions are different, write to the author
1447-to ask for permission. For software which is copyrighted by the Free
1448-Software Foundation, write to the Free Software Foundation; we sometimes
1449-make exceptions for this. Our decision will be guided by the two goals
1450-of preserving the free status of all derivatives of our free software and
1451-of promoting the sharing and reuse of software generally.
1452-
1453- NO WARRANTY
1454-
1455- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
1456-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
1457-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
1458-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
1459-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
1460-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
1461-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
1462-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
1463-REPAIR OR CORRECTION.
1464-
1465- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
1466-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
1467-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
1468-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
1469-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
1470-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
1471-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
1472-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
1473-POSSIBILITY OF SUCH DAMAGES.
1474-
1475- END OF TERMS AND CONDITIONS
1476-\f
1477- Appendix: How to Apply These Terms to Your New Programs
1478+ Each version is given a distinguishing version number. If the
1479+Program specifies that a certain numbered version of the GNU General
1480+Public License "or any later version" applies to it, you have the
1481+option of following the terms and conditions either of that numbered
1482+version or of any later version published by the Free Software
1483+Foundation. If the Program does not specify a version number of the
1484+GNU General Public License, you may choose any version ever published
1485+by the Free Software Foundation.
1486+
1487+ If the Program specifies that a proxy can decide which future
1488+versions of the GNU General Public License can be used, that proxy's
1489+public statement of acceptance of a version permanently authorizes you
1490+to choose that version for the Program.
1491+
1492+ Later license versions may give you additional or different
1493+permissions. However, no additional obligations are imposed on any
1494+author or copyright holder as a result of your choosing to follow a
1495+later version.
1496+
1497+ 15. Disclaimer of Warranty.
1498+
1499+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
1500+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
1501+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
1502+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
1503+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1504+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
1505+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
1506+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
1507+
1508+ 16. Limitation of Liability.
1509+
1510+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
1511+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
1512+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
1513+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
1514+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
1515+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
1516+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
1517+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
1518+SUCH DAMAGES.
1519+
1520+ 17. Interpretation of Sections 15 and 16.
1521+
1522+ If the disclaimer of warranty and limitation of liability provided
1523+above cannot be given local legal effect according to their terms,
1524+reviewing courts shall apply local law that most closely approximates
1525+an absolute waiver of all civil liability in connection with the
1526+Program, unless a warranty or assumption of liability accompanies a
1527+copy of the Program in return for a fee.
1528+
1529+ END OF TERMS AND CONDITIONS
1530+
1531+ How to Apply These Terms to Your New Programs
1532
1533 If you develop a new program, and you want it to be of the greatest
1534 possible use to the public, the best way to achieve this is to make it
1535@@ -287,15 +628,15 @@ free software which everyone can redistr
1536
1537 To do so, attach the following notices to the program. It is safest
1538 to attach them to the start of each source file to most effectively
1539-convey the exclusion of warranty; and each file should have at least
1540+state the exclusion of warranty; and each file should have at least
1541 the "copyright" line and a pointer to where the full notice is found.
1542
1543 <one line to give the program's name and a brief idea of what it does.>
1544- Copyright (C) 19yy <name of author>
1545+ Copyright (C) <year> <name of author>
1546
1547- This program is free software; you can redistribute it and/or modify
1548+ This program is free software: you can redistribute it and/or modify
1549 it under the terms of the GNU General Public License as published by
1550- the Free Software Foundation; either version 2 of the License, or
1551+ the Free Software Foundation, either version 3 of the License, or
1552 (at your option) any later version.
1553
1554 This program is distributed in the hope that it will be useful,
1555@@ -304,36 +645,30 @@ the "copyright" line and a pointer to wh
1556 GNU General Public License for more details.
1557
1558 You should have received a copy of the GNU General Public License
1559- along with this program; if not, write to the Free Software
1560- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
1561+ along with this program. If not, see <http://www.gnu.org/licenses/>.
1562
1563 Also add information on how to contact you by electronic and paper mail.
1564
1565-If the program is interactive, make it output a short notice like this
1566-when it starts in an interactive mode:
1567+ If the program does terminal interaction, make it output a short
1568+notice like this when it starts in an interactive mode:
1569
1570- Gnomovision version 69, Copyright (C) 19yy name of author
1571- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
1572+ <program> Copyright (C) <year> <name of author>
1573+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
1574 This is free software, and you are welcome to redistribute it
1575 under certain conditions; type `show c' for details.
1576
1577 The hypothetical commands `show w' and `show c' should show the appropriate
1578-parts of the General Public License. Of course, the commands you use may
1579-be called something other than `show w' and `show c'; they could even be
1580-mouse-clicks or menu items--whatever suits your program.
1581-
1582-You should also get your employer (if you work as a programmer) or your
1583-school, if any, to sign a "copyright disclaimer" for the program, if
1584-necessary. Here is a sample; alter the names:
1585-
1586- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
1587- `Gnomovision' (which makes passes at compilers) written by James Hacker.
1588-
1589- <signature of Ty Coon>, 1 April 1989
1590- Ty Coon, President of Vice
1591-
1592-This General Public License does not permit incorporating your program into
1593-proprietary programs. If your program is a subroutine library, you may
1594-consider it more useful to permit linking proprietary applications with the
1595-library. If this is what you want to do, use the GNU Library General
1596-Public License instead of this License.
1597+parts of the General Public License. Of course, your program's commands
1598+might be different; for a GUI interface, you would use an "about box".
1599+
1600+ You should also get your employer (if you work as a programmer) or school,
1601+if any, to sign a "copyright disclaimer" for the program, if necessary.
1602+For more information on this, and how to apply and follow the GNU GPL, see
1603+<http://www.gnu.org/licenses/>.
1604+
1605+ The GNU General Public License does not permit incorporating your program
1606+into proprietary programs. If your program is a subroutine library, you
1607+may consider it more useful to permit linking proprietary applications with
1608+the library. If this is what you want to do, use the GNU Lesser General
1609+Public License instead of this License. But first, please read
1610+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
1611Index: gdb-7.2.90.20110703/readline/ChangeLog.gdb
1612===================================================================
1613--- gdb-7.2.90.20110703.orig/readline/ChangeLog.gdb 2011-07-03 10:40:53.000000000 +0200
1614+++ gdb-7.2.90.20110703/readline/ChangeLog.gdb 2011-07-03 10:41:21.000000000 +0200
1615@@ -1,3 +1,12 @@
1616+2011-04-30 Jan Kratochvil <jan.kratochvil@redhat.com>
1617+
1618+ Workaround gdb.base/completion.exp regression on readline-6.2.
1619+ * complete.c (get_y_or_n): Disable the return on RL_STATE_CALLBACK.
1620+
1621+2011-04-25 Jan Kratochvil <jan.kratochvil@redhat.com>
1622+
1623+ Imported readline 6.2, and upstream patch 001.
1624+
1625 2011-06-27 Jan Kratochvil <jan.kratochvil@redhat.com>
1626
1627 Avoid free from a signal handler.
1628Index: gdb-7.2.90.20110703/readline/INSTALL
1629===================================================================
1630--- gdb-7.2.90.20110703.orig/readline/INSTALL 2011-07-03 10:40:53.000000000 +0200
1631+++ gdb-7.2.90.20110703/readline/INSTALL 2011-07-03 10:41:21.000000000 +0200
1632@@ -1,7 +1,7 @@
1633 Basic Installation
1634 ==================
1635
1636-These are installation instructions for Readline-5.1.
1637+These are installation instructions for Readline-6.2.
1638
1639 The simplest way to compile readline is:
1640
1641Index: gdb-7.2.90.20110703/readline/MANIFEST
1642===================================================================
1643--- gdb-7.2.90.20110703.orig/readline/MANIFEST 2011-07-03 10:40:53.000000000 +0200
1644+++ gdb-7.2.90.20110703/readline/MANIFEST 2011-07-03 10:41:21.000000000 +0200
1645@@ -3,6 +3,7 @@
1646 #
1647 doc d
1648 examples d
1649+examples/autoconf d
1650 examples/rlfe d
1651 support d
1652 shlib d
1653@@ -26,6 +27,7 @@ histlib.h f
1654 keymaps.h f
1655 posixdir.h f
1656 posixjmp.h f
1657+posixselect.h f
1658 posixstat.h f
1659 readline.h f
1660 rlconf.h f
1661@@ -69,11 +71,13 @@ undo.c f
1662 util.c f
1663 vi_keymap.c f
1664 vi_mode.c f
1665+xfree.c f
1666 xmalloc.c f
1667 history.c f
1668 histexpand.c f
1669 histfile.c f
1670 histsearch.c f
1671+patchlevel f
1672 shlib/Makefile.in f
1673 support/config.guess f
1674 support/config.rpath f
1675@@ -107,12 +111,16 @@ examples/manexamp.c f
1676 examples/readlinebuf.h f
1677 examples/rl-fgets.c f
1678 examples/rlcat.c f
1679+examples/rlevent.c f
1680 examples/rltest.c f
1681 examples/rl.c f
1682 examples/rlptytest.c f
1683 examples/rlversion.c f
1684 examples/histexamp.c f
1685 examples/Inputrc f
1686+examples/autoconf/BASH_CHECK_LIB_TERMCAP f
1687+examples/autoconf/RL_LIB_READLINE_VERSION f
1688+examples/autoconf/wi_LIB_READLINE f
1689 examples/rlfe/ChangeLog f
1690 examples/rlfe/Makefile.in f
1691 examples/rlfe/README f
1692@@ -124,6 +132,7 @@ examples/rlfe/os.h f
1693 examples/rlfe/pty.c f
1694 examples/rlfe/rlfe.c f
1695 examples/rlfe/screen.h f
1696+examples/rlwrap-0.30.tar.gz f
1697 # formatted documentation, from MANIFEST.doc
1698 doc/readline.ps f
1699 doc/history.ps f
1700Index: gdb-7.2.90.20110703/readline/Makefile.in
1701===================================================================
1702--- gdb-7.2.90.20110703.orig/readline/Makefile.in 2011-07-03 10:40:53.000000000 +0200
1703+++ gdb-7.2.90.20110703/readline/Makefile.in 2011-07-03 10:43:36.000000000 +0200
1704@@ -1,20 +1,20 @@
1705 ## -*- text -*- ##
1706 # Master Makefile for the GNU readline library.
1707-# Copyright (C) 1994-2004 Free Software Foundation, Inc.
1708+# Copyright (C) 1994-2009 Free Software Foundation, Inc.
1709+
1710+# This program is free software: you can redistribute it and/or modify
1711+# it under the terms of the GNU General Public License as published by
1712+# the Free Software Foundation, either version 3 of the License, or
1713+# (at your option) any later version.
1714+
1715+# This program is distributed in the hope that it will be useful,
1716+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1717+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1718+# GNU General Public License for more details.
1719+
1720+# You should have received a copy of the GNU General Public License
1721+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1722
1723-# This program is free software; you can redistribute it and/or modify
1724-# it under the terms of the GNU General Public License as published by
1725-# the Free Software Foundation; either version 2, or (at your option)
1726-# any later version.
1727-
1728-# This program is distributed in the hope that it will be useful,
1729-# but WITHOUT ANY WARRANTY; without even the implied warranty of
1730-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1731-# GNU General Public License for more details.
1732-
1733-# You should have received a copy of the GNU General Public License
1734-# along with this program; if not, write to the Free Software
1735-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
1736 RL_LIBRARY_VERSION = @LIBVERSION@
1737 RL_LIBRARY_NAME = readline
1738
1739@@ -58,7 +58,7 @@ libdir = @libdir@
1740 mandir = @mandir@
1741 includedir = @includedir@
1742 datadir = @datadir@
1743-localedir = $(datadir)/locale
1744+localedir = @localedir@
1745
1746 infodir = @infodir@
1747
1748@@ -68,7 +68,7 @@ man3dir = $(mandir)/man3
1749 DESTDIR =
1750
1751 # Programs to make tags files.
1752-ETAGS = etags -tw
1753+ETAGS = etags
1754 CTAGS = ctags -tw
1755
1756 CFLAGS = @CFLAGS@
1757@@ -100,8 +100,6 @@ GCC_LINT_CFLAGS = $(XCCFLAGS) $(GCC_LINT
1758 LIBRARY_NAME = libreadline.a
1759 STATIC_LIBS = libreadline.a libhistory.a
1760
1761-WCWIDTH_OBJ = @WCWIDTH_OBJ@
1762-
1763 # The C code source files for this library.
1764 CSOURCES = $(srcdir)/readline.c $(srcdir)/funmap.c $(srcdir)/keymaps.c \
1765 $(srcdir)/vi_mode.c $(srcdir)/parens.c $(srcdir)/rltty.c \
1766@@ -109,26 +107,28 @@ CSOURCES = $(srcdir)/readline.c $(srcdir
1767 $(srcdir)/display.c $(srcdir)/signals.c $(srcdir)/emacs_keymap.c \
1768 $(srcdir)/vi_keymap.c $(srcdir)/util.c $(srcdir)/kill.c \
1769 $(srcdir)/undo.c $(srcdir)/macro.c $(srcdir)/input.c \
1770- $(srcdir)/callback.c $(srcdir)/terminal.c $(srcdir)/xmalloc.c \
1771+ $(srcdir)/callback.c $(srcdir)/terminal.c $(srcdir)/xmalloc.c $(srcdir)/xfree.c \
1772 $(srcdir)/history.c $(srcdir)/histsearch.c $(srcdir)/histexpand.c \
1773 $(srcdir)/histfile.c $(srcdir)/nls.c $(srcdir)/search.c \
1774 $(srcdir)/shell.c $(srcdir)/savestring.c $(srcdir)/tilde.c \
1775 $(srcdir)/text.c $(srcdir)/misc.c $(srcdir)/compat.c \
1776- $(srcdir)/mbutil.c $(srcdir)/support/wcwidth.c
1777+ $(srcdir)/mbutil.c
1778
1779 # The header files for this library.
1780-HSOURCES = readline.h rldefs.h chardefs.h keymaps.h history.h histlib.h \
1781- posixstat.h posixdir.h posixjmp.h tilde.h rlconf.h rltty.h \
1782- ansi_stdlib.h tcap.h rlstdc.h xmalloc.h rlprivate.h rlshell.h \
1783- rltypedefs.h rlmbutil.h
1784+HSOURCES = $(srcdir)/readline.h $(srcdir)/rldefs.h $(srcdir)/chardefs.h \
1785+ $(srcdir)/keymaps.h $(srcdir)/history.h $(srcdir)/histlib.h \
1786+ $(srcdir)/posixstat.h $(srcdir)/posixdir.h $(srcdir)/posixjmp.h \
1787+ $(srcdir)/tilde.h $(srcdir)/rlconf.h $(srcdir)/rltty.h \
1788+ $(srcdir)/ansi_stdlib.h $(srcdir)/tcap.h $(srcdir)/rlstdc.h \
1789+ $(srcdir)/xmalloc.h $(srcdir)/rlprivate.h $(srcdir)/rlshell.h \
1790+ $(srcdir)/rltypedefs.h $(srcdir)/rlmbutil.h
1791
1792 HISTOBJ = history.o histexpand.o histfile.o histsearch.o shell.o mbutil.o
1793 TILDEOBJ = tilde.o
1794 OBJECTS = readline.o vi_mode.o funmap.o keymaps.o parens.o search.o \
1795 rltty.o complete.o bind.o isearch.o display.o signals.o \
1796 util.o kill.o undo.o macro.o input.o callback.o terminal.o \
1797- text.o nls.o misc.o compat.o xmalloc.o $(HISTOBJ) $(TILDEOBJ) \
1798- $(WCWIDTH_OBJ)
1799+ text.o nls.o misc.o compat.o xfree.o xmalloc.o $(HISTOBJ) $(TILDEOBJ)
1800
1801 # The texinfo files which document this library.
1802 DOCSOURCE = doc/rlman.texinfo doc/rltech.texinfo doc/rluser.texinfo
1803@@ -159,15 +159,11 @@ libreadline.a: $(OBJECTS)
1804 $(AR) $(ARFLAGS) $@ $(OBJECTS)
1805 -test -n "$(RANLIB)" && $(RANLIB) $@
1806
1807-libhistory.a: $(HISTOBJ) xmalloc.o
1808+libhistory.a: $(HISTOBJ) xmalloc.o xfree.o
1809 $(RM) $@
1810- $(AR) $(ARFLAGS) $@ $(HISTOBJ) xmalloc.o
1811+ $(AR) $(ARFLAGS) $@ $(HISTOBJ) xmalloc.o xfree.o
1812 -test -n "$(RANLIB)" && $(RANLIB) $@
1813
1814-wcwidth.o: $(srcdir)/support/wcwidth.c
1815- $(RM) $@
1816- $(CC) $(CCFLAGS) -c $(srcdir)/support/wcwidth.c
1817-
1818 # Since tilde.c is shared between readline and bash, make sure we compile
1819 # it with the right flags when it's built as part of readline
1820 tilde.o: tilde.c
1821@@ -175,7 +171,7 @@ tilde.o: tilde.c
1822 $(CC) $(CCFLAGS) -DREADLINE_LIBRARY -c $(srcdir)/tilde.c
1823
1824 readline: $(OBJECTS) readline.h rldefs.h chardefs.h ./libreadline.a
1825- $(CC) $(CCFLAGS) -o $@ ./examples/rl.c ./libreadline.a ${TERMCAP_LIB}
1826+ $(CC) $(CCFLAGS) -DREADLINE_LIBRARY -o $@ $(top_srcdir)/examples/rl.c ./libreadline.a ${TERMCAP_LIB}
1827
1828 lint: force
1829 $(MAKE) $(MFLAGS) CCFLAGS='$(GCC_LINT_CFLAGS)' static
1830@@ -200,6 +196,7 @@ stamp-h: config.status $(srcdir)/config.
1831 #$(srcdir)/configure: $(srcdir)/configure.in ## Comment-me-out in distribution
1832 # cd $(srcdir) && autoconf ## Comment-me-out in distribution
1833
1834+
1835 shared: force
1836 -test -d shlib || mkdir shlib
1837 -( cd shlib ; ${MAKE} ${MFLAGS} all )
1838@@ -214,17 +211,6 @@ examples: force
1839
1840 force:
1841
1842-install-headers: installdirs ${INSTALLED_HEADERS}
1843- for f in ${INSTALLED_HEADERS}; do \
1844- $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(includedir)/readline ; \
1845- done
1846-
1847-uninstall-headers:
1848- -test -n "$(includedir)" && cd $(DESTDIR)$(includedir)/readline && \
1849- ${RM} ${INSTALLED_HEADERS}
1850-
1851-maybe-uninstall-headers: uninstall-headers
1852-
1853 ## GDB LOCAL
1854 ## Don't mess with people's installed readline's.
1855 ## This tries to install this version of readline over whatever
1856@@ -237,7 +223,18 @@ install:
1857
1858 #install: $(INSTALL_TARGETS)
1859
1860-install-static: installdirs $(STATIC_LIBS) install-headers install-doc
1861+install-headers: installdirs ${INSTALLED_HEADERS}
1862+ for f in ${INSTALLED_HEADERS}; do \
1863+ $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(includedir)/readline ; \
1864+ done
1865+
1866+uninstall-headers:
1867+ -test -n "$(includedir)" && cd $(DESTDIR)$(includedir)/readline && \
1868+ ${RM} ${INSTALLED_HEADERS}
1869+
1870+maybe-uninstall-headers: uninstall-headers
1871+
1872+install-static: installdirs $(STATIC_LIBS) install-headers install-doc install-examples
1873 -$(MV) $(DESTDIR)$(libdir)/libreadline.a $(DESTDIR)$(libdir)/libreadline.old
1874 $(INSTALL_DATA) libreadline.a $(DESTDIR)$(libdir)/libreadline.a
1875 -test -n "$(RANLIB)" && $(RANLIB) $(DESTDIR)$(libdir)/libreadline.a
1876@@ -250,7 +247,7 @@ installdirs: $(srcdir)/support/mkinstall
1877 $(DESTDIR)$(includedir)/readline $(DESTDIR)$(libdir) \
1878 $(DESTDIR)$(infodir) $(DESTDIR)$(man3dir)
1879
1880-uninstall: uninstall-headers uninstall-doc
1881+uninstall: uninstall-headers uninstall-doc uninstall-examples
1882 -test -n "$(DESTDIR)$(libdir)" && cd $(DESTDIR)$(libdir) && \
1883 ${RM} libreadline.a libreadline.old libhistory.a libhistory.old $(SHARED_LIBS)
1884 -( cd shlib; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} uninstall )
1885@@ -261,6 +258,12 @@ install-shared: installdirs install-head
1886 uninstall-shared: maybe-uninstall-headers
1887 -( cd shlib; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} uninstall )
1888
1889+install-examples: installdirs install-headers shared
1890+ -( cd examples ; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} install )
1891+
1892+uninstall-examples: maybe-uninstall-headers
1893+ -( cd examples; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} uninstall )
1894+
1895 install-doc: installdirs
1896 -( if test -d doc ; then \
1897 cd doc && \
1898@@ -274,10 +277,10 @@ uninstall-doc:
1899 fi )
1900
1901 TAGS: force
1902- $(ETAGS) $(CSOURCES) $(HSOURCES)
1903+ -( cd $(srcdir) && $(ETAGS) $(CSOURCES) $(HSOURCES) )
1904
1905 tags: force
1906- $(CTAGS) $(CSOURCES) $(HSOURCES)
1907+ -( cd $(srcdir) && $(CTAGS) $(CSOURCES) $(HSOURCES) )
1908
1909 clean: force
1910 $(RM) $(OBJECTS) $(STATIC_LIBS)
1911@@ -299,12 +302,14 @@ distclean maintainer-clean: clean
1912 $(RM) $(CREATED_CONFIGURE)
1913 $(RM) $(CREATED_TAGS)
1914
1915-info dvi html pdf:
1916+info dvi html pdf ps:
1917 -( cd doc && $(MAKE) $(MFLAGS) $@ )
1918
1919 install-info:
1920+install-dvi:
1921 install-html:
1922 install-pdf:
1923+install-ps:
1924 check:
1925 installcheck:
1926
1927@@ -417,7 +422,7 @@ vi_mode.o: rldefs.h ${BUILD_DIR}/config.
1928 vi_mode.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
1929 vi_mode.o: history.h ansi_stdlib.h rlstdc.h
1930 xmalloc.o: ${BUILD_DIR}/config.h
1931-xmalloc.o: ansi_stdlib.h readline.h
1932+xmalloc.o: ansi_stdlib.h
1933
1934 bind.o: rlshell.h
1935 histfile.o: rlshell.h
1936@@ -474,6 +479,7 @@ tilde.o: xmalloc.h
1937 undo.o: xmalloc.h
1938 util.o: xmalloc.h
1939 vi_mode.o: xmalloc.h
1940+xfree.o: xmalloc.h readline.h
1941 xmalloc.o: xmalloc.h
1942
1943 complete.o: rlmbutil.h
1944@@ -515,6 +521,7 @@ tilde.o: $(srcdir)/tilde.c
1945 undo.o: $(srcdir)/undo.c
1946 util.o: $(srcdir)/util.c
1947 vi_mode.o: $(srcdir)/vi_mode.c
1948+xfree.o: $(srcdir)/xfree.c
1949 xmalloc.o: $(srcdir)/xmalloc.c
1950
1951 histexpand.o: $(srcdir)/histexpand.c
1952@@ -549,6 +556,7 @@ tilde.o: tilde.c
1953 undo.o: undo.c
1954 util.o: util.c
1955 vi_mode.o: vi_mode.c
1956+xfree.o: xfree.c
1957 xmalloc.o: xmalloc.c
1958
1959 histexpand.o: histexpand.c
1960Index: gdb-7.2.90.20110703/readline/NEWS
1961===================================================================
1962--- gdb-7.2.90.20110703.orig/readline/NEWS 2011-07-03 10:40:53.000000000 +0200
1963+++ gdb-7.2.90.20110703/readline/NEWS 2011-07-03 10:41:21.000000000 +0200
1964@@ -1,32 +1,19 @@
1965-This is a terse description of the new features added to readline-5.1 since
1966-the release of readline-5.0.
1967+This is a terse description of the new features added to readline-6.2 since
1968+the release of readline-6.1.
1969
1970-1. New Features in Readline
1971+a. The history library does not try to write the history filename in the
1972+ current directory if $HOME is unset. This closes a potential security
1973+ problem if the application does not specify a history filename.
1974
1975-a. The key sequence sent by the keypad `delete' key is now automatically
1976- bound to delete-char.
1977+b. New bindable variable `completion-display-width' to set the number of
1978+ columns used when displaying completions.
1979
1980-b. A negative argument to menu-complete now cycles backward through the
1981- completion list.
1982+c. New bindable variable `completion-case-map' to cause case-insensitive
1983+ completion to treat `-' and `_' as identical.
1984
1985-c. A new bindable readline variable: bind-tty-special-chars. If non-zero,
1986- readline will bind the terminal special characters to their readline
1987- equivalents when it's called (on by default).
1988+d. There are new bindable vi-mode command names to avoid readline's case-
1989+ insensitive matching not allowing them to be bound separately.
1990
1991-d. New bindable command: vi-rubout. Saves deleted text for possible
1992- reinsertion, as with any vi-mode `text modification' command; `X' is bound
1993- to this in vi command mode.
1994-
1995-e. If the rl_completion_query_items is set to a value < 0, readline never
1996- asks the user whether or not to view the possible completions.
1997-
1998-f. New application-callable auxiliary function, rl_variable_value, returns
1999- a string corresponding to a readline variable's value.
2000-
2001-g. When parsing inputrc files and variable binding commands, the parser
2002- strips trailing whitespace from values assigned to boolean variables
2003- before checking them.
2004-
2005-h. A new external application-controllable variable that allows the LINES
2006- and COLUMNS environment variables to set the window size regardless of
2007- what the kernel returns.
2008+e. New bindable variable `menu-complete-display-prefix' causes the menu
2009+ completion code to display the common prefix of the possible completions
2010+ before cycling through the list, instead of after.
2011Index: gdb-7.2.90.20110703/readline/README
2012===================================================================
2013--- gdb-7.2.90.20110703.orig/readline/README 2011-07-03 10:40:53.000000000 +0200
2014+++ gdb-7.2.90.20110703/readline/README 2011-07-03 10:41:21.000000000 +0200
2015@@ -1,7 +1,7 @@
2016 Introduction
2017 ============
2018
2019-This is the Gnu Readline library, version 5.1.
2020+This is the Gnu Readline library, version 6.2.
2021
2022 The Readline library provides a set of functions for use by applications
2023 that allow users to edit command lines as they are typed in. Both
2024@@ -16,8 +16,9 @@ may be used without Readline in applicat
2025 capabilities.
2026
2027 The Readline library is free software, distributed under the terms of
2028-the [GNU] General Public License, version 2. For more information, see
2029-the file COPYING.
2030+the [GNU] General Public License as published by the Free Software
2031+Foundation, version 3 of the License. For more information, see the
2032+file COPYING.
2033
2034 To build the library, try typing `./configure', then `make'. The
2035 configuration process is automated, so no further intervention should
2036@@ -183,4 +184,4 @@ list (mirrored to the Usenet newsgroup g
2037 Readline bug reports and fixes.
2038
2039 Chet Ramey
2040-chet@po.cwru.edu
2041+chet.ramey@case.edu
2042Index: gdb-7.2.90.20110703/readline/aclocal.m4
2043===================================================================
2044--- gdb-7.2.90.20110703.orig/readline/aclocal.m4 2011-07-03 10:40:53.000000000 +0200
2045+++ gdb-7.2.90.20110703/readline/aclocal.m4 2011-07-03 10:41:21.000000000 +0200
2046@@ -80,6 +80,9 @@ AC_CACHE_VAL(bash_cv_type_$1,
2047 #if HAVE_INTTYPES_H
2048 #include <inttypes.h>
2049 #endif
2050+#if HAVE_STDINT_H
2051+#include <stdint.h>
2052+#endif
2053 $2
2054 ], bash_cv_type_$1=yes, bash_cv_type_$1=no)])
2055 AC_MSG_RESULT($bash_cv_type_$1)
2056@@ -215,7 +218,7 @@ AC_CACHE_VAL(bash_cv_sys_siglist,
2057 #ifdef HAVE_UNISTD_H
2058 #include <unistd.h>
2059 #endif
2060-#ifndef SYS_SIGLIST_DECLARED
2061+#if !HAVE_DECL_SYS_SIGLIST
2062 extern char *sys_siglist[];
2063 #endif
2064 main()
2065@@ -336,18 +339,18 @@ main()
2066 {
2067 DIR *dir;
2068 int fd, err;
2069-err = mkdir("/tmp/bash-aclocal", 0700);
2070+err = mkdir("bash-aclocal", 0700);
2071 if (err < 0) {
2072 perror("mkdir");
2073 exit(1);
2074 }
2075-unlink("/tmp/bash-aclocal/not_a_directory");
2076-fd = open("/tmp/bash-aclocal/not_a_directory", O_WRONLY|O_CREAT|O_EXCL, 0666);
2077+unlink("bash-aclocal/not_a_directory");
2078+fd = open("bash-aclocal/not_a_directory", O_WRONLY|O_CREAT|O_EXCL, 0666);
2079 write(fd, "\n", 1);
2080 close(fd);
2081-dir = opendir("/tmp/bash-aclocal/not_a_directory");
2082-unlink("/tmp/bash-aclocal/not_a_directory");
2083-rmdir("/tmp/bash-aclocal");
2084+dir = opendir("bash-aclocal/not_a_directory");
2085+unlink("bash-aclocal/not_a_directory");
2086+rmdir("bash-aclocal");
2087 exit (dir == 0);
2088 }], bash_cv_opendir_not_robust=yes,bash_cv_opendir_not_robust=no,
2089 [AC_MSG_WARN(cannot check opendir if cross compiling -- defaulting to no)
2090@@ -531,6 +534,18 @@ AC_DEFINE(RLIMTYPE, rlim_t)
2091 fi
2092 ])
2093
2094+AC_DEFUN(BASH_TYPE_SIG_ATOMIC_T,
2095+[AC_CACHE_CHECK([for sig_atomic_t in signal.h], ac_cv_have_sig_atomic_t,
2096+[AC_TRY_LINK([
2097+#include <signal.h>
2098+],[ sig_atomic_t x; ],
2099+ac_cv_have_sig_atomic_t=yes, ac_cv_have_sig_atomic_t=no)])
2100+if test "$ac_cv_have_sig_atomic_t" = "no"
2101+then
2102+ AC_CHECK_TYPE(sig_atomic_t,int)
2103+fi
2104+])
2105+
2106 AC_DEFUN(BASH_FUNC_LSTAT,
2107 [dnl Cannot use AC_CHECK_FUNCS(lstat) because Linux defines lstat() as an
2108 dnl inline function in <sys/stat.h>.
2109@@ -685,7 +700,7 @@ fi
2110 ])
2111
2112 AC_DEFUN(BASH_FUNC_GETCWD,
2113-[AC_MSG_CHECKING([if getcwd() will dynamically allocate memory])
2114+[AC_MSG_CHECKING([if getcwd() will dynamically allocate memory with 0 size])
2115 AC_CACHE_VAL(bash_cv_getcwd_malloc,
2116 [AC_TRY_RUN([
2117 #include <stdio.h>
2118@@ -933,7 +948,7 @@ AC_DEFINE(HAVE_STRUCT_STAT_ST_BLOCKS)
2119 fi
2120 ])
2121
2122-AC_DEFUN(BASH_CHECK_LIB_TERMCAP,
2123+AC_DEFUN([BASH_CHECK_LIB_TERMCAP],
2124 [
2125 if test "X$bash_cv_termcap_lib" = "X"; then
2126 _bash_needmsg=yes
2127@@ -1423,19 +1438,19 @@ exit (1);
2128 #if defined (NeXT)
2129 exit (1);
2130 #endif
2131-err = mkdir("/tmp/bash-aclocal", 0700);
2132+err = mkdir("bash-aclocal", 0700);
2133 if (err < 0) {
2134 perror ("mkdir");
2135 exit(1);
2136 }
2137-fd = mknod ("/tmp/bash-aclocal/sh-np-autoconf", 0666 | S_IFIFO, 0);
2138+fd = mknod ("bash-aclocal/sh-np-autoconf", 0666 | S_IFIFO, 0);
2139 if (fd == -1) {
2140- rmdir ("/tmp/bash-aclocal");
2141+ rmdir ("bash-aclocal");
2142 exit (1);
2143 }
2144 close(fd);
2145-unlink ("/tmp/bash-aclocal/sh-np-autoconf");
2146-rmdir ("/tmp/bash-aclocal");
2147+unlink ("bash-aclocal/sh-np-autoconf");
2148+rmdir ("bash-aclocal");
2149 exit(0);
2150 }], bash_cv_sys_named_pipes=present, bash_cv_sys_named_pipes=missing,
2151 [AC_MSG_WARN(cannot check for named pipes if cross-compiling -- defaulting to missing)
2152@@ -1540,20 +1555,22 @@ fi
2153 AC_DEFUN(BASH_CHECK_DEV_FD,
2154 [AC_MSG_CHECKING(whether /dev/fd is available)
2155 AC_CACHE_VAL(bash_cv_dev_fd,
2156-[if test -d /dev/fd && test -r /dev/fd/0 < /dev/null; then
2157+[bash_cv_dev_fd=""
2158+if test -d /dev/fd && (exec test -r /dev/fd/0 < /dev/null) ; then
2159 # check for systems like FreeBSD 5 that only provide /dev/fd/[012]
2160- exec 3<&0
2161- if test -r /dev/fd/3; then
2162+ if (exec test -r /dev/fd/3 3</dev/null) ; then
2163 bash_cv_dev_fd=standard
2164 else
2165 bash_cv_dev_fd=absent
2166 fi
2167- exec 3<&-
2168- elif test -d /proc/self/fd && test -r /proc/self/fd/0 < /dev/null; then
2169- bash_cv_dev_fd=whacky
2170- else
2171- bash_cv_dev_fd=absent
2172- fi
2173+fi
2174+if test -z "$bash_cv_dev_fd" ; then
2175+ if test -d /proc/self/fd && (exec test -r /proc/self/fd/0 < /dev/null) ; then
2176+ bash_cv_dev_fd=whacky
2177+ else
2178+ bash_cv_dev_fd=absent
2179+ fi
2180+fi
2181 ])
2182 AC_MSG_RESULT($bash_cv_dev_fd)
2183 if test $bash_cv_dev_fd = "standard"; then
2184@@ -1568,9 +1585,9 @@ fi
2185 AC_DEFUN(BASH_CHECK_DEV_STDIN,
2186 [AC_MSG_CHECKING(whether /dev/stdin stdout stderr are available)
2187 AC_CACHE_VAL(bash_cv_dev_stdin,
2188-[if test -d /dev/fd && test -r /dev/stdin < /dev/null; then
2189+[if test -d /dev/fd && (exec test -r /dev/stdin < /dev/null) ; then
2190 bash_cv_dev_stdin=present
2191- elif test -d /proc/self/fd && test -r /dev/stdin < /dev/null; then
2192+ elif test -d /proc/self/fd && (exec test -r /dev/stdin < /dev/null) ; then
2193 bash_cv_dev_stdin=present
2194 else
2195 bash_cv_dev_stdin=absent
2196@@ -1667,37 +1684,39 @@ fi
2197 dnl
2198 dnl check for availability of multibyte characters and functions
2199 dnl
2200+dnl geez, I wish I didn't have to check for all of this stuff separately
2201+dnl
2202 AC_DEFUN(BASH_CHECK_MULTIBYTE,
2203 [
2204 AC_CHECK_HEADERS(wctype.h)
2205 AC_CHECK_HEADERS(wchar.h)
2206 AC_CHECK_HEADERS(langinfo.h)
2207
2208-AC_CHECK_FUNC(mbsrtowcs, AC_DEFINE(HAVE_MBSRTOWCS))
2209-AC_CHECK_FUNC(mbrtowc, AC_DEFINE(HAVE_MBRTOWC))
2210 AC_CHECK_FUNC(mbrlen, AC_DEFINE(HAVE_MBRLEN))
2211-AC_CHECK_FUNC(wctomb, AC_DEFINE(HAVE_WCTOMB))
2212-AC_CHECK_FUNC(wcwidth, AC_DEFINE(HAVE_WCWIDTH))
2213+AC_CHECK_FUNC(mbscasecmp, AC_DEFINE(HAVE_MBSCMP))
2214+AC_CHECK_FUNC(mbscmp, AC_DEFINE(HAVE_MBSCMP))
2215+AC_CHECK_FUNC(mbsnrtowcs, AC_DEFINE(HAVE_MBSNRTOWCS))
2216+AC_CHECK_FUNC(mbsrtowcs, AC_DEFINE(HAVE_MBSRTOWCS))
2217+
2218+
2219+AC_REPLACE_FUNCS(mbschr)
2220+
2221+AC_CHECK_FUNC(wcrtomb, AC_DEFINE(HAVE_WCRTOMB))
2222+AC_CHECK_FUNC(wcscoll, AC_DEFINE(HAVE_WCSCOLL))
2223 AC_CHECK_FUNC(wcsdup, AC_DEFINE(HAVE_WCSDUP))
2224+AC_CHECK_FUNC(wcwidth, AC_DEFINE(HAVE_WCWIDTH))
2225+AC_CHECK_FUNC(wctype, AC_DEFINE(HAVE_WCTYPE))
2226
2227-if test "$ac_cv_func_wcwidth" = no && test "$ac_cv_header_wchar_h" = yes; then
2228- WCWIDTH_OBJ=wcwidth.o
2229-else
2230- WCWIDTH_OBJ=
2231-fi
2232-AC_SUBST(WCWIDTH_OBJ)
2233+AC_REPLACE_FUNCS(wcswidth)
2234
2235-AC_CACHE_CHECK([for mbstate_t], bash_cv_have_mbstate_t,
2236-[AC_TRY_COMPILE([
2237-#include <wchar.h>], [
2238- mbstate_t ps;
2239- mbstate_t *psp;
2240- psp = (mbstate_t *)0;
2241-], bash_cv_have_mbstate_t=yes, bash_cv_have_mbstate_t=no)])
2242-if test $bash_cv_have_mbstate_t = yes; then
2243+dnl checks for both mbrtowc and mbstate_t
2244+AC_FUNC_MBRTOWC
2245+if test $ac_cv_func_mbrtowc = yes; then
2246 AC_DEFINE(HAVE_MBSTATE_T)
2247 fi
2248
2249+AC_CHECK_FUNCS(iswlower iswupper towlower towupper iswctype)
2250+
2251 AC_CACHE_CHECK([for nl_langinfo and CODESET], bash_cv_langinfo_codeset,
2252 [AC_TRY_LINK(
2253 [#include <langinfo.h>],
2254@@ -1707,6 +1726,50 @@ if test $bash_cv_langinfo_codeset = yes;
2255 AC_DEFINE(HAVE_LANGINFO_CODESET)
2256 fi
2257
2258+dnl check for wchar_t in <wchar.h>
2259+AC_CACHE_CHECK([for wchar_t in wchar.h], bash_cv_type_wchar_t,
2260+[AC_TRY_COMPILE(
2261+[#include <wchar.h>
2262+],
2263+[
2264+ wchar_t foo;
2265+ foo = 0;
2266+], bash_cv_type_wchar_t=yes, bash_cv_type_wchar_t=no)])
2267+if test $bash_cv_type_wchar_t = yes; then
2268+ AC_DEFINE(HAVE_WCHAR_T, 1, [systems should define this type here])
2269+fi
2270+
2271+dnl check for wctype_t in <wctype.h>
2272+AC_CACHE_CHECK([for wctype_t in wctype.h], bash_cv_type_wctype_t,
2273+[AC_TRY_COMPILE(
2274+[#include <wctype.h>],
2275+[
2276+ wctype_t foo;
2277+ foo = 0;
2278+], bash_cv_type_wctype_t=yes, bash_cv_type_wctype_t=no)])
2279+if test $bash_cv_type_wctype_t = yes; then
2280+ AC_DEFINE(HAVE_WCTYPE_T, 1, [systems should define this type here])
2281+fi
2282+
2283+dnl check for wint_t in <wctype.h>
2284+AC_CACHE_CHECK([for wint_t in wctype.h], bash_cv_type_wint_t,
2285+[AC_TRY_COMPILE(
2286+[#include <wctype.h>],
2287+[
2288+ wint_t foo;
2289+ foo = 0;
2290+], bash_cv_type_wint_t=yes, bash_cv_type_wint_t=no)])
2291+if test $bash_cv_type_wint_t = yes; then
2292+ AC_DEFINE(HAVE_WINT_T, 1, [systems should define this type here])
2293+fi
2294+
2295+if test "$am_cv_func_iconv" = yes; then
2296+ OLDLIBS="$LIBS"
2297+ LIBS="$LIBS $LIBICONV"
2298+ AC_CHECK_FUNCS(locale_charset)
2299+ LIBS="$OLDLIBS"
2300+fi
2301+
2302 ])
2303
2304 dnl need: prefix exec_prefix libdir includedir CC TERMCAP_LIB
2305@@ -1714,7 +1777,7 @@ dnl require:
2306 dnl AC_PROG_CC
2307 dnl BASH_CHECK_LIB_TERMCAP
2308
2309-AC_DEFUN(RL_LIB_READLINE_VERSION,
2310+AC_DEFUN([RL_LIB_READLINE_VERSION],
2311 [
2312 AC_REQUIRE([BASH_CHECK_LIB_TERMCAP])
2313
2314@@ -2331,7 +2394,7 @@ AC_DEFUN([AM_INTL_SUBDIR],
2315 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
2316 stdlib.h string.h unistd.h sys/param.h])
2317 AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \
2318-geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \
2319+geteuid getgid getuid mempcpy munmap putenv setenv setlocale localeconv stpcpy \
2320 strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next \
2321 __fsetlocking])
2322
2323@@ -3964,3 +4027,143 @@ AC_DEFUN([jm_AC_TYPE_UNSIGNED_LONG_LONG]
2324 [Define if you have the unsigned long long type.])
2325 fi
2326 ])
2327+
2328+dnl From gnulib
2329+AC_DEFUN([BASH_FUNC_FPURGE],
2330+[
2331+ AC_CHECK_FUNCS_ONCE([fpurge])
2332+ AC_CHECK_FUNCS_ONCE([__fpurge])
2333+ AC_CHECK_DECLS([fpurge], , , [#include <stdio.h>])
2334+])
2335+
2336+AC_DEFUN([BASH_FUNC_SNPRINTF],
2337+[
2338+ AC_CHECK_FUNCS_ONCE([snprintf])
2339+ if test X$ac_cv_func_snprintf = Xyes; then
2340+ AC_CACHE_CHECK([for standard-conformant snprintf], [bash_cv_func_snprintf],
2341+ [AC_TRY_RUN([
2342+#include <stdio.h>
2343+
2344+main()
2345+{
2346+ int n;
2347+ n = snprintf (0, 0, "%s", "0123456");
2348+ exit(n != 7);
2349+}
2350+], bash_cv_func_snprintf=yes, bash_cv_func_snprintf=no,
2351+ [AC_MSG_WARN([cannot check standard snprintf if cross-compiling])
2352+ bash_cv_func_snprintf=yes]
2353+)])
2354+ if test $bash_cv_func_snprintf = no; then
2355+ ac_cv_func_snprintf=no
2356+ fi
2357+ fi
2358+ if test $ac_cv_func_snprintf = no; then
2359+ AC_DEFINE(HAVE_SNPRINTF, 0,
2360+ [Define if you have a standard-conformant snprintf function.])
2361+ fi
2362+])
2363+
2364+AC_DEFUN([BASH_FUNC_VSNPRINTF],
2365+[
2366+ AC_CHECK_FUNCS_ONCE([vsnprintf])
2367+ if test X$ac_cv_func_vsnprintf = Xyes; then
2368+ AC_CACHE_CHECK([for standard-conformant vsnprintf], [bash_cv_func_vsnprintf],
2369+ [AC_TRY_RUN([
2370+#if HAVE_STDARG_H
2371+#include <stdarg.h>
2372+#else
2373+#include <varargs.h>
2374+#endif
2375+#include <stdio.h>
2376+#include <stdlib.h>
2377+
2378+static int
2379+#if HAVE_STDARG_H
2380+foo(const char *fmt, ...)
2381+#else
2382+foo(format, va_alist)
2383+ const char *format;
2384+ va_dcl
2385+#endif
2386+{
2387+ va_list args;
2388+ int n;
2389+
2390+#if HAVE_STDARG_H
2391+ va_start(args, fmt);
2392+#else
2393+ va_start(args);
2394+#endif
2395+ n = vsnprintf(0, 0, fmt, args);
2396+ va_end (args);
2397+ return n;
2398+}
2399+
2400+main()
2401+{
2402+ int n;
2403+ n = foo("%s", "0123456");
2404+ exit(n != 7);
2405+}
2406+], bash_cv_func_vsnprintf=yes, bash_cv_func_vsnprintf=no,
2407+ [AC_MSG_WARN([cannot check standard vsnprintf if cross-compiling])
2408+ bash_cv_func_vsnprintf=yes]
2409+)])
2410+ if test $bash_cv_func_vsnprintf = no; then
2411+ ac_cv_func_vsnprintf=no
2412+ fi
2413+ fi
2414+ if test $ac_cv_func_vsnprintf = no; then
2415+ AC_DEFINE(HAVE_VSNPRINTF, 0,
2416+ [Define if you have a standard-conformant vsnprintf function.])
2417+ fi
2418+])
2419+
2420+AC_DEFUN(BASH_STRUCT_WEXITSTATUS_OFFSET,
2421+[AC_MSG_CHECKING(for offset of exit status in return status from wait)
2422+AC_CACHE_VAL(bash_cv_wexitstatus_offset,
2423+[AC_RUN_IFELSE([
2424+#include <stdlib.h>
2425+#include <unistd.h>
2426+
2427+#include <sys/wait.h>
2428+
2429+main(c, v)
2430+ int c;
2431+ char **v;
2432+{
2433+ pid_t pid, p;
2434+ int s, i, n;
2435+
2436+ s = 0;
2437+ pid = fork();
2438+ if (pid == 0)
2439+ exit (42);
2440+
2441+ /* wait for the process */
2442+ p = wait(&s);
2443+ if (p != pid)
2444+ exit (255);
2445+
2446+ /* crack s */
2447+ for (i = 0; i < (sizeof(s) - 8); i++)
2448+ {
2449+ n = (s >> i) & 0xff;
2450+ if (n == 42)
2451+ exit (i);
2452+ }
2453+
2454+ exit (254);
2455+}
2456+], bash_cv_wexitstatus_offset=0, bash_cv_wexitstatus_offset=$?,
2457+ [AC_MSG_WARN(cannot check WEXITSTATUS offset if cross compiling -- defaulting to 0)
2458+ bash_cv_wexitstatus_offset=0]
2459+)])
2460+if test "$bash_cv_wexitstatus_offset" -gt 32 ; then
2461+ AC_MSG_WARN(bad exit status from test program -- defaulting to 0)
2462+ bash_cv_wexitstatus_offset=0
2463+fi
2464+AC_MSG_RESULT($bash_cv_wexitstatus_offset)
2465+AC_DEFINE_UNQUOTED([WEXITSTATUS_OFFSET], [$bash_cv_wexitstatus_offset], [Offset of exit status in wait status word])
2466+])
2467Index: gdb-7.2.90.20110703/readline/ansi_stdlib.h
2468===================================================================
2469--- gdb-7.2.90.20110703.orig/readline/ansi_stdlib.h 2011-07-03 10:40:53.000000000 +0200
2470+++ gdb-7.2.90.20110703/readline/ansi_stdlib.h 2011-07-03 10:41:21.000000000 +0200
2471@@ -6,19 +6,19 @@
2472
2473 This file is part of GNU Bash, the Bourne Again SHell.
2474
2475- Bash is free software; you can redistribute it and/or modify it under
2476- the terms of the GNU General Public License as published by the Free
2477- Software Foundation; either version 2, or (at your option) any later
2478- version.
2479-
2480- Bash is distributed in the hope that it will be useful, but WITHOUT ANY
2481- WARRANTY; without even the implied warranty of MERCHANTABILITY or
2482- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2483- for more details.
2484-
2485- You should have received a copy of the GNU General Public License along
2486- with Bash; see the file COPYING. If not, write to the Free Software
2487- Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
2488+ Bash is free software: you can redistribute it and/or modify
2489+ it under the terms of the GNU General Public License as published by
2490+ the Free Software Foundation, either version 3 of the License, or
2491+ (at your option) any later version.
2492+
2493+ Bash is distributed in the hope that it will be useful,
2494+ but WITHOUT ANY WARRANTY; without even the implied warranty of
2495+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2496+ GNU General Public License for more details.
2497+
2498+ You should have received a copy of the GNU General Public License
2499+ along with Bash. If not, see <http://www.gnu.org/licenses/>.
2500+*/
2501
2502 #if !defined (_STDLIB_H_)
2503 #define _STDLIB_H_ 1
2504Index: gdb-7.2.90.20110703/readline/bind.c
2505===================================================================
2506--- gdb-7.2.90.20110703.orig/readline/bind.c 2011-07-03 10:40:53.000000000 +0200
2507+++ gdb-7.2.90.20110703/readline/bind.c 2011-07-03 10:41:21.000000000 +0200
2508@@ -1,24 +1,23 @@
2509 /* bind.c -- key binding and startup file support for the readline library. */
2510
2511-/* Copyright (C) 1987-2005 Free Software Foundation, Inc.
2512+/* Copyright (C) 1987-2010 Free Software Foundation, Inc.
2513
2514- This file is part of the GNU Readline Library, a library for
2515- reading lines of text with interactive input and history editing.
2516+ This file is part of the GNU Readline Library (Readline), a library
2517+ for reading lines of text with interactive input and history editing.
2518
2519- The GNU Readline Library is free software; you can redistribute it
2520- and/or modify it under the terms of the GNU General Public License
2521- as published by the Free Software Foundation; either version 2, or
2522+ Readline is free software: you can redistribute it and/or modify
2523+ it under the terms of the GNU General Public License as published by
2524+ the Free Software Foundation, either version 3 of the License, or
2525 (at your option) any later version.
2526
2527- The GNU Readline Library is distributed in the hope that it will be
2528- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
2529- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2530+ Readline is distributed in the hope that it will be useful,
2531+ but WITHOUT ANY WARRANTY; without even the implied warranty of
2532+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2533 GNU General Public License for more details.
2534
2535- The GNU General Public License is often shipped with GNU software, and
2536- is generally kept in a file called COPYING or LICENSE. If you do not
2537- have a copy of the license, write to the Free Software Foundation,
2538- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
2539+ You should have received a copy of the GNU General Public License
2540+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
2541+*/
2542
2543 #define READLINE_LIBRARY
2544
2545@@ -80,7 +79,7 @@ static int glean_key_from_name PARAMS((c
2546 static int find_boolean_var PARAMS((const char *));
2547
2548 static char *_rl_get_string_variable_value PARAMS((const char *));
2549-static int substring_member_of_array PARAMS((char *, const char **));
2550+static int substring_member_of_array PARAMS((const char *, const char * const *));
2551
2552 static int currently_reading_init_file;
2553
2554@@ -317,7 +316,7 @@ rl_macro_bind (keyseq, macro, map)
2555
2556 if (rl_translate_keyseq (macro, macro_keys, &macro_keys_len))
2557 {
2558- free (macro_keys);
2559+ xfree (macro_keys);
2560 return -1;
2561 }
2562 rl_generic_bind (ISMACR, keyseq, macro_keys, map);
2563@@ -347,7 +346,7 @@ rl_generic_bind (type, keyseq, data, map
2564 if (keyseq == 0 || *keyseq == 0)
2565 {
2566 if (type == ISMACR)
2567- free (data);
2568+ xfree (data);
2569 return -1;
2570 }
2571
2572@@ -358,7 +357,7 @@ rl_generic_bind (type, keyseq, data, map
2573 KEYS into KEYS_LEN. */
2574 if (rl_translate_keyseq (keyseq, keys, &keys_len))
2575 {
2576- free (keys);
2577+ xfree (keys);
2578 return -1;
2579 }
2580
2581@@ -370,7 +369,10 @@ rl_generic_bind (type, keyseq, data, map
2582
2583 ic = uc;
2584 if (ic < 0 || ic >= KEYMAP_SIZE)
2585- return -1;
2586+ {
2587+ xfree (keys);
2588+ return -1;
2589+ }
2590
2591 if (META_CHAR (ic) && _rl_convert_meta_chars_to_ascii)
2592 {
2593@@ -411,11 +413,18 @@ rl_generic_bind (type, keyseq, data, map
2594 else
2595 {
2596 if (map[ic].type == ISMACR)
2597- free ((char *)map[ic].function);
2598+ xfree ((char *)map[ic].function);
2599 else if (map[ic].type == ISKMAP)
2600 {
2601 map = FUNCTION_TO_KEYMAP (map, ic);
2602 ic = ANYOTHERKEY;
2603+ /* If we're trying to override a keymap with a null function
2604+ (e.g., trying to unbind it), we can't use a null pointer
2605+ here because that's indistinguishable from having not been
2606+ overridden. We use a special bindable function that does
2607+ nothing. */
2608+ if (type == ISFUNC && data == 0)
2609+ data = (char *)_rl_null_function;
2610 }
2611
2612 map[ic].function = KEYMAP_TO_FUNCTION (data);
2613@@ -424,7 +433,7 @@ rl_generic_bind (type, keyseq, data, map
2614
2615 rl_binding_keymap = map;
2616 }
2617- free (keys);
2618+ xfree (keys);
2619 return 0;
2620 }
2621
2622@@ -462,12 +471,21 @@ rl_translate_keyseq (seq, array, len)
2623 }
2624 else if (c == 'M')
2625 {
2626- i++;
2627- /* XXX - should obey convert-meta setting? */
2628+ i++; /* seq[i] == '-' */
2629+ /* XXX - obey convert-meta setting */
2630 if (_rl_convert_meta_chars_to_ascii && _rl_keymap[ESC].type == ISKMAP)
2631 array[l++] = ESC; /* ESC is meta-prefix */
2632+ else if (seq[i+1] == '\\' && seq[i+2] == 'C' && seq[i+3] == '-')
2633+ {
2634+ i += 4;
2635+ temp = (seq[i] == '?') ? RUBOUT : CTRL (_rl_to_upper (seq[i]));
2636+ array[l++] = META (temp);
2637+ }
2638 else
2639 {
2640+ /* This doesn't yet handle things like \M-\a, which may
2641+ or may not have any reasonable meaning. You're
2642+ probably better off using straight octal or hex. */
2643 i++;
2644 array[l++] = META (seq[i]);
2645 }
2646@@ -565,6 +583,11 @@ rl_untranslate_keyseq (seq)
2647 kseq[i++] = '-';
2648 c = UNMETA (c);
2649 }
2650+ else if (c == ESC)
2651+ {
2652+ kseq[i++] = '\\';
2653+ c = 'e';
2654+ }
2655 else if (CTRL_CHAR (c))
2656 {
2657 kseq[i++] = '\\';
2658@@ -613,7 +636,12 @@ _rl_untranslate_macro_value (seq)
2659 *r++ = '-';
2660 c = UNMETA (c);
2661 }
2662- else if (CTRL_CHAR (c) && c != ESC)
2663+ else if (c == ESC)
2664+ {
2665+ *r++ = '\\';
2666+ c = 'e';
2667+ }
2668+ else if (CTRL_CHAR (c))
2669 {
2670 *r++ = '\\';
2671 *r++ = 'C';
2672@@ -672,7 +700,7 @@ rl_function_of_keyseq (keyseq, map, type
2673 {
2674 register int i;
2675
2676- if (!map)
2677+ if (map == 0)
2678 map = _rl_keymap;
2679
2680 for (i = 0; keyseq && keyseq[i]; i++)
2681@@ -681,25 +709,27 @@ rl_function_of_keyseq (keyseq, map, type
2682
2683 if (META_CHAR (ic) && _rl_convert_meta_chars_to_ascii)
2684 {
2685- if (map[ESC].type != ISKMAP)
2686+ if (map[ESC].type == ISKMAP)
2687+ {
2688+ map = FUNCTION_TO_KEYMAP (map, ESC);
2689+ ic = UNMETA (ic);
2690+ }
2691+ /* XXX - should we just return NULL here, since this obviously
2692+ doesn't match? */
2693+ else
2694 {
2695 if (type)
2696 *type = map[ESC].type;
2697
2698 return (map[ESC].function);
2699 }
2700- else
2701- {
2702- map = FUNCTION_TO_KEYMAP (map, ESC);
2703- ic = UNMETA (ic);
2704- }
2705 }
2706
2707 if (map[ic].type == ISKMAP)
2708 {
2709 /* If this is the last key in the key sequence, return the
2710 map. */
2711- if (!keyseq[i + 1])
2712+ if (keyseq[i + 1] == '\0')
2713 {
2714 if (type)
2715 *type = ISKMAP;
2716@@ -709,7 +739,12 @@ rl_function_of_keyseq (keyseq, map, type
2717 else
2718 map = FUNCTION_TO_KEYMAP (map, ic);
2719 }
2720- else
2721+ /* If we're not at the end of the key sequence, and the current key
2722+ is bound to something other than a keymap, then the entire key
2723+ sequence is not bound. */
2724+ else if (map[ic].type != ISKMAP && keyseq[i+1])
2725+ return ((rl_command_func_t *)NULL);
2726+ else /* map[ic].type != ISKMAP && keyseq[i+1] == 0 */
2727 {
2728 if (type)
2729 *type = map[ic].type;
2730@@ -764,10 +799,12 @@ _rl_read_file (filename, sizep)
2731
2732 if (i < 0)
2733 {
2734- free (buffer);
2735+ xfree (buffer);
2736 return ((char *)NULL);
2737 }
2738
2739+ RL_CHECK_SIGNALS ();
2740+
2741 buffer[i] = '\0';
2742 if (sizep)
2743 *sizep = i;
2744@@ -791,6 +828,7 @@ rl_re_read_init_file (count, ignore)
2745 1. the filename used for the previous call
2746 2. the value of the shell variable `INPUTRC'
2747 3. ~/.inputrc
2748+ 4. /etc/inputrc
2749 If the file existed and could be opened and read, 0 is returned,
2750 otherwise errno is returned. */
2751 int
2752@@ -799,17 +837,18 @@ rl_read_init_file (filename)
2753 {
2754 /* Default the filename. */
2755 if (filename == 0)
2756+ filename = last_readline_init_file;
2757+ if (filename == 0)
2758+ filename = sh_get_env_value ("INPUTRC");
2759+ if (filename == 0 || *filename == 0)
2760 {
2761- filename = last_readline_init_file;
2762- if (filename == 0)
2763- filename = sh_get_env_value ("INPUTRC");
2764- if (filename == 0)
2765- filename = DEFAULT_INPUTRC;
2766+ filename = DEFAULT_INPUTRC;
2767+ /* Try to read DEFAULT_INPUTRC; fall back to SYS_INPUTRC on failure */
2768+ if (_rl_read_init_file (filename, 0) == 0)
2769+ return 0;
2770+ filename = SYS_INPUTRC;
2771 }
2772
2773- if (*filename == 0)
2774- filename = DEFAULT_INPUTRC;
2775-
2776 #if defined (__MSDOS__)
2777 if (_rl_read_init_file (filename, 0) == 0)
2778 return 0;
2779@@ -832,8 +871,9 @@ _rl_read_init_file (filename, include_le
2780
2781 openname = tilde_expand (filename);
2782 buffer = _rl_read_file (openname, &file_size);
2783- free (openname);
2784+ xfree (openname);
2785
2786+ RL_CHECK_SIGNALS ();
2787 if (buffer == 0)
2788 return (errno);
2789
2790@@ -880,7 +920,7 @@ _rl_read_init_file (filename, include_le
2791 current_readline_init_lineno++;
2792 }
2793
2794- free (buffer);
2795+ xfree (buffer);
2796 currently_reading_init_file = 0;
2797 return (0);
2798 }
2799@@ -890,10 +930,10 @@ _rl_init_file_error (msg)
2800 const char *msg;
2801 {
2802 if (currently_reading_init_file)
2803- fprintf (stderr, "readline: %s: line %d: %s\n", current_readline_init_file,
2804+ _rl_errmsg ("%s: line %d: %s\n", current_readline_init_file,
2805 current_readline_init_lineno, msg);
2806 else
2807- fprintf (stderr, "readline: %s\n", msg);
2808+ _rl_errmsg ("%s", msg);
2809 }
2810
2811 /* **************************************************************** */
2812@@ -905,11 +945,11 @@ _rl_init_file_error (msg)
2813 typedef int _rl_parser_func_t PARAMS((char *));
2814
2815 /* Things that mean `Control'. */
2816-const char *_rl_possible_control_prefixes[] = {
2817+const char * const _rl_possible_control_prefixes[] = {
2818 "Control-", "C-", "CTRL-", (const char *)NULL
2819 };
2820
2821-const char *_rl_possible_meta_prefixes[] = {
2822+const char * const _rl_possible_meta_prefixes[] = {
2823 "Meta", "M-", (const char *)NULL
2824 };
2825
2826@@ -971,7 +1011,7 @@ parser_if (args)
2827 `$if term=sun-cmd' into their .inputrc. */
2828 _rl_parsing_conditionalized_out = _rl_stricmp (args + 5, tname) &&
2829 _rl_stricmp (args + 5, rl_terminal_name);
2830- free (tname);
2831+ xfree (tname);
2832 }
2833 #if defined (VI_MODE)
2834 else if (_rl_strnicmp (args, "mode=", 5) == 0)
2835@@ -1068,8 +1108,8 @@ parser_include (args)
2836 }
2837
2838 /* Associate textual names with actual functions. */
2839-static struct {
2840- const char *name;
2841+static const struct {
2842+ const char * const name;
2843 _rl_parser_func_t *function;
2844 } parser_directives [] = {
2845 { "if", parser_if },
2846@@ -1321,7 +1361,7 @@ rl_parse_and_bind (string)
2847 else
2848 rl_bind_keyseq (seq, rl_named_function (funname));
2849
2850- free (seq);
2851+ xfree (seq);
2852 return 0;
2853 }
2854
2855@@ -1375,8 +1415,8 @@ rl_parse_and_bind (string)
2856
2857 #define V_SPECIAL 0x1
2858
2859-static struct {
2860- const char *name;
2861+static const struct {
2862+ const char * const name;
2863 int *value;
2864 int flags;
2865 } boolean_varlist [] = {
2866@@ -1384,9 +1424,12 @@ static struct {
2867 { "blink-matching-paren", &rl_blink_matching_paren, V_SPECIAL },
2868 { "byte-oriented", &rl_byte_oriented, 0 },
2869 { "completion-ignore-case", &_rl_completion_case_fold, 0 },
2870+ { "completion-map-case", &_rl_completion_case_map, 0 },
2871 { "convert-meta", &_rl_convert_meta_chars_to_ascii, 0 },
2872 { "disable-completion", &rl_inhibit_completion, 0 },
2873+ { "echo-control-characters", &_rl_echo_control_chars, 0 },
2874 { "enable-keypad", &_rl_enable_keypad, 0 },
2875+ { "enable-meta-key", &_rl_enable_meta, 0 },
2876 { "expand-tilde", &rl_complete_with_tilde_expansion, 0 },
2877 { "history-preserve-point", &_rl_history_preserve_point, 0 },
2878 { "horizontal-scroll-mode", &_rl_horizontal_scroll_mode, 0 },
2879@@ -1395,17 +1438,20 @@ static struct {
2880 { "mark-modified-lines", &_rl_mark_modified_lines, 0 },
2881 { "mark-symlinked-directories", &_rl_complete_mark_symlink_dirs, 0 },
2882 { "match-hidden-files", &_rl_match_hidden_files, 0 },
2883+ { "menu-complete-display-prefix", &_rl_menu_complete_prefix_first, 0 },
2884 { "meta-flag", &_rl_meta_flag, 0 },
2885 { "output-meta", &_rl_output_meta_chars, 0 },
2886 { "page-completions", &_rl_page_completions, 0 },
2887 { "prefer-visible-bell", &_rl_prefer_visible_bell, V_SPECIAL },
2888 { "print-completions-horizontally", &_rl_print_completions_horizontally, 0 },
2889+ { "revert-all-at-newline", &_rl_revert_all_at_newline, 0 },
2890 { "show-all-if-ambiguous", &_rl_complete_show_all, 0 },
2891 { "show-all-if-unmodified", &_rl_complete_show_unmodified, 0 },
2892+ { "skip-completed-text", &_rl_skip_completed_text, 0 },
2893 #if defined (VISIBLE_STATS)
2894 { "visible-stats", &rl_visible_stats, 0 },
2895 #endif /* VISIBLE_STATS */
2896- { (char *)NULL, (int *)NULL }
2897+ { (char *)NULL, (int *)NULL, 0 }
2898 };
2899
2900 static int
2901@@ -1458,23 +1504,29 @@ typedef int _rl_sv_func_t PARAMS((const
2902 /* Forward declarations */
2903 static int sv_bell_style PARAMS((const char *));
2904 static int sv_combegin PARAMS((const char *));
2905+static int sv_dispprefix PARAMS((const char *));
2906 static int sv_compquery PARAMS((const char *));
2907+static int sv_compwidth PARAMS((const char *));
2908 static int sv_editmode PARAMS((const char *));
2909+static int sv_histsize PARAMS((const char *));
2910 static int sv_isrchterm PARAMS((const char *));
2911 static int sv_keymap PARAMS((const char *));
2912
2913-static struct {
2914- const char *name;
2915+static const struct {
2916+ const char * const name;
2917 int flags;
2918 _rl_sv_func_t *set_func;
2919 } string_varlist[] = {
2920 { "bell-style", V_STRING, sv_bell_style },
2921 { "comment-begin", V_STRING, sv_combegin },
2922+ { "completion-display-width", V_INT, sv_compwidth },
2923+ { "completion-prefix-display-length", V_INT, sv_dispprefix },
2924 { "completion-query-items", V_INT, sv_compquery },
2925 { "editing-mode", V_STRING, sv_editmode },
2926+ { "history-size", V_INT, sv_histsize },
2927 { "isearch-terminators", V_STRING, sv_isrchterm },
2928 { "keymap", V_STRING, sv_keymap },
2929- { (char *)NULL, 0 }
2930+ { (char *)NULL, 0, (_rl_sv_func_t *)0 }
2931 };
2932
2933 static int
2934@@ -1506,8 +1558,6 @@ rl_variable_value (name)
2935 const char *name;
2936 {
2937 register int i;
2938- int v;
2939- char *ret;
2940
2941 /* Check for simple variables first. */
2942 i = find_boolean_var (name);
2943@@ -1585,6 +1635,22 @@ sv_combegin (value)
2944 }
2945
2946 static int
2947+sv_dispprefix (value)
2948+ const char *value;
2949+{
2950+ int nval = 0;
2951+
2952+ if (value && *value)
2953+ {
2954+ nval = atoi (value);
2955+ if (nval < 0)
2956+ nval = 0;
2957+ }
2958+ _rl_completion_prefix_display_length = nval;
2959+ return 0;
2960+}
2961+
2962+static int
2963 sv_compquery (value)
2964 const char *value;
2965 {
2966@@ -1601,6 +1667,35 @@ sv_compquery (value)
2967 }
2968
2969 static int
2970+sv_compwidth (value)
2971+ const char *value;
2972+{
2973+ int nval = -1;
2974+
2975+ if (value && *value)
2976+ nval = atoi (value);
2977+
2978+ _rl_completion_columns = nval;
2979+ return 0;
2980+}
2981+
2982+static int
2983+sv_histsize (value)
2984+ const char *value;
2985+{
2986+ int nval = 500;
2987+
2988+ if (value && *value)
2989+ {
2990+ nval = atoi (value);
2991+ if (nval < 0)
2992+ return 1;
2993+ }
2994+ stifle_history (nval);
2995+ return 0;
2996+}
2997+
2998+static int
2999 sv_keymap (value)
3000 const char *value;
3001 {
3002@@ -1664,7 +1759,7 @@ sv_isrchterm (value)
3003 rl_translate_keyseq (v + beg, _rl_isearch_terminators, &end);
3004 _rl_isearch_terminators[end] = '\0';
3005
3006- free (v);
3007+ xfree (v);
3008 return 0;
3009 }
3010
3011@@ -1672,11 +1767,11 @@ sv_isrchterm (value)
3012 For example, `Space' returns ' '. */
3013
3014 typedef struct {
3015- const char *name;
3016+ const char * const name;
3017 int value;
3018 } assoc_list;
3019
3020-static assoc_list name_key_alist[] = {
3021+static const assoc_list name_key_alist[] = {
3022 { "DEL", 0x7f },
3023 { "ESC", '\033' },
3024 { "Escape", '\033' },
3025@@ -1705,8 +1800,8 @@ glean_key_from_name (name)
3026 }
3027
3028 /* Auxiliary functions to manage keymaps. */
3029-static struct {
3030- const char *name;
3031+static const struct {
3032+ const char * const name;
3033 Keymap map;
3034 } keymap_names[] = {
3035 { "emacs", emacs_standard_keymap },
3036@@ -1809,7 +1904,7 @@ rl_list_funmap_names ()
3037 for (i = 0; funmap_names[i]; i++)
3038 fprintf (rl_outstream, "%s\n", funmap_names[i]);
3039
3040- free (funmap_names);
3041+ xfree (funmap_names);
3042 }
3043
3044 static char *
3045@@ -1948,12 +2043,16 @@ rl_invoking_keyseqs_in_map (function, ma
3046 char *keyname = (char *)xmalloc (6 + strlen (seqs[i]));
3047
3048 if (key == ESC)
3049-#if 0
3050- sprintf (keyname, "\\e");
3051-#else
3052- /* XXX - experimental */
3053- sprintf (keyname, "\\M-");
3054-#endif
3055+ {
3056+ /* If ESC is the meta prefix and we're converting chars
3057+ with the eighth bit set to ESC-prefixed sequences, then
3058+ we can use \M-. Otherwise we need to use the sequence
3059+ for ESC. */
3060+ if (_rl_convert_meta_chars_to_ascii && map[ESC].type == ISKMAP)
3061+ sprintf (keyname, "\\M-");
3062+ else
3063+ sprintf (keyname, "\\e");
3064+ }
3065 else if (CTRL_CHAR (key))
3066 sprintf (keyname, "\\C-%c", _rl_to_lower (UNCTRL (key)));
3067 else if (key == RUBOUT)
3068@@ -1971,7 +2070,7 @@ rl_invoking_keyseqs_in_map (function, ma
3069 }
3070
3071 strcat (keyname, seqs[i]);
3072- free (seqs[i]);
3073+ xfree (seqs[i]);
3074
3075 if (result_index + 2 > result_size)
3076 {
3077@@ -1983,7 +2082,7 @@ rl_invoking_keyseqs_in_map (function, ma
3078 result[result_index] = (char *)NULL;
3079 }
3080
3081- free (seqs);
3082+ xfree (seqs);
3083 }
3084 break;
3085 }
3086@@ -2035,10 +2134,10 @@ rl_function_dumper (print_readably)
3087 {
3088 fprintf (rl_outstream, "\"%s\": %s\n",
3089 invokers[j], name);
3090- free (invokers[j]);
3091+ xfree (invokers[j]);
3092 }
3093
3094- free (invokers);
3095+ xfree (invokers);
3096 }
3097 }
3098 else
3099@@ -2062,9 +2161,9 @@ rl_function_dumper (print_readably)
3100 fprintf (rl_outstream, "...\n");
3101
3102 for (j = 0; invokers[j]; j++)
3103- free (invokers[j]);
3104+ xfree (invokers[j]);
3105
3106- free (invokers);
3107+ xfree (invokers);
3108 }
3109 }
3110 }
3111@@ -2111,8 +2210,8 @@ _rl_macro_dumper_internal (print_readabl
3112 fprintf (rl_outstream, "%s%s outputs %s\n", prefix ? prefix : "",
3113 keyname,
3114 out ? out : "");
3115- free (keyname);
3116- free (out);
3117+ xfree (keyname);
3118+ xfree (out);
3119 break;
3120 case ISFUNC:
3121 break;
3122@@ -2135,13 +2234,13 @@ _rl_macro_dumper_internal (print_readabl
3123 out = (char *)xmalloc (strlen (keyname) + prefix_len + 1);
3124 strcpy (out, prefix);
3125 strcpy (out + prefix_len, keyname);
3126- free (keyname);
3127+ xfree (keyname);
3128 keyname = out;
3129 }
3130 }
3131
3132 _rl_macro_dumper_internal (print_readably, FUNCTION_TO_KEYMAP (map, key), keyname);
3133- free (keyname);
3134+ xfree (keyname);
3135 break;
3136 }
3137 }
3138@@ -2171,7 +2270,6 @@ _rl_get_string_variable_value (name)
3139 {
3140 static char numbuf[32];
3141 char *ret;
3142- int n;
3143
3144 if (_rl_stricmp (name, "bell-style") == 0)
3145 {
3146@@ -2188,6 +2286,16 @@ _rl_get_string_variable_value (name)
3147 }
3148 else if (_rl_stricmp (name, "comment-begin") == 0)
3149 return (_rl_comment_begin ? _rl_comment_begin : RL_COMMENT_BEGIN_DEFAULT);
3150+ else if (_rl_stricmp (name, "completion-display-width") == 0)
3151+ {
3152+ sprintf (numbuf, "%d", _rl_completion_columns);
3153+ return (numbuf);
3154+ }
3155+ else if (_rl_stricmp (name, "completion-prefix-display-length") == 0)
3156+ {
3157+ sprintf (numbuf, "%d", _rl_completion_prefix_display_length);
3158+ return (numbuf);
3159+ }
3160 else if (_rl_stricmp (name, "completion-query-items") == 0)
3161 {
3162 sprintf (numbuf, "%d", rl_completion_query_items);
3163@@ -2195,6 +2303,11 @@ _rl_get_string_variable_value (name)
3164 }
3165 else if (_rl_stricmp (name, "editing-mode") == 0)
3166 return (rl_get_keymap_name_from_edit_mode ());
3167+ else if (_rl_stricmp (name, "history-size") == 0)
3168+ {
3169+ sprintf (numbuf, "%d", history_is_stifled() ? history_max_entries : 0);
3170+ return (numbuf);
3171+ }
3172 else if (_rl_stricmp (name, "isearch-terminators") == 0)
3173 {
3174 if (_rl_isearch_terminators == 0)
3175@@ -2203,7 +2316,7 @@ _rl_get_string_variable_value (name)
3176 if (ret)
3177 {
3178 strncpy (numbuf, ret, sizeof (numbuf) - 1);
3179- free (ret);
3180+ xfree (ret);
3181 numbuf[sizeof(numbuf) - 1] = '\0';
3182 }
3183 else
3184@@ -2267,8 +2380,8 @@ rl_dump_variables (count, key)
3185 /* Return non-zero if any members of ARRAY are a substring in STRING. */
3186 static int
3187 substring_member_of_array (string, array)
3188- char *string;
3189- const char **array;
3190+ const char *string;
3191+ const char * const *array;
3192 {
3193 while (*array)
3194 {
3195Index: gdb-7.2.90.20110703/readline/callback.c
3196===================================================================
3197--- gdb-7.2.90.20110703.orig/readline/callback.c 2011-07-03 10:40:53.000000000 +0200
3198+++ gdb-7.2.90.20110703/readline/callback.c 2011-07-03 10:41:21.000000000 +0200
3199@@ -1,24 +1,24 @@
3200 /* callback.c -- functions to use readline as an X `callback' mechanism. */
3201
3202-/* Copyright (C) 1987-2005 Free Software Foundation, Inc.
3203+/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
3204
3205- This file is part of the GNU Readline Library, a library for
3206- reading lines of text with interactive input and history editing.
3207+ This file is part of the GNU Readline Library (Readline), a library
3208+ for reading lines of text with interactive input and history editing.
3209
3210- The GNU Readline Library is free software; you can redistribute it
3211- and/or modify it under the terms of the GNU General Public License
3212- as published by the Free Software Foundation; either version 2, or
3213+ Readline is free software: you can redistribute it and/or modify
3214+ it under the terms of the GNU General Public License as published by
3215+ the Free Software Foundation, either version 3 of the License, or
3216 (at your option) any later version.
3217
3218- The GNU Readline Library is distributed in the hope that it will be
3219- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
3220- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3221+ Readline is distributed in the hope that it will be useful,
3222+ but WITHOUT ANY WARRANTY; without even the implied warranty of
3223+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3224 GNU General Public License for more details.
3225
3226- The GNU General Public License is often shipped with GNU software, and
3227- is generally kept in a file called COPYING or LICENSE. If you do not
3228- have a copy of the license, write to the Free Software Foundation,
3229- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
3230+ You should have received a copy of the GNU General Public License
3231+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
3232+*/
3233+
3234 #define READLINE_LIBRARY
3235
3236 #if defined (HAVE_CONFIG_H)
3237@@ -87,6 +87,7 @@ _rl_callback_newline ()
3238 }
3239
3240 readline_internal_setup ();
3241+ RL_CHECK_SIGNALS ();
3242 }
3243
3244 /* Install a readline handler, set up the terminal, and issue the prompt. */
3245@@ -111,87 +112,101 @@ rl_callback_read_char ()
3246
3247 if (rl_linefunc == NULL)
3248 {
3249- fprintf (stderr, "readline: readline_callback_read_char() called with no handler!\r\n");
3250+ _rl_errmsg ("readline_callback_read_char() called with no handler!");
3251 abort ();
3252 }
3253
3254- memcpy ((void *)olevel, (void *)readline_top_level, sizeof (procenv_t));
3255- jcode = setjmp (readline_top_level);
3256+ memcpy ((void *)olevel, (void *)_rl_top_level, sizeof (procenv_t));
3257+ jcode = setjmp (_rl_top_level);
3258 if (jcode)
3259 {
3260 (*rl_redisplay_function) ();
3261 _rl_want_redisplay = 0;
3262- memcpy ((void *)readline_top_level, (void *)olevel, sizeof (procenv_t));
3263+ memcpy ((void *)_rl_top_level, (void *)olevel, sizeof (procenv_t));
3264 return;
3265 }
3266
3267- if (RL_ISSTATE (RL_STATE_ISEARCH))
3268+ do
3269 {
3270- eof = _rl_isearch_callback (_rl_iscxt);
3271- if (eof == 0 && (RL_ISSTATE (RL_STATE_ISEARCH) == 0) && RL_ISSTATE (RL_STATE_INPUTPENDING))
3272- rl_callback_read_char ();
3273+ RL_CHECK_SIGNALS ();
3274+ if (RL_ISSTATE (RL_STATE_ISEARCH))
3275+ {
3276+ eof = _rl_isearch_callback (_rl_iscxt);
3277+ if (eof == 0 && (RL_ISSTATE (RL_STATE_ISEARCH) == 0) && RL_ISSTATE (RL_STATE_INPUTPENDING))
3278+ rl_callback_read_char ();
3279
3280- return;
3281- }
3282- else if (RL_ISSTATE (RL_STATE_NSEARCH))
3283- {
3284- eof = _rl_nsearch_callback (_rl_nscxt);
3285- return;
3286- }
3287- else if (RL_ISSTATE (RL_STATE_NUMERICARG))
3288- {
3289- eof = _rl_arg_callback (_rl_argcxt);
3290- if (eof == 0 && (RL_ISSTATE (RL_STATE_NUMERICARG) == 0) && RL_ISSTATE (RL_STATE_INPUTPENDING))
3291- rl_callback_read_char ();
3292- /* XXX - this should handle _rl_last_command_was_kill better */
3293- else if (RL_ISSTATE (RL_STATE_NUMERICARG) == 0)
3294- _rl_internal_char_cleanup ();
3295+ return;
3296+ }
3297+ else if (RL_ISSTATE (RL_STATE_NSEARCH))
3298+ {
3299+ eof = _rl_nsearch_callback (_rl_nscxt);
3300+ return;
3301+ }
3302+#if defined (VI_MODE)
3303+ else if (RL_ISSTATE (RL_STATE_VIMOTION))
3304+ {
3305+ eof = _rl_vi_domove_callback (_rl_vimvcxt);
3306+ /* Should handle everything, including cleanup, numeric arguments,
3307+ and turning off RL_STATE_VIMOTION */
3308+ if (RL_ISSTATE (RL_STATE_NUMERICARG) == 0)
3309+ _rl_internal_char_cleanup ();
3310
3311- return;
3312- }
3313- else if (RL_ISSTATE (RL_STATE_MULTIKEY))
3314- {
3315- eof = _rl_dispatch_callback (_rl_kscxt); /* For now */
3316- while ((eof == -1 || eof == -2) && RL_ISSTATE (RL_STATE_MULTIKEY) && _rl_kscxt && (_rl_kscxt->flags & KSEQ_DISPATCHED))
3317- eof = _rl_dispatch_callback (_rl_kscxt);
3318- if (RL_ISSTATE (RL_STATE_MULTIKEY) == 0)
3319+ return;
3320+ }
3321+#endif
3322+ else if (RL_ISSTATE (RL_STATE_NUMERICARG))
3323+ {
3324+ eof = _rl_arg_callback (_rl_argcxt);
3325+ if (eof == 0 && (RL_ISSTATE (RL_STATE_NUMERICARG) == 0) && RL_ISSTATE (RL_STATE_INPUTPENDING))
3326+ rl_callback_read_char ();
3327+ /* XXX - this should handle _rl_last_command_was_kill better */
3328+ else if (RL_ISSTATE (RL_STATE_NUMERICARG) == 0)
3329+ _rl_internal_char_cleanup ();
3330+
3331+ return;
3332+ }
3333+ else if (RL_ISSTATE (RL_STATE_MULTIKEY))
3334 {
3335- _rl_internal_char_cleanup ();
3336- _rl_want_redisplay = 1;
3337+ eof = _rl_dispatch_callback (_rl_kscxt); /* For now */
3338+ while ((eof == -1 || eof == -2) && RL_ISSTATE (RL_STATE_MULTIKEY) && _rl_kscxt && (_rl_kscxt->flags & KSEQ_DISPATCHED))
3339+ eof = _rl_dispatch_callback (_rl_kscxt);
3340+ if (RL_ISSTATE (RL_STATE_MULTIKEY) == 0)
3341+ {
3342+ _rl_internal_char_cleanup ();
3343+ _rl_want_redisplay = 1;
3344+ }
3345 }
3346- }
3347- else if (_rl_callback_func)
3348- {
3349- /* This allows functions that simply need to read an additional character
3350- (like quoted-insert) to register a function to be called when input is
3351- available. _rl_callback_data is simply a pointer to a struct that has
3352- the argument count originally passed to the registering function and
3353- space for any additional parameters. */
3354- eof = (*_rl_callback_func) (_rl_callback_data);
3355- /* If the function `deregisters' itself, make sure the data is cleaned
3356- up. */
3357- if (_rl_callback_func == 0)
3358+ else if (_rl_callback_func)
3359 {
3360- if (_rl_callback_data)
3361+ /* This allows functions that simply need to read an additional
3362+ character (like quoted-insert) to register a function to be
3363+ called when input is available. _rl_callback_data is simply a
3364+ pointer to a struct that has the argument count originally
3365+ passed to the registering function and space for any additional
3366+ parameters. */
3367+ eof = (*_rl_callback_func) (_rl_callback_data);
3368+ /* If the function `deregisters' itself, make sure the data is
3369+ cleaned up. */
3370+ if (_rl_callback_func == 0)
3371 {
3372- _rl_callback_data_dispose (_rl_callback_data);
3373- _rl_callback_data = 0;
3374+ if (_rl_callback_data)
3375+ {
3376+ _rl_callback_data_dispose (_rl_callback_data);
3377+ _rl_callback_data = 0;
3378+ }
3379+ _rl_internal_char_cleanup ();
3380 }
3381- _rl_internal_char_cleanup ();
3382 }
3383- }
3384- else
3385- eof = readline_internal_char ();
3386+ else
3387+ eof = readline_internal_char ();
3388
3389- if (rl_done == 0 && _rl_want_redisplay)
3390- {
3391- (*rl_redisplay_function) ();
3392- _rl_want_redisplay = 0;
3393- }
3394+ RL_CHECK_SIGNALS ();
3395+ if (rl_done == 0 && _rl_want_redisplay)
3396+ {
3397+ (*rl_redisplay_function) ();
3398+ _rl_want_redisplay = 0;
3399+ }
3400
3401- /* We loop in case some function has pushed input back with rl_execute_next. */
3402- for (;;)
3403- {
3404 if (rl_done)
3405 {
3406 line = readline_internal_teardown (eof);
3407@@ -213,11 +228,8 @@ rl_callback_read_char ()
3408 if (in_handler == 0 && rl_linefunc)
3409 _rl_callback_newline ();
3410 }
3411- if (rl_pending_input || _rl_pushed_input_available () || RL_ISSTATE (RL_STATE_MACROINPUT))
3412- eof = readline_internal_char ();
3413- else
3414- break;
3415 }
3416+ while (rl_pending_input || _rl_pushed_input_available () || RL_ISSTATE (RL_STATE_MACROINPUT));
3417 }
3418
3419 /* Remove the handler, and make sure the terminal is in its normal state. */
3420@@ -226,6 +238,7 @@ rl_callback_handler_remove ()
3421 {
3422 rl_linefunc = NULL;
3423 RL_UNSETSTATE (RL_STATE_CALLBACK);
3424+ RL_CHECK_SIGNALS ();
3425 if (in_handler)
3426 {
3427 in_handler = 0;
3428@@ -254,8 +267,7 @@ _rl_callback_data_alloc (count)
3429 void _rl_callback_data_dispose (arg)
3430 _rl_callback_generic_arg *arg;
3431 {
3432- if (arg)
3433- free (arg);
3434+ xfree (arg);
3435 }
3436
3437 #endif
3438Index: gdb-7.2.90.20110703/readline/chardefs.h
3439===================================================================
3440--- gdb-7.2.90.20110703.orig/readline/chardefs.h 2011-07-03 10:40:53.000000000 +0200
3441+++ gdb-7.2.90.20110703/readline/chardefs.h 2011-07-03 10:41:21.000000000 +0200
3442@@ -1,24 +1,23 @@
3443 /* chardefs.h -- Character definitions for readline. */
3444
3445-/* Copyright (C) 1994 Free Software Foundation, Inc.
3446+/* Copyright (C) 1994-2009 Free Software Foundation, Inc.
3447
3448- This file is part of the GNU Readline Library, a library for
3449- reading lines of text with interactive input and history editing.
3450+ This file is part of the GNU Readline Library (Readline), a library
3451+ for reading lines of text with interactive input and history editing.
3452
3453- The GNU Readline Library is free software; you can redistribute it
3454- and/or modify it under the terms of the GNU General Public License
3455- as published by the Free Software Foundation; either version 2, or
3456+ Readline is free software: you can redistribute it and/or modify
3457+ it under the terms of the GNU General Public License as published by
3458+ the Free Software Foundation, either version 3 of the License, or
3459 (at your option) any later version.
3460
3461- The GNU Readline Library is distributed in the hope that it will be
3462- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
3463- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3464+ Readline is distributed in the hope that it will be useful,
3465+ but WITHOUT ANY WARRANTY; without even the implied warranty of
3466+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3467 GNU General Public License for more details.
3468
3469- The GNU General Public License is often shipped with GNU software, and
3470- is generally kept in a file called COPYING or LICENSE. If you do not
3471- have a copy of the license, write to the Free Software Foundation,
3472- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
3473+ You should have received a copy of the GNU General Public License
3474+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
3475+*/
3476
3477 #ifndef _CHARDEFS_H_
3478 #define _CHARDEFS_H_
3479Index: gdb-7.2.90.20110703/readline/compat.c
3480===================================================================
3481--- gdb-7.2.90.20110703.orig/readline/compat.c 2011-07-03 10:40:53.000000000 +0200
3482+++ gdb-7.2.90.20110703/readline/compat.c 2011-07-03 10:41:21.000000000 +0200
3483@@ -1,24 +1,24 @@
3484 /* compat.c -- backwards compatibility functions. */
3485
3486-/* Copyright (C) 2000 Free Software Foundation, Inc.
3487+/* Copyright (C) 2000-2009 Free Software Foundation, Inc.
3488
3489- This file is part of the GNU Readline Library, a library for
3490- reading lines of text with interactive input and history editing.
3491+ This file is part of the GNU Readline Library (Readline), a library
3492+ for reading lines of text with interactive input and history editing.
3493
3494- The GNU Readline Library is free software; you can redistribute it
3495- and/or modify it under the terms of the GNU General Public License
3496- as published by the Free Software Foundation; either version 2, or
3497+ Readline is free software: you can redistribute it and/or modify
3498+ it under the terms of the GNU General Public License as published by
3499+ the Free Software Foundation, either version 3 of the License, or
3500 (at your option) any later version.
3501
3502- The GNU Readline Library is distributed in the hope that it will be
3503- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
3504- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3505+ Readline is distributed in the hope that it will be useful,
3506+ but WITHOUT ANY WARRANTY; without even the implied warranty of
3507+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3508 GNU General Public License for more details.
3509
3510- The GNU General Public License is often shipped with GNU software, and
3511- is generally kept in a file called COPYING or LICENSE. If you do not
3512- have a copy of the license, write to the Free Software Foundation,
3513- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
3514+ You should have received a copy of the GNU General Public License
3515+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
3516+*/
3517+
3518 #define READLINE_LIBRARY
3519
3520 #if defined (HAVE_CONFIG_H)
3521Index: gdb-7.2.90.20110703/readline/complete.c
3522===================================================================
3523--- gdb-7.2.90.20110703.orig/readline/complete.c 2011-07-03 10:40:53.000000000 +0200
3524+++ gdb-7.2.90.20110703/readline/complete.c 2011-07-03 10:41:21.000000000 +0200
3525@@ -1,24 +1,24 @@
3526 /* complete.c -- filename completion for readline. */
3527
3528-/* Copyright (C) 1987-2005 Free Software Foundation, Inc.
3529+/* Copyright (C) 1987-2011 Free Software Foundation, Inc.
3530
3531- This file is part of the GNU Readline Library, a library for
3532- reading lines of text with interactive input and history editing.
3533+ This file is part of the GNU Readline Library (Readline), a library
3534+ for reading lines of text with interactive input and history editing.
3535
3536- The GNU Readline Library is free software; you can redistribute it
3537- and/or modify it under the terms of the GNU General Public License
3538- as published by the Free Software Foundation; either version 2, or
3539+ Readline is free software: you can redistribute it and/or modify
3540+ it under the terms of the GNU General Public License as published by
3541+ the Free Software Foundation, either version 3 of the License, or
3542 (at your option) any later version.
3543
3544- The GNU Readline Library is distributed in the hope that it will be
3545- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
3546- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3547+ Readline is distributed in the hope that it will be useful,
3548+ but WITHOUT ANY WARRANTY; without even the implied warranty of
3549+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3550 GNU General Public License for more details.
3551
3552- The GNU General Public License is often shipped with GNU software, and
3553- is generally kept in a file called COPYING or LICENSE. If you do not
3554- have a copy of the license, write to the Free Software Foundation,
3555- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
3556+ You should have received a copy of the GNU General Public License
3557+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
3558+*/
3559+
3560 #define READLINE_LIBRARY
3561
3562 #if defined (HAVE_CONFIG_H)
3563@@ -110,8 +110,8 @@ static int get_y_or_n PARAMS((int));
3564 static int _rl_internal_pager PARAMS((int));
3565 static char *printable_part PARAMS((char *));
3566 static int fnwidth PARAMS((const char *));
3567-static int fnprint PARAMS((const char *));
3568-static int print_filename PARAMS((char *, char *));
3569+static int fnprint PARAMS((const char *, int));
3570+static int print_filename PARAMS((char *, char *, int));
3571
3572 static char **gen_completion_matches PARAMS((char *, int, int, rl_compentry_func_t *, int, int));
3573
3574@@ -119,9 +119,11 @@ static char **remove_duplicate_matches P
3575 static void insert_match PARAMS((char *, int, int, char *));
3576 static int append_to_match PARAMS((char *, int, int, int));
3577 static void insert_all_matches PARAMS((char **, int, char *));
3578+static int complete_fncmp PARAMS((const char *, int, const char *, int));
3579 static void display_matches PARAMS((char **));
3580 static int compute_lcd_of_matches PARAMS((char **, int, const char *));
3581 static int postprocess_matches PARAMS((char ***, int));
3582+static int complete_get_screenwidth PARAMS((void));
3583
3584 static char *make_quoted_replacement PARAMS((char *, int, char *));
3585
3586@@ -157,13 +159,27 @@ int _rl_print_completions_horizontally;
3587 #if defined (__MSDOS__) && !defined (__DJGPP__)
3588 int _rl_completion_case_fold = 1;
3589 #else
3590-int _rl_completion_case_fold;
3591+int _rl_completion_case_fold = 0;
3592 #endif
3593
3594-/* If non-zero, don't match hidden files (filenames beginning with a `.' on
3595+/* Non-zero means that `-' and `_' are equivalent when comparing filenames
3596+ for completion. */
3597+int _rl_completion_case_map = 0;
3598+
3599+/* If zero, don't match hidden files (filenames beginning with a `.' on
3600 Unix) when doing filename completion. */
3601 int _rl_match_hidden_files = 1;
3602
3603+/* Length in characters of a common prefix replaced with an ellipsis (`...')
3604+ when displaying completion matches. Matches whose printable portion has
3605+ more than this number of displaying characters in common will have the common
3606+ display prefix replaced with an ellipsis. */
3607+int _rl_completion_prefix_display_length = 0;
3608+
3609+/* The readline-private number of screen columns to use when displaying
3610+ matches. If < 0 or > _rl_screenwidth, it is ignored. */
3611+int _rl_completion_columns = -1;
3612+
3613 /* Global variables available to applications using readline. */
3614
3615 #if defined (VISIBLE_STATS)
3616@@ -173,6 +189,16 @@ int _rl_match_hidden_files = 1;
3617 int rl_visible_stats = 0;
3618 #endif /* VISIBLE_STATS */
3619
3620+/* If non-zero, when completing in the middle of a word, don't insert
3621+ characters from the match that match characters following point in
3622+ the word. This means, for instance, completing when the cursor is
3623+ after the `e' in `Makefile' won't result in `Makefilefile'. */
3624+int _rl_skip_completed_text = 0;
3625+
3626+/* If non-zero, menu completion displays the common prefix first in the
3627+ cycle of possible completions instead of the last. */
3628+int _rl_menu_complete_prefix_first = 0;
3629+
3630 /* If non-zero, then this is the address of a function to call when
3631 completing on a directory name. The function is called with
3632 the address of a string (the current directory name) as an arg. */
3633@@ -180,6 +206,17 @@ rl_icppfunc_t *rl_directory_completion_h
3634
3635 rl_icppfunc_t *rl_directory_rewrite_hook = (rl_icppfunc_t *)NULL;
3636
3637+/* If non-zero, this is the address of a function to call when reading
3638+ directory entries from the filesystem for completion and comparing
3639+ them to the partial word to be completed. The function should
3640+ either return its first argument (if no conversion takes place) or
3641+ newly-allocated memory. This can, for instance, convert filenames
3642+ between character sets for comparison against what's typed at the
3643+ keyboard. The returned value is what is added to the list of
3644+ matches. The second argument is the length of the filename to be
3645+ converted. */
3646+rl_dequote_func_t *rl_filename_rewrite_hook = (rl_dequote_func_t *)NULL;
3647+
3648 /* Non-zero means readline completion functions perform tilde expansion. */
3649 int rl_complete_with_tilde_expansion = 0;
3650
3651@@ -188,6 +225,10 @@ int rl_complete_with_tilde_expansion = 0
3652 completer. */
3653 rl_compentry_func_t *rl_completion_entry_function = (rl_compentry_func_t *)NULL;
3654
3655+/* Pointer to generator function for rl_menu_complete (). NULL means to use
3656+ *rl_completion_entry_function (see above). */
3657+rl_compentry_func_t *rl_menu_completion_entry_function = (rl_compentry_func_t *)NULL;
3658+
3659 /* Pointer to alternative function to create matches.
3660 Function is called with TEXT, START, and END.
3661 START and END are indices in RL_LINE_BUFFER saying what the boundaries
3662@@ -325,11 +366,20 @@ int rl_completion_mark_symlink_dirs;
3663 /* If non-zero, inhibit completion (temporarily). */
3664 int rl_inhibit_completion;
3665
3666+/* Set to the last key used to invoke one of the completion functions */
3667+int rl_completion_invoking_key;
3668+
3669+/* If non-zero, sort the completion matches. On by default. */
3670+int rl_sort_completion_matches = 1;
3671+
3672 /* Variables local to this file. */
3673
3674 /* Local variable states what happened during the last completion attempt. */
3675 static int completion_changed_buffer;
3676
3677+/* The result of the query to the user about displaying completion matches */
3678+static int completion_y_or_n;
3679+
3680 /*************************************/
3681 /* */
3682 /* Bindable completion functions */
3683@@ -343,6 +393,8 @@ int
3684 rl_complete (ignore, invoking_key)
3685 int ignore, invoking_key;
3686 {
3687+ rl_completion_invoking_key = invoking_key;
3688+
3689 if (rl_inhibit_completion)
3690 return (_rl_insert_char (ignore, invoking_key));
3691 else if (rl_last_func == rl_complete && !completion_changed_buffer)
3692@@ -360,6 +412,7 @@ int
3693 rl_possible_completions (ignore, invoking_key)
3694 int ignore, invoking_key;
3695 {
3696+ rl_completion_invoking_key = invoking_key;
3697 return (rl_complete_internal ('?'));
3698 }
3699
3700@@ -367,6 +420,7 @@ int
3701 rl_insert_completions (ignore, invoking_key)
3702 int ignore, invoking_key;
3703 {
3704+ rl_completion_invoking_key = invoking_key;
3705 return (rl_complete_internal ('*'));
3706 }
3707
3708@@ -395,6 +449,14 @@ rl_completion_mode (cfunc)
3709 /* */
3710 /************************************/
3711
3712+/* Reset readline state on a signal or other event. */
3713+void
3714+_rl_reset_completion_state ()
3715+{
3716+ rl_completion_found_quote = 0;
3717+ rl_completion_quote_character = 0;
3718+}
3719+
3720 /* Set default values for readline word completion. These are the variables
3721 that application completion functions can change or inspect. */
3722 static void
3723@@ -406,6 +468,7 @@ set_completion_defaults (what_to_do)
3724 rl_filename_quoting_desired = 1;
3725 rl_completion_type = what_to_do;
3726 rl_completion_suppress_append = rl_completion_suppress_quote = 0;
3727+ rl_completion_append_character = ' ';
3728
3729 /* The completion entry function may optionally change this. */
3730 rl_completion_mark_symlink_dirs = _rl_complete_mark_symlink_dirs;
3731@@ -418,6 +481,19 @@ get_y_or_n (for_pager)
3732 {
3733 int c;
3734
3735+/* Disabled for GDB due to the gdb.base/readline-ask.exp regression.
3736+ [patch] testsuite: Test readline-6.2 "ask" regression
3737+ http://sourceware.org/ml/gdb-patches/2011-05/msg00002.html */
3738+#if 0
3739+ /* For now, disable pager in callback mode, until we later convert to state
3740+ driven functions. Have to wait until next major version to add new
3741+ state definition, since it will change value of RL_STATE_DONE. */
3742+#if defined (READLINE_CALLBACKS)
3743+ if (RL_ISSTATE (RL_STATE_CALLBACK))
3744+ return 1;
3745+#endif
3746+#endif
3747+
3748 for (;;)
3749 {
3750 RL_SETSTATE(RL_STATE_MOREINPUT);
3751@@ -428,7 +504,7 @@ get_y_or_n (for_pager)
3752 return (1);
3753 if (c == 'n' || c == 'N' || c == RUBOUT)
3754 return (0);
3755- if (c == ABORT_CHAR)
3756+ if (c == ABORT_CHAR || c < 0)
3757 _rl_abort_internal ();
3758 if (for_pager && (c == NEWLINE || c == RETURN))
3759 return (2);
3760@@ -481,6 +557,13 @@ stat_char (filename)
3761 struct stat finfo;
3762 int character, r;
3763
3764+ /* Short-circuit a //server on cygwin, since that will always behave as
3765+ a directory. */
3766+#if __CYGWIN__
3767+ if (filename[0] == '/' && filename[1] == '/' && strchr (filename+2, '/') == 0)
3768+ return '/';
3769+#endif
3770+
3771 #if defined (HAVE_LSTAT) && defined (S_ISLNK)
3772 r = lstat (filename, &finfo);
3773 #else
3774@@ -581,7 +664,7 @@ fnwidth (string)
3775 width = pos = 0;
3776 while (string[pos])
3777 {
3778- if (CTRL_CHAR (*string) || *string == RUBOUT)
3779+ if (CTRL_CHAR (string[pos]) || string[pos] == RUBOUT)
3780 {
3781 width += 2;
3782 pos++;
3783@@ -614,17 +697,20 @@ fnwidth (string)
3784 return width;
3785 }
3786
3787+#define ELLIPSIS_LEN 3
3788+
3789 static int
3790-fnprint (to_print)
3791+fnprint (to_print, prefix_bytes)
3792 const char *to_print;
3793+ int prefix_bytes;
3794 {
3795- int printed_len;
3796+ int printed_len, w;
3797 const char *s;
3798 #if defined (HANDLE_MULTIBYTE)
3799 mbstate_t ps;
3800 const char *end;
3801 size_t tlen;
3802- int width, w;
3803+ int width;
3804 wchar_t wc;
3805
3806 end = to_print + strlen (to_print) + 1;
3807@@ -632,7 +718,23 @@ fnprint (to_print)
3808 #endif
3809
3810 printed_len = 0;
3811- s = to_print;
3812+
3813+ /* Don't print only the ellipsis if the common prefix is one of the
3814+ possible completions */
3815+ if (to_print[prefix_bytes] == '\0')
3816+ prefix_bytes = 0;
3817+
3818+ if (prefix_bytes)
3819+ {
3820+ char ellipsis;
3821+
3822+ ellipsis = (to_print[prefix_bytes] == '.') ? '_' : '.';
3823+ for (w = 0; w < ELLIPSIS_LEN; w++)
3824+ putc (ellipsis, rl_outstream);
3825+ printed_len = ELLIPSIS_LEN;
3826+ }
3827+
3828+ s = to_print + prefix_bytes;
3829 while (*s)
3830 {
3831 if (CTRL_CHAR (*s))
3832@@ -691,14 +793,15 @@ fnprint (to_print)
3833 filenames. Return the number of characters we output. */
3834
3835 static int
3836-print_filename (to_print, full_pathname)
3837+print_filename (to_print, full_pathname, prefix_bytes)
3838 char *to_print, *full_pathname;
3839+ int prefix_bytes;
3840 {
3841 int printed_len, extension_char, slen, tlen;
3842 char *s, c, *new_full_pathname, *dn;
3843
3844 extension_char = 0;
3845- printed_len = fnprint (to_print);
3846+ printed_len = fnprint (to_print, prefix_bytes);
3847
3848 #if defined (VISIBLE_STATS)
3849 if (rl_filename_completion_desired && (rl_visible_stats || _rl_complete_mark_directories))
3850@@ -753,7 +856,7 @@ print_filename (to_print, full_pathname)
3851 if (path_isdir (new_full_pathname))
3852 extension_char = '/';
3853
3854- free (new_full_pathname);
3855+ xfree (new_full_pathname);
3856 to_print[-1] = c;
3857 }
3858 else
3859@@ -768,7 +871,7 @@ print_filename (to_print, full_pathname)
3860 extension_char = '/';
3861 }
3862
3863- free (s);
3864+ xfree (s);
3865 if (extension_char)
3866 {
3867 putc (extension_char, rl_outstream);
3868@@ -950,7 +1053,7 @@ gen_completion_matches (text, start, end
3869 rl_compentry_func_t *our_func;
3870 int found_quote, quote_char;
3871 {
3872- char **matches, *temp;
3873+ char **matches;
3874
3875 rl_completion_found_quote = found_quote;
3876 rl_completion_quote_character = quote_char;
3877@@ -960,7 +1063,10 @@ gen_completion_matches (text, start, end
3878 variable rl_attempted_completion_function. */
3879 if (rl_attempted_completion_function)
3880 {
3881+ _rl_interrupt_immediately++;
3882 matches = (*rl_attempted_completion_function) (text, start, end);
3883+ if (_rl_interrupt_immediately > 0)
3884+ _rl_interrupt_immediately--;
3885
3886 if (matches || rl_attempted_completion_over)
3887 {
3888@@ -969,21 +1075,9 @@ gen_completion_matches (text, start, end
3889 }
3890 }
3891
3892- /* Beware -- we're stripping the quotes here. Do this only if we know
3893- we are doing filename completion and the application has defined a
3894- filename dequoting function. */
3895- temp = (char *)NULL;
3896-
3897- if (found_quote && our_func == rl_filename_completion_function &&
3898- rl_filename_dequoting_function)
3899- {
3900- /* delete single and double quotes */
3901- temp = (*rl_filename_dequoting_function) (text, quote_char);
3902- text = temp; /* not freeing text is not a memory leak */
3903- }
3904+ /* XXX -- filename dequoting moved into rl_filename_completion_function */
3905
3906 matches = rl_completion_matches (text, our_func);
3907- FREE (temp);
3908 return matches;
3909 }
3910
3911@@ -1004,7 +1098,7 @@ remove_duplicate_matches (matches)
3912
3913 /* Sort the array without matches[0], since we need it to
3914 stay in place no matter what. */
3915- if (i)
3916+ if (i && rl_sort_completion_matches)
3917 qsort (matches+1, i-1, sizeof (char *), (QSFUNC *)_rl_qsort_string_compare);
3918
3919 /* Remember the lowest common denominator for it may be unique. */
3920@@ -1014,7 +1108,7 @@ remove_duplicate_matches (matches)
3921 {
3922 if (strcmp (matches[i], matches[i + 1]) == 0)
3923 {
3924- free (matches[i]);
3925+ xfree (matches[i]);
3926 matches[i] = (char *)&dead_slot;
3927 }
3928 else
3929@@ -1032,7 +1126,7 @@ remove_duplicate_matches (matches)
3930 temp_array[j] = (char *)NULL;
3931
3932 if (matches[0] != (char *)&dead_slot)
3933- free (matches[0]);
3934+ xfree (matches[0]);
3935
3936 /* Place the lowest common denominator back in [0]. */
3937 temp_array[0] = lowest_common;
3938@@ -1042,7 +1136,7 @@ remove_duplicate_matches (matches)
3939 insert. */
3940 if (j == 2 && strcmp (temp_array[0], temp_array[1]) == 0)
3941 {
3942- free (temp_array[1]);
3943+ xfree (temp_array[1]);
3944 temp_array[1] = (char *)NULL;
3945 }
3946 return (temp_array);
3947@@ -1116,7 +1210,8 @@ compute_lcd_of_matches (match_list, matc
3948 #if defined (HANDLE_MULTIBYTE)
3949 if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
3950 {
3951- mbstate_t ps_back = ps1;
3952+ mbstate_t ps_back;
3953+ ps_back = ps1;
3954 if (!_rl_compare_chars (match_list[i], si, &ps1, match_list[i+1], si, &ps2))
3955 break;
3956 else if ((v = _rl_get_char_len (&match_list[i][si], &ps_back)) > 1)
3957@@ -1220,7 +1315,7 @@ postprocess_matches (matchesp, matching_
3958 if (rl_ignore_completion_duplicates)
3959 {
3960 temp_matches = remove_duplicate_matches (matches);
3961- free (matches);
3962+ xfree (matches);
3963 matches = temp_matches;
3964 }
3965
3966@@ -1257,6 +1352,23 @@ postprocess_matches (matchesp, matching_
3967 return (1);
3968 }
3969
3970+static int
3971+complete_get_screenwidth ()
3972+{
3973+ int cols;
3974+ char *envcols;
3975+
3976+ cols = _rl_completion_columns;
3977+ if (cols >= 0 && cols <= _rl_screenwidth)
3978+ return cols;
3979+ envcols = getenv ("COLUMNS");
3980+ if (envcols && *envcols)
3981+ cols = atoi (envcols);
3982+ if (cols >= 0 && cols <= _rl_screenwidth)
3983+ return cols;
3984+ return _rl_screenwidth;
3985+}
3986+
3987 /* A convenience function for displaying a list of strings in
3988 columnar format on readline's output stream. MATCHES is the list
3989 of strings, in argv format, LEN is the number of strings in MATCHES,
3990@@ -1266,17 +1378,38 @@ rl_display_match_list (matches, len, max
3991 char **matches;
3992 int len, max;
3993 {
3994- int count, limit, printed_len, lines;
3995- int i, j, k, l;
3996- char *temp;
3997+ int count, limit, printed_len, lines, cols;
3998+ int i, j, k, l, common_length, sind;
3999+ char *temp, *t;
4000+
4001+ /* Find the length of the prefix common to all items: length as displayed
4002+ characters (common_length) and as a byte index into the matches (sind) */
4003+ common_length = sind = 0;
4004+ if (_rl_completion_prefix_display_length > 0)
4005+ {
4006+ t = printable_part (matches[0]);
4007+ temp = strrchr (t, '/');
4008+ common_length = temp ? fnwidth (temp) : fnwidth (t);
4009+ sind = temp ? strlen (temp) : strlen (t);
4010+
4011+ if (common_length > _rl_completion_prefix_display_length && common_length > ELLIPSIS_LEN)
4012+ max -= common_length - ELLIPSIS_LEN;
4013+ else
4014+ common_length = sind = 0;
4015+ }
4016
4017 /* How many items of MAX length can we fit in the screen window? */
4018+ cols = complete_get_screenwidth ();
4019 max += 2;
4020- limit = _rl_screenwidth / max;
4021- if (limit != 1 && (limit * max == _rl_screenwidth))
4022+ limit = cols / max;
4023+ if (limit != 1 && (limit * max == cols))
4024 limit--;
4025
4026- /* Avoid a possible floating exception. If max > _rl_screenwidth,
4027+ /* If cols == 0, limit will end up -1 */
4028+ if (cols < _rl_screenwidth && limit < 0)
4029+ limit = 1;
4030+
4031+ /* Avoid a possible floating exception. If max > cols,
4032 limit will be 0 and a divide-by-zero fault will result. */
4033 if (limit == 0)
4034 limit = 1;
4035@@ -1289,7 +1422,7 @@ rl_display_match_list (matches, len, max
4036 0 < len <= limit implies count = 1. */
4037
4038 /* Sort the items if they are not already sorted. */
4039- if (rl_ignore_completion_duplicates == 0)
4040+ if (rl_ignore_completion_duplicates == 0 && rl_sort_completion_matches)
4041 qsort (matches + 1, len, sizeof (char *), (QSFUNC *)_rl_qsort_string_compare);
4042
4043 rl_crlf ();
4044@@ -1307,7 +1440,7 @@ rl_display_match_list (matches, len, max
4045 else
4046 {
4047 temp = printable_part (matches[l]);
4048- printed_len = print_filename (temp, matches[l]);
4049+ printed_len = print_filename (temp, matches[l], sind);
4050
4051 if (j + 1 < limit)
4052 for (k = 0; k < max - printed_len; k++)
4053@@ -1331,7 +1464,7 @@ rl_display_match_list (matches, len, max
4054 for (i = 1; matches[i]; i++)
4055 {
4056 temp = printable_part (matches[i]);
4057- printed_len = print_filename (temp, matches[i]);
4058+ printed_len = print_filename (temp, matches[i], sind);
4059 /* Have we reached the end of this line? */
4060 if (matches[i+1])
4061 {
4062@@ -1381,7 +1514,7 @@ display_matches (matches)
4063 {
4064 temp = printable_part (matches[0]);
4065 rl_crlf ();
4066- print_filename (temp, matches[0]);
4067+ print_filename (temp, matches[0], 0);
4068 rl_crlf ();
4069
4070 rl_forced_update_display ();
4071@@ -1417,7 +1550,7 @@ display_matches (matches)
4072 rl_crlf ();
4073 fprintf (rl_outstream, "Display all %d possibilities? (y or n)", len);
4074 fflush (rl_outstream);
4075- if (get_y_or_n (0) == 0)
4076+ if ((completion_y_or_n = get_y_or_n (0)) == 0)
4077 {
4078 rl_crlf ();
4079
4080@@ -1485,8 +1618,9 @@ insert_match (match, start, mtype, qc)
4081 int start, mtype;
4082 char *qc;
4083 {
4084- char *replacement;
4085+ char *replacement, *r;
4086 char oqc;
4087+ int end, rlen;
4088
4089 oqc = qc ? *qc : '\0';
4090 replacement = make_quoted_replacement (match, mtype, qc);
4091@@ -1494,6 +1628,7 @@ insert_match (match, start, mtype, qc)
4092 /* Now insert the match. */
4093 if (replacement)
4094 {
4095+ rlen = strlen (replacement);
4096 /* Don't double an opening quote character. */
4097 if (qc && *qc && start && rl_line_buffer[start - 1] == *qc &&
4098 replacement[0] == *qc)
4099@@ -1503,9 +1638,26 @@ insert_match (match, start, mtype, qc)
4100 else if (qc && (*qc != oqc) && start && rl_line_buffer[start - 1] == oqc &&
4101 replacement[0] != oqc)
4102 start--;
4103- _rl_replace_text (replacement, start, rl_point - 1);
4104+ end = rl_point - 1;
4105+ /* Don't double a closing quote character */
4106+ if (qc && *qc && end && rl_line_buffer[rl_point] == *qc && replacement[rlen - 1] == *qc)
4107+ end++;
4108+ if (_rl_skip_completed_text)
4109+ {
4110+ r = replacement;
4111+ while (start < rl_end && *r && rl_line_buffer[start] == *r)
4112+ {
4113+ start++;
4114+ r++;
4115+ }
4116+ if (start <= end || *r)
4117+ _rl_replace_text (r, start, end);
4118+ rl_point = start + strlen (r);
4119+ }
4120+ else
4121+ _rl_replace_text (replacement, start, end);
4122 if (replacement != match)
4123- free (replacement);
4124+ xfree (replacement);
4125 }
4126 }
4127
4128@@ -1572,7 +1724,7 @@ append_to_match (text, delimiter, quote_
4129 if (rl_point == rl_end && temp_string_index)
4130 rl_insert_text (temp_string);
4131 }
4132- free (filename);
4133+ xfree (filename);
4134 }
4135 else
4136 {
4137@@ -1608,7 +1760,7 @@ insert_all_matches (matches, point, qc)
4138 rl_insert_text (rp);
4139 rl_insert_text (" ");
4140 if (rp != matches[i])
4141- free (rp);
4142+ xfree (rp);
4143 }
4144 }
4145 else
4146@@ -1617,7 +1769,7 @@ insert_all_matches (matches, point, qc)
4147 rl_insert_text (rp);
4148 rl_insert_text (" ");
4149 if (rp != matches[0])
4150- free (rp);
4151+ xfree (rp);
4152 }
4153 rl_end_undo_group ();
4154 }
4155@@ -1632,8 +1784,8 @@ _rl_free_match_list (matches)
4156 return;
4157
4158 for (i = 0; matches[i]; i++)
4159- free (matches[i]);
4160- free (matches);
4161+ xfree (matches[i]);
4162+ xfree (matches);
4163 }
4164
4165 /* Complete the word at or before point.
4166@@ -1654,6 +1806,9 @@ rl_complete_internal (what_to_do)
4167 int start, end, delimiter, found_quote, i, nontrivial_lcd;
4168 char *text, *saved_line_buffer;
4169 char quote_char;
4170+#if 1
4171+ int tlen, mlen;
4172+#endif
4173
4174 RL_SETSTATE(RL_STATE_COMPLETING);
4175
4176@@ -1681,7 +1836,11 @@ rl_complete_internal (what_to_do)
4177 /* nontrivial_lcd is set if the common prefix adds something to the word
4178 being completed. */
4179 nontrivial_lcd = matches && strcmp (text, matches[0]) != 0;
4180- free (text);
4181+#if 1
4182+ if (what_to_do == '!' || what_to_do == '@')
4183+ tlen = strlen (text);
4184+#endif
4185+ xfree (text);
4186
4187 if (matches == 0)
4188 {
4189@@ -1689,6 +1848,7 @@ rl_complete_internal (what_to_do)
4190 FREE (saved_line_buffer);
4191 completion_changed_buffer = 0;
4192 RL_UNSETSTATE(RL_STATE_COMPLETING);
4193+ _rl_reset_completion_state ();
4194 return (0);
4195 }
4196
4197@@ -1703,6 +1863,7 @@ rl_complete_internal (what_to_do)
4198 FREE (saved_line_buffer);
4199 completion_changed_buffer = 0;
4200 RL_UNSETSTATE(RL_STATE_COMPLETING);
4201+ _rl_reset_completion_state ();
4202 return (0);
4203 }
4204
4205@@ -1712,8 +1873,25 @@ rl_complete_internal (what_to_do)
4206 case '!':
4207 case '@':
4208 /* Insert the first match with proper quoting. */
4209+#if 0
4210 if (*matches[0])
4211 insert_match (matches[0], start, matches[1] ? MULT_MATCH : SINGLE_MATCH, &quote_char);
4212+#else
4213+ if (what_to_do == TAB)
4214+ {
4215+ if (*matches[0])
4216+ insert_match (matches[0], start, matches[1] ? MULT_MATCH : SINGLE_MATCH, &quote_char);
4217+ }
4218+ else if (*matches[0] && matches[1] == 0)
4219+ /* should we perform the check only if there are multiple matches? */
4220+ insert_match (matches[0], start, matches[1] ? MULT_MATCH : SINGLE_MATCH, &quote_char);
4221+ else if (*matches[0]) /* what_to_do != TAB && multiple matches */
4222+ {
4223+ mlen = *matches[0] ? strlen (matches[0]) : 0;
4224+ if (mlen >= tlen)
4225+ insert_match (matches[0], start, matches[1] ? MULT_MATCH : SINGLE_MATCH, &quote_char);
4226+ }
4227+#endif
4228
4229 /* If there are more matches, ring the bell to indicate.
4230 If we are in vi mode, Posix.2 says to not ring the bell.
4231@@ -1753,10 +1931,11 @@ rl_complete_internal (what_to_do)
4232 break;
4233
4234 default:
4235- fprintf (stderr, "\r\nreadline: bad value %d for what_to_do in rl_complete\n", what_to_do);
4236+ _rl_ttymsg ("bad value %d for what_to_do in rl_complete", what_to_do);
4237 rl_ding ();
4238 FREE (saved_line_buffer);
4239 RL_UNSETSTATE(RL_STATE_COMPLETING);
4240+ _rl_reset_completion_state ();
4241 return 1;
4242 }
4243
4244@@ -1766,10 +1945,11 @@ rl_complete_internal (what_to_do)
4245 if (saved_line_buffer)
4246 {
4247 completion_changed_buffer = strcmp (rl_line_buffer, saved_line_buffer) != 0;
4248- free (saved_line_buffer);
4249+ xfree (saved_line_buffer);
4250 }
4251
4252 RL_UNSETSTATE(RL_STATE_COMPLETING);
4253+ _rl_reset_completion_state ();
4254 return 0;
4255 }
4256
4257@@ -1813,6 +1993,7 @@ rl_completion_matches (text, entry_funct
4258 match_list = (char **)xmalloc ((match_list_size + 1) * sizeof (char *));
4259 match_list[1] = (char *)NULL;
4260
4261+ _rl_interrupt_immediately++;
4262 while (string = (*entry_function) (text, matches))
4263 {
4264 if (matches + 1 == match_list_size)
4265@@ -1822,6 +2003,8 @@ rl_completion_matches (text, entry_funct
4266 match_list[++matches] = string;
4267 match_list[matches + 1] = (char *)NULL;
4268 }
4269+ if (_rl_interrupt_immediately > 0)
4270+ _rl_interrupt_immediately--;
4271
4272 /* If there were any matches, then look through them finding out the
4273 lowest common denominator. That then becomes match_list[0]. */
4274@@ -1829,7 +2012,7 @@ rl_completion_matches (text, entry_funct
4275 compute_lcd_of_matches (match_list, matches, text);
4276 else /* There were no matches. */
4277 {
4278- free (match_list);
4279+ xfree (match_list);
4280 match_list = (char **)NULL;
4281 }
4282 return (match_list);
4283@@ -1895,6 +2078,62 @@ rl_username_completion_function (text, s
4284 #endif /* !__WIN32__ && !__OPENNT */
4285 }
4286
4287+/* Return non-zero if CONVFN matches FILENAME up to the length of FILENAME
4288+ (FILENAME_LEN). If _rl_completion_case_fold is set, compare without
4289+ regard to the alphabetic case of characters. CONVFN is the possibly-
4290+ converted directory entry; FILENAME is what the user typed. */
4291+static int
4292+complete_fncmp (convfn, convlen, filename, filename_len)
4293+ const char *convfn;
4294+ int convlen;
4295+ const char *filename;
4296+ int filename_len;
4297+{
4298+ register char *s1, *s2;
4299+ int d, len;
4300+
4301+ /* Otherwise, if these match up to the length of filename, then
4302+ it is a match. */
4303+ if (_rl_completion_case_fold && _rl_completion_case_map)
4304+ {
4305+ /* Case-insensitive comparison treating _ and - as equivalent */
4306+ if (filename_len == 0)
4307+ return 1;
4308+ if (convlen < filename_len)
4309+ return 0;
4310+ s1 = (char *)convfn;
4311+ s2 = (char *)filename;
4312+ len = filename_len;
4313+ do
4314+ {
4315+ d = _rl_to_lower (*s1) - _rl_to_lower (*s2);
4316+ /* *s1 == [-_] && *s2 == [-_] */
4317+ if ((*s1 == '-' || *s1 == '_') && (*s2 == '-' || *s2 == '_'))
4318+ d = 0;
4319+ if (d != 0)
4320+ return 0;
4321+ s1++; s2++; /* already checked convlen >= filename_len */
4322+ }
4323+ while (--len != 0);
4324+ return 1;
4325+ }
4326+ else if (_rl_completion_case_fold)
4327+ {
4328+ if ((_rl_to_lower (convfn[0]) == _rl_to_lower (filename[0])) &&
4329+ (convlen >= filename_len) &&
4330+ (_rl_strnicmp (filename, convfn, filename_len) == 0))
4331+ return 1;
4332+ }
4333+ else
4334+ {
4335+ if ((convfn[0] == filename[0]) &&
4336+ (convlen >= filename_len) &&
4337+ (strncmp (filename, convfn, filename_len) == 0))
4338+ return 1;
4339+ }
4340+ return 0;
4341+}
4342+
4343 /* Okay, now we write the entry_function for filename completion. In the
4344 general case. Note that completion in the shell is a little different
4345 because of all the pathnames that must be followed when looking up the
4346@@ -1909,8 +2148,8 @@ rl_filename_completion_function (text, s
4347 static char *dirname = (char *)NULL;
4348 static char *users_dirname = (char *)NULL;
4349 static int filename_len;
4350- char *temp;
4351- int dirlen;
4352+ char *temp, *dentry, *convfn;
4353+ int dirlen, dentlen, convlen;
4354 struct dirent *entry;
4355
4356 /* If we don't have any state, then do some initialization. */
4357@@ -1961,26 +2200,52 @@ rl_filename_completion_function (text, s
4358
4359 /* We aren't done yet. We also support the "~user" syntax. */
4360
4361- /* Save the version of the directory that the user typed. */
4362- users_dirname = savestring (dirname);
4363+ /* Save the version of the directory that the user typed, dequoting
4364+ it if necessary. */
4365+ if (rl_completion_found_quote && rl_filename_dequoting_function)
4366+ users_dirname = (*rl_filename_dequoting_function) (dirname, rl_completion_quote_character);
4367+ else
4368+ users_dirname = savestring (dirname);
4369
4370 if (*dirname == '~')
4371 {
4372 temp = tilde_expand (dirname);
4373- free (dirname);
4374+ xfree (dirname);
4375 dirname = temp;
4376 }
4377
4378+ /* We have saved the possibly-dequoted version of the directory name
4379+ the user typed. Now transform the directory name we're going to
4380+ pass to opendir(2). The directory rewrite hook modifies only the
4381+ directory name; the directory completion hook modifies both the
4382+ directory name passed to opendir(2) and the version the user
4383+ typed. Both the directory completion and rewrite hooks should perform
4384+ any necessary dequoting. The hook functions return 1 if they modify
4385+ the directory name argument. If either hook returns 0, it should
4386+ not modify the directory name pointer passed as an argument. */
4387 if (rl_directory_rewrite_hook)
4388 (*rl_directory_rewrite_hook) (&dirname);
4389-
4390- if (rl_directory_completion_hook && (*rl_directory_completion_hook) (&dirname))
4391+ else if (rl_directory_completion_hook && (*rl_directory_completion_hook) (&dirname))
4392 {
4393- free (users_dirname);
4394+ xfree (users_dirname);
4395 users_dirname = savestring (dirname);
4396 }
4397-
4398+ else if (rl_completion_found_quote && rl_filename_dequoting_function)
4399+ {
4400+ /* delete single and double quotes */
4401+ xfree (dirname);
4402+ dirname = savestring (users_dirname);
4403+ }
4404 directory = opendir (dirname);
4405+
4406+ /* Now dequote a non-null filename. */
4407+ if (filename && *filename && rl_completion_found_quote && rl_filename_dequoting_function)
4408+ {
4409+ /* delete single and double quotes */
4410+ temp = (*rl_filename_dequoting_function) (filename, rl_completion_quote_character);
4411+ xfree (filename);
4412+ filename = temp;
4413+ }
4414 filename_len = strlen (filename);
4415
4416 rl_filename_completion_desired = 1;
4417@@ -1997,37 +2262,31 @@ rl_filename_completion_function (text, s
4418 entry = (struct dirent *)NULL;
4419 while (directory && (entry = readdir (directory)))
4420 {
4421+ convfn = dentry = entry->d_name;
4422+ convlen = dentlen = D_NAMLEN (entry);
4423+
4424+ if (rl_filename_rewrite_hook)
4425+ {
4426+ convfn = (*rl_filename_rewrite_hook) (dentry, dentlen);
4427+ convlen = (convfn == dentry) ? dentlen : strlen (convfn);
4428+ }
4429+
4430 /* Special case for no filename. If the user has disabled the
4431 `match-hidden-files' variable, skip filenames beginning with `.'.
4432 All other entries except "." and ".." match. */
4433 if (filename_len == 0)
4434 {
4435- if (_rl_match_hidden_files == 0 && HIDDEN_FILE (entry->d_name))
4436+ if (_rl_match_hidden_files == 0 && HIDDEN_FILE (convfn))
4437 continue;
4438
4439- if (entry->d_name[0] != '.' ||
4440- (entry->d_name[1] &&
4441- (entry->d_name[1] != '.' || entry->d_name[2])))
4442+ if (convfn[0] != '.' ||
4443+ (convfn[1] && (convfn[1] != '.' || convfn[2])))
4444 break;
4445 }
4446 else
4447 {
4448- /* Otherwise, if these match up to the length of filename, then
4449- it is a match. */
4450- if (_rl_completion_case_fold)
4451- {
4452- if ((_rl_to_lower (entry->d_name[0]) == _rl_to_lower (filename[0])) &&
4453- (((int)D_NAMLEN (entry)) >= filename_len) &&
4454- (_rl_strnicmp (filename, entry->d_name, filename_len) == 0))
4455- break;
4456- }
4457- else
4458- {
4459- if ((entry->d_name[0] == filename[0]) &&
4460- (((int)D_NAMLEN (entry)) >= filename_len) &&
4461- (strncmp (filename, entry->d_name, filename_len) == 0))
4462- break;
4463- }
4464+ if (complete_fncmp (convfn, convlen, filename, filename_len))
4465+ break;
4466 }
4467 }
4468
4469@@ -2040,17 +2299,17 @@ rl_filename_completion_function (text, s
4470 }
4471 if (dirname)
4472 {
4473- free (dirname);
4474+ xfree (dirname);
4475 dirname = (char *)NULL;
4476 }
4477 if (filename)
4478 {
4479- free (filename);
4480+ xfree (filename);
4481 filename = (char *)NULL;
4482 }
4483 if (users_dirname)
4484 {
4485- free (users_dirname);
4486+ xfree (users_dirname);
4487 users_dirname = (char *)NULL;
4488 }
4489
4490@@ -2084,27 +2343,30 @@ rl_filename_completion_function (text, s
4491 temp[dirlen++] = '/';
4492 }
4493
4494- strcpy (temp + dirlen, entry->d_name);
4495+ strcpy (temp + dirlen, convfn);
4496 }
4497 else
4498- temp = savestring (entry->d_name);
4499+ temp = savestring (convfn);
4500+
4501+ if (convfn != dentry)
4502+ xfree (convfn);
4503
4504 return (temp);
4505 }
4506 }
4507
4508 /* An initial implementation of a menu completion function a la tcsh. The
4509- first time (if the last readline command was not rl_menu_complete), we
4510+ first time (if the last readline command was not rl_old_menu_complete), we
4511 generate the list of matches. This code is very similar to the code in
4512 rl_complete_internal -- there should be a way to combine the two. Then,
4513 for each item in the list of matches, we insert the match in an undoable
4514 fashion, with the appropriate character appended (this happens on the
4515- second and subsequent consecutive calls to rl_menu_complete). When we
4516+ second and subsequent consecutive calls to rl_old_menu_complete). When we
4517 hit the end of the match list, we restore the original unmatched text,
4518 ring the bell, and reset the counter to zero. */
4519 int
4520-rl_menu_complete (count, ignore)
4521- int count, ignore;
4522+rl_old_menu_complete (count, invoking_key)
4523+ int count, invoking_key;
4524 {
4525 rl_compentry_func_t *our_func;
4526 int matching_filenames, found_quote;
4527@@ -2119,7 +2381,7 @@ rl_menu_complete (count, ignore)
4528
4529 /* The first time through, we generate the list of matches and set things
4530 up to insert them. */
4531- if (rl_last_func != rl_menu_complete)
4532+ if (rl_last_func != rl_old_menu_complete)
4533 {
4534 /* Clean up from previous call, if any. */
4535 FREE (orig_text);
4536@@ -2129,10 +2391,16 @@ rl_menu_complete (count, ignore)
4537 match_list_index = match_list_size = 0;
4538 matches = (char **)NULL;
4539
4540+ rl_completion_invoking_key = invoking_key;
4541+
4542+ RL_SETSTATE(RL_STATE_COMPLETING);
4543+
4544 /* Only the completion entry function can change these. */
4545 set_completion_defaults ('%');
4546
4547- our_func = rl_completion_entry_function
4548+ our_func = rl_menu_completion_entry_function;
4549+ if (our_func == 0)
4550+ our_func = rl_completion_entry_function
4551 ? rl_completion_entry_function
4552 : rl_filename_completion_function;
4553
4554@@ -2160,19 +2428,25 @@ rl_menu_complete (count, ignore)
4555
4556 if (matches == 0 || postprocess_matches (&matches, matching_filenames) == 0)
4557 {
4558- rl_ding ();
4559+ rl_ding ();
4560 FREE (matches);
4561 matches = (char **)0;
4562 FREE (orig_text);
4563 orig_text = (char *)0;
4564- completion_changed_buffer = 0;
4565- return (0);
4566+ completion_changed_buffer = 0;
4567+ RL_UNSETSTATE(RL_STATE_COMPLETING);
4568+ return (0);
4569 }
4570
4571+ RL_UNSETSTATE(RL_STATE_COMPLETING);
4572+
4573 for (match_list_size = 0; matches[match_list_size]; match_list_size++)
4574 ;
4575 /* matches[0] is lcd if match_list_size > 1, but the circular buffer
4576 code below should take care of it. */
4577+
4578+ if (match_list_size > 1 && _rl_complete_show_all)
4579+ display_matches (matches);
4580 }
4581
4582 /* Now we have the list of matches. Replace the text between
4583@@ -2190,7 +2464,10 @@ rl_menu_complete (count, ignore)
4584
4585 match_list_index += count;
4586 if (match_list_index < 0)
4587- match_list_index += match_list_size;
4588+ {
4589+ while (match_list_index < 0)
4590+ match_list_index += match_list_size;
4591+ }
4592 else
4593 match_list_index %= match_list_size;
4594
4595@@ -2209,3 +2486,180 @@ rl_menu_complete (count, ignore)
4596 completion_changed_buffer = 1;
4597 return (0);
4598 }
4599+
4600+int
4601+rl_menu_complete (count, ignore)
4602+ int count, ignore;
4603+{
4604+ rl_compentry_func_t *our_func;
4605+ int matching_filenames, found_quote;
4606+
4607+ static char *orig_text;
4608+ static char **matches = (char **)0;
4609+ static int match_list_index = 0;
4610+ static int match_list_size = 0;
4611+ static int nontrivial_lcd = 0;
4612+ static int full_completion = 0; /* set to 1 if menu completion should reinitialize on next call */
4613+ static int orig_start, orig_end;
4614+ static char quote_char;
4615+ static int delimiter, cstate;
4616+
4617+ /* The first time through, we generate the list of matches and set things
4618+ up to insert them. */
4619+ if ((rl_last_func != rl_menu_complete && rl_last_func != rl_backward_menu_complete) || full_completion)
4620+ {
4621+ /* Clean up from previous call, if any. */
4622+ FREE (orig_text);
4623+ if (matches)
4624+ _rl_free_match_list (matches);
4625+
4626+ match_list_index = match_list_size = 0;
4627+ matches = (char **)NULL;
4628+
4629+ full_completion = 0;
4630+
4631+ RL_SETSTATE(RL_STATE_COMPLETING);
4632+
4633+ /* Only the completion entry function can change these. */
4634+ set_completion_defaults ('%');
4635+
4636+ our_func = rl_menu_completion_entry_function;
4637+ if (our_func == 0)
4638+ our_func = rl_completion_entry_function
4639+ ? rl_completion_entry_function
4640+ : rl_filename_completion_function;
4641+
4642+ /* We now look backwards for the start of a filename/variable word. */
4643+ orig_end = rl_point;
4644+ found_quote = delimiter = 0;
4645+ quote_char = '\0';
4646+
4647+ if (rl_point)
4648+ /* This (possibly) changes rl_point. If it returns a non-zero char,
4649+ we know we have an open quote. */
4650+ quote_char = _rl_find_completion_word (&found_quote, &delimiter);
4651+
4652+ orig_start = rl_point;
4653+ rl_point = orig_end;
4654+
4655+ orig_text = rl_copy_text (orig_start, orig_end);
4656+ matches = gen_completion_matches (orig_text, orig_start, orig_end,
4657+ our_func, found_quote, quote_char);
4658+
4659+ nontrivial_lcd = matches && strcmp (orig_text, matches[0]) != 0;
4660+
4661+ /* If we are matching filenames, the attempted completion function will
4662+ have set rl_filename_completion_desired to a non-zero value. The basic
4663+ rl_filename_completion_function does this. */
4664+ matching_filenames = rl_filename_completion_desired;
4665+
4666+ if (matches == 0 || postprocess_matches (&matches, matching_filenames) == 0)
4667+ {
4668+ rl_ding ();
4669+ FREE (matches);
4670+ matches = (char **)0;
4671+ FREE (orig_text);
4672+ orig_text = (char *)0;
4673+ completion_changed_buffer = 0;
4674+ RL_UNSETSTATE(RL_STATE_COMPLETING);
4675+ return (0);
4676+ }
4677+
4678+ RL_UNSETSTATE(RL_STATE_COMPLETING);
4679+
4680+ for (match_list_size = 0; matches[match_list_size]; match_list_size++)
4681+ ;
4682+
4683+ if (match_list_size == 0)
4684+ {
4685+ rl_ding ();
4686+ FREE (matches);
4687+ matches = (char **)0;
4688+ match_list_index = 0;
4689+ completion_changed_buffer = 0;
4690+ return (0);
4691+ }
4692+
4693+ /* matches[0] is lcd if match_list_size > 1, but the circular buffer
4694+ code below should take care of it. */
4695+ if (*matches[0])
4696+ {
4697+ insert_match (matches[0], orig_start, matches[1] ? MULT_MATCH : SINGLE_MATCH, &quote_char);
4698+ orig_end = orig_start + strlen (matches[0]);
4699+ completion_changed_buffer = STREQ (orig_text, matches[0]) == 0;
4700+ }
4701+
4702+ if (match_list_size > 1 && _rl_complete_show_all)
4703+ {
4704+ display_matches (matches);
4705+ /* If there are so many matches that the user has to be asked
4706+ whether or not he wants to see the matches, menu completion
4707+ is unwieldy. */
4708+ if (rl_completion_query_items > 0 && match_list_size >= rl_completion_query_items)
4709+ {
4710+ rl_ding ();
4711+ FREE (matches);
4712+ matches = (char **)0;
4713+ full_completion = 1;
4714+ return (0);
4715+ }
4716+ }
4717+ else if (match_list_size <= 1)
4718+ {
4719+ append_to_match (matches[0], delimiter, quote_char, nontrivial_lcd);
4720+ full_completion = 1;
4721+ return (0);
4722+ }
4723+ else if (_rl_menu_complete_prefix_first && match_list_size > 1)
4724+ {
4725+ rl_ding ();
4726+ return (0);
4727+ }
4728+ }
4729+
4730+ /* Now we have the list of matches. Replace the text between
4731+ rl_line_buffer[orig_start] and rl_line_buffer[rl_point] with
4732+ matches[match_list_index], and add any necessary closing char. */
4733+
4734+ if (matches == 0 || match_list_size == 0)
4735+ {
4736+ rl_ding ();
4737+ FREE (matches);
4738+ matches = (char **)0;
4739+ completion_changed_buffer = 0;
4740+ return (0);
4741+ }
4742+
4743+ match_list_index += count;
4744+ if (match_list_index < 0)
4745+ {
4746+ while (match_list_index < 0)
4747+ match_list_index += match_list_size;
4748+ }
4749+ else
4750+ match_list_index %= match_list_size;
4751+
4752+ if (match_list_index == 0 && match_list_size > 1)
4753+ {
4754+ rl_ding ();
4755+ insert_match (matches[0], orig_start, MULT_MATCH, &quote_char);
4756+ }
4757+ else
4758+ {
4759+ insert_match (matches[match_list_index], orig_start, SINGLE_MATCH, &quote_char);
4760+ append_to_match (matches[match_list_index], delimiter, quote_char,
4761+ strcmp (orig_text, matches[match_list_index]));
4762+ }
4763+
4764+ completion_changed_buffer = 1;
4765+ return (0);
4766+}
4767+
4768+int
4769+rl_backward_menu_complete (count, key)
4770+ int count, key;
4771+{
4772+ /* Positive arguments to backward-menu-complete translate into negative
4773+ arguments for menu-complete, and vice versa. */
4774+ return (rl_menu_complete (-count, key));
4775+}
4776Index: gdb-7.2.90.20110703/readline/config.h.in
4777===================================================================
4778--- gdb-7.2.90.20110703.orig/readline/config.h.in 2011-07-03 10:40:53.000000000 +0200
4779+++ gdb-7.2.90.20110703/readline/config.h.in 2011-07-03 10:41:21.000000000 +0200
4780@@ -4,6 +4,8 @@
4781 characters, even if the OS supports them. */
4782 #undef NO_MULTIBYTE_SUPPORT
4783
4784+#undef _FILE_OFFSET_BITS
4785+
4786 /* Define if on MINIX. */
4787 #undef _MINIX
4788
4789@@ -13,12 +15,16 @@
4790 #undef VOID_SIGHANDLER
4791
4792 /* Characteristics of the compiler. */
4793-#undef const
4794+#undef sig_atomic_t
4795
4796 #undef size_t
4797
4798 #undef ssize_t
4799
4800+#undef const
4801+
4802+#undef volatile
4803+
4804 #undef PROTOTYPES
4805
4806 #undef __CHAR_UNSIGNED__
4807@@ -41,6 +47,15 @@
4808 /* Define if you have the isascii function. */
4809 #undef HAVE_ISASCII
4810
4811+/* Define if you have the iswctype function. */
4812+#undef HAVE_ISWCTYPE
4813+
4814+/* Define if you have the iswlower function. */
4815+#undef HAVE_ISWLOWER
4816+
4817+/* Define if you have the iswupper function. */
4818+#undef HAVE_ISWUPPER
4819+
4820 /* Define if you have the isxdigit function. */
4821 #undef HAVE_ISXDIGIT
4822
4823@@ -88,11 +103,23 @@
4824 /* Define if you have the tcgetattr function. */
4825 #undef HAVE_TCGETATTR
4826
4827+/* Define if you have the towlower function. */
4828+#undef HAVE_TOWLOWER
4829+
4830+/* Define if you have the towupper function. */
4831+#undef HAVE_TOWUPPER
4832+
4833 /* Define if you have the vsnprintf function. */
4834 #undef HAVE_VSNPRINTF
4835
4836-/* Define if you have the wctomb function. */
4837-#undef HAVE_WCTOMB
4838+/* Define if you have the wcrtomb function. */
4839+#undef HAVE_WCRTOMB
4840+
4841+/* Define if you have the wcscoll function. */
4842+#undef HAVE_WCSCOLL
4843+
4844+/* Define if you have the wctype function. */
4845+#undef HAVE_WCTYPE
4846
4847 /* Define if you have the wcwidth function. */
4848 #undef HAVE_WCWIDTH
4849@@ -174,11 +201,20 @@
4850 /* Define if you have the <wchar.h> header file. */
4851 #undef HAVE_WCHAR_H
4852
4853-/* Define if you have the <varargs.h> header file. */
4854+/* Define if you have the <wctype.h> header file. */
4855 #undef HAVE_WCTYPE_H
4856
4857 #undef HAVE_MBSTATE_T
4858
4859+/* Define if you have wchar_t in <wctype.h>. */
4860+#undef HAVE_WCHAR_T
4861+
4862+/* Define if you have wctype_t in <wctype.h>. */
4863+#undef HAVE_WCTYPE_T
4864+
4865+/* Define if you have wint_t in <wctype.h>. */
4866+#undef HAVE_WINT_T
4867+
4868 /* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
4869 #undef HAVE_LANGINFO_CODESET
4870
4871@@ -223,10 +259,6 @@
4872 # define TERMIOS_MISSING
4873 #endif
4874
4875-#if defined (STRCOLL_BROKEN)
4876-# undef HAVE_STRCOLL
4877-#endif
4878-
4879 #if defined (__STDC__) && defined (HAVE_STDARG_H)
4880 # define PREFER_STDARG
4881 # define USE_VARARGS
4882Index: gdb-7.2.90.20110703/readline/configure
4883===================================================================
4884--- gdb-7.2.90.20110703.orig/readline/configure 2011-07-03 10:40:53.000000000 +0200
4885+++ gdb-7.2.90.20110703/readline/configure 2011-07-03 10:41:21.000000000 +0200
4886@@ -1,7 +1,7 @@
4887 #! /bin/sh
4888-# From configure.in for Readline 5.1, version 2.59.
4889+# From configure.in for Readline 6.2, version 2.67.
4890 # Guess values for system-dependent variables and create Makefiles.
4891-# Generated by GNU Autoconf 2.64 for readline 5.1-release.
4892+# Generated by GNU Autoconf 2.64 for readline 6.2.
4893 #
4894 # Report bugs to <bug-readline@gnu.org>.
4895 #
4896@@ -550,8 +550,8 @@ MAKEFLAGS=
4897 # Identity of this package.
4898 PACKAGE_NAME='readline'
4899 PACKAGE_TARNAME='readline'
4900-PACKAGE_VERSION='5.1-release'
4901-PACKAGE_STRING='readline 5.1-release'
4902+PACKAGE_VERSION='6.2'
4903+PACKAGE_STRING='readline 6.2'
4904 PACKAGE_BUGREPORT='bug-readline@gnu.org'
4905 PACKAGE_URL=''
4906
4907@@ -593,7 +593,6 @@ ac_includes_default="\
4908 #endif"
4909
4910 ac_subst_vars='LTLIBOBJS
4911-LIBOBJS
4912 TERMCAP_LIB
4913 LIBVERSION
4914 ARFLAGS
4915@@ -623,14 +622,13 @@ SHOBJ_LDFLAGS
4916 SHOBJ_LD
4917 SHOBJ_CFLAGS
4918 SHOBJ_CC
4919-WCWIDTH_OBJ
4920+LIBOBJS
4921 MAKE_SHELL
4922 RANLIB
4923 AR
4924 INSTALL_DATA
4925 INSTALL_SCRIPT
4926 INSTALL_PROGRAM
4927-CC_FOR_BUILD
4928 EGREP
4929 GREP
4930 CPP
4931@@ -696,6 +694,7 @@ with_curses
4932 with_purify
4933 enable_multibyte
4934 enable_static
4935+enable_largefile
4936 '
4937 ac_precious_vars='build_alias
4938 host_alias
4939@@ -1247,7 +1246,7 @@ if test "$ac_init_help" = "long"; then
4940 # Omit some internal or obsolete options to make the list less imposing.
4941 # This message is too long to be a string in the A/UX 3.1 sh.
4942 cat <<_ACEOF
4943-\`configure' configures readline 5.1-release to adapt to many kinds of systems.
4944+\`configure' configures readline 6.2 to adapt to many kinds of systems.
4945
4946 Usage: $0 [OPTION]... [VAR=VALUE]...
4947
4948@@ -1312,7 +1311,7 @@ fi
4949
4950 if test -n "$ac_init_help"; then
4951 case $ac_init_help in
4952- short | recursive ) echo "Configuration of readline 5.1-release:";;
4953+ short | recursive ) echo "Configuration of readline 6.2:";;
4954 esac
4955 cat <<\_ACEOF
4956
4957@@ -1322,6 +1321,7 @@ Optional Features:
4958 --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
4959 --enable-multibyte enable multibyte characters if OS supports them
4960 --enable-static build static libraries [default=YES]
4961+ --disable-largefile omit support for large files
4962
4963 Optional Packages:
4964 --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
4965@@ -1406,7 +1406,7 @@ fi
4966 test -n "$ac_init_help" && exit $ac_status
4967 if $ac_init_version; then
4968 cat <<\_ACEOF
4969-readline configure 5.1-release
4970+readline configure 6.2
4971 generated by GNU Autoconf 2.64
4972
4973 Copyright (C) 2009 Free Software Foundation, Inc.
4974@@ -1831,7 +1831,7 @@ cat >config.log <<_ACEOF
4975 This file contains any messages produced by compilers while
4976 running configure, to aid debugging if configure makes a mistake.
4977
4978-It was created by readline $as_me 5.1-release, which was
4979+It was created by readline $as_me 6.2, which was
4980 generated by GNU Autoconf 2.64. Invocation command line was
4981
4982 $ $0 $@
4983@@ -2211,7 +2211,7 @@ ac_configure="$SHELL $ac_aux_dir/configu
4984 ac_config_headers="$ac_config_headers config.h"
4985
4986
4987-LIBVERSION=5.1
4988+LIBVERSION=6.2
4989
4990 # Make sure we can run config.sub.
4991 $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
4992@@ -3622,39 +3622,6 @@ $as_echo "$ac_cv_safe_to_define___extens
4993
4994
4995
4996-
4997-if test "x$cross_compiling" = "xyes"; then
4998- case "${host}" in
4999- *-cygwin*)
5000- cross_cache=${srcdir}/cross-build/cygwin.cache
5001- LOCAL_CFLAGS="$LOCAL_CFLAGS -I${srcdir}/../libtermcap"
5002- ;;
5003- *-mingw32*)
5004- cross_cache=${srcdir}/cross-build/mingw.cache
5005- ;;
5006- *) echo "configure: cross-compiling for a non-cygwin target is not supported" >&2
5007- ;;
5008- esac
5009-
5010- if test "x$cross_cache" != "x"; then
5011- if test -r "${cross_cache}"; then
5012- echo "loading cross-build cache file ${cross_cache}"
5013- . ${cross_cache}
5014- fi
5015- unset cross_cache
5016- fi
5017-fi
5018-
5019-if test -z "$CC_FOR_BUILD"; then
5020- if test "x$cross_compiling" = "xno"; then
5021- CC_FOR_BUILD='$(CC)'
5022- else
5023- CC_FOR_BUILD=gcc
5024- fi
5025-fi
5026-
5027-
5028-
5029 # If we're using gcc and the user hasn't specified CFLAGS, add -O to CFLAGS.
5030 test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O"
5031
5032@@ -4056,6 +4023,40 @@ if test $ac_cv_c_char_unsigned = yes &&
5033
5034 fi
5035
5036+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working volatile" >&5
5037+$as_echo_n "checking for working volatile... " >&6; }
5038+if test "${ac_cv_c_volatile+set}" = set; then :
5039+ $as_echo_n "(cached) " >&6
5040+else
5041+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
5042+/* end confdefs.h. */
5043+
5044+int
5045+main ()
5046+{
5047+
5048+volatile int x;
5049+int * volatile y = (int *) 0;
5050+return !x && !y;
5051+ ;
5052+ return 0;
5053+}
5054+_ACEOF
5055+if ac_fn_c_try_compile "$LINENO"; then :
5056+ ac_cv_c_volatile=yes
5057+else
5058+ ac_cv_c_volatile=no
5059+fi
5060+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5061+fi
5062+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_volatile" >&5
5063+$as_echo "$ac_cv_c_volatile" >&6; }
5064+if test $ac_cv_c_volatile = no; then
5065+
5066+$as_echo "#define volatile /**/" >>confdefs.h
5067+
5068+fi
5069+
5070
5071 { $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5
5072 $as_echo_n "checking return type of signal handlers... " >&6; }
5073@@ -4571,6 +4572,205 @@ fi
5074 done
5075
5076
5077+# Check whether --enable-largefile was given.
5078+if test "${enable_largefile+set}" = set; then :
5079+ enableval=$enable_largefile;
5080+fi
5081+
5082+if test "$enable_largefile" != no; then
5083+
5084+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5
5085+$as_echo_n "checking for special C compiler options needed for large files... " >&6; }
5086+if test "${ac_cv_sys_largefile_CC+set}" = set; then :
5087+ $as_echo_n "(cached) " >&6
5088+else
5089+ ac_cv_sys_largefile_CC=no
5090+ if test "$GCC" != yes; then
5091+ ac_save_CC=$CC
5092+ while :; do
5093+ # IRIX 6.2 and later do not support large files by default,
5094+ # so use the C compiler's -n32 option if that helps.
5095+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
5096+/* end confdefs.h. */
5097+#include <sys/types.h>
5098+ /* Check that off_t can represent 2**63 - 1 correctly.
5099+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
5100+ since some C++ compilers masquerading as C compilers
5101+ incorrectly reject 9223372036854775807. */
5102+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
5103+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
5104+ && LARGE_OFF_T % 2147483647 == 1)
5105+ ? 1 : -1];
5106+int
5107+main ()
5108+{
5109+
5110+ ;
5111+ return 0;
5112+}
5113+_ACEOF
5114+ if ac_fn_c_try_compile "$LINENO"; then :
5115+ break
5116+fi
5117+rm -f core conftest.err conftest.$ac_objext
5118+ CC="$CC -n32"
5119+ if ac_fn_c_try_compile "$LINENO"; then :
5120+ ac_cv_sys_largefile_CC=' -n32'; break
5121+fi
5122+rm -f core conftest.err conftest.$ac_objext
5123+ break
5124+ done
5125+ CC=$ac_save_CC
5126+ rm -f conftest.$ac_ext
5127+ fi
5128+fi
5129+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5
5130+$as_echo "$ac_cv_sys_largefile_CC" >&6; }
5131+ if test "$ac_cv_sys_largefile_CC" != no; then
5132+ CC=$CC$ac_cv_sys_largefile_CC
5133+ fi
5134+
5135+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5
5136+$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; }
5137+if test "${ac_cv_sys_file_offset_bits+set}" = set; then :
5138+ $as_echo_n "(cached) " >&6
5139+else
5140+ while :; do
5141+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
5142+/* end confdefs.h. */
5143+#include <sys/types.h>
5144+ /* Check that off_t can represent 2**63 - 1 correctly.
5145+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
5146+ since some C++ compilers masquerading as C compilers
5147+ incorrectly reject 9223372036854775807. */
5148+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
5149+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
5150+ && LARGE_OFF_T % 2147483647 == 1)
5151+ ? 1 : -1];
5152+int
5153+main ()
5154+{
5155+
5156+ ;
5157+ return 0;
5158+}
5159+_ACEOF
5160+if ac_fn_c_try_compile "$LINENO"; then :
5161+ ac_cv_sys_file_offset_bits=no; break
5162+fi
5163+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5164+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
5165+/* end confdefs.h. */
5166+#define _FILE_OFFSET_BITS 64
5167+#include <sys/types.h>
5168+ /* Check that off_t can represent 2**63 - 1 correctly.
5169+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
5170+ since some C++ compilers masquerading as C compilers
5171+ incorrectly reject 9223372036854775807. */
5172+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
5173+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
5174+ && LARGE_OFF_T % 2147483647 == 1)
5175+ ? 1 : -1];
5176+int
5177+main ()
5178+{
5179+
5180+ ;
5181+ return 0;
5182+}
5183+_ACEOF
5184+if ac_fn_c_try_compile "$LINENO"; then :
5185+ ac_cv_sys_file_offset_bits=64; break
5186+fi
5187+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5188+ ac_cv_sys_file_offset_bits=unknown
5189+ break
5190+done
5191+fi
5192+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5
5193+$as_echo "$ac_cv_sys_file_offset_bits" >&6; }
5194+case $ac_cv_sys_file_offset_bits in #(
5195+ no | unknown) ;;
5196+ *)
5197+cat >>confdefs.h <<_ACEOF
5198+#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits
5199+_ACEOF
5200+;;
5201+esac
5202+rm -rf conftest*
5203+ if test $ac_cv_sys_file_offset_bits = unknown; then
5204+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5
5205+$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; }
5206+if test "${ac_cv_sys_large_files+set}" = set; then :
5207+ $as_echo_n "(cached) " >&6
5208+else
5209+ while :; do
5210+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
5211+/* end confdefs.h. */
5212+#include <sys/types.h>
5213+ /* Check that off_t can represent 2**63 - 1 correctly.
5214+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
5215+ since some C++ compilers masquerading as C compilers
5216+ incorrectly reject 9223372036854775807. */
5217+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
5218+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
5219+ && LARGE_OFF_T % 2147483647 == 1)
5220+ ? 1 : -1];
5221+int
5222+main ()
5223+{
5224+
5225+ ;
5226+ return 0;
5227+}
5228+_ACEOF
5229+if ac_fn_c_try_compile "$LINENO"; then :
5230+ ac_cv_sys_large_files=no; break
5231+fi
5232+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5233+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
5234+/* end confdefs.h. */
5235+#define _LARGE_FILES 1
5236+#include <sys/types.h>
5237+ /* Check that off_t can represent 2**63 - 1 correctly.
5238+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
5239+ since some C++ compilers masquerading as C compilers
5240+ incorrectly reject 9223372036854775807. */
5241+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
5242+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
5243+ && LARGE_OFF_T % 2147483647 == 1)
5244+ ? 1 : -1];
5245+int
5246+main ()
5247+{
5248+
5249+ ;
5250+ return 0;
5251+}
5252+_ACEOF
5253+if ac_fn_c_try_compile "$LINENO"; then :
5254+ ac_cv_sys_large_files=1; break
5255+fi
5256+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5257+ ac_cv_sys_large_files=unknown
5258+ break
5259+done
5260+fi
5261+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5
5262+$as_echo "$ac_cv_sys_large_files" >&6; }
5263+case $ac_cv_sys_large_files in #(
5264+ no | unknown) ;;
5265+ *)
5266+cat >>confdefs.h <<_ACEOF
5267+#define _LARGE_FILES $ac_cv_sys_large_files
5268+_ACEOF
5269+;;
5270+esac
5271+rm -rf conftest*
5272+ fi
5273+fi
5274+
5275+
5276
5277 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for type of signal functions" >&5
5278 $as_echo_n "checking for type of signal functions... " >&6; }
5279@@ -5078,6 +5278,49 @@ $as_echo "#define GWINSZ_IN_SYS_IOCTL 1"
5280 fi
5281
5282
5283+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sig_atomic_t in signal.h" >&5
5284+$as_echo_n "checking for sig_atomic_t in signal.h... " >&6; }
5285+if test "${ac_cv_have_sig_atomic_t+set}" = set; then :
5286+ $as_echo_n "(cached) " >&6
5287+else
5288+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
5289+/* end confdefs.h. */
5290+
5291+#include <signal.h>
5292+
5293+int
5294+main ()
5295+{
5296+ sig_atomic_t x;
5297+ ;
5298+ return 0;
5299+}
5300+_ACEOF
5301+if ac_fn_c_try_link "$LINENO"; then :
5302+ ac_cv_have_sig_atomic_t=yes
5303+else
5304+ ac_cv_have_sig_atomic_t=no
5305+fi
5306+rm -f core conftest.err conftest.$ac_objext \
5307+ conftest$ac_exeext conftest.$ac_ext
5308+fi
5309+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_sig_atomic_t" >&5
5310+$as_echo "$ac_cv_have_sig_atomic_t" >&6; }
5311+if test "$ac_cv_have_sig_atomic_t" = "no"
5312+then
5313+ ac_fn_c_check_type "$LINENO" "sig_atomic_t" "ac_cv_type_sig_atomic_t" "$ac_includes_default"
5314+if test "x$ac_cv_type_sig_atomic_t" = x""yes; then :
5315+
5316+else
5317+
5318+cat >>confdefs.h <<_ACEOF
5319+#define sig_atomic_t int
5320+_ACEOF
5321+
5322+fi
5323+
5324+fi
5325+
5326 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether signal handlers are of type void" >&5
5327 $as_echo_n "checking whether signal handlers are of type void... " >&6; }
5328 if test "${bash_cv_void_sighandler+set}" = set; then :
5329@@ -5116,6 +5359,7 @@ $as_echo "#define VOID_SIGHANDLER 1" >>c
5330
5331 fi
5332
5333+
5334 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for TIOCSTAT in sys/ioctl.h" >&5
5335 $as_echo_n "checking for TIOCSTAT in sys/ioctl.h... " >&6; }
5336 if test "${bash_cv_tiocstat_in_ioctl+set}" = set; then :
5337@@ -5638,27 +5882,73 @@ fi
5338 done
5339
5340
5341+ac_fn_c_check_func "$LINENO" "mbrlen" "ac_cv_func_mbrlen"
5342+if test "x$ac_cv_func_mbrlen" = x""yes; then :
5343+ $as_echo "#define HAVE_MBRLEN 1" >>confdefs.h
5344+
5345+fi
5346+
5347+ac_fn_c_check_func "$LINENO" "mbscasecmp" "ac_cv_func_mbscasecmp"
5348+if test "x$ac_cv_func_mbscasecmp" = x""yes; then :
5349+ $as_echo "#define HAVE_MBSCMP 1" >>confdefs.h
5350+
5351+fi
5352+
5353+ac_fn_c_check_func "$LINENO" "mbscmp" "ac_cv_func_mbscmp"
5354+if test "x$ac_cv_func_mbscmp" = x""yes; then :
5355+ $as_echo "#define HAVE_MBSCMP 1" >>confdefs.h
5356+
5357+fi
5358+
5359+ac_fn_c_check_func "$LINENO" "mbsnrtowcs" "ac_cv_func_mbsnrtowcs"
5360+if test "x$ac_cv_func_mbsnrtowcs" = x""yes; then :
5361+ $as_echo "#define HAVE_MBSNRTOWCS 1" >>confdefs.h
5362+
5363+fi
5364+
5365 ac_fn_c_check_func "$LINENO" "mbsrtowcs" "ac_cv_func_mbsrtowcs"
5366 if test "x$ac_cv_func_mbsrtowcs" = x""yes; then :
5367 $as_echo "#define HAVE_MBSRTOWCS 1" >>confdefs.h
5368
5369 fi
5370
5371-ac_fn_c_check_func "$LINENO" "mbrtowc" "ac_cv_func_mbrtowc"
5372-if test "x$ac_cv_func_mbrtowc" = x""yes; then :
5373- $as_echo "#define HAVE_MBRTOWC 1" >>confdefs.h
5374+
5375+
5376+for ac_func in mbschr
5377+do :
5378+ ac_fn_c_check_func "$LINENO" "mbschr" "ac_cv_func_mbschr"
5379+if test "x$ac_cv_func_mbschr" = x""yes; then :
5380+ cat >>confdefs.h <<_ACEOF
5381+#define HAVE_MBSCHR 1
5382+_ACEOF
5383+
5384+else
5385+ case " $LIBOBJS " in
5386+ *" $ac_func.$ac_objext "* ) ;;
5387+ *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext"
5388+ ;;
5389+esac
5390
5391 fi
5392+done
5393
5394-ac_fn_c_check_func "$LINENO" "mbrlen" "ac_cv_func_mbrlen"
5395-if test "x$ac_cv_func_mbrlen" = x""yes; then :
5396- $as_echo "#define HAVE_MBRLEN 1" >>confdefs.h
5397+
5398+
5399+ac_fn_c_check_func "$LINENO" "wcrtomb" "ac_cv_func_wcrtomb"
5400+if test "x$ac_cv_func_wcrtomb" = x""yes; then :
5401+ $as_echo "#define HAVE_WCRTOMB 1" >>confdefs.h
5402
5403 fi
5404
5405-ac_fn_c_check_func "$LINENO" "wctomb" "ac_cv_func_wctomb"
5406-if test "x$ac_cv_func_wctomb" = x""yes; then :
5407- $as_echo "#define HAVE_WCTOMB 1" >>confdefs.h
5408+ac_fn_c_check_func "$LINENO" "wcscoll" "ac_cv_func_wcscoll"
5409+if test "x$ac_cv_func_wcscoll" = x""yes; then :
5410+ $as_echo "#define HAVE_WCSCOLL 1" >>confdefs.h
5411+
5412+fi
5413+
5414+ac_fn_c_check_func "$LINENO" "wcsdup" "ac_cv_func_wcsdup"
5415+if test "x$ac_cv_func_wcsdup" = x""yes; then :
5416+ $as_echo "#define HAVE_WCSDUP 1" >>confdefs.h
5417
5418 fi
5419
5420@@ -5668,55 +5958,89 @@ if test "x$ac_cv_func_wcwidth" = x""yes;
5421
5422 fi
5423
5424-ac_fn_c_check_func "$LINENO" "wcsdup" "ac_cv_func_wcsdup"
5425-if test "x$ac_cv_func_wcsdup" = x""yes; then :
5426- $as_echo "#define HAVE_WCSDUP 1" >>confdefs.h
5427+ac_fn_c_check_func "$LINENO" "wctype" "ac_cv_func_wctype"
5428+if test "x$ac_cv_func_wctype" = x""yes; then :
5429+ $as_echo "#define HAVE_WCTYPE 1" >>confdefs.h
5430
5431 fi
5432
5433
5434-if test "$ac_cv_func_wcwidth" = no && test "$ac_cv_header_wchar_h" = yes; then
5435- WCWIDTH_OBJ=wcwidth.o
5436+for ac_func in wcswidth
5437+do :
5438+ ac_fn_c_check_func "$LINENO" "wcswidth" "ac_cv_func_wcswidth"
5439+if test "x$ac_cv_func_wcswidth" = x""yes; then :
5440+ cat >>confdefs.h <<_ACEOF
5441+#define HAVE_WCSWIDTH 1
5442+_ACEOF
5443+
5444 else
5445- WCWIDTH_OBJ=
5446+ case " $LIBOBJS " in
5447+ *" $ac_func.$ac_objext "* ) ;;
5448+ *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext"
5449+ ;;
5450+esac
5451+
5452 fi
5453+done
5454+
5455+
5456
5457
5458-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for mbstate_t" >&5
5459-$as_echo_n "checking for mbstate_t... " >&6; }
5460-if test "${bash_cv_have_mbstate_t+set}" = set; then :
5461+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc and mbstate_t are properly declared" >&5
5462+$as_echo_n "checking whether mbrtowc and mbstate_t are properly declared... " >&6; }
5463+if test "${ac_cv_func_mbrtowc+set}" = set; then :
5464 $as_echo_n "(cached) " >&6
5465 else
5466 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
5467 /* end confdefs.h. */
5468-
5469 #include <wchar.h>
5470 int
5471 main ()
5472 {
5473-
5474- mbstate_t ps;
5475- mbstate_t *psp;
5476- psp = (mbstate_t *)0;
5477-
5478+wchar_t wc;
5479+ char const s[] = "";
5480+ size_t n = 1;
5481+ mbstate_t state;
5482+ return ! (sizeof state && (mbrtowc) (&wc, s, n, &state));
5483 ;
5484 return 0;
5485 }
5486 _ACEOF
5487-if ac_fn_c_try_compile "$LINENO"; then :
5488- bash_cv_have_mbstate_t=yes
5489+if ac_fn_c_try_link "$LINENO"; then :
5490+ ac_cv_func_mbrtowc=yes
5491 else
5492- bash_cv_have_mbstate_t=no
5493+ ac_cv_func_mbrtowc=no
5494 fi
5495-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5496+rm -f core conftest.err conftest.$ac_objext \
5497+ conftest$ac_exeext conftest.$ac_ext
5498 fi
5499-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bash_cv_have_mbstate_t" >&5
5500-$as_echo "$bash_cv_have_mbstate_t" >&6; }
5501-if test $bash_cv_have_mbstate_t = yes; then
5502+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_mbrtowc" >&5
5503+$as_echo "$ac_cv_func_mbrtowc" >&6; }
5504+ if test $ac_cv_func_mbrtowc = yes; then
5505+
5506+$as_echo "#define HAVE_MBRTOWC 1" >>confdefs.h
5507+
5508+ fi
5509+
5510+if test $ac_cv_func_mbrtowc = yes; then
5511 $as_echo "#define HAVE_MBSTATE_T 1" >>confdefs.h
5512
5513 fi
5514
5515+for ac_func in iswlower iswupper towlower towupper iswctype
5516+do :
5517+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
5518+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
5519+eval as_val=\$$as_ac_var
5520+ if test "x$as_val" = x""yes; then :
5521+ cat >>confdefs.h <<_ACEOF
5522+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
5523+_ACEOF
5524+
5525+fi
5526+done
5527+
5528+
5529 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nl_langinfo and CODESET" >&5
5530 $as_echo_n "checking for nl_langinfo and CODESET... " >&6; }
5531 if test "${bash_cv_langinfo_codeset+set}" = set; then :
5532@@ -5748,6 +6072,126 @@ if test $bash_cv_langinfo_codeset = yes;
5533
5534 fi
5535
5536+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for wchar_t in wchar.h" >&5
5537+$as_echo_n "checking for wchar_t in wchar.h... " >&6; }
5538+if test "${bash_cv_type_wchar_t+set}" = set; then :
5539+ $as_echo_n "(cached) " >&6
5540+else
5541+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
5542+/* end confdefs.h. */
5543+#include <wchar.h>
5544+
5545+int
5546+main ()
5547+{
5548+
5549+ wchar_t foo;
5550+ foo = 0;
5551+
5552+ ;
5553+ return 0;
5554+}
5555+_ACEOF
5556+if ac_fn_c_try_compile "$LINENO"; then :
5557+ bash_cv_type_wchar_t=yes
5558+else
5559+ bash_cv_type_wchar_t=no
5560+fi
5561+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5562+fi
5563+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bash_cv_type_wchar_t" >&5
5564+$as_echo "$bash_cv_type_wchar_t" >&6; }
5565+if test $bash_cv_type_wchar_t = yes; then
5566+
5567+$as_echo "#define HAVE_WCHAR_T 1" >>confdefs.h
5568+
5569+fi
5570+
5571+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for wctype_t in wctype.h" >&5
5572+$as_echo_n "checking for wctype_t in wctype.h... " >&6; }
5573+if test "${bash_cv_type_wctype_t+set}" = set; then :
5574+ $as_echo_n "(cached) " >&6
5575+else
5576+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
5577+/* end confdefs.h. */
5578+#include <wctype.h>
5579+int
5580+main ()
5581+{
5582+
5583+ wctype_t foo;
5584+ foo = 0;
5585+
5586+ ;
5587+ return 0;
5588+}
5589+_ACEOF
5590+if ac_fn_c_try_compile "$LINENO"; then :
5591+ bash_cv_type_wctype_t=yes
5592+else
5593+ bash_cv_type_wctype_t=no
5594+fi
5595+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5596+fi
5597+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bash_cv_type_wctype_t" >&5
5598+$as_echo "$bash_cv_type_wctype_t" >&6; }
5599+if test $bash_cv_type_wctype_t = yes; then
5600+
5601+$as_echo "#define HAVE_WCTYPE_T 1" >>confdefs.h
5602+
5603+fi
5604+
5605+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for wint_t in wctype.h" >&5
5606+$as_echo_n "checking for wint_t in wctype.h... " >&6; }
5607+if test "${bash_cv_type_wint_t+set}" = set; then :
5608+ $as_echo_n "(cached) " >&6
5609+else
5610+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
5611+/* end confdefs.h. */
5612+#include <wctype.h>
5613+int
5614+main ()
5615+{
5616+
5617+ wint_t foo;
5618+ foo = 0;
5619+
5620+ ;
5621+ return 0;
5622+}
5623+_ACEOF
5624+if ac_fn_c_try_compile "$LINENO"; then :
5625+ bash_cv_type_wint_t=yes
5626+else
5627+ bash_cv_type_wint_t=no
5628+fi
5629+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5630+fi
5631+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bash_cv_type_wint_t" >&5
5632+$as_echo "$bash_cv_type_wint_t" >&6; }
5633+if test $bash_cv_type_wint_t = yes; then
5634+
5635+$as_echo "#define HAVE_WINT_T 1" >>confdefs.h
5636+
5637+fi
5638+
5639+if test "$am_cv_func_iconv" = yes; then
5640+ OLDLIBS="$LIBS"
5641+ LIBS="$LIBS $LIBICONV"
5642+ for ac_func in locale_charset
5643+do :
5644+ ac_fn_c_check_func "$LINENO" "locale_charset" "ac_cv_func_locale_charset"
5645+if test "x$ac_cv_func_locale_charset" = x""yes; then :
5646+ cat >>confdefs.h <<_ACEOF
5647+#define HAVE_LOCALE_CHARSET 1
5648+_ACEOF
5649+
5650+fi
5651+done
5652+
5653+ LIBS="$OLDLIBS"
5654+fi
5655+
5656
5657
5658 case "$host_cpu" in
5659@@ -6357,7 +6801,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_wri
5660 # report actual input values of CONFIG_FILES etc. instead of their
5661 # values after options handling.
5662 ac_log="
5663-This file was extended by readline $as_me 5.1-release, which was
5664+This file was extended by readline $as_me 6.2, which was
5665 generated by GNU Autoconf 2.64. Invocation command line was
5666
5667 CONFIG_FILES = $CONFIG_FILES
5668@@ -6421,7 +6865,7 @@ Report bugs to <bug-readline@gnu.org>."
5669 _ACEOF
5670 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
5671 ac_cs_version="\\
5672-readline config.status 5.1-release
5673+readline config.status 6.2
5674 configured by $0, generated by GNU Autoconf 2.64,
5675 with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
5676
5677Index: gdb-7.2.90.20110703/readline/configure.in
5678===================================================================
5679--- gdb-7.2.90.20110703.orig/readline/configure.in 2011-07-03 10:40:53.000000000 +0200
5680+++ gdb-7.2.90.20110703/readline/configure.in 2011-07-03 10:41:21.000000000 +0200
5681@@ -5,28 +5,26 @@ dnl report bugs to chet@po.cwru.edu
5682 dnl
5683 dnl Process this file with autoconf to produce a configure script.
5684
5685-# Copyright (C) 1987-2005 Free Software Foundation, Inc.
5686+# Copyright (C) 1987-2009 Free Software Foundation, Inc.
5687
5688-# This program is free software; you can redistribute it and/or modify
5689-# it under the terms of the GNU General Public License as published by
5690-# the Free Software Foundation; either version 2, or (at your option)
5691-# any later version.
5692-
5693-# This program is distributed in the hope that it will be useful,
5694-# but WITHOUT ANY WARRANTY; without even the implied warranty of
5695-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5696-# GNU General Public License for more details.
5697-
5698-# You should have received a copy of the GNU General Public License
5699-# along with this program; if not, write to the Free Software
5700-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
5701-# 02111-1307, USA.
5702+# This program is free software: you can redistribute it and/or modify
5703+# it under the terms of the GNU General Public License as published by
5704+# the Free Software Foundation, either version 3 of the License, or
5705+# (at your option) any later version.
5706+
5707+# This program is distributed in the hope that it will be useful,
5708+# but WITHOUT ANY WARRANTY; without even the implied warranty of
5709+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5710+# GNU General Public License for more details.
5711
5712-AC_REVISION([for Readline 5.1, version 2.59])
5713+# You should have received a copy of the GNU General Public License
5714+# along with this program. If not, see <http://www.gnu.org/licenses/>.
5715+
5716+AC_REVISION([for Readline 6.2, version 2.67])
5717
5718 m4_include([../config/override.m4])
5719
5720-AC_INIT(readline, 5.1-release, bug-readline@gnu.org)
5721+AC_INIT(readline, 6.2, bug-readline@gnu.org)
5722
5723 dnl make sure we are using a recent autoconf version
5724 AC_PREREQ(2.50)
5725@@ -38,7 +36,7 @@ AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..)
5726 AC_CONFIG_HEADERS(config.h)
5727
5728 dnl update the value of RL_READLINE_VERSION in readline.h when this changes
5729-LIBVERSION=5.1
5730+LIBVERSION=6.2
5731
5732 AC_CANONICAL_HOST
5733
5734@@ -115,44 +113,6 @@ AC_PROG_CC
5735 dnl AC_AIX
5736 AC_MINIX
5737
5738-dnl BEGIN changes for CYGNUS cross-building for Cygwin
5739-dnl NOTE: Some of these changes may no longer be necessary.
5740-
5741-dnl load up the cross-building cache file -- add more cases and cache
5742-dnl files as necessary
5743-if test "x$cross_compiling" = "xyes"; then
5744- case "${host}" in
5745- *-cygwin*)
5746- cross_cache=${srcdir}/cross-build/cygwin.cache
5747- LOCAL_CFLAGS="$LOCAL_CFLAGS -I${srcdir}/../libtermcap"
5748- ;;
5749- *-mingw32*)
5750- cross_cache=${srcdir}/cross-build/mingw.cache
5751- ;;
5752- *) echo "configure: cross-compiling for a non-cygwin target is not supported" >&2
5753- ;;
5754- esac
5755-
5756- if test "x$cross_cache" != "x"; then
5757- if test -r "${cross_cache}"; then
5758- echo "loading cross-build cache file ${cross_cache}"
5759- . ${cross_cache}
5760- fi
5761- unset cross_cache
5762- fi
5763-fi
5764-
5765-if test -z "$CC_FOR_BUILD"; then
5766- if test "x$cross_compiling" = "xno"; then
5767- CC_FOR_BUILD='$(CC)'
5768- else
5769- CC_FOR_BUILD=gcc
5770- fi
5771-fi
5772-AC_SUBST(CC_FOR_BUILD)
5773-
5774-dnl END changes for CYGNUS cross-building for Cygwin
5775-
5776 # If we're using gcc and the user hasn't specified CFLAGS, add -O to CFLAGS.
5777 test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O"
5778
5779@@ -170,6 +130,7 @@ AC_SUBST(MAKE_SHELL)
5780 AC_C_CONST
5781 AC_C_PROTOTYPES
5782 AC_C_CHAR_UNSIGNED
5783+AC_C_VOLATILE
5784
5785 AC_TYPE_SIGNAL
5786
5787@@ -200,6 +161,8 @@ AC_CHECK_HEADERS(sys/ptem.h,,,
5788 #endif
5789 ]])
5790
5791+AC_SYS_LARGEFILE
5792+
5793 BASH_SYS_SIGNAL_VINTAGE
5794 BASH_SYS_REINSTALL_SIGHANDLERS
5795
5796@@ -212,7 +175,9 @@ BASH_CHECK_GETPW_FUNCS
5797
5798 AC_HEADER_TIOCGWINSZ
5799
5800+BASH_TYPE_SIG_ATOMIC_T
5801 BASH_TYPE_SIGHANDLER
5802+
5803 BASH_HAVE_TIOCSTAT
5804 BASH_HAVE_FIONREAD
5805 BASH_CHECK_SPEED_T
5806Index: gdb-7.2.90.20110703/readline/display.c
5807===================================================================
5808--- gdb-7.2.90.20110703.orig/readline/display.c 2011-07-03 10:40:53.000000000 +0200
5809+++ gdb-7.2.90.20110703/readline/display.c 2011-07-03 10:41:21.000000000 +0200
5810@@ -1,24 +1,24 @@
5811 /* display.c -- readline redisplay facility. */
5812
5813-/* Copyright (C) 1987-2005 Free Software Foundation, Inc.
5814+/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
5815
5816- This file is part of the GNU Readline Library, a library for
5817- reading lines of text with interactive input and history editing.
5818+ This file is part of the GNU Readline Library (Readline), a library
5819+ for reading lines of text with interactive input and history editing.
5820
5821- The GNU Readline Library is free software; you can redistribute it
5822- and/or modify it under the terms of the GNU General Public License
5823- as published by the Free Software Foundation; either version 2, or
5824+ Readline is free software: you can redistribute it and/or modify
5825+ it under the terms of the GNU General Public License as published by
5826+ the Free Software Foundation, either version 3 of the License, or
5827 (at your option) any later version.
5828
5829- The GNU Readline Library is distributed in the hope that it will be
5830- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
5831- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5832+ Readline is distributed in the hope that it will be useful,
5833+ but WITHOUT ANY WARRANTY; without even the implied warranty of
5834+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5835 GNU General Public License for more details.
5836
5837- The GNU General Public License is often shipped with GNU software, and
5838- is generally kept in a file called COPYING or LICENSE. If you do not
5839- have a copy of the license, write to the Free Software Foundation,
5840- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
5841+ You should have received a copy of the GNU General Public License
5842+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
5843+*/
5844+
5845 #define READLINE_LIBRARY
5846
5847 #if defined (HAVE_CONFIG_H)
5848@@ -63,30 +63,59 @@
5849 extern char *strchr (), *strrchr ();
5850 #endif /* !strchr && !__STDC__ */
5851
5852-#if defined (HACK_TERMCAP_MOTION)
5853-extern char *_rl_term_forward_char;
5854-#endif
5855-
5856 static void update_line PARAMS((char *, char *, int, int, int, int));
5857 static void space_to_eol PARAMS((int));
5858 static void delete_chars PARAMS((int));
5859 static void insert_some_chars PARAMS((char *, int, int));
5860 static void cr PARAMS((void));
5861
5862+/* State of visible and invisible lines. */
5863+struct line_state
5864+ {
5865+ char *line;
5866+ int *lbreaks;
5867+ int lbsize;
5868 #if defined (HANDLE_MULTIBYTE)
5869-static int _rl_col_width PARAMS((const char *, int, int));
5870-static int *_rl_wrapped_line;
5871-#else
5872-# define _rl_col_width(l, s, e) (((e) <= (s)) ? 0 : (e) - (s))
5873+ int *wrapped_line;
5874+ int wbsize;
5875 #endif
5876+ };
5877+
5878+/* The line display buffers. One is the line currently displayed on
5879+ the screen. The other is the line about to be displayed. */
5880+static struct line_state line_state_array[2];
5881+static struct line_state *line_state_visible = &line_state_array[0];
5882+static struct line_state *line_state_invisible = &line_state_array[1];
5883+static int line_structures_initialized = 0;
5884
5885-static int *inv_lbreaks, *vis_lbreaks;
5886-static int inv_lbsize, vis_lbsize;
5887+/* Backwards-compatible names. */
5888+#define inv_lbreaks (line_state_invisible->lbreaks)
5889+#define inv_lbsize (line_state_invisible->lbsize)
5890+#define vis_lbreaks (line_state_visible->lbreaks)
5891+#define vis_lbsize (line_state_visible->lbsize)
5892+
5893+#define visible_line (line_state_visible->line)
5894+#define invisible_line (line_state_invisible->line)
5895+
5896+#if defined (HANDLE_MULTIBYTE)
5897+static int _rl_col_width PARAMS((const char *, int, int, int));
5898+#else
5899+# define _rl_col_width(l, s, e, f) (((e) <= (s)) ? 0 : (e) - (s))
5900+#endif
5901
5902 /* Heuristic used to decide whether it is faster to move from CUR to NEW
5903- by backing up or outputting a carriage return and moving forward. */
5904+ by backing up or outputting a carriage return and moving forward. CUR
5905+ and NEW are either both buffer positions or absolute screen positions. */
5906 #define CR_FASTER(new, cur) (((new) + 1) < ((cur) - (new)))
5907
5908+/* _rl_last_c_pos is an absolute cursor position in multibyte locales and a
5909+ buffer index in others. This macro is used when deciding whether the
5910+ current cursor position is in the middle of a prompt string containing
5911+ invisible characters. XXX - might need to take `modmark' into account. */
5912+#define PROMPT_ENDING_INDEX \
5913+ ((MB_CUR_MAX > 1 && rl_byte_oriented == 0) ? prompt_physical_chars : prompt_last_invisible+1)
5914+
5915+
5916 /* **************************************************************** */
5917 /* */
5918 /* Display stuff */
5919@@ -139,6 +168,8 @@ int _rl_last_c_pos = 0;
5920 int _rl_last_v_pos = 0;
5921
5922 static int cpos_adjusted;
5923+static int cpos_buffer_position;
5924+static int prompt_multibyte_chars;
5925
5926 /* Number of lines currently on screen minus 1. */
5927 int _rl_vis_botlin = 0;
5928@@ -148,11 +179,6 @@ int _rl_vis_botlin = 0;
5929 doing horizontal scrolling. It shifts in thirds of a screenwidth. */
5930 static int last_lmargin;
5931
5932-/* The line display buffers. One is the line currently displayed on
5933- the screen. The other is the line about to be displayed. */
5934-static char *visible_line = (char *)NULL;
5935-static char *invisible_line = (char *)NULL;
5936-
5937 /* A buffer for `modeline' messages. */
5938 static char msg_buf[128];
5939
5940@@ -166,6 +192,7 @@ static int line_size = 1024;
5941 include invisible characters. */
5942
5943 static char *local_prompt, *local_prompt_prefix;
5944+static int local_prompt_len;
5945 static int prompt_visible_length, prompt_prefix_length;
5946
5947 /* The number of invisible characters in the line currently being
5948@@ -192,6 +219,10 @@ static int prompt_last_screen_line;
5949
5950 static int prompt_physical_chars;
5951
5952+/* set to a non-zero value by rl_redisplay if we are marking modified history
5953+ lines and the current line is so marked. */
5954+static int modmark;
5955+
5956 /* Variables to save and restore prompt and display information. */
5957
5958 /* These are getting numerous enough that it's time to create a struct. */
5959@@ -201,6 +232,7 @@ static char *saved_local_prefix;
5960 static int saved_last_invisible;
5961 static int saved_visible_length;
5962 static int saved_prefix_length;
5963+static int saved_local_length;
5964 static int saved_invis_chars_first_line;
5965 static int saved_physical_chars;
5966
5967@@ -224,7 +256,7 @@ expand_prompt (pmt, lp, lip, niflp, vlp)
5968 char *pmt;
5969 int *lp, *lip, *niflp, *vlp;
5970 {
5971- char *r, *ret, *p;
5972+ char *r, *ret, *p, *igstart;
5973 int l, rl, last, ignoring, ninvis, invfl, invflset, ind, pind, physchars;
5974
5975 /* Short-circuit if we can. */
5976@@ -248,19 +280,21 @@ expand_prompt (pmt, lp, lip, niflp, vlp)
5977 invfl = 0; /* invisible chars in first line of prompt */
5978 invflset = 0; /* we only want to set invfl once */
5979
5980+ igstart = 0;
5981 for (rl = ignoring = last = ninvis = physchars = 0, p = pmt; p && *p; p++)
5982 {
5983 /* This code strips the invisible character string markers
5984 RL_PROMPT_START_IGNORE and RL_PROMPT_END_IGNORE */
5985- if (*p == RL_PROMPT_START_IGNORE)
5986+ if (ignoring == 0 && *p == RL_PROMPT_START_IGNORE) /* XXX - check ignoring? */
5987 {
5988- ignoring++;
5989+ ignoring = 1;
5990+ igstart = p;
5991 continue;
5992 }
5993 else if (ignoring && *p == RL_PROMPT_END_IGNORE)
5994 {
5995 ignoring = 0;
5996- if (p[-1] != RL_PROMPT_START_IGNORE)
5997+ if (p != (igstart + 1))
5998 last = r - ret - 1;
5999 continue;
6000 }
6001@@ -276,8 +310,13 @@ expand_prompt (pmt, lp, lip, niflp, vlp)
6002 *r++ = *p++;
6003 if (!ignoring)
6004 {
6005+ /* rl ends up being assigned to prompt_visible_length,
6006+ which is the number of characters in the buffer that
6007+ contribute to characters on the screen, which might
6008+ not be the same as the number of physical characters
6009+ on the screen in the presence of multibyte characters */
6010 rl += ind - pind;
6011- physchars += _rl_col_width (pmt, pind, ind);
6012+ physchars += _rl_col_width (pmt, pind, ind, 0);
6013 }
6014 else
6015 ninvis += ind - pind;
6016@@ -360,6 +399,7 @@ rl_expand_prompt (prompt)
6017 FREE (local_prompt_prefix);
6018
6019 local_prompt = local_prompt_prefix = (char *)0;
6020+ local_prompt_len = 0;
6021 prompt_last_invisible = prompt_invis_chars_first_line = 0;
6022 prompt_visible_length = prompt_physical_chars = 0;
6023
6024@@ -375,6 +415,7 @@ rl_expand_prompt (prompt)
6025 &prompt_invis_chars_first_line,
6026 &prompt_physical_chars);
6027 local_prompt_prefix = (char *)0;
6028+ local_prompt_len = local_prompt ? strlen (local_prompt) : 0;
6029 return (prompt_visible_length);
6030 }
6031 else
6032@@ -383,16 +424,17 @@ rl_expand_prompt (prompt)
6033 t = ++p;
6034 local_prompt = expand_prompt (p, &prompt_visible_length,
6035 &prompt_last_invisible,
6036- (int *)NULL,
6037+ &prompt_invis_chars_first_line,
6038 &prompt_physical_chars);
6039 c = *t; *t = '\0';
6040 /* The portion of the prompt string up to and including the
6041 final newline is now null-terminated. */
6042 local_prompt_prefix = expand_prompt (prompt, &prompt_prefix_length,
6043 (int *)NULL,
6044- &prompt_invis_chars_first_line,
6045+ (int *)NULL,
6046 (int *)NULL);
6047 *t = c;
6048+ local_prompt_len = local_prompt ? strlen (local_prompt) : 0;
6049 return (prompt_prefix_length);
6050 }
6051 }
6052@@ -434,13 +476,21 @@ init_line_structures (minsize)
6053 {
6054 /* should be enough. */
6055 inv_lbsize = vis_lbsize = 256;
6056- inv_lbreaks = (int *)xmalloc (inv_lbsize * sizeof (int));
6057- vis_lbreaks = (int *)xmalloc (vis_lbsize * sizeof (int));
6058+
6059 #if defined (HANDLE_MULTIBYTE)
6060- _rl_wrapped_line = (int *)xmalloc (vis_lbsize * sizeof (int));
6061+ line_state_visible->wbsize = vis_lbsize;
6062+ line_state_visible->wrapped_line = (int *)xmalloc (line_state_visible->wbsize * sizeof (int));
6063+
6064+ line_state_invisible->wbsize = inv_lbsize;
6065+ line_state_invisible->wrapped_line = (int *)xmalloc (line_state_invisible->wbsize * sizeof (int));
6066 #endif
6067+
6068+ inv_lbreaks = (int *)xmalloc (inv_lbsize * sizeof (int));
6069+ vis_lbreaks = (int *)xmalloc (vis_lbsize * sizeof (int));
6070 inv_lbreaks[0] = vis_lbreaks[0] = 0;
6071 }
6072+
6073+ line_structures_initialized = 1;
6074 }
6075
6076 /* Basic redisplay algorithm. */
6077@@ -449,8 +499,8 @@ rl_redisplay ()
6078 {
6079 register int in, out, c, linenum, cursor_linenum;
6080 register char *line;
6081- int c_pos, inv_botlin, lb_botlin, lb_linenum, o_cpos;
6082- int newlines, lpos, temp, modmark, n0, num;
6083+ int inv_botlin, lb_botlin, lb_linenum, o_cpos;
6084+ int newlines, lpos, temp, n0, num, prompt_lines_estimate;
6085 char *prompt_this_line;
6086 #if defined (HANDLE_MULTIBYTE)
6087 wchar_t wc;
6088@@ -460,24 +510,27 @@ rl_redisplay ()
6089 int _rl_wrapped_multicolumn = 0;
6090 #endif
6091
6092- if (!readline_echoing_p)
6093+ if (_rl_echoing_p == 0)
6094 return;
6095
6096- /* Signals are blocked through this function as the global data structures
6097- could get corrupted upon modifications from an invoked signal handler. */
6098- _rl_block_sigint ();
6099+ /* Block keyboard interrupts because this function manipulates global
6100+ data structures. */
6101+ _rl_block_sigint ();
6102+ RL_SETSTATE (RL_STATE_REDISPLAYING);
6103
6104 if (!rl_display_prompt)
6105 rl_display_prompt = "";
6106
6107- if (invisible_line == 0 || vis_lbreaks == 0)
6108+ if (line_structures_initialized == 0)
6109 {
6110 init_line_structures (0);
6111 rl_on_new_line ();
6112 }
6113
6114 /* Draw the line into the buffer. */
6115- c_pos = -1;
6116+ cpos_buffer_position = -1;
6117+
6118+ prompt_multibyte_chars = prompt_visible_length - prompt_physical_chars;
6119
6120 line = invisible_line;
6121 out = inv_botlin = 0;
6122@@ -504,24 +557,23 @@ rl_redisplay ()
6123 number of non-visible characters in the prompt string. */
6124 if (rl_display_prompt == rl_prompt || local_prompt)
6125 {
6126- int local_len = local_prompt ? strlen (local_prompt) : 0;
6127 if (local_prompt_prefix && forced_display)
6128 _rl_output_some_chars (local_prompt_prefix, strlen (local_prompt_prefix));
6129
6130- if (local_len > 0)
6131+ if (local_prompt_len > 0)
6132 {
6133- temp = local_len + out + 2;
6134+ temp = local_prompt_len + out + 2;
6135 if (temp >= line_size)
6136 {
6137 line_size = (temp + 1024) - (temp % 1024);
6138 visible_line = (char *)xrealloc (visible_line, line_size);
6139 line = invisible_line = (char *)xrealloc (invisible_line, line_size);
6140 }
6141- strncpy (line + out, local_prompt, local_len);
6142- out += local_len;
6143+ strncpy (line + out, local_prompt, local_prompt_len);
6144+ out += local_prompt_len;
6145 }
6146 line[out] = '\0';
6147- wrap_offset = local_len - prompt_visible_length;
6148+ wrap_offset = local_prompt_len - prompt_visible_length;
6149 }
6150 else
6151 {
6152@@ -576,10 +628,14 @@ rl_redisplay ()
6153 { \
6154 inv_lbsize *= 2; \
6155 inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \
6156- _rl_wrapped_line = (int *)xrealloc (_rl_wrapped_line, inv_lbsize * sizeof (int)); \
6157 } \
6158 inv_lbreaks[++newlines] = out; \
6159- _rl_wrapped_line[newlines] = _rl_wrapped_multicolumn; \
6160+ if (newlines >= (line_state_invisible->wbsize - 1)) \
6161+ { \
6162+ line_state_invisible->wbsize *= 2; \
6163+ line_state_invisible->wrapped_line = (int *)xrealloc (line_state_invisible->wrapped_line, line_state_invisible->wbsize * sizeof(int)); \
6164+ } \
6165+ line_state_invisible->wrapped_line[newlines] = _rl_wrapped_multicolumn; \
6166 lpos = 0; \
6167 } \
6168 } while (0)
6169@@ -602,26 +658,26 @@ rl_redisplay ()
6170
6171 /* inv_lbreaks[i] is where line i starts in the buffer. */
6172 inv_lbreaks[newlines = 0] = 0;
6173-#if 0
6174- lpos = out - wrap_offset;
6175-#else
6176 lpos = prompt_physical_chars + modmark;
6177-#endif
6178
6179 #if defined (HANDLE_MULTIBYTE)
6180- memset (_rl_wrapped_line, 0, vis_lbsize);
6181+ memset (line_state_invisible->wrapped_line, 0, line_state_invisible->wbsize * sizeof (int));
6182 num = 0;
6183 #endif
6184
6185 /* prompt_invis_chars_first_line is the number of invisible characters in
6186 the first physical line of the prompt.
6187 wrap_offset - prompt_invis_chars_first_line is the number of invis
6188- chars on the second line. */
6189+ chars on the second (or, more generally, last) line. */
6190+
6191+ /* This is zero-based, used to set the newlines */
6192+ prompt_lines_estimate = lpos / _rl_screenwidth;
6193
6194 /* what if lpos is already >= _rl_screenwidth before we start drawing the
6195 contents of the command line? */
6196 while (lpos >= _rl_screenwidth)
6197 {
6198+ int z;
6199 /* fix from Darin Johnson <darin@acuson.com> for prompt string with
6200 invisible characters that is longer than the screen width. The
6201 prompt_invis_chars_first_line variable could be made into an array
6202@@ -630,37 +686,48 @@ rl_redisplay ()
6203 prompts that exceed two physical lines?
6204 Additional logic fix from Edward Catmur <ed@catmur.co.uk> */
6205 #if defined (HANDLE_MULTIBYTE)
6206- n0 = num;
6207- temp = local_prompt ? strlen (local_prompt) : 0;
6208- while (num < temp)
6209+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0 && prompt_multibyte_chars > 0)
6210 {
6211- if (_rl_col_width (local_prompt, n0, num) > _rl_screenwidth)
6212+ n0 = num;
6213+ temp = local_prompt_len;
6214+ while (num < temp)
6215 {
6216- num = _rl_find_prev_mbchar (local_prompt, num, MB_FIND_ANY);
6217- break;
6218+ z = _rl_col_width (local_prompt, n0, num, 1);
6219+ if (z > _rl_screenwidth)
6220+ {
6221+ num = _rl_find_prev_mbchar (local_prompt, num, MB_FIND_ANY);
6222+ break;
6223+ }
6224+ else if (z == _rl_screenwidth)
6225+ break;
6226+ num++;
6227 }
6228- num++;
6229+ temp = num;
6230 }
6231- temp = num +
6232-#else
6233- temp = ((newlines + 1) * _rl_screenwidth) +
6234+ else
6235 #endif /* !HANDLE_MULTIBYTE */
6236- ((local_prompt_prefix == 0) ? ((newlines == 0) ? prompt_invis_chars_first_line
6237- : ((newlines == 1) ? wrap_offset : 0))
6238- : ((newlines == 0) ? wrap_offset :0));
6239+ temp = ((newlines + 1) * _rl_screenwidth);
6240+
6241+ /* Now account for invisible characters in the current line. */
6242+ /* XXX - this assumes that the invisible characters may be split, but only
6243+ between the first and the last lines. */
6244+ temp += ((local_prompt_prefix == 0) ? ((newlines == 0) ? prompt_invis_chars_first_line
6245+ : ((newlines == prompt_lines_estimate) ? wrap_offset : prompt_invis_chars_first_line))
6246+ : ((newlines == 0) ? wrap_offset : 0));
6247
6248 inv_lbreaks[++newlines] = temp;
6249 #if defined (HANDLE_MULTIBYTE)
6250- lpos -= _rl_col_width (local_prompt, n0, num);
6251-#else
6252- lpos -= _rl_screenwidth;
6253+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0 && prompt_multibyte_chars > 0)
6254+ lpos -= _rl_col_width (local_prompt, n0, num, 1);
6255+ else
6256 #endif
6257+ lpos -= _rl_screenwidth;
6258 }
6259
6260 prompt_last_screen_line = newlines;
6261
6262 /* Draw the rest of the line (after the prompt) into invisible_line, keeping
6263- track of where the cursor is (c_pos), the number of the line containing
6264+ track of where the cursor is (cpos_buffer_position), the number of the line containing
6265 the cursor (lb_linenum), the last line number (lb_botlin and inv_botlin).
6266 It maintains an array of line breaks for display (inv_lbreaks).
6267 This handles expanding tabs for display and displaying meta characters. */
6268@@ -670,6 +737,7 @@ rl_redisplay ()
6269 if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
6270 {
6271 memset (&ps, 0, sizeof (mbstate_t));
6272+ /* XXX - what if wc_bytes ends up <= 0? check for MB_INVALIDCH */
6273 wc_bytes = mbrtowc (&wc, rl_line_buffer, rl_end, &ps);
6274 }
6275 else
6276@@ -713,7 +781,7 @@ rl_redisplay ()
6277
6278 if (in == rl_point)
6279 {
6280- c_pos = out;
6281+ cpos_buffer_position = out;
6282 lb_linenum = newlines;
6283 }
6284
6285@@ -807,7 +875,7 @@ rl_redisplay ()
6286 }
6287 if (in == rl_point)
6288 {
6289- c_pos = out;
6290+ cpos_buffer_position = out;
6291 lb_linenum = newlines;
6292 }
6293 for (i = in; i < in+wc_bytes; i++)
6294@@ -830,6 +898,7 @@ rl_redisplay ()
6295 if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
6296 {
6297 in += wc_bytes;
6298+ /* XXX - what if wc_bytes ends up <= 0? check for MB_INVALIDCH */
6299 wc_bytes = mbrtowc (&wc, rl_line_buffer + in, rl_end - in, &ps);
6300 }
6301 else
6302@@ -838,9 +907,9 @@ rl_redisplay ()
6303
6304 }
6305 line[out] = '\0';
6306- if (c_pos < 0)
6307+ if (cpos_buffer_position < 0)
6308 {
6309- c_pos = out;
6310+ cpos_buffer_position = out;
6311 lb_linenum = newlines;
6312 }
6313
6314@@ -849,7 +918,7 @@ rl_redisplay ()
6315 inv_lbreaks[newlines+1] = out;
6316 cursor_linenum = lb_linenum;
6317
6318- /* C_POS == position in buffer where cursor should be placed.
6319+ /* CPOS_BUFFER_POSITION == position in buffer where cursor should be placed.
6320 CURSOR_LINENUM == line number where the cursor should be placed. */
6321
6322 /* PWP: now is when things get a bit hairy. The visible and invisible
6323@@ -884,6 +953,10 @@ rl_redisplay ()
6324 second and subsequent lines start at inv_lbreaks[N], offset by
6325 OFFSET (which has already been calculated above). */
6326
6327+#define INVIS_FIRST() (prompt_physical_chars > _rl_screenwidth ? prompt_invis_chars_first_line : wrap_offset)
6328+#define WRAP_OFFSET(line, offset) ((line == 0) \
6329+ ? (offset ? INVIS_FIRST() : 0) \
6330+ : ((line == prompt_last_screen_line) ? wrap_offset-prompt_invis_chars_first_line : 0))
6331 #define W_OFFSET(line, offset) ((line) == 0 ? offset : 0)
6332 #define VIS_LLEN(l) ((l) > _rl_vis_botlin ? 0 : (vis_lbreaks[l+1] - vis_lbreaks[l]))
6333 #define INV_LLEN(l) (inv_lbreaks[l+1] - inv_lbreaks[l])
6334@@ -891,9 +964,16 @@ rl_redisplay ()
6335 #define VIS_LINE(line) ((line) > _rl_vis_botlin) ? "" : VIS_CHARS(line)
6336 #define INV_LINE(line) (invisible_line + inv_lbreaks[line])
6337
6338+#define OLD_CPOS_IN_PROMPT() (cpos_adjusted == 0 && \
6339+ _rl_last_c_pos != o_cpos && \
6340+ _rl_last_c_pos > wrap_offset && \
6341+ o_cpos < prompt_last_invisible)
6342+
6343 /* For each line in the buffer, do the updating display. */
6344 for (linenum = 0; linenum <= inv_botlin; linenum++)
6345 {
6346+ /* This can lead us astray if we execute a program that changes
6347+ the locale from a non-multibyte to a multibyte one. */
6348 o_cpos = _rl_last_c_pos;
6349 cpos_adjusted = 0;
6350 update_line (VIS_LINE(linenum), INV_LINE(linenum), linenum,
6351@@ -903,16 +983,22 @@ rl_redisplay ()
6352 take invisible characters into account, since _rl_last_c_pos
6353 is an absolute cursor position in a multibyte locale. See
6354 if compensating here is the right thing, or if we have to
6355- change update_line itself. There is one case in which
6356+ change update_line itself. There are several cases in which
6357 update_line adjusts _rl_last_c_pos itself (so it can pass
6358 _rl_move_cursor_relative accurate values); it communicates
6359- this back by setting cpos_adjusted */
6360- if (linenum == 0 && (MB_CUR_MAX > 1 && rl_byte_oriented == 0) &&
6361- cpos_adjusted == 0 &&
6362- _rl_last_c_pos != o_cpos &&
6363- _rl_last_c_pos > wrap_offset &&
6364- o_cpos < prompt_last_invisible)
6365- _rl_last_c_pos -= wrap_offset;
6366+ this back by setting cpos_adjusted. If we assume that
6367+ _rl_last_c_pos is correct (an absolute cursor position) each
6368+ time update_line is called, then we can assume in our
6369+ calculations that o_cpos does not need to be adjusted by
6370+ wrap_offset. */
6371+ if (linenum == 0 && (MB_CUR_MAX > 1 && rl_byte_oriented == 0) && OLD_CPOS_IN_PROMPT())
6372+ _rl_last_c_pos -= prompt_invis_chars_first_line; /* XXX - was wrap_offset */
6373+ else if (linenum == prompt_last_screen_line && prompt_physical_chars > _rl_screenwidth &&
6374+ (MB_CUR_MAX > 1 && rl_byte_oriented == 0) &&
6375+ cpos_adjusted == 0 &&
6376+ _rl_last_c_pos != o_cpos &&
6377+ _rl_last_c_pos > (prompt_last_invisible - _rl_screenwidth - prompt_invis_chars_first_line))
6378+ _rl_last_c_pos -= (wrap_offset-prompt_invis_chars_first_line);
6379
6380 /* If this is the line with the prompt, we might need to
6381 compensate for invisible characters in the new line. Do
6382@@ -932,6 +1018,19 @@ rl_redisplay ()
6383 if (nleft)
6384 _rl_clear_to_eol (nleft);
6385 }
6386+#if 0
6387+ /* This segment is intended to handle the case where the prompt
6388+ has invisible characters on the second line and the new line
6389+ to be displayed needs to clear the rest of the old characters
6390+ out (e.g., when printing the i-search prompt). In general,
6391+ the case of the new line being shorter than the old.
6392+ Incomplete */
6393+ else if (linenum == prompt_last_screen_line &&
6394+ prompt_physical_chars > _rl_screenwidth &&
6395+ wrap_offset != prompt_invis_chars_first_line &&
6396+ _rl_last_c_pos == out &&
6397+#endif
6398+
6399
6400 /* Since the new first line is now visible, save its length. */
6401 if (linenum == 0)
6402@@ -975,7 +1074,11 @@ rl_redisplay ()
6403 invisible character in the prompt string. */
6404 nleft = prompt_visible_length + wrap_offset;
6405 if (cursor_linenum == 0 && wrap_offset > 0 && _rl_last_c_pos > 0 &&
6406- _rl_last_c_pos <= prompt_last_invisible && local_prompt)
6407+#if 0
6408+ _rl_last_c_pos <= PROMPT_ENDING_INDEX && local_prompt)
6409+#else
6410+ _rl_last_c_pos < PROMPT_ENDING_INDEX && local_prompt)
6411+#endif
6412 {
6413 #if defined (__MSDOS__)
6414 putc ('\r', rl_outstream);
6415@@ -983,19 +1086,22 @@ rl_redisplay ()
6416 if (_rl_term_cr)
6417 tputs (_rl_term_cr, 1, _rl_output_character_function);
6418 #endif
6419+ if (modmark)
6420+ _rl_output_some_chars ("*", 1);
6421+
6422 _rl_output_some_chars (local_prompt, nleft);
6423 if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
6424- _rl_last_c_pos = _rl_col_width (local_prompt, 0, nleft) - wrap_offset;
6425+ _rl_last_c_pos = _rl_col_width (local_prompt, 0, nleft, 1) - wrap_offset + modmark;
6426 else
6427- _rl_last_c_pos = nleft;
6428+ _rl_last_c_pos = nleft + modmark;
6429 }
6430
6431 /* Where on that line? And where does that line start
6432 in the buffer? */
6433 pos = inv_lbreaks[cursor_linenum];
6434 /* nleft == number of characters in the line buffer between the
6435- start of the line and the cursor position. */
6436- nleft = c_pos - pos;
6437+ start of the line and the desired cursor position. */
6438+ nleft = cpos_buffer_position - pos;
6439
6440 /* NLEFT is now a number of characters in a buffer. When in a
6441 multibyte locale, however, _rl_last_c_pos is an absolute cursor
6442@@ -1007,11 +1113,12 @@ rl_redisplay ()
6443 those characters here and call _rl_backspace() directly. */
6444 if (wrap_offset && cursor_linenum == 0 && nleft < _rl_last_c_pos)
6445 {
6446+ /* TX == new physical cursor position in multibyte locale. */
6447 if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
6448- tx = _rl_col_width (&visible_line[pos], 0, nleft) - visible_wrap_offset;
6449+ tx = _rl_col_width (&visible_line[pos], 0, nleft, 1) - visible_wrap_offset;
6450 else
6451 tx = nleft;
6452- if (_rl_last_c_pos > tx)
6453+ if (tx >= 0 && _rl_last_c_pos > tx)
6454 {
6455 _rl_backspace (_rl_last_c_pos - tx); /* XXX */
6456 _rl_last_c_pos = tx;
6457@@ -1040,11 +1147,11 @@ rl_redisplay ()
6458 will be LMARGIN. */
6459
6460 /* The number of characters that will be displayed before the cursor. */
6461- ndisp = c_pos - wrap_offset;
6462+ ndisp = cpos_buffer_position - wrap_offset;
6463 nleft = prompt_visible_length + wrap_offset;
6464 /* Where the new cursor position will be on the screen. This can be
6465 longer than SCREENWIDTH; if it is, lmargin will be adjusted. */
6466- phys_c_pos = c_pos - (last_lmargin ? last_lmargin : wrap_offset);
6467+ phys_c_pos = cpos_buffer_position - (last_lmargin ? last_lmargin : wrap_offset);
6468 t = _rl_screenwidth / 3;
6469
6470 /* If the number of characters had already exceeded the screenwidth,
6471@@ -1055,7 +1162,7 @@ rl_redisplay ()
6472 two-thirds of the way across the screen. */
6473 if (phys_c_pos > _rl_screenwidth - 2)
6474 {
6475- lmargin = c_pos - (2 * t);
6476+ lmargin = cpos_buffer_position - (2 * t);
6477 if (lmargin < 0)
6478 lmargin = 0;
6479 /* If the left margin would be in the middle of a prompt with
6480@@ -1069,7 +1176,7 @@ rl_redisplay ()
6481 {
6482 /* If we are moving back towards the beginning of the line and
6483 the last margin is no longer correct, compute a new one. */
6484- lmargin = ((c_pos - 1) / t) * t; /* XXX */
6485+ lmargin = ((cpos_buffer_position - 1) / t) * t; /* XXX */
6486 if (wrap_offset && lmargin > 0 && lmargin < nleft)
6487 lmargin = nleft;
6488 }
6489@@ -1089,9 +1196,11 @@ rl_redisplay ()
6490 if (t < out)
6491 line[t - 1] = '>';
6492
6493- if (!rl_display_fixed || forced_display || lmargin != last_lmargin)
6494+ if (rl_display_fixed == 0 || forced_display || lmargin != last_lmargin)
6495 {
6496 forced_display = 0;
6497+ o_cpos = _rl_last_c_pos;
6498+ cpos_adjusted = 0;
6499 update_line (&visible_line[last_lmargin],
6500 &invisible_line[lmargin],
6501 0,
6502@@ -1099,6 +1208,9 @@ rl_redisplay ()
6503 _rl_screenwidth + (lmargin ? 0 : wrap_offset),
6504 0);
6505
6506+ if ((MB_CUR_MAX > 1 && rl_byte_oriented == 0) && OLD_CPOS_IN_PROMPT())
6507+ _rl_last_c_pos -= prompt_invis_chars_first_line; /* XXX - was wrap_offset */
6508+
6509 /* If the visible new line is shorter than the old, but the number
6510 of invisible characters is greater, and we are at the end of
6511 the new line, we need to clear to eol. */
6512@@ -1114,7 +1226,7 @@ rl_redisplay ()
6513 if (visible_first_line_len > _rl_screenwidth)
6514 visible_first_line_len = _rl_screenwidth;
6515
6516- _rl_move_cursor_relative (c_pos - lmargin, &invisible_line[lmargin]);
6517+ _rl_move_cursor_relative (cpos_buffer_position - lmargin, &invisible_line[lmargin]);
6518 last_lmargin = lmargin;
6519 }
6520 }
6521@@ -1122,17 +1234,10 @@ rl_redisplay ()
6522
6523 /* Swap visible and non-visible lines. */
6524 {
6525- char *vtemp = visible_line;
6526- int *itemp = vis_lbreaks, ntemp = vis_lbsize;
6527+ struct line_state *vtemp = line_state_visible;
6528
6529- visible_line = invisible_line;
6530- invisible_line = vtemp;
6531-
6532- vis_lbreaks = inv_lbreaks;
6533- inv_lbreaks = itemp;
6534-
6535- vis_lbsize = inv_lbsize;
6536- inv_lbsize = ntemp;
6537+ line_state_visible = line_state_invisible;
6538+ line_state_invisible = vtemp;
6539
6540 rl_display_fixed = 0;
6541 /* If we are displaying on a single line, and last_lmargin is > 0, we
6542@@ -1144,6 +1249,7 @@ rl_redisplay ()
6543 visible_wrap_offset = wrap_offset;
6544 }
6545
6546+ RL_UNSETSTATE (RL_STATE_REDISPLAYING);
6547 _rl_release_sigint ();
6548 }
6549
6550@@ -1169,12 +1275,12 @@ update_line (old, new, current_line, oma
6551 int current_line, omax, nmax, inv_botlin;
6552 {
6553 register char *ofd, *ols, *oe, *nfd, *nls, *ne;
6554- int temp, lendiff, wsatend, od, nd;
6555+ int temp, lendiff, wsatend, od, nd, twidth, o_cpos;
6556 int current_invis_chars;
6557 int col_lendiff, col_temp;
6558 #if defined (HANDLE_MULTIBYTE)
6559 mbstate_t ps_new, ps_old;
6560- int new_offset, old_offset, tmp;
6561+ int new_offset, old_offset;
6562 #endif
6563
6564 /* If we're at the right edge of a terminal that supports xn, we're
6565@@ -1185,7 +1291,7 @@ update_line (old, new, current_line, oma
6566 if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
6567 temp = _rl_last_c_pos;
6568 else
6569- temp = _rl_last_c_pos - W_OFFSET(_rl_last_v_pos, visible_wrap_offset);
6570+ temp = _rl_last_c_pos - WRAP_OFFSET (_rl_last_v_pos, visible_wrap_offset);
6571 if (temp == _rl_screenwidth && _rl_term_autowrap && !_rl_horizontal_scroll_mode
6572 && _rl_last_v_pos == current_line - 1)
6573 {
6574@@ -1200,8 +1306,8 @@ update_line (old, new, current_line, oma
6575 /* This fixes only double-column characters, but if the wrapped
6576 character comsumes more than three columns, spaces will be
6577 inserted in the string buffer. */
6578- if (_rl_wrapped_line[current_line] > 0)
6579- _rl_clear_to_eol (_rl_wrapped_line[current_line]);
6580+ if (current_line < line_state_visible->wbsize && line_state_visible->wrapped_line[current_line] > 0)
6581+ _rl_clear_to_eol (line_state_visible->wrapped_line[current_line]);
6582
6583 memset (&ps, 0, sizeof (mbstate_t));
6584 ret = mbrtowc (&wc, new, MB_CUR_MAX, &ps);
6585@@ -1217,7 +1323,7 @@ update_line (old, new, current_line, oma
6586
6587 if (tempwidth > 0)
6588 {
6589- int count;
6590+ int count, i;
6591 bytes = ret;
6592 for (count = 0; count < bytes; count++)
6593 putc (new[count], rl_outstream);
6594@@ -1228,10 +1334,13 @@ update_line (old, new, current_line, oma
6595 if (ret != 0 && bytes != 0)
6596 {
6597 if (MB_INVALIDCH (ret))
6598- memmove (old+bytes, old+1, strlen (old+1));
6599- else
6600- memmove (old+bytes, old+ret, strlen (old+ret));
6601+ ret = 1;
6602+ memmove (old+bytes, old+ret, strlen (old+ret));
6603 memcpy (old, new, bytes);
6604+ /* Fix up indices if we copy data from one line to another */
6605+ omax += bytes - ret;
6606+ for (i = current_line+1; i < inv_botlin+1; i++)
6607+ vis_lbreaks[i] += bytes - ret;
6608 }
6609 }
6610 else
6611@@ -1265,7 +1374,7 @@ update_line (old, new, current_line, oma
6612 /* See if the old line is a subset of the new line, so that the
6613 only change is adding characters. */
6614 temp = (omax < nmax) ? omax : nmax;
6615- if (memcmp (old, new, temp) == 0)
6616+ if (memcmp (old, new, temp) == 0) /* adding at the end */
6617 {
6618 ofd = old + temp;
6619 nfd = new + temp;
6620@@ -1407,30 +1516,48 @@ update_line (old, new, current_line, oma
6621 sequences (like drawing the `unbold' sequence without a corresponding
6622 `bold') that manifests itself on certain terminals. */
6623
6624- lendiff = local_prompt ? strlen (local_prompt) : 0;
6625+ lendiff = local_prompt_len;
6626 od = ofd - old; /* index of first difference in visible line */
6627 if (current_line == 0 && !_rl_horizontal_scroll_mode &&
6628 _rl_term_cr && lendiff > prompt_visible_length && _rl_last_c_pos > 0 &&
6629- od >= lendiff && _rl_last_c_pos <= prompt_last_invisible)
6630+ od >= lendiff && _rl_last_c_pos < PROMPT_ENDING_INDEX)
6631 {
6632 #if defined (__MSDOS__)
6633 putc ('\r', rl_outstream);
6634 #else
6635 tputs (_rl_term_cr, 1, _rl_output_character_function);
6636 #endif
6637+ if (modmark)
6638+ _rl_output_some_chars ("*", 1);
6639 _rl_output_some_chars (local_prompt, lendiff);
6640 if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
6641 {
6642 /* We take wrap_offset into account here so we can pass correct
6643 information to _rl_move_cursor_relative. */
6644- _rl_last_c_pos = _rl_col_width (local_prompt, 0, lendiff) - wrap_offset;
6645+ _rl_last_c_pos = _rl_col_width (local_prompt, 0, lendiff, 1) - wrap_offset + modmark;
6646 cpos_adjusted = 1;
6647 }
6648 else
6649- _rl_last_c_pos = lendiff;
6650+ _rl_last_c_pos = lendiff + modmark;
6651 }
6652
6653+ o_cpos = _rl_last_c_pos;
6654+
6655+ /* When this function returns, _rl_last_c_pos is correct, and an absolute
6656+ cursor postion in multibyte mode, but a buffer index when not in a
6657+ multibyte locale. */
6658 _rl_move_cursor_relative (od, old);
6659+#if 1
6660+#if defined (HANDLE_MULTIBYTE)
6661+ /* We need to indicate that the cursor position is correct in the presence of
6662+ invisible characters in the prompt string. Let's see if setting this when
6663+ we make sure we're at the end of the drawn prompt string works. */
6664+ if (current_line == 0 && MB_CUR_MAX > 1 && rl_byte_oriented == 0 &&
6665+ (_rl_last_c_pos > 0 || o_cpos > 0) &&
6666+ _rl_last_c_pos == prompt_physical_chars)
6667+ cpos_adjusted = 1;
6668+#endif
6669+#endif
6670
6671 /* if (len (new) > len (old))
6672 lendiff == difference in buffer
6673@@ -1438,7 +1565,7 @@ update_line (old, new, current_line, oma
6674 When not using multibyte characters, these are equal */
6675 lendiff = (nls - nfd) - (ols - ofd);
6676 if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
6677- col_lendiff = _rl_col_width (new, nfd - new, nls - new) - _rl_col_width (old, ofd - old, ols - old);
6678+ col_lendiff = _rl_col_width (new, nfd - new, nls - new, 1) - _rl_col_width (old, ofd - old, ols - old, 1);
6679 else
6680 col_lendiff = lendiff;
6681
6682@@ -1463,7 +1590,7 @@ update_line (old, new, current_line, oma
6683 /* Insert (diff (len (old), len (new)) ch. */
6684 temp = ne - nfd;
6685 if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
6686- col_temp = _rl_col_width (new, nfd - new, ne - new);
6687+ col_temp = _rl_col_width (new, nfd - new, ne - new, 1);
6688 else
6689 col_temp = temp;
6690
6691@@ -1471,22 +1598,60 @@ update_line (old, new, current_line, oma
6692 {
6693 /* Non-zero if we're increasing the number of lines. */
6694 int gl = current_line >= _rl_vis_botlin && inv_botlin > _rl_vis_botlin;
6695+ /* If col_lendiff is > 0, implying that the new string takes up more
6696+ screen real estate than the old, but lendiff is < 0, meaning that it
6697+ takes fewer bytes, we need to just output the characters starting
6698+ from the first difference. These will overwrite what is on the
6699+ display, so there's no reason to do a smart update. This can really
6700+ only happen in a multibyte environment. */
6701+ if (lendiff < 0)
6702+ {
6703+ _rl_output_some_chars (nfd, temp);
6704+ _rl_last_c_pos += _rl_col_width (nfd, 0, temp, 1);
6705+ /* If nfd begins before any invisible characters in the prompt,
6706+ adjust _rl_last_c_pos to account for wrap_offset and set
6707+ cpos_adjusted to let the caller know. */
6708+ if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible))
6709+ {
6710+ _rl_last_c_pos -= wrap_offset;
6711+ cpos_adjusted = 1;
6712+ }
6713+ return;
6714+ }
6715 /* Sometimes it is cheaper to print the characters rather than
6716 use the terminal's capabilities. If we're growing the number
6717 of lines, make sure we actually cause the new line to wrap
6718 around on auto-wrapping terminals. */
6719- if (_rl_terminal_can_insert && ((2 * col_temp) >= col_lendiff || _rl_term_IC) && (!_rl_term_autowrap || !gl))
6720+ else if (_rl_terminal_can_insert && ((2 * col_temp) >= col_lendiff || _rl_term_IC) && (!_rl_term_autowrap || !gl))
6721 {
6722 /* If lendiff > prompt_visible_length and _rl_last_c_pos == 0 and
6723 _rl_horizontal_scroll_mode == 1, inserting the characters with
6724 _rl_term_IC or _rl_term_ic will screw up the screen because of the
6725 invisible characters. We need to just draw them. */
6726- if (*ols && (!_rl_horizontal_scroll_mode || _rl_last_c_pos > 0 ||
6727- lendiff <= prompt_visible_length || !current_invis_chars))
6728+ /* The same thing happens if we're trying to draw before the last
6729+ invisible character in the prompt string or we're increasing the
6730+ number of invisible characters in the line and we're not drawing
6731+ the entire prompt string. */
6732+ if (*ols && ((_rl_horizontal_scroll_mode &&
6733+ _rl_last_c_pos == 0 &&
6734+ lendiff > prompt_visible_length &&
6735+ current_invis_chars > 0) == 0) &&
6736+ (((MB_CUR_MAX > 1 && rl_byte_oriented == 0) &&
6737+ current_line == 0 && wrap_offset &&
6738+ ((nfd - new) <= prompt_last_invisible) &&
6739+ (col_lendiff < prompt_visible_length)) == 0) &&
6740+ (visible_wrap_offset >= current_invis_chars))
6741 {
6742 insert_some_chars (nfd, lendiff, col_lendiff);
6743 _rl_last_c_pos += col_lendiff;
6744 }
6745+#if 0 /* XXX - for now */
6746+ else if ((MB_CUR_MAX > 1 && rl_byte_oriented == 0) && _rl_last_c_pos == 0 && wrap_offset && (nfd-new) <= prompt_last_invisible && col_lendiff < prompt_visible_length && visible_wrap_offset >= current_invis_chars)
6747+ {
6748+ _rl_output_some_chars (nfd, lendiff);
6749+ _rl_last_c_pos += col_lendiff;
6750+ }
6751+#endif
6752 else if ((MB_CUR_MAX == 1 || rl_byte_oriented != 0) && *ols == 0 && lendiff > 0)
6753 {
6754 /* At the end of a line the characters do not have to
6755@@ -1498,11 +1663,16 @@ update_line (old, new, current_line, oma
6756 }
6757 else
6758 {
6759- /* We have horizontal scrolling and we are not inserting at
6760- the end. We have invisible characters in this line. This
6761- is a dumb update. */
6762 _rl_output_some_chars (nfd, temp);
6763 _rl_last_c_pos += col_temp;
6764+ /* If nfd begins before the last invisible character in the
6765+ prompt, adjust _rl_last_c_pos to account for wrap_offset
6766+ and set cpos_adjusted to let the caller know. */
6767+ if ((MB_CUR_MAX > 1 && rl_byte_oriented == 0) && current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible))
6768+ {
6769+ _rl_last_c_pos -= wrap_offset;
6770+ cpos_adjusted = 1;
6771+ }
6772 return;
6773 }
6774 /* Copy (new) chars to screen from first diff to last match. */
6775@@ -1510,15 +1680,23 @@ update_line (old, new, current_line, oma
6776 if ((temp - lendiff) > 0)
6777 {
6778 _rl_output_some_chars (nfd + lendiff, temp - lendiff);
6779-#if 1
6780 /* XXX -- this bears closer inspection. Fixes a redisplay bug
6781 reported against bash-3.0-alpha by Andreas Schwab involving
6782 multibyte characters and prompt strings with invisible
6783 characters, but was previously disabled. */
6784- _rl_last_c_pos += _rl_col_width (nfd+lendiff, 0, temp-col_lendiff);
6785-#else
6786- _rl_last_c_pos += _rl_col_width (nfd+lendiff, 0, temp-lendiff);
6787-#endif
6788+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
6789+ twidth = _rl_col_width (nfd+lendiff, 0, temp-col_lendiff, 1);
6790+ else
6791+ twidth = temp - lendiff;
6792+ _rl_last_c_pos += twidth;
6793+ /* If nfd begins before the last invisible character in the
6794+ prompt, adjust _rl_last_c_pos to account for wrap_offset
6795+ and set cpos_adjusted to let the caller know. */
6796+ if ((MB_CUR_MAX > 1 && rl_byte_oriented == 0) && current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible))
6797+ {
6798+ _rl_last_c_pos -= wrap_offset;
6799+ cpos_adjusted = 1;
6800+ }
6801 }
6802 }
6803 else
6804@@ -1530,6 +1708,14 @@ update_line (old, new, current_line, oma
6805 char in the current line (which implies we just output some invisible
6806 characters) we need to adjust _rl_last_c_pos, since it represents
6807 a physical character position. */
6808+ if ((MB_CUR_MAX > 1 && rl_byte_oriented == 0) &&
6809+ current_line == prompt_last_screen_line && wrap_offset &&
6810+ wrap_offset != prompt_invis_chars_first_line &&
6811+ ((nfd-new) < (prompt_last_invisible-(current_line*_rl_screenwidth))))
6812+ {
6813+ _rl_last_c_pos -= wrap_offset - prompt_invis_chars_first_line;
6814+ cpos_adjusted = 1;
6815+ }
6816 }
6817 }
6818 else /* Delete characters from line. */
6819@@ -1551,8 +1737,22 @@ update_line (old, new, current_line, oma
6820 temp = nls - nfd;
6821 if (temp > 0)
6822 {
6823+ /* If nfd begins at the prompt, or before the invisible
6824+ characters in the prompt, we need to adjust _rl_last_c_pos
6825+ in a multibyte locale to account for the wrap offset and
6826+ set cpos_adjusted accordingly. */
6827 _rl_output_some_chars (nfd, temp);
6828- _rl_last_c_pos += _rl_col_width (nfd, 0, temp);;
6829+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
6830+ {
6831+ _rl_last_c_pos += _rl_col_width (nfd, 0, temp, 1);
6832+ if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible))
6833+ {
6834+ _rl_last_c_pos -= wrap_offset;
6835+ cpos_adjusted = 1;
6836+ }
6837+ }
6838+ else
6839+ _rl_last_c_pos += temp;
6840 }
6841 }
6842 /* Otherwise, print over the existing material. */
6843@@ -1560,16 +1760,37 @@ update_line (old, new, current_line, oma
6844 {
6845 if (temp > 0)
6846 {
6847+ /* If nfd begins at the prompt, or before the invisible
6848+ characters in the prompt, we need to adjust _rl_last_c_pos
6849+ in a multibyte locale to account for the wrap offset and
6850+ set cpos_adjusted accordingly. */
6851 _rl_output_some_chars (nfd, temp);
6852 _rl_last_c_pos += col_temp; /* XXX */
6853+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
6854+ {
6855+ if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible))
6856+ {
6857+ _rl_last_c_pos -= wrap_offset;
6858+ cpos_adjusted = 1;
6859+ }
6860+ }
6861 }
6862 lendiff = (oe - old) - (ne - new);
6863 if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
6864- col_lendiff = _rl_col_width (old, 0, oe - old) - _rl_col_width (new, 0, ne - new);
6865+ col_lendiff = _rl_col_width (old, 0, oe - old, 1) - _rl_col_width (new, 0, ne - new, 1);
6866 else
6867 col_lendiff = lendiff;
6868
6869+#if 0
6870 if (col_lendiff)
6871+#else
6872+ /* If we've already printed over the entire width of the screen,
6873+ including the old material, then col_lendiff doesn't matter and
6874+ space_to_eol will insert too many spaces. XXX - maybe we should
6875+ adjust col_lendiff based on the difference between _rl_last_c_pos
6876+ and _rl_screenwidth */
6877+ if (col_lendiff && ((MB_CUR_MAX == 1 || rl_byte_oriented) || (_rl_last_c_pos < _rl_screenwidth)))
6878+#endif
6879 {
6880 if (_rl_term_autowrap && current_line < inv_botlin)
6881 space_to_eol (col_lendiff);
6882@@ -1623,7 +1844,7 @@ rl_on_new_line_with_prompt ()
6883
6884 l = strlen (prompt_last_line);
6885 if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
6886- _rl_last_c_pos = _rl_col_width (prompt_last_line, 0, l); /* XXX */
6887+ _rl_last_c_pos = _rl_col_width (prompt_last_line, 0, l, 1); /* XXX */
6888 else
6889 _rl_last_c_pos = l;
6890
6891@@ -1658,10 +1879,11 @@ rl_on_new_line_with_prompt ()
6892 int
6893 rl_forced_update_display ()
6894 {
6895+ register char *temp;
6896+
6897 if (visible_line)
6898 {
6899- register char *temp = visible_line;
6900-
6901+ temp = visible_line;
6902 while (*temp)
6903 *temp++ = '\0';
6904 }
6905@@ -1684,9 +1906,14 @@ _rl_move_cursor_relative (new, data)
6906 register int i;
6907 int woff; /* number of invisible chars on current line */
6908 int cpos, dpos; /* current and desired cursor positions */
6909+ int adjust;
6910
6911- woff = W_OFFSET (_rl_last_v_pos, wrap_offset);
6912+ woff = WRAP_OFFSET (_rl_last_v_pos, wrap_offset);
6913 cpos = _rl_last_c_pos;
6914+
6915+ if (cpos == 0 && cpos == new)
6916+ return;
6917+
6918 #if defined (HANDLE_MULTIBYTE)
6919 /* If we have multibyte characters, NEW is indexed by the buffer point in
6920 a multibyte string, but _rl_last_c_pos is the display position. In
6921@@ -1695,9 +1922,42 @@ _rl_move_cursor_relative (new, data)
6922 as long as we are past them and they are counted by _rl_col_width. */
6923 if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
6924 {
6925- dpos = _rl_col_width (data, 0, new);
6926- if (dpos > woff)
6927- dpos -= woff;
6928+ adjust = 1;
6929+ /* Try to short-circuit common cases and eliminate a bunch of multibyte
6930+ character function calls. */
6931+ /* 1. prompt string */
6932+ if (new == local_prompt_len && memcmp (data, local_prompt, new) == 0)
6933+ {
6934+ dpos = prompt_physical_chars;
6935+ cpos_adjusted = 1;
6936+ adjust = 0;
6937+ }
6938+ /* 2. prompt_string + line contents */
6939+ else if (new > local_prompt_len && local_prompt && memcmp (data, local_prompt, local_prompt_len) == 0)
6940+ {
6941+ dpos = prompt_physical_chars + _rl_col_width (data, local_prompt_len, new, 1);
6942+ cpos_adjusted = 1;
6943+ adjust = 0;
6944+ }
6945+ else
6946+ dpos = _rl_col_width (data, 0, new, 1);
6947+
6948+ /* Use NEW when comparing against the last invisible character in the
6949+ prompt string, since they're both buffer indices and DPOS is a
6950+ desired display position. */
6951+ if (adjust && ((new > prompt_last_invisible) || /* XXX - don't use woff here */
6952+ (prompt_physical_chars >= _rl_screenwidth &&
6953+ _rl_last_v_pos == prompt_last_screen_line &&
6954+ wrap_offset >= woff && dpos >= woff &&
6955+ new > (prompt_last_invisible-(_rl_screenwidth*_rl_last_v_pos)-wrap_offset))))
6956+ /* XXX last comparison might need to be >= */
6957+ {
6958+ dpos -= woff;
6959+ /* Since this will be assigned to _rl_last_c_pos at the end (more
6960+ precisely, _rl_last_c_pos == dpos when this function returns),
6961+ let the caller know. */
6962+ cpos_adjusted = 1;
6963+ }
6964 }
6965 else
6966 #endif
6967@@ -1716,7 +1976,7 @@ _rl_move_cursor_relative (new, data)
6968 else
6969 #endif
6970 i = _rl_last_c_pos - woff;
6971- if (new == 0 || CR_FASTER (new, _rl_last_c_pos) ||
6972+ if (dpos == 0 || CR_FASTER (dpos, _rl_last_c_pos) ||
6973 (_rl_term_autowrap && i == _rl_screenwidth))
6974 {
6975 #if defined (__MSDOS__)
6976@@ -1738,19 +1998,27 @@ _rl_move_cursor_relative (new, data)
6977 sequence telling the terminal to move forward one character.
6978 That kind of control is for people who don't know what the
6979 data is underneath the cursor. */
6980-#if defined (HACK_TERMCAP_MOTION)
6981- if (_rl_term_forward_char)
6982- {
6983- for (i = cpos; i < dpos; i++)
6984- tputs (_rl_term_forward_char, 1, _rl_output_character_function);
6985- }
6986- else
6987-#endif /* HACK_TERMCAP_MOTION */
6988+
6989+ /* However, we need a handle on where the current display position is
6990+ in the buffer for the immediately preceding comment to be true.
6991+ In multibyte locales, we don't currently have that info available.
6992+ Without it, we don't know where the data we have to display begins
6993+ in the buffer and we have to go back to the beginning of the screen
6994+ line. In this case, we can use the terminal sequence to move forward
6995+ if it's available. */
6996 if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
6997 {
6998- tputs (_rl_term_cr, 1, _rl_output_character_function);
6999- for (i = 0; i < new; i++)
7000- putc (data[i], rl_outstream);
7001+ if (_rl_term_forward_char)
7002+ {
7003+ for (i = cpos; i < dpos; i++)
7004+ tputs (_rl_term_forward_char, 1, _rl_output_character_function);
7005+ }
7006+ else
7007+ {
7008+ tputs (_rl_term_cr, 1, _rl_output_character_function);
7009+ for (i = 0; i < new; i++)
7010+ putc (data[i], rl_outstream);
7011+ }
7012 }
7013 else
7014 for (i = cpos; i < new; i++)
7015@@ -1908,6 +2176,7 @@ rl_message (va_alist)
7016 &prompt_invis_chars_first_line,
7017 &prompt_physical_chars);
7018 local_prompt_prefix = (char *)NULL;
7019+ local_prompt_len = local_prompt ? strlen (local_prompt) : 0;
7020 (*rl_redisplay_function) ();
7021
7022 return 0;
7023@@ -1931,6 +2200,7 @@ rl_message (format, arg1, arg2)
7024 &prompt_invis_chars_first_line,
7025 &prompt_physical_chars);
7026 local_prompt_prefix = (char *)NULL;
7027+ local_prompt_len = local_prompt ? strlen (local_prompt) : 0;
7028 (*rl_redisplay_function) ();
7029
7030 return 0;
7031@@ -1967,12 +2237,14 @@ rl_save_prompt ()
7032 saved_local_prompt = local_prompt;
7033 saved_local_prefix = local_prompt_prefix;
7034 saved_prefix_length = prompt_prefix_length;
7035+ saved_local_length = local_prompt_len;
7036 saved_last_invisible = prompt_last_invisible;
7037 saved_visible_length = prompt_visible_length;
7038 saved_invis_chars_first_line = prompt_invis_chars_first_line;
7039 saved_physical_chars = prompt_physical_chars;
7040
7041 local_prompt = local_prompt_prefix = (char *)0;
7042+ local_prompt_len = 0;
7043 prompt_last_invisible = prompt_visible_length = prompt_prefix_length = 0;
7044 prompt_invis_chars_first_line = prompt_physical_chars = 0;
7045 }
7046@@ -1985,6 +2257,7 @@ rl_restore_prompt ()
7047
7048 local_prompt = saved_local_prompt;
7049 local_prompt_prefix = saved_local_prefix;
7050+ local_prompt_len = saved_local_length;
7051 prompt_prefix_length = saved_prefix_length;
7052 prompt_last_invisible = saved_last_invisible;
7053 prompt_visible_length = saved_visible_length;
7054@@ -1993,6 +2266,7 @@ rl_restore_prompt ()
7055
7056 /* can test saved_local_prompt to see if prompt info has been saved. */
7057 saved_local_prompt = saved_local_prefix = (char *)0;
7058+ saved_local_length = 0;
7059 saved_last_invisible = saved_visible_length = saved_prefix_length = 0;
7060 saved_invis_chars_first_line = saved_physical_chars = 0;
7061 }
7062@@ -2106,7 +2380,7 @@ insert_some_chars (string, count, col)
7063 /* DEBUGGING */
7064 if (MB_CUR_MAX == 1 || rl_byte_oriented)
7065 if (count != col)
7066- fprintf(stderr, "readline: debug: insert_some_chars: count (%d) != col (%d)\n", count, col);
7067+ _rl_ttymsg ("debug: insert_some_chars: count (%d) != col (%d)", count, col);
7068
7069 /* If IC is defined, then we do not have to "enter" insert mode. */
7070 if (_rl_term_IC)
7071@@ -2189,7 +2463,8 @@ _rl_update_final ()
7072 char *last_line;
7073
7074 last_line = &visible_line[vis_lbreaks[_rl_vis_botlin]];
7075- _rl_move_cursor_relative (_rl_screenwidth - 1, last_line);
7076+ cpos_buffer_position = -1; /* don't know where we are in buffer */
7077+ _rl_move_cursor_relative (_rl_screenwidth - 1, last_line); /* XXX */
7078 _rl_clear_to_eol (0);
7079 putc (last_line[_rl_screenwidth - 1], rl_outstream);
7080 }
7081@@ -2232,6 +2507,7 @@ redraw_prompt (t)
7082 &prompt_invis_chars_first_line,
7083 &prompt_physical_chars);
7084 local_prompt_prefix = (char *)NULL;
7085+ local_prompt_len = local_prompt ? strlen (local_prompt) : 0;
7086
7087 rl_forced_update_display ();
7088
7089@@ -2245,10 +2521,14 @@ _rl_redisplay_after_sigwinch ()
7090 {
7091 char *t;
7092
7093- /* Clear the current line and put the cursor at column 0. Make sure
7094- the right thing happens if we have wrapped to a new screen line. */
7095+ /* Clear the last line (assuming that the screen size change will result in
7096+ either more or fewer characters on that line only) and put the cursor at
7097+ column 0. Make sure the right thing happens if we have wrapped to a new
7098+ screen line. */
7099 if (_rl_term_cr)
7100 {
7101+ _rl_move_vert (_rl_vis_botlin);
7102+
7103 #if defined (__MSDOS__)
7104 putc ('\r', rl_outstream);
7105 #else
7106@@ -2284,7 +2564,7 @@ _rl_redisplay_after_sigwinch ()
7107 void
7108 _rl_clean_up_for_exit ()
7109 {
7110- if (readline_echoing_p)
7111+ if (_rl_echoing_p)
7112 {
7113 _rl_move_vert (_rl_vis_botlin);
7114 _rl_vis_botlin = 0;
7115@@ -2329,20 +2609,41 @@ _rl_current_display_line ()
7116 In the case of multibyte characters with stateful encoding, we have to
7117 scan from the beginning of the string to take the state into account. */
7118 static int
7119-_rl_col_width (str, start, end)
7120+_rl_col_width (str, start, end, flags)
7121 const char *str;
7122- int start, end;
7123+ int start, end, flags;
7124 {
7125 wchar_t wc;
7126- mbstate_t ps = {0};
7127+ mbstate_t ps;
7128 int tmp, point, width, max;
7129
7130 if (end <= start)
7131 return 0;
7132+ if (MB_CUR_MAX == 1 || rl_byte_oriented)
7133+{
7134+_rl_ttymsg ("_rl_col_width: called with MB_CUR_MAX == 1");
7135+ return (end - start);
7136+}
7137+
7138+ memset (&ps, 0, sizeof (mbstate_t));
7139
7140 point = 0;
7141 max = end;
7142
7143+ /* Try to short-circuit common cases. The adjustment to remove wrap_offset
7144+ is done by the caller. */
7145+ /* 1. prompt string */
7146+ if (flags && start == 0 && end == local_prompt_len && memcmp (str, local_prompt, local_prompt_len) == 0)
7147+ return (prompt_physical_chars + wrap_offset);
7148+ /* 2. prompt string + line contents */
7149+ else if (flags && start == 0 && local_prompt_len > 0 && end > local_prompt_len && local_prompt && memcmp (str, local_prompt, local_prompt_len) == 0)
7150+ {
7151+ tmp = prompt_physical_chars + wrap_offset;
7152+ /* XXX - try to call ourselves recursively with non-prompt portion */
7153+ tmp += _rl_col_width (str, local_prompt_len, end, flags);
7154+ return (tmp);
7155+ }
7156+
7157 while (point < start)
7158 {
7159 tmp = mbrlen (str + point, max, &ps);
7160Index: gdb-7.2.90.20110703/readline/doc/ChangeLog.gdb
7161===================================================================
7162--- gdb-7.2.90.20110703.orig/readline/doc/ChangeLog.gdb 2011-07-03 10:40:53.000000000 +0200
7163+++ gdb-7.2.90.20110703/readline/doc/ChangeLog.gdb 2011-07-03 10:41:21.000000000 +0200
7164@@ -1,3 +1,7 @@
7165+2011-04-25 Jan Kratochvil <jan.kratochvil@redhat.com>
7166+
7167+ Imported readline 6.2, and upstream patch 001.
7168+
7169 2006-04-24 Daniel Jacobowitz <dan@codesourcery.com>
7170
7171 Imported readline 5.1, and upstream patches 001-004.
7172Index: gdb-7.2.90.20110703/readline/doc/Makefile.in
7173===================================================================
7174--- gdb-7.2.90.20110703.orig/readline/doc/Makefile.in 2011-07-03 10:40:53.000000000 +0200
7175+++ gdb-7.2.90.20110703/readline/doc/Makefile.in 2011-07-03 10:41:21.000000000 +0200
7176@@ -1,25 +1,24 @@
7177 # This makefile for Readline library documentation is in -*- text -*- mode.
7178 # Emacs likes it that way.
7179
7180-# Copyright (C) 1996-2004 Free Software Foundation, Inc.
7181+# Copyright (C) 1996-2009 Free Software Foundation, Inc.
7182
7183-# This program is free software; you can redistribute it and/or modify
7184-# it under the terms of the GNU General Public License as published by
7185-# the Free Software Foundation; either version 2, or (at your option)
7186-# any later version.
7187-
7188-# This program is distributed in the hope that it will be useful,
7189-# but WITHOUT ANY WARRANTY; without even the implied warranty of
7190-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7191-# GNU General Public License for more details.
7192-
7193-# You should have received a copy of the GNU General Public License
7194-# along with this program; if not, write to the Free Software
7195-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
7196+# This program is free software: you can redistribute it and/or modify
7197+# it under the terms of the GNU General Public License as published by
7198+# the Free Software Foundation, either version 3 of the License, or
7199+# (at your option) any later version.
7200+
7201+# This program is distributed in the hope that it will be useful,
7202+# but WITHOUT ANY WARRANTY; without even the implied warranty of
7203+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7204+# GNU General Public License for more details.
7205+
7206+# You should have received a copy of the GNU General Public License
7207+# along with this program. If not, see <http://www.gnu.org/licenses/>.
7208
7209 topdir = @top_srcdir@
7210 srcdir = @srcdir@
7211-VPATH = .:@srcdir@
7212+VPATH = @srcdir@
7213
7214 prefix = @prefix@
7215
7216@@ -64,9 +63,9 @@ PSPDF = gs -sPAPERSIZE=${PAPERSIZE
7217
7218 RLSRC = $(srcdir)/rlman.texi $(srcdir)/rluser.texi \
7219 $(srcdir)/rltech.texi $(srcdir)/version.texi \
7220- $(srcdir)/rluserman.texi
7221+ $(srcdir)/rluserman.texi $(srcdir)/fdl.texi
7222 HISTSRC = $(srcdir)/history.texi $(srcdir)/hsuser.texi \
7223- $(srcdir)/hstech.texi $(srcdir)/version.texi
7224+ $(srcdir)/hstech.texi $(srcdir)/version.texi $(srcdir)/fdl.texi
7225
7226 # This should be a program that converts troff to an ascii-readable format
7227 NROFF = groff -Tascii
7228@@ -83,7 +82,7 @@ PDFOBJ = readline.pdf history.pdf rluser
7229
7230 INTERMEDIATE_OBJ = rlman.dvi
7231
7232-DIST_DOCS = $(DVIOBJ) $(PSOBJ) $(HTMLOBJ) $(INFOOBJ) $(TEXTOBJ)
7233+DIST_DOCS = $(DVIOBJ) $(PSOBJ) $(HTMLOBJ) $(INFOOBJ) $(TEXTOBJ) $(PDFOBJ)
7234
7235 .SUFFIXES: .0 .3 .ps .txt .dvi .html .pdf
7236
7237@@ -99,9 +98,11 @@ DIST_DOCS = $(DVIOBJ) $(PSOBJ) $(HTMLOBJ
7238 $(RM) $@
7239 -${DVIPDF} $<
7240
7241-all: info dvi html ps text
7242+all: info dvi html ps text pdf
7243 nodvi: info html text
7244
7245+xdist: $(DIST_DOCS)
7246+
7247 info: $(INFOOBJ)
7248 dvi: $(DVIOBJ)
7249 ps: $(PSOBJ)
7250@@ -156,13 +157,13 @@ history.html: ${HISTSRC}
7251
7252 readline.0: readline.3
7253
7254-readline_3.ps: readline.3
7255+readline_3.ps: $(srcdir)/readline.3
7256 ${RM} $@
7257 ${GROFF} -man < $(srcdir)/readline.3 > $@
7258
7259 history.0: history.3
7260
7261-history_3.ps: history.3
7262+history_3.ps: $(srcdir)/history.3
7263 ${RM} $@
7264 ${GROFF} -man < $(srcdir)/history.3 > $@
7265
7266@@ -182,7 +183,7 @@ distclean: clean maybe-clean
7267 $(RM) Makefile
7268
7269 maybe-clean:
7270- -if test "X$(topdir)" != "X$(BUILD_DIR)"; then \
7271+ -if test "X$(topdir)" != "X.." && test "X$(topdir)" != "X$(BUILD_DIR)"; then \
7272 $(RM) $(DIST_DOCS); \
7273 fi
7274
7275Index: gdb-7.2.90.20110703/readline/doc/fdl.texi
7276===================================================================
7277--- gdb-7.2.90.20110703.orig/readline/doc/fdl.texi 2011-07-03 10:40:53.000000000 +0200
7278+++ gdb-7.2.90.20110703/readline/doc/fdl.texi 2011-07-03 10:41:21.000000000 +0200
7279@@ -1,13 +1,12 @@
7280+@c The GNU Free Documentation License.
7281+@center Version 1.3, 3 November 2008
7282
7283-@node GNU Free Documentation License
7284-@appendixsec GNU Free Documentation License
7285-
7286-@cindex FDL, GNU Free Documentation License
7287-@center Version 1.2, November 2002
7288+@c This file is intended to be included within another document,
7289+@c hence no sectioning command or @node.
7290
7291 @display
7292-Copyright @copyright{} 2000,2001,2002 Free Software Foundation, Inc.
7293-59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
7294+Copyright @copyright{} 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
7295+@uref{http://fsf.org/}
7296
7297 Everyone is permitted to copy and distribute verbatim copies
7298 of this license document, but changing it is not allowed.
7299@@ -112,6 +111,9 @@ formats which do not have any title page
7300 the text near the most prominent appearance of the work's title,
7301 preceding the beginning of the body of the text.
7302
7303+The ``publisher'' means any person or entity that distributes copies
7304+of the Document to the public.
7305+
7306 A section ``Entitled XYZ'' means a named subunit of the Document whose
7307 title either is precisely XYZ or contains XYZ in parentheses following
7308 text that translates XYZ in another language. (Here XYZ stands for a
7309@@ -344,7 +346,7 @@ and independent documents or works, in o
7310 distribution medium, is called an ``aggregate'' if the copyright
7311 resulting from the compilation is not used to limit the legal rights
7312 of the compilation's users beyond what the individual works permit.
7313-When the Document is included an aggregate, this License does not
7314+When the Document is included in an aggregate, this License does not
7315 apply to the other works in the aggregate which are not themselves
7316 derivative works of the Document.
7317
7318@@ -380,13 +382,30 @@ title.
7319 @item
7320 TERMINATION
7321
7322-You may not copy, modify, sublicense, or distribute the Document except
7323-as expressly provided for under this License. Any other attempt to
7324-copy, modify, sublicense or distribute the Document is void, and will
7325-automatically terminate your rights under this License. However,
7326-parties who have received copies, or rights, from you under this
7327-License will not have their licenses terminated so long as such
7328-parties remain in full compliance.
7329+You may not copy, modify, sublicense, or distribute the Document
7330+except as expressly provided under this License. Any attempt
7331+otherwise to copy, modify, sublicense, or distribute it is void, and
7332+will automatically terminate your rights under this License.
7333+
7334+However, if you cease all violation of this License, then your license
7335+from a particular copyright holder is reinstated (a) provisionally,
7336+unless and until the copyright holder explicitly and finally
7337+terminates your license, and (b) permanently, if the copyright holder
7338+fails to notify you of the violation by some reasonable means prior to
7339+60 days after the cessation.
7340+
7341+Moreover, your license from a particular copyright holder is
7342+reinstated permanently if the copyright holder notifies you of the
7343+violation by some reasonable means, this is the first time you have
7344+received notice of violation of this License (for any work) from that
7345+copyright holder, and you cure the violation prior to 30 days after
7346+your receipt of the notice.
7347+
7348+Termination of your rights under this section does not terminate the
7349+licenses of parties who have received copies or rights from you under
7350+this License. If your rights have been terminated and not permanently
7351+reinstated, receipt of a copy of some or all of the same material does
7352+not give you any rights to use it.
7353
7354 @item
7355 FUTURE REVISIONS OF THIS LICENSE
7356@@ -404,11 +423,46 @@ following the terms and conditions eithe
7357 of any later version that has been published (not as a draft) by the
7358 Free Software Foundation. If the Document does not specify a version
7359 number of this License, you may choose any version ever published (not
7360-as a draft) by the Free Software Foundation.
7361+as a draft) by the Free Software Foundation. If the Document
7362+specifies that a proxy can decide which future versions of this
7363+License can be used, that proxy's public statement of acceptance of a
7364+version permanently authorizes you to choose that version for the
7365+Document.
7366+
7367+@item
7368+RELICENSING
7369+
7370+``Massive Multiauthor Collaboration Site'' (or ``MMC Site'') means any
7371+World Wide Web server that publishes copyrightable works and also
7372+provides prominent facilities for anybody to edit those works. A
7373+public wiki that anybody can edit is an example of such a server. A
7374+``Massive Multiauthor Collaboration'' (or ``MMC'') contained in the
7375+site means any set of copyrightable works thus published on the MMC
7376+site.
7377+
7378+``CC-BY-SA'' means the Creative Commons Attribution-Share Alike 3.0
7379+license published by Creative Commons Corporation, a not-for-profit
7380+corporation with a principal place of business in San Francisco,
7381+California, as well as future copyleft versions of that license
7382+published by that same organization.
7383+
7384+``Incorporate'' means to publish or republish a Document, in whole or
7385+in part, as part of another Document.
7386+
7387+An MMC is ``eligible for relicensing'' if it is licensed under this
7388+License, and if all works that were first published under this License
7389+somewhere other than this MMC, and subsequently incorporated in whole
7390+or in part into the MMC, (1) had no cover texts or invariant sections,
7391+and (2) were thus incorporated prior to November 1, 2008.
7392+
7393+The operator of an MMC Site may republish an MMC contained in the site
7394+under CC-BY-SA on the same site at any time before August 1, 2009,
7395+provided the MMC is eligible for relicensing.
7396+
7397 @end enumerate
7398
7399 @page
7400-@appendixsubsec ADDENDUM: How to use this License for your documents
7401+@heading ADDENDUM: How to use this License for your documents
7402
7403 To use this License in a document you have written, include a copy of
7404 the License in the document and put the following copyright and
7405@@ -418,16 +472,16 @@ license notices just after the title pag
7406 @group
7407 Copyright (C) @var{year} @var{your name}.
7408 Permission is granted to copy, distribute and/or modify this document
7409- under the terms of the GNU Free Documentation License, Version 1.2
7410+ under the terms of the GNU Free Documentation License, Version 1.3
7411 or any later version published by the Free Software Foundation;
7412- with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
7413- A copy of the license is included in the section entitled ``GNU
7414+ with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
7415+ Texts. A copy of the license is included in the section entitled ``GNU
7416 Free Documentation License''.
7417 @end group
7418 @end smallexample
7419
7420 If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
7421-replace the ``with...Texts.'' line with this:
7422+replace the ``with@dots{}Texts.'' line with this:
7423
7424 @smallexample
7425 @group
7426Index: gdb-7.2.90.20110703/readline/doc/history.3
7427===================================================================
7428--- gdb-7.2.90.20110703.orig/readline/doc/history.3 2011-07-03 10:40:53.000000000 +0200
7429+++ gdb-7.2.90.20110703/readline/doc/history.3 2011-07-03 10:41:21.000000000 +0200
7430@@ -6,9 +6,9 @@
7431 .\" Case Western Reserve University
7432 .\" chet@ins.CWRU.Edu
7433 .\"
7434-.\" Last Change: Thu Jul 31 08:46:08 EDT 2003
7435+.\" Last Change: Thu Aug 12 22:24:41 EDT 2010
7436 .\"
7437-.TH HISTORY 3 "2003 July 31" "GNU History 5.0"
7438+.TH HISTORY 3 "2010 August 12" "GNU History 6.2"
7439 .\"
7440 .\" File Name macro. This used to be `.PN', for Path Name,
7441 .\" but Sun doesn't seem to like that very much.
7442@@ -40,8 +40,8 @@
7443 .SH NAME
7444 history \- GNU History Library
7445 .SH COPYRIGHT
7446-.if t The GNU History Library is Copyright \(co 1989-2002 by the Free Software Foundation, Inc.
7447-.if n The GNU History Library is Copyright (C) 1989-2002 by the Free Software Foundation, Inc.
7448+.if t The GNU History Library is Copyright \(co 1989-2011 by the Free Software Foundation, Inc.
7449+.if n The GNU History Library is Copyright (C) 1989-2011 by the Free Software Foundation, Inc.
7450 .SH DESCRIPTION
7451 Many programs read input from the user a line at a time. The GNU
7452 History library is able to keep track of those lines, associate arbitrary
7453@@ -83,6 +83,8 @@ the history expansion character.
7454 .PP
7455 An event designator is a reference to a command line entry in the
7456 history list.
7457+Unless the reference is absolute, events are relative to the current
7458+position in the history list.
7459 .PP
7460 .PD 0
7461 .TP
7462@@ -96,18 +98,22 @@ Refer to command line
7463 .IR n .
7464 .TP
7465 .B !\-\fIn\fR
7466-Refer to the current command line minus
7467+Refer to the current command minus
7468 .IR n .
7469 .TP
7470 .B !!
7471 Refer to the previous command. This is a synonym for `!\-1'.
7472 .TP
7473 .B !\fIstring\fR
7474-Refer to the most recent command starting with
7475+Refer to the most recent command
7476+preceding the current position in the history list
7477+starting with
7478 .IR string .
7479 .TP
7480 .B !?\fIstring\fR\fB[?]\fR
7481-Refer to the most recent command containing
7482+Refer to the most recent command
7483+preceding the current postition in the history list
7484+containing
7485 .IR string .
7486 The trailing \fB?\fP may be omitted if
7487 .I string
7488@@ -569,10 +575,13 @@ The number of entries currently stored i
7489 The maximum number of history entries. This must be changed using
7490 \fBstifle_history()\fP.
7491
7492-.Vb int history_write_timestamps
7493+.Vb int history_wite_timestamps
7494 If non-zero, timestamps are written to the history file, so they can be
7495 preserved between sessions. The default value is 0, meaning that
7496 timestamps are not saved.
7497+The current timestamp format uses the value of \fIhistory_comment_char\fP
7498+to delimit timestamp entries in the history file. If that variable does
7499+not have a value (the default), timestamps will not be written.
7500
7501 .Vb char history_expansion_char
7502 The character that introduces a history event. The default is \fB!\fP.
7503Index: gdb-7.2.90.20110703/readline/doc/history.texi
7504===================================================================
7505--- gdb-7.2.90.20110703.orig/readline/doc/history.texi 2011-07-03 10:40:53.000000000 +0200
7506+++ gdb-7.2.90.20110703/readline/doc/history.texi 2011-07-03 10:41:21.000000000 +0200
7507@@ -4,8 +4,6 @@
7508 @settitle GNU History Library
7509 @c %**end of header (This is for running Texinfo on a region.)
7510
7511-@setchapternewpage odd
7512-
7513 @include version.texi
7514
7515 @copying
7516@@ -14,7 +12,7 @@ This document describes the GNU History
7517 a programming tool that provides a consistent user interface for
7518 recalling lines of previously typed input.
7519
7520-Copyright @copyright{} 1988-2004 Free Software Foundation, Inc.
7521+Copyright @copyright{} 1988--2011 Free Software Foundation, Inc.
7522
7523 Permission is granted to make and distribute verbatim copies of
7524 this manual provided the copyright notice and this permission notice
7525@@ -22,15 +20,16 @@ are preserved on all copies.
7526
7527 @quotation
7528 Permission is granted to copy, distribute and/or modify this document
7529-under the terms of the GNU Free Documentation License, Version 1.1 or
7530+under the terms of the GNU Free Documentation License, Version 1.3 or
7531 any later version published by the Free Software Foundation; with no
7532-Invariant Sections, with the Front-Cover texts being ``A GNU Manual,''
7533+Invariant Sections, with the Front-Cover texts being ``A GNU Manual'',
7534 and with the Back-Cover Texts as in (a) below. A copy of the license is
7535-included in the section entitled ``GNU Free Documentation License.''
7536+included in the section entitled ``GNU Free Documentation License''.
7537+
7538+(a) The FSF's Back-Cover Text is: You are free to copy and modify
7539+this GNU manual. Buying copies from GNU Press supports the FSF in
7540+developing GNU and promoting software freedom.''
7541
7542-(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
7543-this GNU Manual, like GNU software. Copies published by the Free
7544-Software Foundation raise funds for GNU development.''
7545 @end quotation
7546 @end copying
7547
7548@@ -72,7 +71,7 @@ typed input.
7549 @menu
7550 * Using History Interactively:: GNU History User's Manual.
7551 * Programming with GNU History:: GNU History Programmer's Manual.
7552-* Copying This Manual:: Copying This Manual.
7553+* GNU Free Documentation License:: License for copying this manual.
7554 * Concept Index:: Index of concepts described in this manual.
7555 * Function and Variable Index:: Index of externally visible functions
7556 and variables.
7557@@ -84,12 +83,8 @@ typed input.
7558 @include hsuser.texi
7559 @include hstech.texi
7560
7561-@node Copying This Manual
7562-@appendix Copying This Manual
7563-
7564-@menu
7565-* GNU Free Documentation License:: License for copying this manual.
7566-@end menu
7567+@node GNU Free Documentation License
7568+@appendix GNU Free Documentation License
7569
7570 @include fdl.texi
7571
7572Index: gdb-7.2.90.20110703/readline/doc/hstech.texi
7573===================================================================
7574--- gdb-7.2.90.20110703.orig/readline/doc/hstech.texi 2011-07-03 10:40:53.000000000 +0200
7575+++ gdb-7.2.90.20110703/readline/doc/hstech.texi 2011-07-03 10:41:21.000000000 +0200
7576@@ -1,7 +1,7 @@
7577 @ignore
7578 This file documents the user interface to the GNU History library.
7579
7580-Copyright (C) 1988-2002 Free Software Foundation, Inc.
7581+Copyright (C) 1988-2011 Free Software Foundation, Inc.
7582 Authored by Brian Fox and Chet Ramey.
7583
7584 Permission is granted to make and distribute verbatim copies of this manual
7585@@ -426,6 +426,10 @@ The maximum number of history entries.
7586 If non-zero, timestamps are written to the history file, so they can be
7587 preserved between sessions. The default value is 0, meaning that
7588 timestamps are not saved.
7589+
7590+The current timestamp format uses the value of @var{history_comment_char}
7591+to delimit timestamp entries in the history file. If that variable does
7592+not have a value (the default), timestamps will not be written.
7593 @end deftypevar
7594
7595 @deftypevar char history_expansion_char
7596Index: gdb-7.2.90.20110703/readline/doc/hsuser.texi
7597===================================================================
7598--- gdb-7.2.90.20110703.orig/readline/doc/hsuser.texi 2011-07-03 10:40:53.000000000 +0200
7599+++ gdb-7.2.90.20110703/readline/doc/hsuser.texi 2011-07-03 10:41:21.000000000 +0200
7600@@ -1,7 +1,7 @@
7601 @ignore
7602 This file documents the user interface to the GNU History library.
7603
7604-Copyright (C) 1988-2002 Free Software Foundation, Inc.
7605+Copyright (C) 1988--2011 Free Software Foundation, Inc.
7606 Authored by Brian Fox and Chet Ramey.
7607
7608 Permission is granted to make and distribute verbatim copies of this manual
7609@@ -97,7 +97,11 @@ to contain no more than @env{$HISTFILESI
7610 lines. If @env{HISTFILESIZE} is not set, no truncation is performed.
7611
7612 If the @env{HISTTIMEFORMAT} is set, the time stamp information
7613-associated with each history entry is written to the history file.
7614+associated with each history entry is written to the history file,
7615+marked with the history comment character.
7616+When the history file is read, lines beginning with the history
7617+comment character followed immediately by a digit are interpreted
7618+as timestamps for the previous history line.
7619
7620 The builtin command @code{fc} may be used to list or edit and re-execute
7621 a portion of the history list.
7622@@ -133,7 +137,7 @@ history list and history file.
7623 @item fc
7624 @btindex fc
7625 @example
7626-@code{fc [-e @var{ename}] [-nlr] [@var{first}] [@var{last}]}
7627+@code{fc [-e @var{ename}] [-lnr] [@var{first}] [@var{last}]}
7628 @code{fc -s [@var{pat}=@var{rep}] [@var{command}]}
7629 @end example
7630
7631@@ -277,7 +281,10 @@ them, so that they are available for sub
7632 This is most useful in conjunction with Readline.
7633
7634 The shell allows control of the various characters used by the
7635-history expansion mechanism with the @code{histchars} variable.
7636+history expansion mechanism with the @code{histchars} variable,
7637+as explained above (@pxref{Bash Variables}). The shell uses
7638+the history comment character to mark history timestamps when
7639+writing the history file.
7640 @end ifset
7641
7642 @menu
7643@@ -292,6 +299,8 @@ history expansion mechanism with the @co
7644
7645 An event designator is a reference to a command line entry in the
7646 history list.
7647+Unless the reference is absolute, events are relative to the current
7648+position in the history list.
7649 @cindex history events
7650
7651 @table @asis
7652@@ -317,10 +326,15 @@ Refer to the command @var{n} lines back.
7653 Refer to the previous command. This is a synonym for @samp{!-1}.
7654
7655 @item @code{!@var{string}}
7656-Refer to the most recent command starting with @var{string}.
7657+Refer to the most recent command
7658+preceding the current position in the history list
7659+starting with @var{string}.
7660
7661 @item @code{!?@var{string}[?]}
7662-Refer to the most recent command containing @var{string}. The trailing
7663+Refer to the most recent command
7664+preceding the current position in the history list
7665+containing @var{string}.
7666+The trailing
7667 @samp{?} may be omitted if the @var{string} is followed immediately by
7668 a newline.
7669
7670@@ -412,7 +426,7 @@ of the following modifiers, each precede
7671 Remove a trailing pathname component, leaving only the head.
7672
7673 @item t
7674-Remove all leading pathname components, leaving the tail.
7675+Remove all leading pathname components, leaving the tail.
7676
7677 @item r
7678 Remove a trailing suffix of the form @samp{.@var{suffix}}, leaving
7679Index: gdb-7.2.90.20110703/readline/doc/inc-hist.texinfo
7680===================================================================
7681--- gdb-7.2.90.20110703.orig/readline/doc/inc-hist.texinfo 2011-07-03 10:40:53.000000000 +0200
7682+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
7683@@ -1,457 +0,0 @@
7684-@ignore
7685-This file documents the user interface to the GNU History library.
7686-
7687-Copyright (C) 1988-2002 Free Software Foundation, Inc.
7688-Authored by Brian Fox and Chet Ramey.
7689-
7690-Permission is granted to make and distribute verbatim copies of this manual
7691-provided the copyright notice and this permission notice are preserved on
7692-all copies.
7693-
7694-Permission is granted to process this file through Tex and print the
7695-results, provided the printed document carries copying permission notice
7696-identical to this one except for the removal of this paragraph (this
7697-paragraph not being relevant to the printed manual).
7698-
7699-Permission is granted to copy and distribute modified versions of this
7700-manual under the conditions for verbatim copying, provided also that the
7701-GNU Copyright statement is available to the distributee, and provided that
7702-the entire resulting derived work is distributed under the terms of a
7703-permission notice identical to this one.
7704-
7705-Permission is granted to copy and distribute translations of this manual
7706-into another language, under the above conditions for modified versions.
7707-@end ignore
7708-
7709-@node Using History Interactively
7710-@chapter Using History Interactively
7711-
7712-@c @ifclear BashFeatures
7713-@c @defcodeindex bt
7714-@c @end ifclear
7715-
7716-@ifset BashFeatures
7717-This chapter describes how to use the @sc{gnu} History Library
7718-interactively, from a user's standpoint.
7719-It should be considered a user's guide.
7720-For information on using the @sc{gnu} History Library in other programs,
7721-see the @sc{gnu} Readline Library Manual.
7722-@end ifset
7723-@ifclear BashFeatures
7724-This chapter describes how to use the @sc{gnu} History Library interactively,
7725-from a user's standpoint. It should be considered a user's guide.
7726-For information on using the @sc{gnu} History Library in other programs,
7727-see the @sc{gnu} Readline Library Manual.
7728-@end ifclear
7729-
7730-@ifset BashFeatures
7731-@menu
7732-* Bash History Facilities:: How Bash lets you manipulate your command
7733- history.
7734-* Bash History Builtins:: The Bash builtin commands that manipulate
7735- the command history.
7736-* History Interaction:: What it feels like using History as a user.
7737-@end menu
7738-@end ifset
7739-@ifclear BashFeatures
7740-@menu
7741-* History Interaction:: What it feels like using History as a user.
7742-@end menu
7743-@end ifclear
7744-
7745-@ifset BashFeatures
7746-@node Bash History Facilities
7747-@section Bash History Facilities
7748-@cindex command history
7749-@cindex history list
7750-
7751-When the @option{-o history} option to the @code{set} builtin
7752-is enabled (@pxref{The Set Builtin}),
7753-the shell provides access to the @dfn{command history},
7754-the list of commands previously typed.
7755-The value of the @env{HISTSIZE} shell variable is used as the
7756-number of commands to save in a history list.
7757-The text of the last @env{$HISTSIZE}
7758-commands (default 500) is saved.
7759-The shell stores each command in the history list prior to
7760-parameter and variable expansion
7761-but after history expansion is performed, subject to the
7762-values of the shell variables
7763-@env{HISTIGNORE} and @env{HISTCONTROL}.
7764-
7765-When the shell starts up, the history is initialized from the
7766-file named by the @env{HISTFILE} variable (default @file{~/.bash_history}).
7767-The file named by the value of @env{HISTFILE} is truncated, if
7768-necessary, to contain no more than the number of lines specified by
7769-the value of the @env{HISTFILESIZE} variable.
7770-When an interactive shell exits, the last
7771-@env{$HISTSIZE} lines are copied from the history list to the file
7772-named by @env{$HISTFILE}.
7773-If the @code{histappend} shell option is set (@pxref{Bash Builtins}),
7774-the lines are appended to the history file,
7775-otherwise the history file is overwritten.
7776-If @env{HISTFILE}
7777-is unset, or if the history file is unwritable, the history is
7778-not saved. After saving the history, the history file is truncated
7779-to contain no more than @env{$HISTFILESIZE}
7780-lines. If @env{HISTFILESIZE} is not set, no truncation is performed.
7781-
7782-If the @env{HISTTIMEFORMAT} is set, the time stamp information
7783-associated with each history entry is written to the history file.
7784-
7785-The builtin command @code{fc} may be used to list or edit and re-execute
7786-a portion of the history list.
7787-The @code{history} builtin may be used to display or modify the history
7788-list and manipulate the history file.
7789-When using command-line editing, search commands
7790-are available in each editing mode that provide access to the
7791-history list (@pxref{Commands For History}).
7792-
7793-The shell allows control over which commands are saved on the history
7794-list. The @env{HISTCONTROL} and @env{HISTIGNORE}
7795-variables may be set to cause the shell to save only a subset of the
7796-commands entered.
7797-The @code{cmdhist}
7798-shell option, if enabled, causes the shell to attempt to save each
7799-line of a multi-line command in the same history entry, adding
7800-semicolons where necessary to preserve syntactic correctness.
7801-The @code{lithist}
7802-shell option causes the shell to save the command with embedded newlines
7803-instead of semicolons.
7804-The @code{shopt} builtin is used to set these options.
7805-@xref{Bash Builtins}, for a description of @code{shopt}.
7806-
7807-@node Bash History Builtins
7808-@section Bash History Builtins
7809-@cindex history builtins
7810-
7811-Bash provides two builtin commands which manipulate the
7812-history list and history file.
7813-
7814-@table @code
7815-
7816-@item fc
7817-@btindex fc
7818-@example
7819-@code{fc [-e @var{ename}] [-nlr] [@var{first}] [@var{last}]}
7820-@code{fc -s [@var{pat}=@var{rep}] [@var{command}]}
7821-@end example
7822-
7823-Fix Command. In the first form, a range of commands from @var{first} to
7824-@var{last} is selected from the history list. Both @var{first} and
7825-@var{last} may be specified as a string (to locate the most recent
7826-command beginning with that string) or as a number (an index into the
7827-history list, where a negative number is used as an offset from the
7828-current command number). If @var{last} is not specified it is set to
7829-@var{first}. If @var{first} is not specified it is set to the previous
7830-command for editing and @minus{}16 for listing. If the @option{-l} flag is
7831-given, the commands are listed on standard output. The @option{-n} flag
7832-suppresses the command numbers when listing. The @option{-r} flag
7833-reverses the order of the listing. Otherwise, the editor given by
7834-@var{ename} is invoked on a file containing those commands. If
7835-@var{ename} is not given, the value of the following variable expansion
7836-is used: @code{$@{FCEDIT:-$@{EDITOR:-vi@}@}}. This says to use the
7837-value of the @env{FCEDIT} variable if set, or the value of the
7838-@env{EDITOR} variable if that is set, or @code{vi} if neither is set.
7839-When editing is complete, the edited commands are echoed and executed.
7840-
7841-In the second form, @var{command} is re-executed after each instance
7842-of @var{pat} in the selected command is replaced by @var{rep}.
7843-
7844-A useful alias to use with the @code{fc} command is @code{r='fc -s'}, so
7845-that typing @samp{r cc} runs the last command beginning with @code{cc}
7846-and typing @samp{r} re-executes the last command (@pxref{Aliases}).
7847-
7848-@item history
7849-@btindex history
7850-@example
7851-history [@var{n}]
7852-history -c
7853-history -d @var{offset}
7854-history [-anrw] [@var{filename}]
7855-history -ps @var{arg}
7856-@end example
7857-
7858-With no options, display the history list with line numbers.
7859-Lines prefixed with a @samp{*} have been modified.
7860-An argument of @var{n} lists only the last @var{n} lines.
7861-If the shell variable @env{HISTTIMEFORMAT} is set and not null,
7862-it is used as a format string for @var{strftime} to display
7863-the time stamp associated with each displayed history entry.
7864-No intervening blank is printed between the formatted time stamp
7865-and the history line.
7866-
7867-Options, if supplied, have the following meanings:
7868-
7869-@table @code
7870-@item -c
7871-Clear the history list. This may be combined
7872-with the other options to replace the history list completely.
7873-
7874-@item -d @var{offset}
7875-Delete the history entry at position @var{offset}.
7876-@var{offset} should be specified as it appears when the history is
7877-displayed.
7878-
7879-@item -a
7880-Append the new
7881-history lines (history lines entered since the beginning of the
7882-current Bash session) to the history file.
7883-
7884-@item -n
7885-Append the history lines not already read from the history file
7886-to the current history list. These are lines appended to the history
7887-file since the beginning of the current Bash session.
7888-
7889-@item -r
7890-Read the current history file and append its contents to
7891-the history list.
7892-
7893-@item -w
7894-Write out the current history to the history file.
7895-
7896-@item -p
7897-Perform history substitution on the @var{arg}s and display the result
7898-on the standard output, without storing the results in the history list.
7899-
7900-@item -s
7901-The @var{arg}s are added to the end of
7902-the history list as a single entry.
7903-
7904-@end table
7905-
7906-When any of the @option{-w}, @option{-r}, @option{-a}, or @option{-n} options is
7907-used, if @var{filename}
7908-is given, then it is used as the history file. If not, then
7909-the value of the @env{HISTFILE} variable is used.
7910-
7911-@end table
7912-@end ifset
7913-
7914-@node History Interaction
7915-@section History Expansion
7916-@cindex history expansion
7917-
7918-The History library provides a history expansion feature that is similar
7919-to the history expansion provided by @code{csh}. This section
7920-describes the syntax used to manipulate the history information.
7921-
7922-History expansions introduce words from the history list into
7923-the input stream, making it easy to repeat commands, insert the
7924-arguments to a previous command into the current input line, or
7925-fix errors in previous commands quickly.
7926-
7927-History expansion takes place in two parts. The first is to determine
7928-which line from the history list should be used during substitution.
7929-The second is to select portions of that line for inclusion into the
7930-current one. The line selected from the history is called the
7931-@dfn{event}, and the portions of that line that are acted upon are
7932-called @dfn{words}. Various @dfn{modifiers} are available to manipulate
7933-the selected words. The line is broken into words in the same fashion
7934-that Bash does, so that several words
7935-surrounded by quotes are considered one word.
7936-History expansions are introduced by the appearance of the
7937-history expansion character, which is @samp{!} by default.
7938-@ifset BashFeatures
7939-Only @samp{\} and @samp{'} may be used to escape the history expansion
7940-character.
7941-@end ifset
7942-
7943-@ifset BashFeatures
7944-Several shell options settable with the @code{shopt}
7945-builtin (@pxref{Bash Builtins}) may be used to tailor
7946-the behavior of history expansion. If the
7947-@code{histverify} shell option is enabled, and Readline
7948-is being used, history substitutions are not immediately passed to
7949-the shell parser.
7950-Instead, the expanded line is reloaded into the Readline
7951-editing buffer for further modification.
7952-If Readline is being used, and the @code{histreedit}
7953-shell option is enabled, a failed history expansion will be
7954-reloaded into the Readline editing buffer for correction.
7955-The @option{-p} option to the @code{history} builtin command
7956-may be used to see what a history expansion will do before using it.
7957-The @option{-s} option to the @code{history} builtin may be used to
7958-add commands to the end of the history list without actually executing
7959-them, so that they are available for subsequent recall.
7960-This is most useful in conjunction with Readline.
7961-
7962-The shell allows control of the various characters used by the
7963-history expansion mechanism with the @code{histchars} variable.
7964-@end ifset
7965-
7966-@menu
7967-* Event Designators:: How to specify which history line to use.
7968-* Word Designators:: Specifying which words are of interest.
7969-* Modifiers:: Modifying the results of substitution.
7970-@end menu
7971-
7972-@node Event Designators
7973-@subsection Event Designators
7974-@cindex event designators
7975-
7976-An event designator is a reference to a command line entry in the
7977-history list.
7978-@cindex history events
7979-
7980-@table @asis
7981-
7982-@item @code{!}
7983-@ifset BashFeatures
7984-Start a history substitution, except when followed by a space, tab,
7985-the end of the line, @samp{=} or @samp{(} (when the
7986-@code{extglob} shell option is enabled using the @code{shopt} builtin).
7987-@end ifset
7988-@ifclear BashFeatures
7989-Start a history substitution, except when followed by a space, tab,
7990-the end of the line, or @samp{=}.
7991-@end ifclear
7992-
7993-@item @code{!@var{n}}
7994-Refer to command line @var{n}.
7995-
7996-@item @code{!-@var{n}}
7997-Refer to the command @var{n} lines back.
7998-
7999-@item @code{!!}
8000-Refer to the previous command. This is a synonym for @samp{!-1}.
8001-
8002-@item @code{!@var{string}}
8003-Refer to the most recent command starting with @var{string}.
8004-
8005-@item @code{!?@var{string}[?]}
8006-Refer to the most recent command containing @var{string}. The trailing
8007-@samp{?} may be omitted if the @var{string} is followed immediately by
8008-a newline.
8009-
8010-@item @code{^@var{string1}^@var{string2}^}
8011-Quick Substitution. Repeat the last command, replacing @var{string1}
8012-with @var{string2}. Equivalent to
8013-@code{!!:s/@var{string1}/@var{string2}/}.
8014-
8015-@item @code{!#}
8016-The entire command line typed so far.
8017-
8018-@end table
8019-
8020-@node Word Designators
8021-@subsection Word Designators
8022-
8023-Word designators are used to select desired words from the event.
8024-A @samp{:} separates the event specification from the word designator. It
8025-may be omitted if the word designator begins with a @samp{^}, @samp{$},
8026-@samp{*}, @samp{-}, or @samp{%}. Words are numbered from the beginning
8027-of the line, with the first word being denoted by 0 (zero). Words are
8028-inserted into the current line separated by single spaces.
8029-
8030-@need 0.75
8031-For example,
8032-
8033-@table @code
8034-@item !!
8035-designates the preceding command. When you type this, the preceding
8036-command is repeated in toto.
8037-
8038-@item !!:$
8039-designates the last argument of the preceding command. This may be
8040-shortened to @code{!$}.
8041-
8042-@item !fi:2
8043-designates the second argument of the most recent command starting with
8044-the letters @code{fi}.
8045-@end table
8046-
8047-@need 0.75
8048-Here are the word designators:
8049-
8050-@table @code
8051-
8052-@item 0 (zero)
8053-The @code{0}th word. For many applications, this is the command word.
8054-
8055-@item @var{n}
8056-The @var{n}th word.
8057-
8058-@item ^
8059-The first argument; that is, word 1.
8060-
8061-@item $
8062-The last argument.
8063-
8064-@item %
8065-The word matched by the most recent @samp{?@var{string}?} search.
8066-
8067-@item @var{x}-@var{y}
8068-A range of words; @samp{-@var{y}} abbreviates @samp{0-@var{y}}.
8069-
8070-@item *
8071-All of the words, except the @code{0}th. This is a synonym for @samp{1-$}.
8072-It is not an error to use @samp{*} if there is just one word in the event;
8073-the empty string is returned in that case.
8074-
8075-@item @var{x}*
8076-Abbreviates @samp{@var{x}-$}
8077-
8078-@item @var{x}-
8079-Abbreviates @samp{@var{x}-$} like @samp{@var{x}*}, but omits the last word.
8080-
8081-@end table
8082-
8083-If a word designator is supplied without an event specification, the
8084-previous command is used as the event.
8085-
8086-@node Modifiers
8087-@subsection Modifiers
8088-
8089-After the optional word designator, you can add a sequence of one or more
8090-of the following modifiers, each preceded by a @samp{:}.
8091-
8092-@table @code
8093-
8094-@item h
8095-Remove a trailing pathname component, leaving only the head.
8096-
8097-@item t
8098-Remove all leading pathname components, leaving the tail.
8099-
8100-@item r
8101-Remove a trailing suffix of the form @samp{.@var{suffix}}, leaving
8102-the basename.
8103-
8104-@item e
8105-Remove all but the trailing suffix.
8106-
8107-@item p
8108-Print the new command but do not execute it.
8109-
8110-@ifset BashFeatures
8111-@item q
8112-Quote the substituted words, escaping further substitutions.
8113-
8114-@item x
8115-Quote the substituted words as with @samp{q},
8116-but break into words at spaces, tabs, and newlines.
8117-@end ifset
8118-
8119-@item s/@var{old}/@var{new}/
8120-Substitute @var{new} for the first occurrence of @var{old} in the
8121-event line. Any delimiter may be used in place of @samp{/}.
8122-The delimiter may be quoted in @var{old} and @var{new}
8123-with a single backslash. If @samp{&} appears in @var{new},
8124-it is replaced by @var{old}. A single backslash will quote
8125-the @samp{&}. The final delimiter is optional if it is the last
8126-character on the input line.
8127-
8128-@item &
8129-Repeat the previous substitution.
8130-
8131-@item g
8132-@itemx a
8133-Cause changes to be applied over the entire event line. Used in
8134-conjunction with @samp{s}, as in @code{gs/@var{old}/@var{new}/},
8135-or with @samp{&}.
8136-
8137-@item G
8138-Apply the following @samp{s} modifier once to each word in the event.
8139-
8140-@end table
8141Index: gdb-7.2.90.20110703/readline/doc/readline.3
8142===================================================================
8143--- gdb-7.2.90.20110703.orig/readline/doc/readline.3 2011-07-03 10:40:53.000000000 +0200
8144+++ gdb-7.2.90.20110703/readline/doc/readline.3 2011-07-03 10:41:21.000000000 +0200
8145@@ -6,9 +6,9 @@
8146 .\" Case Western Reserve University
8147 .\" chet@ins.CWRU.Edu
8148 .\"
8149-.\" Last Change: Tue Sep 13 12:07:26 EDT 2005
8150+.\" Last Change: Sat Aug 28 18:56:32 EDT 2010
8151 .\"
8152-.TH READLINE 3 "2005 Sep 13" "GNU Readline 5.1-beta1"
8153+.TH READLINE 3 "2010 August 28" "GNU Readline 6.2"
8154 .\"
8155 .\" File Name macro. This used to be `.PN', for Path Name,
8156 .\" but Sun doesn't seem to like that very much.
8157@@ -34,8 +34,8 @@ readline \- get a line from a user with
8158 \fBreadline\fP (\fIconst char *prompt\fP);
8159 .fi
8160 .SH COPYRIGHT
8161-.if n Readline is Copyright (C) 1989\-2004 by the Free Software Foundation, Inc.
8162-.if t Readline is Copyright \(co 1989\-2004 by the Free Software Foundation, Inc.
8163+.if n Readline is Copyright (C) 1989\-2011 Free Software Foundation, Inc.
8164+.if t Readline is Copyright \(co 1989\-2011 Free Software Foundation, Inc.
8165 .SH DESCRIPTION
8166 .LP
8167 .B readline
8168@@ -76,7 +76,7 @@ is read with a non\-empty line, it is
8169 treated as a newline.
8170 .SH NOTATION
8171 .LP
8172-An emacs-style notation is used to denote
8173+An Emacs-style notation is used to denote
8174 keystrokes. Control keys are denoted by C\-\fIkey\fR, e.g., C\-n
8175 means Control\-N. Similarly,
8176 .I meta
8177@@ -116,6 +116,8 @@ The name of this file is taken from the
8178 .B INPUTRC
8179 environment variable. If that variable is unset, the default is
8180 .IR ~/.inputrc .
8181+If that file does not exist or cannot be read, the ultimate default is
8182+.IR /etc/inputrc .
8183 When a program which uses the readline library starts up, the
8184 init file is read, and the key bindings and variables are set.
8185 There are only a few basic constructs allowed in the
8186@@ -168,6 +170,8 @@ command or the text of a macro and a key
8187 it should be bound. The name may be specified in one of two ways:
8188 as a symbolic key name, possibly with \fIMeta\-\fP or \fIControl\-\fP
8189 prefixes, or as a key sequence.
8190+The name and key sequence are separated by a colon. There can be no
8191+whitespace between the name and the colon.
8192 .PP
8193 When using the form \fBkeyname\fP:\^\fIfunction-name\fP or \fImacro\fP,
8194 .I keyname
8195@@ -356,11 +360,30 @@ This command is bound to
8196 in emacs mode and to
8197 .B #
8198 in vi command mode.
8199+.TP
8200+.B completion\-display\-width (-1)
8201+The number of screen columns used to display possible matches
8202+when performing completion.
8203+The value is ignored if it is less than 0 or greater than the terminal
8204+screen width.
8205+A value of 0 will cause matches to be displayed one per line.
8206+The default value is -1.
8207 .TP
8208 .B completion\-ignore\-case (Off)
8209 If set to \fBOn\fP, readline performs filename matching and completion
8210 in a case\-insensitive fashion.
8211 .TP
8212+.B completion\-map\-case (Off)
8213+If set to \fBOn\fP, and \fBcompletion\-ignore\-case\fP is enabled, readline
8214+treats hyphens (\fI\-\fP) and underscores (\fI_\fP) as equivalent when
8215+performing case\-insensitive filename matching and completion.
8216+.TP
8217+.B completion\-prefix\-display\-length (0)
8218+The length in characters of the common prefix of a list of possible
8219+completions that is displayed without modification. When set to a
8220+value greater than zero, common prefixes longer than this value are
8221+replaced with an ellipsis when displaying possible completions.
8222+.TP
8223 .B completion\-query\-items (100)
8224 This determines when the user is queried about viewing
8225 the number of possible completions
8226@@ -384,27 +407,41 @@ mapped to \fBself-insert\fP.
8227 .TP
8228 .B editing\-mode (emacs)
8229 Controls whether readline begins with a set of key bindings similar
8230-to emacs or vi.
8231+to \fIEmacs\fP or \fIvi\fP.
8232 .B editing\-mode
8233 can be set to either
8234 .B emacs
8235 or
8236 .BR vi .
8237 .TP
8238+.B echo\-control\-characters (On)
8239+When set to \fBOn\fP, on operating systems that indicate they support it,
8240+readline echoes a character corresponding to a signal generated from the
8241+keyboard.
8242+.TP
8243 .B enable\-keypad (Off)
8244 When set to \fBOn\fP, readline will try to enable the application
8245 keypad when it is called. Some systems need this to enable the
8246 arrow keys.
8247 .TP
8248+.B enable\-meta\-key (On)
8249+When set to \fBOn\fP, readline will try to enable any meta modifier
8250+key the terminal claims to support when it is called. On many terminals,
8251+the meta key is used to send eight-bit characters.
8252+.TP
8253 .B expand\-tilde (Off)
8254-If set to \fBon\fP, tilde expansion is performed when readline
8255+If set to \fBOn\fP, tilde expansion is performed when readline
8256 attempts word completion.
8257 .TP
8258 .B history\-preserve\-point (Off)
8259-If set to \fBon\fP, the history code attempts to place point at the
8260+If set to \fBOn\fP, the history code attempts to place point at the
8261 same location on each history line retrieved with \fBprevious-history\fP
8262 or \fBnext-history\fP.
8263 .TP
8264+.B history\-size (0)
8265+Set the maximum number of history entries saved in the history list. If
8266+set to zero, the number of entries in the history list is not limited.
8267+.TP
8268 .B horizontal\-scroll\-mode (Off)
8269 When set to \fBOn\fP, makes readline use a single line for display,
8270 scrolling the input horizontally on a single screen line when it
8271@@ -451,9 +488,15 @@ have a slash appended (subject to the va
8272 .B match\-hidden\-files (On)
8273 This variable, when set to \fBOn\fP, causes readline to match files whose
8274 names begin with a `.' (hidden files) when performing filename
8275-completion, unless the leading `.' is
8276+completion.
8277+If set to \fBOff\fP, the leading `.' must be
8278 supplied by the user in the filename to be completed.
8279 .TP
8280+.B menu\-complete\-display\-prefix (Off)
8281+If set to \fBOn\fP, menu completion displays the common prefix of the
8282+list of possible completions (which may be empty) before cycling through
8283+the list.
8284+.TP
8285 .B output\-meta (Off)
8286 If set to \fBOn\fP, readline will display characters with the
8287 eighth bit set directly rather than as a meta-prefixed escape
8288@@ -467,10 +510,16 @@ to display a screenful of possible compl
8289 If set to \fBOn\fP, readline will display completions with matches
8290 sorted horizontally in alphabetical order, rather than down the screen.
8291 .TP
8292+.B revert\-all\-at\-newline (Off)
8293+If set to \fBOn\fP, readline will undo all changes to history lines
8294+before returning when \fBaccept\-line\fP is executed. By default,
8295+history lines may be modified and retain individual undo lists across
8296+calls to \fBreadline\fP.
8297+.TP
8298 .B show\-all\-if\-ambiguous (Off)
8299 This alters the default behavior of the completion functions. If
8300 set to
8301-.BR on ,
8302+.BR On ,
8303 words which have more than one possible completion cause the
8304 matches to be listed immediately instead of ringing the bell.
8305 .TP
8306@@ -478,12 +527,20 @@ matches to be listed immediately instead
8307 This alters the default behavior of the completion functions in
8308 a fashion similar to \fBshow\-all\-if\-ambiguous\fP.
8309 If set to
8310-.BR on ,
8311+.BR On ,
8312 words which have more than one possible completion without any
8313 possible partial completion (the possible completions don't share
8314 a common prefix) cause the matches to be listed immediately instead
8315 of ringing the bell.
8316 .TP
8317+.B skip\-completed\-text (Off)
8318+If set to \fBOn\fP, this alters the default completion behavior when
8319+inserting a single match into the line. It's only active when
8320+performing completion in the middle of a word. If enabled, readline
8321+does not insert characters from the completion that match characters
8322+after point in the word being completed, so portions of the word
8323+following the cursor are not duplicated.
8324+.TP
8325 .B visible\-stats (Off)
8326 If set to \fBOn\fP, a character denoting a file's type as reported
8327 by \fIstat\fP(2) is appended to the filename when listing possible
8328@@ -530,7 +587,7 @@ library sets the \fIapplication name\fP,
8329 file can test for a particular value.
8330 This could be used to bind key sequences to functions useful for
8331 a specific program. For instance, the following command adds a
8332-key sequence that quotes the current or previous word in Bash:
8333+key sequence that quotes the current or previous word in \fBbash\fP:
8334 .sp 1
8335 .RS
8336 .nf
8337@@ -706,10 +763,14 @@ as if the "!\fIn\fP" history expansion h
8338 .B
8339 yank\-last\-arg (M\-.\^, M\-_\^)
8340 Insert the last argument to the previous command (the last word of
8341-the previous history entry). With an argument,
8342-behave exactly like \fByank\-nth\-arg\fP.
8343+the previous history entry).
8344+With a numeric argument, behave exactly like \fByank\-nth\-arg\fP.
8345 Successive calls to \fByank\-last\-arg\fP move back through the history
8346-list, inserting the last argument of each line in turn.
8347+list, inserting the last word (or the word specified by the argument to
8348+the first call) of each line in turn.
8349+Any numeric argument supplied to these successive calls determines
8350+the direction to move through the history. A negative argument switches
8351+the direction through the history (back or forward).
8352 The history expansion facilities are used to extract the last argument,
8353 as if the "!$" history expansion had been specified.
8354 .PD
8355@@ -884,6 +945,12 @@ only attempts filename completion under
8356 .TP
8357 .B possible\-completions (M\-?)
8358 List the possible completions of the text before point.
8359+When displaying completions, readline sets the number of columns used
8360+for display to the value of \fBcompletion-display-width\fP, the value of
8361+the environment variable
8362+.SM
8363+.BR COLUMNS ,
8364+or the screen width, in that order.
8365 .TP
8366 .B insert\-completions (M\-*)
8367 Insert all completions of the text before point
8368@@ -904,6 +971,11 @@ through the list.
8369 This command is intended to be bound to \fBTAB\fP, but is unbound
8370 by default.
8371 .TP
8372+.B menu\-complete\-backward
8373+Identical to \fBmenu\-complete\fP, but moves backward through the list
8374+of possible completions, as if \fBmenu\-complete\fP had been given a
8375+negative argument. This command is unbound by default.
8376+.TP
8377 .B delete\-char\-or\-list
8378 Deletes the character under the cursor if not at the beginning or
8379 end of the line (like \fBdelete-char\fP).
8380@@ -977,6 +1049,15 @@ character. A negative count searches fo
8381 A character is read and point is moved to the previous occurrence of that
8382 character. A negative count searches for subsequent occurrences.
8383 .TP
8384+.B skip\-csi\-sequence
8385+Read enough characters to consume a multi-key sequence such as those
8386+defined for keys like Home and End. Such sequences begin with a
8387+Control Sequence Indicator (CSI), usually ESC\-[. If this sequence is
8388+bound to "\e[", keys producing such sequences will have no effect
8389+unless explicitly bound to a readline command, instead of inserting
8390+stray characters into the editing buffer. This is unbound by default,
8391+but usually bound to ESC\-[.
8392+.TP
8393 .B insert\-comment (M\-#)
8394 Without a numeric argument, the value of the readline
8395 .B comment\-begin
8396Index: gdb-7.2.90.20110703/readline/doc/rlman.texi
8397===================================================================
8398--- gdb-7.2.90.20110703.orig/readline/doc/rlman.texi 2011-07-03 10:40:53.000000000 +0200
8399+++ gdb-7.2.90.20110703/readline/doc/rlman.texi 2011-07-03 10:41:21.000000000 +0200
8400@@ -4,7 +4,6 @@
8401 @settitle GNU Readline Library
8402 @comment %**end of header (This is for running Texinfo on a region.)
8403 @synindex vr fn
8404-@setchapternewpage odd
8405
8406 @include version.texi
8407
8408@@ -14,7 +13,7 @@ This manual describes the GNU Readline L
8409 consistency of user interface across discrete programs which provide
8410 a command line interface.
8411
8412-Copyright @copyright{} 1988-2004 Free Software Foundation, Inc.
8413+Copyright @copyright{} 1988--2011 Free Software Foundation, Inc.
8414
8415 Permission is granted to make and distribute verbatim copies of
8416 this manual provided the copyright notice and this permission notice
8417@@ -22,15 +21,16 @@ are preserved on all copies.
8418
8419 @quotation
8420 Permission is granted to copy, distribute and/or modify this document
8421-under the terms of the GNU Free Documentation License, Version 1.1 or
8422+under the terms of the GNU Free Documentation License, Version 1.3 or
8423 any later version published by the Free Software Foundation; with no
8424-Invariant Sections, with the Front-Cover texts being ``A GNU Manual,''
8425+Invariant Sections, with the Front-Cover texts being ``A GNU Manual'',
8426 and with the Back-Cover Texts as in (a) below. A copy of the license is
8427-included in the section entitled ``GNU Free Documentation License.''
8428+included in the section entitled ``GNU Free Documentation License''.
8429+
8430+(a) The FSF's Back-Cover Text is: You are free to copy and modify
8431+this GNU manual. Buying copies from GNU Press supports the FSF in
8432+developing GNU and promoting software freedom.''
8433
8434-(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
8435-this GNU Manual, like GNU software. Copies published by the Free
8436-Software Foundation raise funds for GNU development.''
8437 @end quotation
8438 @end copying
8439
8440@@ -71,7 +71,7 @@ provide a command line interface.
8441 @menu
8442 * Command Line Editing:: GNU Readline User's Manual.
8443 * Programming with GNU Readline:: GNU Readline Programmer's Manual.
8444-* Copying This Manual:: Copying this manual.
8445+* GNU Free Documentation License:: License for copying this manual.
8446 * Concept Index:: Index of concepts described in this manual.
8447 * Function and Variable Index:: Index of externally visible functions
8448 and variables.
8449@@ -81,12 +81,8 @@ provide a command line interface.
8450 @include rluser.texi
8451 @include rltech.texi
8452
8453-@node Copying This Manual
8454-@appendix Copying This Manual
8455-
8456-@menu
8457-* GNU Free Documentation License:: License for copying this manual.
8458-@end menu
8459+@node GNU Free Documentation License
8460+@appendix GNU Free Documentation License
8461
8462 @include fdl.texi
8463
8464Index: gdb-7.2.90.20110703/readline/doc/rltech.texi
8465===================================================================
8466--- gdb-7.2.90.20110703.orig/readline/doc/rltech.texi 2011-07-03 10:40:53.000000000 +0200
8467+++ gdb-7.2.90.20110703/readline/doc/rltech.texi 2011-07-03 10:41:21.000000000 +0200
8468@@ -1,14 +1,13 @@
8469 @comment %**start of header (This is for running Texinfo on a region.)
8470 @setfilename rltech.info
8471 @comment %**end of header (This is for running Texinfo on a region.)
8472-@setchapternewpage odd
8473
8474 @ifinfo
8475 This document describes the GNU Readline Library, a utility for aiding
8476 in the consistency of user interface across discrete programs that need
8477 to provide a command line interface.
8478
8479-Copyright (C) 1988-2005 Free Software Foundation, Inc.
8480+Copyright (C) 1988--2011 Free Software Foundation, Inc.
8481
8482 Permission is granted to make and distribute verbatim copies of
8483 this manual provided the copyright notice and this permission notice
8484@@ -351,6 +350,12 @@ The @code{rl_set_prompt()} function (@px
8485 be used to modify the prompt string after calling @code{readline()}.
8486 @end deftypevar
8487
8488+@deftypevar {char *} rl_display_prompt
8489+The string displayed as the prompt. This is usually identical to
8490+@var{rl_prompt}, but may be changed temporarily by functions that
8491+use the prompt string as a message area, such as incremental search.
8492+@end deftypevar
8493+
8494 @deftypevar int rl_already_prompted
8495 If an application wishes to display the prompt itself, rather than have
8496 Readline do it the first time @code{readline()} is called, it should set
8497@@ -518,6 +523,20 @@ Readline is performing word completion.
8498 Readline is currently executing the readline signal handler.
8499 @item RL_STATE_UNDOING
8500 Readline is performing an undo.
8501+@item RL_STATE_INPUTPENDING
8502+Readline has input pending due to a call to @code{rl_execute_next()}.
8503+@item RL_STATE_TTYCSAVED
8504+Readline has saved the values of the terminal's special characters.
8505+@item RL_STATE_CALLBACK
8506+Readline is currently using the alternate (callback) interface
8507+(@pxref{Alternate Interface}).
8508+@item RL_STATE_VIMOTION
8509+Readline is reading the argument to a vi-mode "motion" command.
8510+@item RL_STATE_MULTIKEY
8511+Readline is reading a multiple-keystroke command.
8512+@item RL_STATE_VICMDONCE
8513+Readline has entered vi command (movement) mode at least one time during
8514+the current call to @code{readline()}.
8515 @item RL_STATE_DONE
8516 Readline has read a key sequence bound to @code{accept-line}
8517 and is about to return the line to the caller.
8518@@ -603,7 +622,7 @@ Readline which keymap to use.
8519 @deftypefun Keymap rl_make_bare_keymap (void)
8520 Returns a new, empty keymap. The space for the keymap is allocated with
8521 @code{malloc()}; the caller should free it by calling
8522-@code{rl_discard_keymap()} when done.
8523+@code{rl_free_keymap()} when done.
8524 @end deftypefun
8525
8526 @deftypefun Keymap rl_copy_keymap (Keymap map)
8527@@ -617,7 +636,13 @@ the Meta digits bound to produce numeric
8528 @end deftypefun
8529
8530 @deftypefun void rl_discard_keymap (Keymap keymap)
8531-Free the storage associated with @var{keymap}.
8532+Free the storage associated with the data in @var{keymap}.
8533+The caller should free @var{keymap}.
8534+@end deftypefun
8535+
8536+@deftypefun void rl_free_keymap (Keymap keymap)
8537+Free all storage associated with @var{keymap}. This calls
8538+@code{rl_discard_keymap} to free subordindate keymaps and macros.
8539 @end deftypefun
8540
8541 Readline has several internal keymaps. These functions allow you to
8542@@ -793,7 +818,8 @@ Print the names of all bindable Readline
8543 @deftypefun {const char **} rl_funmap_names (void)
8544 Return a NULL terminated array of known function names. The array is
8545 sorted. The array itself is allocated, but not the strings inside. You
8546-should @code{free()} the array when you are done, but not the pointers.
8547+should free the array, but not the pointers, using @code{free} or
8548+@code{rl_free} when you are done.
8549 @end deftypefun
8550
8551 @deftypefun int rl_add_funmap_entry (const char *name, rl_command_func_t *function)
8552@@ -1033,8 +1059,10 @@ pending input has not already been read
8553 @deftypefun int rl_set_keyboard_input_timeout (int u)
8554 While waiting for keyboard input in @code{rl_read_key()}, Readline will
8555 wait for @var{u} microseconds for input before calling any function
8556-assigned to @code{rl_event_hook}. The default waiting period is
8557-one-tenth of a second. Returns the old timeout value.
8558+assigned to @code{rl_event_hook}. @var{u} must be greater than or equal
8559+to zero (a zero-length timeout is equivalent to a poll).
8560+The default waiting period is one-tenth of a second.
8561+Returns the old timeout value.
8562 @end deftypefun
8563
8564 @node Terminal Management
8565@@ -1075,6 +1103,26 @@ environment variable is used.
8566 @node Utility Functions
8567 @subsection Utility Functions
8568
8569+@deftypefun int rl_save_state (struct readline_state *sp)
8570+Save a snapshot of Readline's internal state to @var{sp}.
8571+The contents of the @var{readline_state} structure are documented
8572+in @file{readline.h}.
8573+The caller is responsible for allocating the structure.
8574+@end deftypefun
8575+
8576+@deftypefun int rl_restore_state (struct readline_state *sp)
8577+Restore Readline's internal state to that stored in @var{sp}, which must
8578+have been saved by a call to @code{rl_save_state}.
8579+The contents of the @var{readline_state} structure are documented
8580+in @file{readline.h}.
8581+The caller is responsible for freeing the structure.
8582+@end deftypefun
8583+
8584+@deftypefun void rl_free (void *mem)
8585+Deallocate the memory pointed to by @var{mem}. @var{mem} must have been
8586+allocated by @code{malloc}.
8587+@end deftypefun
8588+
8589 @deftypefun void rl_replace_line (const char *text, int clear_undo)
8590 Replace the contents of @code{rl_line_buffer} with @var{text}.
8591 The point and mark are preserved, if possible.
8592@@ -1082,7 +1130,7 @@ If @var{clear_undo} is non-zero, the und
8593 current line is cleared.
8594 @end deftypefun
8595
8596-@deftypefun int rl_extend_line_buffer (int len)
8597+@deftypefun void rl_extend_line_buffer (int len)
8598 Ensure that @code{rl_line_buffer} has enough space to hold @var{len}
8599 characters, possibly reallocating it if necessary.
8600 @end deftypefun
8601@@ -1109,6 +1157,9 @@ of strings, in argv format, such as a li
8602 is the length of the longest string in @code{matches}. This function uses
8603 the setting of @code{print-completions-horizontally} to select how the
8604 matches are displayed (@pxref{Readline Init File Syntax}).
8605+When displaying completions, this function sets the number of columns used
8606+for display to the value of @code{completion-display-width}, the value of
8607+the environment variable @env{COLUMNS}, or the screen width, in that order.
8608 @end deftypefun
8609
8610 The following are implemented as macros, defined in @code{chardefs.h}.
8611@@ -1392,6 +1443,13 @@ call @code{rl_resize_terminal()} or @cod
8612 Readline to update its idea of the terminal size when a @code{SIGWINCH}
8613 is received.
8614
8615+@deftypefun void rl_echo_signal_char (int sig)
8616+If an application wishes to install its own signal handlers, but still
8617+have readline display characters that generate signals, calling this
8618+function with @var{sig} set to @code{SIGINT}, @code{SIGQUIT}, or
8619+@code{SIGTSTP} will display the character generating that signal.
8620+@end deftypefun
8621+
8622 @deftypefun void rl_resize_terminal (void)
8623 Update Readline's internal screen size by reading values from the kernel.
8624 @end deftypefun
8625@@ -1659,15 +1717,49 @@ from the array must be freed.
8626
8627 @deftypevar {rl_icppfunc_t *} rl_directory_completion_hook
8628 This function, if defined, is allowed to modify the directory portion
8629-of filenames Readline completes. It is called with the address of a
8630-string (the current directory name) as an argument, and may modify that string.
8631+of filenames Readline completes.
8632+It could be used to expand symbolic links or shell variables in pathnames.
8633+It is called with the address of a string (the current directory name) as an
8634+argument, and may modify that string.
8635 If the string is replaced with a new string, the old value should be freed.
8636 Any modified directory name should have a trailing slash.
8637-The modified value will be displayed as part of the completion, replacing
8638+The modified value will be used as part of the completion, replacing
8639 the directory portion of the pathname the user typed.
8640-It returns an integer that should be non-zero if the function modifies
8641-its directory argument.
8642-It could be used to expand symbolic links or shell variables in pathnames.
8643+At the least, even if no other expansion is performed, this function should
8644+remove any quote characters from the directory name, because its result will
8645+be passed directly to @code{opendir()}.
8646+The directory completion hook returns an integer that should be non-zero if
8647+the function modifies its directory argument.
8648+The function should not modify the directory argument if it returns 0.
8649+@end deftypevar
8650+
8651+@ignore
8652+@deftypevar extern rl_icppfunc_t *rl_directory_rewrite_hook;
8653+If non-zero, this is the address of a function to call when completing
8654+a directory name. This function takes the address of the directory name
8655+to be modified as an argument. Unlike @code{rl_directory_completion_hook},
8656+it only modifies the directory name used in @code{opendir}, not what is
8657+displayed when the possible completions are printed or inserted. It is
8658+called before rl_directory_completion_hook.
8659+
8660+I'm not happy with how this works yet, so it's undocumented.
8661+@end deftypevar
8662+@end ignore
8663+
8664+@deftypevar {rl_dequote_func_t *} rl_filename_rewrite_hook
8665+If non-zero, this is the address of a function called when reading
8666+directory entries from the filesystem for completion and comparing
8667+them to the partial word to be completed. The function should
8668+perform any necesary application or system-specific conversion on
8669+the filename, such as converting between character sets or converting
8670+from a filesystem format to a character input format.
8671+The function takes two arguments: @var{fname}, the filename to be converted,
8672+and @var{fnlen}, its length in bytes.
8673+It must either return its first argument (if no conversion takes place)
8674+or the converted filename in newly-allocated memory. The converted
8675+form is used to compare against the word to be completed, and, if it
8676+matches, is added to the list of matches. Readline will free the
8677+allocated string.
8678 @end deftypevar
8679
8680 @deftypevar {rl_compdisp_func_t *} rl_completion_display_matches_hook
8681@@ -1822,6 +1914,15 @@ if the application's completion function
8682 It should be set only by an application's completion function.
8683 @end deftypevar
8684
8685+@deftypevar int rl_sort_completion_matches
8686+If an application sets this variable to 0, Readline will not sort the
8687+list of completions (which implies that it cannot remove any duplicate
8688+completions). The default value is 1, which means that Readline will
8689+sort the completions and, depending on the value of
8690+@code{rl_ignore_completion_duplicates}, will attempt to remove duplicate
8691+matches.
8692+@end deftypevar
8693+
8694 @deftypevar int rl_completion_type
8695 Set to a character describing the type of completion Readline is currently
8696 attempting; see the description of @code{rl_complete_internal()}
8697@@ -1831,6 +1932,13 @@ completion function is called, allowing
8698 the same interface as @code{rl_complete()}.
8699 @end deftypevar
8700
8701+@deftypevar int rl_completion_invoking_key
8702+Set to the final character in the key sequence that invoked one of the
8703+completion functions that call @code{rl_complete_internal()}. This is
8704+set to the appropriate value before any application-specific completion
8705+function is called.
8706+@end deftypevar
8707+
8708 @deftypevar int rl_inhibit_completion
8709 If this variable is non-zero, completion is inhibited. The completion
8710 character will be inserted as any other bound to @code{self-insert}.
8711@@ -1851,27 +1959,51 @@ history list.
8712 GNU Readline library. This application interactively allows users
8713 to manipulate files and their modes. */
8714
8715-#include <stdio.h>
8716+#ifdef HAVE_CONFIG_H
8717+# include <config.h>
8718+#endif
8719+
8720 #include <sys/types.h>
8721-#include <sys/file.h>
8722+#ifdef HAVE_SYS_FILE_H
8723+# include <sys/file.h>
8724+#endif
8725 #include <sys/stat.h>
8726-#include <sys/errno.h>
8727+
8728+#ifdef HAVE_UNISTD_H
8729+# include <unistd.h>
8730+#endif
8731+
8732+#include <fcntl.h>
8733+#include <stdio.h>
8734+#include <errno.h>
8735+
8736+#if defined (HAVE_STRING_H)
8737+# include <string.h>
8738+#else /* !HAVE_STRING_H */
8739+# include <strings.h>
8740+#endif /* !HAVE_STRING_H */
8741+
8742+#ifdef HAVE_STDLIB_H
8743+# include <stdlib.h>
8744+#endif
8745+
8746+#include <time.h>
8747
8748 #include <readline/readline.h>
8749 #include <readline/history.h>
8750
8751-extern char *xmalloc ();
8752+extern char *xmalloc PARAMS((size_t));
8753
8754 /* The names of functions that actually do the manipulation. */
8755-int com_list __P((char *));
8756-int com_view __P((char *));
8757-int com_rename __P((char *));
8758-int com_stat __P((char *));
8759-int com_pwd __P((char *));
8760-int com_delete __P((char *));
8761-int com_help __P((char *));
8762-int com_cd __P((char *));
8763-int com_quit __P((char *));
8764+int com_list PARAMS((char *));
8765+int com_view PARAMS((char *));
8766+int com_rename PARAMS((char *));
8767+int com_stat PARAMS((char *));
8768+int com_pwd PARAMS((char *));
8769+int com_delete PARAMS((char *));
8770+int com_help PARAMS((char *));
8771+int com_cd PARAMS((char *));
8772+int com_quit PARAMS((char *));
8773
8774 /* A structure which contains information on the commands this program
8775 can understand. */
8776@@ -1904,12 +2036,12 @@ COMMAND *find_command ();
8777 /* The name of this program, as taken from argv[0]. */
8778 char *progname;
8779
8780-/* When non-zero, this means the user is done using this program. */
8781+/* When non-zero, this global means the user is done using this program. */
8782 int done;
8783
8784 char *
8785 dupstr (s)
8786- int s;
8787+ char *s;
8788 @{
8789 char *r;
8790
8791@@ -2034,12 +2166,12 @@ stripwhite (string)
8792 /* */
8793 /* **************************************************************** */
8794
8795-char *command_generator __P((const char *, int));
8796-char **fileman_completion __P((const char *, int, int));
8797+char *command_generator PARAMS((const char *, int));
8798+char **fileman_completion PARAMS((const char *, int, int));
8799
8800-/* Tell the GNU Readline library how to complete. We want to try to
8801- complete on command names if this is the first word in the line, or
8802- on filenames if not. */
8803+/* Tell the GNU Readline library how to complete. We want to try to complete
8804+ on command names if this is the first word in the line, or on filenames
8805+ if not. */
8806 initialize_readline ()
8807 @{
8808 /* Allow conditional parsing of the ~/.inputrc file. */
8809@@ -2049,11 +2181,11 @@ initialize_readline ()
8810 rl_attempted_completion_function = fileman_completion;
8811 @}
8812
8813-/* Attempt to complete on the contents of TEXT. START and END
8814- bound the region of rl_line_buffer that contains the word to
8815- complete. TEXT is the word to complete. We can use the entire
8816- contents of rl_line_buffer in case we want to do some simple
8817- parsing. Returnthe array of matches, or NULL if there aren't any. */
8818+/* Attempt to complete on the contents of TEXT. START and END bound the
8819+ region of rl_line_buffer that contains the word to complete. TEXT is
8820+ the word to complete. We can use the entire contents of rl_line_buffer
8821+ in case we want to do some simple parsing. Return the array of matches,
8822+ or NULL if there aren't any. */
8823 char **
8824 fileman_completion (text, start, end)
8825 const char *text;
8826@@ -2072,9 +2204,9 @@ fileman_completion (text, start, end)
8827 return (matches);
8828 @}
8829
8830-/* Generator function for command completion. STATE lets us
8831- know whether to start from scratch; without any state
8832- (i.e. STATE == 0), then we start at the top of the list. */
8833+/* Generator function for command completion. STATE lets us know whether
8834+ to start from scratch; without any state (i.e. STATE == 0), then we
8835+ start at the top of the list. */
8836 char *
8837 command_generator (text, state)
8838 const char *text;
8839@@ -2083,17 +2215,16 @@ command_generator (text, state)
8840 static int list_index, len;
8841 char *name;
8842
8843- /* If this is a new word to complete, initialize now. This
8844- includes saving the length of TEXT for efficiency, and
8845- initializing the index variable to 0. */
8846+ /* If this is a new word to complete, initialize now. This includes
8847+ saving the length of TEXT for efficiency, and initializing the index
8848+ variable to 0. */
8849 if (!state)
8850 @{
8851 list_index = 0;
8852 len = strlen (text);
8853 @}
8854
8855- /* Return the next name which partially matches from the
8856- command list. */
8857+ /* Return the next name which partially matches from the command list. */
8858 while (name = commands[list_index].name)
8859 @{
8860 list_index++;
8861@@ -2133,7 +2264,12 @@ com_view (arg)
8862 if (!valid_argument ("view", arg))
8863 return 1;
8864
8865+#if defined (__MSDOS__)
8866+ /* more.com doesn't grok slashes in pathnames */
8867+ sprintf (syscom, "less %s", arg);
8868+#else
8869 sprintf (syscom, "more %s", arg);
8870+#endif
8871 return (system (syscom));
8872 @}
8873
8874@@ -2160,7 +2296,8 @@ com_stat (arg)
8875
8876 printf ("Statistics for `%s':\n", arg);
8877
8878- printf ("%s has %d link%s, and is %d byte%s in length.\n", arg,
8879+ printf ("%s has %d link%s, and is %d byte%s in length.\n",
8880+ arg,
8881 finfo.st_nlink,
8882 (finfo.st_nlink == 1) ? "" : "s",
8883 finfo.st_size,
8884@@ -2249,8 +2386,7 @@ com_pwd (ignore)
8885 return 0;
8886 @}
8887
8888-/* The user wishes to quit using this program. Just set DONE
8889- non-zero. */
8890+/* The user wishes to quit using this program. Just set DONE non-zero. */
8891 com_quit (arg)
8892 char *arg;
8893 @{
8894@@ -2263,13 +2399,12 @@ too_dangerous (caller)
8895 char *caller;
8896 @{
8897 fprintf (stderr,
8898- "%s: Too dangerous for me to distribute.\n",
8899+ "%s: Too dangerous for me to distribute. Write it yourself.\n",
8900 caller);
8901- fprintf (stderr, "Write it yourself.\n");
8902 @}
8903
8904-/* Return non-zero if ARG is a valid argument for CALLER,
8905- else print an error message and return zero. */
8906+/* Return non-zero if ARG is a valid argument for CALLER, else print
8907+ an error message and return zero. */
8908 int
8909 valid_argument (caller, arg)
8910 char *caller, *arg;
8911Index: gdb-7.2.90.20110703/readline/doc/rluser.texi
8912===================================================================
8913--- gdb-7.2.90.20110703.orig/readline/doc/rluser.texi 2011-07-03 10:40:53.000000000 +0200
8914+++ gdb-7.2.90.20110703/readline/doc/rluser.texi 2011-07-03 10:41:21.000000000 +0200
8915@@ -1,7 +1,6 @@
8916 @comment %**start of header (This is for running Texinfo on a region.)
8917 @setfilename rluser.info
8918 @comment %**end of header (This is for running Texinfo on a region.)
8919-@setchapternewpage odd
8920
8921 @ignore
8922 This file documents the end user interface to the GNU command line
8923@@ -10,7 +9,7 @@ use these features. There is a document
8924 which contains both end-user and programmer documentation for the
8925 GNU Readline Library.
8926
8927-Copyright (C) 1988-2005 Free Software Foundation, Inc.
8928+Copyright (C) 1988--2011 Free Software Foundation, Inc.
8929
8930 Authored by Brian Fox and Chet Ramey.
8931
8932@@ -48,6 +47,16 @@ command line editing interface.
8933 @ifset BashFeatures
8934 Command line editing is provided by the Readline library, which is
8935 used by several different programs, including Bash.
8936+Command line editing is enabled by default when using an interactive shell,
8937+unless the @option{--noediting} option is supplied at shell invocation.
8938+Line editing is also used when using the @option{-e} option to the
8939+@code{read} builtin command (@pxref{Bash Builtins}).
8940+By default, the line editing commands are similar to those of Emacs.
8941+A vi-style line editing interface is also available.
8942+Line editing can be enabled at any time using the @option{-o emacs} or
8943+@option{-o vi} options to the @code{set} builtin command
8944+(@pxref{The Set Builtin}), or disabled using the @option{+o emacs} or
8945+@option{+o vi} options to @code{set}.
8946 @end ifset
8947
8948 @menu
8949@@ -336,7 +345,9 @@ file is taken from the value of the shel
8950 @ifclear BashFeatures
8951 file is taken from the value of the environment variable @env{INPUTRC}. If
8952 @end ifclear
8953-that variable is unset, the default is @file{~/.inputrc}.
8954+that variable is unset, the default is @file{~/.inputrc}. If that
8955+file does not exist or cannot be read, the ultimate default is
8956+@file{/etc/inputrc}.
8957
8958 When a program which uses the Readline library starts up, the
8959 init file is read, and the key bindings are set.
8960@@ -420,11 +431,34 @@ The string to insert at the beginning of
8961 @code{insert-comment} command is executed. The default value
8962 is @code{"#"}.
8963
8964+@item completion-display-width
8965+@vindex completion-display-width
8966+The number of screen columns used to display possible matches
8967+when performing completion.
8968+The value is ignored if it is less than 0 or greater than the terminal
8969+screen width.
8970+A value of 0 will cause matches to be displayed one per line.
8971+The default value is -1.
8972+
8973 @item completion-ignore-case
8974+@vindex completion-ignore-case
8975 If set to @samp{on}, Readline performs filename matching and completion
8976 in a case-insensitive fashion.
8977 The default value is @samp{off}.
8978
8979+@item completion-map-case
8980+@vindex completion-map-case
8981+If set to @samp{on}, and @var{completion-ignore-case} is enabled, Readline
8982+treats hyphens (@samp{-}) and underscores (@samp{_}) as equivalent when
8983+performing case-insensitive filename matching and completion.
8984+
8985+@item completion-prefix-display-length
8986+@vindex completion-prefix-display-length
8987+The length in characters of the common prefix of a list of possible
8988+completions that is displayed without modification. When set to a
8989+value greater than zero, common prefixes longer than this value are
8990+replaced with an ellipsis when displaying possible completions.
8991+
8992 @item completion-query-items
8993 @vindex completion-query-items
8994 The number of possible completions that determines when the user is
8995@@ -456,12 +490,23 @@ key bindings is used. By default, Readl
8996 mode, where the keystrokes are most similar to Emacs. This variable can be
8997 set to either @samp{emacs} or @samp{vi}.
8998
8999+@item echo-control-characters
9000+When set to @samp{on}, on operating systems that indicate they support it,
9001+readline echoes a character corresponding to a signal generated from the
9002+keyboard. The default is @samp{on}.
9003+
9004 @item enable-keypad
9005 @vindex enable-keypad
9006 When set to @samp{on}, Readline will try to enable the application
9007 keypad when it is called. Some systems need this to enable the
9008 arrow keys. The default is @samp{off}.
9009
9010+@item enable-meta-key
9011+When set to @samp{on}, Readline will try to enable any meta modifier
9012+key the terminal claims to support when it is called. On many terminals,
9013+the meta key is used to send eight-bit characters.
9014+The default is @samp{on}.
9015+
9016 @item expand-tilde
9017 @vindex expand-tilde
9018 If set to @samp{on}, tilde expansion is performed when Readline
9019@@ -469,10 +514,16 @@ attempts word completion. The default i
9020
9021 @item history-preserve-point
9022 @vindex history-preserve-point
9023-If set to @samp{on}, the history code attempts to place point at the
9024+If set to @samp{on}, the history code attempts to place the point (the
9025+current cursor position) at the
9026 same location on each history line retrieved with @code{previous-history}
9027 or @code{next-history}. The default is @samp{off}.
9028
9029+@item history-size
9030+@vindex history-size
9031+Set the maximum number of history entries saved in the history list. If
9032+set to zero, the number of entries in the history list is not limited.
9033+
9034 @item horizontal-scroll-mode
9035 @vindex horizontal-scroll-mode
9036 This variable can be set to either @samp{on} or @samp{off}. Setting it
9037@@ -535,10 +586,17 @@ The default is @samp{off}.
9038 @vindex match-hidden-files
9039 This variable, when set to @samp{on}, causes Readline to match files whose
9040 names begin with a @samp{.} (hidden files) when performing filename
9041-completion, unless the leading @samp{.} is
9042+completion.
9043+If set to @samp{off}, the leading @samp{.} must be
9044 supplied by the user in the filename to be completed.
9045 This variable is @samp{on} by default.
9046
9047+@item menu-complete-display-prefix
9048+@vindex menu-complete-display-prefix
9049+If set to @samp{on}, menu completion displays the common prefix of the
9050+list of possible completions (which may be empty) before cycling through
9051+the list. The default is @samp{off}.
9052+
9053 @item output-meta
9054 @vindex output-meta
9055 If set to @samp{on}, Readline will display characters with the
9056@@ -556,6 +614,13 @@ If set to @samp{on}, Readline will displ
9057 sorted horizontally in alphabetical order, rather than down the screen.
9058 The default is @samp{off}.
9059
9060+@item revert-all-at-newline
9061+@vindex revert-all-at-newline
9062+If set to @samp{on}, Readline will undo all changes to history lines
9063+before returning when @code{accept-line} is executed. By default,
9064+history lines may be modified and retain individual undo lists across
9065+calls to @code{readline}. The default is @samp{off}.
9066+
9067 @item show-all-if-ambiguous
9068 @vindex show-all-if-ambiguous
9069 This alters the default behavior of the completion functions. If
9070@@ -575,6 +640,20 @@ a common prefix) cause the matches to be
9071 of ringing the bell.
9072 The default value is @samp{off}.
9073
9074+@item skip-completed-text
9075+@vindex skip-completed-text
9076+If set to @samp{on}, this alters the default completion behavior when
9077+inserting a single match into the line. It's only active when
9078+performing completion in the middle of a word. If enabled, readline
9079+does not insert characters from the completion that match characters
9080+after point in the word being completed, so portions of the word
9081+following the cursor are not duplicated.
9082+For instance, if this is enabled, attempting completion when the cursor
9083+is after the @samp{e} in @samp{Makefile} will result in @samp{Makefile}
9084+rather than @samp{Makefilefile}, assuming there is a single possible
9085+completion.
9086+The default value is @samp{off}.
9087+
9088 @item visible-stats
9089 @vindex visible-stats
9090 If set to @samp{on}, a character denoting a file's type
9091@@ -593,9 +672,11 @@ the command does.
9092 Once you know the name of the command, simply place on a line
9093 in the init file the name of the key
9094 you wish to bind the command to, a colon, and then the name of the
9095-command. The name of the key
9096-can be expressed in different ways, depending on what you find most
9097-comfortable.
9098+command.
9099+There can be no space between the key name and the colon -- that will be
9100+interpreted as part of the key name.
9101+The name of the key can be expressed in different ways, depending on
9102+what you find most comfortable.
9103
9104 In addition to command names, readline allows keys to be bound
9105 to a string that is inserted when the key is pressed (a @var{macro}).
9106@@ -937,12 +1018,22 @@ Move forward a character.
9107 Move back a character.
9108
9109 @item forward-word (M-f)
9110-Move forward to the end of the next word. Words are composed of
9111-letters and digits.
9112+Move forward to the end of the next word.
9113+Words are composed of letters and digits.
9114
9115 @item backward-word (M-b)
9116-Move back to the start of the current or previous word. Words are
9117-composed of letters and digits.
9118+Move back to the start of the current or previous word.
9119+Words are composed of letters and digits.
9120+
9121+@ifset BashFeatures
9122+@item shell-forward-word ()
9123+Move forward to the end of the next word.
9124+Words are delimited by non-quoted shell metacharacters.
9125+
9126+@item shell-backward-word ()
9127+Move back to the start of the current or previous word.
9128+Words are delimited by non-quoted shell metacharacters.
9129+@end ifset
9130
9131 @item clear-screen (C-l)
9132 Clear the screen and redraw the current line,
9133@@ -1029,10 +1120,14 @@ as if the @samp{!@var{n}} history expans
9134
9135 @item yank-last-arg (M-. or M-_)
9136 Insert last argument to the previous command (the last word of the
9137-previous history entry). With an
9138-argument, behave exactly like @code{yank-nth-arg}.
9139+previous history entry).
9140+With a numeric argument, behave exactly like @code{yank-nth-arg}.
9141 Successive calls to @code{yank-last-arg} move back through the history
9142-list, inserting the last argument of each line in turn.
9143+list, inserting the last word (or the word specified by the argument to
9144+the first call) of each line in turn.
9145+Any numeric argument supplied to these successive calls determines
9146+the direction to move through the history. A negative argument switches
9147+the direction through the history (back or forward).
9148 The history expansion facilities are used to extract the last argument,
9149 as if the @samp{!$} history expansion had been specified.
9150
9151@@ -1138,6 +1233,17 @@ Word boundaries are the same as @code{fo
9152 Kill the word behind point.
9153 Word boundaries are the same as @code{backward-word}.
9154
9155+@ifset BashFeatures
9156+@item shell-kill-word ()
9157+Kill from point to the end of the current word, or if between
9158+words, to the end of the next word.
9159+Word boundaries are the same as @code{shell-forward-word}.
9160+
9161+@item shell-backward-kill-word ()
9162+Kill the word behind point.
9163+Word boundaries are the same as @code{shell-backward-word}.
9164+@end ifset
9165+
9166 @item unix-word-rubout (C-w)
9167 Kill the word behind point, using white space as a word boundary.
9168 The killed text is saved on the kill-ring.
9169@@ -1219,6 +1325,9 @@ The default is filename completion.
9170
9171 @item possible-completions (M-?)
9172 List the possible completions of the text before point.
9173+When displaying completions, Readline sets the number of columns used
9174+for display to the value of @code{completion-display-width}, the value of
9175+the environment variable @env{COLUMNS}, or the screen width, in that order.
9176
9177 @item insert-completions (M-*)
9178 Insert all completions of the text before point that would have
9179@@ -1238,6 +1347,11 @@ through the list.
9180 This command is intended to be bound to @key{TAB}, but is unbound
9181 by default.
9182
9183+@item menu-complete-backward ()
9184+Identical to @code{menu-complete}, but moves backward through the list
9185+of possible completions, as if @code{menu-complete} had been given a
9186+negative argument.
9187+
9188 @item delete-char-or-list ()
9189 Deletes the character under the cursor if not at the beginning or
9190 end of the line (like @code{delete-char}).
9191@@ -1293,6 +1407,11 @@ Attempt completion on the text before po
9192 the text against lines from the history list for possible
9193 completion matches.
9194
9195+@item dabbrev-expand ()
9196+Attempt menu completion on the text before point, comparing
9197+the text against lines from the history list for possible
9198+completion matches.
9199+
9200 @item complete-into-braces (M-@{)
9201 Perform filename completion and insert the list of possible completions
9202 enclosed within braces so the list is available to the shell
9203@@ -1372,6 +1491,15 @@ A character is read and point is moved t
9204 of that character. A negative count searches for subsequent
9205 occurrences.
9206
9207+@item skip-csi-sequence ()
9208+Read enough characters to consume a multi-key sequence such as those
9209+defined for keys like Home and End. Such sequences begin with a
9210+Control Sequence Indicator (CSI), usually ESC-[. If this sequence is
9211+bound to "\e[", keys producing such sequences will have no effect
9212+unless explicitly bound to a readline command, instead of inserting
9213+stray characters into the editing buffer. This is unbound by default,
9214+but usually bound to ESC-[.
9215+
9216 @item insert-comment (M-#)
9217 Without a numeric argument, the value of the @code{comment-begin}
9218 variable is inserted at the beginning of the current line.
9219@@ -1481,7 +1609,7 @@ editing mode.
9220 While the Readline library does not have a full set of @code{vi}
9221 editing functions, it does contain enough to allow simple editing
9222 of the line. The Readline @code{vi} mode behaves as specified in
9223-the @sc{posix} 1003.2 standard.
9224+the @sc{posix} standard.
9225
9226 @ifset BashFeatures
9227 In order to switch interactively between @code{emacs} and @code{vi}
9228@@ -1515,10 +1643,15 @@ the programmable completion facilities a
9229 First, the command name is identified.
9230 If a compspec has been defined for that command, the
9231 compspec is used to generate the list of possible completions for the word.
9232+If the command word is the empty string (completion attempted at the
9233+beginning of an empty line), any compspec defined with
9234+the @option{-E} option to @code{complete} is used.
9235 If the command word is a full pathname, a compspec for the full
9236 pathname is searched for first.
9237 If no compspec is found for the full pathname, an attempt is made to
9238 find a compspec for the portion following the final slash.
9239+If those searches do not result in a compspec, any compspec defined with
9240+the @option{-D} option to @code{complete} is used as the default.
9241
9242 Once a compspec has been found, it is used to generate the list of
9243 matching words.
9244@@ -1555,9 +1688,9 @@ completed, and the matching words become
9245
9246 After these matches have been generated, any shell function or command
9247 specified with the @option{-F} and @option{-C} options is invoked.
9248-When the command or function is invoked, the @env{COMP_LINE} and
9249-@env{COMP_POINT} variables are assigned values as described above
9250-(@pxref{Bash Variables}).
9251+When the command or function is invoked, the @env{COMP_LINE},
9252+@env{COMP_POINT}, @env{COMP_KEY}, and @env{COMP_TYPE} variables are
9253+assigned values as described above (@pxref{Bash Variables}).
9254 If a shell function is being invoked, the @env{COMP_WORDS} and
9255 @env{COMP_CWORD} variables are also set.
9256 When the function or command is invoked, the first argument is the
9257@@ -1570,7 +1703,7 @@ the matches.
9258
9259 Any function specified with @option{-F} is invoked first.
9260 The function may use any of the shell facilities, including the
9261-@code{compgen} builtin described below
9262+@code{compgen} and @code{compopt} builtins described below
9263 (@pxref{Programmable Completion Builtins}), to generate the matches.
9264 It must put the possible completions in the @env{COMPREPLY} array
9265 variable.
9266@@ -1622,6 +1755,30 @@ to completed names which are symbolic li
9267 the value of the @var{mark-directories} Readline variable, regardless
9268 of the setting of the @var{mark-symlinked-directories} Readline variable.
9269
9270+There is some support for dynamically modifying completions. This is
9271+most useful when used in combination with a default completion specified
9272+with @option{-D}. It's possible for shell functions executed as completion
9273+handlers to indicate that completion should be retried by returning an
9274+exit status of 124. If a shell function returns 124, and changes
9275+the compspec associated with the command on which completion is being
9276+attempted (supplied as the first argument when the function is executed),
9277+programmable completion restarts from the beginning, with an
9278+attempt to find a new compspec for that command. This allows a set of
9279+completions to be built dynamically as completion is attempted, rather than
9280+being loaded all at once.
9281+
9282+For instance, assuming that there is a library of compspecs, each kept in a
9283+file corresponding to the name of the command, the following default
9284+completion function would load completions dynamically:
9285+
9286+@example
9287+_completion_loader()
9288+@{
9289+ . "/etc/bash_completion.d/$1.sh" >/dev/null 2>&1 && return 124
9290+@}
9291+complete -D -F _completion_loader
9292+@end example
9293+
9294 @node Programmable Completion Builtins
9295 @section Programmable Completion Builtins
9296 @cindex completion builtins
9297@@ -1657,10 +1814,10 @@ matches were generated.
9298 @item complete
9299 @btindex complete
9300 @example
9301-@code{complete [-abcdefgjksuv] [-o @var{comp-option}] [-A @var{action}] [-G @var{globpat}] [-W @var{wordlist}]
9302-[-P @var{prefix}] [-S @var{suffix}] [-X @var{filterpat}] [-F @var{function}]
9303-[-C @var{command}] @var{name} [@var{name} @dots{}]}
9304-@code{complete -pr [@var{name} @dots{}]}
9305+@code{complete [-abcdefgjksuv] [-o @var{comp-option}] [-DE] [-A @var{action}] [-G @var{globpat}] [-W @var{wordlist}]
9306+[-F @var{function}] [-C @var{command}] [-X @var{filterpat}]
9307+[-P @var{prefix}] [-S @var{suffix}] @var{name} [@var{name} @dots{}]}
9308+@code{complete -pr [-DE] [@var{name} @dots{}]}
9309 @end example
9310
9311 Specify how arguments to each @var{name} should be completed.
9312@@ -1670,9 +1827,16 @@ reused as input.
9313 The @option{-r} option removes a completion specification for
9314 each @var{name}, or, if no @var{name}s are supplied, all
9315 completion specifications.
9316+The @option{-D} option indicates that the remaining options and actions should
9317+apply to the ``default'' command completion; that is, completion attempted
9318+on a command for which no completion has previously been defined.
9319+The @option{-E} option indicates that the remaining options and actions should
9320+apply to ``empty'' command completion; that is, completion attempted on a
9321+blank line.
9322
9323 The process of applying these completion specifications when word completion
9324-is attempted is described above (@pxref{Programmable Completion}).
9325+is attempted is described above (@pxref{Programmable Completion}). The
9326+@option{-D} option takes precedence over @option{-E}.
9327
9328 Other options, if specified, have the following meanings.
9329 The arguments to the @option{-G}, @option{-W}, and @option{-X} options
9330@@ -1702,9 +1866,10 @@ Perform directory name completion if the
9331
9332 @item filenames
9333 Tell Readline that the compspec generates filenames, so it can perform any
9334-filename-specific processing (like adding a slash to directory names or
9335-suppressing trailing spaces). This option is intended to be used with
9336-shell functions specified with @option{-F}.
9337+filename-specific processing (like adding a slash to directory names
9338+quoting special characters, or suppressing trailing spaces).
9339+This option is intended to be used with shell functions specified
9340+with @option{-F}.
9341
9342 @item nospace
9343 Tell Readline not to append a space (the default) to words completed at
9344@@ -1798,17 +1963,6 @@ User names. May also be specified as @o
9345 Names of all shell variables. May also be specified as @option{-v}.
9346 @end table
9347
9348-@item -G @var{globpat}
9349-The filename expansion pattern @var{globpat} is expanded to generate
9350-the possible completions.
9351-
9352-@item -W @var{wordlist}
9353-The @var{wordlist} is split using the characters in the
9354-@env{IFS} special variable as delimiters, and each resultant word
9355-is expanded.
9356-The possible completions are the members of the resultant list which
9357-match the word being completed.
9358-
9359 @item -C @var{command}
9360 @var{command} is executed in a subshell environment, and its output is
9361 used as the possible completions.
9362@@ -1819,13 +1973,9 @@ environment.
9363 When it finishes, the possible completions are retrieved from the value
9364 of the @env{COMPREPLY} array variable.
9365
9366-@item -X @var{filterpat}
9367-@var{filterpat} is a pattern as used for filename expansion.
9368-It is applied to the list of possible completions generated by the
9369-preceding options and arguments, and each completion matching
9370-@var{filterpat} is removed from the list.
9371-A leading @samp{!} in @var{filterpat} negates the pattern; in this
9372-case, any completion not matching @var{filterpat} is removed.
9373+@item -G @var{globpat}
9374+The filename expansion pattern @var{globpat} is expanded to generate
9375+the possible completions.
9376
9377 @item -P @var{prefix}
9378 @var{prefix} is added at the beginning of each possible completion
9379@@ -1834,6 +1984,21 @@ after all other options have been applie
9380 @item -S @var{suffix}
9381 @var{suffix} is appended to each possible completion
9382 after all other options have been applied.
9383+
9384+@item -W @var{wordlist}
9385+The @var{wordlist} is split using the characters in the
9386+@env{IFS} special variable as delimiters, and each resultant word
9387+is expanded.
9388+The possible completions are the members of the resultant list which
9389+match the word being completed.
9390+
9391+@item -X @var{filterpat}
9392+@var{filterpat} is a pattern as used for filename expansion.
9393+It is applied to the list of possible completions generated by the
9394+preceding options and arguments, and each completion matching
9395+@var{filterpat} is removed from the list.
9396+A leading @samp{!} in @var{filterpat} negates the pattern; in this
9397+case, any completion not matching @var{filterpat} is removed.
9398 @end table
9399
9400 The return value is true unless an invalid option is supplied, an option
9401@@ -1842,5 +2007,31 @@ argument, an attempt is made to remove a
9402 a @var{name} for which no specification exists, or
9403 an error occurs adding a completion specification.
9404
9405+@item compopt
9406+@btindex compopt
9407+@example
9408+@code{compopt} [-o @var{option}] [-DE] [+o @var{option}] [@var{name}]
9409+@end example
9410+Modify completion options for each @var{name} according to the
9411+@var{option}s, or for the currently-executing completion if no @var{name}s
9412+are supplied.
9413+If no @var{option}s are given, display the completion options for each
9414+@var{name} or the current completion.
9415+The possible values of @var{option} are those valid for the @code{complete}
9416+builtin described above.
9417+The @option{-D} option indicates that the remaining options should
9418+apply to the ``default'' command completion; that is, completion attempted
9419+on a command for which no completion has previously been defined.
9420+The @option{-E} option indicates that the remaining options should
9421+apply to ``empty'' command completion; that is, completion attempted on a
9422+blank line.
9423+
9424+The @option{-D} option takes precedence over @option{-E}.
9425+
9426+The return value is true unless an invalid option is supplied, an attempt
9427+is made to modify the options for a @var{name} for which no completion
9428+specification exists, or an output error occurs.
9429+
9430 @end table
9431+
9432 @end ifset
9433Index: gdb-7.2.90.20110703/readline/doc/rluserman.texi
9434===================================================================
9435--- gdb-7.2.90.20110703.orig/readline/doc/rluserman.texi 2011-07-03 10:40:53.000000000 +0200
9436+++ gdb-7.2.90.20110703/readline/doc/rluserman.texi 2011-07-03 10:41:21.000000000 +0200
9437@@ -4,8 +4,6 @@
9438 @settitle GNU Readline Library
9439 @comment %**end of header (This is for running Texinfo on a region.)
9440
9441-@setchapternewpage odd
9442-
9443 @include version.texi
9444
9445 @copying
9446@@ -14,7 +12,7 @@ This manual describes the end user inter
9447 consistency of user interface across discrete programs which provide
9448 a command line interface.
9449
9450-Copyright @copyright{} 1988-2005 Free Software Foundation, Inc.
9451+Copyright @copyright{} 1988--2011 Free Software Foundation, Inc.
9452
9453 Permission is granted to make and distribute verbatim copies of
9454 this manual provided the copyright notice and this permission notice
9455@@ -22,15 +20,16 @@ are preserved on all copies.
9456
9457 @quotation
9458 Permission is granted to copy, distribute and/or modify this document
9459-under the terms of the GNU Free Documentation License, Version 1.1 or
9460+under the terms of the GNU Free Documentation License, Version 1.3 or
9461 any later version published by the Free Software Foundation; with no
9462-Invariant Sections, with the Front-Cover texts being ``A GNU Manual,''
9463+Invariant Sections, with the Front-Cover texts being ``A GNU Manual'',
9464 and with the Back-Cover Texts as in (a) below. A copy of the license is
9465-included in the section entitled ``GNU Free Documentation License.''
9466+included in the section entitled ``GNU Free Documentation License''.
9467+
9468+(a) The FSF's Back-Cover Text is: You are free to copy and modify
9469+this GNU manual. Buying copies from GNU Press supports the FSF in
9470+developing GNU and promoting software freedom.''
9471
9472-(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
9473-this GNU Manual, like GNU software. Copies published by the Free
9474-Software Foundation raise funds for GNU development.''
9475 @end quotation
9476 @end copying
9477
9478@@ -70,18 +69,14 @@ programs which provide a command line in
9479
9480 @menu
9481 * Command Line Editing:: GNU Readline User's Manual.
9482-* Copying This Manual:: Copying This Manual.
9483+* GNU Free Documentation License:: License for copying this manual.
9484 @end menu
9485 @end ifnottex
9486
9487 @include rluser.texi
9488
9489-@node Copying This Manual
9490-@appendix Copying This Manual
9491-
9492-@menu
9493-* GNU Free Documentation License:: License for copying this manual.
9494-@end menu
9495+@node GNU Free Documentation License
9496+@appendix GNU Free Documentation License
9497
9498 @include fdl.texi
9499
9500Index: gdb-7.2.90.20110703/readline/doc/texi2dvi
9501===================================================================
9502--- gdb-7.2.90.20110703.orig/readline/doc/texi2dvi 2011-07-03 10:40:53.000000000 +0200
9503+++ gdb-7.2.90.20110703/readline/doc/texi2dvi 2011-07-03 10:41:21.000000000 +0200
9504@@ -5,20 +5,18 @@
9505 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001,
9506 # 2002, 2003 Free Software Foundation, Inc.
9507 #
9508-# This program is free software; you can redistribute it and/or modify
9509-# it under the terms of the GNU General Public License as published by
9510-# the Free Software Foundation; either version 2, or (at your option)
9511-# any later version.
9512+# This program is free software: you can redistribute it and/or modify
9513+# it under the terms of the GNU General Public License as published by
9514+# the Free Software Foundation, either version 3 of the License, or
9515+# (at your option) any later version.
9516 #
9517-# This program is distributed in the hope that it will be useful,
9518-# but WITHOUT ANY WARRANTY; without even the implied warranty of
9519-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9520-# GNU General Public License for more details.
9521+# This program is distributed in the hope that it will be useful,
9522+# but WITHOUT ANY WARRANTY; without even the implied warranty of
9523+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9524+# GNU General Public License for more details.
9525 #
9526-# You should have received a copy of the GNU General Public License
9527-# along with this program; if not, you can either send email to this
9528-# program's maintainer or write to: The Free Software Foundation,
9529-# Inc.; 59 Temple Place, Suite 330; Boston, MA 02111-1307, USA.
9530+# You should have received a copy of the GNU General Public License
9531+# along with this program. If not, see <http://www.gnu.org/licenses/>.
9532 #
9533 # Original author: Noah Friedman <friedman@gnu.org>.
9534 #
9535Index: gdb-7.2.90.20110703/readline/doc/texi2html
9536===================================================================
9537--- gdb-7.2.90.20110703.orig/readline/doc/texi2html 2011-07-03 10:40:53.000000000 +0200
9538+++ gdb-7.2.90.20110703/readline/doc/texi2html 2011-07-03 10:41:21.000000000 +0200
9539@@ -7,20 +7,19 @@
9540 #
9541 # Copyright (C) 1999, 2000 Free Software Foundation, Inc.
9542 #
9543-# This program is free software; you can redistribute it and/or modify
9544-# it under the terms of the GNU General Public License as published by
9545-# the Free Software Foundation; either version 2 of the License, or
9546-# (at your option) any later version.
9547-#
9548-# This program is distributed in the hope that it will be useful,
9549-# but WITHOUT ANY WARRANTY; without even the implied warranty of
9550-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9551-# GNU General Public License for more details.
9552-#
9553-# You should have received a copy of the GNU General Public License
9554-# along with this program; if not, write to the Free Software
9555-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
9556-#
9557+# This program is free software: you can redistribute it and/or modify
9558+# it under the terms of the GNU General Public License as published by
9559+# the Free Software Foundation, either version 3 of the License, or
9560+# (at your option) any later version.
9561+#
9562+# This program is distributed in the hope that it will be useful,
9563+# but WITHOUT ANY WARRANTY; without even the implied warranty of
9564+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9565+# GNU General Public License for more details.
9566+#
9567+# You should have received a copy of the GNU General Public License
9568+# along with this program. If not, see <http://www.gnu.org/licenses/>.
9569+#
9570 #-##############################################################################
9571
9572 # This requires perl version 5 or higher
9573@@ -3564,7 +3563,7 @@ INPUT_LINE: while ($_ = &next_line) {
9574 $name = &normalise_node($name);
9575 $level = $sec2level{$tag};
9576 # check for index
9577- $first_index_chapter = $name
9578+ $first_index_chapter = $node
9579 if ($level == 1 && !$first_index_chapter &&
9580 $name =~ /index/i);
9581 if ($in_top && /heading/){
9582Index: gdb-7.2.90.20110703/readline/doc/version.texi
9583===================================================================
9584--- gdb-7.2.90.20110703.orig/readline/doc/version.texi 2011-07-03 10:40:53.000000000 +0200
9585+++ gdb-7.2.90.20110703/readline/doc/version.texi 2011-07-03 10:41:21.000000000 +0200
9586@@ -1,10 +1,10 @@
9587 @ignore
9588-Copyright (C) 1988-2005 Free Software Foundation, Inc.
9589+Copyright (C) 1988-2011 Free Software Foundation, Inc.
9590 @end ignore
9591
9592-@set EDITION 5.1-beta1
9593-@set VERSION 5.1-beta1
9594-@set UPDATED 11 November 2005
9595-@set UPDATED-MONTH November 2005
9596+@set EDITION 6.2
9597+@set VERSION 6.2
9598+@set UPDATED September 6 2010
9599+@set UPDATED-MONTH September 2010
9600
9601-@set LASTCHANGE Fri Nov 11 19:50:51 EST 2005
9602+@set LASTCHANGE Mon Sep 6 22:07:10 EDT 2010
9603Index: gdb-7.2.90.20110703/readline/emacs_keymap.c
9604===================================================================
9605--- gdb-7.2.90.20110703.orig/readline/emacs_keymap.c 2011-07-03 10:40:53.000000000 +0200
9606+++ gdb-7.2.90.20110703/readline/emacs_keymap.c 2011-07-03 10:41:21.000000000 +0200
9607@@ -1,24 +1,23 @@
9608 /* emacs_keymap.c -- the keymap for emacs_mode in readline (). */
9609
9610-/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
9611+/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
9612
9613- This file is part of the GNU Readline Library, a library for
9614- reading lines of text with interactive input and history editing.
9615+ This file is part of the GNU Readline Library (Readline), a library
9616+ for reading lines of text with interactive input and history editing.
9617
9618- The GNU Readline Library is free software; you can redistribute it
9619- and/or modify it under the terms of the GNU General Public License
9620- as published by the Free Software Foundation; either version 2, or
9621+ Readline is free software: you can redistribute it and/or modify
9622+ it under the terms of the GNU General Public License as published by
9623+ the Free Software Foundation, either version 3 of the License, or
9624 (at your option) any later version.
9625
9626- The GNU Readline Library is distributed in the hope that it will be
9627- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
9628- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9629+ Readline is distributed in the hope that it will be useful,
9630+ but WITHOUT ANY WARRANTY; without even the implied warranty of
9631+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9632 GNU General Public License for more details.
9633
9634- The GNU General Public License is often shipped with GNU software, and
9635- is generally kept in a file called COPYING or LICENSE. If you do not
9636- have a copy of the license, write to the Free Software Foundation,
9637- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
9638+ You should have received a copy of the GNU General Public License
9639+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
9640+*/
9641
9642 #if !defined (BUFSIZ)
9643 #include <stdio.h>
9644Index: gdb-7.2.90.20110703/readline/examples/ChangeLog.gdb
9645===================================================================
9646--- gdb-7.2.90.20110703.orig/readline/examples/ChangeLog.gdb 2011-07-03 10:40:53.000000000 +0200
9647+++ gdb-7.2.90.20110703/readline/examples/ChangeLog.gdb 2011-07-03 10:41:21.000000000 +0200
9648@@ -1,3 +1,7 @@
9649+2011-04-25 Jan Kratochvil <jan.kratochvil@redhat.com>
9650+
9651+ Imported readline 6.2, and upstream patch 001.
9652+
9653 2006-04-24 Daniel Jacobowitz <dan@codesourcery.com>
9654
9655 Imported readline 5.1, and upstream patches 001-004.
9656Index: gdb-7.2.90.20110703/readline/examples/Inputrc
9657===================================================================
9658--- gdb-7.2.90.20110703.orig/readline/examples/Inputrc 2011-07-03 10:40:53.000000000 +0200
9659+++ gdb-7.2.90.20110703/readline/examples/Inputrc 2011-07-03 10:41:21.000000000 +0200
9660@@ -4,21 +4,21 @@
9661 # on which program is running, or what terminal is active.
9662 #
9663
9664-# Copyright (C) 1989-2002 Free Software Foundation, Inc.
9665+# Copyright (C) 1989-2009 Free Software Foundation, Inc.
9666 #
9667-# This program is free software; you can redistribute it and/or modify
9668-# it under the terms of the GNU General Public License as published by
9669-# the Free Software Foundation; either version 2, or (at your option)
9670-# any later version.
9671+# This program is free software: you can redistribute it and/or modify
9672+# it under the terms of the GNU General Public License as published by
9673+# the Free Software Foundation, either version 3 of the License, or
9674+# (at your option) any later version.
9675 #
9676-# This program is distributed in the hope that it will be useful,
9677-# but WITHOUT ANY WARRANTY; without even the implied warranty of
9678-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9679-# GNU General Public License for more details.
9680+# This program is distributed in the hope that it will be useful,
9681+# but WITHOUT ANY WARRANTY; without even the implied warranty of
9682+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9683+# GNU General Public License for more details.
9684+#
9685+# You should have received a copy of the GNU General Public License
9686+# along with this program. If not, see <http://www.gnu.org/licenses/>.
9687 #
9688-# You should have received a copy of the GNU General Public License
9689-# along with this program; if not, write to the Free Software
9690-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
9691
9692 # In all programs, all terminals, make sure this is bound.
9693 "\C-x\C-r": re-read-init-file
9694Index: gdb-7.2.90.20110703/readline/examples/Makefile.in
9695===================================================================
9696--- gdb-7.2.90.20110703.orig/readline/examples/Makefile.in 2011-07-03 10:40:53.000000000 +0200
9697+++ gdb-7.2.90.20110703/readline/examples/Makefile.in 2011-07-03 10:41:21.000000000 +0200
9698@@ -1,30 +1,46 @@
9699 #
9700 # This is the Makefile for the readline examples subdirectory.
9701 #
9702-# Copyright (C) 1994 Free Software Foundation, Inc.
9703+# Copyright (C) 1994,2008,2009 Free Software Foundation, Inc.
9704+
9705+# This program is free software: you can redistribute it and/or modify
9706+# it under the terms of the GNU General Public License as published by
9707+# the Free Software Foundation, either version 3 of the License, or
9708+# (at your option) any later version.
9709+
9710+# This program is distributed in the hope that it will be useful,
9711+# but WITHOUT ANY WARRANTY; without even the implied warranty of
9712+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9713+# GNU General Public License for more details.
9714+
9715+# You should have received a copy of the GNU General Public License
9716+# along with this program. If not, see <http://www.gnu.org/licenses/>.
9717
9718-# This program is free software; you can redistribute it and/or modify
9719-# it under the terms of the GNU General Public License as published by
9720-# the Free Software Foundation; either version 2, or (at your option)
9721-# any later version.
9722-
9723-# This program is distributed in the hope that it will be useful,
9724-# but WITHOUT ANY WARRANTY; without even the implied warranty of
9725-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9726-# GNU General Public License for more details.
9727-
9728-# You should have received a copy of the GNU General Public License
9729-# along with this program; if not, write to the Free Software
9730-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
9731 RL_LIBRARY_VERSION = @LIBVERSION@
9732
9733 SHELL = @MAKE_SHELL@
9734 RM = rm -f
9735
9736+prefix = @prefix@
9737+exec_prefix = @exec_prefix@
9738+
9739+datarootdir = @datarootdir@
9740+
9741+bindir = @bindir@
9742 srcdir = @srcdir@
9743-VPATH = .:@srcdir@
9744+datadir = @datadir@
9745+VPATH = @srcdir@
9746 top_srcdir = @top_srcdir@
9747-BUILD_DIR = .
9748+#BUILD_DIR = .
9749+BUILD_DIR = @BUILD_DIR@
9750+installdir = $(datadir)/readline
9751+
9752+INSTALL = @INSTALL@
9753+INSTALL_PROGRAM = @INSTALL_PROGRAM@
9754+INSTALL_DATA = @INSTALL_DATA@
9755+
9756+EXEEXT = @EXEEXT@
9757+OBJEXT = @OBJEXT@
9758
9759 # Support an alternate destination root directory for package building
9760 DESTDIR =
9761@@ -51,31 +67,56 @@ TERMCAP_LIB = @TERMCAP_LIB@
9762 ${RM} $@
9763 $(CC) $(CCFLAGS) -c $<
9764
9765-EXECUTABLES = fileman rltest rl rlcat rlversion histexamp
9766-OBJECTS = fileman.o rltest.o rl.o rlcat.o rlversion.o histexamp.o
9767+SOURCES = excallback.c fileman.c histexamp.c manexamp.c rl-fgets.c rl.c \
9768+ rlcat.c rlevent.c rlptytest.c rltest.c rlversion.c
9769+
9770+EXECUTABLES = fileman$(EXEEXT) rltest$(EXEEXT) rl$(EXEEXT) rlcat$(EXEEXT) \
9771+ rlevent$(EXEEXT) rlversion$(EXEEXT) histexamp$(EXEEXT)
9772+OBJECTS = fileman.o rltest.o rl.o rlevent.o rlcat.o rlversion.o histexamp.o
9773
9774 all: $(EXECUTABLES)
9775 everything: all
9776
9777-rl: rl.o $(READLINE_LIB)
9778+check: rlversion$(EXEEXT)
9779+ @echo Readline version: `rlversion$(EXEEXT)`
9780+
9781+installdirs:
9782+ -$(SHELL) $(top_srcdir)/support/mkdirs $(DESTDIR)$(installdir)
9783+
9784+install: installdirs
9785+ @for f in $(SOURCES); do \
9786+ $(RM) $(DESTDIR)$(installdir)/$$f ; \
9787+ $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(installdir) ; \
9788+ done
9789+
9790+uninstall:
9791+ @for f in $(SOURCES); do \
9792+ $(RM) $(DESTDIR)$(installdir)/$$f ; \
9793+ done
9794+ -rmdir $(DESTDIR)$(installdir)
9795+
9796+rl$(EXEEXT): rl.o $(READLINE_LIB)
9797 $(PURIFY) $(CC) $(LDFLAGS) -o $@ rl.o $(READLINE_LIB) $(TERMCAP_LIB)
9798
9799-rlcat: rlcat.o $(READLINE_LIB)
9800+rlcat$(EXEEXT): rlcat.o $(READLINE_LIB)
9801 $(PURIFY) $(CC) $(LDFLAGS) -o $@ rlcat.o $(READLINE_LIB) $(TERMCAP_LIB)
9802
9803-fileman: fileman.o $(READLINE_LIB)
9804+rlevent$(EXEEXT): rlevent.o $(READLINE_LIB)
9805+ $(PURIFY) $(CC) $(LDFLAGS) -o $@ rlevent.o $(READLINE_LIB) $(TERMCAP_LIB)
9806+
9807+fileman$(EXEEXT): fileman.o $(READLINE_LIB)
9808 $(PURIFY) $(CC) $(LDFLAGS) -o $@ fileman.o $(READLINE_LIB) $(TERMCAP_LIB)
9809
9810-rltest: rltest.o $(READLINE_LIB)
9811+rltest$(EXEEXT): rltest.o $(READLINE_LIB)
9812 $(PURIFY) $(CC) $(LDFLAGS) -o $@ rltest.o $(READLINE_LIB) $(TERMCAP_LIB)
9813
9814-rlptytest: rlptytest.o $(READLINE_LIB)
9815+rlptytest$(EXEEXT): rlptytest.o $(READLINE_LIB)
9816 $(PURIFY) $(CC) $(LDFLAGS) -o $@ rlptytest.o $(READLINE_LIB) $(TERMCAP_LIB)
9817
9818-rlversion: rlversion.o $(READLINE_LIB)
9819+rlversion$(EXEEXT): rlversion.o $(READLINE_LIB)
9820 $(CC) $(LDFLAGS) -o $@ rlversion.o $(READLINE_LIB) $(TERMCAP_LIB)
9821
9822-histexamp: histexamp.o $(HISTORY_LIB)
9823+histexamp$(EXEEXT): histexamp.o $(HISTORY_LIB)
9824 $(PURIFY) $(CC) $(LDFLAGS) -o $@ histexamp.o -lhistory $(TERMCAP_LIB)
9825
9826 clean mostlyclean:
9827Index: gdb-7.2.90.20110703/readline/examples/autoconf/BASH_CHECK_LIB_TERMCAP
9828===================================================================
9829--- /dev/null 1970-01-01 00:00:00.000000000 +0000
9830+++ gdb-7.2.90.20110703/readline/examples/autoconf/BASH_CHECK_LIB_TERMCAP 2011-07-03 10:41:21.000000000 +0200
9831@@ -0,0 +1,40 @@
9832+AC_DEFUN([BASH_CHECK_LIB_TERMCAP],
9833+[
9834+if test "X$bash_cv_termcap_lib" = "X"; then
9835+_bash_needmsg=yes
9836+else
9837+AC_MSG_CHECKING(which library has the termcap functions)
9838+_bash_needmsg=
9839+fi
9840+AC_CACHE_VAL(bash_cv_termcap_lib,
9841+[AC_CHECK_FUNC(tgetent, bash_cv_termcap_lib=libc,
9842+ [AC_CHECK_LIB(termcap, tgetent, bash_cv_termcap_lib=libtermcap,
9843+ [AC_CHECK_LIB(tinfo, tgetent, bash_cv_termcap_lib=libtinfo,
9844+ [AC_CHECK_LIB(curses, tgetent, bash_cv_termcap_lib=libcurses,
9845+ [AC_CHECK_LIB(ncurses, tgetent, bash_cv_termcap_lib=libncurses,
9846+ bash_cv_termcap_lib=gnutermcap)])])])])])
9847+if test "X$_bash_needmsg" = "Xyes"; then
9848+AC_MSG_CHECKING(which library has the termcap functions)
9849+fi
9850+AC_MSG_RESULT(using $bash_cv_termcap_lib)
9851+if test $bash_cv_termcap_lib = gnutermcap && test -z "$prefer_curses"; then
9852+LDFLAGS="$LDFLAGS -L./lib/termcap"
9853+TERMCAP_LIB="./lib/termcap/libtermcap.a"
9854+TERMCAP_DEP="./lib/termcap/libtermcap.a"
9855+elif test $bash_cv_termcap_lib = libtermcap && test -z "$prefer_curses"; then
9856+TERMCAP_LIB=-ltermcap
9857+TERMCAP_DEP=
9858+elif test $bash_cv_termcap_lib = libtinfo; then
9859+TERMCAP_LIB=-ltinfo
9860+TERMCAP_DEP=
9861+elif test $bash_cv_termcap_lib = libncurses; then
9862+TERMCAP_LIB=-lncurses
9863+TERMCAP_DEP=
9864+elif test $bash_cv_termcap_lib = libc; then
9865+TERMCAP_LIB=
9866+TERMCAP_DEP=
9867+else
9868+TERMCAP_LIB=-lcurses
9869+TERMCAP_DEP=
9870+fi
9871+])
9872Index: gdb-7.2.90.20110703/readline/examples/autoconf/RL_LIB_READLINE_VERSION
9873===================================================================
9874--- /dev/null 1970-01-01 00:00:00.000000000 +0000
9875+++ gdb-7.2.90.20110703/readline/examples/autoconf/RL_LIB_READLINE_VERSION 2011-07-03 10:41:21.000000000 +0200
9876@@ -0,0 +1,118 @@
9877+dnl need: prefix exec_prefix libdir includedir CC TERMCAP_LIB
9878+dnl require:
9879+dnl AC_PROG_CC
9880+dnl BASH_CHECK_LIB_TERMCAP
9881+
9882+AC_DEFUN([RL_LIB_READLINE_VERSION],
9883+[
9884+AC_REQUIRE([BASH_CHECK_LIB_TERMCAP])
9885+
9886+AC_MSG_CHECKING([version of installed readline library])
9887+
9888+# What a pain in the ass this is.
9889+
9890+# save cpp and ld options
9891+_save_CFLAGS="$CFLAGS"
9892+_save_LDFLAGS="$LDFLAGS"
9893+_save_LIBS="$LIBS"
9894+
9895+# Don't set ac_cv_rl_prefix if the caller has already assigned a value. This
9896+# allows the caller to do something like $_rl_prefix=$withval if the user
9897+# specifies --with-installed-readline=PREFIX as an argument to configure
9898+
9899+if test -z "$ac_cv_rl_prefix"; then
9900+test "x$prefix" = xNONE && ac_cv_rl_prefix=$ac_default_prefix || ac_cv_rl_prefix=${prefix}
9901+fi
9902+
9903+eval ac_cv_rl_includedir=${ac_cv_rl_prefix}/include
9904+eval ac_cv_rl_libdir=${ac_cv_rl_prefix}/lib
9905+
9906+LIBS="$LIBS -lreadline ${TERMCAP_LIB}"
9907+CFLAGS="$CFLAGS -I${ac_cv_rl_includedir}"
9908+LDFLAGS="$LDFLAGS -L${ac_cv_rl_libdir}"
9909+
9910+AC_CACHE_VAL(ac_cv_rl_version,
9911+[AC_TRY_RUN([
9912+#include <stdio.h>
9913+#include <readline/readline.h>
9914+
9915+extern int rl_gnu_readline_p;
9916+
9917+main()
9918+{
9919+ FILE *fp;
9920+ fp = fopen("conftest.rlv", "w");
9921+ if (fp == 0)
9922+ exit(1);
9923+ if (rl_gnu_readline_p != 1)
9924+ fprintf(fp, "0.0\n");
9925+ else
9926+ fprintf(fp, "%s\n", rl_library_version ? rl_library_version : "0.0");
9927+ fclose(fp);
9928+ exit(0);
9929+}
9930+],
9931+ac_cv_rl_version=`cat conftest.rlv`,
9932+ac_cv_rl_version='0.0',
9933+ac_cv_rl_version='4.2')])
9934+
9935+CFLAGS="$_save_CFLAGS"
9936+LDFLAGS="$_save_LDFLAGS"
9937+LIBS="$_save_LIBS"
9938+
9939+RL_MAJOR=0
9940+RL_MINOR=0
9941+
9942+# (
9943+case "$ac_cv_rl_version" in
9944+2*|3*|4*|5*|6*|7*|8*|9*)
9945+ RL_MAJOR=`echo $ac_cv_rl_version | sed 's:\..*$::'`
9946+ RL_MINOR=`echo $ac_cv_rl_version | sed -e 's:^.*\.::' -e 's:[[a-zA-Z]]*$::'`
9947+ ;;
9948+esac
9949+
9950+# (((
9951+case $RL_MAJOR in
9952+[[0-9][0-9]]) _RL_MAJOR=$RL_MAJOR ;;
9953+[[0-9]]) _RL_MAJOR=0$RL_MAJOR ;;
9954+*) _RL_MAJOR=00 ;;
9955+esac
9956+
9957+# (((
9958+case $RL_MINOR in
9959+[[0-9][0-9]]) _RL_MINOR=$RL_MINOR ;;
9960+[[0-9]]) _RL_MINOR=0$RL_MINOR ;;
9961+*) _RL_MINOR=00 ;;
9962+esac
9963+
9964+RL_VERSION="0x${_RL_MAJOR}${_RL_MINOR}"
9965+
9966+# Readline versions greater than 4.2 have these defines in readline.h
9967+
9968+if test $ac_cv_rl_version = '0.0' ; then
9969+ AC_MSG_WARN([Could not test version of installed readline library.])
9970+elif test $RL_MAJOR -gt 4 || { test $RL_MAJOR = 4 && test $RL_MINOR -gt 2 ; } ; then
9971+ # set these for use by the caller
9972+ RL_PREFIX=$ac_cv_rl_prefix
9973+ RL_LIBDIR=$ac_cv_rl_libdir
9974+ RL_INCLUDEDIR=$ac_cv_rl_includedir
9975+ AC_MSG_RESULT($ac_cv_rl_version)
9976+else
9977+
9978+AC_DEFINE_UNQUOTED(RL_READLINE_VERSION, $RL_VERSION, [encoded version of the installed readline library])
9979+AC_DEFINE_UNQUOTED(RL_VERSION_MAJOR, $RL_MAJOR, [major version of installed readline library])
9980+AC_DEFINE_UNQUOTED(RL_VERSION_MINOR, $RL_MINOR, [minor version of installed readline library])
9981+
9982+AC_SUBST(RL_VERSION)
9983+AC_SUBST(RL_MAJOR)
9984+AC_SUBST(RL_MINOR)
9985+
9986+# set these for use by the caller
9987+RL_PREFIX=$ac_cv_rl_prefix
9988+RL_LIBDIR=$ac_cv_rl_libdir
9989+RL_INCLUDEDIR=$ac_cv_rl_includedir
9990+
9991+AC_MSG_RESULT($ac_cv_rl_version)
9992+
9993+fi
9994+])
9995Index: gdb-7.2.90.20110703/readline/examples/autoconf/wi_LIB_READLINE
9996===================================================================
9997--- /dev/null 1970-01-01 00:00:00.000000000 +0000
9998+++ gdb-7.2.90.20110703/readline/examples/autoconf/wi_LIB_READLINE 2011-07-03 10:41:21.000000000 +0200
9999@@ -0,0 +1,76 @@
10000+dnl Borut Razem
10001+dnl
10002+dnl This macro checks for the presence of the readline library.
10003+dnl It works also in cross-compilation environment.
10004+dnl
10005+dnl To get it into the aclocal.m4 dnl file, do this:
10006+dnl aclocal -I . --verbose
10007+dnl
10008+dnl The --verbose will show all of the files that are searched
10009+dnl for .m4 macros.
10010+
10011+AC_DEFUN([wi_LIB_READLINE], [
10012+ dnl check for the readline.h header file
10013+
10014+ AC_CHECK_HEADER(readline/readline.h)
10015+
10016+ if test "$ac_cv_header_readline_readline_h" = yes; then
10017+ dnl check the readline version
10018+
10019+ cat > conftest.$ac_ext <<EOF
10020+#include <stdio.h>
10021+#include <readline/readline.h>
10022+wi_LIB_READLINE_VERSION RL_VERSION_MAJOR RL_VERSION_MINOR
10023+EOF
10024+
10025+ wi_READLINE_VERSION=$($CPP $CPPFLAGS conftest.$ac_ext | sed -n -e "s/^wi_LIB_READLINE_VERSION *\([[0-9\]][[0-9\]]*\) *\([[0-9\]][[0-9\]]*\)$/\1.\2/p")
10026+ rm -rf conftest*
10027+
10028+ if test -n "$wi_READLINE_VERSION"; then
10029+ wi_MAJOR=$(expr $wi_READLINE_VERSION : '\([[0-9]][[0-9]]*\)\.')
10030+ wi_MINOR=$(expr $wi_READLINE_VERSION : '[[0-9]][[0-9]]*\.\([[0-9]][[0-9]]*$\)')
10031+ if test $wi_MINOR -lt 10; then
10032+ wi_MINOR=$(expr $wi_MINOR \* 10)
10033+ fi
10034+ wi_READLINE_VERSION=$(expr $wi_MAJOR \* 100 + $wi_MINOR)
10035+ else
10036+ wi_READLINE_VERSION=-1
10037+ fi
10038+
10039+ dnl check for the readline library
10040+
10041+ ac_save_LIBS="$LIBS"
10042+ # Note: $LIBCURSES is permitted to be empty.
10043+
10044+ for LIBREADLINE in "-lreadline.dll" "-lreadline" "-lreadline $LIBCURSES" "-lreadline -ltermcap" "-lreadline -lncurses" "-lreadline -lcurses"
10045+ do
10046+ AC_MSG_CHECKING([for GNU Readline library $LIBREADLINE])
10047+
10048+ LIBS="$ac_save_LIBS $LIBREADLINE"
10049+
10050+ AC_TRY_LINK([
10051+ /* includes */
10052+ #include <stdio.h>
10053+ #include <readline/readline.h>
10054+ ],[
10055+ /* function-body */
10056+ int dummy = rl_completion_append_character; /* rl_completion_append_character appeared in version 2.1 */
10057+ readline(NULL);
10058+ ],[
10059+ wi_cv_lib_readline=yes
10060+ AC_MSG_RESULT(yes)
10061+ ],[
10062+ wi_cv_lib_readline=no
10063+ AC_MSG_RESULT(no)
10064+ ])
10065+
10066+ if test "$wi_cv_lib_readline" = yes; then
10067+ AC_SUBST(LIBREADLINE)
10068+ AC_DEFINE_UNQUOTED(HAVE_LIBREADLINE, $wi_READLINE_VERSION, [Readline])
10069+ break
10070+ fi
10071+ done
10072+
10073+ LIBS="$ac_save_LIBS"
10074+ fi
10075+])
10076Index: gdb-7.2.90.20110703/readline/examples/excallback.c
10077===================================================================
10078--- gdb-7.2.90.20110703.orig/readline/examples/excallback.c 2011-07-03 10:40:53.000000000 +0200
10079+++ gdb-7.2.90.20110703/readline/examples/excallback.c 2011-07-03 10:41:21.000000000 +0200
10080@@ -32,6 +32,9 @@ Let me know what you think.
10081
10082 Jeff
10083 */
10084+/*
10085+Copyright (C) 1999 Jeff Solomon
10086+*/
10087
10088 #if defined (HAVE_CONFIG_H)
10089 #include <config.h>
10090Index: gdb-7.2.90.20110703/readline/examples/fileman.c
10091===================================================================
10092--- gdb-7.2.90.20110703.orig/readline/examples/fileman.c 2011-07-03 10:40:53.000000000 +0200
10093+++ gdb-7.2.90.20110703/readline/examples/fileman.c 2011-07-03 10:41:21.000000000 +0200
10094@@ -1,22 +1,23 @@
10095-/* Copyright (C) 1987-2002 Free Software Foundation, Inc.
10096+/* fileman.c - file manager example for readline library. */
10097
10098- This file is part of the GNU Readline Library, a library for
10099+/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
10100+
10101+ This file is part of the GNU Readline Library (Readline), a library for
10102 reading lines of text with interactive input and history editing.
10103
10104- The GNU Readline Library is free software; you can redistribute it
10105- and/or modify it under the terms of the GNU General Public License
10106- as published by the Free Software Foundation; either version 2, or
10107+ Readline is free software: you can redistribute it and/or modify
10108+ it under the terms of the GNU General Public License as published by
10109+ the Free Software Foundation, either version 3 of the License, or
10110 (at your option) any later version.
10111
10112- The GNU Readline Library is distributed in the hope that it will be
10113- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
10114- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10115+ Readline is distributed in the hope that it will be useful,
10116+ but WITHOUT ANY WARRANTY; without even the implied warranty of
10117+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10118 GNU General Public License for more details.
10119
10120- The GNU General Public License is often shipped with GNU software, and
10121- is generally kept in a file called COPYING or LICENSE. If you do not
10122- have a copy of the license, write to the Free Software Foundation,
10123- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
10124+ You should have received a copy of the GNU General Public License
10125+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
10126+*/
10127
10128 /* fileman.c -- A tiny application which demonstrates how to use the
10129 GNU Readline library. This application interactively allows users
10130@@ -50,6 +51,8 @@
10131 # include <stdlib.h>
10132 #endif
10133
10134+#include <time.h>
10135+
10136 #ifdef READLINE_LIBRARY
10137 # include "readline.h"
10138 # include "history.h"
10139@@ -58,7 +61,7 @@
10140 # include <readline/history.h>
10141 #endif
10142
10143-extern char *xmalloc ();
10144+extern char *xmalloc PARAMS((size_t));
10145
10146 /* The names of functions that actually do the manipulation. */
10147 int com_list PARAMS((char *));
10148Index: gdb-7.2.90.20110703/readline/examples/histexamp.c
10149===================================================================
10150--- gdb-7.2.90.20110703.orig/readline/examples/histexamp.c 2011-07-03 10:40:53.000000000 +0200
10151+++ gdb-7.2.90.20110703/readline/examples/histexamp.c 2011-07-03 10:41:21.000000000 +0200
10152@@ -1,22 +1,23 @@
10153-/* Copyright (C) 1987-2002 Free Software Foundation, Inc.
10154+/* histexamp.c - history library example program. */
10155
10156- This file is part of the GNU Readline Library, a library for
10157+/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
10158+
10159+ This file is part of the GNU Readline Library (Readline), a library for
10160 reading lines of text with interactive input and history editing.
10161
10162- The GNU Readline Library is free software; you can redistribute it
10163- and/or modify it under the terms of the GNU General Public License
10164- as published by the Free Software Foundation; either version 2, or
10165+ Readline is free software: you can redistribute it and/or modify
10166+ it under the terms of the GNU General Public License as published by
10167+ the Free Software Foundation, either version 3 of the License, or
10168 (at your option) any later version.
10169
10170- The GNU Readline Library is distributed in the hope that it will be
10171- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
10172- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10173+ Readline is distributed in the hope that it will be useful,
10174+ but WITHOUT ANY WARRANTY; without even the implied warranty of
10175+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10176 GNU General Public License for more details.
10177
10178- The GNU General Public License is often shipped with GNU software, and
10179- is generally kept in a file called COPYING or LICENSE. If you do not
10180- have a copy of the license, write to the Free Software Foundation,
10181- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
10182+ You should have received a copy of the GNU General Public License
10183+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
10184+*/
10185
10186 #include <stdio.h>
10187
10188Index: gdb-7.2.90.20110703/readline/examples/manexamp.c
10189===================================================================
10190--- gdb-7.2.90.20110703.orig/readline/examples/manexamp.c 2011-07-03 10:40:53.000000000 +0200
10191+++ gdb-7.2.90.20110703/readline/examples/manexamp.c 2011-07-03 10:41:21.000000000 +0200
10192@@ -1,24 +1,23 @@
10193 /* manexamp.c -- The examples which appear in the documentation are here. */
10194
10195-/* Copyright (C) 1987-2002 Free Software Foundation, Inc.
10196+/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
10197
10198- This file is part of the GNU Readline Library, a library for
10199+ This file is part of the GNU Readline Library (Readline), a library for
10200 reading lines of text with interactive input and history editing.
10201
10202- The GNU Readline Library is free software; you can redistribute it
10203- and/or modify it under the terms of the GNU General Public License
10204- as published by the Free Software Foundation; either version 2, or
10205+ Readline is free software: you can redistribute it and/or modify
10206+ it under the terms of the GNU General Public License as published by
10207+ the Free Software Foundation, either version 3 of the License, or
10208 (at your option) any later version.
10209
10210- The GNU Readline Library is distributed in the hope that it will be
10211- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
10212- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10213+ Readline is distributed in the hope that it will be useful,
10214+ but WITHOUT ANY WARRANTY; without even the implied warranty of
10215+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10216 GNU General Public License for more details.
10217
10218- The GNU General Public License is often shipped with GNU software, and
10219- is generally kept in a file called COPYING or LICENSE. If you do not
10220- have a copy of the license, write to the Free Software Foundation,
10221- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
10222+ You should have received a copy of the GNU General Public License
10223+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
10224+*/
10225
10226 #include <stdio.h>
10227 #include <readline/readline.h>
10228Index: gdb-7.2.90.20110703/readline/examples/readlinebuf.h
10229===================================================================
10230--- gdb-7.2.90.20110703.orig/readline/examples/readlinebuf.h 2011-07-03 10:40:53.000000000 +0200
10231+++ gdb-7.2.90.20110703/readline/examples/readlinebuf.h 2011-07-03 10:41:21.000000000 +0200
10232@@ -8,7 +8,7 @@
10233 *
10234 * This program is free software; you can redistribute it and/or modify
10235 * it under the terms of the GNU General Public License as published by
10236- * the Free Software Foundation; either version 2 of the License, or
10237+ * the Free Software Foundation; either version 2 of the License, or
10238 * (at your option) any later version.
10239 *
10240 * This program is distributed in the hope that it will be useful,
10241Index: gdb-7.2.90.20110703/readline/examples/rl.c
10242===================================================================
10243--- gdb-7.2.90.20110703.orig/readline/examples/rl.c 2011-07-03 10:40:53.000000000 +0200
10244+++ gdb-7.2.90.20110703/readline/examples/rl.c 2011-07-03 10:41:21.000000000 +0200
10245@@ -5,25 +5,24 @@
10246 * usage: rl [-p prompt] [-u unit] [-d default] [-n nchars]
10247 */
10248
10249-/* Copyright (C) 1987-2002 Free Software Foundation, Inc.
10250+/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
10251
10252- This file is part of the GNU Readline Library, a library for
10253+ This file is part of the GNU Readline Library (Readline), a library for
10254 reading lines of text with interactive input and history editing.
10255
10256- The GNU Readline Library is free software; you can redistribute it
10257- and/or modify it under the terms of the GNU General Public License
10258- as published by the Free Software Foundation; either version 2, or
10259+ Readline is free software: you can redistribute it and/or modify
10260+ it under the terms of the GNU General Public License as published by
10261+ the Free Software Foundation, either version 3 of the License, or
10262 (at your option) any later version.
10263
10264- The GNU Readline Library is distributed in the hope that it will be
10265- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
10266- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10267+ Readline is distributed in the hope that it will be useful,
10268+ but WITHOUT ANY WARRANTY; without even the implied warranty of
10269+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10270 GNU General Public License for more details.
10271
10272- The GNU General Public License is often shipped with GNU software, and
10273- is generally kept in a file called COPYING or LICENSE. If you do not
10274- have a copy of the license, write to the Free Software Foundation,
10275- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
10276+ You should have received a copy of the GNU General Public License
10277+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
10278+*/
10279
10280 #if defined (HAVE_CONFIG_H)
10281 # include <config.h>
10282Index: gdb-7.2.90.20110703/readline/examples/rlcat.c
10283===================================================================
10284--- gdb-7.2.90.20110703.orig/readline/examples/rlcat.c 2011-07-03 10:40:53.000000000 +0200
10285+++ gdb-7.2.90.20110703/readline/examples/rlcat.c 2011-07-03 10:41:21.000000000 +0200
10286@@ -4,25 +4,24 @@
10287 * usage: rlcat
10288 */
10289
10290-/* Copyright (C) 1987-2002 Free Software Foundation, Inc.
10291+/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
10292
10293- This file is part of the GNU Readline Library, a library for
10294+ This file is part of the GNU Readline Library (Readline), a library for
10295 reading lines of text with interactive input and history editing.
10296
10297- The GNU Readline Library is free software; you can redistribute it
10298- and/or modify it under the terms of the GNU General Public License
10299- as published by the Free Software Foundation; either version 2, or
10300+ Readline is free software: you can redistribute it and/or modify
10301+ it under the terms of the GNU General Public License as published by
10302+ the Free Software Foundation, either version 3 of the License, or
10303 (at your option) any later version.
10304
10305- The GNU Readline Library is distributed in the hope that it will be
10306- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
10307- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10308+ Readline is distributed in the hope that it will be useful,
10309+ but WITHOUT ANY WARRANTY; without even the implied warranty of
10310+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10311 GNU General Public License for more details.
10312
10313- The GNU General Public License is often shipped with GNU software, and
10314- is generally kept in a file called COPYING or LICENSE. If you do not
10315- have a copy of the license, write to the Free Software Foundation,
10316- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
10317+ You should have received a copy of the GNU General Public License
10318+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
10319+*/
10320
10321 #if defined (HAVE_CONFIG_H)
10322 # include <config.h>
10323Index: gdb-7.2.90.20110703/readline/examples/rlevent.c
10324===================================================================
10325--- /dev/null 1970-01-01 00:00:00.000000000 +0000
10326+++ gdb-7.2.90.20110703/readline/examples/rlevent.c 2011-07-03 10:41:21.000000000 +0200
10327@@ -0,0 +1,166 @@
10328+/*
10329+ * rl - command-line interface to read a line from the standard input
10330+ * (or another fd) using readline.
10331+ *
10332+ * usage: rl [-p prompt] [-u unit] [-d default] [-n nchars]
10333+ */
10334+
10335+/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
10336+
10337+ This file is part of the GNU Readline Library (Readline), a library for
10338+ reading lines of text with interactive input and history editing.
10339+
10340+ Readline is free software: you can redistribute it and/or modify
10341+ it under the terms of the GNU General Public License as published by
10342+ the Free Software Foundation, either version 3 of the License, or
10343+ (at your option) any later version.
10344+
10345+ Readline is distributed in the hope that it will be useful,
10346+ but WITHOUT ANY WARRANTY; without even the implied warranty of
10347+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10348+ GNU General Public License for more details.
10349+
10350+ You should have received a copy of the GNU General Public License
10351+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
10352+*/
10353+
10354+#if defined (HAVE_CONFIG_H)
10355+# include <config.h>
10356+#endif
10357+
10358+#include <stdio.h>
10359+#include <sys/types.h>
10360+
10361+#ifdef HAVE_STDLIB_H
10362+# include <stdlib.h>
10363+#else
10364+extern void exit();
10365+#endif
10366+
10367+#if defined (READLINE_LIBRARY)
10368+# include "posixstat.h"
10369+# include "readline.h"
10370+# include "history.h"
10371+#else
10372+# include <sys/stat.h>
10373+# include <readline/readline.h>
10374+# include <readline/history.h>
10375+#endif
10376+
10377+extern int optind;
10378+extern char *optarg;
10379+
10380+#if !defined (strchr) && !defined (__STDC__)
10381+extern char *strrchr();
10382+#endif
10383+
10384+static char *progname;
10385+static char *deftext;
10386+
10387+static int
10388+event_hook ()
10389+{
10390+ fprintf (stderr, "ding!\n");
10391+ sleep (1);
10392+ return 0;
10393+}
10394+
10395+static int
10396+set_deftext ()
10397+{
10398+ if (deftext)
10399+ {
10400+ rl_insert_text (deftext);
10401+ deftext = (char *)NULL;
10402+ rl_startup_hook = (rl_hook_func_t *)NULL;
10403+ }
10404+ return 0;
10405+}
10406+
10407+static void
10408+usage()
10409+{
10410+ fprintf (stderr, "%s: usage: %s [-p prompt] [-u unit] [-d default] [-n nchars]\n",
10411+ progname, progname);
10412+}
10413+
10414+int
10415+main (argc, argv)
10416+ int argc;
10417+ char **argv;
10418+{
10419+ char *temp, *prompt;
10420+ struct stat sb;
10421+ int opt, fd, nch;
10422+ FILE *ifp;
10423+
10424+ progname = strrchr(argv[0], '/');
10425+ if (progname == 0)
10426+ progname = argv[0];
10427+ else
10428+ progname++;
10429+
10430+ /* defaults */
10431+ prompt = "readline$ ";
10432+ fd = nch = 0;
10433+ deftext = (char *)0;
10434+
10435+ while ((opt = getopt(argc, argv, "p:u:d:n:")) != EOF)
10436+ {
10437+ switch (opt)
10438+ {
10439+ case 'p':
10440+ prompt = optarg;
10441+ break;
10442+ case 'u':
10443+ fd = atoi(optarg);
10444+ if (fd < 0)
10445+ {
10446+ fprintf (stderr, "%s: bad file descriptor `%s'\n", progname, optarg);
10447+ exit (2);
10448+ }
10449+ break;
10450+ case 'd':
10451+ deftext = optarg;
10452+ break;
10453+ case 'n':
10454+ nch = atoi(optarg);
10455+ if (nch < 0)
10456+ {
10457+ fprintf (stderr, "%s: bad value for -n: `%s'\n", progname, optarg);
10458+ exit (2);
10459+ }
10460+ break;
10461+ default:
10462+ usage ();
10463+ exit (2);
10464+ }
10465+ }
10466+
10467+ if (fd != 0)
10468+ {
10469+ if (fstat (fd, &sb) < 0)
10470+ {
10471+ fprintf (stderr, "%s: %d: bad file descriptor\n", progname, fd);
10472+ exit (1);
10473+ }
10474+ ifp = fdopen (fd, "r");
10475+ rl_instream = ifp;
10476+ }
10477+
10478+ if (deftext && *deftext)
10479+ rl_startup_hook = set_deftext;
10480+
10481+ if (nch > 0)
10482+ rl_num_chars_to_read = nch;
10483+
10484+ rl_event_hook = event_hook;
10485+ temp = readline (prompt);
10486+
10487+ /* Test for EOF. */
10488+ if (temp == 0)
10489+ exit (1);
10490+
10491+ printf ("%s\n", temp);
10492+ exit (0);
10493+}
10494Index: gdb-7.2.90.20110703/readline/examples/rlfe/ChangeLog
10495===================================================================
10496--- gdb-7.2.90.20110703.orig/readline/examples/rlfe/ChangeLog 2011-07-03 10:40:53.000000000 +0200
10497+++ gdb-7.2.90.20110703/readline/examples/rlfe/ChangeLog 2011-07-03 10:41:21.000000000 +0200
10498@@ -1,14 +1,3 @@
10499-2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10500-
10501- * configure: Regenerate.
10502-
10503- * configure.in: m4_include toplevel config/override.m4.
10504- * configure: Regenerate.
10505-
10506-2009-07-30 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10507-
10508- * configure.in: Correctly quote AC_PROGRAM_SOURCE definition.
10509-
10510 2004-11-04 Per Bothner <per@bothner.com>
10511
10512 * pty.c: Import from screen-4.0.2.
10513Index: gdb-7.2.90.20110703/readline/examples/rlfe/Makefile.in
10514===================================================================
10515--- gdb-7.2.90.20110703.orig/readline/examples/rlfe/Makefile.in 2011-07-03 10:40:53.000000000 +0200
10516+++ gdb-7.2.90.20110703/readline/examples/rlfe/Makefile.in 2011-07-03 10:41:21.000000000 +0200
10517@@ -25,7 +25,7 @@ CFLAGS = @CFLAGS@
10518 CPPFLAGS = @CPPFLAGS@
10519 #LDFLAGS = -L$(READLINE_DIR)
10520 LDFLAGS = @LDFLAGS@
10521-LIBS = -lreadline -lhistory -lncurses
10522+LIBS = -lreadline -lhistory @LIBS@
10523
10524 CPP=@CPP@
10525 CPP_DEPEND=$(CC) -MM
10526@@ -55,7 +55,7 @@ rlfe-$(VERSION).tar.gz:
10527 tar czf $@ $(CFILES) $(HFILES) $(EXTRA_DIST)
10528
10529 .c.o:
10530- $(CC) -c -I. -I$(srcdir) $(M_CFLAGS) $(DEFS) $(OPTIONS) $(CFLAGS) $<
10531+ $(CC) -c -I. -I$(srcdir) $(CPPFLAGS) $(M_CFLAGS) $(DEFS) $(OPTIONS) $(CFLAGS) $<
10532
10533 install_bin: .version screen
10534 -if [ -f $(DESTDIR)$(bindir)/$(SCREEN) ] && [ ! -f $(DESTDIR)$(bindir)/$(SCREEN).old ]; \
10535@@ -68,7 +68,6 @@ install_bin: .version screen
10536 (cd $(DESTDIR)$(bindir) && ln -sf $(SCREEN) screen)
10537 cp $(srcdir)/utf8encodings/?? $(DESTDIR)$(SCREENENCODINGS)
10538
10539-
10540 uninstall: .version
10541 rm -f $(DESTDIR)$(bindir)/$(SCREEN)
10542 rm -f $(DESTDIR)$(bindir)/screen
10543@@ -170,6 +169,15 @@ depend.in: $(CFILES) term.h
10544 for i in $(CFILES); do echo $$i; $(CPP_DEPEND) $$i >> tmp_make; done
10545 mv tmp_make Makefile.in
10546
10547+Makefile makefile: config.status $(srcdir)/Makefile.in
10548+ CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status
10549+
10550+config.status: $(srcdir)/configure
10551+ $(SHELL) ./config.status --recheck
10552+
10553+$(srcdir)/configure: $(srcdir)/configure.in
10554+ cd $(srcdir) && autoconf
10555+
10556 ###############################################################################
10557
10558 ### Dependencies:
10559Index: gdb-7.2.90.20110703/readline/examples/rlfe/config.h.in
10560===================================================================
10561--- gdb-7.2.90.20110703.orig/readline/examples/rlfe/config.h.in 2011-07-03 10:40:53.000000000 +0200
10562+++ gdb-7.2.90.20110703/readline/examples/rlfe/config.h.in 2011-07-03 10:41:21.000000000 +0200
10563@@ -373,3 +373,7 @@
10564 #undef PTYRANGE1
10565
10566 #define USEVARARGS
10567+
10568+#undef HAVE_SYS_STROPTS_H
10569+
10570+#undef HAVE_SYS_WAIT_H
10571Index: gdb-7.2.90.20110703/readline/examples/rlfe/configure
10572===================================================================
10573--- gdb-7.2.90.20110703.orig/readline/examples/rlfe/configure 2011-07-03 10:40:53.000000000 +0200
10574+++ gdb-7.2.90.20110703/readline/examples/rlfe/configure 2011-07-03 10:41:21.000000000 +0200
10575@@ -552,6 +552,42 @@ PACKAGE_BUGREPORT=
10576 PACKAGE_URL=
10577
10578 ac_unique_file="rlfe.c"
10579+# Factoring default headers for most tests.
10580+ac_includes_default="\
10581+#include <stdio.h>
10582+#ifdef HAVE_SYS_TYPES_H
10583+# include <sys/types.h>
10584+#endif
10585+#ifdef HAVE_SYS_STAT_H
10586+# include <sys/stat.h>
10587+#endif
10588+#ifdef STDC_HEADERS
10589+# include <stdlib.h>
10590+# include <stddef.h>
10591+#else
10592+# ifdef HAVE_STDLIB_H
10593+# include <stdlib.h>
10594+# endif
10595+#endif
10596+#ifdef HAVE_STRING_H
10597+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
10598+# include <memory.h>
10599+# endif
10600+# include <string.h>
10601+#endif
10602+#ifdef HAVE_STRINGS_H
10603+# include <strings.h>
10604+#endif
10605+#ifdef HAVE_INTTYPES_H
10606+# include <inttypes.h>
10607+#endif
10608+#ifdef HAVE_STDINT_H
10609+# include <stdint.h>
10610+#endif
10611+#ifdef HAVE_UNISTD_H
10612+# include <unistd.h>
10613+#endif"
10614+
10615 ac_subst_vars='LTLIBOBJS
10616 LIBOBJS
10617 XTERMPATH
10618@@ -1550,6 +1586,124 @@ $as_echo "$ac_res" >&6; }
10619 eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
10620
10621 } # ac_fn_c_check_func
10622+
10623+# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
10624+# -------------------------------------------------------
10625+# Tests whether HEADER exists, giving a warning if it cannot be compiled using
10626+# the include files in INCLUDES and setting the cache variable VAR
10627+# accordingly.
10628+ac_fn_c_check_header_mongrel ()
10629+{
10630+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
10631+ if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
10632+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
10633+$as_echo_n "checking for $2... " >&6; }
10634+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
10635+ $as_echo_n "(cached) " >&6
10636+fi
10637+eval ac_res=\$$3
10638+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
10639+$as_echo "$ac_res" >&6; }
10640+else
10641+ # Is the header compilable?
10642+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
10643+$as_echo_n "checking $2 usability... " >&6; }
10644+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
10645+/* end confdefs.h. */
10646+$4
10647+#include <$2>
10648+_ACEOF
10649+if ac_fn_c_try_compile "$LINENO"; then :
10650+ ac_header_compiler=yes
10651+else
10652+ ac_header_compiler=no
10653+fi
10654+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
10655+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
10656+$as_echo "$ac_header_compiler" >&6; }
10657+
10658+# Is the header present?
10659+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
10660+$as_echo_n "checking $2 presence... " >&6; }
10661+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
10662+/* end confdefs.h. */
10663+#include <$2>
10664+_ACEOF
10665+if ac_fn_c_try_cpp "$LINENO"; then :
10666+ ac_header_preproc=yes
10667+else
10668+ ac_header_preproc=no
10669+fi
10670+rm -f conftest.err conftest.$ac_ext
10671+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
10672+$as_echo "$ac_header_preproc" >&6; }
10673+
10674+# So? What about this header?
10675+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
10676+ yes:no: )
10677+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
10678+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
10679+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
10680+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
10681+ ;;
10682+ no:yes:* )
10683+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
10684+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
10685+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5
10686+$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}
10687+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
10688+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
10689+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5
10690+$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
10691+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
10692+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
10693+ ;;
10694+esac
10695+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
10696+$as_echo_n "checking for $2... " >&6; }
10697+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
10698+ $as_echo_n "(cached) " >&6
10699+else
10700+ eval "$3=\$ac_header_compiler"
10701+fi
10702+eval ac_res=\$$3
10703+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
10704+$as_echo "$ac_res" >&6; }
10705+fi
10706+ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
10707+
10708+} # ac_fn_c_check_header_mongrel
10709+
10710+# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
10711+# -------------------------------------------------------
10712+# Tests whether HEADER exists and can be compiled using the include files in
10713+# INCLUDES, setting the cache variable VAR accordingly.
10714+ac_fn_c_check_header_compile ()
10715+{
10716+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
10717+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
10718+$as_echo_n "checking for $2... " >&6; }
10719+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
10720+ $as_echo_n "(cached) " >&6
10721+else
10722+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
10723+/* end confdefs.h. */
10724+$4
10725+#include <$2>
10726+_ACEOF
10727+if ac_fn_c_try_compile "$LINENO"; then :
10728+ eval "$3=yes"
10729+else
10730+ eval "$3=no"
10731+fi
10732+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
10733+fi
10734+eval ac_res=\$$3
10735+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
10736+$as_echo "$ac_res" >&6; }
10737+ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
10738+
10739+} # ac_fn_c_check_header_compile
10740 cat >config.log <<_ACEOF
10741 This file contains any messages produced by compilers while
10742 running configure, to aid debugging if configure makes a mistake.
10743@@ -4003,6 +4157,151 @@ fi
10744
10745 fi
10746
10747+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
10748+$as_echo_n "checking for ANSI C header files... " >&6; }
10749+if test "${ac_cv_header_stdc+set}" = set; then :
10750+ $as_echo_n "(cached) " >&6
10751+else
10752+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
10753+/* end confdefs.h. */
10754+#include <stdlib.h>
10755+#include <stdarg.h>
10756+#include <string.h>
10757+#include <float.h>
10758+
10759+int
10760+main ()
10761+{
10762+
10763+ ;
10764+ return 0;
10765+}
10766+_ACEOF
10767+if ac_fn_c_try_compile "$LINENO"; then :
10768+ ac_cv_header_stdc=yes
10769+else
10770+ ac_cv_header_stdc=no
10771+fi
10772+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
10773+
10774+if test $ac_cv_header_stdc = yes; then
10775+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
10776+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
10777+/* end confdefs.h. */
10778+#include <string.h>
10779+
10780+_ACEOF
10781+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
10782+ $EGREP "memchr" >/dev/null 2>&1; then :
10783+
10784+else
10785+ ac_cv_header_stdc=no
10786+fi
10787+rm -f conftest*
10788+
10789+fi
10790+
10791+if test $ac_cv_header_stdc = yes; then
10792+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
10793+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
10794+/* end confdefs.h. */
10795+#include <stdlib.h>
10796+
10797+_ACEOF
10798+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
10799+ $EGREP "free" >/dev/null 2>&1; then :
10800+
10801+else
10802+ ac_cv_header_stdc=no
10803+fi
10804+rm -f conftest*
10805+
10806+fi
10807+
10808+if test $ac_cv_header_stdc = yes; then
10809+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
10810+ if test "$cross_compiling" = yes; then :
10811+ :
10812+else
10813+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
10814+/* end confdefs.h. */
10815+#include <ctype.h>
10816+#include <stdlib.h>
10817+#if ((' ' & 0x0FF) == 0x020)
10818+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
10819+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
10820+#else
10821+# define ISLOWER(c) \
10822+ (('a' <= (c) && (c) <= 'i') \
10823+ || ('j' <= (c) && (c) <= 'r') \
10824+ || ('s' <= (c) && (c) <= 'z'))
10825+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
10826+#endif
10827+
10828+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
10829+int
10830+main ()
10831+{
10832+ int i;
10833+ for (i = 0; i < 256; i++)
10834+ if (XOR (islower (i), ISLOWER (i))
10835+ || toupper (i) != TOUPPER (i))
10836+ return 2;
10837+ return 0;
10838+}
10839+_ACEOF
10840+if ac_fn_c_try_run "$LINENO"; then :
10841+
10842+else
10843+ ac_cv_header_stdc=no
10844+fi
10845+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
10846+ conftest.$ac_objext conftest.beam conftest.$ac_ext
10847+fi
10848+
10849+fi
10850+fi
10851+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
10852+$as_echo "$ac_cv_header_stdc" >&6; }
10853+if test $ac_cv_header_stdc = yes; then
10854+
10855+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
10856+
10857+fi
10858+
10859+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
10860+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
10861+ inttypes.h stdint.h unistd.h
10862+do :
10863+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
10864+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
10865+"
10866+eval as_val=\$$as_ac_Header
10867+ if test "x$as_val" = x""yes; then :
10868+ cat >>confdefs.h <<_ACEOF
10869+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
10870+_ACEOF
10871+
10872+fi
10873+
10874+done
10875+
10876+
10877+for ac_header in sys/stropts.h sys/wait.h
10878+do :
10879+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
10880+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
10881+eval as_val=\$$as_ac_Header
10882+ if test "x$as_val" = x""yes; then :
10883+ cat >>confdefs.h <<_ACEOF
10884+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
10885+_ACEOF
10886+
10887+fi
10888+
10889+done
10890+
10891+
10892 ac_config_files="$ac_config_files Makefile"
10893
10894 cat >confcache <<\_ACEOF
10895Index: gdb-7.2.90.20110703/readline/examples/rlfe/configure.in
10896===================================================================
10897--- gdb-7.2.90.20110703.orig/readline/examples/rlfe/configure.in 2011-07-03 10:40:53.000000000 +0200
10898+++ gdb-7.2.90.20110703/readline/examples/rlfe/configure.in 2011-07-03 10:41:21.000000000 +0200
10899@@ -437,4 +437,6 @@ main()
10900
10901 fi
10902
10903+AC_CHECK_HEADERS(sys/stropts.h sys/wait.h)
10904+
10905 AC_OUTPUT(Makefile)
10906Index: gdb-7.2.90.20110703/readline/examples/rlfe/extern.h
10907===================================================================
10908--- gdb-7.2.90.20110703.orig/readline/examples/rlfe/extern.h 2011-07-03 10:40:53.000000000 +0200
10909+++ gdb-7.2.90.20110703/readline/examples/rlfe/extern.h 2011-07-03 10:41:21.000000000 +0200
10910@@ -27,7 +27,14 @@
10911 #define __attribute__(x)
10912 #endif
10913
10914+#if !defined (__P)
10915+# if defined (__STDC__) || defined (__GNUC__) || defined (__cplusplus)
10916+# define __P(protos) protos
10917+# else
10918+# define __P(protos) ()
10919+# endif
10920+#endif
10921+
10922 /* pty.c */
10923 extern int OpenPTY __P((char **));
10924 extern void InitPTY __P((int));
10925-
10926Index: gdb-7.2.90.20110703/readline/examples/rlfe/os.h
10927===================================================================
10928--- gdb-7.2.90.20110703.orig/readline/examples/rlfe/os.h 2011-07-03 10:40:53.000000000 +0200
10929+++ gdb-7.2.90.20110703/readline/examples/rlfe/os.h 2011-07-03 10:41:21.000000000 +0200
10930@@ -186,7 +186,7 @@ extern int errno;
10931 * terminal handling
10932 */
10933
10934-#ifdef POSIX
10935+#if defined (POSIX) || defined (__FreeBSD__)
10936 # include <termios.h>
10937 # ifdef hpux
10938 # include <bsdtty.h>
10939@@ -527,4 +527,3 @@ typedef struct fd_set { int fds_bits[1];
10940 * how many characters your pty's can buffer.
10941 */
10942 #define IOSIZE 4096
10943-
10944Index: gdb-7.2.90.20110703/readline/examples/rlfe/pty.c
10945===================================================================
10946--- gdb-7.2.90.20110703.orig/readline/examples/rlfe/pty.c 2011-07-03 10:40:53.000000000 +0200
10947+++ gdb-7.2.90.20110703/readline/examples/rlfe/pty.c 2011-07-03 10:41:21.000000000 +0200
10948@@ -20,13 +20,15 @@
10949 *
10950 ****************************************************************
10951 */
10952+#include "config.h"
10953
10954 #include <sys/types.h>
10955 #include <sys/stat.h>
10956 #include <fcntl.h>
10957 #include <signal.h>
10958
10959-#include "config.h"
10960+#include <unistd.h>
10961+
10962 #include "screen.h"
10963
10964 #ifndef sun
10965@@ -34,7 +36,7 @@
10966 #endif
10967
10968 /* for solaris 2.1, Unixware (SVR4.2) and possibly others */
10969-#ifdef HAVE_SVR4_PTYS
10970+#if defined (HAVE_SVR4_PTYS) && defined (HAVE_SYS_STROPTS_H)
10971 # include <sys/stropts.h>
10972 #endif
10973
10974@@ -384,4 +386,3 @@ char **ttyn;
10975 return -1;
10976 }
10977 #endif
10978-
10979Index: gdb-7.2.90.20110703/readline/examples/rlfe/rlfe.c
10980===================================================================
10981--- gdb-7.2.90.20110703.orig/readline/examples/rlfe/rlfe.c 2011-07-03 10:40:53.000000000 +0200
10982+++ gdb-7.2.90.20110703/readline/examples/rlfe/rlfe.c 2011-07-03 10:41:21.000000000 +0200
10983@@ -73,6 +73,11 @@
10984 #include <termios.h>
10985
10986 #include "config.h"
10987+#include "extern.h"
10988+
10989+#if defined (HAVE_SYS_WAIT_H)
10990+# include <sys/wait.h>
10991+#endif
10992
10993 #ifdef READLINE_LIBRARY
10994 # include "readline.h"
10995@@ -588,7 +593,7 @@ main(int argc, char** argv)
10996 }
10997 if (FD_ISSET (in_from_tty_fd, &in_set))
10998 {
10999- extern int readline_echoing_p;
11000+ extern int _rl_echoing_p;
11001 struct termios term_master;
11002 int do_canon = 1;
11003 int do_icrnl = 1;
11004@@ -605,9 +610,9 @@ main(int argc, char** argv)
11005 {
11006 do_canon = (term_master.c_lflag & ICANON) != 0;
11007 do_icrnl = (term_master.c_lflag & ICRNL) != 0;
11008- readline_echoing_p = (term_master.c_lflag & ECHO) != 0;
11009+ _rl_echoing_p = (term_master.c_lflag & ECHO) != 0;
11010 DPRINT1 ("echo,canon,crnl:%03d\n",
11011- 100 * readline_echoing_p
11012+ 100 * _rl_echoing_p
11013 + 10 * do_canon
11014 + 1 * do_icrnl);
11015 }
11016@@ -757,7 +762,7 @@ static void set_edit_mode ()
11017 vi = 1;
11018 break;
11019 }
11020- shellopts = index (shellopts + 1, ':');
11021+ shellopts = strchr (shellopts + 1, ':');
11022 }
11023
11024 if (!vi)
11025Index: gdb-7.2.90.20110703/readline/examples/rltest.c
11026===================================================================
11027--- gdb-7.2.90.20110703.orig/readline/examples/rltest.c 2011-07-03 10:40:53.000000000 +0200
11028+++ gdb-7.2.90.20110703/readline/examples/rltest.c 2011-07-03 10:41:21.000000000 +0200
11029@@ -4,25 +4,24 @@
11030 /* */
11031 /* **************************************************************** */
11032
11033-/* Copyright (C) 1987-2002 Free Software Foundation, Inc.
11034+/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
11035
11036- This file is part of the GNU Readline Library, a library for
11037+ This file is part of the GNU Readline Library (Readline), a library for
11038 reading lines of text with interactive input and history editing.
11039
11040- The GNU Readline Library is free software; you can redistribute it
11041- and/or modify it under the terms of the GNU General Public License
11042- as published by the Free Software Foundation; either version 2, or
11043+ Readline is free software: you can redistribute it and/or modify
11044+ it under the terms of the GNU General Public License as published by
11045+ the Free Software Foundation, either version 3 of the License, or
11046 (at your option) any later version.
11047
11048- The GNU Readline Library is distributed in the hope that it will be
11049- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
11050- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11051+ Readline is distributed in the hope that it will be useful,
11052+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11053+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11054 GNU General Public License for more details.
11055
11056- The GNU General Public License is often shipped with GNU software, and
11057- is generally kept in a file called COPYING or LICENSE. If you do not
11058- have a copy of the license, write to the Free Software Foundation,
11059- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
11060+ You should have received a copy of the GNU General Public License
11061+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
11062+*/
11063
11064 #if defined (HAVE_CONFIG_H)
11065 #include <config.h>
11066Index: gdb-7.2.90.20110703/readline/examples/rlversion.c
11067===================================================================
11068--- gdb-7.2.90.20110703.orig/readline/examples/rlversion.c 2011-07-03 10:40:53.000000000 +0200
11069+++ gdb-7.2.90.20110703/readline/examples/rlversion.c 2011-07-03 10:41:21.000000000 +0200
11070@@ -2,25 +2,24 @@
11071 * rlversion -- print out readline's version number
11072 */
11073
11074-/* Copyright (C) 1987-2002 Free Software Foundation, Inc.
11075+/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
11076
11077- This file is part of the GNU Readline Library, a library for
11078+ This file is part of the GNU Readline Library (Readline), a library for
11079 reading lines of text with interactive input and history editing.
11080
11081- The GNU Readline Library is free software; you can redistribute it
11082- and/or modify it under the terms of the GNU General Public License
11083- as published by the Free Software Foundation; either version 2, or
11084+ Readline is free software: you can redistribute it and/or modify
11085+ it under the terms of the GNU General Public License as published by
11086+ the Free Software Foundation, either version 3 of the License, or
11087 (at your option) any later version.
11088
11089- The GNU Readline Library is distributed in the hope that it will be
11090- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
11091- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11092+ Readline is distributed in the hope that it will be useful,
11093+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11094+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11095 GNU General Public License for more details.
11096
11097- The GNU General Public License is often shipped with GNU software, and
11098- is generally kept in a file called COPYING or LICENSE. If you do not
11099- have a copy of the license, write to the Free Software Foundation,
11100- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
11101+ You should have received a copy of the GNU General Public License
11102+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
11103+*/
11104
11105 #if defined (HAVE_CONFIG_H)
11106 # include <config.h>
11107Index: gdb-7.2.90.20110703/readline/funmap.c
11108===================================================================
11109--- gdb-7.2.90.20110703.orig/readline/funmap.c 2011-07-03 10:40:53.000000000 +0200
11110+++ gdb-7.2.90.20110703/readline/funmap.c 2011-07-03 10:41:21.000000000 +0200
11111@@ -1,24 +1,24 @@
11112 /* funmap.c -- attach names to functions. */
11113
11114-/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
11115+/* Copyright (C) 1987-2010 Free Software Foundation, Inc.
11116
11117- This file is part of the GNU Readline Library, a library for
11118- reading lines of text with interactive input and history editing.
11119+ This file is part of the GNU Readline Library (Readline), a library
11120+ for reading lines of text with interactive input and history editing.
11121
11122- The GNU Readline Library is free software; you can redistribute it
11123- and/or modify it under the terms of the GNU General Public License
11124- as published by the Free Software Foundation; either version 2, or
11125+ Readline is free software: you can redistribute it and/or modify
11126+ it under the terms of the GNU General Public License as published by
11127+ the Free Software Foundation, either version 3 of the License, or
11128 (at your option) any later version.
11129
11130- The GNU Readline Library is distributed in the hope that it will be
11131- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
11132- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11133+ Readline is distributed in the hope that it will be useful,
11134+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11135+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11136 GNU General Public License for more details.
11137
11138- The GNU General Public License is often shipped with GNU software, and
11139- is generally kept in a file called COPYING or LICENSE. If you do not
11140- have a copy of the license, write to the Free Software Foundation,
11141- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
11142+ You should have received a copy of the GNU General Public License
11143+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
11144+*/
11145+
11146 #define READLINE_LIBRARY
11147
11148 #if defined (HAVE_CONFIG_H)
11149@@ -56,7 +56,7 @@ static int funmap_entry;
11150 program specific function. */
11151 int funmap_program_specific_entry_start;
11152
11153-static FUNMAP default_funmap[] = {
11154+static const FUNMAP default_funmap[] = {
11155 { "abort", rl_abort },
11156 { "accept-line", rl_newline },
11157 { "arrow-key-prefix", rl_arrow_keys },
11158@@ -105,11 +105,13 @@ static FUNMAP default_funmap[] = {
11159 { "kill-region", rl_kill_region },
11160 { "kill-word", rl_kill_word },
11161 { "menu-complete", rl_menu_complete },
11162+ { "menu-complete-backward", rl_backward_menu_complete },
11163 { "next-history", rl_get_next_history },
11164 { "non-incremental-forward-search-history", rl_noninc_forward_search },
11165 { "non-incremental-reverse-search-history", rl_noninc_reverse_search },
11166 { "non-incremental-forward-search-history-again", rl_noninc_forward_search_again },
11167 { "non-incremental-reverse-search-history-again", rl_noninc_reverse_search_again },
11168+ { "old-menu-complete", rl_old_menu_complete },
11169 { "overwrite-mode", rl_overwrite_mode },
11170 #ifdef __CYGWIN__
11171 { "paste-from-clipboard", rl_paste_from_clipboard },
11172@@ -123,6 +125,7 @@ static FUNMAP default_funmap[] = {
11173 { "revert-line", rl_revert_line },
11174 { "self-insert", rl_insert },
11175 { "set-mark", rl_set_mark },
11176+ { "skip-csi-sequence", rl_skip_csi_sequence },
11177 { "start-kbd-macro", rl_start_kbd_macro },
11178 { "tab-insert", rl_tab_insert },
11179 { "tilde-expand", rl_tilde_expand },
11180@@ -145,6 +148,8 @@ static FUNMAP default_funmap[] = {
11181 { "vi-append-mode", rl_vi_append_mode },
11182 { "vi-arg-digit", rl_vi_arg_digit },
11183 { "vi-back-to-indent", rl_vi_back_to_indent },
11184+ { "vi-backward-bigword", rl_vi_bWord },
11185+ { "vi-backward-word", rl_vi_bword },
11186 { "vi-bWord", rl_vi_bWord },
11187 { "vi-bword", rl_vi_bword },
11188 { "vi-change-case", rl_vi_change_case },
11189@@ -157,12 +162,15 @@ static FUNMAP default_funmap[] = {
11190 { "vi-delete-to", rl_vi_delete_to },
11191 { "vi-eWord", rl_vi_eWord },
11192 { "vi-editing-mode", rl_vi_editing_mode },
11193+ { "vi-end-bigword", rl_vi_eWord },
11194 { "vi-end-word", rl_vi_end_word },
11195 { "vi-eof-maybe", rl_vi_eof_maybe },
11196 { "vi-eword", rl_vi_eword },
11197 { "vi-fWord", rl_vi_fWord },
11198 { "vi-fetch-history", rl_vi_fetch_history },
11199 { "vi-first-print", rl_vi_first_print },
11200+ { "vi-forward-bigword", rl_vi_fWord },
11201+ { "vi-forward-word", rl_vi_fword },
11202 { "vi-fword", rl_vi_fword },
11203 { "vi-goto-mark", rl_vi_goto_mark },
11204 { "vi-insert-beg", rl_vi_insert_beg },
11205Index: gdb-7.2.90.20110703/readline/histexpand.c
11206===================================================================
11207--- gdb-7.2.90.20110703.orig/readline/histexpand.c 2011-07-03 10:40:53.000000000 +0200
11208+++ gdb-7.2.90.20110703/readline/histexpand.c 2011-07-03 10:41:21.000000000 +0200
11209@@ -1,24 +1,23 @@
11210 /* histexpand.c -- history expansion. */
11211
11212-/* Copyright (C) 1989-2004 Free Software Foundation, Inc.
11213+/* Copyright (C) 1989-2010 Free Software Foundation, Inc.
11214
11215- This file contains the GNU History Library (the Library), a set of
11216+ This file contains the GNU History Library (History), a set of
11217 routines for managing the text of previously typed lines.
11218
11219- The Library is free software; you can redistribute it and/or modify
11220+ History is free software: you can redistribute it and/or modify
11221 it under the terms of the GNU General Public License as published by
11222- the Free Software Foundation; either version 2, or (at your option)
11223- any later version.
11224+ the Free Software Foundation, either version 3 of the License, or
11225+ (at your option) any later version.
11226
11227- The Library is distributed in the hope that it will be useful, but
11228- WITHOUT ANY WARRANTY; without even the implied warranty of
11229- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11230- General Public License for more details.
11231-
11232- The GNU General Public License is often shipped with GNU software, and
11233- is generally kept in a file called COPYING or LICENSE. If you do not
11234- have a copy of the license, write to the Free Software Foundation,
11235- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
11236+ History is distributed in the hope that it will be useful,
11237+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11238+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11239+ GNU General Public License for more details.
11240+
11241+ You should have received a copy of the GNU General Public License
11242+ along with History. If not, see <http://www.gnu.org/licenses/>.
11243+*/
11244
11245 #define READLINE_LIBRARY
11246
11247@@ -56,8 +55,6 @@
11248
11249 typedef int _hist_search_func_t PARAMS((const char *, int));
11250
11251-extern int rl_byte_oriented; /* declared in mbutil.c */
11252-
11253 static char error_pointer;
11254
11255 static char *subst_lhs;
11256@@ -66,9 +63,11 @@ static int subst_lhs_len;
11257 static int subst_rhs_len;
11258
11259 static char *get_history_word_specifier PARAMS((char *, char *, int *));
11260-static char *history_find_word PARAMS((char *, int));
11261 static int history_tokenize_word PARAMS((const char *, int));
11262+static char **history_tokenize_internal PARAMS((const char *, int, int *));
11263 static char *history_substring PARAMS((const char *, int, int));
11264+static void freewords PARAMS((char **, int));
11265+static char *history_find_word PARAMS((char *, int));
11266
11267 static char *quote_breaks PARAMS((char *));
11268
11269@@ -246,7 +245,7 @@ get_history_event (string, caller_index,
11270
11271 #define FAIL_SEARCH() \
11272 do { \
11273- history_offset = history_length; free (temp) ; return (char *)NULL; \
11274+ history_offset = history_length; xfree (temp) ; return (char *)NULL; \
11275 } while (0)
11276
11277 /* If there is no search string, try to use the previous search string,
11278@@ -255,7 +254,7 @@ get_history_event (string, caller_index,
11279 {
11280 if (search_string)
11281 {
11282- free (temp);
11283+ xfree (temp);
11284 temp = savestring (search_string);
11285 }
11286 else
11287@@ -286,7 +285,7 @@ get_history_event (string, caller_index,
11288 search_match = history_find_word (entry->line, local_index);
11289 }
11290 else
11291- free (temp);
11292+ xfree (temp);
11293
11294 return (entry->line);
11295 }
11296@@ -306,16 +305,20 @@ get_history_event (string, caller_index,
11297 /* Extract the contents of STRING as if it is enclosed in single quotes.
11298 SINDEX, when passed in, is the offset of the character immediately
11299 following the opening single quote; on exit, SINDEX is left pointing
11300- to the closing single quote. */
11301+ to the closing single quote. FLAGS currently used to allow backslash
11302+ to escape a single quote (e.g., for bash $'...'). */
11303 static void
11304-hist_string_extract_single_quoted (string, sindex)
11305+hist_string_extract_single_quoted (string, sindex, flags)
11306 char *string;
11307- int *sindex;
11308+ int *sindex, flags;
11309 {
11310 register int i;
11311
11312 for (i = *sindex; string[i] && string[i] != '\''; i++)
11313- ;
11314+ {
11315+ if ((flags & 1) && string[i] == '\\' && string[i+1])
11316+ i++;
11317+ }
11318
11319 *sindex = i;
11320 }
11321@@ -505,7 +508,7 @@ postproc_subst_rhs ()
11322 }
11323 }
11324 new[j] = '\0';
11325- free (subst_rhs);
11326+ xfree (subst_rhs);
11327 subst_rhs = new;
11328 subst_rhs_len = j;
11329 }
11330@@ -564,12 +567,12 @@ history_expand_internal (string, start,
11331 #if defined (HANDLE_MULTIBYTE)
11332 if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
11333 {
11334- int c, l;
11335+ int ch, l;
11336 l = _rl_find_prev_mbchar (string, i, MB_FIND_ANY);
11337- c = string[l];
11338+ ch = string[l];
11339 /* XXX - original patch had i - 1 ??? If i == 0 it would fail. */
11340- if (i && (c == '\'' || c == '"'))
11341- quoted_search_delimiter = c;
11342+ if (i && (ch == '\'' || ch == '"'))
11343+ quoted_search_delimiter = ch;
11344 }
11345 else
11346 #endif /* HANDLE_MULTIBYTE */
11347@@ -582,7 +585,7 @@ history_expand_internal (string, start,
11348 if (event == 0)
11349 {
11350 *ret_string = hist_error (string, start, i, EVENT_NOT_FOUND);
11351- free (result);
11352+ xfree (result);
11353 return (-1);
11354 }
11355
11356@@ -596,7 +599,7 @@ history_expand_internal (string, start,
11357 if (word_spec == (char *)&error_pointer)
11358 {
11359 *ret_string = hist_error (string, starting_index, i, BAD_WORD_SPEC);
11360- free (result);
11361+ xfree (result);
11362 return (-1);
11363 }
11364
11365@@ -629,8 +632,8 @@ history_expand_internal (string, start,
11366 {
11367 default:
11368 *ret_string = hist_error (string, i+1, i+2, BAD_MODIFIER);
11369- free (result);
11370- free (temp);
11371+ xfree (result);
11372+ xfree (temp);
11373 return -1;
11374
11375 case 'q':
11376@@ -655,7 +658,7 @@ history_expand_internal (string, start,
11377 {
11378 tstr++;
11379 t = savestring (tstr);
11380- free (temp);
11381+ xfree (temp);
11382 temp = t;
11383 }
11384 break;
11385@@ -680,7 +683,7 @@ history_expand_internal (string, start,
11386 if (tstr)
11387 {
11388 t = savestring (tstr);
11389- free (temp);
11390+ xfree (temp);
11391 temp = t;
11392 }
11393 break;
11394@@ -756,8 +759,8 @@ history_expand_internal (string, start,
11395 if (subst_lhs_len == 0)
11396 {
11397 *ret_string = hist_error (string, starting_index, i, NO_PREV_SUBST);
11398- free (result);
11399- free (temp);
11400+ xfree (result);
11401+ xfree (temp);
11402 return -1;
11403 }
11404
11405@@ -766,8 +769,8 @@ history_expand_internal (string, start,
11406 if (subst_lhs_len > l_temp)
11407 {
11408 *ret_string = hist_error (string, starting_index, i, SUBST_FAILED);
11409- free (result);
11410- free (temp);
11411+ xfree (result);
11412+ xfree (temp);
11413 return (-1);
11414 }
11415
11416@@ -808,7 +811,7 @@ history_expand_internal (string, start,
11417 temp + si + subst_lhs_len,
11418 l_temp - (si + subst_lhs_len));
11419 new_event[len] = '\0';
11420- free (temp);
11421+ xfree (temp);
11422 temp = new_event;
11423
11424 failed = 0;
11425@@ -844,8 +847,8 @@ history_expand_internal (string, start,
11426 continue; /* don't want to increment i */
11427
11428 *ret_string = hist_error (string, starting_index, i, SUBST_FAILED);
11429- free (result);
11430- free (temp);
11431+ xfree (result);
11432+ xfree (temp);
11433 return (-1);
11434 }
11435 }
11436@@ -866,7 +869,7 @@ history_expand_internal (string, start,
11437 else
11438 x = savestring (temp);
11439
11440- free (temp);
11441+ xfree (temp);
11442 temp = x;
11443 }
11444
11445@@ -874,7 +877,7 @@ history_expand_internal (string, start,
11446 if (n >= result_len)
11447 result = (char *)xrealloc (result, n + 2);
11448 strcpy (result, temp);
11449- free (temp);
11450+ xfree (temp);
11451
11452 *end_index_ptr = i;
11453 *ret_string = result;
11454@@ -925,7 +928,7 @@ history_expand (hstring, output)
11455 char **output;
11456 {
11457 register int j;
11458- int i, r, l, passc, cc, modified, eindex, only_printing, dquote;
11459+ int i, r, l, passc, cc, modified, eindex, only_printing, dquote, flag;
11460 char *string;
11461
11462 /* The output string, and its length. */
11463@@ -1017,7 +1020,7 @@ history_expand (hstring, output)
11464 }
11465 else if (string[i] == history_expansion_char)
11466 {
11467- if (!cc || member (cc, history_no_expand_chars))
11468+ if (cc == 0 || member (cc, history_no_expand_chars))
11469 continue;
11470 /* If the calling application has set
11471 history_inhibit_expansion_function to a function that checks
11472@@ -1045,8 +1048,9 @@ history_expand (hstring, output)
11473 else if (dquote == 0 && history_quotes_inhibit_expansion && string[i] == '\'')
11474 {
11475 /* If this is bash, single quotes inhibit history expansion. */
11476+ flag = (i > 0 && string[i - 1] == '$');
11477 i++;
11478- hist_string_extract_single_quoted (string, &i);
11479+ hist_string_extract_single_quoted (string, &i, flag);
11480 }
11481 else if (history_quotes_inhibit_expansion && string[i] == '\\')
11482 {
11483@@ -1060,7 +1064,7 @@ history_expand (hstring, output)
11484
11485 if (string[i] != history_expansion_char)
11486 {
11487- free (result);
11488+ xfree (result);
11489 *output = savestring (string);
11490 return (0);
11491 }
11492@@ -1097,7 +1101,7 @@ history_expand (hstring, output)
11493 if (strlen (mb) > 1)
11494 {
11495 ADD_STRING (mb);
11496- break;
11497+ continue;
11498 }
11499 }
11500 #endif /* HANDLE_MULTIBYTE */
11501@@ -1131,15 +1135,16 @@ history_expand (hstring, output)
11502 {
11503 int quote, slen;
11504
11505+ flag = (i > 0 && string[i - 1] == '$');
11506 quote = i++;
11507- hist_string_extract_single_quoted (string, &i);
11508+ hist_string_extract_single_quoted (string, &i, flag);
11509
11510 slen = i - quote + 2;
11511 temp = (char *)xmalloc (slen);
11512 strncpy (temp, string + quote, slen);
11513 temp[slen - 1] = '\0';
11514 ADD_STRING (temp);
11515- free (temp);
11516+ xfree (temp);
11517 }
11518 else
11519 ADD_CHAR (string[i]);
11520@@ -1152,7 +1157,7 @@ history_expand (hstring, output)
11521 temp = (char *)xmalloc (l - i + 1);
11522 strcpy (temp, string + i);
11523 ADD_STRING (temp);
11524- free (temp);
11525+ xfree (temp);
11526 i = l;
11527 }
11528 else
11529@@ -1165,7 +1170,8 @@ history_expand (hstring, output)
11530 /* If the history_expansion_char is followed by one of the
11531 characters in history_no_expand_chars, then it is not a
11532 candidate for expansion of any kind. */
11533- if (member (cc, history_no_expand_chars))
11534+ if (cc == 0 || member (cc, history_no_expand_chars) ||
11535+ (history_inhibit_expansion_function && (*history_inhibit_expansion_function) (string, i)))
11536 {
11537 ADD_CHAR (string[i]);
11538 break;
11539@@ -1184,7 +1190,7 @@ history_expand (hstring, output)
11540 temp = (char *)xmalloc (1 + strlen (result));
11541 strcpy (temp, result);
11542 ADD_STRING (temp);
11543- free (temp);
11544+ xfree (temp);
11545 }
11546 i++;
11547 break;
11548@@ -1195,9 +1201,9 @@ history_expand (hstring, output)
11549 if (r < 0)
11550 {
11551 *output = temp;
11552- free (result);
11553+ xfree (result);
11554 if (string != hstring)
11555- free (string);
11556+ xfree (string);
11557 return -1;
11558 }
11559 else
11560@@ -1207,7 +1213,7 @@ history_expand (hstring, output)
11561 modified++;
11562 if (*temp)
11563 ADD_STRING (temp);
11564- free (temp);
11565+ xfree (temp);
11566 }
11567 only_printing = r == 1;
11568 i = eindex;
11569@@ -1218,7 +1224,7 @@ history_expand (hstring, output)
11570
11571 *output = result;
11572 if (string != hstring)
11573- free (string);
11574+ xfree (string);
11575
11576 if (only_printing)
11577 {
11578@@ -1399,8 +1405,8 @@ history_arg_extract (first, last, string
11579 }
11580
11581 for (i = 0; i < len; i++)
11582- free (list[i]);
11583- free (list);
11584+ xfree (list[i]);
11585+ xfree (list);
11586
11587 return (result);
11588 }
11589@@ -1411,10 +1417,10 @@ history_tokenize_word (string, ind)
11590 int ind;
11591 {
11592 register int i;
11593- int delimiter;
11594+ int delimiter, nestdelim, delimopen;
11595
11596 i = ind;
11597- delimiter = 0;
11598+ delimiter = nestdelim = 0;
11599
11600 if (member (string[i], "()\n"))
11601 {
11602@@ -1430,20 +1436,34 @@ history_tokenize_word (string, ind)
11603 {
11604 if (peek == '<' && string[i + 2] == '-')
11605 i++;
11606+ else if (peek == '<' && string[i + 2] == '<')
11607+ i++;
11608 i += 2;
11609 return i;
11610 }
11611- else
11612+ else if ((peek == '&' && (string[i] == '>' || string[i] == '<')) ||
11613+ (peek == '>' && string[i] == '&'))
11614 {
11615- if ((peek == '&' && (string[i] == '>' || string[i] == '<')) ||
11616- (peek == '>' && string[i] == '&') ||
11617- (peek == '(' && (string[i] == '>' || string[i] == '<')) || /* ) */
11618- (peek == '(' && string[i] == '$')) /* ) */
11619- {
11620- i += 2;
11621- return i;
11622- }
11623+ i += 2;
11624+ return i;
11625+ }
11626+ /* XXX - separated out for later -- bash-4.2 */
11627+ else if ((peek == '(' && (string[i] == '>' || string[i] == '<')) || /* ) */
11628+ (peek == '(' && string[i] == '$')) /*)*/
11629+ {
11630+ i += 2;
11631+ delimopen = '(';
11632+ delimiter = ')';
11633+ nestdelim = 1;
11634+ goto get_word;
11635 }
11636+#if 0
11637+ else if (peek == '\'' && string[i] == '$')
11638+ {
11639+ i += 2; /* XXX */
11640+ return i;
11641+ }
11642+#endif
11643
11644 if (string[i] != '$')
11645 {
11646@@ -1452,9 +1472,25 @@ history_tokenize_word (string, ind)
11647 }
11648 }
11649
11650+ /* same code also used for $(...)/<(...)/>(...) above */
11651+ if (member (string[i], "!@?+*"))
11652+ {
11653+ int peek = string[i + 1];
11654+
11655+ if (peek == '(') /*)*/
11656+ {
11657+ /* Shell extended globbing patterns */
11658+ i += 2;
11659+ delimopen = '(';
11660+ delimiter = ')'; /* XXX - not perfect */
11661+ nestdelim = 1;
11662+ }
11663+ }
11664+
11665+get_word:
11666 /* Get word from string + i; */
11667
11668- if (member (string[i], HISTORY_QUOTE_CHARACTERS))
11669+ if (delimiter == 0 && member (string[i], HISTORY_QUOTE_CHARACTERS))
11670 delimiter = string[i++];
11671
11672 for (; string[i]; i++)
11673@@ -1472,16 +1508,31 @@ history_tokenize_word (string, ind)
11674 continue;
11675 }
11676
11677+ /* delimiter must be set and set to something other than a quote if
11678+ nestdelim is set, so these tests are safe. */
11679+ if (nestdelim && string[i] == delimopen)
11680+ {
11681+ nestdelim++;
11682+ continue;
11683+ }
11684+ if (nestdelim && string[i] == delimiter)
11685+ {
11686+ nestdelim--;
11687+ if (nestdelim == 0)
11688+ delimiter = 0;
11689+ continue;
11690+ }
11691+
11692 if (delimiter && string[i] == delimiter)
11693 {
11694 delimiter = 0;
11695 continue;
11696 }
11697
11698- if (!delimiter && (member (string[i], history_word_delimiters)))
11699+ if (delimiter == 0 && (member (string[i], history_word_delimiters)))
11700 break;
11701
11702- if (!delimiter && member (string[i], HISTORY_QUOTE_CHARACTERS))
11703+ if (delimiter == 0 && member (string[i], HISTORY_QUOTE_CHARACTERS))
11704 delimiter = string[i];
11705 }
11706
11707@@ -1569,6 +1620,18 @@ history_tokenize (string)
11708 return (history_tokenize_internal (string, -1, (int *)NULL));
11709 }
11710
11711+/* Free members of WORDS from START to an empty string */
11712+static void
11713+freewords (words, start)
11714+ char **words;
11715+ int start;
11716+{
11717+ register int i;
11718+
11719+ for (i = start; words[i]; i++)
11720+ xfree (words[i]);
11721+}
11722+
11723 /* Find and return the word which contains the character at index IND
11724 in the history line LINE. Used to save the word matched by the
11725 last history !?string? search. */
11726@@ -1582,12 +1645,16 @@ history_find_word (line, ind)
11727
11728 words = history_tokenize_internal (line, ind, &wind);
11729 if (wind == -1 || words == 0)
11730- return ((char *)NULL);
11731+ {
11732+ if (words)
11733+ freewords (words, 0);
11734+ FREE (words);
11735+ return ((char *)NULL);
11736+ }
11737 s = words[wind];
11738 for (i = 0; i < wind; i++)
11739- free (words[i]);
11740- for (i = wind + 1; words[i]; i++)
11741- free (words[i]);
11742- free (words);
11743+ xfree (words[i]);
11744+ freewords (words, wind + 1);
11745+ xfree (words);
11746 return s;
11747 }
11748Index: gdb-7.2.90.20110703/readline/histfile.c
11749===================================================================
11750--- gdb-7.2.90.20110703.orig/readline/histfile.c 2011-07-03 10:40:53.000000000 +0200
11751+++ gdb-7.2.90.20110703/readline/histfile.c 2011-07-03 10:41:21.000000000 +0200
11752@@ -1,24 +1,23 @@
11753 /* histfile.c - functions to manipulate the history file. */
11754
11755-/* Copyright (C) 1989-2003 Free Software Foundation, Inc.
11756+/* Copyright (C) 1989-2010 Free Software Foundation, Inc.
11757
11758- This file contains the GNU History Library (the Library), a set of
11759+ This file contains the GNU History Library (History), a set of
11760 routines for managing the text of previously typed lines.
11761
11762- The Library is free software; you can redistribute it and/or modify
11763+ History is free software: you can redistribute it and/or modify
11764 it under the terms of the GNU General Public License as published by
11765- the Free Software Foundation; either version 2, or (at your option)
11766- any later version.
11767+ the Free Software Foundation, either version 3 of the License, or
11768+ (at your option) any later version.
11769
11770- The Library is distributed in the hope that it will be useful, but
11771- WITHOUT ANY WARRANTY; without even the implied warranty of
11772- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11773- General Public License for more details.
11774-
11775- The GNU General Public License is often shipped with GNU software, and
11776- is generally kept in a file called COPYING or LICENSE. If you do not
11777- have a copy of the license, write to the Free Software Foundation,
11778- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
11779+ History is distributed in the hope that it will be useful,
11780+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11781+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11782+ GNU General Public License for more details.
11783+
11784+ You should have received a copy of the GNU General Public License
11785+ along with History. If not, see <http://www.gnu.org/licenses/>.
11786+*/
11787
11788 /* The goal is to make the implementation transparent, so that you
11789 don't have to know what data types are used, just what functions
11790@@ -53,7 +52,9 @@
11791 # include <unistd.h>
11792 #endif
11793
11794-#if defined (__EMX__) || defined (__CYGWIN__)
11795+#include <ctype.h>
11796+
11797+#if defined (__EMX__)
11798 # undef HAVE_MMAP
11799 #endif
11800
11801@@ -103,7 +104,7 @@ int history_write_timestamps = 0;
11802
11803 /* Does S look like the beginning of a history timestamp entry? Placeholder
11804 for more extensive tests. */
11805-#define HIST_TIMESTAMP_START(s) (*(s) == history_comment_char)
11806+#define HIST_TIMESTAMP_START(s) (*(s) == history_comment_char && isdigit ((s)[1]) )
11807
11808 /* Return the string that should be used in the place of this
11809 filename. This only matters when you don't specify the
11810@@ -125,8 +126,12 @@ history_filename (filename)
11811
11812 if (home == 0)
11813 {
11814+#if 0
11815 home = ".";
11816 home_len = 1;
11817+#else
11818+ return (NULL);
11819+#endif
11820 }
11821 else
11822 home_len = strlen (home);
11823@@ -178,7 +183,7 @@ read_history_range (filename, from, to)
11824
11825 buffer = last_ts = (char *)NULL;
11826 input = history_filename (filename);
11827- file = open (input, O_RDONLY|O_BINARY, 0666);
11828+ file = input ? open (input, O_RDONLY|O_BINARY, 0666) : -1;
11829
11830 if ((file < 0) || (fstat (file, &finfo) == -1))
11831 goto error_and_exit;
11832@@ -256,8 +261,9 @@ read_history_range (filename, from, to)
11833 for (line_end = line_start; line_end < bufend; line_end++)
11834 if (*line_end == '\n')
11835 {
11836- if (line_end - 1 >= line_start && *(line_end - 1) == '\r')
11837- *(line_end - 1) = '\0';
11838+ /* Change to allow Windows-like \r\n end of line delimiter. */
11839+ if (line_end > line_start && line_end[-1] == '\r')
11840+ line_end[-1] = '\0';
11841 else
11842 *line_end = '\0';
11843
11844@@ -312,7 +318,7 @@ history_truncate_file (fname, lines)
11845
11846 buffer = (char *)NULL;
11847 filename = history_filename (fname);
11848- file = open (filename, O_RDONLY|O_BINARY, 0666);
11849+ file = filename ? open (filename, O_RDONLY|O_BINARY, 0666) : -1;
11850 rv = 0;
11851
11852 /* Don't try to truncate non-regular files. */
11853@@ -411,7 +417,7 @@ history_truncate_file (fname, lines)
11854
11855 FREE (buffer);
11856
11857- free (filename);
11858+ xfree (filename);
11859 return rv;
11860 }
11861
11862@@ -434,9 +440,10 @@ history_do_write (filename, nelements, o
11863 mode = overwrite ? O_WRONLY|O_CREAT|O_TRUNC|O_BINARY : O_WRONLY|O_APPEND|O_BINARY;
11864 #endif
11865 output = history_filename (filename);
11866+ file = output ? open (output, mode, 0600) : -1;
11867 rv = 0;
11868
11869- if ((file = open (output, mode, 0600)) == -1)
11870+ if (file == -1)
11871 {
11872 FREE (output);
11873 return (errno);
11874@@ -513,7 +520,7 @@ mmap_error:
11875 #else
11876 if (write (file, buffer, buffer_size) < 0)
11877 rv = errno;
11878- free (buffer);
11879+ xfree (buffer);
11880 #endif
11881 }
11882
11883Index: gdb-7.2.90.20110703/readline/histlib.h
11884===================================================================
11885--- gdb-7.2.90.20110703.orig/readline/histlib.h 2011-07-03 10:40:53.000000000 +0200
11886+++ gdb-7.2.90.20110703/readline/histlib.h 2011-07-03 10:41:21.000000000 +0200
11887@@ -1,23 +1,23 @@
11888 /* histlib.h -- internal definitions for the history library. */
11889-/* Copyright (C) 1989, 1992 Free Software Foundation, Inc.
11890
11891- This file contains the GNU History Library (the Library), a set of
11892+/* Copyright (C) 1989-2009 Free Software Foundation, Inc.
11893+
11894+ This file contains the GNU History Library (History), a set of
11895 routines for managing the text of previously typed lines.
11896
11897- The Library is free software; you can redistribute it and/or modify
11898+ History is free software: you can redistribute it and/or modify
11899 it under the terms of the GNU General Public License as published by
11900- the Free Software Foundation; either version 2, or (at your option)
11901- any later version.
11902+ the Free Software Foundation, either version 3 of the License, or
11903+ (at your option) any later version.
11904
11905- The Library is distributed in the hope that it will be useful, but
11906- WITHOUT ANY WARRANTY; without even the implied warranty of
11907- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11908- General Public License for more details.
11909-
11910- The GNU General Public License is often shipped with GNU software, and
11911- is generally kept in a file called COPYING or LICENSE. If you do not
11912- have a copy of the license, write to the Free Software Foundation,
11913- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
11914+ History is distributed in the hope that it will be useful,
11915+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11916+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11917+ GNU General Public License for more details.
11918+
11919+ You should have received a copy of the GNU General Public License
11920+ along with History. If not, see <http://www.gnu.org/licenses/>.
11921+*/
11922
11923 #if !defined (_HISTLIB_H_)
11924 #define _HISTLIB_H_
11925Index: gdb-7.2.90.20110703/readline/history.c
11926===================================================================
11927--- gdb-7.2.90.20110703.orig/readline/history.c 2011-07-03 10:40:53.000000000 +0200
11928+++ gdb-7.2.90.20110703/readline/history.c 2011-07-03 10:41:21.000000000 +0200
11929@@ -1,24 +1,23 @@
11930 /* history.c -- standalone history library */
11931
11932-/* Copyright (C) 1989-2005 Free Software Foundation, Inc.
11933+/* Copyright (C) 1989-2009 Free Software Foundation, Inc.
11934
11935- This file contains the GNU History Library (the Library), a set of
11936+ This file contains the GNU History Library (History), a set of
11937 routines for managing the text of previously typed lines.
11938
11939- The Library is free software; you can redistribute it and/or modify
11940+ History is free software: you can redistribute it and/or modify
11941 it under the terms of the GNU General Public License as published by
11942- the Free Software Foundation; either version 2, or (at your option)
11943- any later version.
11944+ the Free Software Foundation, either version 3 of the License, or
11945+ (at your option) any later version.
11946
11947- The Library is distributed in the hope that it will be useful, but
11948- WITHOUT ANY WARRANTY; without even the implied warranty of
11949- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11950- General Public License for more details.
11951-
11952- The GNU General Public License is often shipped with GNU software, and
11953- is generally kept in a file called COPYING or LICENSE. If you do not
11954- have a copy of the license, write to the Free Software Foundation,
11955- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
11956+ History is distributed in the hope that it will be useful,
11957+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11958+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11959+ GNU General Public License for more details.
11960+
11961+ You should have received a copy of the GNU General Public License
11962+ along with History. If not, see <http://www.gnu.org/licenses/>.
11963+*/
11964
11965 /* The goal is to make the implementation transparent, so that you
11966 don't have to know what data types are used, just what functions
11967@@ -158,7 +157,7 @@ history_set_pos (pos)
11968 return (1);
11969 }
11970
11971-/* Return the current history array. The caller has to be carefull, since this
11972+/* Return the current history array. The caller has to be careful, since this
11973 is the actual array of data, and could be bashed or made corrupt easily.
11974 The array is terminated with a NULL pointer. */
11975 HIST_ENTRY **
11976@@ -209,6 +208,22 @@ history_get (offset)
11977 : the_history[local_index];
11978 }
11979
11980+HIST_ENTRY *
11981+alloc_history_entry (string, ts)
11982+ char *string;
11983+ char *ts;
11984+{
11985+ HIST_ENTRY *temp;
11986+
11987+ temp = (HIST_ENTRY *)xmalloc (sizeof (HIST_ENTRY));
11988+
11989+ temp->line = string ? savestring (string) : string;
11990+ temp->data = (char *)NULL;
11991+ temp->timestamp = ts;
11992+
11993+ return temp;
11994+}
11995+
11996 time_t
11997 history_get_time (hist)
11998 HIST_ENTRY *hist;
11999@@ -290,11 +305,7 @@ add_history (string)
12000 }
12001 }
12002
12003- temp = (HIST_ENTRY *)xmalloc (sizeof (HIST_ENTRY));
12004- temp->line = savestring (string);
12005- temp->data = (char *)NULL;
12006-
12007- temp->timestamp = hist_inittime ();
12008+ temp = alloc_history_entry (string, hist_inittime ());
12009
12010 the_history[history_length] = (HIST_ENTRY *)NULL;
12011 the_history[history_length - 1] = temp;
12012@@ -307,6 +318,8 @@ add_history_time (string)
12013 {
12014 HIST_ENTRY *hs;
12015
12016+ if (string == 0)
12017+ return;
12018 hs = the_history[history_length - 1];
12019 FREE (hs->timestamp);
12020 hs->timestamp = savestring (string);
12021@@ -325,9 +338,29 @@ free_history_entry (hist)
12022 FREE (hist->line);
12023 FREE (hist->timestamp);
12024 x = hist->data;
12025- free (hist);
12026+ xfree (hist);
12027 return (x);
12028 }
12029+
12030+HIST_ENTRY *
12031+copy_history_entry (hist)
12032+ HIST_ENTRY *hist;
12033+{
12034+ HIST_ENTRY *ret;
12035+ char *ts;
12036+
12037+ if (hist == 0)
12038+ return hist;
12039+
12040+ ret = alloc_history_entry (hist->line, (char *)NULL);
12041+
12042+ ts = hist->timestamp ? savestring (hist->timestamp) : hist->timestamp;
12043+ ret->timestamp = ts;
12044+
12045+ ret->data = hist->data;
12046+
12047+ return ret;
12048+}
12049
12050 /* Make the history entry at WHICH have LINE and DATA. This returns
12051 the old entry so you can dispose of the data. In the case of an
12052@@ -354,6 +387,51 @@ replace_history_entry (which, line, data
12053 return (old_value);
12054 }
12055
12056+/* Replace the DATA in the specified history entries, replacing OLD with
12057+ NEW. WHICH says which one(s) to replace: WHICH == -1 means to replace
12058+ all of the history entries where entry->data == OLD; WHICH == -2 means
12059+ to replace the `newest' history entry where entry->data == OLD; and
12060+ WHICH >= 0 means to replace that particular history entry's data, as
12061+ long as it matches OLD. */
12062+void
12063+replace_history_data (which,old, new)
12064+ int which;
12065+ histdata_t *old, *new;
12066+{
12067+ HIST_ENTRY *entry;
12068+ register int i, last;
12069+
12070+ if (which < -2 || which >= history_length || history_length == 0 || the_history == 0)
12071+ return;
12072+
12073+ if (which >= 0)
12074+ {
12075+ entry = the_history[which];
12076+ if (entry && entry->data == old)
12077+ entry->data = new;
12078+ return;
12079+ }
12080+
12081+ last = -1;
12082+ for (i = 0; i < history_length; i++)
12083+ {
12084+ entry = the_history[i];
12085+ if (entry == 0)
12086+ continue;
12087+ if (entry->data == old)
12088+ {
12089+ last = i;
12090+ if (which == -1)
12091+ entry->data = new;
12092+ }
12093+ }
12094+ if (which == -2 && last >= 0)
12095+ {
12096+ entry = the_history[last];
12097+ entry->data = new; /* XXX - we don't check entry->old */
12098+ }
12099+}
12100+
12101 /* Remove history element WHICH from the history. The removed
12102 element is returned to you so you can free the line, data,
12103 and containing structure. */
12104@@ -406,7 +484,7 @@ stifle_history (max)
12105
12106 /* Stop stifling the history. This returns the previous maximum
12107 number of history entries. The value is positive if the history
12108- was stifled, negative if it wasn't. */
12109+ was stifled, negative if it wasn't. */
12110 int
12111 unstifle_history ()
12112 {
12113Index: gdb-7.2.90.20110703/readline/history.h
12114===================================================================
12115--- gdb-7.2.90.20110703.orig/readline/history.h 2011-07-03 10:40:53.000000000 +0200
12116+++ gdb-7.2.90.20110703/readline/history.h 2011-07-03 10:41:21.000000000 +0200
12117@@ -1,23 +1,23 @@
12118 /* history.h -- the names of functions that you can call in history. */
12119-/* Copyright (C) 1989-2003 Free Software Foundation, Inc.
12120
12121- This file contains the GNU History Library (the Library), a set of
12122+/* Copyright (C) 1989-2009 Free Software Foundation, Inc.
12123+
12124+ This file contains the GNU History Library (History), a set of
12125 routines for managing the text of previously typed lines.
12126
12127- The Library is free software; you can redistribute it and/or modify
12128+ History is free software: you can redistribute it and/or modify
12129 it under the terms of the GNU General Public License as published by
12130- the Free Software Foundation; either version 2, or (at your option)
12131- any later version.
12132+ the Free Software Foundation, either version 3 of the License, or
12133+ (at your option) any later version.
12134
12135- The Library is distributed in the hope that it will be useful, but
12136- WITHOUT ANY WARRANTY; without even the implied warranty of
12137- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12138- General Public License for more details.
12139-
12140- The GNU General Public License is often shipped with GNU software, and
12141- is generally kept in a file called COPYING or LICENSE. If you do not
12142- have a copy of the license, write to the Free Software Foundation,
12143- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
12144+ History is distributed in the hope that it will be useful,
12145+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12146+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12147+ GNU General Public License for more details.
12148+
12149+ You should have received a copy of the GNU General Public License
12150+ along with History. If not, see <http://www.gnu.org/licenses/>.
12151+*/
12152
12153 #ifndef _HISTORY_H_
12154 #define _HISTORY_H_
12155Index: gdb-7.2.90.20110703/readline/histsearch.c
12156===================================================================
12157--- gdb-7.2.90.20110703.orig/readline/histsearch.c 2011-07-03 10:40:53.000000000 +0200
12158+++ gdb-7.2.90.20110703/readline/histsearch.c 2011-07-03 10:41:21.000000000 +0200
12159@@ -1,24 +1,23 @@
12160 /* histsearch.c -- searching the history list. */
12161
12162-/* Copyright (C) 1989, 1992 Free Software Foundation, Inc.
12163+/* Copyright (C) 1989, 1992-2009 Free Software Foundation, Inc.
12164
12165- This file contains the GNU History Library (the Library), a set of
12166+ This file contains the GNU History Library (History), a set of
12167 routines for managing the text of previously typed lines.
12168
12169- The Library is free software; you can redistribute it and/or modify
12170+ History is free software: you can redistribute it and/or modify
12171 it under the terms of the GNU General Public License as published by
12172- the Free Software Foundation; either version 2, or (at your option)
12173- any later version.
12174+ the Free Software Foundation, either version 3 of the License, or
12175+ (at your option) any later version.
12176
12177- The Library is distributed in the hope that it will be useful, but
12178- WITHOUT ANY WARRANTY; without even the implied warranty of
12179- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12180- General Public License for more details.
12181-
12182- The GNU General Public License is often shipped with GNU software, and
12183- is generally kept in a file called COPYING or LICENSE. If you do not
12184- have a copy of the license, write to the Free Software Foundation,
12185- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
12186+ History is distributed in the hope that it will be useful,
12187+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12188+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12189+ GNU General Public License for more details.
12190+
12191+ You should have received a copy of the GNU General Public License
12192+ along with History. If not, see <http://www.gnu.org/licenses/>.
12193+*/
12194
12195 #define READLINE_LIBRARY
12196
12197Index: gdb-7.2.90.20110703/readline/input.c
12198===================================================================
12199--- gdb-7.2.90.20110703.orig/readline/input.c 2011-07-03 10:40:53.000000000 +0200
12200+++ gdb-7.2.90.20110703/readline/input.c 2011-07-03 10:41:21.000000000 +0200
12201@@ -1,24 +1,24 @@
12202 /* input.c -- character input functions for readline. */
12203
12204-/* Copyright (C) 1994-2005 Free Software Foundation, Inc.
12205+/* Copyright (C) 1994-2010 Free Software Foundation, Inc.
12206
12207- This file is part of the GNU Readline Library, a library for
12208- reading lines of text with interactive input and history editing.
12209+ This file is part of the GNU Readline Library (Readline), a library
12210+ for reading lines of text with interactive input and history editing.
12211
12212- The GNU Readline Library is free software; you can redistribute it
12213- and/or modify it under the terms of the GNU General Public License
12214- as published by the Free Software Foundation; either version 2, or
12215+ Readline is free software: you can redistribute it and/or modify
12216+ it under the terms of the GNU General Public License as published by
12217+ the Free Software Foundation, either version 3 of the License, or
12218 (at your option) any later version.
12219
12220- The GNU Readline Library is distributed in the hope that it will be
12221- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
12222- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12223+ Readline is distributed in the hope that it will be useful,
12224+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12225+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12226 GNU General Public License for more details.
12227
12228- The GNU General Public License is often shipped with GNU software, and
12229- is generally kept in a file called COPYING or LICENSE. If you do not
12230- have a copy of the license, write to the Free Software Foundation,
12231- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
12232+ You should have received a copy of the GNU General Public License
12233+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
12234+*/
12235+
12236 #define READLINE_LIBRARY
12237
12238 #if defined (__TANDEM)
12239@@ -45,14 +45,7 @@
12240 # include "ansi_stdlib.h"
12241 #endif /* HAVE_STDLIB_H */
12242
12243-#if defined (HAVE_SELECT)
12244-# if !defined (HAVE_SYS_SELECT_H) || !defined (M_UNIX)
12245-# include <sys/time.h>
12246-# endif
12247-#endif /* HAVE_SELECT */
12248-#if defined (HAVE_SYS_SELECT_H)
12249-# include <sys/select.h>
12250-#endif
12251+#include "posixselect.h"
12252
12253 #if defined (FIONREAD_IN_SYS_IOCTL)
12254 # include <sys/ioctl.h>
12255@@ -133,8 +126,11 @@ rl_get_char (key)
12256 return (0);
12257
12258 *key = ibuffer[pop_index++];
12259-
12260+#if 0
12261 if (pop_index >= ibuffer_len)
12262+#else
12263+ if (pop_index > ibuffer_len)
12264+#endif
12265 pop_index = 0;
12266
12267 return (1);
12268@@ -151,7 +147,7 @@ _rl_unget_char (key)
12269 {
12270 pop_index--;
12271 if (pop_index < 0)
12272- pop_index = ibuffer_len - 1;
12273+ pop_index = ibuffer_len;
12274 ibuffer[pop_index] = key;
12275 return (1);
12276 }
12277@@ -179,6 +175,7 @@ rl_gather_tyi ()
12278 struct timeval timeout;
12279 #endif
12280
12281+ chars_avail = 0;
12282 tty = fileno (rl_instream);
12283
12284 #if defined (HAVE_SELECT)
12285@@ -186,8 +183,7 @@ rl_gather_tyi ()
12286 FD_ZERO (&exceptfds);
12287 FD_SET (tty, &readfds);
12288 FD_SET (tty, &exceptfds);
12289- timeout.tv_sec = 0;
12290- timeout.tv_usec = _keyboard_input_timeout;
12291+ USEC_TO_TIMEVAL (_keyboard_input_timeout, timeout);
12292 result = select (tty + 1, &readfds, (fd_set *)NULL, &exceptfds, &timeout);
12293 if (result <= 0)
12294 return 0; /* Nothing to read. */
12295@@ -221,13 +217,10 @@ rl_gather_tyi ()
12296 #endif /* O_NDELAY */
12297
12298 #if defined (__MINGW32__)
12299- /* We use getch to read console input, so use the same
12300- mechanism to check for more. Otherwise, we don't know. */
12301- if (isatty (fileno (rl_instream)))
12302- chars_avail = _kbhit ();
12303- else
12304- chars_avail = 0;
12305- result = 0;
12306+ /* Use getch/_kbhit to check for available console input, in the same way
12307+ that we read it normally. */
12308+ chars_avail = isatty (tty) ? _kbhit () : 0;
12309+ result = 0;
12310 #endif
12311
12312 /* If there's nothing available, don't waste time trying to read
12313@@ -251,8 +244,10 @@ rl_gather_tyi ()
12314 {
12315 while (chars_avail--)
12316 {
12317+ RL_CHECK_SIGNALS ();
12318 k = (*rl_getc_function) (rl_instream);
12319- rl_stuff_char (k);
12320+ if (rl_stuff_char (k) == 0)
12321+ break; /* some problem; no more room */
12322 if (k == NEWLINE || k == RETURN)
12323 break;
12324 }
12325@@ -273,7 +268,7 @@ rl_set_keyboard_input_timeout (u)
12326 int o;
12327
12328 o = _keyboard_input_timeout;
12329- if (u > 0)
12330+ if (u >= 0)
12331 _keyboard_input_timeout = u;
12332 return (o);
12333 }
12334@@ -316,10 +311,8 @@ _rl_input_available ()
12335 #endif
12336
12337 #if defined (__MINGW32__)
12338- /* We use getch to read console input, so use the same
12339- mechanism to check for more. Otherwise, we don't know. */
12340- if (isatty (fileno (rl_instream)))
12341- return _kbhit ();
12342+ if (isatty (tty))
12343+ return (_kbhit ());
12344 #endif
12345
12346 return 0;
12347@@ -358,7 +351,7 @@ _rl_insert_typein (c)
12348
12349 string[i] = '\0';
12350 rl_insert_text (string);
12351- free (string);
12352+ xfree (string);
12353 }
12354
12355 /* Add KEY to the buffer of characters to be read. Returns 1 if the
12356@@ -377,7 +370,11 @@ rl_stuff_char (key)
12357 RL_SETSTATE (RL_STATE_INPUTPENDING);
12358 }
12359 ibuffer[push_index++] = key;
12360+#if 0
12361 if (push_index >= ibuffer_len)
12362+#else
12363+ if (push_index > ibuffer_len)
12364+#endif
12365 push_index = 0;
12366
12367 return 1;
12368@@ -430,22 +427,26 @@ rl_read_key ()
12369 /* If the user has an event function, then call it periodically. */
12370 if (rl_event_hook)
12371 {
12372- while (rl_event_hook && rl_get_char (&c) == 0)
12373+ while (rl_event_hook)
12374 {
12375- (*rl_event_hook) ();
12376- if (rl_done) /* XXX - experimental */
12377- return ('\n');
12378 if (rl_gather_tyi () < 0) /* XXX - EIO */
12379 {
12380 rl_done = 1;
12381 return ('\n');
12382 }
12383+ RL_CHECK_SIGNALS ();
12384+ if (rl_get_char (&c) != 0)
12385+ break;
12386+ if (rl_done) /* XXX - experimental */
12387+ return ('\n');
12388+ (*rl_event_hook) ();
12389 }
12390 }
12391 else
12392 {
12393 if (rl_get_char (&c) == 0)
12394 c = (*rl_getc_function) (rl_instream);
12395+ RL_CHECK_SIGNALS ();
12396 }
12397 }
12398
12399@@ -461,6 +462,8 @@ rl_getc (stream)
12400
12401 while (1)
12402 {
12403+ RL_CHECK_SIGNALS ();
12404+
12405 #if defined (__MINGW32__)
12406 if (isatty (fileno (stream)))
12407 return (getch ());
12408@@ -506,7 +509,7 @@ rl_getc (stream)
12409 this is simply an interrupted system call to read ().
12410 Otherwise, some error ocurred, also signifying EOF. */
12411 if (errno != EINTR)
12412- return (EOF);
12413+ return (RL_ISSTATE (RL_STATE_READCMD) ? READERR : EOF);
12414 }
12415 }
12416
12417@@ -517,20 +520,26 @@ _rl_read_mbchar (mbchar, size)
12418 char *mbchar;
12419 int size;
12420 {
12421- int mb_len = 0;
12422+ int mb_len, c;
12423 size_t mbchar_bytes_length;
12424 wchar_t wc;
12425 mbstate_t ps, ps_back;
12426
12427 memset(&ps, 0, sizeof (mbstate_t));
12428 memset(&ps_back, 0, sizeof (mbstate_t));
12429-
12430+
12431+ mb_len = 0;
12432 while (mb_len < size)
12433 {
12434 RL_SETSTATE(RL_STATE_MOREINPUT);
12435- mbchar[mb_len++] = rl_read_key ();
12436+ c = rl_read_key ();
12437 RL_UNSETSTATE(RL_STATE_MOREINPUT);
12438
12439+ if (c < 0)
12440+ break;
12441+
12442+ mbchar[mb_len++] = c;
12443+
12444 mbchar_bytes_length = mbrtowc (&wc, mbchar, mb_len, &ps);
12445 if (mbchar_bytes_length == (size_t)(-1))
12446 break; /* invalid byte sequence for the current locale */
12447@@ -554,21 +563,21 @@ _rl_read_mbchar (mbchar, size)
12448 }
12449
12450 /* Read a multibyte-character string whose first character is FIRST into
12451- the buffer MB of length MBLEN. Returns the last character read, which
12452+ the buffer MB of length MLEN. Returns the last character read, which
12453 may be FIRST. Used by the search functions, among others. Very similar
12454 to _rl_read_mbchar. */
12455 int
12456-_rl_read_mbstring (first, mb, mblen)
12457+_rl_read_mbstring (first, mb, mlen)
12458 int first;
12459 char *mb;
12460- int mblen;
12461+ int mlen;
12462 {
12463 int i, c;
12464 mbstate_t ps;
12465
12466 c = first;
12467- memset (mb, 0, mblen);
12468- for (i = 0; i < mblen; i++)
12469+ memset (mb, 0, mlen);
12470+ for (i = 0; c >= 0 && i < mlen; i++)
12471 {
12472 mb[i] = (char)c;
12473 memset (&ps, 0, sizeof (mbstate_t));
12474Index: gdb-7.2.90.20110703/readline/isearch.c
12475===================================================================
12476--- gdb-7.2.90.20110703.orig/readline/isearch.c 2011-07-03 10:40:53.000000000 +0200
12477+++ gdb-7.2.90.20110703/readline/isearch.c 2011-07-03 10:41:21.000000000 +0200
12478@@ -1,29 +1,30 @@
12479+/* isearch.c - incremental searching */
12480+
12481 /* **************************************************************** */
12482 /* */
12483 /* I-Search and Searching */
12484 /* */
12485 /* **************************************************************** */
12486
12487-/* Copyright (C) 1987-2005 Free Software Foundation, Inc.
12488+/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
12489
12490- This file contains the Readline Library (the Library), a set of
12491- routines for providing Emacs style line input to programs that ask
12492- for it.
12493+ This file is part of the GNU Readline Library (Readline), a library
12494+ for reading lines of text with interactive input and history editing.
12495
12496- The Library is free software; you can redistribute it and/or modify
12497+ Readline is free software: you can redistribute it and/or modify
12498 it under the terms of the GNU General Public License as published by
12499- the Free Software Foundation; either version 2, or (at your option)
12500- any later version.
12501+ the Free Software Foundation, either version 3 of the License, or
12502+ (at your option) any later version.
12503+
12504+ Readline is distributed in the hope that it will be useful,
12505+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12506+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12507+ GNU General Public License for more details.
12508+
12509+ You should have received a copy of the GNU General Public License
12510+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
12511+*/
12512
12513- The Library is distributed in the hope that it will be useful, but
12514- WITHOUT ANY WARRANTY; without even the implied warranty of
12515- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12516- General Public License for more details.
12517-
12518- The GNU General Public License is often shipped with GNU software, and
12519- is generally kept in a file called COPYING or LICENSE. If you do not
12520- have a copy of the license, write to the Free Software Foundation,
12521- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
12522 #define READLINE_LIBRARY
12523
12524 #if defined (HAVE_CONFIG_H)
12525@@ -68,14 +69,14 @@ static void _rl_isearch_fini PARAMS((_rl
12526 static int _rl_isearch_cleanup PARAMS((_rl_search_cxt *, int));
12527
12528 /* Last line found by the current incremental search, so we don't `find'
12529- identical lines many times in a row. */
12530-static char *prev_line_found;
12531+ identical lines many times in a row. Now part of isearch context. */
12532+/* static char *prev_line_found; */
12533
12534 /* Last search string and its length. */
12535 static char *last_isearch_string;
12536 static int last_isearch_string_len;
12537
12538-static char *default_isearch_terminators = "\033\012";
12539+static char * const default_isearch_terminators = "\033\012";
12540
12541 _rl_search_cxt *
12542 _rl_scxt_alloc (type, flags)
12543@@ -103,6 +104,9 @@ _rl_scxt_alloc (type, flags)
12544
12545 cxt->save_undo_list = 0;
12546
12547+ cxt->keymap = _rl_keymap;
12548+ cxt->okeymap = _rl_keymap;
12549+
12550 cxt->history_pos = 0;
12551 cxt->direction = 0;
12552
12553@@ -125,7 +129,7 @@ _rl_scxt_dispose (cxt, flags)
12554 FREE (cxt->allocated_line);
12555 FREE (cxt->lines);
12556
12557- free (cxt);
12558+ xfree (cxt);
12559 }
12560
12561 /* Search backwards through the history looking for a string which is typed
12562@@ -192,7 +196,7 @@ rl_display_search (search_string, revers
12563 strcpy (message + msglen, "': ");
12564
12565 rl_message ("%s", message);
12566- free (message);
12567+ xfree (message);
12568 (*rl_redisplay_function) ();
12569 }
12570
12571@@ -327,11 +331,30 @@ _rl_isearch_dispatch (cxt, c)
12572 rl_command_func_t *f;
12573
12574 f = (rl_command_func_t *)NULL;
12575-
12576- /* Translate the keys we do something with to opcodes. */
12577- if (c >= 0 && _rl_keymap[c].type == ISFUNC)
12578+
12579+ if (c < 0)
12580 {
12581- f = _rl_keymap[c].function;
12582+ cxt->sflags |= SF_FAILED;
12583+ cxt->history_pos = cxt->last_found_line;
12584+ return -1;
12585+ }
12586+
12587+ /* If we are moving into a new keymap, modify cxt->keymap and go on.
12588+ This can be a problem if c == ESC and we want to terminate the
12589+ incremental search, so we check */
12590+ if (c >= 0 && cxt->keymap[c].type == ISKMAP && strchr (cxt->search_terminators, cxt->lastc) == 0)
12591+ {
12592+ cxt->keymap = FUNCTION_TO_KEYMAP (cxt->keymap, c);
12593+ cxt->sflags |= SF_CHGKMAP;
12594+ /* XXX - we should probably save this sequence, so we can do
12595+ something useful if this doesn't end up mapping to a command. */
12596+ return 1;
12597+ }
12598+
12599+ /* Translate the keys we do something with to opcodes. */
12600+ if (c >= 0 && cxt->keymap[c].type == ISFUNC)
12601+ {
12602+ f = cxt->keymap[c].function;
12603
12604 if (f == rl_reverse_search_history)
12605 cxt->lastc = (cxt->sflags & SF_REVERSE) ? -1 : -2;
12606@@ -339,19 +362,27 @@ _rl_isearch_dispatch (cxt, c)
12607 cxt->lastc = (cxt->sflags & SF_REVERSE) ? -2 : -1;
12608 else if (f == rl_rubout)
12609 cxt->lastc = -3;
12610- else if (c == CTRL ('G'))
12611+ else if (c == CTRL ('G') || f == rl_abort)
12612 cxt->lastc = -4;
12613- else if (c == CTRL ('W')) /* XXX */
12614+ else if (c == CTRL ('W') || f == rl_unix_word_rubout) /* XXX */
12615 cxt->lastc = -5;
12616- else if (c == CTRL ('Y')) /* XXX */
12617+ else if (c == CTRL ('Y') || f == rl_yank) /* XXX */
12618 cxt->lastc = -6;
12619 }
12620
12621+ /* If we changed the keymap earlier while translating a key sequence into
12622+ a command, restore it now that we've succeeded. */
12623+ if (cxt->sflags & SF_CHGKMAP)
12624+ {
12625+ cxt->keymap = cxt->okeymap;
12626+ cxt->sflags &= ~SF_CHGKMAP;
12627+ }
12628+
12629 /* The characters in isearch_terminators (set from the user-settable
12630 variable isearch-terminators) are used to terminate the search but
12631 not subsequently execute the character as a command. The default
12632 value is "\033\012" (ESC and C-J). */
12633- if (strchr (cxt->search_terminators, cxt->lastc))
12634+ if (cxt->lastc > 0 && strchr (cxt->search_terminators, cxt->lastc))
12635 {
12636 /* ESC still terminates the search, but if there is pending
12637 input or if input arrives within 0.1 seconds (on systems
12638@@ -375,7 +406,7 @@ _rl_isearch_dispatch (cxt, c)
12639 {
12640 if (cxt->lastc >= 0 && (cxt->mb[0] && cxt->mb[1] == '\0') && ENDSRCH_CHAR (cxt->lastc))
12641 {
12642- /* This sets rl_pending_input to c; it will be picked up the next
12643+ /* This sets rl_pending_input to LASTC; it will be picked up the next
12644 time rl_read_key is called. */
12645 rl_execute_next (cxt->lastc);
12646 return (0);
12647Index: gdb-7.2.90.20110703/readline/keymaps.c
12648===================================================================
12649--- gdb-7.2.90.20110703.orig/readline/keymaps.c 2011-07-03 10:40:53.000000000 +0200
12650+++ gdb-7.2.90.20110703/readline/keymaps.c 2011-07-03 10:41:21.000000000 +0200
12651@@ -1,23 +1,24 @@
12652 /* keymaps.c -- Functions and keymaps for the GNU Readline library. */
12653
12654-/* Copyright (C) 1988,1989 Free Software Foundation, Inc.
12655+/* Copyright (C) 1988,1989-2009 Free Software Foundation, Inc.
12656
12657- This file is part of GNU Readline, a library for reading lines
12658- of text with interactive input and history editing.
12659+ This file is part of the GNU Readline Library (Readline), a library
12660+ for reading lines of text with interactive input and history editing.
12661
12662- Readline is free software; you can redistribute it and/or modify it
12663- under the terms of the GNU General Public License as published by the
12664- Free Software Foundation; either version 2, or (at your option) any
12665- later version.
12666-
12667- Readline is distributed in the hope that it will be useful, but
12668- WITHOUT ANY WARRANTY; without even the implied warranty of
12669- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12670- General Public License for more details.
12671+ Readline is free software: you can redistribute it and/or modify
12672+ it under the terms of the GNU General Public License as published by
12673+ the Free Software Foundation, either version 3 of the License, or
12674+ (at your option) any later version.
12675+
12676+ Readline is distributed in the hope that it will be useful,
12677+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12678+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12679+ GNU General Public License for more details.
12680
12681 You should have received a copy of the GNU General Public License
12682- along with Readline; see the file COPYING. If not, write to the Free
12683- Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
12684+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
12685+*/
12686+
12687 #define READLINE_LIBRARY
12688
12689 #if defined (HAVE_CONFIG_H)
12690@@ -56,8 +57,9 @@ Keymap
12691 rl_make_bare_keymap ()
12692 {
12693 register int i;
12694- Keymap keymap = (Keymap)xmalloc (KEYMAP_SIZE * sizeof (KEYMAP_ENTRY));
12695+ Keymap keymap;
12696
12697+ keymap = (Keymap)xmalloc (KEYMAP_SIZE * sizeof (KEYMAP_ENTRY));
12698 for (i = 0; i < KEYMAP_SIZE; i++)
12699 {
12700 keymap[i].type = ISFUNC;
12701@@ -75,7 +77,8 @@ rl_make_bare_keymap ()
12702 return (keymap);
12703 }
12704
12705-/* Return a new keymap which is a copy of MAP. */
12706+/* Return a new keymap which is a copy of MAP. Just copies pointers, does
12707+ not copy text of macros or descend into child keymaps. */
12708 Keymap
12709 rl_copy_keymap (map)
12710 Keymap map;
12711@@ -127,7 +130,7 @@ rl_discard_keymap (map)
12712 {
12713 int i;
12714
12715- if (!map)
12716+ if (map == 0)
12717 return;
12718
12719 for (i = 0; i < KEYMAP_SIZE; i++)
12720@@ -139,11 +142,21 @@ rl_discard_keymap (map)
12721
12722 case ISKMAP:
12723 rl_discard_keymap ((Keymap)map[i].function);
12724+ xfree ((char *)map[i].function);
12725 break;
12726
12727 case ISMACR:
12728- free ((char *)map[i].function);
12729+ xfree ((char *)map[i].function);
12730 break;
12731 }
12732 }
12733 }
12734+
12735+/* Convenience function that discards, then frees, MAP. */
12736+void
12737+rl_free_keymap (map)
12738+ Keymap map;
12739+{
12740+ rl_discard_keymap (map);
12741+ xfree ((char *)map);
12742+}
12743Index: gdb-7.2.90.20110703/readline/keymaps.h
12744===================================================================
12745--- gdb-7.2.90.20110703.orig/readline/keymaps.h 2011-07-03 10:40:53.000000000 +0200
12746+++ gdb-7.2.90.20110703/readline/keymaps.h 2011-07-03 10:41:21.000000000 +0200
12747@@ -2,23 +2,22 @@
12748
12749 /* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
12750
12751- This file is part of the GNU Readline Library, a library for
12752- reading lines of text with interactive input and history editing.
12753+ This file is part of the GNU Readline Library (Readline), a library
12754+ for reading lines of text with interactive input and history editing.
12755
12756- The GNU Readline Library is free software; you can redistribute it
12757- and/or modify it under the terms of the GNU General Public License
12758- as published by the Free Software Foundation; either version 2, or
12759+ Readline is free software: you can redistribute it and/or modify
12760+ it under the terms of the GNU General Public License as published by
12761+ the Free Software Foundation, either version 3 of the License, or
12762 (at your option) any later version.
12763
12764- The GNU Readline Library is distributed in the hope that it will be
12765- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
12766- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12767+ Readline is distributed in the hope that it will be useful,
12768+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12769+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12770 GNU General Public License for more details.
12771
12772- The GNU General Public License is often shipped with GNU software, and
12773- is generally kept in a file called COPYING or LICENSE. If you do not
12774- have a copy of the license, write to the Free Software Foundation,
12775- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
12776+ You should have received a copy of the GNU General Public License
12777+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
12778+*/
12779
12780 #ifndef _KEYMAPS_H_
12781 #define _KEYMAPS_H_
12782@@ -53,11 +52,6 @@ typedef struct _keymap_entry {
12783 #define KEYMAP_SIZE 257
12784 #define ANYOTHERKEY KEYMAP_SIZE-1
12785
12786-/* I wanted to make the above structure contain a union of:
12787- union { rl_command_func_t *function; struct _keymap_entry *keymap; } value;
12788- but this made it impossible for me to create a static array.
12789- Maybe I need C lessons. */
12790-
12791 typedef KEYMAP_ENTRY KEYMAP_ENTRY_ARRAY[KEYMAP_SIZE];
12792 typedef KEYMAP_ENTRY *Keymap;
12793
12794Index: gdb-7.2.90.20110703/readline/kill.c
12795===================================================================
12796--- gdb-7.2.90.20110703.orig/readline/kill.c 2011-07-03 10:40:53.000000000 +0200
12797+++ gdb-7.2.90.20110703/readline/kill.c 2011-07-03 10:41:21.000000000 +0200
12798@@ -2,23 +2,23 @@
12799
12800 /* Copyright (C) 1994 Free Software Foundation, Inc.
12801
12802- This file is part of the GNU Readline Library, a library for
12803- reading lines of text with interactive input and history editing.
12804+ This file is part of the GNU Readline Library (Readline), a library
12805+ for reading lines of text with interactive input and history editing.
12806
12807- The GNU Readline Library is free software; you can redistribute it
12808- and/or modify it under the terms of the GNU General Public License
12809- as published by the Free Software Foundation; either version 2, or
12810+ Readline is free software: you can redistribute it and/or modify
12811+ it under the terms of the GNU General Public License as published by
12812+ the Free Software Foundation, either version 3 of the License, or
12813 (at your option) any later version.
12814
12815- The GNU Readline Library is distributed in the hope that it will be
12816- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
12817- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12818+ Readline is distributed in the hope that it will be useful,
12819+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12820+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12821 GNU General Public License for more details.
12822
12823- The GNU General Public License is often shipped with GNU software, and
12824- is generally kept in a file called COPYING or LICENSE. If you do not
12825- have a copy of the license, write to the Free Software Foundation,
12826- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
12827+ You should have received a copy of the GNU General Public License
12828+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
12829+*/
12830+
12831 #define READLINE_LIBRARY
12832
12833 #if defined (HAVE_CONFIG_H)
12834@@ -115,7 +115,7 @@ _rl_copy_to_kill_ring (text, append)
12835 if (slot == rl_max_kills)
12836 {
12837 register int i;
12838- free (rl_kill_ring[0]);
12839+ xfree (rl_kill_ring[0]);
12840 for (i = 0; i < slot; i++)
12841 rl_kill_ring[i] = rl_kill_ring[i + 1];
12842 }
12843@@ -146,8 +146,8 @@ _rl_copy_to_kill_ring (text, append)
12844 strcpy (new, text);
12845 strcat (new, old);
12846 }
12847- free (old);
12848- free (text);
12849+ xfree (old);
12850+ xfree (text);
12851 rl_kill_ring[slot] = new;
12852 }
12853 else
12854@@ -582,6 +582,7 @@ rl_yank_nth_arg_internal (count, ignore,
12855 if (!arg || !*arg)
12856 {
12857 rl_ding ();
12858+ FREE (arg);
12859 return -1;
12860 }
12861
12862@@ -600,7 +601,7 @@ rl_yank_nth_arg_internal (count, ignore,
12863 #endif /* VI_MODE */
12864
12865 rl_insert_text (arg);
12866- free (arg);
12867+ xfree (arg);
12868
12869 rl_end_undo_group ();
12870 return 0;
12871@@ -639,7 +640,7 @@ rl_yank_last_arg (count, key)
12872 {
12873 if (undo_needed)
12874 rl_do_undo ();
12875- if (count < 1)
12876+ if (count < 0) /* XXX - was < 1 */
12877 direction = -direction;
12878 history_skip += direction;
12879 if (history_skip < 0)
12880@@ -685,7 +686,7 @@ rl_paste_from_clipboard (count, key)
12881 _rl_set_mark_at_pos (rl_point);
12882 rl_insert_text (ptr);
12883 if (ptr != data)
12884- free (ptr);
12885+ xfree (ptr);
12886 CloseClipboard ();
12887 }
12888 return (0);
12889Index: gdb-7.2.90.20110703/readline/macro.c
12890===================================================================
12891--- gdb-7.2.90.20110703.orig/readline/macro.c 2011-07-03 10:40:53.000000000 +0200
12892+++ gdb-7.2.90.20110703/readline/macro.c 2011-07-03 10:41:21.000000000 +0200
12893@@ -1,24 +1,24 @@
12894 /* macro.c -- keyboard macros for readline. */
12895
12896-/* Copyright (C) 1994 Free Software Foundation, Inc.
12897+/* Copyright (C) 1994-2009 Free Software Foundation, Inc.
12898
12899- This file is part of the GNU Readline Library, a library for
12900- reading lines of text with interactive input and history editing.
12901+ This file is part of the GNU Readline Library (Readline), a library
12902+ for reading lines of text with interactive input and history editing.
12903
12904- The GNU Readline Library is free software; you can redistribute it
12905- and/or modify it under the terms of the GNU General Public License
12906- as published by the Free Software Foundation; either version 2, or
12907+ Readline is free software: you can redistribute it and/or modify
12908+ it under the terms of the GNU General Public License as published by
12909+ the Free Software Foundation, either version 3 of the License, or
12910 (at your option) any later version.
12911
12912- The GNU Readline Library is distributed in the hope that it will be
12913- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
12914- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12915+ Readline is distributed in the hope that it will be useful,
12916+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12917+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12918 GNU General Public License for more details.
12919
12920- The GNU General Public License is often shipped with GNU software, and
12921- is generally kept in a file called COPYING or LICENSE. If you do not
12922- have a copy of the license, write to the Free Software Foundation,
12923- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
12924+ You should have received a copy of the GNU General Public License
12925+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
12926+*/
12927+
12928 #define READLINE_LIBRARY
12929
12930 #if defined (HAVE_CONFIG_H)
12931@@ -113,7 +113,7 @@ _rl_next_macro_key ()
12932
12933 #if defined (READLINE_CALLBACKS)
12934 c = rl_executing_macro[executing_macro_index++];
12935- if (RL_ISSTATE (RL_STATE_CALLBACK) && RL_ISSTATE (RL_STATE_READCMD) && rl_executing_macro[executing_macro_index] == 0)
12936+ if (RL_ISSTATE (RL_STATE_CALLBACK) && RL_ISSTATE (RL_STATE_READCMD|RL_STATE_MOREINPUT) && rl_executing_macro[executing_macro_index] == 0)
12937 _rl_pop_executing_macro ();
12938 return c;
12939 #else
12940@@ -152,7 +152,7 @@ _rl_pop_executing_macro ()
12941 rl_executing_macro = macro_list->string;
12942 executing_macro_index = macro_list->sindex;
12943 macro_list = macro_list->next;
12944- free (macro);
12945+ xfree (macro);
12946 }
12947
12948 if (rl_executing_macro == 0)
12949@@ -181,7 +181,7 @@ _rl_kill_kbd_macro ()
12950 {
12951 if (current_macro)
12952 {
12953- free (current_macro);
12954+ xfree (current_macro);
12955 current_macro = (char *) NULL;
12956 }
12957 current_macro_size = current_macro_index = 0;
12958Index: gdb-7.2.90.20110703/readline/mbutil.c
12959===================================================================
12960--- gdb-7.2.90.20110703.orig/readline/mbutil.c 2011-07-03 10:40:53.000000000 +0200
12961+++ gdb-7.2.90.20110703/readline/mbutil.c 2011-07-03 10:41:21.000000000 +0200
12962@@ -1,24 +1,24 @@
12963 /* mbutil.c -- readline multibyte character utility functions */
12964
12965-/* Copyright (C) 2001-2005 Free Software Foundation, Inc.
12966+/* Copyright (C) 2001-2009 Free Software Foundation, Inc.
12967
12968- This file is part of the GNU Readline Library, a library for
12969- reading lines of text with interactive input and history editing.
12970+ This file is part of the GNU Readline Library (Readline), a library
12971+ for reading lines of text with interactive input and history editing.
12972
12973- The GNU Readline Library is free software; you can redistribute it
12974- and/or modify it under the terms of the GNU General Public License
12975- as published by the Free Software Foundation; either version 2, or
12976+ Readline is free software: you can redistribute it and/or modify
12977+ it under the terms of the GNU General Public License as published by
12978+ the Free Software Foundation, either version 3 of the License, or
12979 (at your option) any later version.
12980
12981- The GNU Readline Library is distributed in the hope that it will be
12982- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
12983- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12984+ Readline is distributed in the hope that it will be useful,
12985+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12986+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12987 GNU General Public License for more details.
12988
12989- The GNU General Public License is often shipped with GNU software, and
12990- is generally kept in a file called COPYING or LICENSE. If you do not
12991- have a copy of the license, write to the Free Software Foundation,
12992- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
12993+ You should have received a copy of the GNU General Public License
12994+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
12995+*/
12996+
12997 #define READLINE_LIBRARY
12998
12999 #if defined (HAVE_CONFIG_H)
13000@@ -77,7 +77,7 @@ _rl_find_next_mbchar_internal (string, s
13001 char *string;
13002 int seed, count, find_non_zero;
13003 {
13004- size_t tmp;
13005+ size_t tmp, len;
13006 mbstate_t ps;
13007 int point;
13008 wchar_t wc;
13009@@ -91,17 +91,21 @@ _rl_find_next_mbchar_internal (string, s
13010 return seed;
13011
13012 point = seed + _rl_adjust_point (string, seed, &ps);
13013- /* if this is true, means that seed was not pointed character
13014- started byte. So correct the point and consume count */
13015+ /* if this is true, means that seed was not pointing to a byte indicating
13016+ the beginning of a multibyte character. Correct the point and consume
13017+ one char. */
13018 if (seed < point)
13019 count--;
13020
13021 while (count > 0)
13022 {
13023- tmp = mbrtowc (&wc, string+point, strlen(string + point), &ps);
13024+ len = strlen (string + point);
13025+ if (len == 0)
13026+ break;
13027+ tmp = mbrtowc (&wc, string+point, len, &ps);
13028 if (MB_INVALIDCH ((size_t)tmp))
13029 {
13030- /* invalid bytes. asume a byte represents a character */
13031+ /* invalid bytes. assume a byte represents a character */
13032 point++;
13033 count--;
13034 /* reset states. */
13035@@ -128,12 +132,10 @@ _rl_find_next_mbchar_internal (string, s
13036 if (find_non_zero)
13037 {
13038 tmp = mbrtowc (&wc, string + point, strlen (string + point), &ps);
13039- while (tmp > 0 && wcwidth (wc) == 0)
13040+ while (MB_NULLWCH (tmp) == 0 && MB_INVALIDCH (tmp) == 0 && wcwidth (wc) == 0)
13041 {
13042 point += tmp;
13043 tmp = mbrtowc (&wc, string + point, strlen (string + point), &ps);
13044- if (MB_NULLWCH (tmp) || MB_INVALIDCH (tmp))
13045- break;
13046 }
13047 }
13048
13049Index: gdb-7.2.90.20110703/readline/misc.c
13050===================================================================
13051--- gdb-7.2.90.20110703.orig/readline/misc.c 2011-07-03 10:40:53.000000000 +0200
13052+++ gdb-7.2.90.20110703/readline/misc.c 2011-07-03 10:41:21.000000000 +0200
13053@@ -1,24 +1,24 @@
13054 /* misc.c -- miscellaneous bindable readline functions. */
13055
13056-/* Copyright (C) 1987-2005 Free Software Foundation, Inc.
13057+/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
13058
13059- This file is part of the GNU Readline Library, a library for
13060- reading lines of text with interactive input and history editing.
13061+ This file is part of the GNU Readline Library (Readline), a library
13062+ for reading lines of text with interactive input and history editing.
13063
13064- The GNU Readline Library is free software; you can redistribute it
13065- and/or modify it under the terms of the GNU General Public License
13066- as published by the Free Software Foundation; either version 2, or
13067+ Readline is free software: you can redistribute it and/or modify
13068+ it under the terms of the GNU General Public License as published by
13069+ the Free Software Foundation, either version 3 of the License, or
13070 (at your option) any later version.
13071
13072- The GNU Readline Library is distributed in the hope that it will be
13073- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
13074- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13075+ Readline is distributed in the hope that it will be useful,
13076+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13077+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13078 GNU General Public License for more details.
13079
13080- The GNU General Public License is often shipped with GNU software, and
13081- is generally kept in a file called COPYING or LICENSE. If you do not
13082- have a copy of the license, write to the Free Software Foundation,
13083- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
13084+ You should have received a copy of the GNU General Public License
13085+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
13086+*/
13087+
13088 #define READLINE_LIBRARY
13089
13090 #if defined (HAVE_CONFIG_H)
13091@@ -146,6 +146,8 @@ _rl_arg_dispatch (cxt, c)
13092 rl_restore_prompt ();
13093 rl_clear_message ();
13094 RL_UNSETSTATE(RL_STATE_NUMERICARG);
13095+ if (key < 0)
13096+ return -1;
13097 return (_rl_dispatch (key, _rl_keymap));
13098 }
13099 }
13100@@ -212,6 +214,8 @@ rl_digit_loop ()
13101 if (r <= 0 || (RL_ISSTATE (RL_STATE_NUMERICARG) == 0))
13102 break;
13103 }
13104+
13105+ return r;
13106 }
13107
13108 /* Create a default argument. */
13109@@ -324,7 +328,7 @@ _rl_free_history_entry (entry)
13110 FREE (entry->line);
13111 FREE (entry->timestamp);
13112
13113- free (entry);
13114+ xfree (entry);
13115 }
13116
13117 /* Perhaps put back the current line if it has changed. */
13118@@ -338,9 +342,9 @@ rl_maybe_replace_line ()
13119 if (temp && ((UNDO_LIST *)(temp->data) != rl_undo_list))
13120 {
13121 temp = replace_history_entry (where_history (), rl_line_buffer, (histdata_t)rl_undo_list);
13122- free (temp->line);
13123+ xfree (temp->line);
13124 FREE (temp->timestamp);
13125- free (temp);
13126+ xfree (temp);
13127 }
13128 return 0;
13129 }
13130@@ -427,6 +431,56 @@ rl_replace_from_history (entry, flags)
13131 rl_mark = rl_end;
13132 }
13133 #endif
13134+}
13135+
13136+/* Process and free undo lists attached to each history entry prior to the
13137+ current entry, inclusive, reverting each line to its saved state. This
13138+ is destructive, and state about the current line is lost. This is not
13139+ intended to be called while actively editing, and the current line is
13140+ not assumed to have been added to the history list. */
13141+void
13142+_rl_revert_all_lines ()
13143+{
13144+ int hpos;
13145+ HIST_ENTRY *entry;
13146+ UNDO_LIST *ul, *saved_undo_list;
13147+ char *lbuf;
13148+
13149+ lbuf = savestring (rl_line_buffer);
13150+ saved_undo_list = rl_undo_list;
13151+ hpos = where_history ();
13152+
13153+ entry = (hpos == history_length) ? previous_history () : current_history ();
13154+ while (entry)
13155+ {
13156+ if (ul = (UNDO_LIST *)entry->data)
13157+ {
13158+ if (ul == saved_undo_list)
13159+ saved_undo_list = 0;
13160+ /* Set up rl_line_buffer and other variables from history entry */
13161+ rl_replace_from_history (entry, 0); /* entry->line is now current */
13162+ /* Undo all changes to this history entry */
13163+ while (rl_undo_list)
13164+ rl_do_undo ();
13165+ /* And copy the reverted line back to the history entry, preserving
13166+ the timestamp. */
13167+ FREE (entry->line);
13168+ entry->line = savestring (rl_line_buffer);
13169+ entry->data = 0;
13170+ }
13171+ entry = previous_history ();
13172+ }
13173+
13174+ /* Restore history state */
13175+ rl_undo_list = saved_undo_list; /* may have been set to null */
13176+ history_set_pos (hpos);
13177+
13178+ /* reset the line buffer */
13179+ rl_replace_line (lbuf, 0);
13180+ _rl_set_the_line ();
13181+
13182+ /* and clean up */
13183+ xfree (lbuf);
13184 }
13185
13186 /* **************************************************************** */
13187@@ -556,7 +610,7 @@ rl_vi_editing_mode (count, key)
13188 #if defined (VI_MODE)
13189 _rl_set_insert_mode (RL_IM_INSERT, 1); /* vi mode ignores insert mode */
13190 rl_editing_mode = vi_mode;
13191- rl_vi_insertion_mode (1, key);
13192+ rl_vi_insert_mode (1, key);
13193 #endif /* VI_MODE */
13194
13195 return 0;
13196Index: gdb-7.2.90.20110703/readline/nls.c
13197===================================================================
13198--- gdb-7.2.90.20110703.orig/readline/nls.c 2011-07-03 10:40:53.000000000 +0200
13199+++ gdb-7.2.90.20110703/readline/nls.c 2011-07-03 10:41:21.000000000 +0200
13200@@ -1,24 +1,24 @@
13201 /* nls.c -- skeletal internationalization code. */
13202
13203-/* Copyright (C) 1996 Free Software Foundation, Inc.
13204+/* Copyright (C) 1996-2009 Free Software Foundation, Inc.
13205
13206- This file is part of the GNU Readline Library, a library for
13207- reading lines of text with interactive input and history editing.
13208+ This file is part of the GNU Readline Library (Readline), a library
13209+ for reading lines of text with interactive input and history editing.
13210
13211- The GNU Readline Library is free software; you can redistribute it
13212- and/or modify it under the terms of the GNU General Public License
13213- as published by the Free Software Foundation; either version 2, or
13214+ Readline is free software: you can redistribute it and/or modify
13215+ it under the terms of the GNU General Public License as published by
13216+ the Free Software Foundation, either version 3 of the License, or
13217 (at your option) any later version.
13218
13219- The GNU Readline Library is distributed in the hope that it will be
13220- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
13221- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13222+ Readline is distributed in the hope that it will be useful,
13223+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13224+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13225 GNU General Public License for more details.
13226
13227- The GNU General Public License is often shipped with GNU software, and
13228- is generally kept in a file called COPYING or LICENSE. If you do not
13229- have a copy of the license, write to the Free Software Foundation,
13230- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
13231+ You should have received a copy of the GNU General Public License
13232+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
13233+*/
13234+
13235 #define READLINE_LIBRARY
13236
13237 #if defined (HAVE_CONFIG_H)
13238@@ -145,7 +145,7 @@ _rl_init_eightbit ()
13239 _rl_output_meta_chars = 1;
13240 break;
13241 }
13242- free (t);
13243+ xfree (t);
13244 return (legal_lang_values[i] ? 1 : 0);
13245
13246 #endif /* !HAVE_SETLOCALE */
13247Index: gdb-7.2.90.20110703/readline/parens.c
13248===================================================================
13249--- gdb-7.2.90.20110703.orig/readline/parens.c 2011-07-03 10:40:53.000000000 +0200
13250+++ gdb-7.2.90.20110703/readline/parens.c 2011-07-03 10:41:21.000000000 +0200
13251@@ -1,24 +1,24 @@
13252-/* parens.c -- Implementation of matching parentheses feature. */
13253+/* parens.c -- implementation of matching parentheses feature. */
13254
13255-/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
13256+/* Copyright (C) 1987, 1989, 1992-2009 Free Software Foundation, Inc.
13257
13258- This file is part of the GNU Readline Library, a library for
13259- reading lines of text with interactive input and history editing.
13260+ This file is part of the GNU Readline Library (Readline), a library
13261+ for reading lines of text with interactive input and history editing.
13262
13263- The GNU Readline Library is free software; you can redistribute it
13264- and/or modify it under the terms of the GNU General Public License
13265- as published by the Free Software Foundation; either version 2, or
13266+ Readline is free software: you can redistribute it and/or modify
13267+ it under the terms of the GNU General Public License as published by
13268+ the Free Software Foundation, either version 3 of the License, or
13269 (at your option) any later version.
13270
13271- The GNU Readline Library is distributed in the hope that it will be
13272- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
13273- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13274+ Readline is distributed in the hope that it will be useful,
13275+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13276+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13277 GNU General Public License for more details.
13278
13279- The GNU General Public License is often shipped with GNU software, and
13280- is generally kept in a file called COPYING or LICENSE. If you do not
13281- have a copy of the license, write to the Free Software Foundation,
13282- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
13283+ You should have received a copy of the GNU General Public License
13284+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
13285+*/
13286+
13287 #define READLINE_LIBRARY
13288
13289 #if defined (__TANDEM)
13290@@ -38,16 +38,7 @@
13291 # include <unistd.h>
13292 #endif
13293
13294-#if defined (FD_SET) && !defined (HAVE_SELECT)
13295-# define HAVE_SELECT
13296-#endif
13297-
13298-#if defined (HAVE_SELECT)
13299-# include <sys/time.h>
13300-#endif /* HAVE_SELECT */
13301-#if defined (HAVE_SYS_SELECT_H)
13302-# include <sys/select.h>
13303-#endif
13304+#include "posixselect.h"
13305
13306 #if defined (HAVE_STRING_H)
13307 # include <string.h>
13308@@ -130,8 +121,7 @@ rl_insert_close (count, invoking_key)
13309
13310 FD_ZERO (&readfds);
13311 FD_SET (fileno (rl_instream), &readfds);
13312- timer.tv_sec = 0;
13313- timer.tv_usec = _paren_blink_usec;
13314+ USEC_TO_TIMEVAL (_paren_blink_usec, timer);
13315
13316 orig_point = rl_point;
13317 rl_point = match_point;
13318Index: gdb-7.2.90.20110703/readline/patchlevel
13319===================================================================
13320--- /dev/null 1970-01-01 00:00:00.000000000 +0000
13321+++ gdb-7.2.90.20110703/readline/patchlevel 2011-07-03 10:41:21.000000000 +0200
13322@@ -0,0 +1,3 @@
13323+# Do not edit -- exists only for use by patch
13324+
13325+1
13326Index: gdb-7.2.90.20110703/readline/posixdir.h
13327===================================================================
13328--- gdb-7.2.90.20110703.orig/readline/posixdir.h 2011-07-03 10:40:53.000000000 +0200
13329+++ gdb-7.2.90.20110703/readline/posixdir.h 2011-07-03 10:41:21.000000000 +0200
13330@@ -4,19 +4,19 @@
13331
13332 This file is part of GNU Bash, the Bourne Again SHell.
13333
13334- Bash is free software; you can redistribute it and/or modify it
13335- under the terms of the GNU General Public License as published by
13336- the Free Software Foundation; either version 2, or (at your option)
13337- any later version.
13338-
13339- Bash is distributed in the hope that it will be useful, but WITHOUT
13340- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13341- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13342- License for more details.
13343+ Bash is free software: you can redistribute it and/or modify
13344+ it under the terms of the GNU General Public License as published by
13345+ the Free Software Foundation, either version 3 of the License, or
13346+ (at your option) any later version.
13347+
13348+ Bash is distributed in the hope that it will be useful,
13349+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13350+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13351+ GNU General Public License for more details.
13352
13353 You should have received a copy of the GNU General Public License
13354- along with Bash; see the file COPYING. If not, write to the Free
13355- Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
13356+ along with Bash. If not, see <http://www.gnu.org/licenses/>.
13357+*/
13358
13359 /* This file should be included instead of <dirent.h> or <sys/dir.h>. */
13360
13361Index: gdb-7.2.90.20110703/readline/posixjmp.h
13362===================================================================
13363--- gdb-7.2.90.20110703.orig/readline/posixjmp.h 2011-07-03 10:40:53.000000000 +0200
13364+++ gdb-7.2.90.20110703/readline/posixjmp.h 2011-07-03 10:41:21.000000000 +0200
13365@@ -4,19 +4,19 @@
13366
13367 This file is part of GNU Bash, the Bourne Again SHell.
13368
13369- Bash is free software; you can redistribute it and/or modify it
13370- under the terms of the GNU General Public License as published by
13371- the Free Software Foundation; either version 2, or (at your option)
13372- any later version.
13373-
13374- Bash is distributed in the hope that it will be useful, but WITHOUT
13375- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13376- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13377- License for more details.
13378+ Bash is free software: you can redistribute it and/or modify
13379+ it under the terms of the GNU General Public License as published by
13380+ the Free Software Foundation, either version 3 of the License, or
13381+ (at your option) any later version.
13382+
13383+ Bash is distributed in the hope that it will be useful,
13384+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13385+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13386+ GNU General Public License for more details.
13387
13388 You should have received a copy of the GNU General Public License
13389- along with Bash; see the file COPYING. If not, write to the Free
13390- Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
13391+ along with Bash. If not, see <http://www.gnu.org/licenses/>.
13392+*/
13393
13394 #ifndef _POSIXJMP_H_
13395 #define _POSIXJMP_H_
13396Index: gdb-7.2.90.20110703/readline/posixselect.h
13397===================================================================
13398--- /dev/null 1970-01-01 00:00:00.000000000 +0000
13399+++ gdb-7.2.90.20110703/readline/posixselect.h 2011-07-03 10:41:21.000000000 +0200
13400@@ -0,0 +1,47 @@
13401+/* posixselect.h -- wrapper for select(2) includes and definitions */
13402+
13403+/* Copyright (C) 2009 Free Software Foundation, Inc.
13404+
13405+ This file is part of GNU Bash, the Bourne Again SHell.
13406+
13407+ Bash is free software: you can redistribute it and/or modify
13408+ it under the terms of the GNU General Public License as published by
13409+ the Free Software Foundation, either version 3 of the License, or
13410+ (at your option) any later version.
13411+
13412+ Bash is distributed in the hope that it will be useful,
13413+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13414+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13415+ GNU General Public License for more details.
13416+
13417+ You should have received a copy of the GNU General Public License
13418+ along with Bash. If not, see <http://www.gnu.org/licenses/>.
13419+*/
13420+
13421+#ifndef _POSIXSELECT_H_
13422+#define _POSIXSELECT_H_
13423+
13424+#if defined (FD_SET) && !defined (HAVE_SELECT)
13425+# define HAVE_SELECT 1
13426+#endif
13427+
13428+#if defined (HAVE_SELECT)
13429+# if !defined (HAVE_SYS_SELECT_H) || !defined (M_UNIX)
13430+# include <sys/time.h>
13431+# endif
13432+#endif /* HAVE_SELECT */
13433+#if defined (HAVE_SYS_SELECT_H)
13434+# include <sys/select.h>
13435+#endif
13436+
13437+#ifndef USEC_PER_SEC
13438+# define USEC_PER_SEC 1000000
13439+#endif
13440+
13441+#define USEC_TO_TIMEVAL(us, tv) \
13442+do { \
13443+ (tv).tv_sec = (us) / USEC_PER_SEC; \
13444+ (tv).tv_usec = (us) % USEC_PER_SEC; \
13445+} while (0)
13446+
13447+#endif /* _POSIXSELECT_H_ */
13448Index: gdb-7.2.90.20110703/readline/posixstat.h
13449===================================================================
13450--- gdb-7.2.90.20110703.orig/readline/posixstat.h 2011-07-03 10:40:53.000000000 +0200
13451+++ gdb-7.2.90.20110703/readline/posixstat.h 2011-07-03 10:41:21.000000000 +0200
13452@@ -5,19 +5,19 @@
13453
13454 This file is part of GNU Bash, the Bourne Again SHell.
13455
13456- Bash is free software; you can redistribute it and/or modify it
13457- under the terms of the GNU General Public License as published by
13458- the Free Software Foundation; either version 2, or (at your option)
13459- any later version.
13460-
13461- Bash is distributed in the hope that it will be useful, but WITHOUT
13462- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13463- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13464- License for more details.
13465+ Bash is free software: you can redistribute it and/or modify
13466+ it under the terms of the GNU General Public License as published by
13467+ the Free Software Foundation, either version 3 of the License, or
13468+ (at your option) any later version.
13469+
13470+ Bash is distributed in the hope that it will be useful,
13471+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13472+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13473+ GNU General Public License for more details.
13474
13475 You should have received a copy of the GNU General Public License
13476- along with Bash; see the file COPYING. If not, write to the Free
13477- Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
13478+ along with Bash. If not, see <http://www.gnu.org/licenses/>.
13479+*/
13480
13481 /* This file should be included instead of <sys/stat.h>.
13482 It relies on the local sys/stat.h to work though. */
13483Index: gdb-7.2.90.20110703/readline/readline.c
13484===================================================================
13485--- gdb-7.2.90.20110703.orig/readline/readline.c 2011-07-03 10:40:53.000000000 +0200
13486+++ gdb-7.2.90.20110703/readline/readline.c 2011-07-03 10:41:21.000000000 +0200
13487@@ -1,25 +1,25 @@
13488 /* readline.c -- a general facility for reading lines of input
13489 with emacs style editing and completion. */
13490
13491-/* Copyright (C) 1987-2005 Free Software Foundation, Inc.
13492+/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
13493
13494- This file is part of the GNU Readline Library, a library for
13495- reading lines of text with interactive input and history editing.
13496+ This file is part of the GNU Readline Library (Readline), a library
13497+ for reading lines of text with interactive input and history editing.
13498
13499- The GNU Readline Library is free software; you can redistribute it
13500- and/or modify it under the terms of the GNU General Public License
13501- as published by the Free Software Foundation; either version 2, or
13502+ Readline is free software: you can redistribute it and/or modify
13503+ it under the terms of the GNU General Public License as published by
13504+ the Free Software Foundation, either version 3 of the License, or
13505 (at your option) any later version.
13506
13507- The GNU Readline Library is distributed in the hope that it will be
13508- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
13509- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13510+ Readline is distributed in the hope that it will be useful,
13511+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13512+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13513 GNU General Public License for more details.
13514
13515- The GNU General Public License is often shipped with GNU software, and
13516- is generally kept in a file called COPYING or LICENSE. If you do not
13517- have a copy of the license, write to the Free Software Foundation,
13518- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
13519+ You should have received a copy of the GNU General Public License
13520+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
13521+*/
13522+
13523 #define READLINE_LIBRARY
13524
13525 #if defined (HAVE_CONFIG_H)
13526@@ -49,6 +49,11 @@
13527
13528 #include <stdio.h>
13529 #include "posixjmp.h"
13530+#include <errno.h>
13531+
13532+#if !defined (errno)
13533+extern int errno;
13534+#endif /* !errno */
13535
13536 /* System-specific feature definitions and include files. */
13537 #include "rldefs.h"
13538@@ -158,7 +163,7 @@ int rl_done;
13539 rl_command_func_t *rl_last_func = (rl_command_func_t *)NULL;
13540
13541 /* Top level environment for readline_internal (). */
13542-procenv_t readline_top_level;
13543+procenv_t _rl_top_level;
13544
13545 /* The streams we interact with. */
13546 FILE *_rl_in_stream, *_rl_out_stream;
13547@@ -171,7 +176,7 @@ FILE *rl_outstream = (FILE *)NULL;
13548 set to 1 if there is a controlling terminal, we can get its attributes,
13549 and the attributes include `echo'. Look at rltty.c:prepare_terminal_settings
13550 for the code that sets it. */
13551-int readline_echoing_p = 0;
13552+int _rl_echoing_p = 0;
13553
13554 /* Current prompt. */
13555 char *rl_prompt = (char *)NULL;
13556@@ -265,6 +270,15 @@ int _rl_output_meta_chars = 0;
13557 them to equivalent readline functions at startup. */
13558 int _rl_bind_stty_chars = 1;
13559
13560+/* Non-zero means to go through the history list at every newline (or
13561+ whenever rl_done is set and readline returns) and revert each line to
13562+ its initial state. */
13563+int _rl_revert_all_at_newline = 0;
13564+
13565+/* Non-zero means to honor the termios ECHOCTL bit and echo control
13566+ characters corresponding to keyboard-generated signals. */
13567+int _rl_echo_control_chars = 1;
13568+
13569 /* **************************************************************** */
13570 /* */
13571 /* Top Level Functions */
13572@@ -295,6 +309,9 @@ readline (prompt)
13573 const char *prompt;
13574 {
13575 char *value;
13576+#if 0
13577+ int in_callback;
13578+#endif
13579
13580 /* If we are at EOF return a NULL string. */
13581 if (rl_pending_input == EOF)
13582@@ -303,6 +320,15 @@ readline (prompt)
13583 return ((char *)NULL);
13584 }
13585
13586+#if 0
13587+ /* If readline() is called after installing a callback handler, temporarily
13588+ turn off the callback state to avoid ensuing messiness. Patch supplied
13589+ by the gdb folks. XXX -- disabled. This can be fooled and readline
13590+ left in a strange state by a poorly-timed longjmp. */
13591+ if (in_callback = RL_ISSTATE (RL_STATE_CALLBACK))
13592+ RL_UNSETSTATE (RL_STATE_CALLBACK);
13593+#endif
13594+
13595 rl_set_prompt (prompt);
13596
13597 rl_initialize ();
13598@@ -321,6 +347,11 @@ readline (prompt)
13599 rl_clear_signals ();
13600 #endif
13601
13602+#if 0
13603+ if (in_callback)
13604+ RL_SETSTATE (RL_STATE_CALLBACK);
13605+#endif
13606+
13607 return (value);
13608 }
13609
13610@@ -344,14 +375,14 @@ readline_internal_setup ()
13611 /* If we're not echoing, we still want to at least print a prompt, because
13612 rl_redisplay will not do it for us. If the calling application has a
13613 custom redisplay function, though, let that function handle it. */
13614- if (readline_echoing_p == 0 && rl_redisplay_function == rl_redisplay)
13615+ if (_rl_echoing_p == 0 && rl_redisplay_function == rl_redisplay)
13616 {
13617 if (rl_prompt && rl_already_prompted == 0)
13618 {
13619 nprompt = _rl_strip_prompt (rl_prompt);
13620 fprintf (_rl_out_stream, "%s", nprompt);
13621 fflush (_rl_out_stream);
13622- free (nprompt);
13623+ xfree (nprompt);
13624 }
13625 }
13626 else
13627@@ -365,11 +396,13 @@ readline_internal_setup ()
13628
13629 #if defined (VI_MODE)
13630 if (rl_editing_mode == vi_mode)
13631- rl_vi_insertion_mode (1, 'i');
13632+ rl_vi_insert_mode (1, 'i');
13633 #endif /* VI_MODE */
13634
13635 if (rl_pre_input_hook)
13636 (*rl_pre_input_hook) ();
13637+
13638+ RL_CHECK_SIGNALS ();
13639 }
13640
13641 STATIC_CALLBACK char *
13642@@ -379,6 +412,8 @@ readline_internal_teardown (eof)
13643 char *temp;
13644 HIST_ENTRY *entry;
13645
13646+ RL_CHECK_SIGNALS ();
13647+
13648 /* Restore the original of this history line, iff the line that we
13649 are editing was originally in the history, AND the line has changed. */
13650 entry = current_history ();
13651@@ -391,9 +426,12 @@ readline_internal_teardown (eof)
13652 _rl_free_history_entry (entry);
13653
13654 strcpy (the_line, temp);
13655- free (temp);
13656+ xfree (temp);
13657 }
13658
13659+ if (_rl_revert_all_at_newline)
13660+ _rl_revert_all_lines ();
13661+
13662 /* At any rate, it is highly likely that this line has an undo list. Get
13663 rid of it now. */
13664 if (rl_undo_list)
13665@@ -454,7 +492,7 @@ readline_internal_charloop ()
13666 #endif
13667 lk = _rl_last_command_was_kill;
13668
13669- code = setjmp (readline_top_level);
13670+ code = setjmp (_rl_top_level);
13671
13672 if (code)
13673 {
13674@@ -462,7 +500,7 @@ readline_internal_charloop ()
13675 _rl_want_redisplay = 0;
13676 /* If we get here, we're not being called from something dispatched
13677 from _rl_callback_read_char(), which sets up its own value of
13678- readline_top_level (saving and restoring the old, of course), so
13679+ _rl_top_level (saving and restoring the old, of course), so
13680 we can just return here. */
13681 if (RL_ISSTATE (RL_STATE_CALLBACK))
13682 return (0);
13683@@ -479,6 +517,20 @@ readline_internal_charloop ()
13684 c = rl_read_key ();
13685 RL_UNSETSTATE(RL_STATE_READCMD);
13686
13687+ /* look at input.c:rl_getc() for the circumstances under which this will
13688+ be returned; punt immediately on read error without converting it to
13689+ a newline. */
13690+ if (c == READERR)
13691+ {
13692+#if defined (READLINE_CALLBACKS)
13693+ RL_SETSTATE(RL_STATE_DONE);
13694+ return (rl_done = 1);
13695+#else
13696+ eof_found = 1;
13697+ break;
13698+#endif
13699+ }
13700+
13701 /* EOF typed to a non-blank line is a <NL>. */
13702 if (c == EOF && rl_end)
13703 c = NEWLINE;
13704@@ -498,6 +550,7 @@ readline_internal_charloop ()
13705
13706 lastc = c;
13707 _rl_dispatch ((unsigned char)c, _rl_keymap);
13708+ RL_CHECK_SIGNALS ();
13709
13710 /* If there was no change in _rl_last_command_was_kill, then no kill
13711 has taken place. Note that if input is pending we are reading
13712@@ -576,7 +629,7 @@ void
13713 _rl_keyseq_cxt_dispose (cxt)
13714 _rl_keyseq_cxt *cxt;
13715 {
13716- free (cxt);
13717+ xfree (cxt);
13718 }
13719
13720 void
13721@@ -618,7 +671,6 @@ _rl_dispatch_callback (cxt)
13722 int nkey, r;
13723
13724 /* For now */
13725-#if 1
13726 /* The first time this context is used, we want to read input and dispatch
13727 on it. When traversing the chain of contexts back `up', we want to use
13728 the value from the next context down. We're simulating recursion using
13729@@ -626,18 +678,22 @@ _rl_dispatch_callback (cxt)
13730 if ((cxt->flags & KSEQ_DISPATCHED) == 0)
13731 {
13732 nkey = _rl_subseq_getchar (cxt->okey);
13733+ if (nkey < 0)
13734+ {
13735+ _rl_abort_internal ();
13736+ return -1;
13737+ }
13738 r = _rl_dispatch_subseq (nkey, cxt->dmap, cxt->subseq_arg);
13739 cxt->flags |= KSEQ_DISPATCHED;
13740 }
13741 else
13742 r = cxt->childval;
13743-#else
13744- r = _rl_dispatch_subseq (nkey, cxt->dmap, cxt->subseq_arg);
13745-#endif
13746
13747 /* For now */
13748- r = _rl_subseq_result (r, cxt->oldmap, cxt->okey, (cxt->flags & KSEQ_SUBSEQ));
13749+ if (r != -3) /* don't do this if we indicate there will be other matches */
13750+ r = _rl_subseq_result (r, cxt->oldmap, cxt->okey, (cxt->flags & KSEQ_SUBSEQ));
13751
13752+ RL_CHECK_SIGNALS ();
13753 if (r == 0) /* success! */
13754 {
13755 _rl_keyseq_chain_dispose ();
13756@@ -724,6 +780,8 @@ _rl_dispatch_subseq (key, map, got_subse
13757 remember the last command executed in this variable. */
13758 if (rl_pending_input == 0 && map[key].function != rl_digit_argument)
13759 rl_last_func = map[key].function;
13760+
13761+ RL_CHECK_SIGNALS ();
13762 }
13763 else if (map[ANYOTHERKEY].function)
13764 {
13765@@ -778,7 +836,7 @@ _rl_dispatch_subseq (key, map, got_subse
13766 {
13767 /* Return 0 only the first time, to indicate success to
13768 _rl_callback_read_char. The rest of the time, we're called
13769- from _rl_dispatch_callback, so we return 3 to indicate
13770+ from _rl_dispatch_callback, so we return -3 to indicate
13771 special handling is necessary. */
13772 r = RL_ISSTATE (RL_STATE_MULTIKEY) ? -3 : 0;
13773 cxt = _rl_keyseq_cxt_alloc ();
13774@@ -842,7 +900,7 @@ _rl_subseq_result (r, map, key, got_subs
13775 Keymap m;
13776 int type, nt;
13777 rl_command_func_t *func, *nf;
13778-
13779+
13780 if (r == -2)
13781 /* We didn't match anything, and the keymap we're indexed into
13782 shadowed a function previously bound to that prefix. Call
13783@@ -1116,6 +1174,10 @@ bind_arrow_keys ()
13784
13785 #if defined (VI_MODE)
13786 bind_arrow_keys_internal (vi_movement_keymap);
13787+ /* Unbind vi_movement_keymap[ESC] to allow users to repeatedly hit ESC
13788+ in vi command mode while still allowing the arrow keys to work. */
13789+ if (vi_movement_keymap[ESC].type == ISKMAP)
13790+ rl_bind_keyseq_in_map ("\033", (rl_command_func_t *)NULL, vi_movement_keymap);
13791 bind_arrow_keys_internal (vi_insertion_keymap);
13792 #endif
13793 }
13794Index: gdb-7.2.90.20110703/readline/readline.h
13795===================================================================
13796--- gdb-7.2.90.20110703.orig/readline/readline.h 2011-07-03 10:40:53.000000000 +0200
13797+++ gdb-7.2.90.20110703/readline/readline.h 2011-07-03 10:41:21.000000000 +0200
13798@@ -1,24 +1,23 @@
13799 /* Readline.h -- the names of functions callable from within readline. */
13800
13801-/* Copyright (C) 1987-2005 Free Software Foundation, Inc.
13802+/* Copyright (C) 1987-2011 Free Software Foundation, Inc.
13803
13804- This file is part of the GNU Readline Library, a library for
13805- reading lines of text with interactive input and history editing.
13806+ This file is part of the GNU Readline Library (Readline), a library
13807+ for reading lines of text with interactive input and history editing.
13808
13809- The GNU Readline Library is free software; you can redistribute it
13810- and/or modify it under the terms of the GNU General Public License
13811- as published by the Free Software Foundation; either version 2, or
13812+ Readline is free software: you can redistribute it and/or modify
13813+ it under the terms of the GNU General Public License as published by
13814+ the Free Software Foundation, either version 3 of the License, or
13815 (at your option) any later version.
13816
13817- The GNU Readline Library is distributed in the hope that it will be
13818- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
13819- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13820+ Readline is distributed in the hope that it will be useful,
13821+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13822+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13823 GNU General Public License for more details.
13824
13825- The GNU General Public License is often shipped with GNU software, and
13826- is generally kept in a file called COPYING or LICENSE. If you do not
13827- have a copy of the license, write to the Free Software Foundation,
13828- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
13829+ You should have received a copy of the GNU General Public License
13830+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
13831+*/
13832
13833 #if !defined (_READLINE_H_)
13834 #define _READLINE_H_
13835@@ -40,9 +39,9 @@ extern "C" {
13836 #endif
13837
13838 /* Hex-encoded Readline version number. */
13839-#define RL_READLINE_VERSION 0x0501 /* Readline 5.1 */
13840-#define RL_VERSION_MAJOR 5
13841-#define RL_VERSION_MINOR 1
13842+#define RL_READLINE_VERSION 0x0602 /* Readline 6.2 */
13843+#define RL_VERSION_MAJOR 6
13844+#define RL_VERSION_MINOR 2
13845
13846 /* Readline data structures. */
13847
13848@@ -96,6 +95,7 @@ extern int rl_forward_word PARAMS((int,
13849 extern int rl_backward_word PARAMS((int, int));
13850 extern int rl_refresh_line PARAMS((int, int));
13851 extern int rl_clear_screen PARAMS((int, int));
13852+extern int rl_skip_csi_sequence PARAMS((int, int));
13853 extern int rl_arrow_keys PARAMS((int, int));
13854
13855 /* Bindable commands for inserting and deleting text. */
13856@@ -151,7 +151,9 @@ extern int rl_dump_variables PARAMS((int
13857 extern int rl_complete PARAMS((int, int));
13858 extern int rl_possible_completions PARAMS((int, int));
13859 extern int rl_insert_completions PARAMS((int, int));
13860+extern int rl_old_menu_complete PARAMS((int, int));
13861 extern int rl_menu_complete PARAMS((int, int));
13862+extern int rl_backward_menu_complete PARAMS((int, int));
13863
13864 /* Bindable commands for killing and yanking text, and managing the kill ring. */
13865 extern int rl_kill_word PARAMS((int, int));
13866@@ -233,6 +235,7 @@ extern int rl_vi_append_mode PARAMS((int
13867 extern int rl_vi_append_eol PARAMS((int, int));
13868 extern int rl_vi_eof_maybe PARAMS((int, int));
13869 extern int rl_vi_insertion_mode PARAMS((int, int));
13870+extern int rl_vi_insert_mode PARAMS((int, int));
13871 extern int rl_vi_movement_mode PARAMS((int, int));
13872 extern int rl_vi_arg_digit PARAMS((int, int));
13873 extern int rl_vi_change_case PARAMS((int, int));
13874@@ -420,6 +423,7 @@ extern int rl_set_keyboard_input_timeout
13875 extern void rl_extend_line_buffer PARAMS((int));
13876 extern int rl_ding PARAMS((void));
13877 extern int rl_alphabetic PARAMS((int));
13878+extern void rl_free PARAMS((void *));
13879
13880 /* Readline signal handling, from signals.c */
13881 extern int rl_set_signals PARAMS((void));
13882@@ -427,7 +431,9 @@ extern int rl_clear_signals PARAMS((void
13883 extern void rl_cleanup_after_signal PARAMS((void));
13884 extern void rl_reset_after_signal PARAMS((void));
13885 extern void rl_free_line_state PARAMS((void));
13886-
13887+
13888+extern void rl_echo_signal_char PARAMS((int));
13889+
13890 extern int rl_set_paren_blink_timeout PARAMS((int));
13891
13892 /* Undocumented. */
13893@@ -493,6 +499,10 @@ extern const char *rl_readline_name;
13894 readline (), and should not be assigned to directly. */
13895 extern char *rl_prompt;
13896
13897+/* The prompt string that is actually displayed by rl_redisplay. Public so
13898+ applications can more easily supply their own redisplay functions. */
13899+extern char *rl_display_prompt;
13900+
13901 /* The line buffer that is in use. */
13902 extern char *rl_line_buffer;
13903
13904@@ -599,6 +609,10 @@ extern int rl_catch_sigwinch;
13905 filename completer. */
13906 extern rl_compentry_func_t *rl_completion_entry_function;
13907
13908+/* Optional generator for menu completion. Default is
13909+ rl_completion_entry_function (rl_filename_completion_function). */
13910+ extern rl_compentry_func_t *rl_menu_completion_entry_function;
13911+
13912 /* If rl_ignore_some_completions_function is non-NULL it is the address
13913 of a function to call after all of the possible matches have been
13914 generated, but before the actual completion is done to the input line.
13915@@ -652,18 +666,37 @@ extern const char *rl_special_prefixes;
13916 completing on a directory name. The function is called with
13917 the address of a string (the current directory name) as an arg. It
13918 changes what is displayed when the possible completions are printed
13919- or inserted. */
13920+ or inserted. The directory completion hook should perform
13921+ any necessary dequoting. This function should return 1 if it modifies
13922+ the directory name pointer passed as an argument. If the directory
13923+ completion hook returns 0, it should not modify the directory name
13924+ pointer passed as an argument. */
13925 extern rl_icppfunc_t *rl_directory_completion_hook;
13926
13927 /* If non-zero, this is the address of a function to call when completing
13928 a directory name. This function takes the address of the directory name
13929 to be modified as an argument. Unlike rl_directory_completion_hook, it
13930 only modifies the directory name used in opendir(2), not what is displayed
13931- when the possible completions are printed or inserted. It is called
13932- before rl_directory_completion_hook. I'm not happy with how this works
13933- yet, so it's undocumented. */
13934+ when the possible completions are printed or inserted. If set, it takes
13935+ precedence over rl_directory_completion_hook. The directory rewrite
13936+ hook should perform any necessary dequoting. This function has the same
13937+ return value properties as the directory_completion_hook.
13938+
13939+ I'm not happy with how this works yet, so it's undocumented. I'm trying
13940+ it in bash to see how well it goes. */
13941 extern rl_icppfunc_t *rl_directory_rewrite_hook;
13942
13943+/* If non-zero, this is the address of a function to call when reading
13944+ directory entries from the filesystem for completion and comparing
13945+ them to the partial word to be completed. The function should
13946+ either return its first argument (if no conversion takes place) or
13947+ newly-allocated memory. This can, for instance, convert filenames
13948+ between character sets for comparison against what's typed at the
13949+ keyboard. The returned value is what is added to the list of
13950+ matches. The second argument is the length of the filename to be
13951+ converted. */
13952+extern rl_dequote_func_t *rl_filename_rewrite_hook;
13953+
13954 /* Backwards compatibility with previous versions of readline. */
13955 #define rl_symbolic_link_hook rl_directory_completion_hook
13956
13957@@ -713,6 +746,9 @@ extern int rl_attempted_completion_over;
13958 functions. */
13959 extern int rl_completion_type;
13960
13961+/* Set to the last key used to invoke one of the completion functions */
13962+extern int rl_completion_invoking_key;
13963+
13964 /* Up to this many items will be displayed in response to a
13965 possible-completions call. After that, we ask the user if she
13966 is sure she wants to see them all. The default value is 100. */
13967@@ -739,6 +775,9 @@ extern int rl_completion_found_quote;
13968 application-specific completion function. */
13969 extern int rl_completion_suppress_quote;
13970
13971+/* If non-zero, readline will sort the completion matches. On by default. */
13972+extern int rl_sort_completion_matches;
13973+
13974 /* If non-zero, a slash will be appended to completed filenames that are
13975 symbolic links to directory names, subject to the value of the
13976 mark-directories variable (which is user-settable). This exists so
13977@@ -757,6 +796,10 @@ extern int rl_ignore_completion_duplicat
13978 completion character will be inserted as any other. */
13979 extern int rl_inhibit_completion;
13980
13981+/* Input error; can be returned by (*rl_getc_function) if readline is reading
13982+ a top-level command (RL_ISSTATE (RL_STATE_READCMD)). */
13983+#define READERR (-2)
13984+
13985 /* Definitions available for use by readline clients. */
13986 #define RL_PROMPT_START_IGNORE '\001'
13987 #define RL_PROMPT_END_IGNORE '\002'
13988@@ -770,31 +813,32 @@ extern int rl_inhibit_completion;
13989 /* Possible state values for rl_readline_state */
13990 #define RL_STATE_NONE 0x000000 /* no state; before first call */
13991
13992-#define RL_STATE_INITIALIZING 0x000001 /* initializing */
13993-#define RL_STATE_INITIALIZED 0x000002 /* initialization done */
13994-#define RL_STATE_TERMPREPPED 0x000004 /* terminal is prepped */
13995-#define RL_STATE_READCMD 0x000008 /* reading a command key */
13996-#define RL_STATE_METANEXT 0x000010 /* reading input after ESC */
13997-#define RL_STATE_DISPATCHING 0x000020 /* dispatching to a command */
13998-#define RL_STATE_MOREINPUT 0x000040 /* reading more input in a command function */
13999-#define RL_STATE_ISEARCH 0x000080 /* doing incremental search */
14000-#define RL_STATE_NSEARCH 0x000100 /* doing non-inc search */
14001-#define RL_STATE_SEARCH 0x000200 /* doing a history search */
14002-#define RL_STATE_NUMERICARG 0x000400 /* reading numeric argument */
14003-#define RL_STATE_MACROINPUT 0x000800 /* getting input from a macro */
14004-#define RL_STATE_MACRODEF 0x001000 /* defining keyboard macro */
14005-#define RL_STATE_OVERWRITE 0x002000 /* overwrite mode */
14006-#define RL_STATE_COMPLETING 0x004000 /* doing completion */
14007-#define RL_STATE_SIGHANDLER 0x008000 /* in readline sighandler */
14008-#define RL_STATE_UNDOING 0x010000 /* doing an undo */
14009-#define RL_STATE_INPUTPENDING 0x020000 /* rl_execute_next called */
14010-#define RL_STATE_TTYCSAVED 0x040000 /* tty special chars saved */
14011-#define RL_STATE_CALLBACK 0x080000 /* using the callback interface */
14012-#define RL_STATE_VIMOTION 0x100000 /* reading vi motion arg */
14013-#define RL_STATE_MULTIKEY 0x200000 /* reading multiple-key command */
14014-#define RL_STATE_VICMDONCE 0x400000 /* entered vi command mode at least once */
14015+#define RL_STATE_INITIALIZING 0x0000001 /* initializing */
14016+#define RL_STATE_INITIALIZED 0x0000002 /* initialization done */
14017+#define RL_STATE_TERMPREPPED 0x0000004 /* terminal is prepped */
14018+#define RL_STATE_READCMD 0x0000008 /* reading a command key */
14019+#define RL_STATE_METANEXT 0x0000010 /* reading input after ESC */
14020+#define RL_STATE_DISPATCHING 0x0000020 /* dispatching to a command */
14021+#define RL_STATE_MOREINPUT 0x0000040 /* reading more input in a command function */
14022+#define RL_STATE_ISEARCH 0x0000080 /* doing incremental search */
14023+#define RL_STATE_NSEARCH 0x0000100 /* doing non-inc search */
14024+#define RL_STATE_SEARCH 0x0000200 /* doing a history search */
14025+#define RL_STATE_NUMERICARG 0x0000400 /* reading numeric argument */
14026+#define RL_STATE_MACROINPUT 0x0000800 /* getting input from a macro */
14027+#define RL_STATE_MACRODEF 0x0001000 /* defining keyboard macro */
14028+#define RL_STATE_OVERWRITE 0x0002000 /* overwrite mode */
14029+#define RL_STATE_COMPLETING 0x0004000 /* doing completion */
14030+#define RL_STATE_SIGHANDLER 0x0008000 /* in readline sighandler */
14031+#define RL_STATE_UNDOING 0x0010000 /* doing an undo */
14032+#define RL_STATE_INPUTPENDING 0x0020000 /* rl_execute_next called */
14033+#define RL_STATE_TTYCSAVED 0x0040000 /* tty special chars saved */
14034+#define RL_STATE_CALLBACK 0x0080000 /* using the callback interface */
14035+#define RL_STATE_VIMOTION 0x0100000 /* reading vi motion arg */
14036+#define RL_STATE_MULTIKEY 0x0200000 /* reading multiple-key command */
14037+#define RL_STATE_VICMDONCE 0x0400000 /* entered vi command mode at least once */
14038+#define RL_STATE_REDISPLAYING 0x0800000 /* updating terminal display */
14039
14040-#define RL_STATE_DONE 0x800000 /* done; accepted line */
14041+#define RL_STATE_DONE 0x1000000 /* done; accepted line */
14042
14043 #define RL_SETSTATE(x) (rl_readline_state |= (x))
14044 #define RL_UNSETSTATE(x) (rl_readline_state &= ~(x))
14045Index: gdb-7.2.90.20110703/readline/rlconf.h
14046===================================================================
14047--- gdb-7.2.90.20110703.orig/readline/rlconf.h 2011-07-03 10:40:53.000000000 +0200
14048+++ gdb-7.2.90.20110703/readline/rlconf.h 2011-07-03 10:41:21.000000000 +0200
14049@@ -1,25 +1,23 @@
14050 /* rlconf.h -- readline configuration definitions */
14051
14052-/* Copyright (C) 1994 Free Software Foundation, Inc.
14053+/* Copyright (C) 1992-2009 Free Software Foundation, Inc.
14054
14055- This file contains the Readline Library (the Library), a set of
14056- routines for providing Emacs style line input to programs that ask
14057- for it.
14058+ This file is part of the GNU Readline Library (Readline), a library
14059+ for reading lines of text with interactive input and history editing.
14060
14061- The Library is free software; you can redistribute it and/or modify
14062+ Readline is free software: you can redistribute it and/or modify
14063 it under the terms of the GNU General Public License as published by
14064- the Free Software Foundation; either version 2, or (at your option)
14065- any later version.
14066+ the Free Software Foundation, either version 3 of the License, or
14067+ (at your option) any later version.
14068
14069- The Library is distributed in the hope that it will be useful, but
14070- WITHOUT ANY WARRANTY; without even the implied warranty of
14071- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14072- General Public License for more details.
14073-
14074- The GNU General Public License is often shipped with GNU software, and
14075- is generally kept in a file called COPYING or LICENSE. If you do not
14076- have a copy of the license, write to the Free Software Foundation,
14077- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
14078+ Readline is distributed in the hope that it will be useful,
14079+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14080+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14081+ GNU General Public License for more details.
14082+
14083+ You should have received a copy of the GNU General Public License
14084+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
14085+*/
14086
14087 #if !defined (_RLCONF_H_)
14088 #define _RLCONF_H_
14089@@ -37,9 +35,12 @@
14090 /* Ugly but working hack for binding prefix meta. */
14091 #define PREFIX_META_HACK
14092
14093-/* The final, last-ditch effort file name for an init file. */
14094+/* The next-to-last-ditch effort file name for a user-specific init file. */
14095 #define DEFAULT_INPUTRC "~/.inputrc"
14096
14097+/* The ultimate last-ditch filenname for an init file -- system-wide. */
14098+#define SYS_INPUTRC "/etc/inputrc"
14099+
14100 /* If defined, expand tabs to spaces. */
14101 #define DISPLAY_TABS
14102
14103Index: gdb-7.2.90.20110703/readline/rldefs.h
14104===================================================================
14105--- gdb-7.2.90.20110703.orig/readline/rldefs.h 2011-07-03 10:40:53.000000000 +0200
14106+++ gdb-7.2.90.20110703/readline/rldefs.h 2011-07-03 10:41:21.000000000 +0200
14107@@ -2,26 +2,24 @@
14108 for readline. This should be included after any files that define
14109 system-specific constants like _POSIX_VERSION or USG. */
14110
14111-/* Copyright (C) 1987-2005 Free Software Foundation, Inc.
14112+/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
14113
14114- This file contains the Readline Library (the Library), a set of
14115- routines for providing Emacs style line input to programs that ask
14116- for it.
14117+ This file is part of the GNU Readline Library (Readline), a library
14118+ for reading lines of text with interactive input and history editing.
14119
14120- The Library is free software; you can redistribute it and/or modify
14121+ Readline is free software: you can redistribute it and/or modify
14122 it under the terms of the GNU General Public License as published by
14123- the Free Software Foundation; either version 2, or (at your option)
14124- any later version.
14125+ the Free Software Foundation, either version 3 of the License, or
14126+ (at your option) any later version.
14127
14128- The Library is distributed in the hope that it will be useful, but
14129- WITHOUT ANY WARRANTY; without even the implied warranty of
14130- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14131- General Public License for more details.
14132-
14133- The GNU General Public License is often shipped with GNU software, and
14134- is generally kept in a file called COPYING or LICENSE. If you do not
14135- have a copy of the license, write to the Free Software Foundation,
14136- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
14137+ Readline is distributed in the hope that it will be useful,
14138+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14139+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14140+ GNU General Public License for more details.
14141+
14142+ You should have received a copy of the GNU General Public License
14143+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
14144+*/
14145
14146 #if !defined (_RLDEFS_H_)
14147 #define _RLDEFS_H_
14148@@ -32,6 +30,10 @@
14149
14150 #include "rlstdc.h"
14151
14152+#if defined (STRCOLL_BROKEN)
14153+# undef HAVE_STRCOLL
14154+#endif
14155+
14156 #if defined (_POSIX_VERSION) && !defined (TERMIOS_MISSING)
14157 # define TERMIOS_TTY_DRIVER
14158 #else
14159Index: gdb-7.2.90.20110703/readline/rlmbutil.h
14160===================================================================
14161--- gdb-7.2.90.20110703.orig/readline/rlmbutil.h 2011-07-03 10:40:53.000000000 +0200
14162+++ gdb-7.2.90.20110703/readline/rlmbutil.h 2011-07-03 10:41:21.000000000 +0200
14163@@ -1,24 +1,23 @@
14164 /* rlmbutil.h -- utility functions for multibyte characters. */
14165
14166-/* Copyright (C) 2001, 2003 Free Software Foundation, Inc.
14167+/* Copyright (C) 2001-2009 Free Software Foundation, Inc.
14168
14169- This file is part of the GNU Readline Library, a library for
14170- reading lines of text with interactive input and history editing.
14171+ This file is part of the GNU Readline Library (Readline), a library
14172+ for reading lines of text with interactive input and history editing.
14173
14174- The GNU Readline Library is free software; you can redistribute it
14175- and/or modify it under the terms of the GNU General Public License
14176- as published by the Free Software Foundation; either version 2, or
14177+ Readline is free software: you can redistribute it and/or modify
14178+ it under the terms of the GNU General Public License as published by
14179+ the Free Software Foundation, either version 3 of the License, or
14180 (at your option) any later version.
14181
14182- The GNU Readline Library is distributed in the hope that it will be
14183- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
14184- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14185+ Readline is distributed in the hope that it will be useful,
14186+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14187+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14188 GNU General Public License for more details.
14189
14190- The GNU General Public License is often shipped with GNU software, and
14191- is generally kept in a file called COPYING or LICENSE. If you do not
14192- have a copy of the license, write to the Free Software Foundation,
14193- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
14194+ You should have received a copy of the GNU General Public License
14195+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
14196+*/
14197
14198 #if !defined (_RL_MBUTIL_H_)
14199 #define _RL_MBUTIL_H_
14200@@ -30,22 +29,21 @@
14201 /************************************************/
14202
14203 /* For platforms which support the ISO C amendement 1 functionality we
14204- support user defined character classes.
14205-
14206- Some platforms have the multibyte functions such as mbsrtowcs but
14207- are lacking the multitype type mbstate_t. BeOS (unknown version)
14208- and HP/UX 11.23 without _XOPEN_SOURCE=500 are like this.
14209-
14210- We really need mbstate_t type to operate properly. For example, see
14211- compute_lcd_of_matches, where two mbstate_t's are active at the same
14212- time. So we require both the functions and the mbstate_t type in
14213- order to enable multibyte support. */
14214-
14215+ support user defined character classes. */
14216 /* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. */
14217-#if defined (HAVE_WCTYPE_H) && defined (HAVE_WCHAR_H)
14218+#if defined (HAVE_WCTYPE_H) && defined (HAVE_WCHAR_H) && defined (HAVE_LOCALE_H)
14219 # include <wchar.h>
14220 # include <wctype.h>
14221-# if defined (HAVE_MBSTATE_T) && defined (HAVE_MBSRTOWCS) && defined (HAVE_MBRTOWC) && defined (HAVE_MBRLEN) && defined (HAVE_WCWIDTH)
14222+# if defined (HAVE_ISWCTYPE) && \
14223+ defined (HAVE_ISWLOWER) && \
14224+ defined (HAVE_ISWUPPER) && \
14225+ defined (HAVE_MBSRTOWCS) && \
14226+ defined (HAVE_MBRTOWC) && \
14227+ defined (HAVE_MBRLEN) && \
14228+ defined (HAVE_TOWLOWER) && \
14229+ defined (HAVE_TOWUPPER) && \
14230+ defined (HAVE_WCHAR_T) && \
14231+ defined (HAVE_WCWIDTH)
14232 /* system is supposed to support XPG5 */
14233 # define HANDLE_MULTIBYTE 1
14234 # endif
14235Index: gdb-7.2.90.20110703/readline/rlprivate.h
14236===================================================================
14237--- gdb-7.2.90.20110703.orig/readline/rlprivate.h 2011-07-03 10:40:53.000000000 +0200
14238+++ gdb-7.2.90.20110703/readline/rlprivate.h 2011-07-03 10:41:21.000000000 +0200
14239@@ -1,25 +1,24 @@
14240 /* rlprivate.h -- functions and variables global to the readline library,
14241 but not intended for use by applications. */
14242
14243-/* Copyright (C) 1999-2005 Free Software Foundation, Inc.
14244+/* Copyright (C) 1999-2010 Free Software Foundation, Inc.
14245
14246- This file is part of the GNU Readline Library, a library for
14247- reading lines of text with interactive input and history editing.
14248+ This file is part of the GNU Readline Library (Readline), a library
14249+ for reading lines of text with interactive input and history editing.
14250
14251- The GNU Readline Library is free software; you can redistribute it
14252- and/or modify it under the terms of the GNU General Public License
14253- as published by the Free Software Foundation; either version 2, or
14254+ Readline is free software: you can redistribute it and/or modify
14255+ it under the terms of the GNU General Public License as published by
14256+ the Free Software Foundation, either version 3 of the License, or
14257 (at your option) any later version.
14258
14259- The GNU Readline Library is distributed in the hope that it will be
14260- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
14261- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14262+ Readline is distributed in the hope that it will be useful,
14263+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14264+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14265 GNU General Public License for more details.
14266
14267- The GNU General Public License is often shipped with GNU software, and
14268- is generally kept in a file called COPYING or LICENSE. If you do not
14269- have a copy of the license, write to the Free Software Foundation,
14270- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
14271+ You should have received a copy of the GNU General Public License
14272+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
14273+*/
14274
14275 #if !defined (_RL_PRIVATE_H_)
14276 #define _RL_PRIVATE_H_
14277@@ -30,6 +29,21 @@
14278
14279 /*************************************************************************
14280 * *
14281+ * Convenience definitions *
14282+ * *
14283+ *************************************************************************/
14284+
14285+#define EMACS_MODE() (rl_editing_mode == emacs_mode)
14286+#define VI_COMMAND_MODE() (rl_editing_mode == vi_mode && _rl_keymap == vi_movement_keymap)
14287+#define VI_INSERT_MODE() (rl_editing_mode == vi_mode && _rl_keymap == vi_insertion_keymap)
14288+
14289+#define RL_CHECK_SIGNALS() \
14290+ do { \
14291+ if (_rl_caught_signal) _rl_signal_handler (_rl_caught_signal); \
14292+ } while (0)
14293+
14294+/*************************************************************************
14295+ * *
14296 * Global structs undocumented in texinfo manual and not in readline.h *
14297 * *
14298 *************************************************************************/
14299@@ -42,6 +56,7 @@
14300 #define SF_REVERSE 0x01
14301 #define SF_FOUND 0x02
14302 #define SF_FAILED 0x04
14303+#define SF_CHGKMAP 0x08
14304
14305 typedef struct __rl_search_context
14306 {
14307@@ -65,6 +80,9 @@ typedef struct __rl_search_context
14308
14309 UNDO_LIST *save_undo_list;
14310
14311+ Keymap keymap; /* used when dispatching commands in search string */
14312+ Keymap okeymap; /* original keymap */
14313+
14314 int history_pos;
14315 int direction;
14316
14317@@ -106,7 +124,28 @@ typedef struct __rl_keyseq_context
14318 int childval;
14319 } _rl_keyseq_cxt;
14320
14321- /* fill in more as needed */
14322+/* vi-mode commands that use result of motion command to define boundaries */
14323+#define VIM_DELETE 0x01
14324+#define VIM_CHANGE 0x02
14325+#define VIM_YANK 0x04
14326+
14327+/* various states for vi-mode commands that use motion commands. reflects
14328+ RL_READLINE_STATE */
14329+#define VMSTATE_READ 0x01
14330+#define VMSTATE_NUMARG 0x02
14331+
14332+typedef struct __rl_vimotion_context
14333+{
14334+ int op;
14335+ int state;
14336+ int flags; /* reserved */
14337+ _rl_arg_cxt ncxt;
14338+ int numeric_arg;
14339+ int start, end; /* rl_point, rl_end */
14340+ int key, motion; /* initial key, motion command */
14341+} _rl_vimotion_cxt;
14342+
14343+/* fill in more as needed */
14344 /* `Generic' callback data and functions */
14345 typedef struct __rl_callback_generic_arg
14346 {
14347@@ -139,12 +178,9 @@ extern int rl_visible_stats;
14348 extern int rl_line_buffer_len;
14349 extern int rl_arg_sign;
14350 extern int rl_visible_prompt_length;
14351-extern int readline_echoing_p;
14352 extern int rl_key_sequence_length;
14353 extern int rl_byte_oriented;
14354
14355-extern _rl_keyseq_cxt *_rl_kscxt;
14356-
14357 /* display.c */
14358 extern int rl_display_fixed;
14359
14360@@ -206,6 +242,7 @@ extern void _rl_callback_data_dispose PA
14361 /* bind.c */
14362
14363 /* complete.c */
14364+extern void _rl_reset_completion_state PARAMS((void));
14365 extern char _rl_find_completion_word PARAMS((int *, int *));
14366 extern void _rl_free_match_list PARAMS((char **));
14367
14368@@ -261,6 +298,8 @@ extern void _rl_start_using_history PARA
14369 extern int _rl_free_saved_history_line PARAMS((void));
14370 extern void _rl_set_insert_mode PARAMS((int, int));
14371
14372+extern void _rl_revert_all_lines PARAMS((void));
14373+
14374 /* nls.c */
14375 extern int _rl_init_eightbit PARAMS((void));
14376
14377@@ -281,6 +320,14 @@ extern int _rl_restore_tty_signals PARAM
14378 /* search.c */
14379 extern int _rl_nsearch_callback PARAMS((_rl_search_cxt *));
14380
14381+/* signals.c */
14382+extern void _rl_signal_handler PARAMS((int));
14383+
14384+extern void _rl_block_sigint PARAMS((void));
14385+extern void _rl_release_sigint PARAMS((void));
14386+extern void _rl_block_sigwinch PARAMS((void));
14387+extern void _rl_release_sigwinch PARAMS((void));
14388+
14389 /* terminal.c */
14390 extern void _rl_get_screen_size PARAMS((int, int));
14391 extern int _rl_init_terminal_io PARAMS((const char *));
14392@@ -298,6 +345,7 @@ extern void _rl_set_cursor PARAMS((int,
14393 /* text.c */
14394 extern void _rl_fix_point PARAMS((int));
14395 extern int _rl_replace_text PARAMS((const char *, int, int));
14396+extern int _rl_forward_char_internal PARAMS((int));
14397 extern int _rl_insert_char PARAMS((int, int));
14398 extern int _rl_overwrite_char PARAMS((int, int));
14399 extern int _rl_overwrite_rubout PARAMS((int, int));
14400@@ -309,8 +357,25 @@ extern int _rl_char_search_internal PARA
14401 #endif
14402 extern int _rl_set_mark_at_pos PARAMS((int));
14403
14404+/* undo.c */
14405+extern UNDO_LIST *_rl_copy_undo_entry PARAMS((UNDO_LIST *));
14406+extern UNDO_LIST *_rl_copy_undo_list PARAMS((UNDO_LIST *));
14407+
14408 /* util.c */
14409+#if defined (USE_VARARGS) && defined (PREFER_STDARG)
14410+extern void _rl_ttymsg (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
14411+extern void _rl_errmsg (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
14412+extern void _rl_trace (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
14413+#else
14414+extern void _rl_ttymsg ();
14415+extern void _rl_errmsg ();
14416+extern void _rl_trace ();
14417+#endif
14418+
14419+extern int _rl_tropen PARAMS((void));
14420+
14421 extern int _rl_abort_internal PARAMS((void));
14422+extern int _rl_null_function PARAMS((int, int));
14423 extern char *_rl_strindex PARAMS((const char *, const char *));
14424 extern int _rl_qsort_string_compare PARAMS((char **, char **));
14425 extern int (_rl_uppercase_p) PARAMS((int));
14426@@ -327,14 +392,15 @@ extern void _rl_vi_reset_last PARAMS((vo
14427 extern void _rl_vi_set_last PARAMS((int, int, int));
14428 extern int _rl_vi_textmod_command PARAMS((int));
14429 extern void _rl_vi_done_inserting PARAMS((void));
14430+extern int _rl_vi_domove_callback PARAMS((_rl_vimotion_cxt *));
14431
14432 /*************************************************************************
14433 * Undocumented private variables *
14434 *************************************************************************/
14435
14436 /* bind.c */
14437-extern const char *_rl_possible_control_prefixes[];
14438-extern const char *_rl_possible_meta_prefixes[];
14439+extern const char * const _rl_possible_control_prefixes[];
14440+extern const char * const _rl_possible_meta_prefixes[];
14441
14442 /* callback.c */
14443 extern _rl_callback_func_t *_rl_callback_func;
14444@@ -345,17 +411,21 @@ extern int _rl_complete_show_all;
14445 extern int _rl_complete_show_unmodified;
14446 extern int _rl_complete_mark_directories;
14447 extern int _rl_complete_mark_symlink_dirs;
14448+extern int _rl_completion_prefix_display_length;
14449+extern int _rl_completion_columns;
14450 extern int _rl_print_completions_horizontally;
14451 extern int _rl_completion_case_fold;
14452+extern int _rl_completion_case_map;
14453 extern int _rl_match_hidden_files;
14454 extern int _rl_page_completions;
14455+extern int _rl_skip_completed_text;
14456+extern int _rl_menu_complete_prefix_first;
14457
14458 /* display.c */
14459 extern int _rl_vis_botlin;
14460 extern int _rl_last_c_pos;
14461 extern int _rl_suppress_redisplay;
14462 extern int _rl_want_redisplay;
14463-extern char *rl_display_prompt;
14464
14465 /* isearch.c */
14466 extern char *_rl_isearch_terminators;
14467@@ -372,6 +442,7 @@ extern int _rl_history_saved_point;
14468 extern _rl_arg_cxt _rl_argcxt;
14469
14470 /* readline.c */
14471+extern int _rl_echoing_p;
14472 extern int _rl_horizontal_scroll_mode;
14473 extern int _rl_mark_modified_lines;
14474 extern int _rl_bell_preference;
14475@@ -379,6 +450,8 @@ extern int _rl_meta_flag;
14476 extern int _rl_convert_meta_chars_to_ascii;
14477 extern int _rl_output_meta_chars;
14478 extern int _rl_bind_stty_chars;
14479+extern int _rl_revert_all_at_newline;
14480+extern int _rl_echo_control_chars;
14481 extern char *_rl_comment_begin;
14482 extern unsigned char _rl_parsing_conditionalized_out;
14483 extern Keymap _rl_keymap;
14484@@ -386,11 +459,22 @@ extern FILE *_rl_in_stream;
14485 extern FILE *_rl_out_stream;
14486 extern int _rl_last_command_was_kill;
14487 extern int _rl_eof_char;
14488-extern procenv_t readline_top_level;
14489+extern procenv_t _rl_top_level;
14490+extern _rl_keyseq_cxt *_rl_kscxt;
14491
14492 /* search.c */
14493 extern _rl_search_cxt *_rl_nscxt;
14494
14495+/* signals.c */
14496+extern int _rl_interrupt_immediately;
14497+extern int volatile _rl_caught_signal;
14498+
14499+extern int _rl_echoctl;
14500+
14501+extern int _rl_intr_char;
14502+extern int _rl_quit_char;
14503+extern int _rl_susp_char;
14504+
14505 /* terminal.c */
14506 extern int _rl_enable_keypad;
14507 extern int _rl_enable_meta;
14508@@ -404,6 +488,7 @@ extern char *_rl_term_up;
14509 extern char *_rl_term_dc;
14510 extern char *_rl_term_cr;
14511 extern char *_rl_term_IC;
14512+extern char *_rl_term_forward_char;
14513 extern int _rl_screenheight;
14514 extern int _rl_screenwidth;
14515 extern int _rl_screenchars;
14516@@ -416,5 +501,6 @@ extern int _rl_undo_group_level;
14517
14518 /* vi_mode.c */
14519 extern int _rl_vi_last_command;
14520+extern _rl_vimotion_cxt *_rl_vimvcxt;
14521
14522 #endif /* _RL_PRIVATE_H_ */
14523Index: gdb-7.2.90.20110703/readline/rlshell.h
14524===================================================================
14525--- gdb-7.2.90.20110703.orig/readline/rlshell.h 2011-07-03 10:40:53.000000000 +0200
14526+++ gdb-7.2.90.20110703/readline/rlshell.h 2011-07-03 10:41:21.000000000 +0200
14527@@ -1,24 +1,23 @@
14528 /* rlshell.h -- utility functions normally provided by bash. */
14529
14530-/* Copyright (C) 1999 Free Software Foundation, Inc.
14531+/* Copyright (C) 1999-2009 Free Software Foundation, Inc.
14532
14533- This file is part of the GNU Readline Library, a library for
14534- reading lines of text with interactive input and history editing.
14535+ This file is part of the GNU Readline Library (Readline), a library
14536+ for reading lines of text with interactive input and history editing.
14537
14538- The GNU Readline Library is free software; you can redistribute it
14539- and/or modify it under the terms of the GNU General Public License
14540- as published by the Free Software Foundation; either version 2, or
14541+ Readline is free software: you can redistribute it and/or modify
14542+ it under the terms of the GNU General Public License as published by
14543+ the Free Software Foundation, either version 3 of the License, or
14544 (at your option) any later version.
14545
14546- The GNU Readline Library is distributed in the hope that it will be
14547- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
14548- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14549+ Readline is distributed in the hope that it will be useful,
14550+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14551+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14552 GNU General Public License for more details.
14553
14554- The GNU General Public License is often shipped with GNU software, and
14555- is generally kept in a file called COPYING or LICENSE. If you do not
14556- have a copy of the license, write to the Free Software Foundation,
14557- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
14558+ You should have received a copy of the GNU General Public License
14559+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
14560+*/
14561
14562 #if !defined (_RL_SHELL_H_)
14563 #define _RL_SHELL_H_
14564Index: gdb-7.2.90.20110703/readline/rlstdc.h
14565===================================================================
14566--- gdb-7.2.90.20110703.orig/readline/rlstdc.h 2011-07-03 10:40:53.000000000 +0200
14567+++ gdb-7.2.90.20110703/readline/rlstdc.h 2011-07-03 10:41:21.000000000 +0200
14568@@ -1,23 +1,23 @@
14569-/* stdc.h -- macros to make source compile on both ANSI C and K&R C
14570- compilers. */
14571+/* stdc.h -- macros to make source compile on both ANSI C and K&R C compilers. */
14572
14573-/* Copyright (C) 1993 Free Software Foundation, Inc.
14574+/* Copyright (C) 1993-2009 Free Software Foundation, Inc.
14575
14576- This file is part of GNU Bash, the Bourne Again SHell.
14577+ This file is part of the GNU Readline Library (Readline), a library
14578+ for reading lines of text with interactive input and history editing.
14579
14580- Bash is free software; you can redistribute it and/or modify it
14581- under the terms of the GNU General Public License as published by
14582- the Free Software Foundation; either version 2, or (at your option)
14583- any later version.
14584-
14585- Bash is distributed in the hope that it will be useful, but WITHOUT
14586- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14587- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
14588- License for more details.
14589+ Readline is free software: you can redistribute it and/or modify
14590+ it under the terms of the GNU General Public License as published by
14591+ the Free Software Foundation, either version 3 of the License, or
14592+ (at your option) any later version.
14593+
14594+ Readline is distributed in the hope that it will be useful,
14595+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14596+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14597+ GNU General Public License for more details.
14598
14599 You should have received a copy of the GNU General Public License
14600- along with Bash; see the file COPYING. If not, write to the Free
14601- Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
14602+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
14603+*/
14604
14605 #if !defined (_RL_STDC_H_)
14606 #define _RL_STDC_H_
14607Index: gdb-7.2.90.20110703/readline/rltty.c
14608===================================================================
14609--- gdb-7.2.90.20110703.orig/readline/rltty.c 2011-07-03 10:40:53.000000000 +0200
14610+++ gdb-7.2.90.20110703/readline/rltty.c 2011-07-03 10:41:21.000000000 +0200
14611@@ -3,23 +3,23 @@
14612
14613 /* Copyright (C) 1992-2005 Free Software Foundation, Inc.
14614
14615- This file is part of the GNU Readline Library, a library for
14616- reading lines of text with interactive input and history editing.
14617+ This file is part of the GNU Readline Library (Readline), a library
14618+ for reading lines of text with interactive input and history editing.
14619
14620- The GNU Readline Library is free software; you can redistribute it
14621- and/or modify it under the terms of the GNU General Public License
14622- as published by the Free Software Foundation; either version 2, or
14623+ Readline is free software: you can redistribute it and/or modify
14624+ it under the terms of the GNU General Public License as published by
14625+ the Free Software Foundation, either version 3 of the License, or
14626 (at your option) any later version.
14627
14628- The GNU Readline Library is distributed in the hope that it will be
14629- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
14630- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14631+ Readline is distributed in the hope that it will be useful,
14632+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14633+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14634 GNU General Public License for more details.
14635
14636- The GNU General Public License is often shipped with GNU software, and
14637- is generally kept in a file called COPYING or LICENSE. If you do not
14638- have a copy of the license, write to the Free Software Foundation,
14639- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
14640+ You should have received a copy of the GNU General Public License
14641+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
14642+*/
14643+
14644 #define READLINE_LIBRARY
14645
14646 #if defined (HAVE_CONFIG_H)
14647@@ -52,77 +52,10 @@ extern int errno;
14648 rl_vintfunc_t *rl_prep_term_function = rl_prep_terminal;
14649 rl_voidfunc_t *rl_deprep_term_function = rl_deprep_terminal;
14650
14651-void _rl_block_sigint PARAMS((void));
14652-void _rl_release_sigint PARAMS((void));
14653-
14654 static void set_winsize PARAMS((int));
14655
14656 /* **************************************************************** */
14657 /* */
14658-/* Signal Management */
14659-/* */
14660-/* **************************************************************** */
14661-
14662-#if defined (HAVE_POSIX_SIGNALS)
14663-static sigset_t sigint_set, sigint_oset;
14664-#else /* !HAVE_POSIX_SIGNALS */
14665-# if defined (HAVE_BSD_SIGNALS)
14666-static int sigint_oldmask;
14667-# endif /* HAVE_BSD_SIGNALS */
14668-#endif /* !HAVE_POSIX_SIGNALS */
14669-
14670-static int sigint_blocked;
14671-
14672-/* Cause SIGINT to not be delivered until the corresponding call to
14673- _rl_release_sigint(). */
14674-void
14675-_rl_block_sigint ()
14676-{
14677- if (sigint_blocked)
14678- return;
14679-
14680-#if defined (HAVE_POSIX_SIGNALS)
14681- sigemptyset (&sigint_set);
14682- sigemptyset (&sigint_oset);
14683- sigaddset (&sigint_set, SIGINT);
14684- sigprocmask (SIG_BLOCK, &sigint_set, &sigint_oset);
14685-#else /* !HAVE_POSIX_SIGNALS */
14686-# if defined (HAVE_BSD_SIGNALS)
14687- sigint_oldmask = sigblock (sigmask (SIGINT));
14688-# else /* !HAVE_BSD_SIGNALS */
14689-# if defined (HAVE_USG_SIGHOLD)
14690- sighold (SIGINT);
14691-# endif /* HAVE_USG_SIGHOLD */
14692-# endif /* !HAVE_BSD_SIGNALS */
14693-#endif /* !HAVE_POSIX_SIGNALS */
14694-
14695- sigint_blocked = 1;
14696-}
14697-
14698-/* Allow SIGINT to be delivered. */
14699-void
14700-_rl_release_sigint ()
14701-{
14702- if (sigint_blocked == 0)
14703- return;
14704-
14705-#if defined (HAVE_POSIX_SIGNALS)
14706- sigprocmask (SIG_SETMASK, &sigint_oset, (sigset_t *)NULL);
14707-#else
14708-# if defined (HAVE_BSD_SIGNALS)
14709- sigsetmask (sigint_oldmask);
14710-# else /* !HAVE_BSD_SIGNALS */
14711-# if defined (HAVE_USG_SIGHOLD)
14712- sigrelse (SIGINT);
14713-# endif /* HAVE_USG_SIGHOLD */
14714-# endif /* !HAVE_BSD_SIGNALS */
14715-#endif /* !HAVE_POSIX_SIGNALS */
14716-
14717- sigint_blocked = 0;
14718-}
14719-
14720-/* **************************************************************** */
14721-/* */
14722 /* Saving and Restoring the TTY */
14723 /* */
14724 /* **************************************************************** */
14725@@ -204,8 +137,9 @@ save_tty_chars (tiop)
14726
14727 if (tiop->flags & TCHARS_SET)
14728 {
14729- _rl_tty_chars.t_intr = tiop->tchars.t_intrc;
14730- _rl_tty_chars.t_quit = tiop->tchars.t_quitc;
14731+ _rl_intr_char = _rl_tty_chars.t_intr = tiop->tchars.t_intrc;
14732+ _rl_quit_char = _rl_tty_chars.t_quit = tiop->tchars.t_quitc;
14733+
14734 _rl_tty_chars.t_start = tiop->tchars.t_startc;
14735 _rl_tty_chars.t_stop = tiop->tchars.t_stopc;
14736 _rl_tty_chars.t_eof = tiop->tchars.t_eofc;
14737@@ -215,7 +149,8 @@ save_tty_chars (tiop)
14738
14739 if (tiop->flags & LTCHARS_SET)
14740 {
14741- _rl_tty_chars.t_susp = tiop->ltchars.t_suspc;
14742+ _rl_susp_char = _rl_tty_chars.t_susp = tiop->ltchars.t_suspc;
14743+
14744 _rl_tty_chars.t_dsusp = tiop->ltchars.t_dsuspc;
14745 _rl_tty_chars.t_reprint = tiop->ltchars.t_rprntc;
14746 _rl_tty_chars.t_flush = tiop->ltchars.t_flushc;
14747@@ -268,7 +203,7 @@ set_tty_settings (tty, tiop)
14748 ioctl (tty, TIOCSETN, &(tiop->sgttyb));
14749 tiop->flags &= ~SGTTY_SET;
14750 }
14751- readline_echoing_p = 1;
14752+ _rl_echoing_p = 1;
14753
14754 #if defined (TIOCLSET)
14755 if (tiop->flags & LFLAG_SET)
14756@@ -302,7 +237,8 @@ prepare_terminal_settings (meta_flag, ol
14757 int meta_flag;
14758 TIOTYPE oldtio, *tiop;
14759 {
14760- readline_echoing_p = (oldtio.sgttyb.sg_flags & ECHO);
14761+ _rl_echoing_p = (oldtio.sgttyb.sg_flags & ECHO);
14762+ _rl_echoctl = (oldtio.sgttyb.sg_flags & ECHOCTL);
14763
14764 /* Copy the original settings to the structure we're going to use for
14765 our settings. */
14766@@ -433,10 +369,10 @@ save_tty_chars (tiop)
14767 #ifdef VREPRINT
14768 _rl_tty_chars.t_reprint = tiop->c_cc[VREPRINT];
14769 #endif
14770- _rl_tty_chars.t_intr = tiop->c_cc[VINTR];
14771- _rl_tty_chars.t_quit = tiop->c_cc[VQUIT];
14772+ _rl_intr_char = _rl_tty_chars.t_intr = tiop->c_cc[VINTR];
14773+ _rl_quit_char = _rl_tty_chars.t_quit = tiop->c_cc[VQUIT];
14774 #ifdef VSUSP
14775- _rl_tty_chars.t_susp = tiop->c_cc[VSUSP];
14776+ _rl_susp_char = _rl_tty_chars.t_susp = tiop->c_cc[VSUSP];
14777 #endif
14778 #ifdef VDSUSP
14779 _rl_tty_chars.t_dsusp = tiop->c_cc[VDSUSP];
14780@@ -464,7 +400,7 @@ static void
14781 rltty_warning (msg)
14782 char *msg;
14783 {
14784- fprintf (stderr, "readline: warning: %s\n", msg);
14785+ _rl_errmsg ("warning: %s", msg);
14786 }
14787 #endif
14788
14789@@ -475,7 +411,7 @@ TIOTYPE *tp;
14790 {
14791 if ((tp->c_oflag & OPOST) == 0)
14792 {
14793- rltty_warning ("turning on OPOST for terminal\r");
14794+ _rl_errmsg ("warning: turning on OPOST for terminal\r");
14795 tp->c_oflag |= OPOST|ONLCR;
14796 }
14797 }
14798@@ -500,8 +436,8 @@ _get_tty_settings (tty, tiop)
14799 }
14800 if (OUTPUT_BEING_FLUSHED (tiop))
14801 {
14802-#if defined (FLUSHO) && defined (_AIX41)
14803- rltty_warning ("turning off output flushing");
14804+#if defined (FLUSHO)
14805+ _rl_errmsg ("warning: turning off output flushing");
14806 tiop->c_lflag &= ~FLUSHO;
14807 break;
14808 #else
14809@@ -580,7 +516,10 @@ prepare_terminal_settings (meta_flag, ol
14810 int meta_flag;
14811 TIOTYPE oldtio, *tiop;
14812 {
14813- readline_echoing_p = (oldtio.c_lflag & ECHO);
14814+ _rl_echoing_p = (oldtio.c_lflag & ECHO);
14815+#if defined (ECHOCTL)
14816+ _rl_echoctl = (oldtio.c_lflag & ECHOCTL);
14817+#endif
14818
14819 tiop->c_lflag &= ~(ICANON | ECHO);
14820
14821@@ -643,7 +582,7 @@ void
14822 rl_prep_terminal (meta_flag)
14823 int meta_flag;
14824 {
14825- readline_echoing_p = 1;
14826+ _rl_echoing_p = 1;
14827 }
14828
14829 void
14830@@ -665,17 +604,19 @@ rl_prep_terminal (meta_flag)
14831 /* Try to keep this function from being INTerrupted. */
14832 _rl_block_sigint ();
14833
14834- tty = fileno (rl_instream);
14835+ tty = rl_instream ? fileno (rl_instream) : fileno (stdin);
14836
14837 if (get_tty_settings (tty, &tio) < 0)
14838 {
14839 #if defined (ENOTSUP)
14840- /* MacOS X, at least, lies about the value of errno if tcgetattr fails. */
14841- if (errno == ENOTTY || errno == ENOTSUP)
14842+ /* MacOS X and Linux, at least, lie about the value of errno if
14843+ tcgetattr fails. */
14844+ if (errno == ENOTTY || errno == EINVAL || errno == ENOTSUP)
14845 #else
14846- if (errno == ENOTTY)
14847+ if (errno == ENOTTY || errno == EINVAL)
14848 #endif
14849- readline_echoing_p = 1; /* XXX */
14850+ _rl_echoing_p = 1; /* XXX */
14851+
14852 _rl_release_sigint ();
14853 return;
14854 }
14855@@ -737,7 +678,7 @@ rl_deprep_terminal ()
14856 /* Try to keep this function from being interrupted. */
14857 _rl_block_sigint ();
14858
14859- tty = fileno (rl_instream);
14860+ tty = rl_instream ? fileno (rl_instream) : fileno (stdout);
14861
14862 if (_rl_enable_keypad)
14863 _rl_control_keypad (0);
14864@@ -862,7 +803,7 @@ set_special_char (kmap, tiop, sc, func)
14865 }
14866
14867 #define RESET_SPECIAL(c) \
14868- if (c != -1 && kmap[(unsigned char)c].type == ISFUNC)
14869+ if (c != -1 && kmap[(unsigned char)c].type == ISFUNC) \
14870 kmap[(unsigned char)c].function = rl_insert;
14871
14872 static void
14873@@ -933,7 +874,6 @@ rltty_set_default_bindings (kmap)
14874 #if !defined (NO_TTY_DRIVER)
14875 TIOTYPE ttybuff;
14876 int tty;
14877- static int called = 0;
14878
14879 tty = fileno (rl_instream);
14880
14881Index: gdb-7.2.90.20110703/readline/rltty.h
14882===================================================================
14883--- gdb-7.2.90.20110703.orig/readline/rltty.h 2011-07-03 10:40:53.000000000 +0200
14884+++ gdb-7.2.90.20110703/readline/rltty.h 2011-07-03 10:41:21.000000000 +0200
14885@@ -1,25 +1,23 @@
14886 /* rltty.h - tty driver-related definitions used by some library files. */
14887
14888-/* Copyright (C) 1995 Free Software Foundation, Inc.
14889+/* Copyright (C) 1995-2009 Free Software Foundation, Inc.
14890
14891- This file contains the Readline Library (the Library), a set of
14892- routines for providing Emacs style line input to programs that ask
14893- for it.
14894+ This file is part of the GNU Readline Library (Readline), a library
14895+ for reading lines of text with interactive input and history editing.
14896
14897- The Library is free software; you can redistribute it and/or modify
14898+ Readline is free software: you can redistribute it and/or modify
14899 it under the terms of the GNU General Public License as published by
14900- the Free Software Foundation; either version 2, or (at your option)
14901- any later version.
14902+ the Free Software Foundation, either version 3 of the License, or
14903+ (at your option) any later version.
14904
14905- The Library is distributed in the hope that it will be useful, but
14906- WITHOUT ANY WARRANTY; without even the implied warranty of
14907- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14908- General Public License for more details.
14909-
14910- The GNU General Public License is often shipped with GNU software, and
14911- is generally kept in a file called COPYING or LICENSE. If you do not
14912- have a copy of the license, write to the Free Software Foundation,
14913- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
14914+ Readline is distributed in the hope that it will be useful,
14915+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14916+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14917+ GNU General Public License for more details.
14918+
14919+ You should have received a copy of the GNU General Public License
14920+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
14921+*/
14922
14923 #if !defined (_RLTTY_H_)
14924 #define _RLTTY_H_
14925@@ -79,7 +77,4 @@ typedef struct _rl_tty_chars {
14926 unsigned char t_status;
14927 } _RL_TTY_CHARS;
14928
14929-extern void _rl_block_sigint PARAMS((void));
14930-extern void _rl_release_sigint PARAMS((void));
14931-
14932 #endif /* _RLTTY_H_ */
14933Index: gdb-7.2.90.20110703/readline/rltypedefs.h
14934===================================================================
14935--- gdb-7.2.90.20110703.orig/readline/rltypedefs.h 2011-07-03 10:40:53.000000000 +0200
14936+++ gdb-7.2.90.20110703/readline/rltypedefs.h 2011-07-03 10:41:21.000000000 +0200
14937@@ -1,24 +1,23 @@
14938 /* rltypedefs.h -- Type declarations for readline functions. */
14939
14940-/* Copyright (C) 2000-2004 Free Software Foundation, Inc.
14941+/* Copyright (C) 2000-2009 Free Software Foundation, Inc.
14942
14943- This file is part of the GNU Readline Library, a library for
14944- reading lines of text with interactive input and history editing.
14945+ This file is part of the GNU Readline Library (Readline), a library
14946+ for reading lines of text with interactive input and history editing.
14947
14948- The GNU Readline Library is free software; you can redistribute it
14949- and/or modify it under the terms of the GNU General Public License
14950- as published by the Free Software Foundation; either version 2, or
14951+ Readline is free software: you can redistribute it and/or modify
14952+ it under the terms of the GNU General Public License as published by
14953+ the Free Software Foundation, either version 3 of the License, or
14954 (at your option) any later version.
14955
14956- The GNU Readline Library is distributed in the hope that it will be
14957- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
14958- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14959+ Readline is distributed in the hope that it will be useful,
14960+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14961+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14962 GNU General Public License for more details.
14963
14964- The GNU General Public License is often shipped with GNU software, and
14965- is generally kept in a file called COPYING or LICENSE. If you do not
14966- have a copy of the license, write to the Free Software Foundation,
14967- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
14968+ You should have received a copy of the GNU General Public License
14969+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
14970+*/
14971
14972 #ifndef _RL_TYPEDEFS_H_
14973 #define _RL_TYPEDEFS_H_
14974Index: gdb-7.2.90.20110703/readline/rlwinsize.h
14975===================================================================
14976--- gdb-7.2.90.20110703.orig/readline/rlwinsize.h 2011-07-03 10:40:53.000000000 +0200
14977+++ gdb-7.2.90.20110703/readline/rlwinsize.h 2011-07-03 10:41:21.000000000 +0200
14978@@ -1,26 +1,24 @@
14979 /* rlwinsize.h -- an attempt to isolate some of the system-specific defines
14980 for `struct winsize' and TIOCGWINSZ. */
14981
14982-/* Copyright (C) 1997 Free Software Foundation, Inc.
14983+/* Copyright (C) 1997-2009 Free Software Foundation, Inc.
14984
14985- This file contains the Readline Library (the Library), a set of
14986- routines for providing Emacs style line input to programs that ask
14987- for it.
14988+ This file is part of the GNU Readline Library (Readline), a library
14989+ for reading lines of text with interactive input and history editing.
14990
14991- The Library is free software; you can redistribute it and/or modify
14992+ Readline is free software: you can redistribute it and/or modify
14993 it under the terms of the GNU General Public License as published by
14994- the Free Software Foundation; either version 2, or (at your option)
14995- any later version.
14996+ the Free Software Foundation, either version 3 of the License, or
14997+ (at your option) any later version.
14998
14999- The Library is distributed in the hope that it will be useful, but
15000- WITHOUT ANY WARRANTY; without even the implied warranty of
15001- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15002- General Public License for more details.
15003-
15004- The GNU General Public License is often shipped with GNU software, and
15005- is generally kept in a file called COPYING or LICENSE. If you do not
15006- have a copy of the license, write to the Free Software Foundation,
15007- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
15008+ Readline is distributed in the hope that it will be useful,
15009+ but WITHOUT ANY WARRANTY; without even the implied warranty of
15010+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15011+ GNU General Public License for more details.
15012+
15013+ You should have received a copy of the GNU General Public License
15014+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
15015+*/
15016
15017 #if !defined (_RLWINSIZE_H_)
15018 #define _RLWINSIZE_H_
15019@@ -53,5 +51,8 @@
15020 # endif /* HAVE_SYS_PTE_H */
15021 #endif /* !STRUCT_WINSIZE_IN_TERMIOS && !STRUCT_WINSIZE_IN_SYS_IOCTL */
15022
15023-#endif /* _RL_WINSIZE_H */
15024+#if defined (M_UNIX) && !defined (_SCO_DS) && !defined (tcflow)
15025+# define tcflow(fd, action) ioctl(fd, TCXONC, action)
15026+#endif
15027
15028+#endif /* _RL_WINSIZE_H */
15029Index: gdb-7.2.90.20110703/readline/savestring.c
15030===================================================================
15031--- gdb-7.2.90.20110703.orig/readline/savestring.c 2011-07-03 10:40:53.000000000 +0200
15032+++ gdb-7.2.90.20110703/readline/savestring.c 2011-07-03 10:41:21.000000000 +0200
15033@@ -1,24 +1,24 @@
15034-/* savestring.c */
15035+/* savestring.c - function version of savestring for backwards compatibility */
15036
15037 /* Copyright (C) 1998,2003 Free Software Foundation, Inc.
15038
15039- This file is part of the GNU Readline Library, a library for
15040- reading lines of text with interactive input and history editing.
15041+ This file is part of the GNU Readline Library (Readline), a library
15042+ for reading lines of text with interactive input and history editing.
15043
15044- The GNU Readline Library is free software; you can redistribute it
15045- and/or modify it under the terms of the GNU General Public License
15046- as published by the Free Software Foundation; either version 2, or
15047+ Readline is free software: you can redistribute it and/or modify
15048+ it under the terms of the GNU General Public License as published by
15049+ the Free Software Foundation, either version 3 of the License, or
15050 (at your option) any later version.
15051
15052- The GNU Readline Library is distributed in the hope that it will be
15053- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
15054- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15055+ Readline is distributed in the hope that it will be useful,
15056+ but WITHOUT ANY WARRANTY; without even the implied warranty of
15057+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15058 GNU General Public License for more details.
15059
15060- The GNU General Public License is often shipped with GNU software, and
15061- is generally kept in a file called COPYING or LICENSE. If you do not
15062- have a copy of the license, write to the Free Software Foundation,
15063- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
15064+ You should have received a copy of the GNU General Public License
15065+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
15066+*/
15067+
15068 #define READLINE_LIBRARY
15069
15070 #include <config.h>
15071@@ -33,5 +33,9 @@ char *
15072 savestring (s)
15073 const char *s;
15074 {
15075- return ((char *)strcpy ((char *)xmalloc (1 + strlen (s)), (s)));
15076+ char *ret;
15077+
15078+ ret = (char *)xmalloc (strlen (s) + 1);
15079+ strcpy (ret, s);
15080+ return ret;
15081 }
15082Index: gdb-7.2.90.20110703/readline/search.c
15083===================================================================
15084--- gdb-7.2.90.20110703.orig/readline/search.c 2011-07-03 10:40:53.000000000 +0200
15085+++ gdb-7.2.90.20110703/readline/search.c 2011-07-03 10:41:21.000000000 +0200
15086@@ -1,25 +1,24 @@
15087 /* search.c - code for non-incremental searching in emacs and vi modes. */
15088
15089-/* Copyright (C) 1992-2005 Free Software Foundation, Inc.
15090+/* Copyright (C) 1992-2009 Free Software Foundation, Inc.
15091
15092- This file is part of the Readline Library (the Library), a set of
15093- routines for providing Emacs style line input to programs that ask
15094- for it.
15095+ This file is part of the GNU Readline Library (Readline), a library
15096+ for reading lines of text with interactive input and history editing.
15097
15098- The Library is free software; you can redistribute it and/or modify
15099+ Readline is free software: you can redistribute it and/or modify
15100 it under the terms of the GNU General Public License as published by
15101- the Free Software Foundation; either version 2, or (at your option)
15102- any later version.
15103+ the Free Software Foundation, either version 3 of the License, or
15104+ (at your option) any later version.
15105+
15106+ Readline is distributed in the hope that it will be useful,
15107+ but WITHOUT ANY WARRANTY; without even the implied warranty of
15108+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15109+ GNU General Public License for more details.
15110+
15111+ You should have received a copy of the GNU General Public License
15112+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
15113+*/
15114
15115- The Library is distributed in the hope that it will be useful, but
15116- WITHOUT ANY WARRANTY; without even the implied warranty of
15117- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15118- General Public License for more details.
15119-
15120- The GNU General Public License is often shipped with GNU software, and
15121- is generally kept in a file called COPYING or LICENSE. If you do not
15122- have a copy of the license, write to the Free Software Foundation,
15123- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
15124 #define READLINE_LIBRARY
15125
15126 #if defined (HAVE_CONFIG_H)
15127@@ -70,7 +69,6 @@ static int rl_history_search_pos;
15128 static char *history_search_string;
15129 static int history_string_size;
15130
15131-static UNDO_LIST *noninc_saved_undo_list;
15132 static void make_history_line_current PARAMS((HIST_ENTRY *));
15133 static int noninc_search_from_pos PARAMS((char *, int, int));
15134 static int noninc_dosearch PARAMS((char *, int));
15135@@ -212,8 +210,8 @@ _rl_nsearch_init (dir, pchar)
15136 rl_end = rl_point = 0;
15137
15138 p = _rl_make_prompt_for_search (pchar ? pchar : ':');
15139- rl_message (p, 0, 0);
15140- free (p);
15141+ rl_message ("%s", p, 0);
15142+ xfree (p);
15143
15144 RL_SETSTATE(RL_STATE_NSEARCH);
15145
15146Index: gdb-7.2.90.20110703/readline/shell.c
15147===================================================================
15148--- gdb-7.2.90.20110703.orig/readline/shell.c 2011-07-03 10:40:53.000000000 +0200
15149+++ gdb-7.2.90.20110703/readline/shell.c 2011-07-03 10:41:21.000000000 +0200
15150@@ -1,25 +1,25 @@
15151 /* shell.c -- readline utility functions that are normally provided by
15152 bash when readline is linked as part of the shell. */
15153
15154-/* Copyright (C) 1997 Free Software Foundation, Inc.
15155+/* Copyright (C) 1997-2009 Free Software Foundation, Inc.
15156
15157- This file is part of the GNU Readline Library, a library for
15158- reading lines of text with interactive input and history editing.
15159+ This file is part of the GNU Readline Library (Readline), a library
15160+ for reading lines of text with interactive input and history editing.
15161
15162- The GNU Readline Library is free software; you can redistribute it
15163- and/or modify it under the terms of the GNU General Public License
15164- as published by the Free Software Foundation; either version 2, or
15165+ Readline is free software: you can redistribute it and/or modify
15166+ it under the terms of the GNU General Public License as published by
15167+ the Free Software Foundation, either version 3 of the License, or
15168 (at your option) any later version.
15169
15170- The GNU Readline Library is distributed in the hope that it will be
15171- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
15172- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15173+ Readline is distributed in the hope that it will be useful,
15174+ but WITHOUT ANY WARRANTY; without even the implied warranty of
15175+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15176 GNU General Public License for more details.
15177
15178- The GNU General Public License is often shipped with GNU software, and
15179- is generally kept in a file called COPYING or LICENSE. If you do not
15180- have a copy of the license, write to the Free Software Foundation,
15181- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
15182+ You should have received a copy of the GNU General Public License
15183+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
15184+*/
15185+
15186 #define READLINE_LIBRARY
15187
15188 #if defined (HAVE_CONFIG_H)
15189@@ -130,12 +130,12 @@ sh_set_lines_and_columns (lines, cols)
15190 b = (char *)xmalloc (INT_STRLEN_BOUND (int) + 1);
15191 sprintf (b, "%d", lines);
15192 setenv ("LINES", b, 1);
15193- free (b);
15194+ xfree (b);
15195
15196 b = (char *)xmalloc (INT_STRLEN_BOUND (int) + 1);
15197 sprintf (b, "%d", cols);
15198 setenv ("COLUMNS", b, 1);
15199- free (b);
15200+ xfree (b);
15201 #else /* !HAVE_SETENV */
15202 # if defined (HAVE_PUTENV)
15203 b = (char *)xmalloc (INT_STRLEN_BOUND (int) + sizeof ("LINES=") + 1);
15204Index: gdb-7.2.90.20110703/readline/shlib/Makefile.in
15205===================================================================
15206--- gdb-7.2.90.20110703.orig/readline/shlib/Makefile.in 2011-07-03 10:40:53.000000000 +0200
15207+++ gdb-7.2.90.20110703/readline/shlib/Makefile.in 2011-07-03 10:41:21.000000000 +0200
15208@@ -1,21 +1,20 @@
15209 ## -*- text -*- ##
15210 # Makefile for the GNU readline library shared library support.
15211 #
15212-# Copyright (C) 1998-2003 Free Software Foundation, Inc.
15213+# Copyright (C) 1998-2009 Free Software Foundation, Inc.
15214
15215-# This program is free software; you can redistribute it and/or modify
15216-# it under the terms of the GNU General Public License as published by
15217-# the Free Software Foundation; either version 2, or (at your option)
15218-# any later version.
15219-
15220-# This program is distributed in the hope that it will be useful,
15221-# but WITHOUT ANY WARRANTY; without even the implied warranty of
15222-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15223-# GNU General Public License for more details.
15224-
15225-# You should have received a copy of the GNU General Public License
15226-# along with this program; if not, write to the Free Software
15227-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
15228+# This program is free software: you can redistribute it and/or modify
15229+# it under the terms of the GNU General Public License as published by
15230+# the Free Software Foundation, either version 3 of the License, or
15231+# (at your option) any later version.
15232+
15233+# This program is distributed in the hope that it will be useful,
15234+# but WITHOUT ANY WARRANTY; without even the implied warranty of
15235+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15236+# GNU General Public License for more details.
15237+
15238+# You should have received a copy of the GNU General Public License
15239+# along with this program. If not, see <http://www.gnu.org/licenses/>.
15240
15241 PACKAGE = @PACKAGE_NAME@
15242 VERSION = @PACKAGE_VERSION@
15243@@ -31,7 +30,7 @@ RL_LIBRARY_NAME = readline
15244 datarootdir = @datarootdir@
15245
15246 srcdir = @srcdir@
15247-VPATH = .:@top_srcdir@
15248+VPATH = @top_srcdir@
15249 topdir = @top_srcdir@
15250 BUILD_DIR = @BUILD_DIR@
15251
15252@@ -51,6 +50,7 @@ LN = ln
15253 SHELL = @MAKE_SHELL@
15254
15255 host_os = @host_os@
15256+host_vendor = @host_vendor@
15257
15258 prefix = @prefix@
15259 exec_prefix = @exec_prefix@
15260@@ -58,7 +58,7 @@ includedir = @includedir@
15261 bindir = @bindir@
15262 libdir = @libdir@
15263 datadir = @datadir@
15264-localedir = $(datadir)/locale
15265+localedir = @localedir@
15266
15267 # Support an alternate destination root directory for package building
15268 DESTDIR =
15269@@ -122,8 +122,6 @@ SHARED_READLINE = $(SHLIB_LIBPREF)readli
15270 SHARED_HISTORY = $(SHLIB_LIBPREF)history$(SHLIB_DOT)$(SHLIB_LIBVERSION)
15271 SHARED_LIBS = $(SHARED_READLINE) $(SHARED_HISTORY)
15272
15273-WCWIDTH_OBJ = @WCWIDTH_OBJ@
15274-
15275 # The C code source files for this library.
15276 CSOURCES = $(topdir)/readline.c $(topdir)/funmap.c $(topdir)/keymaps.c \
15277 $(topdir)/vi_mode.c $(topdir)/parens.c $(topdir)/rltty.c \
15278@@ -131,12 +129,12 @@ CSOURCES = $(topdir)/readline.c $(topdir
15279 $(topdir)/display.c $(topdir)/signals.c $(topdir)/emacs_keymap.c \
15280 $(topdir)/vi_keymap.c $(topdir)/util.c $(topdir)/kill.c \
15281 $(topdir)/undo.c $(topdir)/macro.c $(topdir)/input.c \
15282- $(topdir)/callback.c $(topdir)/terminal.c $(topdir)/xmalloc.c \
15283+ $(topdir)/callback.c $(topdir)/terminal.c $(topdir)/xmalloc.c $(topdir)/xfree.c \
15284 $(topdir)/history.c $(topdir)/histsearch.c $(topdir)/histexpand.c \
15285 $(topdir)/histfile.c $(topdir)/nls.c $(topdir)/search.c \
15286 $(topdir)/shell.c $(topdir)/savestring.c $(topdir)/tilde.c \
15287 $(topdir)/text.c $(topdir)/misc.c $(topdir)/compat.c \
15288- $(topdir)/mbutil.c $(topdir)/support/wcwidth.c
15289+ $(topdir)/mbutil.c
15290
15291 # The header files for this library.
15292 HSOURCES = readline.h rldefs.h chardefs.h keymaps.h history.h histlib.h \
15293@@ -149,8 +147,8 @@ SHARED_TILDEOBJ = tilde.so
15294 SHARED_OBJ = readline.so vi_mode.so funmap.so keymaps.so parens.so search.so \
15295 rltty.so complete.so bind.so isearch.so display.so signals.so \
15296 util.so kill.so undo.so macro.so input.so callback.so terminal.so \
15297- text.so nls.so misc.so xmalloc.so $(SHARED_HISTOBJ) $(SHARED_TILDEOBJ) \
15298- compat.so $(WCWIDTH_OBJ)
15299+ text.so nls.so misc.so xmalloc.so xfree.so $(SHARED_HISTOBJ) $(SHARED_TILDEOBJ) \
15300+ compat.so
15301
15302 ##########################################################################
15303
15304@@ -170,13 +168,9 @@ $(SHARED_READLINE): $(SHARED_OBJ)
15305 $(RM) $@
15306 $(SHOBJ_LD) ${SHOBJ_LDFLAGS} ${SHLIB_XLDFLAGS} -o $@ $(SHARED_OBJ) $(SHLIB_LIBS)
15307
15308-$(SHARED_HISTORY): $(SHARED_HISTOBJ) xmalloc.so
15309- $(RM) $@
15310- $(SHOBJ_LD) ${SHOBJ_LDFLAGS} ${SHLIB_XLDFLAGS} -o $@ $(SHARED_HISTOBJ) xmalloc.so $(SHLIB_LIBS)
15311-
15312-wcwidth.o: $(srcdir)/support/wcwidth.c
15313+$(SHARED_HISTORY): $(SHARED_HISTOBJ) xmalloc.so xfree.so
15314 $(RM) $@
15315- $(SHOBJ_CC) -c $(CCFLAGS) $(SHOBJ_FLAGS) $(srcdir)/support/wcwidth.c
15316+ $(SHOBJ_LD) ${SHOBJ_LDFLAGS} ${SHLIB_XLDFLAGS} -o $@ $(SHARED_HISTOBJ) xmalloc.so xfree.so $(SHLIB_LIBS)
15317
15318 # Since tilde.c is shared between readline and bash, make sure we compile
15319 # it with the right flags when it's built as part of readline
15320@@ -187,15 +181,16 @@ tilde.so: tilde.c
15321
15322 installdirs: $(topdir)/support/mkdirs
15323 -$(SHELL) $(topdir)/support/mkdirs $(DESTDIR)$(libdir)
15324+ -$(SHELL) $(topdir)/support/mkdirs $(DESTDIR)$(bindir)
15325
15326 install: installdirs $(SHLIB_STATUS)
15327- $(SHELL) $(topdir)/support/shlib-install -O $(host_os) -d $(DESTDIR)$(libdir) -b $(DESTDIR)$(bindir) -i "$(INSTALL_DATA)" $(SHARED_HISTORY)
15328- $(SHELL) $(topdir)/support/shlib-install -O $(host_os) -d $(DESTDIR)$(libdir) -b $(DESTDIR)$(bindir) -i "$(INSTALL_DATA)" $(SHARED_READLINE)
15329+ $(SHELL) $(topdir)/support/shlib-install -O $(host_os) -V $(host_vendor) -d $(DESTDIR)$(libdir) -b $(DESTDIR)$(bindir) -i "$(INSTALL_DATA)" $(SHARED_HISTORY)
15330+ $(SHELL) $(topdir)/support/shlib-install -O $(host_os) -V $(host_vendor) -d $(DESTDIR)$(libdir) -b $(DESTDIR)$(bindir) -i "$(INSTALL_DATA)" $(SHARED_READLINE)
15331 @echo install: you may need to run ldconfig
15332
15333 uninstall:
15334- $(SHELL) $(topdir)/support/shlib-install -O $(host_os) -d $(DESTDIR)$(libdir) -b $(DESTDIR)$(bindir) -U $(SHARED_HISTORY)
15335- $(SHELL) $(topdir)/support/shlib-install -O $(host_os) -d $(DESTDIR)$(libdir) -b $(DESTDIR)$(bindir) -U $(SHARED_READLINE)
15336+ $(SHELL) $(topdir)/support/shlib-install -O $(host_os) -V $(host_vendor) -d $(DESTDIR)$(libdir) -b $(DESTDIR)$(bindir) -U $(SHARED_HISTORY)
15337+ $(SHELL) $(topdir)/support/shlib-install -O $(host_os) -V $(host_vendor) -d $(DESTDIR)$(libdir) -b $(DESTDIR)$(bindir) -U $(SHARED_READLINE)
15338 @echo uninstall: you may need to run ldconfig
15339
15340 clean mostlyclean: force
15341@@ -322,6 +317,8 @@ vi_mode.so: $(topdir)/rldefs.h ${BUILD_D
15342 vi_mode.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h
15343 vi_mode.so: $(topdir)/history.h $(topdir)/ansi_stdlib.h $(topdir)/tilde.h
15344 vi_mode.so: $(topdir)/rltypedefs.h
15345+xfree.so: ${BUILD_DIR}/config.h
15346+xfree.so: $(topdir)/ansi_stdlib.h
15347 xmalloc.so: ${BUILD_DIR}/config.h
15348 xmalloc.so: $(topdir)/ansi_stdlib.h
15349
15350@@ -379,6 +376,7 @@ tilde.so: $(topdir)/xmalloc.h
15351 undo.so: $(topdir)/xmalloc.h
15352 util.so: $(topdir)/xmalloc.h
15353 vi_mode.so: $(topdir)/xmalloc.h
15354+xfree.so: $(topdir)/xmalloc.h
15355 xmalloc.so: $(topdir)/xmalloc.h
15356
15357 complete.o: $(topdir)/rlmbutil.h
15358@@ -420,6 +418,7 @@ tilde.so: $(topdir)/tilde.c
15359 undo.so: $(topdir)/undo.c
15360 util.so: $(topdir)/util.c
15361 vi_mode.so: $(topdir)/vi_mode.c
15362+xfree.so: $(topdir)/xfree.c
15363 xmalloc.so: $(topdir)/xmalloc.c
15364
15365 histexpand.so: $(topdir)/histexpand.c
15366@@ -454,6 +453,7 @@ tilde.so: tilde.c
15367 undo.so: undo.c
15368 util.so: util.c
15369 vi_mode.so: vi_mode.c
15370+xfree.so: xfree.c
15371 xmalloc.so: xmalloc.c
15372
15373 histexpand.so: histexpand.c
15374Index: gdb-7.2.90.20110703/readline/signals.c
15375===================================================================
15376--- gdb-7.2.90.20110703.orig/readline/signals.c 2011-07-03 10:40:53.000000000 +0200
15377+++ gdb-7.2.90.20110703/readline/signals.c 2011-07-03 10:41:21.000000000 +0200
15378@@ -1,24 +1,24 @@
15379 /* signals.c -- signal handling support for readline. */
15380
15381-/* Copyright (C) 1987-2005 Free Software Foundation, Inc.
15382+/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
15383
15384- This file is part of the GNU Readline Library, a library for
15385- reading lines of text with interactive input and history editing.
15386+ This file is part of the GNU Readline Library (Readline), a library
15387+ for reading lines of text with interactive input and history editing.
15388
15389- The GNU Readline Library is free software; you can redistribute it
15390- and/or modify it under the terms of the GNU General Public License
15391- as published by the Free Software Foundation; either version 2, or
15392+ Readline is free software: you can redistribute it and/or modify
15393+ it under the terms of the GNU General Public License as published by
15394+ the Free Software Foundation, either version 3 of the License, or
15395 (at your option) any later version.
15396
15397- The GNU Readline Library is distributed in the hope that it will be
15398- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
15399- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15400+ Readline is distributed in the hope that it will be useful,
15401+ but WITHOUT ANY WARRANTY; without even the implied warranty of
15402+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15403 GNU General Public License for more details.
15404
15405- The GNU General Public License is often shipped with GNU software, and
15406- is generally kept in a file called COPYING or LICENSE. If you do not
15407- have a copy of the license, write to the Free Software Foundation,
15408- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
15409+ You should have received a copy of the GNU General Public License
15410+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
15411+*/
15412+
15413 #define READLINE_LIBRARY
15414
15415 #if defined (HAVE_CONFIG_H)
15416@@ -40,13 +40,14 @@
15417 # include <sys/ioctl.h>
15418 #endif /* GWINSZ_IN_SYS_IOCTL */
15419
15420-#if defined (HANDLE_SIGNALS)
15421 /* Some standard library routines. */
15422 #include "readline.h"
15423 #include "history.h"
15424
15425 #include "rlprivate.h"
15426
15427+#if defined (HANDLE_SIGNALS)
15428+
15429 #if !defined (RETSIGTYPE)
15430 # if defined (VOID_SIGHANDLER)
15431 # define RETSIGTYPE void
15432@@ -80,6 +81,9 @@ typedef struct { SigHandler *sa_handler;
15433 static SigHandler *rl_set_sighandler PARAMS((int, SigHandler *, sighandler_cxt *));
15434 static void rl_maybe_set_sighandler PARAMS((int, SigHandler *, sighandler_cxt *));
15435
15436+static RETSIGTYPE rl_signal_handler PARAMS((int));
15437+static RETSIGTYPE _rl_handle_signal PARAMS((int));
15438+
15439 /* Exported variables for use by applications. */
15440
15441 /* If non-zero, readline will install its own signal handlers for
15442@@ -93,6 +97,18 @@ int rl_catch_sigwinch = 1;
15443 int rl_catch_sigwinch = 0; /* for the readline state struct in readline.c */
15444 #endif
15445
15446+/* Private variables. */
15447+int _rl_interrupt_immediately = 0;
15448+int volatile _rl_caught_signal = 0; /* should be sig_atomic_t, but that requires including <signal.h> everywhere */
15449+
15450+/* If non-zero, print characters corresponding to received signals as long as
15451+ the user has indicated his desire to do so (_rl_echo_control_chars). */
15452+int _rl_echoctl = 0;
15453+
15454+int _rl_intr_char = 0;
15455+int _rl_quit_char = 0;
15456+int _rl_susp_char = 0;
15457+
15458 static int signals_set_flag;
15459 static int sigwinch_set_flag;
15460
15461@@ -112,10 +128,36 @@ static sighandler_cxt old_winch;
15462
15463 /* Readline signal handler functions. */
15464
15465+/* Called from RL_CHECK_SIGNALS() macro */
15466+RETSIGTYPE
15467+_rl_signal_handler (sig)
15468+ int sig;
15469+{
15470+ _rl_caught_signal = 0; /* XXX */
15471+
15472+ _rl_handle_signal (sig);
15473+ SIGHANDLER_RETURN;
15474+}
15475+
15476 static RETSIGTYPE
15477 rl_signal_handler (sig)
15478 int sig;
15479 {
15480+ if (_rl_interrupt_immediately || RL_ISSTATE(RL_STATE_CALLBACK))
15481+ {
15482+ _rl_interrupt_immediately = 0;
15483+ _rl_handle_signal (sig);
15484+ }
15485+ else
15486+ _rl_caught_signal = sig;
15487+
15488+ SIGHANDLER_RETURN;
15489+}
15490+
15491+static RETSIGTYPE
15492+_rl_handle_signal (sig)
15493+ int sig;
15494+{
15495 #if defined (HAVE_POSIX_SIGNALS)
15496 sigset_t set;
15497 #else /* !HAVE_POSIX_SIGNALS */
15498@@ -142,6 +184,7 @@ rl_signal_handler (sig)
15499 switch (sig)
15500 {
15501 case SIGINT:
15502+ _rl_reset_completion_state ();
15503 rl_free_line_state ();
15504 /* FALLTHROUGH */
15505
15506@@ -157,9 +200,11 @@ rl_signal_handler (sig)
15507 #if defined (SIGQUIT)
15508 case SIGQUIT:
15509 #endif
15510+ rl_echo_signal_char (sig);
15511 rl_cleanup_after_signal ();
15512
15513 #if defined (HAVE_POSIX_SIGNALS)
15514+ sigemptyset (&set);
15515 sigprocmask (SIG_BLOCK, (sigset_t *)NULL, &set);
15516 sigdelset (&set, sig);
15517 #else /* !HAVE_POSIX_SIGNALS */
15518@@ -251,11 +296,11 @@ rl_set_sighandler (sig, handler, ohandle
15519 struct sigaction act;
15520
15521 act.sa_handler = handler;
15522-#if defined (SIGWINCH)
15523+# if defined (SIGWINCH)
15524 act.sa_flags = (sig == SIGWINCH) ? SA_RESTART : 0;
15525-#else
15526+# else
15527 act.sa_flags = 0;
15528-#endif
15529+# endif /* SIGWINCH */
15530 sigemptyset (&act.sa_mask);
15531 sigemptyset (&ohandler->sa_mask);
15532 sigaction (sig, &act, &old_handler);
15533@@ -292,9 +337,44 @@ rl_set_signals ()
15534 {
15535 sighandler_cxt dummy;
15536 SigHandler *oh;
15537+#if defined (HAVE_POSIX_SIGNALS)
15538+ static int sigmask_set = 0;
15539+ static sigset_t bset, oset;
15540+#endif
15541+
15542+#if defined (HAVE_POSIX_SIGNALS)
15543+ if (rl_catch_signals && sigmask_set == 0)
15544+ {
15545+ sigemptyset (&bset);
15546+
15547+ sigaddset (&bset, SIGINT);
15548+ sigaddset (&bset, SIGTERM);
15549+#if defined (SIGQUIT)
15550+ sigaddset (&bset, SIGQUIT);
15551+#endif
15552+#if defined (SIGALRM)
15553+ sigaddset (&bset, SIGALRM);
15554+#endif
15555+#if defined (SIGTSTP)
15556+ sigaddset (&bset, SIGTSTP);
15557+#endif
15558+#if defined (SIGTTIN)
15559+ sigaddset (&bset, SIGTTIN);
15560+#endif
15561+#if defined (SIGTTOU)
15562+ sigaddset (&bset, SIGTTOU);
15563+#endif
15564+ sigmask_set = 1;
15565+ }
15566+#endif /* HAVE_POSIX_SIGNALS */
15567
15568 if (rl_catch_signals && signals_set_flag == 0)
15569 {
15570+#if defined (HAVE_POSIX_SIGNALS)
15571+ sigemptyset (&oset);
15572+ sigprocmask (SIG_BLOCK, &bset, &oset);
15573+#endif
15574+
15575 rl_maybe_set_sighandler (SIGINT, rl_signal_handler, &old_int);
15576 rl_maybe_set_sighandler (SIGTERM, rl_signal_handler, &old_term);
15577 #if defined (SIGQUIT)
15578@@ -328,6 +408,10 @@ rl_set_signals ()
15579 #endif /* SIGTTIN */
15580
15581 signals_set_flag = 1;
15582+
15583+#if defined (HAVE_POSIX_SIGNALS)
15584+ sigprocmask (SIG_SETMASK, &oset, (sigset_t *)NULL);
15585+#endif
15586 }
15587
15588 #if defined (SIGWINCH)
15589@@ -394,8 +478,8 @@ rl_cleanup_after_signal ()
15590 _rl_clean_up_for_exit ();
15591 if (rl_deprep_term_function)
15592 (*rl_deprep_term_function) ();
15593- rl_clear_signals ();
15594 rl_clear_pending_input ();
15595+ rl_clear_signals ();
15596 }
15597
15598 /* Reset the terminal and readline state after a signal handler returns. */
15599@@ -428,3 +512,160 @@ rl_free_line_state ()
15600 }
15601
15602 #endif /* HANDLE_SIGNALS */
15603+
15604+/* **************************************************************** */
15605+/* */
15606+/* SIGINT Management */
15607+/* */
15608+/* **************************************************************** */
15609+
15610+#if defined (HAVE_POSIX_SIGNALS)
15611+static sigset_t sigint_set, sigint_oset;
15612+static sigset_t sigwinch_set, sigwinch_oset;
15613+#else /* !HAVE_POSIX_SIGNALS */
15614+# if defined (HAVE_BSD_SIGNALS)
15615+static int sigint_oldmask;
15616+static int sigwinch_oldmask;
15617+# endif /* HAVE_BSD_SIGNALS */
15618+#endif /* !HAVE_POSIX_SIGNALS */
15619+
15620+static int sigint_blocked;
15621+static int sigwinch_blocked;
15622+
15623+/* Cause SIGINT to not be delivered until the corresponding call to
15624+ release_sigint(). */
15625+void
15626+_rl_block_sigint ()
15627+{
15628+ if (sigint_blocked)
15629+ return;
15630+
15631+#if defined (HAVE_POSIX_SIGNALS)
15632+ sigemptyset (&sigint_set);
15633+ sigemptyset (&sigint_oset);
15634+ sigaddset (&sigint_set, SIGINT);
15635+ sigprocmask (SIG_BLOCK, &sigint_set, &sigint_oset);
15636+#else /* !HAVE_POSIX_SIGNALS */
15637+# if defined (HAVE_BSD_SIGNALS)
15638+ sigint_oldmask = sigblock (sigmask (SIGINT));
15639+# else /* !HAVE_BSD_SIGNALS */
15640+# if defined (HAVE_USG_SIGHOLD)
15641+ sighold (SIGINT);
15642+# endif /* HAVE_USG_SIGHOLD */
15643+# endif /* !HAVE_BSD_SIGNALS */
15644+#endif /* !HAVE_POSIX_SIGNALS */
15645+
15646+ sigint_blocked = 1;
15647+}
15648+
15649+/* Allow SIGINT to be delivered. */
15650+void
15651+_rl_release_sigint ()
15652+{
15653+ if (sigint_blocked == 0)
15654+ return;
15655+
15656+#if defined (HAVE_POSIX_SIGNALS)
15657+ sigprocmask (SIG_SETMASK, &sigint_oset, (sigset_t *)NULL);
15658+#else
15659+# if defined (HAVE_BSD_SIGNALS)
15660+ sigsetmask (sigint_oldmask);
15661+# else /* !HAVE_BSD_SIGNALS */
15662+# if defined (HAVE_USG_SIGHOLD)
15663+ sigrelse (SIGINT);
15664+# endif /* HAVE_USG_SIGHOLD */
15665+# endif /* !HAVE_BSD_SIGNALS */
15666+#endif /* !HAVE_POSIX_SIGNALS */
15667+
15668+ sigint_blocked = 0;
15669+}
15670+
15671+/* Cause SIGWINCH to not be delivered until the corresponding call to
15672+ release_sigwinch(). */
15673+void
15674+_rl_block_sigwinch ()
15675+{
15676+ if (sigwinch_blocked)
15677+ return;
15678+
15679+#if defined (HAVE_POSIX_SIGNALS)
15680+ sigemptyset (&sigwinch_set);
15681+ sigemptyset (&sigwinch_oset);
15682+ sigaddset (&sigwinch_set, SIGWINCH);
15683+ sigprocmask (SIG_BLOCK, &sigwinch_set, &sigwinch_oset);
15684+#else /* !HAVE_POSIX_SIGNALS */
15685+# if defined (HAVE_BSD_SIGNALS)
15686+ sigwinch_oldmask = sigblock (sigmask (SIGWINCH));
15687+# else /* !HAVE_BSD_SIGNALS */
15688+# if defined (HAVE_USG_SIGHOLD)
15689+ sighold (SIGWINCH);
15690+# endif /* HAVE_USG_SIGHOLD */
15691+# endif /* !HAVE_BSD_SIGNALS */
15692+#endif /* !HAVE_POSIX_SIGNALS */
15693+
15694+ sigwinch_blocked = 1;
15695+}
15696+
15697+/* Allow SIGWINCH to be delivered. */
15698+void
15699+_rl_release_sigwinch ()
15700+{
15701+ if (sigwinch_blocked == 0)
15702+ return;
15703+
15704+#if defined (HAVE_POSIX_SIGNALS)
15705+ sigprocmask (SIG_SETMASK, &sigwinch_oset, (sigset_t *)NULL);
15706+#else
15707+# if defined (HAVE_BSD_SIGNALS)
15708+ sigsetmask (sigwinch_oldmask);
15709+# else /* !HAVE_BSD_SIGNALS */
15710+# if defined (HAVE_USG_SIGHOLD)
15711+ sigrelse (SIGWINCH);
15712+# endif /* HAVE_USG_SIGHOLD */
15713+# endif /* !HAVE_BSD_SIGNALS */
15714+#endif /* !HAVE_POSIX_SIGNALS */
15715+
15716+ sigwinch_blocked = 0;
15717+}
15718+
15719+/* **************************************************************** */
15720+/* */
15721+/* Echoing special control characters */
15722+/* */
15723+/* **************************************************************** */
15724+void
15725+rl_echo_signal_char (sig)
15726+ int sig;
15727+{
15728+ char cstr[3];
15729+ int cslen, c;
15730+
15731+ if (_rl_echoctl == 0 || _rl_echo_control_chars == 0)
15732+ return;
15733+
15734+ switch (sig)
15735+ {
15736+ case SIGINT: c = _rl_intr_char; break;
15737+#if defined (SIGQUIT)
15738+ case SIGQUIT: c = _rl_quit_char; break;
15739+#endif
15740+#if defined (SIGTSTP)
15741+ case SIGTSTP: c = _rl_susp_char; break;
15742+#endif
15743+ default: return;
15744+ }
15745+
15746+ if (CTRL_CHAR (c) || c == RUBOUT)
15747+ {
15748+ cstr[0] = '^';
15749+ cstr[1] = CTRL_CHAR (c) ? UNCTRL (c) : '?';
15750+ cstr[cslen = 2] = '\0';
15751+ }
15752+ else
15753+ {
15754+ cstr[0] = c;
15755+ cstr[cslen = 1] = '\0';
15756+ }
15757+
15758+ _rl_output_some_chars (cstr, cslen);
15759+}
15760Index: gdb-7.2.90.20110703/readline/support/config.guess
15761===================================================================
15762--- gdb-7.2.90.20110703.orig/readline/support/config.guess 2011-07-03 10:40:53.000000000 +0200
15763+++ gdb-7.2.90.20110703/readline/support/config.guess 2011-07-03 10:41:21.000000000 +0200
15764@@ -1,9 +1,10 @@
15765 #! /bin/sh
15766 # Attempt to guess a canonical system name.
15767 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
15768-# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
15769+# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
15770+# Free Software Foundation, Inc.
15771
15772-timestamp='2004-02-16'
15773+timestamp='2008-03-12'
15774
15775 # This file is free software; you can redistribute it and/or modify it
15776 # under the terms of the GNU General Public License as published by
15777@@ -17,13 +18,15 @@ timestamp='2004-02-16'
15778 #
15779 # You should have received a copy of the GNU General Public License
15780 # along with this program; if not, write to the Free Software
15781-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15782+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
15783+# 02110-1301, USA.
15784 #
15785 # As a special exception to the GNU General Public License, if you
15786 # distribute this file as part of a program that contains a
15787 # configuration script generated by Autoconf, you may include it under
15788 # the same distribution terms that you use for the rest of that program.
15789
15790+
15791 # Originally written by Per Bothner <per@bothner.com>.
15792 # Please send patches to <config-patches@gnu.org>. Submit a context
15793 # diff and a properly formatted ChangeLog entry.
15794@@ -53,8 +56,8 @@ version="\
15795 GNU config.guess ($timestamp)
15796
15797 Originally written by Per Bothner.
15798-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
15799-Free Software Foundation, Inc.
15800+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
15801+2002, 2003, 2004, 2005, 2006, 2007, 2008,2009 Free Software Foundation, Inc.
15802
15803 This is free software; see the source for copying conditions. There is NO
15804 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
15805@@ -66,11 +69,11 @@ Try \`$me --help' for more information."
15806 while test $# -gt 0 ; do
15807 case $1 in
15808 --time-stamp | --time* | -t )
15809- echo "$timestamp" ; exit 0 ;;
15810+ echo "$timestamp" ; exit ;;
15811 --version | -v )
15812- echo "$version" ; exit 0 ;;
15813+ echo "$version" ; exit ;;
15814 --help | --h* | -h )
15815- echo "$usage"; exit 0 ;;
15816+ echo "$usage"; exit ;;
15817 -- ) # Stop option processing
15818 shift; break ;;
15819 - ) # Use stdin as input.
15820@@ -104,7 +107,7 @@ set_cc_for_build='
15821 trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
15822 trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
15823 : ${TMPDIR=/tmp} ;
15824- { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
15825+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
15826 { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
15827 { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
15828 { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
15829@@ -123,7 +126,7 @@ case $CC_FOR_BUILD,$HOST_CC,$CC in
15830 ;;
15831 ,,*) CC_FOR_BUILD=$CC ;;
15832 ,*,*) CC_FOR_BUILD=$HOST_CC ;;
15833-esac ;'
15834+esac ; set_cc_for_build= ;'
15835
15836 # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
15837 # (ghazi@noc.rutgers.edu 1994-08-24)
15838@@ -158,6 +161,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$
15839 arm*) machine=arm-unknown ;;
15840 sh3el) machine=shl-unknown ;;
15841 sh3eb) machine=sh-unknown ;;
15842+ sh5el) machine=sh5le-unknown ;;
15843 *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
15844 esac
15845 # The Operating System including object format, if it has switched
15846@@ -196,68 +200,32 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$
15847 # contains redundant information, the shorter form:
15848 # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
15849 echo "${machine}-${os}${release}"
15850- exit 0 ;;
15851- amd64:OpenBSD:*:*)
15852- echo x86_64-unknown-openbsd${UNAME_RELEASE}
15853- exit 0 ;;
15854- amiga:OpenBSD:*:*)
15855- echo m68k-unknown-openbsd${UNAME_RELEASE}
15856- exit 0 ;;
15857- arc:OpenBSD:*:*)
15858- echo mipsel-unknown-openbsd${UNAME_RELEASE}
15859- exit 0 ;;
15860- cats:OpenBSD:*:*)
15861- echo arm-unknown-openbsd${UNAME_RELEASE}
15862- exit 0 ;;
15863- hp300:OpenBSD:*:*)
15864- echo m68k-unknown-openbsd${UNAME_RELEASE}
15865- exit 0 ;;
15866- mac68k:OpenBSD:*:*)
15867- echo m68k-unknown-openbsd${UNAME_RELEASE}
15868- exit 0 ;;
15869- macppc:OpenBSD:*:*)
15870- echo powerpc-unknown-openbsd${UNAME_RELEASE}
15871- exit 0 ;;
15872- mvme68k:OpenBSD:*:*)
15873- echo m68k-unknown-openbsd${UNAME_RELEASE}
15874- exit 0 ;;
15875- mvme88k:OpenBSD:*:*)
15876- echo m88k-unknown-openbsd${UNAME_RELEASE}
15877- exit 0 ;;
15878- mvmeppc:OpenBSD:*:*)
15879- echo powerpc-unknown-openbsd${UNAME_RELEASE}
15880- exit 0 ;;
15881- pegasos:OpenBSD:*:*)
15882- echo powerpc-unknown-openbsd${UNAME_RELEASE}
15883- exit 0 ;;
15884- pmax:OpenBSD:*:*)
15885- echo mipsel-unknown-openbsd${UNAME_RELEASE}
15886- exit 0 ;;
15887- sgi:OpenBSD:*:*)
15888- echo mipseb-unknown-openbsd${UNAME_RELEASE}
15889- exit 0 ;;
15890- sun3:OpenBSD:*:*)
15891- echo m68k-unknown-openbsd${UNAME_RELEASE}
15892- exit 0 ;;
15893- wgrisc:OpenBSD:*:*)
15894- echo mipsel-unknown-openbsd${UNAME_RELEASE}
15895- exit 0 ;;
15896+ exit ;;
15897 *:OpenBSD:*:*)
15898- echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
15899- exit 0 ;;
15900+ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
15901+ echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
15902+ exit ;;
15903 *:ekkoBSD:*:*)
15904 echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
15905- exit 0 ;;
15906+ exit ;;
15907+ *:SolidBSD:*:*)
15908+ echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
15909+ exit ;;
15910 macppc:MirBSD:*:*)
15911- echo powerppc-unknown-mirbsd${UNAME_RELEASE}
15912- exit 0 ;;
15913+ echo powerpc-unknown-mirbsd${UNAME_RELEASE}
15914+ exit ;;
15915 *:MirBSD:*:*)
15916 echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
15917- exit 0 ;;
15918+ exit ;;
15919 alpha:OSF1:*:*)
15920- if test $UNAME_RELEASE = "V4.0"; then
15921+ case $UNAME_RELEASE in
15922+ *4.0)
15923 UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
15924- fi
15925+ ;;
15926+ *5.*)
15927+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
15928+ ;;
15929+ esac
15930 # According to Compaq, /usr/sbin/psrinfo has been available on
15931 # OSF/1 and Tru64 systems produced since 1995. I hope that
15932 # covers most systems running today. This code pipes the CPU
15933@@ -295,45 +263,49 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$
15934 "EV7.9 (21364A)")
15935 UNAME_MACHINE="alphaev79" ;;
15936 esac
15937+ # A Pn.n version is a patched version.
15938 # A Vn.n version is a released version.
15939 # A Tn.n version is a released field test version.
15940 # A Xn.n version is an unreleased experimental baselevel.
15941 # 1.2 uses "1.2" for uname -r.
15942- echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
15943- exit 0 ;;
15944- Alpha*:OpenVMS:*:*)
15945- echo alpha-hp-vms
15946- exit 0 ;;
15947+ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
15948+ exit ;;
15949 Alpha\ *:Windows_NT*:*)
15950 # How do we know it's Interix rather than the generic POSIX subsystem?
15951 # Should we change UNAME_MACHINE based on the output of uname instead
15952 # of the specific Alpha model?
15953 echo alpha-pc-interix
15954- exit 0 ;;
15955+ exit ;;
15956 21064:Windows_NT:50:3)
15957 echo alpha-dec-winnt3.5
15958- exit 0 ;;
15959+ exit ;;
15960 Amiga*:UNIX_System_V:4.0:*)
15961 echo m68k-unknown-sysv4
15962- exit 0;;
15963+ exit ;;
15964 *:[Aa]miga[Oo][Ss]:*:*)
15965 echo ${UNAME_MACHINE}-unknown-amigaos
15966- exit 0 ;;
15967+ exit ;;
15968 *:[Mm]orph[Oo][Ss]:*:*)
15969 echo ${UNAME_MACHINE}-unknown-morphos
15970- exit 0 ;;
15971+ exit ;;
15972 *:OS/390:*:*)
15973 echo i370-ibm-openedition
15974- exit 0 ;;
15975+ exit ;;
15976+ *:z/VM:*:*)
15977+ echo s390-ibm-zvmoe
15978+ exit ;;
15979 *:OS400:*:*)
15980 echo powerpc-ibm-os400
15981- exit 0 ;;
15982+ exit ;;
15983 arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
15984 echo arm-acorn-riscix${UNAME_RELEASE}
15985- exit 0;;
15986+ exit ;;
15987+ arm:riscos:*:*|arm:RISCOS:*:*)
15988+ echo arm-unknown-riscos
15989+ exit ;;
15990 SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
15991 echo hppa1.1-hitachi-hiuxmpp
15992- exit 0;;
15993+ exit ;;
15994 Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
15995 # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
15996 if test "`(/bin/universe) 2>/dev/null`" = att ; then
15997@@ -341,32 +313,32 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$
15998 else
15999 echo pyramid-pyramid-bsd
16000 fi
16001- exit 0 ;;
16002+ exit ;;
16003 NILE*:*:*:dcosx)
16004 echo pyramid-pyramid-svr4
16005- exit 0 ;;
16006+ exit ;;
16007 DRS?6000:unix:4.0:6*)
16008 echo sparc-icl-nx6
16009- exit 0 ;;
16010- DRS?6000:UNIX_SV:4.2*:7*)
16011+ exit ;;
16012+ DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
16013 case `/usr/bin/uname -p` in
16014- sparc) echo sparc-icl-nx7 && exit 0 ;;
16015+ sparc) echo sparc-icl-nx7; exit ;;
16016 esac ;;
16017 sun4H:SunOS:5.*:*)
16018 echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
16019- exit 0 ;;
16020+ exit ;;
16021 sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
16022 echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
16023- exit 0 ;;
16024- i86pc:SunOS:5.*:*)
16025+ exit ;;
16026+ i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
16027 echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
16028- exit 0 ;;
16029+ exit ;;
16030 sun4*:SunOS:6*:*)
16031 # According to config.sub, this is the proper way to canonicalize
16032 # SunOS6. Hard to guess exactly what SunOS6 will be like, but
16033 # it's likely to be more like Solaris than SunOS4.
16034 echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
16035- exit 0 ;;
16036+ exit ;;
16037 sun4*:SunOS:*:*)
16038 case "`/usr/bin/arch -k`" in
16039 Series*|S4*)
16040@@ -375,10 +347,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$
16041 esac
16042 # Japanese Language versions have a version number like `4.1.3-JL'.
16043 echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
16044- exit 0 ;;
16045+ exit ;;
16046 sun3*:SunOS:*:*)
16047 echo m68k-sun-sunos${UNAME_RELEASE}
16048- exit 0 ;;
16049+ exit ;;
16050 sun*:*:4.2BSD:*)
16051 UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
16052 test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
16053@@ -390,10 +362,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$
16054 echo sparc-sun-sunos${UNAME_RELEASE}
16055 ;;
16056 esac
16057- exit 0 ;;
16058+ exit ;;
16059 aushp:SunOS:*:*)
16060 echo sparc-auspex-sunos${UNAME_RELEASE}
16061- exit 0 ;;
16062+ exit ;;
16063 # The situation for MiNT is a little confusing. The machine name
16064 # can be virtually everything (everything which is not
16065 # "atarist" or "atariste" at least should have a processor
16066@@ -404,40 +376,40 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$
16067 # be no problem.
16068 atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
16069 echo m68k-atari-mint${UNAME_RELEASE}
16070- exit 0 ;;
16071+ exit ;;
16072 atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
16073 echo m68k-atari-mint${UNAME_RELEASE}
16074- exit 0 ;;
16075+ exit ;;
16076 *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
16077 echo m68k-atari-mint${UNAME_RELEASE}
16078- exit 0 ;;
16079+ exit ;;
16080 milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
16081 echo m68k-milan-mint${UNAME_RELEASE}
16082- exit 0 ;;
16083+ exit ;;
16084 hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
16085 echo m68k-hades-mint${UNAME_RELEASE}
16086- exit 0 ;;
16087+ exit ;;
16088 *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
16089 echo m68k-unknown-mint${UNAME_RELEASE}
16090- exit 0 ;;
16091+ exit ;;
16092 m68k:machten:*:*)
16093 echo m68k-apple-machten${UNAME_RELEASE}
16094- exit 0 ;;
16095+ exit ;;
16096 powerpc:machten:*:*)
16097 echo powerpc-apple-machten${UNAME_RELEASE}
16098- exit 0 ;;
16099+ exit ;;
16100 RISC*:Mach:*:*)
16101 echo mips-dec-mach_bsd4.3
16102- exit 0 ;;
16103+ exit ;;
16104 RISC*:ULTRIX:*:*)
16105 echo mips-dec-ultrix${UNAME_RELEASE}
16106- exit 0 ;;
16107+ exit ;;
16108 VAX*:ULTRIX*:*:*)
16109 echo vax-dec-ultrix${UNAME_RELEASE}
16110- exit 0 ;;
16111+ exit ;;
16112 2020:CLIX:*:* | 2430:CLIX:*:*)
16113 echo clipper-intergraph-clix${UNAME_RELEASE}
16114- exit 0 ;;
16115+ exit ;;
16116 mips:*:*:UMIPS | mips:*:*:RISCos)
16117 eval $set_cc_for_build
16118 sed 's/^ //' << EOF >$dummy.c
16119@@ -461,32 +433,33 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$
16120 exit (-1);
16121 }
16122 EOF
16123- $CC_FOR_BUILD -o $dummy $dummy.c \
16124- && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
16125- && exit 0
16126+ $CC_FOR_BUILD -o $dummy $dummy.c &&
16127+ dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
16128+ SYSTEM_NAME=`$dummy $dummyarg` &&
16129+ { echo "$SYSTEM_NAME"; exit; }
16130 echo mips-mips-riscos${UNAME_RELEASE}
16131- exit 0 ;;
16132+ exit ;;
16133 Motorola:PowerMAX_OS:*:*)
16134 echo powerpc-motorola-powermax
16135- exit 0 ;;
16136+ exit ;;
16137 Motorola:*:4.3:PL8-*)
16138 echo powerpc-harris-powermax
16139- exit 0 ;;
16140+ exit ;;
16141 Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
16142 echo powerpc-harris-powermax
16143- exit 0 ;;
16144+ exit ;;
16145 Night_Hawk:Power_UNIX:*:*)
16146 echo powerpc-harris-powerunix
16147- exit 0 ;;
16148+ exit ;;
16149 m88k:CX/UX:7*:*)
16150 echo m88k-harris-cxux7
16151- exit 0 ;;
16152+ exit ;;
16153 m88k:*:4*:R4*)
16154 echo m88k-motorola-sysv4
16155- exit 0 ;;
16156+ exit ;;
16157 m88k:*:3*:R3*)
16158 echo m88k-motorola-sysv3
16159- exit 0 ;;
16160+ exit ;;
16161 AViiON:dgux:*:*)
16162 # DG/UX returns AViiON for all architectures
16163 UNAME_PROCESSOR=`/usr/bin/uname -p`
16164@@ -502,29 +475,29 @@ EOF
16165 else
16166 echo i586-dg-dgux${UNAME_RELEASE}
16167 fi
16168- exit 0 ;;
16169+ exit ;;
16170 M88*:DolphinOS:*:*) # DolphinOS (SVR3)
16171 echo m88k-dolphin-sysv3
16172- exit 0 ;;
16173+ exit ;;
16174 M88*:*:R3*:*)
16175 # Delta 88k system running SVR3
16176 echo m88k-motorola-sysv3
16177- exit 0 ;;
16178+ exit ;;
16179 XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
16180 echo m88k-tektronix-sysv3
16181- exit 0 ;;
16182+ exit ;;
16183 Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
16184 echo m68k-tektronix-bsd
16185- exit 0 ;;
16186+ exit ;;
16187 *:IRIX*:*:*)
16188 echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
16189- exit 0 ;;
16190+ exit ;;
16191 ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
16192- echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
16193- exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
16194+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
16195+ exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
16196 i*86:AIX:*:*)
16197 echo i386-ibm-aix
16198- exit 0 ;;
16199+ exit ;;
16200 ia64:AIX:*:*)
16201 if [ -x /usr/bin/oslevel ] ; then
16202 IBM_REV=`/usr/bin/oslevel`
16203@@ -532,7 +505,7 @@ EOF
16204 IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
16205 fi
16206 echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
16207- exit 0 ;;
16208+ exit ;;
16209 *:AIX:2:3)
16210 if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
16211 eval $set_cc_for_build
16212@@ -547,15 +520,19 @@ EOF
16213 exit(0);
16214 }
16215 EOF
16216- $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
16217- echo rs6000-ibm-aix3.2.5
16218+ if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
16219+ then
16220+ echo "$SYSTEM_NAME"
16221+ else
16222+ echo rs6000-ibm-aix3.2.5
16223+ fi
16224 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
16225 echo rs6000-ibm-aix3.2.4
16226 else
16227 echo rs6000-ibm-aix3.2
16228 fi
16229- exit 0 ;;
16230- *:AIX:*:[45])
16231+ exit ;;
16232+ *:AIX:*:[456])
16233 IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
16234 if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
16235 IBM_ARCH=rs6000
16236@@ -568,28 +545,28 @@ EOF
16237 IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
16238 fi
16239 echo ${IBM_ARCH}-ibm-aix${IBM_REV}
16240- exit 0 ;;
16241+ exit ;;
16242 *:AIX:*:*)
16243 echo rs6000-ibm-aix
16244- exit 0 ;;
16245+ exit ;;
16246 ibmrt:4.4BSD:*|romp-ibm:BSD:*)
16247 echo romp-ibm-bsd4.4
16248- exit 0 ;;
16249+ exit ;;
16250 ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
16251 echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
16252- exit 0 ;; # report: romp-ibm BSD 4.3
16253+ exit ;; # report: romp-ibm BSD 4.3
16254 *:BOSX:*:*)
16255 echo rs6000-bull-bosx
16256- exit 0 ;;
16257+ exit ;;
16258 DPX/2?00:B.O.S.:*:*)
16259 echo m68k-bull-sysv3
16260- exit 0 ;;
16261+ exit ;;
16262 9000/[34]??:4.3bsd:1.*:*)
16263 echo m68k-hp-bsd
16264- exit 0 ;;
16265+ exit ;;
16266 hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
16267 echo m68k-hp-bsd4.4
16268- exit 0 ;;
16269+ exit ;;
16270 9000/[34678]??:HP-UX:*:*)
16271 HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
16272 case "${UNAME_MACHINE}" in
16273@@ -651,9 +628,19 @@ EOF
16274 esac
16275 if [ ${HP_ARCH} = "hppa2.0w" ]
16276 then
16277- # avoid double evaluation of $set_cc_for_build
16278- test -n "$CC_FOR_BUILD" || eval $set_cc_for_build
16279- if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null
16280+ eval $set_cc_for_build
16281+
16282+ # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
16283+ # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
16284+ # generating 64-bit code. GNU and HP use different nomenclature:
16285+ #
16286+ # $ CC_FOR_BUILD=cc ./config.guess
16287+ # => hppa2.0w-hp-hpux11.23
16288+ # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
16289+ # => hppa64-hp-hpux11.23
16290+
16291+ if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
16292+ grep __LP64__ >/dev/null
16293 then
16294 HP_ARCH="hppa2.0w"
16295 else
16296@@ -661,11 +648,11 @@ EOF
16297 fi
16298 fi
16299 echo ${HP_ARCH}-hp-hpux${HPUX_REV}
16300- exit 0 ;;
16301+ exit ;;
16302 ia64:HP-UX:*:*)
16303 HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
16304 echo ia64-hp-hpux${HPUX_REV}
16305- exit 0 ;;
16306+ exit ;;
16307 3050*:HI-UX:*:*)
16308 eval $set_cc_for_build
16309 sed 's/^ //' << EOF >$dummy.c
16310@@ -693,163 +680,192 @@ EOF
16311 exit (0);
16312 }
16313 EOF
16314- $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
16315+ $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
16316+ { echo "$SYSTEM_NAME"; exit; }
16317 echo unknown-hitachi-hiuxwe2
16318- exit 0 ;;
16319+ exit ;;
16320 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
16321 echo hppa1.1-hp-bsd
16322- exit 0 ;;
16323+ exit ;;
16324 9000/8??:4.3bsd:*:*)
16325 echo hppa1.0-hp-bsd
16326- exit 0 ;;
16327+ exit ;;
16328 *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
16329 echo hppa1.0-hp-mpeix
16330- exit 0 ;;
16331+ exit ;;
16332 hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
16333 echo hppa1.1-hp-osf
16334- exit 0 ;;
16335+ exit ;;
16336 hp8??:OSF1:*:*)
16337 echo hppa1.0-hp-osf
16338- exit 0 ;;
16339+ exit ;;
16340 i*86:OSF1:*:*)
16341 if [ -x /usr/sbin/sysversion ] ; then
16342 echo ${UNAME_MACHINE}-unknown-osf1mk
16343 else
16344 echo ${UNAME_MACHINE}-unknown-osf1
16345 fi
16346- exit 0 ;;
16347+ exit ;;
16348 parisc*:Lites*:*:*)
16349 echo hppa1.1-hp-lites
16350- exit 0 ;;
16351+ exit ;;
16352 C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
16353 echo c1-convex-bsd
16354- exit 0 ;;
16355+ exit ;;
16356 C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
16357 if getsysinfo -f scalar_acc
16358 then echo c32-convex-bsd
16359 else echo c2-convex-bsd
16360 fi
16361- exit 0 ;;
16362+ exit ;;
16363 C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
16364 echo c34-convex-bsd
16365- exit 0 ;;
16366+ exit ;;
16367 C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
16368 echo c38-convex-bsd
16369- exit 0 ;;
16370+ exit ;;
16371 C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
16372 echo c4-convex-bsd
16373- exit 0 ;;
16374+ exit ;;
16375 CRAY*Y-MP:*:*:*)
16376 echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
16377- exit 0 ;;
16378+ exit ;;
16379 CRAY*[A-Z]90:*:*:*)
16380 echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
16381 | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
16382 -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
16383 -e 's/\.[^.]*$/.X/'
16384- exit 0 ;;
16385+ exit ;;
16386 CRAY*TS:*:*:*)
16387 echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
16388- exit 0 ;;
16389+ exit ;;
16390 CRAY*T3E:*:*:*)
16391 echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
16392- exit 0 ;;
16393+ exit ;;
16394 CRAY*SV1:*:*:*)
16395 echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
16396- exit 0 ;;
16397+ exit ;;
16398 *:UNICOS/mp:*:*)
16399- echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
16400- exit 0 ;;
16401+ echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
16402+ exit ;;
16403 F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
16404 FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
16405 FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
16406 FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
16407 echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
16408- exit 0 ;;
16409+ exit ;;
16410 5000:UNIX_System_V:4.*:*)
16411 FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
16412 FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
16413 echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
16414- exit 0 ;;
16415+ exit ;;
16416 i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
16417 echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
16418- exit 0 ;;
16419+ exit ;;
16420 sparc*:BSD/OS:*:*)
16421 echo sparc-unknown-bsdi${UNAME_RELEASE}
16422- exit 0 ;;
16423+ exit ;;
16424 *:BSD/OS:*:*)
16425 echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
16426- exit 0 ;;
16427+ exit ;;
16428 *:FreeBSD:*:*)
16429- # Determine whether the default compiler uses glibc.
16430- eval $set_cc_for_build
16431- sed 's/^ //' << EOF >$dummy.c
16432- #include <features.h>
16433- #if __GLIBC__ >= 2
16434- LIBC=gnu
16435- #else
16436- LIBC=
16437- #endif
16438-EOF
16439- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
16440- # GNU/KFreeBSD systems have a "k" prefix to indicate we are using
16441- # FreeBSD's kernel, but not the complete OS.
16442- case ${LIBC} in gnu) kernel_only='k' ;; esac
16443- echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
16444- exit 0 ;;
16445+ case ${UNAME_MACHINE} in
16446+ pc98)
16447+ echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
16448+ amd64)
16449+ echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
16450+ *)
16451+ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
16452+ esac
16453+ exit ;;
16454 i*:CYGWIN*:*)
16455 echo ${UNAME_MACHINE}-pc-cygwin
16456- exit 0 ;;
16457- i*:MINGW*:*)
16458+ exit ;;
16459+ *:MINGW*:*)
16460 echo ${UNAME_MACHINE}-pc-mingw32
16461- exit 0 ;;
16462+ exit ;;
16463+ i*:windows32*:*)
16464+ # uname -m includes "-pc" on this system.
16465+ echo ${UNAME_MACHINE}-mingw32
16466+ exit ;;
16467 i*:PW*:*)
16468 echo ${UNAME_MACHINE}-pc-pw32
16469- exit 0 ;;
16470- x86:Interix*:[34]*)
16471- echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
16472- exit 0 ;;
16473+ exit ;;
16474+ *:Interix*:[3456]*)
16475+ case ${UNAME_MACHINE} in
16476+ x86)
16477+ echo i586-pc-interix${UNAME_RELEASE}
16478+ exit ;;
16479+ EM64T | authenticamd)
16480+ echo x86_64-unknown-interix${UNAME_RELEASE}
16481+ exit ;;
16482+ IA64)
16483+ echo ia64-unknown-interix${UNAME_RELEASE}
16484+ exit ;;
16485+ esac ;;
16486 [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
16487 echo i${UNAME_MACHINE}-pc-mks
16488- exit 0 ;;
16489+ exit ;;
16490 i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
16491 # How do we know it's Interix rather than the generic POSIX subsystem?
16492 # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
16493 # UNAME_MACHINE based on the output of uname instead of i386?
16494 echo i586-pc-interix
16495- exit 0 ;;
16496+ exit ;;
16497 i*:UWIN*:*)
16498 echo ${UNAME_MACHINE}-pc-uwin
16499- exit 0 ;;
16500+ exit ;;
16501+ amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
16502+ echo x86_64-unknown-cygwin
16503+ exit ;;
16504 p*:CYGWIN*:*)
16505 echo powerpcle-unknown-cygwin
16506- exit 0 ;;
16507+ exit ;;
16508 prep*:SunOS:5.*:*)
16509 echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
16510- exit 0 ;;
16511+ exit ;;
16512 *:GNU:*:*)
16513 # the GNU system
16514 echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
16515- exit 0 ;;
16516+ exit ;;
16517 *:GNU/*:*:*)
16518 # other systems with GNU libc and userland
16519 echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
16520- exit 0 ;;
16521+ exit ;;
16522 i*86:Minix:*:*)
16523 echo ${UNAME_MACHINE}-pc-minix
16524- exit 0 ;;
16525+ exit ;;
16526 arm*:Linux:*:*)
16527+ eval $set_cc_for_build
16528+ if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
16529+ | grep -q __ARM_EABI__
16530+ then
16531+ echo ${UNAME_MACHINE}-unknown-linux-gnu
16532+ else
16533+ echo ${UNAME_MACHINE}-unknown-linux-gnueabi
16534+ fi
16535+ exit ;;
16536+ avr32*:Linux:*:*)
16537 echo ${UNAME_MACHINE}-unknown-linux-gnu
16538- exit 0 ;;
16539+ exit ;;
16540 cris:Linux:*:*)
16541 echo cris-axis-linux-gnu
16542- exit 0 ;;
16543+ exit ;;
16544+ crisv32:Linux:*:*)
16545+ echo crisv32-axis-linux-gnu
16546+ exit ;;
16547+ frv:Linux:*:*)
16548+ echo frv-unknown-linux-gnu
16549+ exit ;;
16550 ia64:Linux:*:*)
16551 echo ${UNAME_MACHINE}-unknown-linux-gnu
16552- exit 0 ;;
16553+ exit ;;
16554+ m32r*:Linux:*:*)
16555+ echo ${UNAME_MACHINE}-unknown-linux-gnu
16556+ exit ;;
16557 m68*:Linux:*:*)
16558 echo ${UNAME_MACHINE}-unknown-linux-gnu
16559- exit 0 ;;
16560+ exit ;;
16561 mips:Linux:*:*)
16562 eval $set_cc_for_build
16563 sed 's/^ //' << EOF >$dummy.c
16564@@ -866,8 +882,12 @@ EOF
16565 #endif
16566 #endif
16567 EOF
16568- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
16569- test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
16570+ eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
16571+ /^CPU/{
16572+ s: ::g
16573+ p
16574+ }'`"
16575+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
16576 ;;
16577 mips64:Linux:*:*)
16578 eval $set_cc_for_build
16579@@ -885,15 +905,22 @@ EOF
16580 #endif
16581 #endif
16582 EOF
16583- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
16584- test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
16585+ eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
16586+ /^CPU/{
16587+ s: ::g
16588+ p
16589+ }'`"
16590+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
16591 ;;
16592+ or32:Linux:*:*)
16593+ echo or32-unknown-linux-gnu
16594+ exit ;;
16595 ppc:Linux:*:*)
16596 echo powerpc-unknown-linux-gnu
16597- exit 0 ;;
16598+ exit ;;
16599 ppc64:Linux:*:*)
16600 echo powerpc64-unknown-linux-gnu
16601- exit 0 ;;
16602+ exit ;;
16603 alpha:Linux:*:*)
16604 case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
16605 EV5) UNAME_MACHINE=alphaev5 ;;
16606@@ -907,7 +934,7 @@ EOF
16607 objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
16608 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
16609 echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
16610- exit 0 ;;
16611+ exit ;;
16612 parisc:Linux:*:* | hppa:Linux:*:*)
16613 # Look for CPU level
16614 case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
16615@@ -915,25 +942,31 @@ EOF
16616 PA8*) echo hppa2.0-unknown-linux-gnu ;;
16617 *) echo hppa-unknown-linux-gnu ;;
16618 esac
16619- exit 0 ;;
16620+ exit ;;
16621 parisc64:Linux:*:* | hppa64:Linux:*:*)
16622 echo hppa64-unknown-linux-gnu
16623- exit 0 ;;
16624+ exit ;;
16625 s390:Linux:*:* | s390x:Linux:*:*)
16626 echo ${UNAME_MACHINE}-ibm-linux
16627- exit 0 ;;
16628+ exit ;;
16629 sh64*:Linux:*:*)
16630 echo ${UNAME_MACHINE}-unknown-linux-gnu
16631- exit 0 ;;
16632+ exit ;;
16633 sh*:Linux:*:*)
16634 echo ${UNAME_MACHINE}-unknown-linux-gnu
16635- exit 0 ;;
16636+ exit ;;
16637 sparc:Linux:*:* | sparc64:Linux:*:*)
16638 echo ${UNAME_MACHINE}-unknown-linux-gnu
16639- exit 0 ;;
16640+ exit ;;
16641+ vax:Linux:*:*)
16642+ echo ${UNAME_MACHINE}-dec-linux-gnu
16643+ exit ;;
16644 x86_64:Linux:*:*)
16645 echo x86_64-unknown-linux-gnu
16646- exit 0 ;;
16647+ exit ;;
16648+ xtensa*:Linux:*:*)
16649+ echo ${UNAME_MACHINE}-unknown-linux-gnu
16650+ exit ;;
16651 i*86:Linux:*:*)
16652 # The BFD linker knows what the default object file format is, so
16653 # first see if it will tell us. cd to the root directory to prevent
16654@@ -951,15 +984,15 @@ EOF
16655 ;;
16656 a.out-i386-linux)
16657 echo "${UNAME_MACHINE}-pc-linux-gnuaout"
16658- exit 0 ;;
16659+ exit ;;
16660 coff-i386)
16661 echo "${UNAME_MACHINE}-pc-linux-gnucoff"
16662- exit 0 ;;
16663+ exit ;;
16664 "")
16665 # Either a pre-BFD a.out linker (linux-gnuoldld) or
16666 # one that does not give us useful --help.
16667 echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
16668- exit 0 ;;
16669+ exit ;;
16670 esac
16671 # Determine whether the default compiler is a.out or elf
16672 eval $set_cc_for_build
16673@@ -976,7 +1009,7 @@ EOF
16674 LIBC=gnulibc1
16675 # endif
16676 #else
16677- #ifdef __INTEL_COMPILER
16678+ #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
16679 LIBC=gnu
16680 #else
16681 LIBC=gnuaout
16682@@ -986,16 +1019,23 @@ EOF
16683 LIBC=dietlibc
16684 #endif
16685 EOF
16686- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
16687- test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
16688- test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
16689+ eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
16690+ /^LIBC/{
16691+ s: ::g
16692+ p
16693+ }'`"
16694+ test x"${LIBC}" != x && {
16695+ echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
16696+ exit
16697+ }
16698+ test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
16699 ;;
16700 i*86:DYNIX/ptx:4*:*)
16701 # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
16702 # earlier versions are messed up and put the nodename in both
16703 # sysname and nodename.
16704 echo i386-sequent-sysv4
16705- exit 0 ;;
16706+ exit ;;
16707 i*86:UNIX_SV:4.2MP:2.*)
16708 # Unixware is an offshoot of SVR4, but it has its own version
16709 # number series starting with 2...
16710@@ -1003,27 +1043,27 @@ EOF
16711 # I just have to hope. -- rms.
16712 # Use sysv4.2uw... so that sysv4* matches it.
16713 echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
16714- exit 0 ;;
16715+ exit ;;
16716 i*86:OS/2:*:*)
16717 # If we were able to find `uname', then EMX Unix compatibility
16718 # is probably installed.
16719 echo ${UNAME_MACHINE}-pc-os2-emx
16720- exit 0 ;;
16721+ exit ;;
16722 i*86:XTS-300:*:STOP)
16723 echo ${UNAME_MACHINE}-unknown-stop
16724- exit 0 ;;
16725+ exit ;;
16726 i*86:atheos:*:*)
16727 echo ${UNAME_MACHINE}-unknown-atheos
16728- exit 0 ;;
16729- i*86:syllable:*:*)
16730+ exit ;;
16731+ i*86:syllable:*:*)
16732 echo ${UNAME_MACHINE}-pc-syllable
16733- exit 0 ;;
16734+ exit ;;
16735 i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
16736 echo i386-unknown-lynxos${UNAME_RELEASE}
16737- exit 0 ;;
16738+ exit ;;
16739 i*86:*DOS:*:*)
16740 echo ${UNAME_MACHINE}-pc-msdosdjgpp
16741- exit 0 ;;
16742+ exit ;;
16743 i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
16744 UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
16745 if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
16746@@ -1031,15 +1071,16 @@ EOF
16747 else
16748 echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
16749 fi
16750- exit 0 ;;
16751- i*86:*:5:[78]*)
16752+ exit ;;
16753+ i*86:*:5:[678]*)
16754+ # UnixWare 7.x, OpenUNIX and OpenServer 6.
16755 case `/bin/uname -X | grep "^Machine"` in
16756 *486*) UNAME_MACHINE=i486 ;;
16757 *Pentium) UNAME_MACHINE=i586 ;;
16758 *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
16759 esac
16760 echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
16761- exit 0 ;;
16762+ exit ;;
16763 i*86:*:3.2:*)
16764 if test -f /usr/options/cb.name; then
16765 UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
16766@@ -1057,73 +1098,73 @@ EOF
16767 else
16768 echo ${UNAME_MACHINE}-pc-sysv32
16769 fi
16770- exit 0 ;;
16771+ exit ;;
16772 pc:*:*:*)
16773 # Left here for compatibility:
16774 # uname -m prints for DJGPP always 'pc', but it prints nothing about
16775 # the processor, so we play safe by assuming i386.
16776 echo i386-pc-msdosdjgpp
16777- exit 0 ;;
16778+ exit ;;
16779 Intel:Mach:3*:*)
16780 echo i386-pc-mach3
16781- exit 0 ;;
16782+ exit ;;
16783 paragon:*:*:*)
16784 echo i860-intel-osf1
16785- exit 0 ;;
16786+ exit ;;
16787 i860:*:4.*:*) # i860-SVR4
16788 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
16789 echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
16790 else # Add other i860-SVR4 vendors below as they are discovered.
16791 echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
16792 fi
16793- exit 0 ;;
16794+ exit ;;
16795 mini*:CTIX:SYS*5:*)
16796 # "miniframe"
16797 echo m68010-convergent-sysv
16798- exit 0 ;;
16799+ exit ;;
16800 mc68k:UNIX:SYSTEM5:3.51m)
16801 echo m68k-convergent-sysv
16802- exit 0 ;;
16803+ exit ;;
16804 M680?0:D-NIX:5.3:*)
16805 echo m68k-diab-dnix
16806- exit 0 ;;
16807- M68*:*:R3V[567]*:*)
16808- test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
16809- 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0)
16810+ exit ;;
16811+ M68*:*:R3V[5678]*:*)
16812+ test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
16813+ 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
16814 OS_REL=''
16815 test -r /etc/.relid \
16816 && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
16817 /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
16818- && echo i486-ncr-sysv4.3${OS_REL} && exit 0
16819+ && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
16820 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
16821- && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
16822+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
16823 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
16824 /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
16825- && echo i486-ncr-sysv4 && exit 0 ;;
16826+ && { echo i486-ncr-sysv4; exit; } ;;
16827 m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
16828 echo m68k-unknown-lynxos${UNAME_RELEASE}
16829- exit 0 ;;
16830+ exit ;;
16831 mc68030:UNIX_System_V:4.*:*)
16832 echo m68k-atari-sysv4
16833- exit 0 ;;
16834+ exit ;;
16835 TSUNAMI:LynxOS:2.*:*)
16836 echo sparc-unknown-lynxos${UNAME_RELEASE}
16837- exit 0 ;;
16838+ exit ;;
16839 rs6000:LynxOS:2.*:*)
16840 echo rs6000-unknown-lynxos${UNAME_RELEASE}
16841- exit 0 ;;
16842+ exit ;;
16843 PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
16844 echo powerpc-unknown-lynxos${UNAME_RELEASE}
16845- exit 0 ;;
16846+ exit ;;
16847 SM[BE]S:UNIX_SV:*:*)
16848 echo mips-dde-sysv${UNAME_RELEASE}
16849- exit 0 ;;
16850+ exit ;;
16851 RM*:ReliantUNIX-*:*:*)
16852 echo mips-sni-sysv4
16853- exit 0 ;;
16854+ exit ;;
16855 RM*:SINIX-*:*:*)
16856 echo mips-sni-sysv4
16857- exit 0 ;;
16858+ exit ;;
16859 *:SINIX-*:*:*)
16860 if uname -p 2>/dev/null >/dev/null ; then
16861 UNAME_MACHINE=`(uname -p) 2>/dev/null`
16862@@ -1131,68 +1172,84 @@ EOF
16863 else
16864 echo ns32k-sni-sysv
16865 fi
16866- exit 0 ;;
16867+ exit ;;
16868 PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
16869 # says <Richard.M.Bartel@ccMail.Census.GOV>
16870 echo i586-unisys-sysv4
16871- exit 0 ;;
16872+ exit ;;
16873 *:UNIX_System_V:4*:FTX*)
16874 # From Gerald Hewes <hewes@openmarket.com>.
16875 # How about differentiating between stratus architectures? -djm
16876 echo hppa1.1-stratus-sysv4
16877- exit 0 ;;
16878+ exit ;;
16879 *:*:*:FTX*)
16880 # From seanf@swdc.stratus.com.
16881 echo i860-stratus-sysv4
16882- exit 0 ;;
16883+ exit ;;
16884+ i*86:VOS:*:*)
16885+ # From Paul.Green@stratus.com.
16886+ echo ${UNAME_MACHINE}-stratus-vos
16887+ exit ;;
16888 *:VOS:*:*)
16889 # From Paul.Green@stratus.com.
16890 echo hppa1.1-stratus-vos
16891- exit 0 ;;
16892+ exit ;;
16893 mc68*:A/UX:*:*)
16894 echo m68k-apple-aux${UNAME_RELEASE}
16895- exit 0 ;;
16896+ exit ;;
16897 news*:NEWS-OS:6*:*)
16898 echo mips-sony-newsos6
16899- exit 0 ;;
16900+ exit ;;
16901 R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
16902 if [ -d /usr/nec ]; then
16903 echo mips-nec-sysv${UNAME_RELEASE}
16904 else
16905 echo mips-unknown-sysv${UNAME_RELEASE}
16906 fi
16907- exit 0 ;;
16908+ exit ;;
16909 BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
16910 echo powerpc-be-beos
16911- exit 0 ;;
16912+ exit ;;
16913 BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
16914 echo powerpc-apple-beos
16915- exit 0 ;;
16916+ exit ;;
16917 BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
16918 echo i586-pc-beos
16919- exit 0 ;;
16920+ exit ;;
16921+ BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
16922+ echo i586-pc-haiku
16923+ exit ;;
16924 SX-4:SUPER-UX:*:*)
16925 echo sx4-nec-superux${UNAME_RELEASE}
16926- exit 0 ;;
16927+ exit ;;
16928 SX-5:SUPER-UX:*:*)
16929 echo sx5-nec-superux${UNAME_RELEASE}
16930- exit 0 ;;
16931+ exit ;;
16932 SX-6:SUPER-UX:*:*)
16933 echo sx6-nec-superux${UNAME_RELEASE}
16934- exit 0 ;;
16935+ exit ;;
16936+ SX-7:SUPER-UX:*:*)
16937+ echo sx7-nec-superux${UNAME_RELEASE}
16938+ exit ;;
16939+ SX-8:SUPER-UX:*:*)
16940+ echo sx8-nec-superux${UNAME_RELEASE}
16941+ exit ;;
16942+ SX-8R:SUPER-UX:*:*)
16943+ echo sx8r-nec-superux${UNAME_RELEASE}
16944+ exit ;;
16945 Power*:Rhapsody:*:*)
16946 echo powerpc-apple-rhapsody${UNAME_RELEASE}
16947- exit 0 ;;
16948+ exit ;;
16949 *:Rhapsody:*:*)
16950 echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
16951- exit 0 ;;
16952+ exit ;;
16953 *:Darwin:*:*)
16954- case `uname -p` in
16955- *86) UNAME_PROCESSOR=i686 ;;
16956- powerpc) UNAME_PROCESSOR=powerpc ;;
16957+ UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
16958+ case $UNAME_PROCESSOR in
16959+ unknown) UNAME_PROCESSOR=powerpc ;;
16960 esac
16961 echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
16962- exit 0 ;;
16963+ exit ;;
16964 *:procnto*:*:* | *:QNX:[0123456789]*:*)
16965 UNAME_PROCESSOR=`uname -p`
16966 if test "$UNAME_PROCESSOR" = "x86"; then
16967@@ -1200,22 +1257,25 @@ EOF
16968 UNAME_MACHINE=pc
16969 fi
16970 echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
16971- exit 0 ;;
16972+ exit ;;
16973 *:QNX:*:4*)
16974 echo i386-pc-qnx
16975- exit 0 ;;
16976+ exit ;;
16977+ NSE-?:NONSTOP_KERNEL:*:*)
16978+ echo nse-tandem-nsk${UNAME_RELEASE}
16979+ exit ;;
16980 NSR-?:NONSTOP_KERNEL:*:*)
16981 echo nsr-tandem-nsk${UNAME_RELEASE}
16982- exit 0 ;;
16983+ exit ;;
16984 *:NonStop-UX:*:*)
16985 echo mips-compaq-nonstopux
16986- exit 0 ;;
16987+ exit ;;
16988 BS2000:POSIX*:*:*)
16989 echo bs2000-siemens-sysv
16990- exit 0 ;;
16991+ exit ;;
16992 DS/*:UNIX_System_V:*:*)
16993 echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
16994- exit 0 ;;
16995+ exit ;;
16996 *:Plan9:*:*)
16997 # "uname -m" is not consistent, so use $cputype instead. 386
16998 # is converted to i386 for consistency with other x86
16999@@ -1226,31 +1286,47 @@ EOF
17000 UNAME_MACHINE="$cputype"
17001 fi
17002 echo ${UNAME_MACHINE}-unknown-plan9
17003- exit 0 ;;
17004+ exit ;;
17005 *:TOPS-10:*:*)
17006 echo pdp10-unknown-tops10
17007- exit 0 ;;
17008+ exit ;;
17009 *:TENEX:*:*)
17010 echo pdp10-unknown-tenex
17011- exit 0 ;;
17012+ exit ;;
17013 KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
17014 echo pdp10-dec-tops20
17015- exit 0 ;;
17016+ exit ;;
17017 XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
17018 echo pdp10-xkl-tops20
17019- exit 0 ;;
17020+ exit ;;
17021 *:TOPS-20:*:*)
17022 echo pdp10-unknown-tops20
17023- exit 0 ;;
17024+ exit ;;
17025 *:ITS:*:*)
17026 echo pdp10-unknown-its
17027- exit 0 ;;
17028+ exit ;;
17029 SEI:*:*:SEIUX)
17030 echo mips-sei-seiux${UNAME_RELEASE}
17031- exit 0 ;;
17032+ exit ;;
17033 *:DragonFly:*:*)
17034 echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
17035- exit 0 ;;
17036+ exit ;;
17037+ *:*VMS:*:*)
17038+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
17039+ case "${UNAME_MACHINE}" in
17040+ A*) echo alpha-dec-vms ; exit ;;
17041+ I*) echo ia64-dec-vms ; exit ;;
17042+ V*) echo vax-dec-vms ; exit ;;
17043+ esac ;;
17044+ *:XENIX:*:SysV)
17045+ echo i386-pc-xenix
17046+ exit ;;
17047+ i*86:skyos:*:*)
17048+ echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
17049+ exit ;;
17050+ i*86:rdos:*:*)
17051+ echo ${UNAME_MACHINE}-pc-rdos
17052+ exit ;;
17053 esac
17054
17055 #echo '(No uname command or uname output not recognized.)' 1>&2
17056@@ -1282,7 +1358,7 @@ main ()
17057 #endif
17058
17059 #if defined (__arm) && defined (__acorn) && defined (__unix)
17060- printf ("arm-acorn-riscix"); exit (0);
17061+ printf ("arm-acorn-riscix\n"); exit (0);
17062 #endif
17063
17064 #if defined (hp300) && !defined (hpux)
17065@@ -1371,11 +1447,12 @@ main ()
17066 }
17067 EOF
17068
17069-$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0
17070+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
17071+ { echo "$SYSTEM_NAME"; exit; }
17072
17073 # Apollos put the system type in the environment.
17074
17075-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
17076+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
17077
17078 # Convex versions that predate uname can use getsysinfo(1)
17079
17080@@ -1384,22 +1461,22 @@ then
17081 case `getsysinfo -f cpu_type` in
17082 c1*)
17083 echo c1-convex-bsd
17084- exit 0 ;;
17085+ exit ;;
17086 c2*)
17087 if getsysinfo -f scalar_acc
17088 then echo c32-convex-bsd
17089 else echo c2-convex-bsd
17090 fi
17091- exit 0 ;;
17092+ exit ;;
17093 c34*)
17094 echo c34-convex-bsd
17095- exit 0 ;;
17096+ exit ;;
17097 c38*)
17098 echo c38-convex-bsd
17099- exit 0 ;;
17100+ exit ;;
17101 c4*)
17102 echo c4-convex-bsd
17103- exit 0 ;;
17104+ exit ;;
17105 esac
17106 fi
17107
17108@@ -1410,7 +1487,9 @@ This script, last modified $timestamp, h
17109 the operating system you are using. It is advised that you
17110 download the most up to date version of the config scripts from
17111
17112- ftp://ftp.gnu.org/pub/gnu/config/
17113+ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
17114+and
17115+ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
17116
17117 If the version you run ($0) is already up to date, please
17118 send the following data and any information you think might be
17119Index: gdb-7.2.90.20110703/readline/support/config.rpath
17120===================================================================
17121--- gdb-7.2.90.20110703.orig/readline/support/config.rpath 2011-07-03 10:40:53.000000000 +0200
17122+++ gdb-7.2.90.20110703/readline/support/config.rpath 2011-07-03 10:41:21.000000000 +0200
17123@@ -6,19 +6,18 @@
17124 # Taken from GNU libtool, 2001
17125 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
17126 #
17127-# This program is free software; you can redistribute it and/or modify
17128+# This program is free software: you can redistribute it and/or modify
17129 # it under the terms of the GNU General Public License as published by
17130-# the Free Software Foundation; either version 2 of the License, or
17131+# the Free Software Foundation, either version 3 of the License, or
17132 # (at your option) any later version.
17133 #
17134-# This program is distributed in the hope that it will be useful, but
17135-# WITHOUT ANY WARRANTY; without even the implied warranty of
17136-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17137-# General Public License for more details.
17138+# This program is distributed in the hope that it will be useful,
17139+# but WITHOUT ANY WARRANTY; without even the implied warranty of
17140+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17141+# GNU General Public License for more details.
17142 #
17143 # You should have received a copy of the GNU General Public License
17144-# along with this program; if not, write to the Free Software
17145-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17146+# along with this program. If not, see <http://www.gnu.org/licenses/>.
17147 #
17148 # As a special exception to the GNU General Public License, if you
17149 # distribute this file as part of a program that contains a
17150Index: gdb-7.2.90.20110703/readline/support/config.sub
17151===================================================================
17152--- gdb-7.2.90.20110703.orig/readline/support/config.sub 2011-07-03 10:40:53.000000000 +0200
17153+++ gdb-7.2.90.20110703/readline/support/config.sub 2011-07-03 10:41:21.000000000 +0200
17154@@ -1,9 +1,10 @@
17155 #! /bin/sh
17156 # Configuration validation subroutine script.
17157 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
17158-# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
17159+# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 20098
17160+# Free Software Foundation, Inc.
17161
17162-timestamp='2004-02-16'
17163+timestamp='2008-03-26'
17164
17165 # This file is (in principle) common to ALL GNU software.
17166 # The presence of a machine in this file suggests that SOME GNU software
17167@@ -21,14 +22,15 @@ timestamp='2004-02-16'
17168 #
17169 # You should have received a copy of the GNU General Public License
17170 # along with this program; if not, write to the Free Software
17171-# Foundation, Inc., 59 Temple Place - Suite 330,
17172-# Boston, MA 02111-1307, USA.
17173-
17174+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
17175+# 02110-1301, USA.
17176+#
17177 # As a special exception to the GNU General Public License, if you
17178 # distribute this file as part of a program that contains a
17179 # configuration script generated by Autoconf, you may include it under
17180 # the same distribution terms that you use for the rest of that program.
17181
17182+
17183 # Please send patches to <config-patches@gnu.org>. Submit a context
17184 # diff and a properly formatted ChangeLog entry.
17185 #
17186@@ -70,8 +72,8 @@ Report bugs and patches to <config-patch
17187 version="\
17188 GNU config.sub ($timestamp)
17189
17190-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
17191-Free Software Foundation, Inc.
17192+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
17193+2002, 2003, 2004, 2005, 2006, 2007, 2008,2009 Free Software Foundation, Inc.
17194
17195 This is free software; see the source for copying conditions. There is NO
17196 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
17197@@ -83,11 +85,11 @@ Try \`$me --help' for more information."
17198 while test $# -gt 0 ; do
17199 case $1 in
17200 --time-stamp | --time* | -t )
17201- echo "$timestamp" ; exit 0 ;;
17202+ echo "$timestamp" ; exit ;;
17203 --version | -v )
17204- echo "$version" ; exit 0 ;;
17205+ echo "$version" ; exit ;;
17206 --help | --h* | -h )
17207- echo "$usage"; exit 0 ;;
17208+ echo "$usage"; exit ;;
17209 -- ) # Stop option processing
17210 shift; break ;;
17211 - ) # Use stdin as input.
17212@@ -99,7 +101,7 @@ while test $# -gt 0 ; do
17213 *local*)
17214 # First pass through any local machine types.
17215 echo $1
17216- exit 0;;
17217+ exit ;;
17218
17219 * )
17220 break ;;
17221@@ -118,8 +120,9 @@ esac
17222 # Here we must recognize all the valid KERNEL-OS combinations.
17223 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
17224 case $maybe_os in
17225- nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
17226- kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
17227+ nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
17228+ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
17229+ storm-chaos* | os2-emx* | rtmk-nova*)
17230 os=-$maybe_os
17231 basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
17232 ;;
17233@@ -145,7 +148,7 @@ case $os in
17234 -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
17235 -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
17236 -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
17237- -apple | -axis)
17238+ -apple | -axis | -knuth | -cray)
17239 os=
17240 basic_machine=$1
17241 ;;
17242@@ -170,6 +173,10 @@ case $os in
17243 -hiux*)
17244 os=-hiuxwe2
17245 ;;
17246+ -sco6)
17247+ os=-sco5v6
17248+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
17249+ ;;
17250 -sco5)
17251 os=-sco3.2v5
17252 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
17253@@ -186,6 +193,10 @@ case $os in
17254 # Don't forget version if it is 3.2v4 or newer.
17255 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
17256 ;;
17257+ -sco5v6*)
17258+ # Don't forget version if it is 3.2v4 or newer.
17259+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
17260+ ;;
17261 -sco*)
17262 os=-sco3.2v2
17263 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
17264@@ -230,22 +241,27 @@ case $basic_machine in
17265 | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
17266 | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
17267 | am33_2.0 \
17268- | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
17269+ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
17270+ | bfin \
17271 | c4x | clipper \
17272 | d10v | d30v | dlx | dsp16xx \
17273- | fr30 | frv \
17274+ | fido | fr30 | frv \
17275 | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
17276 | i370 | i860 | i960 | ia64 \
17277 | ip2k | iq2000 \
17278- | m32r | m68000 | m68k | m88k | mcore \
17279+ | m32c | m32r | m32rle | m68000 | m68k | m88k \
17280+ | maxq | mb | microblaze | mcore | mep | metag \
17281 | mips | mipsbe | mipseb | mipsel | mipsle \
17282 | mips16 \
17283 | mips64 | mips64el \
17284- | mips64vr | mips64vrel \
17285+ | mips64octeon | mips64octeonel \
17286 | mips64orion | mips64orionel \
17287+ | mips64r5900 | mips64r5900el \
17288+ | mips64vr | mips64vrel \
17289 | mips64vr4100 | mips64vr4100el \
17290 | mips64vr4300 | mips64vr4300el \
17291 | mips64vr5000 | mips64vr5000el \
17292+ | mips64vr5900 | mips64vr5900el \
17293 | mipsisa32 | mipsisa32el \
17294 | mipsisa32r2 | mipsisa32r2el \
17295 | mipsisa64 | mipsisa64el \
17296@@ -254,20 +270,24 @@ case $basic_machine in
17297 | mipsisa64sr71k | mipsisa64sr71kel \
17298 | mipstx39 | mipstx39el \
17299 | mn10200 | mn10300 \
17300+ | mt \
17301 | msp430 \
17302+ | nios | nios2 \
17303 | ns16k | ns32k \
17304- | openrisc | or32 \
17305+ | or32 \
17306 | pdp10 | pdp11 | pj | pjl \
17307 | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
17308 | pyramid \
17309- | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
17310+ | score \
17311+ | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
17312 | sh64 | sh64le \
17313- | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
17314- | strongarm \
17315+ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
17316+ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
17317+ | spu | strongarm \
17318 | tahoe | thumb | tic4x | tic80 | tron \
17319 | v850 | v850e \
17320 | we32k \
17321- | x86 | xscale | xstormy16 | xtensa \
17322+ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
17323 | z8k)
17324 basic_machine=$basic_machine-unknown
17325 ;;
17326@@ -278,6 +298,9 @@ case $basic_machine in
17327 ;;
17328 m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
17329 ;;
17330+ ms1)
17331+ basic_machine=mt-unknown
17332+ ;;
17333
17334 # We use `pc' rather than `unknown'
17335 # because (1) that's what they normally are, and
17336@@ -297,28 +320,31 @@ case $basic_machine in
17337 | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
17338 | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
17339 | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
17340- | avr-* \
17341- | bs2000-* \
17342+ | avr-* | avr32-* \
17343+ | bfin-* | bs2000-* \
17344 | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
17345- | clipper-* | cydra-* \
17346+ | clipper-* | craynv-* | cydra-* \
17347 | d10v-* | d30v-* | dlx-* \
17348 | elxsi-* \
17349- | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
17350+ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
17351 | h8300-* | h8500-* \
17352 | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
17353 | i*86-* | i860-* | i960-* | ia64-* \
17354 | ip2k-* | iq2000-* \
17355- | m32r-* \
17356+ | m32c-* | m32r-* | m32rle-* \
17357 | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
17358- | m88110-* | m88k-* | mcore-* \
17359+ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
17360 | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
17361 | mips16-* \
17362 | mips64-* | mips64el-* \
17363- | mips64vr-* | mips64vrel-* \
17364+ | mips64octeon-* | mips64octeonel-* \
17365 | mips64orion-* | mips64orionel-* \
17366+ | mips64r5900-* | mips64r5900el-* \
17367+ | mips64vr-* | mips64vrel-* \
17368 | mips64vr4100-* | mips64vr4100el-* \
17369 | mips64vr4300-* | mips64vr4300el-* \
17370 | mips64vr5000-* | mips64vr5000el-* \
17371+ | mips64vr5900-* | mips64vr5900el-* \
17372 | mipsisa32-* | mipsisa32el-* \
17373 | mipsisa32r2-* | mipsisa32r2el-* \
17374 | mipsisa64-* | mipsisa64el-* \
17375@@ -326,27 +352,35 @@ case $basic_machine in
17376 | mipsisa64sb1-* | mipsisa64sb1el-* \
17377 | mipsisa64sr71k-* | mipsisa64sr71kel-* \
17378 | mipstx39-* | mipstx39el-* \
17379+ | mmix-* \
17380+ | mt-* \
17381 | msp430-* \
17382- | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \
17383+ | nios-* | nios2-* \
17384+ | none-* | np1-* | ns16k-* | ns32k-* \
17385 | orion-* \
17386 | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
17387 | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
17388 | pyramid-* \
17389 | romp-* | rs6000-* \
17390- | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
17391+ | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
17392 | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
17393- | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
17394- | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
17395+ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
17396+ | sparclite-* \
17397+ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
17398 | tahoe-* | thumb-* \
17399- | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
17400+ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
17401 | tron-* \
17402 | v850-* | v850e-* | vax-* \
17403 | we32k-* \
17404- | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
17405- | xtensa-* \
17406+ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
17407+ | xstormy16-* | xtensa*-* \
17408 | ymp-* \
17409 | z8k-*)
17410 ;;
17411+ # Recognize the basic CPU types without company name, with glob match.
17412+ xtensa*)
17413+ basic_machine=$basic_machine-unknown
17414+ ;;
17415 # Recognize the various machine names and aliases which stand
17416 # for a CPU type and a company and sometimes even an OS.
17417 386bsd)
17418@@ -417,6 +451,14 @@ case $basic_machine in
17419 basic_machine=ns32k-sequent
17420 os=-dynix
17421 ;;
17422+ blackfin)
17423+ basic_machine=bfin-unknown
17424+ os=-linux
17425+ ;;
17426+ blackfin-*)
17427+ basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
17428+ os=-linux
17429+ ;;
17430 c90)
17431 basic_machine=c90-cray
17432 os=-unicos
17433@@ -445,16 +487,27 @@ case $basic_machine in
17434 basic_machine=j90-cray
17435 os=-unicos
17436 ;;
17437- cr16c)
17438- basic_machine=cr16c-unknown
17439+ craynv)
17440+ basic_machine=craynv-cray
17441+ os=-unicosmp
17442+ ;;
17443+ cr16)
17444+ basic_machine=cr16-unknown
17445 os=-elf
17446 ;;
17447 crds | unos)
17448 basic_machine=m68k-crds
17449 ;;
17450+ crisv32 | crisv32-* | etraxfs*)
17451+ basic_machine=crisv32-axis
17452+ ;;
17453 cris | cris-* | etrax*)
17454 basic_machine=cris-axis
17455 ;;
17456+ crx)
17457+ basic_machine=crx-unknown
17458+ os=-elf
17459+ ;;
17460 da30 | da30-*)
17461 basic_machine=m68k-da30
17462 ;;
17463@@ -477,6 +530,10 @@ case $basic_machine in
17464 basic_machine=m88k-motorola
17465 os=-sysv3
17466 ;;
17467+ djgpp)
17468+ basic_machine=i586-pc
17469+ os=-msdosdjgpp
17470+ ;;
17471 dpx20 | dpx20-*)
17472 basic_machine=rs6000-bull
17473 os=-bosx
17474@@ -627,6 +684,14 @@ case $basic_machine in
17475 basic_machine=m68k-isi
17476 os=-sysv
17477 ;;
17478+ m68knommu)
17479+ basic_machine=m68k-unknown
17480+ os=-linux
17481+ ;;
17482+ m68knommu-*)
17483+ basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
17484+ os=-linux
17485+ ;;
17486 m88k-omron*)
17487 basic_machine=m88k-omron
17488 ;;
17489@@ -642,6 +707,10 @@ case $basic_machine in
17490 basic_machine=i386-pc
17491 os=-mingw32
17492 ;;
17493+ mingw32ce)
17494+ basic_machine=arm-unknown
17495+ os=-mingw32ce
17496+ ;;
17497 miniframe)
17498 basic_machine=m68000-convergent
17499 ;;
17500@@ -655,10 +724,6 @@ case $basic_machine in
17501 mips3*)
17502 basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
17503 ;;
17504- mmix*)
17505- basic_machine=mmix-knuth
17506- os=-mmixware
17507- ;;
17508 monitor)
17509 basic_machine=m68k-rom68k
17510 os=-coff
17511@@ -671,6 +736,9 @@ case $basic_machine in
17512 basic_machine=i386-pc
17513 os=-msdos
17514 ;;
17515+ ms1-*)
17516+ basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
17517+ ;;
17518 mvs)
17519 basic_machine=i370-ibm
17520 os=-mvs
17521@@ -739,9 +807,8 @@ case $basic_machine in
17522 np1)
17523 basic_machine=np1-gould
17524 ;;
17525- nv1)
17526- basic_machine=nv1-cray
17527- os=-unicosmp
17528+ nse-tandem)
17529+ basic_machine=nse-tandem
17530 ;;
17531 nsr-tandem)
17532 basic_machine=nsr-tandem
17533@@ -750,9 +817,8 @@ case $basic_machine in
17534 basic_machine=hppa1.1-oki
17535 os=-proelf
17536 ;;
17537- or32 | or32-*)
17538+ openrisc | openrisc-*)
17539 basic_machine=or32-unknown
17540- os=-coff
17541 ;;
17542 os400)
17543 basic_machine=powerpc-ibm
17544@@ -774,6 +840,14 @@ case $basic_machine in
17545 basic_machine=i860-intel
17546 os=-osf
17547 ;;
17548+ parisc)
17549+ basic_machine=hppa-unknown
17550+ os=-linux
17551+ ;;
17552+ parisc-*)
17553+ basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
17554+ os=-linux
17555+ ;;
17556 pbd)
17557 basic_machine=sparc-tti
17558 ;;
17559@@ -783,6 +857,12 @@ case $basic_machine in
17560 pc532 | pc532-*)
17561 basic_machine=ns32k-pc532
17562 ;;
17563+ pc98)
17564+ basic_machine=i386-pc
17565+ ;;
17566+ pc98-*)
17567+ basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
17568+ ;;
17569 pentium | p5 | k5 | k6 | nexgen | viac3)
17570 basic_machine=i586-pc
17571 ;;
17572@@ -839,6 +919,10 @@ case $basic_machine in
17573 basic_machine=i586-unknown
17574 os=-pw32
17575 ;;
17576+ rdos)
17577+ basic_machine=i386-pc
17578+ os=-rdos
17579+ ;;
17580 rom68k)
17581 basic_machine=m68k-rom68k
17582 os=-coff
17583@@ -865,6 +949,10 @@ case $basic_machine in
17584 sb1el)
17585 basic_machine=mipsisa64sb1el-unknown
17586 ;;
17587+ sde)
17588+ basic_machine=mipsisa32-sde
17589+ os=-elf
17590+ ;;
17591 sei)
17592 basic_machine=mips-sei
17593 os=-seiux
17594@@ -876,6 +964,9 @@ case $basic_machine in
17595 basic_machine=sh-hitachi
17596 os=-hms
17597 ;;
17598+ sh5el)
17599+ basic_machine=sh5le-unknown
17600+ ;;
17601 sh64)
17602 basic_machine=sh64-unknown
17603 ;;
17604@@ -965,6 +1056,10 @@ case $basic_machine in
17605 basic_machine=tic6x-unknown
17606 os=-coff
17607 ;;
17608+ tile*)
17609+ basic_machine=tile-unknown
17610+ os=-linux-gnu
17611+ ;;
17612 tx39)
17613 basic_machine=mipstx39-unknown
17614 ;;
17615@@ -1025,6 +1120,10 @@ case $basic_machine in
17616 basic_machine=hppa1.1-winbond
17617 os=-proelf
17618 ;;
17619+ xbox)
17620+ basic_machine=i686-pc
17621+ os=-mingw32
17622+ ;;
17623 xps | xps100)
17624 basic_machine=xps100-honeywell
17625 ;;
17626@@ -1055,6 +1154,9 @@ case $basic_machine in
17627 romp)
17628 basic_machine=romp-ibm
17629 ;;
17630+ mmix)
17631+ basic_machine=mmix-knuth
17632+ ;;
17633 rs6000)
17634 basic_machine=rs6000-ibm
17635 ;;
17636@@ -1071,13 +1173,10 @@ case $basic_machine in
17637 we32k)
17638 basic_machine=we32k-att
17639 ;;
17640- sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele)
17641+ sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
17642 basic_machine=sh-unknown
17643 ;;
17644- sh64)
17645- basic_machine=sh64-unknown
17646- ;;
17647- sparc | sparcv9 | sparcv9b)
17648+ sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
17649 basic_machine=sparc-sun
17650 ;;
17651 cydra)
17652@@ -1150,20 +1249,23 @@ case $os in
17653 | -aos* \
17654 | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
17655 | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
17656- | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
17657+ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
17658+ | -openbsd* | -solidbsd* \
17659 | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
17660 | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
17661 | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
17662 | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
17663 | -chorusos* | -chorusrdb* \
17664 | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
17665- | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
17666+ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
17667+ | -uxpv* | -beos* | -mpeix* | -udk* \
17668 | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
17669 | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
17670 | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
17671 | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
17672 | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
17673- | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*)
17674+ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
17675+ | -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
17676 # Remember, each alternative MUST END IN *, to match a version number.
17677 ;;
17678 -qnx*)
17679@@ -1181,7 +1283,7 @@ case $os in
17680 os=`echo $os | sed -e 's|nto|nto-qnx|'`
17681 ;;
17682 -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
17683- | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
17684+ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
17685 | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
17686 ;;
17687 -mac*)
17688@@ -1290,6 +1392,9 @@ case $os in
17689 -kaos*)
17690 os=-kaos
17691 ;;
17692+ -zvmoe)
17693+ os=-zvmoe
17694+ ;;
17695 -none)
17696 ;;
17697 *)
17698@@ -1312,6 +1417,12 @@ else
17699 # system, and we'll never get to this point.
17700
17701 case $basic_machine in
17702+ score-*)
17703+ os=-elf
17704+ ;;
17705+ spu-*)
17706+ os=-elf
17707+ ;;
17708 *-acorn)
17709 os=-riscix1.2
17710 ;;
17711@@ -1321,9 +1432,9 @@ case $basic_machine in
17712 arm*-semi)
17713 os=-aout
17714 ;;
17715- c4x-* | tic4x-*)
17716- os=-coff
17717- ;;
17718+ c4x-* | tic4x-*)
17719+ os=-coff
17720+ ;;
17721 # This must come before the *-dec entry.
17722 pdp10-*)
17723 os=-tops20
17724@@ -1349,6 +1460,9 @@ case $basic_machine in
17725 m68*-cisco)
17726 os=-aout
17727 ;;
17728+ mep-*)
17729+ os=-elf
17730+ ;;
17731 mips*-cisco)
17732 os=-elf
17733 ;;
17734@@ -1367,9 +1481,15 @@ case $basic_machine in
17735 *-be)
17736 os=-beos
17737 ;;
17738+ *-haiku)
17739+ os=-haiku
17740+ ;;
17741 *-ibm)
17742 os=-aix
17743 ;;
17744+ *-knuth)
17745+ os=-mmixware
17746+ ;;
17747 *-wec)
17748 os=-proelf
17749 ;;
17750@@ -1535,7 +1655,7 @@ case $basic_machine in
17751 esac
17752
17753 echo $basic_machine$os
17754-exit 0
17755+exit
17756
17757 # Local variables:
17758 # eval: (add-hook 'write-file-hooks 'time-stamp)
17759Index: gdb-7.2.90.20110703/readline/support/mkdirs
17760===================================================================
17761--- gdb-7.2.90.20110703.orig/readline/support/mkdirs 2011-07-03 10:40:53.000000000 +0200
17762+++ gdb-7.2.90.20110703/readline/support/mkdirs 2011-07-03 10:41:21.000000000 +0200
17763@@ -7,19 +7,18 @@
17764
17765 # Copyright (C) 1996-2002 Free Software Foundation, Inc.
17766 #
17767-# This program is free software; you can redistribute it and/or modify
17768-# it under the terms of the GNU General Public License as published by
17769-# the Free Software Foundation; either version 2, or (at your option)
17770-# any later version.
17771+# This program is free software: you can redistribute it and/or modify
17772+# it under the terms of the GNU General Public License as published by
17773+# the Free Software Foundation, either version 3 of the License, or
17774+# (at your option) any later version.
17775 #
17776-# This program is distributed in the hope that it will be useful,
17777-# but WITHOUT ANY WARRANTY; without even the implied warranty of
17778-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17779-# GNU General Public License for more details.
17780+# This program is distributed in the hope that it will be useful,
17781+# but WITHOUT ANY WARRANTY; without even the implied warranty of
17782+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17783+# GNU General Public License for more details.
17784 #
17785-# You should have received a copy of the GNU General Public License
17786-# along with this program; if not, write to the Free Software
17787-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
17788+# You should have received a copy of the GNU General Public License
17789+# along with this program. If not, see <http://www.gnu.org/licenses/>.
17790
17791 for dir
17792 do
17793Index: gdb-7.2.90.20110703/readline/support/mkdist
17794===================================================================
17795--- gdb-7.2.90.20110703.orig/readline/support/mkdist 2011-07-03 10:40:53.000000000 +0200
17796+++ gdb-7.2.90.20110703/readline/support/mkdist 2011-07-03 10:41:21.000000000 +0200
17797@@ -12,19 +12,19 @@
17798
17799 # Copyright (C) 1996-2002 Free Software Foundation, Inc.
17800 #
17801-# This program is free software; you can redistribute it and/or modify
17802-# it under the terms of the GNU General Public License as published by
17803-# the Free Software Foundation; either version 2, or (at your option)
17804-# any later version.
17805+# This program is free software: you can redistribute it and/or modify
17806+# it under the terms of the GNU General Public License as published by
17807+# the Free Software Foundation, either version 3 of the License, or
17808+# (at your option) any later version.
17809 #
17810-# This program is distributed in the hope that it will be useful,
17811-# but WITHOUT ANY WARRANTY; without even the implied warranty of
17812-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17813-# GNU General Public License for more details.
17814+# This program is distributed in the hope that it will be useful,
17815+# but WITHOUT ANY WARRANTY; without even the implied warranty of
17816+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17817+# GNU General Public License for more details.
17818+#
17819+# You should have received a copy of the GNU General Public License
17820+# along with this program. If not, see <http://www.gnu.org/licenses/>.
17821 #
17822-# You should have received a copy of the GNU General Public License
17823-# along with this program; if not, write to the Free Software
17824-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
17825
17826 SRCDIR=src
17827 ROOTNAME=bash
17828Index: gdb-7.2.90.20110703/readline/support/shlib-install
17829===================================================================
17830--- gdb-7.2.90.20110703.orig/readline/support/shlib-install 2011-07-03 10:40:53.000000000 +0200
17831+++ gdb-7.2.90.20110703/readline/support/shlib-install 2011-07-03 10:41:21.000000000 +0200
17832@@ -3,7 +3,7 @@
17833 # shlib-install - install a shared library and do any necessary host-specific
17834 # post-installation configuration (like ldconfig)
17835 #
17836-# usage: shlib-install [-D] -O host_os -d installation-dir [-b bin-dir] -i install-prog [-U] library
17837+# usage: shlib-install [-D] -O host_os [-V host_vendor] -d installation-dir [-b bin-dir] -i install-prog [-U] library
17838 #
17839 # Chet Ramey
17840 # chet@po.cwru.edu
17841@@ -15,13 +15,14 @@ INSTALLDIR=/usr/local/lib
17842 LDCONFIG=ldconfig
17843
17844 PROGNAME=`basename $0`
17845-USAGE="$PROGNAME [-D] -O host_os -d installation-dir [-b bin-dir] -i install-prog [-U] library"
17846+USAGE="$PROGNAME [-D] -O host_os [-V host_vendor] -d installation-dir [-b bin-dir] -i install-prog [-U] library"
17847
17848 # process options
17849
17850 while [ $# -gt 0 ]; do
17851 case "$1" in
17852 -O) shift; host_os="$1"; shift ;;
17853+ -V) shift; host_vendor="$1"; shift ;;
17854 -d) shift; INSTALLDIR="$1"; shift ;;
17855 -b) shift; BINDIR="$1" ; shift ;;
17856 -i) shift; INSTALLPROG="$1" ; shift ;;
17857@@ -65,14 +66,15 @@ fi
17858 # post-install/uninstall
17859
17860 # HP-UX and Darwin/MacOS X require that a shared library have execute permission
17861+# Linux does, too, and ldd warns about it
17862 # Cygwin installs both a dll (which must go in $BINDIR) and an implicit
17863 # link library (in $libdir)
17864 case "$host_os" in
17865-hpux*|darwin*|macosx*)
17866+hpux*|darwin*|macosx*|linux*)
17867 if [ -z "$uninstall" ]; then
17868 chmod 555 ${INSTALLDIR}/${LIBNAME}
17869 fi ;;
17870-cygwin*)
17871+cygwin*|mingw*)
17872 IMPLIBNAME=`echo ${LIBNAME} \
17873 | sed -e 's,^cyg,lib,' -e 's,[0-9]*.dll$,.dll.a,'`
17874 if [ -z "$uninstall" ]; then
17875@@ -114,8 +116,8 @@ INSTALL_LINK2='${echo} cd $INSTALLDIR &&
17876 #
17877 # Create symlinks to the installed library. This section is incomplete.
17878 #
17879-case "$host_os" in
17880-*linux*)
17881+case "$host_os-$host_vendor" in
17882+*linux*|freebsd*-gentoo)
17883 # libname.so.M -> libname.so.M.N
17884 ${echo} ${RM} ${INSTALLDIR}/$LINK2
17885 if [ -z "$uninstall" ]; then
17886@@ -129,7 +131,7 @@ case "$host_os" in
17887 fi
17888 ;;
17889
17890-bsdi4*|*gnu*|darwin*|macosx*|k*bsd*-gnu)
17891+bsdi4*|*gnu*|darwin*|macosx*|netbsd*)
17892 # libname.so.M -> libname.so.M.N
17893 ${echo} ${RM} ${INSTALLDIR}/$LINK2
17894 if [ -z "$uninstall" ]; then
17895@@ -143,7 +145,7 @@ bsdi4*|*gnu*|darwin*|macosx*|k*bsd*-gnu)
17896 fi
17897 ;;
17898
17899-solaris2*|aix4.[2-9]*|osf*|irix[56]*|sysv[45]*|dgux*)
17900+solaris2*|aix4.[2-9]*|aix[5-9]*|osf*|irix[56]*|sysv[45]*|dgux*|interix*)
17901 # libname.so -> libname.so.M
17902 ${echo} ${RM} ${INSTALLDIR}/$LINK1
17903 if [ -z "$uninstall" ]; then
17904@@ -153,7 +155,7 @@ solaris2*|aix4.[2-9]*|osf*|irix[56]*|sys
17905
17906
17907 # FreeBSD 3.x and above can have either a.out or ELF shared libraries
17908-freebsd[3-9]*|freebsdelf[3-9]*|freebsdaout[3-9]*)
17909+freebsd3*|freebsdaout*)
17910 if [ -x /usr/bin/objformat ] && [ "`/usr/bin/objformat`" = "elf" ]; then
17911 # libname.so -> libname.so.M
17912 ${echo} ${RM} ${INSTALLDIR}/$LINK1
17913@@ -175,6 +177,14 @@ freebsd[3-9]*|freebsdelf[3-9]*|freebsdao
17914 fi
17915 ;;
17916
17917+freebsd[4-9]*|freebsdelf*|dragonfly*)
17918+ # libname.so -> libname.so.M
17919+ ${echo} ${RM} ${INSTALLDIR}/$LINK1
17920+ if [ -z "$uninstall" ]; then
17921+ eval $INSTALL_LINK1
17922+ fi
17923+ ;;
17924+
17925 hpux1*)
17926 # libname.sl -> libname.M
17927 ${echo} ${RM} ${INSTALLDIR}/$LINK1.sl
17928@@ -183,7 +193,7 @@ hpux1*)
17929 fi
17930 ;;
17931
17932-cygwin*)
17933+cygwin*|mingw*)
17934 # Links to .dlls don't work. Hence shobj-conf used DLLVERSION.dll
17935 # instead of so.SHLIB_MAJOR.SHLIB_MINOR. The postinstall above
17936 # took care of everything else.
17937Index: gdb-7.2.90.20110703/readline/support/shobj-conf
17938===================================================================
17939--- gdb-7.2.90.20110703.orig/readline/support/shobj-conf 2011-07-03 10:40:53.000000000 +0200
17940+++ gdb-7.2.90.20110703/readline/support/shobj-conf 2011-07-03 10:41:21.000000000 +0200
17941@@ -10,21 +10,23 @@
17942 # Chet Ramey
17943 # chet@po.cwru.edu
17944
17945-# Copyright (C) 1996-2002 Free Software Foundation, Inc.
17946+# Copyright (C) 1996-2009 Free Software Foundation, Inc.
17947+#
17948+# This file is part of GNU Bash, the Bourne Again SHell.
17949+#
17950+# This program is free software: you can redistribute it and/or modify
17951+# it under the terms of the GNU General Public License as published by
17952+# the Free Software Foundation, either version 3 of the License, or
17953+# (at your option) any later version.
17954+#
17955+# This program is distributed in the hope that it will be useful,
17956+# but WITHOUT ANY WARRANTY; without even the implied warranty of
17957+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17958+# GNU General Public License for more details.
17959+#
17960+# You should have received a copy of the GNU General Public License
17961+# along with this program. If not, see <http://www.gnu.org/licenses/>.
17962 #
17963-# This program is free software; you can redistribute it and/or modify
17964-# it under the terms of the GNU General Public License as published by
17965-# the Free Software Foundation; either version 2, or (at your option)
17966-# any later version.
17967-#
17968-# This program is distributed in the hope that it will be useful,
17969-# but WITHOUT ANY WARRANTY; without even the implied warranty of
17970-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17971-# GNU General Public License for more details.
17972-#
17973-# You should have received a copy of the GNU General Public License
17974-# along with this program; if not, write to the Free Software
17975-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
17976
17977 #
17978 # defaults
17979@@ -62,7 +64,7 @@ while [ $# -gt 0 ]; do
17980 esac
17981 done
17982
17983-case "${host_os}-${SHOBJ_CC}" in
17984+case "${host_os}-${SHOBJ_CC}-${host_vendor}" in
17985 sunos4*-*gcc*)
17986 SHOBJ_CFLAGS=-fpic
17987 SHOBJ_LD=/usr/bin/ld
17988@@ -80,15 +82,17 @@ sunos4*)
17989 ;;
17990
17991 sunos5*-*gcc*|solaris2*-*gcc*)
17992- SHOBJ_CFLAGS=-fpic
17993 SHOBJ_LD='${CC}'
17994 ld_used=`gcc -print-prog-name=ld`
17995 if ${ld_used} -V 2>&1 | grep GNU >/dev/null 2>&1; then
17996 # This line works for the GNU ld
17997 SHOBJ_LDFLAGS='-shared -Wl,-h,$@'
17998+ # http://sourceware.org/ml/binutils/2001-08/msg00361.html
17999+ SHOBJ_CFLAGS=-fPIC
18000 else
18001 # This line works for the Solaris linker in /usr/ccs/bin/ld
18002 SHOBJ_LDFLAGS='-shared -Wl,-i -Wl,-h,$@'
18003+ SHOBJ_CFLAGS=-fpic
18004 fi
18005
18006 # SHLIB_XLDFLAGS='-R $(libdir)'
18007@@ -104,8 +108,8 @@ sunos5*|solaris2*)
18008 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
18009 ;;
18010
18011-# All versions of Linux or the semi-mythical GNU Hurd.
18012-linux*-*|gnu*-*|k*bsd*-gnu-*)
18013+# All versions of Linux (including Gentoo/FreeBSD) or the semi-mythical GNU Hurd.
18014+linux*-*|gnu*-*|k*bsd*-gnu-*|freebsd*-gentoo)
18015 SHOBJ_CFLAGS=-fPIC
18016 SHOBJ_LD='${CC}'
18017 SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
18018@@ -114,7 +118,7 @@ linux*-*|gnu*-*|k*bsd*-gnu-*)
18019 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
18020 ;;
18021
18022-freebsd2* | netbsd*)
18023+freebsd2*)
18024 SHOBJ_CFLAGS=-fpic
18025 SHOBJ_LD=ld
18026 SHOBJ_LDFLAGS='-x -Bshareable'
18027@@ -124,8 +128,8 @@ freebsd2* | netbsd*)
18028 ;;
18029
18030 # FreeBSD-3.x ELF
18031-freebsd[3-9]*|freebsdelf[3-9]*|freebsdaout[3-9]*|dragonfly*)
18032- SHOBJ_CFLAGS=-fpic
18033+freebsd3*|freebsdaout*)
18034+ SHOBJ_CFLAGS=-fPIC
18035 SHOBJ_LD='${CC}'
18036
18037 if [ -x /usr/bin/objformat ] && [ "`/usr/bin/objformat`" = "elf" ]; then
18038@@ -141,7 +145,35 @@ freebsd[3-9]*|freebsdelf[3-9]*|freebsdao
18039 fi
18040 ;;
18041
18042+# FreeBSD-4.x and later have only ELF
18043+freebsd[4-9]*|freebsdelf*|dragonfly*)
18044+ SHOBJ_CFLAGS=-fPIC
18045+ SHOBJ_LD='${CC}'
18046+
18047+ SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
18048+ SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir)'
18049+
18050+ SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
18051+ ;;
18052+
18053 # Darwin/MacOS X
18054+darwin[89]*|darwin10*)
18055+ SHOBJ_STATUS=supported
18056+ SHLIB_STATUS=supported
18057+
18058+ SHOBJ_CFLAGS='-fno-common'
18059+
18060+ SHOBJ_LD='MACOSX_DEPLOYMENT_TARGET=10.3 ${CC}'
18061+
18062+ SHLIB_LIBVERSION='$(SHLIB_MAJOR)$(SHLIB_MINOR).$(SHLIB_LIBSUFF)'
18063+ SHLIB_LIBSUFF='dylib'
18064+
18065+ SHOBJ_LDFLAGS='-dynamiclib -dynamic -undefined dynamic_lookup -arch_only `/usr/bin/arch`'
18066+ SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
18067+
18068+ SHLIB_LIBS='-lncurses' # see if -lcurses works on MacOS X 10.1
18069+ ;;
18070+
18071 darwin*|macosx*)
18072 SHOBJ_STATUS=unsupported
18073 SHLIB_STATUS=supported
18074@@ -154,7 +186,7 @@ darwin*|macosx*)
18075 SHLIB_LIBSUFF='dylib'
18076
18077 case "${host_os}" in
18078- darwin[78]*) SHOBJ_LDFLAGS=''
18079+ darwin[789]*|darwin10*) SHOBJ_LDFLAGS=''
18080 SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
18081 ;;
18082 *) SHOBJ_LDFLAGS='-dynamic'
18083@@ -165,7 +197,7 @@ darwin*|macosx*)
18084 SHLIB_LIBS='-lncurses' # see if -lcurses works on MacOS X 10.1
18085 ;;
18086
18087-openbsd*)
18088+openbsd*|netbsd*)
18089 SHOBJ_CFLAGS=-fPIC
18090 SHOBJ_LD='${CC}'
18091 SHOBJ_LDFLAGS='-shared'
18092@@ -230,7 +262,7 @@ osf*)
18093 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
18094 ;;
18095
18096-aix4.[2-9]*-*gcc*) # lightly tested by jik@cisco.com
18097+aix4.[2-9]*-*gcc*|aix[5-9].*-*gcc*) # lightly tested by jik@cisco.com
18098 SHOBJ_CFLAGS=-fpic
18099 SHOBJ_LD='ld'
18100 SHOBJ_LDFLAGS='-bdynamic -bnoentry -bexpall'
18101@@ -241,7 +273,7 @@ aix4.[2-9]*-*gcc*) # lightly tested by
18102 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
18103 ;;
18104
18105-aix4.[2-9]*)
18106+aix4.[2-9]*|aix[5-9].*)
18107 SHOBJ_CFLAGS=-K
18108 SHOBJ_LD='ld'
18109 SHOBJ_LDFLAGS='-bdynamic -bnoentry -bexpall'
18110@@ -312,7 +344,7 @@ hpux10*-*gcc*)
18111 SHOBJ_LD='${CC}'
18112 # if you have problems linking here, moving the `-Wl,+h,$@' from
18113 # SHLIB_XLDFLAGS to SHOBJ_LDFLAGS has been reported to work
18114- SHOBJ_LDFLAGS='-shared -Wl,-b -Wl,+s'
18115+ SHOBJ_LDFLAGS='-shared -fpic -Wl,-b -Wl,+s'
18116
18117 SHLIB_XLDFLAGS='-Wl,+h,$@ -Wl,+b,$(libdir)'
18118 SHLIB_LIBSUFF='sl'
18119@@ -472,20 +504,37 @@ msdos*)
18120
18121 cygwin*)
18122 SHOBJ_LD='$(CC)'
18123- SHOBJ_LDFLAGS='-shared -Wl,--enable-auto-import -Wl,--enable-auto-image-base -Wl,--export-all -Wl,--out-implib=$(@).a'
18124- SHLIB_LIBPREF='cyg'
18125- SHLIB_LIBSUFF='dll'
18126- SHLIB_LIBVERSION='$(SHLIB_DLLVERSION).$(SHLIB_LIBSUFF)'
18127- SHLIB_LIBS='$(TERMCAP_LIB)'
18128+ SHOBJ_LDFLAGS='-shared -Wl,--enable-auto-import -Wl,--enable-auto-image-base -Wl,--export-all -Wl,--out-implib=$(@).a'
18129+ SHLIB_LIBPREF='cyg'
18130+ SHLIB_LIBSUFF='dll'
18131+ SHLIB_LIBVERSION='$(SHLIB_DLLVERSION).$(SHLIB_LIBSUFF)'
18132+ SHLIB_LIBS='$(TERMCAP_LIB)'
18133
18134 SHLIB_DOT=
18135- # For official cygwin releases, DLLVERSION will be defined in the
18136- # environment of configure, and will be incremented any time the API
18137- # changes in a non-backwards compatible manner. Otherwise, it is just
18138- # SHLIB_MAJOR.
18139- if [ -n "$DLLVERSION" ] ; then
18140+ # For official cygwin releases, DLLVERSION will be defined in the
18141+ # environment of configure, and will be incremented any time the API
18142+ # changes in a non-backwards compatible manner. Otherwise, it is just
18143+ # SHLIB_MAJOR.
18144+ if [ -n "$DLLVERSION" ] ; then
18145 SHLIB_DLLVERSION="$DLLVERSION"
18146- fi
18147+ fi
18148+ ;;
18149+
18150+mingw*)
18151+ SHOBJ_LD='$(CC)'
18152+ SHOBJ_LDFLAGS='-shared -Wl,--enable-auto-import -Wl,--enable-auto-image-base -Wl,--export-all -Wl,--out-implib=$(@).a'
18153+ SHLIB_LIBSUFF='dll'
18154+ SHLIB_LIBVERSION='$(SHLIB_DLLVERSION).$(SHLIB_LIBSUFF)'
18155+ SHLIB_LIBS='$(TERMCAP_LIB)'
18156+
18157+ SHLIB_DOT=
18158+ # For official cygwin releases, DLLVERSION will be defined in the
18159+ # environment of configure, and will be incremented any time the API
18160+ # changes in a non-backwards compatible manner. Otherwise, it is just
18161+ # SHLIB_MAJOR.
18162+ if [ -n "$DLLVERSION" ] ; then
18163+ SHLIB_DLLVERSION="$DLLVERSION"
18164+ fi
18165 ;;
18166
18167 #
18168Index: gdb-7.2.90.20110703/readline/support/wcwidth.c
18169===================================================================
18170--- gdb-7.2.90.20110703.orig/readline/support/wcwidth.c 2011-07-03 10:40:53.000000000 +0200
18171+++ gdb-7.2.90.20110703/readline/support/wcwidth.c 2011-07-03 10:41:21.000000000 +0200
18172@@ -1,21 +1,73 @@
18173 /*
18174- * This is an implementation of wcwidth() and wcswidth() as defined in
18175- * "The Single UNIX Specification, Version 2, The Open Group, 1997"
18176- * <http://www.UNIX-systems.org/online.html>
18177+ * This is an implementation of wcwidth() and wcswidth() (defined in
18178+ * IEEE Std 1002.1-2001) for Unicode.
18179 *
18180- * Markus Kuhn -- 2001-09-08 -- public domain
18181+ * http://www.opengroup.org/onlinepubs/007904975/functions/wcwidth.html
18182+ * http://www.opengroup.org/onlinepubs/007904975/functions/wcswidth.html
18183+ *
18184+ * In fixed-width output devices, Latin characters all occupy a single
18185+ * "cell" position of equal width, whereas ideographic CJK characters
18186+ * occupy two such cells. Interoperability between terminal-line
18187+ * applications and (teletype-style) character terminals using the
18188+ * UTF-8 encoding requires agreement on which character should advance
18189+ * the cursor by how many cell positions. No established formal
18190+ * standards exist at present on which Unicode character shall occupy
18191+ * how many cell positions on character terminals. These routines are
18192+ * a first attempt of defining such behavior based on simple rules
18193+ * applied to data provided by the Unicode Consortium.
18194+ *
18195+ * For some graphical characters, the Unicode standard explicitly
18196+ * defines a character-cell width via the definition of the East Asian
18197+ * FullWidth (F), Wide (W), Half-width (H), and Narrow (Na) classes.
18198+ * In all these cases, there is no ambiguity about which width a
18199+ * terminal shall use. For characters in the East Asian Ambiguous (A)
18200+ * class, the width choice depends purely on a preference of backward
18201+ * compatibility with either historic CJK or Western practice.
18202+ * Choosing single-width for these characters is easy to justify as
18203+ * the appropriate long-term solution, as the CJK practice of
18204+ * displaying these characters as double-width comes from historic
18205+ * implementation simplicity (8-bit encoded characters were displayed
18206+ * single-width and 16-bit ones double-width, even for Greek,
18207+ * Cyrillic, etc.) and not any typographic considerations.
18208+ *
18209+ * Much less clear is the choice of width for the Not East Asian
18210+ * (Neutral) class. Existing practice does not dictate a width for any
18211+ * of these characters. It would nevertheless make sense
18212+ * typographically to allocate two character cells to characters such
18213+ * as for instance EM SPACE or VOLUME INTEGRAL, which cannot be
18214+ * represented adequately with a single-width glyph. The following
18215+ * routines at present merely assign a single-cell width to all
18216+ * neutral characters, in the interest of simplicity. This is not
18217+ * entirely satisfactory and should be reconsidered before
18218+ * establishing a formal standard in this area. At the moment, the
18219+ * decision which Not East Asian (Neutral) characters should be
18220+ * represented by double-width glyphs cannot yet be answered by
18221+ * applying a simple rule from the Unicode database content. Setting
18222+ * up a proper standard for the behavior of UTF-8 character terminals
18223+ * will require a careful analysis not only of each Unicode character,
18224+ * but also of each presentation form, something the author of these
18225+ * routines has avoided to do so far.
18226+ *
18227+ * http://www.unicode.org/unicode/reports/tr11/
18228+ *
18229+ * Markus Kuhn -- 2007-05-26 (Unicode 5.0)
18230+ *
18231+ * Permission to use, copy, modify, and distribute this software
18232+ * for any purpose and without fee is hereby granted. The author
18233+ * disclaims all warranties with regard to this software.
18234+ *
18235+ * Latest version: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c
18236 */
18237
18238 #ifdef __GO32__
18239-/* DJGPP needs to include this before including wchar.h. */
18240-# include <wctype.h>
18241+# include <wctype.h>
18242 #endif
18243
18244 #include <wchar.h>
18245
18246 struct interval {
18247- unsigned short first;
18248- unsigned short last;
18249+ int first;
18250+ int last;
18251 };
18252
18253 /* auxiliary function for binary search in interval table */
18254@@ -39,7 +91,7 @@ static int bisearch(wchar_t ucs, const s
18255 }
18256
18257
18258-/* The following functions define the column width of an ISO 10646
18259+/* The following two functions define the column width of an ISO 10646
18260 * character as follows:
18261 *
18262 * - The null character (U+0000) has a column width of 0.
18263@@ -51,6 +103,8 @@ static int bisearch(wchar_t ucs, const s
18264 * category code Mn or Me in the Unicode database) have a
18265 * column width of 0.
18266 *
18267+ * - SOFT HYPHEN (U+00AD) has a column width of 1.
18268+ *
18269 * - Other format characters (general category code Cf in the Unicode
18270 * database) and ZERO WIDTH SPACE (U+200B) have a column width of 0.
18271 *
18272@@ -58,7 +112,7 @@ static int bisearch(wchar_t ucs, const s
18273 * have a column width of 0.
18274 *
18275 * - Spacing characters in the East Asian Wide (W) or East Asian
18276- * FullWidth (F) category as defined in Unicode Technical
18277+ * Full-width (F) category as defined in Unicode Technical
18278 * Report #11 have a column width of 2.
18279 *
18280 * - All remaining characters (including all printable
18281@@ -69,44 +123,59 @@ static int bisearch(wchar_t ucs, const s
18282 * in ISO 10646.
18283 */
18284
18285-int wcwidth(wchar_t ucs)
18286+int mk_wcwidth(wchar_t ucs)
18287 {
18288 /* sorted list of non-overlapping intervals of non-spacing characters */
18289+ /* generated by "uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c" */
18290 static const struct interval combining[] = {
18291- { 0x0300, 0x034E }, { 0x0360, 0x0362 }, { 0x0483, 0x0486 },
18292- { 0x0488, 0x0489 }, { 0x0591, 0x05A1 }, { 0x05A3, 0x05B9 },
18293- { 0x05BB, 0x05BD }, { 0x05BF, 0x05BF }, { 0x05C1, 0x05C2 },
18294- { 0x05C4, 0x05C4 }, { 0x064B, 0x0655 }, { 0x0670, 0x0670 },
18295+ { 0x0300, 0x036F }, { 0x0483, 0x0486 }, { 0x0488, 0x0489 },
18296+ { 0x0591, 0x05BD }, { 0x05BF, 0x05BF }, { 0x05C1, 0x05C2 },
18297+ { 0x05C4, 0x05C5 }, { 0x05C7, 0x05C7 }, { 0x0600, 0x0603 },
18298+ { 0x0610, 0x0615 }, { 0x064B, 0x065E }, { 0x0670, 0x0670 },
18299 { 0x06D6, 0x06E4 }, { 0x06E7, 0x06E8 }, { 0x06EA, 0x06ED },
18300 { 0x070F, 0x070F }, { 0x0711, 0x0711 }, { 0x0730, 0x074A },
18301- { 0x07A6, 0x07B0 }, { 0x0901, 0x0902 }, { 0x093C, 0x093C },
18302- { 0x0941, 0x0948 }, { 0x094D, 0x094D }, { 0x0951, 0x0954 },
18303- { 0x0962, 0x0963 }, { 0x0981, 0x0981 }, { 0x09BC, 0x09BC },
18304- { 0x09C1, 0x09C4 }, { 0x09CD, 0x09CD }, { 0x09E2, 0x09E3 },
18305- { 0x0A02, 0x0A02 }, { 0x0A3C, 0x0A3C }, { 0x0A41, 0x0A42 },
18306- { 0x0A47, 0x0A48 }, { 0x0A4B, 0x0A4D }, { 0x0A70, 0x0A71 },
18307- { 0x0A81, 0x0A82 }, { 0x0ABC, 0x0ABC }, { 0x0AC1, 0x0AC5 },
18308- { 0x0AC7, 0x0AC8 }, { 0x0ACD, 0x0ACD }, { 0x0B01, 0x0B01 },
18309- { 0x0B3C, 0x0B3C }, { 0x0B3F, 0x0B3F }, { 0x0B41, 0x0B43 },
18310- { 0x0B4D, 0x0B4D }, { 0x0B56, 0x0B56 }, { 0x0B82, 0x0B82 },
18311- { 0x0BC0, 0x0BC0 }, { 0x0BCD, 0x0BCD }, { 0x0C3E, 0x0C40 },
18312- { 0x0C46, 0x0C48 }, { 0x0C4A, 0x0C4D }, { 0x0C55, 0x0C56 },
18313+ { 0x07A6, 0x07B0 }, { 0x07EB, 0x07F3 }, { 0x0901, 0x0902 },
18314+ { 0x093C, 0x093C }, { 0x0941, 0x0948 }, { 0x094D, 0x094D },
18315+ { 0x0951, 0x0954 }, { 0x0962, 0x0963 }, { 0x0981, 0x0981 },
18316+ { 0x09BC, 0x09BC }, { 0x09C1, 0x09C4 }, { 0x09CD, 0x09CD },
18317+ { 0x09E2, 0x09E3 }, { 0x0A01, 0x0A02 }, { 0x0A3C, 0x0A3C },
18318+ { 0x0A41, 0x0A42 }, { 0x0A47, 0x0A48 }, { 0x0A4B, 0x0A4D },
18319+ { 0x0A70, 0x0A71 }, { 0x0A81, 0x0A82 }, { 0x0ABC, 0x0ABC },
18320+ { 0x0AC1, 0x0AC5 }, { 0x0AC7, 0x0AC8 }, { 0x0ACD, 0x0ACD },
18321+ { 0x0AE2, 0x0AE3 }, { 0x0B01, 0x0B01 }, { 0x0B3C, 0x0B3C },
18322+ { 0x0B3F, 0x0B3F }, { 0x0B41, 0x0B43 }, { 0x0B4D, 0x0B4D },
18323+ { 0x0B56, 0x0B56 }, { 0x0B82, 0x0B82 }, { 0x0BC0, 0x0BC0 },
18324+ { 0x0BCD, 0x0BCD }, { 0x0C3E, 0x0C40 }, { 0x0C46, 0x0C48 },
18325+ { 0x0C4A, 0x0C4D }, { 0x0C55, 0x0C56 }, { 0x0CBC, 0x0CBC },
18326 { 0x0CBF, 0x0CBF }, { 0x0CC6, 0x0CC6 }, { 0x0CCC, 0x0CCD },
18327- { 0x0D41, 0x0D43 }, { 0x0D4D, 0x0D4D }, { 0x0DCA, 0x0DCA },
18328- { 0x0DD2, 0x0DD4 }, { 0x0DD6, 0x0DD6 }, { 0x0E31, 0x0E31 },
18329- { 0x0E34, 0x0E3A }, { 0x0E47, 0x0E4E }, { 0x0EB1, 0x0EB1 },
18330- { 0x0EB4, 0x0EB9 }, { 0x0EBB, 0x0EBC }, { 0x0EC8, 0x0ECD },
18331- { 0x0F18, 0x0F19 }, { 0x0F35, 0x0F35 }, { 0x0F37, 0x0F37 },
18332- { 0x0F39, 0x0F39 }, { 0x0F71, 0x0F7E }, { 0x0F80, 0x0F84 },
18333- { 0x0F86, 0x0F87 }, { 0x0F90, 0x0F97 }, { 0x0F99, 0x0FBC },
18334- { 0x0FC6, 0x0FC6 }, { 0x102D, 0x1030 }, { 0x1032, 0x1032 },
18335- { 0x1036, 0x1037 }, { 0x1039, 0x1039 }, { 0x1058, 0x1059 },
18336- { 0x1160, 0x11FF }, { 0x17B7, 0x17BD }, { 0x17C6, 0x17C6 },
18337- { 0x17C9, 0x17D3 }, { 0x180B, 0x180E }, { 0x18A9, 0x18A9 },
18338- { 0x200B, 0x200F }, { 0x202A, 0x202E }, { 0x206A, 0x206F },
18339- { 0x20D0, 0x20E3 }, { 0x302A, 0x302F }, { 0x3099, 0x309A },
18340- { 0xFB1E, 0xFB1E }, { 0xFE20, 0xFE23 }, { 0xFEFF, 0xFEFF },
18341- { 0xFFF9, 0xFFFB }
18342+ { 0x0CE2, 0x0CE3 }, { 0x0D41, 0x0D43 }, { 0x0D4D, 0x0D4D },
18343+ { 0x0DCA, 0x0DCA }, { 0x0DD2, 0x0DD4 }, { 0x0DD6, 0x0DD6 },
18344+ { 0x0E31, 0x0E31 }, { 0x0E34, 0x0E3A }, { 0x0E47, 0x0E4E },
18345+ { 0x0EB1, 0x0EB1 }, { 0x0EB4, 0x0EB9 }, { 0x0EBB, 0x0EBC },
18346+ { 0x0EC8, 0x0ECD }, { 0x0F18, 0x0F19 }, { 0x0F35, 0x0F35 },
18347+ { 0x0F37, 0x0F37 }, { 0x0F39, 0x0F39 }, { 0x0F71, 0x0F7E },
18348+ { 0x0F80, 0x0F84 }, { 0x0F86, 0x0F87 }, { 0x0F90, 0x0F97 },
18349+ { 0x0F99, 0x0FBC }, { 0x0FC6, 0x0FC6 }, { 0x102D, 0x1030 },
18350+ { 0x1032, 0x1032 }, { 0x1036, 0x1037 }, { 0x1039, 0x1039 },
18351+ { 0x1058, 0x1059 }, { 0x1160, 0x11FF }, { 0x135F, 0x135F },
18352+ { 0x1712, 0x1714 }, { 0x1732, 0x1734 }, { 0x1752, 0x1753 },
18353+ { 0x1772, 0x1773 }, { 0x17B4, 0x17B5 }, { 0x17B7, 0x17BD },
18354+ { 0x17C6, 0x17C6 }, { 0x17C9, 0x17D3 }, { 0x17DD, 0x17DD },
18355+ { 0x180B, 0x180D }, { 0x18A9, 0x18A9 }, { 0x1920, 0x1922 },
18356+ { 0x1927, 0x1928 }, { 0x1932, 0x1932 }, { 0x1939, 0x193B },
18357+ { 0x1A17, 0x1A18 }, { 0x1B00, 0x1B03 }, { 0x1B34, 0x1B34 },
18358+ { 0x1B36, 0x1B3A }, { 0x1B3C, 0x1B3C }, { 0x1B42, 0x1B42 },
18359+ { 0x1B6B, 0x1B73 }, { 0x1DC0, 0x1DCA }, { 0x1DFE, 0x1DFF },
18360+ { 0x200B, 0x200F }, { 0x202A, 0x202E }, { 0x2060, 0x2063 },
18361+ { 0x206A, 0x206F }, { 0x20D0, 0x20EF }, { 0x302A, 0x302F },
18362+ { 0x3099, 0x309A }, { 0xA806, 0xA806 }, { 0xA80B, 0xA80B },
18363+ { 0xA825, 0xA826 }, { 0xFB1E, 0xFB1E }, { 0xFE00, 0xFE0F },
18364+ { 0xFE20, 0xFE23 }, { 0xFEFF, 0xFEFF }, { 0xFFF9, 0xFFFB },
18365+ { 0x10A01, 0x10A03 }, { 0x10A05, 0x10A06 }, { 0x10A0C, 0x10A0F },
18366+ { 0x10A38, 0x10A3A }, { 0x10A3F, 0x10A3F }, { 0x1D167, 0x1D169 },
18367+ { 0x1D173, 0x1D182 }, { 0x1D185, 0x1D18B }, { 0x1D1AA, 0x1D1AD },
18368+ { 0x1D242, 0x1D244 }, { 0xE0001, 0xE0001 }, { 0xE0020, 0xE007F },
18369+ { 0xE0100, 0xE01EF }
18370 };
18371
18372 /* test for 8-bit control characters */
18373@@ -125,23 +194,26 @@ int wcwidth(wchar_t ucs)
18374 return 1 +
18375 (ucs >= 0x1100 &&
18376 (ucs <= 0x115f || /* Hangul Jamo init. consonants */
18377- (ucs >= 0x2e80 && ucs <= 0xa4cf && (ucs & ~0x0011) != 0x300a &&
18378+ ucs == 0x2329 || ucs == 0x232a ||
18379+ (ucs >= 0x2e80 && ucs <= 0xa4cf &&
18380 ucs != 0x303f) || /* CJK ... Yi */
18381 (ucs >= 0xac00 && ucs <= 0xd7a3) || /* Hangul Syllables */
18382 (ucs >= 0xf900 && ucs <= 0xfaff) || /* CJK Compatibility Ideographs */
18383+ (ucs >= 0xfe10 && ucs <= 0xfe19) || /* Vertical forms */
18384 (ucs >= 0xfe30 && ucs <= 0xfe6f) || /* CJK Compatibility Forms */
18385- (ucs >= 0xff00 && ucs <= 0xff5f) || /* Fullwidth Forms */
18386+ (ucs >= 0xff00 && ucs <= 0xff60) || /* Fullwidth Forms */
18387 (ucs >= 0xffe0 && ucs <= 0xffe6) ||
18388- (ucs >= 0x20000 && ucs <= 0x2ffff)));
18389+ (ucs >= 0x20000 && ucs <= 0x2fffd) ||
18390+ (ucs >= 0x30000 && ucs <= 0x3fffd)));
18391 }
18392
18393
18394-int wcswidth(const wchar_t *pwcs, size_t n)
18395+int mk_wcswidth(const wchar_t *pwcs, size_t n)
18396 {
18397 int w, width = 0;
18398
18399 for (;*pwcs && n-- > 0; pwcs++)
18400- if ((w = wcwidth(*pwcs)) < 0)
18401+ if ((w = mk_wcwidth(*pwcs)) < 0)
18402 return -1;
18403 else
18404 width += w;
18405@@ -151,20 +223,21 @@ int wcswidth(const wchar_t *pwcs, size_t
18406
18407
18408 /*
18409- * The following function is the same as wcwidth(), except that
18410- * spacing characters in the East Asian Ambiguous (A) category as
18411- * defined in Unicode Technical Report #11 have a column width of 2.
18412- * This experimental variant might be useful for users of CJK legacy
18413- * encodings who want to migrate to UCS. It is not otherwise
18414- * recommended for general use.
18415+ * The following functions are the same as mk_wcwidth() and
18416+ * mk_wcswidth(), except that spacing characters in the East Asian
18417+ * Ambiguous (A) category as defined in Unicode Technical Report #11
18418+ * have a column width of 2. This variant might be useful for users of
18419+ * CJK legacy encodings who want to migrate to UCS without changing
18420+ * the traditional terminal character-width behaviour. It is not
18421+ * otherwise recommended for general use.
18422 */
18423-static int wcwidth_cjk(wchar_t ucs)
18424+int mk_wcwidth_cjk(wchar_t ucs)
18425 {
18426 /* sorted list of non-overlapping intervals of East Asian Ambiguous
18427- * characters */
18428+ * characters, generated by "uniset +WIDTH-A -cat=Me -cat=Mn -cat=Cf c" */
18429 static const struct interval ambiguous[] = {
18430 { 0x00A1, 0x00A1 }, { 0x00A4, 0x00A4 }, { 0x00A7, 0x00A8 },
18431- { 0x00AA, 0x00AA }, { 0x00AD, 0x00AE }, { 0x00B0, 0x00B4 },
18432+ { 0x00AA, 0x00AA }, { 0x00AE, 0x00AE }, { 0x00B0, 0x00B4 },
18433 { 0x00B6, 0x00BA }, { 0x00BC, 0x00BF }, { 0x00C6, 0x00C6 },
18434 { 0x00D0, 0x00D0 }, { 0x00D7, 0x00D8 }, { 0x00DE, 0x00E1 },
18435 { 0x00E6, 0x00E6 }, { 0x00E8, 0x00EA }, { 0x00EC, 0x00ED },
18436@@ -180,42 +253,41 @@ static int wcwidth_cjk(wchar_t ucs)
18437 { 0x01DC, 0x01DC }, { 0x0251, 0x0251 }, { 0x0261, 0x0261 },
18438 { 0x02C4, 0x02C4 }, { 0x02C7, 0x02C7 }, { 0x02C9, 0x02CB },
18439 { 0x02CD, 0x02CD }, { 0x02D0, 0x02D0 }, { 0x02D8, 0x02DB },
18440- { 0x02DD, 0x02DD }, { 0x02DF, 0x02DF }, { 0x0300, 0x034E },
18441- { 0x0360, 0x0362 }, { 0x0391, 0x03A1 }, { 0x03A3, 0x03A9 },
18442- { 0x03B1, 0x03C1 }, { 0x03C3, 0x03C9 }, { 0x0401, 0x0401 },
18443- { 0x0410, 0x044F }, { 0x0451, 0x0451 }, { 0x2010, 0x2010 },
18444- { 0x2013, 0x2016 }, { 0x2018, 0x2019 }, { 0x201C, 0x201D },
18445- { 0x2020, 0x2022 }, { 0x2024, 0x2027 }, { 0x2030, 0x2030 },
18446- { 0x2032, 0x2033 }, { 0x2035, 0x2035 }, { 0x203B, 0x203B },
18447- { 0x203E, 0x203E }, { 0x2074, 0x2074 }, { 0x207F, 0x207F },
18448- { 0x2081, 0x2084 }, { 0x20AC, 0x20AC }, { 0x2103, 0x2103 },
18449- { 0x2105, 0x2105 }, { 0x2109, 0x2109 }, { 0x2113, 0x2113 },
18450- { 0x2116, 0x2116 }, { 0x2121, 0x2122 }, { 0x2126, 0x2126 },
18451- { 0x212B, 0x212B }, { 0x2153, 0x2155 }, { 0x215B, 0x215E },
18452- { 0x2160, 0x216B }, { 0x2170, 0x2179 }, { 0x2190, 0x2199 },
18453- { 0x21B8, 0x21B9 }, { 0x21D2, 0x21D2 }, { 0x21D4, 0x21D4 },
18454- { 0x21E7, 0x21E7 }, { 0x2200, 0x2200 }, { 0x2202, 0x2203 },
18455- { 0x2207, 0x2208 }, { 0x220B, 0x220B }, { 0x220F, 0x220F },
18456- { 0x2211, 0x2211 }, { 0x2215, 0x2215 }, { 0x221A, 0x221A },
18457- { 0x221D, 0x2220 }, { 0x2223, 0x2223 }, { 0x2225, 0x2225 },
18458- { 0x2227, 0x222C }, { 0x222E, 0x222E }, { 0x2234, 0x2237 },
18459- { 0x223C, 0x223D }, { 0x2248, 0x2248 }, { 0x224C, 0x224C },
18460- { 0x2252, 0x2252 }, { 0x2260, 0x2261 }, { 0x2264, 0x2267 },
18461- { 0x226A, 0x226B }, { 0x226E, 0x226F }, { 0x2282, 0x2283 },
18462- { 0x2286, 0x2287 }, { 0x2295, 0x2295 }, { 0x2299, 0x2299 },
18463- { 0x22A5, 0x22A5 }, { 0x22BF, 0x22BF }, { 0x2312, 0x2312 },
18464- { 0x2329, 0x232A }, { 0x2460, 0x24BF }, { 0x24D0, 0x24E9 },
18465- { 0x2500, 0x254B }, { 0x2550, 0x2574 }, { 0x2580, 0x258F },
18466- { 0x2592, 0x2595 }, { 0x25A0, 0x25A1 }, { 0x25A3, 0x25A9 },
18467- { 0x25B2, 0x25B3 }, { 0x25B6, 0x25B7 }, { 0x25BC, 0x25BD },
18468- { 0x25C0, 0x25C1 }, { 0x25C6, 0x25C8 }, { 0x25CB, 0x25CB },
18469- { 0x25CE, 0x25D1 }, { 0x25E2, 0x25E5 }, { 0x25EF, 0x25EF },
18470- { 0x2605, 0x2606 }, { 0x2609, 0x2609 }, { 0x260E, 0x260F },
18471+ { 0x02DD, 0x02DD }, { 0x02DF, 0x02DF }, { 0x0391, 0x03A1 },
18472+ { 0x03A3, 0x03A9 }, { 0x03B1, 0x03C1 }, { 0x03C3, 0x03C9 },
18473+ { 0x0401, 0x0401 }, { 0x0410, 0x044F }, { 0x0451, 0x0451 },
18474+ { 0x2010, 0x2010 }, { 0x2013, 0x2016 }, { 0x2018, 0x2019 },
18475+ { 0x201C, 0x201D }, { 0x2020, 0x2022 }, { 0x2024, 0x2027 },
18476+ { 0x2030, 0x2030 }, { 0x2032, 0x2033 }, { 0x2035, 0x2035 },
18477+ { 0x203B, 0x203B }, { 0x203E, 0x203E }, { 0x2074, 0x2074 },
18478+ { 0x207F, 0x207F }, { 0x2081, 0x2084 }, { 0x20AC, 0x20AC },
18479+ { 0x2103, 0x2103 }, { 0x2105, 0x2105 }, { 0x2109, 0x2109 },
18480+ { 0x2113, 0x2113 }, { 0x2116, 0x2116 }, { 0x2121, 0x2122 },
18481+ { 0x2126, 0x2126 }, { 0x212B, 0x212B }, { 0x2153, 0x2154 },
18482+ { 0x215B, 0x215E }, { 0x2160, 0x216B }, { 0x2170, 0x2179 },
18483+ { 0x2190, 0x2199 }, { 0x21B8, 0x21B9 }, { 0x21D2, 0x21D2 },
18484+ { 0x21D4, 0x21D4 }, { 0x21E7, 0x21E7 }, { 0x2200, 0x2200 },
18485+ { 0x2202, 0x2203 }, { 0x2207, 0x2208 }, { 0x220B, 0x220B },
18486+ { 0x220F, 0x220F }, { 0x2211, 0x2211 }, { 0x2215, 0x2215 },
18487+ { 0x221A, 0x221A }, { 0x221D, 0x2220 }, { 0x2223, 0x2223 },
18488+ { 0x2225, 0x2225 }, { 0x2227, 0x222C }, { 0x222E, 0x222E },
18489+ { 0x2234, 0x2237 }, { 0x223C, 0x223D }, { 0x2248, 0x2248 },
18490+ { 0x224C, 0x224C }, { 0x2252, 0x2252 }, { 0x2260, 0x2261 },
18491+ { 0x2264, 0x2267 }, { 0x226A, 0x226B }, { 0x226E, 0x226F },
18492+ { 0x2282, 0x2283 }, { 0x2286, 0x2287 }, { 0x2295, 0x2295 },
18493+ { 0x2299, 0x2299 }, { 0x22A5, 0x22A5 }, { 0x22BF, 0x22BF },
18494+ { 0x2312, 0x2312 }, { 0x2460, 0x24E9 }, { 0x24EB, 0x254B },
18495+ { 0x2550, 0x2573 }, { 0x2580, 0x258F }, { 0x2592, 0x2595 },
18496+ { 0x25A0, 0x25A1 }, { 0x25A3, 0x25A9 }, { 0x25B2, 0x25B3 },
18497+ { 0x25B6, 0x25B7 }, { 0x25BC, 0x25BD }, { 0x25C0, 0x25C1 },
18498+ { 0x25C6, 0x25C8 }, { 0x25CB, 0x25CB }, { 0x25CE, 0x25D1 },
18499+ { 0x25E2, 0x25E5 }, { 0x25EF, 0x25EF }, { 0x2605, 0x2606 },
18500+ { 0x2609, 0x2609 }, { 0x260E, 0x260F }, { 0x2614, 0x2615 },
18501 { 0x261C, 0x261C }, { 0x261E, 0x261E }, { 0x2640, 0x2640 },
18502 { 0x2642, 0x2642 }, { 0x2660, 0x2661 }, { 0x2663, 0x2665 },
18503 { 0x2667, 0x266A }, { 0x266C, 0x266D }, { 0x266F, 0x266F },
18504- { 0x273D, 0x273D }, { 0x3008, 0x300B }, { 0x3014, 0x3015 },
18505- { 0x3018, 0x301B }, { 0xFFFD, 0xFFFD }
18506+ { 0x273D, 0x273D }, { 0x2776, 0x277F }, { 0xE000, 0xF8FF },
18507+ { 0xFFFD, 0xFFFD }, { 0xF0000, 0xFFFFD }, { 0x100000, 0x10FFFD }
18508 };
18509
18510 /* binary search in table of non-spacing characters */
18511@@ -223,16 +295,16 @@ static int wcwidth_cjk(wchar_t ucs)
18512 sizeof(ambiguous) / sizeof(struct interval) - 1))
18513 return 2;
18514
18515- return wcwidth(ucs);
18516+ return mk_wcwidth(ucs);
18517 }
18518
18519
18520-int wcswidth_cjk(const wchar_t *pwcs, size_t n)
18521+int mk_wcswidth_cjk(const wchar_t *pwcs, size_t n)
18522 {
18523 int w, width = 0;
18524
18525 for (;*pwcs && n-- > 0; pwcs++)
18526- if ((w = wcwidth_cjk(*pwcs)) < 0)
18527+ if ((w = mk_wcwidth_cjk(*pwcs)) < 0)
18528 return -1;
18529 else
18530 width += w;
18531Index: gdb-7.2.90.20110703/readline/tcap.h
18532===================================================================
18533--- gdb-7.2.90.20110703.orig/readline/tcap.h 2011-07-03 10:40:53.000000000 +0200
18534+++ gdb-7.2.90.20110703/readline/tcap.h 2011-07-03 10:41:21.000000000 +0200
18535@@ -1,25 +1,23 @@
18536 /* tcap.h -- termcap library functions and variables. */
18537
18538-/* Copyright (C) 1996 Free Software Foundation, Inc.
18539+/* Copyright (C) 1996-2009 Free Software Foundation, Inc.
18540
18541- This file contains the Readline Library (the Library), a set of
18542- routines for providing Emacs style line input to programs that ask
18543- for it.
18544+ This file is part of the GNU Readline Library (Readline), a library
18545+ for reading lines of text with interactive input and history editing.
18546
18547- The Library is free software; you can redistribute it and/or modify
18548+ Readline is free software: you can redistribute it and/or modify
18549 it under the terms of the GNU General Public License as published by
18550- the Free Software Foundation; either version 2, or (at your option)
18551- any later version.
18552+ the Free Software Foundation, either version 3 of the License, or
18553+ (at your option) any later version.
18554
18555- The Library is distributed in the hope that it will be useful, but
18556- WITHOUT ANY WARRANTY; without even the implied warranty of
18557- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18558- General Public License for more details.
18559-
18560- The GNU General Public License is often shipped with GNU software, and
18561- is generally kept in a file called COPYING or LICENSE. If you do not
18562- have a copy of the license, write to the Free Software Foundation,
18563- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
18564+ Readline is distributed in the hope that it will be useful,
18565+ but WITHOUT ANY WARRANTY; without even the implied warranty of
18566+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18567+ GNU General Public License for more details.
18568+
18569+ You should have received a copy of the GNU General Public License
18570+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
18571+*/
18572
18573 #if !defined (_RLTCAP_H_)
18574 #define _RLTCAP_H_
18575Index: gdb-7.2.90.20110703/readline/terminal.c
18576===================================================================
18577--- gdb-7.2.90.20110703.orig/readline/terminal.c 2011-07-03 10:40:53.000000000 +0200
18578+++ gdb-7.2.90.20110703/readline/terminal.c 2011-07-03 10:41:21.000000000 +0200
18579@@ -1,24 +1,24 @@
18580 /* terminal.c -- controlling the terminal with termcap. */
18581
18582-/* Copyright (C) 1996-2005 Free Software Foundation, Inc.
18583+/* Copyright (C) 1996-2009 Free Software Foundation, Inc.
18584
18585- This file is part of the GNU Readline Library, a library for
18586- reading lines of text with interactive input and history editing.
18587+ This file is part of the GNU Readline Library (Readline), a library
18588+ for reading lines of text with interactive input and history editing.
18589
18590- The GNU Readline Library is free software; you can redistribute it
18591- and/or modify it under the terms of the GNU General Public License
18592- as published by the Free Software Foundation; either version 2, or
18593+ Readline is free software: you can redistribute it and/or modify
18594+ it under the terms of the GNU General Public License as published by
18595+ the Free Software Foundation, either version 3 of the License, or
18596 (at your option) any later version.
18597
18598- The GNU Readline Library is distributed in the hope that it will be
18599- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
18600- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18601+ Readline is distributed in the hope that it will be useful,
18602+ but WITHOUT ANY WARRANTY; without even the implied warranty of
18603+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18604 GNU General Public License for more details.
18605
18606- The GNU General Public License is often shipped with GNU software, and
18607- is generally kept in a file called COPYING or LICENSE. If you do not
18608- have a copy of the license, write to the Free Software Foundation,
18609- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
18610+ You should have received a copy of the GNU General Public License
18611+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
18612+*/
18613+
18614 #define READLINE_LIBRARY
18615
18616 #if defined (HAVE_CONFIG_H)
18617@@ -71,6 +71,17 @@
18618 #include "xmalloc.h"
18619
18620 #if defined (__MINGW32__)
18621+# include <windows.h>
18622+# include <wincon.h>
18623+
18624+static void _win_get_screensize PARAMS((int *, int *));
18625+#endif
18626+
18627+#if defined (__EMX__)
18628+static void _emx_get_screensize PARAMS((int *, int *));
18629+#endif
18630+
18631+#if defined (__MINGW32__)
18632 # include <windows.h>
18633 # include <wincon.h>
18634 #endif
18635@@ -78,7 +89,10 @@
18636 #define CUSTOM_REDISPLAY_FUNC() (rl_redisplay_function != rl_redisplay)
18637 #define CUSTOM_INPUT_FUNC() (rl_getc_function != rl_getc)
18638
18639-int rl_prefer_env_winsize;
18640+/* If the calling application sets this to a non-zero value, readline will
18641+ use the $LINES and $COLUMNS environment variables to set its idea of the
18642+ window size before interrogating the kernel. */
18643+int rl_prefer_env_winsize = 0;
18644
18645 /* **************************************************************** */
18646 /* */
18647@@ -93,12 +107,12 @@ static char *term_string_buffer = (char
18648
18649 static int tcap_initialized;
18650
18651-#if !defined (__linux__)
18652+#if !defined (__linux__) && !defined (NCURSES_VERSION)
18653 # if defined (__EMX__) || defined (NEED_EXTERN_PC)
18654 extern
18655 # endif /* __EMX__ || NEED_EXTERN_PC */
18656 char PC, *BC, *UP;
18657-#endif /* __linux__ */
18658+#endif /* !__linux__ && !NCURSES_VERSION */
18659
18660 /* Some strings to control terminal actions. These are output by tputs (). */
18661 char *_rl_term_clreol;
18662@@ -122,9 +136,7 @@ char *_rl_term_IC;
18663 char *_rl_term_dc;
18664 char *_rl_term_DC;
18665
18666-#if defined (HACK_TERMCAP_MOTION)
18667 char *_rl_term_forward_char;
18668-#endif /* HACK_TERMCAP_MOTION */
18669
18670 /* How to go up a line. */
18671 char *_rl_term_up;
18672@@ -195,6 +207,26 @@ _emx_get_screensize (swp, shp)
18673 }
18674 #endif
18675
18676+#if defined (__MINGW32__)
18677+static void
18678+_win_get_screensize (swp, shp)
18679+ int *swp, *shp;
18680+{
18681+ HANDLE hConOut;
18682+ CONSOLE_SCREEN_BUFFER_INFO scr;
18683+
18684+ hConOut = GetStdHandle (STD_OUTPUT_HANDLE);
18685+ if (hConOut != INVALID_HANDLE_VALUE)
18686+ {
18687+ if (GetConsoleScreenBufferInfo (hConOut, &scr))
18688+ {
18689+ *swp = scr.dwSize.X;
18690+ *shp = scr.srWindow.Bottom - scr.srWindow.Top + 1;
18691+ }
18692+ }
18693+}
18694+#endif
18695+
18696 /* Get readline's idea of the screen size. TTY is a file descriptor open
18697 to the terminal. If IGNORE_ENV is true, we do not pay attention to the
18698 values of $LINES and $COLUMNS. The tests for TERM_STRING_BUFFER being
18699@@ -233,7 +265,9 @@ _rl_get_screen_size (tty, ignore_env)
18700 #endif
18701
18702 #if defined (__EMX__)
18703- _emx_get_screensize (&_rl_screenwidth, &_rl_screenheight);
18704+ _emx_get_screensize (&wc, &wr);
18705+#elif defined (__MINGW32__)
18706+ _win_get_screensize (&wc, &wr);
18707 #endif
18708
18709 if (ignore_env || rl_prefer_env_winsize == 0)
18710@@ -347,24 +381,24 @@ rl_reset_screen_size ()
18711 void
18712 rl_resize_terminal ()
18713 {
18714- if (readline_echoing_p)
18715+ _rl_get_screen_size (fileno (rl_instream), 1);
18716+ if (_rl_echoing_p)
18717 {
18718- _rl_get_screen_size (fileno (rl_instream), 1);
18719 if (CUSTOM_REDISPLAY_FUNC ())
18720 rl_forced_update_display ();
18721- else
18722+ else if (RL_ISSTATE(RL_STATE_REDISPLAYING) == 0)
18723 _rl_redisplay_after_sigwinch ();
18724 }
18725 }
18726
18727 struct _tc_string {
18728- const char *tc_var;
18729+ const char * const tc_var;
18730 char **tc_value;
18731 };
18732
18733 /* This should be kept sorted, just in case we decide to change the
18734 search algorithm to something smarter. */
18735-static struct _tc_string tc_strings[] =
18736+static const struct _tc_string tc_strings[] =
18737 {
18738 { "@7", &_rl_term_at7 },
18739 { "DC", &_rl_term_DC },
18740@@ -389,9 +423,7 @@ static struct _tc_string tc_strings[] =
18741 { "le", &_rl_term_backspace },
18742 { "mm", &_rl_term_mm },
18743 { "mo", &_rl_term_mo },
18744-#if defined (HACK_TERMCAP_MOTION)
18745 { "nd", &_rl_term_forward_char },
18746-#endif
18747 { "pc", &_rl_term_pc },
18748 { "up", &_rl_term_up },
18749 { "vb", &_rl_visible_bell },
18750@@ -505,9 +537,7 @@ _rl_init_terminal_io (terminal_name)
18751 _rl_term_ks = _rl_term_ke = _rl_term_at7 = (char *)NULL;
18752 _rl_term_mm = _rl_term_mo = (char *)NULL;
18753 _rl_term_ve = _rl_term_vs = (char *)NULL;
18754-#if defined (HACK_TERMCAP_MOTION)
18755- term_forward_char = (char *)NULL;
18756-#endif
18757+ _rl_term_forward_char = (char *)NULL;
18758 _rl_terminal_can_insert = term_has_meta = 0;
18759
18760 /* Reasonable defaults for tgoto(). Readline currently only uses
18761@@ -546,8 +576,8 @@ _rl_init_terminal_io (terminal_name)
18762
18763 /* Check to see if this terminal has a meta key and clear the capability
18764 variables if there is none. */
18765- term_has_meta = (tgetflag ("km") || tgetflag ("MT"));
18766- if (!term_has_meta)
18767+ term_has_meta = tgetflag ("km") != 0;
18768+ if (term_has_meta == 0)
18769 _rl_term_mm = _rl_term_mo = (char *)NULL;
18770
18771 #endif /* !__MSDOS__ */
18772@@ -663,10 +693,10 @@ _rl_backspace (count)
18773 int
18774 rl_crlf ()
18775 {
18776-#if defined (NEW_TTY_DRIVER)
18777+#if defined (NEW_TTY_DRIVER) || defined (__MINT__)
18778 if (_rl_term_cr)
18779 tputs (_rl_term_cr, 1, _rl_output_character_function);
18780-#endif /* NEW_TTY_DRIVER */
18781+#endif /* NEW_TTY_DRIVER || __MINT__ */
18782 putc ('\n', _rl_out_stream);
18783 return 0;
18784 }
18785@@ -675,7 +705,7 @@ rl_crlf ()
18786 int
18787 rl_ding ()
18788 {
18789- if (readline_echoing_p)
18790+ if (_rl_echoing_p)
18791 {
18792 switch (_rl_bell_preference)
18793 {
18794Index: gdb-7.2.90.20110703/readline/text.c
18795===================================================================
18796--- gdb-7.2.90.20110703.orig/readline/text.c 2011-07-03 10:40:53.000000000 +0200
18797+++ gdb-7.2.90.20110703/readline/text.c 2011-07-03 10:41:21.000000000 +0200
18798@@ -1,24 +1,24 @@
18799 /* text.c -- text handling commands for readline. */
18800
18801-/* Copyright (C) 1987-2005 Free Software Foundation, Inc.
18802+/* Copyright (C) 1987-2010 Free Software Foundation, Inc.
18803
18804- This file is part of the GNU Readline Library, a library for
18805- reading lines of text with interactive input and history editing.
18806+ This file is part of the GNU Readline Library (Readline), a library
18807+ for reading lines of text with interactive input and history editing.
18808
18809- The GNU Readline Library is free software; you can redistribute it
18810- and/or modify it under the terms of the GNU General Public License
18811- as published by the Free Software Foundation; either version 2, or
18812+ Readline is free software: you can redistribute it and/or modify
18813+ it under the terms of the GNU General Public License as published by
18814+ the Free Software Foundation, either version 3 of the License, or
18815 (at your option) any later version.
18816
18817- The GNU Readline Library is distributed in the hope that it will be
18818- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
18819- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18820+ Readline is distributed in the hope that it will be useful,
18821+ but WITHOUT ANY WARRANTY; without even the implied warranty of
18822+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18823 GNU General Public License for more details.
18824
18825- The GNU General Public License is often shipped with GNU software, and
18826- is generally kept in a file called COPYING or LICENSE. If you do not
18827- have a copy of the license, write to the Free Software Foundation,
18828- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
18829+ You should have received a copy of the GNU General Public License
18830+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
18831+*/
18832+
18833 #define READLINE_LIBRARY
18834
18835 #if defined (HAVE_CONFIG_H)
18836@@ -67,6 +67,10 @@ static int _rl_insert_next_callback PARA
18837 static int _rl_char_search_callback PARAMS((_rl_callback_generic_arg *));
18838 #endif
18839
18840+/* The largest chunk of text that can be inserted in one call to
18841+ rl_insert_text. Text blocks larger than this are divided. */
18842+#define TEXT_COUNT_MAX 1024
18843+
18844 /* **************************************************************** */
18845 /* */
18846 /* Insert and Delete */
18847@@ -146,7 +150,7 @@ rl_delete_text (from, to)
18848 if (_rl_doing_an_undo == 0)
18849 rl_add_undo (UNDO_DELETE, from, to, text);
18850 else
18851- free (text);
18852+ xfree (text);
18853
18854 rl_end -= diff;
18855 rl_line_buffer[rl_end] = '\0';
18856@@ -185,10 +189,13 @@ _rl_replace_text (text, start, end)
18857 {
18858 int n;
18859
18860+ n = 0;
18861 rl_begin_undo_group ();
18862- rl_delete_text (start, end + 1);
18863+ if (start <= end)
18864+ rl_delete_text (start, end + 1);
18865 rl_point = start;
18866- n = rl_insert_text (text);
18867+ if (*text)
18868+ n = rl_insert_text (text);
18869 rl_end_undo_group ();
18870
18871 return n;
18872@@ -258,11 +265,13 @@ rl_forward_byte (count, key)
18873
18874 if (count > 0)
18875 {
18876- int end = rl_point + count;
18877+ int end, lend;
18878+
18879+ end = rl_point + count;
18880 #if defined (VI_MODE)
18881- int lend = rl_end > 0 ? rl_end - (rl_editing_mode == vi_mode) : rl_end;
18882+ lend = rl_end > 0 ? rl_end - (VI_COMMAND_MODE()) : rl_end;
18883 #else
18884- int lend = rl_end;
18885+ lend = rl_end;
18886 #endif
18887
18888 if (end > lend)
18889@@ -280,6 +289,31 @@ rl_forward_byte (count, key)
18890 return 0;
18891 }
18892
18893+int
18894+_rl_forward_char_internal (count)
18895+ int count;
18896+{
18897+ int point;
18898+
18899+#if defined (HANDLE_MULTIBYTE)
18900+ point = _rl_find_next_mbchar (rl_line_buffer, rl_point, count, MB_FIND_NONZERO);
18901+
18902+#if defined (VI_MODE)
18903+ if (point >= rl_end && VI_COMMAND_MODE())
18904+ point = _rl_find_prev_mbchar (rl_line_buffer, rl_end, MB_FIND_NONZERO);
18905+#endif
18906+
18907+ if (rl_end < 0)
18908+ rl_end = 0;
18909+#else
18910+ point = rl_point + count;
18911+ if (point > rl_end)
18912+ point = rl_end;
18913+#endif
18914+
18915+ return (point);
18916+}
18917+
18918 #if defined (HANDLE_MULTIBYTE)
18919 /* Move forward COUNT characters. */
18920 int
18921@@ -296,20 +330,18 @@ rl_forward_char (count, key)
18922
18923 if (count > 0)
18924 {
18925- point = _rl_find_next_mbchar (rl_line_buffer, rl_point, count, MB_FIND_NONZERO);
18926+ if (rl_point == rl_end && EMACS_MODE())
18927+ {
18928+ rl_ding ();
18929+ return 0;
18930+ }
18931
18932-#if defined (VI_MODE)
18933- if (rl_end <= point && rl_editing_mode == vi_mode)
18934- point = _rl_find_prev_mbchar (rl_line_buffer, rl_end, MB_FIND_NONZERO);
18935-#endif
18936+ point = _rl_forward_char_internal (count);
18937
18938 if (rl_point == point)
18939 rl_ding ();
18940
18941 rl_point = point;
18942-
18943- if (rl_end < 0)
18944- rl_end = 0;
18945 }
18946
18947 return 0;
18948@@ -565,6 +597,21 @@ rl_clear_screen (count, key)
18949 }
18950
18951 int
18952+rl_skip_csi_sequence (count, key)
18953+ int count, key;
18954+{
18955+ int ch;
18956+
18957+ RL_SETSTATE (RL_STATE_MOREINPUT);
18958+ do
18959+ ch = rl_read_key ();
18960+ while (ch >= 0x20 && ch < 0x40);
18961+ RL_UNSETSTATE (RL_STATE_MOREINPUT);
18962+
18963+ return 0;
18964+}
18965+
18966+int
18967 rl_arrow_keys (count, c)
18968 int count, c;
18969 {
18970@@ -701,7 +748,7 @@ _rl_insert_char (count, c)
18971
18972 /* If we can optimize, then do it. But don't let people crash
18973 readline because of extra large arguments. */
18974- if (count > 1 && count <= 1024)
18975+ if (count > 1 && count <= TEXT_COUNT_MAX)
18976 {
18977 #if defined (HANDLE_MULTIBYTE)
18978 string_size = count * incoming_length;
18979@@ -724,16 +771,16 @@ _rl_insert_char (count, c)
18980
18981 string[i] = '\0';
18982 rl_insert_text (string);
18983- free (string);
18984+ xfree (string);
18985
18986 return 0;
18987 }
18988
18989- if (count > 1024)
18990+ if (count > TEXT_COUNT_MAX)
18991 {
18992 int decreaser;
18993 #if defined (HANDLE_MULTIBYTE)
18994- string_size = incoming_length * 1024;
18995+ string_size = incoming_length * TEXT_COUNT_MAX;
18996 string = (char *)xmalloc (1 + string_size);
18997
18998 i = 0;
18999@@ -745,24 +792,24 @@ _rl_insert_char (count, c)
19000
19001 while (count)
19002 {
19003- decreaser = (count > 1024) ? 1024 : count;
19004+ decreaser = (count > TEXT_COUNT_MAX) ? TEXT_COUNT_MAX : count;
19005 string[decreaser*incoming_length] = '\0';
19006 rl_insert_text (string);
19007 count -= decreaser;
19008 }
19009
19010- free (string);
19011+ xfree (string);
19012 incoming_length = 0;
19013 stored_count = 0;
19014 #else /* !HANDLE_MULTIBYTE */
19015- char str[1024+1];
19016+ char str[TEXT_COUNT_MAX+1];
19017
19018- for (i = 0; i < 1024; i++)
19019+ for (i = 0; i < TEXT_COUNT_MAX; i++)
19020 str[i] = c;
19021
19022 while (count)
19023 {
19024- decreaser = (count > 1024 ? 1024 : count);
19025+ decreaser = (count > TEXT_COUNT_MAX ? TEXT_COUNT_MAX : count);
19026 str[decreaser] = '\0';
19027 rl_insert_text (str);
19028 count -= decreaser;
19029@@ -777,8 +824,9 @@ _rl_insert_char (count, c)
19030 /* We are inserting a single character.
19031 If there is pending input, then make a string of all of the
19032 pending characters that are bound to rl_insert, and insert
19033- them all. */
19034- if (_rl_any_typein ())
19035+ them all. Don't do this if we're current reading input from
19036+ a macro. */
19037+ if ((RL_ISSTATE (RL_STATE_MACROINPUT) == 0) && _rl_any_typein ())
19038 _rl_insert_typein (c);
19039 else
19040 {
19041@@ -857,6 +905,9 @@ _rl_insert_next (count)
19042 c = rl_read_key ();
19043 RL_UNSETSTATE(RL_STATE_MOREINPUT);
19044
19045+ if (c < 0)
19046+ return -1;
19047+
19048 #if defined (HANDLE_SIGNALS)
19049 if (RL_ISSTATE (RL_STATE_CALLBACK) == 0)
19050 _rl_restore_tty_signals ();
19051@@ -940,7 +991,7 @@ rl_newline (count, key)
19052 if (rl_erase_empty_line && rl_point == 0 && rl_end == 0)
19053 return 0;
19054
19055- if (readline_echoing_p)
19056+ if (_rl_echoing_p)
19057 _rl_update_final ();
19058 return 0;
19059 }
19060@@ -1071,6 +1122,8 @@ int
19061 rl_delete (count, key)
19062 int count, key;
19063 {
19064+ int xpoint;
19065+
19066 if (count < 0)
19067 return (_rl_rubout_char (-count, key));
19068
19069@@ -1082,21 +1135,19 @@ rl_delete (count, key)
19070
19071 if (count > 1 || rl_explicit_arg)
19072 {
19073- int orig_point = rl_point;
19074+ xpoint = rl_point;
19075 if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
19076 rl_forward_char (count, key);
19077 else
19078 rl_forward_byte (count, key);
19079
19080- rl_kill_text (orig_point, rl_point);
19081- rl_point = orig_point;
19082+ rl_kill_text (xpoint, rl_point);
19083+ rl_point = xpoint;
19084 }
19085 else
19086 {
19087- int new_point;
19088-
19089- new_point = MB_NEXTCHAR (rl_line_buffer, rl_point, 1, MB_FIND_NONZERO);
19090- rl_delete_text (rl_point, new_point);
19091+ xpoint = MB_NEXTCHAR (rl_line_buffer, rl_point, 1, MB_FIND_NONZERO);
19092+ rl_delete_text (rl_point, xpoint);
19093 }
19094 return 0;
19095 }
19096@@ -1120,7 +1171,7 @@ int
19097 rl_delete_horizontal_space (count, ignore)
19098 int count, ignore;
19099 {
19100- int start = rl_point;
19101+ int start;
19102
19103 while (rl_point && whitespace (rl_line_buffer[rl_point - 1]))
19104 rl_point--;
19105@@ -1237,8 +1288,9 @@ rl_change_case (count, op)
19106 #if defined (HANDLE_MULTIBYTE)
19107 wchar_t wc, nwc;
19108 char mb[MB_LEN_MAX+1];
19109- int mblen, p;
19110- mbstate_t ps;
19111+ int mlen;
19112+ size_t m;
19113+ mbstate_t mps;
19114 #endif
19115
19116 start = rl_point;
19117@@ -1255,7 +1307,7 @@ rl_change_case (count, op)
19118 SWAP (start, end);
19119
19120 #if defined (HANDLE_MULTIBYTE)
19121- memset (&ps, 0, sizeof (mbstate_t));
19122+ memset (&mps, 0, sizeof (mbstate_t));
19123 #endif
19124
19125 /* We are going to modify some text, so let's prepare to undo it. */
19126@@ -1290,15 +1342,19 @@ rl_change_case (count, op)
19127 #if defined (HANDLE_MULTIBYTE)
19128 else
19129 {
19130- mbrtowc (&wc, rl_line_buffer + start, end - start, &ps);
19131+ m = mbrtowc (&wc, rl_line_buffer + start, end - start, &mps);
19132+ if (MB_INVALIDCH (m))
19133+ wc = (wchar_t)rl_line_buffer[start];
19134+ else if (MB_NULLWCH (m))
19135+ wc = L'\0';
19136 nwc = (nop == UpCase) ? _rl_to_wupper (wc) : _rl_to_wlower (wc);
19137 if (nwc != wc) /* just skip unchanged characters */
19138 {
19139- mblen = wcrtomb (mb, nwc, &ps);
19140- if (mblen > 0)
19141- mb[mblen] = '\0';
19142+ mlen = wcrtomb (mb, nwc, &mps);
19143+ if (mlen > 0)
19144+ mb[mlen] = '\0';
19145 /* Assume the same width */
19146- strncpy (rl_line_buffer + start, mb, mblen);
19147+ strncpy (rl_line_buffer + start, mb, mlen);
19148 }
19149 }
19150 #endif
19151@@ -1371,8 +1427,8 @@ rl_transpose_words (count, key)
19152
19153 /* I think that does it. */
19154 rl_end_undo_group ();
19155- free (word1);
19156- free (word2);
19157+ xfree (word1);
19158+ xfree (word2);
19159
19160 return 0;
19161 }
19162@@ -1431,7 +1487,7 @@ rl_transpose_chars (count, key)
19163 rl_end_undo_group ();
19164
19165 #if defined (HANDLE_MULTIBYTE)
19166- free (dummy);
19167+ xfree (dummy);
19168 #endif
19169
19170 return 0;
19171@@ -1459,6 +1515,9 @@ _rl_char_search_internal (count, dir, sc
19172 int prepos;
19173 #endif
19174
19175+ if (dir == 0)
19176+ return -1;
19177+
19178 pos = rl_point;
19179 inc = (dir < 0) ? -1 : 1;
19180 while (count)
19181@@ -1520,6 +1579,9 @@ _rl_char_search (count, fdir, bdir)
19182
19183 mb_len = _rl_read_mbchar (mbchar, MB_LEN_MAX);
19184
19185+ if (mb_len <= 0)
19186+ return -1;
19187+
19188 if (count < 0)
19189 return (_rl_char_search_internal (-count, bdir, mbchar, mb_len));
19190 else
19191@@ -1536,6 +1598,9 @@ _rl_char_search (count, fdir, bdir)
19192 c = rl_read_key ();
19193 RL_UNSETSTATE(RL_STATE_MOREINPUT);
19194
19195+ if (c < 0)
19196+ return -1;
19197+
19198 if (count < 0)
19199 return (_rl_char_search_internal (-count, bdir, c));
19200 else
19201Index: gdb-7.2.90.20110703/readline/tilde.c
19202===================================================================
19203--- gdb-7.2.90.20110703.orig/readline/tilde.c 2011-07-03 10:40:53.000000000 +0200
19204+++ gdb-7.2.90.20110703/readline/tilde.c 2011-07-03 10:41:21.000000000 +0200
19205@@ -1,23 +1,23 @@
19206 /* tilde.c -- Tilde expansion code (~/foo := $HOME/foo). */
19207
19208-/* Copyright (C) 1988,1989 Free Software Foundation, Inc.
19209+/* Copyright (C) 1988-2009 Free Software Foundation, Inc.
19210
19211- This file is part of GNU Readline, a library for reading lines
19212- of text with interactive input and history editing.
19213+ This file is part of the GNU Readline Library (Readline), a library
19214+ for reading lines of text with interactive input and history editing.
19215
19216- Readline is free software; you can redistribute it and/or modify it
19217- under the terms of the GNU General Public License as published by the
19218- Free Software Foundation; either version 2, or (at your option) any
19219- later version.
19220-
19221- Readline is distributed in the hope that it will be useful, but
19222- WITHOUT ANY WARRANTY; without even the implied warranty of
19223- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19224- General Public License for more details.
19225+ Readline is free software: you can redistribute it and/or modify
19226+ it under the terms of the GNU General Public License as published by
19227+ the Free Software Foundation, either version 3 of the License, or
19228+ (at your option) any later version.
19229+
19230+ Readline is distributed in the hope that it will be useful,
19231+ but WITHOUT ANY WARRANTY; without even the implied warranty of
19232+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19233+ GNU General Public License for more details.
19234
19235 You should have received a copy of the GNU General Public License
19236- along with Readline; see the file COPYING. If not, write to the Free
19237- Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
19238+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
19239+*/
19240
19241 #if defined (HAVE_CONFIG_H)
19242 # include <config.h>
19243@@ -236,7 +236,7 @@ tilde_expand (string)
19244 string += end;
19245
19246 expansion = tilde_expand_word (tilde_word);
19247- free (tilde_word);
19248+ xfree (tilde_word);
19249
19250 len = strlen (expansion);
19251 #ifdef __CYGWIN__
19252@@ -251,7 +251,7 @@ tilde_expand (string)
19253 strcpy (result + result_index, expansion);
19254 result_index += len;
19255 }
19256- free (expansion);
19257+ xfree (expansion);
19258 }
19259
19260 result[result_index] = '\0';
19261@@ -377,8 +377,8 @@ tilde_expand_word (filename)
19262 if (expansion)
19263 {
19264 dirname = glue_prefix_and_suffix (expansion, filename, user_len);
19265- free (username);
19266- free (expansion);
19267+ xfree (username);
19268+ xfree (expansion);
19269 return (dirname);
19270 }
19271 }
19272@@ -401,10 +401,9 @@ tilde_expand_word (filename)
19273 if (expansion)
19274 {
19275 dirname = glue_prefix_and_suffix (expansion, filename, user_len);
19276- free (expansion);
19277+ xfree (expansion);
19278 }
19279 }
19280- free (username);
19281 /* If we don't have a failure hook, or if the failure hook did not
19282 expand the tilde, return a copy of what we were passed. */
19283 if (dirname == 0)
19284@@ -412,10 +411,11 @@ tilde_expand_word (filename)
19285 }
19286 #if defined (HAVE_GETPWENT)
19287 else
19288- {
19289- free (username);
19290- dirname = glue_prefix_and_suffix (user_entry->pw_dir, filename, user_len);
19291- }
19292+ dirname = glue_prefix_and_suffix (user_entry->pw_dir, filename, user_len);
19293+#endif
19294+
19295+ xfree (username);
19296+#if defined (HAVE_GETPWENT)
19297 endpwent ();
19298 #endif
19299 return (dirname);
19300Index: gdb-7.2.90.20110703/readline/tilde.h
19301===================================================================
19302--- gdb-7.2.90.20110703.orig/readline/tilde.h 2011-07-03 10:40:53.000000000 +0200
19303+++ gdb-7.2.90.20110703/readline/tilde.h 2011-07-03 10:41:21.000000000 +0200
19304@@ -1,25 +1,24 @@
19305 /* tilde.h: Externally available variables and function in libtilde.a. */
19306
19307-/* Copyright (C) 1992 Free Software Foundation, Inc.
19308+/* Copyright (C) 1992-2009 Free Software Foundation, Inc.
19309
19310- This file contains the Readline Library (the Library), a set of
19311+ This file contains the Readline Library (Readline), a set of
19312 routines for providing Emacs style line input to programs that ask
19313 for it.
19314
19315- The Library is free software; you can redistribute it and/or modify
19316+ Readline is free software: you can redistribute it and/or modify
19317 it under the terms of the GNU General Public License as published by
19318- the Free Software Foundation; either version 2, or (at your option)
19319- any later version.
19320+ the Free Software Foundation, either version 3 of the License, or
19321+ (at your option) any later version.
19322
19323- The Library is distributed in the hope that it will be useful, but
19324- WITHOUT ANY WARRANTY; without even the implied warranty of
19325- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19326- General Public License for more details.
19327-
19328- The GNU General Public License is often shipped with GNU software, and
19329- is generally kept in a file called COPYING or LICENSE. If you do not
19330- have a copy of the license, write to the Free Software Foundation,
19331- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
19332+ Readline is distributed in the hope that it will be useful,
19333+ but WITHOUT ANY WARRANTY; without even the implied warranty of
19334+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19335+ GNU General Public License for more details.
19336+
19337+ You should have received a copy of the GNU General Public License
19338+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
19339+*/
19340
19341 #if !defined (_TILDE_H_)
19342 # define _TILDE_H_
19343Index: gdb-7.2.90.20110703/readline/undo.c
19344===================================================================
19345--- gdb-7.2.90.20110703.orig/readline/undo.c 2011-07-03 10:40:53.000000000 +0200
19346+++ gdb-7.2.90.20110703/readline/undo.c 2011-07-03 10:41:21.000000000 +0200
19347@@ -1,25 +1,25 @@
19348 /* readline.c -- a general facility for reading lines of input
19349 with emacs style editing and completion. */
19350
19351-/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
19352+/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
19353
19354- This file is part of the GNU Readline Library, a library for
19355- reading lines of text with interactive input and history editing.
19356+ This file is part of the GNU Readline Library (Readline), a library
19357+ for reading lines of text with interactive input and history editing.
19358
19359- The GNU Readline Library is free software; you can redistribute it
19360- and/or modify it under the terms of the GNU General Public License
19361- as published by the Free Software Foundation; either version 2, or
19362+ Readline is free software: you can redistribute it and/or modify
19363+ it under the terms of the GNU General Public License as published by
19364+ the Free Software Foundation, either version 3 of the License, or
19365 (at your option) any later version.
19366
19367- The GNU Readline Library is distributed in the hope that it will be
19368- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
19369- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19370+ Readline is distributed in the hope that it will be useful,
19371+ but WITHOUT ANY WARRANTY; without even the implied warranty of
19372+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19373 GNU General Public License for more details.
19374
19375- The GNU General Public License is often shipped with GNU software, and
19376- is generally kept in a file called COPYING or LICENSE. If you do not
19377- have a copy of the license, write to the Free Software Foundation,
19378- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
19379+ You should have received a copy of the GNU General Public License
19380+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
19381+*/
19382+
19383 #define READLINE_LIBRARY
19384
19385 #if defined (HAVE_CONFIG_H)
19386@@ -50,6 +50,8 @@
19387 #include "rlprivate.h"
19388 #include "xmalloc.h"
19389
19390+extern void replace_history_data PARAMS((int, histdata_t *, histdata_t *));
19391+
19392 /* Non-zero tells rl_delete_text and rl_insert_text to not add to
19393 the undo list. */
19394 int _rl_doing_an_undo = 0;
19395@@ -66,19 +68,35 @@ UNDO_LIST *rl_undo_list = (UNDO_LIST *)N
19396 /* */
19397 /* **************************************************************** */
19398
19399-/* Remember how to undo something. Concatenate some undos if that
19400- seems right. */
19401-void
19402-rl_add_undo (what, start, end, text)
19403+static UNDO_LIST *
19404+alloc_undo_entry (what, start, end, text)
19405 enum undo_code what;
19406 int start, end;
19407 char *text;
19408 {
19409- UNDO_LIST *temp = (UNDO_LIST *)xmalloc (sizeof (UNDO_LIST));
19410+ UNDO_LIST *temp;
19411+
19412+ temp = (UNDO_LIST *)xmalloc (sizeof (UNDO_LIST));
19413 temp->what = what;
19414 temp->start = start;
19415 temp->end = end;
19416 temp->text = text;
19417+
19418+ temp->next = (UNDO_LIST *)NULL;
19419+ return temp;
19420+}
19421+
19422+/* Remember how to undo something. Concatenate some undos if that
19423+ seems right. */
19424+void
19425+rl_add_undo (what, start, end, text)
19426+ enum undo_code what;
19427+ int start, end;
19428+ char *text;
19429+{
19430+ UNDO_LIST *temp;
19431+
19432+ temp = alloc_undo_entry (what, start, end, text);
19433 temp->next = rl_undo_list;
19434 rl_undo_list = temp;
19435 }
19436@@ -87,17 +105,60 @@ rl_add_undo (what, start, end, text)
19437 void
19438 rl_free_undo_list ()
19439 {
19440+ UNDO_LIST *release, *orig_list;
19441+
19442+ orig_list = rl_undo_list;
19443 while (rl_undo_list)
19444 {
19445- UNDO_LIST *release = rl_undo_list;
19446+ release = rl_undo_list;
19447 rl_undo_list = rl_undo_list->next;
19448
19449 if (release->what == UNDO_DELETE)
19450- free (release->text);
19451+ xfree (release->text);
19452
19453- free (release);
19454+ xfree (release);
19455 }
19456 rl_undo_list = (UNDO_LIST *)NULL;
19457+ replace_history_data (-1, (histdata_t *)orig_list, (histdata_t *)NULL);
19458+}
19459+
19460+UNDO_LIST *
19461+_rl_copy_undo_entry (entry)
19462+ UNDO_LIST *entry;
19463+{
19464+ UNDO_LIST *new;
19465+
19466+ new = alloc_undo_entry (entry->what, entry->start, entry->end, (char *)NULL);
19467+ new->text = entry->text ? savestring (entry->text) : 0;
19468+ return new;
19469+}
19470+
19471+UNDO_LIST *
19472+_rl_copy_undo_list (head)
19473+ UNDO_LIST *head;
19474+{
19475+ UNDO_LIST *list, *new, *roving, *c;
19476+
19477+ if (head == 0)
19478+ return head;
19479+
19480+ list = head;
19481+ new = 0;
19482+ while (list)
19483+ {
19484+ c = _rl_copy_undo_entry (list);
19485+ if (new == 0)
19486+ roving = new = c;
19487+ else
19488+ {
19489+ roving->next = c;
19490+ roving = roving->next;
19491+ }
19492+ list = list->next;
19493+ }
19494+
19495+ roving->next = 0;
19496+ return new;
19497 }
19498
19499 /* Undo the next thing in the list. Return 0 if there
19500@@ -113,7 +174,7 @@ rl_do_undo ()
19501 start = end = waiting_for_begin = 0;
19502 do
19503 {
19504- if (!rl_undo_list)
19505+ if (rl_undo_list == 0)
19506 return (0);
19507
19508 _rl_doing_an_undo = 1;
19509@@ -133,7 +194,7 @@ rl_do_undo ()
19510 case UNDO_DELETE:
19511 rl_point = start;
19512 rl_insert_text (rl_undo_list->text);
19513- free (rl_undo_list->text);
19514+ xfree (rl_undo_list->text);
19515 break;
19516
19517 /* Undoing inserts means deleting some text. */
19518@@ -161,7 +222,9 @@ rl_do_undo ()
19519
19520 release = rl_undo_list;
19521 rl_undo_list = rl_undo_list->next;
19522- free (release);
19523+ replace_history_data (-1, (histdata_t *)release, (histdata_t *)rl_undo_list);
19524+
19525+ xfree (release);
19526 }
19527 while (waiting_for_begin);
19528
19529@@ -231,7 +294,7 @@ int
19530 rl_revert_line (count, key)
19531 int count, key;
19532 {
19533- if (!rl_undo_list)
19534+ if (rl_undo_list == 0)
19535 rl_ding ();
19536 else
19537 {
19538Index: gdb-7.2.90.20110703/readline/util.c
19539===================================================================
19540--- gdb-7.2.90.20110703.orig/readline/util.c 2011-07-03 10:40:53.000000000 +0200
19541+++ gdb-7.2.90.20110703/readline/util.c 2011-07-03 10:41:21.000000000 +0200
19542@@ -1,24 +1,24 @@
19543 /* util.c -- readline utility functions */
19544
19545-/* Copyright (C) 1987-2005 Free Software Foundation, Inc.
19546+/* Copyright (C) 1987-2010 Free Software Foundation, Inc.
19547
19548- This file is part of the GNU Readline Library, a library for
19549- reading lines of text with interactive input and history editing.
19550+ This file is part of the GNU Readline Library (Readline), a library
19551+ for reading lines of text with interactive input and history editing.
19552
19553- The GNU Readline Library is free software; you can redistribute it
19554- and/or modify it under the terms of the GNU General Public License
19555- as published by the Free Software Foundation; either version 2, or
19556+ Readline is free software: you can redistribute it and/or modify
19557+ it under the terms of the GNU General Public License as published by
19558+ the Free Software Foundation, either version 3 of the License, or
19559 (at your option) any later version.
19560
19561- The GNU Readline Library is distributed in the hope that it will be
19562- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
19563- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19564+ Readline is distributed in the hope that it will be useful,
19565+ but WITHOUT ANY WARRANTY; without even the implied warranty of
19566+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19567 GNU General Public License for more details.
19568
19569- The GNU General Public License is often shipped with GNU software, and
19570- is generally kept in a file called COPYING or LICENSE. If you do not
19571- have a copy of the license, write to the Free Software Foundation,
19572- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
19573+ You should have received a copy of the GNU General Public License
19574+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
19575+*/
19576+
19577 #define READLINE_LIBRARY
19578
19579 #if defined (HAVE_CONFIG_H)
19580@@ -66,7 +66,7 @@
19581 in words, or 1 if it is. */
19582
19583 int _rl_allow_pathname_alphabetic_chars = 0;
19584-static const char *pathname_alphabetic_chars = "/-_=~.#$";
19585+static const char * const pathname_alphabetic_chars = "/-_=~.#$";
19586
19587 int
19588 rl_alphabetic (c)
19589@@ -81,8 +81,7 @@ rl_alphabetic (c)
19590
19591 #if defined (HANDLE_MULTIBYTE)
19592 int
19593-_rl_walphabetic (wc)
19594- wchar_t wc;
19595+_rl_walphabetic (wchar_t wc)
19596 {
19597 int c;
19598
19599@@ -109,7 +108,7 @@ _rl_abort_internal ()
19600 _rl_pop_executing_macro ();
19601
19602 rl_last_func = (rl_command_func_t *)NULL;
19603- longjmp (readline_top_level, 1);
19604+ longjmp (_rl_top_level, 1);
19605 return (0);
19606 }
19607
19608@@ -121,6 +120,13 @@ rl_abort (count, key)
19609 }
19610
19611 int
19612+_rl_null_function (count, key)
19613+ int count, key;
19614+{
19615+ return 0;
19616+}
19617+
19618+int
19619 rl_tty_status (count, key)
19620 int count, key;
19621 {
19622@@ -185,6 +191,7 @@ rl_tilde_expand (ignore, key)
19623 {
19624 homedir = tilde_expand ("~");
19625 _rl_replace_text (homedir, start, end);
19626+ xfree (homedir);
19627 return (0);
19628 }
19629 else if (rl_line_buffer[start] != '~')
19630@@ -212,14 +219,96 @@ rl_tilde_expand (ignore, key)
19631 strncpy (temp, rl_line_buffer + start, len);
19632 temp[len] = '\0';
19633 homedir = tilde_expand (temp);
19634- free (temp);
19635+ xfree (temp);
19636
19637 _rl_replace_text (homedir, start, end);
19638+ xfree (homedir);
19639 }
19640
19641 return (0);
19642 }
19643
19644+#if defined (USE_VARARGS)
19645+void
19646+#if defined (PREFER_STDARG)
19647+_rl_ttymsg (const char *format, ...)
19648+#else
19649+_rl_ttymsg (va_alist)
19650+ va_dcl
19651+#endif
19652+{
19653+ va_list args;
19654+#if defined (PREFER_VARARGS)
19655+ char *format;
19656+#endif
19657+
19658+#if defined (PREFER_STDARG)
19659+ va_start (args, format);
19660+#else
19661+ va_start (args);
19662+ format = va_arg (args, char *);
19663+#endif
19664+
19665+ fprintf (stderr, "readline: ");
19666+ vfprintf (stderr, format, args);
19667+ fprintf (stderr, "\n");
19668+ fflush (stderr);
19669+
19670+ va_end (args);
19671+
19672+ rl_forced_update_display ();
19673+}
19674+
19675+void
19676+#if defined (PREFER_STDARG)
19677+_rl_errmsg (const char *format, ...)
19678+#else
19679+_rl_errmsg (va_alist)
19680+ va_dcl
19681+#endif
19682+{
19683+ va_list args;
19684+#if defined (PREFER_VARARGS)
19685+ char *format;
19686+#endif
19687+
19688+#if defined (PREFER_STDARG)
19689+ va_start (args, format);
19690+#else
19691+ va_start (args);
19692+ format = va_arg (args, char *);
19693+#endif
19694+
19695+ fprintf (stderr, "readline: ");
19696+ vfprintf (stderr, format, args);
19697+ fprintf (stderr, "\n");
19698+ fflush (stderr);
19699+
19700+ va_end (args);
19701+}
19702+
19703+#else /* !USE_VARARGS */
19704+void
19705+_rl_ttymsg (format, arg1, arg2)
19706+ char *format;
19707+{
19708+ fprintf (stderr, "readline: ");
19709+ fprintf (stderr, format, arg1, arg2);
19710+ fprintf (stderr, "\n");
19711+
19712+ rl_forced_update_display ();
19713+}
19714+
19715+void
19716+_rl_errmsg (format, arg1, arg2)
19717+ char *format;
19718+{
19719+ fprintf (stderr, "readline: ");
19720+ fprintf (stderr, format, arg1, arg2);
19721+ fprintf (stderr, "\n");
19722+}
19723+#endif /* !USE_VARARGS */
19724+
19725 /* **************************************************************** */
19726 /* */
19727 /* String Utility Functions */
19728@@ -277,41 +366,56 @@ _rl_strpbrk (string1, string2)
19729
19730 #if !defined (HAVE_STRCASECMP)
19731 /* Compare at most COUNT characters from string1 to string2. Case
19732- doesn't matter. */
19733+ doesn't matter (strncasecmp). */
19734 int
19735 _rl_strnicmp (string1, string2, count)
19736 char *string1, *string2;
19737 int count;
19738 {
19739- register char ch1, ch2;
19740+ register char *s1, *s2;
19741+ int d;
19742+
19743+ if (count <= 0 || (string1 == string2))
19744+ return 0;
19745
19746- while (count)
19747+ s1 = string1;
19748+ s2 = string2;
19749+ do
19750 {
19751- ch1 = *string1++;
19752- ch2 = *string2++;
19753- if (_rl_to_upper(ch1) == _rl_to_upper(ch2))
19754- count--;
19755- else
19756+ d = _rl_to_lower (*s1) - _rl_to_lower (*s2); /* XXX - cast to unsigned char? */
19757+ if (d != 0)
19758+ return d;
19759+ if (*s1++ == '\0')
19760 break;
19761+ s2++;
19762 }
19763- return (count);
19764+ while (--count != 0)
19765+
19766+ return (0);
19767 }
19768
19769-/* strcmp (), but caseless. */
19770+/* strcmp (), but caseless (strcasecmp). */
19771 int
19772 _rl_stricmp (string1, string2)
19773 char *string1, *string2;
19774 {
19775- register char ch1, ch2;
19776+ register char *s1, *s2;
19777+ int d;
19778+
19779+ s1 = string1;
19780+ s2 = string2;
19781+
19782+ if (s1 == s2)
19783+ return 0;
19784
19785- while (*string1 && *string2)
19786+ while ((d = _rl_to_lower (*s1) - _rl_to_lower (*s2)) == 0)
19787 {
19788- ch1 = *string1++;
19789- ch2 = *string2++;
19790- if (_rl_to_upper(ch1) != _rl_to_upper(ch2))
19791- return (1);
19792+ if (*s1++ == '\0')
19793+ return 0;
19794+ s2++;
19795 }
19796- return (*string1 - *string2);
19797+
19798+ return (d);
19799 }
19800 #endif /* !HAVE_STRCASECMP */
19801
19802@@ -344,6 +448,16 @@ FUNCTION_FOR_MACRO (_rl_to_lower)
19803 FUNCTION_FOR_MACRO (_rl_to_upper)
19804 FUNCTION_FOR_MACRO (_rl_uppercase_p)
19805
19806+/* A convenience function, to force memory deallocation to be performed
19807+ by readline. DLLs on Windows apparently require this. */
19808+void
19809+rl_free (mem)
19810+ void *mem;
19811+{
19812+ if (mem)
19813+ free (mem);
19814+}
19815+
19816 /* Backwards compatibility, now that savestring has been removed from
19817 all `public' readline header files. */
19818 #undef _rl_savestring
19819@@ -353,3 +467,60 @@ _rl_savestring (s)
19820 {
19821 return (strcpy ((char *)xmalloc (1 + (int)strlen (s)), (s)));
19822 }
19823+
19824+#if defined (USE_VARARGS)
19825+static FILE *_rl_tracefp;
19826+
19827+void
19828+#if defined (PREFER_STDARG)
19829+_rl_trace (const char *format, ...)
19830+#else
19831+_rl_trace (va_alist)
19832+ va_dcl
19833+#endif
19834+{
19835+ va_list args;
19836+#if defined (PREFER_VARARGS)
19837+ char *format;
19838+#endif
19839+
19840+#if defined (PREFER_STDARG)
19841+ va_start (args, format);
19842+#else
19843+ va_start (args);
19844+ format = va_arg (args, char *);
19845+#endif
19846+
19847+ if (_rl_tracefp == 0)
19848+ _rl_tropen ();
19849+ vfprintf (_rl_tracefp, format, args);
19850+ fprintf (_rl_tracefp, "\n");
19851+ fflush (_rl_tracefp);
19852+
19853+ va_end (args);
19854+}
19855+
19856+int
19857+_rl_tropen ()
19858+{
19859+ char fnbuf[128];
19860+
19861+ if (_rl_tracefp)
19862+ fclose (_rl_tracefp);
19863+ sprintf (fnbuf, "/var/tmp/rltrace.%ld", getpid());
19864+ unlink(fnbuf);
19865+ _rl_tracefp = fopen (fnbuf, "w+");
19866+ return _rl_tracefp != 0;
19867+}
19868+
19869+int
19870+_rl_trclose ()
19871+{
19872+ int r;
19873+
19874+ r = fclose (_rl_tracefp);
19875+ _rl_tracefp = 0;
19876+ return r;
19877+}
19878+
19879+#endif
19880Index: gdb-7.2.90.20110703/readline/vi_keymap.c
19881===================================================================
19882--- gdb-7.2.90.20110703.orig/readline/vi_keymap.c 2011-07-03 10:40:53.000000000 +0200
19883+++ gdb-7.2.90.20110703/readline/vi_keymap.c 2011-07-03 10:41:21.000000000 +0200
19884@@ -1,24 +1,23 @@
19885 /* vi_keymap.c -- the keymap for vi_mode in readline (). */
19886
19887-/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
19888+/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
19889
19890- This file is part of the GNU Readline Library, a library for
19891- reading lines of text with interactive input and history editing.
19892+ This file is part of the GNU Readline Library (Readline), a library
19893+ for reading lines of text with interactive input and history editing.
19894
19895- The GNU Readline Library is free software; you can redistribute it
19896- and/or modify it under the terms of the GNU General Public License
19897- as published by the Free Software Foundation; either version 2, or
19898+ Readline is free software: you can redistribute it and/or modify
19899+ it under the terms of the GNU General Public License as published by
19900+ the Free Software Foundation, either version 3 of the License, or
19901 (at your option) any later version.
19902
19903- The GNU Readline Library is distributed in the hope that it will be
19904- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
19905- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19906+ Readline is distributed in the hope that it will be useful,
19907+ but WITHOUT ANY WARRANTY; without even the implied warranty of
19908+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19909 GNU General Public License for more details.
19910
19911- The GNU General Public License is often shipped with GNU software, and
19912- is generally kept in a file called COPYING or LICENSE. If you do not
19913- have a copy of the license, write to the Free Software Foundation,
19914- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
19915+ You should have received a copy of the GNU General Public License
19916+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
19917+*/
19918
19919 #if !defined (BUFSIZ)
19920 #include <stdio.h>
19921@@ -151,7 +150,7 @@ KEYMAP_ENTRY_ARRAY vi_movement_keymap =
19922 { ISFUNC, rl_vi_char_search }, /* f */
19923 { ISFUNC, (rl_command_func_t *)0x0 }, /* g */
19924 { ISFUNC, rl_backward_char }, /* h */
19925- { ISFUNC, rl_vi_insertion_mode }, /* i */
19926+ { ISFUNC, rl_vi_insert_mode }, /* i */
19927 { ISFUNC, rl_get_next_history }, /* j */
19928 { ISFUNC, rl_get_previous_history }, /* k */
19929 { ISFUNC, rl_forward_char }, /* l */
19930@@ -327,9 +326,9 @@ KEYMAP_ENTRY_ARRAY vi_insertion_keymap =
19931 { ISFUNC, rl_insert }, /* Control-k */
19932 { ISFUNC, rl_insert }, /* Control-l */
19933 { ISFUNC, rl_newline }, /* Control-m */
19934- { ISFUNC, rl_insert }, /* Control-n */
19935+ { ISFUNC, rl_menu_complete}, /* Control-n */
19936 { ISFUNC, rl_insert }, /* Control-o */
19937- { ISFUNC, rl_insert }, /* Control-p */
19938+ { ISFUNC, rl_backward_menu_complete }, /* Control-p */
19939 { ISFUNC, rl_insert }, /* Control-q */
19940 { ISFUNC, rl_reverse_search_history }, /* Control-r */
19941 { ISFUNC, rl_forward_search_history }, /* Control-s */
19942Index: gdb-7.2.90.20110703/readline/vi_mode.c
19943===================================================================
19944--- gdb-7.2.90.20110703.orig/readline/vi_mode.c 2011-07-03 10:40:53.000000000 +0200
19945+++ gdb-7.2.90.20110703/readline/vi_mode.c 2011-07-03 10:41:21.000000000 +0200
19946@@ -1,25 +1,25 @@
19947 /* vi_mode.c -- A vi emulation mode for Bash.
19948 Derived from code written by Jeff Sparkes (jsparkes@bnr.ca). */
19949
19950-/* Copyright (C) 1987-2005 Free Software Foundation, Inc.
19951+/* Copyright (C) 1987-2010 Free Software Foundation, Inc.
19952
19953- This file is part of the GNU Readline Library, a library for
19954- reading lines of text with interactive input and history editing.
19955+ This file is part of the GNU Readline Library (Readline), a library
19956+ for reading lines of text with interactive input and history editing.
19957
19958- The GNU Readline Library is free software; you can redistribute it
19959- and/or modify it under the terms of the GNU General Public License
19960- as published by the Free Software Foundation; either version 2, or
19961+ Readline is free software: you can redistribute it and/or modify
19962+ it under the terms of the GNU General Public License as published by
19963+ the Free Software Foundation, either version 3 of the License, or
19964 (at your option) any later version.
19965
19966- The GNU Readline Library is distributed in the hope that it will be
19967- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
19968- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19969+ Readline is distributed in the hope that it will be useful,
19970+ but WITHOUT ANY WARRANTY; without even the implied warranty of
19971+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19972 GNU General Public License for more details.
19973
19974- The GNU General Public License is often shipped with GNU software, and
19975- is generally kept in a file called COPYING or LICENSE. If you do not
19976- have a copy of the license, write to the Free Software Foundation,
19977- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
19978+ You should have received a copy of the GNU General Public License
19979+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
19980+*/
19981+
19982 #define READLINE_LIBRARY
19983
19984 /* **************************************************************** */
19985@@ -65,11 +65,13 @@
19986
19987 int _rl_vi_last_command = 'i'; /* default `.' puts you in insert mode */
19988
19989+_rl_vimotion_cxt *_rl_vimvcxt = 0;
19990+
19991 /* Non-zero means enter insertion mode. */
19992 static int _rl_vi_doing_insert;
19993
19994 /* Command keys which do movement for xxx_to commands. */
19995-static const char *vi_motion = " hl^$0ftFT;,%wbeWBE|";
19996+static const char * const vi_motion = " hl^$0ftFT;,%wbeWBE|`";
19997
19998 /* Keymap used for vi replace characters. Created dynamically since
19999 rarely used. */
20000@@ -101,7 +103,7 @@ static int _rl_vi_last_key_before_insert
20001 static int vi_redoing;
20002
20003 /* Text modification commands. These are the `redoable' commands. */
20004-static const char *vi_textmod = "_*\\AaIiCcDdPpYyRrSsXx~";
20005+static const char * const vi_textmod = "_*\\AaIiCcDdPpYyRrSsXx~";
20006
20007 /* Arrays for the saved marks. */
20008 static int vi_mark_chars['z' - 'a' + 1];
20009@@ -109,12 +111,16 @@ static int vi_mark_chars['z' - 'a' + 1];
20010 static void _rl_vi_stuff_insert PARAMS((int));
20011 static void _rl_vi_save_insert PARAMS((UNDO_LIST *));
20012
20013+static void _rl_vi_backup PARAMS((void));
20014+
20015 static int _rl_vi_arg_dispatch PARAMS((int));
20016 static int rl_digit_loop1 PARAMS((void));
20017
20018 static int _rl_vi_set_mark PARAMS((void));
20019 static int _rl_vi_goto_mark PARAMS((void));
20020
20021+static void _rl_vi_append_forward PARAMS((int));
20022+
20023 static int _rl_vi_callback_getchar PARAMS((char *, int));
20024
20025 #if defined (READLINE_CALLBACKS)
20026@@ -124,12 +130,23 @@ static int _rl_vi_callback_change_char P
20027 static int _rl_vi_callback_char_search PARAMS((_rl_callback_generic_arg *));
20028 #endif
20029
20030+static int rl_domove_read_callback PARAMS((_rl_vimotion_cxt *));
20031+static int rl_domove_motion_callback PARAMS((_rl_vimotion_cxt *));
20032+static int rl_vi_domove_getchar PARAMS((_rl_vimotion_cxt *));
20033+
20034+static int vi_change_dispatch PARAMS((_rl_vimotion_cxt *));
20035+static int vi_delete_dispatch PARAMS((_rl_vimotion_cxt *));
20036+static int vi_yank_dispatch PARAMS((_rl_vimotion_cxt *));
20037+
20038+static int vidomove_dispatch PARAMS((_rl_vimotion_cxt *));
20039+
20040 void
20041 _rl_vi_initialize_line ()
20042 {
20043- register int i;
20044+ register int i, n;
20045
20046- for (i = 0; i < sizeof (vi_mark_chars) / sizeof (int); i++)
20047+ n = sizeof (vi_mark_chars) / sizeof (vi_mark_chars[0]);
20048+ for (i = 0; i < n; i++)
20049 vi_mark_chars[i] = -1;
20050
20051 RL_UNSETSTATE(RL_STATE_VICMDONCE);
20052@@ -205,7 +222,34 @@ rl_vi_redo (count, c)
20053 _rl_vi_stuff_insert (count);
20054 /* And back up point over the last character inserted. */
20055 if (rl_point > 0)
20056- rl_point--;
20057+ _rl_vi_backup ();
20058+ }
20059+ /* Ditto for redoing an insert with `I', but move to the beginning of the
20060+ line like the `I' command does. */
20061+ else if (_rl_vi_last_command == 'I' && vi_insert_buffer && *vi_insert_buffer)
20062+ {
20063+ rl_beg_of_line (1, 'I');
20064+ _rl_vi_stuff_insert (count);
20065+ if (rl_point > 0)
20066+ _rl_vi_backup ();
20067+ }
20068+ /* Ditto for redoing an insert with `a', but move forward a character first
20069+ like the `a' command does. */
20070+ else if (_rl_vi_last_command == 'a' && vi_insert_buffer && *vi_insert_buffer)
20071+ {
20072+ _rl_vi_append_forward ('a');
20073+ _rl_vi_stuff_insert (count);
20074+ if (rl_point > 0)
20075+ _rl_vi_backup ();
20076+ }
20077+ /* Ditto for redoing an insert with `A', but move to the end of the line
20078+ like the `A' command does. */
20079+ else if (_rl_vi_last_command == 'A' && vi_insert_buffer && *vi_insert_buffer)
20080+ {
20081+ rl_end_of_line (1, 'A');
20082+ _rl_vi_stuff_insert (count);
20083+ if (rl_point > 0)
20084+ _rl_vi_backup ();
20085 }
20086 else
20087 r = _rl_dispatch (_rl_vi_last_command, _rl_keymap);
20088@@ -571,27 +615,40 @@ rl_vi_insert_beg (count, key)
20089 int count, key;
20090 {
20091 rl_beg_of_line (1, key);
20092- rl_vi_insertion_mode (1, key);
20093+ rl_vi_insert_mode (1, key);
20094 return (0);
20095 }
20096
20097-int
20098-rl_vi_append_mode (count, key)
20099- int count, key;
20100+static void
20101+_rl_vi_append_forward (key)
20102+ int key;
20103 {
20104+ int point;
20105+
20106 if (rl_point < rl_end)
20107 {
20108 if (MB_CUR_MAX == 1 || rl_byte_oriented)
20109 rl_point++;
20110 else
20111- {
20112- int point = rl_point;
20113- rl_forward_char (1, key);
20114- if (point == rl_point)
20115- rl_point = rl_end;
20116- }
20117+ {
20118+ point = rl_point;
20119+#if 0
20120+ rl_forward_char (1, key);
20121+#else
20122+ rl_point = _rl_forward_char_internal (1);
20123+#endif
20124+ if (point == rl_point)
20125+ rl_point = rl_end;
20126+ }
20127 }
20128- rl_vi_insertion_mode (1, key);
20129+}
20130+
20131+int
20132+rl_vi_append_mode (count, key)
20133+ int count, key;
20134+{
20135+ _rl_vi_append_forward (key);
20136+ rl_vi_start_inserting (key, 1, rl_arg_sign);
20137 return (0);
20138 }
20139
20140@@ -625,13 +682,21 @@ rl_vi_insertion_mode (count, key)
20141 return (0);
20142 }
20143
20144+int
20145+rl_vi_insert_mode (count, key)
20146+ int count, key;
20147+{
20148+ rl_vi_start_inserting (key, 1, rl_arg_sign);
20149+ return (0);
20150+}
20151+
20152 static void
20153 _rl_vi_save_insert (up)
20154 UNDO_LIST *up;
20155 {
20156 int len, start, end;
20157
20158- if (up == 0)
20159+ if (up == 0 || up->what != UNDO_INSERT)
20160 {
20161 if (vi_insert_buffer_size >= 1)
20162 vi_insert_buffer[0] = '\0';
20163@@ -668,8 +733,11 @@ _rl_vi_done_inserting ()
20164 }
20165 else
20166 {
20167- if ((_rl_vi_last_key_before_insert == 'i' || _rl_vi_last_key_before_insert == 'a') && rl_undo_list)
20168- _rl_vi_save_insert (rl_undo_list);
20169+ if (rl_undo_list && (_rl_vi_last_key_before_insert == 'i' ||
20170+ _rl_vi_last_key_before_insert == 'a' ||
20171+ _rl_vi_last_key_before_insert == 'I' ||
20172+ _rl_vi_last_key_before_insert == 'A'))
20173+ _rl_vi_save_insert (rl_undo_list);
20174 /* XXX - Other keys probably need to be checked. */
20175 else if (_rl_vi_last_key_before_insert == 'C')
20176 rl_end_undo_group ();
20177@@ -716,7 +784,8 @@ _rl_vi_change_mbchar_case (count)
20178 {
20179 wchar_t wc;
20180 char mb[MB_LEN_MAX+1];
20181- int mblen, p;
20182+ int mlen, p;
20183+ size_t m;
20184 mbstate_t ps;
20185
20186 memset (&ps, 0, sizeof (mbstate_t));
20187@@ -724,7 +793,11 @@ _rl_vi_change_mbchar_case (count)
20188 count--;
20189 while (count-- && rl_point < rl_end)
20190 {
20191- mbrtowc (&wc, rl_line_buffer + rl_point, rl_end - rl_point, &ps);
20192+ m = mbrtowc (&wc, rl_line_buffer + rl_point, rl_end - rl_point, &ps);
20193+ if (MB_INVALIDCH (m))
20194+ wc = (wchar_t)rl_line_buffer[rl_point];
20195+ else if (MB_NULLWCH (m))
20196+ wc = L'\0';
20197 if (iswupper (wc))
20198 wc = towlower (wc);
20199 else if (iswlower (wc))
20200@@ -740,9 +813,9 @@ _rl_vi_change_mbchar_case (count)
20201 if (wc)
20202 {
20203 p = rl_point;
20204- mblen = wcrtomb (mb, wc, &ps);
20205- if (mblen >= 0)
20206- mb[mblen] = '\0';
20207+ mlen = wcrtomb (mb, wc, &ps);
20208+ if (mlen >= 0)
20209+ mb[mlen] = '\0';
20210 rl_begin_undo_group ();
20211 rl_vi_delete (1, 0);
20212 if (rl_point < p) /* Did we retreat at EOL? */
20213@@ -752,7 +825,7 @@ _rl_vi_change_mbchar_case (count)
20214 rl_vi_check ();
20215 }
20216 else
20217- rl_forward_char (1, 0);
20218+ rl_forward_char (1, 0);
20219 }
20220
20221 return 0;
20222@@ -799,7 +872,7 @@ rl_vi_change_case (count, ignore)
20223 _rl_insert_char (1, c);
20224 rl_end_undo_group ();
20225 rl_vi_check ();
20226- }
20227+ }
20228 else
20229 rl_forward_char (1, c);
20230 }
20231@@ -820,6 +893,15 @@ rl_vi_put (count, key)
20232 return (0);
20233 }
20234
20235+static void
20236+_rl_vi_backup ()
20237+{
20238+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
20239+ rl_point = _rl_find_prev_mbchar (rl_line_buffer, rl_point, MB_FIND_NONZERO);
20240+ else
20241+ rl_point--;
20242+}
20243+
20244 int
20245 rl_vi_check ()
20246 {
20247@@ -828,7 +910,7 @@ rl_vi_check ()
20248 if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
20249 rl_point = _rl_find_prev_mbchar (rl_line_buffer, rl_point, MB_FIND_NONZERO);
20250 else
20251- rl_point--;
20252+ rl_point--;
20253 }
20254 return (0);
20255 }
20256@@ -844,47 +926,106 @@ rl_vi_column (count, key)
20257 return (0);
20258 }
20259
20260-int
20261-rl_vi_domove (key, nextkey)
20262- int key, *nextkey;
20263+/* Process C as part of the current numeric argument. Return -1 if the
20264+ argument should be aborted, 0 if we should not read any more chars, and
20265+ 1 if we should continue to read chars. */
20266+static int
20267+_rl_vi_arg_dispatch (c)
20268+ int c;
20269 {
20270- int c, save;
20271- int old_end;
20272+ int key;
20273
20274- rl_mark = rl_point;
20275- RL_SETSTATE(RL_STATE_MOREINPUT);
20276- c = rl_read_key ();
20277- RL_UNSETSTATE(RL_STATE_MOREINPUT);
20278- *nextkey = c;
20279+ key = c;
20280+ if (c >= 0 && _rl_keymap[c].type == ISFUNC && _rl_keymap[c].function == rl_universal_argument)
20281+ {
20282+ rl_numeric_arg *= 4;
20283+ return 1;
20284+ }
20285+
20286+ c = UNMETA (c);
20287
20288- if (!member (c, vi_motion))
20289+ if (_rl_digit_p (c))
20290 {
20291- if (_rl_digit_p (c))
20292- {
20293- save = rl_numeric_arg;
20294- rl_numeric_arg = _rl_digit_value (c);
20295- rl_explicit_arg = 1;
20296- RL_SETSTATE (RL_STATE_NUMERICARG|RL_STATE_VIMOTION);
20297- rl_digit_loop1 ();
20298- RL_UNSETSTATE (RL_STATE_VIMOTION);
20299- rl_numeric_arg *= save;
20300- RL_SETSTATE(RL_STATE_MOREINPUT);
20301- c = rl_read_key (); /* real command */
20302- RL_UNSETSTATE(RL_STATE_MOREINPUT);
20303- *nextkey = c;
20304- }
20305- else if (key == c && (key == 'd' || key == 'y' || key == 'c'))
20306- {
20307- rl_mark = rl_end;
20308- rl_beg_of_line (1, c);
20309- _rl_vi_last_motion = c;
20310- return (0);
20311- }
20312+ if (rl_explicit_arg)
20313+ rl_numeric_arg = (rl_numeric_arg * 10) + _rl_digit_value (c);
20314 else
20315- return (-1);
20316+ rl_numeric_arg = _rl_digit_value (c);
20317+ rl_explicit_arg = 1;
20318+ return 1; /* keep going */
20319 }
20320+ else
20321+ {
20322+ rl_clear_message ();
20323+ rl_stuff_char (key);
20324+ return 0; /* done */
20325+ }
20326+}
20327+
20328+/* A simplified loop for vi. Don't dispatch key at end.
20329+ Don't recognize minus sign?
20330+ Should this do rl_save_prompt/rl_restore_prompt? */
20331+static int
20332+rl_digit_loop1 ()
20333+{
20334+ int c, r;
20335+
20336+ while (1)
20337+ {
20338+ if (_rl_arg_overflow ())
20339+ return 1;
20340+
20341+ c = _rl_arg_getchar ();
20342+
20343+ r = _rl_vi_arg_dispatch (c);
20344+ if (r <= 0)
20345+ break;
20346+ }
20347+
20348+ RL_UNSETSTATE(RL_STATE_NUMERICARG);
20349+ return (0);
20350+}
20351+
20352+static void
20353+_rl_mvcxt_init (m, op, key)
20354+ _rl_vimotion_cxt *m;
20355+ int op, key;
20356+{
20357+ m->op = op;
20358+ m->state = m->flags = 0;
20359+ m->ncxt = 0;
20360+ m->numeric_arg = -1;
20361+ m->start = rl_point;
20362+ m->end = rl_end;
20363+ m->key = key;
20364+ m->motion = -1;
20365+}
20366+
20367+static _rl_vimotion_cxt *
20368+_rl_mvcxt_alloc (op, key)
20369+ int op, key;
20370+{
20371+ _rl_vimotion_cxt *m;
20372+
20373+ m = xmalloc (sizeof (_rl_vimotion_cxt));
20374+ _rl_mvcxt_init (m, op, key);
20375+ return m;
20376+}
20377+
20378+static void
20379+_rl_mvcxt_dispose (m)
20380+ _rl_vimotion_cxt *m;
20381+{
20382+ xfree (m);
20383+}
20384
20385- _rl_vi_last_motion = c;
20386+static int
20387+rl_domove_motion_callback (m)
20388+ _rl_vimotion_cxt *m;
20389+{
20390+ int c, save, r;
20391+ int old_end;
20392+
20393+ _rl_vi_last_motion = c = m->motion;
20394
20395 /* Append a blank character temporarily so that the motion routines
20396 work right at the end of the line. */
20397@@ -913,7 +1054,7 @@ rl_vi_domove (key, nextkey)
20398
20399 /* If cw or cW, back up to the end of a word, so the behaviour of ce
20400 or cE is the actual result. Brute-force, no subtlety. */
20401- if (key == 'c' && rl_point >= rl_mark && (_rl_to_upper (c) == 'W'))
20402+ if (m->key == 'c' && rl_point >= rl_mark && (_rl_to_upper (c) == 'W'))
20403 {
20404 /* Don't move farther back than where we started. */
20405 while (rl_point > rl_mark && whitespace (rl_line_buffer[rl_point]))
20406@@ -922,7 +1063,7 @@ rl_vi_domove (key, nextkey)
20407 /* Posix.2 says that if cw or cW moves the cursor towards the end of
20408 the line, the character under the cursor should be deleted. */
20409 if (rl_point == rl_mark)
20410- rl_point++;
20411+ rl_point++;
20412 else
20413 {
20414 /* Move past the end of the word so that the kill doesn't
20415@@ -936,88 +1077,142 @@ rl_vi_domove (key, nextkey)
20416 if (rl_mark < rl_point)
20417 SWAP (rl_point, rl_mark);
20418
20419- return (0);
20420+#if defined (READLINE_CALLBACKS)
20421+ if (RL_ISSTATE (RL_STATE_CALLBACK))
20422+ (*rl_redisplay_function)(); /* make sure motion is displayed */
20423+#endif
20424+
20425+ r = vidomove_dispatch (m);
20426+
20427+ return (r);
20428 }
20429
20430-/* Process C as part of the current numeric argument. Return -1 if the
20431- argument should be aborted, 0 if we should not read any more chars, and
20432- 1 if we should continue to read chars. */
20433+#define RL_VIMOVENUMARG() (RL_ISSTATE (RL_STATE_VIMOTION) && RL_ISSTATE (RL_STATE_NUMERICARG))
20434+
20435 static int
20436-_rl_vi_arg_dispatch (c)
20437- int c;
20438+rl_domove_read_callback (m)
20439+ _rl_vimotion_cxt *m;
20440 {
20441- int key;
20442+ int c, save;
20443
20444- key = c;
20445- if (c >= 0 && _rl_keymap[c].type == ISFUNC && _rl_keymap[c].function == rl_universal_argument)
20446+ c = m->motion;
20447+
20448+ if (member (c, vi_motion))
20449 {
20450- rl_numeric_arg *= 4;
20451- return 1;
20452+#if defined (READLINE_CALLBACKS)
20453+ /* If we just read a vi-mode motion command numeric argument, turn off
20454+ the `reading numeric arg' state */
20455+ if (RL_ISSTATE (RL_STATE_CALLBACK) && RL_VIMOVENUMARG())
20456+ RL_UNSETSTATE (RL_STATE_NUMERICARG);
20457+#endif
20458+ /* Should do everything, including turning off RL_STATE_VIMOTION */
20459+ return (rl_domove_motion_callback (m));
20460+ }
20461+ else if (m->key == c && (m->key == 'd' || m->key == 'y' || m->key == 'c'))
20462+ {
20463+ rl_mark = rl_end;
20464+ rl_beg_of_line (1, c);
20465+ _rl_vi_last_motion = c;
20466+ RL_UNSETSTATE (RL_STATE_VIMOTION);
20467+ return (vidomove_dispatch (m));
20468 }
20469-
20470- c = UNMETA (c);
20471-
20472- if (_rl_digit_p (c))
20473+#if defined (READLINE_CALLBACKS)
20474+ /* XXX - these need to handle rl_universal_argument bindings */
20475+ /* Reading vi motion char continuing numeric argument */
20476+ else if (_rl_digit_p (c) && RL_ISSTATE (RL_STATE_CALLBACK) && RL_VIMOVENUMARG())
20477 {
20478- if (rl_explicit_arg)
20479- rl_numeric_arg = (rl_numeric_arg * 10) + _rl_digit_value (c);
20480- else
20481- rl_numeric_arg = _rl_digit_value (c);
20482+ return (_rl_vi_arg_dispatch (c));
20483+ }
20484+ /* Readine vi motion char starting numeric argument */
20485+ else if (_rl_digit_p (c) && RL_ISSTATE (RL_STATE_CALLBACK) && RL_ISSTATE (RL_STATE_VIMOTION) && (RL_ISSTATE (RL_STATE_NUMERICARG) == 0))
20486+ {
20487+ RL_SETSTATE (RL_STATE_NUMERICARG);
20488+ return (_rl_vi_arg_dispatch (c));
20489+ }
20490+#endif
20491+ else if (_rl_digit_p (c))
20492+ {
20493+ /* This code path taken when not in callback mode */
20494+ save = rl_numeric_arg;
20495+ rl_numeric_arg = _rl_digit_value (c);
20496 rl_explicit_arg = 1;
20497- return 1;
20498+ RL_SETSTATE (RL_STATE_NUMERICARG);
20499+ rl_digit_loop1 ();
20500+ rl_numeric_arg *= save;
20501+ c = rl_vi_domove_getchar (m);
20502+ if (c < 0)
20503+ {
20504+ m->motion = 0;
20505+ return -1;
20506+ }
20507+ m->motion = c;
20508+ return (rl_domove_motion_callback (m));
20509 }
20510 else
20511 {
20512- rl_clear_message ();
20513- rl_stuff_char (key);
20514- return 0;
20515+ RL_UNSETSTATE (RL_STATE_VIMOTION);
20516+ RL_UNSETSTATE (RL_STATE_NUMERICARG);
20517+ return (1);
20518 }
20519 }
20520
20521-/* A simplified loop for vi. Don't dispatch key at end.
20522- Don't recognize minus sign?
20523- Should this do rl_save_prompt/rl_restore_prompt? */
20524 static int
20525-rl_digit_loop1 ()
20526+rl_vi_domove_getchar (m)
20527+ _rl_vimotion_cxt *m;
20528 {
20529- int c, r;
20530+ int c;
20531
20532- while (1)
20533- {
20534- if (_rl_arg_overflow ())
20535- return 1;
20536+ RL_SETSTATE(RL_STATE_MOREINPUT);
20537+ c = rl_read_key ();
20538+ RL_UNSETSTATE(RL_STATE_MOREINPUT);
20539
20540- c = _rl_arg_getchar ();
20541+ return c;
20542+}
20543
20544- r = _rl_vi_arg_dispatch (c);
20545- if (r <= 0)
20546- break;
20547- }
20548+#if defined (READLINE_CALLBACKS)
20549+int
20550+_rl_vi_domove_callback (m)
20551+ _rl_vimotion_cxt *m;
20552+{
20553+ int c, r;
20554
20555- RL_UNSETSTATE(RL_STATE_NUMERICARG);
20556- return (0);
20557+ m->motion = c = rl_vi_domove_getchar (m);
20558+ /* XXX - what to do if this returns -1? Should we return 1 for eof to
20559+ callback code? */
20560+ r = rl_domove_read_callback (m);
20561+
20562+ return ((r == 0) ? r : 1); /* normalize return values */
20563 }
20564+#endif
20565
20566+/* This code path taken when not in callback mode. */
20567 int
20568-rl_vi_delete_to (count, key)
20569- int count, key;
20570+rl_vi_domove (x, ignore)
20571+ int x, *ignore;
20572 {
20573- int c;
20574+ int r;
20575+ _rl_vimotion_cxt *m;
20576
20577- if (_rl_uppercase_p (key))
20578- rl_stuff_char ('$');
20579- else if (vi_redoing)
20580- rl_stuff_char (_rl_vi_last_motion);
20581+ m = _rl_vimvcxt;
20582+ *ignore = m->motion = rl_vi_domove_getchar (m);
20583
20584- if (rl_vi_domove (key, &c))
20585+ if (m->motion < 0)
20586 {
20587- rl_ding ();
20588+ m->motion = 0;
20589 return -1;
20590 }
20591
20592+ return (rl_domove_read_callback (m));
20593+}
20594+
20595+static int
20596+vi_delete_dispatch (m)
20597+ _rl_vimotion_cxt *m;
20598+{
20599 /* These are the motion commands that do not require adjusting the
20600 mark. */
20601- if ((strchr (" l|h^0bB", c) == 0) && (rl_mark < rl_end))
20602+ if (((strchr (" l|h^0bBFT`", m->motion) == 0) && (rl_point >= m->start)) &&
20603+ (rl_mark < rl_end))
20604 rl_mark++;
20605
20606 rl_kill_text (rl_point, rl_mark);
20607@@ -1025,33 +1220,61 @@ rl_vi_delete_to (count, key)
20608 }
20609
20610 int
20611-rl_vi_change_to (count, key)
20612+rl_vi_delete_to (count, key)
20613 int count, key;
20614 {
20615- int c, start_pos;
20616+ int c, r;
20617
20618+ _rl_vimvcxt = _rl_mvcxt_alloc (VIM_DELETE, key);
20619+ _rl_vimvcxt->start = rl_point;
20620+
20621+ rl_mark = rl_point;
20622 if (_rl_uppercase_p (key))
20623- rl_stuff_char ('$');
20624+ {
20625+ _rl_vimvcxt->motion = '$';
20626+ r = rl_domove_motion_callback (_rl_vimvcxt);
20627+ }
20628 else if (vi_redoing)
20629- rl_stuff_char (_rl_vi_last_motion);
20630-
20631- start_pos = rl_point;
20632+ {
20633+ _rl_vimvcxt->motion = _rl_vi_last_motion;
20634+ r = rl_domove_motion_callback (_rl_vimvcxt);
20635+ }
20636+#if defined (READLINE_CALLBACKS)
20637+ else if (RL_ISSTATE (RL_STATE_CALLBACK))
20638+ {
20639+ RL_SETSTATE (RL_STATE_VIMOTION);
20640+ return (0);
20641+ }
20642+#endif
20643+ else
20644+ r = rl_vi_domove (key, &c);
20645
20646- if (rl_vi_domove (key, &c))
20647+ if (r < 0)
20648 {
20649 rl_ding ();
20650- return -1;
20651+ r = -1;
20652 }
20653
20654+ _rl_mvcxt_dispose (_rl_vimvcxt);
20655+ _rl_vimvcxt = 0;
20656+
20657+ return r;
20658+}
20659+
20660+static int
20661+vi_change_dispatch (m)
20662+ _rl_vimotion_cxt *m;
20663+{
20664 /* These are the motion commands that do not require adjusting the
20665 mark. c[wW] are handled by special-case code in rl_vi_domove(),
20666 and already leave the mark at the correct location. */
20667- if ((strchr (" l|hwW^0bB", c) == 0) && (rl_mark < rl_end))
20668+ if (((strchr (" l|hwW^0bBFT`", m->motion) == 0) && (rl_point >= m->start)) &&
20669+ (rl_mark < rl_end))
20670 rl_mark++;
20671
20672 /* The cursor never moves with c[wW]. */
20673- if ((_rl_to_upper (c) == 'W') && rl_point < start_pos)
20674- rl_point = start_pos;
20675+ if ((_rl_to_upper (m->motion) == 'W') && rl_point < m->start)
20676+ rl_point = m->start;
20677
20678 if (vi_redoing)
20679 {
20680@@ -1069,49 +1292,145 @@ rl_vi_change_to (count, key)
20681 rl_begin_undo_group (); /* to make the `u' command work */
20682 rl_kill_text (rl_point, rl_mark);
20683 /* `C' does not save the text inserted for undoing or redoing. */
20684- if (_rl_uppercase_p (key) == 0)
20685- _rl_vi_doing_insert = 1;
20686- rl_vi_start_inserting (key, rl_numeric_arg, rl_arg_sign);
20687+ if (_rl_uppercase_p (m->key) == 0)
20688+ _rl_vi_doing_insert = 1;
20689+ /* XXX -- TODO -- use m->numericarg? */
20690+ rl_vi_start_inserting (m->key, rl_numeric_arg, rl_arg_sign);
20691 }
20692
20693 return (0);
20694 }
20695
20696 int
20697-rl_vi_yank_to (count, key)
20698+rl_vi_change_to (count, key)
20699 int count, key;
20700 {
20701- int c, save;
20702+ int c, r;
20703+
20704+ _rl_vimvcxt = _rl_mvcxt_alloc (VIM_CHANGE, key);
20705+ _rl_vimvcxt->start = rl_point;
20706
20707- save = rl_point;
20708+ rl_mark = rl_point;
20709 if (_rl_uppercase_p (key))
20710- rl_stuff_char ('$');
20711+ {
20712+ _rl_vimvcxt->motion = '$';
20713+ r = rl_domove_motion_callback (_rl_vimvcxt);
20714+ }
20715+ else if (vi_redoing)
20716+ {
20717+ _rl_vimvcxt->motion = _rl_vi_last_motion;
20718+ r = rl_domove_motion_callback (_rl_vimvcxt);
20719+ }
20720+#if defined (READLINE_CALLBACKS)
20721+ else if (RL_ISSTATE (RL_STATE_CALLBACK))
20722+ {
20723+ RL_SETSTATE (RL_STATE_VIMOTION);
20724+ return (0);
20725+ }
20726+#endif
20727+ else
20728+ r = rl_vi_domove (key, &c);
20729
20730- if (rl_vi_domove (key, &c))
20731+ if (r < 0)
20732 {
20733 rl_ding ();
20734- return -1;
20735+ r = -1; /* normalize return value */
20736 }
20737
20738+ _rl_mvcxt_dispose (_rl_vimvcxt);
20739+ _rl_vimvcxt = 0;
20740+
20741+ return r;
20742+}
20743+
20744+static int
20745+vi_yank_dispatch (m)
20746+ _rl_vimotion_cxt *m;
20747+{
20748 /* These are the motion commands that do not require adjusting the
20749 mark. */
20750- if ((strchr (" l|h^0%bB", c) == 0) && (rl_mark < rl_end))
20751+ if (((strchr (" l|h^0%bBFT`", m->motion) == 0) && (rl_point >= m->start)) &&
20752+ (rl_mark < rl_end))
20753 rl_mark++;
20754
20755 rl_begin_undo_group ();
20756 rl_kill_text (rl_point, rl_mark);
20757 rl_end_undo_group ();
20758 rl_do_undo ();
20759- rl_point = save;
20760+ rl_point = m->start;
20761
20762 return (0);
20763 }
20764
20765 int
20766+rl_vi_yank_to (count, key)
20767+ int count, key;
20768+{
20769+ int c, r;
20770+
20771+ _rl_vimvcxt = _rl_mvcxt_alloc (VIM_YANK, key);
20772+ _rl_vimvcxt->start = rl_point;
20773+
20774+ rl_mark = rl_point;
20775+ if (_rl_uppercase_p (key))
20776+ {
20777+ _rl_vimvcxt->motion = '$';
20778+ r = rl_domove_motion_callback (_rl_vimvcxt);
20779+ }
20780+#if defined (READLINE_CALLBACKS)
20781+ else if (RL_ISSTATE (RL_STATE_CALLBACK))
20782+ {
20783+ RL_SETSTATE (RL_STATE_VIMOTION);
20784+ return (0);
20785+ }
20786+#endif
20787+ else
20788+ r = rl_vi_domove (key, &c);
20789+
20790+ if (r < 0)
20791+ {
20792+ rl_ding ();
20793+ r = -1;
20794+ }
20795+
20796+ _rl_mvcxt_dispose (_rl_vimvcxt);
20797+ _rl_vimvcxt = 0;
20798+
20799+ return r;
20800+}
20801+
20802+static int
20803+vidomove_dispatch (m)
20804+ _rl_vimotion_cxt *m;
20805+{
20806+ int r;
20807+
20808+ switch (m->op)
20809+ {
20810+ case VIM_DELETE:
20811+ r = vi_delete_dispatch (m);
20812+ break;
20813+ case VIM_CHANGE:
20814+ r = vi_change_dispatch (m);
20815+ break;
20816+ case VIM_YANK:
20817+ r = vi_yank_dispatch (m);
20818+ break;
20819+ default:
20820+ _rl_errmsg ("vidomove_dispatch: unknown operator %d", m->op);
20821+ r = 1;
20822+ break;
20823+ }
20824+
20825+ RL_UNSETSTATE (RL_STATE_VIMOTION);
20826+ return r;
20827+}
20828+
20829+int
20830 rl_vi_rubout (count, key)
20831 int count, key;
20832 {
20833- int p, opoint;
20834+ int opoint;
20835
20836 if (count < 0)
20837 return (rl_vi_delete (-count, key));
20838@@ -1193,14 +1512,22 @@ static int
20839 _rl_vi_callback_char_search (data)
20840 _rl_callback_generic_arg *data;
20841 {
20842+ int c;
20843 #if defined (HANDLE_MULTIBYTE)
20844- _rl_vi_last_search_mblen = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX);
20845+ c = _rl_vi_last_search_mblen = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX);
20846 #else
20847 RL_SETSTATE(RL_STATE_MOREINPUT);
20848- _rl_vi_last_search_char = rl_read_key ();
20849+ c = rl_read_key ();
20850 RL_UNSETSTATE(RL_STATE_MOREINPUT);
20851 #endif
20852
20853+ if (c <= 0)
20854+ return -1;
20855+
20856+#if !defined (HANDLE_MULTIBYTE)
20857+ _rl_vi_last_search_char = c;
20858+#endif
20859+
20860 _rl_callback_func = 0;
20861 _rl_want_redisplay = 1;
20862
20863@@ -1216,6 +1543,7 @@ int
20864 rl_vi_char_search (count, key)
20865 int count, key;
20866 {
20867+ int c;
20868 #if defined (HANDLE_MULTIBYTE)
20869 static char *target;
20870 static int tlen;
20871@@ -1224,27 +1552,38 @@ rl_vi_char_search (count, key)
20872 #endif
20873
20874 if (key == ';' || key == ',')
20875- _rl_cs_dir = (key == ';') ? _rl_cs_orig_dir : -_rl_cs_orig_dir;
20876+ {
20877+ if (_rl_cs_orig_dir == 0)
20878+ return -1;
20879+#if defined (HANDLE_MULTIBYTE)
20880+ if (_rl_vi_last_search_mblen == 0)
20881+ return -1;
20882+#else
20883+ if (_rl_vi_last_search_char == 0)
20884+ return -1;
20885+#endif
20886+ _rl_cs_dir = (key == ';') ? _rl_cs_orig_dir : -_rl_cs_orig_dir;
20887+ }
20888 else
20889 {
20890 switch (key)
20891- {
20892- case 't':
20893- _rl_cs_orig_dir = _rl_cs_dir = FTO;
20894- break;
20895-
20896- case 'T':
20897- _rl_cs_orig_dir = _rl_cs_dir = BTO;
20898- break;
20899-
20900- case 'f':
20901- _rl_cs_orig_dir = _rl_cs_dir = FFIND;
20902- break;
20903-
20904- case 'F':
20905- _rl_cs_orig_dir = _rl_cs_dir = BFIND;
20906- break;
20907- }
20908+ {
20909+ case 't':
20910+ _rl_cs_orig_dir = _rl_cs_dir = FTO;
20911+ break;
20912+
20913+ case 'T':
20914+ _rl_cs_orig_dir = _rl_cs_dir = BTO;
20915+ break;
20916+
20917+ case 'f':
20918+ _rl_cs_orig_dir = _rl_cs_dir = FFIND;
20919+ break;
20920+
20921+ case 'F':
20922+ _rl_cs_orig_dir = _rl_cs_dir = BFIND;
20923+ break;
20924+ }
20925
20926 if (vi_redoing)
20927 {
20928@@ -1252,21 +1591,27 @@ rl_vi_char_search (count, key)
20929 }
20930 #if defined (READLINE_CALLBACKS)
20931 else if (RL_ISSTATE (RL_STATE_CALLBACK))
20932- {
20933- _rl_callback_data = _rl_callback_data_alloc (count);
20934- _rl_callback_data->i1 = _rl_cs_dir;
20935- _rl_callback_func = _rl_vi_callback_char_search;
20936- return (0);
20937- }
20938+ {
20939+ _rl_callback_data = _rl_callback_data_alloc (count);
20940+ _rl_callback_data->i1 = _rl_cs_dir;
20941+ _rl_callback_func = _rl_vi_callback_char_search;
20942+ return (0);
20943+ }
20944 #endif
20945 else
20946 {
20947 #if defined (HANDLE_MULTIBYTE)
20948- _rl_vi_last_search_mblen = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX);
20949+ c = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX);
20950+ if (c <= 0)
20951+ return -1;
20952+ _rl_vi_last_search_mblen = c;
20953 #else
20954 RL_SETSTATE(RL_STATE_MOREINPUT);
20955- _rl_vi_last_search_char = rl_read_key ();
20956+ c = rl_read_key ();
20957 RL_UNSETSTATE(RL_STATE_MOREINPUT);
20958+ if (c < 0)
20959+ return -1;
20960+ _rl_vi_last_search_char = c;
20961 #endif
20962 }
20963 }
20964@@ -1302,7 +1647,7 @@ rl_vi_match (ignore, key)
20965 pre = rl_point;
20966 rl_forward_char (1, key);
20967 if (pre == rl_point)
20968- break;
20969+ break;
20970 }
20971 }
20972 else
20973@@ -1331,7 +1676,7 @@ rl_vi_match (ignore, key)
20974 {
20975 pos = _rl_find_prev_mbchar (rl_line_buffer, pos, MB_FIND_ANY);
20976 if (tmp == pos)
20977- pos--;
20978+ pos--;
20979 }
20980 if (pos >= 0)
20981 {
20982@@ -1426,9 +1771,9 @@ _rl_vi_change_char (count, c, mb)
20983 }
20984
20985 static int
20986-_rl_vi_callback_getchar (mb, mblen)
20987+_rl_vi_callback_getchar (mb, mlen)
20988 char *mb;
20989- int mblen;
20990+ int mlen;
20991 {
20992 int c;
20993
20994@@ -1436,9 +1781,12 @@ _rl_vi_callback_getchar (mb, mblen)
20995 c = rl_read_key ();
20996 RL_UNSETSTATE(RL_STATE_MOREINPUT);
20997
20998+ if (c < 0)
20999+ return -1;
21000+
21001 #if defined (HANDLE_MULTIBYTE)
21002 if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
21003- c = _rl_read_mbstring (c, mb, mblen);
21004+ c = _rl_read_mbstring (c, mb, mlen);
21005 #endif
21006
21007 return c;
21008@@ -1454,6 +1802,9 @@ _rl_vi_callback_change_char (data)
21009
21010 _rl_vi_last_replacement = c = _rl_vi_callback_getchar (mb, MB_LEN_MAX);
21011
21012+ if (c < 0)
21013+ return -1;
21014+
21015 _rl_callback_func = 0;
21016 _rl_want_redisplay = 1;
21017
21018@@ -1485,6 +1836,9 @@ rl_vi_change_char (count, key)
21019 else
21020 _rl_vi_last_replacement = c = _rl_vi_callback_getchar (mb, MB_LEN_MAX);
21021
21022+ if (c < 0)
21023+ return -1;
21024+
21025 return (_rl_vi_change_char (count, c, mb));
21026 }
21027
21028@@ -1570,8 +1924,8 @@ rl_vi_replace (count, key)
21029 vi_replace_map[NEWLINE].function = rl_newline;
21030
21031 /* If the normal vi insertion keymap has ^H bound to erase, do the
21032- same here. Probably should remove the assignment to RUBOUT up
21033- there, but I don't think it will make a difference in real life. */
21034+ same here. Probably should remove the assignment to RUBOUT up
21035+ there, but I don't think it will make a difference in real life. */
21036 if (vi_insertion_keymap[CTRL ('H')].type == ISFUNC &&
21037 vi_insertion_keymap[CTRL ('H')].function == rl_rubout)
21038 vi_replace_map[CTRL ('H')].function = rl_vi_overstrike_delete;
21039@@ -1619,7 +1973,7 @@ _rl_vi_set_mark ()
21040 ch = rl_read_key ();
21041 RL_UNSETSTATE(RL_STATE_MOREINPUT);
21042
21043- if (ch < 'a' || ch > 'z')
21044+ if (ch < 0 || ch < 'a' || ch > 'z') /* make test against 0 explicit */
21045 {
21046 rl_ding ();
21047 return -1;
21048@@ -1671,7 +2025,7 @@ _rl_vi_goto_mark ()
21049 rl_point = rl_mark;
21050 return 0;
21051 }
21052- else if (ch < 'a' || ch > 'z')
21053+ else if (ch < 0 || ch < 'a' || ch > 'z') /* make test against 0 explicit */
21054 {
21055 rl_ding ();
21056 return -1;
21057Index: gdb-7.2.90.20110703/readline/xfree.c
21058===================================================================
21059--- /dev/null 1970-01-01 00:00:00.000000000 +0000
21060+++ gdb-7.2.90.20110703/readline/xfree.c 2011-07-03 10:44:45.000000000 +0200
21061@@ -0,0 +1,57 @@
21062+/* xfree.c -- safe version of free that ignores attempts to free NUL */
21063+
21064+/* Copyright (C) 1991-2010 Free Software Foundation, Inc.
21065+
21066+ This file is part of the GNU Readline Library (Readline), a library
21067+ for reading lines of text with interactive input and history editing.
21068+
21069+ Readline is free software: you can redistribute it and/or modify
21070+ it under the terms of the GNU General Public License as published by
21071+ the Free Software Foundation, either version 3 of the License, or
21072+ (at your option) any later version.
21073+
21074+ Readline is distributed in the hope that it will be useful,
21075+ but WITHOUT ANY WARRANTY; without even the implied warranty of
21076+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21077+ GNU General Public License for more details.
21078+
21079+ You should have received a copy of the GNU General Public License
21080+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
21081+*/
21082+
21083+#define READLINE_LIBRARY
21084+
21085+#if defined (HAVE_CONFIG_H)
21086+#include <config.h>
21087+#endif
21088+
21089+#if defined (HAVE_STDLIB_H)
21090+# include <stdlib.h>
21091+#else
21092+# include "ansi_stdlib.h"
21093+#endif /* HAVE_STDLIB_H */
21094+
21095+#include <stdio.h>
21096+
21097+#include "xmalloc.h"
21098+#include "readline.h"
21099+
21100+/* **************************************************************** */
21101+/* */
21102+/* Memory Deallocation. */
21103+/* */
21104+/* **************************************************************** */
21105+
21106+/* Use this as the function to call when adding unwind protects so we
21107+ don't need to know what free() returns. */
21108+void
21109+xfree (string)
21110+ PTR_T string;
21111+{
21112+ /* Leak a bit. */
21113+ if (RL_ISSTATE(RL_STATE_SIGHANDLER))
21114+ return;
21115+
21116+ if (string)
21117+ free (string);
21118+}
21119Index: gdb-7.2.90.20110703/readline/xmalloc.c
21120===================================================================
21121--- gdb-7.2.90.20110703.orig/readline/xmalloc.c 2011-07-03 10:40:53.000000000 +0200
21122+++ gdb-7.2.90.20110703/readline/xmalloc.c 2011-07-03 10:43:54.000000000 +0200
21123@@ -1,23 +1,24 @@
21124 /* xmalloc.c -- safe versions of malloc and realloc */
21125
21126-/* Copyright (C) 1991 Free Software Foundation, Inc.
21127+/* Copyright (C) 1991-2009 Free Software Foundation, Inc.
21128
21129- This file is part of GNU Readline, a library for reading lines
21130- of text with interactive input and history editing.
21131+ This file is part of the GNU Readline Library (Readline), a library
21132+ for reading lines of text with interactive input and history editing.
21133
21134- Readline is free software; you can redistribute it and/or modify it
21135- under the terms of the GNU General Public License as published by the
21136- Free Software Foundation; either version 2, or (at your option) any
21137- later version.
21138-
21139- Readline is distributed in the hope that it will be useful, but
21140- WITHOUT ANY WARRANTY; without even the implied warranty of
21141- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21142- General Public License for more details.
21143+ Readline is free software: you can redistribute it and/or modify
21144+ it under the terms of the GNU General Public License as published by
21145+ the Free Software Foundation, either version 3 of the License, or
21146+ (at your option) any later version.
21147+
21148+ Readline is distributed in the hope that it will be useful,
21149+ but WITHOUT ANY WARRANTY; without even the implied warranty of
21150+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21151+ GNU General Public License for more details.
21152
21153 You should have received a copy of the GNU General Public License
21154- along with Readline; see the file COPYING. If not, write to the Free
21155- Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
21156+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
21157+*/
21158+
21159 #define READLINE_LIBRARY
21160
21161 #if defined (HAVE_CONFIG_H)
21162@@ -33,7 +34,6 @@
21163 #endif /* HAVE_STDLIB_H */
21164
21165 #include "xmalloc.h"
21166-#include "readline.h"
21167
21168 /* **************************************************************** */
21169 /* */
21170@@ -41,9 +41,6 @@
21171 /* */
21172 /* **************************************************************** */
21173
21174-/* xmalloc and xrealloc are provided by GDB. */
21175-#if 0
21176-
21177 static void
21178 memory_error_and_abort (fname)
21179 char *fname;
21180@@ -80,21 +77,3 @@ xrealloc (pointer, bytes)
21181 memory_error_and_abort ("xrealloc");
21182 return (temp);
21183 }
21184-
21185-/* xmalloc and xrealloc are provided by GDB. */
21186-#endif /* 0 */
21187-
21188-/* Use this as the function to call when adding unwind protects so we
21189- don't need to know what free() returns. */
21190-void
21191-xfree (string)
21192- PTR_T string;
21193-{
21194- /* Leak a bit. */
21195- if (RL_ISSTATE(RL_STATE_SIGHANDLER))
21196- return;
21197-
21198-#undef free
21199- if (string)
21200- free (string);
21201-}
21202Index: gdb-7.2.90.20110703/readline/xmalloc.h
21203===================================================================
21204--- gdb-7.2.90.20110703.orig/readline/xmalloc.h 2011-07-03 10:40:53.000000000 +0200
21205+++ gdb-7.2.90.20110703/readline/xmalloc.h 2011-07-03 10:41:21.000000000 +0200
21206@@ -1,24 +1,23 @@
21207 /* xmalloc.h -- memory allocation that aborts on errors. */
21208
21209-/* Copyright (C) 1999 Free Software Foundation, Inc.
21210+/* Copyright (C) 1999-2009 Free Software Foundation, Inc.
21211
21212- This file is part of the GNU Readline Library, a library for
21213- reading lines of text with interactive input and history editing.
21214+ This file is part of the GNU Readline Library (Readline), a library
21215+ for reading lines of text with interactive input and history editing.
21216
21217- The GNU Readline Library is free software; you can redistribute it
21218- and/or modify it under the terms of the GNU General Public License
21219- as published by the Free Software Foundation; either version 2, or
21220+ Readline is free software: you can redistribute it and/or modify
21221+ it under the terms of the GNU General Public License as published by
21222+ the Free Software Foundation, either version 3 of the License, or
21223 (at your option) any later version.
21224
21225- The GNU Readline Library is distributed in the hope that it will be
21226- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
21227- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21228+ Readline is distributed in the hope that it will be useful,
21229+ but WITHOUT ANY WARRANTY; without even the implied warranty of
21230+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21231 GNU General Public License for more details.
21232
21233- The GNU General Public License is often shipped with GNU software, and
21234- is generally kept in a file called COPYING or LICENSE. If you do not
21235- have a copy of the license, write to the Free Software Foundation,
21236- 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
21237+ You should have received a copy of the GNU General Public License
21238+ along with Readline. If not, see <http://www.gnu.org/licenses/>.
21239+*/
21240
21241 #if !defined (_XMALLOC_H_)
21242 #define _XMALLOC_H_
21243@@ -42,9 +41,6 @@
21244 /* xmalloc and xrealloc should be also protected from RL_STATE_SIGHANDLER. */
21245 #define xfree xfree_readline
21246
21247-/* readline-5.1 backport. */
21248-#define free xfree
21249-
21250 extern PTR_T xmalloc PARAMS((size_t));
21251 extern PTR_T xrealloc PARAMS((void *, size_t));
21252 extern void xfree PARAMS((void *));
This page took 2.59262 seconds and 4 git commands to generate.