1 /* bind.c -- key binding and startup file support for the readline library. */
3 /* Copyright (C) 1987-2006 Free Software Foundation, Inc.
5 This file is part of the GNU Readline Library, a library for
6 reading lines of text with interactive input and history editing.
8 The GNU Readline Library is free software; you can redistribute it
9 and/or modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2, or
11 (at your option) any later version.
13 The GNU Readline Library is distributed in the hope that it will be
14 useful, but WITHOUT ANY WARRANTY; without even the implied warranty
15 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 The GNU General Public License is often shipped with GNU software, and
19 is generally kept in a file called COPYING or LICENSE. If you do not
20 have a copy of the license, write to the Free Software Foundation,
21 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
23 #define READLINE_LIBRARY
25 #if defined (__TANDEM)
29 #if defined (HAVE_CONFIG_H)
34 #include <sys/types.h>
36 #if defined (HAVE_SYS_FILE_H)
37 # include <sys/file.h>
38 #endif /* HAVE_SYS_FILE_H */
40 #if defined (HAVE_UNISTD_H)
42 #endif /* HAVE_UNISTD_H */
44 #if defined (HAVE_STDLIB_H)
47 # include "ansi_stdlib.h"
48 #endif /* HAVE_STDLIB_H */
56 #include "posixstat.h"
58 /* System-specific feature definitions and include files. */
61 /* Some standard library routines. */
65 #include "rlprivate.h"
69 #if !defined (strchr) && !defined (__STDC__)
70 extern char *strchr (), *strrchr ();
71 #endif /* !strchr && !__STDC__ */
73 /* Variables exported by this file. */
74 Keymap rl_binding_keymap;
76 static char *_rl_read_file PARAMS((char *, size_t *));
77 static void _rl_init_file_error PARAMS((const char *));
78 static int _rl_read_init_file PARAMS((const char *, int));
79 static int glean_key_from_name PARAMS((char *));
80 static int find_boolean_var PARAMS((const char *));
82 static char *_rl_get_string_variable_value PARAMS((const char *));
83 static int substring_member_of_array PARAMS((char *, const char **));
85 static int currently_reading_init_file;
87 /* used only in this file */
88 static int _rl_prefer_visible_bell = 1;
90 /* **************************************************************** */
94 /* **************************************************************** */
96 /* rl_add_defun (char *name, rl_command_func_t *function, int key)
97 Add NAME to the list of named functions. Make FUNCTION be the function
98 that gets called. If KEY is not -1, then bind it. */
100 rl_add_defun (name, function, key)
102 rl_command_func_t *function;
106 rl_bind_key (key, function);
107 rl_add_funmap_entry (name, function);
111 /* Bind KEY to FUNCTION. Returns non-zero if KEY is out of range. */
113 rl_bind_key (key, function)
115 rl_command_func_t *function;
120 if (META_CHAR (key) && _rl_convert_meta_chars_to_ascii)
122 if (_rl_keymap[ESC].type == ISKMAP)
126 escmap = FUNCTION_TO_KEYMAP (_rl_keymap, ESC);
128 escmap[key].type = ISFUNC;
129 escmap[key].function = function;
135 _rl_keymap[key].type = ISFUNC;
136 _rl_keymap[key].function = function;
137 rl_binding_keymap = _rl_keymap;
141 /* Bind KEY to FUNCTION in MAP. Returns non-zero in case of invalid
144 rl_bind_key_in_map (key, function, map)
146 rl_command_func_t *function;
154 result = rl_bind_key (key, function);
159 /* Bind key sequence KEYSEQ to DEFAULT_FUNC if KEYSEQ is unbound. Right
160 now, this is always used to attempt to bind the arrow keys, hence the
161 check for rl_vi_movement_mode. */
163 rl_bind_key_if_unbound_in_map (key, default_func, kmap)
165 rl_command_func_t *default_func;
170 keyseq[0] = (unsigned char)key;
172 return (rl_bind_keyseq_if_unbound_in_map (keyseq, default_func, kmap));
176 rl_bind_key_if_unbound (key, default_func)
178 rl_command_func_t *default_func;
182 keyseq[0] = (unsigned char)key;
184 return (rl_bind_keyseq_if_unbound_in_map (keyseq, default_func, _rl_keymap));
187 /* Make KEY do nothing in the currently selected keymap.
188 Returns non-zero in case of error. */
193 return (rl_bind_key (key, (rl_command_func_t *)NULL));
196 /* Make KEY do nothing in MAP.
197 Returns non-zero in case of error. */
199 rl_unbind_key_in_map (key, map)
203 return (rl_bind_key_in_map (key, (rl_command_func_t *)NULL, map));
206 /* Unbind all keys bound to FUNCTION in MAP. */
208 rl_unbind_function_in_map (func, map)
209 rl_command_func_t *func;
212 register int i, rval;
214 for (i = rval = 0; i < KEYMAP_SIZE; i++)
216 if (map[i].type == ISFUNC && map[i].function == func)
218 map[i].function = (rl_command_func_t *)NULL;
226 rl_unbind_command_in_map (command, map)
230 rl_command_func_t *func;
232 func = rl_named_function (command);
235 return (rl_unbind_function_in_map (func, map));
238 /* Bind the key sequence represented by the string KEYSEQ to
239 FUNCTION, starting in the current keymap. This makes new
240 keymaps as necessary. */
242 rl_bind_keyseq (keyseq, function)
244 rl_command_func_t *function;
246 return (rl_generic_bind (ISFUNC, keyseq, (char *)function, _rl_keymap));
249 /* Bind the key sequence represented by the string KEYSEQ to
250 FUNCTION. This makes new keymaps as necessary. The initial
251 place to do bindings is in MAP. */
253 rl_bind_keyseq_in_map (keyseq, function, map)
255 rl_command_func_t *function;
258 return (rl_generic_bind (ISFUNC, keyseq, (char *)function, map));
261 /* Backwards compatibility; equivalent to rl_bind_keyseq_in_map() */
263 rl_set_key (keyseq, function, map)
265 rl_command_func_t *function;
268 return (rl_generic_bind (ISFUNC, keyseq, (char *)function, map));
271 /* Bind key sequence KEYSEQ to DEFAULT_FUNC if KEYSEQ is unbound. Right
272 now, this is always used to attempt to bind the arrow keys, hence the
273 check for rl_vi_movement_mode. */
275 rl_bind_keyseq_if_unbound_in_map (keyseq, default_func, kmap)
277 rl_command_func_t *default_func;
280 rl_command_func_t *func;
284 func = rl_function_of_keyseq (keyseq, kmap, (int *)NULL);
285 #if defined (VI_MODE)
286 if (!func || func == rl_do_lowercase_version || func == rl_vi_movement_mode)
288 if (!func || func == rl_do_lowercase_version)
290 return (rl_bind_keyseq_in_map (keyseq, default_func, kmap));
298 rl_bind_keyseq_if_unbound (keyseq, default_func)
300 rl_command_func_t *default_func;
302 return (rl_bind_keyseq_if_unbound_in_map (keyseq, default_func, _rl_keymap));
305 /* Bind the key sequence represented by the string KEYSEQ to
306 the string of characters MACRO. This makes new keymaps as
307 necessary. The initial place to do bindings is in MAP. */
309 rl_macro_bind (keyseq, macro, map)
310 const char *keyseq, *macro;
316 macro_keys = (char *)xmalloc ((2 * strlen (macro)) + 1);
318 if (rl_translate_keyseq (macro, macro_keys, ¯o_keys_len))
323 rl_generic_bind (ISMACR, keyseq, macro_keys, map);
327 /* Bind the key sequence represented by the string KEYSEQ to
328 the arbitrary pointer DATA. TYPE says what kind of data is
329 pointed to by DATA, right now this can be a function (ISFUNC),
330 a macro (ISMACR), or a keymap (ISKMAP). This makes new keymaps
331 as necessary. The initial place to do bindings is in MAP. */
333 rl_generic_bind (type, keyseq, data, map)
346 /* If no keys to bind to, exit right away. */
347 if (keyseq == 0 || *keyseq == 0)
354 keys = (char *)xmalloc (1 + (2 * strlen (keyseq)));
356 /* Translate the ASCII representation of KEYSEQ into an array of
357 characters. Stuff the characters into KEYS, and the length of
358 KEYS into KEYS_LEN. */
359 if (rl_translate_keyseq (keyseq, keys, &keys_len))
365 /* Bind keys, making new keymaps as necessary. */
366 for (i = 0; i < keys_len; i++)
368 unsigned char uc = keys[i];
372 if (ic < 0 || ic >= KEYMAP_SIZE)
378 if (META_CHAR (ic) && _rl_convert_meta_chars_to_ascii)
381 if (map[ESC].type == ISKMAP)
382 map = FUNCTION_TO_KEYMAP (map, ESC);
385 if ((i + 1) < keys_len)
387 if (map[ic].type != ISKMAP)
389 /* We allow subsequences of keys. If a keymap is being
390 created that will `shadow' an existing function or macro
391 key binding, we save that keybinding into the ANYOTHERKEY
392 index in the new map. The dispatch code will look there
393 to find the function to execute if the subsequence is not
394 matched. ANYOTHERKEY was chosen to be greater than
398 map[ic].type = ISKMAP;
399 map[ic].function = KEYMAP_TO_FUNCTION (rl_make_bare_keymap());
401 map = FUNCTION_TO_KEYMAP (map, ic);
402 /* The dispatch code will return this function if no matching
403 key sequence is found in the keymap. This (with a little
404 help from the dispatch code in readline.c) allows `a' to be
405 mapped to something, `abc' to be mapped to something else,
406 and the function bound to `a' to be executed when the user
407 types `abx', leaving `bx' in the input queue. */
408 if (k.function && ((k.type == ISFUNC && k.function != rl_do_lowercase_version) || k.type == ISMACR))
410 map[ANYOTHERKEY] = k;
416 if (map[ic].type == ISMACR)
417 free ((char *)map[ic].function);
418 else if (map[ic].type == ISKMAP)
420 map = FUNCTION_TO_KEYMAP (map, ic);
424 map[ic].function = KEYMAP_TO_FUNCTION (data);
428 rl_binding_keymap = map;
434 /* Translate the ASCII representation of SEQ, stuffing the values into ARRAY,
435 an array of characters. LEN gets the final length of ARRAY. Return
436 non-zero if there was an error parsing SEQ. */
438 rl_translate_keyseq (seq, array, len)
443 register int i, c, l, temp;
445 for (i = l = 0; c = seq[i]; i++)
454 /* Handle \C- and \M- prefixes. */
455 if ((c == 'C' || c == 'M') && seq[i + 1] == '-')
457 /* Handle special case of backwards define. */
458 if (strncmp (&seq[i], "C-\\M-", 5) == 0)
460 array[l++] = ESC; /* ESC is meta-prefix */
462 array[l++] = CTRL (_rl_to_upper (seq[i]));
468 i++; /* seq[i] == '-' */
469 /* XXX - obey convert-meta setting */
470 if (_rl_convert_meta_chars_to_ascii && _rl_keymap[ESC].type == ISKMAP)
471 array[l++] = ESC; /* ESC is meta-prefix */
472 else if (seq[i+1] == '\\' && seq[i+2] == 'C' && seq[i+3] == '-')
475 temp = (seq[i] == '?') ? RUBOUT : CTRL (_rl_to_upper (seq[i]));
476 array[l++] = META (temp);
480 /* This doesn't yet handle things like \M-\a, which may
481 or may not have any reasonable meaning. You're
482 probably better off using straight octal or hex. */
484 array[l++] = META (seq[i]);
490 /* Special hack for C-?... */
491 array[l++] = (seq[i] == '?') ? RUBOUT : CTRL (_rl_to_upper (seq[i]));
496 /* Translate other backslash-escaped characters. These are the
497 same escape sequences that bash's `echo' and `printf' builtins
498 handle, with the addition of \d -> RUBOUT. A backslash
499 preceding a character that is not special is stripped. */
509 array[l++] = RUBOUT; /* readline-specific */
518 array[l++] = NEWLINE;
532 case '0': case '1': case '2': case '3':
533 case '4': case '5': case '6': case '7':
535 for (temp = 2, c -= '0'; ISOCTAL (seq[i]) && temp--; i++)
536 c = (c * 8) + OCTVALUE (seq[i]);
537 i--; /* auto-increment in for loop */
538 array[l++] = c & largest_char;
542 for (temp = 2, c = 0; ISXDIGIT ((unsigned char)seq[i]) && temp--; i++)
543 c = (c * 16) + HEXVALUE (seq[i]);
546 i--; /* auto-increment in for loop */
547 array[l++] = c & largest_char;
549 default: /* backslashes before non-special chars just add the char */
551 break; /* the backslash is stripped */
565 rl_untranslate_keyseq (seq)
568 static char kseq[16];
585 else if (CTRL_CHAR (c))
590 c = _rl_to_lower (UNCTRL (c));
592 else if (c == RUBOUT)
605 else if (c == '\\' || c == '"')
610 kseq[i++] = (unsigned char) c;
616 _rl_untranslate_macro_value (seq)
622 r = ret = (char *)xmalloc (7 * strlen (seq) + 1);
623 for (s = seq; *s; s++)
638 else if (CTRL_CHAR (c))
643 c = _rl_to_lower (UNCTRL (c));
645 else if (c == RUBOUT)
658 else if (c == '\\' || c == '"')
661 *r++ = (unsigned char)c;
667 /* Return a pointer to the function that STRING represents.
668 If STRING doesn't have a matching function, then a NULL pointer
671 rl_named_function (string)
676 rl_initialize_funmap ();
678 for (i = 0; funmap[i]; i++)
679 if (_rl_stricmp (funmap[i]->name, string) == 0)
680 return (funmap[i]->function);
681 return ((rl_command_func_t *)NULL);
684 /* Return the function (or macro) definition which would be invoked via
685 KEYSEQ if executed in MAP. If MAP is NULL, then the current keymap is
686 used. TYPE, if non-NULL, is a pointer to an int which will receive the
687 type of the object pointed to. One of ISFUNC (function), ISKMAP (keymap),
688 or ISMACR (macro). */
690 rl_function_of_keyseq (keyseq, map, type)
700 for (i = 0; keyseq && keyseq[i]; i++)
702 unsigned char ic = keyseq[i];
704 if (META_CHAR (ic) && _rl_convert_meta_chars_to_ascii)
706 if (map[ESC].type == ISKMAP)
708 map = FUNCTION_TO_KEYMAP (map, ESC);
711 /* XXX - should we just return NULL here, since this obviously
716 *type = map[ESC].type;
718 return (map[ESC].function);
722 if (map[ic].type == ISKMAP)
724 /* If this is the last key in the key sequence, return the
726 if (keyseq[i + 1] == '\0')
731 return (map[ic].function);
734 map = FUNCTION_TO_KEYMAP (map, ic);
736 /* If we're not at the end of the key sequence, and the current key
737 is bound to something other than a keymap, then the entire key
738 sequence is not bound. */
739 else if (map[ic].type != ISKMAP && keyseq[i+1])
740 return ((rl_command_func_t *)NULL);
741 else /* map[ic].type != ISKMAP && keyseq[i+1] == 0 */
744 *type = map[ic].type;
746 return (map[ic].function);
749 return ((rl_command_func_t *) NULL);
752 /* The last key bindings file read. */
753 static char *last_readline_init_file = (char *)NULL;
755 /* The file we're currently reading key bindings from. */
756 static const char *current_readline_init_file;
757 static int current_readline_init_include_level;
758 static int current_readline_init_lineno;
760 /* Read FILENAME into a locally-allocated buffer and return the buffer.
761 The size of the buffer is returned in *SIZEP. Returns NULL if any
762 errors were encountered. */
764 _rl_read_file (filename, sizep)
773 if ((stat (filename, &finfo) < 0) || (file = open (filename, O_RDONLY, 0666)) < 0)
774 return ((char *)NULL);
776 file_size = (size_t)finfo.st_size;
778 /* check for overflow on very large files */
779 if (file_size != finfo.st_size || file_size + 1 < file_size)
786 return ((char *)NULL);
789 /* Read the file into BUFFER. */
790 buffer = (char *)xmalloc (file_size + 1);
791 i = read (file, buffer, file_size);
797 return ((char *)NULL);
807 /* Re-read the current keybindings file. */
809 rl_re_read_init_file (count, ignore)
813 r = rl_read_init_file ((const char *)NULL);
814 rl_set_keymap_from_edit_mode ();
818 /* Do key bindings from a file. If FILENAME is NULL it defaults
819 to the first non-null filename from this list:
820 1. the filename used for the previous call
821 2. the value of the shell variable `INPUTRC'
824 If the file existed and could be opened and read, 0 is returned,
825 otherwise errno is returned. */
827 rl_read_init_file (filename)
828 const char *filename;
830 /* Default the filename. */
832 filename = last_readline_init_file;
834 filename = sh_get_env_value ("INPUTRC");
835 if (filename == 0 || *filename == 0)
837 filename = DEFAULT_INPUTRC;
838 /* Try to read DEFAULT_INPUTRC; fall back to SYS_INPUTRC on failure */
839 if (_rl_read_init_file (filename, 0) == 0)
841 filename = SYS_INPUTRC;
844 #if defined (__MSDOS__)
845 if (_rl_read_init_file (filename, 0) == 0)
847 filename = "~/_inputrc";
849 return (_rl_read_init_file (filename, 0));
853 _rl_read_init_file (filename, include_level)
854 const char *filename;
858 char *buffer, *openname, *line, *end;
861 current_readline_init_file = filename;
862 current_readline_init_include_level = include_level;
864 openname = tilde_expand (filename);
865 buffer = _rl_read_file (openname, &file_size);
871 if (include_level == 0 && filename != last_readline_init_file)
873 FREE (last_readline_init_file);
874 last_readline_init_file = savestring (filename);
877 currently_reading_init_file = 1;
879 /* Loop over the lines in the file. Lines that start with `#' are
880 comments; all other lines are commands for readline initialization. */
881 current_readline_init_lineno = 1;
883 end = buffer + file_size;
886 /* Find the end of this line. */
887 for (i = 0; line + i != end && line[i] != '\n'; i++);
889 #if defined (__CYGWIN__)
890 /* ``Be liberal in what you accept.'' */
891 if (line[i] == '\n' && line[i-1] == '\r')
895 /* Mark end of line. */
898 /* Skip leading whitespace. */
899 while (*line && whitespace (*line))
905 /* If the line is not a comment, then parse it. */
906 if (*line && *line != '#')
907 rl_parse_and_bind (line);
909 /* Move to the next line. */
911 current_readline_init_lineno++;
915 currently_reading_init_file = 0;
920 _rl_init_file_error (msg)
923 if (currently_reading_init_file)
924 fprintf (stderr, "readline: %s: line %d: %s\n", current_readline_init_file,
925 current_readline_init_lineno, msg);
927 fprintf (stderr, "readline: %s\n", msg);
930 /* **************************************************************** */
932 /* Parser Directives */
934 /* **************************************************************** */
936 typedef int _rl_parser_func_t PARAMS((char *));
938 /* Things that mean `Control'. */
939 const char *_rl_possible_control_prefixes[] = {
940 "Control-", "C-", "CTRL-", (const char *)NULL
943 const char *_rl_possible_meta_prefixes[] = {
944 "Meta", "M-", (const char *)NULL
949 /* Calling programs set this to have their argv[0]. */
950 const char *rl_readline_name = "other";
952 /* Stack of previous values of parsing_conditionalized_out. */
953 static unsigned char *if_stack = (unsigned char *)NULL;
954 static int if_stack_depth;
955 static int if_stack_size;
957 /* Push _rl_parsing_conditionalized_out, and set parser state based
965 /* Push parser state. */
966 if (if_stack_depth + 1 >= if_stack_size)
969 if_stack = (unsigned char *)xmalloc (if_stack_size = 20);
971 if_stack = (unsigned char *)xrealloc (if_stack, if_stack_size += 20);
973 if_stack[if_stack_depth++] = _rl_parsing_conditionalized_out;
975 /* If parsing is turned off, then nothing can turn it back on except
976 for finding the matching endif. In that case, return right now. */
977 if (_rl_parsing_conditionalized_out)
980 /* Isolate first argument. */
981 for (i = 0; args[i] && !whitespace (args[i]); i++);
986 /* Handle "$if term=foo" and "$if mode=emacs" constructs. If this
987 isn't term=foo, or mode=emacs, then check to see if the first
988 word in ARGS is the same as the value stored in rl_readline_name. */
989 if (rl_terminal_name && _rl_strnicmp (args, "term=", 5) == 0)
993 /* Terminals like "aaa-60" are equivalent to "aaa". */
994 tname = savestring (rl_terminal_name);
995 tem = strchr (tname, '-');
999 /* Test the `long' and `short' forms of the terminal name so that
1000 if someone has a `sun-cmd' and does not want to have bindings
1001 that will be executed if the terminal is a `sun', they can put
1002 `$if term=sun-cmd' into their .inputrc. */
1003 _rl_parsing_conditionalized_out = _rl_stricmp (args + 5, tname) &&
1004 _rl_stricmp (args + 5, rl_terminal_name);
1007 #if defined (VI_MODE)
1008 else if (_rl_strnicmp (args, "mode=", 5) == 0)
1012 if (_rl_stricmp (args + 5, "emacs") == 0)
1014 else if (_rl_stricmp (args + 5, "vi") == 0)
1019 _rl_parsing_conditionalized_out = mode != rl_editing_mode;
1021 #endif /* VI_MODE */
1022 /* Check to see if the first word in ARGS is the same as the
1023 value stored in rl_readline_name. */
1024 else if (_rl_stricmp (args, rl_readline_name) == 0)
1025 _rl_parsing_conditionalized_out = 0;
1027 _rl_parsing_conditionalized_out = 1;
1031 /* Invert the current parser state if there is anything on the stack. */
1038 if (if_stack_depth == 0)
1040 _rl_init_file_error ("$else found without matching $if");
1045 /* Check the previous (n - 1) levels of the stack to make sure that
1046 we haven't previously turned off parsing. */
1047 for (i = 0; i < if_stack_depth - 1; i++)
1049 /* Check the previous (n) levels of the stack to make sure that
1050 we haven't previously turned off parsing. */
1051 for (i = 0; i < if_stack_depth; i++)
1053 if (if_stack[i] == 1)
1056 /* Invert the state of parsing if at top level. */
1057 _rl_parsing_conditionalized_out = !_rl_parsing_conditionalized_out;
1061 /* Terminate a conditional, popping the value of
1062 _rl_parsing_conditionalized_out from the stack. */
1068 _rl_parsing_conditionalized_out = if_stack[--if_stack_depth];
1070 _rl_init_file_error ("$endif without matching $if");
1075 parser_include (args)
1078 const char *old_init_file;
1080 int old_line_number, old_include_level, r;
1082 if (_rl_parsing_conditionalized_out)
1085 old_init_file = current_readline_init_file;
1086 old_line_number = current_readline_init_lineno;
1087 old_include_level = current_readline_init_include_level;
1089 e = strchr (args, '\n');
1092 r = _rl_read_init_file ((const char *)args, old_include_level + 1);
1094 current_readline_init_file = old_init_file;
1095 current_readline_init_lineno = old_line_number;
1096 current_readline_init_include_level = old_include_level;
1101 /* Associate textual names with actual functions. */
1104 _rl_parser_func_t *function;
1105 } parser_directives [] = {
1106 { "if", parser_if },
1107 { "endif", parser_endif },
1108 { "else", parser_else },
1109 { "include", parser_include },
1110 { (char *)0x0, (_rl_parser_func_t *)0x0 }
1113 /* Handle a parser directive. STATEMENT is the line of the directive
1114 without any leading `$'. */
1116 handle_parser_directive (statement)
1120 char *directive, *args;
1122 /* Isolate the actual directive. */
1124 /* Skip whitespace. */
1125 for (i = 0; whitespace (statement[i]); i++);
1127 directive = &statement[i];
1129 for (; statement[i] && !whitespace (statement[i]); i++);
1132 statement[i++] = '\0';
1134 for (; statement[i] && whitespace (statement[i]); i++);
1136 args = &statement[i];
1138 /* Lookup the command, and act on it. */
1139 for (i = 0; parser_directives[i].name; i++)
1140 if (_rl_stricmp (directive, parser_directives[i].name) == 0)
1142 (*parser_directives[i].function) (args);
1146 /* display an error message about the unknown parser directive */
1147 _rl_init_file_error ("unknown parser directive");
1151 /* Read the binding command from STRING and perform it.
1152 A key binding command looks like: Keyname: function-name\0,
1153 a variable binding command looks like: set variable value.
1154 A new-style keybinding looks like "\C-x\C-x": exchange-point-and-mark. */
1156 rl_parse_and_bind (string)
1159 char *funname, *kname;
1161 int key, equivalency;
1163 while (string && whitespace (*string))
1166 if (!string || !*string || *string == '#')
1169 /* If this is a parser directive, act on it. */
1172 handle_parser_directive (&string[1]);
1176 /* If we aren't supposed to be parsing right now, then we're done. */
1177 if (_rl_parsing_conditionalized_out)
1181 /* If this keyname is a complex key expression surrounded by quotes,
1182 advance to after the matching close quote. This code allows the
1183 backslash to quote characters in the key expression. */
1188 for (i = 1; c = string[i]; i++)
1205 /* If we didn't find a closing quote, abort the line. */
1206 if (string[i] == '\0')
1208 _rl_init_file_error ("no closing `\"' in key binding");
1213 /* Advance to the colon (:) or whitespace which separates the two objects. */
1214 for (; (c = string[i]) && c != ':' && c != ' ' && c != '\t'; i++ );
1216 equivalency = (c == ':' && string[i + 1] == '=');
1218 /* Mark the end of the command (or keyname). */
1222 /* If doing assignment, skip the '=' sign as well. */
1226 /* If this is a command to set a variable, then do that. */
1227 if (_rl_stricmp (string, "set") == 0)
1229 char *var, *value, *e;
1232 /* Make VAR point to start of variable name. */
1233 while (*var && whitespace (*var)) var++;
1235 /* Make VALUE point to start of value string. */
1237 while (*value && !whitespace (*value)) value++;
1240 while (*value && whitespace (*value)) value++;
1242 /* Strip trailing whitespace from values to boolean variables. Temp
1243 fix until I get a real quoted-string parser here. */
1244 i = find_boolean_var (var);
1247 /* remove trailing whitespace */
1248 e = value + strlen (value) - 1;
1249 while (e >= value && whitespace (*e))
1251 e++; /* skip back to whitespace or EOS */
1252 if (*e && e >= value)
1256 rl_variable_bind (var, value);
1260 /* Skip any whitespace between keyname and funname. */
1261 for (; string[i] && whitespace (string[i]); i++);
1262 funname = &string[i];
1264 /* Now isolate funname.
1265 For straight function names just look for whitespace, since
1266 that will signify the end of the string. But this could be a
1267 macro definition. In that case, the string is quoted, so skip
1268 to the matching delimiter. We allow the backslash to quote the
1269 delimiter characters in the macro body. */
1270 /* This code exists to allow whitespace in macro expansions, which
1271 would otherwise be gobbled up by the next `for' loop.*/
1272 /* XXX - it may be desirable to allow backslash quoting only if " is
1273 the quoted string delimiter, like the shell. */
1274 if (*funname == '\'' || *funname == '"')
1276 int delimiter, passc;
1278 delimiter = string[i++];
1279 for (passc = 0; c = string[i]; i++)
1300 /* Advance to the end of the string. */
1301 for (; string[i] && !whitespace (string[i]); i++);
1303 /* No extra whitespace at the end of the string. */
1306 /* Handle equivalency bindings here. Make the left-hand side be exactly
1307 whatever the right-hand evaluates to, including keymaps. */
1313 /* If this is a new-style key-binding, then do the binding with
1314 rl_bind_keyseq (). Otherwise, let the older code deal with it. */
1318 register int j, k, passc;
1320 seq = (char *)xmalloc (1 + strlen (string));
1321 for (j = 1, k = passc = 0; string[j]; j++)
1323 /* Allow backslash to quote characters, but leave them in place.
1324 This allows a string to end with a backslash quoting another
1325 backslash, or with a backslash quoting a double quote. The
1326 backslashes are left in place for rl_translate_keyseq (). */
1327 if (passc || (string[j] == '\\'))
1329 seq[k++] = string[j];
1334 if (string[j] == '"')
1337 seq[k++] = string[j];
1341 /* Binding macro? */
1342 if (*funname == '\'' || *funname == '"')
1344 j = strlen (funname);
1346 /* Remove the delimiting quotes from each end of FUNNAME. */
1347 if (j && funname[j - 1] == *funname)
1348 funname[j - 1] = '\0';
1350 rl_macro_bind (seq, &funname[1], _rl_keymap);
1353 rl_bind_keyseq (seq, rl_named_function (funname));
1359 /* Get the actual character we want to deal with. */
1360 kname = strrchr (string, '-');
1366 key = glean_key_from_name (kname);
1368 /* Add in control and meta bits. */
1369 if (substring_member_of_array (string, _rl_possible_control_prefixes))
1370 key = CTRL (_rl_to_upper (key));
1372 if (substring_member_of_array (string, _rl_possible_meta_prefixes))
1375 /* Temporary. Handle old-style keyname with macro-binding. */
1376 if (*funname == '\'' || *funname == '"')
1379 int fl = strlen (funname);
1381 useq[0] = key; useq[1] = '\0';
1382 if (fl && funname[fl - 1] == *funname)
1383 funname[fl - 1] = '\0';
1385 rl_macro_bind (useq, &funname[1], _rl_keymap);
1387 #if defined (PREFIX_META_HACK)
1388 /* Ugly, but working hack to keep prefix-meta around. */
1389 else if (_rl_stricmp (funname, "prefix-meta") == 0)
1395 rl_generic_bind (ISKMAP, seq, (char *)emacs_meta_keymap, _rl_keymap);
1397 #endif /* PREFIX_META_HACK */
1399 rl_bind_key (key, rl_named_function (funname));
1403 /* Simple structure for boolean readline variables (i.e., those that can
1404 have one of two values; either "On" or 1 for truth, or "Off" or 0 for
1407 #define V_SPECIAL 0x1
1413 } boolean_varlist [] = {
1414 { "bind-tty-special-chars", &_rl_bind_stty_chars, 0 },
1415 { "blink-matching-paren", &rl_blink_matching_paren, V_SPECIAL },
1416 { "byte-oriented", &rl_byte_oriented, 0 },
1417 { "completion-ignore-case", &_rl_completion_case_fold, 0 },
1418 { "convert-meta", &_rl_convert_meta_chars_to_ascii, 0 },
1419 { "disable-completion", &rl_inhibit_completion, 0 },
1420 { "enable-keypad", &_rl_enable_keypad, 0 },
1421 { "expand-tilde", &rl_complete_with_tilde_expansion, 0 },
1422 { "history-preserve-point", &_rl_history_preserve_point, 0 },
1423 { "horizontal-scroll-mode", &_rl_horizontal_scroll_mode, 0 },
1424 { "input-meta", &_rl_meta_flag, 0 },
1425 { "mark-directories", &_rl_complete_mark_directories, 0 },
1426 { "mark-modified-lines", &_rl_mark_modified_lines, 0 },
1427 { "mark-symlinked-directories", &_rl_complete_mark_symlink_dirs, 0 },
1428 { "match-hidden-files", &_rl_match_hidden_files, 0 },
1429 { "meta-flag", &_rl_meta_flag, 0 },
1430 { "output-meta", &_rl_output_meta_chars, 0 },
1431 { "page-completions", &_rl_page_completions, 0 },
1432 { "prefer-visible-bell", &_rl_prefer_visible_bell, V_SPECIAL },
1433 { "print-completions-horizontally", &_rl_print_completions_horizontally, 0 },
1434 { "show-all-if-ambiguous", &_rl_complete_show_all, 0 },
1435 { "show-all-if-unmodified", &_rl_complete_show_unmodified, 0 },
1436 #if defined (VISIBLE_STATS)
1437 { "visible-stats", &rl_visible_stats, 0 },
1438 #endif /* VISIBLE_STATS */
1439 { (char *)NULL, (int *)NULL }
1443 find_boolean_var (name)
1448 for (i = 0; boolean_varlist[i].name; i++)
1449 if (_rl_stricmp (name, boolean_varlist[i].name) == 0)
1454 /* Hooks for handling special boolean variables, where a
1455 function needs to be called or another variable needs
1456 to be changed when they're changed. */
1458 hack_special_boolean_var (i)
1463 name = boolean_varlist[i].name;
1465 if (_rl_stricmp (name, "blink-matching-paren") == 0)
1466 _rl_enable_paren_matching (rl_blink_matching_paren);
1467 else if (_rl_stricmp (name, "prefer-visible-bell") == 0)
1469 if (_rl_prefer_visible_bell)
1470 _rl_bell_preference = VISIBLE_BELL;
1472 _rl_bell_preference = AUDIBLE_BELL;
1476 typedef int _rl_sv_func_t PARAMS((const char *));
1478 /* These *must* correspond to the array indices for the appropriate
1479 string variable. (Though they're not used right now.) */
1480 #define V_BELLSTYLE 0
1481 #define V_COMBEGIN 1
1482 #define V_EDITMODE 2
1483 #define V_ISRCHTERM 3
1489 /* Forward declarations */
1490 static int sv_bell_style PARAMS((const char *));
1491 static int sv_combegin PARAMS((const char *));
1492 static int sv_compquery PARAMS((const char *));
1493 static int sv_editmode PARAMS((const char *));
1494 static int sv_isrchterm PARAMS((const char *));
1495 static int sv_keymap PARAMS((const char *));
1500 _rl_sv_func_t *set_func;
1501 } string_varlist[] = {
1502 { "bell-style", V_STRING, sv_bell_style },
1503 { "comment-begin", V_STRING, sv_combegin },
1504 { "completion-query-items", V_INT, sv_compquery },
1505 { "editing-mode", V_STRING, sv_editmode },
1506 { "isearch-terminators", V_STRING, sv_isrchterm },
1507 { "keymap", V_STRING, sv_keymap },
1512 find_string_var (name)
1517 for (i = 0; string_varlist[i].name; i++)
1518 if (_rl_stricmp (name, string_varlist[i].name) == 0)
1523 /* A boolean value that can appear in a `set variable' command is true if
1524 the value is null or empty, `on' (case-insenstive), or "1". Any other
1525 values result in 0 (false). */
1530 return (value == 0 || *value == '\0' ||
1531 (_rl_stricmp (value, "on") == 0) ||
1532 (value[0] == '1' && value[1] == '\0'));
1536 rl_variable_value (name)
1541 /* Check for simple variables first. */
1542 i = find_boolean_var (name);
1544 return (*boolean_varlist[i].value ? "on" : "off");
1546 i = find_string_var (name);
1548 return (_rl_get_string_variable_value (string_varlist[i].name));
1550 /* Unknown variable names return NULL. */
1555 rl_variable_bind (name, value)
1556 const char *name, *value;
1561 /* Check for simple variables first. */
1562 i = find_boolean_var (name);
1565 *boolean_varlist[i].value = bool_to_int (value);
1566 if (boolean_varlist[i].flags & V_SPECIAL)
1567 hack_special_boolean_var (i);
1571 i = find_string_var (name);
1573 /* For the time being, unknown variable names or string names without a
1574 handler function are simply ignored. */
1575 if (i < 0 || string_varlist[i].set_func == 0)
1578 v = (*string_varlist[i].set_func) (value);
1586 if (_rl_strnicmp (value, "vi", 2) == 0)
1588 #if defined (VI_MODE)
1589 _rl_keymap = vi_insertion_keymap;
1590 rl_editing_mode = vi_mode;
1591 #endif /* VI_MODE */
1594 else if (_rl_strnicmp (value, "emacs", 5) == 0)
1596 _rl_keymap = emacs_standard_keymap;
1597 rl_editing_mode = emacs_mode;
1607 if (value && *value)
1609 FREE (_rl_comment_begin);
1610 _rl_comment_begin = savestring (value);
1617 sv_compquery (value)
1622 if (value && *value)
1624 nval = atoi (value);
1628 rl_completion_query_items = nval;
1638 kmap = rl_get_keymap_by_name (value);
1641 rl_set_keymap (kmap);
1648 sv_bell_style (value)
1651 if (value == 0 || *value == '\0')
1652 _rl_bell_preference = AUDIBLE_BELL;
1653 else if (_rl_stricmp (value, "none") == 0 || _rl_stricmp (value, "off") == 0)
1654 _rl_bell_preference = NO_BELL;
1655 else if (_rl_stricmp (value, "audible") == 0 || _rl_stricmp (value, "on") == 0)
1656 _rl_bell_preference = AUDIBLE_BELL;
1657 else if (_rl_stricmp (value, "visible") == 0)
1658 _rl_bell_preference = VISIBLE_BELL;
1665 sv_isrchterm (value)
1668 int beg, end, delim;
1674 /* Isolate the value and translate it into a character string. */
1675 v = savestring (value);
1676 FREE (_rl_isearch_terminators);
1677 if (v[0] == '"' || v[0] == '\'')
1680 for (beg = end = 1; v[end] && v[end] != delim; end++)
1685 for (beg = end = 0; whitespace (v[end]) == 0; end++)
1691 /* The value starts at v + beg. Translate it into a character string. */
1692 _rl_isearch_terminators = (char *)xmalloc (2 * strlen (v) + 1);
1693 rl_translate_keyseq (v + beg, _rl_isearch_terminators, &end);
1694 _rl_isearch_terminators[end] = '\0';
1700 /* Return the character which matches NAME.
1701 For example, `Space' returns ' '. */
1708 static assoc_list name_key_alist[] = {
1711 { "Escape", '\033' },
1713 { "Newline", '\n' },
1724 glean_key_from_name (name)
1729 for (i = 0; name_key_alist[i].name; i++)
1730 if (_rl_stricmp (name, name_key_alist[i].name) == 0)
1731 return (name_key_alist[i].value);
1733 return (*(unsigned char *)name); /* XXX was return (*name) */
1736 /* Auxiliary functions to manage keymaps. */
1740 } keymap_names[] = {
1741 { "emacs", emacs_standard_keymap },
1742 { "emacs-standard", emacs_standard_keymap },
1743 { "emacs-meta", emacs_meta_keymap },
1744 { "emacs-ctlx", emacs_ctlx_keymap },
1745 #if defined (VI_MODE)
1746 { "vi", vi_movement_keymap },
1747 { "vi-move", vi_movement_keymap },
1748 { "vi-command", vi_movement_keymap },
1749 { "vi-insert", vi_insertion_keymap },
1750 #endif /* VI_MODE */
1751 { (char *)0x0, (Keymap)0x0 }
1755 rl_get_keymap_by_name (name)
1760 for (i = 0; keymap_names[i].name; i++)
1761 if (_rl_stricmp (name, keymap_names[i].name) == 0)
1762 return (keymap_names[i].map);
1763 return ((Keymap) NULL);
1767 rl_get_keymap_name (map)
1771 for (i = 0; keymap_names[i].name; i++)
1772 if (map == keymap_names[i].map)
1773 return ((char *)keymap_names[i].name);
1774 return ((char *)NULL);
1788 return (_rl_keymap);
1792 rl_set_keymap_from_edit_mode ()
1794 if (rl_editing_mode == emacs_mode)
1795 _rl_keymap = emacs_standard_keymap;
1796 #if defined (VI_MODE)
1797 else if (rl_editing_mode == vi_mode)
1798 _rl_keymap = vi_insertion_keymap;
1799 #endif /* VI_MODE */
1803 rl_get_keymap_name_from_edit_mode ()
1805 if (rl_editing_mode == emacs_mode)
1807 #if defined (VI_MODE)
1808 else if (rl_editing_mode == vi_mode)
1810 #endif /* VI_MODE */
1815 /* **************************************************************** */
1817 /* Key Binding and Function Information */
1819 /* **************************************************************** */
1821 /* Each of the following functions produces information about the
1822 state of keybindings and functions known to Readline. The info
1823 is always printed to rl_outstream, and in such a way that it can
1824 be read back in (i.e., passed to rl_parse_and_bind ()). */
1826 /* Print the names of functions known to Readline. */
1828 rl_list_funmap_names ()
1831 const char **funmap_names;
1833 funmap_names = rl_funmap_names ();
1838 for (i = 0; funmap_names[i]; i++)
1839 fprintf (rl_outstream, "%s\n", funmap_names[i]);
1841 free (funmap_names);
1845 _rl_get_keyname (key)
1851 keyname = (char *)xmalloc (8);
1854 /* Since this is going to be used to write out keysequence-function
1855 pairs for possible inclusion in an inputrc file, we don't want to
1856 do any special meta processing on KEY. */
1859 /* XXX - Experimental */
1860 /* We might want to do this, but the old version of the code did not. */
1862 /* If this is an escape character, we don't want to do any more processing.
1863 Just add the special ESC key sequence and return. */
1873 /* RUBOUT is translated directly into \C-? */
1885 /* Now add special prefixes needed for control characters. This can
1886 potentially change C. */
1889 keyname[i++] = '\\';
1892 c = _rl_to_lower (UNCTRL (c));
1895 /* XXX experimental code. Turn the characters that are not ASCII or
1896 ISO Latin 1 (128 - 159) into octal escape sequences (\200 - \237).
1898 if (c >= 128 && c <= 159)
1900 keyname[i++] = '\\';
1903 keyname[i++] = (c / 8) + '0';
1907 /* Now, if the character needs to be quoted with a backslash, do that. */
1908 if (c == '\\' || c == '"')
1909 keyname[i++] = '\\';
1911 /* Now add the key, terminate the string, and return it. */
1912 keyname[i++] = (char) c;
1918 /* Return a NULL terminated array of strings which represent the key
1919 sequences that are used to invoke FUNCTION in MAP. */
1921 rl_invoking_keyseqs_in_map (function, map)
1922 rl_command_func_t *function;
1927 int result_index, result_size;
1929 result = (char **)NULL;
1930 result_index = result_size = 0;
1932 for (key = 0; key < KEYMAP_SIZE; key++)
1934 switch (map[key].type)
1937 /* Macros match, if, and only if, the pointers are identical.
1938 Thus, they are treated exactly like functions in here. */
1940 /* If the function in the keymap is the one we are looking for,
1941 then add the current KEY to the list of invoking keys. */
1942 if (map[key].function == function)
1946 keyname = _rl_get_keyname (key);
1948 if (result_index + 2 > result_size)
1951 result = (char **)xrealloc (result, result_size * sizeof (char *));
1954 result[result_index++] = keyname;
1955 result[result_index] = (char *)NULL;
1964 /* Find the list of keyseqs in this map which have FUNCTION as
1965 their target. Add the key sequences found to RESULT. */
1966 if (map[key].function)
1968 rl_invoking_keyseqs_in_map (function, FUNCTION_TO_KEYMAP (map, key));
1975 for (i = 0; seqs[i]; i++)
1977 char *keyname = (char *)xmalloc (6 + strlen (seqs[i]));
1981 /* If ESC is the meta prefix and we're converting chars
1982 with the eighth bit set to ESC-prefixed sequences, then
1983 we can use \M-. Otherwise we need to use the sequence
1985 if (_rl_convert_meta_chars_to_ascii && map[ESC].type == ISKMAP)
1986 sprintf (keyname, "\\M-");
1988 sprintf (keyname, "\\e");
1990 else if (CTRL_CHAR (key))
1991 sprintf (keyname, "\\C-%c", _rl_to_lower (UNCTRL (key)));
1992 else if (key == RUBOUT)
1993 sprintf (keyname, "\\C-?");
1994 else if (key == '\\' || key == '"')
1997 keyname[1] = (char) key;
2002 keyname[0] = (char) key;
2006 strcat (keyname, seqs[i]);
2009 if (result_index + 2 > result_size)
2012 result = (char **)xrealloc (result, result_size * sizeof (char *));
2015 result[result_index++] = keyname;
2016 result[result_index] = (char *)NULL;
2027 /* Return a NULL terminated array of strings which represent the key
2028 sequences that can be used to invoke FUNCTION using the current keymap. */
2030 rl_invoking_keyseqs (function)
2031 rl_command_func_t *function;
2033 return (rl_invoking_keyseqs_in_map (function, _rl_keymap));
2036 /* Print all of the functions and their bindings to rl_outstream. If
2037 PRINT_READABLY is non-zero, then print the output in such a way
2038 that it can be read back in. */
2040 rl_function_dumper (print_readably)
2047 names = rl_funmap_names ();
2049 fprintf (rl_outstream, "\n");
2051 for (i = 0; name = names[i]; i++)
2053 rl_command_func_t *function;
2056 function = rl_named_function (name);
2057 invokers = rl_invoking_keyseqs_in_map (function, _rl_keymap);
2062 fprintf (rl_outstream, "# %s (not bound)\n", name);
2067 for (j = 0; invokers[j]; j++)
2069 fprintf (rl_outstream, "\"%s\": %s\n",
2080 fprintf (rl_outstream, "%s is not bound to any keys\n",
2086 fprintf (rl_outstream, "%s can be found on ", name);
2088 for (j = 0; invokers[j] && j < 5; j++)
2090 fprintf (rl_outstream, "\"%s\"%s", invokers[j],
2091 invokers[j + 1] ? ", " : ".\n");
2094 if (j == 5 && invokers[j])
2095 fprintf (rl_outstream, "...\n");
2097 for (j = 0; invokers[j]; j++)
2106 /* Print all of the current functions and their bindings to
2107 rl_outstream. If an explicit argument is given, then print
2108 the output in such a way that it can be read back in. */
2110 rl_dump_functions (count, key)
2114 fprintf (rl_outstream, "\r\n");
2115 rl_function_dumper (rl_explicit_arg);
2121 _rl_macro_dumper_internal (print_readably, map, prefix)
2127 char *keyname, *out;
2130 for (key = 0; key < KEYMAP_SIZE; key++)
2132 switch (map[key].type)
2135 keyname = _rl_get_keyname (key);
2136 out = _rl_untranslate_macro_value ((char *)map[key].function);
2139 fprintf (rl_outstream, "\"%s%s\": \"%s\"\n", prefix ? prefix : "",
2143 fprintf (rl_outstream, "%s%s outputs %s\n", prefix ? prefix : "",
2152 prefix_len = prefix ? strlen (prefix) : 0;
2155 keyname = (char *)xmalloc (3 + prefix_len);
2157 strcpy (keyname, prefix);
2158 keyname[prefix_len] = '\\';
2159 keyname[prefix_len + 1] = 'e';
2160 keyname[prefix_len + 2] = '\0';
2164 keyname = _rl_get_keyname (key);
2167 out = (char *)xmalloc (strlen (keyname) + prefix_len + 1);
2168 strcpy (out, prefix);
2169 strcpy (out + prefix_len, keyname);
2175 _rl_macro_dumper_internal (print_readably, FUNCTION_TO_KEYMAP (map, key), keyname);
2183 rl_macro_dumper (print_readably)
2186 _rl_macro_dumper_internal (print_readably, _rl_keymap, (char *)NULL);
2190 rl_dump_macros (count, key)
2194 fprintf (rl_outstream, "\r\n");
2195 rl_macro_dumper (rl_explicit_arg);
2201 _rl_get_string_variable_value (name)
2204 static char numbuf[32];
2207 if (_rl_stricmp (name, "bell-style") == 0)
2209 switch (_rl_bell_preference)
2220 else if (_rl_stricmp (name, "comment-begin") == 0)
2221 return (_rl_comment_begin ? _rl_comment_begin : RL_COMMENT_BEGIN_DEFAULT);
2222 else if (_rl_stricmp (name, "completion-query-items") == 0)
2224 sprintf (numbuf, "%d", rl_completion_query_items);
2227 else if (_rl_stricmp (name, "editing-mode") == 0)
2228 return (rl_get_keymap_name_from_edit_mode ());
2229 else if (_rl_stricmp (name, "isearch-terminators") == 0)
2231 if (_rl_isearch_terminators == 0)
2233 ret = _rl_untranslate_macro_value (_rl_isearch_terminators);
2236 strncpy (numbuf, ret, sizeof (numbuf) - 1);
2238 numbuf[sizeof(numbuf) - 1] = '\0';
2244 else if (_rl_stricmp (name, "keymap") == 0)
2246 ret = rl_get_keymap_name (_rl_keymap);
2248 ret = rl_get_keymap_name_from_edit_mode ();
2249 return (ret ? ret : "none");
2256 rl_variable_dumper (print_readably)
2262 for (i = 0; boolean_varlist[i].name; i++)
2265 fprintf (rl_outstream, "set %s %s\n", boolean_varlist[i].name,
2266 *boolean_varlist[i].value ? "on" : "off");
2268 fprintf (rl_outstream, "%s is set to `%s'\n", boolean_varlist[i].name,
2269 *boolean_varlist[i].value ? "on" : "off");
2272 for (i = 0; string_varlist[i].name; i++)
2274 v = _rl_get_string_variable_value (string_varlist[i].name);
2275 if (v == 0) /* _rl_isearch_terminators can be NULL */
2278 fprintf (rl_outstream, "set %s %s\n", string_varlist[i].name, v);
2280 fprintf (rl_outstream, "%s is set to `%s'\n", string_varlist[i].name, v);
2284 /* Print all of the current variables and their values to
2285 rl_outstream. If an explicit argument is given, then print
2286 the output in such a way that it can be read back in. */
2288 rl_dump_variables (count, key)
2292 fprintf (rl_outstream, "\r\n");
2293 rl_variable_dumper (rl_explicit_arg);
2298 /* Return non-zero if any members of ARRAY are a substring in STRING. */
2300 substring_member_of_array (string, array)
2306 if (_rl_strindex (string, *array))