aboutsummaryrefslogtreecommitdiffstats
path: root/code/sys/sys_unix.c
diff options
context:
space:
mode:
authortjw <tjw@edf5b092-35ff-0310-97b2-ce42778d08ea>2007-09-15 02:22:58 +0000
committertjw <tjw@edf5b092-35ff-0310-97b2-ce42778d08ea>2007-09-15 02:22:58 +0000
commitf1692e7d753e2ae0b2222425ba51f185928c2988 (patch)
tree7d6358faf8684b7a6c761362b2083a7f5e160c5a /code/sys/sys_unix.c
parent5adc7bfafe2c2e214103e96b4e2a089871b83d8e (diff)
downloadioquake3-aero-f1692e7d753e2ae0b2222425ba51f185928c2988.tar.gz
ioquake3-aero-f1692e7d753e2ae0b2222425ba51f185928c2988.zip
* rewrite of the win32 dedicated console:
1) NET_Sleep() no longer watches for input, Sys_Sleep() added for waiting on input. 2) Added "CtrlHandler" for trapping Ctrl-C and other quit methods not handled by signals on windows 3) Added history support 4) Added tab completion 5) Removed automatic cursor/scroll adjustment (too problematic) 6) Enable mousewheel scrolling 7) Stop using the InputBuffer for editing This seems to work pretty well now, but I jumped the gun on a previous commit message by saying you can scroll now without locking up your server. That was only true up until the point that a server tried to print to the console, at that point it will hang until you release the scroll bar :( It may be possible to get around this by using a seperate thread for console output, but that's a whole new can of worms. git-svn-id: svn://svn.icculus.org/quake3/trunk@1182 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/sys/sys_unix.c')
-rw-r--r--code/sys/sys_unix.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/code/sys/sys_unix.c b/code/sys/sys_unix.c
index 8a8240b..adb3324 100644
--- a/code/sys/sys_unix.c
+++ b/code/sys/sys_unix.c
@@ -448,3 +448,31 @@ char *Sys_StripAppBundle( char *dir )
return cwd;
}
#endif // MACOS_X
+
+
+/*
+==================
+Sys_Sleep
+
+Block execution for msec or until input is recieved.
+==================
+*/
+void Sys_Sleep( int msec )
+{
+ fd_set fdset;
+
+ FD_ZERO(&fdset);
+ FD_SET(fileno(stdin), &fdset);
+ if( msec < 0 )
+ {
+ select((fileno(stdin) + 1), &fdset, NULL, NULL, NULL);
+ }
+ else
+ {
+ struct timeval timeout;
+
+ timeout.tv_sec = msec/1000;
+ timeout.tv_usec = (msec%1000)*1000;
+ select((fileno(stdin) + 1), &fdset, NULL, NULL, &timeout);
+ }
+}