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 a21e20bc authored by rswindell's avatar rswindell

Added POSIX semaphore wrappers for Win32 event functions.

Changed EVENT output_event to sem_t output_sem for POSIX compatibility.
parent 41988b3a
......@@ -121,7 +121,7 @@ public:
RingBuf inbuf;
RingBuf outbuf;
HANDLE output_event;
sem_t output_sem;
HANDLE input_thread;
int outcom(uchar ch); // send character
......
......@@ -74,6 +74,10 @@ extern "C" {
#include <dirent.h> /* POSIX directory functions */
#endif
/***************/
/* OS-specific */
/***************/
#ifdef __unix__
#include <glob.h> /* POSIX.2 directory pattern matching function */
......@@ -115,9 +119,24 @@ extern "C" {
#endif
/***************/
/* OS-specific */
/***************/
#ifdef __unix__
#include <semaphores.h> /* POSIX 1003.1b semaphores */
#elif defined(_WIN32) /* semaphores */
typedef HANDLE sem_t;
#define sem_init(psem,ps,v) ResetEvent(*(psem))
#define sem_wait(psem) WaitForSingleObject(*(psem),INFINITE)
#define sem_post(psem) SetEvent(*(psem))
#define sem_destroy(psem) CloseHandle(*(psem))
#else
#warning "Need semaphore wrappers."
#endif
#if defined(_WIN32)
......
......@@ -198,7 +198,7 @@ void sbbs_t::telnet_gate(char* destaddr, ulong mode)
buf[rd++]='\n';
if(!gotline && mode&TG_ECHO) {
RingBufWrite(&outbuf,buf,rd);
SetEvent(output_event);
sem_post(&output_sem);
}
}
if((i=send(remote_socket,(char*)buf,rd,0))<0) {
......@@ -208,7 +208,7 @@ void sbbs_t::telnet_gate(char* destaddr, ulong mode)
}
rd=recv(remote_socket,(char*)buf,sizeof(buf),0);
if(rd<0) {
if(ERROR_VALUE==WSAEWOULDBLOCK) {
if(ERROR_VALUE==EWOULDBLOCK) {
if(mode&TG_NODESYNC) {
SYNC;
}
......@@ -223,7 +223,7 @@ void sbbs_t::telnet_gate(char* destaddr, ulong mode)
break;
}
RingBufWrite(&outbuf,buf,rd);
SetEvent(output_event);
sem_post(&output_sem);
}
console&=~CON_RAW_IN;
telnet_mode&=~TELNET_MODE_GATE;
......
......@@ -574,7 +574,7 @@ int sbbs_t::external(char* cmdline, long mode, char* startup_dir)
errorlog("TELNET_BUF OVERRUN");
}
RingBufWrite(&outbuf, bp, rd);
SetEvent(output_event);
sem_post(&output_sem);
}
} else { // Windows 9x
......@@ -630,7 +630,7 @@ int sbbs_t::external(char* cmdline, long mode, char* startup_dir)
else
bp=telnet_expand(buf, rd, telnet_buf, rd, telnet_flag);
RingBufWrite(&outbuf, bp, rd);
SetEvent(output_event);
sem_post(&output_sem);
}
}
if(!rd && !wr) {
......
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