diff --git a/src/odoors/ODCom.c b/src/odoors/ODCom.c index ef370cdb018a44a6a46f54237092ece9a602a165..f838c8dc764caf86c83e9b30116cd101acd3ee62 100644 --- a/src/odoors/ODCom.c +++ b/src/odoors/ODCom.c @@ -1784,11 +1784,11 @@ no_fossil: if(pPortInfo->Method == kComMethodStdIO || pPortInfo->Method == kComMethodUnspecified) { - if (isatty(STDOUT_FILENO)) { - tcgetattr(STDOUT_FILENO,&tio_default); + if (isatty(STDIN_FILENO)) { + tcgetattr(STDIN_FILENO,&tio_default); tio_raw = tio_default; cfmakeraw(&tio_raw); - tcsetattr(STDOUT_FILENO,TCSANOW,&tio_raw); + tcsetattr(STDIN_FILENO,TCSANOW,&tio_raw); setvbuf(stdout, NULL, _IONBF, 0); } @@ -1980,7 +1980,8 @@ tODResult ODComClose(tPortHandle hPort) #ifdef INCLUDE_STDIO_COM case kComMethodStdIO: - tcsetattr(STDOUT_FILENO,TCSANOW,&tio_default); + if(isatty(STDIN_FILENO)) + tcsetattr(STDIN_FILENO,TCSANOW,&tio_default); break; #endif diff --git a/src/odoors/ODGetIn.c b/src/odoors/ODGetIn.c index 2af72f808ff2dd7c72c045fbba5164f81c42b4f6..bc905510f278a95d89f68ebd8c547df0494b0c4f 100644 --- a/src/odoors/ODGetIn.c +++ b/src/odoors/ODGetIn.c @@ -210,6 +210,7 @@ ODAPIDEF BOOL ODCALL od_get_input(tODInputEvent *pInputEvent, /* Loop until we have a valid input event, or until we should exit for */ /* some other reason. */ bGotEvent = FALSE; + while(!bGotEvent) { /* If we aren't supposed to wait for input, then fail if there is */ @@ -371,7 +372,6 @@ ODAPIDEF BOOL ODCALL od_get_input(tODInputEvent *pInputEvent, ODTimerStart(&SequenceFailTimer, MAX_CHARACTER_LATENCY); } bTimerActive = TRUE; - /* We only get here if we don't fully match a control sequence. */ /* If this was the first character of a control sequence, we only */ diff --git a/src/odoors/ODInEx1.c b/src/odoors/ODInEx1.c index 3f22624cc3c0aa39beeb10dbbd25f57ca140af16..e6a556f84a552495d33bd62b368c0cae305cd07c 100644 --- a/src/odoors/ODInEx1.c +++ b/src/odoors/ODInEx1.c @@ -264,7 +264,7 @@ static char *apszDropFileNames[] = /* Array of door information (drop) file numbers * (corresponding to apszDropFileNames) */ -static enum { +enum { FOUND_EXITINFO_BBS, FOUND_DORINFO1_DEF, FOUND_CHAIN_TXT, @@ -2252,8 +2252,8 @@ malloc_error: od_control.baud=19200; gethostname(od_control.system_name,sizeof(od_control.system_name)); od_control.system_name[sizeof(od_control.system_name)-1]=0; - if (isatty(STDOUT_FILENO)) { - tcgetattr(STDOUT_FILENO,&term); + if (isatty(STDIN_FILENO)) { + tcgetattr(STDIN_FILENO,&term); od_control.baud=cfgetispeed(&term); if(!od_control.baud) od_control.baud=cfgetispeed(&term); diff --git a/src/odoors/ODInQue.c b/src/odoors/ODInQue.c index 46c49484bcda63467472a8d4f94e8024aa823228..a2c0a7d40cd753717495eba787b4095bf4cee499 100644 --- a/src/odoors/ODInQue.c +++ b/src/odoors/ODInQue.c @@ -304,10 +304,6 @@ tODResult ODInQueueGetNextEvent(tODInQueueHandle hInQueue, tODInputEvent *pEvent, tODMilliSec Timeout) { tInputQueueInfo *pInputQueueInfo = ODHANDLE2PTR(hInQueue, tInputQueueInfo); -#ifdef ODPLAT_NIX - struct timeval tv; - fd_set in; -#endif ASSERT(pInputQueueInfo != NULL); ASSERT(pEvent != NULL); diff --git a/src/odoors/ODKrnl.c b/src/odoors/ODKrnl.c index 8d12d8999f178871185df37c7936d0adee919475..5c4c5cf8c650ef28d240663869bdb9988d85ea3f 100644 --- a/src/odoors/ODKrnl.c +++ b/src/odoors/ODKrnl.c @@ -193,7 +193,7 @@ tODResult ODKrnlInitialize(void) sigemptyset(&(act.sa_mask)); sigaction(SIGHUP,&act,NULL); - /* Run kernel on SIGALRM (Every 1 second) */ + /* Run kernel on SIGALRM (Every .01 seconds) */ act.sa_handler=sig_run_kernel; act.sa_flags=SA_RESTART; sigemptyset(&(act.sa_mask)); diff --git a/src/odoors/ODPlat.c b/src/odoors/ODPlat.c index 0279e8dd2344e51b0bd102200249119a98569753..c0ed58e446b947f21c6efb8b98a60550c2e92fce 100644 --- a/src/odoors/ODPlat.c +++ b/src/odoors/ODPlat.c @@ -632,9 +632,6 @@ BOOL ODTimerElapsed(tODTimer *pTimer) */ void ODTimerWaitForElapse(tODTimer *pTimer) { -#ifdef ODPLAT_NIX - struct timeval tv; -#endif ASSERT(pTimer != NULL); #ifdef ODPLAT_DOS @@ -651,32 +648,12 @@ void ODTimerWaitForElapse(tODTimer *pTimer) od_sleep(0); } -#elif defined(ODPLAT_NIX) - /* This is timing sensitive and *MUST* wait regardless of 100% CPU or signals */ - od_sleep(ODTimerLeft(pTimer)); #else /* !ODPLAT_DOS */ - { - /* Under other platforms, timer resolution is high enough that we can */ - /* ask the OS to block this thread for the amount of time required */ - /* for the timer to elapse. */ - - tODMilliSec CurrentTime; - tODMilliSec TimerElapseTime = pTimer->Start + pTimer->Duration; + /* Under other platforms, timer resolution is high enough that we can */ + /* ask the OS to block this thread for the amount of time required */ + /* for the timer to elapse. */ - /* Determine the current time. */ -#ifdef ODPLAT_WIN32 - CurrentTime = GetCurrentTime(); -#endif /* ODPLAT_WIN32 */ - - if(TimerElapseTime <= CurrentTime) - { - /* Timer has already elapsed. */ - return; - } - - /* Sleep for the amount of time left until the timer should elapse. */ - od_sleep(TimerElapseTime - CurrentTime); - } + od_sleep(ODTimerLeft(pTimer)); #endif /* !ODPLAT_DOS */ } @@ -718,7 +695,7 @@ tODMilliSec ODTimerLeft(tODTimer *pTimer) } #elif defined(ODPLAT_NIX) gettimeofday(&tv,NULL); - left=(long long)tv.tv_sec*1000+tv.tv_usec/1000-pTimer->Start; + left=pTimer->Start+pTimer->Duration-(long long)tv.tv_sec*1000-tv.tv_usec/1000; if(left<0) left=0; return(left);