aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortenox7 <as@tenoware.com>2017-12-17 15:27:39 -0800
committertenox7 <as@tenoware.com>2017-12-17 15:27:39 -0800
commitf82825f63d25a6e117d01324860202977a0ced3d (patch)
tree188a8b9f70cc139f61b45500167aabb0fa947dd7
parentfcd107e17ba9bb04fd7cdb9fc81fadf8fd32c5a6 (diff)
downloadwfm-f82825f63d25a6e117d01324860202977a0ced3d.tar.gz
added dbgprintf
-rw-r--r--wfm.c25
-rw-r--r--wfm.h1
2 files changed, 26 insertions, 0 deletions
diff --git a/wfm.c b/wfm.c
index 15d84a1..2d81659 100644
--- a/wfm.c
+++ b/wfm.c
@@ -348,6 +348,31 @@ char *buprintf(float v, int bold) {
}
//
+// Debug print to a file
+//
+void dbgprintf(char *msg, ...) {
+ va_list ap;
+ char buff[1024]={0};
+ FILE *f;
+
+ if(msg) {
+ va_start(ap, msg);
+ vsnprintf(buff, sizeof(buff), msg, ap);
+ va_end(ap);
+
+ f=fopen("/tmp/wfmdbg.log", "a");
+ if(!f)
+ error("Unable to open debug file");
+
+ fprintf(f, "DEBUG: %s\n", buff);
+
+ fclose(f);
+ }
+
+}
+
+
+//
// redirect browser
//
void redirect(char *location, ...) {
diff --git a/wfm.h b/wfm.h
index 9770df7..b9c8207 100644
--- a/wfm.h
+++ b/wfm.h
@@ -128,6 +128,7 @@ int timesort(const void *, const void *);
int rtimesort(const void *, const void *);
int asscandir(const char *, ASDIR **, int (*compar)(const void *, const void *));
+void dbgprintf(char *, ...);
void error(char *, ...);
void redirect(char *, ...);
char *buprintf(float, int);