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 >
Wrap
Text File
|
1992-01-29
|
8KB
|
216 lines
ARCHIVE TEST MODIFICATION
By The Captain of The White Star Line (@2370)
This modification will allow most archives to be tested, both automatically
after an upload and manually by using a menu command. The modification as
presented will support testing archives with the extensions of ARC, PAK, or
ZIP. Future compression techniques may be added later should the need arise.
For all of these to work, you will either need to have all of the archive
utilities in your main BBS directory, or in a directory listed in your PATH
statement. For testing archives, this mod will use the programs PAK and PKZIP.
PAK is capable of testing both ARC and PAK files, so that is why a third
utility is not necessary. If you do not have PAK or PKZIP, change the
modification to suit your needs. Examples will follow at the end of this doc
file.
* * * * * * * *
STEP 1
Add the following block of code to the beginning of XFER.C, just before
void get_arc_cmd...
void test_upload(char *s)
{
char s1[81],s2[81];
int i,abort,next,i1;
uploadsrec u;
align(s);
dliscan();
abort=0;
next=0;
i=recno(s);
do {
if (i>0) {
lseek(dlf,(long) (i * sizeof(uploadsrec)),SEEK_SET);
read(dlf,(void *)&u,sizeof(uploadsrec));
if ((compare(u.filename,"????????.ARC"))
|| (compare(u.filename,"????????.PAK"))
|| (compare(u.filename,"????????.ZIP"))) {
strcpy(s1,directories[udir[curdir].subnum].path);
strcat(s1,stripfn(u.filename));
if (strstr(u.filename, ".PAK") || strstr(u.filename, ".ARC"))
strcpy(s2,"PAK T");
else
strcpy(s2,"PKUNZIP -T");
strcat(s2," ");
strcat(s2,s1);
if (exist(s1)) {
nl();
ansic(2);
prompt("Testing archive integrity of ",u.filename,":","");
nl();
do_external(s2,1);
checka(&abort,&next);
nl();
prt(3,"If the archive contains errors, please notify the sysop.");
nl();
}
}
i=nrecno(s,i);
}
} while ((i>0) && (!hangup) && (!abort));
closedl();
}
* * * * * * * * * *
STEP 2
In void upload(int dn), also in XFER.C, search for the following block of code:
strcpy(&(s[1]),u.filename);
strcat(s," uploaded on ");
strcat(s,(directories[dn].name));
sysoplog(s);
The next line should be replaced with the following:
if ((strstr(u.filename, ".ARC")) || (strstr(u.filename, ".PAK"))
|| (strstr(u.filename, ".ZIP")))
test_upload(u.filename);
* * * * * * * * * *
STEP 3
Now search for void arc_l() (XFER.C again) and add the following block of code
BEFORE that.
void test_arc()
{
char s[81],s1[81],s2[81];
int i,abort,next,i1;
uploadsrec u;
nl();
prt(2,"Archive to Test: ");
mpl(12);
input(s,12);
if (strchr(s,'.')==NULL)
strcat(s,".*");
align(s);
dliscan();
abort=0;
next=0;
i=recno(s);
do {
if (i>0) {
lseek(dlf,(long) (i * sizeof(uploadsrec)),SEEK_SET);
read(dlf,(void *)&u,sizeof(uploadsrec));
if ((compare(u.filename,"????????.ARC"))
|| (compare(u.filename,"????????.PAK"))
|| (compare(u.filename,"????????.ZIP"))) {
strcpy(s1,directories[udir[curdir].subnum].path);
strcat(s1,stripfn(u.filename));
if (strstr(u.filename, ".PAK") || strstr(u.filename, ".ARC"))
strcpy(s2,"PAK T");
else
strcpy(s2,"PKUNZIP -T");
strcat(s2," ");
strcat(s2,s1);
if (exist(s1)) {
nl();
nl();
ansic(2);
prompt("Testing archive integrity of ",u.filename,":","");
nl();
if (do_external(s2,1))
abort=1;
checka(&abort,&next);
}
}
i=nrecno(s,i);
}
} while ((i>0) && (!hangup) && (!abort));
closedl();
}
* * * * * * * * * *
STEP 4
Now in BBS.C, search for:
if ((strcmp(s,"/?")==0) && (dcs()))
printmenu(8);
and add the following:
if (strcmp(s,"/T")==0)
test_arc();
* * * * * * * * * *
STEP 5
In FCNS.H, search for:
void sort_all();
void arc_l();
and add the following line:
void test_arc();
* * * * * * * * * *
STEP 6
Now hit F9 and recompile. After what will no doubt seem to be an eternity, the
board will be compiled and ready to run. As you've probably surmized by now,
the command /T from the transfer system prompt will allow you to test an
archive (extension optional of course). Whenever a file with an extension of
ARC, PAK, or ZIP is uploaded, it will be tested automatically. Note that this
mod will not take any action other than showing you if a file contains errors.
It does not delete anything, nor does it leave you mail about the problem.
With the recent advances in archive recovery programs, I didn't think you
would want, for instance, a 500k archive that some poor soul had spent an hour
uploading to be deleted because of a single error. Now then, edit your
transfer menu to reflect the new option that is available. Also note that the
option is not restricted to sysops/co-sysops only.
* * * * * * * * * *
ADDITIONAL NOTES
Adding or deleting file compression utilities is relatively easy and does not
involve recompiling the entire BBS. Below I will give you an example of how
you would go about removing support for the PAK method, and adding support for
a method we will call WIZ.
Please refer to STEP 1. Search for PAK. See it? I knew you would. What we have
to do is substitute WIZ for PAK. Now WIZ, being a delightful new program
developed by a Mister Oz, is not compatible with any of the other programs.
This is what the new block of code in that area would look like:
read(dlf,(void *)&u,sizeof(uploadsrec));
if ((compare(u.filename,"????????.ARC"))
|| (compare(u.filename,"????????.WIZ"))
|| (compare(u.filename,"????????.ZIP"))) {
strcpy(s1,directories[udir[curdir].subnum].path);
strcat(s1,stripfn(u.filename));
if (strstr(u.filename, ".ARC"))
strcpy(s2,"PKPAK T"); /* or "PKARC T," or "PAK T" */
if (strstr(u.filename, ".WIZ"))
strcpy(s2,"WIZ T");
if (strstr(u.filename, ".ZIP"))
strcpy(s2,"PKUNZIP -T");
strcat(s2," ");
Now refer to STEP 2. This is what the added block of code would look like:
if ((strstr(u.filename, ".ARC")) || (strstr(u.filename, ".WIZ"))
|| (strstr(u.filename, ".ZIP")))
test_upload(u.filename);
Almost done. Look at STEP 3. The change in that step is exactly the same as it
was in STEP 1. Just look up a couple of paragraphs at the changes I made for
STEP 1, and apply that to STEP 3.
++++++++++++
DISCLAIMER
That's the end of the modification; there are no more steps to take.
I make no guarantees that it will not at some point break.
If your computer explodes tomorrow, don't get too mad at me.
Just keep this fact in mind: You got this mod for free.
The Captain of The White Star Line (@2370)