From e5103242d94d5211fa44bad651caaa7a61519867 Mon Sep 17 00:00:00 2001 From: ache Date: Wed, 11 Apr 2001 02:33:07 +0000 Subject: v4.2 initial import --- contrib/libreadline/CHANGELOG | 126 +++ contrib/libreadline/CHANGES | 153 ++++ contrib/libreadline/MANIFEST | 6 + contrib/libreadline/Makefile.in | 80 +- contrib/libreadline/README | 11 +- contrib/libreadline/aclocal.m4 | 58 +- contrib/libreadline/ansi_stdlib.h | 3 + contrib/libreadline/bind.c | 159 ++-- contrib/libreadline/callback.c | 46 +- contrib/libreadline/chardefs.h | 2 +- contrib/libreadline/compat.c | 113 +++ contrib/libreadline/complete.c | 189 ++--- contrib/libreadline/config.h.in | 3 +- contrib/libreadline/configure | 282 ++++--- contrib/libreadline/configure.in | 6 +- contrib/libreadline/display.c | 327 ++++---- contrib/libreadline/doc/Makefile.in | 21 +- contrib/libreadline/doc/hist.texinfo | 4 +- contrib/libreadline/doc/history.3 | 639 ++++++++++++++ contrib/libreadline/doc/hstech.texinfo | 181 ++-- contrib/libreadline/doc/hsuser.texinfo | 52 +- contrib/libreadline/doc/manvers.texinfo | 10 +- contrib/libreadline/doc/readline.3 | 182 ++-- contrib/libreadline/doc/rlman.texinfo | 4 +- contrib/libreadline/doc/rltech.texinfo | 879 ++++++++++++++------ contrib/libreadline/doc/rluser.texinfo | 371 +++++---- contrib/libreadline/doc/rluserman.texinfo | 6 +- contrib/libreadline/emacs_keymap.c | 1278 ++++++++++++++-------------- contrib/libreadline/examples/Makefile.in | 19 +- contrib/libreadline/examples/excallback.c | 2 + contrib/libreadline/examples/fileman.c | 27 +- contrib/libreadline/examples/histexamp.c | 12 +- contrib/libreadline/examples/manexamp.c | 12 +- contrib/libreadline/examples/rl.c | 4 +- contrib/libreadline/examples/rlfe.c | 383 ++++++++- contrib/libreadline/funmap.c | 28 +- contrib/libreadline/histexpand.c | 40 +- contrib/libreadline/histfile.c | 67 +- contrib/libreadline/histlib.h | 9 - contrib/libreadline/history.3 | 639 ++++++++++++++ contrib/libreadline/history.c | 31 +- contrib/libreadline/history.h | 44 +- contrib/libreadline/histsearch.c | 8 +- contrib/libreadline/input.c | 39 +- contrib/libreadline/isearch.c | 28 +- contrib/libreadline/keymaps.c | 2 +- contrib/libreadline/keymaps.h | 16 +- contrib/libreadline/kill.c | 14 +- contrib/libreadline/macro.c | 42 +- contrib/libreadline/nls.c | 6 +- contrib/libreadline/parens.c | 16 +- contrib/libreadline/readline.3 | 182 ++-- contrib/libreadline/readline.c | 226 +++-- contrib/libreadline/readline.h | 233 ++++-- contrib/libreadline/rldefs.h | 11 +- contrib/libreadline/rlprivate.h | 62 +- contrib/libreadline/rlshell.h | 10 +- contrib/libreadline/rlstdc.h | 12 + contrib/libreadline/rltty.c | 77 +- contrib/libreadline/rltypedefs.h | 88 ++ contrib/libreadline/search.c | 58 +- contrib/libreadline/shell.c | 15 +- contrib/libreadline/shlib/Makefile.in | 41 +- contrib/libreadline/signals.c | 11 +- contrib/libreadline/support/config.guess | 17 +- contrib/libreadline/support/config.sub | 10 +- contrib/libreadline/support/shlib-install | 20 +- contrib/libreadline/support/shobj-conf | 67 +- contrib/libreadline/terminal.c | 280 ++++--- contrib/libreadline/tilde.c | 43 +- contrib/libreadline/tilde.h | 29 +- contrib/libreadline/undo.c | 14 +- contrib/libreadline/util.c | 41 +- contrib/libreadline/vi_keymap.c | 1286 ++++++++++++++--------------- contrib/libreadline/vi_mode.c | 74 +- 75 files changed, 6403 insertions(+), 3183 deletions(-) create mode 100644 contrib/libreadline/compat.c create mode 100644 contrib/libreadline/doc/history.3 create mode 100644 contrib/libreadline/history.3 create mode 100644 contrib/libreadline/rltypedefs.h diff --git a/contrib/libreadline/CHANGELOG b/contrib/libreadline/CHANGELOG index 9024bdf..ab60559 100644 --- a/contrib/libreadline/CHANGELOG +++ b/contrib/libreadline/CHANGELOG @@ -337,3 +337,129 @@ doc/Makefile.in configure.in - changed LIBVERSION to 4.1-beta5 + + 3/17/2000 + --------- +[readline-4.1 released] + + 3/23 + ---- +Makefile.in + - remove the `-t' argument to ranlib in the install recipe; some + ranlibs don't have it and attempt to create a file named `-t' + + 3/27 + ---- +support/shlib-install + - install shared libraries unwritable by anyone on HP-UX + - changed symlinks to relative pathnames on all platforms + +shlib/Makefile.in + - added missing `includedir' assignment, substituted by configure + +Makefile.in + - added missing @SET_MAKE@ so configure can set $MAKE appropriately + +configure.in + - add call to AC_PROG_MAKE_SET + + 8/30 + ---- +shlib/Makefile.in + - change the soname bound into the shared libraries, so it includes + only the major version number. If it includes the minor version, + programs depending on it must be rebuilt (which may or may not be + a bad thing) + + 9/6 + --- +examples/rlfe.c + - add -l option to log input and output (-a option appends to logfile) + - add -n option to set readline application name + - add -v, -h options for version and help information + - change a few things because getopt() is now used to parse arguments + + 9/12 + ---- +support/shlib-install + - fix up the libname on HPUX 11 + + 10/18 + ----- +configure.in + - changed library version to 4.2-alpha + + 10/30 + ----- +configure.in + - add -fsigned-char to LOCAL_CFLAGS for Linux running on the IBM + S/390 + +Makefile.in + - added new file, rltypedefs.h, installed by default with `make install' + + 11/2 + ---- +compat.c + - new file, with backwards-compatibility function definitions + +Makefile.in,shlib/Makefile.in + - make sure that compat.o/compat.so are built and linked apppropriately + +support/shobj-conf + - picked up bash version, which means that shared libs built on + linux and BSD/OS 4.x will have an soname that does not include + the minor version number + + 11/13 + ----- +examples/rlfe.c + - rlfe can perform filename completion for relative pathnames in the + inferior process's context if the OS supports /proc/PID/cwd (linux + does it OK, Solaris is slightly warped, none of the BSDs have it) + + 11/17/2000 + ---------- +[readline-4.2-alpha released] + + 11/27 + ----- +Makefile.in,shlib/Makefile.in + - added dependencies for rltypedefs.h + +shlib/Makefile.in + - changed dependencies on histlib.h to $(topdir)/histlib.h + + 1/22 + ---- +configure.in + - changed release version to 4.2-beta + + 2/2 + --- +examples/Makefile.in + - build histexamp as part of the examples + + 2/5 + --- +doc/Makefile.in + - don't remove the dvi, postscript, html, info, and text `objects' + on a `make distclean', only on a `make maintainer-clean' + + 3/6 + --- +doc/history.{0,3}, doc/history_3.ps + - new manual page for history library + +doc/Makefile.in + - rules to install and uninstall history.3 in ${man3dir} + - rules to build history.0 and history_3.ps + + 4/2 + --- +configure.in + - changed LIBVERSION to `4.2' + + 4/5 + --- +[readline-4.2 frozen] diff --git a/contrib/libreadline/CHANGES b/contrib/libreadline/CHANGES index d2929ab..4f02f77 100644 --- a/contrib/libreadline/CHANGES +++ b/contrib/libreadline/CHANGES @@ -1,3 +1,156 @@ +This document details the changes between this version, readline-4.2, +and the previous version, readline-4.1. + +1. Changes to Readline + +a. When setting the terminal attributes on systems using `struct termio', + readline waits for output to drain before changing the attributes. + +b. A fix was made to the history word tokenization code to avoid attempts to + dereference a null pointer. + +c. Readline now defaults rl_terminal_name to $TERM if the calling application + has left it unset, and tries to initialize with the resultant value. + +d. Instead of calling (*rl_getc_function)() directly to get input in certain + places, readline now calls rl_read_key() consistently. + +e. Fixed a bug in the completion code that allowed a backslash to quote a + single quote inside a single-quoted string. + +f. rl_prompt is no longer assigned directly from the argument to readline(), + but uses memory allocated by readline. This allows constant strings to + be passed to readline without problems arising when the prompt processing + code wants to modify the string. + +g. Fixed a bug that caused non-interactive history searches to return the + wrong line when performing multiple searches backward for the same string. + +h. Many variables, function arguments, and function return values are now + declared `const' where appropriate, to improve behavior when linking with + C++ code. + +i. The control character detection code now works better on systems where + `char' is unsigned by default. + +j. The vi-mode numeric argument is now capped at 999999, just like emacs mode. + +k. The Function, CPFunction, CPPFunction, and VFunction typedefs have been + replaced with a set of specific prototyped typedefs, though they are + still in the readline header files for backwards compatibility. + +m. Nearly all of the (undocumented) internal global variables in the library + now have an _rl_ prefix -- there were a number that did not, like + screenheight, screenwidth, alphabetic, etc. + +n. The ding() convenience function has been renamed to rl_ding(), though the + old function is still defined for backwards compatibility. + +o. The completion convenience functions filename_completion_function, + username_completion_function, and completion_matches now have an rl_ + prefix, though the old names are still defined for backwards compatibility. + +p. The functions shared by readline and bash (linkage is satisfied from bash + when compiling with bash, and internally otherwise) now have an sh_ prefix. + +q. Changed the shared library creation procedure on Linux and BSD/OS 4.x so + that the `soname' contains only the major version number rather than the + major and minor numbers. + +r. Fixed a redisplay bug that occurred when the prompt spanned more than one + physical line and contained invisible characters. + +s. Added a missing `includedir' variable to the Makefile. + +t. When installing the shared libraries, make sure symbolic links are relative. + +u. Added configure test so that it can set `${MAKE}' appropriately. + +v. Fixed a bug in rl_forward that could cause the point to be set to before + the beginning of the line in vi mode. + +w. Fixed a bug in the callback read-char interface to make it work when a + readline function pushes some input onto the input stream with + rl_execute_next (like the incremental search functions). + +x. Fixed a file descriptor leak in the history file manipulation code that + was tripped when attempting to truncate a non-regular file (like + /dev/null). + +y. Changes to make all of the exported readline functions declared in + readline.h have an rl_ prefix (rltty_set_default_bindings is now + rl_tty_set_default_bindings, crlf is now rl_crlf, etc.) + +z. The formatted documentation included in the base readline distribution + is no longer removed on a `make distclean'. + +aa. Some changes were made to avoid gcc warnings with -Wall. + +bb. rl_get_keymap_by_name now finds keymaps case-insensitively, so + `set keymap EMACS' works. + +cc. The history file writing and truncation functions now return a useful + status on error. + +dd. Fixed a bug that could cause applications to dereference a NULL pointer + if a NULL second argument was passed to history_expand(). + +ee. If a hook function assigned to rl_event_hook sets rl_done to a non-zero + value, rl_read_key() now immediately returns '\n' (which is assumed to + be bound to accept-line). + +2. New Features in Readline + +a. The blink timeout for paren matching is now settable by applications, + via the rl_set_paren_blink_timeout() function. + +b. _rl_executing_macro has been renamed to rl_executing_macro, which means + it's now part of the public interface. + +c. Readline has a new variable, rl_readline_state, which is a bitmap that + encapsulates the current state of the library; intended for use by + callbacks and hook functions. + +d. rlfe has a new -l option to log input and output (-a appends to logfile), + a new -n option to set the readline application name, and -v and -h + options for version and help information. + +e. rlfe can now perform filename completion for the inferior process if the + OS has a /proc//cwd that can be read with readlink(2) to get the + inferior's current working directory. + +f. A new file, rltypedefs.h, contains the new typedefs for function pointers + and is installed by `make install'. + +g. New application-callable function rl_set_prompt(const char *prompt): + expands its prompt string argument and sets rl_prompt to the result. + +h. New application-callable function rl_set_screen_size(int rows, int cols): + public method for applications to set readline's idea of the screen + dimensions. + +i. The history example program (examples/histexamp.c) is now built as one + of the examples. + +j. The documentation has been updated to cover nearly all of the public + functions and variables declared in readline.h. + +k. New function, rl_get_screen_size (int *rows, int *columns), returns + readline's idea of the screen dimensions. + +l. The timeout in rl_gather_tyi (readline keyboard input polling function) + is now settable via a function (rl_set_keyboard_input_timeout()). + +m. Renamed the max_input_history variable to history_max_entries; the old + variable is maintained for backwards compatibility. + +n. The list of characters that separate words for the history tokenizer is + now settable with a variable: history_word_delimiters. The default + value is as before. + +o. There is a new history.3 manual page documenting the history library. + +------------------------------------------------------------------------------- This document details the changes between this version, readline-4.1, and the previous version, readline-4.0. diff --git a/contrib/libreadline/MANIFEST b/contrib/libreadline/MANIFEST index a51ca05..e80aba7 100644 --- a/contrib/libreadline/MANIFEST +++ b/contrib/libreadline/MANIFEST @@ -32,11 +32,13 @@ rlprivate.h f rlshell.h f rlstdc.h f rltty.h f +rltypedefs.h f rlwinsize.h f tcap.h f tilde.h f xmalloc.h f bind.c f +compat.c f complete.c f display.c f emacs_keymap.c f @@ -85,6 +87,7 @@ doc/hist.texinfo f doc/hstech.texinfo f doc/hsuser.texinfo f doc/readline.3 f +doc/history.3 f doc/texi2dvi f doc/texi2html f examples/Makefile.in f @@ -111,3 +114,6 @@ doc/readline.html f doc/history.html f doc/rluserman.html f doc/readline.0 f +doc/history.0 f +doc/readline_3.ps f +doc/history_3.ps f diff --git a/contrib/libreadline/Makefile.in b/contrib/libreadline/Makefile.in index 023496d..4caf6a8 100644 --- a/contrib/libreadline/Makefile.in +++ b/contrib/libreadline/Makefile.in @@ -35,6 +35,7 @@ RM = rm -f CP = cp MV = mv +@SET_MAKE@ SHELL = @MAKE_SHELL@ prefix = @prefix@ @@ -65,7 +66,14 @@ TERMCAP_LIB = @TERMCAP_LIB@ # For libraries which include headers from other libraries. INCLUDES = -I. -I$(srcdir) -I$(includedir) -CCFLAGS = $(DEFS) $(LOCAL_DEFS) $(CPPFLAGS) $(INCLUDES) $(LOCAL_CFLAGS) $(CFLAGS) +XCCFLAGS = $(DEFS) $(LOCAL_DEFS) $(CPPFLAGS) $(INCLUDES) +CCFLAGS = $(XCCFLAGS) $(LOCAL_CFLAGS) $(CFLAGS) + +# could add -Werror here +GCC_LINT_FLAGS = -ansi -Wall -Wshadow -Wpointer-arith -Wcast-qual \ + -Wwrite-strings -Wstrict-prototypes \ + -Wmissing-prototypes -Wno-implicit +GCC_LINT_CFLAGS = $(XCCFLAGS) $(GCC_LINT_FLAGS) @CFLAGS@ @LOCAL_CFLAGS@ .c.o: ${RM} $@ @@ -85,19 +93,21 @@ CSOURCES = $(srcdir)/readline.c $(srcdir)/funmap.c $(srcdir)/keymaps.c \ $(srcdir)/callback.c $(srcdir)/terminal.c $(srcdir)/xmalloc.c \ $(srcdir)/history.c $(srcdir)/histsearch.c $(srcdir)/histexpand.c \ $(srcdir)/histfile.c $(srcdir)/nls.c $(srcdir)/search.c \ - $(srcdir)/shell.c $(srcdir)/savestring.c $(srcdir)/tilde.c + $(srcdir)/shell.c $(srcdir)/savestring.c $(srcdir)/tilde.c \ + $(srcdir)/compat.c # The header files for this library. HSOURCES = readline.h rldefs.h chardefs.h keymaps.h history.h histlib.h \ posixstat.h posixdir.h posixjmp.h tilde.h rlconf.h rltty.h \ - ansi_stdlib.h tcap.h rlstdc.h xmalloc.h rlprivate.h rlshell.h + ansi_stdlib.h tcap.h rlstdc.h xmalloc.h rlprivate.h rlshell.h \ + rltypedefs.h HISTOBJ = history.o histexpand.o histfile.o histsearch.o shell.o TILDEOBJ = tilde.o OBJECTS = readline.o vi_mode.o funmap.o keymaps.o parens.o search.o \ rltty.o complete.o bind.o isearch.o display.o signals.o \ util.o kill.o undo.o macro.o input.o callback.o terminal.o \ - nls.o xmalloc.o $(HISTOBJ) $(TILDEOBJ) + nls.o compat.o xmalloc.o $(HISTOBJ) $(TILDEOBJ) # The texinfo files which document this library. DOCSOURCE = doc/rlman.texinfo doc/rltech.texinfo doc/rluser.texinfo @@ -111,7 +121,7 @@ CREATED_CONFIGURE = config.status config.h config.cache config.log \ CREATED_TAGS = TAGS tags INSTALLED_HEADERS = readline.h chardefs.h keymaps.h history.h tilde.h \ - rlstdc.h rlconf.h + rlstdc.h rlconf.h rltypedefs.h ########################################################################## @@ -134,6 +144,9 @@ libhistory.a: $(HISTOBJ) xmalloc.o readline: $(OBJECTS) readline.h rldefs.h chardefs.h ./libreadline.a $(CC) $(CCFLAGS) -o $@ ./examples/rl.c ./libreadline.a ${TERMCAP_LIB} +lint: force + $(MAKE) $(MFLAGS) CCFLAGS='$(GCC_LINT_CFLAGS)' static + Makefile makefile: config.status $(srcdir)/Makefile.in CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status @@ -183,10 +196,10 @@ maybe-uninstall-headers: uninstall-headers install: installdirs $(STATIC_LIBS) install-headers -$(MV) $(libdir)/libreadline.a $(libdir)/libreadline.old $(INSTALL_DATA) libreadline.a $(libdir)/libreadline.a - -test -n "$(RANLIB)" && $(RANLIB) -t $(libdir)/libreadline.a + -test -n "$(RANLIB)" && $(RANLIB) $(libdir)/libreadline.a -$(MV) $(libdir)/libhistory.a $(libdir)/libhistory.old $(INSTALL_DATA) libhistory.a $(libdir)/libhistory.a - -test -n "$(RANLIB)" && $(RANLIB) -t $(libdir)/libhistory.a + -test -n "$(RANLIB)" && $(RANLIB) $(libdir)/libhistory.a -( if test -d doc ; then \ cd doc && \ ${MAKE} ${MFLAGS} infodir=$(infodir) $@; \ @@ -253,90 +266,91 @@ dist: force # Dependencies bind.o: ansi_stdlib.h posixstat.h bind.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h -bind.o: readline.h keymaps.h chardefs.h tilde.h rlstdc.h +bind.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h rlstdc.h bind.o: history.h callback.o: rlconf.h callback.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h -callback.o: readline.h keymaps.h chardefs.h tilde.h rlstdc.h +callback.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h rlstdc.h +compat.o: rlstdc.h complete.o: ansi_stdlib.h posixdir.h posixstat.h complete.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h -complete.o: readline.h keymaps.h chardefs.h tilde.h rlstdc.h +complete.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h rlstdc.h display.o: ansi_stdlib.h posixstat.h display.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h display.o: tcap.h -display.o: readline.h keymaps.h chardefs.h tilde.h +display.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h display.o: history.h rlstdc.h -funmap.o: readline.h keymaps.h chardefs.h tilde.h +funmap.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h funmap.o: rlconf.h ansi_stdlib.h rlstdc.h funmap.o: ${BUILD_DIR}/config.h histexpand.o: ansi_stdlib.h -histexpand.o: history.h histlib.h rlstdc.h +histexpand.o: history.h histlib.h rlstdc.h rltypedefs.h histexpand.o: ${BUILD_DIR}/config.h histfile.o: ansi_stdlib.h -histfile.o: history.h histlib.h rlstdc.h +histfile.o: history.h histlib.h rlstdc.h rltypedefs.h histfile.o: ${BUILD_DIR}/config.h history.o: ansi_stdlib.h -history.o: history.h histlib.h rlstdc.h +history.o: history.h histlib.h rlstdc.h rltypedefs.h history.o: ${BUILD_DIR}/config.h histsearch.o: ansi_stdlib.h -histsearch.o: history.h histlib.h rlstdc.h +histsearch.o: history.h histlib.h rlstdc.h rltypedefs.h histsearch.o: ${BUILD_DIR}/config.h input.o: ansi_stdlib.h input.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h -input.o: readline.h keymaps.h chardefs.h tilde.h rlstdc.h +input.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h rlstdc.h isearch.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h -isearch.o: readline.h keymaps.h chardefs.h tilde.h +isearch.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h isearch.o: ansi_stdlib.h history.h rlstdc.h keymaps.o: emacs_keymap.c vi_keymap.c -keymaps.o: keymaps.h chardefs.h rlconf.h ansi_stdlib.h -keymaps.o: readline.h keymaps.h chardefs.h tilde.h +keymaps.o: keymaps.h rltypedefs.h chardefs.h rlconf.h ansi_stdlib.h +keymaps.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h keymaps.o: ${BUILD_DIR}/config.h rlstdc.h kill.o: ansi_stdlib.h kill.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h -kill.o: readline.h keymaps.h chardefs.h tilde.h +kill.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h kill.o: history.h rlstdc.h macro.o: ansi_stdlib.h macro.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h -macro.o: readline.h keymaps.h chardefs.h tilde.h +macro.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h macro.o: history.h rlstdc.h nls.o: ansi_stdlib.h nls.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h -nls.o: readline.h keymaps.h chardefs.h tilde.h +nls.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h nls.o: history.h rlstdc.h parens.o: rlconf.h parens.o: ${BUILD_DIR}/config.h -parens.o: readline.h keymaps.h chardefs.h tilde.h rlstdc.h -readline.o: readline.h keymaps.h chardefs.h tilde.h +parens.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h rlstdc.h +readline.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h readline.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h readline.o: history.h rlstdc.h readline.o: posixstat.h ansi_stdlib.h posixjmp.h rltty.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h rltty.o: rltty.h -rltty.o: readline.h keymaps.h chardefs.h tilde.h rlstdc.h +rltty.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h rlstdc.h search.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h -search.o: readline.h keymaps.h chardefs.h tilde.h +search.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h search.o: ansi_stdlib.h history.h rlstdc.h shell.o: ${BUILD_DIR}/config.h shell.o: ansi_stdlib.h signals.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h -signals.o: readline.h keymaps.h chardefs.h tilde.h +signals.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h signals.o: history.h rlstdc.h terminal.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h terminal.o: tcap.h -terminal.o: readline.h keymaps.h chardefs.h tilde.h +terminal.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h terminal.o: history.h rlstdc.h tilde.o: ansi_stdlib.h tilde.o: ${BUILD_DIR}/config.h tilde.o: tilde.h undo.o: ansi_stdlib.h undo.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h -undo.o: readline.h keymaps.h chardefs.h tilde.h +undo.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h undo.o: history.h rlstdc.h util.o: posixjmp.h ansi_stdlib.h util.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h -util.o: readline.h keymaps.h chardefs.h tilde.h rlstdc.h +util.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h rlstdc.h vi_mode.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h -vi_mode.o: readline.h keymaps.h chardefs.h tilde.h +vi_mode.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h vi_mode.o: history.h ansi_stdlib.h rlstdc.h xmalloc.o: ${BUILD_DIR}/config.h xmalloc.o: ansi_stdlib.h @@ -396,6 +410,7 @@ keymaps.o: $(srcdir)/keymaps.c parens.o: $(srcdir)/parens.c search.o: $(srcdir)/search.c rltty.o: $(srcdir)/rltty.c +compat.o: $(srcdir)/compat.c complete.o: $(srcdir)/complete.c bind.o: $(srcdir)/bind.c isearch.o: $(srcdir)/isearch.c @@ -425,6 +440,7 @@ keymaps.o: keymaps.c parens.o: parens.c search.o: search.c rltty.o: rltty.c +compat.o: compat.c complete.o: complete.c bind.o: bind.c isearch.o: isearch.c diff --git a/contrib/libreadline/README b/contrib/libreadline/README index 41a5d0c..53680c3 100644 --- a/contrib/libreadline/README +++ b/contrib/libreadline/README @@ -1,7 +1,7 @@ Introduction ============ -This is the Gnu Readline library, version 4.1. +This is the Gnu Readline library, version 4.2. The Readline library provides a set of functions for use by applications that allow users to edit command lines as they are typed in. Both @@ -37,6 +37,9 @@ to customize and control the build process. The file rlconf.h contains C preprocessor defines that enable and disable certain Readline features. +The special make target `everything' will build the static and shared +libraries (if the target platform supports them) and the examples. + Examples ======== @@ -64,8 +67,8 @@ your platform. If you need to update support/shobj-conf, you will need to create a `stanza' for your operating system and compiler. The script uses the value of host_os and ${CC} as determined by configure. For -instance, FreeBSD 2.2.5 with any version of gcc is identified as -`freebsd2.2.5-gcc*'. +instance, FreeBSD 4.2 using the ELF object file format with any +version of gcc is identified as `freebsdelf4.2-gcc*'. In the stanza for your operating system-compiler pair, you will need to define several variables. They are: @@ -144,7 +147,7 @@ Bug reports for Readline should be sent to: When reporting a bug, please include the following information: - * the version number and release status of Readline (e.g., 4.0-release) + * the version number and release status of Readline (e.g., 4.2-release) * the machine and OS that it is running on * a list of the compilation flags or the contents of `config.h', if appropriate diff --git a/contrib/libreadline/aclocal.m4 b/contrib/libreadline/aclocal.m4 index f8f5b74..8c977c1 100644 --- a/contrib/libreadline/aclocal.m4 +++ b/contrib/libreadline/aclocal.m4 @@ -1065,17 +1065,19 @@ fi ]) AC_DEFUN(BASH_CHECK_GETPW_FUNCS, -[AC_MSG_CHECKING(whether programs are able to redeclare getpw functions) -AC_CACHE_VAL(bash_cv_can_redecl_getpw, -[AC_TRY_COMPILE([#include +[AC_MSG_CHECKING(whether getpw functions are declared in pwd.h) +AC_CACHE_VAL(bash_cv_getpw_declared, +[AC_EGREP_CPP(getpwuid, +[ +#include +#ifdef HAVE_UNISTD_H +# include +#endif #include -extern struct passwd *getpwent(); -extern struct passwd *getpwuid(); -extern struct passwd *getpwnam();], -[struct passwd *z; z = getpwent(); z = getpwuid(0); z = getpwnam("root");], - bash_cv_can_redecl_getpw=yes,bash_cv_can_redecl_getpw=no)]) -AC_MSG_RESULT($bash_cv_can_redecl_getpw) -if test $bash_cv_can_redecl_getpw = no; then +], +bash_cv_getpw_declared=yes,bash_cv_getpw_declared=no)]) +AC_MSG_RESULT($bash_cv_getpw_declared) +if test $bash_cv_getpw_declared = yes; then AC_DEFINE(HAVE_GETPW_DECLS) fi ]) @@ -1350,12 +1352,15 @@ dnl causes system calls to be restarted after the signal is caught dnl AC_DEFUN(BASH_SYS_RESTARTABLE_SYSCALLS, [AC_REQUIRE([BASH_SIGNAL_CHECK]) -AC_CACHE_CHECK(for restartable system calls with posix sigaction, +AC_CACHE_CHECK(whether posix sigaction restarts system calls by default, bash_cv_sys_restartable_syscalls, [AC_TRY_RUN( [/* Exit 0 (true) if wait returns something other than -1, i.e. the pid of the child, which means that wait was restarted after getting the signal. */ +#ifdef HAVE_UNISTD_H +# include +#endif #include #include static int caught = 0; @@ -1425,3 +1430,34 @@ if test $bash_cv_struct_timeval = yes; then AC_DEFINE(HAVE_TIMEVAL) fi ]) + +AC_DEFUN(BASH_CHECK_RTSIGS, +[AC_MSG_CHECKING(for unusable real-time signals due to large values) +AC_CACHE_VAL(bash_cv_unusable_rtsigs, +[AC_TRY_RUN([ +#include +#include + +#ifndef NSIG +# define NSIG 64 +#endif + +main () +{ + int n_sigs = 2 * NSIG; +#ifdef SIGRTMIN + int rtmin = SIGRTMIN; +#else + int rtmin = 0; +#endif + + exit(rtmin < n_sigs); +}], bash_cv_unusable_rtsigs=yes, bash_cv_unusable_rtsigs=no, + [AC_MSG_WARN(cannot check real-time signals if cross compiling -- defaulting to yes) + bash_cv_unusable_rtsigs=yes] +)]) +AC_MSG_RESULT($bash_cv_unusable_rtsigs) +if test $bash_cv_unusable_rtsigs = yes; then +AC_DEFINE(UNUSABLE_RT_SIGNALS) +fi +]) diff --git a/contrib/libreadline/ansi_stdlib.h b/contrib/libreadline/ansi_stdlib.h index a720cb9..3a354f2 100644 --- a/contrib/libreadline/ansi_stdlib.h +++ b/contrib/libreadline/ansi_stdlib.h @@ -27,6 +27,9 @@ extern int atoi (); extern long int atol (); +extern double atof (); +extern double strtod (); + /* Memory allocation functions. */ extern char *malloc (); extern char *realloc (); diff --git a/contrib/libreadline/bind.c b/contrib/libreadline/bind.c index 6a6424e..74fa6f2 100644 --- a/contrib/libreadline/bind.c +++ b/contrib/libreadline/bind.c @@ -68,9 +68,9 @@ extern char *strchr (), *strrchr (); /* Variables exported by this file. */ Keymap rl_binding_keymap; -static int _rl_read_init_file __P((char *, int)); +static int _rl_read_init_file __P((const char *, int)); static int glean_key_from_name __P((char *)); -static int substring_member_of_array __P((char *, char **)); +static int substring_member_of_array __P((char *, const char **)); static int currently_reading_init_file; @@ -83,13 +83,13 @@ static int _rl_prefer_visible_bell = 1; /* */ /* **************************************************************** */ -/* rl_add_defun (char *name, Function *function, int key) +/* rl_add_defun (char *name, rl_command_func_t *function, int key) Add NAME to the list of named functions. Make FUNCTION be the function that gets called. If KEY is not -1, then bind it. */ int rl_add_defun (name, function, key) - char *name; - Function *function; + const char *name; + rl_command_func_t *function; int key; { if (key != -1) @@ -102,7 +102,7 @@ rl_add_defun (name, function, key) int rl_bind_key (key, function) int key; - Function *function; + rl_command_func_t *function; { if (key < 0) return (key); @@ -133,7 +133,7 @@ rl_bind_key (key, function) int rl_bind_key_in_map (key, function, map) int key; - Function *function; + rl_command_func_t *function; Keymap map; { int result; @@ -152,7 +152,7 @@ int rl_unbind_key (key) int key; { - return (rl_bind_key (key, (Function *)NULL)); + return (rl_bind_key (key, (rl_command_func_t *)NULL)); } /* Make KEY do nothing in MAP. @@ -162,13 +162,13 @@ rl_unbind_key_in_map (key, map) int key; Keymap map; { - return (rl_bind_key_in_map (key, (Function *)NULL, map)); + return (rl_bind_key_in_map (key, (rl_command_func_t *)NULL, map)); } /* Unbind all keys bound to FUNCTION in MAP. */ int rl_unbind_function_in_map (func, map) - Function *func; + rl_command_func_t *func; Keymap map; { register int i, rval; @@ -177,7 +177,7 @@ rl_unbind_function_in_map (func, map) { if (map[i].type == ISFUNC && map[i].function == func) { - map[i].function = (Function *)NULL; + map[i].function = (rl_command_func_t *)NULL; rval = 1; } } @@ -186,10 +186,10 @@ rl_unbind_function_in_map (func, map) int rl_unbind_command_in_map (command, map) - char *command; + const char *command; Keymap map; { - Function *func; + rl_command_func_t *func; func = rl_named_function (command); if (func == 0) @@ -202,8 +202,8 @@ rl_unbind_command_in_map (command, map) place to do bindings is in MAP. */ int rl_set_key (keyseq, function, map) - char *keyseq; - Function *function; + const char *keyseq; + rl_command_func_t *function; Keymap map; { return (rl_generic_bind (ISFUNC, keyseq, (char *)function, map)); @@ -214,7 +214,7 @@ rl_set_key (keyseq, function, map) necessary. The initial place to do bindings is in MAP. */ int rl_macro_bind (keyseq, macro, map) - char *keyseq, *macro; + const char *keyseq, *macro; Keymap map; { char *macro_keys; @@ -239,7 +239,8 @@ rl_macro_bind (keyseq, macro, map) int rl_generic_bind (type, keyseq, data, map) int type; - char *keyseq, *data; + const char *keyseq; + char *data; Keymap map; { char *keys; @@ -309,7 +310,8 @@ rl_generic_bind (type, keyseq, data, map) non-zero if there was an error parsing SEQ. */ int rl_translate_keyseq (seq, array, len) - char *seq, *array; + const char *seq; + char *array; int *len; { register int i, c, l, temp; @@ -513,9 +515,9 @@ _rl_untranslate_macro_value (seq) /* Return a pointer to the function that STRING represents. If STRING doesn't have a matching function, then a NULL pointer is returned. */ -Function * +rl_command_func_t * rl_named_function (string) - char *string; + const char *string; { register int i; @@ -524,7 +526,7 @@ rl_named_function (string) for (i = 0; funmap[i]; i++) if (_rl_stricmp (funmap[i]->name, string) == 0) return (funmap[i]->function); - return ((Function *)NULL); + return ((rl_command_func_t *)NULL); } /* Return the function (or macro) definition which would be invoked via @@ -532,9 +534,9 @@ rl_named_function (string) used. TYPE, if non-NULL, is a pointer to an int which will receive the type of the object pointed to. One of ISFUNC (function), ISKMAP (keymap), or ISMACR (macro). */ -Function * +rl_command_func_t * rl_function_of_keyseq (keyseq, map, type) - char *keyseq; + const char *keyseq; Keymap map; int *type; { @@ -585,14 +587,14 @@ rl_function_of_keyseq (keyseq, map, type) return (map[ic].function); } } - return ((Function *) NULL); + return ((rl_command_func_t *) NULL); } /* The last key bindings file read. */ static char *last_readline_init_file = (char *)NULL; /* The file we're currently reading key bindings from. */ -static char *current_readline_init_file; +static const char *current_readline_init_file; static int current_readline_init_include_level; static int current_readline_init_lineno; @@ -659,7 +661,7 @@ rl_re_read_init_file (count, ignore) int count, ignore; { int r; - r = rl_read_init_file ((char *)NULL); + r = rl_read_init_file ((const char *)NULL); rl_set_keymap_from_edit_mode (); return r; } @@ -673,14 +675,14 @@ rl_re_read_init_file (count, ignore) otherwise errno is returned. */ int rl_read_init_file (filename) - char *filename; + const char *filename; { /* Default the filename. */ if (filename == 0) { filename = last_readline_init_file; if (filename == 0) - filename = get_env_value ("INPUTRC"); + filename = sh_get_env_value ("INPUTRC"); if (filename == 0) filename = DEFAULT_INPUTRC; } @@ -698,7 +700,7 @@ rl_read_init_file (filename) static int _rl_read_init_file (filename, include_level) - char *filename; + const char *filename; int include_level; { register int i; @@ -733,7 +735,7 @@ _rl_read_init_file (filename, include_level) /* Find the end of this line. */ for (i = 0; line + i != end && line[i] != '\n'; i++); -#if defined (__CYGWIN32__) +#if defined (__CYGWIN__) /* ``Be liberal in what you accept.'' */ if (line[i] == '\n' && line[i-1] == '\r') line[i - 1] = '\0'; @@ -780,10 +782,21 @@ _rl_init_file_error (msg) /* */ /* **************************************************************** */ +typedef int _rl_parser_func_t __P((char *)); + +/* Things that mean `Control'. */ +const char *_rl_possible_control_prefixes[] = { + "Control-", "C-", "CTRL-", (const char *)NULL +}; + +const char *_rl_possible_meta_prefixes[] = { + "Meta", "M-", (const char *)NULL +}; + /* Conditionals. */ /* Calling programs set this to have their argv[0]. */ -char *rl_readline_name = "other"; +const char *rl_readline_name = "other"; /* Stack of previous values of parsing_conditionalized_out. */ static unsigned char *if_stack = (unsigned char *)NULL; @@ -905,7 +918,8 @@ static int parser_include (args) char *args; { - char *old_init_file, *e; + const char *old_init_file; + char *e; int old_line_number, old_include_level, r; if (_rl_parsing_conditionalized_out) @@ -918,7 +932,7 @@ parser_include (args) e = strchr (args, '\n'); if (e) *e = '\0'; - r = _rl_read_init_file (args, old_include_level + 1); + r = _rl_read_init_file ((const char *)args, old_include_level + 1); current_readline_init_file = old_init_file; current_readline_init_lineno = old_line_number; @@ -929,14 +943,14 @@ parser_include (args) /* Associate textual names with actual functions. */ static struct { - char *name; - Function *function; + const char *name; + _rl_parser_func_t *function; } parser_directives [] = { { "if", parser_if }, { "endif", parser_endif }, { "else", parser_else }, { "include", parser_include }, - { (char *)0x0, (Function *)0x0 } + { (char *)0x0, (_rl_parser_func_t *)0x0 } }; /* Handle a parser directive. STATEMENT is the line of the directive @@ -1180,10 +1194,10 @@ rl_parse_and_bind (string) key = glean_key_from_name (kname); /* Add in control and meta bits. */ - if (substring_member_of_array (string, possible_control_prefixes)) + if (substring_member_of_array (string, _rl_possible_control_prefixes)) key = CTRL (_rl_to_upper (key)); - if (substring_member_of_array (string, possible_meta_prefixes)) + if (substring_member_of_array (string, _rl_possible_meta_prefixes)) key = META (key); /* Temporary. Handle old-style keyname with macro-binding. */ @@ -1221,7 +1235,7 @@ rl_parse_and_bind (string) #define V_SPECIAL 0x1 static struct { - char *name; + const char *name; int *value; int flags; } boolean_varlist [] = { @@ -1265,7 +1279,7 @@ static void hack_special_boolean_var (i) int i; { - char *name; + const char *name; name = boolean_varlist[i].name; @@ -1280,6 +1294,8 @@ hack_special_boolean_var (i) } } +typedef int _rl_sv_func_t __P((const char *)); + /* These *must* correspond to the array indices for the appropriate string variable. (Though they're not used right now.) */ #define V_BELLSTYLE 0 @@ -1292,17 +1308,17 @@ hack_special_boolean_var (i) #define V_INT 2 /* Forward declarations */ -static int sv_bell_style __P((char *)); -static int sv_combegin __P((char *)); -static int sv_compquery __P((char *)); -static int sv_editmode __P((char *)); -static int sv_isrchterm __P((char *)); -static int sv_keymap __P((char *)); +static int sv_bell_style __P((const char *)); +static int sv_combegin __P((const char *)); +static int sv_compquery __P((const char *)); +static int sv_editmode __P((const char *)); +static int sv_isrchterm __P((const char *)); +static int sv_keymap __P((const char *)); static struct { - char *name; + const char *name; int flags; - Function *set_func; + _rl_sv_func_t *set_func; } string_varlist[] = { { "bell-style", V_STRING, sv_bell_style }, { "comment-begin", V_STRING, sv_combegin }, @@ -1339,7 +1355,7 @@ bool_to_int (value) int rl_variable_bind (name, value) - char *name, *value; + const char *name, *value; { register int i; int v; @@ -1367,7 +1383,7 @@ rl_variable_bind (name, value) static int sv_editmode (value) - char *value; + const char *value; { if (_rl_strnicmp (value, "vi", 2) == 0) { @@ -1388,7 +1404,7 @@ sv_editmode (value) static int sv_combegin (value) - char *value; + const char *value; { if (value && *value) { @@ -1401,7 +1417,7 @@ sv_combegin (value) static int sv_compquery (value) - char *value; + const char *value; { int nval = 100; @@ -1417,7 +1433,7 @@ sv_compquery (value) static int sv_keymap (value) - char *value; + const char *value; { Keymap kmap; @@ -1434,7 +1450,7 @@ sv_keymap (value) static int sv_bell_style (value) - char *value; + const char *value; { if (value == 0 || *value == '\0') _SET_BELL (AUDIBLE_BELL); @@ -1451,7 +1467,7 @@ sv_bell_style (value) static int sv_isrchterm (value) - char *value; + const char *value; { int beg, end, delim; char *v; @@ -1489,7 +1505,7 @@ sv_isrchterm (value) For example, `Space' returns ' '. */ typedef struct { - char *name; + const char *name; int value; } assoc_list; @@ -1523,7 +1539,7 @@ glean_key_from_name (name) /* Auxiliary functions to manage keymaps. */ static struct { - char *name; + const char *name; Keymap map; } keymap_names[] = { { "emacs", emacs_standard_keymap }, @@ -1541,12 +1557,12 @@ static struct { Keymap rl_get_keymap_by_name (name) - char *name; + const char *name; { register int i; for (i = 0; keymap_names[i].name; i++) - if (strcmp (name, keymap_names[i].name) == 0) + if (_rl_stricmp (name, keymap_names[i].name) == 0) return (keymap_names[i].map); return ((Keymap) NULL); } @@ -1558,7 +1574,7 @@ rl_get_keymap_name (map) register int i; for (i = 0; keymap_names[i].name; i++) if (map == keymap_names[i].map) - return (keymap_names[i].name); + return ((char *)keymap_names[i].name); return ((char *)NULL); } @@ -1616,7 +1632,7 @@ void rl_list_funmap_names () { register int i; - char **funmap_names; + const char **funmap_names; funmap_names = rl_funmap_names (); @@ -1706,7 +1722,7 @@ _rl_get_keyname (key) sequences that are used to invoke FUNCTION in MAP. */ char ** rl_invoking_keyseqs_in_map (function, map) - Function *function; + rl_command_func_t *function; Keymap map; { register int key; @@ -1806,7 +1822,7 @@ rl_invoking_keyseqs_in_map (function, map) sequences that can be used to invoke FUNCTION using the current keymap. */ char ** rl_invoking_keyseqs (function) - Function *function; + rl_command_func_t *function; { return (rl_invoking_keyseqs_in_map (function, _rl_keymap)); } @@ -1819,8 +1835,8 @@ rl_function_dumper (print_readably) int print_readably; { register int i; - char **names; - char *name; + const char **names; + const char *name; names = rl_funmap_names (); @@ -1828,7 +1844,7 @@ rl_function_dumper (print_readably) for (i = 0; name = names[i]; i++) { - Function *function; + rl_command_func_t *function; char **invokers; function = rl_named_function (name); @@ -1985,7 +2001,7 @@ rl_variable_dumper (print_readably) int print_readably; { int i; - char *kname; + const char *kname; for (i = 0; boolean_varlist[i].name; i++) { @@ -2073,10 +2089,10 @@ rl_dump_variables (count, key) /* Bind key sequence KEYSEQ to DEFAULT_FUNC if KEYSEQ is unbound. */ void _rl_bind_if_unbound (keyseq, default_func) - char *keyseq; - Function *default_func; + const char *keyseq; + rl_command_func_t *default_func; { - Function *func; + rl_command_func_t *func; if (keyseq) { @@ -2089,7 +2105,8 @@ _rl_bind_if_unbound (keyseq, default_func) /* Return non-zero if any members of ARRAY are a substring in STRING. */ static int substring_member_of_array (string, array) - char *string, **array; + char *string; + const char **array; { while (*array) { diff --git a/contrib/libreadline/callback.c b/contrib/libreadline/callback.c index 1172356..9ddf9f1 100644 --- a/contrib/libreadline/callback.c +++ b/contrib/libreadline/callback.c @@ -52,7 +52,7 @@ text read in at each end of line. The terminal is kept prepped and signals handled all the time, except during calls to the user's function. */ -VFunction *rl_linefunc; /* user callback function */ +rl_vcpfunc_t *rl_linefunc; /* user callback function */ static int in_handler; /* terminal_prepped and signals set? */ /* Make sure the terminal is set up, initialize readline, and prompt. */ @@ -78,11 +78,10 @@ _rl_callback_newline () /* Install a readline handler, set up the terminal, and issue the prompt. */ void rl_callback_handler_install (prompt, linefunc) - char *prompt; - VFunction *linefunc; + const char *prompt; + rl_vcpfunc_t *linefunc; { - rl_prompt = prompt; - rl_visible_prompt_length = rl_prompt ? rl_expand_prompt (rl_prompt) : 0; + rl_set_prompt (prompt); rl_linefunc = linefunc; _rl_callback_newline (); } @@ -102,24 +101,33 @@ rl_callback_read_char () eof = readline_internal_char (); - if (rl_done) + /* We loop in case some function has pushed input back with rl_execute_next. */ + for (;;) { - line = readline_internal_teardown (eof); + if (rl_done) + { + line = readline_internal_teardown (eof); - (*rl_deprep_term_function) (); + (*rl_deprep_term_function) (); #if defined (HANDLE_SIGNALS) - rl_clear_signals (); + rl_clear_signals (); #endif - in_handler = 0; - (*rl_linefunc) (line); - - /* If the user did not clear out the line, do it for him. */ - if (rl_line_buffer[0]) - _rl_init_line_state (); - - /* Redisplay the prompt if readline_handler_{install,remove} not called. */ - if (in_handler == 0 && rl_linefunc) - _rl_callback_newline (); + in_handler = 0; + (*rl_linefunc) (line); + + /* If the user did not clear out the line, do it for him. */ + if (rl_line_buffer[0]) + _rl_init_line_state (); + + /* Redisplay the prompt if readline_handler_{install,remove} + not called. */ + if (in_handler == 0 && rl_linefunc) + _rl_callback_newline (); + } + if (rl_pending_input) + eof = readline_internal_char (); + else + break; } } diff --git a/contrib/libreadline/chardefs.h b/contrib/libreadline/chardefs.h index 664c1e4..aec704d 100644 --- a/contrib/libreadline/chardefs.h +++ b/contrib/libreadline/chardefs.h @@ -51,7 +51,7 @@ #define meta_character_bit 0x080 /* x0000000, must be on. */ #define largest_char 255 /* Largest character value. */ -#define CTRL_CHAR(c) ((c) < control_character_threshold && (c) >= 0) +#define CTRL_CHAR(c) ((c) < control_character_threshold && (((c) & 0x80) == 0)) #define META_CHAR(c) ((c) > meta_character_threshold && (c) <= largest_char) #define CTRL(c) ((c) & control_character_mask) diff --git a/contrib/libreadline/compat.c b/contrib/libreadline/compat.c new file mode 100644 index 0000000..1f41559 --- /dev/null +++ b/contrib/libreadline/compat.c @@ -0,0 +1,113 @@ +/* compat.c -- backwards compatibility functions. */ + +/* Copyright (C) 2000 Free Software Foundation, Inc. + + This file is part of the GNU Readline Library, a library for + reading lines of text with interactive input and history editing. + + The GNU Readline Library is free software; you can redistribute it + and/or modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2, or + (at your option) any later version. + + The GNU Readline Library is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied warranty + of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + The GNU General Public License is often shipped with GNU software, and + is generally kept in a file called COPYING or LICENSE. If you do not + have a copy of the license, write to the Free Software Foundation, + 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ +#define READLINE_LIBRARY + +#if defined (HAVE_CONFIG_H) +# include +#endif + +#include + +#include "rlstdc.h" +#include "rltypedefs.h" + +extern void rl_free_undo_list __P((void)); +extern int rl_maybe_save_line __P((void)); +extern int rl_maybe_unsave_line __P((void)); +extern int rl_maybe_replace_line __P((void)); + +extern int rl_crlf __P((void)); +extern int rl_ding __P((void)); +extern int rl_alphabetic __P((int)); + +extern char **rl_completion_matches __P((const char *, rl_compentry_func_t *)); +extern char *rl_username_completion_function __P((const char *, int)); +extern char *rl_filename_completion_function __P((const char *, int)); + +/* Provide backwards-compatible entry points for old function names. */ + +void +free_undo_list () +{ + rl_free_undo_list (); +} + +int +maybe_replace_line () +{ + return rl_maybe_replace_line (); +} + +int +maybe_save_line () +{ + return rl_maybe_save_line (); +} + +int +maybe_unsave_line () +{ + return rl_maybe_unsave_line (); +} + +int +ding () +{ + return rl_ding (); +} + +int +crlf () +{ + return rl_crlf (); +} + +int +alphabetic (c) + int c; +{ + return rl_alphabetic (c); +} + +char ** +completion_matches (s, f) + const char *s; + rl_compentry_func_t *f; +{ + return rl_completion_matches (s, f); +} + +char * +username_completion_function (s, i) + const char *s; + int i; +{ + return rl_username_completion_function (s, i); +} + +char * +filename_completion_function (s, i) + const char *s; + int i; +{ + return rl_filename_completion_function (s, i); +} diff --git a/contrib/libreadline/complete.c b/contrib/libreadline/complete.c index fb48712..927bd52 100644 --- a/contrib/libreadline/complete.c +++ b/contrib/libreadline/complete.c @@ -49,18 +49,6 @@ extern int errno; #endif /* !errno */ #include -#if !defined (HAVE_GETPW_DECLS) -extern struct passwd *getpwent (); -#endif /* USG && !HAVE_GETPW_DECLS */ - -/* ISC systems don't define getpwent() if _POSIX_SOURCE is defined. */ -#if defined (isc386) && defined (_POSIX_SOURCE) -# if defined (__STDC__) -extern struct passwd *getpwent (void); -# else -extern struct passwd *getpwent (); -# endif /* !__STDC__ */ -#endif /* isc386 && _POSIX_SOURCE */ #include "posixdir.h" #include "posixstat.h" @@ -79,6 +67,12 @@ typedef int QSFUNC (const void *, const void *); typedef int QSFUNC (); #endif +/* Most systems don't declare getpwent in if _POSIX_SOURCE is + defined. */ +#if !defined (HAVE_GETPW_DECLS) || defined (_POSIX_SOURCE) +extern struct passwd *getpwent __P((void)); +#endif /* !HAVE_GETPW_DECLS || _POSIX_SOURCE */ + /* If non-zero, then this is the address of a function to call when completing a word would normally display the list of possible matches. This function is called instead of actually doing the display. @@ -86,11 +80,7 @@ typedef int QSFUNC (); where MATCHES is the array of strings that matched, NUM_MATCHES is the number of strings in that array, and MAX_LENGTH is the length of the longest string in that array. */ -VFunction *rl_completion_display_matches_hook = (VFunction *)NULL; - -/* Forward declarations for functions defined and used in this file. */ -char *filename_completion_function __P((char *, int)); -char **completion_matches __P((char *, CPFunction *)); +rl_compdisp_func_t *rl_completion_display_matches_hook = (rl_compdisp_func_t *)NULL; #if defined (VISIBLE_STATS) # if !defined (X_OK) @@ -100,14 +90,13 @@ static int stat_char __P((char *)); #endif static char *rl_quote_filename __P((char *, int, char *)); -static char *rl_strpbrk __P((char *, char *)); static char **remove_duplicate_matches __P((char **)); static void insert_match __P((char *, int, int, char *)); static int append_to_match __P((char *, int, int)); static void insert_all_matches __P((char **, int, char *)); static void display_matches __P((char **)); -static int compute_lcd_of_matches __P((char **, int, char *)); +static int compute_lcd_of_matches __P((char **, int, const char *)); /* **************************************************************** */ /* */ @@ -146,15 +135,17 @@ int rl_visible_stats = 0; /* 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; +rl_icppfunc_t *rl_directory_completion_hook = (rl_icppfunc_t *)NULL; + +rl_icppfunc_t *rl_directory_rewrite_hook = (rl_icppfunc_t *)NULL; /* Non-zero means readline completion functions perform tilde expansion. */ int rl_complete_with_tilde_expansion = 0; /* Pointer to the generator function for completion_matches (). - NULL means to use filename_completion_function (), the default filename + NULL means to use rl_filename_completion_function (), the default filename completer. */ -Function *rl_completion_entry_function = (Function *)NULL; +rl_compentry_func_t *rl_completion_entry_function = (rl_compentry_func_t *)NULL; /* Pointer to alternative function to create matches. Function is called with TEXT, START, and END. @@ -163,7 +154,7 @@ Function *rl_completion_entry_function = (Function *)NULL; If this function exists and returns NULL then call the value of rl_completion_entry_function to try to match, otherwise use the array of strings returned. */ -CPPFunction *rl_attempted_completion_function = (CPPFunction *)NULL; +rl_completion_func_t *rl_attempted_completion_function = (rl_completion_func_t *)NULL; /* Non-zero means to suppress normal filename completion after the user-specified completion function has been called. */ @@ -182,29 +173,29 @@ int rl_completion_query_items = 100; /* The basic list of characters that signal a break between words for the completer routine. The contents of this variable is what breaks words in the shell, i.e. " \t\n\"\\'`@$><=" */ -char *rl_basic_word_break_characters = " \t\n\"\\'`@$><=;|&{("; +const char *rl_basic_word_break_characters = " \t\n\"\\'`@$><=;|&{("; /* List of basic quoting characters. */ -char *rl_basic_quote_characters = "\"'"; +const char *rl_basic_quote_characters = "\"'"; /* The list of characters that signal a break between words for rl_complete_internal. The default list is the contents of rl_basic_word_break_characters. */ -char *rl_completer_word_break_characters = (char *)NULL; +const char *rl_completer_word_break_characters = (const char *)NULL; /* List of characters which can be used to quote a substring of the line. Completion occurs on the entire substring, and within the substring rl_completer_word_break_characters are treated as any other character, unless they also appear within this list. */ -char *rl_completer_quote_characters = (char *)NULL; +const char *rl_completer_quote_characters = (const char *)NULL; /* List of characters that should be quoted in filenames by the completer. */ -char *rl_filename_quote_characters = (char *)NULL; +const char *rl_filename_quote_characters = (const char *)NULL; /* List of characters that are word break characters, but should be left in TEXT when it is passed to the completion function. The shell uses this to help determine what kind of completing to do. */ -char *rl_special_prefixes = (char *)NULL; +const char *rl_special_prefixes = (const char *)NULL; /* If non-zero, then disallow duplicates in the matches. */ int rl_ignore_completion_duplicates = 1; @@ -230,24 +221,24 @@ int rl_filename_quoting_desired = 1; the list of matches as required, but all elements of the array must be free()'d if they are deleted. The main intent of this function is to implement FIGNORE a la SunOS csh. */ -Function *rl_ignore_some_completions_function = (Function *)NULL; +rl_compignore_func_t *rl_ignore_some_completions_function = (rl_compignore_func_t *)NULL; /* Set to a function to quote a filename in an application-specific fashion. Called with the text to quote, the type of match found (single or multiple) and a pointer to the quoting character to be used, which the function can reset if desired. */ -CPFunction *rl_filename_quoting_function = rl_quote_filename; +rl_quote_func_t *rl_filename_quoting_function = rl_quote_filename; /* Function to call to remove quoting characters from a filename. Called before completion is attempted, so the embedded quotes do not interfere with matching names in the file system. Readline doesn't do anything with this; it's set only by applications. */ -CPFunction *rl_filename_dequoting_function = (CPFunction *)NULL; +rl_dequote_func_t *rl_filename_dequoting_function = (rl_dequote_func_t *)NULL; /* Function to call to decide whether or not a word break character is quoted. If a character is quoted, it does not break words for the completer. */ -Function *rl_char_is_quoted_p = (Function *)NULL; +rl_linebuf_func_t *rl_char_is_quoted_p = (rl_linebuf_func_t *)NULL; /* Character appended to completed words when at the end of the line. The default is a space. */ @@ -269,7 +260,7 @@ static int completion_changed_buffer; /* 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. */ + rl_completion_matches ()). The default is to do filename completion. */ int rl_complete (ignore, invoking_key) int ignore, invoking_key; @@ -305,27 +296,6 @@ rl_insert_completions (ignore, invoking_key) /* */ /************************************/ -/* 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 () @@ -334,14 +304,17 @@ get_y_or_n () for (;;) { + RL_SETSTATE(RL_STATE_MOREINPUT); c = rl_read_key (); + RL_UNSETSTATE(RL_STATE_MOREINPUT); + if (c == 'y' || c == 'Y' || c == ' ') return (1); if (c == 'n' || c == 'N' || c == RUBOUT) return (0); if (c == ABORT_CHAR) _rl_abort_internal (); - ding (); + rl_ding (); } } @@ -571,7 +544,11 @@ find_completion_word (fp, dp) continue; } - if (rl_line_buffer[scan] == '\\') + /* Shell-like semantics for single quotes -- don't allow backslash + to quote anything in single quotes, especially not the closing + quote. If you don't like this, take out the check on the value + of quote_char. */ + if (quote_char != '\'' && rl_line_buffer[scan] == '\\') { pass_next = 1; found_quote |= RL_QF_BACKSLASH; @@ -671,7 +648,7 @@ static char ** gen_completion_matches (text, start, end, our_func, found_quote, quote_char) char *text; int start, end; - Function *our_func; + rl_compentry_func_t *our_func; int found_quote, quote_char; { char **matches, *temp; @@ -695,7 +672,7 @@ gen_completion_matches (text, start, end, our_func, found_quote, quote_char) filename dequoting function. */ temp = (char *)NULL; - if (found_quote && our_func == (Function *)filename_completion_function && + if (found_quote && our_func == rl_filename_completion_function && rl_filename_dequoting_function) { /* delete single and double quotes */ @@ -703,7 +680,7 @@ gen_completion_matches (text, start, end, our_func, found_quote, quote_char) text = temp; /* not freeing text is not a memory leak */ } - matches = completion_matches (text, (CPFunction *)our_func); + matches = rl_completion_matches (text, our_func); FREE (temp); return matches; } @@ -775,7 +752,7 @@ static int compute_lcd_of_matches (match_list, matches, text) char **match_list; int matches; - char *text; + const char *text; { register int i, c1, c2, si; int low; /* Count of max-matched characters. */ @@ -901,11 +878,11 @@ rl_display_match_list (matches, len, max) /* How many items of MAX length can we fit in the screen window? */ max += 2; - limit = screenwidth / max; - if (limit != 1 && (limit * max == screenwidth)) + limit = _rl_screenwidth / max; + if (limit != 1 && (limit * max == _rl_screenwidth)) limit--; - /* Avoid a possible floating exception. If max > screenwidth, + /* Avoid a possible floating exception. If max > _rl_screenwidth, limit will be 0 and a divide-by-zero fault will result. */ if (limit == 0) limit = 1; @@ -921,7 +898,7 @@ rl_display_match_list (matches, len, max) if (rl_ignore_completion_duplicates == 0) qsort (matches + 1, len, sizeof (char *), (QSFUNC *)_rl_qsort_string_compare); - crlf (); + rl_crlf (); if (_rl_print_completions_horizontally == 0) { @@ -943,7 +920,7 @@ rl_display_match_list (matches, len, max) } l += count; } - crlf (); + rl_crlf (); } } else @@ -957,13 +934,13 @@ rl_display_match_list (matches, len, max) if (matches[i+1]) { if (i && (limit > 1) && (i % limit) == 0) - crlf (); + rl_crlf (); else for (k = 0; k < max - printed_len; k++) putc (' ', rl_outstream); } } - crlf (); + rl_crlf (); } } @@ -992,9 +969,9 @@ display_matches (matches) if (matches[1] == 0) { temp = printable_part (matches[0]); - crlf (); + rl_crlf (); print_filename (temp, matches[0]); - crlf (); + rl_crlf (); rl_forced_update_display (); rl_display_fixed = 1; @@ -1026,12 +1003,12 @@ display_matches (matches) see them all. */ if (len >= rl_completion_query_items) { - crlf (); + rl_crlf (); fprintf (rl_outstream, "Display all %d possibilities? (y or n)", len); fflush (rl_outstream); if (get_y_or_n () == 0) { - crlf (); + rl_crlf (); rl_forced_update_display (); rl_display_fixed = 1; @@ -1079,7 +1056,7 @@ make_quoted_replacement (match, mtype, qc) This also checks whether the common prefix of several matches needs to be quoted. */ should_quote = rl_filename_quote_characters - ? (rl_strpbrk (match, rl_filename_quote_characters) != 0) + ? (_rl_strpbrk (match, rl_filename_quote_characters) != 0) : 0; do_replace = should_quote ? mtype : NO_MATCH; @@ -1232,11 +1209,12 @@ rl_complete_internal (what_to_do) int what_to_do; { char **matches; - Function *our_func; + rl_compentry_func_t *our_func; int start, end, delimiter, found_quote, i; char *text, *saved_line_buffer; char quote_char; + RL_SETSTATE(RL_STATE_COMPLETING); /* Only the completion entry function can change these. */ rl_filename_completion_desired = 0; rl_filename_quoting_desired = 1; @@ -1245,7 +1223,7 @@ rl_complete_internal (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; + : rl_filename_completion_function; /* We now look backwards for the start of a filename/variable word. */ end = rl_point; @@ -1266,27 +1244,23 @@ rl_complete_internal (what_to_do) if (matches == 0) { - ding (); + rl_ding (); FREE (saved_line_buffer); + RL_UNSETSTATE(RL_STATE_COMPLETING); return (0); } -#if 0 - /* If we are matching filenames, our_func will have been set to - filename_completion_function */ - i = our_func == (Function *)filename_completion_function; -#else /* If we are matching filenames, the attempted completion function will have set rl_filename_completion_desired to a non-zero value. The basic - filename_completion_function does this. */ + rl_filename_completion_function does this. */ i = rl_filename_completion_desired; -#endif if (postprocess_matches (&matches, i) == 0) { - ding (); + rl_ding (); FREE (saved_line_buffer); completion_changed_buffer = 0; + RL_UNSETSTATE(RL_STATE_COMPLETING); return (0); } @@ -1314,7 +1288,7 @@ rl_complete_internal (what_to_do) break; } else if (rl_editing_mode != vi_mode) - ding (); /* There are other matches remaining. */ + rl_ding (); /* There are other matches remaining. */ } else append_to_match (matches[0], delimiter, quote_char); @@ -1331,8 +1305,9 @@ rl_complete_internal (what_to_do) default: fprintf (stderr, "\r\nreadline: bad value %d for what_to_do in rl_complete\n", what_to_do); - ding (); + rl_ding (); FREE (saved_line_buffer); + RL_UNSETSTATE(RL_STATE_COMPLETING); return 1; } @@ -1345,6 +1320,7 @@ rl_complete_internal (what_to_do) free (saved_line_buffer); } + RL_UNSETSTATE(RL_STATE_COMPLETING); return 0; } @@ -1367,9 +1343,9 @@ rl_complete_internal (what_to_do) when there are no more matches. */ char ** -completion_matches (text, entry_function) - char *text; - CPFunction *entry_function; +rl_completion_matches (text, entry_function) + const char *text; + rl_compentry_func_t *entry_function; { /* Number of slots in match_list. */ int match_list_size; @@ -1414,8 +1390,8 @@ completion_matches (text, entry_function) TEXT contains a partial username preceded by a random character (usually `~'). */ char * -username_completion_function (text, state) - char *text; +rl_username_completion_function (text, state) + const char *text; int state; { #if defined (__WIN32__) || defined (__OPENNT) @@ -1471,8 +1447,8 @@ username_completion_function (text, state) because of all the pathnames that must be followed when looking up the completion for a command. */ char * -filename_completion_function (text, state) - char *text; +rl_filename_completion_function (text, state) + const char *text; int state; { static DIR *directory = (DIR *)NULL; @@ -1542,6 +1518,9 @@ filename_completion_function (text, state) dirname = temp; } + if (rl_directory_rewrite_hook) + (*rl_directory_rewrite_hook) (&dirname); + if (rl_directory_completion_hook && (*rl_directory_completion_hook) (&dirname)) { free (users_dirname); @@ -1641,8 +1620,11 @@ filename_completion_function (text, state) else { dirlen = strlen (users_dirname); - temp = xmalloc (1 + dirlen + D_NAMLEN (entry)); + temp = xmalloc (2 + dirlen + D_NAMLEN (entry)); strcpy (temp, users_dirname); + /* Make sure that temp has a trailing slash here. */ + if (users_dirname[dirlen - 1] != '/') + temp[dirlen++] = '/'; } strcpy (temp + dirlen, entry->d_name); @@ -1667,7 +1649,7 @@ int rl_menu_complete (count, ignore) int count, ignore; { - Function *our_func; + rl_compentry_func_t *our_func; int matching_filenames, found_quote; static char *orig_text; @@ -1697,7 +1679,7 @@ rl_menu_complete (count, ignore) our_func = rl_completion_entry_function ? rl_completion_entry_function - : (Function *)filename_completion_function; + : rl_filename_completion_function; /* We now look backwards for the start of a filename/variable word. */ orig_end = rl_point; @@ -1716,19 +1698,14 @@ rl_menu_complete (count, ignore) matches = gen_completion_matches (orig_text, orig_start, orig_end, our_func, found_quote, quote_char); -#if 0 - /* If we are matching filenames, our_func will have been set to - filename_completion_function */ - matching_filenames = our_func == (Function *)filename_completion_function; -#else /* If we are matching filenames, the attempted completion function will have set rl_filename_completion_desired to a non-zero value. The basic - filename_completion_function does this. */ + rl_filename_completion_function does this. */ matching_filenames = rl_filename_completion_desired; -#endif + if (matches == 0 || postprocess_matches (&matches, matching_filenames) == 0) { - ding (); + rl_ding (); FREE (matches); matches = (char **)0; FREE (orig_text); @@ -1749,7 +1726,7 @@ rl_menu_complete (count, ignore) if (matches == 0 || match_list_size == 0) { - ding (); + rl_ding (); FREE (matches); matches = (char **)0; completion_changed_buffer = 0; @@ -1762,7 +1739,7 @@ rl_menu_complete (count, ignore) if (match_list_index == 0 && match_list_size > 1) { - ding (); + rl_ding (); insert_match (orig_text, orig_start, MULT_MATCH, "e_char); } else diff --git a/contrib/libreadline/config.h.in b/contrib/libreadline/config.h.in index d9aa535..ca7bd90 100644 --- a/contrib/libreadline/config.h.in +++ b/contrib/libreadline/config.h.in @@ -1,4 +1,4 @@ -/* config.h.in. Generated automatically from configure.in by autoheader. */ +/* config.h.in. Maintained by hand. */ /* Define if on MINIX. */ #undef _MINIX @@ -124,7 +124,6 @@ #undef HAVE_POSIX_SIGSETJMP -/* config.h.bot */ /* modify settings or make new ones based on what autoconf tells us. */ /* Ultrix botches type-ahead when switching from canonical to diff --git a/contrib/libreadline/configure b/contrib/libreadline/configure index bcb5ff8..0765d4e 100755 --- a/contrib/libreadline/configure +++ b/contrib/libreadline/configure @@ -1,7 +1,9 @@ #! /bin/sh -# From configure.in for Readline 4.1, version 2.22, from autoconf version 2.13 -LIBVERSION=4.1 +# From configure.in for Readline 4.2, version 2.26, from autoconf version 2.13 +LIBVERSION=4.2 + + @@ -657,7 +659,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:661: checking host system type" >&5 +echo "configure:663: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -695,10 +697,37 @@ fi # We want these before the checks, so the checks can modify their values. test -z "$CFLAGS" && CFLAGS=-g auto_cflags=1 +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:702: checking whether ${MAKE-make} sets \${MAKE}" >&5 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftestmake +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= +else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:702: checking for $ac_word" >&5 +echo "configure:731: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -728,7 +757,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:732: checking for $ac_word" >&5 +echo "configure:761: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -779,7 +808,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:783: checking for $ac_word" >&5 +echo "configure:812: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -811,7 +840,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:815: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:844: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -822,12 +851,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 826 "configure" +#line 855 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:831: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:860: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -853,12 +882,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:857: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:886: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:862: checking whether we are using GNU C" >&5 +echo "configure:891: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -867,7 +896,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:871: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:900: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -886,7 +915,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:890: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:919: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -918,7 +947,7 @@ else fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:922: checking how to run the C preprocessor" >&5 +echo "configure:951: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -933,13 +962,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:943: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:972: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -950,13 +979,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:960: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:989: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -967,13 +996,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:977: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1006: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -999,17 +1028,17 @@ echo "$ac_t""$CPP" 1>&6 ac_safe=`echo "minix/config.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for minix/config.h""... $ac_c" 1>&6 -echo "configure:1003: checking for minix/config.h" >&5 +echo "configure:1032: checking for minix/config.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1013: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1042: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1052,13 +1081,13 @@ test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O" if test $ac_cv_prog_gcc = yes; then echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6 -echo "configure:1056: checking whether ${CC-cc} needs -traditional" >&5 +echo "configure:1085: checking whether ${CC-cc} needs -traditional" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_pattern="Autoconf.*'x'" cat > conftest.$ac_ext < Autoconf TIOCGETP @@ -1076,7 +1105,7 @@ rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat > conftest.$ac_ext < Autoconf TCGETA @@ -1109,7 +1138,7 @@ fi # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1113: checking for a BSD compatible install" >&5 +echo "configure:1142: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1164,7 +1193,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1168: checking for $ac_word" >&5 +echo "configure:1197: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1194,7 +1223,7 @@ test -n "$ARFLAGS" || ARFLAGS="cr" # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1198: checking for $ac_word" >&5 +echo "configure:1227: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1226,12 +1255,12 @@ MAKE_SHELL=/bin/sh echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:1230: checking return type of signal handlers" >&5 +echo "configure:1259: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1248,7 +1277,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:1252: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1281: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -1268,12 +1297,12 @@ EOF echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6 -echo "configure:1272: checking whether stat file-mode macros are broken" >&5 +echo "configure:1301: checking whether stat file-mode macros are broken" >&5 if eval "test \"`echo '$''{'ac_cv_header_stat_broken'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1328,12 +1357,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:1332: checking for $ac_hdr that defines DIR" >&5 +echo "configure:1361: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_hdr> @@ -1341,7 +1370,7 @@ int main() { DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:1345: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1374: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -1366,7 +1395,7 @@ done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:1370: checking for opendir in -ldir" >&5 +echo "configure:1399: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1374,7 +1403,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1418: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1407,7 +1436,7 @@ fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:1411: checking for opendir in -lx" >&5 +echo "configure:1440: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1415,7 +1444,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1459: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1453,12 +1482,12 @@ for ac_func in lstat memmove putenv select setenv setlocale \ strcasecmp tcgetattr do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1457: checking for $ac_func" >&5 +echo "configure:1486: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1514: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1507,7 +1536,7 @@ done echo $ac_n "checking for working strcoll""... $ac_c" 1>&6 -echo "configure:1511: checking for working strcoll" >&5 +echo "configure:1540: checking for working strcoll" >&5 if eval "test \"`echo '$''{'ac_cv_func_strcoll_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1515,7 +1544,7 @@ else ac_cv_func_strcoll_works=no else cat > conftest.$ac_ext < main () @@ -1525,7 +1554,7 @@ main () strcoll ("123", "456") >= 0); } EOF -if { (eval echo configure:1529: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1558: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_strcoll_works=yes else @@ -1554,17 +1583,17 @@ for ac_hdr in unistd.h stdlib.h varargs.h stdarg.h string.h \ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1558: checking for $ac_hdr" >&5 +echo "configure:1587: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1568: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1597: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1593,13 +1622,13 @@ done echo $ac_n "checking for type of signal functions""... $ac_c" 1>&6 -echo "configure:1597: checking for type of signal functions" >&5 +echo "configure:1626: checking for type of signal functions" >&5 if eval "test \"`echo '$''{'bash_cv_signal_vintage'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { @@ -1612,7 +1641,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:1616: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1645: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* bash_cv_signal_vintage=posix else @@ -1621,7 +1650,7 @@ else rm -rf conftest* cat > conftest.$ac_ext < int main() { @@ -1631,7 +1660,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:1635: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1664: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* bash_cv_signal_vintage=4.2bsd else @@ -1640,7 +1669,7 @@ else rm -rf conftest* cat > conftest.$ac_ext < @@ -1653,7 +1682,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:1657: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1686: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* bash_cv_signal_vintage=svr3 else @@ -1694,7 +1723,7 @@ fi echo $ac_n "checking if signal handlers must be reinstalled when invoked""... $ac_c" 1>&6 -echo "configure:1698: checking if signal handlers must be reinstalled when invoked" >&5 +echo "configure:1727: checking if signal handlers must be reinstalled when invoked" >&5 if eval "test \"`echo '$''{'bash_cv_must_reinstall_sighandlers'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1704,7 +1733,7 @@ else else cat > conftest.$ac_ext < @@ -1751,7 +1780,7 @@ main() } EOF -if { (eval echo configure:1755: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1784: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then bash_cv_must_reinstall_sighandlers=no else @@ -1776,7 +1805,7 @@ fi echo $ac_n "checking for presence of POSIX-style sigsetjmp/siglongjmp""... $ac_c" 1>&6 -echo "configure:1780: checking for presence of POSIX-style sigsetjmp/siglongjmp" >&5 +echo "configure:1809: checking for presence of POSIX-style sigsetjmp/siglongjmp" >&5 if eval "test \"`echo '$''{'bash_cv_func_sigsetjmp'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1786,7 +1815,7 @@ else else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1860: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then bash_cv_func_sigsetjmp=present else @@ -1850,12 +1879,12 @@ EOF fi echo $ac_n "checking for lstat""... $ac_c" 1>&6 -echo "configure:1854: checking for lstat" >&5 +echo "configure:1883: checking for lstat" >&5 if eval "test \"`echo '$''{'bash_cv_func_lstat'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -1865,7 +1894,7 @@ int main() { lstat(".",(struct stat *)0); ; return 0; } EOF -if { (eval echo configure:1869: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1898: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* bash_cv_func_lstat=yes else @@ -1885,37 +1914,36 @@ EOF fi -echo $ac_n "checking whether programs are able to redeclare getpw functions""... $ac_c" 1>&6 -echo "configure:1890: checking whether programs are able to redeclare getpw functions" >&5 -if eval "test \"`echo '$''{'bash_cv_can_redecl_getpw'+set}'`\" = set"; then +echo $ac_n "checking whether getpw functions are declared in pwd.h""... $ac_c" 1>&6 +echo "configure:1919: checking whether getpw functions are declared in pwd.h" >&5 +if eval "test \"`echo '$''{'bash_cv_getpw_declared'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < +#ifdef HAVE_UNISTD_H +# include +#endif #include -extern struct passwd *getpwent(); -extern struct passwd *getpwuid(); -extern struct passwd *getpwnam(); -int main() { -struct passwd *z; z = getpwent(); z = getpwuid(0); z = getpwnam("root"); -; return 0; } + EOF -if { (eval echo configure:1906: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "getpwuid" >/dev/null 2>&1; then rm -rf conftest* - bash_cv_can_redecl_getpw=yes + bash_cv_getpw_declared=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 rm -rf conftest* - bash_cv_can_redecl_getpw=no + bash_cv_getpw_declared=no fi rm -f conftest* + fi -echo "$ac_t""$bash_cv_can_redecl_getpw" 1>&6 -if test $bash_cv_can_redecl_getpw = no; then +echo "$ac_t""$bash_cv_getpw_declared" 1>&6 +if test $bash_cv_getpw_declared = yes; then cat >> confdefs.h <<\EOF #define HAVE_GETPW_DECLS 1 EOF @@ -1924,7 +1952,7 @@ fi echo $ac_n "checking whether or not strcoll and strcmp differ""... $ac_c" 1>&6 -echo "configure:1928: checking whether or not strcoll and strcmp differ" >&5 +echo "configure:1956: checking whether or not strcoll and strcmp differ" >&5 if eval "test \"`echo '$''{'bash_cv_func_strcoll_broken'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1934,7 +1962,7 @@ else else cat > conftest.$ac_ext < @@ -1973,7 +2001,7 @@ char *v[]; } EOF -if { (eval echo configure:1977: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2005: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then bash_cv_func_strcoll_broken=yes else @@ -1997,12 +2025,12 @@ fi echo $ac_n "checking whether signal handlers are of type void""... $ac_c" 1>&6 -echo "configure:2001: checking whether signal handlers are of type void" >&5 +echo "configure:2029: checking whether signal handlers are of type void" >&5 if eval "test \"`echo '$''{'bash_cv_void_sighandler'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2017,7 +2045,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:2021: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2049: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bash_cv_void_sighandler=yes else @@ -2037,12 +2065,12 @@ EOF fi echo $ac_n "checking for TIOCGWINSZ in sys/ioctl.h""... $ac_c" 1>&6 -echo "configure:2041: checking for TIOCGWINSZ in sys/ioctl.h" >&5 +echo "configure:2069: checking for TIOCGWINSZ in sys/ioctl.h" >&5 if eval "test \"`echo '$''{'bash_cv_tiocgwinsz_in_ioctl'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2050,7 +2078,7 @@ int main() { int x = TIOCGWINSZ; ; return 0; } EOF -if { (eval echo configure:2054: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2082: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bash_cv_tiocgwinsz_in_ioctl=yes else @@ -2071,12 +2099,12 @@ EOF fi echo $ac_n "checking for TIOCSTAT in sys/ioctl.h""... $ac_c" 1>&6 -echo "configure:2075: checking for TIOCSTAT in sys/ioctl.h" >&5 +echo "configure:2103: checking for TIOCSTAT in sys/ioctl.h" >&5 if eval "test \"`echo '$''{'bash_cv_tiocstat_in_ioctl'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2084,7 +2112,7 @@ int main() { int x = TIOCSTAT; ; return 0; } EOF -if { (eval echo configure:2088: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2116: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bash_cv_tiocstat_in_ioctl=yes else @@ -2105,12 +2133,12 @@ EOF fi echo $ac_n "checking for FIONREAD in sys/ioctl.h""... $ac_c" 1>&6 -echo "configure:2109: checking for FIONREAD in sys/ioctl.h" >&5 +echo "configure:2137: checking for FIONREAD in sys/ioctl.h" >&5 if eval "test \"`echo '$''{'bash_cv_fionread_in_ioctl'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2118,7 +2146,7 @@ int main() { int x = FIONREAD; ; return 0; } EOF -if { (eval echo configure:2122: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2150: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bash_cv_fionread_in_ioctl=yes else @@ -2139,19 +2167,19 @@ EOF fi echo $ac_n "checking for speed_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:2143: checking for speed_t in sys/types.h" >&5 +echo "configure:2171: checking for speed_t in sys/types.h" >&5 if eval "test \"`echo '$''{'bash_cv_speed_t_in_sys_types'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { speed_t x; ; return 0; } EOF -if { (eval echo configure:2155: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2183: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bash_cv_speed_t_in_sys_types=yes else @@ -2172,12 +2200,12 @@ EOF fi echo $ac_n "checking for struct winsize in sys/ioctl.h and termios.h""... $ac_c" 1>&6 -echo "configure:2176: checking for struct winsize in sys/ioctl.h and termios.h" >&5 +echo "configure:2204: checking for struct winsize in sys/ioctl.h and termios.h" >&5 if eval "test \"`echo '$''{'bash_cv_struct_winsize_header'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2185,7 +2213,7 @@ int main() { struct winsize x; ; return 0; } EOF -if { (eval echo configure:2189: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2217: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bash_cv_struct_winsize_header=ioctl_h else @@ -2193,7 +2221,7 @@ else cat conftest.$ac_ext >&5 rm -rf conftest* cat > conftest.$ac_ext < #include @@ -2201,7 +2229,7 @@ int main() { struct winsize x; ; return 0; } EOF -if { (eval echo configure:2205: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2233: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bash_cv_struct_winsize_header=termios_h else @@ -2234,12 +2262,12 @@ fi echo $ac_n "checking if struct dirent has a d_ino member""... $ac_c" 1>&6 -echo "configure:2238: checking if struct dirent has a d_ino member" >&5 +echo "configure:2266: checking if struct dirent has a d_ino member" >&5 if eval "test \"`echo '$''{'bash_cv_dirent_has_dino'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -2268,7 +2296,7 @@ struct dirent d; int z; z = d.d_ino; ; return 0; } EOF -if { (eval echo configure:2272: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2300: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bash_cv_dirent_has_dino=yes else @@ -2290,12 +2318,12 @@ fi echo $ac_n "checking if struct dirent has a d_fileno member""... $ac_c" 1>&6 -echo "configure:2294: checking if struct dirent has a d_fileno member" >&5 +echo "configure:2322: checking if struct dirent has a d_fileno member" >&5 if eval "test \"`echo '$''{'bash_cv_dirent_has_d_fileno'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -2324,7 +2352,7 @@ struct dirent d; int z; z = d.d_fileno; ; return 0; } EOF -if { (eval echo configure:2328: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2356: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bash_cv_dirent_has_d_fileno=yes else @@ -2353,14 +2381,14 @@ if test "X$bash_cv_termcap_lib" = "X"; then _bash_needmsg=yes else echo $ac_n "checking which library has the termcap functions""... $ac_c" 1>&6 -echo "configure:2357: checking which library has the termcap functions" >&5 +echo "configure:2385: checking which library has the termcap functions" >&5 _bash_needmsg= fi if eval "test \"`echo '$''{'bash_cv_termcap_lib'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else echo $ac_n "checking for tgetent in -ltermcap""... $ac_c" 1>&6 -echo "configure:2364: checking for tgetent in -ltermcap" >&5 +echo "configure:2392: checking for tgetent in -ltermcap" >&5 ac_lib_var=`echo termcap'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2368,7 +2396,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ltermcap $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2411: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2398,7 +2426,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for tgetent in -lcurses""... $ac_c" 1>&6 -echo "configure:2402: checking for tgetent in -lcurses" >&5 +echo "configure:2430: checking for tgetent in -lcurses" >&5 ac_lib_var=`echo curses'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2406,7 +2434,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcurses $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2449: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2436,7 +2464,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for tgetent in -lncurses""... $ac_c" 1>&6 -echo "configure:2440: checking for tgetent in -lncurses" >&5 +echo "configure:2468: checking for tgetent in -lncurses" >&5 ac_lib_var=`echo ncurses'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2444,7 +2472,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lncurses $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2487: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2484,7 +2512,7 @@ fi if test "X$_bash_needmsg" = "Xyes"; then echo $ac_n "checking which library has the termcap functions""... $ac_c" 1>&6 -echo "configure:2488: checking which library has the termcap functions" >&5 +echo "configure:2516: checking which library has the termcap functions" >&5 fi echo "$ac_t""using $bash_cv_termcap_lib" 1>&6 if test $bash_cv_termcap_lib = gnutermcap && test -z "$prefer_curses"; then @@ -2508,6 +2536,7 @@ fi case "$host_cpu" in *cray*) LOCAL_CFLAGS=-DCRAY ;; +*s390*) LOCAL_CFLAGS=-fsigned-char ;; esac case "$host_os" in @@ -2521,7 +2550,7 @@ esac # if test -f ${srcdir}/support/shobj-conf; then echo $ac_n "checking configuration for building shared libraries""... $ac_c" 1>&6 -echo "configure:2525: checking configuration for building shared libraries" >&5 +echo "configure:2554: checking configuration for building shared libraries" >&5 eval `${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C "${CC}" -c ${host_cpu} -o ${host_os} -v ${host_vendor}` @@ -2705,6 +2734,7 @@ s%@host_alias@%$host_alias%g s%@host_cpu@%$host_cpu%g s%@host_vendor@%$host_vendor%g s%@host_os@%$host_os%g +s%@SET_MAKE@%$SET_MAKE%g s%@CC@%$CC%g s%@CPP@%$CPP%g s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g diff --git a/contrib/libreadline/configure.in b/contrib/libreadline/configure.in index f977fec..0cc5383 100644 --- a/contrib/libreadline/configure.in +++ b/contrib/libreadline/configure.in @@ -4,8 +4,8 @@ dnl dnl report bugs to chet@po.cwru.edu dnl dnl Process this file with autoconf to produce a configure script. -AC_REVISION([for Readline 4.1, version 2.22, from autoconf version] AC_ACVERSION) -LIBVERSION=4.1 +AC_REVISION([for Readline 4.2, version 2.26, from autoconf version] AC_ACVERSION) +LIBVERSION=4.2 AC_INIT(readline.h) AC_CONFIG_HEADER(config.h) @@ -31,6 +31,7 @@ fi # We want these before the checks, so the checks can modify their values. test -z "$CFLAGS" && CFLAGS=-g auto_cflags=1 +AC_PROG_MAKE_SET AC_PROG_CC dnl AC_AIX AC_MINIX @@ -91,6 +92,7 @@ fi case "$host_cpu" in *cray*) LOCAL_CFLAGS=-DCRAY ;; +*s390*) LOCAL_CFLAGS=-fsigned-char ;; esac case "$host_os" in diff --git a/contrib/libreadline/display.c b/contrib/libreadline/display.c index 4487004..cb1c500 100644 --- a/contrib/libreadline/display.c +++ b/contrib/libreadline/display.c @@ -59,7 +59,7 @@ extern char *strchr (), *strrchr (); #endif /* !strchr && !__STDC__ */ #if defined (HACK_TERMCAP_MOTION) -extern char *term_forward_char; +extern char *_rl_term_forward_char; #endif static void update_line __P((char *, char *, int, int, int, int)); @@ -103,7 +103,7 @@ static int inv_lbsize, vis_lbsize; RL_DISPLAY_FIXED variable. This is good for efficiency. */ /* Application-specific redisplay function. */ -VFunction *rl_redisplay_function = rl_redisplay; +rl_voidfunc_t *rl_redisplay_function = rl_redisplay; /* Global variables declared here. */ /* What YOU turn on when you have handled all redisplay yourself. */ @@ -142,27 +142,40 @@ static int forced_display; /* Default and initial buffer size. Can grow. */ static int line_size = 1024; +/* Variables to keep track of the expanded prompt string, which may + include invisible characters. */ + static char *local_prompt, *local_prompt_prefix; -static int visible_length, prefix_length; +static int prompt_visible_length, prompt_prefix_length; /* The number of invisible characters in the line currently being displayed on the screen. */ static int visible_wrap_offset; -/* static so it can be shared between rl_redisplay and update_line */ +/* The number of invisible characters in the prompt string. Static so it + can be shared between rl_redisplay and update_line */ static int wrap_offset; -/* The index of the last invisible_character in the prompt string. */ -static int last_invisible; +/* The index of the last invisible character in the prompt string. */ +static int prompt_last_invisible; /* The length (buffer offset) of the first line of the last (possibly multi-line) buffer displayed on the screen. */ static int visible_first_line_len; +/* Number of invisible characters on the first physical line of the prompt. + Only valid when the number of physical characters in the prompt exceeds + (or is equal to) _rl_screenwidth. */ +static int prompt_invis_chars_first_line; + +static int prompt_last_screen_line; + /* Expand the prompt string S and return the number of visible characters in *LP, if LP is not null. This is currently more-or-less a placeholder for expansion. LIP, if non-null is a place to store the - index of the last invisible character in the returned string. */ + index of the last invisible character in the returned string. NIFLP, + if non-zero, is a place to store the number of invisible characters in + the first prompt line. */ /* Current implementation: \001 (^A) start non-visible characters @@ -172,12 +185,12 @@ static int visible_first_line_len; \002 are assumed to be `visible'. */ static char * -expand_prompt (pmt, lp, lip) +expand_prompt (pmt, lp, lip, niflp) char *pmt; - int *lp, *lip; + int *lp, *lip, *niflp; { char *r, *ret, *p; - int l, rl, last, ignoring; + int l, rl, last, ignoring, ninvis, invfl; /* Short-circuit if we can. */ if (strchr (pmt, RL_PROMPT_START_IGNORE) == 0) @@ -190,8 +203,10 @@ expand_prompt (pmt, lp, lip) l = strlen (pmt); r = ret = xmalloc (l + 1); - - for (rl = ignoring = last = 0, p = pmt; p && *p; p++) + + invfl = 0; /* invisible chars in first line of prompt */ + + for (rl = ignoring = last = ninvis = 0, p = pmt; p && *p; p++) { /* This code strips the invisible character string markers RL_PROMPT_START_IGNORE and RL_PROMPT_END_IGNORE */ @@ -211,14 +226,23 @@ expand_prompt (pmt, lp, lip) *r++ = *p; if (!ignoring) rl++; + else + ninvis++; + if (rl == _rl_screenwidth) + invfl = ninvis; } } + if (rl < _rl_screenwidth) + invfl = ninvis; + *r = '\0'; if (lp) *lp = rl; if (lip) *lip = last; + if (niflp) + *niflp = invfl; return ret; } @@ -230,7 +254,7 @@ _rl_strip_prompt (pmt) { char *ret; - ret = expand_prompt (pmt, (int *)NULL, (int *)NULL); + ret = expand_prompt (pmt, (int *)NULL, (int *)NULL, (int *)NULL); return ret; } @@ -242,8 +266,8 @@ _rl_strip_prompt (pmt) * (portion after the final newline) * local_prompt_prefix = portion before last newline of rl_display_prompt, * expanded via expand_prompt - * visible_length = number of visible characters in local_prompt - * prefix_length = number of visible characters in local_prompt_prefix + * prompt_visible_length = number of visible characters in local_prompt + * prompt_prefix_length = number of visible characters in local_prompt_prefix * * This function is called once per call to readline(). It may also be * called arbitrarily to expand the primary prompt. @@ -259,12 +283,11 @@ rl_expand_prompt (prompt) int c; /* Clear out any saved values. */ - if (local_prompt) - free (local_prompt); - if (local_prompt_prefix) - free (local_prompt_prefix); + FREE (local_prompt); + FREE (local_prompt_prefix); + local_prompt = local_prompt_prefix = (char *)0; - last_invisible = visible_length = 0; + prompt_last_invisible = prompt_visible_length = 0; if (prompt == 0 || *prompt == 0) return (0); @@ -272,22 +295,28 @@ rl_expand_prompt (prompt) p = strrchr (prompt, '\n'); if (!p) { - /* The prompt is only one line. */ - local_prompt = expand_prompt (prompt, &visible_length, &last_invisible); + /* The prompt is only one logical line, though it might wrap. */ + local_prompt = expand_prompt (prompt, &prompt_visible_length, + &prompt_last_invisible, + &prompt_invis_chars_first_line); local_prompt_prefix = (char *)0; - return (visible_length); + return (prompt_visible_length); } else { /* The prompt spans multiple lines. */ t = ++p; - local_prompt = expand_prompt (p, &visible_length, &last_invisible); + local_prompt = expand_prompt (p, &prompt_visible_length, + &prompt_last_invisible, + &prompt_invis_chars_first_line); c = *t; *t = '\0'; /* The portion of the prompt string up to and including the final newline is now null-terminated. */ - local_prompt_prefix = expand_prompt (prompt, &prefix_length, (int *)NULL); + local_prompt_prefix = expand_prompt (prompt, &prompt_prefix_length, + (int *)NULL, + &prompt_invis_chars_first_line); *t = c; - return (prefix_length); + return (prompt_prefix_length); } } @@ -399,7 +428,7 @@ rl_redisplay () out += local_len; } line[out] = '\0'; - wrap_offset = local_len - visible_length; + wrap_offset = local_len - prompt_visible_length; } else { @@ -432,7 +461,7 @@ rl_redisplay () strncpy (line + out, prompt_this_line, pmtlen); out += pmtlen; line[out] = '\0'; - wrap_offset = 0; + wrap_offset = prompt_invis_chars_first_line = 0; } #define CHECK_INV_LBREAKS() \ @@ -447,7 +476,7 @@ rl_redisplay () #define CHECK_LPOS() \ do { \ lpos++; \ - if (lpos >= screenwidth) \ + if (lpos >= _rl_screenwidth) \ { \ if (newlines >= (inv_lbsize - 2)) \ { \ @@ -463,21 +492,36 @@ rl_redisplay () inv_lbreaks[newlines = 0] = 0; lpos = out - wrap_offset; - /* XXX - what if lpos is already >= screenwidth before we start drawing the + /* prompt_invis_chars_first_line is the number of invisible characters in + the first physical line of the prompt. + wrap_offset - prompt_invis_chars_first_line is the number of invis + chars on the second line. */ + + /* what if lpos is already >= _rl_screenwidth before we start drawing the contents of the command line? */ - while (lpos >= screenwidth) + while (lpos >= _rl_screenwidth) { - /* XXX - possible fix from Darin Johnson for prompt - string with invisible characters that is longer than the screen - width. XXX - this doesn't work right if invisible characters have - to be put on the second screen line -- it adds too much (the number - of invisible chars after the screenwidth). */ - temp = ((newlines + 1) * screenwidth) + ((newlines == 0) ? wrap_offset : 0); + /* fix from Darin Johnson for prompt string with + invisible characters that is longer than the screen width. The + prompt_invis_chars_first_line variable could be made into an array + saying how many invisible characters there are per line, but that's + probably too much work for the benefit gained. How many people have + prompts that exceed two physical lines? */ + temp = ((newlines + 1) * _rl_screenwidth) + + ((newlines == 0) ? prompt_invis_chars_first_line : 0) + + ((newlines == 1) ? wrap_offset : 0); inv_lbreaks[++newlines] = temp; - lpos -= screenwidth; + lpos -= _rl_screenwidth; } + prompt_last_screen_line = newlines; + + /* Draw the rest of the line (after the prompt) into invisible_line, keeping + track of where the cursor is (c_pos), the number of the line containing + the cursor (lb_linenum), the last line number (lb_botlin and inv_botlin). + It maintains an array of line breaks for display (inv_lbreaks). + This handles expanding tabs for display and displaying meta characters. */ lb_linenum = 0; for (in = 0; in < rl_end; in++) { @@ -503,9 +547,9 @@ rl_redisplay () { sprintf (line + out, "\\%o", c); - if (lpos + 4 >= screenwidth) + if (lpos + 4 >= _rl_screenwidth) { - temp = screenwidth - lpos; + temp = _rl_screenwidth - lpos; CHECK_INV_LBREAKS (); inv_lbreaks[++newlines] = out + temp; lpos = 4 - temp; @@ -524,7 +568,7 @@ rl_redisplay () #if defined (DISPLAY_TABS) else if (c == '\t') { - register int temp, newout; + register int newout; #if 0 newout = (out | (int)7) + 1; @@ -532,10 +576,10 @@ rl_redisplay () newout = out + 8 - lpos % 8; #endif temp = newout - out; - if (lpos + temp >= screenwidth) + if (lpos + temp >= _rl_screenwidth) { register int temp2; - temp2 = screenwidth - lpos; + temp2 = _rl_screenwidth - lpos; CHECK_INV_LBREAKS (); inv_lbreaks[++newlines] = out + temp2; lpos = temp - temp2; @@ -550,7 +594,7 @@ rl_redisplay () } } #endif - else if (c == '\n' && _rl_horizontal_scroll_mode == 0 && term_up && *term_up) + else if (c == '\n' && _rl_horizontal_scroll_mode == 0 && _rl_term_up && *_rl_term_up) { line[out++] = '\0'; /* XXX - sentinel */ CHECK_INV_LBREAKS (); @@ -582,7 +626,8 @@ rl_redisplay () inv_lbreaks[newlines+1] = out; cursor_linenum = lb_linenum; - /* C_POS == position in buffer where cursor should be placed. */ + /* C_POS == position in buffer where cursor should be placed. + CURSOR_LINENUM == line number where the cursor should be placed. */ /* PWP: now is when things get a bit hairy. The visible and invisible line buffers are really multiple lines, which would wrap every @@ -593,7 +638,7 @@ rl_redisplay () otherwise, let long lines display in a single terminal line, and horizontally scroll it. */ - if (_rl_horizontal_scroll_mode == 0 && term_up && *term_up) + if (_rl_horizontal_scroll_mode == 0 && _rl_term_up && *_rl_term_up) { int nleft, pos, changed_screen_line; @@ -604,8 +649,8 @@ rl_redisplay () /* If we have more than a screenful of material to display, then only display a screenful. We should display the last screen, not the first. */ - if (out >= screenchars) - out = screenchars - 1; + if (out >= _rl_screenchars) + out = _rl_screenchars - 1; /* The first line is at character position 0 in the buffer. The second and subsequent lines start at inv_lbreaks[N], offset by @@ -635,7 +680,7 @@ rl_redisplay () (wrap_offset > visible_wrap_offset) && (_rl_last_c_pos < visible_first_line_len)) { - nleft = screenwidth + wrap_offset - _rl_last_c_pos; + nleft = _rl_screenwidth + wrap_offset - _rl_last_c_pos; if (nleft) _rl_clear_to_eol (nleft); } @@ -656,7 +701,7 @@ rl_redisplay () _rl_move_vert (linenum); _rl_move_cursor_relative (0, tt); _rl_clear_to_eol - ((linenum == _rl_vis_botlin) ? strlen (tt) : screenwidth); + ((linenum == _rl_vis_botlin) ? strlen (tt) : _rl_screenwidth); } } _rl_vis_botlin = inv_botlin; @@ -667,7 +712,7 @@ rl_redisplay () if (changed_screen_line) { _rl_move_vert (cursor_linenum); - /* If we moved up to the line with the prompt using term_up, + /* If we moved up to the line with the prompt using _rl_term_up, the physical cursor position on the screen stays the same, but the buffer position needs to be adjusted to account for invisible characters. */ @@ -680,15 +725,15 @@ rl_redisplay () the characters from the current cursor position. But we only need to reprint it if the cursor is before the last invisible character in the prompt string. */ - nleft = visible_length + wrap_offset; + nleft = prompt_visible_length + wrap_offset; if (cursor_linenum == 0 && wrap_offset > 0 && _rl_last_c_pos > 0 && - _rl_last_c_pos <= last_invisible && local_prompt) + _rl_last_c_pos <= prompt_last_invisible && local_prompt) { #if defined (__MSDOS__) putc ('\r', rl_outstream); #else - if (term_cr) - tputs (term_cr, 1, _rl_output_character_function); + if (_rl_term_cr) + tputs (_rl_term_cr, 1, _rl_output_character_function); #endif _rl_output_some_chars (local_prompt, nleft); _rl_last_c_pos = nleft; @@ -727,11 +772,11 @@ rl_redisplay () /* The number of characters that will be displayed before the cursor. */ ndisp = c_pos - wrap_offset; - nleft = visible_length + wrap_offset; + nleft = prompt_visible_length + wrap_offset; /* Where the new cursor position will be on the screen. This can be longer than SCREENWIDTH; if it is, lmargin will be adjusted. */ phys_c_pos = c_pos - (last_lmargin ? last_lmargin : wrap_offset); - t = screenwidth / 3; + t = _rl_screenwidth / 3; /* If the number of characters had already exceeded the screenwidth, last_lmargin will be > 0. */ @@ -739,7 +784,7 @@ rl_redisplay () /* If the number of characters to be displayed is more than the screen width, compute the starting offset so that the cursor is about two-thirds of the way across the screen. */ - if (phys_c_pos > screenwidth - 2) + if (phys_c_pos > _rl_screenwidth - 2) { lmargin = c_pos - (2 * t); if (lmargin < 0) @@ -749,7 +794,7 @@ rl_redisplay () if (wrap_offset && lmargin > 0 && lmargin < nleft) lmargin = nleft; } - else if (ndisp < screenwidth - 2) /* XXX - was -1 */ + else if (ndisp < _rl_screenwidth - 2) /* XXX - was -1 */ lmargin = 0; else if (phys_c_pos < 1) { @@ -771,7 +816,7 @@ rl_redisplay () the whole line, indicate that with a special character at the right edge of the screen. If LMARGIN is 0, we need to take the wrap offset into account. */ - t = lmargin + M_OFFSET (lmargin, wrap_offset) + screenwidth; + t = lmargin + M_OFFSET (lmargin, wrap_offset) + _rl_screenwidth; if (t < out) line[t - 1] = '>'; @@ -781,8 +826,8 @@ rl_redisplay () update_line (&visible_line[last_lmargin], &invisible_line[lmargin], 0, - screenwidth + visible_wrap_offset, - screenwidth + (lmargin ? 0 : wrap_offset), + _rl_screenwidth + visible_wrap_offset, + _rl_screenwidth + (lmargin ? 0 : wrap_offset), 0); /* If the visible new line is shorter than the old, but the number @@ -793,12 +838,12 @@ rl_redisplay () (_rl_last_c_pos == out) && t < visible_first_line_len) { - nleft = screenwidth - t; + nleft = _rl_screenwidth - t; _rl_clear_to_eol (nleft); } visible_first_line_len = out - lmargin - M_OFFSET (lmargin, wrap_offset); - if (visible_first_line_len > screenwidth) - visible_first_line_len = screenwidth; + if (visible_first_line_len > _rl_screenwidth) + visible_first_line_len = _rl_screenwidth; _rl_move_cursor_relative (c_pos - lmargin, &invisible_line[lmargin]); last_lmargin = lmargin; @@ -808,11 +853,11 @@ rl_redisplay () /* Swap visible and non-visible lines. */ { - char *temp = visible_line; + char *vtemp = visible_line; int *itemp = vis_lbreaks, ntemp = vis_lbsize; visible_line = invisible_line; - invisible_line = temp; + invisible_line = vtemp; vis_lbreaks = inv_lbreaks; inv_lbreaks = itemp; @@ -862,7 +907,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin) emulators. In this calculation, TEMP is the physical screen position of the cursor. */ temp = _rl_last_c_pos - W_OFFSET(_rl_last_v_pos, visible_wrap_offset); - if (temp == screenwidth && _rl_term_autowrap && !_rl_horizontal_scroll_mode + if (temp == _rl_screenwidth && _rl_term_autowrap && !_rl_horizontal_scroll_mode && _rl_last_v_pos == current_line - 1) { if (new[0]) @@ -939,13 +984,13 @@ update_line (old, new, current_line, omax, nmax, inv_botlin) lendiff = local_prompt ? strlen (local_prompt) : 0; od = ofd - old; /* index of first difference in visible line */ if (current_line == 0 && !_rl_horizontal_scroll_mode && - term_cr && lendiff > visible_length && _rl_last_c_pos > 0 && - od > lendiff && _rl_last_c_pos < last_invisible) + _rl_term_cr && lendiff > prompt_visible_length && _rl_last_c_pos > 0 && + od >= lendiff && _rl_last_c_pos <= prompt_last_invisible) { #if defined (__MSDOS__) putc ('\r', rl_outstream); #else - tputs (term_cr, 1, _rl_output_character_function); + tputs (_rl_term_cr, 1, _rl_output_character_function); #endif _rl_output_some_chars (local_prompt, lendiff); _rl_last_c_pos = lendiff; @@ -973,14 +1018,14 @@ update_line (old, new, current_line, omax, nmax, inv_botlin) use the terminal's capabilities. If we're growing the number of lines, make sure we actually cause the new line to wrap around on auto-wrapping terminals. */ - if (terminal_can_insert && ((2 * temp) >= lendiff || term_IC) && (!_rl_term_autowrap || !gl)) + if (_rl_terminal_can_insert && ((2 * temp) >= lendiff || _rl_term_IC) && (!_rl_term_autowrap || !gl)) { - /* If lendiff > visible_length and _rl_last_c_pos == 0 and + /* If lendiff > prompt_visible_length and _rl_last_c_pos == 0 and _rl_horizontal_scroll_mode == 1, inserting the characters with - term_IC or term_ic will screw up the screen because of the + _rl_term_IC or _rl_term_ic will screw up the screen because of the invisible characters. We need to just draw them. */ if (*ols && (!_rl_horizontal_scroll_mode || _rl_last_c_pos > 0 || - lendiff <= visible_length || !current_invis_chars)) + lendiff <= prompt_visible_length || !current_invis_chars)) { insert_some_chars (nfd, lendiff); _rl_last_c_pos += lendiff; @@ -1021,7 +1066,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin) else /* Delete characters from line. */ { /* If possible and inexpensive to use terminal deletion, then do so. */ - if (term_dc && (2 * temp) >= -lendiff) + if (_rl_term_dc && (2 * temp) >= -lendiff) { /* If all we're doing is erasing the invisible characters in the prompt string, don't bother. It screws up the assumptions @@ -1106,7 +1151,7 @@ rl_on_new_line_with_prompt () /* Dissect prompt_last_line into screen lines. Note that here we have to use the real screenwidth. Readline's notion of screenwidth might be one less, see terminal.c. */ - real_screenwidth = screenwidth + (_rl_term_autowrap ? 0 : 1); + real_screenwidth = _rl_screenwidth + (_rl_term_autowrap ? 0 : 1); _rl_last_v_pos = l / real_screenwidth; /* If the prompt length is a multiple of real_screenwidth, we don't know whether the cursor is at the end of the last line, or already at the @@ -1151,7 +1196,7 @@ rl_forced_update_display () void _rl_move_cursor_relative (new, data) int new; - char *data; + const char *data; { register int i; @@ -1163,12 +1208,12 @@ _rl_move_cursor_relative (new, data) /* i == current physical cursor position. */ i = _rl_last_c_pos - W_OFFSET(_rl_last_v_pos, visible_wrap_offset); if (new == 0 || CR_FASTER (new, _rl_last_c_pos) || - (_rl_term_autowrap && i == screenwidth)) + (_rl_term_autowrap && i == _rl_screenwidth)) { #if defined (__MSDOS__) putc ('\r', rl_outstream); #else - tputs (term_cr, 1, _rl_output_character_function); + tputs (_rl_term_cr, 1, _rl_output_character_function); #endif /* !__MSDOS__ */ _rl_last_c_pos = 0; } @@ -1185,9 +1230,9 @@ _rl_move_cursor_relative (new, data) That kind of control is for people who don't know what the data is underneath the cursor. */ #if defined (HACK_TERMCAP_MOTION) - if (term_forward_char) + if (_rl_term_forward_char) for (i = _rl_last_c_pos; i < new; i++) - tputs (term_forward_char, 1, _rl_output_character_function); + tputs (_rl_term_forward_char, 1, _rl_output_character_function); else for (i = _rl_last_c_pos; i < new; i++) putc (data[i], rl_outstream); @@ -1208,7 +1253,7 @@ _rl_move_vert (to) { register int delta, i; - if (_rl_last_v_pos == to || to > screenheight) + if (_rl_last_v_pos == to || to > _rl_screenheight) return; if ((delta = to - _rl_last_v_pos) > 0) @@ -1218,15 +1263,15 @@ _rl_move_vert (to) #if defined (__MSDOS__) putc ('\r', rl_outstream); #else - tputs (term_cr, 1, _rl_output_character_function); + tputs (_rl_term_cr, 1, _rl_output_character_function); #endif _rl_last_c_pos = 0; } else { /* delta < 0 */ - if (term_up && *term_up) + if (_rl_term_up && *_rl_term_up) for (i = 0; i < -delta; i++) - tputs (term_up, 1, _rl_output_character_function); + tputs (_rl_term_up, 1, _rl_output_character_function); } _rl_last_v_pos = to; /* Now TO is here */ @@ -1360,25 +1405,23 @@ rl_save_prompt () { saved_local_prompt = local_prompt; saved_local_prefix = local_prompt_prefix; - saved_last_invisible = last_invisible; - saved_visible_length = visible_length; + saved_last_invisible = prompt_last_invisible; + saved_visible_length = prompt_visible_length; local_prompt = local_prompt_prefix = (char *)0; - last_invisible = visible_length = 0; + prompt_last_invisible = prompt_visible_length = 0; } void rl_restore_prompt () { - if (local_prompt) - free (local_prompt); - if (local_prompt_prefix) - free (local_prompt_prefix); + FREE (local_prompt); + FREE (local_prompt_prefix); local_prompt = saved_local_prompt; local_prompt_prefix = saved_local_prefix; - last_invisible = saved_last_invisible; - visible_length = saved_visible_length; + prompt_last_invisible = saved_last_invisible; + prompt_visible_length = saved_visible_length; } char * @@ -1408,8 +1451,8 @@ _rl_make_prompt_for_search (pchar) pmt[len] = pchar; pmt[len+1] = '\0'; local_prompt = savestring (pmt); - last_invisible = saved_last_invisible; - visible_length = saved_visible_length + 1; + prompt_last_invisible = saved_last_invisible; + prompt_visible_length = saved_visible_length + 1; } return pmt; } @@ -1436,8 +1479,8 @@ void _rl_clear_to_eol (count) int count; { - if (term_clreol) - tputs (term_clreol, 1, _rl_output_character_function); + if (_rl_term_clreol) + tputs (_rl_term_clreol, 1, _rl_output_character_function); else if (count) space_to_eol (count); } @@ -1459,10 +1502,10 @@ space_to_eol (count) void _rl_clear_screen () { - if (term_clrpag) - tputs (term_clrpag, 1, _rl_output_character_function); + if (_rl_term_clrpag) + tputs (_rl_term_clrpag, 1, _rl_output_character_function); else - crlf (); + rl_crlf (); } /* Insert COUNT characters from STRING to the output stream. */ @@ -1472,10 +1515,10 @@ insert_some_chars (string, count) int count; { /* If IC is defined, then we do not have to "enter" insert mode. */ - if (term_IC) + if (_rl_term_IC) { char *buffer; - buffer = tgoto (term_IC, 0, count); + buffer = tgoto (_rl_term_IC, 0, count); tputs (buffer, 1, _rl_output_character_function); _rl_output_some_chars (string, count); } @@ -1484,15 +1527,15 @@ insert_some_chars (string, count) register int i; /* If we have to turn on insert-mode, then do so. */ - if (term_im && *term_im) - tputs (term_im, 1, _rl_output_character_function); + if (_rl_term_im && *_rl_term_im) + tputs (_rl_term_im, 1, _rl_output_character_function); /* If there is a special command for inserting characters, then use that first to open up the space. */ - if (term_ic && *term_ic) + if (_rl_term_ic && *_rl_term_ic) { for (i = count; i--; ) - tputs (term_ic, 1, _rl_output_character_function); + tputs (_rl_term_ic, 1, _rl_output_character_function); } /* Print the text. */ @@ -1500,8 +1543,8 @@ insert_some_chars (string, count) /* If there is a string to turn off insert mode, we had best use it now. */ - if (term_ei && *term_ei) - tputs (term_ei, 1, _rl_output_character_function); + if (_rl_term_ei && *_rl_term_ei) + tputs (_rl_term_ei, 1, _rl_output_character_function); } } @@ -1510,20 +1553,20 @@ static void delete_chars (count) int count; { - if (count > screenwidth) /* XXX */ + if (count > _rl_screenwidth) /* XXX */ return; - if (term_DC && *term_DC) + if (_rl_term_DC && *_rl_term_DC) { char *buffer; - buffer = tgoto (term_DC, count, count); + buffer = tgoto (_rl_term_DC, count, count); tputs (buffer, count, _rl_output_character_function); } else { - if (term_dc && *term_dc) + if (_rl_term_dc && *_rl_term_dc) while (count--) - tputs (term_dc, 1, _rl_output_character_function); + tputs (_rl_term_dc, 1, _rl_output_character_function); } } @@ -1543,7 +1586,7 @@ _rl_update_final () } _rl_move_vert (_rl_vis_botlin); /* If we've wrapped lines, remove the final xterm line-wrap flag. */ - if (full_lines && _rl_term_autowrap && (VIS_LLEN(_rl_vis_botlin) == screenwidth)) + if (full_lines && _rl_term_autowrap && (VIS_LLEN(_rl_vis_botlin) == _rl_screenwidth)) { char *last_line; #if 0 @@ -1551,12 +1594,12 @@ _rl_update_final () #else last_line = &visible_line[vis_lbreaks[_rl_vis_botlin]]; #endif - _rl_move_cursor_relative (screenwidth - 1, last_line); + _rl_move_cursor_relative (_rl_screenwidth - 1, last_line); _rl_clear_to_eol (0); - putc (last_line[screenwidth - 1], rl_outstream); + putc (last_line[_rl_screenwidth - 1], rl_outstream); } _rl_vis_botlin = 0; - crlf (); + rl_crlf (); fflush (rl_outstream); rl_display_fixed++; } @@ -1565,12 +1608,12 @@ _rl_update_final () static void cr () { - if (term_cr) + if (_rl_term_cr) { #if defined (__MSDOS__) putc ('\r', rl_outstream); #else - tputs (term_cr, 1, _rl_output_character_function); + tputs (_rl_term_cr, 1, _rl_output_character_function); #endif _rl_last_c_pos = 0; } @@ -1584,27 +1627,31 @@ redraw_prompt (t) char *t; { char *oldp, *oldl, *oldlprefix; - int oldlen, oldlast, oldplen; + int oldlen, oldlast, oldplen, oldninvis; /* Geez, I should make this a struct. */ oldp = rl_display_prompt; oldl = local_prompt; oldlprefix = local_prompt_prefix; - oldlen = visible_length; - oldplen = prefix_length; - oldlast = last_invisible; + oldlen = prompt_visible_length; + oldplen = prompt_prefix_length; + oldlast = prompt_last_invisible; + oldninvis = prompt_invis_chars_first_line; rl_display_prompt = t; - local_prompt = expand_prompt (t, &visible_length, &last_invisible); + local_prompt = expand_prompt (t, &prompt_visible_length, + &prompt_last_invisible, + &prompt_invis_chars_first_line); local_prompt_prefix = (char *)NULL; rl_forced_update_display (); rl_display_prompt = oldp; local_prompt = oldl; local_prompt_prefix = oldlprefix; - visible_length = oldlen; - prefix_length = oldplen; - last_invisible = oldlast; + prompt_visible_length = oldlen; + prompt_prefix_length = oldplen; + prompt_last_invisible = oldlast; + prompt_invis_chars_first_line = oldninvis; } /* Redisplay the current line after a SIGWINCH is received. */ @@ -1615,31 +1662,31 @@ _rl_redisplay_after_sigwinch () /* Clear the current line and put the cursor at column 0. Make sure the right thing happens if we have wrapped to a new screen line. */ - if (term_cr) + if (_rl_term_cr) { #if defined (__MSDOS__) putc ('\r', rl_outstream); #else - tputs (term_cr, 1, _rl_output_character_function); + tputs (_rl_term_cr, 1, _rl_output_character_function); #endif _rl_last_c_pos = 0; #if defined (__MSDOS__) - space_to_eol (screenwidth); + space_to_eol (_rl_screenwidth); putc ('\r', rl_outstream); #else - if (term_clreol) - tputs (term_clreol, 1, _rl_output_character_function); + if (_rl_term_clreol) + tputs (_rl_term_clreol, 1, _rl_output_character_function); else { - space_to_eol (screenwidth); - tputs (term_cr, 1, _rl_output_character_function); + space_to_eol (_rl_screenwidth); + tputs (_rl_term_cr, 1, _rl_output_character_function); } #endif if (_rl_last_v_pos > 0) _rl_move_vert (0); } else - crlf (); + rl_crlf (); /* Redraw only the last line of a multi-line prompt. */ t = strrchr (rl_display_prompt, '\n'); @@ -1680,12 +1727,12 @@ _rl_current_display_line () /* Find out whether or not there might be invisible characters in the editing buffer. */ if (rl_display_prompt == rl_prompt) - nleft = _rl_last_c_pos - screenwidth - rl_visible_prompt_length; + nleft = _rl_last_c_pos - _rl_screenwidth - rl_visible_prompt_length; else - nleft = _rl_last_c_pos - screenwidth; + nleft = _rl_last_c_pos - _rl_screenwidth; if (nleft > 0) - ret = 1 + nleft / screenwidth; + ret = 1 + nleft / _rl_screenwidth; else ret = 0; diff --git a/contrib/libreadline/doc/Makefile.in b/contrib/libreadline/doc/Makefile.in index 4a38563..bf3a5a3 100644 --- a/contrib/libreadline/doc/Makefile.in +++ b/contrib/libreadline/doc/Makefile.in @@ -63,13 +63,13 @@ GROFF = groff DVIOBJ = readline.dvi history.dvi rluserman.dvi INFOOBJ = readline.info history.info rluserman.info -PSOBJ = readline.ps history.ps rluserman.ps +PSOBJ = readline.ps history.ps rluserman.ps readline_3.ps history_3.ps HTMLOBJ = readline.html history.html rluserman.html -TEXTOBJ = readline.0 +TEXTOBJ = readline.0 history.0 INTERMEDIATE_OBJ = rlman.dvi hist.dvi rluserman.dvi -CREATED_DOCS = $(DVIOBJ) $(INFOOBJ) $(PSOBJ) $(HTMLOBJ) $(TEXTOBJ) +DIST_DOCS = $(DVIOBJ) $(PSOBJ) $(HTMLOBJ) $(INFOOBJ) $(TEXTOBJ) .SUFFIXES: .0 .3 .ps .txt .dvi @@ -133,19 +133,28 @@ text: $(TEXTOBJ) readline.0: readline.3 +readline_3.ps: readline.3 + ${RM} $@ + ${GROFF} -man < $(srcdir)/readline.3 > $@ + +history.0: history.3 + +history_3.ps: history.3 + ${RM} $@ + ${GROFF} -man < $(srcdir)/history.3 > $@ + clean: $(RM) *.aux *.cp *.fn *.ky *.log *.pg *.toc *.tp *.vr *.cps *.pgs \ *.fns *.kys *.tps *.vrs *.bt *.bts *.o core distclean: clean - $(RM) $(CREATED_DOCS) $(RM) $(INTERMEDIATE_OBJ) $(RM) Makefile mostlyclean: clean maintainer-clean: clean - $(RM) $(CREATED_DOCS) + $(RM) $(DIST_DOCS) $(RM) $(INTERMEDIATE_OBJ) $(RM) Makefile @@ -173,9 +182,11 @@ install: installdirs install-info --dir-file=$(infodir)/dir $(infodir)/history.info ; \ else true; fi -${INSTALL_DATA} $(srcdir)/readline.3 $(man3dir)/readline.3 + -${INSTALL_DATA} $(srcdir)/history.3 $(man3dir)/history.3 uninstall: $(RM) $(infodir)/readline.info $(RM) $(infodir)/rluserman.info $(RM) $(infodir)/history.info $(RM) $(man3dir)/readline.3 + $(RM) $(man3dir)/history.3 diff --git a/contrib/libreadline/doc/hist.texinfo b/contrib/libreadline/doc/hist.texinfo index 8a9c941..90ace3c 100644 --- a/contrib/libreadline/doc/hist.texinfo +++ b/contrib/libreadline/doc/hist.texinfo @@ -18,7 +18,7 @@ This document describes the GNU History library, a programming tool that provides a consistent user interface for recalling lines of previously typed input. -Copyright (C) 1988-1999 Free Software Foundation, Inc. +Copyright (C) 1988-2001 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice @@ -73,7 +73,7 @@ except that this permission notice may be stated in a translation approved by the Free Software Foundation. @vskip 0pt plus 1filll -Copyright @copyright{} 1988-1999 Free Software Foundation, Inc. +Copyright @copyright{} 1988-2001 Free Software Foundation, Inc. @end titlepage @ifinfo diff --git a/contrib/libreadline/doc/history.3 b/contrib/libreadline/doc/history.3 new file mode 100644 index 0000000..93702b4 --- /dev/null +++ b/contrib/libreadline/doc/history.3 @@ -0,0 +1,639 @@ +.\" +.\" MAN PAGE COMMENTS to +.\" +.\" Chet Ramey +.\" Information Network Services +.\" Case Western Reserve University +.\" chet@ins.CWRU.Edu +.\" +.\" Last Change: Tue Mar 6 12:50:54 EST 2001 +.\" +.TH HISTORY 3 "2001 Mar 6" "GNU History 4.2" +.\" +.\" File Name macro. This used to be `.PN', for Path Name, +.\" but Sun doesn't seem to like that very much. +.\" +.de FN +\fI\|\\$1\|\fP +.. +.ds lp \fR\|(\fP +.ds rp \fR\|)\fP +.\" FnN return-value fun-name N arguments +.de Fn1 +\fI\\$1\fP \fB\\$2\fP \\*(lp\fI\\$3\fP\\*(rp +.br +.. +.de Fn2 +.if t \fI\\$1\fP \fB\\$2\fP \\*(lp\fI\\$3,\|\\$4\fP\\*(rp +.if n \fI\\$1\fP \fB\\$2\fP \\*(lp\fI\\$3, \\$4\fP\\*(rp +.br +.. +.de Fn3 +.if t \fI\\$1\fP \fB\\$2\fP \\*(lp\fI\\$3,\|\\$4,\|\\$5\fP\|\\*(rp +.if n \fI\\$1\fP \fB\\$2\fP \\*(lp\fI\\$3, \\$4, \\$5\fP\\*(rp +.br +.. +.de Vb +\fI\\$1\fP \fB\\$2\fP +.br +.. +.SH NAME +history \- GNU History Library +.SH COPYRIGHT +.if t The GNU History Library is Copyright \(co 1989-2001 by the Free Software Foundation, Inc. +.if n The GNU History Library is Copyright (C) 1989-2001 by the Free Software Foundation, Inc. +.SH DESCRIPTION +Many programs read input from the user a line at a time. The GNU +History library is able to keep track of those lines, associate arbitrary +data with each line, and utilize information from previous lines in +composing new ones. +.PP +.SH "HISTORY EXPANSION" +.PP +The history library supports a history expansion feature that +is identical to the history expansion in +.BR bash. +This section describes what syntax features are available. +.PP +History expansions introduce words from the history list into +the input stream, making it easy to repeat commands, insert the +arguments to a previous command into the current input line, or +fix errors in previous commands quickly. +.PP +History expansion is usually performed immediately after a complete line +is read. +It takes place in two parts. +The first is to determine which line from the history list +to use during substitution. +The second is to select portions of that line for inclusion into +the current one. +The line selected from the history is the \fIevent\fP, +and the portions of that line that are acted upon are \fIwords\fP. +Various \fImodifiers\fP are available to manipulate the selected words. +The line is broken into words in the same fashion as \fBbash\fP +does when reading input, +so that several words that would otherwise be separated +are considered one word when surrounded by quotes (see the +description of \fBhistory_tokenize()\fP below). +History expansions are introduced by the appearance of the +history expansion character, which is \^\fB!\fP\^ by default. +Only backslash (\^\fB\e\fP\^) and single quotes can quote +the history expansion character. +.SS Event Designators +.PP +An event designator is a reference to a command line entry in the +history list. +.PP +.PD 0 +.TP +.B ! +Start a history substitution, except when followed by a +.BR blank , +newline, = or (. +.TP +.B !\fIn\fR +Refer to command line +.IR n . +.TP +.B !\-\fIn\fR +Refer to the current command line minus +.IR n . +.TP +.B !! +Refer to the previous command. This is a synonym for `!\-1'. +.TP +.B !\fIstring\fR +Refer to the most recent command starting with +.IR string . +.TP +.B !?\fIstring\fR\fB[?]\fR +Refer to the most recent command containing +.IR string . +The trailing \fB?\fP may be omitted if +.I string +is followed immediately by a newline. +.TP +.B \d\s+2^\s-2\u\fIstring1\fP\d\s+2^\s-2\u\fIstring2\fP\d\s+2^\s-2\u +Quick substitution. Repeat the last command, replacing +.I string1 +with +.IR string2 . +Equivalent to +``!!:s/\fIstring1\fP/\fIstring2\fP/'' +(see \fBModifiers\fP below). +.TP +.B !# +The entire command line typed so far. +.PD +.SS Word Designators +.PP +Word designators are used to select desired words from the event. +A +.B : +separates the event specification from the word designator. +It may be omitted if the word designator begins with a +.BR ^ , +.BR $ , +.BR * , +.BR \- , +or +.BR % . +Words are numbered from the beginning of the line, +with the first word being denoted by 0 (zero). +Words are inserted into the current line separated by single spaces. +.PP +.PD 0 +.TP +.B 0 (zero) +The zeroth word. For the shell, this is the command +word. +.TP +.I n +The \fIn\fRth word. +.TP +.B ^ +The first argument. That is, word 1. +.TP +.B $ +The last argument. +.TP +.B % +The word matched by the most recent `?\fIstring\fR?' search. +.TP +.I x\fB\-\fPy +A range of words; `\-\fIy\fR' abbreviates `0\-\fIy\fR'. +.TP +.B * +All of the words but the zeroth. This is a synonym +for `\fI1\-$\fP'. It is not an error to use +.B * +if there is just one +word in the event; the empty string is returned in that case. +.TP +.B x* +Abbreviates \fIx\-$\fP. +.TP +.B x\- +Abbreviates \fIx\-$\fP like \fBx*\fP, but omits the last word. +.PD +.PP +If a word designator is supplied without an event specification, the +previous command is used as the event. +.SS Modifiers +.PP +After the optional word designator, there may appear a sequence of +one or more of the following modifiers, each preceded by a `:'. +.PP +.PD 0 +.PP +.TP +.B h +Remove a trailing file name component, leaving only the head. +.TP +.B t +Remove all leading file name components, leaving the tail. +.TP +.B r +Remove a trailing suffix of the form \fI.xxx\fP, leaving the +basename. +.TP +.B e +Remove all but the trailing suffix. +.TP +.B p +Print the new command but do not execute it. +.TP +.B q +Quote the substituted words, escaping further substitutions. +.TP +.B x +Quote the substituted words as with +.BR q , +but break into words at +.B blanks +and newlines. +.TP +.B s/\fIold\fP/\fInew\fP/ +Substitute +.I new +for the first occurrence of +.I old +in the event line. Any delimiter can be used in place of /. The +final delimiter is optional if it is the last character of the +event line. The delimiter may be quoted in +.I old +and +.I new +with a single backslash. If & appears in +.IR new , +it is replaced by +.IR old . +A single backslash will quote the &. If +.I old +is null, it is set to the last +.I old +substituted, or, if no previous history substitutions took place, +the last +.I string +in a +.B !?\fIstring\fR\fB[?]\fR +search. +.TP +.B & +Repeat the previous substitution. +.TP +.B g +Cause changes to be applied over the entire event line. This is +used in conjunction with `\fB:s\fP' (e.g., `\fB:gs/\fIold\fP/\fInew\fP/\fR') +or `\fB:&\fP'. If used with +`\fB:s\fP', any delimiter can be used +in place of /, and the final delimiter is optional +if it is the last character of the event line. +.PD +.SH "PROGRAMMING WITH HISTORY FUNCTIONS" +This section describes how to use the History library in other programs. +.SS Introduction to History +.PP +The programmer using the History library has available functions +for remembering lines on a history list, associating arbitrary data +with a line, removing lines from the list, searching through the list +for a line containing an arbitrary text string, and referencing any line +in the list directly. In addition, a history \fIexpansion\fP function +is available which provides for a consistent user interface across +different programs. +.PP +The user using programs written with the History library has the +benefit of a consistent user interface with a set of well-known +commands for manipulating the text of previous lines and using that text +in new commands. The basic history manipulation commands are +identical to +the history substitution provided by \fBbash\fP. +.PP +If the programmer desires, he can use the Readline library, which +includes some history manipulation by default, and has the added +advantage of command line editing. +.PP +Before declaring any functions using any functionality the History +library provides in other code, an application writer should include +the file +.FN +in any file that uses the +History library's features. It supplies extern declarations for all +of the library's public functions and variables, and declares all of +the public data structures. + +.SS History Storage +.PP +The history list is an array of history entries. A history entry is +declared as follows: +.PP +.Vb "typedef void *" histdata_t; +.PP +.nf +typedef struct _hist_entry { + char *line; + histdata_t data; +} HIST_ENTRY; +.fi +.PP +The history list itself might therefore be declared as +.PP +.Vb "HIST_ENTRY **" the_history_list; +.PP +The state of the History library is encapsulated into a single structure: +.PP +.nf +/* + * A structure used to pass around the current state of the history. + */ +typedef struct _hist_state { + HIST_ENTRY **entries; /* Pointer to the entries themselves. */ + int offset; /* The location pointer within this array. */ + int length; /* Number of elements within this array. */ + int size; /* Number of slots allocated to this array. */ + int flags; +} HISTORY_STATE; +.fi +.PP +If the flags member includes \fBHS_STIFLED\fP, the history has been +stifled. +.SH "History Functions" +.PP +This section describes the calling sequence for the various functions +exported by the GNU History library. +.SS Initializing History and State Management +This section describes functions used to initialize and manage +the state of the History library when you want to use the history +functions in your program. + +.Fn1 void using_history void +Begin a session in which the history functions might be used. This +initializes the interactive variables. + +.Fn1 "HISTORY_STATE *" history_get_history_state void +Return a structure describing the current state of the input history. + +.Fn1 void history_set_history_state "HISTORY_STATE *state" +Set the state of the history list according to \fIstate\fP. + +.SS History List Management + +These functions manage individual entries on the history list, or set +parameters managing the list itself. + +.Fn1 void add_history "const char *string" +Place \fIstring\fP at the end of the history list. The associated data +field (if any) is set to \fBNULL\fP. + +.Fn1 "HIST_ENTRY *" remove_history "int which" +Remove history entry at offset \fIwhich\fP from the history. The +removed element is returned so you can free the line, data, +and containing structure. + +.Fn3 "HIST_ENTRY *" replace_history_entry "int which" "const char *line" "histdata_t data" +Make the history entry at offset \fIwhich\fP have \fIline\fP and \fIdata\fP. +This returns the old entry so you can dispose of the data. In the case +of an invalid \fIwhich\fP, a \fBNULL\fP pointer is returned. + +.Fn1 void clear_history "void" +Clear the history list by deleting all the entries. + +.Fn1 void stifle_history "int max" +Stifle the history list, remembering only the last \fImax\fP entries. + +.Fn1 int unstifle_history "void" +Stop stifling the history. This returns the previous amount the +history was stifled. The value is positive if the history was +stifled, negative if it wasn't. + +.Fn1 int history_is_stifled "void" +Returns non-zero if the history is stifled, zero if it is not. + +.SS Information About the History List + +These functions return information about the entire history list or +individual list entries. + +.Fn1 "HIST_ENTRY **" history_list "void" +Return a \fBNULL\fP terminated array of \fIHIST_ENTRY *\fP which is the +current input history. Element 0 of this list is the beginning of time. +If there is no history, return \fBNULL\fP. + +.Fn1 int where_history "void" +Returns the offset of the current history element. + +.Fn1 "HIST_ENTRY *" current_history "void" +Return the history entry at the current position, as determined by +\fBwhere_history()\fP. If there is no entry there, return a \fBNULL\fP +pointer. + +.Fn1 "HIST_ENTRY *" history_get "int offset" +Return the history entry at position \fIoffset\fP, starting from +\fBhistory_base\fP. +If there is no entry there, or if \fIoffset\fP +is greater than the history length, return a \fBNULL\fP pointer. + +.Fn1 int history_total_bytes "void" +Return the number of bytes that the primary history entries are using. +This function returns the sum of the lengths of all the lines in the +history. + +.SS Moving Around the History List + +These functions allow the current index into the history list to be +set or changed. + +.Fn1 int history_set_pos "int pos" +Set the current history offset to \fIpos\fP, an absolute index +into the list. +Returns 1 on success, 0 if \fIpos\fP is less than zero or greater +than the number of history entries. + +.Fn1 "HIST_ENTRY *" previous_history "void" +Back up the current history offset to the previous history entry, and +return a pointer to that entry. If there is no previous entry, return +a \fBNULL\fP pointer. + +.Fn1 "HIST_ENTRY *" next_history "void" +Move the current history offset forward to the next history entry, and +return the a pointer to that entry. If there is no next entry, return +a \fBNULL\fP pointer. + +.SS Searching the History List + +These functions allow searching of the history list for entries containing +a specific string. Searching may be performed both forward and backward +from the current history position. The search may be \fIanchored\fP, +meaning that the string must match at the beginning of the history entry. + +.Fn2 int history_search "const char *string" "int direction" +Search the history for \fIstring\fP, starting at the current history offset. +If \fIdirection\fP is less than 0, then the search is through +previous entries, otherwise through subsequent entries. +If \fIstring\fP is found, then +the current history index is set to that history entry, and the value +returned is the offset in the line of the entry where +\fIstring\fP was found. Otherwise, nothing is changed, and a -1 is +returned. + +.Fn2 int history_search_prefix "const char *string" "int direction" +Search the history for \fIstring\fP, starting at the current history +offset. The search is anchored: matching lines must begin with +\fIstring\fP. If \fIdirection\fP is less than 0, then the search is +through previous entries, otherwise through subsequent entries. +If \fIstring\fP is found, then the +current history index is set to that entry, and the return value is 0. +Otherwise, nothing is changed, and a -1 is returned. + +.Fn3 int history_search_pos "const char *string" "int direction" "int pos" +Search for \fIstring\fP in the history list, starting at \fIpos\fP, an +absolute index into the list. If \fIdirection\fP is negative, the search +proceeds backward from \fIpos\fP, otherwise forward. Returns the absolute +index of the history element where \fIstring\fP was found, or -1 otherwise. + +.SS Managing the History File +The History library can read the history from and write it to a file. +This section documents the functions for managing a history file. + +.Fn1 int read_history "const char *filename" +Add the contents of \fIfilename\fP to the history list, a line at a time. +If \fIfilename\fP is \fBNULL\fP, then read from \fI~/.history\fP. +Returns 0 if successful, or \fBerrno\fP if not. + +.Fn3 int read_history_range "const char *filename" "int from" "int to" +Read a range of lines from \fIfilename\fP, adding them to the history list. +Start reading at line \fIfrom\fP and end at \fIto\fP. +If \fIfrom\fP is zero, start at the beginning. If \fIto\fP is less than +\fIfrom\fP, then read until the end of the file. If \fIfilename\fP is +\fBNULL\fP, then read from \fI~/.history\fP. Returns 0 if successful, +or \fBerrno\fP if not. + +.Fn1 int write_history "const char *filename" +Write the current history to \fIfilename\fP, overwriting \fIfilename\fP +if necessary. +If \fIfilename\fP is \fBNULL\fP, then write the history list to \fI~/.history\fP. +Returns 0 on success, or \fBerrno\fP on a read or write error. + + +.Fn2 int append_history "int nelements" "const char *filename" +Append the last \fInelements\fP of the history list to \fIfilename\fP. +If \fIfilename\fP is \fBNULL\fP, then append to \fI~/.history\fP. +Returns 0 on success, or \fBerrno\fP on a read or write error. + +.Fn2 int history_truncate_file "const char *filename" "int nlines" +Truncate the history file \fIfilename\fP, leaving only the last +\fInlines\fP lines. +If \fIfilename\fP is \fBNULL\fP, then \fI~/.history\fP is truncated. +Returns 0 on success, or \fBerrno\fP on failure. + +.SS History Expansion + +These functions implement history expansion. + +.Fn2 int history_expand "char *string" "char **output" +Expand \fIstring\fP, placing the result into \fIoutput\fP, a pointer +to a string. Returns: +.RS +.PD 0 +.TP +0 +If no expansions took place (or, if the only change in +the text was the removal of escape characters preceding the history expansion +character); +.TP +1 +if expansions did take place; +.TP +-1 +if there was an error in expansion; +.TP +2 +if the returned line should be displayed, but not executed, +as with the \fB:p\fP modifier. +.PD +.RE +If an error ocurred in expansion, then \fIoutput\fP contains a descriptive +error message. + +.Fn3 "char *" get_history_event "const char *string" "int *cindex" "int qchar" +Returns the text of the history event beginning at \fIstring\fP + +\fI*cindex\fP. \fI*cindex\fP is modified to point to after the event +specifier. At function entry, \fIcindex\fP points to the index into +\fIstring\fP where the history event specification begins. \fIqchar\fP +is a character that is allowed to end the event specification in addition +to the ``normal'' terminating characters. + +.Fn1 "char **" history_tokenize "const char *string" +Return an array of tokens parsed out of \fIstring\fP, much as the +shell might. +The tokens are split on the characters in the +\fBhistory_word_delimiters\fP variable, +and shell quoting conventions are obeyed. + +.Fn3 "char *" history_arg_extract "int first" "int last" "const char *string" +Extract a string segment consisting of the \fIfirst\fP through \fIlast\fP +arguments present in \fIstring\fP. Arguments are split using +\fBhistory_tokenize()\fP. + +.SS History Variables + +This section describes the externally-visible variables exported by +the GNU History Library. + +.Vb int history_base +The logical offset of the first entry in the history list. + +.Vb int history_length +The number of entries currently stored in the history list. + +.Vb int history_max_entries +The maximum number of history entries. This must be changed using +\fBstifle_history()\fP. + +.Vb char history_expansion_char +The character that introduces a history event. The default is \fB!\fP. +Setting this to 0 inhibits history expansion. + +.Vb char history_subst_char +The character that invokes word substitution if found at the start of +a line. The default is \fB^\fP. + +.Vb char history_comment_char +During tokenization, if this character is seen as the first character +of a word, then it and all subsequent characters up to a newline are +ignored, suppressing history expansion for the remainder of the line. +This is disabled by default. + +.Vb "char *" history_word_delimiters +The characters that separate tokens for \fBhistory_tokenize()\fP. +The default value is \fB"\ \et\en()<>;&|"\fP. + +.Vb "char *" history_no_expand_chars +The list of characters which inhibit history expansion if found immediately +following \fBhistory_expansion_char\fP. The default is space, tab, newline, +\fB\er\fP, and \fB=\fP. + +.Vb "char *" history_search_delimiter_chars +The list of additional characters which can delimit a history search +string, in addition to space, tab, \fI:\fP and \fI?\fP in the case of +a substring search. The default is empty. + +.Vb int history_quotes_inhibit_expansion +If non-zero, single-quoted words are not scanned for the history expansion +character. The default value is 0. + +.Vb "rl_linebuf_func_t *" history_inhibit_expansion_function +This should be set to the address of a function that takes two arguments: +a \fBchar *\fP (\fIstring\fP) +and an \fBint\fP index into that string (\fIi\fP). +It should return a non-zero value if the history expansion starting at +\fIstring[i]\fP should not be performed; zero if the expansion should +be done. +It is intended for use by applications like \fBbash\fP that use the history +expansion character for additional purposes. +By default, this variable is set to \fBNULL\fP. +.SH FILES +.PD 0 +.TP +.FN ~/.history +Default filename for reading and writing saved history +.PD +.SH "SEE ALSO" +.PD 0 +.TP +\fIThe Gnu Readline Library\fP, Brian Fox and Chet Ramey +.TP +\fIThe Gnu History Library\fP, Brian Fox and Chet Ramey +.TP +\fIbash\fP(1) +.TP +\fIreadline\fP(3) +.PD +.SH AUTHORS +Brian Fox, Free Software Foundation +.br +bfox@gnu.org +.PP +Chet Ramey, Case Western Reserve University +.br +chet@ins.CWRU.Edu +.SH BUG REPORTS +If you find a bug in the +.B history +library, you should report it. But first, you should +make sure that it really is a bug, and that it appears in the latest +version of the +.B history +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. +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 +newsgroup +.BR gnu.bash.bug . +.PP +Comments and bug reports concerning +this manual page should be directed to +.IR chet@ins.CWRU.Edu . diff --git a/contrib/libreadline/doc/hstech.texinfo b/contrib/libreadline/doc/hstech.texinfo index 12fff2c..e4ac50c 100644 --- a/contrib/libreadline/doc/hstech.texinfo +++ b/contrib/libreadline/doc/hstech.texinfo @@ -1,7 +1,7 @@ @ignore This file documents the user interface to the GNU History library. -Copyright (C) 1988, 1991, 1994, 1996 Free Software Foundation, Inc. +Copyright (C) 1988-2001 Free Software Foundation, Inc. Authored by Brian Fox and Chet Ramey. Permission is granted to make and distribute verbatim copies of this manual @@ -27,9 +27,9 @@ into another language, under the above conditions for modified versions. @chapter Programming with GNU History This chapter describes how to interface programs that you write -with the GNU History Library. +with the @sc{gnu} History Library. It should be considered a technical guide. -For information on the interactive use of GNU History, @pxref{Using +For information on the interactive use of @sc{gnu} History, @pxref{Using History Interactively}. @menu @@ -43,10 +43,10 @@ History Interactively}. @node Introduction to History @section Introduction to History -Many programs read input from the user a line at a time. The GNU History -library is able to keep track of those lines, associate arbitrary data with -each line, and utilize information from previous lines in composing new -ones. +Many programs read input from the user a line at a time. The @sc{gnu} +History library is able to keep track of those lines, associate arbitrary +data with each line, and utilize information from previous lines in +composing new ones. The programmer using the History library has available functions for remembering lines on a history list, associating arbitrary data @@ -80,9 +80,11 @@ The history list is an array of history entries. A history entry is declared as follows: @example +typedef void *histdata_t; + typedef struct _hist_entry @{ char *line; - char *data; + histdata_t data; @} HIST_ENTRY; @end example @@ -95,12 +97,14 @@ HIST_ENTRY **the_history_list; The state of the History library is encapsulated into a single structure: @example -/* A structure used to pass the current state of the history stuff around. */ +/* + * A structure used to pass around the current state of the history. + */ typedef struct _hist_state @{ - HIST_ENTRY **entries; /* Pointer to the entries themselves. */ - int offset; /* The location pointer within this array. */ - int length; /* Number of elements within this array. */ - int size; /* Number of slots allocated to this array. */ + HIST_ENTRY **entries; /* Pointer to the entries themselves. */ + int offset; /* The location pointer within this array. */ + int length; /* Number of elements within this array. */ + int size; /* Number of slots allocated to this array. */ int flags; @} HISTORY_STATE; @end example @@ -112,7 +116,7 @@ stifled. @section History Functions This section describes the calling sequence for the various functions -present in GNU History. +exported by the @sc{gnu} History library. @menu * Initializing History and State Management:: Functions to call when you @@ -139,12 +143,12 @@ This section describes functions used to initialize and manage the state of the History library when you want to use the history functions in your program. -@deftypefun void using_history () +@deftypefun void using_history (void) Begin a session in which the history functions might be used. This initializes the interactive variables. @end deftypefun -@deftypefun {HISTORY_STATE *} history_get_history_state () +@deftypefun {HISTORY_STATE *} history_get_history_state (void) Return a structure describing the current state of the input history. @end deftypefun @@ -158,7 +162,7 @@ Set the state of the history list according to @var{state}. These functions manage individual entries on the history list, or set parameters managing the list itself. -@deftypefun void add_history (char *string) +@deftypefun void add_history (const char *string) Place @var{string} at the end of the history list. The associated data field (if any) is set to @code{NULL}. @end deftypefun @@ -169,13 +173,13 @@ removed element is returned so you can free the line, data, and containing structure. @end deftypefun -@deftypefun {HIST_ENTRY *} replace_history_entry (int which, char *line, char *data) +@deftypefun {HIST_ENTRY *} replace_history_entry (int which, const char *line, histdata_t data) Make the history entry at offset @var{which} have @var{line} and @var{data}. This returns the old entry so you can dispose of the data. In the case of an invalid @var{which}, a @code{NULL} pointer is returned. @end deftypefun -@deftypefun void clear_history () +@deftypefun void clear_history (void) Clear the history list by deleting all the entries. @end deftypefun @@ -183,13 +187,13 @@ Clear the history list by deleting all the entries. Stifle the history list, remembering only the last @var{max} entries. @end deftypefun -@deftypefun int unstifle_history () +@deftypefun int unstifle_history (void) Stop stifling the history. This returns the previous amount the history was stifled. The value is positive if the history was stifled, negative if it wasn't. @end deftypefun -@deftypefun int history_is_stifled () +@deftypefun int history_is_stifled (void) Returns non-zero if the history is stifled, zero if it is not. @end deftypefun @@ -199,29 +203,30 @@ Returns non-zero if the history is stifled, zero if it is not. These functions return information about the entire history list or individual list entries. -@deftypefun {HIST_ENTRY **} history_list () -Return a @code{NULL} terminated array of @code{HIST_ENTRY} which is the +@deftypefun {HIST_ENTRY **} history_list (void) +Return a @code{NULL} terminated array of @code{HIST_ENTRY *} which is the current input history. Element 0 of this list is the beginning of time. If there is no history, return @code{NULL}. @end deftypefun -@deftypefun int where_history () +@deftypefun int where_history (void) Returns the offset of the current history element. @end deftypefun -@deftypefun {HIST_ENTRY *} current_history () +@deftypefun {HIST_ENTRY *} current_history (void) Return the history entry at the current position, as determined by -@code{where_history ()}. If there is no entry there, return a @code{NULL} +@code{where_history()}. If there is no entry there, return a @code{NULL} pointer. @end deftypefun @deftypefun {HIST_ENTRY *} history_get (int offset) Return the history entry at position @var{offset}, starting from -@code{history_base}. If there is no entry there, or if @var{offset} +@code{history_base} (@pxref{History Variables}). +If there is no entry there, or if @var{offset} is greater than the history length, return a @code{NULL} pointer. @end deftypefun -@deftypefun int history_total_bytes () +@deftypefun int history_total_bytes (void) Return the number of bytes that the primary history entries are using. This function returns the sum of the lengths of all the lines in the history. @@ -234,17 +239,19 @@ These functions allow the current index into the history list to be set or changed. @deftypefun int history_set_pos (int pos) -Set the position in the history list to @var{pos}, an absolute index +Set the current history offset to @var{pos}, an absolute index into the list. +Returns 1 on success, 0 if @var{pos} is less than zero or greater +than the number of history entries. @end deftypefun -@deftypefun {HIST_ENTRY *} previous_history () +@deftypefun {HIST_ENTRY *} previous_history (void) Back up the current history offset to the previous history entry, and return a pointer to that entry. If there is no previous entry, return a @code{NULL} pointer. @end deftypefun -@deftypefun {HIST_ENTRY *} next_history () +@deftypefun {HIST_ENTRY *} next_history (void) Move the current history offset forward to the next history entry, and return the a pointer to that entry. If there is no next entry, return a @code{NULL} pointer. @@ -260,26 +267,28 @@ from the current history position. The search may be @dfn{anchored}, meaning that the string must match at the beginning of the history entry. @cindex anchored search -@deftypefun int history_search (char *string, int direction) -Search the history for @var{string}, starting at the current history -offset. If @var{direction} < 0, then the search is through previous entries, -else through subsequent. If @var{string} is found, then +@deftypefun int history_search (const char *string, int direction) +Search the history for @var{string}, starting at the current history offset. +If @var{direction} is less than 0, then the search is through +previous entries, otherwise through subsequent entries. +If @var{string} is found, then the current history index is set to that history entry, and the value returned is the offset in the line of the entry where @var{string} was found. Otherwise, nothing is changed, and a -1 is returned. @end deftypefun -@deftypefun int history_search_prefix (char *string, int direction) +@deftypefun int history_search_prefix (const char *string, int direction) Search the history for @var{string}, starting at the current history offset. The search is anchored: matching lines must begin with -@var{string}. If @var{direction} < 0, then the search is through previous -entries, else through subsequent. If @var{string} is found, then the +@var{string}. If @var{direction} is less than 0, then the search is +through previous entries, otherwise through subsequent entries. +If @var{string} is found, then the current history index is set to that entry, and the return value is 0. Otherwise, nothing is changed, and a -1 is returned. @end deftypefun -@deftypefun int history_search_pos (char *string, int direction, int pos) +@deftypefun int history_search_pos (const char *string, int direction, int pos) Search for @var{string} in the history list, starting at @var{pos}, an absolute index into the list. If @var{direction} is negative, the search proceeds backward from @var{pos}, otherwise forward. Returns the absolute @@ -292,41 +301,46 @@ index of the history element where @var{string} was found, or -1 otherwise. The History library can read the history from and write it to a file. This section documents the functions for managing a history file. -@deftypefun int read_history (char *filename) -Add the contents of @var{filename} to the history list, a line at a -time. If @var{filename} is @code{NULL}, then read from -@file{~/.history}. Returns 0 if successful, or errno if not. +@deftypefun int read_history (const char *filename) +Add the contents of @var{filename} to the history list, a line at a time. +If @var{filename} is @code{NULL}, then read from @file{~/.history}. +Returns 0 if successful, or @code{errno} if not. @end deftypefun -@deftypefun int read_history_range (char *filename, int from, int to) +@deftypefun int read_history_range (const char *filename, int from, int to) Read a range of lines from @var{filename}, adding them to the history list. -Start reading at line @var{from} and end at @var{to}. If -@var{from} is zero, start at the beginning. If @var{to} is less than +Start reading at line @var{from} and end at @var{to}. +If @var{from} is zero, start at the beginning. If @var{to} is less than @var{from}, then read until the end of the file. If @var{filename} is @code{NULL}, then read from @file{~/.history}. Returns 0 if successful, or @code{errno} if not. @end deftypefun -@deftypefun int write_history (char *filename) +@deftypefun int write_history (const char *filename) Write the current history to @var{filename}, overwriting @var{filename} -if necessary. If @var{filename} is -@code{NULL}, then write the history list to @file{~/.history}. Values -returned are as in @code{read_history ()}. +if necessary. +If @var{filename} is @code{NULL}, then write the history list to +@file{~/.history}. +Returns 0 on success, or @code{errno} on a read or write error. @end deftypefun -@deftypefun int append_history (int nelements, char *filename) +@deftypefun int append_history (int nelements, const char *filename) Append the last @var{nelements} of the history list to @var{filename}. +If @var{filename} is @code{NULL}, then append to @file{~/.history}. +Returns 0 on success, or @code{errno} on a read or write error. @end deftypefun -@deftypefun int history_truncate_file (char *filename, int nlines) +@deftypefun int history_truncate_file (const char *filename, int nlines) Truncate the history file @var{filename}, leaving only the last @var{nlines} lines. +If @var{filename} is @code{NULL}, then @file{~/.history} is truncated. +Returns 0 on success, or @code{errno} on failure. @end deftypefun @node History Expansion @subsection History Expansion -These functions implement @code{csh}-like history expansion. +These functions implement history expansion. @deftypefun int history_expand (char *string, char **output) Expand @var{string}, placing the result into @var{output}, a pointer @@ -334,7 +348,7 @@ to a string (@pxref{History Interaction}). Returns: @table @code @item 0 If no expansions took place (or, if the only change in -the text was the de-slashifying of the history expansion +the text was the removal of escape characters preceding the history expansion character); @item 1 if expansions did take place; @@ -349,12 +363,7 @@ If an error ocurred in expansion, then @var{output} contains a descriptive error message. @end deftypefun -@deftypefun {char *} history_arg_extract (int first, int last, char *string) -Extract a string segment consisting of the @var{first} through @var{last} -arguments present in @var{string}. Arguments are broken up as in Bash. -@end deftypefun - -@deftypefun {char *} get_history_event (char *string, int *cindex, int qchar) +@deftypefun {char *} get_history_event (const char *string, int *cindex, int qchar) Returns the text of the history event beginning at @var{string} + @var{*cindex}. @var{*cindex} is modified to point to after the event specifier. At function entry, @var{cindex} points to the index into @@ -363,18 +372,24 @@ is a character that is allowed to end the event specification in addition to the ``normal'' terminating characters. @end deftypefun -@deftypefun {char **} history_tokenize (char *string) +@deftypefun {char **} history_tokenize (const char *string) Return an array of tokens parsed out of @var{string}, much as the -shell might. The tokens are split on white space and on the -characters @code{()<>;&|$}, and shell quoting conventions are -obeyed. +shell might. The tokens are split on the characters in the +@var{history_word_delimiters} variable, +and shell quoting conventions are obeyed. +@end deftypefun + +@deftypefun {char *} history_arg_extract (int first, int last, const char *string) +Extract a string segment consisting of the @var{first} through @var{last} +arguments present in @var{string}. Arguments are split using +@code{history_tokenize}. @end deftypefun @node History Variables @section History Variables -This section describes the externally visible variables exported by -the GNU History Library. +This section describes the externally-visible variables exported by +the @sc{gnu} History Library. @deftypevar int history_base The logical offset of the first entry in the history list. @@ -384,13 +399,14 @@ The logical offset of the first entry in the history list. The number of entries currently stored in the history list. @end deftypevar -@deftypevar int max_input_history +@deftypevar int history_max_entries The maximum number of history entries. This must be changed using -@code{stifle_history ()}. +@code{stifle_history()}. @end deftypevar @deftypevar char history_expansion_char -The character that starts a history event. The default is @samp{!}. +The character that introduces a history event. The default is @samp{!}. +Setting this to 0 inhibits history expansion. @end deftypevar @deftypevar char history_subst_char @@ -405,15 +421,20 @@ ignored, suppressing history expansion for the remainder of the line. This is disabled by default. @end deftypevar +@deftypevar {char *} history_word_delimiters +The characters that separate tokens for \fBhistory_tokenize()\fP. +The default value is @code{" \t\n()<>;&|"}. +@end deftypevar + @deftypevar {char *} history_no_expand_chars The list of characters which inhibit history expansion if found immediately -following @var{history_expansion_char}. The default is whitespace and -@samp{=}. +following @var{history_expansion_char}. The default is space, tab, newline, +carriage return, and @samp{=}. @end deftypevar @deftypevar {char *} history_search_delimiter_chars The list of additional characters which can delimit a history search -string, in addition to whitespace, @samp{:} and @samp{?} in the case of +string, in addition to space, TAB, @samp{:} and @samp{?} in the case of a substring search. The default is empty. @end deftypevar @@ -422,24 +443,30 @@ If non-zero, single-quoted words are not scanned for the history expansion character. The default value is 0. @end deftypevar -@deftypevar {Function *} history_inhibit_expansion_function +@deftypevar {rl_linebuf_func_t *} history_inhibit_expansion_function This should be set to the address of a function that takes two arguments: -a @code{char *} (@var{string}) and an integer index into that string (@var{i}). +a @code{char *} (@var{string}) +and an @code{int} index into that string (@var{i}). It should return a non-zero value if the history expansion starting at @var{string[i]} should not be performed; zero if the expansion should be done. It is intended for use by applications like Bash that use the history expansion character for additional purposes. -By default, this variable is set to NULL. +By default, this variable is set to @code{NULL}. @end deftypevar @node History Programming Example @section History Programming Example -The following program demonstrates simple use of the GNU History Library. +The following program demonstrates simple use of the @sc{gnu} History Library. @smallexample -main () +#include +#include + +main (argc, argv) + int argc; + char **argv; @{ char line[1024], *t; int len, done = 0; diff --git a/contrib/libreadline/doc/hsuser.texinfo b/contrib/libreadline/doc/hsuser.texinfo index 5f75f5d..6926b26 100644 --- a/contrib/libreadline/doc/hsuser.texinfo +++ b/contrib/libreadline/doc/hsuser.texinfo @@ -38,9 +38,9 @@ For information on using the @sc{gnu} History Library in other programs, see the @sc{gnu} Readline Library Manual. @end ifset @ifclear BashFeatures -This chapter describes how to use the GNU History Library interactively, +This chapter describes how to use the @sc{gnu} History Library interactively, from a user's standpoint. It should be considered a user's guide. For -information on using the GNU History Library in your own programs, +information on using the @sc{gnu} History Library in your own programs, @pxref{Programming with GNU History}. @end ifclear @@ -65,36 +65,36 @@ information on using the GNU History Library in your own programs, @cindex command history @cindex history list -When the @samp{-o history} option to the @code{set} builtin +When the @option{-o history} option to the @code{set} builtin is enabled (@pxref{The Set Builtin}), -the shell provides access to the @var{command history}, +the shell provides access to the @dfn{command history}, the list of commands previously typed. -The value of the @code{HISTSIZE} shell variable is used as the +The value of the @env{HISTSIZE} shell variable is used as the number of commands to save in a history list. -The text of the last @code{$HISTSIZE} +The text of the last @env{$HISTSIZE} commands (default 500) is saved. The shell stores each command in the history list prior to parameter and variable expansion but after history expansion is performed, subject to the values of the shell variables -@code{HISTIGNORE} and @code{HISTCONTROL}. +@env{HISTIGNORE} and @env{HISTCONTROL}. When the shell starts up, the history is initialized from the -file named by the @code{HISTFILE} variable (default @file{~/.bash_history}). -The file named by the value of @code{HISTFILE} is truncated, if +file named by the @env{HISTFILE} variable (default @file{~/.bash_history}). +The file named by the value of @env{HISTFILE} is truncated, if necessary, to contain no more than the number of lines specified by -the value of the @code{HISTFILESIZE} variable. +the value of the @env{HISTFILESIZE} variable. When an interactive shell exits, the last -@code{$HISTSIZE} lines are copied from the history list to the file -named by @code{$HISTFILE}. +@env{$HISTSIZE} lines are copied from the history list to the file +named by @env{$HISTFILE}. If the @code{histappend} shell option is set (@pxref{Bash Builtins}), the lines are appended to the history file, otherwise the history file is overwritten. -If @code{HISTFILE} +If @env{HISTFILE} is unset, or if the history file is unwritable, the history is not saved. After saving the history, the history file is truncated -to contain no more than @code{$HISTFILESIZE} -lines. If @code{HISTFILESIZE} is not set, no truncation is performed. +to contain no more than @env{$HISTFILESIZE} +lines. If @env{HISTFILESIZE} is not set, no truncation is performed. The builtin command @code{fc} may be used to list or edit and re-execute a portion of the history list. @@ -105,7 +105,7 @@ are available in each editing mode that provide access to the history list (@pxref{Commands For History}). The shell allows control over which commands are saved on the history -list. The @code{HISTCONTROL} and @code{HISTIGNORE} +list. The @env{HISTCONTROL} and @env{HISTIGNORE} variables may be set to cause the shell to save only a subset of the commands entered. The @code{cmdhist} @@ -141,15 +141,15 @@ command beginning with that string) or as a number (an index into the history list, where a negative number is used as an offset from the current command number). If @var{last} is not specified it is set to @var{first}. If @var{first} is not specified it is set to the previous -command for editing and @minus{}16 for listing. If the @samp{-l} flag is -given, the commands are listed on standard output. The @samp{-n} flag -suppresses the command numbers when listing. The @samp{-r} flag +command for editing and @minus{}16 for listing. If the @option{-l} flag is +given, the commands are listed on standard output. The @option{-n} flag +suppresses the command numbers when listing. The @option{-r} flag reverses the order of the listing. Otherwise, the editor given by @var{ename} is invoked on a file containing those commands. If @var{ename} is not given, the value of the following variable expansion is used: @code{$@{FCEDIT:-$@{EDITOR:-vi@}@}}. This says to use the -value of the @code{FCEDIT} variable if set, or the value of the -@code{EDITOR} variable if that is set, or @code{vi} if neither is set. +value of the @env{FCEDIT} variable if set, or the value of the +@env{EDITOR} variable if that is set, or @code{vi} if neither is set. When editing is complete, the edited commands are echoed and executed. In the second form, @var{command} is re-executed after each instance @@ -170,7 +170,7 @@ history -ps @var{arg} @end example With no options, display the history list with line numbers. -Lines prefixed with with a @samp{*} have been modified. +Lines prefixed with a @samp{*} have been modified. An argument of @var{n} lists only the last @var{n} lines. Options, if supplied, have the following meanings: @@ -211,10 +211,10 @@ the history list as a single entry. @end table -When any of the @samp{-w}, @samp{-r}, @samp{-a}, or @samp{-n} options is +When any of the @option{-w}, @option{-r}, @option{-a}, or @option{-n} options is used, if @var{filename} is given, then it is used as the history file. If not, then -the value of the @code{HISTFILE} variable is used. +the value of the @env{HISTFILE} variable is used. @end table @end ifset @@ -260,9 +260,9 @@ editing buffer for further modification. If Readline is being used, and the @code{histreedit} shell option is enabled, a failed history expansion will be reloaded into the Readline editing buffer for correction. -The @samp{-p} option to the @code{history} builtin command +The @option{-p} option to the @code{history} builtin command may be used to see what a history expansion will do before using it. -The @samp{-s} option to the @code{history} builtin may be used to +The @option{-s} option to the @code{history} builtin may be used to add commands to the end of the history list without actually executing them, so that they are available for subsequent recall. This is most useful in conjunction with Readline. diff --git a/contrib/libreadline/doc/manvers.texinfo b/contrib/libreadline/doc/manvers.texinfo index 3122b6c..23d3073 100644 --- a/contrib/libreadline/doc/manvers.texinfo +++ b/contrib/libreadline/doc/manvers.texinfo @@ -1,6 +1,6 @@ -@set EDITION 4.1 -@set VERSION 4.1 -@set UPDATED 2000 January 19 -@set UPDATE-MONTH January 2000 +@set EDITION 4.2-beta +@set VERSION 4.2-beta +@set UPDATED 2001 Mar 12 +@set UPDATE-MONTH Mar 2001 -@set LASTCHANGE Wed Jan 19 12:16:30 EST 2000 +@set LASTCHANGE Mon Mar 12 05:36:44 EST 2001 diff --git a/contrib/libreadline/doc/readline.3 b/contrib/libreadline/doc/readline.3 index c1ed9cf..037b1bb 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: Tue Jun 1 13:28:03 EDT 1999 +.\" Last Change: Mon Mar 5 09:58:38 EST 2001 .\" -.TH READLINE 3 "1999 Jun 1" GNU +.TH READLINE 3 "2001 Mar 5" "GNU Readline 4.2" .\" .\" File Name macro. This used to be `.PN', for Path Name, .\" but Sun doesn't seem to like that very much. @@ -23,20 +23,19 @@ readline \- get a line from a user with editing .nf .ft B #include -#include -#include +#include +#include .ft .fi .LP .nf -.ft B -char *readline (prompt) -char *prompt; -.ft +\fIchar *\fP +.br +\fBreadline\fP (\fIconst char *prompt\fP); .fi .SH COPYRIGHT -.if n Readline is Copyright (C) 1989, 1991, 1993, 1995, 1996 by the Free Software Foundation, Inc. -.if t Readline is Copyright \(co 1989, 1991, 1993, 1995, 1996 by the Free Software Foundation, Inc. +.if n Readline is Copyright (C) 1989\-2001 by the Free Software Foundation, Inc. +.if t Readline is Copyright \(co 1989\-2001 by the Free Software Foundation, Inc. .SH DESCRIPTION .LP .B readline @@ -45,9 +44,10 @@ and return it, using .B prompt as a prompt. If .B prompt -is null, no prompt is issued. The line returned is allocated with -.IR malloc (3), -so the caller must free it when finished. The line returned +is \fBNULL\fP or the empty string, no prompt is issued. +The line returned is allocated with +.IR malloc (3); +the caller must free it when finished. The line returned has the final newline removed, so only the text of the line remains. .LP @@ -57,6 +57,11 @@ line. By default, the line editing commands are similar to those of emacs. A vi\-style line editing interface is also available. +.LP +This manual page describes only the most basic use of \fBreadline\fP. +Much more functionality is available; see +\fIThe GNU Readline Library\fP and \fIThe GNU History Library\fP +for additional information. .SH RETURN VALUE .LP .B readline @@ -130,6 +135,7 @@ or .RS C\-Meta\-u: universal\-argument .RE +.sp into the .I inputrc would make M\-C\-u execute the readline command @@ -137,15 +143,16 @@ would make M\-C\-u execute the readline command .PP The following symbolic character names are recognized while processing key bindings: -.IR RUBOUT , .IR DEL , .IR ESC , +.IR ESCAPE , .IR LFD , .IR NEWLINE , .IR RET , .IR RETURN , -.IR SPC , +.IR RUBOUT , .IR SPACE , +.IR SPC , and .IR TAB . .PP @@ -161,6 +168,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. +.PP 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: @@ -170,7 +178,7 @@ Control\-u: universal\-argument .br Meta\-Rubout: backward\-kill\-word .br -Control\-o: ">&output" +Control\-o: "> output" .RE .LP In the above example, @@ -184,7 +192,8 @@ and .I C\-o is bound to run the macro expressed on the right hand side (that is, to insert the text -.I >&output +.if t \f(CW> output\fP +.if n ``> output'' into the line). .PP In the second form, \fB"keyseq"\fP:\^\fIfunction\-name\fP or \fImacro\fP, @@ -194,7 +203,8 @@ differs from above in that strings denoting an entire key sequence may be specified by placing the sequence within double quotes. Some GNU Emacs style key escapes can be -used, as in the following example. +used, as in the following example, but the symbolic character names +are not recognized. .sp .RS "\eC\-u": universal\-argument @@ -214,8 +224,11 @@ is bound to the function 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 +.if t \f(CWFunction Key 1\fP. +.if n ``Function Key 1''. +.PP +The full set of GNU Emacs style escape sequences available when specifying +key sequences is .RS .PD 0 .TP @@ -232,10 +245,10 @@ an escape character backslash .TP .B \e" -literal " +literal ", a double quote .TP .B \e' -literal ' +literal ', a single quote .RE .PD .PP @@ -313,7 +326,8 @@ file with a statement of the form Except where noted, readline variables can take the values .B On or -.BR Off . +.B Off +(without regard to case). The variables and their default values are: .PP .PD 0 @@ -351,7 +365,7 @@ on the terminal. .B convert\-meta (On) If set to \fBOn\fP, readline will convert characters with the eighth bit set to an ASCII key sequence -by stripping the eighth bit and prepending an +by stripping the eighth bit and prefixing it with an escape character (in effect, using escape as the \fImeta prefix\fP). .TP .B disable\-completion (Off) @@ -361,7 +375,7 @@ mapped to \fBself-insert\fP. .TP .B editing\-mode (emacs) Controls whether readline begins with a set of key bindings similar -to \fIemacs\fP or \fIvi\fP. +to emacs or vi. .B editing\-mode can be set to either .B emacs @@ -384,12 +398,12 @@ becomes longer than the screen width rather than wrapping to a new line. .TP .B input\-meta (Off) If set to \fBOn\fP, readline will enable eight-bit input (that is, -it will not strip the high bit from the characters it reads), +it will not clear the eighth bit in the characters it reads), regardless of what the terminal claims it can support. The name .B meta\-flag is a synonym for this variable. .TP -.B isearch\-terminators (``C\-[C\-J'') +.B isearch\-terminators (``C\-[ C\-J'') The string of characters that should terminate an incremental search without subsequently executing the character as a command. If this variable has not been given a value, the characters @@ -402,13 +416,13 @@ vi-command\fP, and .IR vi-insert . \fIvi\fP is equivalent to \fIvi-command\fP; \fIemacs\fP is equivalent to \fIemacs-standard\fP. The default value is -.IR emacs ; -the value of +.IR emacs . +The value of .B editing\-mode also affects the default keymap. .TP .B mark\-directories (On) -If set to \fBOn\fP, complete) -Set the mark to the current point. If a +.B set\-mark (C\-@, M\-) +Set the mark to the point. If a numeric argument is supplied, the mark is set to that position. .TP .B exchange\-point\-and\-mark (C\-x C\-x) @@ -894,8 +920,9 @@ character. A negative count searches for subsequent occurrences. The value of the readline .B comment\-begin 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. +is accepted as if a newline had been typed. The default value of +.B comment\-begin +makes the current line a shell comment. .TP .B dump\-functions Print all of the functions and their key bindings to the @@ -932,25 +959,23 @@ editing mode. .SH DEFAULT KEY BINDINGS .LP The following is a list of the default emacs and vi bindings. -Characters with the 8th bit set are written as M\-, and +Characters with the eighth bit set are written as M\-, and are referred to as .I metafied characters. The printable ASCII characters not mentioned in the list of emacs standard bindings are bound to the -.I self\-insert +.B self\-insert function, which just inserts the given character into the input line. In vi insertion mode, all characters not specifically mentioned are bound to -.IR self\-insert . +.BR self\-insert . Characters assigned to signal generation by .IR stty (1) or the terminal driver, such as C-Z or C-C, retain that function. -Upper and lower case -.I metafied -characters are bound to the same function in the emacs mode -meta keymap. +Upper and lower case metafied characters are bound to the same function in +the emacs mode meta keymap. The remaining characters are unbound, which causes readline to ring the bell (subject to the setting of the .B bell\-style @@ -1036,7 +1061,7 @@ Emacs Meta bindings "M-Y" yank-pop "M-\e" delete-horizontal-space "M-~" tilde-expand -"M-C-?" backward-delete-word +"M-C-?" backward-kill-word "M-_" yank-last-arg .PP Emacs Control-X bindings @@ -1096,6 +1121,7 @@ VI Command Mode functions "C-V" quoted-insert "C-W" unix-word-rubout "C-Y" yank +"C-_" vi-undo "\^ " forward-char "#" insert-comment "$" end-of-line @@ -1150,7 +1176,7 @@ VI Command Mode functions "r" vi-change-char "s" vi-subst "t" vi-char-search -"u" undo +"u" vi-undo "w" vi-next-word "x" vi-delete "y" vi-yank-to diff --git a/contrib/libreadline/doc/rlman.texinfo b/contrib/libreadline/doc/rlman.texinfo index 759f0eb..894c516 100644 --- a/contrib/libreadline/doc/rlman.texinfo +++ b/contrib/libreadline/doc/rlman.texinfo @@ -18,7 +18,7 @@ This document describes the GNU Readline Library, a utility which aids in the consistency of user interface across discrete programs that need to provide a command line interface. -Copyright (C) 1988-1999 Free Software Foundation, Inc. +Copyright (C) 1988-2001 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice @@ -73,7 +73,7 @@ except that this permission notice may be stated in a translation approved by the Free Software Foundation. @vskip 0pt plus 1filll -Copyright @copyright{} 1988-1999 Free Software Foundation, Inc. +Copyright @copyright{} 1988-2001 Free Software Foundation, Inc. @end titlepage @ifinfo diff --git a/contrib/libreadline/doc/rltech.texinfo b/contrib/libreadline/doc/rltech.texinfo index 51c340a..acc8d4d 100644 --- a/contrib/libreadline/doc/rltech.texinfo +++ b/contrib/libreadline/doc/rltech.texinfo @@ -8,7 +8,7 @@ This document describes the GNU Readline Library, a utility for aiding in the consitency of user interface across discrete programs that need to provide a command line interface. -Copyright (C) 1988, 1994, 1996, 1998, 1999 Free Software Foundation, Inc. +Copyright (C) 1988-2001 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice @@ -35,9 +35,9 @@ by the Foundation. @node Programming with GNU Readline @chapter Programming with GNU Readline -This chapter describes the interface between the GNU Readline Library and +This chapter describes the interface between the @sc{gnu} Readline Library and other programs. If you are a programmer, and you wish to include the -features found in GNU Readline +features found in @sc{gnu} Readline such as completion, line editing, and interactive history manipulation in your own programs, this section is for you. @@ -61,18 +61,20 @@ Many programs provide a command line interface, such as @code{mail}, @code{ftp}, and @code{sh}. For such programs, the default behaviour of Readline is sufficient. This section describes how to use Readline in the simplest way possible, perhaps to replace calls in your code to -@code{gets()} or @code{fgets ()}. +@code{gets()} or @code{fgets()}. @findex readline @cindex readline, function -The function @code{readline ()} prints a prompt and then reads and returns -a single line of text from the user. The line @code{readline} -returns is allocated with @code{malloc ()}; you should @code{free ()} -the line when you are done with it. The declaration for @code{readline} -in ANSI C is + +The function @code{readline()} prints a prompt @var{prompt} +and then reads and returns a single line of text from the user. +If @var{prompt} is @code{NULL} or the empty string, no prompt is displayed. +The line @code{readline} returns is allocated with @code{malloc()}; +the caller should @code{free()} the line when it has finished with it. +The declaration for @code{readline} in ANSI C is @example -@code{char *readline (char *@var{prompt});} +@code{char *readline (const char *@var{prompt});} @end example @noindent @@ -90,7 +92,7 @@ line is empty at that point, then @code{(char *)NULL} is returned. Otherwise, the line is ended just as if a newline had been typed. If you want the user to be able to get at the line later, (with -@key{C-p} for example), you must call @code{add_history ()} to save the +@key{C-p} for example), you must call @code{add_history()} to save the line away in a @dfn{history} list of such lines. @example @@ -102,7 +104,7 @@ For full details on the GNU History Library, see the associated manual. It is preferable to avoid saving empty lines on the history list, since users rarely have a burning need to reuse a blank line. Here is -a function which usefully replaces the standard @code{gets ()} library +a function which usefully replaces the standard @code{gets()} library function, and has the advantage of no static buffer to overflow: @example @@ -135,17 +137,17 @@ rl_gets () This function gives the user the default behaviour of @key{TAB} completion: completion on file names. If you do not want Readline to complete on filenames, you can change the binding of the @key{TAB} key -with @code{rl_bind_key ()}. +with @code{rl_bind_key()}. @example -@code{int rl_bind_key (int @var{key}, int (*@var{function})());} +@code{int rl_bind_key (int @var{key}, rl_command_func_t *@var{function});} @end example -@code{rl_bind_key ()} takes two arguments: @var{key} is the character that +@code{rl_bind_key()} takes two arguments: @var{key} is the character that you want to bind, and @var{function} is the address of the function to -call when @var{key} is pressed. Binding @key{TAB} to @code{rl_insert ()} +call when @var{key} is pressed. Binding @key{TAB} to @code{rl_insert()} makes @key{TAB} insert itself. -@code{rl_bind_key ()} returns non-zero if @var{key} is not a valid +@code{rl_bind_key()} returns non-zero if @var{key} is not a valid ASCII character code (between 0 and 255). Thus, to disable the default @key{TAB} behavior, the following suffices: @@ -154,7 +156,7 @@ Thus, to disable the default @key{TAB} behavior, the following suffices: @end example This code should be executed once at the start of your program; you -might write a function called @code{initialize_readline ()} which +might write a function called @code{initialize_readline()} which performs this and other desired initializations, such as installing custom completers (@pxref{Custom Completers}). @@ -175,44 +177,71 @@ in @code{readline.h} use the @code{stdio} library, the file @code{} should be included before @code{readline.h}. @menu -* The Function Type:: C declarations to make code readable. +* Readline Typedefs:: C declarations to make code readable. * Function Writing:: Variables and calling conventions. @end menu -@node The Function Type -@subsection The Function Type +@node Readline Typedefs +@subsection Readline Typedefs -For readabilty, we declare a new type of object, called -@dfn{Function}. A @code{Function} is a C function which -returns an @code{int}. The type declaration for @code{Function} is: +For readabilty, we declare a number of new object types, all pointers +to functions. -@noindent -@code{typedef int Function ();} +The reason for declaring these new types is to make it easier to write +code describing pointers to C functions with appropriately prototyped +arguments and return values. -The reason for declaring this new type is to make it easier to write -code describing pointers to C functions. Let us say we had a variable -called @var{func} which was a pointer to a function. Instead of the -classic C declaration +For instance, say we want to declare a variable @var{func} as a pointer +to a function which takes two @code{int} arguments and returns an +@code{int} (this is the type of all of the Readline bindable functions). +Instead of the classic C declaration -@code{int (*)()func;} +@code{int (*func)();} @noindent -we may write +or the ANSI-C style declaration -@code{Function *func;} +@code{int (*func)(int, int);} @noindent -Similarly, there are +we may write -@example -typedef void VFunction (); -typedef char *CPFunction (); @r{and} -typedef char **CPPFunction (); -@end example +@code{rl_command_func_t *func;} -@noindent -for functions returning no value, @code{pointer to char}, and -@code{pointer to pointer to char}, respectively. +The full list of function pointer types available is + +@table @code +@item typedef int rl_command_func_t (int, int); + +@item typedef char *rl_compentry_func_t (const char *, int); + +@item typedef char **rl_completion_func_t (const char *, int, int); + +@item typedef char *rl_quote_func_t (char *, int, char *); + +@item typedef char *rl_dequote_func_t (char *, int); + +@item typedef int rl_compignore_func_t (char **); + +@item typedef void rl_compdisp_func_t (char **, int, int); + +@item typedef int rl_hook_func_t (void); + +@item typedef int rl_getc_func_t (FILE *); + +@item typedef int rl_linebuf_func_t (char *, int); + +@item typedef int rl_intfunc_t (int); +@item #define rl_ivoidfunc_t rl_hook_func_t +@item typedef int rl_icpfunc_t (char *); +@item typedef int rl_icppfunc_t (char **); + +@item typedef void rl_voidfunc_t (void); +@item typedef void rl_vintfunc_t (int); +@item typedef void rl_vcpfunc_t (char *); +@item typedef void rl_vcppfunc_t (char **); + +@end table @node Function Writing @subsection Writing a New Function @@ -265,7 +294,7 @@ The number of characters present in @code{rl_line_buffer}. When @end deftypevar @deftypevar int rl_mark -The mark (saved position) in the current line. If set, the mark +The @var{mark} (saved position) in the current line. If set, the mark and point define a @emph{region}. @end deftypevar @@ -274,11 +303,23 @@ Setting this to a non-zero value causes Readline to return the current line immediately. @end deftypevar +@deftypevar int rl_num_chars_to_read +Setting this to a positive value before calling @code{readline()} causes +Readline to return after accepting that many characters, rather +than reading up to a character bound to @code{accept-line}. +@end deftypevar + @deftypevar int rl_pending_input Setting this to a value makes it the next keystroke read. This is a way to stuff a single character into the input stream. @end deftypevar +@deftypevar int rl_dispatching +Set to a non-zero value if a function is being called from a key binding; +zero otherwise. Application functions can test this to discover whether +they were called directly or by Readline's dispatching mechanism. +@end deftypevar + @deftypevar int rl_erase_empty_line Setting this to a non-zero value causes Readline to completely erase the current line, including any prompt, any time a newline is typed as @@ -288,7 +329,9 @@ the beginning of the newly-blank line. @deftypevar {char *} rl_prompt The prompt Readline uses. This is set from the argument to -@code{readline ()}, and should not be assigned to directly. +@code{readline()}, and should not be assigned to directly. +The @code{rl_set_prompt()} function (@pxref{Redisplay}) may +be used to modify the prompt string after calling @code{readline()}. @end deftypevar @deftypevar int rl_already_prompted @@ -301,15 +344,22 @@ The calling application is responsible for managing the value; Readline never sets it. @end deftypevar -@deftypevar {char *} rl_library_version +@deftypevar {const char *} rl_library_version The version number of this revision of the library. @end deftypevar -@deftypevar {char *} rl_terminal_name -The terminal type, used for initialization. +@deftypevar {int} rl_gnu_readline_p +Always set to 1, denoting that this is @sc{gnu} readline rather than some +emulation. @end deftypevar -@deftypevar {char *} rl_readline_name +@deftypevar {const char *} rl_terminal_name +The terminal type, used for initialization. If not set by the application, +Readline sets this to the value of the @env{TERM} environment variable +the first time it is called. +@end deftypevar + +@deftypevar {const char *} rl_readline_name This variable is set to a unique name by each application using Readline. The value allows conditional parsing of the inputrc file (@pxref{Conditional Init Constructs}). @@ -323,36 +373,60 @@ The stdio stream from which Readline reads input. The stdio stream to which Readline performs output. @end deftypevar -@deftypevar {Function *} rl_startup_hook +@deftypevar {rl_command_func_t *} rl_last_func +The address of the last command function Readline executed. May be used to +test whether or not a function is being executed twice in succession, for +example. +@end deftypevar + +@deftypevar {rl_hook_func_t *} rl_startup_hook If non-zero, this is the address of a function to call just before @code{readline} prints the first prompt. @end deftypevar -@deftypevar {Function *} rl_pre_input_hook +@deftypevar {rl_hook_func_t *} rl_pre_input_hook If non-zero, this is the address of a function to call after the first prompt has been printed and just before @code{readline} starts reading input characters. @end deftypevar -@deftypevar {Function *} rl_event_hook +@deftypevar {rl_hook_func_t *} rl_event_hook If non-zero, this is the address of a function to call periodically -when readline is waiting for terminal input. +when Readline is waiting for terminal input. +By default, this will be called at most ten times a second if there +is no keyboard input. @end deftypevar -@deftypevar {Function *} rl_getc_function -If non-zero, @code{readline} will call indirectly through this pointer +@deftypevar {rl_getc_func_t *} rl_getc_function +If non-zero, Readline will call indirectly through this pointer to get a character from the input stream. By default, it is set to -@code{rl_getc}, the default @code{readline} character input function -(@pxref{Utility Functions}). +@code{rl_getc}, the default Readline character input function +(@pxref{Character Input}). @end deftypevar -@deftypevar {VFunction *} rl_redisplay_function -If non-zero, @code{readline} will call indirectly through this pointer +@deftypevar {rl_voidfunc_t *} rl_redisplay_function +If non-zero, Readline will call indirectly through this pointer to update the display with the current contents of the editing buffer. -By default, it is set to @code{rl_redisplay}, the default @code{readline} +By default, it is set to @code{rl_redisplay}, the default Readline redisplay function (@pxref{Redisplay}). @end deftypevar +@deftypevar {rl_vintfunc_t *} rl_prep_term_function +If non-zero, Readline will call indirectly through this pointer +to initialize the terminal. The function takes a single argument, an +@code{int} flag that says whether or not to use eight-bit characters. +By default, this is set to @code{rl_prep_terminal} +(@pxref{Terminal Management}). +@end deftypevar + +@deftypevar {rl_voidfunc_t *} rl_deprep_term_function +If non-zero, Readline will call indirectly through this pointer +to reset the terminal. This function should undo the effects of +@code{rl_prep_term_function}. +By default, this is set to @code{rl_deprep_terminal} +(@pxref{Terminal Management}). +@end deftypevar + @deftypevar {Keymap} rl_executing_keymap This variable is set to the keymap (@pxref{Keymaps}) in which the currently executing readline function was found. @@ -363,6 +437,79 @@ This variable is set to the keymap (@pxref{Keymaps}) in which the last key binding occurred. @end deftypevar +@deftypevar {char *} rl_executing_macro +This variable is set to the text of any currently-executing macro. +@end deftypevar + +@deftypevar {int} rl_readline_state +A variable with bit values that encapsulate the current Readline state. +A bit is set with the @code{RL_SETSTATE} macro, and unset with the +@code{RL_UNSETSTATE} macro. Use the @code{RL_ISSTATE} macro to test +whether a particular state bit is set. Current state bits include: + +@table @code +@item RL_STATE_NONE +Readline has not yet been called, nor has it begun to intialize. +@item RL_STATE_INITIALIZING +Readline is initializing its internal data structures. +@item RL_STATE_INITIALIZED +Readline has completed its initialization. +@item RL_STATE_TERMPREPPED +Readline has modified the terminal modes to do its own input and redisplay. +@item RL_STATE_READCMD +Readline is reading a command from the keyboard. +@item RL_STATE_METANEXT +Readline is reading more input after reading the meta-prefix character. +@item RL_STATE_DISPATCHING +Readline is dispatching to a command. +@item RL_STATE_MOREINPUT +Readline is reading more input while executing an editing command. +@item RL_STATE_ISEARCH +Readline is performing an incremental history search. +@item RL_STATE_NSEARCH +Readline is performing a non-incremental history search. +@item RL_STATE_SEARCH +Readline is searching backward or forward through the history for a string. +@item RL_STATE_NUMERICARG +Readline is reading a numeric argument. +@item RL_STATE_MACROINPUT +Readline is currently getting its input from a previously-defined keyboard +macro. +@item RL_STATE_MACRODEF +Readline is currently reading characters defining a keyboard macro. +@item RL_STATE_OVERWRITE +Readline is in overwrite mode. +@item RL_STATE_COMPLETING +Readline is performing word completion. +@item RL_STATE_SIGHANDLER +Readline is currently executing the readline signal handler. +@item RL_STATE_UNDOING +Readline is performing an undo. +@item RL_STATE_DONE +Readline has read a key sequence bound to @code{accept-line} +and is about to return the line to the caller. +@end table + +@end deftypevar + +@deftypevar {int} rl_explicit_arg +Set to a non-zero value if an explicit numeric argument was specified by +the user. Only valid in a bindable command function. +@end deftypevar + +@deftypevar {int} rl_numeric_arg +Set to the value of any numeric argument explicitly specified by the user +before executing the current Readline function. Only valid in a bindable +command function. +@end deftypevar + +@deftypevar {int} rl_editing_mode +Set to a value denoting Readline's current editing mode. A value of +@var{1} means Readline is currently in emacs mode; @var{0} +means that vi mode is active. +@end deftypevar + + @node Readline Convenience Functions @section Readline Convenience Functions @@ -375,8 +522,12 @@ last key binding occurred. * Allowing Undoing:: How to make your functions undoable. * Redisplay:: Functions to control line display. * Modifying Text:: Functions to modify @code{rl_line_buffer}. +* Character Input:: Functions to read keyboard input. +* Terminal Management:: Functions to manage terminal settings. * Utility Functions:: Generally useful functions and hooks. +* Miscellaneous Functions:: Functions that don't fall into any category. * Alternate Interface:: Using Readline in a `callback' fashion. +* A Readline Example:: An example Readline function. @end menu @node Function Naming @@ -396,10 +547,10 @@ This binds the keystroke @key{Meta-Rubout} to the function programmer, should bind the functions you write to descriptive names as well. Readline provides a function for doing that: -@deftypefun int rl_add_defun (char *name, Function *function, int key) +@deftypefun int rl_add_defun (const char *name, rl_command_func_t *function, int key) Add @var{name} to the list of named functions. Make @var{function} be the function that gets called. If @var{key} is not -1, then bind it to -@var{function} using @code{rl_bind_key ()}. +@var{function} using @code{rl_bind_key()}. @end deftypefun Using this function alone is sufficient for most applications. It is @@ -416,16 +567,17 @@ association between the keys that the user types and the functions that get run. You can make your own keymaps, copy existing keymaps, and tell Readline which keymap to use. -@deftypefun Keymap rl_make_bare_keymap () +@deftypefun Keymap rl_make_bare_keymap (void) Returns a new, empty keymap. The space for the keymap is allocated with -@code{malloc ()}; you should @code{free ()} it when you are done. +@code{malloc()}; the caller should free it by calling +@code{rl_discard_keymap()} when done. @end deftypefun @deftypefun Keymap rl_copy_keymap (Keymap map) Return a new keymap which is a copy of @var{map}. @end deftypefun -@deftypefun Keymap rl_make_keymap () +@deftypefun Keymap rl_make_keymap (void) Return a new keymap with the printing characters bound to rl_insert, the lowercase Meta characters bound to run their equivalents, and the Meta digits bound to produce numeric arguments. @@ -438,7 +590,7 @@ Free the storage associated with @var{keymap}. Readline has several internal keymaps. These functions allow you to change which keymap is active. -@deftypefun Keymap rl_get_keymap () +@deftypefun Keymap rl_get_keymap (void) Returns the currently active keymap. @end deftypefun @@ -446,7 +598,7 @@ Returns the currently active keymap. Makes @var{keymap} the currently active keymap. @end deftypefun -@deftypefun Keymap rl_get_keymap_by_name (char *name) +@deftypefun Keymap rl_get_keymap_by_name (const char *name) Return the keymap matching @var{name}. @var{name} is one which would be supplied in a @code{set keymap} inputrc line (@pxref{Readline Init File}). @end deftypefun @@ -459,28 +611,28 @@ be supplied in a @code{set keymap} inputrc line (@pxref{Readline Init File}). @node Binding Keys @subsection Binding Keys -You associate keys with functions through the keymap. Readline has -several internal keymaps: @code{emacs_standard_keymap}, +Key sequences are associate with functions through the keymap. +Readline has several internal keymaps: @code{emacs_standard_keymap}, @code{emacs_meta_keymap}, @code{emacs_ctlx_keymap}, @code{vi_movement_keymap}, and @code{vi_insertion_keymap}. @code{emacs_standard_keymap} is the default, and the examples in this manual assume that. -Since @code{readline} installs a set of default key bindings the first +Since @code{readline()} installs a set of default key bindings the first time it is called, there is always the danger that a custom binding -installed before the first call to @code{readline} will be overridden. +installed before the first call to @code{readline()} will be overridden. An alternate mechanism is to install custom key bindings in an initialization function assigned to the @code{rl_startup_hook} variable (@pxref{Readline Variables}). These functions manage key bindings. -@deftypefun int rl_bind_key (int key, Function *function) +@deftypefun int rl_bind_key (int key, rl_command_func_t *function) Binds @var{key} to @var{function} in the currently active keymap. Returns non-zero in the case of an invalid @var{key}. @end deftypefun -@deftypefun int rl_bind_key_in_map (int key, Function *function, Keymap map) +@deftypefun int rl_bind_key_in_map (int key, rl_command_func_t *function, Keymap map) Bind @var{key} to @var{function} in @var{map}. Returns non-zero in the case of an invalid @var{key}. @end deftypefun @@ -495,15 +647,21 @@ Bind @var{key} to the null function in @var{map}. Returns non-zero in case of error. @end deftypefun -@deftypefun int rl_unbind_function_in_map (Function *function, Keymap map) +@deftypefun int rl_unbind_function_in_map (rl_command_func_t *function, Keymap map) Unbind all keys that execute @var{function} in @var{map}. @end deftypefun -@deftypefun int rl_unbind_command_in_map (char *command, Keymap map) +@deftypefun int rl_unbind_command_in_map (const char *command, Keymap map) Unbind all keys that are bound to @var{command} in @var{map}. @end deftypefun -@deftypefun int rl_generic_bind (int type, char *keyseq, char *data, Keymap map) +@deftypefun int rl_set_key (const char *keyseq, rl_command_func_t *function, Keymap map) +Bind the key sequence represented by the string @var{keyseq} to the function +@var{function}. This makes new keymaps as +necessary. The initial keymap in which to do bindings is @var{map}. +@end deftypefun + +@deftypefun int rl_generic_bind (int type, const char *keyseq, char *data, Keymap map) Bind the key sequence represented by the string @var{keyseq} to the arbitrary pointer @var{data}. @var{type} says what kind of data is pointed to by @var{data}; this can be a function (@code{ISFUNC}), a macro @@ -517,7 +675,7 @@ perform any key bindings and variable assignments found (@pxref{Readline Init File}). @end deftypefun -@deftypefun int rl_read_init_file (char *filename) +@deftypefun int rl_read_init_file (const char *filename) Read keybindings and variable assignments from @var{filename} (@pxref{Readline Init File}). @end deftypefun @@ -526,25 +684,26 @@ Read keybindings and variable assignments from @var{filename} @subsection Associating Function Names and Bindings These functions allow you to find out what keys invoke named functions -and the functions invoked by a particular key sequence. +and the functions invoked by a particular key sequence. You may also +associate a new function name with an arbitrary function. -@deftypefun {Function *} rl_named_function (char *name) +@deftypefun {rl_command_func_t *} rl_named_function (const char *name) Return the function with name @var{name}. @end deftypefun -@deftypefun {Function *} rl_function_of_keyseq (char *keyseq, Keymap map, int *type) +@deftypefun {rl_command_func_t *} rl_function_of_keyseq (const char *keyseq, Keymap map, int *type) Return the function invoked by @var{keyseq} in keymap @var{map}. -If @var{map} is NULL, the current keymap is used. If @var{type} is -not NULL, the type of the object is returned in it (one of @code{ISFUNC}, -@code{ISKMAP}, or @code{ISMACR}). +If @var{map} is @code{NULL}, the current keymap is used. If @var{type} is +not @code{NULL}, the type of the object is returned in the @code{int} variable +it points to (one of @code{ISFUNC}, @code{ISKMAP}, or @code{ISMACR}). @end deftypefun -@deftypefun {char **} rl_invoking_keyseqs (Function *function) +@deftypefun {char **} rl_invoking_keyseqs (rl_command_func_t *function) Return an array of strings representing the key sequences used to invoke @var{function} in the current keymap. @end deftypefun -@deftypefun {char **} rl_invoking_keyseqs_in_map (Function *function, Keymap map) +@deftypefun {char **} rl_invoking_keyseqs_in_map (rl_command_func_t *function, Keymap map) Return an array of strings representing the key sequences used to invoke @var{function} in the keymap @var{map}. @end deftypefun @@ -556,14 +715,19 @@ the list is formatted in such a way that it can be made part of an @code{inputrc} file and re-read. @end deftypefun -@deftypefun void rl_list_funmap_names () +@deftypefun void rl_list_funmap_names (void) Print the names of all bindable Readline functions to @code{rl_outstream}. @end deftypefun -@deftypefun {char **} rl_funmap_names () +@deftypefun {const char **} rl_funmap_names (void) Return a NULL terminated array of known function names. The array is sorted. The array itself is allocated, but not the strings inside. You -should free () the array when you done, but not the pointrs. +should @code{free()} the array when you are done, but not the pointers. +@end deftypefun + +@deftypefun int rl_add_funmap_entry (const char *name, rl_command_func_t *function) +Add @var{name} to the list of bindable Readline command names, and make +@var{function} the function to be called when @var{name} is invoked. @end deftypefun @node Allowing Undoing @@ -571,17 +735,16 @@ should free () the array when you done, but not the pointrs. Supporting the undo command is a painless thing, and makes your functions much more useful. It is certainly easy to try -something if you know you can undo it. I could use an undo function for -the stock market. +something if you know you can undo it. If your function simply inserts text once, or deletes text once, and -uses @code{rl_insert_text ()} or @code{rl_delete_text ()} to do it, then +uses @code{rl_insert_text()} or @code{rl_delete_text()} to do it, then undoing is already done for you automatically. If you do multiple insertions or multiple deletions, or any combination of these operations, you should group them together into one operation. -This is done with @code{rl_begin_undo_group ()} and -@code{rl_end_undo_group ()}. +This is done with @code{rl_begin_undo_group()} and +@code{rl_end_undo_group()}. The types of events that can be undone are: @@ -591,21 +754,21 @@ enum undo_code @{ UNDO_DELETE, UNDO_INSERT, UNDO_BEGIN, UNDO_END @}; Notice that @code{UNDO_DELETE} means to insert some text, and @code{UNDO_INSERT} means to delete some text. That is, the undo code -tells undo what to undo, not how to undo it. @code{UNDO_BEGIN} and -@code{UNDO_END} are tags added by @code{rl_begin_undo_group ()} and -@code{rl_end_undo_group ()}. +tells what to undo, not how to undo it. @code{UNDO_BEGIN} and +@code{UNDO_END} are tags added by @code{rl_begin_undo_group()} and +@code{rl_end_undo_group()}. -@deftypefun int rl_begin_undo_group () +@deftypefun int rl_begin_undo_group (void) Begins saving undo information in a group construct. The undo -information usually comes from calls to @code{rl_insert_text ()} and -@code{rl_delete_text ()}, but could be the result of calls to -@code{rl_add_undo ()}. +information usually comes from calls to @code{rl_insert_text()} and +@code{rl_delete_text()}, but could be the result of calls to +@code{rl_add_undo()}. @end deftypefun -@deftypefun int rl_end_undo_group () +@deftypefun int rl_end_undo_group (void) Closes the current undo group started with @code{rl_begin_undo_group -()}. There should be one call to @code{rl_end_undo_group ()} -for each call to @code{rl_begin_undo_group ()}. +()}. There should be one call to @code{rl_end_undo_group()} +for each call to @code{rl_begin_undo_group()}. @end deftypefun @deftypefun void rl_add_undo (enum undo_code what, int start, int end, char *text) @@ -613,17 +776,17 @@ Remember how to undo an event (according to @var{what}). The affected text runs from @var{start} to @var{end}, and encompasses @var{text}. @end deftypefun -@deftypefun void free_undo_list () +@deftypefun void rl_free_undo_list (void) Free the existing undo list. @end deftypefun -@deftypefun int rl_do_undo () +@deftypefun int rl_do_undo (void) Undo the first thing on the undo list. Returns @code{0} if there was nothing to undo, non-zero if something was undone. @end deftypefun Finally, if you neither insert nor delete text, but directly modify the -existing text (e.g., change its case), call @code{rl_modifying ()} +existing text (e.g., change its case), call @code{rl_modifying()} once, just before you modify the text. You must supply the indices of the text range that you are going to modify. @@ -636,22 +799,22 @@ that text. @node Redisplay @subsection Redisplay -@deftypefun void rl_redisplay () +@deftypefun void rl_redisplay (void) Change what's displayed on the screen to reflect the current contents of @code{rl_line_buffer}. @end deftypefun -@deftypefun int rl_forced_update_display () +@deftypefun int rl_forced_update_display (void) Force the line to be updated and redisplayed, whether or not Readline thinks the screen display is correct. @end deftypefun -@deftypefun int rl_on_new_line () +@deftypefun int rl_on_new_line (void) Tell the update functions that we have moved onto a new (empty) line, usually after ouputting a newline. @end deftypefun -@deftypefun int rl_on_new_line_with_prompt () +@deftypefun int rl_on_new_line_with_prompt (void) Tell the update functions that we have moved onto a new line, with @var{rl_prompt} already displayed. This could be used by applications that want to output the prompt string @@ -660,35 +823,65 @@ redisplay. It should be used after setting @var{rl_already_prompted}. @end deftypefun -@deftypefun int rl_reset_line_state () +@deftypefun int rl_reset_line_state (void) Reset the display state to a clean state and redisplay the current line starting on a new line. @end deftypefun -@deftypefun int rl_message (va_alist) -The arguments are a string as would be supplied to @code{printf}. The -resulting string is displayed in the @dfn{echo area}. The echo area +@deftypefun int rl_crlf (void) +Move the cursor to the start of the next screen line. +@end deftypefun + +@deftypefun int rl_show_char (int c) +Display character @var{c} on @code{rl_outstream}. +If Readline has not been set to display meta characters directly, this +will convert meta characters to a meta-prefixed key sequence. +This is intended for use by applications which wish to do their own +redisplay. +@end deftypefun + +@deftypefun int rl_message (const char *, @dots{}) +The arguments are a format string as would be supplied to @code{printf}, +possibly containing conversion specifications such as @samp{%d}, and +any additional arguments necessary to satisfy the conversion specifications. +The resulting string is displayed in the @dfn{echo area}. The echo area is also used to display numeric arguments and search strings. @end deftypefun -@deftypefun int rl_clear_message () +@deftypefun int rl_clear_message (void) Clear the message in the echo area. @end deftypefun -@deftypefun void rl_save_prompt () +@deftypefun void rl_save_prompt (void) Save the local Readline prompt display state in preparation for -displaying a new message in the message area with @code{rl_message}. +displaying a new message in the message area with @code{rl_message()}. @end deftypefun -@deftypefun void rl_restore_prompt () +@deftypefun void rl_restore_prompt (void) Restore the local Readline prompt display state saved by the most recent call to @code{rl_save_prompt}. @end deftypefun +@deftypefun int rl_expand_prompt (char *prompt) +Expand any special character sequences in @var{prompt} and set up the +local Readline prompt redisplay variables. +This function is called by @code{readline()}. It may also be called to +expand the primary prompt if the @code{rl_on_new_line_with_prompt()} +function or @code{rl_already_prompted} variable is used. +It returns the number of visible characters on the last line of the +(possibly multi-line) prompt. +@end deftypefun + +@deftypefun int rl_set_prompt (const char *prompt) +Make Readline use @var{prompt} for subsequent redisplay. This calls +@code{rl_expand_prompt()} to expand the prompt and sets @code{rl_prompt} +to the result. +@end deftypefun + @node Modifying Text @subsection Modifying Text -@deftypefun int rl_insert_text (char *text) +@deftypefun int rl_insert_text (const char *text) Insert @var{text} into the line at the current cursor position. @end deftypefun @@ -710,53 +903,104 @@ the text is appended, otherwise prepended. If the last command was not a kill, a new kill ring slot is used. @end deftypefun -@node Utility Functions -@subsection Utility Functions +@deftypefun int rl_push_macro_input (char *macro) +Cause @var{macro} to be inserted into the line, as if it had been invoked +by a key bound to a macro. Not especially useful; use +@code{rl_insert_text()} instead. +@end deftypefun -@deftypefun int rl_read_key () -Return the next character available. This handles input inserted into -the input stream via @var{pending input} (@pxref{Readline Variables}) -and @code{rl_stuff_char ()}, macros, and characters read from the keyboard. +@node Character Input +@subsection Character Input + +@deftypefun int rl_read_key (void) +Return the next character available from Readline's current input stream. +This handles input inserted into +the input stream via @var{rl_pending_input} (@pxref{Readline Variables}) +and @code{rl_stuff_char()}, macros, and characters read from the keyboard. +While waiting for input, this function will call any function assigned to +the @code{rl_event_hook} variable. @end deftypefun -@deftypefun int rl_getc (FILE *) -Return the next character available from the keyboard. +@deftypefun int rl_getc (FILE *stream) +Return the next character available from @var{stream}, which is assumed to +be the keyboard. @end deftypefun @deftypefun int rl_stuff_char (int c) Insert @var{c} into the Readline input stream. It will be "read" before Readline attempts to read characters from the terminal with -@code{rl_read_key ()}. +@code{rl_read_key()}. @end deftypefun -@deftypefun int rl_extend_line_buffer (int len) -Ensure that @code{rl_line_buffer} has enough space to hold @var{len} -characters, possibly reallocating it if necessary. +@deftypefun int rl_execute_next (int c) +Make @var{c} be the next command to be executed when @code{rl_read_key()} +is called. This sets @var{rl_pending_input}. @end deftypefun -@deftypefun int rl_initialize () -Initialize or re-initialize Readline's internal state. +@deftypefun int rl_clear_pending_input (void) +Unset @var{rl_pending_input}, effectively negating the effect of any +previous call to @code{rl_execute_next()}. This works only if the +pending input has not already been read with @code{rl_read_key()}. +@end deftypefun + +@deftypefun int rl_set_keyboard_input_timeout (int u) +While waiting for keyboard input in @code{rl_read_key()}, Readline will +wait for @var{u} microseconds for input before calling any function +assigned to @code{rl_event_hook}. The default waiting period is +one-tenth of a second. Returns the old timeout value. @end deftypefun -@deftypefun int rl_reset_terminal (char *terminal_name) +@node Terminal Management +@subsection Terminal Management + +@deftypefun void rl_prep_terminal (int meta_flag) +Modify the terminal settings for Readline's use, so @code{readline()} +can read a single character at a time from the keyboard. +The @var{meta_flag} argument should be non-zero if Readline should +read eight-bit input. +@end deftypefun + +@deftypefun void rl_deprep_terminal (void) +Undo the effects of @code{rl_prep_terminal()}, leaving the terminal in +the state in which it was before the most recent call to +@code{rl_prep_terminal()}. +@end deftypefun + +@deftypefun void rl_tty_set_default_bindings (Keymap kmap) +Read the operating system's terminal editing characters (as would be displayed +by @code{stty}) to their Readline equivalents. The bindings are performed +in @var{kmap}. +@end deftypefun + +@deftypefun int rl_reset_terminal (const char *terminal_name) Reinitialize Readline's idea of the terminal settings using @var{terminal_name} as the terminal type (e.g., @code{vt100}). -If @var{terminal_name} is NULL, the value of the @code{TERM} +If @var{terminal_name} is @code{NULL}, the value of the @code{TERM} environment variable is used. @end deftypefun -@deftypefun int alphabetic (int c) -Return 1 if @var{c} is an alphabetic character. +@node Utility Functions +@subsection Utility Functions + +@deftypefun int rl_extend_line_buffer (int len) +Ensure that @code{rl_line_buffer} has enough space to hold @var{len} +characters, possibly reallocating it if necessary. @end deftypefun -@deftypefun int numeric (int c) -Return 1 if @var{c} is a numeric character. +@deftypefun int rl_initialize (void) +Initialize or re-initialize Readline's internal state. +It's not strictly necessary to call this; @code{readline()} calls it before +reading any input. @end deftypefun -@deftypefun int ding () +@deftypefun int rl_ding (void) Ring the terminal bell, obeying the setting of @code{bell-style}. @end deftypefun +@deftypefun int rl_alphabetic (int c) +Return 1 if @var{c} is an alphabetic character. +@end deftypefun + @deftypefun void rl_display_match_list (char **matches, int len, int max) A convenience function for displaying a list of strings in columnar format on Readline's output stream. @code{matches} is the list @@ -767,34 +1011,71 @@ the setting of @code{print-completions-horizontally} to select how the matches are displayed (@pxref{Readline Init File Syntax}). @end deftypefun -The following are implemented as macros, defined in @code{chartypes.h}. +The following are implemented as macros, defined in @code{chardefs.h}. +Applications should refrain from using them. -@deftypefun int uppercase_p (int c) +@deftypefun int _rl_uppercase_p (int c) Return 1 if @var{c} is an uppercase alphabetic character. @end deftypefun -@deftypefun int lowercase_p (int c) +@deftypefun int _rl_lowercase_p (int c) Return 1 if @var{c} is a lowercase alphabetic character. @end deftypefun -@deftypefun int digit_p (int c) +@deftypefun int _rl_digit_p (int c) Return 1 if @var{c} is a numeric character. @end deftypefun -@deftypefun int to_upper (int c) +@deftypefun int _rl_to_upper (int c) If @var{c} is a lowercase alphabetic character, return the corresponding uppercase character. @end deftypefun -@deftypefun int to_lower (int c) +@deftypefun int _rl_to_lower (int c) If @var{c} is an uppercase alphabetic character, return the corresponding lowercase character. @end deftypefun -@deftypefun int digit_value (int c) +@deftypefun int _rl_digit_value (int c) If @var{c} is a number, return the value it represents. @end deftypefun +@node Miscellaneous Functions +@subsection Miscellaneous Functions + +@deftypefun int rl_macro_bind (const char *keyseq, const char *macro, Keymap map) +Bind the key sequence @var{keyseq} to invoke the macro @var{macro}. +The binding is performed in @var{map}. When @var{keyseq} is invoked, the +@var{macro} will be inserted into the line. This function is deprecated; +use @code{rl_generic_bind()} instead. +@end deftypefun + +@deftypefun void rl_macro_dumper (int readable) +Print the key sequences bound to macros and their values, using +the current keymap, to @code{rl_outstream}. +If @var{readable} is non-zero, the list is formatted in such a way +that it can be made part of an @code{inputrc} file and re-read. +@end deftypefun + +@deftypefun int rl_variable_bind (const char *variable, const char *value) +Make the Readline variable @var{variable} have @var{value}. +This behaves as if the readline command +@samp{set @var{variable} @var{value}} had been executed in an @code{inputrc} +file (@pxref{Readline Init File Syntax}). +@end deftypefun + +@deftypefun void rl_variable_dumper (int readable) +Print the readline variable names and their current values +to @code{rl_outstream}. +If @var{readable} is non-zero, the list is formatted in such a way +that it can be made part of an @code{inputrc} file and re-read. +@end deftypefun + +@deftypefun int rl_set_paren_blink_timeout (int u) +Set the time interval (in microseconds) that Readline waits when showing +a balancing character when @code{blink-matching-paren} has been enabled. +@end deftypefun + @node Alternate Interface @subsection Alternate Interface @@ -805,13 +1086,14 @@ on various file descriptors. To accomodate this need, readline can also be invoked as a `callback' function from an event loop. There are functions available to make this easy. -@deftypefun void rl_callback_handler_install (char *prompt, Vfunction *lhandler) +@deftypefun void rl_callback_handler_install (const char *prompt, rl_vcpfunc_t *lhandler) Set up the terminal for readline I/O and display the initial expanded value of @var{prompt}. Save the value of @var{lhandler} to -use as a callback when a complete line of input has been entered. +use as a function to call when a complete line of input has been entered. +The function takes the text of the line as an argument. @end deftypefun -@deftypefun void rl_callback_read_char () +@deftypefun void rl_callback_read_char (void) Whenever an application determines that keyboard input is available, it should call @code{rl_callback_read_char()}, which will read the next character from the current input source. If that character completes the @@ -821,12 +1103,13 @@ line. @code{EOF} is indicated by calling @var{lhandler} with a @code{NULL} line. @end deftypefun -@deftypefun void rl_callback_handler_remove () +@deftypefun void rl_callback_handler_remove (void) Restore the terminal to its initial state and remove the line handler. This may be called from within a callback as well as independently. @end deftypefun -@subsection An Example +@node A Readline Example +@subsection A Readline Example Here is a function which changes lowercase characters to their uppercase equivalents, and uppercase characters to lowercase. If @@ -881,10 +1164,10 @@ invert_case_line (count, key) for (i = start; i != end; i++) @{ - if (uppercase_p (rl_line_buffer[i])) - rl_line_buffer[i] = to_lower (rl_line_buffer[i]); - else if (lowercase_p (rl_line_buffer[i])) - rl_line_buffer[i] = to_upper (rl_line_buffer[i]); + if (_rl_uppercase_p (rl_line_buffer[i])) + rl_line_buffer[i] = _rl_to_lower (rl_line_buffer[i]); + else if (_rl_lowercase_p (rl_line_buffer[i])) + rl_line_buffer[i] = _rl_to_upper (rl_line_buffer[i]); @} /* Move point to on top of the last character changed. */ rl_point = (direction == 1) ? end - 1 : start; @@ -897,44 +1180,44 @@ invert_case_line (count, key) Signals are asynchronous events sent to a process by the Unix kernel, sometimes on behalf of another process. They are intended to indicate -exceptional events, like a user pressing the interrupt key on his -terminal, or a network connection being broken. There is a class of -signals that can be sent to the process currently reading input from -the keyboard. Since Readline changes the terminal attributes when it -is called, it needs to perform special processing when a signal is -received to restore the terminal to a sane state, or provide application -writers with functions to do so manually. +exceptional events, like a user pressing the interrupt key on his terminal, +or a network connection being broken. There is a class of signals that can +be sent to the process currently reading input from the keyboard. Since +Readline changes the terminal attributes when it is called, it needs to +perform special processing when such a signal is received in order to +restore the terminal to a sane state, or provide application writers with +functions to do so manually. Readline contains an internal signal handler that is installed for a number of signals (@code{SIGINT}, @code{SIGQUIT}, @code{SIGTERM}, @code{SIGALRM}, @code{SIGTSTP}, @code{SIGTTIN}, and @code{SIGTTOU}). When one of these signals is received, the signal handler will reset the terminal attributes to those that were in effect before -@code{readline ()} was called, reset the signal handling to what it was -before @code{readline ()} was called, and resend the signal to the calling +@code{readline()} was called, reset the signal handling to what it was +before @code{readline()} was called, and resend the signal to the calling application. If and when the calling application's signal handler returns, Readline will reinitialize the terminal and continue to accept input. When a @code{SIGINT} is received, the Readline signal handler performs some additional work, which will cause any partially-entered line to be -aborted (see the description of @code{rl_free_line_state ()}). +aborted (see the description of @code{rl_free_line_state()} below). There is an additional Readline signal handler, for @code{SIGWINCH}, which the kernel sends to a process whenever the terminal's size changes (for example, if a user resizes an @code{xterm}). The Readline @code{SIGWINCH} -handler updates Readline's internal screen size state, and then calls any -@code{SIGWINCH} signal handler the calling application has installed. +handler updates Readline's internal screen size information, and then calls +any @code{SIGWINCH} signal handler the calling application has installed. Readline calls the application's @code{SIGWINCH} signal handler without resetting the terminal to its original state. If the application's signal handler does more than update its idea of the terminal size and return (for example, a @code{longjmp} back to a main processing loop), it @emph{must} -call @code{rl_cleanup_after_signal ()} (described below), to restore the +call @code{rl_cleanup_after_signal()} (described below), to restore the terminal state. Readline provides two variables that allow application writers to control whether or not it will catch certain signals and act on them when they are received. It is important that applications change the -values of these variables only when calling @code{readline ()}, not in +values of these variables only when calling @code{readline()}, not in a signal handler, so Readline's internal signal state is not corrupted. @deftypevar int rl_catch_signals @@ -960,7 +1243,7 @@ and internal state cleanup upon receipt of a signal. @deftypefun void rl_cleanup_after_signal (void) This function will reset the state of the terminal to what it was before -@code{readline ()} was called, and remove the Readline signal handlers for +@code{readline()} was called, and remove the Readline signal handlers for all signals, depending on the values of @code{rl_catch_signals} and @code{rl_catch_sigwinch}. @end deftypefun @@ -969,7 +1252,7 @@ all signals, depending on the values of @code{rl_catch_signals} and This will free any partial state associated with the current input line (undo information, any partial history entry, any partially-entered keyboard macro, and any partially-entered numeric argument). This -should be called before @code{rl_cleanup_after_signal ()}. The +should be called before @code{rl_cleanup_after_signal()}. The Readline signal handler for @code{SIGINT} calls this to abort the current input line. @end deftypefun @@ -981,11 +1264,26 @@ handlers, depending on the values of @code{rl_catch_signals} and @end deftypefun If an application does not wish Readline to catch @code{SIGWINCH}, it may -call @code{rl_resize_terminal ()} to force Readline to update its idea of -the terminal size when a @code{SIGWINCH} is received. +call @code{rl_resize_terminal()} or @code{rl_set_screen_size()} to force +Readline to update its idea of the terminal size when a @code{SIGWINCH} +is received. @deftypefun void rl_resize_terminal (void) -Update Readline's internal screen size. +Update Readline's internal screen size by reading values from the kernel. +@end deftypefun + +@deftypefun void rl_set_screen_size (int rows, int cols) +Set Readline's idea of the terminal size to @var{rows} rows and +@var{cols} columns. +@end deftypefun + +If an application does not want to install a @code{SIGWINCH} handler, but +is still interested in the screen dimensions, Readline's idea of the screen +size may be queried. + +@deftypefun void rl_get_screen_size (int *rows, int *cols) +Return Readline's idea of the terminal's size in the +variables pointed to by the arguments. @end deftypefun The following functions install and remove Readline's signal handlers. @@ -999,7 +1297,7 @@ Install Readline's signal handler for @code{SIGINT}, @code{SIGQUIT}, @deftypefun int rl_clear_signals (void) Remove all of the Readline signal handlers installed by -@code{rl_set_signals ()}. +@code{rl_set_signals()}. @end deftypefun @node Custom Completers @@ -1034,30 +1332,31 @@ There are three major functions used to perform completion: @enumerate @item -The user-interface function @code{rl_complete ()}. This function is -called with the same arguments as other Readline -functions intended for interactive use: @var{count} and -@var{invoking_key}. It isolates the word to be completed and calls -@code{completion_matches ()} to generate a list of possible completions. +The user-interface function @code{rl_complete()}. This function is +called with the same arguments as other bindable Readline functions: +@var{count} and @var{invoking_key}. +It isolates the word to be completed and calls +@code{rl_completion_matches()} to generate a list of possible completions. It then either lists the possible completions, inserts the possible completions, or actually performs the completion, depending on which behavior is desired. @item -The internal function @code{completion_matches ()} uses your -@dfn{generator} function to generate the list of possible matches, and -then returns the array of these matches. You should place the address -of your generator function in @code{rl_completion_entry_function}. +The internal function @code{rl_completion_matches()} uses an +application-supplied @dfn{generator} function to generate the list of +possible matches, and then returns the array of these matches. +The caller should place the address of its generator function in +@code{rl_completion_entry_function}. @item The generator function is called repeatedly from -@code{completion_matches ()}, returning a string each time. The +@code{rl_completion_matches()}, returning a string each time. The arguments to the generator function are @var{text} and @var{state}. @var{text} is the partial word to be completed. @var{state} is zero the first time the function is called, allowing the generator to perform any necessary initialization, and a positive non-zero integer for -each subsequent call. When the generator function returns -@code{(char *)NULL} this signals @code{completion_matches ()} that there are +each subsequent call. The generator function returns +@code{(char *)NULL} to inform @code{rl_completion_matches()} that there are no more possibilities left. Usually the generator function computes the list of possible completions when @var{state} is zero, and returns them one at a time on subsequent calls. Each string the generator function @@ -1069,14 +1368,15 @@ frees the strings when it has finished with them. @deftypefun int rl_complete (int ignore, int invoking_key) Complete the word at or before point. You have supplied the function that does the initial simple matching selection algorithm (see -@code{completion_matches ()}). The default is to do filename completion. +@code{rl_completion_matches()}). The default is to do filename completion. @end deftypefun -@deftypevar {Function *} rl_completion_entry_function -This is a pointer to the generator function for @code{completion_matches -()}. If the value of @code{rl_completion_entry_function} is -@code{(Function *)NULL} then the default filename generator function, -@code{filename_completion_function ()}, is used. +@deftypevar {rl_compentry_func_t *} rl_completion_entry_function +This is a pointer to the generator function for +@code{rl_completion_matches()}. +If the value of @code{rl_completion_entry_function} is +@code{NULL} then the default filename generator +function, @code{rl_filename_completion_function()}, is used. @end deftypevar @node Completion Functions @@ -1097,47 +1397,47 @@ performing partial completion. @deftypefun int rl_complete (int ignore, int invoking_key) Complete the word at or before point. You have supplied the function that does the initial simple matching selection algorithm (see -@code{completion_matches ()} and @code{rl_completion_entry_function}). +@code{rl_completion_matches()} and @code{rl_completion_entry_function}). The default is to do filename -completion. This calls @code{rl_complete_internal ()} with an +completion. This calls @code{rl_complete_internal()} with an argument depending on @var{invoking_key}. @end deftypefun -@deftypefun int rl_possible_completions (int count, int invoking_key)) +@deftypefun int rl_possible_completions (int count, int invoking_key) List the possible completions. See description of @code{rl_complete -()}. This calls @code{rl_complete_internal ()} with an argument of +()}. This calls @code{rl_complete_internal()} with an argument of @samp{?}. @end deftypefun -@deftypefun int rl_insert_completions (int count, int invoking_key)) +@deftypefun int rl_insert_completions (int count, int invoking_key) Insert the list of possible completions into the line, deleting the -partially-completed word. See description of @code{rl_complete ()}. -This calls @code{rl_complete_internal ()} with an argument of @samp{*}. +partially-completed word. See description of @code{rl_complete()}. +This calls @code{rl_complete_internal()} with an argument of @samp{*}. @end deftypefun -@deftypefun {char **} completion_matches (char *text, CPFunction *entry_func) -Returns an array of @code{(char *)} which is a list of completions for -@var{text}. If there are no completions, returns @code{(char **)NULL}. +@deftypefun {char **} rl_completion_matches (const char *text, rl_compentry_func_t *entry_func) +Returns an array of strings which is a list of completions for +@var{text}. If there are no completions, returns @code{NULL}. The first entry in the returned array is the substitution for @var{text}. The remaining entries are the possible completions. The array is terminated with a @code{NULL} pointer. @var{entry_func} is a function of two args, and returns a -@code{(char *)}. The first argument is @var{text}. The second is a +@code{char *}. The first argument is @var{text}. The second is a state argument; it is zero on the first call, and non-zero on subsequent calls. @var{entry_func} returns a @code{NULL} pointer to the caller when there are no more matches. @end deftypefun -@deftypefun {char *} filename_completion_function (char *text, int state) -A generator function for filename completion in the general case. Note -that completion in Bash is a little different because of all -the pathnames that must be followed when looking up completions for a -command. The Bash source is a useful reference for writing custom -completion functions. +@deftypefun {char *} rl_filename_completion_function (const char *text, int state) +A generator function for filename completion in the general case. +@var{text} is a partial filename. +The Bash source is a useful reference for writing custom +completion functions (the Bash completion functions call this and other +Readline functions). @end deftypefun -@deftypefun {char *} username_completion_function (char *text, int state) +@deftypefun {char *} rl_username_completion_function (const char *text, int state) A completion generator for usernames. @var{text} contains a partial username preceded by a random character (usually @samp{~}). As with all completion generators, @var{state} is zero on the first call and non-zero @@ -1147,26 +1447,29 @@ for subsequent calls. @node Completion Variables @subsection Completion Variables -@deftypevar {Function *} rl_completion_entry_function -A pointer to the generator function for @code{completion_matches ()}. -@code{NULL} means to use @code{filename_completion_function ()}, the default +@deftypevar {rl_compentry_func_t *} rl_completion_entry_function +A pointer to the generator function for @code{rl_completion_matches()}. +@code{NULL} means to use @code{rl_filename_completion_function()}, the default filename completer. @end deftypevar -@deftypevar {CPPFunction *} rl_attempted_completion_function +@deftypevar {rl_completion_func_t *} rl_attempted_completion_function A pointer to an alternative function to create matches. The function is called with @var{text}, @var{start}, and @var{end}. -@var{start} and @var{end} are indices in @code{rl_line_buffer} saying -what the boundaries of @var{text} are. If this function exists and -returns @code{NULL}, or if this variable is set to @code{NULL}, then -@code{rl_complete ()} will call the value of +@var{start} and @var{end} are indices in @code{rl_line_buffer} defining +the boundaries of @var{text}, which is a character string. +If this function exists and returns @code{NULL}, or if this variable is +set to @code{NULL}, then @code{rl_complete()} will call the value of @code{rl_completion_entry_function} to generate matches, otherwise the array of strings returned will be used. +If this function sets the @code{rl_attempted_completion_over} +variable to a non-zero value, Readline will not perform its default +completion even if this function returns no matches. @end deftypevar -@deftypevar {CPFunction *} rl_filename_quoting_function -A pointer to a function that will quote a filename in an application- -specific fashion. This is called if filename completion is being +@deftypevar {rl_quote_func_t *} rl_filename_quoting_function +A pointer to a function that will quote a filename in an +application-specific fashion. This is called if filename completion is being attempted and one of the characters in @code{rl_filename_quote_characters} appears in a completed filename. The function is called with @var{text}, @var{match_type}, and @var{quote_pointer}. The @var{text} @@ -1178,7 +1481,7 @@ to any opening quote character the user typed. Some functions choose to reset this character. @end deftypevar -@deftypevar {CPFunction *} rl_filename_dequoting_function +@deftypevar {rl_dequote_func_t *} rl_filename_dequoting_function A pointer to a function that will remove application-specific quoting characters from a filename before completion is attempted, so those characters do not interfere with matching the text against names in @@ -1188,10 +1491,10 @@ that delimits the filename (usually @samp{'} or @samp{"}). If @var{quote_char} is zero, the filename was not in an embedded string. @end deftypevar -@deftypevar {Function *} rl_char_is_quoted_p +@deftypevar {rl_linebuf_func_t *} rl_char_is_quoted_p A pointer to a function to call that determines whether or not a specific character in the line buffer is quoted, according to whatever quoting -mechanism the program calling readline uses. The function is called with +mechanism the program calling Readline uses. The function is called with two arguments: @var{text}, the text of the line, and @var{index}, the index of the character in the line. It is used to decide whether a character found in @code{rl_completer_word_break_characters} should be @@ -1204,36 +1507,36 @@ possible-completions call. After that, we ask the user if she is sure she wants to see them all. The default value is 100. @end deftypevar -@deftypevar {char *} rl_basic_word_break_characters +@deftypevar {const char *} rl_basic_word_break_characters The basic list of characters that signal a break between words for the completer routine. The default value of this variable is the characters -which break words for completion in Bash, i.e., +which break words for completion in Bash: @code{" \t\n\"\\'`@@$><=;|&@{("}. @end deftypevar -@deftypevar {char *} rl_basic_quote_characters -List of quote characters which can cause a word break. +@deftypevar {const char *} rl_basic_quote_characters +A list of quote characters which can cause a word break. @end deftypevar -@deftypevar {char *} rl_completer_word_break_characters +@deftypevar {const char *} rl_completer_word_break_characters The list of characters that signal a break between words for -@code{rl_complete_internal ()}. The default list is the value of +@code{rl_complete_internal()}. The default list is the value of @code{rl_basic_word_break_characters}. @end deftypevar -@deftypevar {char *} rl_completer_quote_characters -List of characters which can be used to quote a substring of the line. +@deftypevar {const char *} rl_completer_quote_characters +A list of characters which can be used to quote a substring of the line. Completion occurs on the entire substring, and within the substring @code{rl_completer_word_break_characters} are treated as any other character, unless they also appear within this list. @end deftypevar -@deftypevar {char *} rl_filename_quote_characters +@deftypevar {const char *} rl_filename_quote_characters A list of characters that cause a filename to be quoted by the completer when they appear in a completed filename. The default is the null string. @end deftypevar -@deftypevar {char *} rl_special_prefixes +@deftypevar {const char *} rl_special_prefixes The list of characters that are word break characters, but should be left in @var{text} when it is passed to the completion function. Programs can use this to help determine what kind of completing to do. @@ -1252,7 +1555,8 @@ an application-specific command line syntax specification. @end deftypevar @deftypevar int rl_ignore_completion_duplicates -If non-zero, then disallow duplicates in the matches. Default is 1. +If non-zero, then duplicates in the matches are removed. +The default is 1. @end deftypevar @deftypevar int rl_filename_completion_desired @@ -1260,8 +1564,9 @@ Non-zero means that the results of the matches are to be treated as filenames. This is @emph{always} zero on entry, and can only be changed within a completion entry generator function. If it is set to a non-zero value, directory names have a slash appended and Readline attempts to -quote completed filenames if they contain any embedded word break -characters. +quote completed filenames if they contain any characters in +@code{rl_filename_quote_characters} and @code{rl_filename_quoting_desired} +is set to a non-zero value. @end deftypevar @deftypevar int rl_filename_quoting_desired @@ -1274,12 +1579,26 @@ function. The quoting is effected via a call to the function pointed to by @code{rl_filename_quoting_function}. @end deftypevar +@deftypevar int rl_attempted_completion_over +If an application-specific completion function assigned to +@code{rl_attempted_completion_function} sets this variable to a non-zero +value, Readline will not perform its default filename completion even +if the application's completion function returns no matches. +It should be set only by an application's completion function. +@end deftypevar + +@deftypevar int rl_completion_type +Set to a character describing the type of completion Readline is currently +attempting; see the description of @code{rl_complete_internal()} +(@pxref{Completion Functions}) for the list of characters. +@end deftypevar + @deftypevar int rl_inhibit_completion -If this variable is non-zero, completion is inhibit #include -extern char *getwd (); extern char *xmalloc (); /* The names of functions that actually do the manipulation. */ -int com_list (), com_view (), com_rename (), com_stat (), com_pwd (); -int com_delete (), com_help (), com_cd (), com_quit (); +int com_list __P((char *)); +int com_view __P((char *)); +int com_rename __P((char *)); +int com_stat __P((char *)); +int com_pwd __P((char *)); +int com_delete __P((char *)); +int com_help __P((char *)); +int com_cd __P((char *)); +int com_quit __P((char *)); /* A structure which contains information on the commands this program can understand. */ typedef struct @{ char *name; /* User printable name of the function. */ - Function *func; /* Function to call to do the job. */ + rl_icpfunc_t *func; /* Function to call to do the job. */ char *doc; /* Documentation for this function. */ @} COMMAND; @@ -1362,7 +1693,7 @@ COMMAND commands[] = @{ @{ "rename", com_rename, "Rename FILE to NEWNAME" @}, @{ "stat", com_stat, "Print out statistics on FILE" @}, @{ "view", com_view, "View the contents of FILE" @}, - @{ (char *)NULL, (Function *)NULL, (char *)NULL @} + @{ (char *)NULL, (rl_icpfunc_t *)NULL, (char *)NULL @} @}; /* Forward declarations. */ @@ -1372,7 +1703,7 @@ COMMAND *find_command (); /* The name of this program, as taken from argv[0]. */ char *progname; -/* When non-zero, this global means the user is done using this program. */ +/* When non-zero, this means the user is done using this program. */ int done; char * @@ -1502,29 +1833,29 @@ stripwhite (string) /* */ /* **************************************************************** */ -char *command_generator (); -char **fileman_completion (); +char *command_generator __P((const char *, int)); +char **fileman_completion __P((const char *, int, int)); -/* Tell the GNU Readline library how to complete. We want to try to complete - on command names if this is the first word in the line, or on filenames - if not. */ +/* Tell the GNU Readline library how to complete. We want to try to + complete on command names if this is the first word in the line, or + on filenames if not. */ initialize_readline () @{ /* Allow conditional parsing of the ~/.inputrc file. */ rl_readline_name = "FileMan"; /* Tell the completer that we want a crack first. */ - rl_attempted_completion_function = (CPPFunction *)fileman_completion; + rl_attempted_completion_function = fileman_completion; @} -/* Attempt to complete on the contents of TEXT. START and END bound the - region of rl_line_buffer that contains the word to complete. TEXT is - the word to complete. We can use the entire contents of rl_line_buffer - in case we want to do some simple parsing. Return the array of matches, - or NULL if there aren't any. */ +/* Attempt to complete on the contents of TEXT. START and END + bound the region of rl_line_buffer that contains the word to + complete. TEXT is the word to complete. We can use the entire + contents of rl_line_buffer in case we want to do some simple + parsing. Returnthe array of matches, or NULL if there aren't any. */ char ** fileman_completion (text, start, end) - char *text; + const char *text; int start, end; @{ char **matches; @@ -1535,32 +1866,33 @@ fileman_completion (text, start, end) to complete. Otherwise it is the name of a file in the current directory. */ if (start == 0) - matches = completion_matches (text, command_generator); + matches = rl_completion_matches (text, command_generator); return (matches); @} -/* Generator function for command completion. STATE lets us know whether - to start from scratch; without any state (i.e. STATE == 0), then we - start at the top of the list. */ +/* Generator function for command completion. STATE lets us + know whether to start from scratch; without any state + (i.e. STATE == 0), then we start at the top of the list. */ char * command_generator (text, state) - char *text; + const char *text; int state; @{ static int list_index, len; char *name; - /* If this is a new word to complete, initialize now. This includes - saving the length of TEXT for efficiency, and initializing the index - variable to 0. */ + /* If this is a new word to complete, initialize now. This + includes saving the length of TEXT for efficiency, and + initializing the index variable to 0. */ if (!state) @{ list_index = 0; len = strlen (text); @} - /* Return the next name which partially matches from the command list. */ + /* Return the next name which partially matches from the + command list. */ while (name = commands[list_index].name) @{ list_index++; @@ -1705,7 +2037,7 @@ com_pwd (ignore) @{ char dir[1024], *s; - s = getwd (dir); + s = getcwd (dir, sizeof(dir) - 1); if (s == 0) @{ printf ("Error getting pwd: %s\n", dir); @@ -1716,7 +2048,8 @@ com_pwd (ignore) return 0; @} -/* The user wishes to quit using this program. Just set DONE non-zero. */ +/* The user wishes to quit using this program. Just set DONE + non-zero. */ com_quit (arg) char *arg; @{ diff --git a/contrib/libreadline/doc/rluser.texinfo b/contrib/libreadline/doc/rluser.texinfo index 9f088ff..e5bf54d 100644 --- a/contrib/libreadline/doc/rluser.texinfo +++ b/contrib/libreadline/doc/rluser.texinfo @@ -10,7 +10,7 @@ use these features. There is a document entitled "readline.texinfo" which contains both end-user and programmer documentation for the GNU Readline Library. -Copyright (C) 1988-1999 Free Software Foundation, Inc. +Copyright (C) 1988-2000 Free Software Foundation, Inc. Authored by Brian Fox and Chet Ramey. @@ -72,11 +72,11 @@ used by several different programs, including Bash. The following paragraphs describe the notation used to represent keystrokes. -The text @key{C-k} is read as `Control-K' and describes the character +The text @kbd{C-k} is read as `Control-K' and describes the character produced when the @key{k} key is pressed while the Control key is depressed. -The text @key{M-k} is read as `Meta-K' and describes the character +The text @kbd{M-k} is read as `Meta-K' and describes the character produced when the Meta key (if you have one) is depressed, and the @key{k} key is pressed. The Meta key is labeled @key{ALT} on many keyboards. @@ -89,11 +89,11 @@ Compose key for typing accented characters. If you do not have a Meta or @key{ALT} key, or another key working as a Meta key, the identical keystroke can be generated by typing @key{ESC} -@i{first}, and then typing @key{k}. +@emph{first}, and then typing @key{k}. Either process is known as @dfn{metafying} the @key{k} key. -The text @key{M-C-k} is read as `Meta-Control-k' and describes the -character produced by @dfn{metafying} @key{C-k}. +The text @kbd{M-C-k} is read as `Meta-Control-k' and describes the +character produced by @dfn{metafying} @kbd{C-k}. In addition, several keys have their own names. Specifically, @key{DEL}, @key{ESC}, @key{LFD}, @key{SPC}, @key{RET}, and @key{TAB} all @@ -115,8 +115,8 @@ as you type it in, allowing you to just fix your typo, and not forcing you to retype the majority of the line. Using these editing commands, you move the cursor to the place that needs correction, and delete or insert the text of the corrections. Then, when you are satisfied with -the line, you simply press @key{RETURN}. You do not have to be at the -end of the line to press @key{RETURN}; the entire line is accepted +the line, you simply press @key{RET}. You do not have to be at the +end of the line to press @key{RET}; the entire line is accepted regardless of the location of the cursor within the line. @menu @@ -140,9 +140,9 @@ erase character to back up and delete the mistyped character. Sometimes you may mistype a character, and not notice the error until you have typed several other characters. In -that case, you can type @key{C-b} to move the cursor to the left, and then +that case, you can type @kbd{C-b} to move the cursor to the left, and then correct your mistake. Afterwards, you can move the cursor to the right -with @key{C-f}. +with @kbd{C-f}. When you add text in the middle of a line, you will notice that characters to the right of the cursor are `pushed over' to make room for the text @@ -152,17 +152,17 @@ blank space created by the removal of the text. A list of the bare essentials for editing the text of an input line follows. @table @asis -@item @key{C-b} +@item @kbd{C-b} Move back one character. -@item @key{C-f} +@item @kbd{C-f} Move forward one character. @item @key{DEL} or @key{Backspace} Delete the character to the left of the cursor. -@item @key{C-d} +@item @kbd{C-d} Delete the character underneath the cursor. @item @w{Printing characters} Insert the character into the line at the cursor. -@item @key{C-_} or @key{C-x C-u} +@item @kbd{C-_} or @kbd{C-x C-u} Undo the last editing command. You can undo all the way back to an empty line. @end table @@ -170,7 +170,7 @@ empty line. @noindent (Depending on your configuration, the @key{Backspace} key be set to delete the character to the left of the cursor and the @key{DEL} key set -to delete the character underneath the cursor, like @key{C-d}, rather +to delete the character underneath the cursor, like @kbd{C-d}, rather than the character to the left of the cursor.) @node Readline Movement Commands @@ -179,11 +179,11 @@ than the character to the left of the cursor.) The above table describes the most basic keystrokes that you need in order to do editing of the input line. For your convenience, many -other commands have been added in addition to @key{C-b}, @key{C-f}, -@key{C-d}, and @key{DEL}. Here are some commands for moving more rapidly +other commands have been added in addition to @kbd{C-b}, @kbd{C-f}, +@kbd{C-d}, and @key{DEL}. Here are some commands for moving more rapidly about the line. -@table @key +@table @kbd @item C-a Move to the start of the line. @item C-e @@ -196,7 +196,7 @@ Move backward a word. Clear the screen, reprinting the current line at the top. @end table -Notice how @key{C-f} moves forward a character, while @key{M-f} moves +Notice how @kbd{C-f} moves forward a character, while @kbd{M-f} moves forward a word. It is a loose convention that control keystrokes operate on characters while meta keystrokes operate on words. @@ -225,36 +225,36 @@ another line. Here is the list of commands for killing text. -@table @key +@table @kbd @item C-k Kill the text from the current cursor position to the end of the line. @item M-d Kill from the cursor to the end of the current word, or, if between words, to the end of the next word. -Word boundaries are the same as those used by @key{M-f}. +Word boundaries are the same as those used by @kbd{M-f}. -@item M-DEL +@item M-@key{DEL} Kill from the cursor the start of the previous word, or, if between words, to the start of the previous word. -Word boundaries are the same as those used by @key{M-b}. +Word boundaries are the same as those used by @kbd{M-b}. @item C-w Kill from the cursor to the previous whitespace. This is different than -@key{M-DEL} because the word boundaries differ. +@kbd{M-@key{DEL}} because the word boundaries differ. @end table Here is how to @dfn{yank} the text back into the line. Yanking means to copy the most-recently-killed text from the kill buffer. -@table @key +@table @kbd @item C-y Yank the most recently killed text back into the buffer at the cursor. @item M-y Rotate the kill-ring, and yank the new top. You can only do this if -the prior command is @key{C-y} or @key{M-y}. +the prior command is @kbd{C-y} or @kbd{M-y}. @end table @node Readline Arguments @@ -272,7 +272,8 @@ digits before the command. If the first `digit' typed is a minus sign (@samp{-}), then the sign of the argument will be negative. Once you have typed one meta digit to get the argument started, you can type the remainder of the digits, and then the command. For example, to give -the @key{C-d} command an argument of 10, you could type @samp{M-1 0 C-d}. +the @kbd{C-d} command an argument of 10, you could type @samp{M-1 0 C-d}, +which will delete the next ten characters on the input line. @node Searching @subsection Searching for Commands in the History @@ -282,7 +283,7 @@ Readline provides commands for searching through the command history (@pxref{Bash History Facilities}) @end ifset for lines containing a specified string. -There are two search modes: @var{incremental} and @var{non-incremental}. +There are two search modes: @dfn{incremental} and @dfn{non-incremental}. Incremental searches begin before the user has finished typing the search string. @@ -291,23 +292,25 @@ the next entry from the history matching the string typed so far. An incremental search requires only as many characters as needed to find the desired history entry. To search backward in the history for a particular string, type -@key{C-r}. Typing @key{C-s} searches forward through the history. +@kbd{C-r}. Typing @kbd{C-s} searches forward through the history. The characters present in the value of the @code{isearch-terminators} variable are used to terminate an incremental search. If that variable has not been assigned a value, the @key{ESC} and -@key{C-J} characters will terminate an incremental search. -@key{C-g} will abort an incremental search and restore the original line. +@kbd{C-J} characters will terminate an incremental search. +@kbd{C-g} will abort an incremental search and restore the original line. When the search is terminated, the history entry containing the search string becomes the current line. -To find other matching entries in the history list, type @key{C-r} or -@key{C-s} as appropriate. +To find other matching entries in the history list, type @kbd{C-r} or +@kbd{C-s} as appropriate. This will search backward or forward in the history for the next entry matching the search string typed so far. Any other key sequence bound to a Readline command will terminate the search and execute that command. For instance, a @key{RET} will terminate the search and accept the line, thereby executing the command from the history list. +A movement command will terminate the search, make the last line found +the current line, and begin editing. Non-incremental searches read the entire search string before starting to search for matching history lines. The search string may be @@ -324,10 +327,10 @@ Any user can customize programs that use Readline by putting commands in an @dfn{inputrc} file, conventionally in his home directory. The name of this @ifset BashFeatures -file is taken from the value of the shell variable @code{INPUTRC}. If +file is taken from the value of the shell variable @env{INPUTRC}. If @end ifset @ifclear BashFeatures -file is taken from the value of the environment variable @code{INPUTRC}. If +file is taken from the value of the environment variable @env{INPUTRC}. If @end ifclear that variable is unset, the default is @file{~/.inputrc}. @@ -359,7 +362,15 @@ denote variable settings and key bindings. @item Variable Settings You can modify the run-time behavior of Readline by altering the values of variables in Readline -using the @code{set} command within the init file. Here is how to +using the @code{set} command within the init file. +The syntax is simple: + +@example +set @var{variable} @var{value} +@end example + +@noindent +Here, for example, is how to change from the default Emacs-like key binding to use @code{vi} line editing commands: @@ -367,6 +378,9 @@ change from the default Emacs-like key binding to use set editing-mode vi @end example +Variable names and values, where appropriate, are recognized without regard +to case. + @ifset BashFeatures The @w{@code{bind -V}} command lists the current Readline variable names and values. @xref{Bash Builtins}. @@ -375,6 +389,7 @@ and values. @xref{Bash Builtins}. A great deal of run-time behavior is changeable with the following variables. +@cindex variables, readline @table @code @item bell-style @@ -402,13 +417,14 @@ The number of possible completions that determines when the user is asked whether he wants to see the list of possibilities. If the number of possible completions is greater than this value, Readline will ask the user whether or not he wishes to view -them; otherwise, they are simply listed. The default limit is -@code{100}. +them; otherwise, they are simply listed. +This variable must be set to an integer value greater than or equal to 0. +The default limit is @code{100}. @item convert-meta @vindex convert-meta If set to @samp{on}, Readline will convert characters with the -eighth bit set to an ASCII key sequence by stripping the eighth +eighth bit set to an @sc{ascii} key sequence by stripping the eighth bit and prefixing an @key{ESC} character, converting them to a meta-prefixed key sequence. The default value is @samp{on}. @@ -448,7 +464,7 @@ this variable is set to @samp{off}. @vindex input-meta @vindex meta-flag If set to @samp{on}, Readline will enable eight-bit input (it -will not strip the eighth bit from the characters it reads), +will not clear the eighth bit in the characters it reads), regardless of what the terminal claims it can support. The default value is @samp{off}. The name @code{meta-flag} is a synonym for this variable. @@ -458,7 +474,7 @@ synonym for this variable. The string of characters that should terminate an incremental search without subsequently executing the character as a command (@pxref{Searching}). If this variable has not been given a value, the characters @key{ESC} and -@key{C-J} will terminate an incremental search. +@kbd{C-J} will terminate an incremental search. @item keymap @vindex keymap @@ -469,6 +485,7 @@ Acceptable @code{keymap} names are @code{emacs-meta}, @code{emacs-ctlx}, @code{vi}, +@code{vi-move}, @code{vi-command}, and @code{vi-insert}. @code{vi} is equivalent to @code{vi-command}; @code{emacs} is @@ -520,11 +537,15 @@ want to change. The following sections contain tables of the command name, the default keybinding, if any, and a short description of what the command does. -Once you know the name of the command, simply place the name of the key +Once you know the name of the command, simply place on a line +in the init file the name of the key you wish to bind the command to, a colon, and then the name of the -command on a line in the init file. The name of the key -can be expressed in different ways, depending on which is most -comfortable for you. +command. The name of the key +can be expressed in different ways, depending on what you find most +comfortable. + +In addition to command names, readline allows keys to be bound +to a string that is inserted when the key is pressed (a @var{macro}). @ifset BashFeatures The @w{@code{bind -p}} command displays Readline function names and @@ -541,11 +562,28 @@ Meta-Rubout: backward-kill-word Control-o: "> output" @end example -In the above example, @key{C-u} is bound to the function -@code{universal-argument}, and @key{C-o} is bound to run the macro +In the above example, @kbd{C-u} is bound to the function +@code{universal-argument}, +@kbd{M-DEL} is bound to the function @code{backward-kill-word}, and +@kbd{C-o} is bound to run the macro expressed on the right hand side (that is, to insert the text @samp{> output} into the line). +A number of symbolic character names are recognized while +processing this key binding syntax: +@var{DEL}, +@var{ESC}, +@var{ESCAPE}, +@var{LFD}, +@var{NEWLINE}, +@var{RET}, +@var{RETURN}, +@var{RUBOUT}, +@var{SPACE}, +@var{SPC}, +and +@var{TAB}. + @item @w{"@var{keyseq}": @var{function-name} or @var{macro}} @var{keyseq} differs from @var{keyname} above in that strings denoting an entire key sequence can be specified, by placing @@ -559,9 +597,9 @@ special character names are not recognized. "\e[11~": "Function Key 1" @end example -In the above example, @key{C-u} is bound to the function +In the above example, @kbd{C-u} is again bound to the function @code{universal-argument} (just as it was in the first example), -@samp{@key{C-x} @key{C-r}} is bound to the function @code{re-read-init-file}, +@samp{@kbd{C-x} @kbd{C-r}} is bound to the function @code{re-read-init-file}, and @samp{@key{ESC} @key{[} @key{1} @key{1} @key{~}} is bound to insert the text @samp{Function Key 1}. @@ -606,10 +644,10 @@ horizontal tab @item \v vertical tab @item \@var{nnn} -the character whose @code{ASCII} code is the octal value @var{nnn} +the character whose @sc{ascii} code is the octal value @var{nnn} (one to three digits) @item \x@var{nnn} -the character whose @code{ASCII} code is the hexadecimal value @var{nnn} +the character whose @sc{ascii} code is the hexadecimal value @var{nnn} (one to three digits) @end table @@ -619,7 +657,7 @@ 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 @samp{"} and @samp{'}. -For example, the following binding will make @samp{C-x \} +For example, the following binding will make @samp{@kbd{C-x} \} insert a single @samp{\} into the line: @example "\C-x\\": "\\" @@ -663,7 +701,8 @@ for instance. @item application The @var{application} construct is used to include application-specific settings. Each program using the Readline -library sets the @var{application name}, and you can test for it. +library sets the @var{application name}, and you 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: @@ -686,6 +725,7 @@ the test fails. @item $include This directive takes a single filename as an argument and reads commands and bindings from that file. +For example, the following directive reads from @file{/etc/inputrc}: @example $include /etc/inputrc @end example @@ -694,7 +734,7 @@ $include /etc/inputrc @node Sample Init File @subsection Sample Init File -Here is an example of an inputrc file. This illustrates key +Here is an example of an @var{inputrc} file. This illustrates key binding, variable assignment, and conditional syntax. @example @@ -819,12 +859,12 @@ You can list your key bindings by executing @w{@code{bind -P}} or, for a more terse format, suitable for an @var{inputrc} file, @w{@code{bind -p}}. (@xref{Bash Builtins}.) @end ifset - Command names without an accompanying key sequence are unbound by default. -In the following descriptions, @var{point} refers to the current cursor -position, and @var{mark} refers to a cursor position saved by the + +In the following descriptions, @dfn{point} refers to the current cursor +position, and @dfn{mark} refers to a cursor position saved by the @code{set-mark} command. -The text between the point and mark is referred to as the @var{region}. +The text between the point and mark is referred to as the @dfn{region}. @node Commands For Moving @subsection Commands For Moving @@ -862,25 +902,29 @@ Refresh the current line. By default, this is unbound. @subsection Commands For Manipulating The History @ftable @code -@item accept-line (Newline, Return) +@item accept-line (Newline or Return) @ifset BashFeatures -Accept the line regardless of where the cursor is. If this line is +Accept the line regardless of where the cursor is. +If this line is non-empty, add it to the history list according to the setting of -the @code{HISTCONTROL} and @code{HISTIGNORE} variables. -If this line was a history line, then restore the history line to its -original state. +the @env{HISTCONTROL} and @env{HISTIGNORE} variables. +If this line is a modified history line, then restore the history line +to its original state. @end ifset @ifclear BashFeatures -Accept the line regardless of where the cursor is. If this line is -non-empty, add it to the history list. If this line was a history -line, then restore the history line to its original state. +Accept the line regardless of where the cursor is. +If this line is +non-empty, it may be added to the history list for future recall with +@code{add_history()}. +If this line is a modified history line, the history line is restored +to its original state. @end ifclear @item previous-history (C-p) -Move `up' through the history list. +Move `back' through the history list, fetching the previous command. @item next-history (C-n) -Move `down' through the history list. +Move `forward' through the history list, fetching the next command. @item beginning-of-history (M-<) Move to the first line in the history. @@ -920,12 +964,13 @@ is a non-incremental search. By default, this command is unbound. @item yank-nth-arg (M-C-y) Insert the first argument to the previous command (usually -the second word on the previous line). With an argument @var{n}, +the second word on the previous line) at point. +With an argument @var{n}, insert the @var{n}th word from the previous command (the words in the previous command begin with word 0). A negative argument inserts the @var{n}th word from the end of the previous command. -@item yank-last-arg (M-., M-_) +@item yank-last-arg (M-. or M-_) Insert last argument to the previous command (the last word of the previous history entry). With an argument, behave exactly like @code{yank-nth-arg}. @@ -939,10 +984,10 @@ list, inserting the last argument of each line in turn. @ftable @code @item delete-char (C-d) -Delete the character under the cursor. If the cursor is at the +Delete the character at point. 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 @code{delete-char}, then -return @code{EOF}. +return @sc{eof}. @item backward-delete-char (Rubout) Delete the character behind the cursor. A numeric argument means @@ -953,16 +998,16 @@ Delete the character under the cursor, unless the cursor is at the end of the line, in which case the character behind the cursor is deleted. By default, this is not bound to a key. -@item quoted-insert (C-q, C-v) +@item quoted-insert (C-q or C-v) Add the next character typed to the line verbatim. This is -how to insert key sequences like @key{C-q}, for example. +how to insert key sequences like @kbd{C-q}, for example. @ifclear BashFeatures -@item tab-insert (M-TAB) +@item tab-insert (M-@key{TAB}) Insert a tab character. @end ifclear -@item self-insert (a, b, A, 1, !, ...) +@item self-insert (a, b, A, 1, !, @dots{}) Insert yourself. @item transpose-chars (C-t) @@ -1006,7 +1051,7 @@ Kill backward to the beginning of the line. Kill backward from the cursor to the beginning of the current line. @item kill-whole-line () -Kill all characters on the current line, no matter point is. +Kill all characters on the current line, no matter where point is. By default, this is unbound. @item kill-word (M-d) @@ -1014,7 +1059,7 @@ Kill from point to the end of the current word, or if between words, to the end of the next word. Word boundaries are the same as @code{forward-word}. -@item backward-kill-word (M-DEL) +@item backward-kill-word (M-@key{DEL}) Kill the word behind point. Word boundaries are the same as @code{backward-word}. @@ -1044,21 +1089,20 @@ The word boundaries are the same as @code{forward-word}. By default, this command is unbound. @item yank (C-y) -Yank the top of the kill ring into the buffer at the current -cursor position. +Yank the top of the kill ring into the buffer at point. @item yank-pop (M-y) Rotate the kill-ring, and yank the new top. You can only do this if -the prior command is yank or yank-pop. +the prior command is @code{yank} or @code{yank-pop}. @end ftable @node Numeric Arguments @subsection Specifying Numeric Arguments @ftable @code -@item digit-argument (M-0, M-1, ... M--) +@item digit-argument (@kbd{M-0}, @kbd{M-1}, @dots{} @kbd{M--}) Add this digit to the argument already accumulating, or start a new -argument. @key{M--} starts a negative argument. +argument. @kbd{M--} starts a negative argument. @item universal-argument () This is another way to specify an argument. @@ -1079,13 +1123,9 @@ By default, this is not bound to a key. @subsection Letting Readline Type For You @ftable @code -@item complete (TAB) -Attempt to do completion on the text before the cursor. This is -application-specific. Generally, if you are typing a filename -argument, you can do filename completion; if you are typing a command, -you can do command completion; if you are typing in a symbol to GDB, you -can do symbol name completion; if you are typing in a variable to Bash, -you can do variable name completion, and so on. +@item complete (@key{TAB}) +Attempt to perform completion on the text before point. +The actual completion performed is application-specific. @ifset BashFeatures Bash attempts completion treating the text as a variable (if the text begins with @samp{$}), username (if the text begins with @@ -1093,9 +1133,12 @@ text begins with @samp{$}), username (if the text begins with command (including aliases and functions) in turn. If none of these produces a match, filename completion is attempted. @end ifset +@ifclear BashFeatures +The default is filename completion. +@end ifclear @item possible-completions (M-?) -List the possible completions of the text before the cursor. +List the possible completions of the text before point. @item insert-completions (M-*) Insert all completions of the text before point that would have @@ -1106,12 +1149,13 @@ Similar to @code{complete}, but replaces the word to be completed with a single match from the list of possible completions. Repeated execution of @code{menu-complete} 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. +At the end of the list of completions, the bell is rung +(subject to the setting of @code{bell-style}) +and the original text is restored. An argument of @var{n} moves @var{n} 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 @code{TAB}, but is unbound +This command is intended to be bound to @key{TAB}, but is unbound by default. @item delete-char-or-list () @@ -1164,7 +1208,7 @@ in that order. List the possible completions of the text before point, treating it as a command name. -@item dynamic-complete-history (M-TAB) +@item dynamic-complete-history (M-@key{TAB}) Attempt completion on the text before point, comparing the text against lines from the history list for possible completion matches. @@ -1211,12 +1255,12 @@ ring the terminal's bell (subject to the setting of If the metafied character @var{x} is lowercase, run the command that is bound to the corresponding uppercase character. -@item prefix-meta (ESC) -Make the next character typed be metafied. This is for keyboards -without a meta key. Typing @samp{ESC f} is equivalent to typing -@samp{M-f}. +@item prefix-meta (@key{ESC}) +Metafy the next character typed. This is for keyboards +without a meta key. Typing @samp{@key{ESC} f} is equivalent to typing +@kbd{M-f}. -@item undo (C-_, C-x C-u) +@item undo (C-_ or C-x C-u) Incremental undo, separately remembered for each line. @item revert-line (M-r) @@ -1232,7 +1276,7 @@ command enough times to get back to the beginning. Perform tilde expansion on the current word. @item set-mark (C-@@) -Set the mark to the current point. If a +Set the mark to the point. If a numeric argument is supplied, the mark is set to that position. @item exchange-point-and-mark (C-x C-x) @@ -1271,7 +1315,7 @@ of an @var{inputrc} file. This command is unbound by default. @item dump-macros () Print all of the Readline key sequences bound to macros and the -strings they ouput. If a numeric argument is supplied, +strings they output. If a numeric argument is supplied, the output is formatted in such a way that it can be made part of an @var{inputrc} file. This command is unbound by default. @@ -1305,7 +1349,7 @@ Perform alias expansion on the current line (@pxref{Aliases}). @item history-and-alias-expand-line () Perform history and alias expansion on the current line. -@item insert-last-argument (M-., M-_) +@item insert-last-argument (M-. or M-_) A synonym for @code{yank-last-arg}. @item operate-and-get-next (C-o) @@ -1328,7 +1372,7 @@ been executed. While the Readline library does not have a full set of @code{vi} editing functions, it does contain enough to allow simple editing of the line. The Readline @code{vi} mode behaves as specified in -the @sc{POSIX} 1003.2 standard. +the @sc{posix} 1003.2 standard. @ifset BashFeatures In order to switch interactively between @code{emacs} and @code{vi} @@ -1337,7 +1381,8 @@ commands (@pxref{The Set Builtin}). @end ifset @ifclear BashFeatures In order to switch interactively between @code{emacs} and @code{vi} -editing modes, use the command M-C-j (toggle-editing-mode). +editing modes, use the command @kbd{M-C-j} (bound to emacs-editing-mode +when in @code{vi} mode and to vi-editing-mode in @code{emacs} mode). @end ifclear The Readline default is @code{emacs} mode. @@ -1374,20 +1419,20 @@ described above (@pxref{Commands For Completion}) is performed. First, the actions specified by the compspec are used. Only matches which are prefixed by the word being completed are returned. -When the @samp{-f} or @samp{-d} option is used for filename or -directory name completion, the shell variable @code{FIGNORE} is +When the @option{-f} or @option{-d} option is used for filename or +directory name completion, the shell variable @env{FIGNORE} is used to filter the matches. -@xref{Bash Variables}, for a description of @code{FIGNORE}. +@xref{Bash Variables}, for a description of @env{FIGNORE}. Any completions specified by a filename expansion pattern to the -@samp{-G} option are generated next. +@option{-G} option are generated next. The words generated by the pattern need not match the word being completed. -The @code{GLOBIGNORE} shell variable is not used to filter the matches, -but the @code{FIGNORE} shell variable is used. +The @env{GLOBIGNORE} shell variable is not used to filter the matches, +but the @env{FIGNORE} shell variable is used. -Next, the string specified as the argument to the @samp{-W} option +Next, the string specified as the argument to the @option{-W} option is considered. -The string is first split using the characters in the @code{IFS} +The string is first split using the characters in the @env{IFS} special variable as delimiters. Shell quoting is honored. Each word is then expanded using @@ -1400,12 +1445,12 @@ The results of the expansion are prefix-matched against the word being completed, and the matching words become the possible completions. After these matches have been generated, any shell function or command -specified with the @samp{-F} and @samp{-C} options is invoked. -When the command or function is invoked, the @code{COMP_LINE} and -@code{COMP_POINT} variables are assigned values as described above +specified with the @option{-F} and @option{-C} options is invoked. +When the command or function is invoked, the @env{COMP_LINE} and +@env{COMP_POINT} variables are assigned values as described above (@pxref{Bash Variables}). -If a shell function is being invoked, the @code{COMP_WORDS} and -@code{COMP_CWORD} variables are also set. +If a shell function is being invoked, the @env{COMP_WORDS} and +@env{COMP_CWORD} variables are also set. When the function or command is invoked, the first argument is the name of the command whose arguments are being completed, the second argument is the word being completed, and the third argument @@ -1414,21 +1459,21 @@ No filtering of the generated completions against the word being completed is performed; the function or command has complete freedom in generating the matches. -Any function specified with @samp{-F} is invoked first. +Any function specified with @option{-F} is invoked first. The function may use any of the shell facilities, including the @code{compgen} builtin described below (@pxref{Programmable Completion Builtins}), to generate the matches. -It must put the possible completions in the @code{COMPREPLY} array +It must put the possible completions in the @env{COMPREPLY} array variable. -Next, any command specified with the @samp{-C} option is invoked +Next, any command specified with the @option{-C} option is invoked in an environment equivalent to command substitution. It should print a list of completions, one per line, to the standard output. Backslash may be used to escape a newline, if necessary. After all of the possible completions are generated, any filter -specified with the @samp{-X} option is applied to the list. +specified with the @option{-X} option is applied to the list. The filter is a pattern as used for pathname expansion; a @samp{&} in the pattern is replaced with the text of the word being completed. A literal @samp{&} may be escaped with a backslash; the backslash @@ -1437,15 +1482,22 @@ Any completion that matches the pattern will be removed from the list. A leading @samp{!} negates the pattern; in this case any completion not matching the pattern will be removed. -Finally, any prefix and suffix specified with the @samp{-P} and @samp{-S} +Finally, any prefix and suffix specified with the @option{-P} and @option{-S} options are added to each member of the completion list, and the result is returned to the Readline completion code as the list of possible completions. -If a compspec is found, whatever it generates is returned to the completion -code as the full set of possible completions. -The default Bash completions are not attempted, and the Readline -default of filename completion is disabled. +If the previously-applied actions do not generate any matches, and the +@option{-o dirnames} option was supplied to @code{complete} when the +compspec was defined, directory name completion is attempted. + +By default, if a compspec is found, whatever it generates is returned to +the completion code as the full set of possible completions. +The default Bash completions are not attempted, and the Readline default +of filename completion is disabled. +If the @option{-o default} option was supplied to @code{complete} when the +compspec was defined, Readline's default completion will be performed +if the compspec generates no matches. @node Programmable Completion Builtins @section Programmable Completion Builtins @@ -1464,9 +1516,9 @@ facilities. Generate possible completion matches for @var{word} according to the @var{option}s, which may be any option accepted by the @code{complete} -builtin with the exception of @samp{-p} and @samp{-r}, and write +builtin with the exception of @option{-p} and @option{-r}, and write the matches to the standard output. -When using the @samp{-F} or @samp{-C} options, the various shell variables +When using the @option{-F} or @option{-C} options, the various shell variables set by the programmable completion facilities, while available, will not have useful values. @@ -1482,17 +1534,17 @@ matches were generated. @item complete @btindex complete @example -@code{complete [-abcdefjkvu] [-A @var{action}] [-G @var{globpat}] [-W @var{wordlist}] +@code{complete [-abcdefjkvu] [-o @var{comp-option}] [-A @var{action}] [-G @var{globpat}] [-W @var{wordlist}] [-P @var{prefix}] [-S @var{suffix}] [-X @var{filterpat}] [-F @var{function}] [-C @var{command}] @var{name} [@var{name} @dots{}]} @code{complete -pr [@var{name} @dots{}]} @end example Specify how arguments to each @var{name} should be completed. -If the @samp{-p} option is supplied, or if no options are supplied, existing +If the @option{-p} option is supplied, or if no options are supplied, existing completion specifications are printed in a way that allows them to be reused as input. -The @samp{-r} option removes a completion specification for +The @option{-r} option removes a completion specification for each @var{name}, or, if no @var{name}s are supplied, all completion specifications. @@ -1500,19 +1552,40 @@ The process of applying these completion specifications when word completion is attempted is described above (@pxref{Programmable Completion}). Other options, if specified, have the following meanings. -The arguments to the @samp{-G}, @samp{-W}, and @samp{-X} options -(and, if necessary, the @samp{-P} and @samp{-S} options) +The arguments to the @option{-G}, @option{-W}, and @option{-X} options +(and, if necessary, the @option{-P} and @option{-S} options) should be quoted to protect them from expansion before the @code{complete} builtin is invoked. + +@table @code +@item -o @var{comp-option} +The @var{comp-option} controls several aspects of the compspec's behavior +beyond the simple generation of completions. +@var{comp-option} may be one of: + @table @code + +@item default +Use readline's default completion if the compspec generates no matches. + +@item dirnames +Perform directory name completion if the compspec generates no matches. + +@item filenames +Tell Readline that the compspec generates filenames, so it can perform any +filename\-specific processing (like adding a slash to directory names or +suppressing trailing spaces). This option is intended to be used with +shell functions specified with @option{-F}. +@end table + @item -A @var{action} The @var{action} may be one of the following to generate a list of possible completions: @table @code @item alias -Alias names. May also be specified as @samp{-a}. +Alias names. May also be specified as @option{-a}. @item arrayvar Array variable names. @@ -1521,13 +1594,13 @@ Array variable names. Readline key binding names (@pxref{Bindable Readline Commands}). @item builtin -Names of shell builtin commands. May also be specified as @samp{-b}. +Names of shell builtin commands. May also be specified as @option{-b}. @item command -Command names. May also be specified as @samp{-c}. +Command names. May also be specified as @option{-c}. @item directory -Directory names. May also be specified as @samp{-d}. +Directory names. May also be specified as @option{-d}. @item disabled Names of disabled shell builtins. @@ -1536,10 +1609,10 @@ Names of disabled shell builtins. Names of enabled shell builtins. @item export -Names of exported shell variables. May also be specified as @samp{-e}. +Names of exported shell variables. May also be specified as @option{-e}. @item file -File names. May also be specified as @samp{-f}. +File names. May also be specified as @option{-f}. @item function Names of shell functions. @@ -1549,19 +1622,19 @@ Help topics as accepted by the @code{help} builtin (@pxref{Bash Builtins}). @item hostname Hostnames, as taken from the file specified by the -@code{HOSTFILE} shell variable (@pxref{Bash Variables}). +@env{HOSTFILE} shell variable (@pxref{Bash Variables}). @item job -Job names, if job control is active. May also be specified as @samp{-j}. +Job names, if job control is active. May also be specified as @option{-j}. @item keyword -Shell reserved words. May also be specified as @samp{-k}. +Shell reserved words. May also be specified as @option{-k}. @item running Names of running jobs, if job control is active. @item setopt -Valid arguments for the @samp{-o} option to the @code{set} builtin +Valid arguments for the @option{-o} option to the @code{set} builtin (@pxref{The Set Builtin}). @item shopt @@ -1575,10 +1648,10 @@ Signal names. Names of stopped jobs, if job control is active. @item user -User names. May also be specified as @samp{-u}. +User names. May also be specified as @option{-u}. @item variable -Names of all shell variables. May also be specified as @samp{-v}. +Names of all shell variables. May also be specified as @option{-v}. @end table @item -G @var{globpat} @@ -1587,7 +1660,7 @@ the possible completions. @item -W @var{wordlist} The @var{wordlist} is split using the characters in the -@code{IFS} special variable as delimiters, and each resultant word +@env{IFS} special variable as delimiters, and each resultant word is expanded. The possible completions are the members of the resultant list which match the word being completed. @@ -1600,7 +1673,7 @@ used as the possible completions. The shell function @var{function} is executed in the current shell environment. When it finishes, the possible completions are retrieved from the value -of the @code{COMPREPLY} array variable. +of the @env{COMPREPLY} array variable. @item -X @var{filterpat} @var{filterpat} is a pattern as used for filename expansion. @@ -1620,7 +1693,7 @@ after all other options have been applied. @end table The return value is true unless an invalid option is supplied, an option -other than @samp{-p} or @samp{-r} is supplied without a @var{name} +other than @option{-p} or @option{-r} is supplied without a @var{name} argument, an attempt is made to remove a completion specification for a @var{name} for which no specification exists, or an error occurs adding a completion specification. diff --git a/contrib/libreadline/doc/rluserman.texinfo b/contrib/libreadline/doc/rluserman.texinfo index e6a3dcd..db560b9 100644 --- a/contrib/libreadline/doc/rluserman.texinfo +++ b/contrib/libreadline/doc/rluserman.texinfo @@ -10,14 +10,14 @@ @ifinfo @dircategory Libraries @direntry -* Readline: (readline). The GNU readline library API +* RLuserman: (rluserman). The GNU readline library User's Manual. @end direntry This document describes the end user interface of the GNU Readline Library, a utility which aids in the consistency of user interface across discrete programs that need to provide a command line interface. -Copyright (C) 1988-1999 Free Software Foundation, Inc. +Copyright (C) 1988-2001 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice @@ -72,7 +72,7 @@ except that this permission notice may be stated in a translation approved by the Free Software Foundation. @vskip 0pt plus 1filll -Copyright @copyright{} 1988-1999 Free Software Foundation, Inc. +Copyright @copyright{} 1988-2001 Free Software Foundation, Inc. @end titlepage @ifinfo diff --git a/contrib/libreadline/emacs_keymap.c b/contrib/libreadline/emacs_keymap.c index daba213..e2f2b30 100644 --- a/contrib/libreadline/emacs_keymap.c +++ b/contrib/libreadline/emacs_keymap.c @@ -33,185 +33,185 @@ KEYMAP_ENTRY_ARRAY emacs_standard_keymap = { /* Control keys. */ - { ISFUNC, rl_set_mark }, /* Control-@ */ - { ISFUNC, rl_beg_of_line }, /* Control-a */ - { ISFUNC, rl_backward }, /* Control-b */ - { ISFUNC, (Function *)0x0 }, /* Control-c */ - { ISFUNC, rl_delete }, /* Control-d */ - { ISFUNC, rl_end_of_line }, /* Control-e */ - { ISFUNC, rl_forward }, /* Control-f */ - { ISFUNC, rl_abort }, /* Control-g */ - { ISFUNC, rl_rubout }, /* Control-h */ - { ISFUNC, rl_complete }, /* Control-i */ - { ISFUNC, rl_newline }, /* Control-j */ - { ISFUNC, rl_kill_line }, /* Control-k */ - { ISFUNC, rl_clear_screen }, /* Control-l */ - { ISFUNC, rl_newline }, /* Control-m */ - { ISFUNC, rl_get_next_history }, /* Control-n */ - { ISFUNC, (Function *)0x0 }, /* Control-o */ - { ISFUNC, rl_get_previous_history }, /* Control-p */ - { ISFUNC, rl_quoted_insert }, /* Control-q */ - { ISFUNC, rl_reverse_search_history }, /* Control-r */ - { ISFUNC, rl_forward_search_history }, /* Control-s */ - { ISFUNC, rl_transpose_chars }, /* Control-t */ - { ISFUNC, rl_unix_line_discard }, /* Control-u */ - { ISFUNC, rl_quoted_insert }, /* Control-v */ - { ISFUNC, rl_unix_word_rubout }, /* Control-w */ - { ISKMAP, (Function *)emacs_ctlx_keymap }, /* Control-x */ - { ISFUNC, rl_yank }, /* Control-y */ - { ISFUNC, (Function *)0x0 }, /* Control-z */ - { ISKMAP, (Function *)emacs_meta_keymap }, /* Control-[ */ - { ISFUNC, (Function *)0x0 }, /* Control-\ */ - { ISFUNC, rl_char_search }, /* Control-] */ - { ISFUNC, (Function *)0x0 }, /* Control-^ */ - { ISFUNC, rl_undo_command }, /* Control-_ */ + { ISFUNC, rl_set_mark }, /* Control-@ */ + { ISFUNC, rl_beg_of_line }, /* Control-a */ + { ISFUNC, rl_backward }, /* Control-b */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-c */ + { ISFUNC, rl_delete }, /* Control-d */ + { ISFUNC, rl_end_of_line }, /* Control-e */ + { ISFUNC, rl_forward }, /* Control-f */ + { ISFUNC, rl_abort }, /* Control-g */ + { ISFUNC, rl_rubout }, /* Control-h */ + { ISFUNC, rl_complete }, /* Control-i */ + { ISFUNC, rl_newline }, /* Control-j */ + { ISFUNC, rl_kill_line }, /* Control-k */ + { ISFUNC, rl_clear_screen }, /* Control-l */ + { ISFUNC, rl_newline }, /* Control-m */ + { ISFUNC, rl_get_next_history }, /* Control-n */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-o */ + { ISFUNC, rl_get_previous_history }, /* Control-p */ + { ISFUNC, rl_quoted_insert }, /* Control-q */ + { ISFUNC, rl_reverse_search_history }, /* Control-r */ + { ISFUNC, rl_forward_search_history }, /* Control-s */ + { ISFUNC, rl_transpose_chars }, /* Control-t */ + { ISFUNC, rl_unix_line_discard }, /* Control-u */ + { ISFUNC, rl_quoted_insert }, /* Control-v */ + { ISFUNC, rl_unix_word_rubout }, /* Control-w */ + { ISKMAP, (rl_command_func_t *)emacs_ctlx_keymap }, /* Control-x */ + { ISFUNC, rl_yank }, /* Control-y */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-z */ + { ISKMAP, (rl_command_func_t *)emacs_meta_keymap }, /* Control-[ */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-\ */ + { ISFUNC, rl_char_search }, /* Control-] */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-^ */ + { ISFUNC, rl_undo_command }, /* Control-_ */ /* The start of printing characters. */ - { ISFUNC, rl_insert }, /* SPACE */ - { ISFUNC, rl_insert }, /* ! */ - { ISFUNC, rl_insert }, /* " */ - { ISFUNC, rl_insert }, /* # */ - { ISFUNC, rl_insert }, /* $ */ - { ISFUNC, rl_insert }, /* % */ - { ISFUNC, rl_insert }, /* & */ - { ISFUNC, rl_insert }, /* ' */ - { ISFUNC, rl_insert }, /* ( */ - { ISFUNC, rl_insert }, /* ) */ - { ISFUNC, rl_insert }, /* * */ - { ISFUNC, rl_insert }, /* + */ - { ISFUNC, rl_insert }, /* , */ - { ISFUNC, rl_insert }, /* - */ - { ISFUNC, rl_insert }, /* . */ - { ISFUNC, rl_insert }, /* / */ - - /* Regular digits. */ - { ISFUNC, rl_insert }, /* 0 */ - { ISFUNC, rl_insert }, /* 1 */ - { ISFUNC, rl_insert }, /* 2 */ - { ISFUNC, rl_insert }, /* 3 */ - { ISFUNC, rl_insert }, /* 4 */ - { ISFUNC, rl_insert }, /* 5 */ - { ISFUNC, rl_insert }, /* 6 */ - { ISFUNC, rl_insert }, /* 7 */ - { ISFUNC, rl_insert }, /* 8 */ - { ISFUNC, rl_insert }, /* 9 */ + { ISFUNC, rl_insert }, /* SPACE */ + { ISFUNC, rl_insert }, /* ! */ + { ISFUNC, rl_insert }, /* " */ + { ISFUNC, rl_insert }, /* # */ + { ISFUNC, rl_insert }, /* $ */ + { ISFUNC, rl_insert }, /* % */ + { ISFUNC, rl_insert }, /* & */ + { ISFUNC, rl_insert }, /* ' */ + { ISFUNC, rl_insert }, /* ( */ + { ISFUNC, rl_insert }, /* ) */ + { ISFUNC, rl_insert }, /* * */ + { ISFUNC, rl_insert }, /* + */ + { ISFUNC, rl_insert }, /* , */ + { ISFUNC, rl_insert }, /* - */ + { ISFUNC, rl_insert }, /* . */ + { ISFUNC, rl_insert }, /* / */ + + /* Regular digits. */ + { ISFUNC, rl_insert }, /* 0 */ + { ISFUNC, rl_insert }, /* 1 */ + { ISFUNC, rl_insert }, /* 2 */ + { ISFUNC, rl_insert }, /* 3 */ + { ISFUNC, rl_insert }, /* 4 */ + { ISFUNC, rl_insert }, /* 5 */ + { ISFUNC, rl_insert }, /* 6 */ + { ISFUNC, rl_insert }, /* 7 */ + { ISFUNC, rl_insert }, /* 8 */ + { ISFUNC, rl_insert }, /* 9 */ /* A little more punctuation. */ - { ISFUNC, rl_insert }, /* : */ - { ISFUNC, rl_insert }, /* ; */ - { ISFUNC, rl_insert }, /* < */ - { ISFUNC, rl_insert }, /* = */ - { ISFUNC, rl_insert }, /* > */ - { ISFUNC, rl_insert }, /* ? */ - { ISFUNC, rl_insert }, /* @ */ + { ISFUNC, rl_insert }, /* : */ + { ISFUNC, rl_insert }, /* ; */ + { ISFUNC, rl_insert }, /* < */ + { ISFUNC, rl_insert }, /* = */ + { ISFUNC, rl_insert }, /* > */ + { ISFUNC, rl_insert }, /* ? */ + { ISFUNC, rl_insert }, /* @ */ /* Uppercase alphabet. */ - { ISFUNC, rl_insert }, /* A */ - { ISFUNC, rl_insert }, /* B */ - { ISFUNC, rl_insert }, /* C */ - { ISFUNC, rl_insert }, /* D */ - { ISFUNC, rl_insert }, /* E */ - { ISFUNC, rl_insert }, /* F */ - { ISFUNC, rl_insert }, /* G */ - { ISFUNC, rl_insert }, /* H */ - { ISFUNC, rl_insert }, /* I */ - { ISFUNC, rl_insert }, /* J */ - { ISFUNC, rl_insert }, /* K */ - { ISFUNC, rl_insert }, /* L */ - { ISFUNC, rl_insert }, /* M */ - { ISFUNC, rl_insert }, /* N */ - { ISFUNC, rl_insert }, /* O */ - { ISFUNC, rl_insert }, /* P */ - { ISFUNC, rl_insert }, /* Q */ - { ISFUNC, rl_insert }, /* R */ - { ISFUNC, rl_insert }, /* S */ - { ISFUNC, rl_insert }, /* T */ - { ISFUNC, rl_insert }, /* U */ - { ISFUNC, rl_insert }, /* V */ - { ISFUNC, rl_insert }, /* W */ - { ISFUNC, rl_insert }, /* X */ - { ISFUNC, rl_insert }, /* Y */ - { ISFUNC, rl_insert }, /* Z */ + { ISFUNC, rl_insert }, /* A */ + { ISFUNC, rl_insert }, /* B */ + { ISFUNC, rl_insert }, /* C */ + { ISFUNC, rl_insert }, /* D */ + { ISFUNC, rl_insert }, /* E */ + { ISFUNC, rl_insert }, /* F */ + { ISFUNC, rl_insert }, /* G */ + { ISFUNC, rl_insert }, /* H */ + { ISFUNC, rl_insert }, /* I */ + { ISFUNC, rl_insert }, /* J */ + { ISFUNC, rl_insert }, /* K */ + { ISFUNC, rl_insert }, /* L */ + { ISFUNC, rl_insert }, /* M */ + { ISFUNC, rl_insert }, /* N */ + { ISFUNC, rl_insert }, /* O */ + { ISFUNC, rl_insert }, /* P */ + { ISFUNC, rl_insert }, /* Q */ + { ISFUNC, rl_insert }, /* R */ + { ISFUNC, rl_insert }, /* S */ + { ISFUNC, rl_insert }, /* T */ + { ISFUNC, rl_insert }, /* U */ + { ISFUNC, rl_insert }, /* V */ + { ISFUNC, rl_insert }, /* W */ + { ISFUNC, rl_insert }, /* X */ + { ISFUNC, rl_insert }, /* Y */ + { ISFUNC, rl_insert }, /* Z */ /* Some more punctuation. */ - { ISFUNC, rl_insert }, /* [ */ - { ISFUNC, rl_insert }, /* \ */ - { ISFUNC, rl_insert }, /* ] */ - { ISFUNC, rl_insert }, /* ^ */ - { ISFUNC, rl_insert }, /* _ */ - { ISFUNC, rl_insert }, /* ` */ + { ISFUNC, rl_insert }, /* [ */ + { ISFUNC, rl_insert }, /* \ */ + { ISFUNC, rl_insert }, /* ] */ + { ISFUNC, rl_insert }, /* ^ */ + { ISFUNC, rl_insert }, /* _ */ + { ISFUNC, rl_insert }, /* ` */ /* Lowercase alphabet. */ - { ISFUNC, rl_insert }, /* a */ - { ISFUNC, rl_insert }, /* b */ - { ISFUNC, rl_insert }, /* c */ - { ISFUNC, rl_insert }, /* d */ - { ISFUNC, rl_insert }, /* e */ - { ISFUNC, rl_insert }, /* f */ - { ISFUNC, rl_insert }, /* g */ - { ISFUNC, rl_insert }, /* h */ - { ISFUNC, rl_insert }, /* i */ - { ISFUNC, rl_insert }, /* j */ - { ISFUNC, rl_insert }, /* k */ - { ISFUNC, rl_insert }, /* l */ - { ISFUNC, rl_insert }, /* m */ - { ISFUNC, rl_insert }, /* n */ - { ISFUNC, rl_insert }, /* o */ - { ISFUNC, rl_insert }, /* p */ - { ISFUNC, rl_insert }, /* q */ - { ISFUNC, rl_insert }, /* r */ - { ISFUNC, rl_insert }, /* s */ - { ISFUNC, rl_insert }, /* t */ - { ISFUNC, rl_insert }, /* u */ - { ISFUNC, rl_insert }, /* v */ - { ISFUNC, rl_insert }, /* w */ - { ISFUNC, rl_insert }, /* x */ - { ISFUNC, rl_insert }, /* y */ - { ISFUNC, rl_insert }, /* z */ + { ISFUNC, rl_insert }, /* a */ + { ISFUNC, rl_insert }, /* b */ + { ISFUNC, rl_insert }, /* c */ + { ISFUNC, rl_insert }, /* d */ + { ISFUNC, rl_insert }, /* e */ + { ISFUNC, rl_insert }, /* f */ + { ISFUNC, rl_insert }, /* g */ + { ISFUNC, rl_insert }, /* h */ + { ISFUNC, rl_insert }, /* i */ + { ISFUNC, rl_insert }, /* j */ + { ISFUNC, rl_insert }, /* k */ + { ISFUNC, rl_insert }, /* l */ + { ISFUNC, rl_insert }, /* m */ + { ISFUNC, rl_insert }, /* n */ + { ISFUNC, rl_insert }, /* o */ + { ISFUNC, rl_insert }, /* p */ + { ISFUNC, rl_insert }, /* q */ + { ISFUNC, rl_insert }, /* r */ + { ISFUNC, rl_insert }, /* s */ + { ISFUNC, rl_insert }, /* t */ + { ISFUNC, rl_insert }, /* u */ + { ISFUNC, rl_insert }, /* v */ + { ISFUNC, rl_insert }, /* w */ + { ISFUNC, rl_insert }, /* x */ + { ISFUNC, rl_insert }, /* y */ + { ISFUNC, rl_insert }, /* z */ /* Final punctuation. */ - { ISFUNC, rl_insert }, /* { */ - { ISFUNC, rl_insert }, /* | */ - { ISFUNC, rl_insert }, /* } */ - { ISFUNC, rl_insert }, /* ~ */ - { ISFUNC, rl_rubout }, /* RUBOUT */ + { ISFUNC, rl_insert }, /* { */ + { ISFUNC, rl_insert }, /* | */ + { ISFUNC, rl_insert }, /* } */ + { ISFUNC, rl_insert }, /* ~ */ + { ISFUNC, rl_rubout }, /* RUBOUT */ #if KEYMAP_SIZE > 128 /* Pure 8-bit characters (128 - 159). These might be used in some character sets. */ - { ISFUNC, rl_insert }, /* ? */ - { ISFUNC, rl_insert }, /* ? */ - { ISFUNC, rl_insert }, /* ? */ - { ISFUNC, rl_insert }, /* ? */ - { ISFUNC, rl_insert }, /* ? */ - { ISFUNC, rl_insert }, /* ? */ - { ISFUNC, rl_insert }, /* ? */ - { ISFUNC, rl_insert }, /* ? */ - { ISFUNC, rl_insert }, /* ? */ - { ISFUNC, rl_insert }, /* ? */ - { ISFUNC, rl_insert }, /* ? */ - { ISFUNC, rl_insert }, /* ? */ - { ISFUNC, rl_insert }, /* ? */ - { ISFUNC, rl_insert }, /* ? */ - { ISFUNC, rl_insert }, /* ? */ - { ISFUNC, rl_insert }, /* ? */ - { ISFUNC, rl_insert }, /* ? */ - { ISFUNC, rl_insert }, /* ? */ - { ISFUNC, rl_insert }, /* ? */ - { ISFUNC, rl_insert }, /* ? */ - { ISFUNC, rl_insert }, /* ? */ - { ISFUNC, rl_insert }, /* ? */ - { ISFUNC, rl_insert }, /* ? */ - { ISFUNC, rl_insert }, /* ? */ - { ISFUNC, rl_insert }, /* ? */ - { ISFUNC, rl_insert }, /* ? */ - { ISFUNC, rl_insert }, /* ? */ - { ISFUNC, rl_insert }, /* ? */ - { ISFUNC, rl_insert }, /* ? */ - { ISFUNC, rl_insert }, /* ? */ - { ISFUNC, rl_insert }, /* ? */ - { ISFUNC, rl_insert }, /* ? */ + { ISFUNC, rl_insert }, /* ? */ + { ISFUNC, rl_insert }, /* ? */ + { ISFUNC, rl_insert }, /* ? */ + { ISFUNC, rl_insert }, /* ? */ + { ISFUNC, rl_insert }, /* ? */ + { ISFUNC, rl_insert }, /* ? */ + { ISFUNC, rl_insert }, /* ? */ + { ISFUNC, rl_insert }, /* ? */ + { ISFUNC, rl_insert }, /* ? */ + { ISFUNC, rl_insert }, /* ? */ + { ISFUNC, rl_insert }, /* ? */ + { ISFUNC, rl_insert }, /* ? */ + { ISFUNC, rl_insert }, /* ? */ + { ISFUNC, rl_insert }, /* ? */ + { ISFUNC, rl_insert }, /* ? */ + { ISFUNC, rl_insert }, /* ? */ + { ISFUNC, rl_insert }, /* ? */ + { ISFUNC, rl_insert }, /* ? */ + { ISFUNC, rl_insert }, /* ? */ + { ISFUNC, rl_insert }, /* ? */ + { ISFUNC, rl_insert }, /* ? */ + { ISFUNC, rl_insert }, /* ? */ + { ISFUNC, rl_insert }, /* ? */ + { ISFUNC, rl_insert }, /* ? */ + { ISFUNC, rl_insert }, /* ? */ + { ISFUNC, rl_insert }, /* ? */ + { ISFUNC, rl_insert }, /* ? */ + { ISFUNC, rl_insert }, /* ? */ + { ISFUNC, rl_insert }, /* ? */ + { ISFUNC, rl_insert }, /* ? */ + { ISFUNC, rl_insert }, /* ? */ + { ISFUNC, rl_insert }, /* ? */ /* ISO Latin-1 characters (160 - 255) */ { ISFUNC, rl_insert }, /* No-break space */ @@ -316,78 +316,78 @@ KEYMAP_ENTRY_ARRAY emacs_standard_keymap = { KEYMAP_ENTRY_ARRAY emacs_meta_keymap = { /* Meta keys. Just like above, but the high bit is set. */ - { ISFUNC, (Function *)0x0 }, /* Meta-Control-@ */ - { ISFUNC, (Function *)0x0 }, /* Meta-Control-a */ - { ISFUNC, (Function *)0x0 }, /* Meta-Control-b */ - { ISFUNC, (Function *)0x0 }, /* Meta-Control-c */ - { ISFUNC, (Function *)0x0 }, /* Meta-Control-d */ - { ISFUNC, (Function *)0x0 }, /* Meta-Control-e */ - { ISFUNC, (Function *)0x0 }, /* Meta-Control-f */ - { ISFUNC, rl_abort }, /* Meta-Control-g */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-@ */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-a */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-b */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-c */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-d */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-e */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-f */ + { ISFUNC, rl_abort }, /* Meta-Control-g */ { ISFUNC, rl_backward_kill_word }, /* Meta-Control-h */ - { ISFUNC, rl_tab_insert }, /* Meta-Control-i */ - { ISFUNC, rl_vi_editing_mode }, /* Meta-Control-j */ - { ISFUNC, (Function *)0x0 }, /* Meta-Control-k */ - { ISFUNC, (Function *)0x0 }, /* Meta-Control-l */ - { ISFUNC, rl_vi_editing_mode }, /* Meta-Control-m */ - { ISFUNC, (Function *)0x0 }, /* Meta-Control-n */ - { ISFUNC, (Function *)0x0 }, /* Meta-Control-o */ - { ISFUNC, (Function *)0x0 }, /* Meta-Control-p */ - { ISFUNC, (Function *)0x0 }, /* Meta-Control-q */ - { ISFUNC, rl_revert_line }, /* Meta-Control-r */ - { ISFUNC, (Function *)0x0 }, /* Meta-Control-s */ - { ISFUNC, (Function *)0x0 }, /* Meta-Control-t */ - { ISFUNC, (Function *)0x0 }, /* Meta-Control-u */ - { ISFUNC, (Function *)0x0 }, /* Meta-Control-v */ - { ISFUNC, (Function *)0x0 }, /* Meta-Control-w */ - { ISFUNC, (Function *)0x0 }, /* Meta-Control-x */ - { ISFUNC, rl_yank_nth_arg }, /* Meta-Control-y */ - { ISFUNC, (Function *)0x0 }, /* Meta-Control-z */ - - { ISFUNC, rl_complete }, /* Meta-Control-[ */ - { ISFUNC, (Function *)0x0 }, /* Meta-Control-\ */ + { ISFUNC, rl_tab_insert }, /* Meta-Control-i */ + { ISFUNC, rl_vi_editing_mode }, /* Meta-Control-j */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-k */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-l */ + { ISFUNC, rl_vi_editing_mode }, /* Meta-Control-m */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-n */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-o */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-p */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-q */ + { ISFUNC, rl_revert_line }, /* Meta-Control-r */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-s */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-t */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-u */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-v */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-w */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-x */ + { ISFUNC, rl_yank_nth_arg }, /* Meta-Control-y */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-z */ + + { ISFUNC, rl_complete }, /* Meta-Control-[ */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-\ */ { ISFUNC, rl_backward_char_search }, /* Meta-Control-] */ - { ISFUNC, (Function *)0x0 }, /* Meta-Control-^ */ - { ISFUNC, (Function *)0x0 }, /* Meta-Control-_ */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-^ */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-_ */ /* The start of printing characters. */ - { ISFUNC, rl_set_mark }, /* Meta-SPACE */ - { ISFUNC, (Function *)0x0 }, /* Meta-! */ - { ISFUNC, (Function *)0x0 }, /* Meta-" */ - { ISFUNC, rl_insert_comment },/* Meta-# */ - { ISFUNC, (Function *)0x0 }, /* Meta-$ */ - { ISFUNC, (Function *)0x0 }, /* Meta-% */ - { ISFUNC, rl_tilde_expand }, /* Meta-& */ - { ISFUNC, (Function *)0x0 }, /* Meta-' */ - { ISFUNC, (Function *)0x0 }, /* Meta-( */ - { ISFUNC, (Function *)0x0 }, /* Meta-) */ + { ISFUNC, rl_set_mark }, /* Meta-SPACE */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-! */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-" */ + { ISFUNC, rl_insert_comment }, /* Meta-# */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-$ */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-% */ + { ISFUNC, rl_tilde_expand }, /* Meta-& */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-' */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-( */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-) */ { ISFUNC, rl_insert_completions }, /* Meta-* */ - { ISFUNC, (Function *)0x0 }, /* Meta-+ */ - { ISFUNC, (Function *)0x0 }, /* Meta-, */ - { ISFUNC, rl_digit_argument }, /* Meta-- */ - { ISFUNC, rl_yank_last_arg}, /* Meta-. */ - { ISFUNC, (Function *)0x0 }, /* Meta-/ */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-+ */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-, */ + { ISFUNC, rl_digit_argument }, /* Meta-- */ + { ISFUNC, rl_yank_last_arg}, /* Meta-. */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-/ */ /* Regular digits. */ - { ISFUNC, rl_digit_argument }, /* Meta-0 */ - { ISFUNC, rl_digit_argument }, /* Meta-1 */ - { ISFUNC, rl_digit_argument }, /* Meta-2 */ - { ISFUNC, rl_digit_argument }, /* Meta-3 */ - { ISFUNC, rl_digit_argument }, /* Meta-4 */ - { ISFUNC, rl_digit_argument }, /* Meta-5 */ - { ISFUNC, rl_digit_argument }, /* Meta-6 */ - { ISFUNC, rl_digit_argument }, /* Meta-7 */ - { ISFUNC, rl_digit_argument }, /* Meta-8 */ - { ISFUNC, rl_digit_argument }, /* Meta-9 */ + { ISFUNC, rl_digit_argument }, /* Meta-0 */ + { ISFUNC, rl_digit_argument }, /* Meta-1 */ + { ISFUNC, rl_digit_argument }, /* Meta-2 */ + { ISFUNC, rl_digit_argument }, /* Meta-3 */ + { ISFUNC, rl_digit_argument }, /* Meta-4 */ + { ISFUNC, rl_digit_argument }, /* Meta-5 */ + { ISFUNC, rl_digit_argument }, /* Meta-6 */ + { ISFUNC, rl_digit_argument }, /* Meta-7 */ + { ISFUNC, rl_digit_argument }, /* Meta-8 */ + { ISFUNC, rl_digit_argument }, /* Meta-9 */ /* A little more punctuation. */ - { ISFUNC, (Function *)0x0 }, /* Meta-: */ - { ISFUNC, (Function *)0x0 }, /* Meta-; */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-: */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-; */ { ISFUNC, rl_beginning_of_history }, /* Meta-< */ { ISFUNC, rl_possible_completions }, /* Meta-= */ { ISFUNC, rl_end_of_history }, /* Meta-> */ { ISFUNC, rl_possible_completions }, /* Meta-? */ - { ISFUNC, (Function *)0x0 }, /* Meta-@ */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-@ */ /* Uppercase alphabet. */ { ISFUNC, rl_do_lowercase_version }, /* Meta-A */ @@ -418,456 +418,456 @@ KEYMAP_ENTRY_ARRAY emacs_meta_keymap = { { ISFUNC, rl_do_lowercase_version }, /* Meta-Z */ /* Some more punctuation. */ - { ISFUNC, (Function *)0x0 }, /* Meta-[ */ /* was rl_arrow_keys */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-[ */ /* was rl_arrow_keys */ { ISFUNC, rl_delete_horizontal_space }, /* Meta-\ */ - { ISFUNC, (Function *)0x0 }, /* Meta-] */ - { ISFUNC, (Function *)0x0 }, /* Meta-^ */ - { ISFUNC, rl_yank_last_arg }, /* Meta-_ */ - { ISFUNC, (Function *)0x0 }, /* Meta-` */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-] */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-^ */ + { ISFUNC, rl_yank_last_arg }, /* Meta-_ */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-` */ /* Lowercase alphabet. */ - { ISFUNC, (Function *)0x0 }, /* Meta-a */ - { ISFUNC, rl_backward_word }, /* Meta-b */ - { ISFUNC, rl_capitalize_word }, /* Meta-c */ - { ISFUNC, rl_kill_word }, /* Meta-d */ - { ISFUNC, (Function *)0x0 }, /* Meta-e */ - { ISFUNC, rl_forward_word }, /* Meta-f */ - { ISFUNC, (Function *)0x0 }, /* Meta-g */ - { ISFUNC, (Function *)0x0 }, /* Meta-h */ - { ISFUNC, (Function *)0x0 }, /* Meta-i */ - { ISFUNC, (Function *)0x0 }, /* Meta-j */ - { ISFUNC, (Function *)0x0 }, /* Meta-k */ - { ISFUNC, rl_downcase_word }, /* Meta-l */ - { ISFUNC, (Function *)0x0 }, /* Meta-m */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-a */ + { ISFUNC, rl_backward_word }, /* Meta-b */ + { ISFUNC, rl_capitalize_word }, /* Meta-c */ + { ISFUNC, rl_kill_word }, /* Meta-d */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-e */ + { ISFUNC, rl_forward_word }, /* Meta-f */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-g */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-h */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-i */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-j */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-k */ + { ISFUNC, rl_downcase_word }, /* Meta-l */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-m */ { ISFUNC, rl_noninc_forward_search }, /* Meta-n */ - { ISFUNC, (Function *)0x0 }, /* Meta-o */ /* was rl_arrow_keys */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-o */ /* was rl_arrow_keys */ { ISFUNC, rl_noninc_reverse_search }, /* Meta-p */ - { ISFUNC, (Function *)0x0 }, /* Meta-q */ - { ISFUNC, rl_revert_line }, /* Meta-r */ - { ISFUNC, (Function *)0x0 }, /* Meta-s */ - { ISFUNC, rl_transpose_words }, /* Meta-t */ - { ISFUNC, rl_upcase_word }, /* Meta-u */ - { ISFUNC, (Function *)0x0 }, /* Meta-v */ - { ISFUNC, (Function *)0x0 }, /* Meta-w */ - { ISFUNC, (Function *)0x0 }, /* Meta-x */ - { ISFUNC, rl_yank_pop }, /* Meta-y */ - { ISFUNC, (Function *)0x0 }, /* Meta-z */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-q */ + { ISFUNC, rl_revert_line }, /* Meta-r */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-s */ + { ISFUNC, rl_transpose_words }, /* Meta-t */ + { ISFUNC, rl_upcase_word }, /* Meta-u */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-v */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-w */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-x */ + { ISFUNC, rl_yank_pop }, /* Meta-y */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-z */ /* Final punctuation. */ - { ISFUNC, (Function *)0x0 }, /* Meta-{ */ - { ISFUNC, (Function *)0x0 }, /* Meta-| */ - { ISFUNC, (Function *)0x0 }, /* Meta-} */ - { ISFUNC, rl_tilde_expand }, /* Meta-~ */ - { ISFUNC, rl_backward_kill_word }, /* Meta-rubout */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-{ */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-| */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-} */ + { ISFUNC, rl_tilde_expand }, /* Meta-~ */ + { ISFUNC, rl_backward_kill_word }, /* Meta-rubout */ #if KEYMAP_SIZE > 128 /* Undefined keys. */ - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 } + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 } #endif /* KEYMAP_SIZE > 128 */ }; KEYMAP_ENTRY_ARRAY emacs_ctlx_keymap = { /* Control keys. */ - { ISFUNC, (Function *)0x0 }, /* Control-@ */ - { ISFUNC, (Function *)0x0 }, /* Control-a */ - { ISFUNC, (Function *)0x0 }, /* Control-b */ - { ISFUNC, (Function *)0x0 }, /* Control-c */ - { ISFUNC, (Function *)0x0 }, /* Control-d */ - { ISFUNC, (Function *)0x0 }, /* Control-e */ - { ISFUNC, (Function *)0x0 }, /* Control-f */ - { ISFUNC, rl_abort }, /* Control-g */ - { ISFUNC, (Function *)0x0 }, /* Control-h */ - { ISFUNC, (Function *)0x0 }, /* Control-i */ - { ISFUNC, (Function *)0x0 }, /* Control-j */ - { ISFUNC, (Function *)0x0 }, /* Control-k */ - { ISFUNC, (Function *)0x0 }, /* Control-l */ - { ISFUNC, (Function *)0x0 }, /* Control-m */ - { ISFUNC, (Function *)0x0 }, /* Control-n */ - { ISFUNC, (Function *)0x0 }, /* Control-o */ - { ISFUNC, (Function *)0x0 }, /* Control-p */ - { ISFUNC, (Function *)0x0 }, /* Control-q */ - { ISFUNC, rl_re_read_init_file }, /* Control-r */ - { ISFUNC, (Function *)0x0 }, /* Control-s */ - { ISFUNC, (Function *)0x0 }, /* Control-t */ - { ISFUNC, rl_undo_command }, /* Control-u */ - { ISFUNC, (Function *)0x0 }, /* Control-v */ - { ISFUNC, (Function *)0x0 }, /* Control-w */ - { ISFUNC, rl_exchange_point_and_mark },/* Control-x */ - { ISFUNC, (Function *)0x0 }, /* Control-y */ - { ISFUNC, (Function *)0x0 }, /* Control-z */ - { ISFUNC, (Function *)0x0 }, /* Control-[ */ - { ISFUNC, (Function *)0x0 }, /* Control-\ */ - { ISFUNC, (Function *)0x0 }, /* Control-] */ - { ISFUNC, (Function *)0x0 }, /* Control-^ */ - { ISFUNC, (Function *)0x0 }, /* Control-_ */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-@ */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-a */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-b */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-c */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-d */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-e */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-f */ + { ISFUNC, rl_abort }, /* Control-g */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-h */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-i */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-j */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-k */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-l */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-m */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-n */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-o */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-p */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-q */ + { ISFUNC, rl_re_read_init_file }, /* Control-r */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-s */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-t */ + { ISFUNC, rl_undo_command }, /* Control-u */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-v */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-w */ + { ISFUNC, rl_exchange_point_and_mark }, /* Control-x */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-y */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-z */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-[ */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-\ */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-] */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-^ */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-_ */ /* The start of printing characters. */ - { ISFUNC, (Function *)0x0 }, /* SPACE */ - { ISFUNC, (Function *)0x0 }, /* ! */ - { ISFUNC, (Function *)0x0 }, /* " */ - { ISFUNC, (Function *)0x0 }, /* # */ - { ISFUNC, (Function *)0x0 }, /* $ */ - { ISFUNC, (Function *)0x0 }, /* % */ - { ISFUNC, (Function *)0x0 }, /* & */ - { ISFUNC, (Function *)0x0 }, /* ' */ - { ISFUNC, rl_start_kbd_macro }, /* ( */ - { ISFUNC, rl_end_kbd_macro }, /* ) */ - { ISFUNC, (Function *)0x0 }, /* * */ - { ISFUNC, (Function *)0x0 }, /* + */ - { ISFUNC, (Function *)0x0 }, /* , */ - { ISFUNC, (Function *)0x0 }, /* - */ - { ISFUNC, (Function *)0x0 }, /* . */ - { ISFUNC, (Function *)0x0 }, /* / */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* SPACE */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* ! */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* " */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* # */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* $ */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* % */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* & */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* ' */ + { ISFUNC, rl_start_kbd_macro }, /* ( */ + { ISFUNC, rl_end_kbd_macro }, /* ) */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* * */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* + */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* , */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* - */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* . */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* / */ /* Regular digits. */ - { ISFUNC, (Function *)0x0 }, /* 0 */ - { ISFUNC, (Function *)0x0 }, /* 1 */ - { ISFUNC, (Function *)0x0 }, /* 2 */ - { ISFUNC, (Function *)0x0 }, /* 3 */ - { ISFUNC, (Function *)0x0 }, /* 4 */ - { ISFUNC, (Function *)0x0 }, /* 5 */ - { ISFUNC, (Function *)0x0 }, /* 6 */ - { ISFUNC, (Function *)0x0 }, /* 7 */ - { ISFUNC, (Function *)0x0 }, /* 8 */ - { ISFUNC, (Function *)0x0 }, /* 9 */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* 0 */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* 1 */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* 2 */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* 3 */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* 4 */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* 5 */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* 6 */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* 7 */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* 8 */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* 9 */ /* A little more punctuation. */ - { ISFUNC, (Function *)0x0 }, /* : */ - { ISFUNC, (Function *)0x0 }, /* ; */ - { ISFUNC, (Function *)0x0 }, /* < */ - { ISFUNC, (Function *)0x0 }, /* = */ - { ISFUNC, (Function *)0x0 }, /* > */ - { ISFUNC, (Function *)0x0 }, /* ? */ - { ISFUNC, (Function *)0x0 }, /* @ */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* : */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* ; */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* < */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* = */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* > */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* ? */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* @ */ /* Uppercase alphabet. */ - { ISFUNC, rl_do_lowercase_version }, /* A */ - { ISFUNC, rl_do_lowercase_version }, /* B */ - { ISFUNC, rl_do_lowercase_version }, /* C */ - { ISFUNC, rl_do_lowercase_version }, /* D */ - { ISFUNC, rl_do_lowercase_version }, /* E */ - { ISFUNC, rl_do_lowercase_version }, /* F */ - { ISFUNC, rl_do_lowercase_version }, /* G */ - { ISFUNC, rl_do_lowercase_version }, /* H */ - { ISFUNC, rl_do_lowercase_version }, /* I */ - { ISFUNC, rl_do_lowercase_version }, /* J */ - { ISFUNC, rl_do_lowercase_version }, /* K */ - { ISFUNC, rl_do_lowercase_version }, /* L */ - { ISFUNC, rl_do_lowercase_version }, /* M */ - { ISFUNC, rl_do_lowercase_version }, /* N */ - { ISFUNC, rl_do_lowercase_version }, /* O */ - { ISFUNC, rl_do_lowercase_version }, /* P */ - { ISFUNC, rl_do_lowercase_version }, /* Q */ - { ISFUNC, rl_do_lowercase_version }, /* R */ - { ISFUNC, rl_do_lowercase_version }, /* S */ - { ISFUNC, rl_do_lowercase_version }, /* T */ - { ISFUNC, rl_do_lowercase_version }, /* U */ - { ISFUNC, rl_do_lowercase_version }, /* V */ - { ISFUNC, rl_do_lowercase_version }, /* W */ - { ISFUNC, rl_do_lowercase_version }, /* X */ - { ISFUNC, rl_do_lowercase_version }, /* Y */ - { ISFUNC, rl_do_lowercase_version }, /* Z */ + { ISFUNC, rl_do_lowercase_version }, /* A */ + { ISFUNC, rl_do_lowercase_version }, /* B */ + { ISFUNC, rl_do_lowercase_version }, /* C */ + { ISFUNC, rl_do_lowercase_version }, /* D */ + { ISFUNC, rl_do_lowercase_version }, /* E */ + { ISFUNC, rl_do_lowercase_version }, /* F */ + { ISFUNC, rl_do_lowercase_version }, /* G */ + { ISFUNC, rl_do_lowercase_version }, /* H */ + { ISFUNC, rl_do_lowercase_version }, /* I */ + { ISFUNC, rl_do_lowercase_version }, /* J */ + { ISFUNC, rl_do_lowercase_version }, /* K */ + { ISFUNC, rl_do_lowercase_version }, /* L */ + { ISFUNC, rl_do_lowercase_version }, /* M */ + { ISFUNC, rl_do_lowercase_version }, /* N */ + { ISFUNC, rl_do_lowercase_version }, /* O */ + { ISFUNC, rl_do_lowercase_version }, /* P */ + { ISFUNC, rl_do_lowercase_version }, /* Q */ + { ISFUNC, rl_do_lowercase_version }, /* R */ + { ISFUNC, rl_do_lowercase_version }, /* S */ + { ISFUNC, rl_do_lowercase_version }, /* T */ + { ISFUNC, rl_do_lowercase_version }, /* U */ + { ISFUNC, rl_do_lowercase_version }, /* V */ + { ISFUNC, rl_do_lowercase_version }, /* W */ + { ISFUNC, rl_do_lowercase_version }, /* X */ + { ISFUNC, rl_do_lowercase_version }, /* Y */ + { ISFUNC, rl_do_lowercase_version }, /* Z */ /* Some more punctuation. */ - { ISFUNC, (Function *)0x0 }, /* [ */ - { ISFUNC, (Function *)0x0 }, /* \ */ - { ISFUNC, (Function *)0x0 }, /* ] */ - { ISFUNC, (Function *)0x0 }, /* ^ */ - { ISFUNC, (Function *)0x0 }, /* _ */ - { ISFUNC, (Function *)0x0 }, /* ` */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* [ */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* \ */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* ] */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* ^ */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* _ */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* ` */ /* Lowercase alphabet. */ - { ISFUNC, (Function *)0x0 }, /* a */ - { ISFUNC, (Function *)0x0 }, /* b */ - { ISFUNC, (Function *)0x0 }, /* c */ - { ISFUNC, (Function *)0x0 }, /* d */ - { ISFUNC, rl_call_last_kbd_macro }, /* e */ - { ISFUNC, (Function *)0x0 }, /* f */ - { ISFUNC, (Function *)0x0 }, /* g */ - { ISFUNC, (Function *)0x0 }, /* h */ - { ISFUNC, (Function *)0x0 }, /* i */ - { ISFUNC, (Function *)0x0 }, /* j */ - { ISFUNC, (Function *)0x0 }, /* k */ - { ISFUNC, (Function *)0x0 }, /* l */ - { ISFUNC, (Function *)0x0 }, /* m */ - { ISFUNC, (Function *)0x0 }, /* n */ - { ISFUNC, (Function *)0x0 }, /* o */ - { ISFUNC, (Function *)0x0 }, /* p */ - { ISFUNC, (Function *)0x0 }, /* q */ - { ISFUNC, (Function *)0x0 }, /* r */ - { ISFUNC, (Function *)0x0 }, /* s */ - { ISFUNC, (Function *)0x0 }, /* t */ - { ISFUNC, (Function *)0x0 }, /* u */ - { ISFUNC, (Function *)0x0 }, /* v */ - { ISFUNC, (Function *)0x0 }, /* w */ - { ISFUNC, (Function *)0x0 }, /* x */ - { ISFUNC, (Function *)0x0 }, /* y */ - { ISFUNC, (Function *)0x0 }, /* z */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* a */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* b */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* c */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* d */ + { ISFUNC, rl_call_last_kbd_macro }, /* e */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* f */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* g */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* h */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* i */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* j */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* k */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* l */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* m */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* n */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* o */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* p */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* q */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* r */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* s */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* t */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* u */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* v */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* w */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* x */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* y */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* z */ /* Final punctuation. */ - { ISFUNC, (Function *)0x0 }, /* { */ - { ISFUNC, (Function *)0x0 }, /* | */ - { ISFUNC, (Function *)0x0 }, /* } */ - { ISFUNC, (Function *)0x0 }, /* ~ */ - { ISFUNC, rl_backward_kill_line }, /* RUBOUT */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* { */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* | */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* } */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* ~ */ + { ISFUNC, rl_backward_kill_line }, /* RUBOUT */ #if KEYMAP_SIZE > 128 /* Undefined keys. */ - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 } + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 } #endif /* KEYMAP_SIZE > 128 */ }; diff --git a/contrib/libreadline/examples/Makefile.in b/contrib/libreadline/examples/Makefile.in index 7246e75..1e90f8a 100644 --- a/contrib/libreadline/examples/Makefile.in +++ b/contrib/libreadline/examples/Makefile.in @@ -16,6 +16,7 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA. +RL_LIBRARY_VERSION = @LIBVERSION@ SHELL = @MAKE_SHELL@ RM = rm -f @@ -28,7 +29,7 @@ BUILD_DIR = . DEFS = @DEFS@ CC = @CC@ CFLAGS = @CFLAGS@ -LOCAL_CFLAGS = @LOCAL_CFLAGS@ -DREADLINE_LIBRARY +LOCAL_CFLAGS = @LOCAL_CFLAGS@ -DREADLINE_LIBRARY -DRL_LIBRARY_VERSION='"$(RL_LIBRARY_VERSION)"' CPPFLAGS = @CPPFLAGS@ INCLUDES = -I$(srcdir) -I$(top_srcdir) -I.. @@ -45,10 +46,11 @@ TERMCAP_LIB = @TERMCAP_LIB@ ${RM} $@ $(CC) $(CCFLAGS) -c $< -EXECUTABLES = fileman rltest rl rlversion -OBJECTS = fileman.o rltest.o rl.o rlversion.o +EXECUTABLES = fileman rltest rl rlversion histexamp +OBJECTS = fileman.o rltest.o rl.o rlversion.o histexamp.o all: $(EXECUTABLES) +everything: all rlfe rl: rl.o $(CC) $(LDFLAGS) -o $@ rl.o -lreadline $(TERMCAP_LIB) @@ -62,9 +64,13 @@ rltest: rltest.o rlversion: rlversion.o $(READLINE_LIB) $(CC) $(LDFLAGS) -o $@ rlversion.o -lreadline $(TERMCAP_LIB) +histexamp: histexamp.o $(HISTORY_LIB) + $(CC) $(LDFLAGS) -o $@ histexamp.o -lhistory $(TERMCAP_LIB) + clean mostlyclean: $(RM) $(OBJECTS) $(RM) $(EXECUTABLES) *.exe + $(RM) rlfe.o rlfe distclean maintainer-clean: clean $(RM) Makefile @@ -73,6 +79,13 @@ fileman.o: fileman.c rltest.o: rltest.c rl.o: rl.c rlversion.o: rlversion.c +histexamp.o: histexamp.c + +fileman.o: $(top_srcdir)/readline.h +rltest.o: $(top_srcdir)/readline.h +rl.o: $(top_srcdir)/readline.h +rlversion.o: $(top_srcdir)/readline.h +histexamp.o: $(top_srcdir)/history.h # Stuff for Per Bothner's `rlfe' program diff --git a/contrib/libreadline/examples/excallback.c b/contrib/libreadline/examples/excallback.c index ca03fc3..3d4bb18 100644 --- a/contrib/libreadline/examples/excallback.c +++ b/contrib/libreadline/examples/excallback.c @@ -153,6 +153,8 @@ process_line(char *line) } else { fprintf(stderr, "|%s|\n", line); } + + free (line); } int diff --git a/contrib/libreadline/examples/fileman.c b/contrib/libreadline/examples/fileman.c index dc29a40..e976848 100644 --- a/contrib/libreadline/examples/fileman.c +++ b/contrib/libreadline/examples/fileman.c @@ -41,15 +41,22 @@ extern char *xmalloc (); /* The names of functions that actually do the manipulation. */ -int com_list (), com_view (), com_rename (), com_stat (), com_pwd (); -int com_delete (), com_help (), com_cd (), com_quit (); +int com_list __P((char *)); +int com_view __P((char *)); +int com_rename __P((char *)); +int com_stat __P((char *)); +int com_pwd __P((char *)); +int com_delete __P((char *)); +int com_help __P((char *)); +int com_cd __P((char *)); +int com_quit __P((char *)); /* A structure which contains information on the commands this program can understand. */ typedef struct { char *name; /* User printable name of the function. */ - Function *func; /* Function to call to do the job. */ + rl_icpfunc_t *func; /* Function to call to do the job. */ char *doc; /* Documentation for this function. */ } COMMAND; @@ -65,7 +72,7 @@ COMMAND commands[] = { { "rename", com_rename, "Rename FILE to NEWNAME" }, { "stat", com_stat, "Print out statistics on FILE" }, { "view", com_view, "View the contents of FILE" }, - { (char *)NULL, (Function *)NULL, (char *)NULL } + { (char *)NULL, (rl_icpfunc_t *)NULL, (char *)NULL } }; /* Forward declarations. */ @@ -205,8 +212,8 @@ stripwhite (string) /* */ /* **************************************************************** */ -char *command_generator (); -char **fileman_completion (); +char *command_generator __P((const char *, int)); +char **fileman_completion __P((const char *, int, int)); /* Tell the GNU Readline library how to complete. We want to try to complete on command names if this is the first word in the line, or on filenames @@ -217,7 +224,7 @@ initialize_readline () rl_readline_name = "FileMan"; /* Tell the completer that we want a crack first. */ - rl_attempted_completion_function = (CPPFunction *)fileman_completion; + rl_attempted_completion_function = fileman_completion; } /* Attempt to complete on the contents of TEXT. START and END bound the @@ -227,7 +234,7 @@ initialize_readline () or NULL if there aren't any. */ char ** fileman_completion (text, start, end) - char *text; + const char *text; int start, end; { char **matches; @@ -238,7 +245,7 @@ fileman_completion (text, start, end) to complete. Otherwise it is the name of a file in the current directory. */ if (start == 0) - matches = completion_matches (text, command_generator); + matches = rl_completion_matches (text, command_generator); return (matches); } @@ -248,7 +255,7 @@ fileman_completion (text, start, end) start at the top of the list. */ char * command_generator (text, state) - char *text; + const char *text; int state; { static int list_index, len; diff --git a/contrib/libreadline/examples/histexamp.c b/contrib/libreadline/examples/histexamp.c index eceb66d..fa0de1b 100644 --- a/contrib/libreadline/examples/histexamp.c +++ b/contrib/libreadline/examples/histexamp.c @@ -1,4 +1,14 @@ -main () +#include + +#ifdef READLINE_LIBRARY +# include "history.h" +#else +# include +#endif + +main (argc, argv) + int argc; + char **argv; { char line[1024], *t; int len, done = 0; diff --git a/contrib/libreadline/examples/manexamp.c b/contrib/libreadline/examples/manexamp.c index 3496efa..132e2bf 100644 --- a/contrib/libreadline/examples/manexamp.c +++ b/contrib/libreadline/examples/manexamp.c @@ -3,10 +3,9 @@ #include #include - /* **************************************************************** */ /* */ -* How to Emulate gets () */ +/* How to Emulate gets () */ /* */ /* **************************************************************** */ @@ -82,13 +81,12 @@ invert_case_line (count, key) for (; start != end; start += direction) { - if (uppercase_p (rl_line_buffer[start])) - rl_line_buffer[start] = to_lower (rl_line_buffer[start]); - else if (lowercase_p (rl_line_buffer[start])) - rl_line_buffer[start] = to_upper (rl_line_buffer[start]); + if (_rl_uppercase_p (rl_line_buffer[start])) + rl_line_buffer[start] = _rl_to_lower (rl_line_buffer[start]); + else if (_rl_lowercase_p (rl_line_buffer[start])) + rl_line_buffer[start] = _rl_to_upper (rl_line_buffer[start]); } /* Move point to on top of the last character changed. */ rl_point = end - direction; } - diff --git a/contrib/libreadline/examples/rl.c b/contrib/libreadline/examples/rl.c index 2d1d17e..8636184 100644 --- a/contrib/libreadline/examples/rl.c +++ b/contrib/libreadline/examples/rl.c @@ -38,7 +38,7 @@ set_deftext () { rl_insert_text (deftext); deftext = (char *)NULL; - rl_startup_hook = (Function *)NULL; + rl_startup_hook = (rl_hook_func_t *)NULL; } return 0; } @@ -126,6 +126,6 @@ main (argc, argv) if (temp == 0) exit (1); - puts (temp); + printf ("%s\n", temp); exit (0); } diff --git a/contrib/libreadline/examples/rlfe.c b/contrib/libreadline/examples/rlfe.c index 5c3c8fd..d634d7c 100644 --- a/contrib/libreadline/examples/rlfe.c +++ b/contrib/libreadline/examples/rlfe.c @@ -64,6 +64,8 @@ #include #include #include +#include +#include #ifdef READLINE_LIBRARY # include "readline.h" @@ -81,6 +83,7 @@ #endif #ifndef HAVE_MEMMOVE +#ifndef memmove # if __GNUC__ > 1 # define memmove(d, s, n) __builtin_memcpy(d, s, n) # else @@ -89,8 +92,19 @@ #else # define memmove(d, s, n) memcpy(d, s, n) #endif +#endif + +#define APPLICATION_NAME "Rlfe" + +#ifndef errno +extern int errno; +#endif -#define APPLICATION_NAME "Fep" +extern int optind; +extern char *optarg; + +static char *progname; +static char *progversion; static int in_from_inferior_fd; static int out_to_inferior_fd; @@ -110,13 +124,15 @@ char echo_suppress_buffer[ECHO_SUPPRESS_MAX]; int echo_suppress_start = 0; int echo_suppress_limit = 0; -#define DEBUG +/* #define DEBUG */ + +static FILE *logfile = NULL; #ifdef DEBUG -FILE *logfile = NULL; -#define DPRINT0(FMT) (fprintf(logfile, FMT), fflush(logfile)) -#define DPRINT1(FMT, V1) (fprintf(logfile, FMT, V1), fflush(logfile)) -#define DPRINT2(FMT, V1, V2) (fprintf(logfile, FMT, V1, V2), fflush(logfile)) +FILE *debugfile = NULL; +#define DPRINT0(FMT) (fprintf(debugfile, FMT), fflush(debugfile)) +#define DPRINT1(FMT, V1) (fprintf(debugfile, FMT, V1), fflush(debugfile)) +#define DPRINT2(FMT, V1, V2) (fprintf(debugfile, FMT, V1, V2), fflush(debugfile)) #else #define DPRINT0(FMT) /* Do nothing */ #define DPRINT1(FMT, V1) /* Do nothing */ @@ -125,6 +141,10 @@ FILE *logfile = NULL; struct termios orig_term; +static int rlfe_directory_completion_hook __P((char **)); +static int rlfe_directory_rewrite_hook __P((char **)); +static char *rlfe_filename_completion_function __P((const char *, int)); + /* Pid of child process. */ static pid_t child = -1; @@ -370,13 +390,20 @@ my_rl_getc (FILE *dummy) return ch; } +static void +usage() +{ + fprintf (stderr, "%s: usage: %s [-l filename] [-a] [-n appname] [-hv] [command [arguments...]]\n", + progname, progname); +} + int main(int argc, char** argv) { char *path; - int i; + int i, append; int master; - char *name; + char *name, *logfname, *appname; int in_from_tty_fd; struct sigaction act; struct winsize ws; @@ -387,12 +414,58 @@ main(int argc, char** argv) char *prompt = empty_string; int ioctl_err = 0; + if ((progname = strrchr (argv[0], '/')) == 0) + progname = argv[0]; + else + progname++; + progversion = RL_LIBRARY_VERSION; + + append = 0; + appname = APPLICATION_NAME; + logfname = (char *)NULL; + + while ((i = getopt (argc, argv, "ahl:n:v")) != EOF) + { + switch (i) + { + case 'l': + logfname = optarg; + break; + case 'n': + appname = optarg; + break; + case 'a': + append = 1; + break; + case 'h': + usage (); + exit (0); + case 'v': + fprintf (stderr, "%s version %s\n", progname, progversion); + exit (0); + default: + usage (); + exit (2); + } + } + + argc -= optind; + argv += optind; + + if (logfname) + { + logfile = fopen (logfname, append ? "a" : "w"); + if (logfile == 0) + fprintf (stderr, "%s: warning: could not open log file %s: %s\n", + progname, logfname, strerror (errno)); + } + + rl_readline_name = appname; + #ifdef DEBUG - logfile = fopen("LOG", "w"); + debugfile = fopen("LOG", "w"); #endif - rl_readline_name = APPLICATION_NAME; - if ((master = get_master_pty(&name)) < 0) { perror("ptypair: could not open master pty"); @@ -486,10 +559,10 @@ main(int argc, char** argv) /* now start the shell */ { static char* command_args[] = { COMMAND_ARGS, NULL }; - if (argc <= 1) + if (argc < 1) execvp(COMMAND, command_args); else - execvp(argv[1], &argv[1]); + execvp(argv[0], &argv[0]); } /* should never be reached */ @@ -535,6 +608,13 @@ main(int argc, char** argv) rl_deprep_term_function = null_deprep_terminal; rl_callback_handler_install (prompt, line_handler); +#if 1 + rl_directory_completion_hook = rlfe_directory_completion_hook; + rl_completion_entry_function = rlfe_filename_completion_function; +#else + rl_directory_rewrite_hook = rlfe_directory_rewrite_hook; +#endif + in_from_tty_fd = STDIN_FILENO; FD_ZERO (&in_set); maxfd = in_from_inferior_fd > in_from_tty_fd ? in_from_inferior_fd @@ -644,6 +724,47 @@ main(int argc, char** argv) } old_count = buf_count; + /* Do some minimal carriage return translation and backspace + processing before logging the input line. */ + if (logfile) + { +#ifndef __GNUC__ + char *b; +#else + char b[count + 1]; +#endif + int i, j; + +#ifndef __GNUC__ + b = malloc (count + 1); + if (b) { +#endif + for (i = 0; i < count; i++) + b[i] = buf[buf_count + i]; + b[i] = '\0'; + for (i = j = 0; i <= count; i++) + { + if (b[i] == '\r') + { + if (b[i+1] != '\n') + b[j++] = '\n'; + } + else if (b[i] == '\b') + { + if (i) + j--; + } + else + b[j++] = b[i]; + } + fprintf (logfile, "%s", b); + +#ifndef __GNUC__ + free (b); + } +#endif + } + /* Look for any pending echo that we need to suppress. */ while (echo_suppress_start < echo_suppress_limit && count > 0 @@ -683,3 +804,239 @@ main(int argc, char** argv) } } } + +/* + * + * FILENAME COMPLETION FOR RLFE + * + */ + +#ifndef PATH_MAX +# define PATH_MAX 1024 +#endif + +#define DIRSEP '/' +#define ISDIRSEP(x) ((x) == '/') +#define PATHSEP(x) (ISDIRSEP(x) || (x) == 0) + +#define DOT_OR_DOTDOT(x) \ + ((x)[0] == '.' && (PATHSEP((x)[1]) || \ + ((x)[1] == '.' && PATHSEP((x)[2])))) + +#define FREE(x) if (x) free(x) + +#define STRDUP(s, x) do { \ + s = strdup (x);\ + if (s == 0) \ + return ((char *)NULL); \ + } while (0) + +static int +get_inferior_cwd (path, psize) + char *path; + size_t psize; +{ + int n; + static char procfsbuf[PATH_MAX] = { '\0' }; + + if (procfsbuf[0] == '\0') + sprintf (procfsbuf, "/proc/%d/cwd", (int)child); + n = readlink (procfsbuf, path, psize); + if (n < 0) + return n; + if (n > psize) + return -1; + path[n] = '\0'; + return n; +} + +static int +rlfe_directory_rewrite_hook (dirnamep) + char **dirnamep; +{ + char *ldirname, cwd[PATH_MAX], *retdir, *ld; + int n, ldlen; + + ldirname = *dirnamep; + + if (*ldirname == '/') + return 0; + + n = get_inferior_cwd (cwd, sizeof(cwd) - 1); + if (n < 0) + return 0; + if (n == 0) /* current directory */ + { + cwd[0] = '.'; + cwd[1] = '\0'; + n = 1; + } + + /* Minimally canonicalize ldirname by removing leading `./' */ + for (ld = ldirname; *ld; ) + { + if (ISDIRSEP (ld[0])) + ld++; + else if (ld[0] == '.' && PATHSEP(ld[1])) + ld++; + else + break; + } + ldlen = (ld && *ld) ? strlen (ld) : 0; + + retdir = (char *)malloc (n + ldlen + 3); + if (retdir == 0) + return 0; + if (ldlen) + sprintf (retdir, "%s/%s", cwd, ld); + else + strcpy (retdir, cwd); + free (ldirname); + + *dirnamep = retdir; + + DPRINT1("rl_directory_rewrite_hook returns %s\n", retdir); + return 1; +} + +/* Translate *DIRNAMEP to be relative to the inferior's CWD. Leave a trailing + slash on the result. */ +static int +rlfe_directory_completion_hook (dirnamep) + char **dirnamep; +{ + char *ldirname, *retdir; + int n, ldlen; + + ldirname = *dirnamep; + + if (*ldirname == '/') + return 0; + + n = rlfe_directory_rewrite_hook (dirnamep); + if (n == 0) + return 0; + + ldirname = *dirnamep; + ldlen = (ldirname && *ldirname) ? strlen (ldirname) : 0; + + if (ldlen == 0 || ldirname[ldlen - 1] != '/') + { + retdir = (char *)malloc (ldlen + 3); + if (retdir == 0) + return 0; + if (ldlen) + strcpy (retdir, ldirname); + else + retdir[ldlen++] = '.'; + retdir[ldlen] = '/'; + retdir[ldlen+1] = '\0'; + free (ldirname); + + *dirnamep = retdir; + } + + DPRINT1("rl_directory_completion_hook returns %s\n", retdir); + return 1; +} + +static char * +rlfe_filename_completion_function (text, state) + const char *text; + int state; +{ + static DIR *directory; + static char *filename = (char *)NULL; + static char *dirname = (char *)NULL, *ud = (char *)NULL; + static int flen, udlen; + char *temp; + struct dirent *dentry; + + if (state == 0) + { + if (directory) + { + closedir (directory); + directory = 0; + } + FREE (dirname); + FREE (filename); + FREE (ud); + + if (text && *text) + STRDUP (filename, text); + else + { + filename = malloc(1); + if (filename == 0) + return ((char *)NULL); + filename[0] = '\0'; + } + dirname = (text && *text) ? strdup (text) : strdup ("."); + if (dirname == 0) + return ((char *)NULL); + + temp = strrchr (dirname, '/'); + if (temp) + { + strcpy (filename, ++temp); + *temp = '\0'; + } + else + { + dirname[0] = '.'; + dirname[1] = '\0'; + } + + STRDUP (ud, dirname); + udlen = strlen (ud); + + rlfe_directory_completion_hook (&dirname); + + directory = opendir (dirname); + flen = strlen (filename); + + rl_filename_completion_desired = 1; + } + + dentry = 0; + while (directory && (dentry = readdir (directory))) + { + if (flen == 0) + { + if (DOT_OR_DOTDOT(dentry->d_name) == 0) + break; + } + else + { + if ((dentry->d_name[0] == filename[0]) && + (strlen (dentry->d_name) >= flen) && + (strncmp (filename, dentry->d_name, flen) == 0)) + break; + } + } + + if (dentry == 0) + { + if (directory) + { + closedir (directory); + directory = 0; + } + FREE (dirname); + FREE (filename); + FREE (ud); + dirname = filename = ud = 0; + return ((char *)NULL); + } + + if (ud == 0 || (ud[0] == '.' && ud[1] == '\0')) + temp = strdup (dentry->d_name); + else + { + temp = malloc (1 + udlen + strlen (dentry->d_name)); + strcpy (temp, ud); + strcpy (temp + udlen, dentry->d_name); + } + return (temp); +} diff --git a/contrib/libreadline/funmap.c b/contrib/libreadline/funmap.c index 1f7ba87..e09faf5 100644 --- a/contrib/libreadline/funmap.c +++ b/contrib/libreadline/funmap.c @@ -46,7 +46,7 @@ typedef int QSFUNC (const void *, const void *); typedef int QSFUNC (); #endif -extern int _rl_qsort_string_compare (); +extern int _rl_qsort_string_compare __P((char **, char **)); FUNMAP **funmap; static int funmap_size; @@ -108,7 +108,7 @@ static FUNMAP default_funmap[] = { { "non-incremental-reverse-search-history", rl_noninc_reverse_search }, { "non-incremental-forward-search-history-again", rl_noninc_forward_search_again }, { "non-incremental-reverse-search-history-again", rl_noninc_reverse_search_again }, -#ifdef __CYGWIN32__ +#ifdef __CYGWIN__ { "paste-from-clipboard", rl_paste_from_clipboard }, #endif { "possible-completions", rl_possible_completions }, @@ -142,7 +142,6 @@ static FUNMAP default_funmap[] = { { "vi-arg-digit", rl_vi_arg_digit }, { "vi-back-to-indent", rl_vi_back_to_indent }, { "vi-bWord", rl_vi_bWord }, - { "vi-bracktype", rl_vi_bracktype }, { "vi-bword", rl_vi_bword }, { "vi-change-case", rl_vi_change_case }, { "vi-change-char", rl_vi_change_char }, @@ -182,13 +181,13 @@ static FUNMAP default_funmap[] = { { "vi-yank-to", rl_vi_yank_to }, #endif /* VI_MODE */ - {(char *)NULL, (Function *)NULL } + {(char *)NULL, (rl_command_func_t *)NULL } }; int rl_add_funmap_entry (name, function) - char *name; - Function *function; + const char *name; + rl_command_func_t *function; { if (funmap_entry + 2 >= funmap_size) { @@ -225,21 +224,21 @@ rl_initialize_funmap () /* Produce a NULL terminated array of known function names. The array is sorted. The array itself is allocated, but not the strings inside. You should free () the array when you done, but not the pointrs. */ -char ** +const char ** rl_funmap_names () { - char **result; + const char **result; int result_size, result_index; /* Make sure that the function map has been initialized. */ rl_initialize_funmap (); - for (result_index = result_size = 0, result = (char **)NULL; funmap[result_index]; result_index++) + for (result_index = result_size = 0, result = (const char **)NULL; funmap[result_index]; result_index++) { if (result_index + 2 > result_size) { result_size += 20; - result = (char **)xrealloc (result, result_size * sizeof (char *)); + result = (const char **)xrealloc (result, result_size * sizeof (char *)); } result[result_index] = funmap[result_index]->name; @@ -249,12 +248,3 @@ rl_funmap_names () qsort (result, result_index, sizeof (char *), (QSFUNC *)_rl_qsort_string_compare); return (result); } - -/* Things that mean `Control'. */ -char *possible_control_prefixes[] = { - "Control-", "C-", "CTRL-", (char *)NULL -}; - -char *possible_meta_prefixes[] = { - "Meta", "M-", (char *)NULL -}; diff --git a/contrib/libreadline/histexpand.c b/contrib/libreadline/histexpand.c index 78da3e5..1c8a1d9 100644 --- a/contrib/libreadline/histexpand.c +++ b/contrib/libreadline/histexpand.c @@ -56,6 +56,8 @@ #define HISTORY_WORD_DELIMITERS " \t\n;&()|<>" #define HISTORY_QUOTE_CHARACTERS "\"'`" +typedef int _hist_search_func_t __P((const char *, int)); + static char error_pointer; static char *subst_lhs; @@ -91,9 +93,12 @@ char *history_no_expand_chars = " \t\n\r="; The default is 0. */ int history_quotes_inhibit_expansion = 0; +/* Used to split words by history_tokenize_internal. */ +char *history_word_delimiters = HISTORY_WORD_DELIMITERS; + /* If set, this points to a function that is called to verify that a particular history expansion should be performed. */ -Function *history_inhibit_expansion_function; +rl_linebuf_func_t *history_inhibit_expansion_function; /* **************************************************************** */ /* */ @@ -122,7 +127,7 @@ static char *search_match; line = get_history_event ("!echo:p", &index, 0); */ char * get_history_event (string, caller_index, delimiting_quote) - char *string; + const char *string; int *caller_index; int delimiting_quote; { @@ -130,7 +135,7 @@ get_history_event (string, caller_index, delimiting_quote) register char c; HIST_ENTRY *entry; int which, sign, local_index, substring_okay; - Function *search_func; + _hist_search_func_t *search_func; char *temp; /* The event can be specified in a number of ways. @@ -340,7 +345,8 @@ hist_error(s, start, current, errtype) char *s; int start, current, errtype; { - char *temp, *emsg; + char *temp; + const char *emsg; int ll, elen; ll = current - start; @@ -622,7 +628,7 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line) case '&': case 's': { - char *new_event, *t; + char *new_event; int delimiter, failed, si, l_temp; if (c == 's') @@ -741,7 +747,7 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line) char *x; if (want_quotes == 'q') - x = single_quote (temp); + x = sh_single_quote (temp); else if (want_quotes == 'x') x = quote_breaks (temp); else @@ -816,6 +822,9 @@ history_expand (hstring, output) /* Used when adding the string. */ char *temp; + if (output == 0) + return 0; + /* Setting the history expansion character to 0 inhibits all history expansion. */ if (history_expansion_char == 0) @@ -865,7 +874,7 @@ history_expand (hstring, output) history expansion performed on it. Skip the rest of the line and break out of the loop. */ if (history_comment_char && string[i] == history_comment_char && - (i == 0 || member (string[i - 1], HISTORY_WORD_DELIMITERS))) + (i == 0 || member (string[i - 1], history_word_delimiters))) { while (string[i]) i++; @@ -963,7 +972,7 @@ history_expand (hstring, output) } case -2: /* history_comment_char */ - if (i == 0 || member (string[i - 1], HISTORY_WORD_DELIMITERS)) + if (i == 0 || member (string[i - 1], history_word_delimiters)) { temp = xmalloc (l - i + 1); strcpy (temp, string + i); @@ -1151,7 +1160,7 @@ get_history_word_specifier (spec, from, caller_index) char * history_arg_extract (first, last, string) int first, last; - char *string; + const char *string; { register int i, len; char *result; @@ -1217,13 +1226,18 @@ history_arg_extract (first, last, string) *INDP. */ static char ** history_tokenize_internal (string, wind, indp) - char *string; + const char *string; int wind, *indp; { char **result; register int i, start, result_index, size; int len, delimiter; + /* If we're searching for a string that's not part of a word (e.g., " "), + make sure we set *INDP to a reasonable value. */ + if (indp && wind != -1) + *indp = -1; + /* Get a token, and stuff it into RESULT. The tokens are split exactly where the shell would split them. */ for (i = result_index = size = 0, result = (char **)NULL; string[i]; ) @@ -1298,7 +1312,7 @@ history_tokenize_internal (string, wind, indp) continue; } - if (!delimiter && (member (string[i], HISTORY_WORD_DELIMITERS))) + if (!delimiter && (member (string[i], history_word_delimiters))) break; if (!delimiter && member (string[i], HISTORY_QUOTE_CHARACTERS)) @@ -1328,7 +1342,7 @@ history_tokenize_internal (string, wind, indp) parsed out of STRING. */ char ** history_tokenize (string) - char *string; + const char *string; { return (history_tokenize_internal (string, -1, (int *)NULL)); } @@ -1345,7 +1359,7 @@ history_find_word (line, ind) int i, wind; words = history_tokenize_internal (line, ind, &wind); - if (wind == -1) + if (wind == -1 || words == 0) return ((char *)NULL); s = words[wind]; for (i = 0; i < wind; i++) diff --git a/contrib/libreadline/histfile.c b/contrib/libreadline/histfile.c index b908e22..c0582de 100644 --- a/contrib/libreadline/histfile.c +++ b/contrib/libreadline/histfile.c @@ -84,9 +84,10 @@ extern int errno; filename to read_history (), or write_history (). */ static char * history_filename (filename) - char *filename; + const char *filename; { - char *return_val, *home; + char *return_val; + const char *home; int home_len; return_val = filename ? savestring (filename) : (char *)NULL; @@ -94,7 +95,7 @@ history_filename (filename) if (return_val) return (return_val); - home = get_env_value ("HOME"); + home = sh_get_env_value ("HOME"); if (home == 0) { @@ -121,7 +122,7 @@ history_filename (filename) successful, or errno if not. */ int read_history (filename) - char *filename; + const char *filename; { return (read_history_range (filename, 0, -1)); } @@ -133,7 +134,7 @@ read_history (filename) ~/.history. Returns 0 if successful, or errno if not. */ int read_history_range (filename, from, to) - char *filename; + const char *filename; int from, to; { register int line_start, line_end; @@ -221,14 +222,15 @@ read_history_range (filename, from, to) } /* Truncate the history file FNAME, leaving only LINES trailing lines. - If FNAME is NULL, then use ~/.history. */ + If FNAME is NULL, then use ~/.history. Returns 0 on success, errno + on failure. */ int history_truncate_file (fname, lines) - char *fname; + const char *fname; int lines; { register int i; - int file, chars_read; + int file, chars_read, rv; char *buffer, *filename; struct stat finfo; size_t file_size; @@ -236,13 +238,27 @@ history_truncate_file (fname, lines) buffer = (char *)NULL; filename = history_filename (fname); file = open (filename, O_RDONLY|O_BINARY, 0666); + rv = 0; + /* Don't try to truncate non-regular files. */ if (file == -1 || fstat (file, &finfo) == -1) - goto truncate_exit; + { + rv = errno; + if (file != -1) + close (file); + goto truncate_exit; + } - /* Don't try to truncate non-regular files. */ - if (S_ISREG(finfo.st_mode) == 0) - goto truncate_exit; + if (S_ISREG (finfo.st_mode) == 0) + { + close (file); +#ifdef EFTYPE + rv = EFTYPE; +#else + rv = EINVAL; +#endif + goto truncate_exit; + } file_size = (size_t)finfo.st_size; @@ -251,7 +267,11 @@ history_truncate_file (fname, lines) { close (file); #if defined (EFBIG) - errno = EFBIG; + rv = errno = EFBIG; +#elif defined (EOVERFLOW) + rv = errno = EOVERFLOW; +#else + rv = errno = EINVAL; #endif goto truncate_exit; } @@ -261,7 +281,10 @@ history_truncate_file (fname, lines) close (file); if (chars_read <= 0) - goto truncate_exit; + { + rv = (chars_read < 0) ? errno : 0; + goto truncate_exit; + } /* Count backwards from the end of buffer until we have passed LINES lines. */ @@ -302,7 +325,7 @@ history_truncate_file (fname, lines) FREE (buffer); free (filename); - return 0; + return rv; } /* Workhorse function for writing history. Writes NELEMENT entries @@ -310,15 +333,16 @@ history_truncate_file (fname, lines) wish to replace FILENAME with the entries. */ static int history_do_write (filename, nelements, overwrite) - char *filename; + const char *filename; int nelements, overwrite; { register int i; char *output; - int file, mode; + int file, mode, rv; mode = overwrite ? O_WRONLY|O_CREAT|O_TRUNC|O_BINARY : O_WRONLY|O_APPEND|O_BINARY; output = history_filename (filename); + rv = 0; if ((file = open (output, mode, 0600)) == -1) { @@ -352,7 +376,8 @@ history_do_write (filename, nelements, overwrite) buffer[j++] = '\n'; } - write (file, buffer, buffer_size); + if (write (file, buffer, buffer_size) < 0) + rv = errno; free (buffer); } @@ -360,7 +385,7 @@ history_do_write (filename, nelements, overwrite) FREE (output); - return (0); + return (rv); } /* Append NELEMENT entries to FILENAME. The entries appended are from @@ -368,7 +393,7 @@ history_do_write (filename, nelements, overwrite) int append_history (nelements, filename) int nelements; - char *filename; + const char *filename; { return (history_do_write (filename, nelements, HISTORY_APPEND)); } @@ -378,7 +403,7 @@ append_history (nelements, filename) are as in read_history ().*/ int write_history (filename) - char *filename; + const char *filename; { return (history_do_write (filename, history_length, HISTORY_OVERWRITE)); } diff --git a/contrib/libreadline/histlib.h b/contrib/libreadline/histlib.h index 88a34d1..bc948b0 100644 --- a/contrib/libreadline/histlib.h +++ b/contrib/libreadline/histlib.h @@ -22,15 +22,6 @@ #if !defined (_HISTLIB_H_) #define _HISTLIB_H_ -/* Function pointers can be declared as (Function *)foo. */ -#if !defined (_FUNCTION_DEF) -# define _FUNCTION_DEF -typedef int Function (); -typedef void VFunction (); -typedef char *CPFunction (); -typedef char **CPPFunction (); -#endif /* _FUNCTION_DEF */ - #if !defined (STREQ) #define STREQ(a, b) (((a)[0] == (b)[0]) && (strcmp ((a), (b)) == 0)) #define STREQN(a, b, n) (((n) == 0) ? (1) \ diff --git a/contrib/libreadline/history.3 b/contrib/libreadline/history.3 new file mode 100644 index 0000000..93702b4 --- /dev/null +++ b/contrib/libreadline/history.3 @@ -0,0 +1,639 @@ +.\" +.\" MAN PAGE COMMENTS to +.\" +.\" Chet Ramey +.\" Information Network Services +.\" Case Western Reserve University +.\" chet@ins.CWRU.Edu +.\" +.\" Last Change: Tue Mar 6 12:50:54 EST 2001 +.\" +.TH HISTORY 3 "2001 Mar 6" "GNU History 4.2" +.\" +.\" File Name macro. This used to be `.PN', for Path Name, +.\" but Sun doesn't seem to like that very much. +.\" +.de FN +\fI\|\\$1\|\fP +.. +.ds lp \fR\|(\fP +.ds rp \fR\|)\fP +.\" FnN return-value fun-name N arguments +.de Fn1 +\fI\\$1\fP \fB\\$2\fP \\*(lp\fI\\$3\fP\\*(rp +.br +.. +.de Fn2 +.if t \fI\\$1\fP \fB\\$2\fP \\*(lp\fI\\$3,\|\\$4\fP\\*(rp +.if n \fI\\$1\fP \fB\\$2\fP \\*(lp\fI\\$3, \\$4\fP\\*(rp +.br +.. +.de Fn3 +.if t \fI\\$1\fP \fB\\$2\fP \\*(lp\fI\\$3,\|\\$4,\|\\$5\fP\|\\*(rp +.if n \fI\\$1\fP \fB\\$2\fP \\*(lp\fI\\$3, \\$4, \\$5\fP\\*(rp +.br +.. +.de Vb +\fI\\$1\fP \fB\\$2\fP +.br +.. +.SH NAME +history \- GNU History Library +.SH COPYRIGHT +.if t The GNU History Library is Copyright \(co 1989-2001 by the Free Software Foundation, Inc. +.if n The GNU History Library is Copyright (C) 1989-2001 by the Free Software Foundation, Inc. +.SH DESCRIPTION +Many programs read input from the user a line at a time. The GNU +History library is able to keep track of those lines, associate arbitrary +data with each line, and utilize information from previous lines in +composing new ones. +.PP +.SH "HISTORY EXPANSION" +.PP +The history library supports a history expansion feature that +is identical to the history expansion in +.BR bash. +This section describes what syntax features are available. +.PP +History expansions introduce words from the history list into +the input stream, making it easy to repeat commands, insert the +arguments to a previous command into the current input line, or +fix errors in previous commands quickly. +.PP +History expansion is usually performed immediately after a complete line +is read. +It takes place in two parts. +The first is to determine which line from the history list +to use during substitution. +The second is to select portions of that line for inclusion into +the current one. +The line selected from the history is the \fIevent\fP, +and the portions of that line that are acted upon are \fIwords\fP. +Various \fImodifiers\fP are available to manipulate the selected words. +The line is broken into words in the same fashion as \fBbash\fP +does when reading input, +so that several words that would otherwise be separated +are considered one word when surrounded by quotes (see the +description of \fBhistory_tokenize()\fP below). +History expansions are introduced by the appearance of the +history expansion character, which is \^\fB!\fP\^ by default. +Only backslash (\^\fB\e\fP\^) and single quotes can quote +the history expansion character. +.SS Event Designators +.PP +An event designator is a reference to a command line entry in the +history list. +.PP +.PD 0 +.TP +.B ! +Start a history substitution, except when followed by a +.BR blank , +newline, = or (. +.TP +.B !\fIn\fR +Refer to command line +.IR n . +.TP +.B !\-\fIn\fR +Refer to the current command line minus +.IR n . +.TP +.B !! +Refer to the previous command. This is a synonym for `!\-1'. +.TP +.B !\fIstring\fR +Refer to the most recent command starting with +.IR string . +.TP +.B !?\fIstring\fR\fB[?]\fR +Refer to the most recent command containing +.IR string . +The trailing \fB?\fP may be omitted if +.I string +is followed immediately by a newline. +.TP +.B \d\s+2^\s-2\u\fIstring1\fP\d\s+2^\s-2\u\fIstring2\fP\d\s+2^\s-2\u +Quick substitution. Repeat the last command, replacing +.I string1 +with +.IR string2 . +Equivalent to +``!!:s/\fIstring1\fP/\fIstring2\fP/'' +(see \fBModifiers\fP below). +.TP +.B !# +The entire command line typed so far. +.PD +.SS Word Designators +.PP +Word designators are used to select desired words from the event. +A +.B : +separates the event specification from the word designator. +It may be omitted if the word designator begins with a +.BR ^ , +.BR $ , +.BR * , +.BR \- , +or +.BR % . +Words are numbered from the beginning of the line, +with the first word being denoted by 0 (zero). +Words are inserted into the current line separated by single spaces. +.PP +.PD 0 +.TP +.B 0 (zero) +The zeroth word. For the shell, this is the command +word. +.TP +.I n +The \fIn\fRth word. +.TP +.B ^ +The first argument. That is, word 1. +.TP +.B $ +The last argument. +.TP +.B % +The word matched by the most recent `?\fIstring\fR?' search. +.TP +.I x\fB\-\fPy +A range of words; `\-\fIy\fR' abbreviates `0\-\fIy\fR'. +.TP +.B * +All of the words but the zeroth. This is a synonym +for `\fI1\-$\fP'. It is not an error to use +.B * +if there is just one +word in the event; the empty string is returned in that case. +.TP +.B x* +Abbreviates \fIx\-$\fP. +.TP +.B x\- +Abbreviates \fIx\-$\fP like \fBx*\fP, but omits the last word. +.PD +.PP +If a word designator is supplied without an event specification, the +previous command is used as the event. +.SS Modifiers +.PP +After the optional word designator, there may appear a sequence of +one or more of the following modifiers, each preceded by a `:'. +.PP +.PD 0 +.PP +.TP +.B h +Remove a trailing file name component, leaving only the head. +.TP +.B t +Remove all leading file name components, leaving the tail. +.TP +.B r +Remove a trailing suffix of the form \fI.xxx\fP, leaving the +basename. +.TP +.B e +Remove all but the trailing suffix. +.TP +.B p +Print the new command but do not execute it. +.TP +.B q +Quote the substituted words, escaping further substitutions. +.TP +.B x +Quote the substituted words as with +.BR q , +but break into words at +.B blanks +and newlines. +.TP +.B s/\fIold\fP/\fInew\fP/ +Substitute +.I new +for the first occurrence of +.I old +in the event line. Any delimiter can be used in place of /. The +final delimiter is optional if it is the last character of the +event line. The delimiter may be quoted in +.I old +and +.I new +with a single backslash. If & appears in +.IR new , +it is replaced by +.IR old . +A single backslash will quote the &. If +.I old +is null, it is set to the last +.I old +substituted, or, if no previous history substitutions took place, +the last +.I string +in a +.B !?\fIstring\fR\fB[?]\fR +search. +.TP +.B & +Repeat the previous substitution. +.TP +.B g +Cause changes to be applied over the entire event line. This is +used in conjunction with `\fB:s\fP' (e.g., `\fB:gs/\fIold\fP/\fInew\fP/\fR') +or `\fB:&\fP'. If used with +`\fB:s\fP', any delimiter can be used +in place of /, and the final delimiter is optional +if it is the last character of the event line. +.PD +.SH "PROGRAMMING WITH HISTORY FUNCTIONS" +This section describes how to use the History library in other programs. +.SS Introduction to History +.PP +The programmer using the History library has available functions +for remembering lines on a history list, associating arbitrary data +with a line, removing lines from the list, searching through the list +for a line containing an arbitrary text string, and referencing any line +in the list directly. In addition, a history \fIexpansion\fP function +is available which provides for a consistent user interface across +different programs. +.PP +The user using programs written with the History library has the +benefit of a consistent user interface with a set of well-known +commands for manipulating the text of previous lines and using that text +in new commands. The basic history manipulation commands are +identical to +the history substitution provided by \fBbash\fP. +.PP +If the programmer desires, he can use the Readline library, which +includes some history manipulation by default, and has the added +advantage of command line editing. +.PP +Before declaring any functions using any functionality the History +library provides in other code, an application writer should include +the file +.FN +in any file that uses the +History library's features. It supplies extern declarations for all +of the library's public functions and variables, and declares all of +the public data structures. + +.SS History Storage +.PP +The history list is an array of history entries. A history entry is +declared as follows: +.PP +.Vb "typedef void *" histdata_t; +.PP +.nf +typedef struct _hist_entry { + char *line; + histdata_t data; +} HIST_ENTRY; +.fi +.PP +The history list itself might therefore be declared as +.PP +.Vb "HIST_ENTRY **" the_history_list; +.PP +The state of the History library is encapsulated into a single structure: +.PP +.nf +/* + * A structure used to pass around the current state of the history. + */ +typedef struct _hist_state { + HIST_ENTRY **entries; /* Pointer to the entries themselves. */ + int offset; /* The location pointer within this array. */ + int length; /* Number of elements within this array. */ + int size; /* Number of slots allocated to this array. */ + int flags; +} HISTORY_STATE; +.fi +.PP +If the flags member includes \fBHS_STIFLED\fP, the history has been +stifled. +.SH "History Functions" +.PP +This section describes the calling sequence for the various functions +exported by the GNU History library. +.SS Initializing History and State Management +This section describes functions used to initialize and manage +the state of the History library when you want to use the history +functions in your program. + +.Fn1 void using_history void +Begin a session in which the history functions might be used. This +initializes the interactive variables. + +.Fn1 "HISTORY_STATE *" history_get_history_state void +Return a structure describing the current state of the input history. + +.Fn1 void history_set_history_state "HISTORY_STATE *state" +Set the state of the history list according to \fIstate\fP. + +.SS History List Management + +These functions manage individual entries on the history list, or set +parameters managing the list itself. + +.Fn1 void add_history "const char *string" +Place \fIstring\fP at the end of the history list. The associated data +field (if any) is set to \fBNULL\fP. + +.Fn1 "HIST_ENTRY *" remove_history "int which" +Remove history entry at offset \fIwhich\fP from the history. The +removed element is returned so you can free the line, data, +and containing structure. + +.Fn3 "HIST_ENTRY *" replace_history_entry "int which" "const char *line" "histdata_t data" +Make the history entry at offset \fIwhich\fP have \fIline\fP and \fIdata\fP. +This returns the old entry so you can dispose of the data. In the case +of an invalid \fIwhich\fP, a \fBNULL\fP pointer is returned. + +.Fn1 void clear_history "void" +Clear the history list by deleting all the entries. + +.Fn1 void stifle_history "int max" +Stifle the history list, remembering only the last \fImax\fP entries. + +.Fn1 int unstifle_history "void" +Stop stifling the history. This returns the previous amount the +history was stifled. The value is positive if the history was +stifled, negative if it wasn't. + +.Fn1 int history_is_stifled "void" +Returns non-zero if the history is stifled, zero if it is not. + +.SS Information About the History List + +These functions return information about the entire history list or +individual list entries. + +.Fn1 "HIST_ENTRY **" history_list "void" +Return a \fBNULL\fP terminated array of \fIHIST_ENTRY *\fP which is the +current input history. Element 0 of this list is the beginning of time. +If there is no history, return \fBNULL\fP. + +.Fn1 int where_history "void" +Returns the offset of the current history element. + +.Fn1 "HIST_ENTRY *" current_history "void" +Return the history entry at the current position, as determined by +\fBwhere_history()\fP. If there is no entry there, return a \fBNULL\fP +pointer. + +.Fn1 "HIST_ENTRY *" history_get "int offset" +Return the history entry at position \fIoffset\fP, starting from +\fBhistory_base\fP. +If there is no entry there, or if \fIoffset\fP +is greater than the history length, return a \fBNULL\fP pointer. + +.Fn1 int history_total_bytes "void" +Return the number of bytes that the primary history entries are using. +This function returns the sum of the lengths of all the lines in the +history. + +.SS Moving Around the History List + +These functions allow the current index into the history list to be +set or changed. + +.Fn1 int history_set_pos "int pos" +Set the current history offset to \fIpos\fP, an absolute index +into the list. +Returns 1 on success, 0 if \fIpos\fP is less than zero or greater +than the number of history entries. + +.Fn1 "HIST_ENTRY *" previous_history "void" +Back up the current history offset to the previous history entry, and +return a pointer to that entry. If there is no previous entry, return +a \fBNULL\fP pointer. + +.Fn1 "HIST_ENTRY *" next_history "void" +Move the current history offset forward to the next history entry, and +return the a pointer to that entry. If there is no next entry, return +a \fBNULL\fP pointer. + +.SS Searching the History List + +These functions allow searching of the history list for entries containing +a specific string. Searching may be performed both forward and backward +from the current history position. The search may be \fIanchored\fP, +meaning that the string must match at the beginning of the history entry. + +.Fn2 int history_search "const char *string" "int direction" +Search the history for \fIstring\fP, starting at the current history offset. +If \fIdirection\fP is less than 0, then the search is through +previous entries, otherwise through subsequent entries. +If \fIstring\fP is found, then +the current history index is set to that history entry, and the value +returned is the offset in the line of the entry where +\fIstring\fP was found. Otherwise, nothing is changed, and a -1 is +returned. + +.Fn2 int history_search_prefix "const char *string" "int direction" +Search the history for \fIstring\fP, starting at the current history +offset. The search is anchored: matching lines must begin with +\fIstring\fP. If \fIdirection\fP is less than 0, then the search is +through previous entries, otherwise through subsequent entries. +If \fIstring\fP is found, then the +current history index is set to that entry, and the return value is 0. +Otherwise, nothing is changed, and a -1 is returned. + +.Fn3 int history_search_pos "const char *string" "int direction" "int pos" +Search for \fIstring\fP in the history list, starting at \fIpos\fP, an +absolute index into the list. If \fIdirection\fP is negative, the search +proceeds backward from \fIpos\fP, otherwise forward. Returns the absolute +index of the history element where \fIstring\fP was found, or -1 otherwise. + +.SS Managing the History File +The History library can read the history from and write it to a file. +This section documents the functions for managing a history file. + +.Fn1 int read_history "const char *filename" +Add the contents of \fIfilename\fP to the history list, a line at a time. +If \fIfilename\fP is \fBNULL\fP, then read from \fI~/.history\fP. +Returns 0 if successful, or \fBerrno\fP if not. + +.Fn3 int read_history_range "const char *filename" "int from" "int to" +Read a range of lines from \fIfilename\fP, adding them to the history list. +Start reading at line \fIfrom\fP and end at \fIto\fP. +If \fIfrom\fP is zero, start at the beginning. If \fIto\fP is less than +\fIfrom\fP, then read until the end of the file. If \fIfilename\fP is +\fBNULL\fP, then read from \fI~/.history\fP. Returns 0 if successful, +or \fBerrno\fP if not. + +.Fn1 int write_history "const char *filename" +Write the current history to \fIfilename\fP, overwriting \fIfilename\fP +if necessary. +If \fIfilename\fP is \fBNULL\fP, then write the history list to \fI~/.history\fP. +Returns 0 on success, or \fBerrno\fP on a read or write error. + + +.Fn2 int append_history "int nelements" "const char *filename" +Append the last \fInelements\fP of the history list to \fIfilename\fP. +If \fIfilename\fP is \fBNULL\fP, then append to \fI~/.history\fP. +Returns 0 on success, or \fBerrno\fP on a read or write error. + +.Fn2 int history_truncate_file "const char *filename" "int nlines" +Truncate the history file \fIfilename\fP, leaving only the last +\fInlines\fP lines. +If \fIfilename\fP is \fBNULL\fP, then \fI~/.history\fP is truncated. +Returns 0 on success, or \fBerrno\fP on failure. + +.SS History Expansion + +These functions implement history expansion. + +.Fn2 int history_expand "char *string" "char **output" +Expand \fIstring\fP, placing the result into \fIoutput\fP, a pointer +to a string. Returns: +.RS +.PD 0 +.TP +0 +If no expansions took place (or, if the only change in +the text was the removal of escape characters preceding the history expansion +character); +.TP +1 +if expansions did take place; +.TP +-1 +if there was an error in expansion; +.TP +2 +if the returned line should be displayed, but not executed, +as with the \fB:p\fP modifier. +.PD +.RE +If an error ocurred in expansion, then \fIoutput\fP contains a descriptive +error message. + +.Fn3 "char *" get_history_event "const char *string" "int *cindex" "int qchar" +Returns the text of the history event beginning at \fIstring\fP + +\fI*cindex\fP. \fI*cindex\fP is modified to point to after the event +specifier. At function entry, \fIcindex\fP points to the index into +\fIstring\fP where the history event specification begins. \fIqchar\fP +is a character that is allowed to end the event specification in addition +to the ``normal'' terminating characters. + +.Fn1 "char **" history_tokenize "const char *string" +Return an array of tokens parsed out of \fIstring\fP, much as the +shell might. +The tokens are split on the characters in the +\fBhistory_word_delimiters\fP variable, +and shell quoting conventions are obeyed. + +.Fn3 "char *" history_arg_extract "int first" "int last" "const char *string" +Extract a string segment consisting of the \fIfirst\fP through \fIlast\fP +arguments present in \fIstring\fP. Arguments are split using +\fBhistory_tokenize()\fP. + +.SS History Variables + +This section describes the externally-visible variables exported by +the GNU History Library. + +.Vb int history_base +The logical offset of the first entry in the history list. + +.Vb int history_length +The number of entries currently stored in the history list. + +.Vb int history_max_entries +The maximum number of history entries. This must be changed using +\fBstifle_history()\fP. + +.Vb char history_expansion_char +The character that introduces a history event. The default is \fB!\fP. +Setting this to 0 inhibits history expansion. + +.Vb char history_subst_char +The character that invokes word substitution if found at the start of +a line. The default is \fB^\fP. + +.Vb char history_comment_char +During tokenization, if this character is seen as the first character +of a word, then it and all subsequent characters up to a newline are +ignored, suppressing history expansion for the remainder of the line. +This is disabled by default. + +.Vb "char *" history_word_delimiters +The characters that separate tokens for \fBhistory_tokenize()\fP. +The default value is \fB"\ \et\en()<>;&|"\fP. + +.Vb "char *" history_no_expand_chars +The list of characters which inhibit history expansion if found immediately +following \fBhistory_expansion_char\fP. The default is space, tab, newline, +\fB\er\fP, and \fB=\fP. + +.Vb "char *" history_search_delimiter_chars +The list of additional characters which can delimit a history search +string, in addition to space, tab, \fI:\fP and \fI?\fP in the case of +a substring search. The default is empty. + +.Vb int history_quotes_inhibit_expansion +If non-zero, single-quoted words are not scanned for the history expansion +character. The default value is 0. + +.Vb "rl_linebuf_func_t *" history_inhibit_expansion_function +This should be set to the address of a function that takes two arguments: +a \fBchar *\fP (\fIstring\fP) +and an \fBint\fP index into that string (\fIi\fP). +It should return a non-zero value if the history expansion starting at +\fIstring[i]\fP should not be performed; zero if the expansion should +be done. +It is intended for use by applications like \fBbash\fP that use the history +expansion character for additional purposes. +By default, this variable is set to \fBNULL\fP. +.SH FILES +.PD 0 +.TP +.FN ~/.history +Default filename for reading and writing saved history +.PD +.SH "SEE ALSO" +.PD 0 +.TP +\fIThe Gnu Readline Library\fP, Brian Fox and Chet Ramey +.TP +\fIThe Gnu History Library\fP, Brian Fox and Chet Ramey +.TP +\fIbash\fP(1) +.TP +\fIreadline\fP(3) +.PD +.SH AUTHORS +Brian Fox, Free Software Foundation +.br +bfox@gnu.org +.PP +Chet Ramey, Case Western Reserve University +.br +chet@ins.CWRU.Edu +.SH BUG REPORTS +If you find a bug in the +.B history +library, you should report it. But first, you should +make sure that it really is a bug, and that it appears in the latest +version of the +.B history +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. +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 +newsgroup +.BR gnu.bash.bug . +.PP +Comments and bug reports concerning +this manual page should be directed to +.IR chet@ins.CWRU.Edu . diff --git a/contrib/libreadline/history.c b/contrib/libreadline/history.c index 400f18b..d59d8ce 100644 --- a/contrib/libreadline/history.c +++ b/contrib/libreadline/history.c @@ -73,7 +73,8 @@ static int history_stifled; /* If HISTORY_STIFLED is non-zero, then this is the maximum number of entries to remember. */ -int max_input_history; +int history_max_entries; +int max_input_history; /* backwards compatibility */ /* The current location of the interactive history pointer. Just makes life easier for outside callers. */ @@ -134,9 +135,7 @@ history_total_bytes () { register int i, result; - result = 0; - - for (i = 0; the_history && the_history[i]; i++) + for (i = result = 0; the_history && the_history[i]; i++) result += strlen (the_history[i]->line); return (result); @@ -217,16 +216,16 @@ history_get (offset) is set to NULL. */ void add_history (string) - char *string; + const char *string; { HIST_ENTRY *temp; - if (history_stifled && (history_length == max_input_history)) + if (history_stifled && (history_length == history_max_entries)) { register int i; /* If the history is stifled, and history_length is zero, - and it equals max_input_history, we don't save items. */ + and it equals history_max_entries, we don't save items. */ if (history_length == 0) return; @@ -277,15 +276,15 @@ add_history (string) HIST_ENTRY * replace_history_entry (which, line, data) int which; - char *line; + const char *line; histdata_t data; { - HIST_ENTRY *temp = (HIST_ENTRY *)xmalloc (sizeof (HIST_ENTRY)); - HIST_ENTRY *old_value; + HIST_ENTRY *temp, *old_value; if (which >= history_length) return ((HIST_ENTRY *)NULL); + temp = (HIST_ENTRY *)xmalloc (sizeof (HIST_ENTRY)); old_value = the_history[which]; temp->line = savestring (line); @@ -303,12 +302,12 @@ remove_history (which) int which; { HIST_ENTRY *return_value; + register int i; if (which >= history_length || !history_length) return_value = (HIST_ENTRY *)NULL; else { - register int i; return_value = the_history[which]; for (i = which; i < history_length; i++) @@ -325,13 +324,13 @@ void stifle_history (max) int max; { + register int i, j; + if (max < 0) max = 0; if (history_length > max) { - register int i, j; - /* This loses because we cannot free the data. */ for (i = 0, j = history_length - max; i < j; i++) { @@ -347,7 +346,7 @@ stifle_history (max) } history_stifled = 1; - max_input_history = max; + max_input_history = history_max_entries = max; } /* Stop stifling the history. This returns the previous amount the @@ -359,10 +358,10 @@ unstifle_history () if (history_stifled) { history_stifled = 0; - return (-max_input_history); + return (-history_max_entries); } - return (max_input_history); + return (history_max_entries); } int diff --git a/contrib/libreadline/history.h b/contrib/libreadline/history.h index 5210deb..947902e 100644 --- a/contrib/libreadline/history.h +++ b/contrib/libreadline/history.h @@ -28,16 +28,10 @@ extern "C" { #if defined READLINE_LIBRARY # include "rlstdc.h" +# include "rltypedefs.h" #else # include -#endif - -#if !defined (_FUNCTION_DEF) -# define _FUNCTION_DEF -typedef int Function (); -typedef void VFunction (); -typedef char *CPFunction (); -typedef char **CPPFunction (); +# include #endif #ifdef __STDC__ @@ -80,7 +74,7 @@ extern void history_set_history_state __P((HISTORY_STATE *)); /* Place STRING at the end of the history list. The associated data field (if any) is set to NULL. */ -extern void add_history __P((char *)); +extern void add_history __P((const char *)); /* A reasonably useless function, only here for completeness. WHICH is the magic number that tells us which element to delete. The @@ -90,7 +84,7 @@ extern HIST_ENTRY *remove_history __P((int)); /* Make the history entry at WHICH have LINE and DATA. This returns the old entry so you can dispose of the data. In the case of an invalid WHICH, a NULL pointer is returned. */ -extern HIST_ENTRY *replace_history_entry __P((int, char *, histdata_t)); +extern HIST_ENTRY *replace_history_entry __P((int, const char *, histdata_t)); /* Clear the history list and start over. */ extern void clear_history __P((void)); @@ -152,45 +146,45 @@ extern HIST_ENTRY *next_history __P((void)); current_history () is the history entry, and the value of this function is the offset in the line of that history entry that the string was found in. Otherwise, nothing is changed, and a -1 is returned. */ -extern int history_search __P((char *, int)); +extern int history_search __P((const char *, int)); /* Search the history for STRING, starting at history_offset. The search is anchored: matching lines must begin with string. DIRECTION is as in history_search(). */ -extern int history_search_prefix __P((char *, int)); +extern int history_search_prefix __P((const char *, int)); /* Search for STRING in the history list, starting at POS, an absolute index into the list. DIR, if negative, says to search backwards from POS, else forwards. Returns the absolute index of the history element where STRING was found, or -1 otherwise. */ -extern int history_search_pos __P((char *, int, int)); +extern int history_search_pos __P((const char *, int, int)); /* Managing the history file. */ /* Add the contents of FILENAME to the history list, a line at a time. If FILENAME is NULL, then read from ~/.history. Returns 0 if successful, or errno if not. */ -extern int read_history __P((char *)); +extern int read_history __P((const char *)); /* Read a range of lines from FILENAME, adding them to the history list. Start reading at the FROM'th line and end at the TO'th. If FROM is zero, start at the beginning. If TO is less than FROM, read until the end of the file. If FILENAME is NULL, then read from ~/.history. Returns 0 if successful, or errno if not. */ -extern int read_history_range __P((char *, int, int)); +extern int read_history_range __P((const char *, int, int)); /* Write the current history to FILENAME. If FILENAME is NULL, then write the history list to ~/.history. Values returned are as in read_history (). */ -extern int write_history __P((char *)); +extern int write_history __P((const char *)); /* Append NELEMENT entries to FILENAME. The entries appended are from the end of the list minus NELEMENTs up to the end of the list. */ -extern int append_history __P((int, char *)); +extern int append_history __P((int, const char *)); /* Truncate the history file, leaving only the last NLINES lines. */ -extern int history_truncate_file __P((char *, int)); +extern int history_truncate_file __P((const char *, int)); /* History expansion. */ @@ -211,7 +205,7 @@ extern int history_expand __P((char *, char **)); /* Extract a string segment consisting of the FIRST through LAST arguments present in STRING. Arguments are broken up as in the shell. */ -extern char *history_arg_extract __P((int, int, char *)); +extern char *history_arg_extract __P((int, int, const char *)); /* Return the text of the history event beginning at the current offset into STRING. Pass STRING with *INDEX equal to the @@ -219,27 +213,31 @@ extern char *history_arg_extract __P((int, int, char *)); DELIMITING_QUOTE is a character that is allowed to end the string specification for what to search for in addition to the normal characters `:', ` ', `\t', `\n', and sometimes `?'. */ -extern char *get_history_event __P((char *, int *, int)); +extern char *get_history_event __P((const char *, int *, int)); /* Return an array of tokens, much as the shell might. The tokens are parsed out of STRING. */ -extern char **history_tokenize __P((char *)); +extern char **history_tokenize __P((const char *)); /* Exported history variables. */ extern int history_base; extern int history_length; -extern int max_input_history; +extern int history_max_entries; extern char history_expansion_char; extern char history_subst_char; +extern char *history_word_delimiters; extern char history_comment_char; extern char *history_no_expand_chars; extern char *history_search_delimiter_chars; extern int history_quotes_inhibit_expansion; +/* Backwards compatibility */ +extern int max_input_history; + /* If set, this function is called to decide whether or not a particular history expansion should be treated as a special case for the calling application and not expanded. */ -extern Function *history_inhibit_expansion_function; +extern rl_linebuf_func_t *history_inhibit_expansion_function; #ifdef __cplusplus } diff --git a/contrib/libreadline/histsearch.c b/contrib/libreadline/histsearch.c index 8d153b6..ff4f3a1 100644 --- a/contrib/libreadline/histsearch.c +++ b/contrib/libreadline/histsearch.c @@ -63,7 +63,7 @@ char *history_search_delimiter_chars = (char *)NULL; static int history_search_internal (string, direction, anchored) - char *string; + const char *string; int direction, anchored; { register int i, reverse; @@ -159,7 +159,7 @@ history_search_internal (string, direction, anchored) /* Do a non-anchored search for STRING through the history in DIRECTION. */ int history_search (string, direction) - char *string; + const char *string; int direction; { return (history_search_internal (string, direction, NON_ANCHORED_SEARCH)); @@ -168,7 +168,7 @@ history_search (string, direction) /* Do an anchored search for string through the history in DIRECTION. */ int history_search_prefix (string, direction) - char *string; + const char *string; int direction; { return (history_search_internal (string, direction, ANCHORED_SEARCH)); @@ -179,7 +179,7 @@ history_search_prefix (string, direction) which point to begin searching. */ int history_search_pos (string, dir, pos) - char *string; + const char *string; int dir, pos; { int ret, old; diff --git a/contrib/libreadline/input.c b/contrib/libreadline/input.c index 64a55c6..e5af52d 100644 --- a/contrib/libreadline/input.c +++ b/contrib/libreadline/input.c @@ -78,9 +78,11 @@ extern int errno; /* Non-null means it is a pointer to a function to run while waiting for character input. */ -Function *rl_event_hook = (Function *)NULL; +rl_hook_func_t *rl_event_hook = (rl_hook_func_t *)NULL; -Function *rl_getc_function = rl_getc; +rl_getc_func_t *rl_getc_function = rl_getc; + +static int _keyboard_input_timeout = 100000; /* 0.1 seconds; it's in usec */ /* **************************************************************** */ /* */ @@ -169,7 +171,7 @@ rl_gather_tyi () FD_SET (tty, &readfds); FD_SET (tty, &exceptfds); timeout.tv_sec = 0; - timeout.tv_usec = 100000; /* 0.1 seconds */ + timeout.tv_usec = _keyboard_input_timeout; if (select (tty + 1, &readfds, (fd_set *)NULL, &exceptfds, &timeout) <= 0) return; /* Nothing to read. */ #endif @@ -222,6 +224,18 @@ rl_gather_tyi () } } +int +rl_set_keyboard_input_timeout (u) + int u; +{ + int o; + + o = _keyboard_input_timeout; + if (u > 0) + _keyboard_input_timeout = u; + return (o); +} + /* Is there input available to be read on the readline input file descriptor? Only works if the system has select(2) or FIONREAD. */ int @@ -244,7 +258,7 @@ _rl_input_available () FD_SET (tty, &readfds); FD_SET (tty, &exceptfds); timeout.tv_sec = 0; - timeout.tv_usec = 100000; /* 0.1 seconds */ + timeout.tv_usec = _keyboard_input_timeout; return (select (tty + 1, &readfds, (fd_set *)NULL, &exceptfds, &timeout) > 0); #endif @@ -293,6 +307,7 @@ rl_stuff_char (key) { key = NEWLINE; rl_pending_input = EOF; + RL_SETSTATE (RL_STATE_INPUTPENDING); } ibuffer[push_index++] = key; if (push_index >= ibuffer_len) @@ -307,6 +322,16 @@ rl_execute_next (c) int c; { rl_pending_input = c; + RL_SETSTATE (RL_STATE_INPUTPENDING); + return 0; +} + +/* Clear any pending input pushed with rl_execute_next() */ +int +rl_clear_pending_input () +{ + rl_pending_input = 0; + RL_UNSETSTATE (RL_STATE_INPUTPENDING); return 0; } @@ -327,7 +352,7 @@ rl_read_key () if (rl_pending_input) { c = rl_pending_input; - rl_pending_input = 0; + rl_clear_pending_input (); } else { @@ -341,6 +366,8 @@ rl_read_key () while (rl_event_hook && rl_get_char (&c) == 0) { (*rl_event_hook) (); + if (rl_done) /* XXX - experimental */ + return ('\n'); rl_gather_tyi (); } } @@ -392,7 +419,7 @@ rl_getc (stream) if (errno == X_EWOULDBLOCK || errno == X_EAGAIN) { - if (unset_nodelay_mode (fileno (stream)) < 0) + if (sh_unset_nodelay_mode (fileno (stream)) < 0) return (EOF); continue; } diff --git a/contrib/libreadline/isearch.c b/contrib/libreadline/isearch.c index 952c10d..f8d7695 100644 --- a/contrib/libreadline/isearch.c +++ b/contrib/libreadline/isearch.c @@ -55,7 +55,7 @@ unsigned char *_rl_isearch_terminators = (unsigned char *)NULL; /* Variables imported from other files in the readline library. */ -extern HIST_ENTRY *saved_line_for_history; +extern HIST_ENTRY *_rl_saved_line_for_history; /* Forward declarations */ static int rl_search_history __P((int, int)); @@ -64,6 +64,8 @@ static int rl_search_history __P((int, int)); identical lines many times in a row. */ static char *prev_line_found; +static unsigned char *default_isearch_terminators = "\033\012"; + /* Search backwards through the history looking for a string which is typed interactively. Start with the current line. */ int @@ -176,6 +178,7 @@ rl_search_history (direction, invoking_key) been set, we use that value, otherwise we use ESC and C-J. */ unsigned char *isearch_terminators; + RL_SETSTATE(RL_STATE_ISEARCH); orig_point = rl_point; last_found_line = orig_line = where_history (); reverse = direction < 0; @@ -183,10 +186,10 @@ rl_search_history (direction, invoking_key) allocated_line = (char *)NULL; isearch_terminators = _rl_isearch_terminators ? _rl_isearch_terminators - : (unsigned char *)"\033\012"; + : default_isearch_terminators; /* Create an arrary of pointers to the lines that we want to search. */ - maybe_replace_line (); + rl_maybe_replace_line (); i = 0; if (hlist) for (i = 0; hlist[i]; i++); @@ -197,8 +200,8 @@ rl_search_history (direction, invoking_key) for (i = 0; i < hlen; i++) lines[i] = hlist[i]->line; - if (saved_line_for_history) - lines[i] = saved_line_for_history->line; + if (_rl_saved_line_for_history) + lines[i] = _rl_saved_line_for_history->line; else { /* Keep track of this so we can free it. */ @@ -232,10 +235,12 @@ rl_search_history (direction, invoking_key) found = failed = 0; for (;;) { - Function *f = (Function *)NULL; + rl_command_func_t *f = (rl_command_func_t *)NULL; /* Read a key and decide how to proceed. */ + RL_SETSTATE(RL_STATE_MOREINPUT); c = rl_read_key (); + RL_UNSETSTATE(RL_STATE_MOREINPUT); if (_rl_keymap[c].type == ISFUNC) { @@ -273,6 +278,8 @@ rl_search_history (direction, invoking_key) if (c >= 0 && (CTRL_CHAR (c) || META_CHAR (c) || c == RUBOUT) && c != CTRL ('G')) { + /* This sets rl_pending_input to c; it will be picked up the next + time rl_read_key is called. */ rl_execute_next (c); break; } @@ -287,7 +294,7 @@ rl_search_history (direction, invoking_key) else if (line_index != sline_len) ++line_index; else - ding (); + rl_ding (); break; /* switch directions */ @@ -305,13 +312,14 @@ rl_search_history (direction, invoking_key) if (allocated_line) free (allocated_line); free (lines); + RL_UNSETSTATE(RL_STATE_ISEARCH); return 0; #if 0 /* delete character from search string. */ case -3: if (search_string_index == 0) - ding (); + rl_ding (); else { search_string[--search_string_index] = '\0'; @@ -384,7 +392,7 @@ rl_search_history (direction, invoking_key) if (failed) { /* We cannot find the search string. Ding the bell. */ - ding (); + rl_ding (); i = last_found_line; continue; /* XXX - was break */ } @@ -438,5 +446,7 @@ rl_search_history (direction, invoking_key) free (allocated_line); free (lines); + RL_UNSETSTATE(RL_STATE_ISEARCH); + return 0; } diff --git a/contrib/libreadline/keymaps.c b/contrib/libreadline/keymaps.c index 8fb7de3..12506d3 100644 --- a/contrib/libreadline/keymaps.c +++ b/contrib/libreadline/keymaps.c @@ -61,7 +61,7 @@ rl_make_bare_keymap () for (i = 0; i < KEYMAP_SIZE; i++) { keymap[i].type = ISFUNC; - keymap[i].function = (Function *)NULL; + keymap[i].function = (rl_command_func_t *)NULL; } for (i = 'A'; i < ('Z' + 1); i++) diff --git a/contrib/libreadline/keymaps.h b/contrib/libreadline/keymaps.h index 3a504fb..d8cba23 100644 --- a/contrib/libreadline/keymaps.h +++ b/contrib/libreadline/keymaps.h @@ -30,17 +30,11 @@ extern "C" { #if defined (READLINE_LIBRARY) # include "rlstdc.h" # include "chardefs.h" +# include "rltypedefs.h" #else # include # include -#endif - -#if !defined (_FUNCTION_DEF) -# define _FUNCTION_DEF -typedef int Function (); -typedef void VFunction (); -typedef char *CPFunction (); -typedef char **CPPFunction (); +# include #endif /* A keymap contains one entry for each key in the ASCII set. @@ -50,7 +44,7 @@ typedef char **CPPFunction (); TYPE says which kind of thing FUNCTION is. */ typedef struct _keymap_entry { char type; - Function *function; + rl_command_func_t *function; } KEYMAP_ENTRY; /* This must be large enough to hold bindings for all of the characters @@ -59,7 +53,7 @@ typedef struct _keymap_entry { #define KEYMAP_SIZE 256 /* I wanted to make the above structure contain a union of: - union { Function *function; struct _keymap_entry *keymap; } value; + union { rl_command_func_t *function; struct _keymap_entry *keymap; } value; but this made it impossible for me to create a static array. Maybe I need C lessons. */ @@ -93,7 +87,7 @@ extern void rl_discard_keymap __P((Keymap)); /* Return the keymap corresponding to a given name. Names look like `emacs' or `emacs-meta' or `vi-insert'. */ -extern Keymap rl_get_keymap_by_name __P((char *)); +extern Keymap rl_get_keymap_by_name __P((const char *)); /* Return the current keymap. */ extern Keymap rl_get_keymap __P((void)); diff --git a/contrib/libreadline/kill.c b/contrib/libreadline/kill.c index c3241bd..3ced8fb 100644 --- a/contrib/libreadline/kill.c +++ b/contrib/libreadline/kill.c @@ -264,7 +264,7 @@ rl_backward_kill_line (direction, ignore) else { if (!rl_point) - ding (); + rl_ding (); else { rl_beg_of_line (1, ignore); @@ -299,7 +299,7 @@ rl_unix_word_rubout (count, key) int orig_point; if (rl_point == 0) - ding (); + rl_ding (); else { orig_point = rl_point; @@ -331,7 +331,7 @@ rl_unix_line_discard (count, key) int count, key; { if (rl_point == 0) - ding (); + rl_ding (); else { rl_kill_text (rl_point, 0); @@ -512,14 +512,14 @@ rl_yank_nth_arg_internal (count, ignore, history_skip) if (entry == 0) { - ding (); + rl_ding (); return -1; } arg = history_arg_extract (count, count, entry->line); if (!arg || !*arg) { - ding (); + rl_ding (); return -1; } @@ -592,7 +592,7 @@ rl_yank_last_arg (count, key) } /* A special paste command for users of Cygnus's cygwin32. */ -#if defined (__CYGWIN32__) +#if defined (__CYGWIN__) #include int @@ -625,4 +625,4 @@ rl_paste_from_clipboard (count, key) } return (0); } -#endif /* __CYGWIN32__ */ +#endif /* __CYGWIN__ */ diff --git a/contrib/libreadline/macro.c b/contrib/libreadline/macro.c index 5a44852..fed298a 100644 --- a/contrib/libreadline/macro.c +++ b/contrib/libreadline/macro.c @@ -57,12 +57,12 @@ /* */ /* **************************************************************** */ -/* Non-zero means to save keys that we dispatch on in a kbd macro. */ -int _rl_defining_kbd_macro = 0; - /* The currently executing macro string. If this is non-zero, then it is a malloc ()'ed string where input is coming from. */ -char *_rl_executing_macro = (char *)NULL; +char *rl_executing_macro = (char *)NULL; + +/* Non-zero means to save keys that we dispatch on in a kbd macro. */ +int _rl_defining_kbd_macro = 0; /* The offset in the above string to the next character to be read. */ static int executing_macro_index; @@ -95,8 +95,9 @@ _rl_with_macro_input (string) char *string; { _rl_push_executing_macro (); - _rl_executing_macro = string; + rl_executing_macro = string; executing_macro_index = 0; + RL_SETSTATE(RL_STATE_MACROINPUT); } /* Return the next character available from a macro, or 0 if @@ -104,16 +105,16 @@ _rl_with_macro_input (string) int _rl_next_macro_key () { - if (_rl_executing_macro == 0) + if (rl_executing_macro == 0) return (0); - if (_rl_executing_macro[executing_macro_index] == 0) + if (rl_executing_macro[executing_macro_index] == 0) { _rl_pop_executing_macro (); return (_rl_next_macro_key ()); } - return (_rl_executing_macro[executing_macro_index++]); + return (rl_executing_macro[executing_macro_index++]); } /* Save the currently executing macro on a stack of saved macros. */ @@ -125,7 +126,7 @@ _rl_push_executing_macro () saver = (struct saved_macro *)xmalloc (sizeof (struct saved_macro)); saver->next = macro_list; saver->sindex = executing_macro_index; - saver->string = _rl_executing_macro; + saver->string = rl_executing_macro; macro_list = saver; } @@ -137,20 +138,21 @@ _rl_pop_executing_macro () { struct saved_macro *macro; - if (_rl_executing_macro) - free (_rl_executing_macro); - - _rl_executing_macro = (char *)NULL; + FREE (rl_executing_macro); + rl_executing_macro = (char *)NULL; executing_macro_index = 0; if (macro_list) { macro = macro_list; - _rl_executing_macro = macro_list->string; + rl_executing_macro = macro_list->string; executing_macro_index = macro_list->sindex; macro_list = macro_list->next; free (macro); } + + if (rl_executing_macro == 0) + RL_UNSETSTATE(RL_STATE_MACROINPUT); } /* Add a character to the macro being built. */ @@ -180,14 +182,12 @@ _rl_kill_kbd_macro () } current_macro_size = current_macro_index = 0; - if (_rl_executing_macro) - { - free (_rl_executing_macro); - _rl_executing_macro = (char *) NULL; - } + FREE (rl_executing_macro); + rl_executing_macro = (char *) NULL; executing_macro_index = 0; _rl_defining_kbd_macro = 0; + RL_UNSETSTATE(RL_STATE_MACRODEF); } /* Begin defining a keyboard macro. @@ -215,6 +215,7 @@ rl_start_kbd_macro (ignore1, ignore2) current_macro_index = 0; _rl_defining_kbd_macro = 1; + RL_SETSTATE(RL_STATE_MACRODEF); return 0; } @@ -235,6 +236,7 @@ rl_end_kbd_macro (count, ignore) current_macro[current_macro_index] = '\0'; _rl_defining_kbd_macro = 0; + RL_UNSETSTATE(RL_STATE_MACRODEF); return (rl_call_last_kbd_macro (--count, 0)); } @@ -250,7 +252,7 @@ rl_call_last_kbd_macro (count, ignore) if (_rl_defining_kbd_macro) { - ding (); /* no recursive macros */ + rl_ding (); /* no recursive macros */ current_macro[--current_macro_index] = '\0'; /* erase this char */ return 0; } diff --git a/contrib/libreadline/nls.c b/contrib/libreadline/nls.c index 67bed8a..f807995 100644 --- a/contrib/libreadline/nls.c +++ b/contrib/libreadline/nls.c @@ -105,9 +105,9 @@ _rl_init_eightbit () /* We don't have setlocale. Finesse it. Check the environment for the appropriate variables and set eight-bit mode if they have the right values. */ - lspec = get_env_value ("LC_ALL"); - if (lspec == 0) lspec = get_env_value ("LC_CTYPE"); - if (lspec == 0) lspec = get_env_value ("LANG"); + lspec = sh_get_env_value ("LC_ALL"); + if (lspec == 0) lspec = sh_get_env_value ("LC_CTYPE"); + if (lspec == 0) lspec = sh_get_env_value ("LANG"); if (lspec == 0 || (t = normalize_codeset (lspec)) == 0) return (0); for (i = 0; t && legal_lang_values[i]; i++) diff --git a/contrib/libreadline/parens.c b/contrib/libreadline/parens.c index b6de529..d1e66f5 100644 --- a/contrib/libreadline/parens.c +++ b/contrib/libreadline/parens.c @@ -64,6 +64,8 @@ int rl_blink_matching_paren = 1; int rl_blink_matching_paren = 0; #endif /* !HAVE_SELECT */ +static int _paren_blink_usec = 500000; + /* Change emacs_standard_keymap to have bindings for paren matching when ON_OR_OFF is 1, change them back to self_insert when ON_OR_OFF == 0. */ void @@ -85,6 +87,18 @@ _rl_enable_paren_matching (on_or_off) } int +rl_set_paren_blink_timeout (u) + int u; +{ + int o; + + o = _paren_blink_usec; + if (u > 0) + _paren_blink_usec = u; + return (o); +} + +int rl_insert_close (count, invoking_key) int count, invoking_key; { @@ -109,7 +123,7 @@ rl_insert_close (count, invoking_key) FD_ZERO (&readfds); FD_SET (fileno (rl_instream), &readfds); timer.tv_sec = 0; - timer.tv_usec = 500000; + timer.tv_usec = _paren_blink_usec; orig_point = rl_point; rl_point = match_point; diff --git a/contrib/libreadline/readline.3 b/contrib/libreadline/readline.3 index c1ed9cf..037b1bb 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: Tue Jun 1 13:28:03 EDT 1999 +.\" Last Change: Mon Mar 5 09:58:38 EST 2001 .\" -.TH READLINE 3 "1999 Jun 1" GNU +.TH READLINE 3 "2001 Mar 5" "GNU Readline 4.2" .\" .\" File Name macro. This used to be `.PN', for Path Name, .\" but Sun doesn't seem to like that very much. @@ -23,20 +23,19 @@ readline \- get a line from a user with editing .nf .ft B #include -#include -#include +#include +#include .ft .fi .LP .nf -.ft B -char *readline (prompt) -char *prompt; -.ft +\fIchar *\fP +.br +\fBreadline\fP (\fIconst char *prompt\fP); .fi .SH COPYRIGHT -.if n Readline is Copyright (C) 1989, 1991, 1993, 1995, 1996 by the Free Software Foundation, Inc. -.if t Readline is Copyright \(co 1989, 1991, 1993, 1995, 1996 by the Free Software Foundation, Inc. +.if n Readline is Copyright (C) 1989\-2001 by the Free Software Foundation, Inc. +.if t Readline is Copyright \(co 1989\-2001 by the Free Software Foundation, Inc. .SH DESCRIPTION .LP .B readline @@ -45,9 +44,10 @@ and return it, using .B prompt as a prompt. If .B prompt -is null, no prompt is issued. The line returned is allocated with -.IR malloc (3), -so the caller must free it when finished. The line returned +is \fBNULL\fP or the empty string, no prompt is issued. +The line returned is allocated with +.IR malloc (3); +the caller must free it when finished. The line returned has the final newline removed, so only the text of the line remains. .LP @@ -57,6 +57,11 @@ line. By default, the line editing commands are similar to those of emacs. A vi\-style line editing interface is also available. +.LP +This manual page describes only the most basic use of \fBreadline\fP. +Much more functionality is available; see +\fIThe GNU Readline Library\fP and \fIThe GNU History Library\fP +for additional information. .SH RETURN VALUE .LP .B readline @@ -130,6 +135,7 @@ or .RS C\-Meta\-u: universal\-argument .RE +.sp into the .I inputrc would make M\-C\-u execute the readline command @@ -137,15 +143,16 @@ would make M\-C\-u execute the readline command .PP The following symbolic character names are recognized while processing key bindings: -.IR RUBOUT , .IR DEL , .IR ESC , +.IR ESCAPE , .IR LFD , .IR NEWLINE , .IR RET , .IR RETURN , -.IR SPC , +.IR RUBOUT , .IR SPACE , +.IR SPC , and .IR TAB . .PP @@ -161,6 +168,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. +.PP 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: @@ -170,7 +178,7 @@ Control\-u: universal\-argument .br Meta\-Rubout: backward\-kill\-word .br -Control\-o: ">&output" +Control\-o: "> output" .RE .LP In the above example, @@ -184,7 +192,8 @@ and .I C\-o is bound to run the macro expressed on the right hand side (that is, to insert the text -.I >&output +.if t \f(CW> output\fP +.if n ``> output'' into the line). .PP In the second form, \fB"keyseq"\fP:\^\fIfunction\-name\fP or \fImacro\fP, @@ -194,7 +203,8 @@ differs from above in that strings denoting an entire key sequence may be specified by placing the sequence within double quotes. Some GNU Emacs style key escapes can be -used, as in the following example. +used, as in the following example, but the symbolic character names +are not recognized. .sp .RS "\eC\-u": universal\-argument @@ -214,8 +224,11 @@ is bound to the function 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 +.if t \f(CWFunction Key 1\fP. +.if n ``Function Key 1''. +.PP +The full set of GNU Emacs style escape sequences available when specifying +key sequences is .RS .PD 0 .TP @@ -232,10 +245,10 @@ an escape character backslash .TP .B \e" -literal " +literal ", a double quote .TP .B \e' -literal ' +literal ', a single quote .RE .PD .PP @@ -313,7 +326,8 @@ file with a statement of the form Except where noted, readline variables can take the values .B On or -.BR Off . +.B Off +(without regard to case). The variables and their default values are: .PP .PD 0 @@ -351,7 +365,7 @@ on the terminal. .B convert\-meta (On) If set to \fBOn\fP, readline will convert characters with the eighth bit set to an ASCII key sequence -by stripping the eighth bit and prepending an +by stripping the eighth bit and prefixing it with an escape character (in effect, using escape as the \fImeta prefix\fP). .TP .B disable\-completion (Off) @@ -361,7 +375,7 @@ mapped to \fBself-insert\fP. .TP .B editing\-mode (emacs) Controls whether readline begins with a set of key bindings similar -to \fIemacs\fP or \fIvi\fP. +to emacs or vi. .B editing\-mode can be set to either .B emacs @@ -384,12 +398,12 @@ becomes longer than the screen width rather than wrapping to a new line. .TP .B input\-meta (Off) If set to \fBOn\fP, readline will enable eight-bit input (that is, -it will not strip the high bit from the characters it reads), +it will not clear the eighth bit in the characters it reads), regardless of what the terminal claims it can support. The name .B meta\-flag is a synonym for this variable. .TP -.B isearch\-terminators (``C\-[C\-J'') +.B isearch\-terminators (``C\-[ C\-J'') The string of characters that should terminate an incremental search without subsequently executing the character as a command. If this variable has not been given a value, the characters @@ -402,13 +416,13 @@ vi-command\fP, and .IR vi-insert . \fIvi\fP is equivalent to \fIvi-command\fP; \fIemacs\fP is equivalent to \fIemacs-standard\fP. The default value is -.IR emacs ; -the value of +.IR emacs . +The value of .B editing\-mode also affects the default keymap. .TP .B mark\-directories (On) -If set to \fBOn\fP, complete) -Set the mark to the current point. If a +.B set\-mark (C\-@, M\-) +Set the mark to the point. If a numeric argument is supplied, the mark is set to that position. .TP .B exchange\-point\-and\-mark (C\-x C\-x) @@ -894,8 +920,9 @@ character. A negative count searches for subsequent occurrences. The value of the readline .B comment\-begin 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. +is accepted as if a newline had been typed. The default value of +.B comment\-begin +makes the current line a shell comment. .TP .B dump\-functions Print all of the functions and their key bindings to the @@ -932,25 +959,23 @@ editing mode. .SH DEFAULT KEY BINDINGS .LP The following is a list of the default emacs and vi bindings. -Characters with the 8th bit set are written as M\-, and +Characters with the eighth bit set are written as M\-, and are referred to as .I metafied characters. The printable ASCII characters not mentioned in the list of emacs standard bindings are bound to the -.I self\-insert +.B self\-insert function, which just inserts the given character into the input line. In vi insertion mode, all characters not specifically mentioned are bound to -.IR self\-insert . +.BR self\-insert . Characters assigned to signal generation by .IR stty (1) or the terminal driver, such as C-Z or C-C, retain that function. -Upper and lower case -.I metafied -characters are bound to the same function in the emacs mode -meta keymap. +Upper and lower case metafied characters are bound to the same function in +the emacs mode meta keymap. The remaining characters are unbound, which causes readline to ring the bell (subject to the setting of the .B bell\-style @@ -1036,7 +1061,7 @@ Emacs Meta bindings "M-Y" yank-pop "M-\e" delete-horizontal-space "M-~" tilde-expand -"M-C-?" backward-delete-word +"M-C-?" backward-kill-word "M-_" yank-last-arg .PP Emacs Control-X bindings @@ -1096,6 +1121,7 @@ VI Command Mode functions "C-V" quoted-insert "C-W" unix-word-rubout "C-Y" yank +"C-_" vi-undo "\^ " forward-char "#" insert-comment "$" end-of-line @@ -1150,7 +1176,7 @@ VI Command Mode functions "r" vi-change-char "s" vi-subst "t" vi-char-search -"u" undo +"u" vi-undo "w" vi-next-word "x" vi-delete "y" vi-yank-to diff --git a/contrib/libreadline/readline.c b/contrib/libreadline/readline.c index 2c6aef6..9d7cc5b 100644 --- a/contrib/libreadline/readline.c +++ b/contrib/libreadline/readline.c @@ -67,7 +67,7 @@ #include "xmalloc.h" #ifndef RL_LIBRARY_VERSION -# define RL_LIBRARY_VERSION "4.1" +# define RL_LIBRARY_VERSION "4.2" #endif /* Evaluates its arguments multiple times. */ @@ -90,8 +90,9 @@ static void readline_default_bindings __P((void)); /* */ /* **************************************************************** */ -char *rl_library_version = RL_LIBRARY_VERSION; +const char *rl_library_version = RL_LIBRARY_VERSION; +/* True if this is `real' readline as opposed to some stub substitute. */ int rl_gnu_readline_p = 1; /* A pointer to the keymap that is currently in use. @@ -121,8 +122,13 @@ int rl_arg_sign = 1; /* Non-zero means we have been called at least once before. */ static int rl_initialized; +#if 0 /* If non-zero, this program is running in an EMACS buffer. */ static int running_in_emacs; +#endif + +/* Flags word encapsulating the current readline state. */ +int rl_readline_state = RL_STATE_NONE; /* The current offset in the current input line. */ int rl_point; @@ -137,7 +143,7 @@ int rl_end; int rl_done; /* The last function executed by readline. */ -Function *rl_last_func = (Function *)NULL; +rl_command_func_t *rl_last_func = (rl_command_func_t *)NULL; /* Top level environment for readline_internal (). */ procenv_t readline_top_level; @@ -153,7 +159,7 @@ FILE *rl_outstream = (FILE *)NULL; int readline_echoing_p = 1; /* Current prompt. */ -char *rl_prompt; +char *rl_prompt = (char *)NULL; int rl_visible_prompt_length = 0; /* Set to non-zero by calling application if it has already printed rl_prompt @@ -165,12 +171,12 @@ int rl_key_sequence_length = 0; /* If non-zero, then this is the address of a function to call just before readline_internal_setup () prints the first prompt. */ -Function *rl_startup_hook = (Function *)NULL; +rl_hook_func_t *rl_startup_hook = (rl_hook_func_t *)NULL; /* If non-zero, this is the address of a function to call just before readline_internal_setup () returns and readline_internal starts reading input characters. */ -Function *rl_pre_input_hook = (Function *)NULL; +rl_hook_func_t *rl_pre_input_hook = (rl_hook_func_t *)NULL; /* What we use internally. You should always refer to RL_LINE_BUFFER. */ static char *the_line; @@ -183,7 +189,7 @@ int _rl_eof_char = CTRL ('D'); int rl_pending_input = 0; /* Pointer to a useful terminal name. */ -char *rl_terminal_name = (char *)NULL; +const char *rl_terminal_name = (const char *)NULL; /* Non-zero means to always use horizontal scrolling in line display. */ int _rl_horizontal_scroll_mode = 0; @@ -243,24 +249,37 @@ int _rl_output_meta_chars = 0; /* Non-zero means treat 0200 bit in terminal input as Meta bit. */ int _rl_meta_flag = 0; /* Forward declaration */ +/* Set up the prompt and expand it. Called from readline() and + rl_callback_handler_install (). */ +int +rl_set_prompt (prompt) + const char *prompt; +{ + FREE (rl_prompt); + rl_prompt = prompt ? savestring (prompt) : (char *)NULL; + + rl_visible_prompt_length = (rl_prompt && *rl_prompt) + ? rl_expand_prompt (rl_prompt) + : 0; + return 0; +} + /* Read a line of input. Prompt with PROMPT. An empty PROMPT means none. A return value of NULL means that EOF was encountered. */ char * readline (prompt) - char *prompt; + const char *prompt; { char *value; - rl_prompt = prompt; - /* If we are at EOF return a NULL string. */ if (rl_pending_input == EOF) { - rl_pending_input = 0; + rl_clear_pending_input (); return ((char *)NULL); } - rl_visible_prompt_length = rl_expand_prompt (rl_prompt); + rl_set_prompt (prompt); rl_initialize (); (*rl_prep_term_function) (_rl_meta_flag); @@ -348,7 +367,7 @@ readline_internal_teardown (eof) /* At any rate, it is highly likely that this line has an undo list. Get rid of it now. */ if (rl_undo_list) - free_undo_list (); + rl_free_undo_list (); return (eof ? (char *)NULL : savestring (the_line)); } @@ -384,7 +403,9 @@ readline_internal_charloop () rl_key_sequence_length = 0; } + RL_SETSTATE(RL_STATE_READCMD); c = rl_read_key (); + RL_UNSETSTATE(RL_STATE_READCMD); /* EOF typed to a non-blank line is a . */ if (c == EOF && rl_end) @@ -395,6 +416,7 @@ readline_internal_charloop () if (((c == _rl_eof_char && lastc != c) || c == EOF) && !rl_end) { #if defined (READLINE_CALLBACKS) + RL_SETSTATE(RL_STATE_DONE); return (rl_done = 1); #else eof_found = 1; @@ -491,7 +513,7 @@ _rl_dispatch (key, map) { int r, newkey; char *macro; - Function *func; + rl_command_func_t *func; if (META_CHAR (key) && _rl_convert_meta_chars_to_ascii) { @@ -505,7 +527,7 @@ _rl_dispatch (key, map) return (_rl_dispatch (key, map)); } else - ding (); + rl_ding (); return 0; } @@ -517,7 +539,7 @@ _rl_dispatch (key, map) { case ISFUNC: func = map[key].function; - if (func != (Function *)NULL) + if (func) { /* Special case rl_do_lowercase_version (). */ if (func == rl_do_lowercase_version) @@ -530,13 +552,15 @@ _rl_dispatch (key, map) #endif rl_dispatching = 1; + RL_SETSTATE(RL_STATE_DISPATCHING); r = (*map[key].function)(rl_numeric_arg * rl_arg_sign, key); + RL_UNSETSTATE(RL_STATE_DISPATCHING); rl_dispatching = 0; /* If we have input pending, then the last command was a prefix command. Don't change the state of rl_last_func. Otherwise, remember the last command executed in this variable. */ - if (!rl_pending_input && map[key].function != rl_digit_argument) + if (rl_pending_input == 0 && map[key].function != rl_digit_argument) rl_last_func = map[key].function; } else @@ -547,10 +571,18 @@ _rl_dispatch (key, map) break; case ISKMAP: - if (map[key].function != (Function *)NULL) + if (map[key].function != 0) { rl_key_sequence_length++; + + if (key == ESC) + RL_SETSTATE(RL_STATE_METANEXT); + RL_SETSTATE(RL_STATE_MOREINPUT); newkey = rl_read_key (); + RL_UNSETSTATE(RL_STATE_MOREINPUT); + if (key == ESC) + RL_UNSETSTATE(RL_STATE_METANEXT); + r = _rl_dispatch (newkey, FUNCTION_TO_KEYMAP (map, key)); } else @@ -561,7 +593,7 @@ _rl_dispatch (key, map) break; case ISMACR: - if (map[key].function != (Function *)NULL) + if (map[key].function != 0) { macro = savestring ((char *)map[key].function); _rl_with_macro_input (macro); @@ -591,8 +623,11 @@ rl_initialize () terminal and data structures. */ if (!rl_initialized) { + RL_SETSTATE(RL_STATE_INITIALIZING); readline_initialize_everything (); + RL_UNSETSTATE(RL_STATE_INITIALIZING); rl_initialized++; + RL_SETSTATE(RL_STATE_INITIALIZED); } /* Initalize the current line information. */ @@ -600,6 +635,7 @@ rl_initialize () /* We aren't done yet. We haven't even gotten started yet! */ rl_done = 0; + RL_UNSETSTATE(RL_STATE_DONE); /* Tell the history routines what is going on. */ start_using_history (); @@ -608,7 +644,7 @@ rl_initialize () rl_reset_line_state (); /* No such function typed yet. */ - rl_last_func = (Function *)NULL; + rl_last_func = (rl_command_func_t *)NULL; /* Parsing of key-bindings begins in an enabled state. */ _rl_parsing_conditionalized_out = 0; @@ -658,8 +694,10 @@ readline_initialize_everything () #endif #endif - /* Find out if we are running in Emacs. */ - running_in_emacs = get_env_value ("EMACS") != (char *)0; +#if 0 + /* Find out if we are running in Emacs -- UNUSED. */ + running_in_emacs = sh_get_env_value ("EMACS") != (char *)0; +#endif /* Set up input and output if they are not already set up. */ if (!rl_instream) @@ -679,7 +717,9 @@ readline_initialize_everything () rl_line_buffer = xmalloc (rl_line_buffer_len = DEFAULT_BUFFER_SIZE); /* Initialize the terminal interface. */ - _rl_init_terminal_io ((char *)NULL); + if (rl_terminal_name == 0) + rl_terminal_name = sh_get_env_value ("TERM"); + _rl_init_terminal_io (rl_terminal_name); /* Bind tty characters to readline functions. */ readline_default_bindings (); @@ -696,8 +736,8 @@ readline_initialize_everything () /* XXX */ if (_rl_horizontal_scroll_mode && _rl_term_autowrap) { - screenwidth--; - screenchars -= screenheight; + _rl_screenwidth--; + _rl_screenchars -= _rl_screenheight; } /* Override the effect of any `set keymap' assignments in the @@ -723,13 +763,13 @@ readline_initialize_everything () static void readline_default_bindings () { - rltty_set_default_bindings (_rl_keymap); + rl_tty_set_default_bindings (_rl_keymap); } static void bind_arrow_keys_internal () { - Function *f; + rl_command_func_t *f; #if defined (__MSDOS__) f = rl_function_of_keyseq ("\033[0A", _rl_keymap, (int *)NULL); @@ -797,19 +837,23 @@ rl_digit_loop () rl_save_prompt (); + RL_SETSTATE(RL_STATE_NUMERICARG); sawminus = sawdigits = 0; while (1) { if (rl_numeric_arg > 1000000) { sawdigits = rl_explicit_arg = rl_numeric_arg = 0; - ding (); + rl_ding (); rl_restore_prompt (); rl_clear_message (); + RL_UNSETSTATE(RL_STATE_NUMERICARG); return 1; } rl_message ("(arg: %d) ", rl_arg_sign * rl_numeric_arg); + RL_SETSTATE(RL_STATE_MOREINPUT); key = c = rl_read_key (); + RL_UNSETSTATE(RL_STATE_MOREINPUT); /* If we see a key bound to `universal-argument' after seeing digits, it ends the argument but is otherwise ignored. */ @@ -823,9 +867,12 @@ rl_digit_loop () } else { + RL_SETSTATE(RL_STATE_MOREINPUT); key = rl_read_key (); + RL_UNSETSTATE(RL_STATE_MOREINPUT); rl_restore_prompt (); rl_clear_message (); + RL_UNSETSTATE(RL_STATE_NUMERICARG); return (_rl_dispatch (key, _rl_keymap)); } } @@ -849,10 +896,12 @@ rl_digit_loop () rl_explicit_arg = 1; rl_restore_prompt (); rl_clear_message (); + RL_UNSETSTATE(RL_STATE_NUMERICARG); return (_rl_dispatch (key, _rl_keymap)); } } + RL_UNSETSTATE(RL_STATE_NUMERICARG); return 0; } @@ -861,7 +910,7 @@ int rl_digit_argument (ignore, key) int ignore, key; { - rl_pending_input = key; + rl_execute_next (key); return (rl_digit_loop ()); } @@ -869,7 +918,7 @@ rl_digit_argument (ignore, key) int rl_discard_argument () { - ding (); + rl_ding (); rl_clear_message (); _rl_init_argument (); return 0; @@ -906,7 +955,7 @@ rl_universal_argument (count, key) function. */ int rl_insert_text (string) - char *string; + const char *string; { register int i, l = strlen (string); @@ -999,7 +1048,7 @@ _rl_fix_point (fix_mark_too) void _rl_replace_text (text, start, end) - char *text; + const char *text; int start, end; { rl_begin_undo_group (); @@ -1053,7 +1102,7 @@ rl_forward (count, key) { int end = rl_point + count; #if defined (VI_MODE) - int lend = rl_end - (rl_editing_mode == vi_mode); + int lend = rl_end > 0 ? rl_end - (rl_editing_mode == vi_mode) : rl_end; #else int lend = rl_end; #endif @@ -1061,7 +1110,7 @@ rl_forward (count, key) if (end > lend) { rl_point = lend; - ding (); + rl_ding (); } else rl_point = end; @@ -1085,7 +1134,7 @@ rl_backward (count, key) if (rl_point < count) { rl_point = 0; - ding (); + rl_ding (); } else rl_point -= count; @@ -1132,12 +1181,12 @@ rl_forward_word (count, key) /* If we are not in a word, move forward until we are in one. Then, move forward until we hit a non-alphabetic character. */ c = the_line[rl_point]; - if (alphabetic (c) == 0) + if (rl_alphabetic (c) == 0) { while (++rl_point < rl_end) { c = the_line[rl_point]; - if (alphabetic (c)) + if (rl_alphabetic (c)) break; } } @@ -1146,7 +1195,7 @@ rl_forward_word (count, key) while (++rl_point < rl_end) { c = the_line[rl_point]; - if (alphabetic (c) == 0) + if (rl_alphabetic (c) == 0) break; } --count; @@ -1176,12 +1225,12 @@ rl_backward_word (count, key) just before point. */ c = the_line[rl_point - 1]; - if (alphabetic (c) == 0) + if (rl_alphabetic (c) == 0) { while (--rl_point) { c = the_line[rl_point - 1]; - if (alphabetic (c)) + if (rl_alphabetic (c)) break; } } @@ -1189,7 +1238,7 @@ rl_backward_word (count, key) while (rl_point) { c = the_line[rl_point - 1]; - if (alphabetic (c) == 0) + if (rl_alphabetic (c) == 0) break; else --rl_point; @@ -1245,7 +1294,9 @@ rl_arrow_keys (count, c) { int ch; + RL_SETSTATE(RL_STATE_MOREINPUT); ch = rl_read_key (); + RL_UNSETSTATE(RL_STATE_MOREINPUT); switch (_rl_to_upper (ch)) { @@ -1266,7 +1317,7 @@ rl_arrow_keys (count, c) break; default: - ding (); + rl_ding (); } return 0; } @@ -1352,7 +1403,11 @@ rl_quoted_insert (count, key) #if defined (HANDLE_SIGNALS) _rl_disable_tty_signals (); #endif + + RL_SETSTATE(RL_STATE_MOREINPUT); c = rl_read_key (); + RL_UNSETSTATE(RL_STATE_MOREINPUT); + #if defined (HANDLE_SIGNALS) _rl_restore_tty_signals (); #endif @@ -1376,6 +1431,7 @@ rl_newline (count, key) int count, key; { rl_done = 1; + RL_SETSTATE(RL_STATE_DONE); #if defined (VI_MODE) if (rl_editing_mode == vi_mode) @@ -1386,7 +1442,7 @@ rl_newline (count, key) #endif /* VI_MODE */ /* If we've been asked to erase empty lines, suppress the final update, - since _rl_update_final calls crlf(). */ + since _rl_update_final calls rl_crlf(). */ if (rl_erase_empty_line && rl_point == 0 && rl_end == 0) return 0; @@ -1419,7 +1475,7 @@ rl_rubout (count, key) if (!rl_point) { - ding (); + rl_ding (); return -1; } @@ -1455,7 +1511,7 @@ rl_delete (count, key) if (rl_point == rl_end) { - ding (); + rl_ding (); return -1; } @@ -1611,11 +1667,11 @@ rl_change_case (count, op) case CapCase: the_line[start] = (inword == 0) ? _rl_to_upper (c) : _rl_to_lower (c); - inword = alphabetic (the_line[start]); + inword = rl_alphabetic (the_line[start]); break; default: - ding (); + rl_ding (); return -1; } } @@ -1654,7 +1710,7 @@ rl_transpose_words (count, key) /* Do some check to make sure that there really are two words. */ if ((w1_beg == w2_beg) || (w2_beg < w1_end)) { - ding (); + rl_ding (); rl_point = orig_point; return -1; } @@ -1702,7 +1758,7 @@ rl_transpose_chars (count, key) if (!rl_point || rl_end < 2) { - ding (); + rl_ding (); return -1; } @@ -1746,7 +1802,7 @@ _rl_char_search_internal (count, dir, schar) { if ((dir < 0 && pos <= 0) || (dir > 0 && pos >= rl_end)) { - ding (); + rl_ding (); return -1; } @@ -1777,7 +1833,10 @@ _rl_char_search (count, fdir, bdir) { int c; + RL_SETSTATE(RL_STATE_MOREINPUT); c = rl_read_key (); + RL_UNSETSTATE(RL_STATE_MOREINPUT); + if (count < 0) return (_rl_char_search_internal (-count, bdir, c)); else @@ -1810,17 +1869,17 @@ rl_backward_char_search (count, key) /* While we are editing the history, this is the saved version of the original line. */ -HIST_ENTRY *saved_line_for_history = (HIST_ENTRY *)NULL; +HIST_ENTRY *_rl_saved_line_for_history = (HIST_ENTRY *)NULL; /* Set the history pointer back to the last entry in the history. */ static void start_using_history () { using_history (); - if (saved_line_for_history) - _rl_free_history_entry (saved_line_for_history); + if (_rl_saved_line_for_history) + _rl_free_history_entry (_rl_saved_line_for_history); - saved_line_for_history = (HIST_ENTRY *)NULL; + _rl_saved_line_for_history = (HIST_ENTRY *)NULL; } /* Free the contents (and containing structure) of a HIST_ENTRY. */ @@ -1837,7 +1896,7 @@ _rl_free_history_entry (entry) /* Perhaps put back the current line if it has changed. */ int -maybe_replace_line () +rl_maybe_replace_line () { HIST_ENTRY *temp; @@ -1852,43 +1911,54 @@ maybe_replace_line () return 0; } -/* Put back the saved_line_for_history if there is one. */ +/* Restore the _rl_saved_line_for_history if there is one. */ int -maybe_unsave_line () +rl_maybe_unsave_line () { int line_len; - if (saved_line_for_history) + if (_rl_saved_line_for_history) { - line_len = strlen (saved_line_for_history->line); + line_len = strlen (_rl_saved_line_for_history->line); if (line_len >= rl_line_buffer_len) rl_extend_line_buffer (line_len); - strcpy (the_line, saved_line_for_history->line); - rl_undo_list = (UNDO_LIST *)saved_line_for_history->data; - _rl_free_history_entry (saved_line_for_history); - saved_line_for_history = (HIST_ENTRY *)NULL; + strcpy (the_line, _rl_saved_line_for_history->line); + rl_undo_list = (UNDO_LIST *)_rl_saved_line_for_history->data; + _rl_free_history_entry (_rl_saved_line_for_history); + _rl_saved_line_for_history = (HIST_ENTRY *)NULL; rl_end = rl_point = strlen (the_line); } else - ding (); + rl_ding (); return 0; } -/* Save the current line in saved_line_for_history. */ +/* Save the current line in _rl_saved_line_for_history. */ int -maybe_save_line () +rl_maybe_save_line () { - if (saved_line_for_history == 0) + if (_rl_saved_line_for_history == 0) { - saved_line_for_history = (HIST_ENTRY *)xmalloc (sizeof (HIST_ENTRY)); - saved_line_for_history->line = savestring (the_line); - saved_line_for_history->data = (char *)rl_undo_list; + _rl_saved_line_for_history = (HIST_ENTRY *)xmalloc (sizeof (HIST_ENTRY)); + _rl_saved_line_for_history->line = savestring (the_line); + _rl_saved_line_for_history->data = (char *)rl_undo_list; } return 0; } +int +_rl_free_saved_history_line () +{ + if (_rl_saved_line_for_history) + { + _rl_free_history_entry (_rl_saved_line_for_history); + _rl_saved_line_for_history = (HIST_ENTRY *)NULL; + } + return 0; +} + /* **************************************************************** */ /* */ /* History Commands */ @@ -1908,9 +1978,9 @@ int rl_end_of_history (count, key) int count, key; { - maybe_replace_line (); + rl_maybe_replace_line (); using_history (); - maybe_unsave_line (); + rl_maybe_unsave_line (); return 0; } @@ -1928,7 +1998,7 @@ rl_get_next_history (count, key) if (count == 0) return 0; - maybe_replace_line (); + rl_maybe_replace_line (); temp = (HIST_ENTRY *)NULL; while (count) @@ -1940,7 +2010,7 @@ rl_get_next_history (count, key) } if (temp == 0) - maybe_unsave_line (); + rl_maybe_unsave_line (); else { line_len = strlen (temp->line); @@ -1975,10 +2045,10 @@ rl_get_previous_history (count, key) return 0; /* If we don't have a line saved, then save this one. */ - maybe_save_line (); + rl_maybe_save_line (); /* If the current line has changed, save the changes. */ - maybe_replace_line (); + rl_maybe_replace_line (); temp = old_temp = (HIST_ENTRY *)NULL; while (count) @@ -1997,7 +2067,7 @@ rl_get_previous_history (count, key) temp = old_temp; if (temp == 0) - ding (); + rl_ding (); else { line_len = strlen (temp->line); @@ -2053,7 +2123,7 @@ rl_exchange_point_and_mark (count, key) if (rl_mark == -1) { - ding (); + rl_ding (); return -1; } else diff --git a/contrib/libreadline/readline.h b/contrib/libreadline/readline.h index 97c62fd1..d362df1 100644 --- a/contrib/libreadline/readline.h +++ b/contrib/libreadline/readline.h @@ -60,8 +60,8 @@ extern UNDO_LIST *rl_undo_list; /* The data structure for mapping textual names to code addresses. */ typedef struct _funmap { - char *name; - Function *function; + const char *name; + rl_command_func_t *function; } FUNMAP; extern FUNMAP **funmap; @@ -155,8 +155,8 @@ extern int rl_yank __P((int, int)); extern int rl_yank_pop __P((int, int)); extern int rl_yank_nth_arg __P((int, int)); extern int rl_yank_last_arg __P((int, int)); -/* Not available unless __CYGWIN32__ is defined. */ -#ifdef __CYGWIN32__ +/* Not available unless __CYGWIN__ is defined. */ +#ifdef __CYGWIN__ extern int rl_paste_from_clipboard __P((int, int)); #endif @@ -196,7 +196,7 @@ extern int rl_noninc_reverse_search_again __P((int, int)); extern int rl_insert_close __P((int, int)); /* Not available unless READLINE_CALLBACKS is defined. */ -extern void rl_callback_handler_install __P((char *, VFunction *)); +extern void rl_callback_handler_install __P((const char *, rl_vcpfunc_t *)); extern void rl_callback_read_char __P((void)); extern void rl_callback_handler_remove __P((void)); @@ -260,43 +260,47 @@ extern int rl_vi_eword __P((int, int)); /* Readline functions. */ /* Read a line of input. Prompt with PROMPT. A NULL PROMPT means none. */ -extern char *readline __P((char *)); +extern char *readline __P((const char *)); + +extern int rl_set_prompt __P((const char *)); +extern int rl_expand_prompt __P((char *)); extern int rl_initialize __P((void)); +/* Undocumented; unused by readline */ extern int rl_discard_argument __P((void)); /* Utility functions to bind keys to readline commands. */ -extern int rl_add_defun __P((char *, Function *, int)); -extern int rl_bind_key __P((int, Function *)); -extern int rl_bind_key_in_map __P((int, Function *, Keymap)); +extern int rl_add_defun __P((const char *, rl_command_func_t *, int)); +extern int rl_bind_key __P((int, rl_command_func_t *)); +extern int rl_bind_key_in_map __P((int, rl_command_func_t *, Keymap)); extern int rl_unbind_key __P((int)); extern int rl_unbind_key_in_map __P((int, Keymap)); -extern int rl_unbind_function_in_map __P((Function *, Keymap)); -extern int rl_unbind_command_in_map __P((char *, Keymap)); -extern int rl_set_key __P((char *, Function *, Keymap)); -extern int rl_generic_bind __P((int, char *, char *, Keymap)); -extern int rl_variable_bind __P((char *, char *)); +extern int rl_unbind_function_in_map __P((rl_command_func_t *, Keymap)); +extern int rl_unbind_command_in_map __P((const char *, Keymap)); +extern int rl_set_key __P((const char *, rl_command_func_t *, Keymap)); +extern int rl_generic_bind __P((int, const char *, char *, Keymap)); +extern int rl_variable_bind __P((const char *, const char *)); /* Backwards compatibility, use rl_generic_bind instead. */ -extern int rl_macro_bind __P((char *, char *, Keymap)); +extern int rl_macro_bind __P((const char *, const char *, Keymap)); /* Undocumented in the texinfo manual; not really useful to programs. */ -extern int rl_translate_keyseq __P((char *, char *, int *)); +extern int rl_translate_keyseq __P((const char *, char *, int *)); extern char *rl_untranslate_keyseq __P((int)); -extern Function *rl_named_function __P((char *)); -extern Function *rl_function_of_keyseq __P((char *, Keymap, int *)); +extern rl_command_func_t *rl_named_function __P((const char *)); +extern rl_command_func_t *rl_function_of_keyseq __P((const char *, Keymap, int *)); extern void rl_list_funmap_names __P((void)); -extern char **rl_invoking_keyseqs_in_map __P((Function *, Keymap)); -extern char **rl_invoking_keyseqs __P((Function *)); +extern char **rl_invoking_keyseqs_in_map __P((rl_command_func_t *, Keymap)); +extern char **rl_invoking_keyseqs __P((rl_command_func_t *)); extern void rl_function_dumper __P((int)); extern void rl_macro_dumper __P((int)); extern void rl_variable_dumper __P((int)); -extern int rl_read_init_file __P((char *)); +extern int rl_read_init_file __P((const char *)); extern int rl_parse_and_bind __P((char *)); /* Functions for manipulating keymaps. */ @@ -305,24 +309,27 @@ extern Keymap rl_copy_keymap __P((Keymap)); extern Keymap rl_make_keymap __P((void)); extern void rl_discard_keymap __P((Keymap)); -extern Keymap rl_get_keymap_by_name __P((char *)); +extern Keymap rl_get_keymap_by_name __P((const char *)); extern char *rl_get_keymap_name __P((Keymap)); extern void rl_set_keymap __P((Keymap)); extern Keymap rl_get_keymap __P((void)); +/* Undocumented; used internally only. */ extern void rl_set_keymap_from_edit_mode __P((void)); extern char *rl_get_keymap_name_from_edit_mode __P((void)); /* Functions for manipulating the funmap, which maps command names to functions. */ -extern int rl_add_funmap_entry __P((char *, Function *)); +extern int rl_add_funmap_entry __P((const char *, rl_command_func_t *)); +extern const char **rl_funmap_names __P((void)); +/* Undocumented, only used internally -- there is only one funmap, and this + function may be called only once. */ extern void rl_initialize_funmap __P((void)); -extern char **rl_funmap_names __P((void)); /* Utility functions for managing keyboard macros. */ extern void rl_push_macro_input __P((char *)); /* Functions for undoing, from undo.c */ extern void rl_add_undo __P((enum undo_code, int, int, char *)); -extern void free_undo_list __P((void)); +extern void rl_free_undo_list __P((void)); extern int rl_do_undo __P((void)); extern int rl_begin_undo_group __P((void)); extern int rl_end_undo_group __P((void)); @@ -335,6 +342,7 @@ extern int rl_on_new_line_with_prompt __P((void)); extern int rl_forced_update_display __P((void)); extern int rl_clear_message __P((void)); extern int rl_reset_line_state __P((void)); +extern int rl_crlf __P((void)); #if (defined (__STDC__) || defined (__cplusplus)) && defined (USE_VARARGS) && defined (PREFER_STDARG) extern int rl_message (const char *, ...); @@ -342,17 +350,17 @@ extern int rl_message (const char *, ...); extern int rl_message (); #endif -/* Undocumented in texinfo manual. */ extern int rl_show_char __P((int)); + +/* Undocumented in texinfo manual. */ extern int rl_character_len __P((int, int)); -extern int crlf __P((void)); /* Save and restore internal prompt redisplay information. */ extern void rl_save_prompt __P((void)); extern void rl_restore_prompt __P((void)); /* Modifying text. */ -extern int rl_insert_text __P((char *)); +extern int rl_insert_text __P((const char *)); extern int rl_delete_text __P((int, int)); extern int rl_kill_text __P((int, int)); extern char *rl_copy_text __P((int, int)); @@ -360,20 +368,25 @@ extern char *rl_copy_text __P((int, int)); /* Terminal and tty mode management. */ extern void rl_prep_terminal __P((int)); extern void rl_deprep_terminal __P((void)); -extern void rltty_set_default_bindings __P((Keymap)); +extern void rl_tty_set_default_bindings __P((Keymap)); -extern int rl_reset_terminal __P((char *)); +extern int rl_reset_terminal __P((const char *)); extern void rl_resize_terminal __P((void)); - -/* `Public' utility functions . */ -extern void rl_extend_line_buffer __P((int)); -extern int ding __P((void)); +extern void rl_set_screen_size __P((int, int)); +extern void rl_get_screen_size __P((int *, int *)); /* Functions for character input. */ extern int rl_stuff_char __P((int)); extern int rl_execute_next __P((int)); +extern int rl_clear_pending_input __P((void)); extern int rl_read_key __P((void)); extern int rl_getc __P((FILE *)); +extern int rl_set_keyboard_input_timeout __P((int)); + +/* `Public' utility functions . */ +extern void rl_extend_line_buffer __P((int)); +extern int rl_ding __P((void)); +extern int rl_alphabetic __P((int)); /* Readline signal handling, from signals.c */ extern int rl_set_signals __P((void)); @@ -383,19 +396,36 @@ extern void rl_reset_after_signal __P((void)); extern void rl_free_line_state __P((void)); /* Undocumented. */ -extern int rl_expand_prompt __P((char *)); +extern int rl_set_paren_blink_timeout __P((int)); -extern int maybe_save_line __P((void)); -extern int maybe_unsave_line __P((void)); -extern int maybe_replace_line __P((void)); +/* Undocumented. */ +extern int rl_maybe_save_line __P((void)); +extern int rl_maybe_unsave_line __P((void)); +extern int rl_maybe_replace_line __P((void)); /* Completion functions. */ extern int rl_complete_internal __P((int)); extern void rl_display_match_list __P((char **, int, int)); -extern char **completion_matches __P((char *, CPFunction *)); -extern char *username_completion_function __P((char *, int)); -extern char *filename_completion_function __P((char *, int)); +extern char **rl_completion_matches __P((const char *, rl_compentry_func_t *)); +extern char *rl_username_completion_function __P((const char *, int)); +extern char *rl_filename_completion_function __P((const char *, int)); + +#if 0 +/* Backwards compatibility (compat.c). These will go away sometime. */ +extern void free_undo_list __P((void)); +extern int maybe_save_line __P((void)); +extern int maybe_unsave_line __P((void)); +extern int maybe_replace_line __P((void)); + +extern int ding __P((void)); +extern int alphabetic __P((int)); +extern int crlf __P((void)); + +extern char **completion_matches __P((char *, rl_compentry_func_t *)); +extern char *username_completion_function __P((const char *, int)); +extern char *filename_completion_function __P((const char *, int)); +#endif /* **************************************************************** */ /* */ @@ -404,14 +434,21 @@ extern char *filename_completion_function __P((char *, int)); /* **************************************************************** */ /* The version of this incarnation of the readline library. */ -extern char *rl_library_version; +extern const char *rl_library_version; /* True if this is real GNU readline. */ extern int rl_gnu_readline_p; +/* Flags word encapsulating the current readline state. */ +extern int rl_readline_state; + +/* Says which editing mode readline is currently using. 1 means emacs mode; + 0 means vi mode. */ +extern int rl_editing_mode; + /* The name of the calling program. You should initialize this to whatever was in argv[0]. It is used when parsing conditionals. */ -extern char *rl_readline_name; +extern const char *rl_readline_name; /* The prompt readline uses. This is set from the argument to readline (), and should not be assigned to directly. */ @@ -421,7 +458,8 @@ extern char *rl_prompt; extern char *rl_line_buffer; /* The location of point, and end. */ -extern int rl_point, rl_end; +extern int rl_point; +extern int rl_end; /* The mark, or saved cursor position. */ extern int rl_mark; @@ -438,29 +476,44 @@ extern int rl_pending_input; or directly from an application. */ extern int rl_dispatching; +/* Non-zero if the user typed a numeric argument before executing the + current function. */ +extern int rl_explicit_arg; + +/* The current value of the numeric argument specified by the user. */ +extern int rl_numeric_arg; + +/* The address of the last command function Readline executed. */ +extern rl_command_func_t *rl_last_func; + /* The name of the terminal to use. */ -extern char *rl_terminal_name; +extern const char *rl_terminal_name; /* The input and output streams. */ -extern FILE *rl_instream, *rl_outstream; +extern FILE *rl_instream; +extern FILE *rl_outstream; /* If non-zero, then this is the address of a function to call just before readline_internal () prints the first prompt. */ -extern Function *rl_startup_hook; +extern rl_hook_func_t *rl_startup_hook; /* If non-zero, this is the address of a function to call just before readline_internal_setup () returns and readline_internal starts reading input characters. */ -extern Function *rl_pre_input_hook; +extern rl_hook_func_t *rl_pre_input_hook; /* The address of a function to call periodically while Readline is awaiting character input, or NULL, for no event handling. */ -extern Function *rl_event_hook; +extern rl_hook_func_t *rl_event_hook; -extern Function *rl_getc_function; -extern VFunction *rl_redisplay_function; -extern VFunction *rl_prep_term_function; -extern VFunction *rl_deprep_term_function; +/* The address of the function to call to fetch a character from the current + Readline input stream */ +extern rl_getc_func_t *rl_getc_function; + +extern rl_voidfunc_t *rl_redisplay_function; + +extern rl_vintfunc_t *rl_prep_term_function; +extern rl_voidfunc_t *rl_deprep_term_function; /* Dispatch variables. */ extern Keymap rl_executing_keymap; @@ -481,6 +534,9 @@ extern int rl_already_prompted; up to a character bound to accept-line. */ extern int rl_num_chars_to_read; +/* The text of a currently-executing keyboard macro. */ +extern char *rl_executing_macro; + /* Variables to control readline signal handling. */ /* If non-zero, readline will install its own signal handlers for SIGINT, SIGTERM, SIGQUIT, SIGALRM, SIGTSTP, SIGTTIN, and SIGTTOU. */ @@ -497,7 +553,7 @@ extern int rl_catch_sigwinch; /* Pointer to the generator function for completion_matches (). NULL means to use filename_entry_function (), the default filename completer. */ -extern Function *rl_completion_entry_function; +extern rl_compentry_func_t *rl_completion_entry_function; /* If rl_ignore_some_completions_function is non-NULL it is the address of a function to call after all of the possible matches have been @@ -505,7 +561,7 @@ extern Function *rl_completion_entry_function; The function is called with one argument; a NULL terminated array of (char *). If your function removes any of the elements, they must be free()'ed. */ -extern Function *rl_ignore_some_completions_function; +extern rl_compignore_func_t *rl_ignore_some_completions_function; /* Pointer to alternative function to create matches. Function is called with TEXT, START, and END. @@ -514,39 +570,50 @@ extern Function *rl_ignore_some_completions_function; If this function exists and returns NULL then call the value of rl_completion_entry_function to try to match, otherwise use the array of strings returned. */ -extern CPPFunction *rl_attempted_completion_function; +extern rl_completion_func_t *rl_attempted_completion_function; /* The basic list of characters that signal a break between words for the completer routine. The initial contents of this variable is what breaks words in the shell, i.e. "n\"\\'`@$>". */ -extern char *rl_basic_word_break_characters; +extern const char *rl_basic_word_break_characters; /* The list of characters that signal a break between words for rl_complete_internal. The default list is the contents of rl_basic_word_break_characters. */ -extern char *rl_completer_word_break_characters; +extern const char *rl_completer_word_break_characters; /* List of characters which can be used to quote a substring of the line. Completion occurs on the entire substring, and within the substring rl_completer_word_break_characters are treated as any other character, unless they also appear within this list. */ -extern char *rl_completer_quote_characters; +extern const char *rl_completer_quote_characters; /* List of quote characters which cause a word break. */ -extern char *rl_basic_quote_characters; +extern const char *rl_basic_quote_characters; /* List of characters that need to be quoted in filenames by the completer. */ -extern char *rl_filename_quote_characters; +extern const char *rl_filename_quote_characters; /* List of characters that are word break characters, but should be left in TEXT when it is passed to the completion function. The shell uses this to help determine what kind of completing to do. */ -extern char *rl_special_prefixes; +extern const char *rl_special_prefixes; /* 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. */ -extern Function *rl_directory_completion_hook; + the address of a string (the current directory name) as an arg. It + changes what is displayed when the possible completions are printed + or inserted. */ +extern rl_icppfunc_t *rl_directory_completion_hook; + +/* If non-zero, this is the address of a function to call when completing + a directory name. This function takes the address of the directory name + to be modified as an argument. Unlike rl_directory_completion_hook, it + only modifies the directory name used in opendir(2), not what is displayed + when the possible completions are printed or inserted. It is called + before rl_directory_completion_hook. I'm not happy with how this works + yet, so it's undocumented. */ +extern rl_icppfunc_t *rl_directory_rewrite_hook; /* Backwards compatibility with previous versions of readline. */ #define rl_symbolic_link_hook rl_directory_completion_hook @@ -558,7 +625,7 @@ extern Function *rl_directory_completion_hook; where MATCHES is the array of strings that matched, NUM_MATCHES is the number of strings in that array, and MAX_LENGTH is the length of the longest string in that array. */ -extern VFunction *rl_completion_display_matches_hook; +extern rl_compdisp_func_t *rl_completion_display_matches_hook; /* Non-zero means that the results of the matches are to be treated as filenames. This is ALWAYS zero on entry, and can only be changed @@ -576,17 +643,17 @@ extern int rl_filename_quoting_desired; Called with the text to quote, the type of match found (single or multiple) and a pointer to the quoting character to be used, which the function can reset if desired. */ -extern CPFunction *rl_filename_quoting_function; +extern rl_quote_func_t *rl_filename_quoting_function; /* Function to call to remove quoting characters from a filename. Called before completion is attempted, so the embedded quotes do not interfere with matching names in the file system. */ -extern CPFunction *rl_filename_dequoting_function; +extern rl_dequote_func_t *rl_filename_dequoting_function; /* Function to call to decide whether or not a word break character is quoted. If a character is quoted, it does not break words for the completer. */ -extern Function *rl_char_is_quoted_p; +extern rl_linebuf_func_t *rl_char_is_quoted_p; /* Non-zero means to suppress normal filename completion after the user-specified completion function has been called. */ @@ -623,9 +690,33 @@ extern int rl_inhibit_completion; #define SINGLE_MATCH 1 #define MULT_MATCH 2 -#if !defined (savestring) -extern char *savestring __P((char *)); /* XXX backwards compatibility */ -#endif +/* Possible state values for rl_readline_state */ +#define RL_STATE_NONE 0x00000 /* no state; before first call */ + +#define RL_STATE_INITIALIZING 0x00001 /* initializing */ +#define RL_STATE_INITIALIZED 0x00002 /* initialization done */ +#define RL_STATE_TERMPREPPED 0x00004 /* terminal is prepped */ +#define RL_STATE_READCMD 0x00008 /* reading a command key */ +#define RL_STATE_METANEXT 0x00010 /* reading input after ESC */ +#define RL_STATE_DISPATCHING 0x00020 /* dispatching to a command */ +#define RL_STATE_MOREINPUT 0x00040 /* reading more input in a command function */ +#define RL_STATE_ISEARCH 0x00080 /* doing incremental search */ +#define RL_STATE_NSEARCH 0x00100 /* doing non-inc search */ +#define RL_STATE_SEARCH 0x00200 /* doing a history search */ +#define RL_STATE_NUMERICARG 0x00400 /* reading numeric argument */ +#define RL_STATE_MACROINPUT 0x00800 /* getting input from a macro */ +#define RL_STATE_MACRODEF 0x01000 /* defining keyboard macro */ +#define RL_STATE_OVERWRITE 0x02000 /* overwrite mode */ +#define RL_STATE_COMPLETING 0x04000 /* doing completion */ +#define RL_STATE_SIGHANDLER 0x08000 /* in readline sighandler */ +#define RL_STATE_UNDOING 0x10000 /* doing an undo */ +#define RL_STATE_INPUTPENDING 0x20000 /* rl_execute_next called */ + +#define RL_STATE_DONE 0x80000 /* done; accepted line */ + +#define RL_SETSTATE(x) (rl_readline_state |= (x)) +#define RL_UNSETSTATE(x) (rl_readline_state &= ~(x)) +#define RL_ISSTATE(x) (rl_readline_state & (x)) #ifdef __cplusplus } diff --git a/contrib/libreadline/rldefs.h b/contrib/libreadline/rldefs.h index e504d9b..4e094bf 100644 --- a/contrib/libreadline/rldefs.h +++ b/contrib/libreadline/rldefs.h @@ -30,6 +30,8 @@ # include "config.h" #endif +#include "rlstdc.h" + #if defined (_POSIX_VERSION) && !defined (TERMIOS_MISSING) # define TERMIOS_TTY_DRIVER #else @@ -71,7 +73,8 @@ extern char *strchr (), *strrchr (); #define _rl_stricmp strcasecmp #define _rl_strnicmp strncasecmp #else -extern int _rl_stricmp (), _rl_strnicmp (); +extern int _rl_stricmp __P((char *, char *); +extern int _rl_strnicmp __P((char *, char *)); #endif #if !defined (emacs_mode) @@ -87,14 +90,14 @@ extern int _rl_stricmp (), _rl_strnicmp (); This is not what is wanted. */ #if defined (CRAY) # define FUNCTION_TO_KEYMAP(map, key) (Keymap)((int)map[key].function) -# define KEYMAP_TO_FUNCTION(data) (Function *)((int)(data)) +# define KEYMAP_TO_FUNCTION(data) (rl_command_func_t *)((int)(data)) #else # define FUNCTION_TO_KEYMAP(map, key) (Keymap)(map[key].function) -# define KEYMAP_TO_FUNCTION(data) (Function *)(data) +# define KEYMAP_TO_FUNCTION(data) (rl_command_func_t *)(data) #endif #ifndef savestring -extern char *xmalloc (); +extern char *xmalloc __P((int)); #define savestring(x) strcpy (xmalloc (1 + strlen (x)), (x)) #endif diff --git a/contrib/libreadline/rlprivate.h b/contrib/libreadline/rlprivate.h index c05230e..a36de9b 100644 --- a/contrib/libreadline/rlprivate.h +++ b/contrib/libreadline/rlprivate.h @@ -35,7 +35,7 @@ *************************************************************************/ /* terminal.c */ -extern char *rl_get_termcap __P((char *)); +extern char *rl_get_termcap __P((const char *)); /************************************************************************* * * @@ -51,12 +51,8 @@ extern int rl_visible_stats; /* readline.c */ extern int rl_line_buffer_len; -extern int rl_numeric_arg; extern int rl_arg_sign; -extern int rl_explicit_arg; -extern int rl_editing_mode; extern int rl_visible_prompt_length; -extern Function *rl_last_func; extern int readline_echoing_p; extern int rl_key_sequence_length; @@ -91,7 +87,7 @@ extern void _rl_set_screen_size __P((int, int)); extern int _rl_fix_last_undo_of_type __P((int, int, int)); /* util.c */ -extern char *_rl_savestring __P((char *)); +extern char *_rl_savestring __P((const char *)); /************************************************************************* * * @@ -118,11 +114,11 @@ extern int readline_internal_char __P((void)); #endif /* READLINE_CALLBACKS */ /* bind.c */ -extern void _rl_bind_if_unbound __P((char *, Function *)); +extern void _rl_bind_if_unbound __P((const char *, rl_command_func_t *)); /* display.c */ extern char *_rl_strip_prompt __P((char *)); -extern void _rl_move_cursor_relative __P((int, char *)); +extern void _rl_move_cursor_relative __P((int, const char *)); extern void _rl_move_vert __P((int)); extern void _rl_save_prompt __P((void)); extern void _rl_restore_prompt __P((void)); @@ -134,7 +130,7 @@ extern void _rl_update_final __P((void)); extern void _rl_redisplay_after_sigwinch __P((void)); extern void _rl_clean_up_for_exit __P((void)); extern void _rl_erase_entire_line __P((void)); -extern int _rl_currentb_display_line __P((void)); +extern int _rl_current_display_line __P((void)); /* input.c */ extern int _rl_any_typein __P((void)); @@ -161,9 +157,10 @@ extern void _rl_set_the_line __P((void)); extern int _rl_dispatch __P((int, Keymap)); extern int _rl_init_argument __P((void)); extern void _rl_fix_point __P((int)); -extern void _rl_replace_text __P((char *, int, int)); +extern void _rl_replace_text __P((const char *, int, int)); extern int _rl_char_search_internal __P((int, int, int)); extern int _rl_set_mark_at_pos __P((int)); +extern int _rl_free_saved_history_line __P((void)); /* rltty.c */ extern int _rl_disable_tty_signals __P((void)); @@ -171,21 +168,22 @@ extern int _rl_restore_tty_signals __P((void)); /* terminal.c */ extern void _rl_get_screen_size __P((int, int)); -extern int _rl_init_terminal_io __P((char *)); +extern int _rl_init_terminal_io __P((const char *)); #ifdef _MINIX extern void _rl_output_character_function __P((int)); #else extern int _rl_output_character_function __P((int)); #endif -extern void _rl_output_some_chars __P((char *, int)); +extern void _rl_output_some_chars __P((const char *, int)); extern int _rl_backspace __P((int)); extern void _rl_enable_meta_key __P((void)); extern void _rl_control_keypad __P((int)); /* util.c */ -extern int alphabetic __P((int)); +extern int rl_alphabetic __P((int)); extern int _rl_abort_internal __P((void)); -extern char *_rl_strindex __P((char *, char *)); +extern char *_rl_strindex __P((const char *, const char *)); +extern char *_rl_strpbrk __P((const char *, const char *)); extern int _rl_qsort_string_compare __P((char **, char **)); extern int (_rl_uppercase_p) __P((int)); extern int (_rl_lowercase_p) __P((int)); @@ -206,6 +204,10 @@ extern void _rl_vi_done_inserting __P((void)); * Undocumented private variables * *************************************************************************/ +/* bind.c */ +extern const char *_rl_possible_control_prefixes[]; +extern const char *_rl_possible_meta_prefixes[]; + /* complete.c */ extern int _rl_complete_show_all; extern int _rl_complete_mark_directories; @@ -218,10 +220,6 @@ extern int _rl_last_c_pos; extern int _rl_suppress_redisplay; extern char *rl_display_prompt; -/* funmap.c */ -extern char *possible_control_prefixes[]; -extern char *possible_meta_prefixes[]; - /* isearch.c */ extern unsigned char *_rl_isearch_terminators; @@ -248,20 +246,20 @@ extern procenv_t readline_top_level; /* terminal.c */ extern int _rl_enable_keypad; extern int _rl_enable_meta; -extern char *term_clreol; -extern char *term_clrpag; -extern char *term_im; -extern char *term_ic; -extern char *term_ei; -extern char *term_DC; -extern char *term_up; -extern char *term_dc; -extern char *term_cr; -extern char *term_IC; -extern int screenheight; -extern int screenwidth; -extern int screenchars; -extern int terminal_can_insert; +extern char *_rl_term_clreol; +extern char *_rl_term_clrpag; +extern char *_rl_term_im; +extern char *_rl_term_ic; +extern char *_rl_term_ei; +extern char *_rl_term_DC; +extern char *_rl_term_up; +extern char *_rl_term_dc; +extern char *_rl_term_cr; +extern char *_rl_term_IC; +extern int _rl_screenheight; +extern int _rl_screenwidth; +extern int _rl_screenchars; +extern int _rl_terminal_can_insert; extern int _rl_term_autowrap; /* undo.c */ diff --git a/contrib/libreadline/rlshell.h b/contrib/libreadline/rlshell.h index 7a4e699..6032275 100644 --- a/contrib/libreadline/rlshell.h +++ b/contrib/libreadline/rlshell.h @@ -25,10 +25,10 @@ #include "rlstdc.h" -extern char *single_quote __P((char *)); -extern void set_lines_and_columns __P((int, int)); -extern char *get_env_value __P((char *)); -extern char *get_home_dir __P((void)); -extern int unset_nodelay_mode __P((int)); +extern char *sh_single_quote __P((char *)); +extern void sh_set_lines_and_columns __P((int, int)); +extern char *sh_get_env_value __P((const char *)); +extern char *sh_get_home_dir __P((void)); +extern int sh_unset_nodelay_mode __P((int)); #endif /* _RL_SHELL_H_ */ diff --git a/contrib/libreadline/rlstdc.h b/contrib/libreadline/rlstdc.h index dac8e98..a1ca208 100644 --- a/contrib/libreadline/rlstdc.h +++ b/contrib/libreadline/rlstdc.h @@ -36,4 +36,16 @@ # endif #endif +#if !defined (__STDC__) && !defined (__cplusplus) +# if defined (__GNUC__) /* gcc with -traditional */ +# if !defined (const) +# define const __const +# endif /* !const */ +# else /* !__GNUC__ */ +# if !defined (const) +# define const +# endif /* !const */ +# endif /* !__GNUC__ */ +#endif /* !__STDC__ && !__cplusplus */ + #endif /* !_RL_STDC_H_ */ diff --git a/contrib/libreadline/rltty.c b/contrib/libreadline/rltty.c index b868b69..636e7f7 100644 --- a/contrib/libreadline/rltty.c +++ b/contrib/libreadline/rltty.c @@ -49,8 +49,8 @@ extern int errno; #endif /* !errno */ -VFunction *rl_prep_term_function = rl_prep_terminal; -VFunction *rl_deprep_term_function = rl_deprep_terminal; +rl_vintfunc_t *rl_prep_term_function = rl_prep_terminal; +rl_voidfunc_t *rl_deprep_term_function = rl_deprep_terminal; /* **************************************************************** */ /* */ @@ -190,7 +190,7 @@ save_tty_chars (tiop) _rl_tty_chars.t_intr = tiop->tchars.t_intrc; _rl_tty_chars.t_quit = tiop->tchars.t_quitc; _rl_tty_chars.t_start = tiop->tchars.t_startc; - _rl_tty_chars.t_stop = tiop->tchars.t_stopc + _rl_tty_chars.t_stop = tiop->tchars.t_stopc; _rl_tty_chars.t_eof = tiop->tchars.t_eofc; _rl_tty_chars.t_eol = '\n'; _rl_tty_chars.t_eol2 = tiop->tchars.t_brkc; @@ -218,22 +218,23 @@ get_tty_settings (tty, tiop) tiop->flags = tiop->lflag = 0; - ioctl (tty, TIOCGETP, &(tiop->sgttyb)); + if (ioctl (tty, TIOCGETP, &(tiop->sgttyb)) < 0) + return -1; tiop->flags |= SGTTY_SET; #if defined (TIOCLGET) - ioctl (tty, TIOCLGET, &(tiop->lflag)); - tiop->flags |= LFLAG_SET; + if (ioctl (tty, TIOCLGET, &(tiop->lflag)) == 0) + tiop->flags |= LFLAG_SET; #endif #if defined (TIOCGETC) - ioctl (tty, TIOCGETC, &(tiop->tchars)); - tiop->flags |= TCHARS_SET; + if (ioctl (tty, TIOCGETC, &(tiop->tchars)) == 0) + tiop->flags |= TCHARS_SET; #endif #if defined (TIOCGLTC) - ioctl (tty, TIOCGLTC, &(tiop->ltchars)); - tiop->flags |= LTCHARS_SET; + if (ioctl (tty, TIOCGLTC, &(tiop->ltchars)) == 0) + tiop->flags |= LTCHARS_SET; #endif return 0; @@ -279,23 +280,23 @@ set_tty_settings (tty, tiop) } static void -prepare_terminal_settings (meta_flag, otio, tiop) +prepare_terminal_settings (meta_flag, oldtio, tiop) int meta_flag; - TIOTYPE otio, *tiop; + TIOTYPE oldtio, *tiop; { - readline_echoing_p = (otio.sgttyb.sg_flags & ECHO); + readline_echoing_p = (oldtio.sgttyb.sg_flags & ECHO); /* Copy the original settings to the structure we're going to use for our settings. */ - tiop->sgttyb = otio.sgttyb; - tiop->lflag = otio.lflag; + tiop->sgttyb = oldtio.sgttyb; + tiop->lflag = oldtio.lflag; #if defined (TIOCGETC) - tiop->tchars = otio.tchars; + tiop->tchars = oldtio.tchars; #endif #if defined (TIOCGLTC) - tiop->ltchars = otio.ltchars; + tiop->ltchars = oldtio.ltchars; #endif - tiop->flags = otio.flags; + tiop->flags = oldtio.flags; /* First, the basic settings to put us into character-at-a-time, no-echo input mode. */ @@ -308,8 +309,8 @@ prepare_terminal_settings (meta_flag, otio, tiop) #if !defined (ANYP) # define ANYP (EVENP | ODDP) #endif - if (((otio.sgttyb.sg_flags & ANYP) == ANYP) || - ((otio.sgttyb.sg_flags & ANYP) == 0)) + if (((oldtio.sgttyb.sg_flags & ANYP) == ANYP) || + ((oldtio.sgttyb.sg_flags & ANYP) == 0)) { tiop->sgttyb.sg_flags |= ANYP; @@ -328,13 +329,13 @@ prepare_terminal_settings (meta_flag, otio, tiop) tiop->tchars.t_startc = -1; /* C-q */ /* If there is an XON character, bind it to restart the output. */ - if (otio.tchars.t_startc != -1) - rl_bind_key (otio.tchars.t_startc, rl_restart_output); + if (oldtio.tchars.t_startc != -1) + rl_bind_key (oldtio.tchars.t_startc, rl_restart_output); # endif /* USE_XON_XOFF */ /* If there is an EOF char, bind _rl_eof_char to it. */ - if (otio.tchars.t_eofc != -1) - _rl_eof_char = otio.tchars.t_eofc; + if (oldtio.tchars.t_eofc != -1) + _rl_eof_char = oldtio.tchars.t_eofc; # if defined (NO_KILL_INTR) /* Get rid of terminal-generated SIGQUIT and SIGINT. */ @@ -373,7 +374,7 @@ prepare_terminal_settings (meta_flag, otio, tiop) # define TIOTYPE struct termio # define DRAIN_OUTPUT(fd) # define GETATTR(tty, tiop) (ioctl (tty, TCGETA, tiop)) -# define SETATTR(tty, tiop) (ioctl (tty, TCSETA, tiop)) +# define SETATTR(tty, tiop) (ioctl (tty, TCSETAW, tiop)) #endif /* !TERMIOS_TTY_DRIVER */ static TIOTYPE otio; @@ -545,16 +546,16 @@ set_tty_settings (tty, tiop) } static void -prepare_terminal_settings (meta_flag, otio, tiop) +prepare_terminal_settings (meta_flag, oldtio, tiop) int meta_flag; - TIOTYPE otio, *tiop; + TIOTYPE oldtio, *tiop; { - readline_echoing_p = (otio.c_lflag & ECHO); + readline_echoing_p = (oldtio.c_lflag & ECHO); tiop->c_lflag &= ~(ICANON | ECHO); - if ((unsigned char) otio.c_cc[VEOF] != (unsigned char) _POSIX_VDISABLE) - _rl_eof_char = otio.c_cc[VEOF]; + if ((unsigned char) oldtio.c_cc[VEOF] != (unsigned char) _POSIX_VDISABLE) + _rl_eof_char = oldtio.c_cc[VEOF]; #if defined (USE_XON_XOFF) #if defined (IXANY) @@ -585,7 +586,7 @@ prepare_terminal_settings (meta_flag, otio, tiop) if (OUTPUT_BEING_FLUSHED (tiop)) { tiop->c_lflag &= ~FLUSHO; - otio.c_lflag &= ~FLUSHO; + oldtio.c_lflag &= ~FLUSHO; } #endif @@ -645,6 +646,7 @@ rl_prep_terminal (meta_flag) fflush (rl_outstream); terminal_prepped = 1; + RL_SETSTATE(RL_STATE_TERMPREPPED); release_sigint (); } @@ -675,6 +677,7 @@ rl_deprep_terminal () } terminal_prepped = 0; + RL_UNSETSTATE(RL_STATE_TERMPREPPED); release_sigint (); } @@ -751,6 +754,9 @@ rl_stop_output (count, key) /* Default Key Bindings */ /* */ /* **************************************************************** */ + +/* Set the system's default editing characters to their readline equivalents + in KMAP. Should be static, now that we have rl_tty_set_default_bindings. */ void rltty_set_default_bindings (kmap) Keymap kmap; @@ -815,6 +821,15 @@ rltty_set_default_bindings (kmap) #endif /* !NEW_TTY_DRIVER */ } +/* New public way to set the system default editing chars to their readline + equivalents. */ +void +rl_tty_set_default_bindings (kmap) + Keymap kmap; +{ + rltty_set_default_bindings (kmap); +} + #if defined (HANDLE_SIGNALS) #if defined (NEW_TTY_DRIVER) diff --git a/contrib/libreadline/rltypedefs.h b/contrib/libreadline/rltypedefs.h new file mode 100644 index 0000000..b6f9b42 --- /dev/null +++ b/contrib/libreadline/rltypedefs.h @@ -0,0 +1,88 @@ +/* rltypedefs.h -- Type declarations for readline functions. */ + +/* Copyright (C) 2000 Free Software Foundation, Inc. + + This file is part of the GNU Readline Library, a library for + reading lines of text with interactive input and history editing. + + The GNU Readline Library is free software; you can redistribute it + and/or modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2, or + (at your option) any later version. + + The GNU Readline Library is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied warranty + of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + The GNU General Public License is often shipped with GNU software, and + is generally kept in a file called COPYING or LICENSE. If you do not + have a copy of the license, write to the Free Software Foundation, + 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ + +#ifndef _RL_TYPEDEFS_H_ +#define _RL_TYPEDEFS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Old-style */ + +#if !defined (_FUNCTION_DEF) +# define _FUNCTION_DEF + +typedef int Function (); +typedef void VFunction (); +typedef char *CPFunction (); +typedef char **CPPFunction (); + +#endif /* _FUNCTION_DEF */ + +/* New style. */ + +#if !defined (_RL_FUNCTION_TYPEDEF) +# define _RL_FUNCTION_TYPEDEF + +/* Bindable functions */ +typedef int rl_command_func_t __P((int, int)); + +/* Typedefs for the completion system */ +typedef char *rl_compentry_func_t __P((const char *, int)); +typedef char **rl_completion_func_t __P((const char *, int, int)); + +typedef char *rl_quote_func_t __P((char *, int, char *)); +typedef char *rl_dequote_func_t __P((char *, int)); + +typedef int rl_compignore_func_t __P((char **)); + +typedef void rl_compdisp_func_t __P((char **, int, int)); + +/* Type for input and pre-read hook functions like rl_event_hook */ +typedef int rl_hook_func_t __P((void)); + +/* Input function type */ +typedef int rl_getc_func_t __P((FILE *)); + +/* Generic function that takes a character buffer (which could be the readline + line buffer) and an index into it (which could be rl_point) and returns + an int. */ +typedef int rl_linebuf_func_t __P((char *, int)); + +/* `Generic' function pointer typedefs */ +typedef int rl_intfunc_t __P((int)); +#define rl_ivoidfunc_t rl_hook_func_t +typedef int rl_icpfunc_t __P((char *)); +typedef int rl_icppfunc_t __P((char **)); + +typedef void rl_voidfunc_t __P((void)); +typedef void rl_vintfunc_t __P((int)); +typedef void rl_vcpfunc_t __P((char *)); +typedef void rl_vcppfunc_t __P((char **)); +#endif /* _RL_FUNCTION_TYPEDEF */ + +#ifdef __cplusplus +} +#endif + +#endif /* _RL_TYPEDEFS_H_ */ diff --git a/contrib/libreadline/search.c b/contrib/libreadline/search.c index 112f807..45d7f13 100644 --- a/contrib/libreadline/search.c +++ b/contrib/libreadline/search.c @@ -51,7 +51,7 @@ #endif #define abs(x) (((x) >= 0) ? (x) : -(x)) -extern HIST_ENTRY *saved_line_for_history; +extern HIST_ENTRY *_rl_saved_line_for_history; /* Functions imported from the rest of the library. */ extern int _rl_free_history_entry __P((HIST_ENTRY *)); @@ -83,9 +83,9 @@ make_history_line_current (entry) rl_undo_list = (UNDO_LIST *)entry->data; rl_end = line_len; - if (saved_line_for_history) - _rl_free_history_entry (saved_line_for_history); - saved_line_for_history = (HIST_ENTRY *)NULL; + if (_rl_saved_line_for_history) + _rl_free_history_entry (_rl_saved_line_for_history); + _rl_saved_line_for_history = (HIST_ENTRY *)NULL; } /* Search the history list for STRING starting at absolute history position @@ -100,13 +100,19 @@ noninc_search_from_pos (string, pos, dir) { int ret, old; + if (pos < 0) + return -1; + old = where_history (); - history_set_pos (pos); + if (history_set_pos (pos) == 0) + return -1; + RL_SETSTATE(RL_STATE_SEARCH); if (*string == '^') ret = history_search_prefix (string + 1, dir); else ret = history_search (string, dir); + RL_UNSETSTATE(RL_STATE_SEARCH); if (ret != -1) ret = where_history (); @@ -128,7 +134,7 @@ noninc_dosearch (string, dir) if (string == 0 || *string == '\0' || noninc_history_pos < 0) { - ding (); + rl_ding (); return; } @@ -136,10 +142,10 @@ noninc_dosearch (string, dir) if (pos == -1) { /* Search failed, current history position unchanged. */ - maybe_unsave_line (); + rl_maybe_unsave_line (); rl_clear_message (); rl_point = 0; - ding (); + rl_ding (); return; } @@ -172,7 +178,7 @@ noninc_search (dir, pchar) int saved_point, c; char *p; - maybe_save_line (); + rl_maybe_save_line (); saved_point = rl_point; /* Use the line buffer to read the search string. */ @@ -183,18 +189,26 @@ noninc_search (dir, pchar) rl_message (p, 0, 0); free (p); -#define SEARCH_RETURN rl_restore_prompt (); return +#define SEARCH_RETURN rl_restore_prompt (); RL_UNSETSTATE(RL_STATE_NSEARCH); return + RL_SETSTATE(RL_STATE_NSEARCH); /* Read the search string. */ - while (c = rl_read_key ()) + while (1) { + RL_SETSTATE(RL_STATE_MOREINPUT); + c = rl_read_key (); + RL_UNSETSTATE(RL_STATE_MOREINPUT); + + if (c == 0) + break; + switch (c) { case CTRL('H'): case RUBOUT: if (rl_point == 0) { - maybe_unsave_line (); + rl_maybe_unsave_line (); rl_clear_message (); rl_point = saved_point; SEARCH_RETURN; @@ -218,10 +232,10 @@ noninc_search (dir, pchar) case CTRL('C'): case CTRL('G'): - maybe_unsave_line (); + rl_maybe_unsave_line (); rl_clear_message (); rl_point = saved_point; - ding (); + rl_ding (); SEARCH_RETURN; default: @@ -239,7 +253,7 @@ noninc_search (dir, pchar) { if (!noninc_search_string) { - ding (); + rl_ding (); SEARCH_RETURN; } } @@ -253,6 +267,7 @@ noninc_search (dir, pchar) rl_restore_prompt (); noninc_dosearch (noninc_search_string, dir); + RL_UNSETSTATE(RL_STATE_NSEARCH); } /* Search forward through the history list for a string. If the vi-mode @@ -283,7 +298,7 @@ rl_noninc_forward_search_again (count, key) { if (!noninc_search_string) { - ding (); + rl_ding (); return (-1); } noninc_dosearch (noninc_search_string, 1); @@ -298,7 +313,7 @@ rl_noninc_reverse_search_again (count, key) { if (!noninc_search_string) { - ding (); + rl_ding (); return (-1); } noninc_dosearch (noninc_search_string, -1); @@ -312,7 +327,7 @@ rl_history_search_internal (count, dir) HIST_ENTRY *temp; int ret, oldpos; - maybe_save_line (); + rl_maybe_save_line (); temp = (HIST_ENTRY *)NULL; /* Search COUNT times through the history for a line whose prefix @@ -341,8 +356,8 @@ rl_history_search_internal (count, dir) /* If we didn't find anything at all, return. */ if (temp == 0) { - maybe_unsave_line (); - ding (); + rl_maybe_unsave_line (); + rl_ding (); /* If you don't want the saved history line (last match) to show up in the line buffer after the search fails, change the #if 0 to #if 1 */ @@ -353,7 +368,7 @@ rl_history_search_internal (count, dir) rl_line_buffer[rl_end] = '\0'; } #else - rl_point = rl_history_search_len; /* maybe_unsave_line changes it */ + rl_point = rl_history_search_len; /* rl_maybe_unsave_line changes it */ #endif return 1; } @@ -382,6 +397,7 @@ rl_history_search_reinit () strncpy (history_search_string + 1, rl_line_buffer, rl_point); history_search_string[rl_point + 1] = '\0'; } + _rl_free_saved_history_line (); } /* Search forward in the history for the string of characters diff --git a/contrib/libreadline/shell.c b/contrib/libreadline/shell.c index 3daef69..3727f7c 100644 --- a/contrib/libreadline/shell.c +++ b/contrib/libreadline/shell.c @@ -49,11 +49,12 @@ #include +#include "rlstdc.h" #include "rlshell.h" #include "xmalloc.h" #if !defined (HAVE_GETPW_DECLS) -extern struct passwd *getpwuid (); +extern struct passwd *getpwuid __P((uid_t)); #endif /* !HAVE_GETPW_DECLS */ #ifndef NULL @@ -65,7 +66,7 @@ extern struct passwd *getpwuid (); /* Does shell-like quoting using single quotes. */ char * -single_quote (string) +sh_single_quote (string) char *string; { register int c; @@ -96,7 +97,7 @@ single_quote (string) /* Set the environment variables LINES and COLUMNS to lines and cols, respectively. */ void -set_lines_and_columns (lines, cols) +sh_set_lines_and_columns (lines, cols) int lines, cols; { char *b; @@ -121,14 +122,14 @@ set_lines_and_columns (lines, cols) } char * -get_env_value (varname) - char *varname; +sh_get_env_value (varname) + const char *varname; { return ((char *)getenv (varname)); } char * -get_home_dir () +sh_get_home_dir () { char *home_dir; struct passwd *entry; @@ -147,7 +148,7 @@ get_home_dir () #endif int -unset_nodelay_mode (fd) +sh_unset_nodelay_mode (fd) int fd; { int flags, bflags; diff --git a/contrib/libreadline/shlib/Makefile.in b/contrib/libreadline/shlib/Makefile.in index b1f70de..9eaa5f5 100644 --- a/contrib/libreadline/shlib/Makefile.in +++ b/contrib/libreadline/shlib/Makefile.in @@ -36,6 +36,7 @@ ARFLAGS = @ARFLAGS@ RM = rm -f CP = cp MV = mv +LN = ln SHELL = @MAKE_SHELL@ @@ -43,6 +44,7 @@ host_os = @host_os@ prefix = @prefix@ exec_prefix = @exec_prefix@ +includedir = @includedir@ libdir = @libdir@ CFLAGS = @CFLAGS@ @@ -108,7 +110,8 @@ CSOURCES = $(topdir)/readline.c $(topdir)/funmap.c $(topdir)/keymaps.c \ $(topdir)/callback.c $(topdir)/terminal.c $(topdir)/xmalloc.c \ $(topdir)/history.c $(topdir)/histsearch.c $(topdir)/histexpand.c \ $(topdir)/histfile.c $(topdir)/nls.c $(topdir)/search.c \ - $(topdir)/shell.c $(topdir)/savestring.c $(topdir)/tilde.c + $(topdir)/shell.c $(topdir)/savestring.c $(topdir)/compat.c \ + $(topdir)/tilde.c # The header files for this library. HSOURCES = readline.h rldefs.h chardefs.h keymaps.h history.h histlib.h \ @@ -120,7 +123,7 @@ SHARED_TILDEOBJ = tilde.so SHARED_OBJ = readline.so vi_mode.so funmap.so keymaps.so parens.so search.so \ rltty.so complete.so bind.so isearch.so display.so signals.so \ util.so kill.so undo.so macro.so input.so callback.so terminal.so \ - nls.so xmalloc.so $(SHARED_HISTOBJ) $(SHARED_TILDEOBJ) + nls.so xmalloc.so $(SHARED_HISTOBJ) $(SHARED_TILDEOBJ) compat.so ########################################################################## @@ -173,90 +176,108 @@ force: bind.so: $(topdir)/ansi_stdlib.h $(topdir)/posixstat.h bind.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h bind.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +bind.so: $(topdir)/rltypedefs.h bind.so: $(topdir)/tilde.h $(topdir)/history.h +compat.so: $(topdir)/rlstdc.h callback.so: $(topdir)/rlconf.h callback.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h callback.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +callback.so: $(topdir)/rltypedefs.h callback.so: $(topdir)/tilde.h complete.so: $(topdir)/ansi_stdlib.h posixdir.h $(topdir)/posixstat.h complete.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h complete.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +complete.so: $(topdir)/rltypedefs.h complete.so: $(topdir)/tilde.h display.so: $(topdir)/ansi_stdlib.h $(topdir)/posixstat.h display.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h display.so: $(topdir)/tcap.h display.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +display.so: $(topdir)/rltypedefs.h display.so: $(topdir)/tilde.h $(topdir)/history.h funmap.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +funmap.so: $(topdir)/rltypedefs.h funmap.so: $(topdir)/rlconf.h $(topdir)/ansi_stdlib.h funmap.so: ${BUILD_DIR}/config.h $(topdir)/tilde.h histexpand.so: $(topdir)/ansi_stdlib.h -histexpand.so: $(topdir)/history.h histlib.h +histexpand.so: $(topdir)/history.h $(topdir)/histlib.h $(topdir)/rltypedefs.h histexpand.so: ${BUILD_DIR}/config.h histfile.so: $(topdir)/ansi_stdlib.h -histfile.so: $(topdir)/history.h histlib.h +histfile.so: $(topdir)/history.h $(topdir)/histlib.h $(topdir)/rltypedefs.h histfile.so: ${BUILD_DIR}/config.h history.so: $(topdir)/ansi_stdlib.h -history.so: $(topdir)/history.h histlib.h +history.so: $(topdir)/history.h $(topdir)/histlib.h $(topdir)/rltypedefs.h history.so: ${BUILD_DIR}/config.h histsearch.so: $(topdir)/ansi_stdlib.h -histsearch.so: $(topdir)/history.h histlib.h +histsearch.so: $(topdir)/history.h $(topdir)/histlib.h $(topdir)/rltypedefs.h histsearch.so: ${BUILD_DIR}/config.h input.so: $(topdir)/ansi_stdlib.h input.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h input.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +input.so: $(topdir)/rltypedefs.h input.so: $(topdir)/tilde.h isearch.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h isearch.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +isearch.so: $(topdir)/rltypedefs.h isearch.so: $(topdir)/ansi_stdlib.h $(topdir)/history.h $(topdir)/tilde.h keymaps.so: emacs_keymap.c vi_keymap.c keymaps.so: $(topdir)/keymaps.h $(topdir)/chardefs.h $(topdir)/rlconf.h keymaps.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +keymaps.so: $(topdir)/rltypedefs.h keymaps.so: ${BUILD_DIR}/config.h $(topdir)/ansi_stdlib.h $(topdir)/tilde.h kill.so: $(topdir)/ansi_stdlib.h kill.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h kill.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h -kill.so: $(topdir)/tilde.h $(topdir)/history.h +kill.so: $(topdir)/tilde.h $(topdir)/history.h $(topdir)/rltypedefs.h macro.so: $(topdir)/ansi_stdlib.h macro.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h macro.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h -macro.so: $(topdir)/tilde.h $(topdir)/history.h +macro.so: $(topdir)/tilde.h $(topdir)/history.h $(topdir)/rltypedefs.h nls.so: $(topdir)/ansi_stdlib.h nls.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h nls.o: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +nls.o: $(topdir)/rltypedefs.h nls.o: $(topdir)/tilde.h $(topdir)/history.h $(topdir)/rlstdc.h parens.so: $(topdir)/rlconf.h ${BUILD_DIR}/config.h parens.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +parens.so: $(topdir)/rltypedefs.h parens.so: $(topdir)/tilde.h readline.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h readline.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h +readline.so: $(topdir)/rltypedefs.h readline.so: $(topdir)/history.h $(topdir)/tilde.h readline.so: $(topdir)/posixstat.h $(topdir)/ansi_stdlib.h $(topdir)/posixjmp.h rltty.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h rltty.so: $(topdir)/rltty.h $(topdir)/tilde.h rltty.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +rltty.so: $(topdir)/rltypedefs.h search.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h search.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h search.so: $(topdir)/ansi_stdlib.h $(topdir)/history.h $(topdir)/tilde.h +search.so: $(topdir)/rltypedefs.h signals.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h signals.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h signals.so: $(topdir)/history.h $(topdir)/tilde.h +signals.so: $(topdir)/rltypedefs.h terminal.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h terminal.so: $(topdir)/tcap.h terminal.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h terminal.so: $(topdir)/tilde.h $(topdir)/history.h +terminal.so: $(topdir)/rltypedefs.h tilde.so: $(topdir)/ansi_stdlib.h ${BUILD_DIR}/config.h $(topdir)/tilde.h undo.so: $(topdir)/ansi_stdlib.h undo.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h undo.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +undo.so: $(topdir)/rltypedefs.h undo.so: $(topdir)/tilde.h $(topdir)/history.h util.so: $(topdir)/posixjmp.h $(topdir)/ansi_stdlib.h util.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h util.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h -util.so: $(topdir)/tilde.h +util.so: $(topdir)/rltypedefs.h $(topdir)/tilde.h vi_mode.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h vi_mode.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h vi_mode.so: $(topdir)/history.h $(topdir)/ansi_stdlib.h $(topdir)/tilde.h +vi_mode.so: $(topdir)/rltypedefs.h xmalloc.so: ${BUILD_DIR}/config.h xmalloc.so: $(topdir)/ansi_stdlib.h @@ -315,6 +336,7 @@ keymaps.so: $(topdir)/keymaps.c parens.so: $(topdir)/parens.c search.so: $(topdir)/search.c rltty.so: $(topdir)/rltty.c +compat.so: $(topdir)/compat.c complete.so: $(topdir)/complete.c bind.so: $(topdir)/bind.c isearch.so: $(topdir)/isearch.c @@ -344,6 +366,7 @@ keymaps.so: keymaps.c parens.so: parens.c search.so: search.c rltty.so: rltty.c +comapt.so: compat.c complete.so: complete.c bind.so: bind.c isearch.so: isearch.c diff --git a/contrib/libreadline/signals.c b/contrib/libreadline/signals.c index 861019d..ddc6563 100644 --- a/contrib/libreadline/signals.c +++ b/contrib/libreadline/signals.c @@ -61,7 +61,7 @@ # define SIGHANDLER_RETURN return (0) #endif -/* This typedef is equivalant to the one for Function; it allows us +/* This typedef is equivalent to the one for Function; it allows us to say SigHandler *foo = signal (SIGKILL, SIG_IGN); */ typedef RETSIGTYPE SigHandler (); @@ -119,6 +119,8 @@ rl_signal_handler (sig) # endif /* !HAVE_BSD_SIGNALS */ #endif /* !HAVE_POSIX_SIGNALS */ + RL_SETSTATE(RL_STATE_SIGHANDLER); + #if !defined (HAVE_BSD_SIGNALS) && !defined (HAVE_POSIX_SIGNALS) /* Since the signal will not be blocked while we are in the signal handler, ignore it until rl_clear_signals resets the catcher. */ @@ -169,6 +171,7 @@ rl_signal_handler (sig) rl_reset_after_signal (); } + RL_UNSETSTATE(RL_STATE_SIGHANDLER); SIGHANDLER_RETURN; } @@ -189,6 +192,7 @@ rl_sigwinch_handler (sig) rl_set_sighandler (SIGWINCH, rl_sigwinch_handler, &dummy_winch); #endif + RL_SETSTATE(RL_STATE_SIGHANDLER); rl_resize_terminal (); /* If another sigwinch handler has been installed, call it. */ @@ -196,6 +200,7 @@ rl_sigwinch_handler (sig) if (oh && oh != (SigHandler *)SIG_IGN && oh != (SigHandler *)SIG_DFL) (*oh) (sig); + RL_UNSETSTATE(RL_STATE_SIGHANDLER); SIGHANDLER_RETURN; } #endif /* SIGWINCH */ @@ -358,7 +363,7 @@ rl_cleanup_after_signal () _rl_clean_up_for_exit (); (*rl_deprep_term_function) (); rl_clear_signals (); - rl_pending_input = 0; + rl_clear_pending_input (); } /* Reset the terminal and readline state after a signal handler returns. */ @@ -378,7 +383,7 @@ rl_free_line_state () { register HIST_ENTRY *entry; - free_undo_list (); + rl_free_undo_list (); entry = current_history (); if (entry) diff --git a/contrib/libreadline/support/config.guess b/contrib/libreadline/support/config.guess index ad5983e..6a2c9ff 100755 --- a/contrib/libreadline/support/config.guess +++ b/contrib/libreadline/support/config.guess @@ -168,10 +168,17 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:Windows:NT:*:SP*) echo intel-pc-opennt exit 0 ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit 0 ;; # end cases added for Bash alpha:OSF1:*:*) - if test $UNAME_RELEASE = "V4.0"; then + # TEST CHANGED FOR BASH to handle `letter version' releases + UNAME_MAJOR=`echo "$UNAME_RELEASE" | sed -e 's/^.\([0-9]\).*/\1/'` + if test X"$UNAME_MAJOR" != X"" && test $UNAME_MAJOR = 4 ; then UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + elif test X"$UNAME_MAJOR" != X"" && test $UNAME_MAJOR -gt 4 ; then + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` fi # A Vn.n version is a released version. # A Tn.n version is a released field test version. @@ -703,7 +710,7 @@ EOF echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` exit 0 ;; i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin32 + echo ${UNAME_MACHINE}-pc-cygwin exit 0 ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 @@ -1058,6 +1065,12 @@ EOF *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit 0 ;; + Power*:Darwin:*:*) + echo powerpc-apple-darwin${UNAME_RELEASE} + exit 0 ;; + *:Darwin:*:*) + echo ${UNAME_MACHINE}-apple-darwin${UNAME_RELEASE} + exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 diff --git a/contrib/libreadline/support/config.sub b/contrib/libreadline/support/config.sub index 7d0c026..6cc1150 100755 --- a/contrib/libreadline/support/config.sub +++ b/contrib/libreadline/support/config.sub @@ -173,7 +173,7 @@ case $basic_machine in | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \ | mips64vr5000 | miprs64vr5000el | mcore \ | sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \ - | thumb | d10v) + | thumb | d10v | s390) basic_machine=$basic_machine-unknown ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65) @@ -676,6 +676,10 @@ case $basic_machine in rtpc | rtpc-*) basic_machine=romp-ibm ;; + s390-*) + basic_machine=s390-ibm + os=-linux + ;; sa29200) basic_machine=a29k-amd os=-udi @@ -946,13 +950,13 @@ case $os in | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -rhapsody* | -openstep* | -oskit*) # Remember, each alternative MUST END IN *, to match a version number. ;; # BEGIN CASES ADDED FOR Bash - -qnx* | -powerux* | -superux* ) + -qnx* | -powerux* | -superux* | -darwin* | -nonstopux*) ;; # END CASES ADDED FOR Bash -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ diff --git a/contrib/libreadline/support/shlib-install b/contrib/libreadline/support/shlib-install index 471fec7..6d45d0f 100755 --- a/contrib/libreadline/support/shlib-install +++ b/contrib/libreadline/support/shlib-install @@ -66,7 +66,7 @@ fi # HP-UX requires that a shared library have execute permission case "$host_os" in hpux*) if [ -z "$uninstall" ]; then - chmod 755 ${INSTALLDIR}/${LIBNAME} + chmod 555 ${INSTALLDIR}/${LIBNAME} fi ;; *) ;; esac @@ -84,6 +84,9 @@ case "$LIBNAME" in ;; esac +INSTALL_LINK1='cd $INSTALLDIR ; ln -s $LIBNAME $LINK1' +INSTALL_LINK2='cd $INSTALLDIR ; ln -s $LIBNAME $LINK2' + # # Create symlinks to the installed library. This section is incomplete. # @@ -92,13 +95,13 @@ case "$host_os" in # libname.so.M -> libname.so.M.N ${echo} ${RM} ${INSTALLDIR}/$LINK2 if [ -z "$uninstall" ]; then - ${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK2 + ${echo} ln -s $LIBNAME ${INSTALLDIR}/$LINK2 fi # libname.so -> libname.so.M.N ${echo} ${RM} ${INSTALLDIR}/$LINK1 if [ -z "$uninstall" ]; then - ${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK1 + ${echo} ln -s $LIBNAME ${INSTALLDIR}/$LINK1 fi ;; @@ -106,7 +109,7 @@ solaris2*|aix4.[2-9]*|osf*|irix[56]*) # libname.so -> libname.so.M ${echo} ${RM} ${INSTALLDIR}/$LINK1 if [ -z "$uninstall" ]; then - ${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK1 + ${echo} ln -s $LIBNAME ${INSTALLDIR}/$LINK1 fi ;; @@ -117,19 +120,19 @@ freebsd3*) # libname.so -> libname.so.M ${echo} ${RM} ${INSTALLDIR}/$LINK1 if [ -z "$uninstall" ]; then - ${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK1 + ${echo} ln -s $LIBNAME ${INSTALLDIR}/$LINK1 fi else # libname.so.M -> libname.so.M.N ${echo} ${RM} ${INSTALLDIR}/$LINK2 if [ -z "$uninstall" ]; then - ${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK2 + ${echo} ln -s $LIBNAME ${INSTALLDIR}/$LINK2 fi # libname.so -> libname.so.M.N ${echo} ${RM} ${INSTALLDIR}/$LINK1 if [ -z "$uninstall" ]; then - ${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK1 + ${echo} ln -s $LIBNAME ${INSTALLDIR}/$LINK1 fi fi ;; @@ -138,7 +141,8 @@ hpux1*) # libname.sl -> libname.M ${echo} ${RM} ${INSTALLDIR}/$LINK1.sl if [ -z "$uninstall" ]; then - ${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/${LINK1}.sl +# ${echo} ln -s $LIBNAME ${INSTALLDIR}/${LINK1}.sl + ${echo} ln -s $LIBNAME ${INSTALLDIR}/${LINK1} fi ;; diff --git a/contrib/libreadline/support/shobj-conf b/contrib/libreadline/support/shobj-conf index 6649c70..5abef8a 100755 --- a/contrib/libreadline/support/shobj-conf +++ b/contrib/libreadline/support/shobj-conf @@ -43,7 +43,7 @@ while [ $# -gt 0 ]; do done case "${host_os}-${SHOBJ_CC}" in -sunos4*-gcc*) +sunos4*-*gcc*) SHOBJ_CFLAGS=-fpic SHOBJ_LD=/usr/bin/ld SHOBJ_LDFLAGS='-assert pure-text' @@ -59,7 +59,7 @@ sunos4*) SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)' ;; -sunos5*-gcc*|solaris2*-gcc*) +sunos5*-*gcc*|solaris2*-*gcc*) SHOBJ_CFLAGS=-fpic SHOBJ_LD='${CC}' SHOBJ_LDFLAGS='-shared -Wl,-i -Wl,-h,$@' @@ -97,7 +97,7 @@ freebsd2* | netbsd* | openbsd*) # ;; # FreeBSD-3.x ELF -freebsd3*) +freebsd[3-9]*|freebsdelf[3-9]*|freebsdaout[3-9]*) SHOBJ_CFLAGS=-fpic SHOBJ_LD='${CC}' @@ -113,13 +113,13 @@ freebsd3*) SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)' fi ;; - -linux*) +# All versions of Linux or the semi-mythical GNU Hurd. +linux*|gnu*) SHOBJ_CFLAGS=-fPIC SHOBJ_LD='${CC}' SHOBJ_LDFLAGS='-shared -Wl,-soname,$@' - SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir)' + SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir) -Wl,-soname,`basename $@ $(SHLIB_MINOR)`' SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)' ;; @@ -158,10 +158,11 @@ bsdi4*) SHOBJ_LD='${CC}' SHOBJ_LDFLAGS='-shared -Wl,-soname,$@' + SHLIB_XLDFLAGS='-Wl,-soname,`basename $@ $(SHLIB_MINOR)`' SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)' ;; -osf*-gcc*) +osf*-*gcc*) # Fix to use gcc linker driver from bfischer@TechFak.Uni-Bielefeld.DE SHOBJ_LD='${CC}' SHOBJ_LDFLAGS='-shared -Wl,-soname,$@' @@ -178,7 +179,7 @@ osf*) SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' ;; -aix4.[2-9]*-gcc*) # lightly tested by jik@cisco.com +aix4.[2-9]*-*gcc*) # lightly tested by jik@cisco.com SHOBJ_CFLAGS=-fpic SHOBJ_LD='ld' SHOBJ_LDFLAGS='-bdynamic -bnoentry -bexpall' @@ -203,7 +204,7 @@ aix4.[2-9]*) # # THE FOLLOWING ARE UNTESTED -- and some may not support the dlopen interface # -irix[56]*-gcc*) +irix[56]*-*gcc*) SHOBJ_CFLAGS='-fpic' SHOBJ_LD='${CC}' SHOBJ_LDFLAGS='-shared -Wl,-soname,$@' @@ -216,14 +217,15 @@ irix[56]*) SHOBJ_CFLAGS='-K PIC' SHOBJ_LD=ld # SHOBJ_LDFLAGS='-call_shared -hidden_symbol -no_unresolved -soname $@' -# Change from David Kaelbling +# Change from David Kaelbling . If you have problems, +# remove the `-no_unresolved' SHOBJ_LDFLAGS='-shared -no_unresolved -soname $@' SHLIB_XLDFLAGS='-rpath $(libdir)' SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' ;; -hpux9*-gcc*) +hpux9*-*gcc*) # must use gcc; the bundled cc cannot compile PIC code SHOBJ_CFLAGS='-fpic' SHOBJ_LD='${CC}' @@ -239,7 +241,7 @@ hpux9*) SHLIB_STATUS=unsupported ;; -hpux10*-gcc*) +hpux10*-*gcc*) # must use gcc; the bundled cc cannot compile PIC code SHOBJ_CFLAGS='-fpic' SHOBJ_LD='${CC}' @@ -253,14 +255,27 @@ hpux10*-gcc*) hpux10*) SHOBJ_STATUS=unsupported SHLIB_STATUS=unsupported + + # If you are using the HP ANSI C compiler, you can uncomment and use + # this code +# SHOBJ_STATUS=unsupported +# SHLIB_STATUS=unsupported +# +# SHOBJ_CFLAGS='+z' +# SHOBJ_LD='ld' +# SHOBJ_LDFLAGS='-b' +# +# SHLIB_XLDFLAGS='' +# SHLIB_LIBSUFF='sl' +# SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' ;; -hpux11*-gcc*) +hpux11*-*gcc*) # must use gcc; the bundled cc cannot compile PIC code SHOBJ_CFLAGS='-fpic' SHOBJ_LD='${CC}' # SHOBJ_LDFLAGS='-shared -Wl,-b -Wl,-B,symbolic -Wl,+s -Wl,+std -Wl,+h,$@' - SHOBJ_LDFLAGS='-shared -Wl,-b -Wl,+s -Wl,+h,$@' + SHOBJ_LDFLAGS='-shared -fpic -Wl,-b -Wl,+s -Wl,+h,$@' SHLIB_XLDFLAGS='-Wl,+b,$(libdir)' SHLIB_LIBSUFF='sl' @@ -270,9 +285,23 @@ hpux11*-gcc*) hpux11*) SHOBJ_STATUS=unsupported SHLIB_STATUS=unsupported + + # If you are using the HP ANSI C compiler, you can uncomment and use + # this code +# SHOBJ_STATUS=unsupported +# SHLIB_STATUS=unsupported +# +# SHOBJ_CFLAGS='+z' +# SHOBJ_LD='ld' +# SHOBJ_LDFLAGS='-b' +# +# SHLIB_XLDFLAGS='' +# SHLIB_LIBSUFF='sl' +# SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' + ;; -sysv4*-gcc*) +sysv4*-*gcc*) SHOBJ_CFLAGS=-shared SHOBJ_LDFLAGS='-shared -h $@' SHOBJ_LD='${CC}' @@ -288,7 +317,7 @@ sysv4*) SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' ;; -sco3.2v5*-gcc*) +sco3.2v5*-*gcc*) SHOBJ_CFLAGS='-fpic' # DEFAULTS TO ELF SHOBJ_LD='${CC}' SHOBJ_LDFLAGS='-shared' @@ -304,7 +333,7 @@ sco3.2v5*) SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' ;; -sysv5uw7*-gcc*) +sysv5uw7*-*gcc*) SHOBJ_CFLAGS='-fpic' SHOBJ_LD='${CC}' SHOBJ_LDFLAGS='-shared' @@ -320,7 +349,7 @@ sysv5uw7*) SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' ;; -dgux*-gcc*) +dgux*-*gcc*) SHOBJ_CFLAGS=-fpic SHOBJ_LD='${CC}' SHOBJ_LDFLAGS='-shared' @@ -344,7 +373,7 @@ msdos*) # # Rely on correct gcc configuration for everything else # -*-gcc*) +*-*gcc*) SHOBJ_CFLAGS=-fpic SHOBJ_LD='${CC}' SHOBJ_LDFLAGS='-shared' diff --git a/contrib/libreadline/terminal.c b/contrib/libreadline/terminal.c index 20ad126..64256b4 100644 --- a/contrib/libreadline/terminal.c +++ b/contrib/libreadline/terminal.c @@ -76,9 +76,6 @@ static char *term_string_buffer = (char *)NULL; static int tcap_initialized; -/* Non-zero means this terminal can't really do anything. */ -static int dumb_term; - #if !defined (__linux__) # if defined (__EMX__) || defined (NEED_EXTERN_PC) extern @@ -87,27 +84,36 @@ char PC, *BC, *UP; #endif /* __linux__ */ /* Some strings to control terminal actions. These are output by tputs (). */ -char *term_goto, *term_clreol, *term_cr, *term_clrpag, *term_backspace; -char *term_pc; +char *_rl_term_clreol; +char *_rl_term_clrpag; +char *_rl_term_cr; +char *_rl_term_backspace; +char *_rl_term_goto; +char *_rl_term_pc; /* Non-zero if we determine that the terminal can do character insertion. */ -int terminal_can_insert = 0; +int _rl_terminal_can_insert = 0; /* How to insert characters. */ -char *term_im, *term_ei, *term_ic, *term_ip, *term_IC; +char *_rl_term_im; +char *_rl_term_ei; +char *_rl_term_ic; +char *_rl_term_ip; +char *_rl_term_IC; /* How to delete characters. */ -char *term_dc, *term_DC; +char *_rl_term_dc; +char *_rl_term_DC; #if defined (HACK_TERMCAP_MOTION) -char *term_forward_char; +char *_rl_term_forward_char; #endif /* HACK_TERMCAP_MOTION */ /* How to go up a line. */ -char *term_up; +char *_rl_term_up; -/* A visible bell, if the terminal can be made to flash the screen. */ -static char *visible_bell; +/* A visible bell; char if the terminal can be made to flash the screen. */ +static char *_rl_visible_bell; /* Non-zero means the terminal can auto-wrap lines. */ int _rl_term_autowrap; @@ -116,20 +122,26 @@ int _rl_term_autowrap; static int term_has_meta; /* The sequences to write to turn on and off the meta key, if this - terminal has one. */ -static char *term_mm, *term_mo; + terminal has one. */ +static char *_rl_term_mm; +static char *_rl_term_mo; /* The key sequences output by the arrow keys, if this terminal has any. */ -static char *term_ku, *term_kd, *term_kr, *term_kl; +static char *_rl_term_ku; +static char *_rl_term_kd; +static char *_rl_term_kr; +static char *_rl_term_kl; /* How to initialize and reset the arrow keys, if this terminal has any. */ -static char *term_ks, *term_ke; +static char *_rl_term_ks; +static char *_rl_term_ke; /* The key sequences sent by the Home and End keys, if any. */ -static char *term_kh, *term_kH; +static char *_rl_term_kh; +static char *_rl_term_kH; /* Variables that hold the screen dimensions, used by the display code. */ -int screenwidth, screenheight, screenchars; +int _rl_screenwidth, _rl_screenheight, _rl_screenchars; /* Non-zero means the user wants to enable the keypad. */ int _rl_enable_keypad; @@ -169,73 +181,93 @@ _rl_get_screen_size (tty, ignore_env) #if defined (TIOCGWINSZ) if (ioctl (tty, TIOCGWINSZ, &window_size) == 0) { - screenwidth = (int) window_size.ws_col; - screenheight = (int) window_size.ws_row; + _rl_screenwidth = (int) window_size.ws_col; + _rl_screenheight = (int) window_size.ws_row; } #endif /* TIOCGWINSZ */ #if defined (__EMX__) - _emx_get_screensize (&screenwidth, &screenheight); + _emx_get_screensize (&_rl_screenwidth, &_rl_screenheight); #endif /* Environment variable COLUMNS overrides setting of "co" if IGNORE_ENV is unset. */ - if (screenwidth <= 0) + if (_rl_screenwidth <= 0) { - if (ignore_env == 0 && (ss = get_env_value ("COLUMNS"))) - screenwidth = atoi (ss); + if (ignore_env == 0 && (ss = sh_get_env_value ("COLUMNS"))) + _rl_screenwidth = atoi (ss); #if !defined (__DJGPP__) - if (screenwidth <= 0 && term_string_buffer) - screenwidth = tgetnum ("co"); + if (_rl_screenwidth <= 0 && term_string_buffer) + _rl_screenwidth = tgetnum ("co"); #endif } /* Environment variable LINES overrides setting of "li" if IGNORE_ENV is unset. */ - if (screenheight <= 0) + if (_rl_screenheight <= 0) { - if (ignore_env == 0 && (ss = get_env_value ("LINES"))) - screenheight = atoi (ss); + if (ignore_env == 0 && (ss = sh_get_env_value ("LINES"))) + _rl_screenheight = atoi (ss); #if !defined (__DJGPP__) - if (screenheight <= 0 && term_string_buffer) - screenheight = tgetnum ("li"); + if (_rl_screenheight <= 0 && term_string_buffer) + _rl_screenheight = tgetnum ("li"); #endif } /* If all else fails, default to 80x24 terminal. */ - if (screenwidth <= 1) - screenwidth = 80; + if (_rl_screenwidth <= 1) + _rl_screenwidth = 80; - if (screenheight <= 0) - screenheight = 24; + if (_rl_screenheight <= 0) + _rl_screenheight = 24; /* If we're being compiled as part of bash, set the environment variables $LINES and $COLUMNS to new values. Otherwise, just do a pair of putenv () or setenv () calls. */ - set_lines_and_columns (screenheight, screenwidth); + sh_set_lines_and_columns (_rl_screenheight, _rl_screenwidth); if (_rl_term_autowrap == 0) - screenwidth--; + _rl_screenwidth--; - screenchars = screenwidth * screenheight; + _rl_screenchars = _rl_screenwidth * _rl_screenheight; } void _rl_set_screen_size (rows, cols) int rows, cols; { - screenheight = rows; - screenwidth = cols; + if (rows == 0 || cols == 0) + return; + + _rl_screenheight = rows; + _rl_screenwidth = cols; if (_rl_term_autowrap == 0) - screenwidth--; + _rl_screenwidth--; - screenchars = screenwidth * screenheight; + _rl_screenchars = _rl_screenwidth * _rl_screenheight; +} + +void +rl_set_screen_size (rows, cols) + int rows, cols; +{ + _rl_set_screen_size (rows, cols); } void +rl_get_screen_size (rows, cols) + int *rows, *cols; +{ + if (rows) + *rows = _rl_screenheight; + if (cols) + *cols = _rl_screenwidth; +} + +void rl_resize_terminal () { if (readline_echoing_p) @@ -246,7 +278,7 @@ rl_resize_terminal () } struct _tc_string { - char *tc_var; + const char *tc_var; char **tc_value; }; @@ -254,32 +286,32 @@ struct _tc_string { search algorithm to something smarter. */ static struct _tc_string tc_strings[] = { - { "DC", &term_DC }, - { "IC", &term_IC }, - { "ce", &term_clreol }, - { "cl", &term_clrpag }, - { "cr", &term_cr }, - { "dc", &term_dc }, - { "ei", &term_ei }, - { "ic", &term_ic }, - { "im", &term_im }, - { "kd", &term_kd }, - { "kh", &term_kh }, /* home */ - { "kH", &term_kH }, /* end */ - { "kl", &term_kl }, - { "kr", &term_kr }, - { "ku", &term_ku }, - { "ks", &term_ks }, - { "ke", &term_ke }, - { "le", &term_backspace }, - { "mm", &term_mm }, - { "mo", &term_mo }, + { "DC", &_rl_term_DC }, + { "IC", &_rl_term_IC }, + { "ce", &_rl_term_clreol }, + { "cl", &_rl_term_clrpag }, + { "cr", &_rl_term_cr }, + { "dc", &_rl_term_dc }, + { "ei", &_rl_term_ei }, + { "ic", &_rl_term_ic }, + { "im", &_rl_term_im }, + { "kd", &_rl_term_kd }, + { "kh", &_rl_term_kh }, /* home */ + { "kH", &_rl_term_kH }, /* end */ + { "kl", &_rl_term_kl }, + { "kr", &_rl_term_kr }, + { "ku", &_rl_term_ku }, + { "ks", &_rl_term_ks }, + { "ke", &_rl_term_ke }, + { "le", &_rl_term_backspace }, + { "mm", &_rl_term_mm }, + { "mo", &_rl_term_mo }, #if defined (HACK_TERMCAP_MOTION) - { "nd", &term_forward_char }, + { "nd", &_rl_term_forward_char }, #endif - { "pc", &term_pc }, - { "up", &term_up }, - { "vb", &visible_bell }, + { "pc", &_rl_term_pc }, + { "up", &_rl_term_up }, + { "vb", &_rl_visible_bell }, }; #define NUM_TC_STRINGS (sizeof (tc_strings) / sizeof (struct _tc_string)) @@ -304,16 +336,17 @@ get_term_capabilities (bp) int _rl_init_terminal_io (terminal_name) - char *terminal_name; + const char *terminal_name; { - char *term, *buffer; + const char *term; + char *buffer; int tty, tgetent_ret; Keymap xkeymap; - term = terminal_name ? terminal_name : get_env_value ("TERM"); - term_clrpag = term_cr = term_clreol = (char *)NULL; + term = terminal_name ? terminal_name : sh_get_env_value ("TERM"); + _rl_term_clrpag = _rl_term_cr = _rl_term_clreol = (char *)NULL; tty = rl_instream ? fileno (rl_instream) : 0; - screenwidth = screenheight = 0; + _rl_screenwidth = _rl_screenheight = 0; if (term == 0) term = "dumb"; @@ -344,41 +377,40 @@ _rl_init_terminal_io (terminal_name) FREE (term_buffer); buffer = term_buffer = term_string_buffer = (char *)NULL; - dumb_term = 1; _rl_term_autowrap = 0; /* used by _rl_get_screen_size */ #if defined (__EMX__) - _emx_get_screensize (&screenwidth, &screenheight); - screenwidth--; + _emx_get_screensize (&_rl_screenwidth, &_rl_screenheight); + _rl_screenwidth--; #else /* !__EMX__ */ _rl_get_screen_size (tty, 0); #endif /* !__EMX__ */ /* Defaults. */ - if (screenwidth <= 0 || screenheight <= 0) + if (_rl_screenwidth <= 0 || _rl_screenheight <= 0) { - screenwidth = 79; - screenheight = 24; + _rl_screenwidth = 79; + _rl_screenheight = 24; } /* Everything below here is used by the redisplay code (tputs). */ - screenchars = screenwidth * screenheight; - term_cr = "\r"; - term_im = term_ei = term_ic = term_IC = (char *)NULL; - term_up = term_dc = term_DC = visible_bell = (char *)NULL; - term_ku = term_kd = term_kl = term_kr = (char *)NULL; - term_mm = term_mo = (char *)NULL; + _rl_screenchars = _rl_screenwidth * _rl_screenheight; + _rl_term_cr = "\r"; + _rl_term_im = _rl_term_ei = _rl_term_ic = _rl_term_IC = (char *)NULL; + _rl_term_up = _rl_term_dc = _rl_term_DC = _rl_visible_bell = (char *)NULL; + _rl_term_ku = _rl_term_kd = _rl_term_kl = _rl_term_kr = (char *)NULL; + _rl_term_mm = _rl_term_mo = (char *)NULL; #if defined (HACK_TERMCAP_MOTION) term_forward_char = (char *)NULL; #endif - terminal_can_insert = term_has_meta = 0; + _rl_terminal_can_insert = term_has_meta = 0; /* Reasonable defaults for tgoto(). Readline currently only uses - tgoto if term_IC or term_DC is defined, but just in case we + tgoto if _rl_term_IC or _rl_term_DC is defined, but just in case we change that later... */ PC = '\0'; - BC = term_backspace = "\b"; - UP = term_up; + BC = _rl_term_backspace = "\b"; + UP = _rl_term_up; return 0; } @@ -387,12 +419,12 @@ _rl_init_terminal_io (terminal_name) /* Set up the variables that the termcap library expects the application to provide. */ - PC = term_pc ? *term_pc : 0; - BC = term_backspace; - UP = term_up; + PC = _rl_term_pc ? *_rl_term_pc : 0; + BC = _rl_term_backspace; + UP = _rl_term_up; - if (!term_cr) - term_cr = "\r"; + if (!_rl_term_cr) + _rl_term_cr = "\r"; _rl_term_autowrap = tgetflag ("am") && tgetflag ("xn"); @@ -402,36 +434,36 @@ _rl_init_terminal_io (terminal_name) character insertion if *any one of* the capabilities `IC', `im', `ic' or `ip' is provided." But we can't do anything if only `ip' is provided, so... */ - terminal_can_insert = (term_IC || term_im || term_ic); + _rl_terminal_can_insert = (_rl_term_IC || _rl_term_im || _rl_term_ic); /* Check to see if this terminal has a meta key and clear the capability variables if there is none. */ term_has_meta = (tgetflag ("km") || tgetflag ("MT")); if (!term_has_meta) - term_mm = term_mo = (char *)NULL; + _rl_term_mm = _rl_term_mo = (char *)NULL; /* Attempt to find and bind the arrow keys. Do not override already bound keys in an overzealous attempt, however. */ xkeymap = _rl_keymap; _rl_keymap = emacs_standard_keymap; - _rl_bind_if_unbound (term_ku, rl_get_previous_history); - _rl_bind_if_unbound (term_kd, rl_get_next_history); - _rl_bind_if_unbound (term_kr, rl_forward); - _rl_bind_if_unbound (term_kl, rl_backward); + _rl_bind_if_unbound (_rl_term_ku, rl_get_previous_history); + _rl_bind_if_unbound (_rl_term_kd, rl_get_next_history); + _rl_bind_if_unbound (_rl_term_kr, rl_forward); + _rl_bind_if_unbound (_rl_term_kl, rl_backward); - _rl_bind_if_unbound (term_kh, rl_beg_of_line); /* Home */ - _rl_bind_if_unbound (term_kH, rl_end_of_line); /* End */ + _rl_bind_if_unbound (_rl_term_kh, rl_beg_of_line); /* Home */ + _rl_bind_if_unbound (_rl_term_kH, rl_end_of_line); /* End */ #if defined (VI_MODE) _rl_keymap = vi_movement_keymap; - _rl_bind_if_unbound (term_ku, rl_get_previous_history); - _rl_bind_if_unbound (term_kd, rl_get_next_history); - _rl_bind_if_unbound (term_kr, rl_forward); - _rl_bind_if_unbound (term_kl, rl_backward); + _rl_bind_if_unbound (_rl_term_ku, rl_get_previous_history); + _rl_bind_if_unbound (_rl_term_kd, rl_get_next_history); + _rl_bind_if_unbound (_rl_term_kr, rl_forward); + _rl_bind_if_unbound (_rl_term_kl, rl_backward); - _rl_bind_if_unbound (term_kh, rl_beg_of_line); /* Home */ - _rl_bind_if_unbound (term_kH, rl_end_of_line); /* End */ + _rl_bind_if_unbound (_rl_term_kh, rl_beg_of_line); /* Home */ + _rl_bind_if_unbound (_rl_term_kH, rl_end_of_line); /* End */ #endif /* VI_MODE */ _rl_keymap = xkeymap; @@ -441,7 +473,7 @@ _rl_init_terminal_io (terminal_name) char * rl_get_termcap (cap) - char *cap; + const char *cap; { register int i; @@ -459,7 +491,7 @@ rl_get_termcap (cap) has changed. */ int rl_reset_terminal (terminal_name) - char *terminal_name; + const char *terminal_name; { _rl_init_terminal_io (terminal_name); return 0; @@ -485,7 +517,7 @@ _rl_output_character_function (c) /* Write COUNT characters from STRING to the output stream. */ void _rl_output_some_chars (string, count) - char *string; + const char *string; int count; { fwrite (string, 1, count, _rl_out_stream); @@ -498,9 +530,9 @@ _rl_backspace (count) { register int i; - if (term_backspace) + if (_rl_term_backspace) for (i = 0; i < count; i++) - tputs (term_backspace, 1, _rl_output_character_function); + tputs (_rl_term_backspace, 1, _rl_output_character_function); else for (i = 0; i < count; i++) putc ('\b', _rl_out_stream); @@ -509,11 +541,11 @@ _rl_backspace (count) /* Move to the start of the next line. */ int -crlf () +rl_crlf () { #if defined (NEW_TTY_DRIVER) - if (term_cr) - tputs (term_cr, 1, _rl_output_character_function); + if (_rl_term_cr) + tputs (_rl_term_cr, 1, _rl_output_character_function); #endif /* NEW_TTY_DRIVER */ putc ('\n', _rl_out_stream); return 0; @@ -521,7 +553,7 @@ crlf () /* Ring the terminal bell. */ int -ding () +rl_ding () { if (readline_echoing_p) { @@ -531,9 +563,9 @@ ding () default: break; case VISIBLE_BELL: - if (visible_bell) + if (_rl_visible_bell) { - tputs (visible_bell, 1, _rl_output_character_function); + tputs (_rl_visible_bell, 1, _rl_output_character_function); break; } /* FALLTHROUGH */ @@ -557,8 +589,8 @@ void _rl_enable_meta_key () { #if !defined (__DJGPP__) - if (term_has_meta && term_mm) - tputs (term_mm, 1, _rl_output_character_function); + if (term_has_meta && _rl_term_mm) + tputs (_rl_term_mm, 1, _rl_output_character_function); #endif } @@ -567,9 +599,9 @@ _rl_control_keypad (on) int on; { #if !defined (__DJGPP__) - if (on && term_ks) - tputs (term_ks, 1, _rl_output_character_function); - else if (!on && term_ke) - tputs (term_ke, 1, _rl_output_character_function); + if (on && _rl_term_ks) + tputs (_rl_term_ks, 1, _rl_output_character_function); + else if (!on && _rl_term_ke) + tputs (_rl_term_ke, 1, _rl_output_character_function); #endif } diff --git a/contrib/libreadline/tilde.c b/contrib/libreadline/tilde.c index 777b655..7f33db4 100644 --- a/contrib/libreadline/tilde.c +++ b/contrib/libreadline/tilde.c @@ -50,16 +50,13 @@ #if defined (TEST) || defined (STATIC_MALLOC) static char *xmalloc (), *xrealloc (); #else -# if defined __STDC__ -extern char *xmalloc (int); -extern char *xrealloc (void *, int); -# else -extern char *xmalloc (), *xrealloc (); -# endif /* !__STDC__ */ +extern char *xmalloc __P((int)); +extern char *xrealloc __P((void *, int)); #endif /* TEST || STATIC_MALLOC */ #if !defined (HAVE_GETPW_DECLS) -extern struct passwd *getpwuid (), *getpwnam (); +extern struct passwd *getpwuid __P((uid_t)); +extern struct passwd *getpwnam __P((const char *)); #endif /* !HAVE_GETPW_DECLS */ #if !defined (savestring) @@ -80,42 +77,42 @@ extern char *strcpy (); /* If being compiled as part of bash, these will be satisfied from variables.o. If being compiled as part of readline, they will be satisfied from shell.o. */ -extern char *get_home_dir __P((void)); -extern char *get_env_value __P((char *)); +extern char *sh_get_home_dir __P((void)); +extern char *sh_get_env_value __P((const char *)); /* The default value of tilde_additional_prefixes. This is set to whitespace preceding a tilde so that simple programs which do not perform any word separation get desired behaviour. */ -static char *default_prefixes[] = - { " ~", "\t~", (char *)NULL }; +static const char *default_prefixes[] = + { " ~", "\t~", (const char *)NULL }; /* The default value of tilde_additional_suffixes. This is set to whitespace or newline so that simple programs which do not perform any word separation get desired behaviour. */ -static char *default_suffixes[] = - { " ", "\n", (char *)NULL }; +static const char *default_suffixes[] = + { " ", "\n", (const char *)NULL }; /* If non-null, this contains the address of a function that the application wants called before trying the standard tilde expansions. The function is called with the text sans tilde, and returns a malloc()'ed string which is the expansion, or a NULL pointer if the expansion fails. */ -CPFunction *tilde_expansion_preexpansion_hook = (CPFunction *)NULL; +tilde_hook_func_t *tilde_expansion_preexpansion_hook = (tilde_hook_func_t *)NULL; /* If non-null, this contains the address of a function to call if the standard meaning for expanding a tilde fails. The function is called with the text (sans tilde, as in "foo"), and returns a malloc()'ed string which is the expansion, or a NULL pointer if there is no expansion. */ -CPFunction *tilde_expansion_failure_hook = (CPFunction *)NULL; +tilde_hook_func_t *tilde_expansion_failure_hook = (tilde_hook_func_t *)NULL; /* When non-null, this is a NULL terminated array of strings which are duplicates for a tilde prefix. Bash uses this to expand `=~' and `:~'. */ -char **tilde_additional_prefixes = default_prefixes; +char **tilde_additional_prefixes = (char **)default_prefixes; /* When non-null, this is a NULL terminated array of strings which match the end of a username, instead of just "/". Bash sets this to `:' and `=~'. */ -char **tilde_additional_suffixes = default_suffixes; +char **tilde_additional_suffixes = (char **)default_suffixes; /* Find the start of a tilde expansion in STRING, and return the index of the tilde which starts the expansion. Place the length of the text @@ -186,7 +183,7 @@ tilde_find_suffix (string) /* Return a new string which is the result of tilde expanding STRING. */ char * tilde_expand (string) - char *string; + const char *string; { char *result; int result_size, result_index; @@ -235,9 +232,9 @@ tilde_expand (string) free (tilde_word); len = strlen (expansion); -#ifdef __CYGWIN32__ +#ifdef __CYGWIN__ /* Fix for Cygwin to prevent ~user/xxx from expanding to //xxx when - $HOME for `user' is /. On cygwin, // denotes a network drive. */ + $HOME for `user' is /. On cygwin, // denotes a network drive. */ if (len > 1 || *expansion != '/' || *string != '/') #endif { @@ -303,7 +300,7 @@ glue_prefix_and_suffix (prefix, suffix, suffind) This always returns a newly-allocated string, never static storage. */ char * tilde_expand_word (filename) - char *filename; + const char *filename; { char *dirname, *expansion, *username; int user_len; @@ -321,12 +318,12 @@ tilde_expand_word (filename) if (filename[1] == '\0' || filename[1] == '/') { /* Prefix $HOME to the rest of the string. */ - expansion = get_env_value ("HOME"); + expansion = sh_get_env_value ("HOME"); /* If there is no HOME variable, look up the directory in the password database. */ if (expansion == 0) - expansion = get_home_dir (); + expansion = sh_get_home_dir (); return (glue_prefix_and_suffix (expansion, filename, 1)); } diff --git a/contrib/libreadline/tilde.h b/contrib/libreadline/tilde.h index 7783fd6..d3966a6 100644 --- a/contrib/libreadline/tilde.h +++ b/contrib/libreadline/tilde.h @@ -40,26 +40,31 @@ extern "C" { # endif #endif -/* Function pointers can be declared as (Function *)foo. */ -#if !defined (_FUNCTION_DEF) -# define _FUNCTION_DEF -typedef int Function (); -typedef void VFunction (); -typedef char *CPFunction (); -typedef char **CPPFunction (); -#endif /* _FUNCTION_DEF */ +#if !defined (__STDC__) && !defined (__cplusplus) +# if defined (__GNUC__) /* gcc with -traditional */ +# if !defined (const) +# define const __const +# endif /* !const */ +# else /* !__GNUC__ */ +# if !defined (const) +# define const +# endif /* !const */ +# endif /* !__GNUC__ */ +#endif /* !__STDC__ && !__cplusplus */ + +typedef char *tilde_hook_func_t __P((char *)); /* If non-null, this contains the address of a function that the application wants called before trying the standard tilde expansions. The function is called with the text sans tilde, and returns a malloc()'ed string which is the expansion, or a NULL pointer if the expansion fails. */ -extern CPFunction *tilde_expansion_preexpansion_hook; +extern tilde_hook_func_t *tilde_expansion_preexpansion_hook; /* If non-null, this contains the address of a function to call if the standard meaning for expanding a tilde fails. The function is called with the text (sans tilde, as in "foo"), and returns a malloc()'ed string which is the expansion, or a NULL pointer if there is no expansion. */ -extern CPFunction *tilde_expansion_failure_hook; +extern tilde_hook_func_t *tilde_expansion_failure_hook; /* When non-null, this is a NULL terminated array of strings which are duplicates for a tilde prefix. Bash uses this to expand @@ -72,11 +77,11 @@ extern char **tilde_additional_prefixes; extern char **tilde_additional_suffixes; /* Return a new string which is the result of tilde expanding STRING. */ -extern char *tilde_expand __P((char *)); +extern char *tilde_expand __P((const char *)); /* Do the work of tilde expansion on FILENAME. FILENAME starts with a tilde. If there is no expansion, call tilde_expansion_failure_hook. */ -extern char *tilde_expand_word __P((char *)); +extern char *tilde_expand_word __P((const char *)); #ifdef __cplusplus } diff --git a/contrib/libreadline/undo.c b/contrib/libreadline/undo.c index f7f30d1..e29e940 100644 --- a/contrib/libreadline/undo.c +++ b/contrib/libreadline/undo.c @@ -86,7 +86,7 @@ rl_add_undo (what, start, end, text) /* Free the existing undo list. */ void -free_undo_list () +rl_free_undo_list () { while (rl_undo_list) { @@ -107,17 +107,18 @@ int rl_do_undo () { UNDO_LIST *release; - int waiting_for_begin = 0; - int start, end; + int waiting_for_begin, start, end; #define TRANS(i) ((i) == -1 ? rl_point : ((i) == -2 ? rl_end : (i))) + start = end = waiting_for_begin = 0; do { if (!rl_undo_list) return (0); _rl_doing_an_undo = 1; + RL_SETSTATE(RL_STATE_UNDOING); /* To better support vi-mode, a start or end value of -1 means rl_point, and a value of -2 means rl_end. */ @@ -152,11 +153,12 @@ rl_do_undo () if (waiting_for_begin) waiting_for_begin--; else - ding (); + rl_ding (); break; } _rl_doing_an_undo = 0; + RL_UNSETSTATE(RL_STATE_UNDOING); release = rl_undo_list; rl_undo_list = rl_undo_list->next; @@ -231,7 +233,7 @@ rl_revert_line (count, key) int count, key; { if (!rl_undo_list) - ding (); + rl_ding (); else { while (rl_undo_list) @@ -254,7 +256,7 @@ rl_undo_command (count, key) count--; else { - ding (); + rl_ding (); break; } } diff --git a/contrib/libreadline/util.c b/contrib/libreadline/util.c index be9e0a9..6d0a6e3 100644 --- a/contrib/libreadline/util.c +++ b/contrib/libreadline/util.c @@ -67,10 +67,10 @@ in words, or 1 if it is. */ int _rl_allow_pathname_alphabetic_chars = 0; -static char *pathname_alphabetic_chars = "/-_=~.#$"; +static const char *pathname_alphabetic_chars = "/-_=~.#$"; int -alphabetic (c) +rl_alphabetic (c) int c; { if (ALPHABETIC (c)) @@ -84,16 +84,16 @@ alphabetic (c) int _rl_abort_internal () { - ding (); + rl_ding (); rl_clear_message (); _rl_init_argument (); - rl_pending_input = 0; + rl_clear_pending_input (); _rl_defining_kbd_macro = 0; - while (_rl_executing_macro) + while (rl_executing_macro) _rl_pop_executing_macro (); - rl_last_func = (Function *)NULL; + rl_last_func = (rl_command_func_t *)NULL; longjmp (readline_top_level, 1); return (0); } @@ -113,7 +113,7 @@ rl_tty_status (count, key) ioctl (1, TIOCSTAT, (char *)0); rl_refresh_line (count, key); #else - ding (); + rl_ding (); #endif return 0; } @@ -215,13 +215,32 @@ rl_tilde_expand (ignore, key) match in s1. The compare is case insensitive. */ char * _rl_strindex (s1, s2) - register char *s1, *s2; + register const char *s1, *s2; { register int i, l, len; for (i = 0, l = strlen (s2), len = strlen (s1); (len - i) >= l; i++) if (_rl_strnicmp (s1 + i, s2, l) == 0) - return (s1 + i); + return ((char *) (s1 + i)); + return ((char *)NULL); +} + +/* Find the first occurrence in STRING1 of any character from STRING2. + Return a pointer to the character in STRING1. */ +char * +_rl_strpbrk (string1, string2) + const char *string1, *string2; +{ + register const char *scan; + + for (; *string1; string1++) + { + for (scan = string2; *scan; scan++) + { + if (*string1 == *scan) + return ((char *)string1); + } + } return ((char *)NULL); } @@ -345,7 +364,7 @@ _rl_digit_value (c) #undef _rl_savestring char * _rl_savestring (s) - char *s; + const char *s; { - return ((char *)strcpy (xmalloc (1 + (int)strlen (s)), (s))); + return (strcpy (xmalloc (1 + (int)strlen (s)), (s))); } diff --git a/contrib/libreadline/vi_keymap.c b/contrib/libreadline/vi_keymap.c index cf6724c..cb84c06 100644 --- a/contrib/libreadline/vi_keymap.c +++ b/contrib/libreadline/vi_keymap.c @@ -33,429 +33,429 @@ extern KEYMAP_ENTRY_ARRAY vi_escape_keymap; /* The keymap arrays for handling vi mode. */ KEYMAP_ENTRY_ARRAY vi_movement_keymap = { /* The regular control keys come first. */ - { ISFUNC, (Function *)0x0 }, /* Control-@ */ - { ISFUNC, (Function *)0x0 }, /* Control-a */ - { ISFUNC, (Function *)0x0 }, /* Control-b */ - { ISFUNC, (Function *)0x0 }, /* Control-c */ - { ISFUNC, rl_vi_eof_maybe }, /* Control-d */ - { ISFUNC, rl_emacs_editing_mode }, /* Control-e */ - { ISFUNC, (Function *)0x0 }, /* Control-f */ - { ISFUNC, rl_abort }, /* Control-g */ - { ISFUNC, rl_backward }, /* Control-h */ - { ISFUNC, (Function *)0x0 }, /* Control-i */ - { ISFUNC, rl_newline }, /* Control-j */ - { ISFUNC, rl_kill_line }, /* Control-k */ - { ISFUNC, rl_clear_screen }, /* Control-l */ - { ISFUNC, rl_newline }, /* Control-m */ - { ISFUNC, rl_get_next_history }, /* Control-n */ - { ISFUNC, (Function *)0x0 }, /* Control-o */ - { ISFUNC, rl_get_previous_history }, /* Control-p */ - { ISFUNC, rl_quoted_insert }, /* Control-q */ - { ISFUNC, rl_reverse_search_history }, /* Control-r */ - { ISFUNC, rl_forward_search_history }, /* Control-s */ - { ISFUNC, rl_transpose_chars }, /* Control-t */ - { ISFUNC, rl_unix_line_discard }, /* Control-u */ - { ISFUNC, rl_quoted_insert }, /* Control-v */ - { ISFUNC, rl_unix_word_rubout }, /* Control-w */ - { ISFUNC, (Function *)0x0 }, /* Control-x */ - { ISFUNC, rl_yank }, /* Control-y */ - { ISFUNC, (Function *)0x0 }, /* Control-z */ - - { ISFUNC, (Function *)0x0 }, /* Control-[ */ /* vi_escape_keymap */ - { ISFUNC, (Function *)0x0 }, /* Control-\ */ - { ISFUNC, (Function *)0x0 }, /* Control-] */ - { ISFUNC, (Function *)0x0 }, /* Control-^ */ - { ISFUNC, rl_vi_undo }, /* Control-_ */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-@ */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-a */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-b */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-c */ + { ISFUNC, rl_vi_eof_maybe }, /* Control-d */ + { ISFUNC, rl_emacs_editing_mode }, /* Control-e */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-f */ + { ISFUNC, rl_abort }, /* Control-g */ + { ISFUNC, rl_backward }, /* Control-h */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-i */ + { ISFUNC, rl_newline }, /* Control-j */ + { ISFUNC, rl_kill_line }, /* Control-k */ + { ISFUNC, rl_clear_screen }, /* Control-l */ + { ISFUNC, rl_newline }, /* Control-m */ + { ISFUNC, rl_get_next_history }, /* Control-n */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-o */ + { ISFUNC, rl_get_previous_history }, /* Control-p */ + { ISFUNC, rl_quoted_insert }, /* Control-q */ + { ISFUNC, rl_reverse_search_history }, /* Control-r */ + { ISFUNC, rl_forward_search_history }, /* Control-s */ + { ISFUNC, rl_transpose_chars }, /* Control-t */ + { ISFUNC, rl_unix_line_discard }, /* Control-u */ + { ISFUNC, rl_quoted_insert }, /* Control-v */ + { ISFUNC, rl_unix_word_rubout }, /* Control-w */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-x */ + { ISFUNC, rl_yank }, /* Control-y */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-z */ + + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-[ */ /* vi_escape_keymap */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-\ */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-] */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-^ */ + { ISFUNC, rl_vi_undo }, /* Control-_ */ /* The start of printing characters. */ - { ISFUNC, rl_forward }, /* SPACE */ - { ISFUNC, (Function *)0x0 }, /* ! */ - { ISFUNC, (Function *)0x0 }, /* " */ - { ISFUNC, rl_insert_comment }, /* # */ - { ISFUNC, rl_end_of_line }, /* $ */ - { ISFUNC, rl_vi_match }, /* % */ - { ISFUNC, rl_vi_tilde_expand }, /* & */ - { ISFUNC, (Function *)0x0 }, /* ' */ - { ISFUNC, (Function *)0x0 }, /* ( */ - { ISFUNC, (Function *)0x0 }, /* ) */ - { ISFUNC, rl_vi_complete }, /* * */ - { ISFUNC, rl_get_next_history}, /* + */ - { ISFUNC, rl_vi_char_search }, /* , */ - { ISFUNC, rl_get_previous_history }, /* - */ - { ISFUNC, rl_vi_redo }, /* . */ - { ISFUNC, rl_vi_search }, /* / */ + { ISFUNC, rl_forward }, /* SPACE */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* ! */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* " */ + { ISFUNC, rl_insert_comment }, /* # */ + { ISFUNC, rl_end_of_line }, /* $ */ + { ISFUNC, rl_vi_match }, /* % */ + { ISFUNC, rl_vi_tilde_expand }, /* & */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* ' */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* ( */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* ) */ + { ISFUNC, rl_vi_complete }, /* * */ + { ISFUNC, rl_get_next_history}, /* + */ + { ISFUNC, rl_vi_char_search }, /* , */ + { ISFUNC, rl_get_previous_history }, /* - */ + { ISFUNC, rl_vi_redo }, /* . */ + { ISFUNC, rl_vi_search }, /* / */ /* Regular digits. */ - { ISFUNC, rl_beg_of_line }, /* 0 */ - { ISFUNC, rl_vi_arg_digit }, /* 1 */ - { ISFUNC, rl_vi_arg_digit }, /* 2 */ - { ISFUNC, rl_vi_arg_digit }, /* 3 */ - { ISFUNC, rl_vi_arg_digit }, /* 4 */ - { ISFUNC, rl_vi_arg_digit }, /* 5 */ - { ISFUNC, rl_vi_arg_digit }, /* 6 */ - { ISFUNC, rl_vi_arg_digit }, /* 7 */ - { ISFUNC, rl_vi_arg_digit }, /* 8 */ - { ISFUNC, rl_vi_arg_digit }, /* 9 */ + { ISFUNC, rl_beg_of_line }, /* 0 */ + { ISFUNC, rl_vi_arg_digit }, /* 1 */ + { ISFUNC, rl_vi_arg_digit }, /* 2 */ + { ISFUNC, rl_vi_arg_digit }, /* 3 */ + { ISFUNC, rl_vi_arg_digit }, /* 4 */ + { ISFUNC, rl_vi_arg_digit }, /* 5 */ + { ISFUNC, rl_vi_arg_digit }, /* 6 */ + { ISFUNC, rl_vi_arg_digit }, /* 7 */ + { ISFUNC, rl_vi_arg_digit }, /* 8 */ + { ISFUNC, rl_vi_arg_digit }, /* 9 */ /* A little more punctuation. */ - { ISFUNC, (Function *)0x0 }, /* : */ - { ISFUNC, rl_vi_char_search }, /* ; */ - { ISFUNC, (Function *)0x0 }, /* < */ - { ISFUNC, rl_vi_complete }, /* = */ - { ISFUNC, (Function *)0x0 }, /* > */ - { ISFUNC, rl_vi_search }, /* ? */ - { ISFUNC, (Function *)0x0 }, /* @ */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* : */ + { ISFUNC, rl_vi_char_search }, /* ; */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* < */ + { ISFUNC, rl_vi_complete }, /* = */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* > */ + { ISFUNC, rl_vi_search }, /* ? */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* @ */ /* Uppercase alphabet. */ - { ISFUNC, rl_vi_append_eol }, /* A */ - { ISFUNC, rl_vi_prev_word}, /* B */ - { ISFUNC, rl_vi_change_to }, /* C */ - { ISFUNC, rl_vi_delete_to }, /* D */ - { ISFUNC, rl_vi_end_word }, /* E */ - { ISFUNC, rl_vi_char_search }, /* F */ - { ISFUNC, rl_vi_fetch_history }, /* G */ - { ISFUNC, (Function *)0x0 }, /* H */ - { ISFUNC, rl_vi_insert_beg }, /* I */ - { ISFUNC, (Function *)0x0 }, /* J */ - { ISFUNC, (Function *)0x0 }, /* K */ - { ISFUNC, (Function *)0x0 }, /* L */ - { ISFUNC, (Function *)0x0 }, /* M */ - { ISFUNC, rl_vi_search_again }, /* N */ - { ISFUNC, (Function *)0x0 }, /* O */ - { ISFUNC, rl_vi_put }, /* P */ - { ISFUNC, (Function *)0x0 }, /* Q */ - { ISFUNC, rl_vi_replace }, /* R */ - { ISFUNC, rl_vi_subst }, /* S */ - { ISFUNC, rl_vi_char_search }, /* T */ - { ISFUNC, rl_revert_line }, /* U */ - { ISFUNC, (Function *)0x0 }, /* V */ - { ISFUNC, rl_vi_next_word }, /* W */ - { ISFUNC, rl_rubout }, /* X */ - { ISFUNC, rl_vi_yank_to }, /* Y */ - { ISFUNC, (Function *)0x0 }, /* Z */ + { ISFUNC, rl_vi_append_eol }, /* A */ + { ISFUNC, rl_vi_prev_word}, /* B */ + { ISFUNC, rl_vi_change_to }, /* C */ + { ISFUNC, rl_vi_delete_to }, /* D */ + { ISFUNC, rl_vi_end_word }, /* E */ + { ISFUNC, rl_vi_char_search }, /* F */ + { ISFUNC, rl_vi_fetch_history }, /* G */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* H */ + { ISFUNC, rl_vi_insert_beg }, /* I */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* J */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* K */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* L */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* M */ + { ISFUNC, rl_vi_search_again }, /* N */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* O */ + { ISFUNC, rl_vi_put }, /* P */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Q */ + { ISFUNC, rl_vi_replace }, /* R */ + { ISFUNC, rl_vi_subst }, /* S */ + { ISFUNC, rl_vi_char_search }, /* T */ + { ISFUNC, rl_revert_line }, /* U */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* V */ + { ISFUNC, rl_vi_next_word }, /* W */ + { ISFUNC, rl_rubout }, /* X */ + { ISFUNC, rl_vi_yank_to }, /* Y */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Z */ /* Some more punctuation. */ - { ISFUNC, (Function *)0x0 }, /* [ */ - { ISFUNC, rl_vi_complete }, /* \ */ - { ISFUNC, (Function *)0x0 }, /* ] */ - { ISFUNC, rl_vi_first_print }, /* ^ */ - { ISFUNC, rl_vi_yank_arg }, /* _ */ - { ISFUNC, rl_vi_goto_mark }, /* ` */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* [ */ + { ISFUNC, rl_vi_complete }, /* \ */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* ] */ + { ISFUNC, rl_vi_first_print }, /* ^ */ + { ISFUNC, rl_vi_yank_arg }, /* _ */ + { ISFUNC, rl_vi_goto_mark }, /* ` */ /* Lowercase alphabet. */ - { ISFUNC, rl_vi_append_mode }, /* a */ - { ISFUNC, rl_vi_prev_word }, /* b */ - { ISFUNC, rl_vi_change_to }, /* c */ - { ISFUNC, rl_vi_delete_to }, /* d */ - { ISFUNC, rl_vi_end_word }, /* e */ - { ISFUNC, rl_vi_char_search }, /* f */ - { ISFUNC, (Function *)0x0 }, /* g */ - { ISFUNC, rl_backward }, /* h */ - { ISFUNC, rl_vi_insertion_mode }, /* i */ - { ISFUNC, rl_get_next_history }, /* j */ - { ISFUNC, rl_get_previous_history }, /* k */ - { ISFUNC, rl_forward }, /* l */ - { ISFUNC, rl_vi_set_mark }, /* m */ - { ISFUNC, rl_vi_search_again }, /* n */ - { ISFUNC, (Function *)0x0 }, /* o */ - { ISFUNC, rl_vi_put }, /* p */ - { ISFUNC, (Function *)0x0 }, /* q */ - { ISFUNC, rl_vi_change_char }, /* r */ - { ISFUNC, rl_vi_subst }, /* s */ - { ISFUNC, rl_vi_char_search }, /* t */ - { ISFUNC, rl_vi_undo }, /* u */ - { ISFUNC, (Function *)0x0 }, /* v */ - { ISFUNC, rl_vi_next_word }, /* w */ - { ISFUNC, rl_vi_delete }, /* x */ - { ISFUNC, rl_vi_yank_to }, /* y */ - { ISFUNC, (Function *)0x0 }, /* z */ + { ISFUNC, rl_vi_append_mode }, /* a */ + { ISFUNC, rl_vi_prev_word }, /* b */ + { ISFUNC, rl_vi_change_to }, /* c */ + { ISFUNC, rl_vi_delete_to }, /* d */ + { ISFUNC, rl_vi_end_word }, /* e */ + { ISFUNC, rl_vi_char_search }, /* f */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* g */ + { ISFUNC, rl_backward }, /* h */ + { ISFUNC, rl_vi_insertion_mode }, /* i */ + { ISFUNC, rl_get_next_history }, /* j */ + { ISFUNC, rl_get_previous_history }, /* k */ + { ISFUNC, rl_forward }, /* l */ + { ISFUNC, rl_vi_set_mark }, /* m */ + { ISFUNC, rl_vi_search_again }, /* n */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* o */ + { ISFUNC, rl_vi_put }, /* p */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* q */ + { ISFUNC, rl_vi_change_char }, /* r */ + { ISFUNC, rl_vi_subst }, /* s */ + { ISFUNC, rl_vi_char_search }, /* t */ + { ISFUNC, rl_vi_undo }, /* u */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* v */ + { ISFUNC, rl_vi_next_word }, /* w */ + { ISFUNC, rl_vi_delete }, /* x */ + { ISFUNC, rl_vi_yank_to }, /* y */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* z */ /* Final punctuation. */ - { ISFUNC, (Function *)0x0 }, /* { */ - { ISFUNC, rl_vi_column }, /* | */ - { ISFUNC, (Function *)0x0 }, /* } */ - { ISFUNC, rl_vi_change_case }, /* ~ */ - { ISFUNC, (Function *)0x0 }, /* RUBOUT */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* { */ + { ISFUNC, rl_vi_column }, /* | */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* } */ + { ISFUNC, rl_vi_change_case }, /* ~ */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* RUBOUT */ #if KEYMAP_SIZE > 128 /* Undefined keys. */ - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 } + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 } #endif /* KEYMAP_SIZE > 128 */ }; KEYMAP_ENTRY_ARRAY vi_insertion_keymap = { /* The regular control keys come first. */ - { ISFUNC, (Function *)0x0 }, /* Control-@ */ - { ISFUNC, rl_insert }, /* Control-a */ - { ISFUNC, rl_insert }, /* Control-b */ - { ISFUNC, rl_insert }, /* Control-c */ - { ISFUNC, rl_vi_eof_maybe }, /* Control-d */ - { ISFUNC, rl_insert }, /* Control-e */ - { ISFUNC, rl_insert }, /* Control-f */ - { ISFUNC, rl_insert }, /* Control-g */ - { ISFUNC, rl_rubout }, /* Control-h */ - { ISFUNC, rl_complete }, /* Control-i */ - { ISFUNC, rl_newline }, /* Control-j */ - { ISFUNC, rl_insert }, /* Control-k */ - { ISFUNC, rl_insert }, /* Control-l */ - { ISFUNC, rl_newline }, /* Control-m */ - { ISFUNC, rl_insert }, /* Control-n */ - { ISFUNC, rl_insert }, /* Control-o */ - { ISFUNC, rl_insert }, /* Control-p */ - { ISFUNC, rl_insert }, /* Control-q */ - { ISFUNC, rl_reverse_search_history }, /* Control-r */ - { ISFUNC, rl_forward_search_history }, /* Control-s */ - { ISFUNC, rl_transpose_chars }, /* Control-t */ - { ISFUNC, rl_unix_line_discard }, /* Control-u */ - { ISFUNC, rl_quoted_insert }, /* Control-v */ - { ISFUNC, rl_unix_word_rubout }, /* Control-w */ - { ISFUNC, rl_insert }, /* Control-x */ - { ISFUNC, rl_yank }, /* Control-y */ - { ISFUNC, rl_insert }, /* Control-z */ - - { ISFUNC, rl_vi_movement_mode }, /* Control-[ */ - { ISFUNC, rl_insert }, /* Control-\ */ - { ISFUNC, rl_insert }, /* Control-] */ - { ISFUNC, rl_insert }, /* Control-^ */ - { ISFUNC, rl_vi_undo }, /* Control-_ */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-@ */ + { ISFUNC, rl_insert }, /* Control-a */ + { ISFUNC, rl_insert }, /* Control-b */ + { ISFUNC, rl_insert }, /* Control-c */ + { ISFUNC, rl_vi_eof_maybe }, /* Control-d */ + { ISFUNC, rl_insert }, /* Control-e */ + { ISFUNC, rl_insert }, /* Control-f */ + { ISFUNC, rl_insert }, /* Control-g */ + { ISFUNC, rl_rubout }, /* Control-h */ + { ISFUNC, rl_complete }, /* Control-i */ + { ISFUNC, rl_newline }, /* Control-j */ + { ISFUNC, rl_insert }, /* Control-k */ + { ISFUNC, rl_insert }, /* Control-l */ + { ISFUNC, rl_newline }, /* Control-m */ + { ISFUNC, rl_insert }, /* Control-n */ + { ISFUNC, rl_insert }, /* Control-o */ + { ISFUNC, rl_insert }, /* Control-p */ + { ISFUNC, rl_insert }, /* Control-q */ + { ISFUNC, rl_reverse_search_history }, /* Control-r */ + { ISFUNC, rl_forward_search_history }, /* Control-s */ + { ISFUNC, rl_transpose_chars }, /* Control-t */ + { ISFUNC, rl_unix_line_discard }, /* Control-u */ + { ISFUNC, rl_quoted_insert }, /* Control-v */ + { ISFUNC, rl_unix_word_rubout }, /* Control-w */ + { ISFUNC, rl_insert }, /* Control-x */ + { ISFUNC, rl_yank }, /* Control-y */ + { ISFUNC, rl_insert }, /* Control-z */ + + { ISFUNC, rl_vi_movement_mode }, /* Control-[ */ + { ISFUNC, rl_insert }, /* Control-\ */ + { ISFUNC, rl_insert }, /* Control-] */ + { ISFUNC, rl_insert }, /* Control-^ */ + { ISFUNC, rl_vi_undo }, /* Control-_ */ /* The start of printing characters. */ - { ISFUNC, rl_insert }, /* SPACE */ - { ISFUNC, rl_insert }, /* ! */ - { ISFUNC, rl_insert }, /* " */ - { ISFUNC, rl_insert }, /* # */ - { ISFUNC, rl_insert }, /* $ */ - { ISFUNC, rl_insert }, /* % */ - { ISFUNC, rl_insert }, /* & */ - { ISFUNC, rl_insert }, /* ' */ - { ISFUNC, rl_insert }, /* ( */ - { ISFUNC, rl_insert }, /* ) */ - { ISFUNC, rl_insert }, /* * */ - { ISFUNC, rl_insert }, /* + */ - { ISFUNC, rl_insert }, /* , */ - { ISFUNC, rl_insert }, /* - */ - { ISFUNC, rl_insert }, /* . */ - { ISFUNC, rl_insert }, /* / */ + { ISFUNC, rl_insert }, /* SPACE */ + { ISFUNC, rl_insert }, /* ! */ + { ISFUNC, rl_insert }, /* " */ + { ISFUNC, rl_insert }, /* # */ + { ISFUNC, rl_insert }, /* $ */ + { ISFUNC, rl_insert }, /* % */ + { ISFUNC, rl_insert }, /* & */ + { ISFUNC, rl_insert }, /* ' */ + { ISFUNC, rl_insert }, /* ( */ + { ISFUNC, rl_insert }, /* ) */ + { ISFUNC, rl_insert }, /* * */ + { ISFUNC, rl_insert }, /* + */ + { ISFUNC, rl_insert }, /* , */ + { ISFUNC, rl_insert }, /* - */ + { ISFUNC, rl_insert }, /* . */ + { ISFUNC, rl_insert }, /* / */ /* Regular digits. */ - { ISFUNC, rl_insert }, /* 0 */ - { ISFUNC, rl_insert }, /* 1 */ - { ISFUNC, rl_insert }, /* 2 */ - { ISFUNC, rl_insert }, /* 3 */ - { ISFUNC, rl_insert }, /* 4 */ - { ISFUNC, rl_insert }, /* 5 */ - { ISFUNC, rl_insert }, /* 6 */ - { ISFUNC, rl_insert }, /* 7 */ - { ISFUNC, rl_insert }, /* 8 */ - { ISFUNC, rl_insert }, /* 9 */ + { ISFUNC, rl_insert }, /* 0 */ + { ISFUNC, rl_insert }, /* 1 */ + { ISFUNC, rl_insert }, /* 2 */ + { ISFUNC, rl_insert }, /* 3 */ + { ISFUNC, rl_insert }, /* 4 */ + { ISFUNC, rl_insert }, /* 5 */ + { ISFUNC, rl_insert }, /* 6 */ + { ISFUNC, rl_insert }, /* 7 */ + { ISFUNC, rl_insert }, /* 8 */ + { ISFUNC, rl_insert }, /* 9 */ /* A little more punctuation. */ - { ISFUNC, rl_insert }, /* : */ - { ISFUNC, rl_insert }, /* ; */ - { ISFUNC, rl_insert }, /* < */ - { ISFUNC, rl_insert }, /* = */ - { ISFUNC, rl_insert }, /* > */ - { ISFUNC, rl_insert }, /* ? */ - { ISFUNC, rl_insert }, /* @ */ + { ISFUNC, rl_insert }, /* : */ + { ISFUNC, rl_insert }, /* ; */ + { ISFUNC, rl_insert }, /* < */ + { ISFUNC, rl_insert }, /* = */ + { ISFUNC, rl_insert }, /* > */ + { ISFUNC, rl_insert }, /* ? */ + { ISFUNC, rl_insert }, /* @ */ /* Uppercase alphabet. */ - { ISFUNC, rl_insert }, /* A */ - { ISFUNC, rl_insert }, /* B */ - { ISFUNC, rl_insert }, /* C */ - { ISFUNC, rl_insert }, /* D */ - { ISFUNC, rl_insert }, /* E */ - { ISFUNC, rl_insert }, /* F */ - { ISFUNC, rl_insert }, /* G */ - { ISFUNC, rl_insert }, /* H */ - { ISFUNC, rl_insert }, /* I */ - { ISFUNC, rl_insert }, /* J */ - { ISFUNC, rl_insert }, /* K */ - { ISFUNC, rl_insert }, /* L */ - { ISFUNC, rl_insert }, /* M */ - { ISFUNC, rl_insert }, /* N */ - { ISFUNC, rl_insert }, /* O */ - { ISFUNC, rl_insert }, /* P */ - { ISFUNC, rl_insert }, /* Q */ - { ISFUNC, rl_insert }, /* R */ - { ISFUNC, rl_insert }, /* S */ - { ISFUNC, rl_insert }, /* T */ - { ISFUNC, rl_insert }, /* U */ - { ISFUNC, rl_insert }, /* V */ - { ISFUNC, rl_insert }, /* W */ - { ISFUNC, rl_insert }, /* X */ - { ISFUNC, rl_insert }, /* Y */ - { ISFUNC, rl_insert }, /* Z */ + { ISFUNC, rl_insert }, /* A */ + { ISFUNC, rl_insert }, /* B */ + { ISFUNC, rl_insert }, /* C */ + { ISFUNC, rl_insert }, /* D */ + { ISFUNC, rl_insert }, /* E */ + { ISFUNC, rl_insert }, /* F */ + { ISFUNC, rl_insert }, /* G */ + { ISFUNC, rl_insert }, /* H */ + { ISFUNC, rl_insert }, /* I */ + { ISFUNC, rl_insert }, /* J */ + { ISFUNC, rl_insert }, /* K */ + { ISFUNC, rl_insert }, /* L */ + { ISFUNC, rl_insert }, /* M */ + { ISFUNC, rl_insert }, /* N */ + { ISFUNC, rl_insert }, /* O */ + { ISFUNC, rl_insert }, /* P */ + { ISFUNC, rl_insert }, /* Q */ + { ISFUNC, rl_insert }, /* R */ + { ISFUNC, rl_insert }, /* S */ + { ISFUNC, rl_insert }, /* T */ + { ISFUNC, rl_insert }, /* U */ + { ISFUNC, rl_insert }, /* V */ + { ISFUNC, rl_insert }, /* W */ + { ISFUNC, rl_insert }, /* X */ + { ISFUNC, rl_insert }, /* Y */ + { ISFUNC, rl_insert }, /* Z */ /* Some more punctuation. */ - { ISFUNC, rl_insert }, /* [ */ - { ISFUNC, rl_insert }, /* \ */ - { ISFUNC, rl_insert }, /* ] */ - { ISFUNC, rl_insert }, /* ^ */ - { ISFUNC, rl_insert }, /* _ */ - { ISFUNC, rl_insert }, /* ` */ + { ISFUNC, rl_insert }, /* [ */ + { ISFUNC, rl_insert }, /* \ */ + { ISFUNC, rl_insert }, /* ] */ + { ISFUNC, rl_insert }, /* ^ */ + { ISFUNC, rl_insert }, /* _ */ + { ISFUNC, rl_insert }, /* ` */ /* Lowercase alphabet. */ - { ISFUNC, rl_insert }, /* a */ - { ISFUNC, rl_insert }, /* b */ - { ISFUNC, rl_insert }, /* c */ - { ISFUNC, rl_insert }, /* d */ - { ISFUNC, rl_insert }, /* e */ - { ISFUNC, rl_insert }, /* f */ - { ISFUNC, rl_insert }, /* g */ - { ISFUNC, rl_insert }, /* h */ - { ISFUNC, rl_insert }, /* i */ - { ISFUNC, rl_insert }, /* j */ - { ISFUNC, rl_insert }, /* k */ - { ISFUNC, rl_insert }, /* l */ - { ISFUNC, rl_insert }, /* m */ - { ISFUNC, rl_insert }, /* n */ - { ISFUNC, rl_insert }, /* o */ - { ISFUNC, rl_insert }, /* p */ - { ISFUNC, rl_insert }, /* q */ - { ISFUNC, rl_insert }, /* r */ - { ISFUNC, rl_insert }, /* s */ - { ISFUNC, rl_insert }, /* t */ - { ISFUNC, rl_insert }, /* u */ - { ISFUNC, rl_insert }, /* v */ - { ISFUNC, rl_insert }, /* w */ - { ISFUNC, rl_insert }, /* x */ - { ISFUNC, rl_insert }, /* y */ - { ISFUNC, rl_insert }, /* z */ + { ISFUNC, rl_insert }, /* a */ + { ISFUNC, rl_insert }, /* b */ + { ISFUNC, rl_insert }, /* c */ + { ISFUNC, rl_insert }, /* d */ + { ISFUNC, rl_insert }, /* e */ + { ISFUNC, rl_insert }, /* f */ + { ISFUNC, rl_insert }, /* g */ + { ISFUNC, rl_insert }, /* h */ + { ISFUNC, rl_insert }, /* i */ + { ISFUNC, rl_insert }, /* j */ + { ISFUNC, rl_insert }, /* k */ + { ISFUNC, rl_insert }, /* l */ + { ISFUNC, rl_insert }, /* m */ + { ISFUNC, rl_insert }, /* n */ + { ISFUNC, rl_insert }, /* o */ + { ISFUNC, rl_insert }, /* p */ + { ISFUNC, rl_insert }, /* q */ + { ISFUNC, rl_insert }, /* r */ + { ISFUNC, rl_insert }, /* s */ + { ISFUNC, rl_insert }, /* t */ + { ISFUNC, rl_insert }, /* u */ + { ISFUNC, rl_insert }, /* v */ + { ISFUNC, rl_insert }, /* w */ + { ISFUNC, rl_insert }, /* x */ + { ISFUNC, rl_insert }, /* y */ + { ISFUNC, rl_insert }, /* z */ /* Final punctuation. */ - { ISFUNC, rl_insert }, /* { */ - { ISFUNC, rl_insert }, /* | */ - { ISFUNC, rl_insert }, /* } */ - { ISFUNC, rl_insert }, /* ~ */ - { ISFUNC, rl_rubout }, /* RUBOUT */ + { ISFUNC, rl_insert }, /* { */ + { ISFUNC, rl_insert }, /* | */ + { ISFUNC, rl_insert }, /* } */ + { ISFUNC, rl_insert }, /* ~ */ + { ISFUNC, rl_rubout }, /* RUBOUT */ #if KEYMAP_SIZE > 128 /* Pure 8-bit characters (128 - 159). @@ -598,280 +598,280 @@ KEYMAP_ENTRY_ARRAY vi_insertion_keymap = { #if 0 KEYMAP_ENTRY_ARRAY vi_escape_keymap = { /* The regular control keys come first. */ - { ISFUNC, (Function *)0x0 }, /* Control-@ */ - { ISFUNC, (Function *)0x0 }, /* Control-a */ - { ISFUNC, (Function *)0x0 }, /* Control-b */ - { ISFUNC, (Function *)0x0 }, /* Control-c */ - { ISFUNC, (Function *)0x0 }, /* Control-d */ - { ISFUNC, (Function *)0x0 }, /* Control-e */ - { ISFUNC, (Function *)0x0 }, /* Control-f */ - { ISFUNC, (Function *)0x0 }, /* Control-g */ - { ISFUNC, (Function *)0x0 }, /* Control-h */ - { ISFUNC, rl_tab_insert}, /* Control-i */ - { ISFUNC, rl_emacs_editing_mode}, /* Control-j */ - { ISFUNC, rl_kill_line }, /* Control-k */ - { ISFUNC, (Function *)0x0 }, /* Control-l */ - { ISFUNC, rl_emacs_editing_mode}, /* Control-m */ - { ISFUNC, (Function *)0x0 }, /* Control-n */ - { ISFUNC, (Function *)0x0 }, /* Control-o */ - { ISFUNC, (Function *)0x0 }, /* Control-p */ - { ISFUNC, (Function *)0x0 }, /* Control-q */ - { ISFUNC, (Function *)0x0 }, /* Control-r */ - { ISFUNC, (Function *)0x0 }, /* Control-s */ - { ISFUNC, (Function *)0x0 }, /* Control-t */ - { ISFUNC, (Function *)0x0 }, /* Control-u */ - { ISFUNC, (Function *)0x0 }, /* Control-v */ - { ISFUNC, (Function *)0x0 }, /* Control-w */ - { ISFUNC, (Function *)0x0 }, /* Control-x */ - { ISFUNC, (Function *)0x0 }, /* Control-y */ - { ISFUNC, (Function *)0x0 }, /* Control-z */ - - { ISFUNC, rl_vi_movement_mode }, /* Control-[ */ - { ISFUNC, (Function *)0x0 }, /* Control-\ */ - { ISFUNC, (Function *)0x0 }, /* Control-] */ - { ISFUNC, (Function *)0x0 }, /* Control-^ */ - { ISFUNC, rl_vi_undo }, /* Control-_ */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-@ */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-a */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-b */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-c */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-d */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-e */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-f */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-g */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-h */ + { ISFUNC, rl_tab_insert}, /* Control-i */ + { ISFUNC, rl_emacs_editing_mode}, /* Control-j */ + { ISFUNC, rl_kill_line }, /* Control-k */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-l */ + { ISFUNC, rl_emacs_editing_mode}, /* Control-m */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-n */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-o */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-p */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-q */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-r */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-s */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-t */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-u */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-v */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-w */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-x */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-y */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-z */ + + { ISFUNC, rl_vi_movement_mode }, /* Control-[ */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-\ */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-] */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-^ */ + { ISFUNC, rl_vi_undo }, /* Control-_ */ /* The start of printing characters. */ - { ISFUNC, (Function *)0x0 }, /* SPACE */ - { ISFUNC, (Function *)0x0 }, /* ! */ - { ISFUNC, (Function *)0x0 }, /* " */ - { ISFUNC, (Function *)0x0 }, /* # */ - { ISFUNC, (Function *)0x0 }, /* $ */ - { ISFUNC, (Function *)0x0 }, /* % */ - { ISFUNC, (Function *)0x0 }, /* & */ - { ISFUNC, (Function *)0x0 }, /* ' */ - { ISFUNC, (Function *)0x0 }, /* ( */ - { ISFUNC, (Function *)0x0 }, /* ) */ - { ISFUNC, (Function *)0x0 }, /* * */ - { ISFUNC, (Function *)0x0 }, /* + */ - { ISFUNC, (Function *)0x0 }, /* , */ - { ISFUNC, (Function *)0x0 }, /* - */ - { ISFUNC, (Function *)0x0 }, /* . */ - { ISFUNC, (Function *)0x0 }, /* / */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* SPACE */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* ! */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* " */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* # */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* $ */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* % */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* & */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* ' */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* ( */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* ) */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* * */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* + */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* , */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* - */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* . */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* / */ /* Regular digits. */ - { ISFUNC, rl_vi_arg_digit }, /* 0 */ - { ISFUNC, rl_vi_arg_digit }, /* 1 */ - { ISFUNC, rl_vi_arg_digit }, /* 2 */ - { ISFUNC, rl_vi_arg_digit }, /* 3 */ - { ISFUNC, rl_vi_arg_digit }, /* 4 */ - { ISFUNC, rl_vi_arg_digit }, /* 5 */ - { ISFUNC, rl_vi_arg_digit }, /* 6 */ - { ISFUNC, rl_vi_arg_digit }, /* 7 */ - { ISFUNC, rl_vi_arg_digit }, /* 8 */ - { ISFUNC, rl_vi_arg_digit }, /* 9 */ + { ISFUNC, rl_vi_arg_digit }, /* 0 */ + { ISFUNC, rl_vi_arg_digit }, /* 1 */ + { ISFUNC, rl_vi_arg_digit }, /* 2 */ + { ISFUNC, rl_vi_arg_digit }, /* 3 */ + { ISFUNC, rl_vi_arg_digit }, /* 4 */ + { ISFUNC, rl_vi_arg_digit }, /* 5 */ + { ISFUNC, rl_vi_arg_digit }, /* 6 */ + { ISFUNC, rl_vi_arg_digit }, /* 7 */ + { ISFUNC, rl_vi_arg_digit }, /* 8 */ + { ISFUNC, rl_vi_arg_digit }, /* 9 */ /* A little more punctuation. */ - { ISFUNC, (Function *)0x0 }, /* : */ - { ISFUNC, (Function *)0x0 }, /* ; */ - { ISFUNC, (Function *)0x0 }, /* < */ - { ISFUNC, (Function *)0x0 }, /* = */ - { ISFUNC, (Function *)0x0 }, /* > */ - { ISFUNC, (Function *)0x0 }, /* ? */ - { ISFUNC, (Function *)0x0 }, /* @ */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* : */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* ; */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* < */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* = */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* > */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* ? */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* @ */ /* Uppercase alphabet. */ - { ISFUNC, rl_do_lowercase_version }, /* A */ - { ISFUNC, rl_do_lowercase_version }, /* B */ - { ISFUNC, rl_do_lowercase_version }, /* C */ - { ISFUNC, rl_do_lowercase_version }, /* D */ - { ISFUNC, rl_do_lowercase_version }, /* E */ - { ISFUNC, rl_do_lowercase_version }, /* F */ - { ISFUNC, rl_do_lowercase_version }, /* G */ - { ISFUNC, rl_do_lowercase_version }, /* H */ - { ISFUNC, rl_do_lowercase_version }, /* I */ - { ISFUNC, rl_do_lowercase_version }, /* J */ - { ISFUNC, rl_do_lowercase_version }, /* K */ - { ISFUNC, rl_do_lowercase_version }, /* L */ - { ISFUNC, rl_do_lowercase_version }, /* M */ - { ISFUNC, rl_do_lowercase_version }, /* N */ - { ISFUNC, rl_do_lowercase_version }, /* O */ - { ISFUNC, rl_do_lowercase_version }, /* P */ - { ISFUNC, rl_do_lowercase_version }, /* Q */ - { ISFUNC, rl_do_lowercase_version }, /* R */ - { ISFUNC, rl_do_lowercase_version }, /* S */ - { ISFUNC, rl_do_lowercase_version }, /* T */ - { ISFUNC, rl_do_lowercase_version }, /* U */ - { ISFUNC, rl_do_lowercase_version }, /* V */ - { ISFUNC, rl_do_lowercase_version }, /* W */ - { ISFUNC, rl_do_lowercase_version }, /* X */ - { ISFUNC, rl_do_lowercase_version }, /* Y */ - { ISFUNC, rl_do_lowercase_version }, /* Z */ + { ISFUNC, rl_do_lowercase_version }, /* A */ + { ISFUNC, rl_do_lowercase_version }, /* B */ + { ISFUNC, rl_do_lowercase_version }, /* C */ + { ISFUNC, rl_do_lowercase_version }, /* D */ + { ISFUNC, rl_do_lowercase_version }, /* E */ + { ISFUNC, rl_do_lowercase_version }, /* F */ + { ISFUNC, rl_do_lowercase_version }, /* G */ + { ISFUNC, rl_do_lowercase_version }, /* H */ + { ISFUNC, rl_do_lowercase_version }, /* I */ + { ISFUNC, rl_do_lowercase_version }, /* J */ + { ISFUNC, rl_do_lowercase_version }, /* K */ + { ISFUNC, rl_do_lowercase_version }, /* L */ + { ISFUNC, rl_do_lowercase_version }, /* M */ + { ISFUNC, rl_do_lowercase_version }, /* N */ + { ISFUNC, rl_do_lowercase_version }, /* O */ + { ISFUNC, rl_do_lowercase_version }, /* P */ + { ISFUNC, rl_do_lowercase_version }, /* Q */ + { ISFUNC, rl_do_lowercase_version }, /* R */ + { ISFUNC, rl_do_lowercase_version }, /* S */ + { ISFUNC, rl_do_lowercase_version }, /* T */ + { ISFUNC, rl_do_lowercase_version }, /* U */ + { ISFUNC, rl_do_lowercase_version }, /* V */ + { ISFUNC, rl_do_lowercase_version }, /* W */ + { ISFUNC, rl_do_lowercase_version }, /* X */ + { ISFUNC, rl_do_lowercase_version }, /* Y */ + { ISFUNC, rl_do_lowercase_version }, /* Z */ /* Some more punctuation. */ - { ISFUNC, rl_arrow_keys }, /* [ */ - { ISFUNC, (Function *)0x0 }, /* \ */ - { ISFUNC, (Function *)0x0 }, /* ] */ - { ISFUNC, (Function *)0x0 }, /* ^ */ - { ISFUNC, (Function *)0x0 }, /* _ */ - { ISFUNC, (Function *)0x0 }, /* ` */ + { ISFUNC, rl_arrow_keys }, /* [ */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* \ */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* ] */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* ^ */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* _ */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* ` */ /* Lowercase alphabet. */ - { ISFUNC, (Function *)0x0 }, /* a */ - { ISFUNC, (Function *)0x0 }, /* b */ - { ISFUNC, (Function *)0x0 }, /* c */ - { ISFUNC, (Function *)0x0 }, /* d */ - { ISFUNC, (Function *)0x0 }, /* e */ - { ISFUNC, (Function *)0x0 }, /* f */ - { ISFUNC, (Function *)0x0 }, /* g */ - { ISFUNC, (Function *)0x0 }, /* h */ - { ISFUNC, (Function *)0x0 }, /* i */ - { ISFUNC, (Function *)0x0 }, /* j */ - { ISFUNC, (Function *)0x0 }, /* k */ - { ISFUNC, (Function *)0x0 }, /* l */ - { ISFUNC, (Function *)0x0 }, /* m */ - { ISFUNC, (Function *)0x0 }, /* n */ - { ISFUNC, rl_arrow_keys }, /* o */ - { ISFUNC, (Function *)0x0 }, /* p */ - { ISFUNC, (Function *)0x0 }, /* q */ - { ISFUNC, (Function *)0x0 }, /* r */ - { ISFUNC, (Function *)0x0 }, /* s */ - { ISFUNC, (Function *)0x0 }, /* t */ - { ISFUNC, (Function *)0x0 }, /* u */ - { ISFUNC, (Function *)0x0 }, /* v */ - { ISFUNC, (Function *)0x0 }, /* w */ - { ISFUNC, (Function *)0x0 }, /* x */ - { ISFUNC, (Function *)0x0 }, /* y */ - { ISFUNC, (Function *)0x0 }, /* z */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* a */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* b */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* c */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* d */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* e */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* f */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* g */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* h */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* i */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* j */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* k */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* l */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* m */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* n */ + { ISFUNC, rl_arrow_keys }, /* o */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* p */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* q */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* r */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* s */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* t */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* u */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* v */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* w */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* x */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* y */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* z */ /* Final punctuation. */ - { ISFUNC, (Function *)0x0 }, /* { */ - { ISFUNC, (Function *)0x0 }, /* | */ - { ISFUNC, (Function *)0x0 }, /* } */ - { ISFUNC, (Function *)0x0 }, /* ~ */ - { ISFUNC, rl_backward_kill_word }, /* RUBOUT */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* { */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* | */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* } */ + { ISFUNC, (rl_command_func_t *)0x0 }, /* ~ */ + { ISFUNC, rl_backward_kill_word }, /* RUBOUT */ #if KEYMAP_SIZE > 128 /* Undefined keys. */ - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 }, - { ISFUNC, (Function *)0x0 } + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 }, + { ISFUNC, (rl_command_func_t *)0x0 } #endif /* KEYMAP_SIZE > 128 */ }; #endif diff --git a/contrib/libreadline/vi_mode.c b/contrib/libreadline/vi_mode.c index be7f949..b9c0ea8 100644 --- a/contrib/libreadline/vi_mode.c +++ b/contrib/libreadline/vi_mode.c @@ -81,7 +81,7 @@ static int _rl_vi_doing_insert; /* Command keys which do movement for xxx_to commands. */ -static char *vi_motion = " hl^$0ftFt;,%wbeWBE|"; +static const char *vi_motion = " hl^$0ftFt;,%wbeWBE|"; /* Keymap used for vi replace characters. Created dynamically since rarely used. */ @@ -109,7 +109,7 @@ static int _rl_vi_last_key_before_insert; static int vi_redoing; /* Text modification commands. These are the `redoable' commands. */ -static char *vi_textmod = "_*\\AaIiCcDdPpYyRrSsXx~"; +static const char *vi_textmod = "_*\\AaIiCcDdPpYyRrSsXx~"; /* Arrays for the saved marks. */ static int vi_mark_chars[27]; @@ -274,7 +274,7 @@ rl_vi_search (count, key) break; default: - ding (); + rl_ding (); break; } return (0); @@ -330,7 +330,7 @@ rl_vi_prev_word (count, key) if (rl_point == 0) { - ding (); + rl_ding (); return (0); } @@ -352,7 +352,7 @@ rl_vi_next_word (count, key) if (rl_point >= (rl_end - 1)) { - ding (); + rl_ding (); return (0); } @@ -370,7 +370,7 @@ rl_vi_end_word (count, key) { if (count < 0) { - ding (); + rl_ding (); return -1; } @@ -744,7 +744,9 @@ rl_vi_domove (key, nextkey) int old_end; rl_mark = rl_point; + RL_SETSTATE(RL_STATE_MOREINPUT); c = rl_read_key (); + RL_UNSETSTATE(RL_STATE_MOREINPUT); *nextkey = c; if (!member (c, vi_motion)) @@ -755,7 +757,9 @@ rl_vi_domove (key, nextkey) rl_numeric_arg = _rl_digit_value (c); rl_digit_loop1 (); rl_numeric_arg *= save; + RL_SETSTATE(RL_STATE_MOREINPUT); c = rl_read_key (); /* real command */ + RL_UNSETSTATE(RL_STATE_MOREINPUT); *nextkey = c; } else if (key == c && (key == 'd' || key == 'y' || key == 'c')) @@ -825,16 +829,28 @@ rl_vi_domove (key, nextkey) } /* A simplified loop for vi. Don't dispatch key at end. - Don't recognize minus sign? */ + Don't recognize minus sign? + Should this do rl_save_prompt/rl_restore_prompt? */ static int rl_digit_loop1 () { int key, c; + RL_SETSTATE(RL_STATE_NUMERICARG); while (1) { + if (rl_numeric_arg > 1000000) + { + rl_explicit_arg = rl_numeric_arg = 0; + rl_ding (); + rl_clear_message (); + RL_UNSETSTATE(RL_STATE_NUMERICARG); + return 1; + } rl_message ("(arg: %d) ", rl_arg_sign * rl_numeric_arg, 0); + RL_SETSTATE(RL_STATE_MOREINPUT); key = c = rl_read_key (); + RL_UNSETSTATE(RL_STATE_MOREINPUT); if (_rl_keymap[c].type == ISFUNC && _rl_keymap[c].function == rl_universal_argument) @@ -859,6 +875,8 @@ rl_digit_loop1 () break; } } + + RL_UNSETSTATE(RL_STATE_NUMERICARG); return (0); } @@ -875,7 +893,7 @@ rl_vi_delete_to (count, key) if (rl_vi_domove (key, &c)) { - ding (); + rl_ding (); return -1; } @@ -903,7 +921,7 @@ rl_vi_change_to (count, key) if (rl_vi_domove (key, &c)) { - ding (); + rl_ding (); return -1; } @@ -953,7 +971,7 @@ rl_vi_yank_to (count, key) if (rl_vi_domove (key, &c)) { - ding (); + rl_ding (); return -1; } @@ -979,7 +997,7 @@ rl_vi_delete (count, key) if (rl_end == 0) { - ding (); + rl_ding (); return -1; } @@ -1026,7 +1044,11 @@ rl_vi_char_search (count, key) if (vi_redoing) target = _rl_vi_last_search_char; else - _rl_vi_last_search_char = target = (*rl_getc_function) (rl_instream); + { + RL_SETSTATE(RL_STATE_MOREINPUT); + _rl_vi_last_search_char = target = rl_read_key (); + RL_UNSETSTATE(RL_STATE_MOREINPUT); + } switch (key) { @@ -1068,7 +1090,7 @@ rl_vi_match (ignore, key) if (brack <= 0) { rl_point = pos; - ding (); + rl_ding (); return -1; } } @@ -1089,7 +1111,7 @@ rl_vi_match (ignore, key) } else { - ding (); + rl_ding (); return -1; } } @@ -1108,7 +1130,7 @@ rl_vi_match (ignore, key) } else { - ding (); + rl_ding (); return -1; } } @@ -1142,7 +1164,11 @@ rl_vi_change_char (count, key) if (vi_redoing) c = _rl_vi_last_replacement; else - _rl_vi_last_replacement = c = (*rl_getc_function) (rl_instream); + { + RL_SETSTATE(RL_STATE_MOREINPUT); + _rl_vi_last_replacement = c = rl_read_key (); + RL_UNSETSTATE(RL_STATE_MOREINPUT); + } if (c == '\033' || c == CTRL ('C')) return -1; @@ -1238,7 +1264,7 @@ rl_vi_overstrike_delete (count, key) { if (vi_replace_count == 0) { - ding (); + rl_ding (); break; } s = rl_point; @@ -1308,7 +1334,7 @@ rl_vi_possible_completions() } else if (rl_line_buffer[rl_point - 1] == ';') { - ding (); + rl_ding (); return (0); } @@ -1326,10 +1352,13 @@ rl_vi_set_mark (count, key) { int ch; + RL_SETSTATE(RL_STATE_MOREINPUT); ch = rl_read_key (); + RL_UNSETSTATE(RL_STATE_MOREINPUT); + if (_rl_lowercase_p (ch) == 0) { - ding (); + rl_ding (); return -1; } ch -= 'a'; @@ -1343,7 +1372,10 @@ rl_vi_goto_mark (count, key) { int ch; + RL_SETSTATE(RL_STATE_MOREINPUT); ch = rl_read_key (); + RL_UNSETSTATE(RL_STATE_MOREINPUT); + if (ch == '`') { rl_point = rl_mark; @@ -1351,14 +1383,14 @@ rl_vi_goto_mark (count, key) } else if (_rl_lowercase_p (ch) == 0) { - ding (); + rl_ding (); return -1; } ch -= 'a'; if (vi_mark_chars[ch] == -1) { - ding (); + rl_ding (); return -1; } rl_point = vi_mark_chars[ch]; -- cgit v1.1