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

  1.                           ARCHIVE TEST MODIFICATION
  2.                 By The Captain of The White Star Line (@2370)
  3.  
  4.    This modification will allow most archives to be tested, both automatically
  5. after an upload and manually by using a menu command. The modification as
  6. presented will support testing archives with the extensions of ARC, PAK, or
  7. ZIP. Future compression techniques may be added later should the need arise.
  8.  
  9.    For all of these to work, you will either need to have all of the archive
  10. utilities in your main BBS directory, or in a directory listed in your PATH
  11. statement. For testing archives, this mod will use the programs PAK and PKZIP.
  12. PAK is capable of testing both ARC and PAK files, so that is why a third
  13. utility is not necessary. If you do not have PAK or PKZIP, change the
  14. modification to suit your needs. Examples will follow at the end of this doc
  15. file.
  16.  
  17.                     *    *    *    *    *    *    *    *
  18.                                     STEP 1
  19. Add the following block of code to the beginning of XFER.C, just before
  20. void get_arc_cmd...
  21.  
  22. void test_upload(char *s)
  23. {
  24.   char s1[81],s2[81];
  25.   int i,abort,next,i1;
  26.   uploadsrec u;
  27.  
  28.   align(s);
  29.   dliscan();
  30.   abort=0;
  31.   next=0;
  32.   i=recno(s);
  33.   do {
  34.     if (i>0) {
  35.       lseek(dlf,(long) (i * sizeof(uploadsrec)),SEEK_SET);
  36.       read(dlf,(void *)&u,sizeof(uploadsrec));
  37.       if ((compare(u.filename,"????????.ARC"))
  38.       || (compare(u.filename,"????????.PAK"))
  39.       || (compare(u.filename,"????????.ZIP"))) {
  40.         strcpy(s1,directories[udir[curdir].subnum].path);
  41.         strcat(s1,stripfn(u.filename));
  42.         if (strstr(u.filename, ".PAK") || strstr(u.filename, ".ARC"))
  43.           strcpy(s2,"PAK T");
  44.         else
  45.           strcpy(s2,"PKUNZIP -T");
  46.         strcat(s2," ");
  47.         strcat(s2,s1);
  48.         if (exist(s1)) {
  49.           nl();
  50.           ansic(2);
  51.           prompt("Testing archive integrity of ",u.filename,":","");
  52.           nl();
  53.           do_external(s2,1);
  54.           checka(&abort,&next);
  55.         nl();
  56.         prt(3,"If the archive contains errors, please notify the sysop.");
  57.         nl();
  58.         }
  59.       }
  60.       i=nrecno(s,i);
  61.     }
  62.   } while ((i>0) && (!hangup) && (!abort));
  63.   closedl();
  64. }
  65.  
  66.                *    *    *    *    *    *    *    *    *    *
  67.                                     STEP 2
  68. In void upload(int dn), also in XFER.C, search for the following block of code:
  69.  
  70.           strcpy(&(s[1]),u.filename);
  71.           strcat(s," uploaded on ");
  72.           strcat(s,(directories[dn].name));
  73.           sysoplog(s);
  74.  
  75. The next line should be replaced with the following:
  76.  
  77.           if ((strstr(u.filename, ".ARC")) || (strstr(u.filename, ".PAK"))
  78.           || (strstr(u.filename, ".ZIP")))
  79.             test_upload(u.filename);
  80.  
  81.                *    *    *    *    *    *    *    *    *    *    
  82.                                     STEP 3
  83. Now search for void arc_l() (XFER.C again) and add the following block of code
  84. BEFORE that.
  85.  
  86. void test_arc()
  87. {
  88.   char s[81],s1[81],s2[81];
  89.   int i,abort,next,i1;
  90.   uploadsrec u;
  91.  
  92.   nl();
  93.   prt(2,"Archive to Test: ");
  94.   mpl(12);
  95.   input(s,12);
  96.   if (strchr(s,'.')==NULL)
  97.     strcat(s,".*");
  98.   align(s);
  99.   dliscan();
  100.   abort=0;
  101.   next=0;
  102.   i=recno(s);
  103.   do {
  104.     if (i>0) {
  105.       lseek(dlf,(long) (i * sizeof(uploadsrec)),SEEK_SET);
  106.       read(dlf,(void *)&u,sizeof(uploadsrec));
  107.       if ((compare(u.filename,"????????.ARC"))
  108.       || (compare(u.filename,"????????.PAK"))
  109.       || (compare(u.filename,"????????.ZIP"))) {
  110.         strcpy(s1,directories[udir[curdir].subnum].path);
  111.         strcat(s1,stripfn(u.filename));
  112.         if (strstr(u.filename, ".PAK") || strstr(u.filename, ".ARC"))
  113.           strcpy(s2,"PAK T");
  114.         else
  115.           strcpy(s2,"PKUNZIP -T");
  116.         strcat(s2," ");
  117.         strcat(s2,s1);
  118.         if (exist(s1)) {
  119.           nl();
  120.           nl();
  121.           ansic(2);
  122.           prompt("Testing archive integrity of ",u.filename,":","");
  123.           nl();
  124.           if (do_external(s2,1))
  125.             abort=1;
  126.           checka(&abort,&next);
  127.         }
  128.       }
  129.       i=nrecno(s,i);
  130.     }
  131.   } while ((i>0) && (!hangup) && (!abort));
  132.   closedl();
  133. }
  134.  
  135.                *    *    *    *    *    *    *    *    *    *    
  136.                                     STEP 4
  137. Now in BBS.C, search for:
  138.  
  139.   if ((strcmp(s,"/?")==0) && (dcs()))
  140.     printmenu(8);
  141.  
  142. and add the following:
  143.  
  144.   if (strcmp(s,"/T")==0)
  145.     test_arc();
  146.  
  147.                *    *    *    *    *    *    *    *    *    *
  148.                                     STEP 5
  149. In FCNS.H, search for:
  150.  
  151. void sort_all();
  152. void arc_l();
  153.  
  154. and add the following line:
  155.  
  156. void test_arc();
  157.  
  158.                *    *    *    *    *    *    *    *    *    *
  159.                                     STEP 6
  160. Now hit F9 and recompile. After what will no doubt seem to be an eternity, the
  161. board will be compiled and ready to run. As you've probably surmized by now,
  162. the command /T from the transfer system prompt will allow you to test an
  163. archive (extension optional of course). Whenever a file with an extension of
  164. ARC, PAK, or ZIP is uploaded, it will be tested automatically. Note that this
  165. mod will not take any action other than showing you if a file contains errors.
  166. It does not delete anything, nor does it leave you mail about the problem.
  167. With the recent advances in archive recovery programs, I didn't think you
  168. would want, for instance, a 500k archive that some poor soul had spent an hour
  169. uploading to be deleted because of a single error. Now then, edit your
  170. transfer menu to reflect the new option that is available. Also note that the
  171. option is not restricted to sysops/co-sysops only.
  172.  
  173.                *    *    *    *    *    *    *    *    *    *    
  174.                                ADDITIONAL NOTES
  175. Adding or deleting file compression utilities is relatively easy and does not
  176. involve recompiling the entire BBS. Below I will give you an example of how
  177. you would go about removing support for the PAK method, and adding support for
  178. a method we will call WIZ.
  179.  
  180. Please refer to STEP 1. Search for PAK. See it? I knew you would. What we have
  181. to do is substitute WIZ for PAK. Now WIZ, being a delightful new program
  182. developed by a Mister Oz, is not compatible with any of the other programs.
  183. This is what the new block of code in that area would look like:
  184.  
  185.       read(dlf,(void *)&u,sizeof(uploadsrec));
  186.       if ((compare(u.filename,"????????.ARC"))
  187.       || (compare(u.filename,"????????.WIZ"))
  188.       || (compare(u.filename,"????????.ZIP"))) {
  189.         strcpy(s1,directories[udir[curdir].subnum].path);
  190.         strcat(s1,stripfn(u.filename));
  191.         if (strstr(u.filename, ".ARC"))
  192.           strcpy(s2,"PKPAK T");        /* or "PKARC T," or "PAK T" */
  193.         if (strstr(u.filename, ".WIZ"))
  194.           strcpy(s2,"WIZ T");
  195.         if (strstr(u.filename, ".ZIP"))
  196.           strcpy(s2,"PKUNZIP -T");
  197.         strcat(s2," ");
  198.  
  199. Now refer to STEP 2. This is what the added block of code would look like:
  200.  
  201.           if ((strstr(u.filename, ".ARC")) || (strstr(u.filename, ".WIZ"))
  202.           || (strstr(u.filename, ".ZIP")))
  203.             test_upload(u.filename);
  204.  
  205. Almost done. Look at STEP 3. The change in that step is exactly the same as it
  206. was in STEP 1. Just look up a couple of paragraphs at the changes I made for
  207. STEP 1, and apply that to STEP 3.
  208.  
  209.                                  ++++++++++++
  210.                                   DISCLAIMER
  211.      That's the end of the modification; there are no more steps to take.
  212.           I make no guarantees that it will not at some point break.
  213.          If your computer explodes tomorrow, don't get too mad at me.
  214.            Just keep this fact in mind: You got this mod for free.
  215.  
  216.                   The Captain of The White Star Line (@2370)