diff options
Diffstat (limited to 'unix/utils/dputs.c')
-rw-r--r-- | unix/utils/dputs.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/unix/utils/dputs.c b/unix/utils/dputs.c new file mode 100644 index 00000000..97a275e0 --- /dev/null +++ b/unix/utils/dputs.c @@ -0,0 +1,24 @@ +/* + * Implementation of dputs() for Unix. + * + * The debug messages are written to standard output, and also into a + * file called debug.log. + */ + +#include <unistd.h> + +#include "putty.h" + +static FILE *debug_fp = NULL; + +void dputs(const char *buf) +{ + if (!debug_fp) { + debug_fp = fopen("debug.log", "w"); + } + + if (write(1, buf, strlen(buf)) < 0) {} /* 'error check' to placate gcc */ + + fputs(buf, debug_fp); + fflush(debug_fp); +} |