home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Devil's Doorknob BBS Capture (1996-2003)
/
devilsdoorknobbbscapture1996-2003.iso
/
Dloads
/
WWIVMODS
/
MODS412.ZIP
/
BIMOD412.MOD
< prev
next >
Wrap
Text File
|
1990-09-18
|
18KB
|
758 lines
One Eyed Willy #17 @8878
Saturday, September 15, 1990 at 1:33 am
BI4WWIV1.MOD V 1.0
A BiModem Mod for WWIV 4.12 ONLY
Written by One Eyed Willy #1 @18851
This mod was written to allow WWIV to use the best protocol available
to date, Bimodem. Bimodem allows transfers in two directions at the same
time and allows you to chat while the xfer goes. It is a totally batch-
oriented protocol, and due to its powerful external file configurability,
allows for easy batch uploading and downloading.
The most popular mod to this date for using Bimodem on a WWIV bbs
system was written by Cheat Sheet. His mod is very easy to install, and
does work. However, he does not distribute the source code to his mod,
making it impossible for a sysop to add things such as virus checkers, and
allow them to basically change the way it looks. It also seems to be
an "attatchment" to the board, rather than one of its protocols. This,
however, is given to the users in full source code form, and works just
like WWIV's batch function always has. In fact, WWIV is actually written
to handle both batch uploading and downloading, but to this date hasn't
been written to handle batch uploads, probably due to the fact that Zmodem
can't control which files are sent up too easily. This mod puts those
"strands" of code into use, and therefore may require modification for
later versions of the BBS software, but until then, this works just
beautifly.
This REQUIRES WWIV v4.12, it may work on 4.13, but that will depend on
Wayne not further developing the batch upload proceedures in 4.12. I have
no way of knowing what will happen, however, I can say that the batch upload
ability has existed since 4.10, so who knows what Wayne will do.
On with the mod
---------------------------------------------------
DISCLAIMER: This mod is in its beta test stages
still. If your computer blows up, don't blame me,
I didn't do it.. I doubt the mod could either..
---------------------------------------------------
///////////////////////////// Step 1 \\\\\\\\\\\\\\\\\\\\\\\\\\\\
File to be in editor: BATCH.C
Add the following code to the end of BATCH.C.. I know its bad
coding to put structures wherever you please, but this makes it
much easier to install the mod. You can go ahead and put the
typedef struct {...} stuff in Vardec.h if you please, but this
is to make it easier.
-------------------------------------------------------------------
typedef struct {
char direction, /* Direction file will be going */
refresh,
replace,
verify,
delete,
unused,
fulldir,
subdir,
sourcepath[80],
destpath[80],
descr[80];
} bimodrec;
void bidl(int had)
{
char s[255],listfn[81],sx1[21],sx2[21],sx3[21],dl[100];
int i,i1,f,ok;
bimodrec bilist;
double at=0.0;
long addk=0,thisk;
sprintf(dl,"BIMODEM, %d files, time=%s",numbatchdl, ctim(batchtime));
if (had)
strcat(dl,", HAD");
sysoplog(dl);
sprintf(listfn,"%s\\BIMODEM.PTH",cdir);
_chmod(listfn,1,0);
unlink(listfn);
_chmod(dszlog,1,0);
unlink(dszlog);
f=open(listfn,O_RDWR | O_BINARY | O_CREAT | O_TRUNC, S_IREAD | S_IWRITE);
if (f<0)
return;
for (i=0; i<numbatch; i++) {
bilist.direction = batch[i].sending ? 'U' : 'D';
bilist.refresh= ' ';
bilist.replace= 'N';
bilist.verify = 'Y';
bilist.delete = 'N';
bilist.unused = ' ';
bilist.fulldir= 'N';
bilist.subdir = 'Y';
sprintf(s,"%s%s",directories[batch[i].dir].path,stripfn(batch[i].filename));
for (i1=0;i1<80;i1++) {
bilist.sourcepath[i1]=32;
bilist.descr[i1]=32;
bilist.destpath[i1]=32;
}
strupr(s);
strupr(batch[i].filename);
if (batch[i].sending) {
sprintf(bilist.sourcepath,"%-70s",s);
sprintf(bilist.destpath,"%-70s",stripfn(batch[i].filename));
} else {
sprintf(bilist.sourcepath,"%-70s",stripfn(batch[i].filename));
sprintf(bilist.destpath,"%-70s",s);
}
thisk=(batch[i].len+1023)/1024;
if ((syscfg.req_ratio>0.0001) && (ratio1(addk+thisk)<syscfg.req_ratio) &&
(!(thisuser.exempt & exempt_ratio)))
ok=0;
if (ok) {
write(f,&bilist,248);
at += batch[i].time;
addk += thisk;
}
}
close(f);
ultoa(com_speed,sx1,10);
ultoa(modem_speed,sx3,10);
sx2[0]='0'+syscfg.primaryport;
sx2[1]=0;
sprintf(s,"BIMODEM /B%s /L%s /PBIMODEM.PTH",sx1,sx2);
if (s[0]) {
clrscrb();
outs(dl);
outs("\r\n");
outs(s);
outs("\r\n");
if (incom) {
run_external1(s);
topscreen();
process_dszlog();
}
}
_chmod(listfn,1,0);
unlink(listfn);
_chmod(dszlog,1,0);
unlink(dszlog);
}
void remove_entry(char *fn, int dn)
{
int i, f;
uploadsrec u;
dliscan1(dn);
f = recno(fn);
SETREC(f);
read(dlf,(void *)&u, sizeof(uploadsrec));
if (u.mask & mask_extended)
delete_extended_description(fn);
for(i = f; i<numf; i++) {
SETREC(i+1);
read(dlf,(void *)&u, sizeof(uploadsrec));
SETREC(i);
write(dlf,(void *)&u, sizeof(uploadsrec));
}
--numf;
u.numbytes = numf;
SETREC(0);
write(dlf,(void *)&u, sizeof(uploadsrec));
closedl();
}
--------------------------------------------------------------------------
////////////////////////// Step 2 \\\\\\\\\\\\\\\\\\\\\\\
File to be in editor: BATCH.C
REPLACE the entire process_dszlog() void from batch.c, and put this
in its place. I think Wayne was smoking too many of those special
cigarettes that night when he wrote the routine, becuase its terribly
inefficient, and won't even work with Bimodem's outputted DSZ logs.
-------------------------------------------------------------------------
void process_dszlog()
{
FILE *f;
char s[100];
if ((f=fopen(dszlog,"rt"))!=0) {
outchr(12);
ansic(4);
pl(" Transfer Results ");
nl();
while (fgets(s,78,f))
handle_dszline(s);
fclose(f);
}
_chmod(dszlog,1,0);
unlink(dszlog);
}
------------------------------------------------------------------------
////////////////////////////// Step 3 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
File to be in editor: BATCH.C
Now to do a little modification to Wayne's batch fucntions. One is
a cosmetic change to show the user what's happened, rather than it
just going into the sysop log, the other is to do what wayne knew he'd
have to do eventually.
Anyway, in void uploaded(), where it says:
void uploaded()
{
bla bla..
make it read:
void uploaded()
{
int f;
~~~~~~
bla bla..
and where it says:
SETREC(i);
read(dlf,(void *)&u,sizeof(uploadsrec));
/* more here */
++thisuser.uploaded;
thisuser.uk += (int) ((u.numbytes+1023)/1024);
fill in what Wayne left out, put in:
SETREC(i);
read(dlf,(void *)&u,sizeof(uploadsrec));
sprintf(s,"%s%s",directories[batch[i1].dir].path,stripfn(batch[i1].filename));
f=open(s,O_RDONLY | O_BINARY);
u.numbytes=filelength(f);
close(f);
++thisuser.uploaded;
thisuser.uk += (int) ((u.numbytes+1023)/1024);
Also, go down a little further where it reads:
SETREC(i);
write(dlf,(void *)&u,sizeof(uploadsrec));
sprintf(s,"+%s uploaded on %s",
u.filename,
directories[batch[i1].dir].name);
sysoplog(s);
}
closedl();
and replace that code with:
SETREC(i);
write(dlf,(void *)&u,sizeof(uploadsrec));
ansic(3);
sprintf(s,"Uploaded '%s'",
u.filename);
sysoplog(s);
pl(s);
}
closedl();
and in void downloaded(), replace:
SETREC(i);
write(dlf,(void *)&u,sizeof(uploadsrec));
sprintf(s,"Downloaded '%s'",u.filename);
sysoplog(s);
sprintf(s,"%s downloaded '%s' on %s",
nam(&thisuser,usernum), u.filename, date());
ssm(u.ownerusr,0,s);
}
closedl();
with the following:
SETREC(i);
write(dlf,(void *)&u,sizeof(uploadsrec));
sprintf(s,"Downloaded '%s'",u.filename);
sysoplog(s);
ansic(7);
pl(s);
sprintf(s,"%s downloaded '%s' on %s",
nam(&thisuser,usernum), u.filename, date());
ssm(u.ownerusr,0,s);
}
closedl();
Well, that will handle the joys of the batch transfer, but now
we have to handle these empty files which will appear unless
taken care of..
////////////////////////////// Step 4 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
File to be in editor: BATCH.C (still!)
Replace the entire delbatch() void with this one:
void delbatch(int i)
{
int i1;
char s[65];
if (i<numbatch) {
batchtime -= batch[i].time;
if (batch[i].sending)
--numbatchdl;
else {
sprintf(s,"%s%s",directories[batch[i].dir].path,stripfn(batch[i].filename));
if (!exist(s))
remove_entry(batch[i].filename,batch[i].dir);
}
--numbatch;
for (i1=i; i1<=numbatch; i1++) {
batch[i1]=batch[i1+1];
}
}
}
This will make it so that it removes temporary upload records when they are
in fact not used.
////////////////////////// Step 5 \\\\\\\\\\\\\\\\\\\\\\\
Alright, last thing to do in BATCH.C, finally..
Change the lines that read:
prt(2,"Batch: L,D,R,Q,C,? : ");
ch=onek("Q?CLRD");
to read:
prt(2,"Batch: L,D,R,Q,C,B,? : ");
ch=onek("Q?CLRDB");
and change the code that reads:
case 'C':
prt(5,"Clear queue? ");
if (yn()) {
numbatch=0;
numbatchdl=0;
batchtime=0.0;
done=1;
pl("Queue cleared.");
}
break;
case 'D':
nl();
to read:
case 'C':
prt(5,"Clear queue? ");
if (yn()) {
while(numbatch)
delbatch(0);
done=1;
pl("Queue cleared.");
}
break;
case 'B':
nl();
prt(5,"Hang up after transfer? ");
had=yn();
nl();
pl("Execute BiModem From Your Computer Now");
/* Cheat Sheet, this looks like yours, because people
have autoscripts which act on the string */
nl();
bidl(had);
if (had)
hangup=1;
done=1;
break;
case 'D':
nl();
////////////////////////////// Step 5 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
File to be in editor: SR.C
Now to make the receive_file() function allow for a batch upload.
Change the line that reads:
void receive_file(char *fn, int *received, char *ft)
to read:
int receive_file(char *fn, int *received, char *ft, char *sfn, int dn)
~~~ ~~~~~~~~~~~~~~~~~~~
and right after the line that reads:
int i;
add:
char s[80];
so it reads:
int receive_file(char *fn, int *received, char *ft, char *sfn, int dn)
{
int i;
char s[80];
i=get_protocol(0).....
Near the bottom of the same void turned int, change the portion of code
which looks like:
xymodem_receive(fn,ft,received,1);
break;
case 4:
if (incom)
xymodem_receive(fn,ft,received,1);
break;
default:
if ((i>5) && (incom)) {
extern_prot(i-6,fn,0);
*received=exist(fn);
}
break;
}
}
to read:
xymodem_receive(fn,ft,received,1);
break;
case 5:
*received=0;
if (numbatch>=MAX_BATCH || sfn[0]==0) {
nl();
pl("No room left in batch queue.");
nl();
*received=0;
} else {
strcpy(batch[numbatch].filename,sfn);
batch[numbatch].dir=dn;
batch[numbatch].time=0;
batch[numbatch].sending=0;
batch[numbatch].len=0;
numbatch++;
sprintf(s,"File added to upload queue. Files: %d D/l Time: %s",numbatch,ctim(batchtime));
nl();
pl(s);
nl();
*received=0;
return(1);
}
break;
default:
if ((i>5) && (incom)) {
extern_prot(i-6,fn,0);
*received=exist(fn);
}
break;
}
return(0);
}
////////////////////////////// Step 6 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\
File to be in editor: SR.C
At the top of get_protocol, change the lines which read:
int i,i1,i2,prot,maxprot,done;
if (dl>0)
strcpy(oks,"Q?012345");
else
if (dl<0)
strcpy(oks,"Q?0234");
else
strcpy(oks,"Q?0234");
maxprot=5;
prot=thisuser.defprot;
if ((dl!=1) && ((prot==5) || (prot==1)))
prot=0;
done=0;
To read:
int i,i1,i2,prot,maxprot,done;
strcpy(oks,"Q?012345");
maxprot=5;
prot=thisuser.defprot;
if ((dl!=1) && (prot==1))
prot=0;
done=0;
Do a search for "Batch" and change it to "Batch/Bimodem" TWICE..
there are two occurrences.
////////////////////////////// Step 8 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\
File to be in editor: BBSUTL.C
Now, gotta make a quick change to BBSUTL.C to allow the //UPLOAD to work
with the change in function syntax.
Change the lines that read:
print("You may now upload a message, max ",s1," bytes.","");
nl();
receive_file(s,&i1,&ch);
f=open(s,O_RDWR | O_BINARY);
if (f>0) {
to read:
print("You may now upload a message, max ",s1," bytes.","");
nl();
receive_file(s,&i1,&ch,"",0);
f=open(s,O_RDWR | O_BINARY);
if (f>0) {
/////////////////////////// Step 7 \\\\\\\\\\\\\\\\\\\\\\\\\\\
File to be in editor: XFER.C
Now time to modify the upload() function so it doesn't think
each file is aborted when you attempt to upload them, and to keep
the directory record so it can be modified as soon as a file is
sent up. If I wasn't using Wayne's code, I probably would not be
doing the upload part this way, as it leaves an ASK file whenever
you send something up, however, I'm not about to disagree with
the ever omnicient Mr. Bell...
In function upload(), at the very beginning where it reads:
void upload(int dn)
{
directoryrec d;
uploadsrec u,u1;
int i,i1,i2,ok,xfer,f;
char s[255],s1[81],*ss;
change it to read:
void upload(int dn)
{
directoryrec d;
uploadsrec u,u1;
int i,i1,i2,ok,xfer,f,bi; /* Change this line */
~~~
char s[255],s1[81],*ss;
Now, Change the lines that read:
add_extended_description(u.filename,ss);
u.mask |= mask_extended;
farfree(ss);
}
nl();
if (xfer) {
ti=timer();
receive_file(s1,&ok,&u.filetype);
ti=timer()-ti;
.......................
all the way to the end of the void, replace with:
add_extended_description(u.filename,ss);
u.mask |= mask_extended;
farfree(ss);
}
nl();
if (xfer) {
ti=timer();
bi=receive_file(s1,&ok,&u.filetype,u.filename,dn); /* Change from */
ti=timer()-ti; /* This point on.*/
if (ti<0)
ti += 24.0*3600.0;
thisuser.extratime += ti;
}
if (ok) {
f=open(s1,O_RDONLY | O_BINARY);
if (f<0) {
ok=0;
nl();
nl();
pl("DOS error - File not found.");
nl();
if (u.mask & mask_extended)
delete_extended_description(u.filename);
}
}
if (ok && syscfg.upload_c[0]) {
stuff_in(s,syscfg.upload_c,create_chain_file("CHAIN.TXT"),d.path,stripfn(u.filename),"","");
close(f);
full_external(s,0,1);
f=open(s1,O_RDONLY | O_BINARY);
if (f<0) {
ok=0;
nl();
pl("File got removed.");
nl();
if (u.mask & mask_extended)
delete_extended_description(u.filename);
}
}
if (ok) {
l=filelength(f);
u.numbytes=l;
close(f);
++thisuser.uploaded;
thisuser.uk += ((l+1023)/1024);
}
if (ok || bi) {
time(&l);
u.daten=l;
for (i=numf; i>=1; i--) {
SETREC(i);
read(dlf,(void *)&u1,sizeof(uploadsrec));
SETREC(i+1);
write(dlf,(void *)&u1,sizeof(uploadsrec));
}
SETREC(1);
write(dlf,(void *)&u,sizeof(uploadsrec));
++numf;
u1.numbytes=numf;
SETREC(0);
write(dlf,(void *)&u1,sizeof(uploadsrec));
}
if (ok) {
++status.uptoday;
save_status();
sprintf(s,"+%s uploaded on %s",u.filename,directories[dn].name);
sysoplog(s);
nl();
nl();
pl("File uploaded.");
nl();
sprintf(s,"%-6.3f",ratio());
print("Your ratio is now: ",s,"");
nl();
nl();
if (useron)
topscreen();
}
}
}
closedl();
}
////////////////////// Step 9 \\\\\\\\\\\\\\\\\\\\\
File to be in editor: BBSUTL.C
Now that you're done with that little barrel - o - fun, and are
almost done, you have two more things to do! Wow, almost done!
Because the upload record is saved, even if its never used,
you need to place a small function which clears the queue
whenever the user does something to erase the batch list.. Thankfully,
the only two things which cause that are shrinking out, and
logging off.. so, load up BBSUTL.C, and ..
Search for this partion of code, in logoff()
search for:
shortmsgrec sm;
double ton;
dtr(0);
hangup=1;
and change it to read:
shortmsgrec sm;
double ton;
while(numbatch)
delbatch(0);
dtr(0);
hangup=1;
Not hard, eh? .. Well..
File to be in editor: SHRINK.C
Right near the top, right after this line:
#define READ(x) read(f,&(x),sizeof(x))
ADD the line:
extern int numbatch;
Now, in function shrink_out()..
change the code that reads:
int ok_shrink;
ok_shrink=1;
to read:
int ok_shrink;
while(numbatch)
delbatch(0);
ok_shrink=1;
Welp, you're done with the hard stuff, now one easy last thing..
////////////////////////// Step 10 \\\\\\\\\\\\\\\\\\\\\\\\
Shell out from whatever editor you're using, and make sure you save all
files. At the dos prompt, in the directory where you have your BBS files
type:
make fcns
to recreate fncs.h, which is needed because we changed the way
receive_file() is used. As soon as its done, which doesn't
take too long, go ahead and type
make
all alone and compile the sucker, because YOU ARE DONE!