diff options
author | Jason Molenda <jmolenda@apple.com> | 1999-08-16 19:57:19 +0000 |
---|---|---|
committer | Jason Molenda <jmolenda@apple.com> | 1999-08-16 19:57:19 +0000 |
commit | 7be570e7ce77920e2e628a03bdfe2d295fc2568f (patch) | |
tree | a49512270bb021f1d5171b362dc973e28c97ca94 /gdb/event-top.c | |
parent | ed288bb597072176e84fc8279707a3f2f475779b (diff) | |
download | gdb-7be570e7ce77920e2e628a03bdfe2d295fc2568f.zip gdb-7be570e7ce77920e2e628a03bdfe2d295fc2568f.tar.gz gdb-7be570e7ce77920e2e628a03bdfe2d295fc2568f.tar.bz2 |
import gdb-1999-08-16 snapshot
Diffstat (limited to 'gdb/event-top.c')
-rw-r--r-- | gdb/event-top.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/gdb/event-top.c b/gdb/event-top.c index 639a71b..eb4f820 100644 --- a/gdb/event-top.c +++ b/gdb/event-top.c @@ -224,7 +224,7 @@ change_line_handler () off. This means that the 'set editing on/off' will have effect only on the interactive session. */ delete_file_handler (input_fd); - add_file_handler (input_fd, (file_handler_func *) call_readline, 0); + add_file_handler (input_fd, call_readline, 0); } /* Displays the prompt. The prompt that is displayed is the current @@ -774,6 +774,19 @@ gdb_readline2 () char *result; int input_index = 0; int result_size = 80; + static int done_once = 0; + + /* Unbuffer the input stream, so that, later on, the calls to fgetc + fetch only one char at the time from the stream. The fgetc's will + get up to the first newline, but there may be more chars in the + stream after '\n'. If we buffer the input and fgetc drains the + stream, getting stuff beyond the newline as well, a select, done + afterwards will not trigger. */ + if (!done_once && !ISATTY (instream)) + { + setbuf (instream, NULL); + done_once = 1; + } result = (char *) xmalloc (result_size); @@ -1100,7 +1113,7 @@ _initialize_event_loop () the target program (inferior), but that must be registered only when it actually exists (I.e. after we say 'run' or after we connect to a remote target. */ - add_file_handler (input_fd, (file_handler_func *) call_readline, 0); + add_file_handler (input_fd, call_readline, 0); /* Tell gdb that we will be using the readline library. This could be overwritten by a command in .gdbinit like 'set |