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

...
 
Commits (1)
......@@ -1019,7 +1019,7 @@ void ansi_suspend(void)
#endif
}
CIOLIBEXPORT void CIOLIBCALL ansi_ciolib_setdoorway(int enable)
CIOLIBEXPORT void ansi_ciolib_setdoorway(int enable)
{
if(cio_api.mode!=CIOLIB_MODE_ANSI)
return;
......
This diff is collapsed.
This diff is collapsed.
......@@ -1270,7 +1270,7 @@ clear2bol(struct cterminal * cterm)
free(buf);
}
void CIOLIBCALL
void
cterm_clearscreen(struct cterminal *cterm, char attr)
{
int getw;
......@@ -4389,7 +4389,7 @@ cterm_reset(struct cterminal *cterm)
}
}
struct cterminal* CIOLIBCALL cterm_init(int height, int width, int xpos, int ypos, int backlines, int backcols, struct vmem_cell *scrollback, int emulation)
struct cterminal* cterm_init(int height, int width, int xpos, int ypos, int backlines, int backcols, struct vmem_cell *scrollback, int emulation)
{
char *revision="$Revision: 1.314 $";
char *in;
......@@ -4461,7 +4461,7 @@ struct cterminal* CIOLIBCALL cterm_init(int height, int width, int xpos, int ypo
return cterm;
}
void CIOLIBCALL cterm_start(struct cterminal *cterm)
void cterm_start(struct cterminal *cterm)
{
struct text_info ti;
......@@ -4758,7 +4758,7 @@ static void parse_macro_intro(struct cterminal *cterm)
#define uctputs(c, p) ctputs(c, (char *)p)
#define ustrcat(b, s) strcat((char *)b, (const char *)s)
CIOLIBEXPORT char* CIOLIBCALL cterm_write(struct cterminal * cterm, const void *vbuf, int buflen, char *retbuf, size_t retsize, int *speed)
CIOLIBEXPORT char* cterm_write(struct cterminal * cterm, const void *vbuf, int buflen, char *retbuf, size_t retsize, int *speed)
{
const unsigned char *buf = (unsigned char *)vbuf;
unsigned char ch[2];
......@@ -5541,7 +5541,7 @@ CIOLIBEXPORT char* CIOLIBCALL cterm_write(struct cterminal * cterm, const void *
return(retbuf);
}
int CIOLIBCALL cterm_openlog(struct cterminal *cterm, char *logfile, int logtype)
int cterm_openlog(struct cterminal *cterm, char *logfile, int logtype)
{
if(!cterm->started)
cterm_start(cterm);
......@@ -5553,7 +5553,7 @@ int CIOLIBCALL cterm_openlog(struct cterminal *cterm, char *logfile, int logtype
return(1);
}
void CIOLIBCALL cterm_closelog(struct cterminal *cterm)
void cterm_closelog(struct cterminal *cterm)
{
if(!cterm->started)
cterm_start(cterm);
......@@ -5565,7 +5565,7 @@ void CIOLIBCALL cterm_closelog(struct cterminal *cterm)
}
FILE *dbg;
void CIOLIBCALL cterm_end(struct cterminal *cterm)
void cterm_end(struct cterminal *cterm)
{
int i;
......
......@@ -241,27 +241,27 @@ struct cterminal {
int (*ciolib_cputs) (struct cterminal *,char *);
int (*ciolib_setfont) (struct cterminal *,int font, int force, int font_num);
#else
void CIOLIBCALL (*ciolib_gotoxy) (int,int);
int CIOLIBCALL (*ciolib_wherex) (void);
int CIOLIBCALL (*ciolib_wherey) (void);
int CIOLIBCALL (*ciolib_gettext) (int,int,int,int,void *);
int CIOLIBCALL (*ciolib_vmem_gettext) (int,int,int,int,struct vmem_cell *);
void CIOLIBCALL (*ciolib_gettextinfo) (struct text_info *);
void CIOLIBCALL (*ciolib_textattr) (int);
void CIOLIBCALL (*ciolib_setcursortype) (int);
int CIOLIBCALL (*ciolib_movetext) (int,int,int,int,int,int);
void CIOLIBCALL (*ciolib_clreol) (void);
void CIOLIBCALL (*ciolib_clrscr) (void);
void CIOLIBCALL (*ciolib_setvideoflags) (int flags);
int CIOLIBCALL (*ciolib_getvideoflags) (void);
void CIOLIBCALL (*ciolib_setscaling) (int new_value);
int CIOLIBCALL (*ciolib_getscaling) (void);
int CIOLIBCALL (*ciolib_putch) (int);
int CIOLIBCALL (*ciolib_puttext) (int,int,int,int,void *);
int CIOLIBCALL (*ciolib_vmem_puttext) (int,int,int,int,struct vmem_cell *);
void CIOLIBCALL (*ciolib_window) (int,int,int,int);
int CIOLIBCALL (*ciolib_cputs) (char *);
int CIOLIBCALL (*ciolib_setfont) (int font, int force, int font_num);
void (*ciolib_gotoxy) (int,int);
int (*ciolib_wherex) (void);
int (*ciolib_wherey) (void);
int (*ciolib_gettext) (int,int,int,int,void *);
int (*ciolib_vmem_gettext) (int,int,int,int,struct vmem_cell *);
void (*ciolib_gettextinfo) (struct text_info *);
void (*ciolib_textattr) (int);
void (*ciolib_setcursortype) (int);
int (*ciolib_movetext) (int,int,int,int,int,int);
void (*ciolib_clreol) (void);
void (*ciolib_clrscr) (void);
void (*ciolib_setvideoflags) (int flags);
int (*ciolib_getvideoflags) (void);
void (*ciolib_setscaling) (int new_value);
int (*ciolib_getscaling) (void);
int (*ciolib_putch) (int);
int (*ciolib_puttext) (int,int,int,int,void *);
int (*ciolib_vmem_puttext) (int,int,int,int,struct vmem_cell *);
void (*ciolib_window) (int,int,int,int);
int (*ciolib_cputs) (char *);
int (*ciolib_setfont) (int font, int force, int font_num);
#endif
int *_wscroll;
int *puttext_can_move;
......@@ -273,13 +273,13 @@ struct cterminal {
extern "C" {
#endif
CIOLIBEXPORT struct cterminal* CIOLIBCALL cterm_init(int height, int width, int xpos, int ypos, int backlines, int backcols, struct vmem_cell *scrollback, int emulation);
CIOLIBEXPORT char* CIOLIBCALL cterm_write(struct cterminal *cterm, const void *buf, int buflen, char *retbuf, size_t retsize, int *speed);
CIOLIBEXPORT int CIOLIBCALL cterm_openlog(struct cterminal *cterm, char *logfile, int logtype);
CIOLIBEXPORT void CIOLIBCALL cterm_closelog(struct cterminal *cterm);
CIOLIBEXPORT void CIOLIBCALL cterm_end(struct cterminal *cterm);
CIOLIBEXPORT void CIOLIBCALL cterm_clearscreen(struct cterminal *cterm, char attr);
CIOLIBEXPORT void CIOLIBCALL cterm_start(struct cterminal *cterm);
CIOLIBEXPORT struct cterminal* cterm_init(int height, int width, int xpos, int ypos, int backlines, int backcols, struct vmem_cell *scrollback, int emulation);
CIOLIBEXPORT char* cterm_write(struct cterminal *cterm, const void *buf, int buflen, char *retbuf, size_t retsize, int *speed);
CIOLIBEXPORT int cterm_openlog(struct cterminal *cterm, char *logfile, int logtype);
CIOLIBEXPORT void cterm_closelog(struct cterminal *cterm);
CIOLIBEXPORT void cterm_end(struct cterminal *cterm);
CIOLIBEXPORT void cterm_clearscreen(struct cterminal *cterm, char attr);
CIOLIBEXPORT void cterm_start(struct cterminal *cterm);
void cterm_gotoxy(struct cterminal *cterm, int x, int y);
void setwindow(struct cterminal *cterm);
void cterm_clreol(struct cterminal *cterm);
......
......@@ -110,7 +110,7 @@ int ciolib_mouse_initialized=0;
static int ungot=0;
pthread_mutex_t unget_mutex;
void CIOLIBCALL init_mouse(void)
void init_mouse(void)
{
memset(&state,0,sizeof(state));
state.click_timeout=0;
......@@ -121,7 +121,7 @@ void CIOLIBCALL init_mouse(void)
ciolib_mouse_initialized=1;
}
void CIOLIBCALL mousestate(int *x, int *y, uint8_t *buttons)
void mousestate(int *x, int *y, uint8_t *buttons)
{
if (!ciolib_mouse_initialized) {
if (x)
......@@ -139,7 +139,7 @@ void CIOLIBCALL mousestate(int *x, int *y, uint8_t *buttons)
return;
}
void CIOLIBCALL mousestate_res(int *x, int *y, uint8_t *buttons)
void mousestate_res(int *x, int *y, uint8_t *buttons)
{
if (!ciolib_mouse_initialized) {
if (x)
......@@ -157,37 +157,37 @@ void CIOLIBCALL mousestate_res(int *x, int *y, uint8_t *buttons)
return;
}
uint64_t CIOLIBCALL ciomouse_setevents(uint64_t events)
uint64_t ciomouse_setevents(uint64_t events)
{
mouse_events=events;
return mouse_events;
}
uint64_t CIOLIBCALL ciomouse_addevents(uint64_t events)
uint64_t ciomouse_addevents(uint64_t events)
{
mouse_events |= events;
return mouse_events;
}
uint64_t CIOLIBCALL ciomouse_delevents(uint64_t events)
uint64_t ciomouse_delevents(uint64_t events)
{
mouse_events &= ~events;
return mouse_events;
}
uint64_t CIOLIBCALL ciomouse_addevent(uint64_t event)
uint64_t ciomouse_addevent(uint64_t event)
{
mouse_events |= (UINT64_C(1)<<event);
return mouse_events;
}
uint64_t CIOLIBCALL ciomouse_delevent(uint64_t event)
uint64_t ciomouse_delevent(uint64_t event)
{
mouse_events &= ~(UINT64_C(1)<<event);
return mouse_events;
}
void CIOLIBCALL ciomouse_gotevent(int event, int x, int y, int x_res, int y_res)
void ciomouse_gotevent(int event, int x, int y, int x_res, int y_res)
{
struct in_mouse_event *ime;
......@@ -207,7 +207,7 @@ void CIOLIBCALL ciomouse_gotevent(int event, int x, int y, int x_res, int y_res)
}
}
void CIOLIBCALL add_outevent(int event, int x, int y, int xres, int yres)
void add_outevent(int event, int x, int y, int xres, int yres)
{
struct out_mouse_event *ome;
int but;
......@@ -236,7 +236,7 @@ void CIOLIBCALL add_outevent(int event, int x, int y, int xres, int yres)
}
}
int CIOLIBCALL more_multies(int button, int clicks)
int more_multies(int button, int clicks)
{
switch(clicks) {
case 0:
......@@ -516,7 +516,7 @@ void ciolib_mouse_thread(void *data)
}
}
int CIOLIBCALL mouse_trywait(void)
int mouse_trywait(void)
{
int result;
......@@ -534,7 +534,7 @@ int CIOLIBCALL mouse_trywait(void)
}
}
int CIOLIBCALL mouse_wait(void)
int mouse_wait(void)
{
int result;
......@@ -552,14 +552,14 @@ int CIOLIBCALL mouse_wait(void)
}
}
int CIOLIBCALL mouse_pending(void)
int mouse_pending(void)
{
while(!ciolib_mouse_initialized)
SLEEP(1);
return(listCountNodes(&state.output));
}
int CIOLIBCALL ciolib_getmouse(struct mouse_event *mevent)
int ciolib_getmouse(struct mouse_event *mevent)
{
int retval=0;
......@@ -594,7 +594,7 @@ int CIOLIBCALL ciolib_getmouse(struct mouse_event *mevent)
return(retval);
}
int CIOLIBCALL ciolib_ungetmouse(struct mouse_event *mevent)
int ciolib_ungetmouse(struct mouse_event *mevent)
{
struct mouse_event *me;
......
......@@ -42,25 +42,19 @@
#else
#define B64EXPORT __declspec(dllexport)
#endif
#if defined(__BORLANDC__)
#define B64CALL
#else
#define B64CALL
#endif
#else /* !_WIN32 */
#define B64EXPORT
#define B64CALL
#endif
#ifdef __cplusplus
extern "C" {
#endif
B64EXPORT int B64CALL b64_encode(char *target, size_t tlen, const char *source, size_t slen);
B64EXPORT int B64CALL b64_decode(char *target, size_t tlen, const char *source, size_t slen);
B64EXPORT int b64_encode(char *target, size_t tlen, const char *source, size_t slen);
B64EXPORT int b64_decode(char *target, size_t tlen, const char *source, size_t slen);
#ifdef __cplusplus
}
#endif
#endif /* Don't add anything after this line */
\ No newline at end of file
#endif /* Don't add anything after this line */
......@@ -558,7 +558,7 @@ static short int lzh_decode_position(lzh_t* lzh, uint8_t *inbuf, int32_t *incnt,
/* Encoding/Compressing */
/* Returns length of outbuf */
int32_t LZHCALL lzh_encode(uint8_t *inbuf, int32_t inlen, uint8_t *outbuf)
int32_t lzh_encode(uint8_t *inbuf, int32_t inlen, uint8_t *outbuf)
{
short int i, c, len, r, s, last_match_length;
int32_t incnt,outlen; /* textsize=0; */
......@@ -688,7 +688,7 @@ int32_t LZHCALL lzh_encode(uint8_t *inbuf, int32_t inlen, uint8_t *outbuf)
/* Decoding/Uncompressing */
/* Returns length of outbuf */
int32_t LZHCALL lzh_decode(uint8_t *inbuf, int32_t inlen, uint8_t *outbuf)
int32_t lzh_decode(uint8_t *inbuf, int32_t inlen, uint8_t *outbuf)
{
short int i, j, k, r, c;
uint32_t count;
......
/* lzh.h */
/* Synchronet LZH compression library */
/* $Id: lzh.h,v 1.13 2019/03/22 21:29:12 rswindell Exp $ */
/****************************************************************************
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
......@@ -16,18 +12,6 @@
* Anonymous FTP access to the most recent released source is available at *
* ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
* *
* Anonymous CVS access to the development source and modification history *
* is available at cvs.synchro.net:/cvsroot/sbbs, example: *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login *
* (just hit return, no password is necessary) *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src *
* *
* For Synchronet coding style and modification guidelines, see *
* http://www.synchro.net/source.html *
* *
* You are encouraged to submit any modifications (preferably in Unix diff *
* format) via e-mail to mods@synchro.net *
* *
* Note: If this box doesn't appear square, then you need to fix your tabs. *
****************************************************************************/
......@@ -39,11 +23,6 @@
#endif
#ifdef _WIN32
#ifdef __BORLANDC__
#define LZHCALL
#else
#define LZHCALL
#endif
#ifdef LZHDLL /* LZH functions in DLL */
#ifdef LZH_EXPORTS
#define LZHEXPORT __declspec( dllexport )
......@@ -54,7 +33,6 @@
#define LZHEXPORT
#endif
#else /* !_WIN32 */
#define LZHCALL
#define LZHEXPORT
#endif
......@@ -63,8 +41,8 @@
#ifdef __cplusplus
extern "C" {
#endif
LZHEXPORT int32_t LZHCALL lzh_encode(uint8_t *inbuf, int32_t inlen, uint8_t *outbuf);
LZHEXPORT int32_t LZHCALL lzh_decode(uint8_t *inbuf, int32_t inlen, uint8_t *outbuf);
LZHEXPORT int32_t lzh_encode(uint8_t *inbuf, int32_t inlen, uint8_t *outbuf);
LZHEXPORT int32_t lzh_decode(uint8_t *inbuf, int32_t inlen, uint8_t *outbuf);
#ifdef __cplusplus
}
#endif
......
......@@ -139,9 +139,6 @@ static ini_bitdesc_t ftp_options[] = {
#ifdef DLLEXPORT
#undef DLLEXPORT
#endif
#ifdef DLLCALL
#undef DLLCALL
#endif
#ifdef _WIN32
#ifdef FTPSRVR_EXPORTS
......@@ -149,23 +146,17 @@ static ini_bitdesc_t ftp_options[] = {
#else
#define DLLEXPORT __declspec(dllimport)
#endif
#ifdef __BORLANDC__
#define DLLCALL
#else
#define DLLCALL
#endif
#else
#define DLLEXPORT
#define DLLCALL
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* arg is pointer to static ftp_startup_t */
DLLEXPORT void DLLCALL ftp_server(void* arg);
DLLEXPORT void DLLCALL ftp_terminate(void);
DLLEXPORT const char* DLLCALL ftp_ver(void);
DLLEXPORT void ftp_server(void* arg);
DLLEXPORT void ftp_terminate(void);
DLLEXPORT const char* ftp_ver(void);
#ifdef __cplusplus
}
#endif
......
......@@ -7,6 +7,6 @@ struct js_cryptcert_private_data {
extern JSClass js_cryptcert_class;
JSObject* DLLCALL js_CreateCryptCertObject(JSContext* cx, CRYPT_CERTIFICATE cert);
JSObject* js_CreateCryptCertObject(JSContext* cx, CRYPT_CERTIFICATE cert);
#endif
......@@ -7,6 +7,6 @@ struct js_cryptcon_private_data {
extern JSClass js_cryptcon_class;
JSObject* DLLCALL js_CreateCryptconObject(JSContext* cx, CRYPT_CONTEXT ctx);
JSObject* js_CreateCryptconObject(JSContext* cx, CRYPT_CONTEXT ctx);
#endif
......@@ -77,7 +77,7 @@
/****************************************************************************/
/* Returns 0 on success, non-zero on failure */
/****************************************************************************/
int RINGBUFCALL RingBufInit( RingBuf* rb, DWORD size
int RingBufInit( RingBuf* rb, DWORD size
#ifndef RINGBUF_USE_STD_RTL
,void *(os_malloc)(size_t)
,void (os_free)(void *)
......@@ -108,7 +108,7 @@ int RINGBUFCALL RingBufInit( RingBuf* rb, DWORD size
return(0);
}
void RINGBUFCALL RingBufDispose( RingBuf* rb)
void RingBufDispose( RingBuf* rb)
{
if(rb->pStart!=NULL)
os_free(rb->pStart);
......@@ -137,7 +137,7 @@ void RINGBUFCALL RingBufDispose( RingBuf* rb)
#define RINGBUF_FILL_LEVEL(rb) (rb->pHead >= rb->pTail ? (rb->pHead - rb->pTail) \
: (rb->size - (rb->pTail - (rb->pHead + 1))))
DWORD RINGBUFCALL RingBufFull( RingBuf* rb )
DWORD RingBufFull( RingBuf* rb )
{
DWORD retval;
......@@ -154,7 +154,7 @@ DWORD RINGBUFCALL RingBufFull( RingBuf* rb )
return(retval);
}
DWORD RINGBUFCALL RingBufFree( RingBuf* rb )
DWORD RingBufFree( RingBuf* rb )
{
DWORD retval;
......@@ -163,7 +163,7 @@ DWORD RINGBUFCALL RingBufFree( RingBuf* rb )
return(retval);
}
DWORD RINGBUFCALL RingBufWrite( RingBuf* rb, const BYTE* src, DWORD cnt )
DWORD RingBufWrite( RingBuf* rb, const BYTE* src, DWORD cnt )
{
DWORD max, first, remain, fill_level;
......@@ -224,7 +224,7 @@ DWORD RINGBUFCALL RingBufWrite( RingBuf* rb, const BYTE* src, DWORD cnt )
}
/* Pass NULL dst to just foward pointer (after Peek) */
DWORD RINGBUFCALL RingBufRead( RingBuf* rb, BYTE* dst, DWORD cnt )
DWORD RingBufRead( RingBuf* rb, BYTE* dst, DWORD cnt )
{
DWORD max, first, remain, len;
......@@ -284,7 +284,7 @@ DWORD RINGBUFCALL RingBufRead( RingBuf* rb, BYTE* dst, DWORD cnt )
return(cnt);
}
DWORD RINGBUFCALL RingBufPeek( RingBuf* rb, BYTE* dst, DWORD cnt)
DWORD RingBufPeek( RingBuf* rb, BYTE* dst, DWORD cnt)
{
DWORD max, first, remain, len;
......@@ -325,7 +325,7 @@ DWORD RINGBUFCALL RingBufPeek( RingBuf* rb, BYTE* dst, DWORD cnt)
}
/* Reset head and tail pointers */
void RINGBUFCALL RingBufReInit(RingBuf* rb)
void RingBufReInit(RingBuf* rb)
{
#ifdef RINGBUF_MUTEX
pthread_mutex_lock(&rb->mutex);
......
......@@ -151,9 +151,6 @@ static ini_bitdesc_t web_options[] = {
#ifdef DLLEXPORT
#undef DLLEXPORT
#endif
#ifdef DLLCALL
#undef DLLCALL
#endif
#ifdef _WIN32
#ifdef WEBSRVR_EXPORTS
......@@ -161,22 +158,16 @@ static ini_bitdesc_t web_options[] = {
#else
#define DLLEXPORT __declspec(dllimport)
#endif
#ifdef __BORLANDC__
#define DLLCALL
#else
#define DLLCALL
#endif
#else
#define DLLEXPORT
#define DLLCALL
#endif
#ifdef __cplusplus
extern "C" {
#endif
DLLEXPORT void DLLCALL web_server(void* arg);
DLLEXPORT void DLLCALL web_terminate(void);
DLLEXPORT const char* DLLCALL web_ver(void);
DLLEXPORT void web_server(void* arg);
DLLEXPORT void web_terminate(void);
DLLEXPORT const char* web_ver(void);
#ifdef __cplusplus
}
#endif
......
......@@ -52,11 +52,6 @@
#endif
#ifdef _WIN32
#ifdef __BORLANDC__
#define UIFCCALL
#else
#define UIFCCALL
#endif
#if defined(UIFC_IMPORTS) || defined(UIFC_EXPORTS)
#if defined(UIFC_IMPORTS)
#define UIFCEXPORT __declspec( dllimport )
......@@ -70,7 +65,6 @@
#define UIFCEXPORTVAR extern
#endif
#else
#define UIFCCALL
#define UIFCEXPORT
#define UIFCEXPORTVAR extern
#endif
......@@ -530,8 +524,8 @@ UIFCEXPORTVAR char* uifcYesNoOpts[];
/* Returns 0 on success, non-zero on failure. */
/****************************************************************************/
int uifcini(uifcapi_t*); /* Original implementation based on conio */
UIFCEXPORT int UIFCCALL uifcinix(uifcapi_t*); /* Standard I/O implementation */
UIFCEXPORT int UIFCCALL uifcini32(uifcapi_t*); /* modern implementation */
UIFCEXPORT int uifcinix(uifcapi_t*); /* Standard I/O implementation */
UIFCEXPORT int uifcini32(uifcapi_t*); /* modern implementation */
/****************************************************************************/
#ifdef __cplusplus
......
......@@ -207,7 +207,7 @@ int inkey(void)
return(c);
}
int UIFCCALL uifcini32(uifcapi_t* uifcapi)
int uifcini32(uifcapi_t* uifcapi)
{
unsigned i;
struct text_info txtinfo;
......
......@@ -86,7 +86,7 @@ static int uprintf(int x, int y, unsigned attr, char *fmat, ...)
/* Initialization function, see uifc.h for details. */
/* Returns 0 on success. */
/****************************************************************************/
int UIFCCALL uifcinix(uifcapi_t* uifcapi)
int uifcinix(uifcapi_t* uifcapi)
{
static char* yesNoOpts[] = {"Yes", "No", NULL};
......
/* datewrap.h */
/* Wrappers for non-standard date and time functions */
/* $Id: datewrap.h,v 1.28 2019/07/24 04:08:25 rswindell Exp $ */
/****************************************************************************
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
......@@ -17,21 +13,9 @@
* See the GNU Lesser General Public License for more details: lgpl.txt or *
* http://www.fsf.org/copyleft/lesser.html *
* *
* Anonymous FTP access to the most recent released source is available at *
* ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
* *
* Anonymous CVS access to the development source and modification history *
* is available at cvs.synchro.net:/cvsroot/sbbs, example: *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login *
* (just hit return, no password is necessary) *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src *
* *
* For Synchronet coding style and modification guidelines, see *
* http://www.synchro.net/source.html *
* *
* You are encouraged to submit any modifications (preferably in Unix diff *
* format) via e-mail to mods@synchro.net *
* *
* Note: If this box doesn't appear square, then you need to fix your tabs. *
****************************************************************************/
......@@ -45,16 +29,16 @@ extern "C" {
#endif
/* Return difference (in seconds) in time() result from standard (0 on success) */
DLLEXPORT time_t DLLCALL checktime(void);
DLLEXPORT time_t checktime(void);
/* Implementation of mktime()/timegm() that handles common tm element conversions for you */
DLLEXPORT time_t DLLCALL sane_mktime(struct tm*);
DLLEXPORT time_t DLLCALL sane_timegm(struct tm*);
DLLEXPORT time_t sane_mktime(struct tm*);
DLLEXPORT time_t sane_timegm(struct tm*);
/* Legacy (32-bit time_t) versions of time() and mktime() */
DLLEXPORT time32_t DLLCALL time32(time32_t* tp);
DLLEXPORT time32_t DLLCALL mktime32(struct tm*);
DLLEXPORT struct tm* DLLCALL localtime32(const time32_t* t, struct tm* tm);
DLLEXPORT time32_t time32(time32_t* tp);
DLLEXPORT time32_t mktime32(struct tm*);
DLLEXPORT struct tm* localtime32(const time32_t* t, struct tm* tm);
/*********************************************************************************/
/* Win32 implementations of recursive (thread-safe) std C time functions on Unix */
......@@ -64,10 +48,10 @@ DLLEXPORT struct tm* DLLCALL localtime32(const time32_t* t, struct tm* tm);
#include <time.h> /* time_t, etc. */
DLLEXPORT struct tm* DLLCALL gmtime_r(const time_t* t, struct tm* tm);
DLLEXPORT struct tm* DLLCALL localtime_r(const time_t* t, struct tm* tm);
DLLEXPORT char* DLLCALL ctime_r(const time_t *t, char *buf);
DLLEXPORT char* DLLCALL asctime_r(const struct tm *tm, char *buf);
DLLEXPORT struct tm* gmtime_r(const time_t* t, struct tm* tm);
DLLEXPORT struct tm* localtime_r(const time_t* t, struct tm* tm);
DLLEXPORT char* ctime_r(const time_t *t, char *buf);
DLLEXPORT char* asctime_r(const struct tm *tm, char *buf);
#endif
......@@ -103,8 +87,8 @@ struct time {
};
#define getdate(x) xp_getdate(x)
DLLEXPORT void DLLCALL xp_getdate(struct date*);
DLLEXPORT void DLLCALL gettime(struct time*);
DLLEXPORT void xp_getdate(struct date*);
DLLEXPORT void gettime(struct time*);
#endif /* !Borland */
......
......@@ -33,7 +33,7 @@
#endif
#include "gen_defs.h" /* ulong */
#include "wrapdll.h" /* DLLEXPORT and DLLCALL */
#include "wrapdll.h" /* DLLEXPORT */
#if defined(__cplusplus)
extern "C" {
......@@ -105,8 +105,8 @@ extern "C" {
#define GLOB_NOMATCH 3 /* No matches found. */
#define GLOB_NOSYS 4 /* Not implemented. */
DLLEXPORT int DLLCALL glob(const char *pattern, int flags, void* unused, glob_t*);
DLLEXPORT void DLLCALL globfree(glob_t*);
DLLEXPORT int glob(const char *pattern, int flags, void* unused, glob_t*);
DLLEXPORT void globfree(glob_t*);
#endif
......@@ -140,10 +140,10 @@ extern "C" {
/* Prototypes.
*/
DLLEXPORT DIR* DLLCALL opendir (const char *__dirname);
DLLEXPORT struct dirent* DLLCALL readdir (DIR *__dir);
DLLEXPORT int DLLCALL closedir (DIR *__dir);
DLLEXPORT void DLLCALL rewinddir(DIR *__dir);
DLLEXPORT DIR* opendir (const char *__dirname);
DLLEXPORT struct dirent* readdir (DIR *__dir);
DLLEXPORT int closedir (DIR *__dir);
DLLEXPORT void rewinddir(DIR *__dir);
#elif !defined(__WATCOMC__)
#include <dirent.h> /* POSIX directory functions */
#endif
......@@ -200,37 +200,37 @@ extern "C" {
#endif
/* General file system wrappers for all platforms and compilers */
DLLEXPORT BOOL DLLCALL fexist(const char *filespec);
DLLEXPORT BOOL DLLCALL fexistcase(char *filespec); /* fixes upr/lwr case fname */
DLLEXPORT off_t DLLCALL flength(const char *filename);
DLLEXPORT time_t DLLCALL fdate(const char *filename);
DLLEXPORT time_t DLLCALL fcdate(const char* filename);
DLLEXPORT int DLLCALL setfdate(const char* filename, time_t t);
DLLEXPORT BOOL DLLCALL isdir(const char *filename);
DLLEXPORT BOOL DLLCALL isabspath(const char *filename);
DLLEXPORT BOOL DLLCALL isfullpath(const char* filename);
DLLEXPORT char* DLLCALL getfname(const char* path);
DLLEXPORT char* DLLCALL getfext(const char* path);
DLLEXPORT int DLLCALL getfattr(const char* filename);
DLLEXPORT int DLLCALL getfmode(const char* filename);
DLLEXPORT ulong DLLCALL getfilecount(const char *path);
DLLEXPORT char* DLLCALL getdirname(const char* path);
DLLEXPORT long DLLCALL getdirsize(const char* path, BOOL include_subdirs, BOOL subdir_only);
DLLEXPORT ulong DLLCALL getdisksize(const char* path, ulong unit);
DLLEXPORT ulong DLLCALL getfreediskspace(const char* path, ulong unit);
DLLEXPORT uint64_t DLLCALL getfilesizetotal(const char *path);
DLLEXPORT long DLLCALL delfiles(const char *inpath, const char *spec, size_t keep);
DLLEXPORT char* DLLCALL backslash(char* path);
DLLEXPORT BOOL DLLCALL wildmatch(const char *fname, const char *spec, BOOL path, BOOL case_sensitive);
DLLEXPORT BOOL DLLCALL wildmatchi(const char *fname, const char *spec, BOOL path);
DLLEXPORT int DLLCALL mkpath(const char* path);
DLLEXPORT BOOL fexist(const char *filespec);
DLLEXPORT BOOL fexistcase(char *filespec); /* fixes upr/lwr case fname */
DLLEXPORT off_t flength(const char *filename);
DLLEXPORT time_t fdate(const char *filename);
DLLEXPORT time_t fcdate(const char* filename);
DLLEXPORT int setfdate(const char* filename, time_t t);
DLLEXPORT BOOL isdir(const char *filename);
DLLEXPORT BOOL isabspath(const char *filename);
DLLEXPORT BOOL isfullpath(const char* filename);
DLLEXPORT char* getfname(const char* path);
DLLEXPORT char* getfext(const char* path);
DLLEXPORT int getfattr(const char* filename);
DLLEXPORT int getfmode(const char* filename);
DLLEXPORT ulong getfilecount(const char *path);
DLLEXPORT char* getdirname(const char* path);
DLLEXPORT long getdirsize(const char* path, BOOL include_subdirs, BOOL subdir_only);
DLLEXPORT ulong getdisksize(const char* path, ulong unit);
DLLEXPORT ulong getfreediskspace(const char* path, ulong unit);
DLLEXPORT uint64_t getfilesizetotal(const char *path);
DLLEXPORT long delfiles(const char *inpath, const char *spec, size_t keep);
DLLEXPORT char* backslash(char* path);
DLLEXPORT BOOL wildmatch(const char *fname, const char *spec, BOOL path, BOOL case_sensitive);
DLLEXPORT BOOL wildmatchi(const char *fname, const char *spec, BOOL path);
DLLEXPORT int mkpath(const char* path);
#if defined(__unix__)
DLLEXPORT void DLLCALL _splitpath(const char *path, char *drive, char *dir,
DLLEXPORT void _splitpath(const char *path, char *drive, char *dir,
char *fname, char *ext);
DLLEXPORT char * DLLCALL _fullpath(char *target, const char *path, size_t size);
DLLEXPORT int DLLCALL removecase(const char *path);
DLLEXPORT char * _fullpath(char *target, const char *path, size_t size);
DLLEXPORT int removecase(const char *path);
#else
#define removecase(x) remove(x)
#endif
......
/* eventwrap.h */
/* Event-related cross-platform development wrappers (Win32 API emulation) */
/* $Id: eventwrap.h,v 1.4 2018/07/24 01:13:09 rswindell Exp $ */
/****************************************************************************
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
......@@ -17,21 +13,9 @@
* See the GNU Lesser General Public License for more details: lgpl.txt or *
* http://www.fsf.org/copyleft/lesser.html *
* *
* Anonymous FTP access to the most recent released source is available at *
* ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
* *
* Anonymous CVS access to the development source and modification history *
* is available at cvs.synchro.net:/cvsroot/sbbs, example: *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login *
* (just hit return, no password is necessary) *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src *
* *
* For Synchronet coding style and modification guidelines, see *
* http://www.synchro.net/source.html *
* *
* You are encouraged to submit any modifications (preferably in Unix diff *
* format) via e-mail to mods@synchro.net *
* *
* Note: If this box doesn't appear square, then you need to fix your tabs. *
****************************************************************************/
......
/* filewrap.h */
/* File system-call wrappers */
/* $Id: filewrap.h,v 1.39 2019/08/31 22:16:21 rswindell Exp $ */
/****************************************************************************
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
......@@ -17,21 +13,9 @@
* See the GNU Lesser General Public License for more details: lgpl.txt or *
* http://www.fsf.org/copyleft/lesser.html *
* *
* Anonymous FTP access to the most recent released source is available at *
* ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
* *
* Anonymous CVS access to the development source and modification history *
* is available at cvs.synchro.net:/cvsroot/sbbs, example: *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login *
* (just hit return, no password is necessary) *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src *
* *
* For Synchronet coding style and modification guidelines, see *
* http://www.synchro.net/source.html *
* *
* You are encouraged to submit any modifications (preferably in Unix diff *
* format) via e-mail to mods@synchro.net *
* *
* Note: If this box doesn't appear square, then you need to fix your tabs. *
****************************************************************************/
......
/* General cross-platform development wrappers */
/* $Id: genwrap.h,v 1.122 2020/08/08 23:25:46 rswindell Exp $ */
// vi: tabstop=4
/****************************************************************************
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
......@@ -16,21 +13,9 @@
* See the GNU Lesser General Public License for more details: lgpl.txt or *
* http://www.fsf.org/copyleft/lesser.html *
* *
* Anonymous FTP access to the most recent released source is available at *
* ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
* *
* Anonymous CVS access to the development source and modification history *
* is available at cvs.synchro.net:/cvsroot/sbbs, example: *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login *
* (just hit return, no password is necessary) *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src *
* *
* For Synchronet coding style and modification guidelines, see *
* http://www.synchro.net/source.html *
* *
* You are encouraged to submit any modifications (preferably in Unix diff *
* format) via e-mail to mods@synchro.net *
* *
* Note: If this box doesn't appear square, then you need to fix your tabs. *
****************************************************************************/
......@@ -41,7 +26,7 @@
#include <string.h> /* strerror() */
#include <time.h> /* clock_t */
#include "gen_defs.h" /* ulong */
#include "wrapdll.h" /* DLLEXPORT and DLLCALL */
#include "wrapdll.h" /* DLLEXPORT and */
#if defined(__unix__)
#include <sched.h> /* sched_yield */
......@@ -242,13 +227,13 @@ extern "C" {
#endif
#if !defined(_MSC_VER) && !defined(__BORLANDC__) && !defined(__WATCOMC__)
DLLEXPORT char* DLLCALL ultoa(ulong, char*, int radix);
DLLEXPORT char* ultoa(ulong, char*, int radix);
#endif
#if defined(__unix__)
DLLEXPORT char* DLLCALL strupr(char* str);
DLLEXPORT char* DLLCALL strlwr(char* str);
DLLEXPORT char* DLLCALL strrev(char* str);
DLLEXPORT char* strupr(char* str);
DLLEXPORT char* strlwr(char* str);
DLLEXPORT char* strrev(char* str);
#if !defined(stricmp)
#define stricmp strcasecmp
#define strnicmp strncasecmp
......@@ -260,28 +245,28 @@ extern "C" {
#endif
#if defined(_WIN32)
DLLEXPORT char* DLLCALL strcasestr(const char* haystack, const char* needle);
DLLEXPORT char* strcasestr(const char* haystack, const char* needle);
#endif
/* Skip white-space chars at beginning of string */
DLLEXPORT char* DLLCALL skipsp(char* str);
DLLEXPORT char* skipsp(char* str);
/* Truncate white-space chars off end of string */
DLLEXPORT char* DLLCALL truncsp(char* str);
DLLEXPORT char* truncsp(char* str);
/* Truncate white-space chars off end of every \n-terminated line in string */
DLLEXPORT char* DLLCALL truncsp_lines(char* str);
DLLEXPORT char* truncsp_lines(char* str);
/* Truncate new-line chars off end of string */
DLLEXPORT char* DLLCALL truncnl(char* str);
DLLEXPORT char* truncnl(char* str);
#define STRERROR(x) strerror(x)
/* Re-entrant version of strerror() */
DLLEXPORT char* DLLCALL safe_strerror(int errnum, char* buf, size_t buflen);
DLLEXPORT char* safe_strerror(int errnum, char* buf, size_t buflen);
/*********************/
/* Utility Functions */
/*********************/
/* Thunking for multi-threaded specific implementations of "errno" */
DLLEXPORT int DLLCALL get_errno(void);
DLLEXPORT int get_errno(void);
/**********************************/
/* Common Utility Macro Functions */
......@@ -362,37 +347,37 @@ DLLEXPORT int DLLCALL get_errno(void);
/* Win32 implementations of recursive (thread-safe) std C time functions on Unix */
#if !defined(__unix__)
DLLEXPORT char* DLLCALL strtok_r(char *str, const char *delim, char **last);
DLLEXPORT char* strtok_r(char *str, const char *delim, char **last);
#endif
/* Mimic the Borland randomize() and random() CRTL functions */
DLLEXPORT void DLLCALL xp_randomize(void);
DLLEXPORT long DLLCALL xp_random(int);
DLLEXPORT long double DLLCALL xp_timer(void);
DLLEXPORT char* DLLCALL os_version(char *str);
DLLEXPORT char* DLLCALL os_cmdshell(void);
DLLEXPORT char* DLLCALL lastchar(const char* str);
DLLEXPORT int DLLCALL safe_snprintf(char *dst, size_t size, const char *fmt, ...)
DLLEXPORT void xp_randomize(void);
DLLEXPORT long xp_random(int);
DLLEXPORT long double xp_timer(void);
DLLEXPORT char* os_version(char *str);
DLLEXPORT char* os_cmdshell(void);
DLLEXPORT char* lastchar(const char* str);
DLLEXPORT int safe_snprintf(char *dst, size_t size, const char *fmt, ...)
#if defined(__GNUC__) // Catch printf-format errors
__attribute__ ((format (printf, 3 , 4))); // 1 is 'this'
#endif
;
/* C string/char escape-sequence processing */
DLLEXPORT char* DLLCALL c_escape_str(const char* src, char* dst, size_t maxlen, BOOL ctrl_only);
DLLEXPORT char* DLLCALL c_escape_char(char ch);
DLLEXPORT char* DLLCALL c_unescape_str(char* str);
DLLEXPORT char DLLCALL c_unescape_char_ptr(const char* str, char** endptr);
DLLEXPORT char DLLCALL c_unescape_char(char ch);
DLLEXPORT char* c_escape_str(const char* src, char* dst, size_t maxlen, BOOL ctrl_only);
DLLEXPORT char* c_escape_char(char ch);
DLLEXPORT char* c_unescape_str(char* str);
DLLEXPORT char c_unescape_char_ptr(const char* str, char** endptr);
DLLEXPORT char c_unescape_char(char ch);
/* Power-of-2 byte count string parser (e.g. "100K" returns 102400 if unit is 1) */
DLLEXPORT int64_t DLLCALL parse_byte_count(const char*, ulong unit);
DLLEXPORT double DLLCALL parse_duration(const char*);
DLLEXPORT char* DLLCALL duration_to_str(double value, char* str, size_t size);
DLLEXPORT char* DLLCALL duration_to_vstr(double value, char* str, size_t size);
DLLEXPORT char* DLLCALL byte_count_to_str(int64_t bytes, char* str, size_t size);
DLLEXPORT char* DLLCALL byte_estimate_to_str(int64_t bytes, char* str, size_t size, ulong unit, int precision);
DLLEXPORT int64_t parse_byte_count(const char*, ulong unit);
DLLEXPORT double parse_duration(const char*);
DLLEXPORT char* duration_to_str(double value, char* str, size_t size);
DLLEXPORT char* duration_to_vstr(double value, char* str, size_t size);
DLLEXPORT char* byte_count_to_str(int64_t bytes, char* str, size_t size);
DLLEXPORT char* byte_estimate_to_str(int64_t bytes, char* str, size_t size, ulong unit, int precision);
/* Microsoft (e.g. DOS/Win32) real-time system clock API (ticks since process started) */
typedef clock_t msclock_t;
......@@ -404,8 +389,8 @@ typedef clock_t msclock_t;
msclock_t msclock(void);
#endif
DLLEXPORT BOOL DLLCALL check_pid(pid_t);
DLLEXPORT BOOL DLLCALL terminate_pid(pid_t);
DLLEXPORT BOOL check_pid(pid_t);
DLLEXPORT BOOL terminate_pid(pid_t);
#if defined(__cplusplus)
}
......
......@@ -79,98 +79,98 @@ typedef struct link_list {
} link_list_t;
/* Initialization, Allocation, and Freeing of Lists and Nodes */
DLLEXPORT link_list_t* DLLCALL listInit(link_list_t* /* NULL to auto-allocate */, long flags);
DLLEXPORT BOOL DLLCALL listFree(link_list_t*);
DLLEXPORT long DLLCALL listFreeNodes(link_list_t*);
DLLEXPORT BOOL DLLCALL listFreeNodeData(list_node_t* node);
DLLEXPORT link_list_t* listInit(link_list_t* /* NULL to auto-allocate */, long flags);
DLLEXPORT BOOL listFree(link_list_t*);
DLLEXPORT long listFreeNodes(link_list_t*);
DLLEXPORT BOOL listFreeNodeData(list_node_t* node);
/* Increment/decrement reference counter (and auto-free when zero), returns -1 on error */
DLLEXPORT long DLLCALL listAttach(link_list_t*);
DLLEXPORT long DLLCALL listDetach(link_list_t*);
DLLEXPORT long listAttach(link_list_t*);
DLLEXPORT long listDetach(link_list_t*);
#if defined(LINK_LIST_THREADSAFE)
DLLEXPORT BOOL DLLCALL listSemPost(link_list_t*);
DLLEXPORT BOOL DLLCALL listSemWait(link_list_t*);
DLLEXPORT BOOL DLLCALL listSemTryWait(link_list_t*);
DLLEXPORT BOOL DLLCALL listSemTryWaitBlock(link_list_t*, unsigned long timeout);
DLLEXPORT BOOL listSemPost(link_list_t*);
DLLEXPORT BOOL listSemWait(link_list_t*);
DLLEXPORT BOOL listSemTryWait(link_list_t*);
DLLEXPORT BOOL listSemTryWaitBlock(link_list_t*, unsigned long timeout);
#endif
/* Lock/unlock linked lists (works best for mutex-protected lists) */
/* Locks are recursive (e.g. must call Unlock for each call to Lock */
DLLEXPORT BOOL DLLCALL listLock(link_list_t*);
DLLEXPORT BOOL DLLCALL listUnlock(link_list_t*);
DLLEXPORT BOOL DLLCALL listIsLocked(const link_list_t*);
DLLEXPORT BOOL listLock(link_list_t*);
DLLEXPORT BOOL listUnlock(link_list_t*);
DLLEXPORT BOOL listIsLocked(const link_list_t*);
#define listForceUnlock(list) while(listUnlock(list)==TRUE)
/* Return count or index of nodes, or -1 on error */
DLLEXPORT long DLLCALL listCountNodes(link_list_t*);
DLLEXPORT long DLLCALL listNodeIndex(link_list_t*, list_node_t*);
DLLEXPORT long listCountNodes(link_list_t*);
DLLEXPORT long listNodeIndex(link_list_t*, list_node_t*);
/* Get/Set list private data */
DLLEXPORT void* DLLCALL listSetPrivateData(link_list_t*, void*);
DLLEXPORT void* DLLCALL listGetPrivateData(link_list_t*);
DLLEXPORT void* listSetPrivateData(link_list_t*, void*);
DLLEXPORT void* listGetPrivateData(link_list_t*);
/* Return an allocated string list (which must be freed), array of all strings in linked list */
DLLEXPORT str_list_t DLLCALL listStringList(link_list_t*);
DLLEXPORT str_list_t listStringList(link_list_t*);
/* Return an allocated string list (which must be freed), subset of strings in linked list */
DLLEXPORT str_list_t DLLCALL listSubStringList(const list_node_t*, long max);
DLLEXPORT str_list_t listSubStringList(const list_node_t*, long max);
/* Free a string list returned from either of the above functions */
DLLEXPORT void* DLLCALL listFreeStringList(str_list_t);
DLLEXPORT void* listFreeStringList(str_list_t);
/* Extract subset (up to max number of nodes) in linked list (src_node) and place into dest_list */
/* dest_list == NULL, then allocate a return a new linked list */
DLLEXPORT link_list_t* DLLCALL listExtract(link_list_t* dest_list, const list_node_t* src_node, long max);
DLLEXPORT link_list_t* listExtract(link_list_t* dest_list, const list_node_t* src_node, long max);
/* Simple search functions returning found node or NULL on error */
DLLEXPORT list_node_t* DLLCALL listNodeAt(link_list_t*, long index);
DLLEXPORT list_node_t* listNodeAt(link_list_t*, long index);
/* Find a specific node by data or tag */
/* Pass length of 0 to search by data pointer rather than by data content comparison (memcmp) */
DLLEXPORT list_node_t* DLLCALL listFindNode(link_list_t*, const void* data, size_t length);
DLLEXPORT list_node_t* listFindNode(link_list_t*, const void* data, size_t length);
/* Find a specific node by its tag value */
#define listFindTaggedNode(list, tag) listFindNode(list, NULL, tag)
/* Pass length of 0 to search by data pointer rather than by data content comparison (memcmp) */
DLLEXPORT ulong DLLCALL listCountMatches(link_list_t*, const void* data, size_t length);
DLLEXPORT ulong listCountMatches(link_list_t*, const void* data, size_t length);
/* Convenience functions */
DLLEXPORT list_node_t* DLLCALL listFirstNode(link_list_t*);
DLLEXPORT list_node_t* DLLCALL listLastNode(link_list_t*);
DLLEXPORT list_node_t* DLLCALL listNextNode(const list_node_t*);
DLLEXPORT list_node_t* DLLCALL listPrevNode(const list_node_t*);
DLLEXPORT void* DLLCALL listNodeData(const list_node_t*);
DLLEXPORT list_node_t* listFirstNode(link_list_t*);
DLLEXPORT list_node_t* listLastNode(link_list_t*);
DLLEXPORT list_node_t* listNextNode(const list_node_t*);
DLLEXPORT list_node_t* listPrevNode(const list_node_t*);
DLLEXPORT void* listNodeData(const list_node_t*);
/* Primitive node locking (not recursive) */
DLLEXPORT BOOL DLLCALL listLockNode(list_node_t*);
DLLEXPORT BOOL DLLCALL listUnlockNode(list_node_t*);
DLLEXPORT BOOL DLLCALL listNodeIsLocked(const list_node_t*);
DLLEXPORT BOOL listLockNode(list_node_t*);
DLLEXPORT BOOL listUnlockNode(list_node_t*);
DLLEXPORT BOOL listNodeIsLocked(const list_node_t*);
/* Add node to list, returns pointer to new node or NULL on error */
DLLEXPORT list_node_t* DLLCALL listAddNode(link_list_t*, void* data, list_node_tag_t, list_node_t* after /* NULL=insert */);
DLLEXPORT list_node_t* listAddNode(link_list_t*, void* data, list_node_tag_t, list_node_t* after /* NULL=insert */);
/* Add array of node data to list, returns number of nodes added (or negative on error) */
/* tag array may be NULL */
DLLEXPORT long DLLCALL listAddNodes(link_list_t*, void** data, list_node_tag_t*, list_node_t* after /* NULL=insert */);
DLLEXPORT long listAddNodes(link_list_t*, void** data, list_node_tag_t*, list_node_t* after /* NULL=insert */);
/* Add node to list, allocating and copying the data for the node */
DLLEXPORT list_node_t* DLLCALL listAddNodeData(link_list_t*, const void* data, size_t length, list_node_tag_t, list_node_t* after);
DLLEXPORT list_node_t* listAddNodeData(link_list_t*, const void* data, size_t length, list_node_tag_t, list_node_t* after);
/* Add node to list, allocating and copying ASCIIZ string data */
DLLEXPORT list_node_t* DLLCALL listAddNodeString(link_list_t*, const char* str, list_node_tag_t, list_node_t* after);
DLLEXPORT list_node_t* listAddNodeString(link_list_t*, const char* str, list_node_tag_t, list_node_t* after);
/* Add a list of strings to the linked list, allocating and copying each */
/* tag array may be NULL */
DLLEXPORT long DLLCALL listAddStringList(link_list_t*, str_list_t, list_node_tag_t*, list_node_t* after);
DLLEXPORT long listAddStringList(link_list_t*, str_list_t, list_node_tag_t*, list_node_t* after);
/* Add a list of nodes from a source linked list */
DLLEXPORT long DLLCALL listAddNodeList(link_list_t*, const link_list_t* src, list_node_t* after);
DLLEXPORT long listAddNodeList(link_list_t*, const link_list_t* src, list_node_t* after);
/* Merge a source linked list into the destination linked list */
/* after merging, the nodes in the source linked list should not be modified or freed */
DLLEXPORT long DLLCALL listMerge(link_list_t* dest, const link_list_t* src, list_node_t* after);
DLLEXPORT long listMerge(link_list_t* dest, const link_list_t* src, list_node_t* after);
/* Swap the data pointers and flags for 2 nodes (possibly in separate lists) */
DLLEXPORT BOOL DLLCALL listSwapNodes(list_node_t* node1, list_node_t* node2);
DLLEXPORT BOOL listSwapNodes(list_node_t* node1, list_node_t* node2);
/* Convenience macros for pushing, popping, and inserting nodes */
#define listPushNode(list, data) listAddNode(list, data, LIST_NODE_TAG_DEFAULT, LAST_NODE)
......@@ -185,17 +185,17 @@ DLLEXPORT BOOL DLLCALL listSwapNodes(list_node_t* node1, list_node_t* node2);
#define listShiftNode(list) listRemoveNode(list, FIRST_NODE, FALSE)
/* Remove node from list, returning the node's data (if not free'd) */
DLLEXPORT void* DLLCALL listRemoveNode(link_list_t*, list_node_t* /* NULL=first */, BOOL free_data);
DLLEXPORT void* DLLCALL listRemoveTaggedNode(link_list_t*, list_node_tag_t, BOOL free_data);
DLLEXPORT void* listRemoveNode(link_list_t*, list_node_t* /* NULL=first */, BOOL free_data);
DLLEXPORT void* listRemoveTaggedNode(link_list_t*, list_node_tag_t, BOOL free_data);
/* Remove multiple nodes from list, returning the number of nodes removed */
DLLEXPORT long DLLCALL listRemoveNodes(link_list_t*, list_node_t* /* NULL=first */, long count, BOOL free_data);
DLLEXPORT long listRemoveNodes(link_list_t*, list_node_t* /* NULL=first */, long count, BOOL free_data);
/* Reverse the nodes in a list */
DLLEXPORT void DLLCALL listReverse(link_list_t*);
DLLEXPORT void listReverse(link_list_t*);
/* Return >= 0 (count of nodes) if list is valid, negative otherwise */
DLLEXPORT long DLLCALL listVerify(link_list_t*);
DLLEXPORT long listVerify(link_list_t*);
#if defined(__cplusplus)
}
......
/* msg_queue.h */
/* Uni or Bi-directional FIFO message queue */
/* $Id: msg_queue.h,v 1.9 2019/08/22 01:40:21 rswindell Exp $ */
/****************************************************************************
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
......@@ -17,21 +13,9 @@
* See the GNU Lesser General Public License for more details: lgpl.txt or *
* http://www.fsf.org/copyleft/lesser.html *
* *
* Anonymous FTP access to the most recent released source is available at *
* ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
* *
* Anonymous CVS access to the development source and modification history *
* is available at cvs.synchro.net:/cvsroot/sbbs, example: *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login *
* (just hit return, no password is necessary) *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src *
* *
* For Synchronet coding style and modification guidelines, see *
* http://www.synchro.net/source.html *
* *
* You are encouraged to submit any modifications (preferably in Unix diff *
* format) via e-mail to mods@synchro.net *
* *
* Note: If this box doesn't appear square, then you need to fix your tabs. *
****************************************************************************/
......@@ -60,30 +44,30 @@ typedef struct {
#define MSG_QUEUE_BIDIR (1<<1) /* Bi-directional message queue */
#define MSG_QUEUE_ORPHAN (1<<2) /* Owner has detached */
DLLEXPORT msg_queue_t* DLLCALL msgQueueInit(msg_queue_t*, long flags);
DLLEXPORT BOOL DLLCALL msgQueueFree(msg_queue_t*);
DLLEXPORT msg_queue_t* msgQueueInit(msg_queue_t*, long flags);
DLLEXPORT BOOL msgQueueFree(msg_queue_t*);
DLLEXPORT long DLLCALL msgQueueAttach(msg_queue_t*);
DLLEXPORT long DLLCALL msgQueueDetach(msg_queue_t*);
DLLEXPORT BOOL DLLCALL msgQueueOwner(msg_queue_t*);
DLLEXPORT long msgQueueAttach(msg_queue_t*);
DLLEXPORT long msgQueueDetach(msg_queue_t*);
DLLEXPORT BOOL msgQueueOwner(msg_queue_t*);
/* Get/Set queue private data */
DLLEXPORT void* DLLCALL msgQueueSetPrivateData(msg_queue_t*, void*);
DLLEXPORT void* DLLCALL msgQueueGetPrivateData(msg_queue_t*);
DLLEXPORT void* msgQueueSetPrivateData(msg_queue_t*, void*);
DLLEXPORT void* msgQueueGetPrivateData(msg_queue_t*);
DLLEXPORT BOOL DLLCALL msgQueueWait(msg_queue_t* q, long timeout);
DLLEXPORT long DLLCALL msgQueueReadLevel(msg_queue_t*);
DLLEXPORT void* DLLCALL msgQueueRead(msg_queue_t*, long timeout);
DLLEXPORT void* DLLCALL msgQueuePeek(msg_queue_t*, long timeout);
DLLEXPORT void* DLLCALL msgQueueFind(msg_queue_t*, const void*, size_t length);
DLLEXPORT list_node_t* DLLCALL msgQueueFirstNode(msg_queue_t*);
DLLEXPORT list_node_t* DLLCALL msgQueueLastNode(msg_queue_t*);
DLLEXPORT BOOL msgQueueWait(msg_queue_t* q, long timeout);
DLLEXPORT long msgQueueReadLevel(msg_queue_t*);
DLLEXPORT void* msgQueueRead(msg_queue_t*, long timeout);
DLLEXPORT void* msgQueuePeek(msg_queue_t*, long timeout);
DLLEXPORT void* msgQueueFind(msg_queue_t*, const void*, size_t length);
DLLEXPORT list_node_t* msgQueueFirstNode(msg_queue_t*);
DLLEXPORT list_node_t* msgQueueLastNode(msg_queue_t*);
#define msgQueueNextNode(node) listNextNode(node)
#define msgQueuePrevNode(node) listPrevNode(node)
#define msgQueueNodeData(node) listNodeData(node)
DLLEXPORT long DLLCALL msgQueueWriteLevel(msg_queue_t*);
DLLEXPORT BOOL DLLCALL msgQueueWrite(msg_queue_t*, const void*, size_t length);
DLLEXPORT long msgQueueWriteLevel(msg_queue_t*);
DLLEXPORT BOOL msgQueueWrite(msg_queue_t*, const void*, size_t length);
#if defined(__cplusplus)
}
......
......@@ -33,19 +33,19 @@ struct xpms_set {
extern "C" {
#endif
DLLEXPORT struct xpms_set* DLLCALL xpms_create(unsigned int retries, unsigned int wait_secs,
DLLEXPORT struct xpms_set* xpms_create(unsigned int retries, unsigned int wait_secs,
int (*lprintf)(int level, const char *fmt, ...));
DLLEXPORT void DLLCALL xpms_destroy(struct xpms_set *xpms_set, void (*sock_destroy)(SOCKET, void *), void *cbdata);
DLLEXPORT BOOL DLLCALL xpms_add(struct xpms_set *xpms_set, int domain, int type,
DLLEXPORT void xpms_destroy(struct xpms_set *xpms_set, void (*sock_destroy)(SOCKET, void *), void *cbdata);
DLLEXPORT BOOL xpms_add(struct xpms_set *xpms_set, int domain, int type,
int protocol, const char *addr, uint16_t port, const char *prot,
void (*sock_init)(SOCKET, void *), int(*bind_init)(BOOL), void *cbdata);
DLLEXPORT BOOL DLLCALL xpms_add_list(struct xpms_set *xpms_set, int domain, int type,
DLLEXPORT BOOL xpms_add_list(struct xpms_set *xpms_set, int domain, int type,
int protocol, str_list_t list, uint16_t default_port, const char *prot,
void (*sock_init)(SOCKET, void *), int(*bind_init)(BOOL), void *cbdata);
DLLEXPORT BOOL DLLCALL xpms_add_chararray_list(struct xpms_set *xpms_set, int domain, int type,
DLLEXPORT BOOL xpms_add_chararray_list(struct xpms_set *xpms_set, int domain, int type,
int protocol, const char *list, uint16_t default_port, const char *prot,
void (*sock_init)(SOCKET, void *), int(*bind_init)(BOOL), void *cbdata);
DLLEXPORT SOCKET DLLCALL xpms_accept(struct xpms_set *, union xp_sockaddr * addr,
DLLEXPORT SOCKET xpms_accept(struct xpms_set *, union xp_sockaddr * addr,
socklen_t * addrlen, unsigned int timeout, uint32_t flags, void **cb_data);
#ifdef __cplusplus
......
/* netwrap.h */
/* Network related wrapper functions */
/* $Id: netwrap.h,v 1.5 2018/07/24 01:13:09 rswindell Exp $ */
/****************************************************************************
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
......@@ -17,21 +13,9 @@
* See the GNU Lesser General Public License for more details: lgpl.txt or *
* http://www.fsf.org/copyleft/lesser.html *
* *
* Anonymous FTP access to the most recent released source is available at *
* ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
* *
* Anonymous CVS access to the development source and modification history *
* is available at cvs.synchro.net:/cvsroot/sbbs, example: *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login *
* (just hit return, no password is necessary) *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src *
* *
* For Synchronet coding style and modification guidelines, see *
* http://www.synchro.net/source.html *
* *
* You are encouraged to submit any modifications (preferably in Unix diff *
* format) via e-mail to mods@synchro.net *
* *
* Note: If this box doesn't appear square, then you need to fix your tabs. *
****************************************************************************/
......@@ -48,9 +32,9 @@
extern "C" {
#endif
DLLEXPORT const char* DLLCALL getHostNameByAddr(const char*);
DLLEXPORT str_list_t DLLCALL getNameServerList(void);
DLLEXPORT void DLLCALL freeNameServerList(str_list_t);
DLLEXPORT const char* getHostNameByAddr(const char*);
DLLEXPORT str_list_t getNameServerList(void);
DLLEXPORT void freeNameServerList(str_list_t);
#if defined(__cplusplus)
}
......
/* semfile.h */
/* Semaphore file functions */
/* $Id: semfile.h,v 1.2 2018/07/24 01:13:09 rswindell Exp $ */
/****************************************************************************
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
......@@ -17,21 +13,9 @@
* See the GNU Lesser General Public License for more details: lgpl.txt or *
* http://www.fsf.org/copyleft/lesser.html *
* *
* Anonymous FTP access to the most recent released source is available at *
* ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
* *
* Anonymous CVS access to the development source and modification history *
* is available at cvs.synchro.net:/cvsroot/sbbs, example: *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login *
* (just hit return, no password is necessary) *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src *
* *
* For Synchronet coding style and modification guidelines, see *
* http://www.synchro.net/source.html *
* *
* You are encouraged to submit any modifications (preferably in Unix diff *
* format) via e-mail to mods@synchro.net *
* *
* Note: If this box doesn't appear square, then you need to fix your tabs. *
****************************************************************************/
......@@ -40,21 +24,21 @@
#include <time.h> /* time_t */
#include "str_list.h" /* string list functions and types */
#include "wrapdll.h" /* DLLEXPORT and DLLCALL */
#include "wrapdll.h" /* DLLEXPORT */
#if defined(__cplusplus)
extern "C" {
#endif
/* semfile.c */
DLLEXPORT BOOL DLLCALL semfile_signal(const char* fname, const char* text);
DLLEXPORT BOOL DLLCALL semfile_check(time_t* t, const char* fname);
DLLEXPORT char* DLLCALL semfile_list_check(time_t* t, str_list_t filelist);
DLLEXPORT BOOL semfile_signal(const char* fname, const char* text);
DLLEXPORT BOOL semfile_check(time_t* t, const char* fname);
DLLEXPORT char* semfile_list_check(time_t* t, str_list_t filelist);
DLLEXPORT str_list_t
DLLCALL semfile_list_init(const char* parent, const char* action
semfile_list_init(const char* parent, const char* action
,const char* service);
DLLEXPORT void DLLCALL semfile_list_add(str_list_t* filelist, const char* fname);
DLLEXPORT void DLLCALL semfile_list_free(str_list_t* filelist);
DLLEXPORT void semfile_list_add(str_list_t* filelist, const char* fname);
DLLEXPORT void semfile_list_free(str_list_t* filelist);
#if defined(__cplusplus)
}
......
/* semwrap.h */
/* Semaphore-related cross-platform development wrappers */
/* $Id: semwrap.h,v 1.16 2018/07/24 01:13:09 rswindell Exp $ */
/****************************************************************************
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
......@@ -17,21 +13,9 @@
* See the GNU Lesser General Public License for more details: lgpl.txt or *
* http://www.fsf.org/copyleft/lesser.html *
* *
* Anonymous FTP access to the most recent released source is available at *
* ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
* *
* Anonymous CVS access to the development source and modification history *
* is available at cvs.synchro.net:/cvsroot/sbbs, example: *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login *
* (just hit return, no password is necessary) *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src *
* *
* For Synchronet coding style and modification guidelines, see *
* http://www.synchro.net/source.html *
* *
* You are encouraged to submit any modifications (preferably in Unix diff *
* format) via e-mail to mods@synchro.net *
* *
* Note: If this box doesn't appear square, then you need to fix your tabs. *
****************************************************************************/
......@@ -68,10 +52,10 @@ extern "C" {
/* POSIX semaphores */
typedef HANDLE sem_t;
DLLEXPORT int DLLCALL sem_init(sem_t*, int pshared, unsigned int value);
DLLEXPORT int DLLCALL sem_post(sem_t*);
DLLEXPORT int DLLCALL sem_getvalue(sem_t*, int* value);
DLLEXPORT int DLLCALL sem_destroy(sem_t*);
DLLEXPORT int sem_init(sem_t*, int pshared, unsigned int value);
DLLEXPORT int sem_post(sem_t*);
DLLEXPORT int sem_getvalue(sem_t*, int* value);
DLLEXPORT int sem_destroy(sem_t*);
#define sem_wait(psem) sem_trywait_block(psem,INFINITE)
#define sem_trywait(psem) sem_trywait_block(psem,0)
......@@ -91,7 +75,7 @@ extern "C" {
#endif
/* NOT POSIX */
DLLEXPORT int DLLCALL sem_trywait_block(sem_t* psem, unsigned long timeout);
DLLEXPORT int sem_trywait_block(sem_t* psem, unsigned long timeout);
/* Change semaphore to "unsignaled" (NOT POSIX) */
......
/* Thread-related cross-platform development wrappers */
/* $Id: threadwrap.h,v 1.52 2019/07/24 04:15:24 rswindell Exp $ */
// vi: tabstop=4
/****************************************************************************
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
......@@ -16,21 +13,9 @@
* See the GNU Lesser General Public License for more details: lgpl.txt or *
* http://www.fsf.org/copyleft/lesser.html *
* *
* Anonymous FTP access to the most recent released source is available at *
* ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
* *
* Anonymous CVS access to the development source and modification history *
* is available at cvs.synchro.net:/cvsroot/sbbs, example: *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login *
* (just hit return, no password is necessary) *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src *
* *
* For Synchronet coding style and modification guidelines, see *
* http://www.synchro.net/source.html *
* *
* You are encouraged to submit any modifications (preferably in Unix diff *
* format) via e-mail to mods@synchro.net *
* *
* Note: If this box doesn't appear square, then you need to fix your tabs. *
****************************************************************************/
......@@ -38,7 +23,7 @@
#define _THREADWRAP_H
#include "gen_defs.h" /* HANDLE */
#include "wrapdll.h" /* DLLEXPORT and DLLCALL */
#include "wrapdll.h" /* DLLEXPORT and */
#if !__STDC_NO_ATOMICS__
#if defined __GNUC__ && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 9)) && !defined(__llvm__) && !defined(__INTEL_COMPILER)
......@@ -130,11 +115,11 @@ pthread_mutex_t pthread_mutex_initializer_np(BOOL recursive);