diff options
author | Elena Zannoni <ezannoni@kwikemart.cygnus.com> | 2002-12-08 22:31:39 +0000 |
---|---|---|
committer | Elena Zannoni <ezannoni@kwikemart.cygnus.com> | 2002-12-08 22:31:39 +0000 |
commit | 9255ee3150832d7e235fc0711f0efa70700559e7 (patch) | |
tree | 97d578647cc7f257e42ce12fa74e570b783ee0b9 /readline/callback.c | |
parent | ffbceea9fb49e8dd28c88a4b59cf8616b2dcc210 (diff) | |
download | binutils-9255ee3150832d7e235fc0711f0efa70700559e7.zip binutils-9255ee3150832d7e235fc0711f0efa70700559e7.tar.gz binutils-9255ee3150832d7e235fc0711f0efa70700559e7.tar.bz2 |
Import of readline 4.3.
Non-readline modified files:
src/gdb/ChangeLog src/gdb/defs.h src/gdb/cli/cli-cmds.c
src/gdb/cli/cli-setshow.c src/gdb/tui/ChangeLog
src/gdb/tui/tuiWin.c
In readline directory:
* compat.c, mbutil.c, misc.c, rlmbutil.h, rltypedefs.h,
text.c, doc/history.0, doc/history.3, support/wcwidth.c,
examples/readlinebuf.h, examples/rlcat.c: New files.
* CHANGELOG, CHANGES, INSTALL, MANIFEST, Makefile.in, README,
aclocal.m4, ansi_stdlib.h, bind.c, callback.c, chardefs.h,
complete.c, config.h.in, configure, configure.in, display.c,
emacs_keymap.c, funmap.c, histexpand.c, histfile.c, histlib.h,
history.c, history.h, histsearch.c, input.c, isearch.c,
keymaps.c, keymaps.h, kill.c, macro.c, nls.c, parens.c,
posixdir.h, readline.c, readline.h, rlconf.h, rldefs.h,
rlprivate.h, rlshell.h, rlstdc.h, rltty.c, savestring.c,
search.c, shell.c, signals.c, terminal.c, tilde.c, tilde.h,
undo.c, util.c, vi_keymap.c, vi_mode.c, xmalloc.c, xmalloc.h,
doc/Makefile.in, doc/hist.texinfo, doc/hstech.texinfo,
doc/hsuser.texinfo, doc/manvers.texinfo, doc/readline.3,
doc/rlman.texinfo, doc/rltech.texinfo, doc/rluser.texinfo
doc/rluserman.texinfo, doc/texi2dvi, doc/texi2html,
shlib/Makefile.in, support/install.sh, support/mkdirs,
support/mkdist, support/shlib-install, support/shobj-conf,
examples/Inputrc, examples/Makefile.in, examples/fileman.c,
examples/histexamp.c, examples/manexamp.c, examples/rl.c,
examples/rlfe.c, examples/rltest.c, examples/rlversion.c:
Modified files.
Diffstat (limited to 'readline/callback.c')
-rw-r--r-- | readline/callback.c | 53 |
1 files changed, 34 insertions, 19 deletions
diff --git a/readline/callback.c b/readline/callback.c index 1172356..a8f4323 100644 --- a/readline/callback.c +++ b/readline/callback.c @@ -30,6 +30,13 @@ #if defined (READLINE_CALLBACKS) #include <sys/types.h> + +#ifdef HAVE_STDLIB_H +# include <stdlib.h> +#else +# include "ansi_stdlib.h" +#endif + #include <stdio.h> /* System-specific feature definitions and include files. */ @@ -52,7 +59,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 +85,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 +108,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; } } |