summaryrefslogtreecommitdiffstats
path: root/contrib/libreadline
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/libreadline')
-rw-r--r--contrib/libreadline/STANDALONE32
-rw-r--r--contrib/libreadline/complete.c824
-rw-r--r--contrib/libreadline/doc/Makefile69
-rw-r--r--contrib/libreadline/doc/readline.3131
-rw-r--r--contrib/libreadline/examples/Makefile19
-rw-r--r--contrib/libreadline/readline.3131
-rw-r--r--contrib/libreadline/readline.h21
-rw-r--r--contrib/libreadline/rlconf.h2
-rw-r--r--contrib/libreadline/shell.c11
-rw-r--r--contrib/libreadline/util.c62
10 files changed, 409 insertions, 893 deletions
diff --git a/contrib/libreadline/STANDALONE b/contrib/libreadline/STANDALONE
deleted file mode 100644
index f999e8d..0000000
--- a/contrib/libreadline/STANDALONE
+++ /dev/null
@@ -1,32 +0,0 @@
-This is a description of C preprocessor defines that readline accepts.
-Most are passed in from the parent `make'; e.g. from the bash source
-directory.
-
-NO_SYS_FILE <sys/file.h> is not present
-HAVE_UNISTD_H <unistd.h> exists
-HAVE_STDLIB_H <stdlib.h> exists
-HAVE_VARARGS_H <varargs.h> exists and is usable
-HAVE_STRING_H <string.h> exists
-HAVE_ALLOCA_H <alloca.h> exists and is needed for alloca()
-HAVE_ALLOCA alloca(3) or a define for it exists
-PRAGMA_ALLOCA use of alloca() requires a #pragma, as in AIX 3.x
-VOID_SIGHANDLER signal handlers are void functions
-HAVE_DIRENT_H <dirent.h> exists and is usable
-HAVE_SYS_PTEM_H <sys/ptem.h> exists
-HAVE_SYS_PTE_H <sys/pte.h> exists
-HAVE_SYS_STREAM_H <sys/stream.h> exists
-HAVE_SYS_SELECT_H <sys/select.h> exists
-
-System-specific options:
-
-GWINSZ_IN_SYS_IOCTL need to include <sys/ioctl.h> for TIOCGWINSZ
-HAVE_GETPW_DECLS the getpw* functions are declared in <pwd.h> and cannot
- be redeclared without compiler errors
-HAVE_STRCASECMP the strcasecmp and strncasecmp functions are available
-
-USG Running a variant of System V
-USGr3 Running System V.3
-XENIX_22 Xenix 2.2
-Linux Linux
-CRAY running a recent version of Cray UNICOS
-SunOS4 Running SunOS 4.x
diff --git a/contrib/libreadline/complete.c b/contrib/libreadline/complete.c
index 985e898..552cb6c 100644
--- a/contrib/libreadline/complete.c
+++ b/contrib/libreadline/complete.c
@@ -75,7 +75,6 @@ extern char *tilde_expand ();
extern char *rl_copy_text ();
extern void _rl_abort_internal ();
extern int _rl_qsort_string_compare ();
-extern void _rl_replace_text ();
extern Function *rl_last_func;
extern int rl_editing_mode;
@@ -89,32 +88,26 @@ extern int rl_display_fixed;
char *filename_completion_function ();
char **completion_matches ();
-#if defined (VISIBLE_STATS)
-# if !defined (X_OK)
-# define X_OK 1
-# endif
-static int stat_char ();
-#endif
-
static char *rl_quote_filename ();
static char *rl_strpbrk ();
static char **remove_duplicate_matches ();
+static void insert_text ();
static void insert_match ();
-static int append_to_match ();
+static void append_to_match ();
static void insert_all_matches ();
static void display_matches ();
static int compute_lcd_of_matches ();
extern char *xmalloc (), *xrealloc ();
-/* **************************************************************** */
-/* */
-/* Completion matching, from readline's point of view. */
-/* */
-/* **************************************************************** */
+/* If non-zero, then this is the address of a function to call when
+ completing on a directory name. The function is called with
+ the address of a string (the current directory name) as an arg. */
+Function *rl_directory_completion_hook = (Function *)NULL;
-/* Variables known only to the readline library. */
+/* Non-zero means readline completion functions perform tilde expansion. */
+int rl_complete_with_tilde_expansion = 0;
/* If non-zero, non-unique completions always show the list of matches. */
int _rl_complete_show_all = 0;
@@ -122,29 +115,27 @@ int _rl_complete_show_all = 0;
/* If non-zero, completed directory names have a slash appended. */
int _rl_complete_mark_directories = 1;
-/* If non-zero, completions are printed horizontally in alphabetical order,
- like `ls -x'. */
-int _rl_print_completions_horizontally;
-
-/* Non-zero means that case is not significant in filename completion. */
-int _rl_completion_case_fold;
+#if defined (VISIBLE_STATS)
+# if !defined (X_OK)
+# define X_OK 1
+# endif
-/* Global variables available to applications using readline. */
+static int stat_char ();
-#if defined (VISIBLE_STATS)
/* Non-zero means add an additional character to each filename displayed
during listing completion iff rl_filename_completion_desired which helps
to indicate the type of file being listed. */
int rl_visible_stats = 0;
#endif /* VISIBLE_STATS */
-/* If non-zero, then this is the address of a function to call when
- completing on a directory name. The function is called with
- the address of a string (the current directory name) as an arg. */
-Function *rl_directory_completion_hook = (Function *)NULL;
+/* **************************************************************** */
+/* */
+/* Completion matching, from readline's point of view. */
+/* */
+/* **************************************************************** */
-/* Non-zero means readline completion functions perform tilde expansion. */
-int rl_complete_with_tilde_expansion = 0;
+/* Local variable states what happened during the last completion attempt. */
+static int completion_changed_buffer;
/* Pointer to the generator function for completion_matches ().
NULL means to use filename_completion_function (), the default filename
@@ -251,17 +242,6 @@ int rl_completion_append_character = ' ';
/* If non-zero, inhibit completion (temporarily). */
int rl_inhibit_completion;
-/* Variables local to this file. */
-
-/* Local variable states what happened during the last completion attempt. */
-static int completion_changed_buffer;
-
-/*************************************/
-/* */
-/* Bindable completion functions */
-/* */
-/*************************************/
-
/* Complete the word at or before point. You have supplied the function
that does the initial simple matching selection algorithm (see
completion_matches ()). The default is to do filename completion. */
@@ -294,33 +274,6 @@ rl_insert_completions (ignore, invoking_key)
return (rl_complete_internal ('*'));
}
-/************************************/
-/* */
-/* Completion utility functions */
-/* */
-/************************************/
-
-/* Find the first occurrence in STRING1 of any character from STRING2.
- Return a pointer to the character in STRING1. */
-static char *
-rl_strpbrk (string1, string2)
- char *string1, *string2;
-{
- register char *scan;
-
- for (; *string1; string1++)
- {
- for (scan = string2; *scan; scan++)
- {
- if (*string1 == *scan)
- {
- return (string1);
- }
- }
- }
- return ((char *)NULL);
-}
-
/* The user must press "y" or "n". Non-zero return means "y" pressed. */
static int
get_y_or_n ()
@@ -340,63 +293,6 @@ get_y_or_n ()
}
}
-#if defined (VISIBLE_STATS)
-/* Return the character which best describes FILENAME.
- `@' for symbolic links
- `/' for directories
- `*' for executables
- `=' for sockets
- `|' for FIFOs
- `%' for character special devices
- `#' for block special devices */
-static int
-stat_char (filename)
- char *filename;
-{
- struct stat finfo;
- int character, r;
-
-#if defined (HAVE_LSTAT) && defined (S_ISLNK)
- r = lstat (filename, &finfo);
-#else
- r = stat (filename, &finfo);
-#endif
-
- if (r == -1)
- return (0);
-
- character = 0;
- if (S_ISDIR (finfo.st_mode))
- character = '/';
-#if defined (S_ISCHR)
- else if (S_ISCHR (finfo.st_mode))
- character = '%';
-#endif /* S_ISCHR */
-#if defined (S_ISBLK)
- else if (S_ISBLK (finfo.st_mode))
- character = '#';
-#endif /* S_ISBLK */
-#if defined (S_ISLNK)
- else if (S_ISLNK (finfo.st_mode))
- character = '@';
-#endif /* S_ISLNK */
-#if defined (S_ISSOCK)
- else if (S_ISSOCK (finfo.st_mode))
- character = '=';
-#endif /* S_ISSOCK */
-#if defined (S_ISFIFO)
- else if (S_ISFIFO (finfo.st_mode))
- character = '|';
-#endif
- else if (S_ISREG (finfo.st_mode))
- {
- if (access (filename, X_OK) == 0)
- character = '*';
- }
- return (character);
-}
-#endif /* VISIBLE_STATS */
-
/* Return the portion of PATHNAME that should be output when listing
possible completions. If we are hacking filename completion, we
are only interested in the basename, the portion following the
@@ -413,34 +309,26 @@ printable_part (pathname)
/* Output TO_PRINT to rl_outstream. If VISIBLE_STATS is defined and we
are using it, check for and output a single character for `special'
- filenames. Return the number of characters we output. */
+ filenames. Return 1 if we printed an extension character, 0 if not. */
#define PUTX(c) \
- do { \
if (CTRL_CHAR (c)) \
{ \
putc ('^', rl_outstream); \
putc (UNCTRL (c), rl_outstream); \
- printed_len += 2; \
} \
else if (c == RUBOUT) \
{ \
putc ('^', rl_outstream); \
putc ('?', rl_outstream); \
- printed_len += 2; \
} \
else \
- { \
- putc (c, rl_outstream); \
- printed_len++; \
- } \
- } while (0)
+ putc (c, rl_outstream)
static int
print_filename (to_print, full_pathname)
char *to_print, *full_pathname;
{
- int printed_len = 0;
#if !defined (VISIBLE_STATS)
char *s;
@@ -448,6 +336,7 @@ print_filename (to_print, full_pathname)
{
PUTX (*s);
}
+ return 0;
#else
char *s, c, *new_full_pathname;
int extension_char, slen, tlen;
@@ -492,13 +381,12 @@ print_filename (to_print, full_pathname)
free (s);
if (extension_char)
- {
- putc (extension_char, rl_outstream);
- printed_len++;
- }
+ putc (extension_char, rl_outstream);
+ return (extension_char != 0);
}
+ else
+ return 0;
#endif /* VISIBLE_STATS */
- return printed_len;
}
static char *
@@ -748,125 +636,6 @@ remove_duplicate_matches (matches)
return (temp_array);
}
-/* Find the common prefix of the list of matches, and put it into
- matches[0]. */
-static int
-compute_lcd_of_matches (match_list, matches, text)
- char **match_list;
- int matches;
- char *text;
-{
- register int i, c1, c2, si;
- int low; /* Count of max-matched characters. */
-
- /* If only one match, just use that. Otherwise, compare each
- member of the list with the next, finding out where they
- stop matching. */
- if (matches == 1)
- {
- match_list[0] = match_list[1];
- match_list[1] = (char *)NULL;
- return 1;
- }
-
- for (i = 1, low = 100000; i < matches; i++)
- {
- if (_rl_completion_case_fold)
- {
- for (si = 0;
- (c1 = _rl_to_lower(match_list[i][si])) &&
- (c2 = _rl_to_lower(match_list[i + 1][si]));
- si++)
- if (c1 != c2)
- break;
- }
- else
- {
- for (si = 0;
- (c1 = match_list[i][si]) &&
- (c2 = match_list[i + 1][si]);
- si++)
- if (c1 != c2)
- break;
- }
-
- if (low > si)
- low = si;
- }
-
- /* If there were multiple matches, but none matched up to even the
- first character, and the user typed something, use that as the
- value of matches[0]. */
- if (low == 0 && text && *text)
- {
- match_list[0] = xmalloc (strlen (text) + 1);
- strcpy (match_list[0], text);
- }
- else
- {
- match_list[0] = xmalloc (low + 1);
- strncpy (match_list[0], match_list[1], low);
- match_list[0][low] = '\0';
- }
-
- return matches;
-}
-
-static int
-postprocess_matches (text, matchesp, matching_filenames)
- char *text;
- char ***matchesp;
- int matching_filenames;
-{
- char *t, **matches, **temp_matches;
- int nmatch, i;
-
- matches = *matchesp;
-
- /* It seems to me that in all the cases we handle we would like
- to ignore duplicate possiblilities. Scan for the text to
- insert being identical to the other completions. */
- if (rl_ignore_completion_duplicates)
- {
- temp_matches = remove_duplicate_matches (matches);
- free (matches);
- matches = temp_matches;
- }
-
- /* If we are matching filenames, then here is our chance to
- do clever processing by re-examining the list. Call the
- ignore function with the array as a parameter. It can
- munge the array, deleting matches as it desires. */
- if (rl_ignore_some_completions_function && matching_filenames)
- {
- for (nmatch = 1; matches[nmatch]; nmatch++)
- ;
- (void)(*rl_ignore_some_completions_function) (matches);
- if (matches == 0 || matches[0] == 0)
- {
- FREE (matches);
- ding ();
- *matchesp = (char **)0;
- return 0;
- }
- else
- {
- /* If we removed some matches, recompute the common prefix. */
- for (i = 1; matches[i]; i++)
- ;
- if (i > 1 && i < nmatch)
- {
- t = matches[0];
- compute_lcd_of_matches (matches, i - 1, text);
- FREE (t);
- }
- }
- }
-
- *matchesp = matches;
- return (1);
-}
-
static void
display_matches (matches)
char **matches;
@@ -949,47 +718,25 @@ display_matches (matches)
if (rl_ignore_completion_duplicates == 0)
qsort (matches + 1, len, sizeof (char *), _rl_qsort_string_compare);
+ /* Print the sorted items, up-and-down alphabetically, like ls. */
crlf ();
- if (_rl_print_completions_horizontally == 0)
+ for (i = 1; i <= count; i++)
{
- /* Print the sorted items, up-and-down alphabetically, like ls. */
- for (i = 1; i <= count; i++)
+ for (j = 0, l = i; j < limit; j++)
{
- for (j = 0, l = i; j < limit; j++)
+ if (l > len || matches[l] == 0)
+ break;
+ else
{
- if (l > len || matches[l] == 0)
- break;
- else
- {
- temp = printable_part (matches[l]);
- printed_len = print_filename (temp, matches[l]);
+ temp = printable_part (matches[l]);
+ printed_len = strlen (temp) + print_filename (temp, matches[l]);
- if (j + 1 < limit)
- for (k = 0; k < max - printed_len; k++)
- putc (' ', rl_outstream);
- }
- l += count;
- }
- crlf ();
- }
- }
- else
- {
- /* Print the sorted items, across alphabetically, like ls -x. */
- for (i = 1; matches[i]; i++)
- {
- temp = printable_part (matches[i]);
- printed_len = print_filename (temp, matches[i]);
- /* Have we reached the end of this line? */
- if (matches[i+1])
- {
- if (i && (limit > 1) && (i % limit) == 0)
- crlf ();
- else
+ if (j + 1 < limit)
for (k = 0; k < max - printed_len; k++)
putc (' ', rl_outstream);
}
+ l += count;
}
crlf ();
}
@@ -1002,6 +749,18 @@ display_matches (matches)
#endif
}
+static void
+insert_text (text, start, end)
+ char *text;
+ int start, end;
+{
+ rl_begin_undo_group ();
+ rl_delete_text (start, end + 1);
+ rl_point = start;
+ rl_insert_text (text);
+ rl_end_undo_group ();
+}
+
static char *
make_quoted_replacement (match, mtype, qc)
char *match;
@@ -1074,7 +833,7 @@ insert_match (match, start, mtype, qc)
else if (qc && (*qc != oqc) && start && rl_line_buffer[start - 1] == oqc &&
replacement[0] != oqc)
start--;
- _rl_replace_text (replacement, start, rl_point - 1);
+ insert_text (replacement, start, rl_point - 1);
if (replacement != match)
free (replacement);
}
@@ -1083,9 +842,8 @@ insert_match (match, start, mtype, qc)
/* Append any necessary closing quote and a separator character to the
just-inserted match. If the user has specified that directories
should be marked by a trailing `/', append one of those instead. The
- default trailing character is a space. Returns the number of characters
- appended. */
-static int
+ default trailing character */
+static void
append_to_match (text, delimiter, quote_char)
char *text;
int delimiter, quote_char;
@@ -1125,8 +883,6 @@ append_to_match (text, delimiter, quote_char)
if (rl_point == rl_end)
rl_insert_text (temp_string);
}
-
- return (temp_string_index);
}
static void
@@ -1179,24 +935,27 @@ int
rl_complete_internal (what_to_do)
int what_to_do;
{
- char **matches;
+ char **matches, **temp_matches;
Function *our_func;
- int start, end, delimiter, found_quote, i;
- char *text, *saved_line_buffer;
+ int start, end, delimiter, found_quote, nmatch, i;
+ char *text, *saved_line_buffer, *t;
char quote_char;
- /* Only the completion entry function can change these. */
- rl_filename_completion_desired = 0;
- rl_filename_quoting_desired = 1;
- rl_completion_type = what_to_do;
-
saved_line_buffer = rl_line_buffer ? savestring (rl_line_buffer) : (char *)NULL;
+
our_func = rl_completion_entry_function
? rl_completion_entry_function
: (Function *)filename_completion_function;
+ /* Only the completion entry function can change these. */
+ rl_filename_completion_desired = 0;
+ rl_filename_quoting_desired = 1;
+
+ rl_completion_type = what_to_do;
+
/* We now look backwards for the start of a filename/variable word. */
end = rl_point;
+
found_quote = delimiter = 0;
quote_char = '\0';
@@ -1216,19 +975,50 @@ rl_complete_internal (what_to_do)
ding ();
FREE (saved_line_buffer);
free (text);
- return (0);
+ return 0;
}
-
- /* If we are matching filenames, our_func will have been set to
- filename_completion_function */
- i = our_func == (Function *)filename_completion_function;
- if (postprocess_matches (text, &matches, i) == 0)
+
+ /* It seems to me that in all the cases we handle we would like
+ to ignore duplicate possiblilities. Scan for the text to
+ insert being identical to the other completions. */
+ if (rl_ignore_completion_duplicates)
{
- FREE (saved_line_buffer);
- free (text);
- return (0);
+ temp_matches = remove_duplicate_matches (matches);
+ free (matches);
+ matches = temp_matches;
}
+ /* If we are matching filenames, then here is our chance to
+ do clever processing by re-examining the list. Call the
+ ignore function with the array as a parameter. It can
+ munge the array, deleting matches as it desires. */
+ if (rl_ignore_some_completions_function &&
+ our_func == (Function *)filename_completion_function)
+ {
+ for (nmatch = 1; matches[nmatch]; nmatch++)
+ ;
+ (void)(*rl_ignore_some_completions_function) (matches);
+ if (matches == 0 || matches[0] == 0)
+ {
+ FREE (matches);
+ ding ();
+ FREE (saved_line_buffer);
+ FREE (text);
+ return 0;
+ }
+ else
+ {
+ /* If we removed some matches, recompute the common prefix. */
+ for (i = 1; matches[i]; i++)
+ ;
+ if (i > 1 && i < nmatch)
+ {
+ t = matches[0];
+ compute_lcd_of_matches (matches, i - 1, text);
+ FREE (t);
+ }
+ }
+ }
free (text);
switch (what_to_do)
@@ -1291,67 +1081,62 @@ rl_complete_internal (what_to_do)
return 0;
}
-/***************************************************************/
-/* */
-/* Application-callable completion match generator functions */
-/* */
-/***************************************************************/
-
-/* Return an array of (char *) which is a list of completions for TEXT.
- If there are no completions, return a NULL pointer.
- The first entry in the returned array is the substitution for TEXT.
- The remaining entries are the possible completions.
- The array is terminated with a NULL pointer.
-
- ENTRY_FUNCTION is a function of two args, and returns a (char *).
- The first argument is TEXT.
- The second is a state argument; it should be zero on the first call, and
- non-zero on subsequent calls. It returns a NULL pointer to the caller
- when there are no more matches.
- */
-char **
-completion_matches (text, entry_function)
- char *text;
- CPFunction *entry_function;
+#if defined (VISIBLE_STATS)
+/* Return the character which best describes FILENAME.
+ `@' for symbolic links
+ `/' for directories
+ `*' for executables
+ `=' for sockets
+ `|' for FIFOs
+ `%' for character special devices
+ `#' for block special devices */
+static int
+stat_char (filename)
+ char *filename;
{
- /* Number of slots in match_list. */
- int match_list_size;
-
- /* The list of matches. */
- char **match_list;
-
- /* Number of matches actually found. */
- int matches;
-
- /* Temporary string binder. */
- char *string;
-
- matches = 0;
- match_list_size = 10;
- match_list = (char **)xmalloc ((match_list_size + 1) * sizeof (char *));
- match_list[1] = (char *)NULL;
+ struct stat finfo;
+ int character, r;
- while (string = (*entry_function) (text, matches))
- {
- if (matches + 1 == match_list_size)
- match_list = (char **)xrealloc
- (match_list, ((match_list_size += 10) + 1) * sizeof (char *));
+#if defined (HAVE_LSTAT) && defined (S_ISLNK)
+ r = lstat (filename, &finfo);
+#else
+ r = stat (filename, &finfo);
+#endif
- match_list[++matches] = string;
- match_list[matches + 1] = (char *)NULL;
- }
+ if (r == -1)
+ return (0);
- /* If there were any matches, then look through them finding out the
- lowest common denominator. That then becomes match_list[0]. */
- if (matches)
- compute_lcd_of_matches (match_list, matches, text);
- else /* There were no matches. */
+ character = 0;
+ if (S_ISDIR (finfo.st_mode))
+ character = '/';
+#if defined (S_ISCHR)
+ else if (S_ISCHR (finfo.st_mode))
+ character = '%';
+#endif /* S_ISCHR */
+#if defined (S_ISBLK)
+ else if (S_ISBLK (finfo.st_mode))
+ character = '#';
+#endif /* S_ISBLK */
+#if defined (S_ISLNK)
+ else if (S_ISLNK (finfo.st_mode))
+ character = '@';
+#endif /* S_ISLNK */
+#if defined (S_ISSOCK)
+ else if (S_ISSOCK (finfo.st_mode))
+ character = '=';
+#endif /* S_ISSOCK */
+#if defined (S_ISFIFO)
+ else if (S_ISFIFO (finfo.st_mode))
+ character = '|';
+#endif
+ else if (S_ISREG (finfo.st_mode))
{
- free (match_list);
- match_list = (char **)NULL;
+ if (access (filename, X_OK) == 0)
+ character = '*';
}
- return (match_list);
+ return (character);
}
+#endif /* VISIBLE_STATS */
/* A completion function for usernames.
TEXT contains a partial username preceded by a random
@@ -1409,6 +1194,135 @@ username_completion_function (text, state)
#endif /* !__GO32__ */
}
+/* **************************************************************** */
+/* */
+/* Completion */
+/* */
+/* **************************************************************** */
+
+/* Non-zero means that case is not significant in completion. */
+int completion_case_fold = 0;
+
+/* Find the common prefix of the list of matches, and put it into
+ matches[0]. */
+static int
+compute_lcd_of_matches (match_list, matches, text)
+ char **match_list;
+ int matches;
+ char *text;
+{
+ register int i, c1, c2, si;
+ int low; /* Count of max-matched characters. */
+
+ /* If only one match, just use that. Otherwise, compare each
+ member of the list with the next, finding out where they
+ stop matching. */
+ if (matches == 1)
+ {
+ match_list[0] = match_list[1];
+ match_list[1] = (char *)NULL;
+ return 1;
+ }
+
+ for (i = 1, low = 100000; i < matches; i++)
+ {
+ if (completion_case_fold)
+ {
+ for (si = 0;
+ (c1 = _rl_to_lower(match_list[i][si])) &&
+ (c2 = _rl_to_lower(match_list[i + 1][si]));
+ si++)
+ if (c1 != c2)
+ break;
+ }
+ else
+ {
+ for (si = 0;
+ (c1 = match_list[i][si]) &&
+ (c2 = match_list[i + 1][si]);
+ si++)
+ if (c1 != c2)
+ break;
+ }
+
+ if (low > si)
+ low = si;
+ }
+
+ /* If there were multiple matches, but none matched up to even the
+ first character, and the user typed something, use that as the
+ value of matches[0]. */
+ if (low == 0 && text && *text)
+ {
+ match_list[0] = xmalloc (strlen (text) + 1);
+ strcpy (match_list[0], text);
+ }
+ else
+ {
+ match_list[0] = xmalloc (low + 1);
+ strncpy (match_list[0], match_list[1], low);
+ match_list[0][low] = '\0';
+ }
+
+ return matches;
+}
+
+/* Return an array of (char *) which is a list of completions for TEXT.
+ If there are no completions, return a NULL pointer.
+ The first entry in the returned array is the substitution for TEXT.
+ The remaining entries are the possible completions.
+ The array is terminated with a NULL pointer.
+
+ ENTRY_FUNCTION is a function of two args, and returns a (char *).
+ The first argument is TEXT.
+ The second is a state argument; it should be zero on the first call, and
+ non-zero on subsequent calls. It returns a NULL pointer to the caller
+ when there are no more matches.
+ */
+char **
+completion_matches (text, entry_function)
+ char *text;
+ CPFunction *entry_function;
+{
+ /* Number of slots in match_list. */
+ int match_list_size;
+
+ /* The list of matches. */
+ char **match_list;
+
+ /* Number of matches actually found. */
+ int matches;
+
+ /* Temporary string binder. */
+ char *string;
+
+ matches = 0;
+ match_list_size = 10;
+ match_list = (char **)xmalloc ((match_list_size + 1) * sizeof (char *));
+ match_list[1] = (char *)NULL;
+
+ while (string = (*entry_function) (text, matches))
+ {
+ if (matches + 1 == match_list_size)
+ match_list = (char **)xrealloc
+ (match_list, ((match_list_size += 10) + 1) * sizeof (char *));
+
+ match_list[++matches] = string;
+ match_list[matches + 1] = (char *)NULL;
+ }
+
+ /* If there were any matches, then look through them finding out the
+ lowest common denominator. That then becomes match_list[0]. */
+ if (matches)
+ compute_lcd_of_matches (match_list, matches, text);
+ else /* There were no matches. */
+ {
+ free (match_list);
+ match_list = (char **)NULL;
+ }
+ return (match_list);
+}
+
/* Okay, now we write the entry_function for filename completion. In the
general case. Note that completion in the shell is a little different
because of all the pathnames that must be followed when looking up the
@@ -1507,20 +1421,10 @@ filename_completion_function (text, state)
{
/* Otherwise, if these match up to the length of filename, then
it is a match. */
- if (_rl_completion_case_fold)
- {
- if ((_rl_to_lower (entry->d_name[0]) == _rl_to_lower (filename[0])) &&
- (((int)D_NAMLEN (entry)) >= filename_len) &&
- (_rl_strnicmp (filename, entry->d_name, filename_len) == 0))
- break;
- }
- else
- {
- if ((entry->d_name[0] == filename[0]) &&
- (((int)D_NAMLEN (entry)) >= filename_len) &&
- (strncmp (filename, entry->d_name, filename_len) == 0))
- break;
- }
+ if ((entry->d_name[0] == filename[0]) &&
+ (((int)D_NAMLEN (entry)) >= filename_len) &&
+ (strncmp (filename, entry->d_name, filename_len) == 0))
+ break;
}
}
@@ -1583,120 +1487,74 @@ filename_completion_function (text, state)
}
}
-/* An initial implementation of a menu completion function a la tcsh. The
- first time (if the last readline command was not rl_menu_complete), we
- generate the list of matches. This code is very similar to the code in
- rl_complete_internal -- there should be a way to combine the two. Then,
- for each item in the list of matches, we insert the match in an undoable
- fashion, with the appropriate character appended (this happens on the
- second and subsequent consecutive calls to rl_menu_complete). When we
- hit the end of the match list, we restore the original unmatched text,
- ring the bell, and reset the counter to zero. */
+/* A function for simple tilde expansion. */
int
-rl_menu_complete (count, ignore)
- int count, ignore;
+rl_tilde_expand (ignore, key)
+ int ignore, key;
{
- Function *our_func;
- int matching_filenames, found_quote;
-
- static char *orig_text;
- static char **matches = (char **)0;
- static int match_list_index = 0;
- static int match_list_size = 0;
- static int orig_start, orig_end;
- static char quote_char;
- static int delimiter;
-
- /* The first time through, we generate the list of matches and set things
- up to insert them. */
- if (rl_last_func != rl_menu_complete)
- {
- /* Clean up from previous call, if any. */
- FREE (orig_text);
- if (matches)
- {
- for (match_list_index = 0; matches[match_list_index]; match_list_index++)
- free (matches[match_list_index]);
- free (matches);
- }
-
- match_list_index = match_list_size = 0;
- matches = (char **)NULL;
-
- /* Only the completion entry function can change these. */
- rl_filename_completion_desired = 0;
- rl_filename_quoting_desired = 1;
- rl_completion_type = '%';
-
- our_func = rl_completion_entry_function
- ? rl_completion_entry_function
- : (Function *)filename_completion_function;
-
- /* We now look backwards for the start of a filename/variable word. */
- orig_end = rl_point;
- found_quote = delimiter = 0;
- quote_char = '\0';
-
- if (rl_point)
- /* This (possibly) changes rl_point. If it returns a non-zero char,
- we know we have an open quote. */
- quote_char = find_completion_word (&found_quote, &delimiter);
-
- orig_start = rl_point;
- rl_point = orig_end;
-
- orig_text = rl_copy_text (orig_start, orig_end);
- matches = gen_completion_matches (orig_text, orig_start, orig_end,
- our_func, found_quote, quote_char);
+ register int start, end;
+ char *homedir, *temp;
+ int len;
- /* If we are matching filenames, our_func will have been set to
- filename_completion_function */
- matching_filenames = our_func == (Function *)filename_completion_function;
- if (matches == 0 || postprocess_matches (orig_text, &matches, matching_filenames) == 0)
- {
- ding ();
- FREE (matches);
- matches = (char **)0;
- FREE (orig_text);
- orig_text = (char *)0;
- completion_changed_buffer = 0;
- return (0);
- }
+ end = rl_point;
+ start = end - 1;
- for (match_list_size = 0; matches[match_list_size]; match_list_size++)
+ if (rl_point == rl_end && rl_line_buffer[rl_point] == '~')
+ {
+ homedir = tilde_expand ("~");
+ insert_text (homedir, start, end);
+ return (0);
+ }
+ else if (rl_line_buffer[start] != '~')
+ {
+ for (; !whitespace (rl_line_buffer[start]) && start >= 0; start--)
;
- /* matches[0] is lcd if match_list_size > 1, but the circular buffer
- code below should take care of it. */
+ start++;
}
- /* Now we have the list of matches. Replace the text between
- rl_line_buffer[orig_start] and rl_line_buffer[rl_point] with
- matches[match_list_index], and add any necessary closing char. */
+ end = start;
+ do
+ end++;
+ while (whitespace (rl_line_buffer[end]) == 0 && end < rl_end);
+
+ if (whitespace (rl_line_buffer[end]) || end >= rl_end)
+ end--;
- if (matches == 0 || match_list_size == 0)
+ /* If the first character of the current word is a tilde, perform
+ tilde expansion and insert the result. If not a tilde, do
+ nothing. */
+ if (rl_line_buffer[start] == '~')
{
- ding ();
- FREE (matches);
- matches = (char **)0;
- completion_changed_buffer = 0;
- return (0);
+ len = end - start + 1;
+ temp = xmalloc (len + 1);
+ strncpy (temp, rl_line_buffer + start, len);
+ temp[len] = '\0';
+ homedir = tilde_expand (temp);
+ free (temp);
+
+ insert_text (homedir, start, end);
}
- match_list_index = (match_list_index + count) % match_list_size;
- if (match_list_index < 0)
- match_list_index += match_list_size;
+ return (0);
+}
- if (match_list_index == 0)
- {
- ding ();
- insert_match (orig_text, orig_start, MULT_MATCH, &quote_char);
- }
- else
+/* Find the first occurrence in STRING1 of any character from STRING2.
+ Return a pointer to the character in STRING1. */
+static char *
+rl_strpbrk (string1, string2)
+ char *string1, *string2;
+{
+ register char *scan;
+
+ for (; *string1; string1++)
{
- insert_match (matches[match_list_index], orig_start, SINGLE_MATCH, &quote_char);
- append_to_match (matches[match_list_index], delimiter, quote_char);
+ for (scan = string2; *scan; scan++)
+ {
+ if (*string1 == *scan)
+ {
+ return (string1);
+ }
+ }
}
-
- completion_changed_buffer = 1;
- return (0);
+ return ((char *)NULL);
}
diff --git a/contrib/libreadline/doc/Makefile b/contrib/libreadline/doc/Makefile
deleted file mode 100644
index 9dbab24..0000000
--- a/contrib/libreadline/doc/Makefile
+++ /dev/null
@@ -1,69 +0,0 @@
-# This makefile for Readline library documentation is in -*- text -*- mode.
-# Emacs likes it that way.
-TEXI2DVI = texi2dvi
-
-RM = rm -f
-
-INSTALL_DATA = cp
-infodir = /usr/local/info
-
-RLSRC = rlman.texinfo rluser.texinfo rltech.texinfo
-HISTSRC = hist.texinfo hsuser.texinfo hstech.texinfo
-
-DVIOBJ = readline.dvi history.dvi
-INFOOBJ = readline.info history.info
-PSOBJ = readline.ps history.ps
-HTMLOBJ = readline.html history.html
-
-all: info dvi html
-
-readline.dvi: $(RLSRC)
- $(TEXI2DVI) rlman.texinfo
- mv rlman.dvi readline.dvi
-
-readline.info: $(RLSRC)
- makeinfo --no-split -o $@ rlman.texinfo
-
-history.dvi: ${HISTSRC}
- $(TEXI2DVI) hist.texinfo
- mv hist.dvi history.dvi
-
-history.info: ${HISTSRC}
- makeinfo --no-split -o $@ hist.texinfo
-
-readline.ps: readline.dvi
- dvips -D 300 -o $@ readline.dvi
-
-history.ps: history.dvi
- dvips -D 300 -o $@ history.dvi
-
-readline.html: ${RLSRC}
- texi2html rlman.texinfo
- sed -e 's:rlman.html:readline.html:' -e 's:rlman_toc.html:readline_toc.html:' rlman.html > readline.html
- sed -e 's:rlman.html:readline.html:' -e 's:rlman_toc.html:readline_toc.html:' rlman_toc.html > readline_toc.html
- rm -f rlman.html rlman_toc.html
-
-history.html: ${HISTSRC}
- texi2html hist.texinfo
- sed -e 's:hist.html:history.html:' -e 's:hist_toc.html:history_toc.html:' hist.html > history.html
- sed -e 's:hist.html:history.html:' -e 's:hist_toc.html:history_toc.html:' hist_toc.html > history_toc.html
- rm -f hist.html hist_toc.html
-
-info: $(INFOOBJ)
-dvi: $(DVIOBJ)
-ps: $(PSOBJ)
-html: $(HTMLOBJ)
-
-clean:
- $(RM) *.aux *.cp *.fn *.ky *.log *.pg *.toc *.tp *.vr *.cps *.pgs \
- *.fns *.kys *.tps *.vrs *.o core
-
-distclean: clean
-mostlyclean: clean
-
-maintainer-clean: clean
- $(RM) *.dvi *.info *.info-* *.ps *.html
-
-install: info
- ${INSTALL_DATA} readline.info $(infodir)/readline.info
- ${INSTALL_DATA} history.info $(infodir)/history.info
diff --git a/contrib/libreadline/doc/readline.3 b/contrib/libreadline/doc/readline.3
index bb9f759..8c5ae93 100644
--- a/contrib/libreadline/doc/readline.3
+++ b/contrib/libreadline/doc/readline.3
@@ -6,9 +6,9 @@
.\" Case Western Reserve University
.\" chet@ins.CWRU.Edu
.\"
-.\" Last Change: Thu Feb 19 10:26:47 EST 1998
+.\" Last Change: Wed Feb 5 14:13:22 EST 1997
.\"
-.TH READLINE 3 "1998 Feb 19" GNU
+.TH READLINE 3 "1997 Feb 5" GNU
.\"
.\" File Name macro. This used to be `.PN', for Path Name,
.\" but Sun doesn't seem to like that very much.
@@ -22,8 +22,8 @@ readline \- get a line from a user with editing
.LP
.nf
.ft B
-#include <readline.h>
-#include <history.h>
+#include <readline/readline.h>
+#include <readline/history.h>
.ft
.fi
.LP
@@ -159,7 +159,7 @@ command or the text of a macro and a key sequence to which
it should be bound. The name may be specified in one of two ways:
as a symbolic key name, possibly with \fIMeta\-\fP or \fIControl\-\fP
prefixes, or as a key sequence.
-When using the form \fBkeyname\fP:\^\fIfunction-name\fP or \fImacro\fP,
+When using the form \fBkeyname\fP:\fIfunction-name\fP or \fImacro\fP,
.I keyname
is the name of a key spelled out in English. For example:
.sp
@@ -185,7 +185,7 @@ expressed on the right hand side (that is, to insert the text
.I >&output
into the line).
.PP
-In the second form, \fB"keyseq"\fP:\^\fIfunction\-name\fP or \fImacro\fP,
+In the second form, \fB"keyseq"\fP:\fIfunction\-name\fP or \fImacro\fP,
.B keyseq
differs from
.B keyname
@@ -213,9 +213,8 @@ and
.I "ESC [ 1 1 ~"
is bound to insert the text
.BR "Function Key 1" .
-The full set of GNU Emacs style escape sequences is
+The full set of escape sequences is
.RS
-.PD 0
.TP
.B \eC\-
control prefix
@@ -235,53 +234,11 @@ literal "
.B \e'
literal '
.RE
-.PD
-.PP
-In addition to the GNU Emacs style escape sequences, a second
-set of backslash escapes is available:
-.RS
-.PD 0
-.TP
-.B \ea
-alert (bell)
-.TP
-.B \eb
-backspace
-.TP
-.B \ed
-delete
-.TP
-.B \ef
-form feed
-.TP
-.B \en
-newline
-.TP
-.B \er
-carriage return
-.TP
-.B \et
-horizontal tab
-.TP
-.B \ev
-vertical tab
-.TP
-.B \e\fInnn\fP
-the character whose ASCII code is the octal value \fInnn\fP
-(one to three digits)
-.TP
-.B \ex\fInnn\fP
-the character whose ASCII code is the hexadecimal value \fInnn\fP
-(one to three digits)
-.RE
-.PD
.PP
When entering the text of a macro, single or double quotes should
be used to indicate a macro definition. Unquoted text
-is assumed to be a function name.
-In the macro body, the backslash escapes described above are expanded.
-Backslash will quote any other character in the macro text,
-including " and '.
+is assumed to be a function name. Backslash
+will quote any character in the macro text, including " and '.
.PP
.B Bash
allows the current readline key bindings to be displayed or modified
@@ -331,10 +288,6 @@ This command is bound to
in emacs mode and to
.B #
in vi command mode.
-.TP
-.B completion\-ignore\-case (Off)
-If set to \fBOn\fP, readline performs filename matching and completion
-in a case\-insensitive fashion.
.TP
.B completion\-query\-items (100)
This determines when the user is queried about viewing
@@ -393,7 +346,7 @@ the value of
also affects the default keymap.
.TP
.B mark\-directories (On)
-If set to \fBOn\fP, complete<d directory names have a slash
+If set to \fBOn\fP, completed directory names have a slash
appended.
.TP
.B mark\-modified\-lines (Off)
@@ -410,10 +363,6 @@ If set to \fBOn\fP, readline will display characters with the
eighth bit set directly rather than as a meta-prefixed escape
sequence.
.TP
-.B print\-completions\-horizontally (Off)
-If set to \fBOn\fP, readline will display completions with matches
-sorted horizontally in alphabetical order, rather than down the screen.
-.TP
.B show\-all\-if\-ambiguous (Off)
This alters the default behavior of the completion functions. If
set to
@@ -431,7 +380,7 @@ completions.
Readline implements a facility similar in spirit to the conditional
compilation features of the C preprocessor which allows key
bindings and variable settings to be performed as the result
-of tests. There are four parser directives used.
+of tests. There are three parser directives used.
.IP \fB$if\fP
The
.B $if
@@ -468,7 +417,6 @@ file can test for a particular value.
This could be used to bind key sequences to functions useful for
a specific program. For instance, the following command adds a
key sequence that quotes the current or previous word in Bash:
-.sp 1
.RS
.nf
\fB$if\fP bash
@@ -479,21 +427,11 @@ key sequence that quotes the current or previous word in Bash:
.RE
.RE
.IP \fB$endif\fP
-This command, as seen in the previous example, terminates an
+This command, as you saw in the previous example, terminates an
\fB$if\fP command.
.IP \fB$else\fP
Commands in this branch of the \fB$if\fP directive are executed if
the test fails.
-.IP \fB$include\fP
-This directive takes a single filename as an argument and reads commands
-and bindings from that file. For example, the following directive
-would read \fI/etc/inputrc\fP:
-.sp 1
-.RS
-.nf
-\fB$include\fP \^ \fI/etc/inputrc\fP
-.fi
-.RE
.SH SEARCHING
.PP
Readline provides commands for searching through the command history
@@ -526,7 +464,7 @@ the line, thereby executing the command from the history list.
.PP
Non-incremental searches read the entire search string before starting
to search for matching history lines. The search string may be
-typed by the user or be part of the contents of the current line.
+typed by the user or part of the contents of the current line.
.SH EDITING COMMANDS
.PP
The following is a list of the names of the commands and the default
@@ -629,8 +567,6 @@ yank\-last\-arg (M\-.\^, M\-_\^)
Insert the last argument to the previous command (the last word of
the previous history entry). With an argument,
behave exactly like \fByank\-nth\-arg\fP.
-Successive calls to \fByank\-last\-arg\fP move back through the history
-list, inserting the last argument of each line in turn.
.PD
.SS Commands for Changing Text
.PP
@@ -639,7 +575,9 @@ list, inserting the last argument of each line in turn.
.B delete\-char (C\-d)
Delete the character under the cursor. If point is at the
beginning of the line, there are no characters in the line, and
-the last character typed was not bound to \fBBdelete\-char\fP, then return
+the last character typed was not
+.BR C\-d ,
+then return
.SM
.BR EOF .
.TP
@@ -668,15 +606,15 @@ moving the cursor over that word as well.
.TP
.B upcase\-word (M\-u)
Uppercase the current (or following) word. With a negative argument,
-uppercase the previous word, but do not move point.
+do the previous word, but do not move point.
.TP
.B downcase\-word (M\-l)
Lowercase the current (or following) word. With a negative argument,
-lowercase the previous word, but do not move point.
+do the previous word, but do not move point.
.TP
.B capitalize\-word (M\-c)
Capitalize the current (or following) word. With a negative argument,
-capitalize the previous word, but do not move point.
+do the previous word, but do not move point.
.PD
.SS Killing and Yanking
.PP
@@ -690,7 +628,6 @@ Kill backward to the beginning of the line.
.TP
.B unix\-line\-discard (C\-u)
Kill backward from point to the beginning of the line.
-The killed text is saved on the kill-ring.
.\" There is no real difference between this and backward-kill-line
.TP
.B kill\-whole\-line
@@ -723,11 +660,9 @@ Copy the text in the region to the kill buffer.
.TP
.B copy\-backward\-word
Copy the word before point to the kill buffer.
-The word boundaries are the same as \fBbackward\-word\fP.
.TP
.B copy\-forward\-word
Copy the word following point to the kill buffer.
-The word boundaries are the same as \fBforward\-word\fP.
.TP
.B yank (C\-y)
Yank the top of the kill ring into the buffer at the cursor.
@@ -785,19 +720,6 @@ List the possible completions of the text before point.
Insert all completions of the text before point
that would have been generated by
\fBpossible\-completions\fP.
-.TP
-.B menu\-complete
-Similar to \fBcomplete\fP, but replaces the word to be completed
-with a single match from the list of possible completions.
-Repeated execution of \fBmenu\-complete\fP steps through the list
-of possible completions, inserting each match in turn.
-At the end of the list of completions, the bell is rung and the
-original text is restored.
-An argument of \fIn\fP moves \fIn\fP positions forward in the list
-of matches; a negative argument may be used to move backward
-through the list.
-This command is intended to be bound to \fBTAB\fP, but is unbound
-by default.
.PD
.SS Keyboard Macros
.PP
@@ -843,7 +765,7 @@ is equivalent to
Incremental undo, separately remembered for each line.
.TP
.B revert\-line (M\-r)
-Undo all changes made to this line. This is like executing the
+Undo all changes made to this line. This is like typing the
.B undo
command enough times to return the line to its initial state.
.TP
@@ -873,6 +795,15 @@ variable is inserted at the beginning of the current line, and the line
is accepted as if a newline had been typed. This makes the current line
a shell comment.
.TP
+.B glob\-expand\-word (C\-x *)
+The word before point is treated as a pattern for pathname expansion,
+and the list of matching file names is inserted, replacing the word.
+.TP
+.B glob\-list\-expansions (C\-x g)
+The list of expansions that would have been generated by
+.B glob\-expand\-word
+is inserted into the line, replacing the word before point.
+.TP
.B dump\-functions
Print all of the functions and their key bindings to the
readline output stream. If a numeric argument is supplied,
@@ -1166,10 +1097,10 @@ version of the
library that you have.
.PP
Once you have determined that a bug actually exists, mail a
-bug report to \fIbug\-readline\fP@\fIgnu.org\fP.
+bug report to \fIbug\-readline\fP@\fIprep.ai.MIT.Edu\fP.
If you have a fix, you are welcome to mail that
as well! Suggestions and `philosophical' bug reports may be mailed
-to \fPbug-readline\fP@\fIgnu.org\fP or posted to the Usenet
+to \fPbug-readline\fP@\fIprep.ai.MIT.Edu\fP or posted to the Usenet
newsgroup
.BR gnu.bash.bug .
.PP
diff --git a/contrib/libreadline/examples/Makefile b/contrib/libreadline/examples/Makefile
deleted file mode 100644
index cfa7745..0000000
--- a/contrib/libreadline/examples/Makefile
+++ /dev/null
@@ -1,19 +0,0 @@
-# This is the Makefile for the examples subdirectory of readline. -*- text -*-
-#
-EXECUTABLES = fileman rltest
-CFLAGS = -g -I../.. -I..
-LDFLAGS = -g -L..
-
-.c.o:
- $(CC) $(CFLAGS) -c $<
-
-all: $(EXECUTABLES)
-
-fileman: fileman.o
- $(CC) $(LDFLAGS) -o $@ fileman.o -lreadline -ltermcap
-
-rltest: rltest.o
- $(CC) $(LDFLAGS) -o $@ rltest.o -lreadline -ltermcap
-
-fileman.o: fileman.c
-rltest.o: rltest.c
diff --git a/contrib/libreadline/readline.3 b/contrib/libreadline/readline.3
index bb9f759..8c5ae93 100644
--- a/contrib/libreadline/readline.3
+++ b/contrib/libreadline/readline.3
@@ -6,9 +6,9 @@
.\" Case Western Reserve University
.\" chet@ins.CWRU.Edu
.\"
-.\" Last Change: Thu Feb 19 10:26:47 EST 1998
+.\" Last Change: Wed Feb 5 14:13:22 EST 1997
.\"
-.TH READLINE 3 "1998 Feb 19" GNU
+.TH READLINE 3 "1997 Feb 5" GNU
.\"
.\" File Name macro. This used to be `.PN', for Path Name,
.\" but Sun doesn't seem to like that very much.
@@ -22,8 +22,8 @@ readline \- get a line from a user with editing
.LP
.nf
.ft B
-#include <readline.h>
-#include <history.h>
+#include <readline/readline.h>
+#include <readline/history.h>
.ft
.fi
.LP
@@ -159,7 +159,7 @@ command or the text of a macro and a key sequence to which
it should be bound. The name may be specified in one of two ways:
as a symbolic key name, possibly with \fIMeta\-\fP or \fIControl\-\fP
prefixes, or as a key sequence.
-When using the form \fBkeyname\fP:\^\fIfunction-name\fP or \fImacro\fP,
+When using the form \fBkeyname\fP:\fIfunction-name\fP or \fImacro\fP,
.I keyname
is the name of a key spelled out in English. For example:
.sp
@@ -185,7 +185,7 @@ expressed on the right hand side (that is, to insert the text
.I >&output
into the line).
.PP
-In the second form, \fB"keyseq"\fP:\^\fIfunction\-name\fP or \fImacro\fP,
+In the second form, \fB"keyseq"\fP:\fIfunction\-name\fP or \fImacro\fP,
.B keyseq
differs from
.B keyname
@@ -213,9 +213,8 @@ and
.I "ESC [ 1 1 ~"
is bound to insert the text
.BR "Function Key 1" .
-The full set of GNU Emacs style escape sequences is
+The full set of escape sequences is
.RS
-.PD 0
.TP
.B \eC\-
control prefix
@@ -235,53 +234,11 @@ literal "
.B \e'
literal '
.RE
-.PD
-.PP
-In addition to the GNU Emacs style escape sequences, a second
-set of backslash escapes is available:
-.RS
-.PD 0
-.TP
-.B \ea
-alert (bell)
-.TP
-.B \eb
-backspace
-.TP
-.B \ed
-delete
-.TP
-.B \ef
-form feed
-.TP
-.B \en
-newline
-.TP
-.B \er
-carriage return
-.TP
-.B \et
-horizontal tab
-.TP
-.B \ev
-vertical tab
-.TP
-.B \e\fInnn\fP
-the character whose ASCII code is the octal value \fInnn\fP
-(one to three digits)
-.TP
-.B \ex\fInnn\fP
-the character whose ASCII code is the hexadecimal value \fInnn\fP
-(one to three digits)
-.RE
-.PD
.PP
When entering the text of a macro, single or double quotes should
be used to indicate a macro definition. Unquoted text
-is assumed to be a function name.
-In the macro body, the backslash escapes described above are expanded.
-Backslash will quote any other character in the macro text,
-including " and '.
+is assumed to be a function name. Backslash
+will quote any character in the macro text, including " and '.
.PP
.B Bash
allows the current readline key bindings to be displayed or modified
@@ -331,10 +288,6 @@ This command is bound to
in emacs mode and to
.B #
in vi command mode.
-.TP
-.B completion\-ignore\-case (Off)
-If set to \fBOn\fP, readline performs filename matching and completion
-in a case\-insensitive fashion.
.TP
.B completion\-query\-items (100)
This determines when the user is queried about viewing
@@ -393,7 +346,7 @@ the value of
also affects the default keymap.
.TP
.B mark\-directories (On)
-If set to \fBOn\fP, complete<d directory names have a slash
+If set to \fBOn\fP, completed directory names have a slash
appended.
.TP
.B mark\-modified\-lines (Off)
@@ -410,10 +363,6 @@ If set to \fBOn\fP, readline will display characters with the
eighth bit set directly rather than as a meta-prefixed escape
sequence.
.TP
-.B print\-completions\-horizontally (Off)
-If set to \fBOn\fP, readline will display completions with matches
-sorted horizontally in alphabetical order, rather than down the screen.
-.TP
.B show\-all\-if\-ambiguous (Off)
This alters the default behavior of the completion functions. If
set to
@@ -431,7 +380,7 @@ completions.
Readline implements a facility similar in spirit to the conditional
compilation features of the C preprocessor which allows key
bindings and variable settings to be performed as the result
-of tests. There are four parser directives used.
+of tests. There are three parser directives used.
.IP \fB$if\fP
The
.B $if
@@ -468,7 +417,6 @@ file can test for a particular value.
This could be used to bind key sequences to functions useful for
a specific program. For instance, the following command adds a
key sequence that quotes the current or previous word in Bash:
-.sp 1
.RS
.nf
\fB$if\fP bash
@@ -479,21 +427,11 @@ key sequence that quotes the current or previous word in Bash:
.RE
.RE
.IP \fB$endif\fP
-This command, as seen in the previous example, terminates an
+This command, as you saw in the previous example, terminates an
\fB$if\fP command.
.IP \fB$else\fP
Commands in this branch of the \fB$if\fP directive are executed if
the test fails.
-.IP \fB$include\fP
-This directive takes a single filename as an argument and reads commands
-and bindings from that file. For example, the following directive
-would read \fI/etc/inputrc\fP:
-.sp 1
-.RS
-.nf
-\fB$include\fP \^ \fI/etc/inputrc\fP
-.fi
-.RE
.SH SEARCHING
.PP
Readline provides commands for searching through the command history
@@ -526,7 +464,7 @@ the line, thereby executing the command from the history list.
.PP
Non-incremental searches read the entire search string before starting
to search for matching history lines. The search string may be
-typed by the user or be part of the contents of the current line.
+typed by the user or part of the contents of the current line.
.SH EDITING COMMANDS
.PP
The following is a list of the names of the commands and the default
@@ -629,8 +567,6 @@ yank\-last\-arg (M\-.\^, M\-_\^)
Insert the last argument to the previous command (the last word of
the previous history entry). With an argument,
behave exactly like \fByank\-nth\-arg\fP.
-Successive calls to \fByank\-last\-arg\fP move back through the history
-list, inserting the last argument of each line in turn.
.PD
.SS Commands for Changing Text
.PP
@@ -639,7 +575,9 @@ list, inserting the last argument of each line in turn.
.B delete\-char (C\-d)
Delete the character under the cursor. If point is at the
beginning of the line, there are no characters in the line, and
-the last character typed was not bound to \fBBdelete\-char\fP, then return
+the last character typed was not
+.BR C\-d ,
+then return
.SM
.BR EOF .
.TP
@@ -668,15 +606,15 @@ moving the cursor over that word as well.
.TP
.B upcase\-word (M\-u)
Uppercase the current (or following) word. With a negative argument,
-uppercase the previous word, but do not move point.
+do the previous word, but do not move point.
.TP
.B downcase\-word (M\-l)
Lowercase the current (or following) word. With a negative argument,
-lowercase the previous word, but do not move point.
+do the previous word, but do not move point.
.TP
.B capitalize\-word (M\-c)
Capitalize the current (or following) word. With a negative argument,
-capitalize the previous word, but do not move point.
+do the previous word, but do not move point.
.PD
.SS Killing and Yanking
.PP
@@ -690,7 +628,6 @@ Kill backward to the beginning of the line.
.TP
.B unix\-line\-discard (C\-u)
Kill backward from point to the beginning of the line.
-The killed text is saved on the kill-ring.
.\" There is no real difference between this and backward-kill-line
.TP
.B kill\-whole\-line
@@ -723,11 +660,9 @@ Copy the text in the region to the kill buffer.
.TP
.B copy\-backward\-word
Copy the word before point to the kill buffer.
-The word boundaries are the same as \fBbackward\-word\fP.
.TP
.B copy\-forward\-word
Copy the word following point to the kill buffer.
-The word boundaries are the same as \fBforward\-word\fP.
.TP
.B yank (C\-y)
Yank the top of the kill ring into the buffer at the cursor.
@@ -785,19 +720,6 @@ List the possible completions of the text before point.
Insert all completions of the text before point
that would have been generated by
\fBpossible\-completions\fP.
-.TP
-.B menu\-complete
-Similar to \fBcomplete\fP, but replaces the word to be completed
-with a single match from the list of possible completions.
-Repeated execution of \fBmenu\-complete\fP steps through the list
-of possible completions, inserting each match in turn.
-At the end of the list of completions, the bell is rung and the
-original text is restored.
-An argument of \fIn\fP moves \fIn\fP positions forward in the list
-of matches; a negative argument may be used to move backward
-through the list.
-This command is intended to be bound to \fBTAB\fP, but is unbound
-by default.
.PD
.SS Keyboard Macros
.PP
@@ -843,7 +765,7 @@ is equivalent to
Incremental undo, separately remembered for each line.
.TP
.B revert\-line (M\-r)
-Undo all changes made to this line. This is like executing the
+Undo all changes made to this line. This is like typing the
.B undo
command enough times to return the line to its initial state.
.TP
@@ -873,6 +795,15 @@ variable is inserted at the beginning of the current line, and the line
is accepted as if a newline had been typed. This makes the current line
a shell comment.
.TP
+.B glob\-expand\-word (C\-x *)
+The word before point is treated as a pattern for pathname expansion,
+and the list of matching file names is inserted, replacing the word.
+.TP
+.B glob\-list\-expansions (C\-x g)
+The list of expansions that would have been generated by
+.B glob\-expand\-word
+is inserted into the line, replacing the word before point.
+.TP
.B dump\-functions
Print all of the functions and their key bindings to the
readline output stream. If a numeric argument is supplied,
@@ -1166,10 +1097,10 @@ version of the
library that you have.
.PP
Once you have determined that a bug actually exists, mail a
-bug report to \fIbug\-readline\fP@\fIgnu.org\fP.
+bug report to \fIbug\-readline\fP@\fIprep.ai.MIT.Edu\fP.
If you have a fix, you are welcome to mail that
as well! Suggestions and `philosophical' bug reports may be mailed
-to \fPbug-readline\fP@\fIgnu.org\fP or posted to the Usenet
+to \fPbug-readline\fP@\fIprep.ai.MIT.Edu\fP or posted to the Usenet
newsgroup
.BR gnu.bash.bug .
.PP
diff --git a/contrib/libreadline/readline.h b/contrib/libreadline/readline.h
index 280ec32..2eae30b 100644
--- a/contrib/libreadline/readline.h
+++ b/contrib/libreadline/readline.h
@@ -73,7 +73,6 @@ extern int
rl_forward_word (), rl_tab_insert (), rl_yank_pop (), rl_yank_nth_arg (),
rl_backward_kill_word (), rl_backward_kill_line (), rl_transpose_words (),
rl_complete (), rl_possible_completions (), rl_insert_completions (),
- rl_menu_complete (),
rl_do_lowercase_version (), rl_kill_full_line (),
rl_digit_argument (), rl_universal_argument (), rl_abort (),
rl_undo_command (), rl_revert_line (), rl_beginning_of_history (),
@@ -94,19 +93,13 @@ extern void rl_callback_handler_install ();
extern void rl_callback_read_char ();
extern void rl_callback_handler_remove ();
-/* Not available unless __CYGWIN32__ is defined. */
-#ifdef __CYGWIN32__
-extern int rl_paste_from_clipboard ();
-#endif
-
/* These are *both* defined even when VI_MODE is not. */
extern int rl_vi_editing_mode (), rl_emacs_editing_mode ();
/* Non incremental history searching. */
-extern int rl_noninc_forward_search ();
-extern int rl_noninc_reverse_search ();
-extern int rl_noninc_forward_search_again ();
-extern int rl_noninc_reverse_search_again ();
+extern int
+ rl_noninc_forward_search (), rl_noninc_reverse_search (),
+ rl_noninc_forward_search_again (), rl_noninc_reverse_search_again ();
/* Things for vi mode. Not available unless readline is compiled -DVI_MODE. */
extern int rl_vi_check ();
@@ -150,17 +143,10 @@ extern char *readline ();
If KEY is not -1, then bind it. */
extern int rl_add_defun ();
-extern Keymap rl_make_bare_keymap ();
-extern Keymap rl_copy_keymap ();
-extern Keymap rl_make_keymap ();
-extern void rl_discard_keymap ();
-extern Keymap rl_get_keymap (), rl_get_keymap_by_name ();
-extern void rl_set_keymap ();
extern char *rl_get_keymap_name ();
extern int rl_bind_key (), rl_bind_key_in_map ();
extern int rl_unbind_key (), rl_unbind_key_in_map ();
-extern int rl_unbind_function_in_map (), rl_unbind_command_in_map ();
extern int rl_set_key ();
extern int rl_generic_bind ();
extern int rl_parse_and_bind ();
@@ -410,6 +396,7 @@ extern int rl_inhibit_completion;
#define MULT_MATCH 2
#if !defined (savestring)
+#define savestring rl_savestring
extern char *savestring (); /* XXX backwards compatibility */
#endif
diff --git a/contrib/libreadline/rlconf.h b/contrib/libreadline/rlconf.h
index 8f07db1..e5594ce 100644
--- a/contrib/libreadline/rlconf.h
+++ b/contrib/libreadline/rlconf.h
@@ -32,7 +32,7 @@
/* If defined, readline shows opening parens and braces when closing
paren or brace entered. */
-/* #define PAREN_MATCHING */
+#define PAREN_MATCHING
/* This definition is needed by readline.c, rltty.c, and signals.c. */
/* If on, then readline handles signals in a way that doesn't screw. */
diff --git a/contrib/libreadline/shell.c b/contrib/libreadline/shell.c
index 553f3c1..c39e459 100644
--- a/contrib/libreadline/shell.c
+++ b/contrib/libreadline/shell.c
@@ -27,9 +27,6 @@
#endif
#if defined (HAVE_UNISTD_H)
-# ifdef _MINIX
-# include <sys/types.h>
-# endif
# include <unistd.h>
#endif /* HAVE_UNISTD_H */
@@ -39,12 +36,6 @@
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
-#if defined (HAVE_STRING_H)
-# include <string.h>
-#else
-# include <strings.h>
-#endif /* !HAVE_STRING_H */
-
extern char *xmalloc (), *xrealloc ();
#if !defined (SHELL)
@@ -56,7 +47,7 @@ extern char *xmalloc (), *xrealloc ();
/* Backwards compatibility, now that savestring has been removed from
all `public' readline header files. */
char *
-savestring (s)
+rl_savestring (s)
char *s;
{
return ((char *)strcpy (xmalloc (1 + (int)strlen (s)), (s)));
diff --git a/contrib/libreadline/util.c b/contrib/libreadline/util.c
index fde012e..d96b29e 100644
--- a/contrib/libreadline/util.c
+++ b/contrib/libreadline/util.c
@@ -166,58 +166,6 @@ rl_extend_line_buffer (len)
_rl_set_the_line ();
}
-
-/* A function for simple tilde expansion. */
-int
-rl_tilde_expand (ignore, key)
- int ignore, key;
-{
- register int start, end;
- char *homedir, *temp;
- int len;
-
- end = rl_point;
- start = end - 1;
-
- if (rl_point == rl_end && rl_line_buffer[rl_point] == '~')
- {
- homedir = tilde_expand ("~");
- _rl_replace_text (homedir, start, end);
- return (0);
- }
- else if (rl_line_buffer[start] != '~')
- {
- for (; !whitespace (rl_line_buffer[start]) && start >= 0; start--)
- ;
- start++;
- }
-
- end = start;
- do
- end++;
- while (whitespace (rl_line_buffer[end]) == 0 && end < rl_end);
-
- if (whitespace (rl_line_buffer[end]) || end >= rl_end)
- end--;
-
- /* If the first character of the current word is a tilde, perform
- tilde expansion and insert the result. If not a tilde, do
- nothing. */
- if (rl_line_buffer[start] == '~')
- {
- len = end - start + 1;
- temp = xmalloc (len + 1);
- strncpy (temp, rl_line_buffer + start, len);
- temp[len] = '\0';
- homedir = tilde_expand (temp);
- free (temp);
-
- _rl_replace_text (homedir, start, end);
- }
-
- return (0);
-}
-
/* **************************************************************** */
/* */
/* String Utility Functions */
@@ -352,13 +300,3 @@ _rl_digit_value (c)
{
return (isdigit (c) ? c - '0' : c);
}
-
-/* Backwards compatibility, now that savestring has been removed from
- all `public' readline header files. */
-#undef _rl_savestring
-char *
-_rl_savestring (s)
- char *s;
-{
- return ((char *)strcpy (xmalloc (1 + (int)strlen (s)), (s)));
-}
OpenPOWER on IntegriCloud