summaryrefslogtreecommitdiff
path: root/lib/debug.c
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2011-02-04 13:44:19 +0100
committerLinus Nordberg <linus@nordu.net>2011-02-04 13:44:19 +0100
commit17a43cf2205a933169e11bc9280431577a183e65 (patch)
tree8ed8351d48576fb94ebd4088ef0dea94c614b81c /lib/debug.c
parent094640561e271d0224613c207b646488f437d8ef (diff)
Add and use rs_debug() instead of fprintf to stderr.
Diffstat (limited to 'lib/debug.c')
-rw-r--r--lib/debug.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/debug.c b/lib/debug.c
index 801f2fb..485e29a 100644
--- a/lib/debug.c
+++ b/lib/debug.c
@@ -21,6 +21,7 @@ rs_dump_packet (const struct rs_packet *pkt)
p->code,
p->id,
p->data_len);
+ fflush (stderr);
}
void
@@ -28,3 +29,19 @@ rs_dump_attr (const struct rs_attr *attr)
{
vp_printlist (stderr, attr->vp);
}
+
+#if defined DEBUG
+int
+rs_debug (const char *fmt, ...)
+{
+ int n;
+ va_list args;
+
+ va_start (args, fmt);
+ n = vfprintf (stderr, fmt, args);
+ va_end (args);
+ fflush (stderr);
+
+ return n;
+}
+#endif