From: Chet Ramey Date: Wed, 23 Nov 2022 22:01:37 +0000 (-0500) Subject: rollup of changes since readline-8.2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8d0c439faf0df125b6cd51f14309bc58407411d7;p=thirdparty%2Freadline.git rollup of changes since readline-8.2 --- diff --git a/callback.c b/callback.c index 69df77d..d78a7ca 100644 --- a/callback.c +++ b/callback.c @@ -115,7 +115,10 @@ rl_callback_handler_install (const char *prompt, rl_vcpfunc_t *linefunc) #define CALLBACK_READ_RETURN() \ do { \ if (rl_persistent_signal_handlers == 0) \ - rl_clear_signals (); \ + { \ + rl_clear_signals (); \ + if (_rl_caught_signal) _rl_signal_handler (_rl_caught_signal); \ + } \ return; \ } while (0) #else diff --git a/complete.c b/complete.c index e5d224e..61461c9 100644 --- a/complete.c +++ b/complete.c @@ -1,6 +1,6 @@ /* complete.c -- filename completion for readline. */ -/* Copyright (C) 1987-2021 Free Software Foundation, Inc. +/* Copyright (C) 1987-2022 Free Software Foundation, Inc. This file is part of the GNU Readline Library (Readline), a library for reading lines of text with interactive input and history editing. @@ -1784,6 +1784,11 @@ make_quoted_replacement (char *match, int mtype, char *qc) should_quote = rl_filename_quote_characters ? (_rl_strpbrk (match, rl_filename_quote_characters) != 0) : 0; + /* If we saw a quote in the original word, but readline thinks the + match doesn't need to be quoted, and the application has a filename + quoting function, give the application a chance to quote it if + needed so we don't second-guess the user. */ + should_quote |= *qc == 0 && rl_completion_found_quote && mtype != NO_MATCH && rl_filename_quoting_function; do_replace = should_quote ? mtype : NO_MATCH; /* Quote the replacement, since we found an embedded @@ -1791,6 +1796,7 @@ make_quoted_replacement (char *match, int mtype, char *qc) if (do_replace != NO_MATCH && rl_filename_quoting_function) replacement = (*rl_filename_quoting_function) (match, do_replace, qc); } + return (replacement); } @@ -2265,9 +2271,9 @@ rl_completion_matches (const char *text, rl_compentry_func_t *entry_function) char * rl_username_completion_function (const char *text, int state) { -#if defined (__WIN32__) || defined (__OPENNT) +#if defined (_WIN32) || defined (__OPENNT) return (char *)NULL; -#else /* !__WIN32__ && !__OPENNT) */ +#else /* !_WIN32 && !__OPENNT) */ static char *username = (char *)NULL; static struct passwd *entry; static int namelen, first_char, first_char_loc; @@ -2316,7 +2322,7 @@ rl_username_completion_function (const char *text, int state) return (value); } -#endif /* !__WIN32__ && !__OPENNT */ +#endif /* !_WIN32 && !__OPENNT */ } /* Return non-zero if CONVFN matches FILENAME up to the length of FILENAME @@ -2526,7 +2532,8 @@ rl_filename_completion_function (const char *text, int state) temp = tilde_expand (dirname); xfree (dirname); dirname = temp; - tilde_dirname = 1; + if (*dirname != '~') + tilde_dirname = 1; /* indicate successful tilde expansion */ } /* We have saved the possibly-dequoted version of the directory name @@ -2545,11 +2552,16 @@ rl_filename_completion_function (const char *text, int state) xfree (users_dirname); users_dirname = savestring (dirname); } - else if (tilde_dirname == 0 && rl_completion_found_quote && rl_filename_dequoting_function) + else if (rl_completion_found_quote && rl_filename_dequoting_function) { - /* delete single and double quotes */ + /* We already ran users_dirname through the dequoting function. + If tilde_dirname == 1, we successfully performed tilde expansion + on dirname. Now we need to reconcile those results. We either + just copy the already-dequoted users_dirname or tilde expand it + if we tilde-expanded dirname. */ + temp = tilde_dirname ? tilde_expand (users_dirname) : savestring (users_dirname); xfree (dirname); - dirname = savestring (users_dirname); + dirname = temp; } directory = opendir (dirname); diff --git a/display.c b/display.c index df9d749..0e42930 100644 --- a/display.c +++ b/display.c @@ -282,6 +282,10 @@ static int prompt_physical_chars; characters in the prompt or use heuristics about where they are. */ static int *local_prompt_newlines; +/* An array saying how many invisible characters are in each line of the + prompt. */ +static int *local_prompt_invis_chars; + /* set to a non-zero value by rl_redisplay if we are marking modified history lines and the current line is so marked. */ static int modmark; @@ -295,6 +299,7 @@ static int line_totbytes; static char *saved_local_prompt; static char *saved_local_prefix; static int *saved_local_prompt_newlines; +static int *saved_local_prompt_invis_chars; static int saved_last_invisible; static int saved_visible_length; @@ -356,7 +361,7 @@ expand_prompt (char *pmt, int flags, int *lp, int *lip, int *niflp, int *vlp) { char *r, *ret, *p, *igstart, *nprompt, *ms; int l, rl, last, ignoring, ninvis, invfl, invflset, ind, pind, physchars; - int mlen, newlines, newlines_guess, bound, can_add_invis; + int mlen, newlines, newlines_guess, bound, can_add_invis, lastinvis; int mb_cur_max; /* We only expand the mode string for the last line of a multiline prompt @@ -399,7 +404,8 @@ expand_prompt (char *pmt, int flags, int *lp, int *lip, int *niflp, int *vlp) *vlp = l; local_prompt_newlines = (int *) xrealloc (local_prompt_newlines, sizeof (int) * 2); - local_prompt_newlines[0] = 0; + local_prompt_invis_chars = (int *) xrealloc (local_prompt_invis_chars, sizeof (int) * 2); + local_prompt_newlines[0] = local_prompt_invis_chars[0] = 0; local_prompt_newlines[1] = -1; return r; @@ -414,15 +420,20 @@ expand_prompt (char *pmt, int flags, int *lp, int *lip, int *niflp, int *vlp) newlines_guess = (_rl_screenwidth > 0) ? APPROX_DIV(l, _rl_screenwidth) : APPROX_DIV(l, 80); local_prompt_newlines = (int *) xrealloc (local_prompt_newlines, sizeof (int) * (newlines_guess + 1)); local_prompt_newlines[newlines = 0] = 0; + local_prompt_invis_chars = (int *) xrealloc (local_prompt_invis_chars, sizeof (int) * (newlines_guess + 1)); + local_prompt_invis_chars[0] = 0; for (rl = 1; rl <= newlines_guess; rl++) - local_prompt_newlines[rl] = -1; + { + local_prompt_newlines[rl] = -1; + local_prompt_invis_chars[rl] = 0; + } rl = physchars = 0; /* mode string now part of nprompt */ invfl = 0; /* invisible chars in first line of prompt */ invflset = 0; /* we only want to set invfl once */ igstart = 0; /* we're not ignoring any characters yet */ - for (ignoring = last = ninvis = 0, p = nprompt; p && *p; p++) + for (ignoring = last = ninvis = lastinvis = 0, p = nprompt; p && *p; p++) { /* This code strips the invisible character string markers RL_PROMPT_START_IGNORE and RL_PROMPT_END_IGNORE */ @@ -447,6 +458,8 @@ expand_prompt (char *pmt, int flags, int *lp, int *lip, int *niflp, int *vlp) counter. */ if (invflset && newlines == 1) invfl = ninvis; + local_prompt_invis_chars[newlines - 1] = ninvis - lastinvis; + lastinvis = ninvis; } if (p != (igstart + 1)) last = r - ret - 1; @@ -511,6 +524,8 @@ expand_prompt (char *pmt, int flags, int *lp, int *lip, int *niflp, int *vlp) else new = r - ret; local_prompt_newlines[++newlines] = new; + local_prompt_invis_chars[newlines - 1] = ninvis - lastinvis; + lastinvis = ninvis; } /* What if a physical character of width >= 2 is split? There is @@ -525,6 +540,9 @@ expand_prompt (char *pmt, int flags, int *lp, int *lip, int *niflp, int *vlp) if (rl <= _rl_screenwidth) invfl = ninvis; + /* Make sure we account for invisible characters on the last line. */ + local_prompt_invis_chars[newlines] = ninvis - lastinvis; + *r = '\0'; if (lp) *lp = rl; @@ -591,11 +609,16 @@ rl_expand_prompt (char *prompt) FREE (local_prompt); FREE (local_prompt_prefix); + /* Set default values for variables expand_prompt sets */ local_prompt = local_prompt_prefix = (char *)0; local_prompt_len = 0; prompt_last_invisible = prompt_invis_chars_first_line = 0; prompt_visible_length = prompt_physical_chars = 0; + if (local_prompt_invis_chars == 0) + local_prompt_invis_chars = (int *)xmalloc (sizeof (int)); + local_prompt_invis_chars[0] = 0; + if (prompt == 0 || *prompt == 0) return (0); @@ -758,6 +781,28 @@ _rl_optimize_redisplay (void) _rl_quick_redisplay = 1; } +/* Useful shorthand used by rl_redisplay, update_line, rl_move_cursor_relative */ +#define INVIS_FIRST() (local_prompt_invis_chars[0]) +#define WRAP_OFFSET(line, offset) ((line <= prompt_last_screen_line) ? local_prompt_invis_chars[line] : 0) + +#define W_OFFSET(line, offset) ((line) == 0 ? offset : 0) +#define VIS_LLEN(l) ((l) > _rl_vis_botlin ? 0 : (vis_lbreaks[l+1] - vis_lbreaks[l])) +#define INV_LLEN(l) (inv_lbreaks[l+1] - inv_lbreaks[l]) +#define VIS_CHARS(line) (visible_line + vis_lbreaks[line]) +#define VIS_FACE(line) (vis_face + vis_lbreaks[line]) +#define VIS_LINE(line) ((line) > _rl_vis_botlin) ? "" : VIS_CHARS(line) +#define VIS_LINE_FACE(line) ((line) > _rl_vis_botlin) ? "" : VIS_FACE(line) +#define INV_LINE(line) (invisible_line + inv_lbreaks[line]) +#define INV_LINE_FACE(line) (inv_face + inv_lbreaks[line]) + +#define INV_CHARS_CURRENT_PROMPT_LINE(line) \ + (local_prompt_invis_chars[line] > 0) + +#define OLD_CPOS_IN_PROMPT() (cpos_adjusted == 0 && \ + _rl_last_c_pos != o_cpos && \ + _rl_last_c_pos > wrap_offset && \ + o_cpos < prompt_last_invisible) + /* Basic redisplay algorithm. See comments inline. */ void rl_redisplay (void) @@ -964,6 +1009,9 @@ rl_redisplay (void) in the first physical line of the prompt. wrap_offset - prompt_invis_chars_first_line is usually the number of invis chars on the second (or, more generally, last) line. */ + /* XXX - There is code that assumes that all the invisible characters occur + on the first and last prompt lines; change that to use + local_prompt_invis_chars */ /* This is zero-based, used to set the newlines */ prompt_lines_estimate = lpos / _rl_screenwidth; @@ -982,6 +1030,7 @@ rl_redisplay (void) } /* Now set lpos from the last newline */ + /* XXX - change to use local_prompt_invis_chars[] */ if (mb_cur_max > 1 && rl_byte_oriented == 0 && prompt_multibyte_chars > 0) lpos = _rl_col_width (local_prompt, temp, local_prompt_len, 1) - (wrap_offset - prompt_invis_chars_first_line); else @@ -1249,26 +1298,6 @@ rl_redisplay (void) second and subsequent lines start at inv_lbreaks[N], offset by OFFSET (which has already been calculated above). */ -#define INVIS_FIRST() (prompt_physical_chars > _rl_screenwidth ? prompt_invis_chars_first_line : wrap_offset) -#define WRAP_OFFSET(line, offset) ((line == 0) \ - ? (offset ? INVIS_FIRST() : 0) \ - : ((line == prompt_last_screen_line) ? wrap_offset-prompt_invis_chars_first_line : 0)) -#define W_OFFSET(line, offset) ((line) == 0 ? offset : 0) -#define VIS_LLEN(l) ((l) > _rl_vis_botlin ? 0 : (vis_lbreaks[l+1] - vis_lbreaks[l])) -#define INV_LLEN(l) (inv_lbreaks[l+1] - inv_lbreaks[l]) -#define VIS_CHARS(line) (visible_line + vis_lbreaks[line]) -#define VIS_FACE(line) (vis_face + vis_lbreaks[line]) -#define VIS_LINE(line) ((line) > _rl_vis_botlin) ? "" : VIS_CHARS(line) -#define VIS_LINE_FACE(line) ((line) > _rl_vis_botlin) ? "" : VIS_FACE(line) -#define INV_LINE(line) (invisible_line + inv_lbreaks[line]) -#define INV_LINE_FACE(line) (inv_face + inv_lbreaks[line]) - -#define OLD_CPOS_IN_PROMPT() (cpos_adjusted == 0 && \ - _rl_last_c_pos != o_cpos && \ - _rl_last_c_pos > wrap_offset && \ - o_cpos < prompt_last_invisible) - - /* We don't want to highlight anything that's going to be off the top of the display; if the current line takes up more than an entire screen, just mark the lines that won't be displayed as having a @@ -1319,6 +1348,7 @@ rl_redisplay (void) between the first and last lines of the prompt, if the prompt consumes more than two lines. It's usually right */ /* XXX - not sure this is ever executed */ + /* XXX - use local_prompt_invis_chars[linenum] */ _rl_last_c_pos -= (wrap_offset-prompt_invis_chars_first_line); /* If this is the line with the prompt, we might need to @@ -1413,6 +1443,7 @@ rl_redisplay (void) only need to reprint it if the cursor is before the last invisible character in the prompt string. */ /* XXX - why not use local_prompt_len? */ + /* XXX - This is right only if the prompt is a single line. */ nleft = prompt_visible_length + wrap_offset; if (cursor_linenum == 0 && wrap_offset > 0 && _rl_last_c_pos > 0 && _rl_last_c_pos < PROMPT_ENDING_INDEX && local_prompt) @@ -1895,6 +1926,8 @@ update_line (char *old, char *old_face, char *new, char *new_face, int current_l /* See comments at dumb_update: for an explanation of this heuristic */ if (nmax < omax) goto clear_rest_of_line; + /* XXX - need to use WRAP_OFFSET(current_line, wrap_offset) instead of + W_OFFSET - XXX */ else if ((nmax - W_OFFSET(current_line, wrap_offset)) < (omax - W_OFFSET (current_line, visible_wrap_offset))) goto clear_rest_of_line; else @@ -2076,7 +2109,7 @@ update_line (char *old, char *old_face, char *new, char *new_face, int current_l } /* count of invisible characters in the current invisible line. */ - current_invis_chars = W_OFFSET (current_line, wrap_offset); + current_invis_chars = WRAP_OFFSET (current_line, wrap_offset); if (_rl_last_v_pos != current_line) { _rl_move_vert (current_line); @@ -2140,6 +2173,7 @@ update_line (char *old, char *old_face, char *new, char *new_face, int current_l else /* We take wrap_offset into account here so we can pass correct information to _rl_move_cursor_relative. */ + /* XXX - can use local_prompt_invis_chars[0] instead of wrap_offset */ _rl_last_c_pos = _rl_col_width (local_prompt, 0, lendiff, 1) - wrap_offset + modmark; cpos_adjusted = 1; } @@ -2183,6 +2217,7 @@ dumb_update: wrap_offset-prompt_invis_chars_first_line on the assumption that this is the number of invisible characters in the last line of the prompt. */ + /* XXX - CHANGE THIS USING local_prompt_invis_chars[current_line] */ if (wrap_offset > prompt_invis_chars_first_line && current_line == prompt_last_screen_line && prompt_physical_chars > _rl_screenwidth && @@ -2201,6 +2236,20 @@ dumb_update: wrap_offset >= prompt_invis_chars_first_line && _rl_horizontal_scroll_mode == 0) ADJUST_CPOS (prompt_invis_chars_first_line); + /* XXX - This is experimental. It's a start at supporting + prompts where a non-terminal line contains the last + invisible characters. We assume that we can use the + local_prompt_invis_chars array and that the current line + is completely filled with characters to _rl_screenwidth, + so we can either adjust by the number of bytes in the + current line or just go straight to _rl_screenwidth */ + else if (current_line > 0 && current_line < prompt_last_screen_line && + INV_CHARS_CURRENT_PROMPT_LINE(current_line) && + _rl_horizontal_scroll_mode == 0) + { + _rl_last_c_pos = _rl_screenwidth; + cpos_adjusted = 1; + } } else _rl_last_c_pos += temp; @@ -2212,6 +2261,8 @@ dumb_update: know for sure, so we use another heuristic calclulation below. */ if (nmax < omax) goto clear_rest_of_line; /* XXX */ + /* XXX - use WRAP_OFFSET(current_line, wrap_offset) here instead of + W_OFFSET since current_line == 0 */ else if ((nmax - W_OFFSET(current_line, wrap_offset)) < (omax - W_OFFSET (current_line, visible_wrap_offset))) goto clear_rest_of_line; else @@ -3099,10 +3150,12 @@ rl_save_prompt (void) saved_invis_chars_first_line = prompt_invis_chars_first_line; saved_physical_chars = prompt_physical_chars; saved_local_prompt_newlines = local_prompt_newlines; + saved_local_prompt_invis_chars = local_prompt_invis_chars; local_prompt = local_prompt_prefix = (char *)0; local_prompt_len = 0; local_prompt_newlines = (int *)0; + local_prompt_invis_chars = (int *)0; prompt_last_invisible = prompt_visible_length = prompt_prefix_length = 0; prompt_invis_chars_first_line = prompt_physical_chars = 0; @@ -3114,11 +3167,13 @@ rl_restore_prompt (void) FREE (local_prompt); FREE (local_prompt_prefix); FREE (local_prompt_newlines); + FREE (local_prompt_invis_chars); local_prompt = saved_local_prompt; local_prompt_prefix = saved_local_prefix; local_prompt_len = saved_local_length; local_prompt_newlines = saved_local_prompt_newlines; + local_prompt_invis_chars = saved_local_prompt_invis_chars; prompt_prefix_length = saved_prefix_length; prompt_last_invisible = saved_last_invisible; @@ -3131,7 +3186,7 @@ rl_restore_prompt (void) saved_local_length = 0; saved_last_invisible = saved_visible_length = saved_prefix_length = 0; saved_invis_chars_first_line = saved_physical_chars = 0; - saved_local_prompt_newlines = 0; + saved_local_prompt_newlines = saved_local_prompt_invis_chars = 0; } char * @@ -3319,7 +3374,7 @@ _rl_update_final (void) full_lines = 1; } _rl_move_vert (_rl_vis_botlin); - woff = W_OFFSET(_rl_vis_botlin, wrap_offset); + woff = W_OFFSET(_rl_vis_botlin, wrap_offset); /* XXX - WRAP_OFFSET? */ botline_length = VIS_LLEN(_rl_vis_botlin) - woff; /* If we've wrapped lines, remove the final xterm line-wrap flag. */ if (full_lines && _rl_term_autowrap && botline_length == _rl_screenwidth) @@ -3328,7 +3383,7 @@ _rl_update_final (void) /* LAST_LINE includes invisible characters, so if you want to get the last character of the first line, you have to take WOFF into account. - This needs to be done for both calls to _rl_move_cursor_relative, + This needs to be done both for calls to _rl_move_cursor_relative, which takes a buffer position as the first argument, and any direct subscripts of LAST_LINE. */ last_line = &visible_line[vis_lbreaks[_rl_vis_botlin]]; /* = VIS_CHARS(_rl_vis_botlin); */ diff --git a/input.c b/input.c index da4da45..9118fed 100644 --- a/input.c +++ b/input.c @@ -1,6 +1,6 @@ /* input.c -- character input functions for readline. */ -/* Copyright (C) 1994-2021 Free Software Foundation, Inc. +/* Copyright (C) 1994-2022 Free Software Foundation, Inc. This file is part of the GNU Readline Library (Readline), a library for reading lines of text with interactive input and history editing. @@ -250,7 +250,7 @@ rl_gather_tyi (void) register int tem, result; int chars_avail, k; char input; -#if defined(HAVE_SELECT) +#if defined (HAVE_PSELECT) || defined (HAVE_SELECT) fd_set readfds, exceptfds; struct timeval timeout; #endif @@ -807,7 +807,7 @@ rl_getc (FILE *stream) int result; unsigned char c; int fd; -#if defined (HAVE_PSELECT) +#if defined (HAVE_PSELECT) || defined (HAVE_SELECT) sigset_t empty_set; fd_set readfds; #endif diff --git a/isearch.c b/isearch.c index c2d4d23..8e7fc01 100644 --- a/isearch.c +++ b/isearch.c @@ -463,6 +463,11 @@ add_character: { rl_stuff_char (cxt->lastc); rl_execute_next (cxt->prevc); + + /* We're going to read the last two characters again. */ + _rl_del_executing_keyseq (); + _rl_del_executing_keyseq (); + /* XXX - do we insert everything in cxt->pmb? */ return (0); } @@ -477,6 +482,8 @@ add_character: /* Make lastc be the next character read */ /* XXX - do we insert everything in cxt->mb? */ rl_execute_next (cxt->lastc); + _rl_del_executing_keyseq (); + /* Dispatch on the previous character (insert into search string) */ cxt->lastc = cxt->prevc; #if defined (HANDLE_MULTIBYTE) @@ -524,7 +531,10 @@ add_character: settable keyboard timeout value, this could alternatively use _rl_input_queued(100000) */ if (cxt->lastc == ESC && (_rl_pushed_input_available () || _rl_input_available ())) - rl_execute_next (ESC); + { + rl_execute_next (ESC); + _rl_del_executing_keyseq (); + } return (0); } @@ -536,6 +546,7 @@ add_character: /* This sets rl_pending_input to LASTC; it will be picked up the next time rl_read_key is called. */ rl_execute_next (cxt->lastc); + _rl_del_executing_keyseq (); return (0); } } @@ -546,6 +557,7 @@ add_character: /* This sets rl_pending_input to LASTC; it will be picked up the next time rl_read_key is called. */ rl_execute_next (cxt->lastc); + _rl_del_executing_keyseq (); return (0); } diff --git a/misc.c b/misc.c index 4bca9c5..dddd499 100644 --- a/misc.c +++ b/misc.c @@ -235,6 +235,7 @@ rl_digit_argument (int ignore, int key) else { rl_execute_next (key); + _rl_del_executing_keyseq (); return (rl_digit_loop ()); } } @@ -693,7 +694,7 @@ static int saved_history_logical_offset = -1; #define HISTORY_FULL() (history_is_stifled () && history_length >= history_max_entries) static int -set_saved_history () +set_saved_history (void) { int absolute_offset, count; diff --git a/posixselect.h b/posixselect.h index da6a1ac..9d40001 100644 --- a/posixselect.h +++ b/posixselect.h @@ -27,7 +27,7 @@ #if defined (HAVE_SELECT) # if !defined (HAVE_SYS_SELECT_H) || !defined (M_UNIX) -# include +# include "posixtime.h" # endif #endif /* HAVE_SELECT */ #if defined (HAVE_SYS_SELECT_H) diff --git a/readline.c b/readline.c index 9d42a8d..eb3ddc7 100644 --- a/readline.c +++ b/readline.c @@ -566,6 +566,7 @@ readline_internal_charloop (void) { static int lastc, eof_found; int c, code, lk, r; + static procenv_t olevel; lastc = EOF; @@ -576,6 +577,9 @@ readline_internal_charloop (void) #endif lk = _rl_last_command_was_kill; + /* Save and restore _rl_top_level even though most of the time it + doesn't matter. */ + memcpy ((void *)olevel, (void *)_rl_top_level, sizeof (procenv_t)); #if defined (HAVE_POSIX_SIGSETJMP) code = sigsetjmp (_rl_top_level, 0); #else @@ -586,6 +590,7 @@ readline_internal_charloop (void) { (*rl_redisplay_function) (); _rl_want_redisplay = 0; + memcpy ((void *)_rl_top_level, (void *)olevel, sizeof (procenv_t)); /* If we longjmped because of a timeout, handle it here. */ if (RL_ISSTATE (RL_STATE_TIMEOUT)) @@ -703,6 +708,7 @@ readline_internal_charloop (void) _rl_internal_char_cleanup (); #if defined (READLINE_CALLBACKS) + memcpy ((void *)_rl_top_level, (void *)olevel, sizeof (procenv_t)); return 0; #else } @@ -1322,9 +1328,8 @@ readline_initialize_everything (void) _rl_parse_colors (); #endif - rl_executing_keyseq = malloc (_rl_executing_keyseq_size = 16); - if (rl_executing_keyseq) - rl_executing_keyseq[rl_key_sequence_length = 0] = '\0'; + rl_executing_keyseq = xmalloc (_rl_executing_keyseq_size = 16); + rl_executing_keyseq[rl_key_sequence_length = 0] = '\0'; } /* If this system allows us to look at the values of the regular diff --git a/rldefs.h b/rldefs.h index 98577a6..dfb1320 100644 --- a/rldefs.h +++ b/rldefs.h @@ -40,7 +40,7 @@ # if defined (HAVE_TERMIO_H) # define TERMIO_TTY_DRIVER # else -# if !defined (__MINGW32__) +# if !defined (__MINGW32__) && !defined (_WIN32) # define NEW_TTY_DRIVER # else # define NO_TTY_DRIVER diff --git a/rltty.c b/rltty.c index 882a3d4..d9b0cd1 100644 --- a/rltty.c +++ b/rltty.c @@ -729,7 +729,7 @@ rl_tty_set_echoing (int u) _rl_echoing_p = u; return o; } - + /* **************************************************************** */ /* */ /* Bogus Flow Control */ diff --git a/xmalloc.c b/xmalloc.c index 5d01d75..35e46ea 100644 --- a/xmalloc.c +++ b/xmalloc.c @@ -42,7 +42,7 @@ /* **************************************************************** */ static void -memory_error_and_abort (char *fname) +memory_error_and_abort (const char * const fname) { fprintf (stderr, "%s: out of virtual memory\n", fname); exit (2);