home *** CD-ROM | disk | FTP | other *** search
/ The Devil's Doorknob BBS Capture (1996-2003) / devilsdoorknobbbscapture1996-2003.iso / Dloads / WWIVMODS / MODSUNKN.ZIP / BATCHDL2.MOD < prev    next >
Text File  |  1992-12-01  |  6KB  |  199 lines

  1. Parker Prospect #1 @9964
  2. Sat Mar 24 09:19:51 1990
  3.           +---------------------------------------------------------+
  4.           +        A Simple Yet Powerful Batch Download Mod         +
  5.           +---------------------------------------------------------+
  6.  
  7. This mod was created because of the flurry of ultra-complicated
  8. batch download mods that have recently been released, and all of them
  9. are either too buggy (VARBATCH) or very complicated (Bilbo's).  This
  10. mod is not a "flame" to them, but I was simply dissatisfied with
  11. what they could have done more easily and effectively.
  12.  
  13. Now, what I did for this mod was simply take the three most popular
  14. batch protocols (DSZ's Ymodem, Zmodem, and Matt T.'s PUMA) and
  15. use them in the most easily adaptable way.
  16.  
  17. NOTE TO HIGH SPEED SYSOPS:  Due to the way WWIV arranges its modem
  18. speeds, and the unique configurations of high speed modems,
  19. slight modification may be required to the command lines.  You can
  20. call my BBS (described at the end of this mod) for help, if need
  21. be.
  22.  
  23.  
  24.                      ************************************
  25.                      ************** Legend **************
  26.                      ************************************
  27.                      * %% Delete Line                   *
  28.                      * -- Search for Line, DON'T CHANGE *
  29.                      * ++ Add Line                      *
  30.                      * -+ Modify Line                   *
  31.                      ************************************
  32.  
  33.  
  34. ------------------------------------------------------------------------
  35. Step #1 <XFER.C>: THE ONLY STEP!!!!!!!!!!!!!
  36.                   Delete the ENTIRE "void batchdl" from XFER.C and
  37.                   replace it with the one listed below.
  38.  
  39. void batchdl()
  40. {
  41.   FILE *f;
  42.   int i,abort,done,i1,i2,had,rr;
  43.   char s[81],s1[81],xxx[81],ch,ch2,numb;
  44.   double percent;
  45.   uploadsrec u;
  46.  
  47.   done=0;
  48.   if (numbatch==0) {
  49.     nl();
  50.     pl("No files in queue.");
  51.     nl();
  52.     return;
  53.   }
  54.   do {
  55.     nl();
  56.     prt(2,"Batch: L,D,R,Q,C,? : ");
  57.     ch=onek("Q?CLRD");
  58.     switch(ch) {
  59.       case '?':
  60.         printmenu(9);
  61.         break;
  62.       case 'Q':
  63.         done=1;
  64.         break;
  65.       case 'L':
  66.         listbatch();
  67.         break;
  68.       case 'R':
  69.         nl();
  70.         prt(2,"Remove which? ");
  71.         input(s,2);
  72.         i=atoi(s);
  73.         if ((i>0) && (i<=numbatch)) {
  74.           delbatch(i-1);
  75.         }
  76.         if (numbatch==0) {
  77.           nl();
  78.           pl("Batch queue empty.");
  79.           nl();
  80.           done=1;
  81.         }
  82.         break;
  83.       case 'C':
  84.         prt(5,"Clear queue? ");
  85.         if (yn()) {
  86.           numbatch=0;
  87.           batchtime=0.0;
  88.           done=1;
  89.           pl("Queue cleared.");
  90.         }
  91.         break;
  92.       case 'D':
  93.         if (!incom)
  94.           break;
  95.         nl();
  96.         prt(2, "[Y]modem, [Z]modem, [P]uma, or [Q]uit? ");
  97.         ch2 = onek("QPYZ");
  98.         if (ch2 == 'Q')
  99.           break;
  100.         prt(5,"Hang up after transfer? ");
  101.         had=yn();
  102.         nl();
  103.         sprintf(s,"Transmitting:  Files - %d  Time - %s",numbatch,ctim(batchtime));
  104.         pl(s);
  105.         nl();
  106.         rr=0;
  107.         if ((syscfg.req_ratio>0.0001) && (ratio()<syscfg.req_ratio))
  108.           rr=1;
  109.         if (thisuser.exempt & exempt_ratio)
  110.           rr=0;
  111.         if (rr) {
  112.           nl();
  113.           pl("Sorry, your ratio is too low.");
  114.           nl();
  115.           break;
  116.         }
  117.         strcpy(s,"BATCHDWN.LST");
  118.         f = fopen("BATCHDWN.LST","w");
  119.         for (i=0; (i<numbatch); i++ )        {
  120.            strcpy(xxx,directories[batchdir[i]].path);
  121.            strcat(xxx,stripfn(batchfn[i]));
  122.            fprintf(f,"%s\n",xxx);
  123.         }
  124.         fclose(f);
  125.         switch(ch2) {
  126.           case 'Y':
  127.             sprintf(s1,"DSZ port %c speed %s pB4096 sb -k @%c:BATCHDWN.LST",
  128.             syscfg.primaryport+'0',curspeed,getdisk()+'A');
  129.             break;
  130.           case 'Z':
  131.             sprintf(s1,"DSZ port %c speed %s pB4096 sz @%c:BATCHDWN.LST",
  132.             syscfg.primaryport+'0',curspeed,getdisk()+'A');
  133.             break;
  134.           case 'P':
  135.             sprintf(s1,"PUMA p%c E%s B+ HF N+ X+ S @%c:BATCHDWN.LST",
  136.             syscfg.primaryport+'0',curspeed,getdisk()+'A');
  137.             break;
  138.           default:
  139.             break;
  140.         }
  141.         set_protect(0);
  142.         run_external(s1);
  143.         topscreen();
  144.         numb = numbatch;
  145.         for (i2 = 0 ; i2<numb ; i2++ ) {
  146.           dliscan1(batchdir[0]);
  147.           i=recno((batchfn[0]));
  148.           if (i<=0) {
  149.             delbatch(0);
  150.           } else {
  151.             lseek(dlf,(long) (i * sizeof(uploadsrec)),SEEK_SET);
  152.             read(dlf,(void *)&u,sizeof(uploadsrec));
  153.             strcpy(s,directories[batchdir[0]].path);
  154.             strcat(s,u.filename);
  155.             ++thisuser.downloaded;
  156.             thisuser.dk += (int) ((u.numbytes+1023)/1024);
  157.             ++u.numdloads;
  158.             lseek(dlf,(long) (i*sizeof(uploadsrec)),SEEK_SET);
  159.             write(dlf,(void *)&u,sizeof(uploadsrec));
  160.             switch (ch2) {
  161.               case 'Z':
  162.                 strcpy(s, "Zmodem Batch Download: ");
  163.                 break;
  164.               case 'Y':
  165.                 strcpy(s, "Ymodem Batch Download: ");
  166.             break;
  167.               case 'P':
  168.                 strcpy(s, "Puma Batch Download: ");
  169.                 break;
  170.             }
  171.             strcat(s,u.filename);
  172.             sysoplog(s);
  173.             closedl();
  174.             delbatch(0);
  175.           }
  176.         }
  177.         strcpy(s,"BATCHDWN.LST");
  178.         unlink(s);
  179.         if (had)
  180.           hangup=1;
  181.         done=1;
  182.         break;
  183.     }
  184.   } while ((!done) && (!hangup));
  185. }
  186.  
  187. ------------------------------------------------------------------------
  188. Final Step
  189.  
  190. Compile the BBS... and look for more mods by Parker Prospect!
  191.  
  192. ------------------------------------------------------------------------
  193. Disclaimer
  194.  
  195. I, Jeff Garzik, claim no liability for this mod, or for any damage that
  196. may have resulted from the use of this mod.  I also attach no
  197. warranty, expressed OR implied, to this product.
  198.  
  199.