diff options
author | Andrey Nazarov <skuller@skuller.net> | 2009-09-08 11:27:54 +0000 |
---|---|---|
committer | Andrey Nazarov <skuller@skuller.net> | 2009-09-08 11:27:54 +0000 |
commit | 2c654f00a26b3872d109c56a71099869c4c9ca71 (patch) | |
tree | d696f5b66d90e2d66378c00d47e914895e8ee2c7 | |
parent | c1df6019baf94cdec6b1404de69fafce12aa26a4 (diff) |
Don't attempt to set color or title of disabled console.
-rw-r--r-- | source/sys_unix.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/source/sys_unix.c b/source/sys_unix.c index 72d5406..6a3a9c3 100644 --- a/source/sys_unix.c +++ b/source/sys_unix.c @@ -158,6 +158,14 @@ void Sys_SetConsoleColor( color_index_t color ) { char buf[5]; size_t len; + if( !sys_console || !sys_console->integer ) { + return; + } + + if( !tty_enabled ) { + return; + } + buf[0] = '\033'; buf[1] = '['; switch( color ) { @@ -221,9 +229,14 @@ void Sys_SetConsoleTitle( const char *title ) { char buffer[MAX_STRING_CHARS]; size_t len; + if( !sys_console || !sys_console->integer ) { + return; + } + if( !tty_enabled ) { return; } + len = Q_snprintf( buffer, sizeof( buffer ), "\033]0;%s\007", title ); if( len < sizeof( buffer ) ) { write( 1, buffer, len ); |