home *** CD-ROM | disk | FTP | other *** search
- 11/28/94 version of Asylum's FILES.BBS modification.
-
- for 424 and 423
-
-
- A Small mod that will build a FILES.BBS in batch downloads. It also builds
- a non-standard FILES_EX.BBS which contains the extended descriptions also.
-
-
- This is basically a 'get descriptions with my files please, I leeche to much
- and forgot what they were!'
-
-
- Or, for wwiv sysops, you can download from your favorite support board, and
- then just //UPLOADFILE them onto your bbs.
-
-
- 11/28/94 notes :
-
- 1. Removed the code to add FILES.BBS and FILES_EX.BBS to the batch queue, it
- was creating uglier warning/errors than the first problem was.
-
- 2. Created a check so that FILES.BBS and FILES_EX.BBS do not issue a Warning
- when they are not found in the batch download queue, after zmodem reports
- them to have been properly downloaded.
-
-
- 11/14/94 notes :
-
- The mod is being slightly upgraded and repackaged for the icenet mod of the
- month.
-
- 1. A new option was added by way of a #define to ask the user if they do or
- don't want to download the descriptions.
-
- 2. The descriptions will be added to the batch queue so that wwiv doesn't
- put a warning in the log that it doesn't exist there.
-
- 3. With the addition of option 2, I had to add code, via a #define to support
- either 423 or 424 code. Since I run 424 code, 424 compatablity is, of
- course, going to be present.
-
- A. The two #defines are at the top of the code segment in Step 1, besure you
- have them defined properly.
-
-
-
- 10/04/94 notes :
-
- 1. This mod is automatic... once it is installed, just forget about it.
-
-
-
-
- Look, no seperate .C files, and this time the userrec is untouched!!!
- Only 4 steps to install!
-
-
- My side of the code presented here is public domain, use it like you want,
- since it is PD, the only restrictions presented are those in of WWIV and
- Wayne Bell's copyright on WWIV (all 20 or so lines of his source used here).
-
-
- Asylum disclaimer:
- If you don't understand the mod, don't install it. Fully read both the
- mod file and the source included. If any of it confuses you, don't install
- the mod. If you have anything to loose, ANYTHING, then don't install the
- mod. All source is presented to you for you to review, if you can't
- fully understand it, then don't install this mod.
-
-
- Btw, your author is Zu Digital -- programmed on 10/04/94
- upgraded on 11/14/94
- fixed upgrade on 11/28/94
-
- ----------------------------
- Step 1) BATCH.C in function make_dl_batch_list, add the following at the
- very end.
-
- == void make_dl_batch_list(char *listfn)
- == {
-
- .... (Skip to the bottom of the function)
-
- == ok=0;
- == if (ok) {
- == sh_write(f,s,strlen(s));
- == at += batch[i].time;
- == addk += thisk;
- == }
- == }
- == }
- ++
- ++ /* --------------- Start FILES.BBS addition ------------------------ */
- ++
- ++
- ++ /* uncomment the below line to prompt user on creation of files.bbs */
- ++ // #define ANNOY_USER_FBBS
- ++
- ++
- ++
- ++
- ++ #ifdef ANNOY_USER_FBBS
- ++ ansic(7);
- ++ outstr("Download descriptions? ");
- ++ if(ny())
- ++ {
- ++ #endif
- ++ i = create_filesbbs(); /* Go create the FILES.BBS files */
- ++ switch(i) /* find out how successful it was */
- ++ {
- ++ case 2: /* both files were created... */
- ++ /* add ext desc file to download list */
- ++ sprintf(s, "%sFILES_EX.BBS\r\n", syscfgovr.tempdir);
- ++ sh_write(f, s, strlen(s));
- ++
- ++
- ++ case 1: /* This falls through on purpose */
- ++ /* Add FILES.BBS to download list */
- ++ sprintf(s, "%sFILES.BBS\r\n", syscfgovr.tempdir);
- ++ sh_write(f, s, strlen(s));
- ++
- ++ }
- ++ #ifdef ANNOY_USER_FBBS
- ++ }
- ++ #endif
- ++
- ++ /* --------------------- End FILES.BBS addition ----------------------- */
- ++
- ++
- ==
- ==
- == sh_close(f);
- == }
-
-
-
- ----------------------------
- Step 2) BATCH.C - Modify the following in function 'downloaded(char *, long)'
- This is all the way at the end of that function.
-
-
- == }
- == delbatch(i1);
- ==
- == return;
- == }
- == }
- == /* don't issue warning if the file is FILES.BBS or FILES_EX.BBS */
- ++ if(strcmp(fn, "FILES .BBS") != 0 && strcmp(fn, "FILES_EX.BBS") != 0)
- ++ { /* don't forget this */
- == sprintf(s,get_stringx(1,52),fn);
- == sysoplog(s);
- ++ } /* or this ! */
- ==}
-
-
-
-
- ----------------------------
- Step 3) FCNS.H - Add the following, or MAKE FCNS
-
- int create_filesbbs(void)
-
-
-
-
- ----------------------------
- Step 4) Add the following function somewhere, in BATCH.C or some overlaid
- file somewhere, it don't matter...
-
-
- /* Start FILES.BBS addition */
- int create_filesbbs(void)
- {
- FILE *filebbs, *filebbs_ex;
- char filename1[130], filename2[130], *ext_desc;
- int batch_pos = 0, file_base, file_pos, abort = 0, next = 0, ret;
- uploadsrec u;
-
-
- sprintf(filename1, "%sFILES.BBS", syscfgovr.tempdir);
- sprintf(filename2, "%sFILES_EX.BBS", syscfgovr.tempdir);
-
- ansic(1);
- pl("Building descriptions");
-
- filebbs = fsh_open(filename1, "wt"); /* Try to open FILES.BBS file */
- if(!filebbs) /* if it can't be done, abort */
- {
- pl("Couldn't create FILE.BBS");
- return 0; /* return of 0 means no files.bbs was created */
- }
-
-
- /* now try to open EXT. desc FILES.BBS */
- filebbs_ex = fsh_open(filename2, "wb");
- /* If it fails, no big deal */
-
- while(batch_pos < numbatch) /* Loop through batch QUEUE */
- {
- if(batch[batch_pos].sending) /* If we are sending this file... */
- {
- dliscan1(batch[batch_pos].dir); /* Read dir info, to include dlfn */
-
-
- /* open up directory file */
- file_base=sh_open1(dlfn,O_RDONLY | O_BINARY);
-
-
- /* And loop through until the file is found */
- for (file_pos=1; (file_pos<=numf) && (!abort) && (!hangup); file_pos++)
- {
- SETREC(file_base,file_pos);
-
- /* Read in upload record */
- sh_read(file_base,(void *)&u,sizeof(uploadsrec));
-
-
- /* If the file matches... */
- if(compare(batch[batch_pos].filename,u.filename))
- {
- file_pos = numf+1; /* make for loop fail test so it stops */
-
-
- /* Add filename and description to FILES.BBS */
- fprintf(filebbs, "%-12.12s %s\n",
- strupr(stripfn(u.filename)), u.description);
-
-
- if(filebbs_ex) /* the extended file may have failed to open */
- {
- /* Add filename and description to it too */
- fprintf(filebbs_ex, "%-12.12s %s\r\n",
- strupr(stripfn(u.filename)), u.description);
-
-
- /* If there is an extended description */
- if(u.mask & mask_extended)
- {
- /* Read it in */
- ext_desc = read_extended_description(u.filename);
-
- if(ext_desc) /* (Was it read in? */
- {
- /* Print it FILES_EX.BBS */
- fprintf(filebbs_ex, "%s\r\n", ext_desc);
- /* Free up memory allocated by read ext description */
- free(ext_desc);
- }
- } /* End of if upload record has an extended description */
- } /* End of if filebbs_ex was properly opened */
- } /* End of if this batch filename was found as this uploadrec */
- else if (!empty()) /* Allow this to be aborted... I guess */
- checka(&abort,&next);
- } /* End of for loop, looping through file base */
-
-
- file_base=sh_close(file_base);
-
- ++batch_pos; /* go onto next batch record */
- } /* End of if check this file is being sent (as opposed to receive) */
- } /* End of while loop looping through batch QUEUE */
-
-
- if(filebbs_ex) /* return of 2 means both FILES.BBS and FILES_EX.BBS */
- ret = 2; /* was created and ready to download */
- else
- ret = 1; /* 1 means only FILES.BBS was created (0 means none) */
-
- fclose(filebbs); /* was checked for validity above */
- if(filebbs_ex) /* Since it may not have been opened */
- fclose(filebbs_ex); /* make sure it is safe to close it */
-
- return ret; /* return status on which files were created */
- }
- /* End FILES.BBS addition */
-
-
-
-