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 232bf756 authored by deuce's avatar deuce

Fix nasty kernel bug... also, numerous other *nix fixes.

parent 1066ae7e
......@@ -63,8 +63,9 @@
#include "OpenDoor.h"
#ifdef ODPLAT_NIX
#include <signal.h>
#include <sys/ioctl.h>
#include <signal.h>
#include <termios.h>
#endif
#include "ODCore.h"
#include "ODGen.h"
......@@ -114,6 +115,12 @@
#include "windows.h"
#endif /* INCLUDE_WIN32_COM */
/* terminal variables */
#ifdef INCLUDE_STDIO_COM
struct termios tio_default; /* Initial term settings */
#endif
#if defined(_WIN32) && defined(INCLUDE_SOCKET_COM)
#include <winsock.h>
static WSADATA WSAData; /* WinSock data */
......@@ -168,7 +175,6 @@ typedef struct
#endif
} tPortInfo;
/* ========================================================================= */
/* Internal interrupt-driven serial I/O specific defintions & functions. */
/* ========================================================================= */
......@@ -316,7 +322,6 @@ static int nRXLowWaterMark; /* Low water mark for queue size. */
static BYTE btFlowControl; /* Flow control method. */
static BOOL bStopTrans; /* Flag set to stop transmitting. */
/* ----------------------------------------------------------------------------
* ODComSetVect() *** PRIVATE FUNCTION ***
*
......@@ -1197,6 +1202,9 @@ tODResult ODComOpen(tPortHandle hPort)
unsigned long ulQuotient, ulRemainder;
BYTE btTemp;
#endif /* INCLUDE_FOSSIL_COM || INCLUDE_UART_COM */
#ifdef INCLUDE_STDIO_COM
struct termios tio_raw;
#endif
tPortInfo *pPortInfo = ODHANDLE2PTR(hPort, tPortInfo);
int nPort;
......@@ -1760,6 +1768,13 @@ no_fossil:
if(pPortInfo->Method == kComMethodStdIO ||
pPortInfo->Method == kComMethodUnspecified)
{
if (isatty(fileno(stdin))) {
tcgetattr(fileno(stdin),&tio_default);
tio_raw = tio_default;
cfmakeraw(&tio_raw);
tcsetattr(fileno(stdin),TCSANOW,&tio_raw);
}
/* Set port state as open. */
pPortInfo->bIsOpen = TRUE;
......@@ -2767,7 +2782,7 @@ tODResult ODComGetByte(tPortHandle hPort, char *pbtNext, BOOL bWait)
tv.tv_sec=0;
tv.tv_usec=0;
select_ret = select(1, &socket_set, NULL, NULL, bWait ? NULL : &tv);
select_ret = select(2, &socket_set, NULL, NULL, bWait ? NULL : &tv);
if (select_ret == -1)
return (kODRCGeneralFailure);
if (select_ret == 0)
......
......@@ -2151,6 +2151,9 @@ malloc_error:
case kComMethodSocket:
od_control.od_com_method = COM_SOCKET; /* Why are using doubling up constants here? */
break;
case kComMethodStdIO:
od_control.od_com_method = COM_STDIO;
break;
default:
ODInitError("No method of accessing serial port, cannot continue.\n");
exit(od_control.od_errorlevel[1]);
......
......@@ -343,7 +343,6 @@ ODAPIDEF void ODCALL od_kernel(void)
ODKrnlHandleReceivedChar(ch, TRUE);
}
}
#endif
#ifdef ODPLAT_DOS
check_keyboard_again:
......@@ -648,6 +647,7 @@ statup:
ODScrnEnableCaret(TRUE);
}
}
#endif
ODKrnlTimeUpdate();
......
......@@ -806,7 +806,7 @@ ODAPIDEF void ODCALL od_sleep(tODMilliSec Milliseconds)
#ifdef ODPLAT_NIX
tv.tv_sec=Milliseconds/1000;
tv.tv_usec=(Milliseconds%1000)*1000;
select(0,NULL,NULL,NULL,tv);
select(0,NULL,NULL,NULL,&tv);
#endif
OD_API_EXIT();
......
......@@ -49,6 +49,10 @@
#include "ODTypes.h"
#include "ODGen.h"
#ifdef ODPLAT_NIX
#include <sys/time.h>
#endif
#ifdef ODPLAT_WIN32
#include "windows.h"
#endif /* ODPLAT_WIN32 */
......
......@@ -466,6 +466,7 @@ typedef struct
#define COM_WIN32 3
#define COM_DOOR32 4
#define COM_SOCKET 5
#define COM_STDIO 6
/* Flow control method (od_control.od_com_flow_control). */
#define COM_DEFAULT_FLOW 0
......
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