home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1998 September / PCO_0998.ISO / filesbbs / dos / sbbs230b.exe / EXEC.LZH / SBBSQNET.SLT < prev    next >
Encoding:
Text File  |  1995-09-17  |  3.2 KB  |  139 lines

  1. //    Logon to Synchronet and transfer QWK packets using Zmodem
  2. //    Version 2.00 (updated 09/17/95)
  3.  
  4. //    This script should need no modification for most Synchronet hubs.
  5. //    The 'login name' node account must have the 'Q' restriction set on
  6. //    the hub (call-out to) system.
  7. //    arg1=system id
  8. //    arg2=dial list
  9. //    arg3=login name
  10. //    arg4=password
  11. //    arg5=retry count
  12.  
  13. main(str arg1, str arg2, str arg3, str arg4, str arg5)
  14. {
  15.     str path[128],tmp[128];
  16.     int t,tmark,tstat,nn,pw,pause,qwk,prot,qwkcnt=0;
  17.  
  18. _zmod_auto=0;    // Disable auto-zmodem (causing problems for many Qnet sysops)
  19. _zmod_rcrash=0; // Disable zmodem receive crash recovery (resume)
  20. clear_scr();
  21. printsc("SBBSQNET: Initialized ");
  22. t=curtime();
  23. date(t,tmp);
  24. printsc(tmp);
  25. printsc(" ");
  26. time(t,tmp);
  27. prints(tmp);
  28.  
  29. copystr(_up_dir,path,0,80);
  30. strcat(path,"\");
  31. strcat(path,arg1);
  32. strcat(path,".LOG");
  33. printsc("SBBSQNET: ");
  34. if(usagelog(path)==-1)
  35.     printsc("ERROR OPENING ");
  36. else
  37.     printsc("Opened ");
  38. prints(path);
  39.  
  40. copystr(_up_dir,path,0,80);
  41. strcat(path,"\");
  42. strcat(path,arg1);
  43. strcat(path,".REP");
  44.  
  45. if(filesize(path)>0) {
  46.     printsc("SBBSQNET: Attempting to send ");
  47.     prints(path); }
  48.  
  49. printsc("SBBSQNET: ");
  50. copystr("Calling ",tmp,0,80);
  51. strcat(tmp,arg1);
  52. prints(tmp);
  53. ustamp(tmp,1,1);
  54.  
  55. printsc("SBBSQNET: Dialing ");
  56. prints(arg2);
  57. if(redial(arg2,stoi(arg5),1)==-1) {    // Dialing error
  58.     ustamp("Dial error.",1,1);
  59.     return; }
  60. if(not carrier()) {
  61.     ustamp("No answer.",1,1);
  62.     return; }
  63.  
  64. nn=track("NN:",0);
  65. pw=track("PW:",0);
  66. qwk=track("QWK:",0);
  67. prot=track("PROTOCOL OR ",1);
  68. pause=track("HIT A KEY",1);
  69.  
  70. tmark=timer_start(18000);        // wait up to 30 minutes for sucess
  71. while(not time_up(tmark)) {
  72.     if(not carrier()) {
  73.         ustamp("No carrier.",1,1);
  74.         break; }
  75.     terminal();
  76.     tstat=track_hit(0);        // check for track hit
  77.  
  78.     if(tstat==nn) {         // NN: prompt
  79.                     // Show hub that we're a script
  80.         cputs("Telix Qnet Version 2.00");
  81.         delay(10);        // one second
  82.         cputs("^X");            // clear any garbage
  83.         cputs(arg3);        // send login name
  84.         cputs("^M"); }
  85.  
  86.     else if(tstat==pw) {        // PW: prompt
  87.         delay(1);
  88.         cputs(arg4);        // send password
  89.         cputs("^M"); }
  90.  
  91.     else if(tstat==pause)        // Hit a key
  92.         cputs("^M");
  93.  
  94.     else if(tstat==qwk) {        // QWK prompt
  95.         delay(1);
  96.         qwkcnt=qwkcnt+1;
  97.         if(qwkcnt==1) {
  98.             if(filesize(path)>0) {
  99.                 cputs("UZN");
  100.                 delay(10);
  101.                 terminal();
  102.                 flushbuf();
  103.                 if(send('Z',path)>=0) {         // successful
  104.                     copystr("DEL ",tmp,0,4);
  105.                     strcat(tmp,path);
  106.                     dos(tmp,0); } }     // delete REP
  107.             else qwkcnt=2; }
  108.         if(qwkcnt==2) {
  109.             cputs("DL");
  110.             while(not time_up(tmark)) {
  111.                 if(not carrier())
  112.                     break;
  113.                 terminal();
  114.                 tstat=track_hit(0);
  115.                 if(tstat==qwk) {
  116.                     qwkcnt=3;
  117.                     break; }
  118.                 if(tstat==prot) {
  119.                     cputs("ZN");
  120.                     delay(10);
  121.                     terminal();
  122.                     flushbuf();
  123.                     receive('Z',"");
  124.                     break; } } }
  125.         if(qwkcnt==3) {
  126.             cputs("Q");
  127.             break; } } }
  128. delay(10);
  129. terminal();
  130. if(time_up(tmark)) {
  131.     prints("SBBSQNET: Timeout.");
  132.     ustamp("Timeout.",1,1); }
  133. hangup();
  134. timer_free(tmark);        // free timer channel
  135. track_free(0);            // free track channels
  136. usagelog("*CLOSE*");            // close log file
  137. }
  138.  
  139.