home *** CD-ROM | disk | FTP | other *** search
/ The Arcade BBS / arcadebbs.zip / arcadebbs / bbstools / MODS / ALLMODS.ZIP / FILEBBS1.MOD < prev    next >
Encoding:
Text File  |  1995-06-18  |  8.6 KB  |  281 lines

  1. 11/28/94 version of Asylum's FILES.BBS modification.
  2.  
  3. for 424 and 423
  4.  
  5.  
  6. A Small mod that will build a FILES.BBS in batch downloads.  It also builds
  7. a non-standard FILES_EX.BBS which contains the extended descriptions also.
  8.  
  9.  
  10. This is basically a 'get descriptions with my files please, I leeche to much
  11. and forgot what they were!'
  12.  
  13.  
  14. Or, for wwiv sysops, you can download from your favorite support board, and
  15. then just //UPLOADFILE them onto your bbs.
  16.  
  17.  
  18. 11/28/94 notes :
  19.  
  20. 1. Removed the code to add FILES.BBS and FILES_EX.BBS to the batch queue, it
  21.    was creating uglier warning/errors than the first problem was.
  22.  
  23. 2. Created a check so that FILES.BBS and FILES_EX.BBS do not issue a Warning
  24.    when they are not found in the batch download queue, after zmodem reports
  25.    them to have been properly downloaded.
  26.  
  27.  
  28. 11/14/94 notes :
  29.  
  30. The mod is being slightly upgraded and repackaged for the icenet mod of the
  31. month.
  32.  
  33. 1. A new option was added by way of a #define to ask the user if they do or
  34.    don't want to download the descriptions.
  35.  
  36. 2. The descriptions will be added to the batch queue so that wwiv doesn't
  37.    put a warning in the log that it doesn't exist there.
  38.  
  39. 3. With the addition of option 2, I had to add code, via a #define to support
  40.    either 423 or 424 code.  Since I run 424 code, 424 compatablity is, of
  41.    course, going to be present.
  42.  
  43. A. The two #defines are at the top of the code segment in Step 1, besure you
  44.    have them defined properly.
  45.  
  46.  
  47.  
  48. 10/04/94 notes :
  49.  
  50. 1. This mod is automatic... once it is installed, just forget about it.
  51.  
  52.  
  53.  
  54.  
  55. Look, no seperate .C files, and this time the userrec is untouched!!!
  56. Only 4 steps to install!
  57.  
  58.  
  59. My side of the code presented here is public domain, use it like you want,
  60. since it is PD, the only restrictions presented are those in of WWIV and
  61. Wayne Bell's copyright on WWIV (all 20 or so lines of his source used here).
  62.  
  63.  
  64. Asylum disclaimer:
  65.   If you don't understand the mod, don't install it.  Fully read both the
  66.   mod file and the source included.  If any of it confuses you, don't install
  67.   the mod.  If you have anything to loose, ANYTHING, then don't install the
  68.   mod.  All source is presented to you for you to review, if you can't
  69.   fully understand it, then don't install this mod.
  70.  
  71.  
  72. Btw, your author is Zu Digital -- programmed on 10/04/94
  73.                                     upgraded on 11/14/94
  74.                                fixed upgrade on 11/28/94
  75.  
  76. ----------------------------
  77. Step 1) BATCH.C in function make_dl_batch_list, add the following at the
  78.         very end.
  79.  
  80. == void make_dl_batch_list(char *listfn)
  81. == {
  82.  
  83. .... (Skip to the bottom of the function)
  84.  
  85. ==         ok=0;
  86. ==       if (ok) {
  87. ==         sh_write(f,s,strlen(s));
  88. ==         at += batch[i].time;
  89. ==         addk += thisk;
  90. ==       }
  91. ==     }
  92. ==   }
  93. ++
  94. ++ /* ---------------    Start FILES.BBS addition ------------------------ */
  95. ++
  96. ++
  97. ++ /* uncomment the below line to prompt user on creation of files.bbs */
  98. ++ // #define ANNOY_USER_FBBS
  99. ++
  100. ++
  101. ++
  102. ++
  103. ++ #ifdef ANNOY_USER_FBBS
  104. ++   ansic(7);
  105. ++   outstr("Download descriptions? ");
  106. ++   if(ny())
  107. ++   {
  108. ++ #endif
  109. ++     i = create_filesbbs();        /* Go create the FILES.BBS files      */
  110. ++     switch(i)                     /* find out how successful it was     */
  111. ++     {
  112. ++       case 2:                     /* both files were created...         */
  113. ++                                   /* add ext desc file to download list */
  114. ++         sprintf(s, "%sFILES_EX.BBS\r\n", syscfgovr.tempdir);
  115. ++         sh_write(f, s, strlen(s));
  116. ++
  117. ++
  118. ++       case 1:                         /* This falls through on purpose  */
  119. ++                                       /* Add FILES.BBS to download list */
  120. ++         sprintf(s, "%sFILES.BBS\r\n", syscfgovr.tempdir);
  121. ++         sh_write(f, s, strlen(s));
  122. ++
  123. ++     }
  124. ++ #ifdef ANNOY_USER_FBBS
  125. ++   }
  126. ++ #endif
  127. ++
  128. ++ /* --------------------- End FILES.BBS addition ----------------------- */
  129. ++
  130. ++
  131. ==
  132. ==
  133. ==   sh_close(f);
  134. == }
  135.  
  136.  
  137.  
  138. ----------------------------
  139. Step 2) BATCH.C - Modify the following in function 'downloaded(char *, long)'
  140.         This is all the way at the end of that function.
  141.  
  142.  
  143. ==      }
  144. ==      delbatch(i1);
  145. ==
  146. ==      return;
  147. ==    }
  148. ==  }
  149. ==  /* don't issue warning if the file is FILES.BBS or FILES_EX.BBS */
  150. ++  if(strcmp(fn, "FILES   .BBS") != 0 && strcmp(fn, "FILES_EX.BBS") != 0)
  151. ++  {                                     /* don't forget this */
  152. ==    sprintf(s,get_stringx(1,52),fn);
  153. ==    sysoplog(s);
  154. ++  }                                     /* or this !         */
  155. ==}
  156.  
  157.  
  158.  
  159.  
  160. ----------------------------
  161. Step 3) FCNS.H - Add the following, or MAKE FCNS
  162.  
  163. int create_filesbbs(void)
  164.  
  165.  
  166.  
  167.  
  168. ----------------------------
  169. Step 4) Add the following function somewhere, in BATCH.C or some overlaid
  170. file somewhere, it don't matter...
  171.  
  172.  
  173. /* Start FILES.BBS addition */
  174. int create_filesbbs(void)
  175. {
  176.   FILE *filebbs, *filebbs_ex;
  177.   char filename1[130], filename2[130], *ext_desc;
  178.   int batch_pos = 0, file_base, file_pos, abort = 0, next = 0, ret;
  179.   uploadsrec u;
  180.  
  181.  
  182.   sprintf(filename1, "%sFILES.BBS", syscfgovr.tempdir);
  183.   sprintf(filename2, "%sFILES_EX.BBS", syscfgovr.tempdir);
  184.  
  185.   ansic(1);
  186.   pl("Building descriptions");
  187.  
  188.   filebbs = fsh_open(filename1, "wt");   /* Try to open FILES.BBS file */
  189.   if(!filebbs)                           /* if it can't be done, abort */
  190.   {
  191.     pl("Couldn't create FILE.BBS");
  192.     return 0;            /* return of 0 means no files.bbs was created */
  193.   }
  194.  
  195.  
  196.   /* now try to open EXT. desc FILES.BBS */
  197.   filebbs_ex = fsh_open(filename2, "wb");
  198.                                        /* If it fails, no big deal       */
  199.  
  200.   while(batch_pos < numbatch)          /* Loop through batch QUEUE       */
  201.   {
  202.     if(batch[batch_pos].sending)       /* If we are sending this file... */
  203.     {
  204.       dliscan1(batch[batch_pos].dir);  /* Read dir info, to include dlfn */
  205.  
  206.  
  207.       /* open up directory file */
  208.       file_base=sh_open1(dlfn,O_RDONLY | O_BINARY);
  209.  
  210.  
  211.       /* And loop through until the file is found */
  212.       for (file_pos=1; (file_pos<=numf) && (!abort) && (!hangup); file_pos++)
  213.       {
  214.         SETREC(file_base,file_pos);
  215.  
  216.         /* Read in upload record */
  217.         sh_read(file_base,(void *)&u,sizeof(uploadsrec));
  218.  
  219.  
  220.         /* If the file matches... */
  221.         if(compare(batch[batch_pos].filename,u.filename))
  222.         {
  223.           file_pos = numf+1;       /* make for loop fail test so it stops */
  224.  
  225.  
  226.           /* Add filename and description to FILES.BBS */
  227.           fprintf(filebbs, "%-12.12s %s\n",
  228.                  strupr(stripfn(u.filename)), u.description);
  229.  
  230.  
  231.           if(filebbs_ex)  /* the extended file may have failed to open */
  232.           {
  233.             /* Add filename and description to it too  */
  234.             fprintf(filebbs_ex, "%-12.12s %s\r\n",
  235.                     strupr(stripfn(u.filename)), u.description);
  236.  
  237.  
  238.             /* If there is an extended description     */
  239.             if(u.mask & mask_extended)
  240.             {
  241.               /* Read it in */
  242.               ext_desc = read_extended_description(u.filename);
  243.  
  244.               if(ext_desc)              /* (Was it read in? */
  245.               {
  246.                 /* Print it FILES_EX.BBS */
  247.                 fprintf(filebbs_ex, "%s\r\n", ext_desc);
  248.                 /* Free up memory allocated by read ext description */
  249.                 free(ext_desc);
  250.               }
  251.             }  /* End of if upload record has an extended description       */
  252.           }    /* End of if filebbs_ex was properly opened                  */
  253.         }      /* End of if this batch filename was found as this uploadrec */
  254.         else if (!empty())     /* Allow this to be aborted... I guess */
  255.           checka(&abort,&next);
  256.       }        /* End of for loop, looping through file base */
  257.  
  258.  
  259.       file_base=sh_close(file_base);
  260.  
  261.       ++batch_pos;       /* go onto next batch record */
  262.     }    /* End of if check this file is being sent (as opposed to receive) */
  263.   }      /* End of while loop looping through batch QUEUE */
  264.  
  265.  
  266.   if(filebbs_ex)  /* return of 2 means both FILES.BBS and FILES_EX.BBS */
  267.     ret = 2;      /* was created and ready to download                 */
  268.   else
  269.     ret = 1;      /* 1 means only FILES.BBS was created (0 means none) */
  270.  
  271.   fclose(filebbs);      /* was checked for validity above    */
  272.   if(filebbs_ex)        /* Since it may not have been opened */
  273.     fclose(filebbs_ex); /* make sure it is safe to close it  */
  274.  
  275.   return ret;           /* return status on which files were created */
  276. }
  277. /* End FILES.BBS addition */
  278.  
  279.  
  280.  
  281.