home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.wwiv.com
/
ftp.wwiv.com.zip
/
ftp.wwiv.com
/
pub
/
BBS
/
SBBS1B00.ZIP
/
EXEC.EXE
/
EXEC
/
SBBSQNET.SLT
< prev
next >
Wrap
Text File
|
1992-06-28
|
3KB
|
124 lines
// Logon to Synchronet and transfer QWK packets using Zmodem
// The 'login name' node account must have the 'Q' restriction set on
// the hub (call-out to) system.
// arg1=system id
// arg2=dial list
// arg3=login name
// arg4=password
// arg5=retry count
main(str arg1, str arg2, str arg3, str arg4, str arg5)
{
str path[128],tmp[128];
int t,tmark,tstat,nn,pw,pause,qwk,prot,qwkcnt=0;
clear_scr();
printsc("SBBSQNET: Initialized ");
t=curtime();
date(t,tmp);
printsc(tmp);
printsc(" ");
time(t,tmp);
prints(tmp);
copystr(_up_dir,path,0,80);
strcat(path,"\");
strcat(path,arg1);
strcat(path,".LOG");
printsc("SBBSQNET: ");
if(usagelog(path)==-1)
printsc("ERROR OPENING ");
else
printsc("Opened ");
prints(path);
copystr(_up_dir,path,0,80);
strcat(path,"\");
strcat(path,arg1);
strcat(path,".REP");
if(filesize(path)>0) {
printsc("SBBSQNET: Attempting to send ");
prints(path); }
printsc("SBBSQNET: ");
copystr("Calling ",tmp,0,80);
strcat(tmp,arg1);
prints(tmp);
ustamp(tmp,1,1);
printsc("SBBSQNET: Dialing ");
prints(arg2);
if(redial(arg2,stoi(arg5),1)==-1) // Dialing error
return;
nn=track("NN:",0);
pw=track("PW:",0);
qwk=track("QWK:",0);
prot=track("PROTOCOL OR QUIT",1);
pause=track("HIT A KEY",1);
tmark=timer_start(6000); // wait up to 10 minutes for sucess
while(not time_up(tmark)) {
if(not carrier()) {
ustamp("No carrier.",1,1);
break; }
terminal();
tstat=track_hit(0); // check for track hit
if(tstat==nn) { // NN: prompt
delay(1);
cputs("^X"); // clear any garbage
cputs(arg3); // send login name
cputs("^M"); }
else if(tstat==pw) { // PW: prompt
delay(1);
cputs(arg4); // send password
cputs("^M"); }
else if(tstat==pause) // Hit a key
cputs("^M");
else if(tstat==qwk) { // QWK prompt
delay(1);
qwkcnt=qwkcnt+1;
if(qwkcnt==1) {
if(filesize(path)>0) {
cputs("UZN");
terminal();
if(send('Z',path)>=0) { // successful
copystr("DEL ",tmp,0,4);
strcat(tmp,path);
dos(tmp,0); } } // delete REP
else qwkcnt=2; }
if(qwkcnt==2) {
cputs("DL");
while(not time_up(tmark)) {
if(not carrier())
break;
terminal();
tstat=track_hit(0);
if(tstat==qwk) {
qwkcnt=3;
break; }
if(tstat==prot) {
cputs("ZN");
terminal();
receive('Z',"");
break; } } }
if(qwkcnt==3) {
cputs("Q");
break; } } }
terminal();
if(time_up(tmark)) {
prints("SBBSQNET: Timeout.");
ustamp("Timeout.",1,1); }
hangup();
timer_free(tmark); // free timer channel
track_free(0); // free track channels
usagelog("*CLOSE*"); // close log file
}