[quake3-commits] r1537 - trunk/code/sys

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sun May 3 16:05:20 EDT 2009


Author: ludwig
Date: 2009-05-03 16:05:16 -0400 (Sun, 03 May 2009)
New Revision: 1537

Modified:
   trunk/code/sys/con_tty.c
Log:
fix dedicated server stdin console (#4009)

Modified: trunk/code/sys/con_tty.c
===================================================================
--- trunk/code/sys/con_tty.c	2009-05-03 18:49:55 UTC (rev 1536)
+++ trunk/code/sys/con_tty.c	2009-05-03 20:05:16 UTC (rev 1537)
@@ -40,6 +40,7 @@
 =============================================================
 */
 
+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 @@
 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 @@
 	// 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,19 +412,12 @@
 
 		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
 		timeout.tv_sec = 0;
@@ -443,6 +440,7 @@
 
 		return text;
 	}
+	return NULL;
 }
 
 /*



More information about the quake3-commits mailing list