1 /* UI_FILE - a generic STDIO like output stream.
2 Copyright (C) 1999-2019 Free Software Foundation, Inc.
4 This file is part of GDB.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 #include "tui/tui-file.h"
21 #include "tui/tui-io.h"
22 #include "tui/tui-command.h"
25 tui_file::tui_file (FILE *stream)
29 /* All TUI I/O sent to the *_filtered and *_unfiltered functions
30 eventually ends up here. The fputs_unfiltered_hook is primarily
31 used by GUIs to collect all output and send it to the GUI, instead
32 of the controlling terminal. Only output to gdb_stdout and
33 gdb_stderr are sent to the hook. Everything else is sent on to
34 fputs to allow file I/O to be handled appropriately. */
37 tui_file::puts (const char *linebuffer)
39 tui_puts (linebuffer);
40 /* gdb_stdout is buffered, and the caller must gdb_flush it at
41 appropriate times. Other streams are not so buffered. */
42 if (this != gdb_stdout)
43 tui_refresh_cmd_win ();
47 tui_file::write (const char *buf, long length_buf)
49 tui_write (buf, length_buf);
50 /* gdb_stdout is buffered, and the caller must gdb_flush it at
51 appropriate times. Other streams are not so buffered. */
52 if (this != gdb_stdout)
53 tui_refresh_cmd_win ();
59 /* gdb_stdout is buffered. Other files are always flushed on
61 if (this == gdb_stdout)
62 tui_refresh_cmd_win ();