aboutsummaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c
index d69ed0a..8da1181 100644
--- a/src/util.c
+++ b/src/util.c
@@ -23,3 +23,20 @@ void remove_cruft(char *str)
char *junk;
strtok_r(str, "\r\n", &junk);
}
+
+/**
+ * WARNING: not totally signal-safe
+ * TODO: rewrite to avoid calling *printf()
+ */
+void sig_printf(const char *fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+
+ char buf[128];
+ int len = vsnprintf(buf, sizeof(buf), fmt, ap);
+
+ write(STDOUT_FILENO, buf, len);
+
+ va_end(ap);
+}