summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2013-11-09 08:55:57 +0100
committerSebastien Helleu <flashcode@flashtux.org>2013-11-09 08:55:57 +0100
commitcce23613a7c9afdb7addf522500b72ba52310be0 (patch)
tree5b3a6d06ad4e67dd93611a831113ad176814687c /src/gui
parent05e1e31072c12ff9a897ce1ba83bb53cb0518cd8 (diff)
downloadweechat-cce23613a7c9afdb7addf522500b72ba52310be0.zip
core: display lines waiting for buffer on exit (in case of early exit)
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/gui-chat.c15
-rw-r--r--src/gui/gui-chat.h2
2 files changed, 13 insertions, 4 deletions
diff --git a/src/gui/gui-chat.c b/src/gui/gui-chat.c
index e45396acd..2391c15f3 100644
--- a/src/gui/gui-chat.c
+++ b/src/gui/gui-chat.c
@@ -24,6 +24,7 @@
#endif
#include <stdlib.h>
+#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <ctype.h>
@@ -907,11 +908,16 @@ gui_chat_printf_y (struct t_gui_buffer *buffer, int y, const char *message, ...)
}
/*
- * Prints lines that are waiting for buffer.
+ * Displays lines that are waiting for buffer.
+ *
+ * If "f" is not NULL, the lines are written in this file (which is commonly
+ * stdout or stderr).
+ * If "f" is NULL, the lines are displayed in core buffer if the GUI is
+ * initialized (gui_init_ok == 1), otherwise on stdout.
*/
void
-gui_chat_print_lines_waiting_buffer ()
+gui_chat_print_lines_waiting_buffer (FILE *f)
{
char **lines;
int num_lines, i;
@@ -924,7 +930,10 @@ gui_chat_print_lines_waiting_buffer ()
{
for (i = 0; i < num_lines; i++)
{
- gui_chat_printf (NULL, "%s", lines[i]);
+ if (!f && gui_init_ok)
+ gui_chat_printf (NULL, "%s", lines[i]);
+ else
+ string_iconv_fprintf ((f) ? f : stdout, "%s\n", lines[i]);
}
string_free_split (lines);
}
diff --git a/src/gui/gui-chat.h b/src/gui/gui-chat.h
index 80ec2c622..9e6f65fc7 100644
--- a/src/gui/gui-chat.h
+++ b/src/gui/gui-chat.h
@@ -87,7 +87,7 @@ extern void gui_chat_printf_date_tags (struct t_gui_buffer *buffer,
const char *message, ...);
extern void gui_chat_printf_y (struct t_gui_buffer *buffer, int y,
const char *message, ...);
-extern void gui_chat_print_lines_waiting_buffer ();
+extern void gui_chat_print_lines_waiting_buffer (FILE *f);
extern int gui_chat_hsignal_quote_line_cb (void *data, const char *signal,
struct t_hashtable *hashtable);
extern void gui_chat_end ();