return acc.buffer;
}
+/* ui_file utility function for converting a ``struct ui_file'' into a
+ std:string. */
+
+static void
+do_ui_file_as_string (void *context, const char *buffer, long length)
+{
+ std::string *str = (std::string *) context;
+
+ *str = std::string (buffer, length);
+}
+
+/* See ui-file.h. */
+
+std::string
+ui_file_as_string (struct ui_file *file)
+{
+ std::string str;
+
+ ui_file_put (file, do_ui_file_as_string, &str);
+ return str;
+}
+
static void
do_ui_file_obsavestring (void *context, const char *buffer, long length)
{
internal_error (__FILE__, __LINE__,
_("stdio_file_read: bad magic number"));
- /* For the benefit of Windows, call gdb_select before reading from
- the file. Wait until at least one byte of data is available.
- Control-C can interrupt gdb_select, but not read. */
+ /* Wait until at least one byte of data is available, or we get
+ interrupted with Control-C. */
{
fd_set readfds;
+
FD_ZERO (&readfds);
FD_SET (stdio->fd, &readfds);
- if (gdb_select (stdio->fd + 1, &readfds, NULL, NULL, NULL) == -1)
+ if (interruptible_select (stdio->fd + 1, &readfds, NULL, NULL, NULL) == -1)
return -1;
}
#endif
struct ui_file *
-stderr_fileopen (void)
+stderr_fileopen (FILE *stream)
{
- struct ui_file *ui_file = stdio_fileopen (stderr);
+ struct ui_file *ui_file = stdio_fileopen (stream);
#ifdef __MINGW32__
/* There is no real line-buffering on Windows, see