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 (5)
......@@ -25,15 +25,15 @@
#include "petdefs.h"
#include "cp437defs.h"
char* sbbs_t::auto_utf8(const char* str, long* mode)
char* sbbs_t::auto_utf8(const char* str, long& mode)
{
if(strncmp(str, "\xEF\xBB\xBF", 3) == 0) {
*mode |= P_UTF8;
mode |= P_UTF8;
return (char*)(str + 3);
}
if((*mode)&P_AUTO_UTF8) {
if(mode & P_AUTO_UTF8) {
if(!str_is_ascii(str) && utf8_str_is_valid(str))
*mode |= P_UTF8;
mode |= P_UTF8;
}
return (char*)str;
}
......@@ -61,7 +61,7 @@ int sbbs_t::bputs(const char *str, long mode)
if(online==ON_LOCAL && console&CON_L_ECHO) /* script running as event */
return(lputs(LOG_INFO, str));
str = auto_utf8(str, &mode);
str = auto_utf8(str, mode);
size_t len = strlen(str);
while(l < len && online) {
switch(str[l]) {
......@@ -137,7 +137,7 @@ int sbbs_t::bputs(const char *str, long mode)
/****************************************************************************/
size_t sbbs_t::bstrlen(const char *str, long mode)
{
str = auto_utf8(str, &mode);
str = auto_utf8(str, mode);
size_t count = 0;
const char* end = str + strlen(str);
while (str < end) {
......
......@@ -226,6 +226,7 @@ bool sbbs_t::removefile(smb_t* smb, file_t* f)
,f->name
,cfg.lib[cfg.dir[smb->dirnum]->lib]->sname,cfg.dir[smb->dirnum]->sname);
logline("U-",str);
f->hdr.attr |= MSG_DELETE;
return true;
}
errormsg(WHERE, ERR_REMOVE, f->name, result, smb->last_error);
......
......@@ -971,6 +971,9 @@ char* read_diz(const char* path, struct sauce_charinfo* sauce)
memset(sauce, 0, sizeof(*sauce));
off_t len = flength(path);
if(len < 1)
return NULL;
FILE* fp = fopen(path, "rb");
if(fp == NULL)
return NULL;
......@@ -982,13 +985,15 @@ char* read_diz(const char* path, struct sauce_charinfo* sauce)
len = LEN_EXTDESC;
char* buf = calloc((size_t)len + 1, 1);
if(buf != NULL)
fread(buf, (size_t)len, 1, fp);
fclose(fp);
if(buf != NULL) {
size_t rd = fread(buf, 1, (size_t)len, fp);
buf[rd] = 0;
char* eof = strchr(buf, CTRL_Z); // CP/M EOF
if(eof != NULL)
*eof = '\0';
}
fclose(fp);
return buf;
}
......
......@@ -364,7 +364,7 @@ bool sbbs_t::listfile(file_t* f, uint dirnum, const char *search, const char let
}
cond_newline();
attr(cfg.color[clr_filename]);
attr(cfg.color[(f->hdr.attr & MSG_DELETE) ? clr_err : clr_filename]);
char fname[SMB_FILEIDX_NAMELEN + 1];
if(namelen < 12 || cols < 132)
namelen = 12;
......
......@@ -131,7 +131,7 @@ bool sbbs_t::printfile(const char* fname, long mode, long org_cols, JSObject* ob
break;
if((mode&P_UTF8) && !term_supports(UTF8))
utf8_normalize_str(buf);
if(putmsgfrag(buf, &mode, org_cols, obj) != '\0') // early-EOF?
if(putmsgfrag(buf, mode, org_cols, obj) != '\0') // early-EOF?
break;
}
free(buf);
......
......@@ -64,7 +64,7 @@ char sbbs_t::putmsg(const char *buf, long mode, long org_cols, JSObject* obj)
if(mode&P_NOPAUSE)
sys_status|=SS_PAUSEOFF;
char ret = putmsgfrag(buf, &mode, org_cols, obj);
char ret = putmsgfrag(buf, mode, org_cols, obj);
if(!(mode&P_SAVEATR)) {
console=orgcon;
attr(tmpatr);
......@@ -84,7 +84,7 @@ char sbbs_t::putmsg(const char *buf, long mode, long org_cols, JSObject* obj)
}
// Print a message fragment, doesn't save/restore any console states (e.g. attributes, auto-pause)
char sbbs_t::putmsgfrag(const char* buf, long* mode, long org_cols, JSObject* obj)
char sbbs_t::putmsgfrag(const char* buf, long& mode, long org_cols, JSObject* obj)
{
char tmp2[256],tmp3[128];
char* str=(char*)buf;
......@@ -102,13 +102,13 @@ char sbbs_t::putmsgfrag(const char* buf, long* mode, long org_cols, JSObject* ob
size_t len = strlen(str);
long term = term_supports();
if(!((*mode)&P_NOATCODES) && memcmp(str, "@WRAPOFF@", 9) == 0) {
(*mode) &= ~P_WORDWRAP;
if(!(mode&P_NOATCODES) && memcmp(str, "@WRAPOFF@", 9) == 0) {
mode &= ~P_WORDWRAP;
l += 9;
}
if((*mode)&P_WORDWRAP) {
if(mode&P_WORDWRAP) {
char* wrapoff = NULL;
if(!((*mode)&P_NOATCODES)) {
if(!(mode&P_NOATCODES)) {
wrapoff = strstr((char*)str+l, "@WRAPOFF@");
if(wrapoff != NULL)
*wrapoff = 0;
......@@ -117,11 +117,11 @@ char sbbs_t::putmsgfrag(const char* buf, long* mode, long org_cols, JSObject* ob
if(org_cols < TERM_COLS_MIN)
org_cols = TERM_COLS_DEFAULT;
if((wrapped=::wordwrap((char*)str+l, cols - 1, org_cols - 1, /* handle_quotes: */TRUE
,/* is_utf8: */INT_TO_BOOL((*mode)&P_UTF8))) == NULL)
,/* is_utf8: */INT_TO_BOOL(mode&P_UTF8))) == NULL)
errormsg(WHERE,ERR_ALLOC,"wordwrap buffer",0);
else {
truncsp_lines(wrapped);
(*mode) &= ~P_WORDWRAP;
mode &= ~P_WORDWRAP;
putmsgfrag(wrapped, mode);
free(wrapped);
l=strlen(str);
......@@ -130,7 +130,7 @@ char sbbs_t::putmsgfrag(const char* buf, long* mode, long org_cols, JSObject* ob
}
}
while(l < len && ((*mode)&P_NOABORT || !msgabort()) && online) {
while(l < len && (mode&P_NOABORT || !msgabort()) && online) {
switch(str[l]) {
case '\r':
case '\n':
......@@ -144,12 +144,12 @@ char sbbs_t::putmsgfrag(const char* buf, long* mode, long org_cols, JSObject* ob
}
// fallthrough
default: // printing char
if(((*mode) & P_INDENT) && column < col)
if((mode & P_INDENT) && column < col)
cursor_right(col - column);
else if(((*mode)&P_TRUNCATE) && column >= (cols - 1)) {
else if((mode&P_TRUNCATE) && column >= (cols - 1)) {
l++;
continue;
} else if((*mode)&P_WRAP) {
} else if(mode&P_WRAP) {
if(org_cols) {
if(column > (org_cols - 1)) {
CRLF;
......@@ -162,7 +162,7 @@ char sbbs_t::putmsgfrag(const char* buf, long* mode, long org_cols, JSObject* ob
}
break;
}
if((*mode) & P_MARKUP) {
if(mode & P_MARKUP) {
const char* marks = "*/_#";
if(((mark == 0) && strchr(marks, str[l]) != NULL) || str[l] == mark) {
char* next = NULL;
......@@ -182,7 +182,7 @@ char sbbs_t::putmsgfrag(const char* buf, long* mode, long org_cols, JSObject* ob
mark = str[l];
else {
mark = 0;
if(!((*mode) & P_HIDEMARKS))
if(!(mode & P_HIDEMARKS))
outchar(str[l]);
}
switch(str[l]) {
......@@ -199,7 +199,7 @@ char sbbs_t::putmsgfrag(const char* buf, long* mode, long org_cols, JSObject* ob
attr(((curatr&0x0f) << 4) | ((curatr&0xf0) >> 4));
break;
}
if(mark != 0 && !((*mode) & P_HIDEMARKS))
if(mark != 0 && !(mode & P_HIDEMARKS))
outchar(str[l]);
l++;
continue;
......@@ -207,7 +207,7 @@ char sbbs_t::putmsgfrag(const char* buf, long* mode, long org_cols, JSObject* ob
}
}
if(str[l]==CTRL_A && str[l+1]!=0) {
if(str[l+1]=='"' && !(sys_status&SS_NEST_PF) && !((*mode)&P_NOATCODES)) { /* Quote a file */
if(str[l+1]=='"' && !(sys_status&SS_NEST_PF) && !(mode&P_NOATCODES)) { /* Quote a file */
l+=2;
i=0;
while(i<(int)sizeof(tmp2)-1 && IS_PRINTABLE(str[l]) && str[l]!='\\' && str[l]!='/')
......@@ -241,7 +241,7 @@ char sbbs_t::putmsgfrag(const char* buf, long* mode, long org_cols, JSObject* ob
l+=2;
}
}
else if(!((*mode)&P_NOXATTRS)
else if(!(mode&P_NOXATTRS)
&& (cfg.sys_misc&SM_PCBOARD) && str[l]=='@' && str[l+1]=='X'
&& IS_HEXDIGIT(str[l+2]) && IS_HEXDIGIT(str[l+3])) {
sprintf(tmp2,"%.2s",str+l+2);
......@@ -262,7 +262,7 @@ char sbbs_t::putmsgfrag(const char* buf, long* mode, long org_cols, JSObject* ob
exatr=1;
l+=4;
}
else if(!((*mode)&P_NOXATTRS)
else if(!(mode&P_NOXATTRS)
&& (cfg.sys_misc&SM_WILDCAT) && str[l]=='@' && str[l+3]=='@'
&& IS_HEXDIGIT(str[l+1]) && IS_HEXDIGIT(str[l+2])) {
sprintf(tmp2,"%.2s",str+l+1);
......@@ -270,7 +270,7 @@ char sbbs_t::putmsgfrag(const char* buf, long* mode, long org_cols, JSObject* ob
// exatr=1;
l+=4;
}
else if(!((*mode)&P_NOXATTRS)
else if(!(mode&P_NOXATTRS)
&& (cfg.sys_misc&SM_RENEGADE) && str[l]=='|' && IS_DIGIT(str[l+1])
&& IS_DIGIT(str[l+2]) && !(useron.misc&RIP)) {
sprintf(tmp2,"%.2s",str+l+1);
......@@ -286,7 +286,7 @@ char sbbs_t::putmsgfrag(const char* buf, long* mode, long org_cols, JSObject* ob
exatr=1;
l+=3; /* Skip |xx */
}
else if(!((*mode)&P_NOXATTRS)
else if(!(mode&P_NOXATTRS)
&& (cfg.sys_misc&SM_CELERITY) && str[l]=='|' && IS_ALPHA(str[l+1])
&& !(useron.misc&RIP)) {
switch(str[l+1]) {
......@@ -345,7 +345,7 @@ char sbbs_t::putmsgfrag(const char* buf, long* mode, long org_cols, JSObject* ob
exatr=1;
l+=2; /* Skip |x */
} /* Skip second digit if it exists */
else if(!((*mode)&P_NOXATTRS)
else if(!(mode&P_NOXATTRS)
&& (cfg.sys_misc&SM_WWIV) && str[l]==CTRL_C && IS_DIGIT(str[l+1])) {
exatr=1;
switch(str[l+1]) {
......@@ -403,7 +403,7 @@ char sbbs_t::putmsgfrag(const char* buf, long* mode, long org_cols, JSObject* ob
}
if(str[l]=='!' && str[l+1]=='|' && useron.misc&RIP) /* RIP */
lncntr=0; /* so defeat pause */
if(str[l]=='@' && !((*mode)&P_NOATCODES)) {
if(str[l]=='@' && !(mode&P_NOATCODES)) {
if(memcmp(str+l, "@EOF@", 5) == 0)
break;
if(memcmp(str+l, "@CLEAR@", 7) == 0) {
......@@ -436,17 +436,17 @@ char sbbs_t::putmsgfrag(const char* buf, long* mode, long org_cols, JSObject* ob
}
if(memcmp(str+l, "@WORDWRAP@", 10) == 0) {
l += 10;
(*mode) |= P_WORDWRAP;
mode |= P_WORDWRAP;
return putmsgfrag(str+l, mode, org_cols);
}
if(memcmp(str+l, "@QON@", 5) == 0) { // Allow the file display to be aborted (PCBoard)
l += 5;
(*mode) &= ~P_NOABORT;
mode &= ~P_NOABORT;
continue;
}
if(memcmp(str+l, "@QOFF@", 6) == 0) { // Do not allow the display of teh file to be aborted (PCBoard)
l += 6;
(*mode) |= P_NOABORT;
mode |= P_NOABORT;
continue;
}
bool was_tos = (row == 0);
......@@ -457,7 +457,7 @@ char sbbs_t::putmsgfrag(const char* buf, long* mode, long org_cols, JSObject* ob
if(i) /* if valid string, go to top */
continue;
}
if((*mode)&P_CPM_EOF && str[l]==CTRL_Z)
if(mode&P_CPM_EOF && str[l]==CTRL_Z)
break;
if(hot_attr) {
if(curatr == hot_attr && str[l] > ' ') {
......@@ -473,12 +473,12 @@ char sbbs_t::putmsgfrag(const char* buf, long* mode, long org_cols, JSObject* ob
}
}
size_t skip = sizeof(char);
if((*mode)&P_PETSCII) {
if(mode&P_PETSCII) {
if(term&PETSCII)
outcom(str[l]);
else
petscii_to_ansibbs(str[l]);
} else if((str[l]&0x80) && ((*mode)&P_UTF8)) {
} else if((str[l]&0x80) && (mode&P_UTF8)) {
if(term&UTF8)
outcom(str[l]);
else
......
......@@ -37,7 +37,7 @@ bool sauce_fread_record(FILE* fp, sauce_record_t* record)
&& memcmp(record->id, SAUCE_ID, SAUCE_LEN_ID) == 0
&& memcmp(record->ver, SAUCE_VERSION, SAUCE_LEN_VERSION) == 0;
fseeko(fp, offset, SEEK_SET);
(void)fseeko(fp, offset, SEEK_SET);
return result;
}
......
......@@ -736,7 +736,7 @@ public:
char* quotes_fname(int xedit, char* buf, size_t len);
char* msg_tmp_fname(int xedit, char* fname, size_t len);
char putmsg(const char *str, long mode, long org_cols = 0, JSObject* obj = NULL);
char putmsgfrag(const char* str, long* mode, long org_cols = 0, JSObject* obj = NULL);
char putmsgfrag(const char* str, long& mode, long org_cols = 0, JSObject* obj = NULL);
bool msgabort(void);
bool email(int usernumber, const char *top = NULL, const char *title = NULL
, long mode = WM_NONE, smb_t* resmb = NULL, smbmsg_t* remsg = NULL);
......@@ -851,7 +851,7 @@ public:
size_t print_utf8_as_cp437(const char*, size_t);
int attr(int); /* Change text color/attributes */
void ctrl_a(char); /* Performs Ctrl-Ax attribute changes */
char* auto_utf8(const char*, long* mode);
char* auto_utf8(const char*, long& mode);
enum output_rate {
output_rate_unlimited,
output_rate_300 = 300,
......
......@@ -256,14 +256,11 @@
#define DIR_MOVENEW (1<<17) /* Files marked as new when moved */
#define DIR_QUIET (1<<18) /* Do not notify uploader of downloads */
#define DIR_NOSTAT (1<<19) /* Do not include transfers in system stats */
#define DIR_FILES (1<<20) /* List/access files not in database */
#define DIR_FILES (1<<20) /* List/access files not in database (not used) */
#define DIR_TEMPLATE (1<<21) /* Use this dir as template for new dirs (in this lib) */
#define DIR_NOHASH (1<<22) /* Don't auto calculate/store file content hashes */
#define DIR_FILETAGS (1<<23) /* Allow files to have user-specified tags */
/* Bit values for cfg.file_misc */
#define FM_NO_LFN (1<<0) /* No long filenames in listings */
/* Bit values for cfg.msg_misc (upper 16-bits default to on) */
#define MM_REALNAME (1<<16) /* Allow receipt of e-mail using real names */
#define MM_EMAILSIG (1<<17) /* Include user signatures in e-mail msgs */
......@@ -669,30 +666,21 @@ typedef enum { /* Values for xtrn_t.event */
#define ON_REMOTE 2 /* Online remotely */
/* Various SYSTEM parameters for sys_status */
#define SS_UNUSED (1L<<0) /* Unused */
#define SS_INITIAL (1L<<1) /* The bbs data has been initialized. */
#define SS_TMPSYSOP (1L<<2) /* Temporary Sysop Status */
#define SS_USERON (1L<<3) /* A User is logged on to the BBS */
#define SS_LCHAT (1L<<4) /* Local chat in progress */
#define SS_CAP (1L<<5) /* Capture is on */
#define SS_ANSCAP (1L<<6) /* Capture ANSI codes too */
#define SS_FINPUT (1L<<7) /* Using file for input */
#define SS_COMISR (1L<<8) /* Com port ISR is installed */
#define SS_DAILY (1L<<9) /* Execute System Daily Event on logoff */
#define SS_INUEDIT (1L<<10) /* Inside Alt-Useredit section */
#define SS_ABORT (1L<<11) /* Global abort input or output flag */
#define SS_SYSPAGE (1L<<12) /* Paging sysop */
#define SS_SYSALERT (1L<<13) /* Notify sysop when users hangs up */
#define SS_GURUCHAT (1L<<14) /* Guru chat in progress */
#define SS_UNUSED2 (1L<<15) /* not used in v3 (used to be SS_NODEDAB) */
#define SS_EVENT (1L<<16) /* Time shortened due to upcoming event */
#define SS_PAUSEON (1L<<17) /* Pause on, overriding user default */
#define SS_PAUSEOFF (1L<<18) /* Pause off, overriding user default */
#define SS_IN_CTRLP (1L<<19) /* Inside ctrl-p send node message func */
#define SS_NEWUSER (1L<<20) /* New User online */
#define SS_MDMDEBUG (1L<<21) /* Modem debug output */
#define SS_NEST_PF (1L<<22) /* Nested in printfile function */
#define SS_DCDHIGH (1L<<23) /* Assume DCD is high always */
#define SS_SPLITP (1L<<24) /* Split-screen private chat */
#define SS_NEWDAY (1L<<25) /* Date changed while online */
#define SS_RLOGIN (1L<<26) /* Current login via BSD RLogin */
......@@ -818,7 +806,6 @@ enum { /* readmail and delmailidx which types */
#define EX_CHKTIME XTRN_CHKTIME /* Check time left */
#define EX_NOECHO XTRN_NOECHO /* Don't echo stdin to stdout */
#define EX_STDIO (EX_STDIN|EX_STDOUT)
#define EX_JS_CX (1<<24) /* New JavaScript context */
#define EX_NOLOG (1<<30) /* Don't log intercepted stdio */
#define EX_CONIO (1<<31) /* Intercept Windows console I/O (doorway) */
#define EX_UNSPECIFIED -1
......