From: havoc Date: Sun, 25 May 2003 16:17:37 +0000 (+0000) Subject: Sys_Print added to handle the output of text to the terminal (since this varies from... X-Git-Tag: xonotic-v0.1.0preview~6620 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=51d67386b0e66fcab982ee52fb0efd67b4699f98;p=xonotic%2Fdarkplaces.git Sys_Print added to handle the output of text to the terminal (since this varies from platform to platform and may depend on whether it is dedicated) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3032 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/sys.h b/sys.h index 91eeb2c0..6b38df3e 100644 --- a/sys.h +++ b/sys.h @@ -8,7 +8,7 @@ of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -56,7 +56,10 @@ void Sys_Error (const char *error, ...); // an error will cause the entire program to exit void Sys_Printf (const char *fmt, ...); -// send text to the console +// send text to the quake console (and possibly to terminal) + +void Sys_Print(const char *text); +// (may) output text to terminal which launched program void Sys_Quit (void); diff --git a/sys_linux.c b/sys_linux.c index 148f540b..e63d6a7a 100644 --- a/sys_linux.c +++ b/sys_linux.c @@ -84,7 +84,11 @@ void Sys_Error (const char *error, ...) Host_Shutdown (); exit (1); +} +void Sys_Print(const char *text) +{ + printf("%s", text); } double Sys_DoubleTime (void) diff --git a/sys_shared.c b/sys_shared.c index ddd831e2..3d666e92 100644 --- a/sys_shared.c +++ b/sys_shared.c @@ -48,9 +48,6 @@ static char qfont_table[256] = { 'x', 'y', 'z', '{', '|', '}', '~', '<' }; -//#ifdef WIN32 -//extern HANDLE houtput; -//#endif #define MAX_PRINT_MSG 16384 void Sys_Printf (const char *fmt, ...) @@ -64,9 +61,6 @@ void Sys_Printf (const char *fmt, ...) struct tm *local = NULL; unsigned char *p; -//#ifdef WIN32 -// DWORD dummy; -//#endif va_start (argptr, fmt); vsnprintf (start, sizeof(start), fmt, argptr); @@ -90,12 +84,7 @@ void Sys_Printf (const char *fmt, ...) final[MAX_PRINT_MSG - 1] = 0; for (p = (unsigned char *) final;*p; p++) *p = qfont_table[*p]; -//#ifdef WIN32 -// if (cls.state == ca_dedicated) -// WriteFile(houtput, final, strlen (final), &dummy, NULL); -//#else - printf("%s", final); -//#endif + Sys_Print(final); } diff --git a/sys_win.c b/sys_win.c index e23c8b3f..ae3f7cd4 100644 --- a/sys_win.c +++ b/sys_win.c @@ -132,6 +132,13 @@ void Sys_Quit (void) exit (0); } +void Sys_Print(const char *text) +{ + DWORD dummy; + extern HANDLE houtput; + if (cls.state == ca_dedicated) + WriteFile(houtput, text, strlen (text), &dummy, NULL); +} /* ================