aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorludwig <ludwig@edf5b092-35ff-0310-97b2-ce42778d08ea>2009-05-03 20:05:16 +0000
committerludwig <ludwig@edf5b092-35ff-0310-97b2-ce42778d08ea>2009-05-03 20:05:16 +0000
commit0203b6b8fde5fc1358fa159491e73d3e2f8f9e77 (patch)
tree6854426e281f7bd84a2c642a3865dff7b701a80f
parentbc2bb9f9a119e39ded19a0b6a6cf1a2d0cbd9fae (diff)
downloadioquake3-aero-0203b6b8fde5fc1358fa159491e73d3e2f8f9e77.tar.gz
ioquake3-aero-0203b6b8fde5fc1358fa159491e73d3e2f8f9e77.zip
fix dedicated server stdin console (#4009)
git-svn-id: svn://svn.icculus.org/quake3/trunk@1537 edf5b092-35ff-0310-97b2-ce42778d08ea
-rw-r--r--code/sys/con_tty.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/code/sys/con_tty.c b/code/sys/con_tty.c
index 28f1fd4..f65f5f7 100644
--- a/code/sys/con_tty.c
+++ b/code/sys/con_tty.c
@@ -40,6 +40,7 @@ called before and after a stdout or stderr output
=============================================================
*/
+static qboolean stdin_active;
// general flag to tell about tty console mode
static qboolean ttycon_on = qfalse;
static int ttycon_hide = 0;
@@ -254,6 +255,7 @@ Initialize the console input (tty mode if possible)
void CON_Init( void )
{
struct termios tc;
+ const char* term = getenv("TERM");
// If the process is backgrounded (running non interactively)
// then SIGTTIN or SIGTOU is emitted, if not caught, turns into a SIGSTP
@@ -263,10 +265,12 @@ void CON_Init( void )
// Make stdin reads non-blocking
fcntl( 0, F_SETFL, fcntl( 0, F_GETFL, 0 ) | O_NONBLOCK );
- if (isatty(STDIN_FILENO)!=1)
+ if (isatty(STDIN_FILENO) != 1
+ || (term && (!strcmp(term, "raw") || !strcmp(term, "dumb"))))
{
- Com_Printf( "stdin is not a tty, tty console mode disabled\n");
+ Com_Printf("tty console mode disabled\n");
ttycon_on = qfalse;
+ stdin_active = qtrue;
return;
}
@@ -408,18 +412,11 @@ char *CON_Input( void )
return NULL;
}
- else
+ else if (stdin_active)
{
int len;
fd_set fdset;
struct timeval timeout;
- static qboolean stdin_active;
-
- if (!com_dedicated || !com_dedicated->value)
- return NULL;
-
- if (!stdin_active)
- return NULL;
FD_ZERO(&fdset);
FD_SET(0, &fdset); // stdin
@@ -443,6 +440,7 @@ char *CON_Input( void )
return text;
}
+ return NULL;
}
/*