home *** CD-ROM | disk | FTP | other *** search
- // Logon to Synchronet and transfer QWK packets using Zmodem
- // Version 2.00 (updated 09/17/95)
-
- // This script should need no modification for most Synchronet hubs.
- // 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;
-
- _zmod_auto=0; // Disable auto-zmodem (causing problems for many Qnet sysops)
- _zmod_rcrash=0; // Disable zmodem receive crash recovery (resume)
- 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
- ustamp("Dial error.",1,1);
- return; }
- if(not carrier()) {
- ustamp("No answer.",1,1);
- return; }
-
- nn=track("NN:",0);
- pw=track("PW:",0);
- qwk=track("QWK:",0);
- prot=track("PROTOCOL OR ",1);
- pause=track("HIT A KEY",1);
-
- tmark=timer_start(18000); // wait up to 30 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
- // Show hub that we're a script
- cputs("Telix Qnet Version 2.00");
- delay(10); // one second
- 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");
- delay(10);
- terminal();
- flushbuf();
- 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");
- delay(10);
- terminal();
- flushbuf();
- receive('Z',"");
- break; } } }
- if(qwkcnt==3) {
- cputs("Q");
- break; } } }
- delay(10);
- 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
- }
-
-