aboutsummaryrefslogtreecommitdiffhomepage
path: root/main.cpp
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2012-11-15 19:52:31 +0100
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2012-11-15 19:52:31 +0100
commit51e123544bff3ca0bdd8f6ba6a1c507b57071ca4 (patch)
tree0b3c68e7520dc310a49cee0b6dc1abd042143224 /main.cpp
parent5fe8298dec3736a2169719af9f0edf8592f3f7b6 (diff)
downloadsciteco-51e123544bff3ca0bdd8f6ba6a1c507b57071ca4.tar.gz
support stdio for curses interface
* ./sciteco commandline help works now * messages issued during batch-mode macro processing are written to stdout/stderr * output can be redirected
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/main.cpp b/main.cpp
index f551450..300d2f8 100644
--- a/main.cpp
+++ b/main.cpp
@@ -1,3 +1,4 @@
+#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -19,6 +20,29 @@
static gchar *mung_file = NULL;
+void
+Interface::stdio_vmsg(MessageType type, const gchar *fmt, va_list ap)
+{
+ gchar buf[255];
+
+ g_vsnprintf(buf, sizeof(buf), fmt, ap);
+
+ switch (type) {
+ case MSG_USER:
+ g_printf("%s\n", buf);
+ break;
+ case MSG_INFO:
+ g_printf("Info: %s\n", buf);
+ break;
+ case MSG_WARNING:
+ g_fprintf(stderr, "Warning: %s\n", buf);
+ break;
+ case MSG_ERROR:
+ g_fprintf(stderr, "Error: %s\n", buf);
+ break;
+ }
+}
+
static inline void
process_options(int &argc, char **&argv)
{