OpenCoverage

readline.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/bash/src/lib/readline/readline.c
Source codeSwitch to Preprocessed file
LineSourceCount
1/* readline.c -- a general facility for reading lines of input-
2 with emacs style editing and completion. */-
3-
4/* Copyright (C) 1987-2017 Free Software Foundation, Inc.-
5-
6 This file is part of the GNU Readline Library (Readline), a library-
7 for reading lines of text with interactive input and history editing. -
8-
9 Readline is free software: you can redistribute it and/or modify-
10 it under the terms of the GNU General Public License as published by-
11 the Free Software Foundation, either version 3 of the License, or-
12 (at your option) any later version.-
13-
14 Readline is distributed in the hope that it will be useful,-
15 but WITHOUT ANY WARRANTY; without even the implied warranty of-
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-
17 GNU General Public License for more details.-
18-
19 You should have received a copy of the GNU General Public License-
20 along with Readline. If not, see <http://www.gnu.org/licenses/>.-
21*/-
22-
23#define READLINE_LIBRARY-
24-
25#if defined (HAVE_CONFIG_H)-
26# include <config.h>-
27#endif-
28-
29#include <sys/types.h>-
30#include "posixstat.h"-
31#include <fcntl.h>-
32#if defined (HAVE_SYS_FILE_H)-
33# include <sys/file.h>-
34#endif /* HAVE_SYS_FILE_H */-
35-
36#if defined (HAVE_UNISTD_H)-
37# include <unistd.h>-
38#endif /* HAVE_UNISTD_H */-
39-
40#if defined (HAVE_STDLIB_H)-
41# include <stdlib.h>-
42#else-
43# include "ansi_stdlib.h"-
44#endif /* HAVE_STDLIB_H */-
45-
46#if defined (HAVE_LOCALE_H)-
47# include <locale.h>-
48#endif-
49-
50#include <stdio.h>-
51#include "posixjmp.h"-
52#include <errno.h>-
53-
54#if !defined (errno)-
55extern int errno;-
56#endif /* !errno */-
57-
58/* System-specific feature definitions and include files. */-
59#include "rldefs.h"-
60#include "rlmbutil.h"-
61-
62#if defined (__EMX__)-
63# define INCL_DOSPROCESS-
64# include <os2.h>-
65#endif /* __EMX__ */-
66-
67/* Some standard library routines. */-
68#include "readline.h"-
69#include "history.h"-
70-
71#include "rlprivate.h"-
72#include "rlshell.h"-
73#include "xmalloc.h"-
74-
75#ifndef RL_LIBRARY_VERSION-
76# define RL_LIBRARY_VERSION "5.1"-
77#endif-
78-
79#ifndef RL_READLINE_VERSION-
80# define RL_READLINE_VERSION 0x0501-
81#endif-
82-
83extern void _rl_free_history_entry PARAMS((HIST_ENTRY *));-
84-
85#if defined (COLOR_SUPPORT)-
86extern void _rl_parse_colors PARAMS((void)); /* XXX */-
87#endif-
88-
89-
90/* Forward declarations used in this file. */-
91static char *readline_internal PARAMS((void));-
92static void readline_initialize_everything PARAMS((void));-
93-
94static void bind_arrow_keys_internal PARAMS((Keymap));-
95static void bind_arrow_keys PARAMS((void));-
96-
97static void bind_bracketed_paste_prefix PARAMS((void));-
98-
99static void readline_default_bindings PARAMS((void));-
100static void reset_default_bindings PARAMS((void));-
101-
102static int _rl_subseq_result PARAMS((int, Keymap, int, int));-
103static int _rl_subseq_getchar PARAMS((int));-
104-
105/* **************************************************************** */-
106/* */-
107/* Line editing input utility */-
108/* */-
109/* **************************************************************** */-
110-
111const char *rl_library_version = RL_LIBRARY_VERSION;-
112-
113int rl_readline_version = RL_READLINE_VERSION;-
114-
115/* True if this is `real' readline as opposed to some stub substitute. */-
116int rl_gnu_readline_p = 1;-
117-
118/* A pointer to the keymap that is currently in use.-
119 By default, it is the standard emacs keymap. */-
120Keymap _rl_keymap = emacs_standard_keymap;-
121-
122/* The current style of editing. */-
123int rl_editing_mode = emacs_mode;-
124-
125/* The current insert mode: input (the default) or overwrite */-
126int rl_insert_mode = RL_IM_DEFAULT;-
127-
128/* Non-zero if we called this function from _rl_dispatch(). It's present-
129 so functions can find out whether they were called from a key binding-
130 or directly from an application. */-
131int rl_dispatching;-
132-
133/* Non-zero if the previous command was a kill command. */-
134int _rl_last_command_was_kill = 0;-
135-
136/* The current value of the numeric argument specified by the user. */-
137int rl_numeric_arg = 1;-
138-
139/* Non-zero if an argument was typed. */-
140int rl_explicit_arg = 0;-
141-
142/* Temporary value used while generating the argument. */-
143int rl_arg_sign = 1;-
144-
145/* Non-zero means we have been called at least once before. */-
146static int rl_initialized;-
147-
148#if 0-
149/* If non-zero, this program is running in an EMACS buffer. */-
150static int running_in_emacs;-
151#endif-
152-
153/* Flags word encapsulating the current readline state. */-
154unsigned long rl_readline_state = RL_STATE_NONE;-
155-
156/* The current offset in the current input line. */-
157int rl_point;-
158-
159/* Mark in the current input line. */-
160int rl_mark;-
161-
162/* Length of the current input line. */-
163int rl_end;-
164-
165/* Make this non-zero to return the current input_line. */-
166int rl_done;-
167-
168/* The last function executed by readline. */-
169rl_command_func_t *rl_last_func = (rl_command_func_t *)NULL;-
170-
171/* Top level environment for readline_internal (). */-
172procenv_t _rl_top_level;-
173-
174/* The streams we interact with. */-
175FILE *_rl_in_stream, *_rl_out_stream;-
176-
177/* The names of the streams that we do input and output to. */-
178FILE *rl_instream = (FILE *)NULL;-
179FILE *rl_outstream = (FILE *)NULL;-
180-
181/* Non-zero means echo characters as they are read. Defaults to no echo;-
182 set to 1 if there is a controlling terminal, we can get its attributes,-
183 and the attributes include `echo'. Look at rltty.c:prepare_terminal_settings-
184 for the code that sets it. */-
185int _rl_echoing_p = 0;-
186-
187/* Current prompt. */-
188char *rl_prompt = (char *)NULL;-
189int rl_visible_prompt_length = 0;-
190-
191/* Set to non-zero by calling application if it has already printed rl_prompt-
192 and does not want readline to do it the first time. */-
193int rl_already_prompted = 0;-
194-
195/* The number of characters read in order to type this complete command. */-
196int rl_key_sequence_length = 0;-
197-
198/* If non-zero, then this is the address of a function to call just-
199 before readline_internal_setup () prints the first prompt. */-
200rl_hook_func_t *rl_startup_hook = (rl_hook_func_t *)NULL;-
201-
202/* If non-zero, this is the address of a function to call just before-
203 readline_internal_setup () returns and readline_internal starts-
204 reading input characters. */-
205rl_hook_func_t *rl_pre_input_hook = (rl_hook_func_t *)NULL;-
206-
207/* What we use internally. You should always refer to RL_LINE_BUFFER. */-
208static char *the_line;-
209-
210/* The character that can generate an EOF. Really read from-
211 the terminal driver... just defaulted here. */-
212int _rl_eof_char = CTRL ('D');-
213-
214/* Non-zero makes this the next keystroke to read. */-
215int rl_pending_input = 0;-
216-
217/* Pointer to a useful terminal name. */-
218const char *rl_terminal_name = (const char *)NULL;-
219-
220/* Non-zero means to always use horizontal scrolling in line display. */-
221int _rl_horizontal_scroll_mode = 0;-
222-
223/* Non-zero means to display an asterisk at the starts of history lines-
224 which have been modified. */-
225int _rl_mark_modified_lines = 0; -
226-
227/* The style of `bell' notification preferred. This can be set to NO_BELL,-
228 AUDIBLE_BELL, or VISIBLE_BELL. */-
229int _rl_bell_preference = AUDIBLE_BELL;-
230 -
231/* String inserted into the line by rl_insert_comment (). */-
232char *_rl_comment_begin;-
233-
234/* Keymap holding the function currently being executed. */-
235Keymap rl_executing_keymap;-
236-
237/* Keymap we're currently using to dispatch. */-
238Keymap _rl_dispatching_keymap;-
239-
240/* Non-zero means to erase entire line, including prompt, on empty input lines. */-
241int rl_erase_empty_line = 0;-
242-
243/* Non-zero means to read only this many characters rather than up to a-
244 character bound to accept-line. */-
245int rl_num_chars_to_read = 0;-
246-
247/* Line buffer and maintenance. */-
248char *rl_line_buffer = (char *)NULL;-
249int rl_line_buffer_len = 0;-
250-
251/* Key sequence `contexts' */-
252_rl_keyseq_cxt *_rl_kscxt = 0;-
253-
254int rl_executing_key;-
255char *rl_executing_keyseq = 0;-
256int _rl_executing_keyseq_size = 0;-
257-
258/* Timeout (specified in milliseconds) when reading characters making up an-
259 ambiguous multiple-key sequence */-
260int _rl_keyseq_timeout = 500;-
261-
262#define RESIZE_KEYSEQ_BUFFER() \-
263 do \-
264 { \-
265 if (rl_key_sequence_length + 2 >= _rl_executing_keyseq_size) \-
266 { \-
267 _rl_executing_keyseq_size += 16; \-
268 rl_executing_keyseq = xrealloc (rl_executing_keyseq, _rl_executing_keyseq_size); \-
269 } \-
270 } \-
271 while (0);-
272 -
273/* Forward declarations used by the display, termcap, and history code. */-
274-
275/* **************************************************************** */-
276/* */-
277/* `Forward' declarations */-
278/* */-
279/* **************************************************************** */-
280-
281/* Non-zero means do not parse any lines other than comments and-
282 parser directives. */-
283unsigned char _rl_parsing_conditionalized_out = 0;-
284-
285/* Non-zero means to convert characters with the meta bit set to-
286 escape-prefixed characters so we can indirect through-
287 emacs_meta_keymap or vi_escape_keymap. */-
288int _rl_convert_meta_chars_to_ascii = 1;-
289-
290/* Non-zero means to output characters with the meta bit set directly-
291 rather than as a meta-prefixed escape sequence. */-
292int _rl_output_meta_chars = 0;-
293-
294/* Non-zero means to look at the termios special characters and bind-
295 them to equivalent readline functions at startup. */-
296int _rl_bind_stty_chars = 1;-
297-
298/* Non-zero means to go through the history list at every newline (or-
299 whenever rl_done is set and readline returns) and revert each line to-
300 its initial state. */-
301int _rl_revert_all_at_newline = 0;-
302-
303/* Non-zero means to honor the termios ECHOCTL bit and echo control-
304 characters corresponding to keyboard-generated signals. */-
305int _rl_echo_control_chars = 1;-
306-
307/* Non-zero means to prefix the displayed prompt with a character indicating-
308 the editing mode: @ for emacs, : for vi-command, + for vi-insert. */-
309int _rl_show_mode_in_prompt = 0;-
310-
311/* Non-zero means to attempt to put the terminal in `bracketed paste mode',-
312 where it will prefix pasted text with an escape sequence and send-
313 another to mark the end of the paste. */-
314int _rl_enable_bracketed_paste = 0;-
315-
316/* **************************************************************** */-
317/* */-
318/* Top Level Functions */-
319/* */-
320/* **************************************************************** */-
321-
322/* Non-zero means treat 0200 bit in terminal input as Meta bit. */-
323int _rl_meta_flag = 0; /* Forward declaration */-
324-
325/* Set up the prompt and expand it. Called from readline() and-
326 rl_callback_handler_install (). */-
327int-
328rl_set_prompt (const char *prompt)-
329{-
330 FREE (rl_prompt);
never executed: free (rl_prompt);
rl_promptDescription
TRUEnever evaluated
FALSEnever evaluated
0
331 rl_prompt = prompt ? savestring (prompt) : (char *)NULL;
promptDescription
TRUEnever evaluated
FALSEnever evaluated
0
332 rl_display_prompt = rl_prompt ? rl_prompt : "";
rl_promptDescription
TRUEnever evaluated
FALSEnever evaluated
0
333-
334 rl_visible_prompt_length = rl_expand_prompt (rl_prompt);-
335 return 0;
never executed: return 0;
0
336}-
337 -
338/* Read a line of input. Prompt with PROMPT. An empty PROMPT means-
339 none. A return value of NULL means that EOF was encountered. */-
340char *-
341readline (const char *prompt)-
342{-
343 char *value;-
344#if 0-
345 int in_callback;-
346#endif-
347-
348 /* If we are at EOF return a NULL string. */-
349 if (rl_pending_input == EOF)
rl_pending_input == (-1)Description
TRUEnever evaluated
FALSEnever evaluated
0
350 {-
351 rl_clear_pending_input ();-
352 return ((char *)NULL);
never executed: return ((char *) ((void *)0) );
0
353 }-
354-
355#if 0-
356 /* If readline() is called after installing a callback handler, temporarily-
357 turn off the callback state to avoid ensuing messiness. Patch supplied-
358 by the gdb folks. XXX -- disabled. This can be fooled and readline-
359 left in a strange state by a poorly-timed longjmp. */-
360 if (in_callback = RL_ISSTATE (RL_STATE_CALLBACK))-
361 RL_UNSETSTATE (RL_STATE_CALLBACK);-
362#endif-
363-
364 rl_set_prompt (prompt);-
365-
366 rl_initialize ();-
367 if (rl_prep_term_function)
rl_prep_term_functionDescription
TRUEnever evaluated
FALSEnever evaluated
0
368 (*rl_prep_term_function) (_rl_meta_flag);
never executed: (*rl_prep_term_function) (_rl_meta_flag);
0
369-
370#if defined (HANDLE_SIGNALS)-
371 rl_set_signals ();-
372#endif-
373-
374 value = readline_internal ();-
375 if (rl_deprep_term_function)
rl_deprep_term_functionDescription
TRUEnever evaluated
FALSEnever evaluated
0
376 (*rl_deprep_term_function) ();
never executed: (*rl_deprep_term_function) ();
0
377-
378#if defined (HANDLE_SIGNALS)-
379 rl_clear_signals ();-
380#endif-
381-
382#if 0-
383 if (in_callback)-
384 RL_SETSTATE (RL_STATE_CALLBACK);-
385#endif-
386-
387#if HAVE_DECL_AUDIT_USER_TTY && defined (HAVE_LIBAUDIT_H) && defined (ENABLE_TTY_AUDIT_SUPPORT)-
388 if (value)-
389 _rl_audit_tty (value);-
390#endif-
391-
392 return (value);
never executed: return (value);
0
393}-
394-
395#if defined (READLINE_CALLBACKS)-
396# define STATIC_CALLBACK-
397#else-
398# define STATIC_CALLBACK static-
399#endif-
400-
401STATIC_CALLBACK void-
402readline_internal_setup (void)-
403{-
404 char *nprompt;-
405-
406 _rl_in_stream = rl_instream;-
407 _rl_out_stream = rl_outstream;-
408-
409 /* Enable the meta key only for the duration of readline(), if this-
410 terminal has one and the terminal has been initialized */-
411 if (_rl_enable_meta & RL_ISSTATE (RL_STATE_TERMPREPPED))
_rl_enable_met...& (0x0000004))Description
TRUEnever evaluated
FALSEnever evaluated
0
412 _rl_enable_meta_key ();
never executed: _rl_enable_meta_key ();
0
413-
414 if (rl_startup_hook)
rl_startup_hookDescription
TRUEnever evaluated
FALSEnever evaluated
0
415 (*rl_startup_hook) ();
never executed: (*rl_startup_hook) ();
0
416-
417#if defined (VI_MODE)-
418 if (rl_editing_mode == vi_mode)
rl_editing_mode == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
419 rl_vi_insertion_mode (1, 'i'); /* don't want to reset last */
never executed: rl_vi_insertion_mode (1, 'i');
0
420 else-
421#endif /* VI_MODE */-
422 if (_rl_show_mode_in_prompt)
_rl_show_mode_in_promptDescription
TRUEnever evaluated
FALSEnever evaluated
0
423 _rl_reset_prompt ();
never executed: _rl_reset_prompt ();
0
424-
425 /* If we're not echoing, we still want to at least print a prompt, because-
426 rl_redisplay will not do it for us. If the calling application has a-
427 custom redisplay function, though, let that function handle it. */-
428 if (_rl_echoing_p == 0 && rl_redisplay_function == rl_redisplay)
_rl_echoing_p == 0Description
TRUEnever evaluated
FALSEnever evaluated
rl_redisplay_f...= rl_redisplayDescription
TRUEnever evaluated
FALSEnever evaluated
0
429 {-
430 if (rl_prompt && rl_already_prompted == 0)
rl_promptDescription
TRUEnever evaluated
FALSEnever evaluated
rl_already_prompted == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
431 {-
432 nprompt = _rl_strip_prompt (rl_prompt);-
433 fprintf (_rl_out_stream, "%s", nprompt);-
434 fflush (_rl_out_stream);-
435 xfree (nprompt);-
436 }
never executed: end of block
0
437 }
never executed: end of block
0
438 else-
439 {-
440 if (rl_prompt && rl_already_prompted)
rl_promptDescription
TRUEnever evaluated
FALSEnever evaluated
rl_already_promptedDescription
TRUEnever evaluated
FALSEnever evaluated
0
441 rl_on_new_line_with_prompt ();
never executed: rl_on_new_line_with_prompt ();
0
442 else-
443 rl_on_new_line ();
never executed: rl_on_new_line ();
0
444 (*rl_redisplay_function) ();-
445 }
never executed: end of block
0
446-
447 if (rl_pre_input_hook)
rl_pre_input_hookDescription
TRUEnever evaluated
FALSEnever evaluated
0
448 (*rl_pre_input_hook) ();
never executed: (*rl_pre_input_hook) ();
0
449-
450 RL_CHECK_SIGNALS ();
never executed: _rl_signal_handler (_rl_caught_signal);
_rl_caught_signalDescription
TRUEnever evaluated
FALSEnever evaluated
0
451}
never executed: end of block
0
452-
453STATIC_CALLBACK char *-
454readline_internal_teardown (int eof)-
455{-
456 char *temp;-
457 HIST_ENTRY *entry;-
458-
459 RL_CHECK_SIGNALS ();
never executed: _rl_signal_handler (_rl_caught_signal);
_rl_caught_signalDescription
TRUEnever evaluated
FALSEnever evaluated
0
460-
461 /* Restore the original of this history line, iff the line that we-
462 are editing was originally in the history, AND the line has changed. */-
463 entry = current_history ();-
464-
465 if (entry && rl_undo_list)
entryDescription
TRUEnever evaluated
FALSEnever evaluated
rl_undo_listDescription
TRUEnever evaluated
FALSEnever evaluated
0
466 {-
467 temp = savestring (the_line);-
468 rl_revert_line (1, 0);-
469 entry = replace_history_entry (where_history (), the_line, (histdata_t)NULL);-
470 _rl_free_history_entry (entry);-
471-
472 strcpy (the_line, temp);-
473 xfree (temp);-
474 }
never executed: end of block
0
475-
476 if (_rl_revert_all_at_newline)
_rl_revert_all_at_newlineDescription
TRUEnever evaluated
FALSEnever evaluated
0
477 _rl_revert_all_lines ();
never executed: _rl_revert_all_lines ();
0
478-
479 /* At any rate, it is highly likely that this line has an undo list. Get-
480 rid of it now. */-
481 if (rl_undo_list)
rl_undo_listDescription
TRUEnever evaluated
FALSEnever evaluated
0
482 rl_free_undo_list ();
never executed: rl_free_undo_list ();
0
483-
484 /* Disable the meta key, if this terminal has one and we were told to use it.-
485 The check whether or not we sent the enable string is in-
486 _rl_disable_meta_key(); the flag is set in _rl_enable_meta_key */-
487 _rl_disable_meta_key ();-
488-
489 /* Restore normal cursor, if available. */-
490 _rl_set_insert_mode (RL_IM_INSERT, 0);-
491-
492 return (eof ? (char *)NULL : savestring (the_line));
never executed: return (eof ? (char *) ((void *)0) : strcpy ((char *)xmalloc (1 + strlen (the_line)), (the_line)));
0
493}-
494-
495void-
496_rl_internal_char_cleanup (void)-
497{-
498#if defined (VI_MODE)-
499 /* In vi mode, when you exit insert mode, the cursor moves back-
500 over the previous character. We explicitly check for that here. */-
501 if (rl_editing_mode == vi_mode && _rl_keymap == vi_movement_keymap)
rl_editing_mode == 0Description
TRUEnever evaluated
FALSEnever evaluated
_rl_keymap == ...ovement_keymapDescription
TRUEnever evaluated
FALSEnever evaluated
0
502 rl_vi_check ();
never executed: rl_vi_check ();
0
503#endif /* VI_MODE */-
504-
505 if (rl_num_chars_to_read && rl_end >= rl_num_chars_to_read)
rl_num_chars_to_readDescription
TRUEnever evaluated
FALSEnever evaluated
rl_end >= rl_num_chars_to_readDescription
TRUEnever evaluated
FALSEnever evaluated
0
506 {-
507 (*rl_redisplay_function) ();-
508 _rl_want_redisplay = 0;-
509 rl_newline (1, '\n');-
510 }
never executed: end of block
0
511-
512 if (rl_done == 0)
rl_done == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
513 {-
514 (*rl_redisplay_function) ();-
515 _rl_want_redisplay = 0;-
516 }
never executed: end of block
0
517-
518 /* If the application writer has told us to erase the entire line if-
519 the only character typed was something bound to rl_newline, do so. */-
520 if (rl_erase_empty_line && rl_done && rl_last_func == rl_newline &&
rl_erase_empty_lineDescription
TRUEnever evaluated
FALSEnever evaluated
rl_doneDescription
TRUEnever evaluated
FALSEnever evaluated
rl_last_func == rl_newlineDescription
TRUEnever evaluated
FALSEnever evaluated
0
521 rl_point == 0 && rl_end == 0)
rl_point == 0Description
TRUEnever evaluated
FALSEnever evaluated
rl_end == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
522 _rl_erase_entire_line ();
never executed: _rl_erase_entire_line ();
0
523}
never executed: end of block
0
524-
525STATIC_CALLBACK int-
526#if defined (READLINE_CALLBACKS)-
527readline_internal_char (void)-
528#else-
529readline_internal_charloop (void)-
530#endif-
531{-
532 static int lastc, eof_found;-
533 int c, code, lk, r;-
534-
535 lastc = EOF;-
536-
537#if !defined (READLINE_CALLBACKS)-
538 eof_found = 0;-
539 while (rl_done == 0)-
540 {-
541#endif-
542 lk = _rl_last_command_was_kill;-
543-
544#if defined (HAVE_POSIX_SIGSETJMP)-
545 code = sigsetjmp (_rl_top_level, 0);-
546#else-
547 code = setjmp (_rl_top_level);-
548#endif-
549-
550 if (code)
codeDescription
TRUEnever evaluated
FALSEnever evaluated
0
551 {-
552 (*rl_redisplay_function) ();-
553 _rl_want_redisplay = 0;-
554 /* If we get here, we're not being called from something dispatched-
555 from _rl_callback_read_char(), which sets up its own value of-
556 _rl_top_level (saving and restoring the old, of course), so-
557 we can just return here. */-
558 if (RL_ISSTATE (RL_STATE_CALLBACK))
(rl_readline_s...& (0x0080000))Description
TRUEnever evaluated
FALSEnever evaluated
0
559 return (0);
never executed: return (0);
0
560 }
never executed: end of block
0
561-
562 if (rl_pending_input == 0)
rl_pending_input == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
563 {-
564 /* Then initialize the argument and number of keys read. */-
565 _rl_reset_argument ();-
566 rl_executing_keyseq[rl_key_sequence_length = 0] = '\0';-
567 }
never executed: end of block
0
568-
569 RL_SETSTATE(RL_STATE_READCMD);-
570 c = rl_read_key ();-
571 RL_UNSETSTATE(RL_STATE_READCMD);-
572-
573 /* look at input.c:rl_getc() for the circumstances under which this will-
574 be returned; punt immediately on read error without converting it to-
575 a newline; assume that rl_read_key has already called the signal-
576 handler. */-
577 if (c == READERR)
c == (-2)Description
TRUEnever evaluated
FALSEnever evaluated
0
578 {-
579#if defined (READLINE_CALLBACKS)-
580 RL_SETSTATE(RL_STATE_DONE);-
581 return (rl_done = 1);
never executed: return (rl_done = 1);
0
582#else-
583 eof_found = 1;-
584 break;-
585#endif-
586 }-
587-
588 /* EOF typed to a non-blank line is ^D the first time, EOF the second-
589 time in a row. This won't return any partial line read from the tty.-
590 If we want to change this, to force any existing line to be returned-
591 when read(2) reads EOF, for example, this is the place to change. */-
592 if (c == EOF && rl_end)
c == (-1)Description
TRUEnever evaluated
FALSEnever evaluated
rl_endDescription
TRUEnever evaluated
FALSEnever evaluated
0
593 {-
594 if (RL_SIG_RECEIVED ())
(_rl_caught_signal != 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
595 {-
596 RL_CHECK_SIGNALS ();
never executed: _rl_signal_handler (_rl_caught_signal);
_rl_caught_signalDescription
TRUEnever evaluated
FALSEnever evaluated
0
597 if (rl_signal_event_hook)
rl_signal_event_hookDescription
TRUEnever evaluated
FALSEnever evaluated
0
598 (*rl_signal_event_hook) (); /* XXX */
never executed: (*rl_signal_event_hook) ();
0
599 }
never executed: end of block
0
600-
601 /* XXX - reading two consecutive EOFs returns EOF */-
602 if (RL_ISSTATE (RL_STATE_TERMPREPPED))
(rl_readline_s...& (0x0000004))Description
TRUEnever evaluated
FALSEnever evaluated
0
603 {-
604 if (lastc == _rl_eof_char || lastc == EOF)
lastc == _rl_eof_charDescription
TRUEnever evaluated
FALSEnever evaluated
lastc == (-1)Description
TRUEnever evaluated
FALSEnever evaluated
0
605 rl_end = 0;
never executed: rl_end = 0;
0
606 else-
607 c = _rl_eof_char;
never executed: c = _rl_eof_char;
0
608 }-
609 else-
610 c = NEWLINE;
never executed: c = '\n';
0
611 }-
612-
613 /* The character _rl_eof_char typed to blank line, and not as the-
614 previous character is interpreted as EOF. This doesn't work when-
615 READLINE_CALLBACKS is defined, so hitting a series of ^Ds will-
616 erase all the chars on the line and then return EOF. */-
617 if (((c == _rl_eof_char && lastc != c) || c == EOF) && rl_end == 0)
c == _rl_eof_charDescription
TRUEnever evaluated
FALSEnever evaluated
lastc != cDescription
TRUEnever evaluated
FALSEnever evaluated
c == (-1)Description
TRUEnever evaluated
FALSEnever evaluated
rl_end == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
618 {-
619#if defined (READLINE_CALLBACKS)-
620 RL_SETSTATE(RL_STATE_DONE);-
621 return (rl_done = 1);
never executed: return (rl_done = 1);
0
622#else-
623 eof_found = 1;-
624 break;-
625#endif-
626 }-
627-
628 lastc = c;-
629 r = _rl_dispatch ((unsigned char)c, _rl_keymap);-
630 RL_CHECK_SIGNALS ();
never executed: _rl_signal_handler (_rl_caught_signal);
_rl_caught_signalDescription
TRUEnever evaluated
FALSEnever evaluated
0
631-
632 /* If there was no change in _rl_last_command_was_kill, then no kill-
633 has taken place. Note that if input is pending we are reading-
634 a prefix command, so nothing has changed yet. */-
635 if (rl_pending_input == 0 && lk == _rl_last_command_was_kill)
rl_pending_input == 0Description
TRUEnever evaluated
FALSEnever evaluated
lk == _rl_last...mmand_was_killDescription
TRUEnever evaluated
FALSEnever evaluated
0
636 _rl_last_command_was_kill = 0;
never executed: _rl_last_command_was_kill = 0;
0
637-
638 _rl_internal_char_cleanup ();-
639-
640#if defined (READLINE_CALLBACKS)-
641 return 0;
never executed: return 0;
0
642#else-
643 }-
644-
645 return (eof_found);-
646#endif-
647}-
648-
649#if defined (READLINE_CALLBACKS)-
650static int-
651readline_internal_charloop (void)-
652{-
653 int eof = 1;-
654-
655 while (rl_done == 0)
rl_done == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
656 eof = readline_internal_char ();
never executed: eof = readline_internal_char ();
0
657 return (eof);
never executed: return (eof);
0
658}-
659#endif /* READLINE_CALLBACKS */-
660-
661/* Read a line of input from the global rl_instream, doing output on-
662 the global rl_outstream.-
663 If rl_prompt is non-null, then that is our prompt. */-
664static char *-
665readline_internal (void)-
666{-
667 int eof;-
668-
669 readline_internal_setup ();-
670 eof = readline_internal_charloop ();-
671 return (readline_internal_teardown (eof));
never executed: return (readline_internal_teardown (eof));
0
672}-
673-
674void-
675_rl_init_line_state (void)-
676{-
677 rl_point = rl_end = rl_mark = 0;-
678 the_line = rl_line_buffer;-
679 the_line[0] = 0;-
680}
never executed: end of block
0
681-
682void-
683_rl_set_the_line (void)-
684{-
685 the_line = rl_line_buffer;-
686}
never executed: end of block
0
687-
688#if defined (READLINE_CALLBACKS)-
689_rl_keyseq_cxt *-
690_rl_keyseq_cxt_alloc (void)-
691{-
692 _rl_keyseq_cxt *cxt;-
693-
694 cxt = (_rl_keyseq_cxt *)xmalloc (sizeof (_rl_keyseq_cxt));-
695-
696 cxt->flags = cxt->subseq_arg = cxt->subseq_retval = 0;-
697-
698 cxt->okey = 0;-
699 cxt->ocxt = _rl_kscxt;-
700 cxt->childval = 42; /* sentinel value */-
701-
702 return cxt;
never executed: return cxt;
0
703}-
704-
705void-
706_rl_keyseq_cxt_dispose (_rl_keyseq_cxt *cxt)-
707{-
708 xfree (cxt);-
709}
never executed: end of block
0
710-
711void-
712_rl_keyseq_chain_dispose (void)-
713{-
714 _rl_keyseq_cxt *cxt;-
715-
716 while (_rl_kscxt)
_rl_kscxtDescription
TRUEnever evaluated
FALSEnever evaluated
0
717 {-
718 cxt = _rl_kscxt;-
719 _rl_kscxt = _rl_kscxt->ocxt;-
720 _rl_keyseq_cxt_dispose (cxt);-
721 }
never executed: end of block
0
722}
never executed: end of block
0
723#endif-
724-
725static int-
726_rl_subseq_getchar (int key)-
727{-
728 int k;-
729-
730 if (key == ESC)
key == (('[') & 0x1f)Description
TRUEnever evaluated
FALSEnever evaluated
0
731 RL_SETSTATE(RL_STATE_METANEXT);
never executed: (rl_readline_state |= (0x0000010));
0
732 RL_SETSTATE(RL_STATE_MOREINPUT);-
733 k = rl_read_key ();-
734 RL_UNSETSTATE(RL_STATE_MOREINPUT);-
735 if (key == ESC)
key == (('[') & 0x1f)Description
TRUEnever evaluated
FALSEnever evaluated
0
736 RL_UNSETSTATE(RL_STATE_METANEXT);
never executed: (rl_readline_state &= ~(0x0000010));
0
737-
738 return k;
never executed: return k;
0
739}-
740-
741#if defined (READLINE_CALLBACKS)-
742int-
743_rl_dispatch_callback (_rl_keyseq_cxt *cxt)-
744{-
745 int nkey, r;-
746-
747 /* For now */-
748 /* The first time this context is used, we want to read input and dispatch-
749 on it. When traversing the chain of contexts back `up', we want to use-
750 the value from the next context down. We're simulating recursion using-
751 a chain of contexts. */-
752 if ((cxt->flags & KSEQ_DISPATCHED) == 0)
(cxt->flags & 0x01) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
753 {-
754 nkey = _rl_subseq_getchar (cxt->okey);-
755 if (nkey < 0)
nkey < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
756 {-
757 _rl_abort_internal ();-
758 return -1;
never executed: return -1;
0
759 }-
760 r = _rl_dispatch_subseq (nkey, cxt->dmap, cxt->subseq_arg);-
761 cxt->flags |= KSEQ_DISPATCHED;-
762 }
never executed: end of block
0
763 else-
764 r = cxt->childval;
never executed: r = cxt->childval;
0
765-
766 /* For now */-
767 if (r != -3) /* don't do this if we indicate there will be other matches */
r != -3Description
TRUEnever evaluated
FALSEnever evaluated
0
768 r = _rl_subseq_result (r, cxt->oldmap, cxt->okey, (cxt->flags & KSEQ_SUBSEQ));
never executed: r = _rl_subseq_result (r, cxt->oldmap, cxt->okey, (cxt->flags & 0x02));
0
769-
770 RL_CHECK_SIGNALS ();
never executed: _rl_signal_handler (_rl_caught_signal);
_rl_caught_signalDescription
TRUEnever evaluated
FALSEnever evaluated
0
771 /* We only treat values < 0 specially to simulate recursion. */-
772 if (r >= 0 || (r == -1 && (cxt->flags & KSEQ_SUBSEQ) == 0)) /* success! or failure! */
r >= 0Description
TRUEnever evaluated
FALSEnever evaluated
r == -1Description
TRUEnever evaluated
FALSEnever evaluated
(cxt->flags & 0x02) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
773 {-
774 _rl_keyseq_chain_dispose ();-
775 RL_UNSETSTATE (RL_STATE_MULTIKEY);-
776 return r;
never executed: return r;
0
777 }-
778-
779 if (r != -3) /* magic value that says we added to the chain */
r != -3Description
TRUEnever evaluated
FALSEnever evaluated
0
780 _rl_kscxt = cxt->ocxt;
never executed: _rl_kscxt = cxt->ocxt;
0
781 if (_rl_kscxt)
_rl_kscxtDescription
TRUEnever evaluated
FALSEnever evaluated
0
782 _rl_kscxt->childval = r;
never executed: _rl_kscxt->childval = r;
0
783 if (r != -3)
r != -3Description
TRUEnever evaluated
FALSEnever evaluated
0
784 _rl_keyseq_cxt_dispose (cxt);
never executed: _rl_keyseq_cxt_dispose (cxt);
0
785-
786 return r;
never executed: return r;
0
787}-
788#endif /* READLINE_CALLBACKS */-
789 -
790/* Do the command associated with KEY in MAP.-
791 If the associated command is really a keymap, then read-
792 another key, and dispatch into that map. */-
793int-
794_rl_dispatch (register int key, Keymap map)-
795{-
796 _rl_dispatching_keymap = map;-
797 return _rl_dispatch_subseq (key, map, 0);
never executed: return _rl_dispatch_subseq (key, map, 0);
0
798}-
799-
800int-
801_rl_dispatch_subseq (register int key, Keymap map, int got_subseq)-
802{-
803 int r, newkey;-
804 char *macro;-
805 rl_command_func_t *func;-
806#if defined (READLINE_CALLBACKS)-
807 _rl_keyseq_cxt *cxt;-
808#endif-
809-
810 if (META_CHAR (key) && _rl_convert_meta_chars_to_ascii)
(key) > 0x07fDescription
TRUEnever evaluated
FALSEnever evaluated
(key) <= 255Description
TRUEnever evaluated
FALSEnever evaluated
_rl_convert_me...chars_to_asciiDescription
TRUEnever evaluated
FALSEnever evaluated
0
811 {-
812 if (map[ESC].type == ISKMAP)
map[(('[') & 0x1f)].type == 1Description
TRUEnever evaluated
FALSEnever evaluated
0
813 {-
814 if (RL_ISSTATE (RL_STATE_MACRODEF))
(rl_readline_s...& (0x0001000))Description
TRUEnever evaluated
FALSEnever evaluated
0
815 _rl_add_macro_char (ESC);
never executed: _rl_add_macro_char ((('[') & 0x1f));
0
816 RESIZE_KEYSEQ_BUFFER ();
never executed: end of block
rl_key_sequenc...ng_keyseq_sizeDescription
TRUEnever evaluated
FALSEnever evaluated
0
817 rl_executing_keyseq[rl_key_sequence_length++] = ESC;-
818 map = FUNCTION_TO_KEYMAP (map, ESC);-
819 key = UNMETA (key);-
820 return (_rl_dispatch (key, map));
never executed: return (_rl_dispatch (key, map));
0
821 }-
822 else-
823 rl_ding ();
never executed: rl_ding ();
0
824 return 0;
never executed: return 0;
0
825 }-
826-
827 if (RL_ISSTATE (RL_STATE_MACRODEF))
(rl_readline_s...& (0x0001000))Description
TRUEnever evaluated
FALSEnever evaluated
0
828 _rl_add_macro_char (key);
never executed: _rl_add_macro_char (key);
0
829-
830 r = 0;-
831 switch (map[key].type)-
832 {-
833 case ISFUNC:
never executed: case 0:
0
834 func = map[key].function;-
835 if (func)
funcDescription
TRUEnever evaluated
FALSEnever evaluated
0
836 {-
837 /* Special case rl_do_lowercase_version (). */-
838 if (func == rl_do_lowercase_version)
func == rl_do_...ercase_versionDescription
TRUEnever evaluated
FALSEnever evaluated
0
839 /* Should we do anything special if key == ANYOTHERKEY? */-
840 return (_rl_dispatch (_rl_to_lower ((unsigned char)key), map));
never executed: return (_rl_dispatch (((((unsigned char)((unsigned char)key) == ((unsigned char)key)) && (1 && ((*__ctype_b_loc ())[(int) (( (unsigned char)(unsigned char)key ))] & (unsigned short int) _ISupper) )) ? (__extension__ ({ int __res; if (sizeof ( (unsigned ch...__c < -128 || __c > 255 ? __c : (*__ctype_tolower_loc ())[__c]; } else __res = tolower ( (unsigned char)(unsigned char)key ); } else __res = (*__ctype_tolower_loc ())[(int) ( (unsigned char)(unsigned char)key )]; __res; })) : ((unsigned char)key)), map));
never executed: end of block
never executed: __res = tolower ( (unsigned char)(unsigned char)key );
never executed: __res = (*__ctype_tolower_loc ())[(int) ( (unsigned char)(unsigned char)key )];
sizeof ( (unsi...char)key ) > 1Description
TRUEnever evaluated
FALSEnever evaluated
__builtin_cons...ned char)key )Description
TRUEnever evaluated
FALSEnever evaluated
__c < -128Description
TRUEnever evaluated
FALSEnever evaluated
__c > 255Description
TRUEnever evaluated
FALSEnever evaluated
0
841-
842 rl_executing_keymap = map;-
843 rl_executing_key = key;-
844-
845 RESIZE_KEYSEQ_BUFFER();
never executed: end of block
rl_key_sequenc...ng_keyseq_sizeDescription
TRUEnever evaluated
FALSEnever evaluated
0
846 rl_executing_keyseq[rl_key_sequence_length++] = key;-
847 rl_executing_keyseq[rl_key_sequence_length] = '\0';-
848-
849 rl_dispatching = 1;-
850 RL_SETSTATE(RL_STATE_DISPATCHING);-
851 r = (*func) (rl_numeric_arg * rl_arg_sign, key);-
852 RL_UNSETSTATE(RL_STATE_DISPATCHING);-
853 rl_dispatching = 0;-
854-
855 /* If we have input pending, then the last command was a prefix-
856 command. Don't change the state of rl_last_func. Otherwise,-
857 remember the last command executed in this variable. */-
858 if (rl_pending_input == 0 && map[key].function != rl_digit_argument)
rl_pending_input == 0Description
TRUEnever evaluated
FALSEnever evaluated
map[key].funct...digit_argumentDescription
TRUEnever evaluated
FALSEnever evaluated
0
859 rl_last_func = map[key].function;
never executed: rl_last_func = map[key].function;
0
860-
861 RL_CHECK_SIGNALS ();
never executed: _rl_signal_handler (_rl_caught_signal);
_rl_caught_signalDescription
TRUEnever evaluated
FALSEnever evaluated
0
862 }
never executed: end of block
0
863 else if (map[ANYOTHERKEY].function)
map[257 -1].functionDescription
TRUEnever evaluated
FALSEnever evaluated
0
864 {-
865 /* OK, there's no function bound in this map, but there is a-
866 shadow function that was overridden when the current keymap-
867 was created. Return -2 to note that. */-
868 if (RL_ISSTATE (RL_STATE_MACROINPUT))
(rl_readline_s...& (0x0000800))Description
TRUEnever evaluated
FALSEnever evaluated
0
869 _rl_prev_macro_key ();
never executed: _rl_prev_macro_key ();
0
870 else-
871 _rl_unget_char (key);
never executed: _rl_unget_char (key);
0
872 return -2;
never executed: return -2;
0
873 }-
874 else if (got_subseq)
got_subseqDescription
TRUEnever evaluated
FALSEnever evaluated
0
875 {-
876 /* Return -1 to note that we're in a subsequence, but we don't-
877 have a matching key, nor was one overridden. This means-
878 we need to back up the recursion chain and find the last-
879 subsequence that is bound to a function. */-
880 if (RL_ISSTATE (RL_STATE_MACROINPUT))
(rl_readline_s...& (0x0000800))Description
TRUEnever evaluated
FALSEnever evaluated
0
881 _rl_prev_macro_key ();
never executed: _rl_prev_macro_key ();
0
882 else-
883 _rl_unget_char (key);
never executed: _rl_unget_char (key);
0
884 return -1;
never executed: return -1;
0
885 }-
886 else-
887 {-
888#if defined (READLINE_CALLBACKS)-
889 RL_UNSETSTATE (RL_STATE_MULTIKEY);-
890 _rl_keyseq_chain_dispose ();-
891#endif-
892 _rl_abort_internal ();-
893 return -1;
never executed: return -1;
0
894 }-
895 break;
never executed: break;
0
896-
897 case ISKMAP:
never executed: case 1:
0
898 if (map[key].function != 0)
map[key].function != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
899 {-
900#if defined (VI_MODE)-
901 /* The only way this test will be true is if a subsequence has been-
902 bound starting with ESC, generally the arrow keys. What we do is-
903 check whether there's input in the queue, which there generally-
904 will be if an arrow key has been pressed, and, if there's not,-
905 just dispatch to (what we assume is) rl_vi_movement_mode right-
906 away. This is essentially an input test with a zero timeout (by-
907 default) or a timeout determined by the value of `keyseq-timeout' */-
908 /* _rl_keyseq_timeout specified in milliseconds; _rl_input_queued-
909 takes microseconds, so multiply by 1000 */-
910 if (rl_editing_mode == vi_mode && key == ESC && map == vi_insertion_keymap &&
rl_editing_mode == 0Description
TRUEnever evaluated
FALSEnever evaluated
key == (('[') & 0x1f)Description
TRUEnever evaluated
FALSEnever evaluated
map == vi_insertion_keymapDescription
TRUEnever evaluated
FALSEnever evaluated
0
911 (RL_ISSTATE (RL_STATE_INPUTPENDING|RL_STATE_MACROINPUT) == 0) &&
((rl_readline_...000800)) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
912 _rl_pushed_input_available () == 0 &&
_rl_pushed_inp...ilable () == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
913 _rl_input_queued ((_rl_keyseq_timeout > 0) ? _rl_keyseq_timeout*1000 : 0) == 0)
_rl_input_queu...1000 : 0) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
914 return (_rl_dispatch (ANYOTHERKEY, FUNCTION_TO_KEYMAP (map, key)));
never executed: return (_rl_dispatch (257 -1, (Keymap)(map[key].function)));
0
915 /* This is a very specific test. It can possibly be generalized in-
916 the future, but for now it handles a specific case of ESC being-
917 the last character in a keyboard macro. */-
918 if (rl_editing_mode == vi_mode && key == ESC && map == vi_insertion_keymap &&
rl_editing_mode == 0Description
TRUEnever evaluated
FALSEnever evaluated
key == (('[') & 0x1f)Description
TRUEnever evaluated
FALSEnever evaluated
map == vi_insertion_keymapDescription
TRUEnever evaluated
FALSEnever evaluated
0
919 (RL_ISSTATE (RL_STATE_INPUTPENDING) == 0) &&
((rl_readline_...020000)) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
920 (RL_ISSTATE (RL_STATE_MACROINPUT) && _rl_peek_macro_key () == 0) &&
(rl_readline_s...& (0x0000800))Description
TRUEnever evaluated
FALSEnever evaluated
_rl_peek_macro_key () == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
921 _rl_pushed_input_available () == 0 &&
_rl_pushed_inp...ilable () == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
922 _rl_input_queued ((_rl_keyseq_timeout > 0) ? _rl_keyseq_timeout*1000 : 0) == 0)
_rl_input_queu...1000 : 0) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
923 return (_rl_dispatch (ANYOTHERKEY, FUNCTION_TO_KEYMAP (map, key)));
never executed: return (_rl_dispatch (257 -1, (Keymap)(map[key].function)));
0
924#endif-
925-
926 RESIZE_KEYSEQ_BUFFER ();
never executed: end of block
rl_key_sequenc...ng_keyseq_sizeDescription
TRUEnever evaluated
FALSEnever evaluated
0
927 rl_executing_keyseq[rl_key_sequence_length++] = key;-
928 _rl_dispatching_keymap = FUNCTION_TO_KEYMAP (map, key);-
929-
930 /* Allocate new context here. Use linked contexts (linked through-
931 cxt->ocxt) to simulate recursion */-
932#if defined (READLINE_CALLBACKS)-
933# if defined (VI_MODE)-
934 /* If we're redoing a vi mode command and we know there is a shadowed-
935 function corresponding to this key, just call it -- all the redoable-
936 vi mode commands already have all the input they need, and rl_vi_redo-
937 assumes that one call to rl_dispatch is sufficient to complete the-
938 command. */-
939 if (_rl_vi_redoing && RL_ISSTATE (RL_STATE_CALLBACK) &&
_rl_vi_redoingDescription
TRUEnever evaluated
FALSEnever evaluated
(rl_readline_s...& (0x0080000))Description
TRUEnever evaluated
FALSEnever evaluated
0
940 map[ANYOTHERKEY].function != 0)
map[257 -1].function != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
941 return (_rl_subseq_result (-2, map, key, got_subseq));
never executed: return (_rl_subseq_result (-2, map, key, got_subseq));
0
942# endif-
943 if (RL_ISSTATE (RL_STATE_CALLBACK))
(rl_readline_s...& (0x0080000))Description
TRUEnever evaluated
FALSEnever evaluated
0
944 {-
945 /* Return 0 only the first time, to indicate success to-
946 _rl_callback_read_char. The rest of the time, we're called-
947 from _rl_dispatch_callback, so we return -3 to indicate-
948 special handling is necessary. */-
949 r = RL_ISSTATE (RL_STATE_MULTIKEY) ? -3 : 0;
(rl_readline_s...& (0x0200000))Description
TRUEnever evaluated
FALSEnever evaluated
0
950 cxt = _rl_keyseq_cxt_alloc ();-
951-
952 if (got_subseq)
got_subseqDescription
TRUEnever evaluated
FALSEnever evaluated
0
953 cxt->flags |= KSEQ_SUBSEQ;
never executed: cxt->flags |= 0x02;
0
954 cxt->okey = key;-
955 cxt->oldmap = map;-
956 cxt->dmap = _rl_dispatching_keymap;-
957 cxt->subseq_arg = got_subseq || cxt->dmap[ANYOTHERKEY].function;
got_subseqDescription
TRUEnever evaluated
FALSEnever evaluated
cxt->dmap[257 -1].functionDescription
TRUEnever evaluated
FALSEnever evaluated
0
958-
959 RL_SETSTATE (RL_STATE_MULTIKEY);-
960 _rl_kscxt = cxt;-
961-
962 return r; /* don't indicate immediate success */
never executed: return r;
0
963 }-
964#endif-
965-
966 /* Tentative inter-character timeout for potential multi-key-
967 sequences? If no input within timeout, abort sequence and-
968 act as if we got non-matching input. */-
969 /* _rl_keyseq_timeout specified in milliseconds; _rl_input_queued-
970 takes microseconds, so multiply by 1000 */-
971 if (_rl_keyseq_timeout > 0 &&
_rl_keyseq_timeout > 0Description
TRUEnever evaluated
FALSEnever evaluated
0
972 (RL_ISSTATE (RL_STATE_INPUTPENDING|RL_STATE_MACROINPUT) == 0) &&
((rl_readline_...000800)) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
973 _rl_pushed_input_available () == 0 &&
_rl_pushed_inp...ilable () == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
974 _rl_dispatching_keymap[ANYOTHERKEY].function &&
_rl_dispatchin...7 -1].functionDescription
TRUEnever evaluated
FALSEnever evaluated
0
975 _rl_input_queued (_rl_keyseq_timeout*1000) == 0)
_rl_input_queu...out*1000) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
976 return (_rl_subseq_result (-2, map, key, got_subseq));
never executed: return (_rl_subseq_result (-2, map, key, got_subseq));
0
977-
978 newkey = _rl_subseq_getchar (key);-
979 if (newkey < 0)
newkey < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
980 {-
981 _rl_abort_internal ();-
982 return -1;
never executed: return -1;
0
983 }-
984-
985 r = _rl_dispatch_subseq (newkey, _rl_dispatching_keymap, got_subseq || map[ANYOTHERKEY].function);-
986 return _rl_subseq_result (r, map, key, got_subseq);
never executed: return _rl_subseq_result (r, map, key, got_subseq);
0
987 }-
988 else-
989 {-
990 _rl_abort_internal (); /* XXX */-
991 return -1;
never executed: return -1;
0
992 }-
993 break;
dead code: break;
-
994-
995 case ISMACR:
never executed: case 2:
0
996 if (map[key].function != 0)
map[key].function != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
997 {-
998 rl_executing_keyseq[rl_key_sequence_length] = '\0';-
999 macro = savestring ((char *)map[key].function);-
1000 _rl_with_macro_input (macro);-
1001 return 0;
never executed: return 0;
0
1002 }-
1003 break;
never executed: break;
0
1004 }-
1005-
1006#if defined (VI_MODE)-
1007 if (rl_editing_mode == vi_mode && _rl_keymap == vi_movement_keymap &&
rl_editing_mode == 0Description
TRUEnever evaluated
FALSEnever evaluated
_rl_keymap == ...ovement_keymapDescription
TRUEnever evaluated
FALSEnever evaluated
0
1008 key != ANYOTHERKEY &&
key != 257 -1Description
TRUEnever evaluated
FALSEnever evaluated
0
1009 _rl_dispatching_keymap == vi_movement_keymap &&
_rl_dispatchin...ovement_keymapDescription
TRUEnever evaluated
FALSEnever evaluated
0
1010 _rl_vi_textmod_command (key))
_rl_vi_textmod_command (key)Description
TRUEnever evaluated
FALSEnever evaluated
0
1011 _rl_vi_set_last (key, rl_numeric_arg, rl_arg_sign);
never executed: _rl_vi_set_last (key, rl_numeric_arg, rl_arg_sign);
0
1012#endif-
1013-
1014 return (r);
never executed: return (r);
0
1015}-
1016-
1017static int-
1018_rl_subseq_result (int r, Keymap map, int key, int got_subseq)-
1019{-
1020 Keymap m;-
1021 int type, nt;-
1022 rl_command_func_t *func, *nf;-
1023-
1024 if (r == -2)
r == -2Description
TRUEnever evaluated
FALSEnever evaluated
0
1025 /* We didn't match anything, and the keymap we're indexed into-
1026 shadowed a function previously bound to that prefix. Call-
1027 the function. The recursive call to _rl_dispatch_subseq has-
1028 already taken care of pushing any necessary input back onto-
1029 the input queue with _rl_unget_char. */-
1030 {-
1031 m = _rl_dispatching_keymap;-
1032 type = m[ANYOTHERKEY].type;-
1033 func = m[ANYOTHERKEY].function;-
1034 if (type == ISFUNC && func == rl_do_lowercase_version)
type == 0Description
TRUEnever evaluated
FALSEnever evaluated
func == rl_do_...ercase_versionDescription
TRUEnever evaluated
FALSEnever evaluated
0
1035 r = _rl_dispatch (_rl_to_lower ((unsigned char)key), map);
never executed: r = _rl_dispatch (((((unsigned char)((unsigned char)key) == ((unsigned char)key)) && (1 && ((*__ctype_b_loc ())[(int) (( (unsigned char)(unsigned char)key ))] & (unsigned short int) _ISupper) )) ? (__extension__ ({ int __res; if (sizeof ( (unsigned char)(... __c < -128 || __c > 255 ? __c : (*__ctype_tolower_loc ())[__c]; } else __res = tolower ( (unsigned char)(unsigned char)key ); } else __res = (*__ctype_tolower_loc ())[(int) ( (unsigned char)(unsigned char)key )]; __res; })) : ((unsigned char)key)), map);
never executed: end of block
never executed: __res = tolower ( (unsigned char)(unsigned char)key );
never executed: __res = (*__ctype_tolower_loc ())[(int) ( (unsigned char)(unsigned char)key )];
sizeof ( (unsi...char)key ) > 1Description
TRUEnever evaluated
FALSEnever evaluated
__builtin_cons...ned char)key )Description
TRUEnever evaluated
FALSEnever evaluated
__c < -128Description
TRUEnever evaluated
FALSEnever evaluated
__c > 255Description
TRUEnever evaluated
FALSEnever evaluated
0
1036 else if (type == ISFUNC)
type == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1037 {-
1038 /* If we shadowed a function, whatever it is, we somehow need a-
1039 keymap with map[key].func == shadowed-function.-
1040 Let's use this one. Then we can dispatch using the original-
1041 key, since there are commands (e.g., in vi mode) for which it-
1042 matters. */-
1043 nt = m[key].type;-
1044 nf = m[key].function;-
1045-
1046 m[key].type = type;-
1047 m[key].function = func;-
1048 /* Don't change _rl_dispatching_keymap, set it here */-
1049 _rl_dispatching_keymap = map; /* previous map */-
1050 r = _rl_dispatch_subseq (key, m, 0);-
1051 m[key].type = nt;-
1052 m[key].function = nf;-
1053 }
never executed: end of block
0
1054 else-
1055 /* We probably shadowed a keymap, so keep going. */-
1056 r = _rl_dispatch (ANYOTHERKEY, m);
never executed: r = _rl_dispatch (257 -1, m);
0
1057 }-
1058 else if (r && map[ANYOTHERKEY].function)
rDescription
TRUEnever evaluated
FALSEnever evaluated
map[257 -1].functionDescription
TRUEnever evaluated
FALSEnever evaluated
0
1059 {-
1060 /* We didn't match (r is probably -1), so return something to-
1061 tell the caller that it should try ANYOTHERKEY for an-
1062 overridden function. */-
1063 if (RL_ISSTATE (RL_STATE_MACROINPUT))
(rl_readline_s...& (0x0000800))Description
TRUEnever evaluated
FALSEnever evaluated
0
1064 _rl_prev_macro_key ();
never executed: _rl_prev_macro_key ();
0
1065 else-
1066 _rl_unget_char (key);
never executed: _rl_unget_char (key);
0
1067 _rl_dispatching_keymap = map;-
1068 return -2;
never executed: return -2;
0
1069 }-
1070 else if (r < 0 && got_subseq) /* XXX */
r < 0Description
TRUEnever evaluated
FALSEnever evaluated
got_subseqDescription
TRUEnever evaluated
FALSEnever evaluated
0
1071 {-
1072 /* OK, back up the chain. */-
1073 if (RL_ISSTATE (RL_STATE_MACROINPUT))
(rl_readline_s...& (0x0000800))Description
TRUEnever evaluated
FALSEnever evaluated
0
1074 _rl_prev_macro_key ();
never executed: _rl_prev_macro_key ();
0
1075 else-
1076 _rl_unget_char (key);
never executed: _rl_unget_char (key);
0
1077 _rl_dispatching_keymap = map;-
1078 return -1;
never executed: return -1;
0
1079 }-
1080-
1081 return r;
never executed: return r;
0
1082}-
1083-
1084/* **************************************************************** */-
1085/* */-
1086/* Initializations */-
1087/* */-
1088/* **************************************************************** */-
1089-
1090/* Initialize readline (and terminal if not already). */-
1091int-
1092rl_initialize (void)-
1093{-
1094 /* If we have never been called before, initialize the-
1095 terminal and data structures. */-
1096 if (rl_initialized == 0)
rl_initialized == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1097 {-
1098 RL_SETSTATE(RL_STATE_INITIALIZING);-
1099 readline_initialize_everything ();-
1100 RL_UNSETSTATE(RL_STATE_INITIALIZING);-
1101 rl_initialized++;-
1102 RL_SETSTATE(RL_STATE_INITIALIZED);-
1103 }
never executed: end of block
0
1104 else-
1105 (void)_rl_init_locale (); /* check current locale */
never executed: (void)_rl_init_locale ();
0
1106-
1107 /* Initialize the current line information. */-
1108 _rl_init_line_state ();-
1109-
1110 /* We aren't done yet. We haven't even gotten started yet! */-
1111 rl_done = 0;-
1112 RL_UNSETSTATE(RL_STATE_DONE);-
1113-
1114 /* Tell the history routines what is going on. */-
1115 _rl_start_using_history ();-
1116-
1117 /* Make the display buffer match the state of the line. */-
1118 rl_reset_line_state ();-
1119-
1120 /* No such function typed yet. */-
1121 rl_last_func = (rl_command_func_t *)NULL;-
1122-
1123 /* Parsing of key-bindings begins in an enabled state. */-
1124 _rl_parsing_conditionalized_out = 0;-
1125-
1126#if defined (VI_MODE)-
1127 if (rl_editing_mode == vi_mode)
rl_editing_mode == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1128 _rl_vi_initialize_line ();
never executed: _rl_vi_initialize_line ();
0
1129#endif-
1130-
1131 /* Each line starts in insert mode (the default). */-
1132 _rl_set_insert_mode (RL_IM_DEFAULT, 1);-
1133-
1134 return 0;
never executed: return 0;
0
1135}-
1136-
1137#if 0-
1138#if defined (__EMX__)-
1139static void-
1140_emx_build_environ (void)-
1141{-
1142 TIB *tibp;-
1143 PIB *pibp;-
1144 char *t, **tp;-
1145 int c;-
1146-
1147 DosGetInfoBlocks (&tibp, &pibp);-
1148 t = pibp->pib_pchenv;-
1149 for (c = 1; *t; c++)-
1150 t += strlen (t) + 1;-
1151 tp = environ = (char **)xmalloc ((c + 1) * sizeof (char *));-
1152 t = pibp->pib_pchenv;-
1153 while (*t)-
1154 {-
1155 *tp++ = t;-
1156 t += strlen (t) + 1;-
1157 }-
1158 *tp = 0;-
1159}-
1160#endif /* __EMX__ */-
1161#endif-
1162-
1163/* Initialize the entire state of the world. */-
1164static void-
1165readline_initialize_everything (void)-
1166{-
1167#if 0-
1168#if defined (__EMX__)-
1169 if (environ == 0)-
1170 _emx_build_environ ();-
1171#endif-
1172#endif-
1173-
1174#if 0-
1175 /* Find out if we are running in Emacs -- UNUSED. */-
1176 running_in_emacs = sh_get_env_value ("EMACS") != (char *)0;-
1177#endif-
1178-
1179 /* Set up input and output if they are not already set up. */-
1180 if (!rl_instream)
!rl_instreamDescription
TRUEnever evaluated
FALSEnever evaluated
0
1181 rl_instream = stdin;
never executed: rl_instream = stdin ;
0
1182-
1183 if (!rl_outstream)
!rl_outstreamDescription
TRUEnever evaluated
FALSEnever evaluated
0
1184 rl_outstream = stdout;
never executed: rl_outstream = stdout ;
0
1185-
1186 /* Bind _rl_in_stream and _rl_out_stream immediately. These values-
1187 may change, but they may also be used before readline_internal ()-
1188 is called. */-
1189 _rl_in_stream = rl_instream;-
1190 _rl_out_stream = rl_outstream;-
1191-
1192 /* Allocate data structures. */-
1193 if (rl_line_buffer == 0)
rl_line_buffer == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1194 rl_line_buffer = (char *)xmalloc (rl_line_buffer_len = DEFAULT_BUFFER_SIZE);
never executed: rl_line_buffer = (char *)xmalloc (rl_line_buffer_len = 256);
0
1195-
1196 /* Initialize the terminal interface. */-
1197 if (rl_terminal_name == 0)
rl_terminal_name == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1198 rl_terminal_name = sh_get_env_value ("TERM");
never executed: rl_terminal_name = sh_get_env_value ("TERM");
0
1199 _rl_init_terminal_io (rl_terminal_name);-
1200-
1201 /* Bind tty characters to readline functions. */-
1202 readline_default_bindings ();-
1203-
1204 /* Initialize the function names. */-
1205 rl_initialize_funmap ();-
1206-
1207 /* Decide whether we should automatically go into eight-bit mode. */-
1208 _rl_init_eightbit ();-
1209 -
1210 /* Read in the init file. */-
1211 rl_read_init_file ((char *)NULL);-
1212-
1213 /* XXX */-
1214 if (_rl_horizontal_scroll_mode && _rl_term_autowrap)
_rl_horizontal_scroll_modeDescription
TRUEnever evaluated
FALSEnever evaluated
_rl_term_autowrapDescription
TRUEnever evaluated
FALSEnever evaluated
0
1215 {-
1216 _rl_screenwidth--;-
1217 _rl_screenchars -= _rl_screenheight;-
1218 }
never executed: end of block
0
1219-
1220 /* Override the effect of any `set keymap' assignments in the-
1221 inputrc file. */-
1222 rl_set_keymap_from_edit_mode ();-
1223-
1224 /* Try to bind a common arrow key prefix, if not already bound. */-
1225 bind_arrow_keys ();-
1226-
1227 /* Bind the bracketed paste prefix assuming that the user will enable-
1228 it on terminals that support it. */-
1229 bind_bracketed_paste_prefix ();-
1230-
1231 /* If the completion parser's default word break characters haven't-
1232 been set yet, then do so now. */-
1233 if (rl_completer_word_break_characters == (char *)NULL)
rl_completer_w...*) ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1234 rl_completer_word_break_characters = (char *)rl_basic_word_break_characters;
never executed: rl_completer_word_break_characters = (char *)rl_basic_word_break_characters;
0
1235-
1236#if defined (COLOR_SUPPORT)-
1237 if (_rl_colored_stats || _rl_colored_completion_prefix)
_rl_colored_statsDescription
TRUEnever evaluated
FALSEnever evaluated
_rl_colored_completion_prefixDescription
TRUEnever evaluated
FALSEnever evaluated
0
1238 _rl_parse_colors ();
never executed: _rl_parse_colors ();
0
1239#endif-
1240-
1241 rl_executing_keyseq = malloc (_rl_executing_keyseq_size = 16);-
1242 if (rl_executing_keyseq)
rl_executing_keyseqDescription
TRUEnever evaluated
FALSEnever evaluated
0
1243 rl_executing_keyseq[0] = '\0';
never executed: rl_executing_keyseq[0] = '\0';
0
1244}
never executed: end of block
0
1245-
1246/* If this system allows us to look at the values of the regular-
1247 input editing characters, then bind them to their readline-
1248 equivalents, iff the characters are not bound to keymaps. */-
1249static void-
1250readline_default_bindings (void)-
1251{-
1252 if (_rl_bind_stty_chars)
_rl_bind_stty_charsDescription
TRUEnever evaluated
FALSEnever evaluated
0
1253 rl_tty_set_default_bindings (_rl_keymap);
never executed: rl_tty_set_default_bindings (_rl_keymap);
0
1254}
never executed: end of block
0
1255-
1256/* Reset the default bindings for the terminal special characters we're-
1257 interested in back to rl_insert and read the new ones. */-
1258static void-
1259reset_default_bindings (void)-
1260{-
1261 if (_rl_bind_stty_chars)
_rl_bind_stty_charsDescription
TRUEnever evaluated
FALSEnever evaluated
0
1262 {-
1263 rl_tty_unset_default_bindings (_rl_keymap);-
1264 rl_tty_set_default_bindings (_rl_keymap);-
1265 }
never executed: end of block
0
1266}
never executed: end of block
0
1267-
1268/* Bind some common arrow key sequences in MAP. */-
1269static void-
1270bind_arrow_keys_internal (Keymap map)-
1271{-
1272 Keymap xkeymap;-
1273-
1274 xkeymap = _rl_keymap;-
1275 _rl_keymap = map;-
1276-
1277#if defined (__MSDOS__)-
1278 rl_bind_keyseq_if_unbound ("\033[0A", rl_get_previous_history);-
1279 rl_bind_keyseq_if_unbound ("\033[0B", rl_backward_char);-
1280 rl_bind_keyseq_if_unbound ("\033[0C", rl_forward_char);-
1281 rl_bind_keyseq_if_unbound ("\033[0D", rl_get_next_history);-
1282#endif-
1283-
1284 rl_bind_keyseq_if_unbound ("\033[A", rl_get_previous_history);-
1285 rl_bind_keyseq_if_unbound ("\033[B", rl_get_next_history);-
1286 rl_bind_keyseq_if_unbound ("\033[C", rl_forward_char);-
1287 rl_bind_keyseq_if_unbound ("\033[D", rl_backward_char);-
1288 rl_bind_keyseq_if_unbound ("\033[H", rl_beg_of_line);-
1289 rl_bind_keyseq_if_unbound ("\033[F", rl_end_of_line);-
1290-
1291 rl_bind_keyseq_if_unbound ("\033OA", rl_get_previous_history);-
1292 rl_bind_keyseq_if_unbound ("\033OB", rl_get_next_history);-
1293 rl_bind_keyseq_if_unbound ("\033OC", rl_forward_char);-
1294 rl_bind_keyseq_if_unbound ("\033OD", rl_backward_char);-
1295 rl_bind_keyseq_if_unbound ("\033OH", rl_beg_of_line);-
1296 rl_bind_keyseq_if_unbound ("\033OF", rl_end_of_line);-
1297-
1298 /* Key bindings for control-arrow keys */-
1299 rl_bind_keyseq_if_unbound ("\033[1;5C", rl_forward_word);-
1300 rl_bind_keyseq_if_unbound ("\033[1;5D", rl_backward_word);-
1301 rl_bind_keyseq_if_unbound ("\033[3;5~", rl_kill_word);-
1302-
1303 /* Key bindings for alt-arrow keys */-
1304 rl_bind_keyseq_if_unbound ("\033[1;3C", rl_forward_word);-
1305 rl_bind_keyseq_if_unbound ("\033[1;3D", rl_backward_word);-
1306-
1307#if defined (__MINGW32__)-
1308 rl_bind_keyseq_if_unbound ("\340H", rl_get_previous_history);-
1309 rl_bind_keyseq_if_unbound ("\340P", rl_get_next_history);-
1310 rl_bind_keyseq_if_unbound ("\340M", rl_forward_char);-
1311 rl_bind_keyseq_if_unbound ("\340K", rl_backward_char);-
1312 rl_bind_keyseq_if_unbound ("\340G", rl_beg_of_line);-
1313 rl_bind_keyseq_if_unbound ("\340O", rl_end_of_line);-
1314 rl_bind_keyseq_if_unbound ("\340S", rl_delete);-
1315 rl_bind_keyseq_if_unbound ("\340R", rl_overwrite_mode);-
1316-
1317 /* These may or may not work because of the embedded NUL. */-
1318 rl_bind_keyseq_if_unbound ("\\000H", rl_get_previous_history);-
1319 rl_bind_keyseq_if_unbound ("\\000P", rl_get_next_history);-
1320 rl_bind_keyseq_if_unbound ("\\000M", rl_forward_char);-
1321 rl_bind_keyseq_if_unbound ("\\000K", rl_backward_char);-
1322 rl_bind_keyseq_if_unbound ("\\000G", rl_beg_of_line);-
1323 rl_bind_keyseq_if_unbound ("\\000O", rl_end_of_line);-
1324 rl_bind_keyseq_if_unbound ("\\000S", rl_delete);-
1325 rl_bind_keyseq_if_unbound ("\\000R", rl_overwrite_mode);-
1326#endif-
1327-
1328 _rl_keymap = xkeymap;-
1329}
never executed: end of block
0
1330-
1331/* Try and bind the common arrow key prefixes after giving termcap and-
1332 the inputrc file a chance to bind them and create `real' keymaps-
1333 for the arrow key prefix. */-
1334static void-
1335bind_arrow_keys (void)-
1336{-
1337 bind_arrow_keys_internal (emacs_standard_keymap);-
1338-
1339#if defined (VI_MODE)-
1340 bind_arrow_keys_internal (vi_movement_keymap);-
1341 /* Unbind vi_movement_keymap[ESC] to allow users to repeatedly hit ESC-
1342 in vi command mode while still allowing the arrow keys to work. */-
1343 if (vi_movement_keymap[ESC].type == ISKMAP)
vi_movement_ke...1f)].type == 1Description
TRUEnever evaluated
FALSEnever evaluated
0
1344 rl_bind_keyseq_in_map ("\033", (rl_command_func_t *)NULL, vi_movement_keymap);
never executed: rl_bind_keyseq_in_map ("\033", (rl_command_func_t *) ((void *)0) , vi_movement_keymap);
0
1345 bind_arrow_keys_internal (vi_insertion_keymap);-
1346#endif-
1347}
never executed: end of block
0
1348-
1349static void-
1350bind_bracketed_paste_prefix (void)-
1351{-
1352 Keymap xkeymap;-
1353-
1354 xkeymap = _rl_keymap;-
1355-
1356 _rl_keymap = emacs_standard_keymap;-
1357 rl_bind_keyseq_if_unbound (BRACK_PASTE_PREF, rl_bracketed_paste_begin);-
1358 -
1359 _rl_keymap = vi_insertion_keymap;-
1360 rl_bind_keyseq_if_unbound (BRACK_PASTE_PREF, rl_bracketed_paste_begin);-
1361-
1362 _rl_keymap = xkeymap;-
1363}
never executed: end of block
0
1364 -
1365/* **************************************************************** */-
1366/* */-
1367/* Saving and Restoring Readline's state */-
1368/* */-
1369/* **************************************************************** */-
1370-
1371int-
1372rl_save_state (struct readline_state *sp)-
1373{-
1374 if (sp == 0)
sp == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1375 return -1;
never executed: return -1;
0
1376-
1377 sp->point = rl_point;-
1378 sp->end = rl_end;-
1379 sp->mark = rl_mark;-
1380 sp->buffer = rl_line_buffer;-
1381 sp->buflen = rl_line_buffer_len;-
1382 sp->ul = rl_undo_list;-
1383 sp->prompt = rl_prompt;-
1384-
1385 sp->rlstate = rl_readline_state;-
1386 sp->done = rl_done;-
1387 sp->kmap = _rl_keymap;-
1388-
1389 sp->lastfunc = rl_last_func;-
1390 sp->insmode = rl_insert_mode;-
1391 sp->edmode = rl_editing_mode;-
1392 sp->kseq = rl_executing_keyseq;-
1393 sp->kseqlen = rl_key_sequence_length;-
1394 sp->inf = rl_instream;-
1395 sp->outf = rl_outstream;-
1396 sp->pendingin = rl_pending_input;-
1397 sp->macro = rl_executing_macro;-
1398-
1399 sp->catchsigs = rl_catch_signals;-
1400 sp->catchsigwinch = rl_catch_sigwinch;-
1401-
1402 sp->entryfunc = rl_completion_entry_function;-
1403 sp->menuentryfunc = rl_menu_completion_entry_function;-
1404 sp->ignorefunc = rl_ignore_some_completions_function;-
1405 sp->attemptfunc = rl_attempted_completion_function;-
1406 sp->wordbreakchars = rl_completer_word_break_characters;-
1407-
1408 return (0);
never executed: return (0);
0
1409}-
1410-
1411int-
1412rl_restore_state (struct readline_state *sp)-
1413{-
1414 if (sp == 0)
sp == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1415 return -1;
never executed: return -1;
0
1416-
1417 rl_point = sp->point;-
1418 rl_end = sp->end;-
1419 rl_mark = sp->mark;-
1420 the_line = rl_line_buffer = sp->buffer;-
1421 rl_line_buffer_len = sp->buflen;-
1422 rl_undo_list = sp->ul;-
1423 rl_prompt = sp->prompt;-
1424-
1425 rl_readline_state = sp->rlstate;-
1426 rl_done = sp->done;-
1427 _rl_keymap = sp->kmap;-
1428-
1429 rl_last_func = sp->lastfunc;-
1430 rl_insert_mode = sp->insmode;-
1431 rl_editing_mode = sp->edmode;-
1432 rl_executing_keyseq = sp->kseq;-
1433 rl_key_sequence_length = sp->kseqlen;-
1434 rl_instream = sp->inf;-
1435 rl_outstream = sp->outf;-
1436 rl_pending_input = sp->pendingin;-
1437 rl_executing_macro = sp->macro;-
1438-
1439 rl_catch_signals = sp->catchsigs;-
1440 rl_catch_sigwinch = sp->catchsigwinch;-
1441-
1442 rl_completion_entry_function = sp->entryfunc;-
1443 rl_menu_completion_entry_function = sp->menuentryfunc;-
1444 rl_ignore_some_completions_function = sp->ignorefunc;-
1445 rl_attempted_completion_function = sp->attemptfunc;-
1446 rl_completer_word_break_characters = sp->wordbreakchars;-
1447-
1448 return (0);
never executed: return (0);
0
1449}-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.1.2