mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 16:05:44 -07:00
Add debugging support.
[originally from svn r6018]
This commit is contained in:
29
gtk.c
29
gtk.c
@ -25,6 +25,35 @@
|
|||||||
#define USE_PANGO
|
#define USE_PANGO
|
||||||
#endif
|
#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.
|
* Error reporting functions used elsewhere.
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user