ref: 258293a82a76f716dbbcd6517f3b835162e9b257
parent: 7f7583d7f43a11cc06b58b214470a232ee05a73b
author: Jacob Nevins <jacobn@chiark.greenend.org.uk>
date: Sat Jun 25 13:24:03 EDT 2005
Add debugging support. [originally from svn r6018]
--- a/gtk.c
+++ b/gtk.c
@@ -25,6 +25,35 @@
#define USE_PANGO
#endif
+#ifdef DEBUGGING
+static FILE *debug_fp = NULL;
+
+void dputs(char *buf)
+{
+ if (!debug_fp) {
+ debug_fp = fopen("debug.log", "w");
+ }
+
+ fputs(buf, stderr);
+
+ if (debug_fp) {
+ fputs(buf, debug_fp);
+ fflush(debug_fp);
+ }
+}
+
+void debug_printf(char *fmt, ...)
+{
+ char buf[4096];
+ va_list ap;
+
+ va_start(ap, fmt);
+ vsprintf(buf, fmt, ap);
+ dputs(buf);
+ va_end(ap);
+}
+#endif
+
/* ----------------------------------------------------------------------
* Error reporting functions used elsewhere.
*/