/* vi: set ts=2: +-------------------+ Christian Schlittchen | | Enno Rehling | Eressea PBEM host | Katja Zedel | (c) 1998 - 2003 | Henning Peters | | Ingo Wilken +-------------------+ Stefan Reich This program may not be used, modified or distributed without prior permission by the authors of Eressea. */ #include #include "log.h" #include "unicode.h" #include #include #include #include #include /* TODO: set from external function */ int log_flags = LOG_FLUSH|LOG_CPERROR|LOG_CPWARNING; #ifdef STDIO_CP static int stdio_codepage = STDIO_CP; #else static int stdio_codepage = 0; #endif static FILE * logfile; #define MAXLENGTH 4096 /* because I am lazy, CP437 output is limited to this many chars */ void log_flush(void) { fflush(logfile); } void log_puts(const char * str) { fflush(stdout); if (!logfile) logfile = stderr; fputs(str, logfile); } static int cp_convert(const char * format, char * buffer, size_t length, int codepage) { /* when console output on MSDOS, convert to codepage */ const char * input = format; char * pos = buffer; while (pos+1