X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/blobdiff_plain/9a30e26b7801d63e4ccfe8d36169299c09b89dff..1d009ae71b849a95c86c3117d1b8f063fda8aae5:/unix/uxmisc.c diff --git a/unix/uxmisc.c b/unix/uxmisc.c index 39ef7edd..6889bcaf 100644 --- a/unix/uxmisc.c +++ b/unix/uxmisc.c @@ -3,6 +3,7 @@ */ #include +#include #include #include "putty.h" @@ -18,7 +19,7 @@ unsigned long getticks(void) return tv.tv_sec * 1000000 + tv.tv_usec; } -Filename filename_from_str(char *str) +Filename filename_from_str(const char *str) { Filename ret; strncpy(ret.path, str, sizeof(ret.path)); @@ -26,9 +27,9 @@ Filename filename_from_str(char *str) return ret; } -char *filename_to_str(Filename fn) +const char *filename_to_str(const Filename *fn) { - return fn.path; + return fn->path; } int filename_equal(Filename f1, Filename f2) @@ -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