...
 
Commits (1)
......@@ -209,8 +209,10 @@ bool sbbs_t::ansi_getxy(int* x, int* y)
int ch;
char str[128];
*x=0;
*y=0;
if(x != NULL)
*x=0;
if(y != NULL)
*y=0;
putcom("\x1b[6n"); /* Request cursor position */
......
......@@ -608,10 +608,10 @@ long sbbs_t::js_execfile(const char *cmd, const char* startup_dir, JSObject* sco
if(js_scope!=NULL) {
if (scope != NULL) {
JS_GetProperty(js_cx, scope, "argv", &old_js_argv);
JS_AddValueRoot(js_cx, &old_js_argv);
JS_GetProperty(js_cx, scope, "argc", &old_js_argc);
JS_AddValueRoot(js_cx, &old_js_argc);
if(JS_GetProperty(js_cx, scope, "argv", &old_js_argv))
JS_AddValueRoot(js_cx, &old_js_argv);
if(JS_GetProperty(js_cx, scope, "argc", &old_js_argc))
JS_AddValueRoot(js_cx, &old_js_argc);
}
JSObject* argv=JS_NewArrayObject(js_cx, 0, NULL);
......
/* execfunc.cpp */
/* Hi-level command shell/module routines (functions) */
/* $Id: execfunc.cpp,v 1.46 2020/05/14 07:49:59 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 General Public License for more details: gpl.txt or *
* http://www.fsf.org/copyleft/gpl.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. *
****************************************************************************/
......@@ -268,7 +252,7 @@ int sbbs_t::exec_function(csi_t *csi)
bputs(text[ErrorLogHdr]);
printfile(str,0);
if(text[DeleteErrorLogQ][0] && !noyes(text[DeleteErrorLogQ]))
remove(str);
(void)remove(str);
}
else
bprintf(text[FileDoesNotExist],str);
......
......@@ -24,28 +24,6 @@
#include "sbbs.h"
#include "qwk.h"
void pt_zone_kludge(fmsghdr_t hdr,int fido)
{
char str[256];
sprintf(str,"\1INTL %hu:%hu/%hu %hu:%hu/%hu\r"
,hdr.destzone,hdr.destnet,hdr.destnode
,hdr.origzone,hdr.orignet,hdr.orignode);
write(fido,str,strlen(str));
if(hdr.destpoint) {
sprintf(str,"\1TOPT %hu\r"
,hdr.destpoint);
write(fido,str,strlen(str));
}
if(hdr.origpoint) {
sprintf(str,"\1FMPT %hu\r"
,hdr.origpoint);
write(fido,str,strlen(str));
}
}
bool sbbs_t::lookup_netuser(char *into)
{
char to[128],name[26],str[256],q[128];
......
/* Synchronet file transfer-related functions */
/* $Id: file.cpp,v 1.36 2019/08/12 06:24:08 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 General Public License for more details: gpl.txt or *
* http://www.fsf.org/copyleft/gpl.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. *
****************************************************************************/
......@@ -122,7 +107,7 @@ void sbbs_t::openfile(file_t* f)
errormsg(WHERE,ERR_OPEN,str1,O_RDWR);
return;
}
lseek(file,f->datoffset+F_OPENCOUNT,SEEK_SET);
(void)lseek(file,f->datoffset+F_OPENCOUNT,SEEK_SET);
if(read(file,str2,3)!=3) {
close(file);
errormsg(WHERE,ERR_READ,str1,3);
......@@ -131,7 +116,7 @@ void sbbs_t::openfile(file_t* f)
str2[3]=0;
ultoa(atoi(str2)+1,str3,10);
putrec(str2,0,3,str3);
lseek(file,f->datoffset+F_OPENCOUNT,SEEK_SET);
(void)lseek(file,f->datoffset+F_OPENCOUNT,SEEK_SET);
if(write(file,str2,3)!=3) {
close(file);
errormsg(WHERE,ERR_WRITE,str1,3);
......@@ -172,7 +157,7 @@ void sbbs_t::closefile(file_t* f)
errormsg(WHERE,ERR_OPEN,str1,O_RDWR);
return;
}
lseek(file,f->datoffset+F_OPENCOUNT,SEEK_SET);
(void)lseek(file,f->datoffset+F_OPENCOUNT,SEEK_SET);
if(read(file,str2,3)!=3) {
close(file);
errormsg(WHERE,ERR_READ,str1,3);
......@@ -183,7 +168,7 @@ void sbbs_t::closefile(file_t* f)
if(ch) ch--;
ultoa(ch,str3,10);
putrec(str2,0,3,str3);
lseek(file,f->datoffset+F_OPENCOUNT,SEEK_SET);
(void)lseek(file,f->datoffset+F_OPENCOUNT,SEEK_SET);
if(write(file,str2,3)!=3) {
close(file);
errormsg(WHERE,ERR_WRITE,str1,3);
......
This diff is collapsed.
......@@ -22,7 +22,27 @@
#include "sbbs.h"
#include "qwk.h"
void pt_zone_kludge(fmsghdr_t hdr,int fido);
static void pt_zone_kludge(const fmsghdr_t* hdr,int fido)
{
char str[256];
sprintf(str,"\1INTL %hu:%hu/%hu %hu:%hu/%hu\r"
,hdr->destzone,hdr->destnet,hdr->destnode
,hdr->origzone,hdr->orignet,hdr->orignode);
write(fido,str,strlen(str));
if(hdr->destpoint) {
sprintf(str,"\1TOPT %hu\r"
,hdr->destpoint);
write(fido,str,strlen(str));
}
if(hdr->origpoint) {
sprintf(str,"\1FMPT %hu\r"
,hdr->origpoint);
write(fido,str,strlen(str));
}
}
/****************************************************************************/
/* Returns the FidoNet address (struct) parsed from str (in ASCII text). */
......@@ -854,7 +874,7 @@ void sbbs_t::qwktonetmail(FILE *rep, char *block, char *into, uchar fromhub)
}
write(fido,&hdr,sizeof(hdr));
pt_zone_kludge(hdr,fido);
pt_zone_kludge(&hdr,fido);
if(cfg.netmail_misc&NMAIL_DIRECT) {
sprintf(str,"\1FLAGS DIR\r\n");
......
......@@ -2219,8 +2219,10 @@ int getuserrec(scfg_t* cfg, int usernumber,int start, int length, char *str)
if(length < 1) { /* auto-length */
length=user_rec_len(start);
if(length < 1)
if(length < 1) {
close(file);
return -5;
}
}
i=0;
......@@ -2341,8 +2343,10 @@ ulong adjustuserrec(scfg_t* cfg, int usernumber, int start, int length, long adj
if(length < 1) { /* auto-length */
length=user_rec_len(start);
if(length < 1)
if(length < 1) {
close(file);
return 0;
}
}
i=0;
......
......@@ -1465,6 +1465,7 @@ int sbbs_t::external(const char* cmdline, long mode, const char* startup_dir)
SAFEPRINTF(str,"%sdosemu.ini",cfg.exec_dir);
if (!fexist(str)) {
errormsg(WHERE,ERR_OPEN,"dosemu.ini", 0);
fclose(dosemubatfp);
return(-1);
}
}
......@@ -1472,6 +1473,7 @@ int sbbs_t::external(const char* cmdline, long mode, const char* startup_dir)
/* if file found, then open and process it */
if ((de_launch_inifp=iniOpenFile(str, false))==NULL) {
errormsg(WHERE,ERR_OPEN,str, 0);
fclose(dosemubatfp);
return(-1);
}
de_launch_ini = iniReadFile(de_launch_inifp);
......
......@@ -869,7 +869,7 @@ int zmodem_recv_data32(zmodem_t* zm, unsigned char * p, unsigned maxlen, unsigne
rxd_crc |= zmodem_rx(zm) << 24;
if(rxd_crc != crc) {
lprintf(zm, LOG_DEBUG, "%lu %s CRC ERROR (%08lX, expected: %08lX) Bytes=%u, subpacket type=%s"
lprintf(zm, LOG_DEBUG, "%lu %s CRC ERROR (%08X, expected: %08X) Bytes=%u, subpacket type=%s"
,(ulong)zm->ack_file_pos, __FUNCTION__, rxd_crc, crc, *len, chr(subpkt_type));
return CRCFAILED;
}
......@@ -1205,7 +1205,7 @@ BOOL zmodem_recv_bin32_header(zmodem_t* zm)
rxd_crc |= zmodem_rx(zm) << 24;
if(rxd_crc != crc) {
lprintf(zm,LOG_WARNING, "%lu %s CRC ERROR (%08lX, expected: %08lX)"
lprintf(zm,LOG_WARNING, "%lu %s CRC ERROR (%08X, expected: %08X)"
,(ulong)zm->ack_file_pos, __FUNCTION__, rxd_crc, crc);
return(FALSE);
}
......@@ -1515,7 +1515,7 @@ BOOL zmodem_handle_zrpos(zmodem_t* zm, uint64_t* pos)
zmodem_recv_purge(zm, /* timeout: */1);
return TRUE;
}
lprintf(zm, LOG_WARNING, "%lu Received INVALID ZRPOS offset: %lu"
lprintf(zm, LOG_WARNING, "%lu Received INVALID ZRPOS offset: %u"
,(ulong)zm->current_file_pos, zm->rxd_header_pos);
return FALSE;
}
......@@ -1523,7 +1523,7 @@ BOOL zmodem_handle_zrpos(zmodem_t* zm, uint64_t* pos)
BOOL zmodem_handle_zack(zmodem_t* zm, uint32_t min, uint32_t max)
{
if(zm->rxd_header_pos >= min && zm->rxd_header_pos <= max) {
lprintf(zm, LOG_DEBUG, "%lu Received valid ZACK", zm->rxd_header_pos);
lprintf(zm, LOG_DEBUG, "%lu Received valid ZACK", (ulong)zm->rxd_header_pos);
zm->ack_file_pos = zm->rxd_header_pos;
return TRUE;
}
......@@ -1661,7 +1661,7 @@ int zmodem_send_from(zmodem_t* zm, FILE* fp, uint64_t pos, uint64_t* sent)
}
}
lprintf(zm, LOG_DEBUG, "%lu Sending %s data subpacket (%u bytes) window: %lu / %lu"
lprintf(zm, LOG_DEBUG, "%lu Sending %s data subpacket (%lu bytes) window: %lu / %lu"
,(ulong)pos, chr(tx_type), len, (ulong)zm->current_window_size, (ulong)zm->max_window_size);
if(zmodem_send_data(zm, tx_type, zm->tx_data_subpacket, len) != SEND_SUCCESS) {
zm->consecutive_errors++;
......@@ -1896,7 +1896,7 @@ BOOL zmodem_send_file(zmodem_t* zm, char* fname, FILE* fp, BOOL request_init, ti
if(zm->crc_request==0)
lprintf(zm,LOG_NOTICE,"Receiver requested CRC of entire file");
else
lprintf(zm,LOG_NOTICE,"Receiver requested CRC of first %lu bytes of file"
lprintf(zm,LOG_NOTICE,"Receiver requested CRC of first %u bytes of file"
,zm->crc_request);
zmodem_send_pos_header(zm, ZCRC, fcrc32(fp,zm->crc_request), /* Hex: */TRUE);
type = zmodem_recv_header(zm);
......@@ -2054,7 +2054,7 @@ int zmodem_recv_files(zmodem_t* zm, const char* download_dir, uint64_t* bytes_re
lprintf(zm,LOG_NOTICE,"Calculating CRC of: %s", fpath);
crc=fcrc32(fp,(uint32_t)l); /* Warning: 4GB limit! */
fclose(fp);
lprintf(zm,LOG_INFO,"CRC of %s (%lu bytes): %08lX"
lprintf(zm,LOG_INFO,"CRC of %s (%lu bytes): %08X"
,getfname(fpath), (ulong)l, crc);
lprintf(zm,LOG_NOTICE,"Waiting for CRC of remote file: %s", zm->current_file_name);
if(!zmodem_recv_crc(zm,&rcrc)) {
......@@ -2062,7 +2062,7 @@ int zmodem_recv_files(zmodem_t* zm, const char* download_dir, uint64_t* bytes_re
break;
}
if(crc!=rcrc) {
lprintf(zm,LOG_WARNING,"Remote file has different CRC value: %08lX", rcrc);
lprintf(zm,LOG_WARNING,"Remote file has different CRC value: %08X", rcrc);
if(zm->duplicate_filename) {
if(zm->duplicate_filename(zm->cbdata, zm)) {
loop=TRUE;
......@@ -2293,7 +2293,7 @@ unsigned zmodem_recv_file_data(zmodem_t* zm, FILE* fp, int64_t offset)
errors++;
lprintf(zm, LOG_WARNING, "%lu ERROR #%d: %s (type: %s)", (ulong)pos, errors, chr(result), chr(type));
if(errors > zm->max_errors) {
lprintf(zm, LOG_ERR, "%lu Maximum errors (%lu) exceeded", (ulong)pos, zm->max_errors);
lprintf(zm, LOG_ERR, "%lu Maximum errors (%u) exceeded", (ulong)pos, zm->max_errors);
break;
}
if(zmodem_waits_for_ack(type))
......@@ -2328,7 +2328,7 @@ int zmodem_recv_file_frame(zmodem_t* zm, FILE* fp, int* type)
*/
if(zm->rxd_header_pos==(uint32_t)ftello(fp))
return result;
lprintf(zm,LOG_WARNING,"Ignoring ZEOF as all bytes (%lu) have not been received"
lprintf(zm,LOG_WARNING,"Ignoring ZEOF as all bytes (%u) have not been received"
,zm->rxd_header_pos);
continue;
case ZFIN:
......