Commit 8e263c46 authored by rswindell's avatar rswindell
Browse files

Added support for "Native Executable" toggle option for transfer protocols.

parent f6731b40
......@@ -167,7 +167,7 @@ void sbbs_t::batchmenu()
sprintf(str,"%sBATCHDN.LST",cfg.node_dir);
sprintf(tmp2,"%sBATCHUP.LST",cfg.node_dir);
start=time(NULL);
protocol(cmdstr(cfg.prot[xfrprot]->bicmd,str,tmp2,NULL),true);
protocol(xfrprot,cmdstr(cfg.prot[xfrprot]->bicmd,str,tmp2,NULL),true);
end=time(NULL);
for(i=0;i<batdn_total;i++)
if(cfg.dir[batdn_dir[i]]->seqdev) {
......@@ -310,7 +310,7 @@ void sbbs_t::batchmenu()
if(online==ON_REMOTE) {
delfiles(cfg.temp_dir,ALLFILES);
start=time(NULL);
protocol(cmdstr(cfg.prot[xfrprot]->batulcmd,str,nulstr,NULL),true);
protocol(xfrprot,cmdstr(cfg.prot[xfrprot]->batulcmd,str,nulstr,NULL),true);
end=time(NULL);
if(!(cfg.dir[xfrdir]->misc&DIR_ULTIME))
starttime+=end-start;
......@@ -461,7 +461,7 @@ BOOL sbbs_t::start_batch_download()
putnodedat(cfg.node_num,&thisnode); /* calculate ETA */
}
start=time(NULL);
error=protocol(cmdstr(cfg.prot[xfrprot]->batdlcmd,str,list,NULL),false);
error=protocol(xfrprot,cmdstr(cfg.prot[xfrprot]->batdlcmd,str,list,NULL),false);
end=time(NULL);
if(cfg.prot[xfrprot]->misc&PROT_DSZLOG || !error)
batch_download(xfrprot);
......
......@@ -178,11 +178,12 @@ void sbbs_t::notdownloaded(ulong size, time_t start, time_t end)
/****************************************************************************/
/* Handles start and stop routines for transfer protocols */
/****************************************************************************/
int sbbs_t::protocol(char *cmdline, bool cd)
int sbbs_t::protocol(uint prot, char *cmdline, bool cd)
{
char protlog[256],*p;
char msg[256];
int i;
long ex_mode;
FILE* stream;
sprintf(protlog,"%sPROTOCOL.LOG",cfg.node_dir);
......@@ -211,12 +212,14 @@ int sbbs_t::protocol(char *cmdline, bool cd)
telnet_mode|=TELNET_MODE_BIN_RX;
}
send_telnet_cmd(TELNET_WILL,TELNET_BINARY);
i=external(cmdline
,EX_OUTL
#ifdef __unix__ /* file xfer progs use stdio on Unix */
|EX_INR|EX_OUTR|EX_BIN
ex_mode=0;
if(cfg.prot[prot]->misc&PROT_NATIVE)
ex_mode|=EX_NATIVE;
#ifdef __unix__ /* file xfer progs must use stdio on Unix */
ex_mode|=(EX_INR|EX_OUTR|EX_BIN);
#endif
,p);
i=external(cmdline,ex_mode,p);
/* disable telnet binary transmission mode */
send_telnet_cmd(TELNET_WONT,TELNET_BINARY);
/* Got back to Text/NVT mode */
......
......@@ -142,7 +142,7 @@ bool sbbs_t::email(int usernumber, char *top, char *subj, long mode)
&& chk_ar(cfg.prot[x]->ar,&useron))
break;
if(x<cfg.total_prots) /* This should be always */
protocol(cmdstr(cfg.prot[x]->ulcmd,str2,nulstr,NULL),true);
protocol(x,cmdstr(cfg.prot[x]->ulcmd,str2,nulstr,NULL),true);
}
sprintf(tmp,"%s%s",cfg.temp_dir,title);
if(!fexistcase(str2) && fexistcase(tmp))
......
......@@ -375,7 +375,7 @@ int sbbs_t::exec_function(csi_t *csi)
if(cfg.prot[i]->mnemonic==ch && chk_ar(cfg.prot[i]->ar,&useron))
break;
if(i<cfg.total_prots) {
if(protocol(cmdstr(cfg.prot[i]->dlcmd,csi->str,csi->str,str),false)==0)
if(protocol(i,cmdstr(cfg.prot[i]->dlcmd,csi->str,csi->str,str),false)==0)
csi->logic=LOGIC_TRUE;
autohangup();
}
......@@ -403,7 +403,7 @@ int sbbs_t::exec_function(csi_t *csi)
if(cfg.prot[i]->mnemonic==ch && chk_ar(cfg.prot[i]->ar,&useron))
break;
if(i<cfg.total_prots) {
if(protocol(cmdstr(cfg.prot[i]->ulcmd,csi->str,csi->str,str),true)==0)
if(protocol(i,cmdstr(cfg.prot[i]->ulcmd,csi->str,csi->str,str),true)==0)
csi->logic=LOGIC_TRUE;
autohangup();
}
......
......@@ -966,7 +966,7 @@ int sbbs_t::exec_misc(csi_t* csi, char *path)
break;
csi->logic=LOGIC_FALSE;
if(i<cfg.total_prots)
if(protocol(cmdstr(j==SEND_FILE_VIA
if(protocol(i,cmdstr(j==SEND_FILE_VIA
? cfg.prot[i]->dlcmd : cfg.prot[i]->ulcmd,str,str,buf)
,true)==0)
csi->logic=LOGIC_TRUE;
......@@ -984,7 +984,7 @@ int sbbs_t::exec_misc(csi_t* csi, char *path)
if(!pp || !(*pp))
return(0);
if(i<cfg.total_prots)
if(protocol(cmdstr(j==SEND_FILE_VIA_VAR
if(protocol(i,cmdstr(j==SEND_FILE_VIA_VAR
? cfg.prot[i]->dlcmd : cfg.prot[i]->ulcmd,*pp,*pp,buf)
,true)==0)
csi->logic=LOGIC_TRUE;
......
......@@ -252,7 +252,7 @@ bool sbbs_t::netmail(char *into, char *title, long mode)
&& chk_ar(cfg.prot[x]->ar,&useron))
break;
if(x<cfg.total_prots) /* This should be always */
protocol(cmdstr(cfg.prot[x]->ulcmd,subj,nulstr,NULL),true);
protocol(x,cmdstr(cfg.prot[x]->ulcmd,subj,nulstr,NULL),true);
}
sprintf(tmp,"%s%s",cfg.temp_dir,title);
if(!fexistcase(subj) && fexistcase(tmp))
......
......@@ -1291,7 +1291,7 @@ int sbbs_t::listfileinfo(uint dirnum, char *filespec, long mode)
thisnode.aux=(tm.tm_hour*60)+tm.tm_min;
putnodedat(cfg.node_num,&thisnode); /* calculate ETA */
start=time(NULL);
error=protocol(cmdstr(cfg.prot[i]->dlcmd,path,nulstr,NULL),false);
error=protocol(i,cmdstr(cfg.prot[i]->dlcmd,path,nulstr,NULL),false);
end=time(NULL);
if(cfg.dir[f.dir]->misc&DIR_TFREE)
starttime+=end-start;
......
......@@ -130,7 +130,7 @@ bool sbbs_t::inetmail(char *into, char *subj, long mode)
&& chk_ar(cfg.prot[x]->ar,&useron))
break;
if(x<cfg.total_prots) /* This should be always */
protocol(cmdstr(cfg.prot[x]->ulcmd,str2,nulstr,NULL),true);
protocol(x,cmdstr(cfg.prot[x]->ulcmd,str2,nulstr,NULL),true);
}
sprintf(tmp,"%s%s",cfg.temp_dir,title);
if(!fexistcase(str2) && fexistcase(tmp))
......
......@@ -596,7 +596,7 @@ void sbbs_t::qwk_sec()
padfname(tmp2,fd.name);
sprintf(str,"%sBATCHDN.LST",cfg.node_dir);
sprintf(tmp2,"%sBATCHUP.LST",cfg.node_dir);
error=protocol(cmdstr(cfg.prot[i]->bicmd,str,tmp2,NULL),true);
error=protocol(i,cmdstr(cfg.prot[i]->bicmd,str,tmp2,NULL),true);
batdn_total=batup_total=0;
if(!checkprotresult(cfg.prot[i],error,&fd)) {
last_ns_time=ns_time;
......@@ -685,7 +685,7 @@ void sbbs_t::qwk_sec()
sprintf(str,"%s%s.qwk",cfg.temp_dir,cfg.sys_id);
sprintf(tmp2,"%s.qwk",cfg.sys_id);
padfname(tmp2,fd.name);
error=protocol(cmdstr(cfg.prot[i]->dlcmd,str,nulstr,NULL),false);
error=protocol(i,cmdstr(cfg.prot[i]->dlcmd,str,nulstr,NULL),false);
if(!checkprotresult(cfg.prot[i],error,&fd)) {
last_ns_time=ns_time;
for(i=0;i<cfg.total_subs;i++)
......@@ -755,7 +755,7 @@ void sbbs_t::qwk_sec()
if(i>=cfg.total_prots) /* This shouldn't happen */
continue;
sprintf(str,"%s%s.rep",cfg.temp_dir,cfg.sys_id);
protocol(cmdstr(cfg.prot[i]->ulcmd,str,nulstr,NULL),true);
protocol(i,cmdstr(cfg.prot[i]->ulcmd,str,nulstr,NULL),true);
unpack_rep();
delfiles(cfg.temp_dir,ALLFILES);
//autohangup();
......
......@@ -268,7 +268,7 @@ void sbbs_t::readmail(uint usernumber, int which)
&& chk_ar(cfg.prot[i]->ar,&useron))
break;
if(i<cfg.total_prots) {
error=protocol(cmdstr(cfg.prot[i]->dlcmd,str2,nulstr,NULL),false);
error=protocol(i,cmdstr(cfg.prot[i]->dlcmd,str2,nulstr,NULL),false);
if(checkprotresult(cfg.prot[i],error,&fd)) {
if(which==MAIL_YOUR)
remove(str2);
......
......@@ -590,7 +590,7 @@ public:
/* download.cpp */
void downloadfile(file_t* f);
void notdownloaded(ulong size, time_t start, time_t end);
int protocol(char *cmdline, bool cd);
int protocol(uint prot, char *cmdline, bool cd);
void seqwait(uint devnum);
void autohangup(void);
bool checkdszlog(file_t*);
......
......@@ -198,11 +198,12 @@ typedef struct {
/* Bit values for level_misc[x] */
#define LEVEL_EXPTOLVL (1<<0) /* Expire to level_expireto[x] */
#define LEVEL_EXPTOVAL (1<<1) /* Expire to val[level_expireto[x]] */
#define LEVEL_EXPTOLVL (1<<0) /* Expire to level_expireto[x] */
#define LEVEL_EXPTOVAL (1<<1) /* Expire to val[level_expireto[x]] */
/* Bit values for prot[x].misc */
#define PROT_DSZLOG (1<<0) /* Supports DSZ Log */
#define PROT_DSZLOG (1<<0) /* Supports DSZ Log */
#define PROT_NATIVE (1<<1) /* Native (32-bit) executable */
/* Bit values in netmail_misc */
......
......@@ -176,7 +176,7 @@ void sbbs_t::temp_xfer()
putnodedat(cfg.node_num,&thisnode); /* calculate ETA */
start=time(NULL);
error=protocol(cmdstr(cfg.prot[i]->dlcmd,str,nulstr,NULL),false);
error=protocol(i,cmdstr(cfg.prot[i]->dlcmd,str,nulstr,NULL),false);
end=time(NULL);
if(cfg.dir[temp_dirnum]->misc&DIR_TFREE)
starttime+=end-start;
......
......@@ -499,7 +499,7 @@ bool sbbs_t::upload(uint dirnum)
break;
if(i<cfg.total_prots) {
start=time(NULL);
protocol(cmdstr(cfg.prot[i]->ulcmd,str,nulstr,NULL),true);
protocol(i,cmdstr(cfg.prot[i]->ulcmd,str,nulstr,NULL),true);
end=time(NULL);
if(!(cfg.dir[dirnum]->misc&DIR_ULTIME)) /* Don't deduct upload time */
starttime+=end-start;
......
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