source: clfs-sysroot/patches/readline-5.2-fixes-5.patch@ fabddfd

Last change on this file since fabddfd was a50d3ff, checked in by Joe Ciccone <jciccone@…>, 16 years ago

Update Readline Patch.

  • Property mode set to 100644
File size: 21.3 KB
RevLine 
[63a055f]1Submitted By: Jim Gifford (jim at linuxfromscratch dot org)
[a50d3ff]2Date: 12-20-2008
[63a055f]3Initial Package Version: 5.2
4Origin: Upstream
5Upstream Status: Applied
[a50d3ff]6Description: Contains all upstream patches up to 5.2-013
[63a055f]7
8diff -Naur readline-5.2.orig/complete.c readline-5.2/complete.c
[a50d3ff]9--- readline-5.2.orig/complete.c 2006-07-28 08:35:49.000000000 -0700
10+++ readline-5.2/complete.c 2008-12-20 14:28:42.000000000 -0800
[63a055f]11@@ -428,7 +428,7 @@
12 return (1);
13 if (c == 'n' || c == 'N' || c == RUBOUT)
14 return (0);
15- if (c == ABORT_CHAR)
16+ if (c == ABORT_CHAR || c < 0)
17 _rl_abort_internal ();
18 if (for_pager && (c == NEWLINE || c == RETURN))
19 return (2);
20diff -Naur readline-5.2.orig/display.c readline-5.2/display.c
[a50d3ff]21--- readline-5.2.orig/display.c 2006-09-14 11:20:12.000000000 -0700
22+++ readline-5.2/display.c 2008-12-20 14:28:55.000000000 -0800
[63a055f]23@@ -391,14 +391,14 @@
24 t = ++p;
25 local_prompt = expand_prompt (p, &prompt_visible_length,
26 &prompt_last_invisible,
27- (int *)NULL,
28+ &prompt_invis_chars_first_line,
29 &prompt_physical_chars);
30 c = *t; *t = '\0';
31 /* The portion of the prompt string up to and including the
32 final newline is now null-terminated. */
33 local_prompt_prefix = expand_prompt (prompt, &prompt_prefix_length,
34 (int *)NULL,
35- &prompt_invis_chars_first_line,
36+ (int *)NULL,
37 (int *)NULL);
38 *t = c;
39 local_prompt_len = local_prompt ? strlen (local_prompt) : 0;
40@@ -561,6 +561,17 @@
41 wrap_offset = prompt_invis_chars_first_line = 0;
42 }
43
44+#if defined (HANDLE_MULTIBYTE)
45+#define CHECK_INV_LBREAKS() \
46+ do { \
47+ if (newlines >= (inv_lbsize - 2)) \
48+ { \
49+ inv_lbsize *= 2; \
50+ inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \
51+ _rl_wrapped_line = (int *)xrealloc (_rl_wrapped_line, inv_lbsize * sizeof (int)); \
52+ } \
53+ } while (0)
54+#else
55 #define CHECK_INV_LBREAKS() \
56 do { \
57 if (newlines >= (inv_lbsize - 2)) \
58@@ -569,6 +580,7 @@
59 inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \
60 } \
61 } while (0)
62+#endif /* HANDLE_MULTIBYTE */
63
64 #if defined (HANDLE_MULTIBYTE)
65 #define CHECK_LPOS() \
[a50d3ff]66@@ -898,6 +910,10 @@
67 second and subsequent lines start at inv_lbreaks[N], offset by
68 OFFSET (which has already been calculated above). */
69
70+#define INVIS_FIRST() (prompt_physical_chars > _rl_screenwidth ? prompt_invis_chars_first_line : wrap_offset)
71+#define WRAP_OFFSET(line, offset) ((line == 0) \
72+ ? (offset ? INVIS_FIRST() : 0) \
73+ : ((line == prompt_last_screen_line) ? wrap_offset-prompt_invis_chars_first_line : 0))
74 #define W_OFFSET(line, offset) ((line) == 0 ? offset : 0)
75 #define VIS_LLEN(l) ((l) > _rl_vis_botlin ? 0 : (vis_lbreaks[l+1] - vis_lbreaks[l]))
76 #define INV_LLEN(l) (inv_lbreaks[l+1] - inv_lbreaks[l])
77@@ -932,7 +948,13 @@
78 _rl_last_c_pos != o_cpos &&
79 _rl_last_c_pos > wrap_offset &&
80 o_cpos < prompt_last_invisible)
81- _rl_last_c_pos -= wrap_offset;
82+ _rl_last_c_pos -= prompt_invis_chars_first_line; /* XXX - was wrap_offset */
83+ else if (linenum == prompt_last_screen_line && prompt_physical_chars > _rl_screenwidth &&
84+ (MB_CUR_MAX > 1 && rl_byte_oriented == 0) &&
85+ cpos_adjusted == 0 &&
86+ _rl_last_c_pos != o_cpos &&
87+ _rl_last_c_pos > (prompt_last_invisible - _rl_screenwidth - prompt_invis_chars_first_line))
88+ _rl_last_c_pos -= (wrap_offset-prompt_invis_chars_first_line);
89
90 /* If this is the line with the prompt, we might need to
91 compensate for invisible characters in the new line. Do
92@@ -1036,7 +1058,7 @@
[63a055f]93 tx = _rl_col_width (&visible_line[pos], 0, nleft) - visible_wrap_offset;
94 else
95 tx = nleft;
96- if (_rl_last_c_pos > tx)
97+ if (tx >= 0 && _rl_last_c_pos > tx)
98 {
99 _rl_backspace (_rl_last_c_pos - tx); /* XXX */
100 _rl_last_c_pos = tx;
[a50d3ff]101@@ -1192,7 +1214,7 @@
[63a055f]102 int current_line, omax, nmax, inv_botlin;
103 {
104 register char *ofd, *ols, *oe, *nfd, *nls, *ne;
105- int temp, lendiff, wsatend, od, nd;
[a50d3ff]106+ int temp, lendiff, wsatend, od, nd, twidth, o_cpos;
[63a055f]107 int current_invis_chars;
108 int col_lendiff, col_temp;
109 #if defined (HANDLE_MULTIBYTE)
[a50d3ff]110@@ -1208,7 +1230,7 @@
111 if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
112 temp = _rl_last_c_pos;
113 else
114- temp = _rl_last_c_pos - W_OFFSET(_rl_last_v_pos, visible_wrap_offset);
115+ temp = _rl_last_c_pos - WRAP_OFFSET (_rl_last_v_pos, visible_wrap_offset);
116 if (temp == _rl_screenwidth && _rl_term_autowrap && !_rl_horizontal_scroll_mode
117 && _rl_last_v_pos == current_line - 1)
118 {
119@@ -1453,6 +1475,8 @@
[63a055f]120 _rl_last_c_pos = lendiff;
121 }
122
123+ o_cpos = _rl_last_c_pos;
124+
125 /* When this function returns, _rl_last_c_pos is correct, and an absolute
126 cursor postion in multibyte mode, but a buffer index when not in a
127 multibyte locale. */
[a50d3ff]128@@ -1462,7 +1486,9 @@
[63a055f]129 /* We need to indicate that the cursor position is correct in the presence of
130 invisible characters in the prompt string. Let's see if setting this when
131 we make sure we're at the end of the drawn prompt string works. */
132- if (current_line == 0 && MB_CUR_MAX > 1 && rl_byte_oriented == 0 && _rl_last_c_pos == prompt_physical_chars)
133+ if (current_line == 0 && MB_CUR_MAX > 1 && rl_byte_oriented == 0 &&
134+ (_rl_last_c_pos > 0 || o_cpos > 0) &&
135+ _rl_last_c_pos == prompt_physical_chars)
136 cpos_adjusted = 1;
137 #endif
138 #endif
[a50d3ff]139@@ -1506,11 +1532,31 @@
[63a055f]140 {
141 /* Non-zero if we're increasing the number of lines. */
142 int gl = current_line >= _rl_vis_botlin && inv_botlin > _rl_vis_botlin;
143+ /* If col_lendiff is > 0, implying that the new string takes up more
144+ screen real estate than the old, but lendiff is < 0, meaning that it
145+ takes fewer bytes, we need to just output the characters starting
146+ from the first difference. These will overwrite what is on the
147+ display, so there's no reason to do a smart update. This can really
148+ only happen in a multibyte environment. */
149+ if (lendiff < 0)
150+ {
151+ _rl_output_some_chars (nfd, temp);
152+ _rl_last_c_pos += _rl_col_width (nfd, 0, temp);
153+ /* If nfd begins before any invisible characters in the prompt,
154+ adjust _rl_last_c_pos to account for wrap_offset and set
155+ cpos_adjusted to let the caller know. */
156+ if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible))
157+ {
158+ _rl_last_c_pos -= wrap_offset;
159+ cpos_adjusted = 1;
160+ }
161+ return;
162+ }
163 /* Sometimes it is cheaper to print the characters rather than
164 use the terminal's capabilities. If we're growing the number
165 of lines, make sure we actually cause the new line to wrap
166 around on auto-wrapping terminals. */
167- if (_rl_terminal_can_insert && ((2 * col_temp) >= col_lendiff || _rl_term_IC) && (!_rl_term_autowrap || !gl))
168+ else if (_rl_terminal_can_insert && ((2 * col_temp) >= col_lendiff || _rl_term_IC) && (!_rl_term_autowrap || !gl))
169 {
170 /* If lendiff > prompt_visible_length and _rl_last_c_pos == 0 and
171 _rl_horizontal_scroll_mode == 1, inserting the characters with
[a50d3ff]172@@ -1533,11 +1579,16 @@
[63a055f]173 }
174 else
175 {
176- /* We have horizontal scrolling and we are not inserting at
177- the end. We have invisible characters in this line. This
178- is a dumb update. */
179 _rl_output_some_chars (nfd, temp);
180 _rl_last_c_pos += col_temp;
181+ /* If nfd begins before any invisible characters in the prompt,
182+ adjust _rl_last_c_pos to account for wrap_offset and set
183+ cpos_adjusted to let the caller know. */
184+ if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible))
185+ {
186+ _rl_last_c_pos -= wrap_offset;
187+ cpos_adjusted = 1;
188+ }
189 return;
190 }
191 /* Copy (new) chars to screen from first diff to last match. */
[a50d3ff]192@@ -1545,15 +1596,15 @@
193 if ((temp - lendiff) > 0)
194 {
195 _rl_output_some_chars (nfd + lendiff, temp - lendiff);
196-#if 1
197 /* XXX -- this bears closer inspection. Fixes a redisplay bug
198 reported against bash-3.0-alpha by Andreas Schwab involving
199 multibyte characters and prompt strings with invisible
200 characters, but was previously disabled. */
201- _rl_last_c_pos += _rl_col_width (nfd+lendiff, 0, temp-col_lendiff);
202-#else
203- _rl_last_c_pos += _rl_col_width (nfd+lendiff, 0, temp-lendiff);
204-#endif
205+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
206+ twidth = _rl_col_width (nfd+lendiff, 0, temp-col_lendiff);
207+ else
208+ twidth = temp - lendiff;
209+ _rl_last_c_pos += twidth;
210 }
211 }
212 else
213@@ -1586,8 +1637,22 @@
[63a055f]214 temp = nls - nfd;
215 if (temp > 0)
216 {
217+ /* If nfd begins at the prompt, or before the invisible
218+ characters in the prompt, we need to adjust _rl_last_c_pos
219+ in a multibyte locale to account for the wrap offset and
220+ set cpos_adjusted accordingly. */
221 _rl_output_some_chars (nfd, temp);
222- _rl_last_c_pos += _rl_col_width (nfd, 0, temp);;
223+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
224+ {
225+ _rl_last_c_pos += _rl_col_width (nfd, 0, temp);
226+ if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible))
227+ {
228+ _rl_last_c_pos -= wrap_offset;
229+ cpos_adjusted = 1;
230+ }
231+ }
232+ else
233+ _rl_last_c_pos += temp;
234 }
235 }
236 /* Otherwise, print over the existing material. */
[a50d3ff]237@@ -1595,8 +1660,20 @@
[63a055f]238 {
239 if (temp > 0)
240 {
241+ /* If nfd begins at the prompt, or before the invisible
242+ characters in the prompt, we need to adjust _rl_last_c_pos
243+ in a multibyte locale to account for the wrap offset and
244+ set cpos_adjusted accordingly. */
245 _rl_output_some_chars (nfd, temp);
246 _rl_last_c_pos += col_temp; /* XXX */
247+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
248+ {
249+ if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible))
250+ {
251+ _rl_last_c_pos -= wrap_offset;
252+ cpos_adjusted = 1;
253+ }
254+ }
255 }
256 lendiff = (oe - old) - (ne - new);
257 if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
[a50d3ff]258@@ -1721,7 +1798,7 @@
259 int woff; /* number of invisible chars on current line */
260 int cpos, dpos; /* current and desired cursor positions */
261
262- woff = W_OFFSET (_rl_last_v_pos, wrap_offset);
263+ woff = WRAP_OFFSET (_rl_last_v_pos, wrap_offset);
264 cpos = _rl_last_c_pos;
265 #if defined (HANDLE_MULTIBYTE)
266 /* If we have multibyte characters, NEW is indexed by the buffer point in
267@@ -1732,7 +1809,14 @@
[63a055f]268 if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
269 {
270 dpos = _rl_col_width (data, 0, new);
271- if (dpos > prompt_last_invisible) /* XXX - don't use woff here */
272+ /* Use NEW when comparing against the last invisible character in the
273+ prompt string, since they're both buffer indices and DPOS is a
274+ desired display position. */
[a50d3ff]275+ if ((new > prompt_last_invisible) || /* XXX - don't use woff here */
276+ (prompt_physical_chars > _rl_screenwidth &&
277+ _rl_last_v_pos == prompt_last_screen_line &&
278+ wrap_offset != woff &&
279+ new > (prompt_last_invisible-_rl_screenwidth-wrap_offset)))
[63a055f]280 {
281 dpos -= woff;
282 /* Since this will be assigned to _rl_last_c_pos at the end (more
[a50d3ff]283@@ -2380,6 +2464,8 @@
[63a055f]284
285 if (end <= start)
286 return 0;
287+ if (MB_CUR_MAX == 1 || rl_byte_oriented)
288+ return (end - start);
289
290 memset (&ps, 0, sizeof (mbstate_t));
291
292diff -Naur readline-5.2.orig/input.c readline-5.2/input.c
[a50d3ff]293--- readline-5.2.orig/input.c 2006-08-16 12:15:16.000000000 -0700
294+++ readline-5.2/input.c 2008-12-20 14:28:52.000000000 -0800
[63a055f]295@@ -133,8 +133,11 @@
296 return (0);
297
298 *key = ibuffer[pop_index++];
299-
300+#if 0
301 if (pop_index >= ibuffer_len)
302+#else
303+ if (pop_index > ibuffer_len)
304+#endif
305 pop_index = 0;
306
307 return (1);
308@@ -151,7 +154,7 @@
309 {
310 pop_index--;
311 if (pop_index < 0)
312- pop_index = ibuffer_len - 1;
313+ pop_index = ibuffer_len;
314 ibuffer[pop_index] = key;
315 return (1);
316 }
317@@ -250,7 +253,8 @@
318 while (chars_avail--)
319 {
320 k = (*rl_getc_function) (rl_instream);
321- rl_stuff_char (k);
322+ if (rl_stuff_char (k) == 0)
323+ break; /* some problem; no more room */
324 if (k == NEWLINE || k == RETURN)
325 break;
326 }
327@@ -373,7 +377,11 @@
328 RL_SETSTATE (RL_STATE_INPUTPENDING);
329 }
330 ibuffer[push_index++] = key;
331+#if 0
332 if (push_index >= ibuffer_len)
333+#else
334+ if (push_index > ibuffer_len)
335+#endif
336 push_index = 0;
337
338 return 1;
339@@ -513,20 +521,26 @@
340 char *mbchar;
341 int size;
342 {
343- int mb_len = 0;
344+ int mb_len, c;
345 size_t mbchar_bytes_length;
346 wchar_t wc;
347 mbstate_t ps, ps_back;
348
349 memset(&ps, 0, sizeof (mbstate_t));
350 memset(&ps_back, 0, sizeof (mbstate_t));
351-
352+
353+ mb_len = 0;
354 while (mb_len < size)
355 {
356 RL_SETSTATE(RL_STATE_MOREINPUT);
357- mbchar[mb_len++] = rl_read_key ();
358+ c = rl_read_key ();
359 RL_UNSETSTATE(RL_STATE_MOREINPUT);
360
361+ if (c < 0)
362+ break;
363+
364+ mbchar[mb_len++] = c;
365+
366 mbchar_bytes_length = mbrtowc (&wc, mbchar, mb_len, &ps);
367 if (mbchar_bytes_length == (size_t)(-1))
368 break; /* invalid byte sequence for the current locale */
369@@ -564,7 +578,7 @@
370
371 c = first;
372 memset (mb, 0, mlen);
373- for (i = 0; i < mlen; i++)
374+ for (i = 0; c >= 0 && i < mlen; i++)
375 {
376 mb[i] = (char)c;
377 memset (&ps, 0, sizeof (mbstate_t));
378diff -Naur readline-5.2.orig/isearch.c readline-5.2/isearch.c
[a50d3ff]379--- readline-5.2.orig/isearch.c 2005-12-26 14:18:53.000000000 -0800
380+++ readline-5.2/isearch.c 2008-12-20 14:28:42.000000000 -0800
[63a055f]381@@ -327,8 +327,15 @@
382 rl_command_func_t *f;
383
384 f = (rl_command_func_t *)NULL;
385-
386- /* Translate the keys we do something with to opcodes. */
387+
388+ if (c < 0)
389+ {
390+ cxt->sflags |= SF_FAILED;
391+ cxt->history_pos = cxt->last_found_line;
392+ return -1;
393+ }
394+
395+ /* Translate the keys we do something with to opcodes. */
396 if (c >= 0 && _rl_keymap[c].type == ISFUNC)
397 {
398 f = _rl_keymap[c].function;
399diff -Naur readline-5.2.orig/misc.c readline-5.2/misc.c
[a50d3ff]400--- readline-5.2.orig/misc.c 2005-12-26 14:20:46.000000000 -0800
401+++ readline-5.2/misc.c 2008-12-20 14:28:42.000000000 -0800
[63a055f]402@@ -146,6 +146,8 @@
403 rl_restore_prompt ();
404 rl_clear_message ();
405 RL_UNSETSTATE(RL_STATE_NUMERICARG);
406+ if (key < 0)
407+ return -1;
408 return (_rl_dispatch (key, _rl_keymap));
409 }
410 }
411diff -Naur readline-5.2.orig/readline.c readline-5.2/readline.c
[a50d3ff]412--- readline-5.2.orig/readline.c 2006-08-16 12:00:36.000000000 -0700
413+++ readline-5.2/readline.c 2008-12-20 14:28:42.000000000 -0800
[63a055f]414@@ -645,6 +645,11 @@
415 if ((cxt->flags & KSEQ_DISPATCHED) == 0)
416 {
417 nkey = _rl_subseq_getchar (cxt->okey);
418+ if (nkey < 0)
419+ {
420+ _rl_abort_internal ();
421+ return -1;
422+ }
423 r = _rl_dispatch_subseq (nkey, cxt->dmap, cxt->subseq_arg);
424 cxt->flags |= KSEQ_DISPATCHED;
425 }
426diff -Naur readline-5.2.orig/support/shobj-conf readline-5.2/support/shobj-conf
[a50d3ff]427--- readline-5.2.orig/support/shobj-conf 2006-04-11 06:15:43.000000000 -0700
428+++ readline-5.2/support/shobj-conf 2008-12-20 14:28:53.000000000 -0800
[63a055f]429@@ -10,7 +10,7 @@
430 # Chet Ramey
431 # chet@po.cwru.edu
432
433-# Copyright (C) 1996-2002 Free Software Foundation, Inc.
434+# Copyright (C) 1996-2007 Free Software Foundation, Inc.
435 #
436 # This program is free software; you can redistribute it and/or modify
437 # it under the terms of the GNU General Public License as published by
438@@ -114,7 +114,7 @@
439 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
440 ;;
441
442-freebsd2* | netbsd*)
443+freebsd2*)
444 SHOBJ_CFLAGS=-fpic
445 SHOBJ_LD=ld
446 SHOBJ_LDFLAGS='-x -Bshareable'
447@@ -125,7 +125,7 @@
448
449 # FreeBSD-3.x ELF
450 freebsd[3-9]*|freebsdelf[3-9]*|freebsdaout[3-9]*|dragonfly*)
451- SHOBJ_CFLAGS=-fpic
452+ SHOBJ_CFLAGS=-fPIC
453 SHOBJ_LD='${CC}'
454
455 if [ -x /usr/bin/objformat ] && [ "`/usr/bin/objformat`" = "elf" ]; then
456@@ -142,7 +142,7 @@
457 ;;
458
459 # Darwin/MacOS X
460-darwin8*)
461+darwin[89]*)
462 SHOBJ_STATUS=supported
463 SHLIB_STATUS=supported
464
465@@ -153,7 +153,7 @@
466 SHLIB_LIBVERSION='$(SHLIB_MAJOR)$(SHLIB_MINOR).$(SHLIB_LIBSUFF)'
467 SHLIB_LIBSUFF='dylib'
468
469- SHOBJ_LDFLAGS='-undefined dynamic_lookup'
470+ SHOBJ_LDFLAGS='-dynamiclib -dynamic -undefined dynamic_lookup -arch_only `/usr/bin/arch`'
471 SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
472
473 SHLIB_LIBS='-lncurses' # see if -lcurses works on MacOS X 10.1
474@@ -171,7 +171,7 @@
475 SHLIB_LIBSUFF='dylib'
476
477 case "${host_os}" in
478- darwin[78]*) SHOBJ_LDFLAGS=''
479+ darwin[789]*) SHOBJ_LDFLAGS=''
480 SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
481 ;;
482 *) SHOBJ_LDFLAGS='-dynamic'
483@@ -182,7 +182,7 @@
484 SHLIB_LIBS='-lncurses' # see if -lcurses works on MacOS X 10.1
485 ;;
486
487-openbsd*)
488+openbsd*|netbsd*)
489 SHOBJ_CFLAGS=-fPIC
490 SHOBJ_LD='${CC}'
491 SHOBJ_LDFLAGS='-shared'
492@@ -247,7 +247,7 @@
493 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
494 ;;
495
496-aix4.[2-9]*-*gcc*) # lightly tested by jik@cisco.com
497+aix4.[2-9]*-*gcc*|aix[5-9].*-*gcc*) # lightly tested by jik@cisco.com
498 SHOBJ_CFLAGS=-fpic
499 SHOBJ_LD='ld'
500 SHOBJ_LDFLAGS='-bdynamic -bnoentry -bexpall'
501@@ -258,7 +258,7 @@
502 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
503 ;;
504
505-aix4.[2-9]*)
506+aix4.[2-9]*|aix[5-9].*)
507 SHOBJ_CFLAGS=-K
508 SHOBJ_LD='ld'
509 SHOBJ_LDFLAGS='-bdynamic -bnoentry -bexpall'
510@@ -329,7 +329,7 @@
511 SHOBJ_LD='${CC}'
512 # if you have problems linking here, moving the `-Wl,+h,$@' from
513 # SHLIB_XLDFLAGS to SHOBJ_LDFLAGS has been reported to work
514- SHOBJ_LDFLAGS='-shared -Wl,-b -Wl,+s'
515+ SHOBJ_LDFLAGS='-shared -fpic -Wl,-b -Wl,+s'
516
517 SHLIB_XLDFLAGS='-Wl,+h,$@ -Wl,+b,$(libdir)'
518 SHLIB_LIBSUFF='sl'
519diff -Naur readline-5.2.orig/text.c readline-5.2/text.c
[a50d3ff]520--- readline-5.2.orig/text.c 2006-07-28 08:55:27.000000000 -0700
521+++ readline-5.2/text.c 2008-12-20 14:28:42.000000000 -0800
[63a055f]522@@ -857,6 +857,9 @@
523 c = rl_read_key ();
524 RL_UNSETSTATE(RL_STATE_MOREINPUT);
525
526+ if (c < 0)
527+ return -1;
528+
529 #if defined (HANDLE_SIGNALS)
530 if (RL_ISSTATE (RL_STATE_CALLBACK) == 0)
531 _rl_restore_tty_signals ();
532@@ -1520,6 +1523,9 @@
533
534 mb_len = _rl_read_mbchar (mbchar, MB_LEN_MAX);
535
536+ if (mb_len <= 0)
537+ return -1;
538+
539 if (count < 0)
540 return (_rl_char_search_internal (-count, bdir, mbchar, mb_len));
541 else
542@@ -1536,6 +1542,9 @@
543 c = rl_read_key ();
544 RL_UNSETSTATE(RL_STATE_MOREINPUT);
545
546+ if (c < 0)
547+ return -1;
548+
549 if (count < 0)
550 return (_rl_char_search_internal (-count, bdir, c));
551 else
552diff -Naur readline-5.2.orig/vi_mode.c readline-5.2/vi_mode.c
[a50d3ff]553--- readline-5.2.orig/vi_mode.c 2006-07-29 13:42:28.000000000 -0700
554+++ readline-5.2/vi_mode.c 2008-12-20 14:28:42.000000000 -0800
[63a055f]555@@ -886,6 +886,13 @@
556 RL_SETSTATE(RL_STATE_MOREINPUT);
557 c = rl_read_key ();
558 RL_UNSETSTATE(RL_STATE_MOREINPUT);
559+
560+ if (c < 0)
561+ {
562+ *nextkey = 0;
563+ return -1;
564+ }
565+
566 *nextkey = c;
567
568 if (!member (c, vi_motion))
569@@ -902,6 +909,11 @@
570 RL_SETSTATE(RL_STATE_MOREINPUT);
571 c = rl_read_key (); /* real command */
572 RL_UNSETSTATE(RL_STATE_MOREINPUT);
573+ if (c < 0)
574+ {
575+ *nextkey = 0;
576+ return -1;
577+ }
578 *nextkey = c;
579 }
580 else if (key == c && (key == 'd' || key == 'y' || key == 'c'))
581@@ -1224,14 +1236,22 @@
582 _rl_vi_callback_char_search (data)
583 _rl_callback_generic_arg *data;
584 {
585+ int c;
586 #if defined (HANDLE_MULTIBYTE)
587- _rl_vi_last_search_mblen = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX);
588+ c = _rl_vi_last_search_mblen = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX);
589 #else
590 RL_SETSTATE(RL_STATE_MOREINPUT);
591- _rl_vi_last_search_char = rl_read_key ();
592+ c = rl_read_key ();
593 RL_UNSETSTATE(RL_STATE_MOREINPUT);
594 #endif
595
596+ if (c <= 0)
597+ return -1;
598+
599+#if !defined (HANDLE_MULTIBYTE)
600+ _rl_vi_last_search_char = c;
601+#endif
602+
603 _rl_callback_func = 0;
604 _rl_want_redisplay = 1;
605
606@@ -1247,6 +1267,7 @@
607 rl_vi_char_search (count, key)
608 int count, key;
609 {
610+ int c;
611 #if defined (HANDLE_MULTIBYTE)
612 static char *target;
613 static int tlen;
614@@ -1293,11 +1314,17 @@
615 else
616 {
617 #if defined (HANDLE_MULTIBYTE)
618- _rl_vi_last_search_mblen = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX);
619+ c = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX);
620+ if (c <= 0)
621+ return -1;
622+ _rl_vi_last_search_mblen = c;
623 #else
624 RL_SETSTATE(RL_STATE_MOREINPUT);
625- _rl_vi_last_search_char = rl_read_key ();
626+ c = rl_read_key ();
627 RL_UNSETSTATE(RL_STATE_MOREINPUT);
628+ if (c < 0)
629+ return -1;
630+ _rl_vi_last_search_char = c;
631 #endif
632 }
633 }
634@@ -1467,6 +1494,9 @@
635 c = rl_read_key ();
636 RL_UNSETSTATE(RL_STATE_MOREINPUT);
637
638+ if (c < 0)
639+ return -1;
640+
641 #if defined (HANDLE_MULTIBYTE)
642 if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
643 c = _rl_read_mbstring (c, mb, mlen);
644@@ -1485,6 +1515,9 @@
645
646 _rl_vi_last_replacement = c = _rl_vi_callback_getchar (mb, MB_LEN_MAX);
647
648+ if (c < 0)
649+ return -1;
650+
651 _rl_callback_func = 0;
652 _rl_want_redisplay = 1;
653
654@@ -1516,6 +1549,9 @@
655 else
656 _rl_vi_last_replacement = c = _rl_vi_callback_getchar (mb, MB_LEN_MAX);
657
658+ if (c < 0)
659+ return -1;
660+
661 return (_rl_vi_change_char (count, c, mb));
662 }
663
664@@ -1650,7 +1686,7 @@
665 ch = rl_read_key ();
666 RL_UNSETSTATE(RL_STATE_MOREINPUT);
667
668- if (ch < 'a' || ch > 'z')
669+ if (ch < 0 || ch < 'a' || ch > 'z') /* make test against 0 explicit */
670 {
671 rl_ding ();
672 return -1;
673@@ -1702,7 +1738,7 @@
674 rl_point = rl_mark;
675 return 0;
676 }
677- else if (ch < 'a' || ch > 'z')
678+ else if (ch < 0 || ch < 'a' || ch > 'z') /* make test against 0 explicit */
679 {
680 rl_ding ();
681 return -1;
Note: See TracBrowser for help on using the repository browser.