source: clfs-sysroot/patches/readline-5.2-fixes-4.patch@ e950f58

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

Patches should not be executable.

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