diff --git a/common/sys.h b/common/sys.h index e3b89f5..36800dc 100644 --- a/common/sys.h +++ b/common/sys.h @@ -71,3 +71,4 @@ void Sys_LowFPPrecision (void); void Sys_HighFPPrecision (void); void Sys_SetFPCW (void); +extern char trans_table[256]; diff --git a/common/sys_common.c b/common/sys_common.c index 2198ec4..6519b56 100644 --- a/common/sys_common.c +++ b/common/sys_common.c @@ -46,6 +46,27 @@ int nostdout = 0; cvar_t sys_nostdout = {"sys_nostdout","0"}; +char trans_table[256] = { +'\0', '#', '#', '#', '#', '.', '#', '#', '#', 9, 10, '#', ' ', 13, '.', +'.', '[', ']', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.', '<', +'=', '>', ' ', '!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', +'-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', +'<', '=', '>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', +'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', +'Z', '[', '\\', ']', '^', '_', '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', +'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', +'x', 'y', 'z', '{', '|', '}', '~', '<', '<', '=', '>', '#', '#', '.', '#', +'#', '#', '#', ' ', '#', ' ', '>', '.', '.', '[', ']', '0', '1', '2', '3', +'4', '5', '6', '7', '8', '9', '.', '<', '=', '>', ' ', '!', '"', '#', '$', +'%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', +'4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?', '@', 'A', 'B', +'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', +'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', '`', +'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', +'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', +'<', +}; + /* ================ Sys_Printf @@ -64,10 +85,13 @@ void Sys_Printf (char *fmt, ...) va_end(argptr); for (p = (unsigned char *)text; *p; p++) { + putc(trans_table[*p], stdout); + /* if ((*p > 128 || *p < 32) && *p != 10 && *p != 13 && *p != 9) printf("[%02x]", *p); else putc(*p, stdout); + */ } /* Make sure output is seen. */ diff --git a/common/sys_linux.c b/common/sys_linux.c index 27413f2..6db2564 100644 --- a/common/sys_linux.c +++ b/common/sys_linux.c @@ -155,15 +155,24 @@ void Sys_DebugLog(char *file, char *fmt, ...) { va_list argptr; static char data[1024]; - int fd; + FILE *stream; + unsigned char *p; + //int fd; va_start(argptr, fmt); vsprintf(data, fmt, argptr); va_end(argptr); // fd = open(file, O_WRONLY | O_BINARY | O_CREAT | O_APPEND, 0666); + stream = fopen(file, "a"); + for (p = (unsigned char *) data; *p; p++) { + putc(trans_table[*p], stream); + } + fclose(stream); + /* fd = open(file, O_WRONLY | O_CREAT | O_APPEND, 0666); write(fd, data, strlen(data)); close(fd); + */ } void Sys_EditFile(char *filename) { diff --git a/qw_common/console.c b/qw_common/console.c index 75c463c..0ef62b1 100644 --- a/qw_common/console.c +++ b/qw_common/console.c @@ -350,7 +350,6 @@ Handles cursor positioning, line wrapping, etc ================ */ #define MAXPRINTMSG 4096 -// FIXME: make a buffer size safe vsprintf? void Con_Printf (char *fmt, ...) { va_list argptr;