Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit 068b6162 authored by deuce's avatar deuce

Use STDIN as the isatty() test

Don't use silly "static enum"
More ODTimer fixes
parent ab402ebc
......@@ -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
......
......@@ -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 */
......
......@@ -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);
......
......@@ -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);
......
......@@ -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));
......
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment