Reorganisation of misc.c: Minefield has moved out to winmisc.c, and
[u/mdw/putty] / unix / uxmisc.c
index 8239158..6889bca 100644 (file)
@@ -3,6 +3,7 @@
  */
 
 #include <stdio.h>
+#include <unistd.h>
 #include <sys/time.h>
 
 #include "putty.h"
@@ -40,3 +41,19 @@ int filename_is_null(Filename fn)
 {
     return !*fn.path;
 }
+
+#ifdef DEBUG
+static FILE *debug_fp = NULL;
+
+void dputs(char *buf)
+{
+    if (!debug_fp) {
+       debug_fp = fopen("debug.log", "w");
+    }
+
+    write(1, buf, strlen(buf));
+
+    fputs(buf, debug_fp);
+    fflush(debug_fp);
+}
+#endif