Category : BBS Programs+Doors
Archive   : TONSMOD.ZIP
Filename : BATCH412.MOD

 
Output of file : BATCH412.MOD contained in archive : TONSMOD.ZIP
Fire Drake #1 @8424
Sun Sep 09 21:05:23 1990
Conversion for 4.12 By Fire Drake 1@8424



ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ Zmodem Batch Uploads ³
³ ³
³ Written by PC Guru ³
³ ³
³ SysOp of B.S. Box BBS ³
³ (314) 434-3470 ³
³ ³
³ WWIVnet @3458 ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ




05/23/89

This modification is the result of a request by several of our area Sysops
and myself to see a batch upload mod. Of course, PC Guru said.."Oh thats not
hard", and proceded to create what is (as far as I know) the only working Batch
Upload. This mod has been tested extensively by myself and the author on our
own boards, and so far, everything has worked great.


This .ZIP file should contain the following:

ZBATUP.MOD = This file.
ZBATUP.GFL = The Gfile to put in your gfiles (optional).


The way this procedure works
============================

The way this thing works is the user uploads all of the files he wants
using Zmodem Batch Upload to a "ZBATCH" directory. This directory will
hold all of the files until the transfer is complete. Then after all the files
have been uploaded, the user is prompted to enter the file desription(s) (using
an automated version //UPLOAD to the batch directory). After the
descriptions are all entered, the user is prompted as to where he would like
to "move" his files. Now, this relies heavily on the fact that your users are
smart enough to know where his uploads belong. It would be a simple two line
modification to allow a DAR to be set to restrict certain users from moving
the uploaded files, but I did not feel this was a necessity. Feel free to
email me if you'd like this added and don't know how.

Well, thats the basic idea. I hope you can find it useful. Now, on to
the good stuff....

Oh yeah, all complaints should be sent to the author as I take no reponsibility
for this

Dr. Spine 1@3453
SysOp of the Banana Repubic
MODIFIED FURTHER BY: Fire Drake
Sysop: Dragons Rest (804/275-6069)
1@8424
----------------------------------------------------------------------------
::: Step #1 :::

BBS.C in 4.12

First, load up BBS.C, search in void dlmainmenu() for case 'X':, and replace it
with the following procedure. I chose X since regular batch transfers are
taken care of with the 'B' option, and it was senseless having duplicate keys
for the same procedure. But you can call the Zmodem Batch with any key you
want. Be sure to update your download mainmenu to reflect this change.


case 'V': /* Existing code */
arc_l(); /* " " */
break; /* " " */
case 'X': /* Replace case 'X' with this routine */
nl(); /* add */
nl(); /* add */
if (incom) { /* add */
if (so()) /* add */
curdir=1; /* add */
else /* add */
curdir=0; /* Force user to be in correct sub */
upload1(0); /* add */
} /* add */
break; /* add */


-------------------------------------------------------------------------------
::: Step #2 :::

XFER.C in 4.12

Next load up XFER.C, and add the following routine near the start of the code,
anywhere after the extern variable declerations. NOTE: Fire Drake Has Enhanced
This version.. The Lines That I have modified are marked with my personal
symbol. Just block read in this code over the existing code.

:----------:
: }:[> :
;----------:

Drake's Symbol:
void bup()

{
directoryrec d;
char s[81],s1[81];
char ch;
outchr(12); /* Clear the screen before we start */

prt(5," The B.S. Box BBS Presents Zmodem Batch Uploads"); nl();
prt(1," ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ");
pl("");
pl("");
pl("");

/* Print users name locally */

sprintf(s," %s is currently online",thisuser.name);
outs(s);

pl("");
pl("");

}:[> prt(5,"{Z}modem or {P}uma [Z/P]"); /* Fire Drake's Enhancement */
}:[> ch=onek("ZP");

}:[> switch(ch){
}:[> case 'Z':
pl(" Please execute Zmodem from your computer now...");
nl();
pl(" Press '^X to abort transfer");

d=directories[1]; /* Read directory info */
cd_to(d.path); /* This changes to the d/l path set in WWIV */

strcpy(s1,"DSZ speed ");
strcat(s1,curspeed);
strcat(s1,"port 2"); /* Set to your comm port 1,2,3,4 */
strcat(s1," rz ");
set_protect(0); /* Turn off line scroll protection */
run_external(s1); /* Go execute Zmodem now */
}:[> break;

}:[> case 'P':
}:[> pl(" Please execute Puma from your computer now...");
}:[> nl();
}:[> pl(" Press '^X to abort transfer");

}:[> d=directories[1]; /* Read directory info */
}:[> cd_to(d.path); /* This changes to the d/l path set in WWIV */

}:[> strcpy(s1,"PUMA speed ");
}:[> strcat(s1,curspeed);
}:[> strcat(s1,"port 2"); /* Set to your comm port 1,2,3,4 */
}:[> strcat(s1," r ");
}:[> set_protect(0); /* Turn off line scroll protection */
}:[> run_external(s1); /* Go execute PUMA now */
}:[> break;
}:[> } /* End Of Fire Drake's Enhancement */
}

------------------------------------------------------------------------------
::: Step #3 :::
Add this block after the void bup() block you installed in step #2.

void move_upload() /* Move all the uploaded files */
{
char sx[81],s[81],s1[81],s2[81],s3[81],ch,*ss;
int i,i1,ok,d1,d2,done,cp;
uploadsrec u,u1,u2;
char *b;

ok=0;
nl();
nl();

prt(2," Now moving all uploaded files "); nl();
prt(1," ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ "); nl();
strcpy(sx,"*.*"); /* Do all the files in directory */
align(sx);

dliscan();

i=recno(sx);
done=0;
while ((!hangup) && (i>0) && (!done)) {
cp=i;
SETREC(i);
read(dlf,(void *)&u,sizeof(uploadsrec));

if (!so())
strcpy(s1,directories[0].path);
else
strcpy(s1,directories[1].path);

strcat(s1,u.filename);
do {
nl();
nl();
strcpy(s3,u.filename);
prt(7,"Move ");
prt(2,stripfn(s3));
prt(7," to which directory (? for list) ? ");
ss=mmkey(1);
if (ss[0]=='?')
dirlist();
} while ((!hangup) && (ss[0]=='?'));
d1=-1;
if (ss[0])
for (i1=0; i1<64; i1++)
if (strcmp(udir[i1].keys,ss)==0)
d1=i1;
if (d1!=-1) {
ok=1;
d1=udir[d1].subnum;
closedl();
dliscan1(d1);
if (recno(u.filename)>0) {
ok=0;
nl();
pl("Filename already in use in that directory.");
}
if (numf>=directories[d1].maxfiles) {
ok=0;
nl();
pl("Too many files in that directory, notify SysOp.");
}
if (freek1(directories[d1].path)<((double)(u.numbytes/1024L)+3)) {
ok=0;
nl();
pl("Not enough disk space to move it, please notify SysOp.");
}
closedl();
dliscan();
}
if (ok) {
--cp;
for (i1=i; i1 SETREC(i1+1);
read(dlf,(void *)&u1,sizeof(uploadsrec));
SETREC(i1);
write(dlf,(void *)&u1,sizeof(uploadsrec));
}
--numf;
u1.numbytes=numf;
SETREC(0);
write(dlf,(void *)&u1,sizeof(uploadsrec));
closedl();

strcpy(s2,directories[d1].path);
strcat(s2,u.filename);
dliscan1(d1);
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));
closedl();

if (strcmp(s1,s2)!=0) {
d2=0;
if ((s1[1]!=':') && (s2[1]!=':'))
d2=1;
if ((s1[1]==':') && (s2[1]==':') && (s1[0]==s2[0]))
d2=1;
if (d2) {
rename(s1,s2);
unlink(s1);
} else {
b=(char *)farmalloc(16400);
d1=open(s1,O_RDONLY | O_BINARY);
d2=open(s2,O_RDWR | O_BINARY | O_CREAT, S_IREAD | S_IWRITE);
i=read(d1,(void *)b,16384);
while (i>0) {
write(d2,(void *)b,i);
i=read(d1,(void *)b,16384);
}
close(d1);
close(d2);
unlink(s1);
farfree(b);
}
}
nl();
pl("File moved.");
} else
closedl();

dliscan();

i=nrecno(sx,cp);
}
closedl();
}


-------------------------------------------------------------------------------
::: Step #4 :::

Next, still in XFER.C, search for 'void upload(int dn)' and add this
procedure right after it. This procedure is a simplified duplication of
the previous function, without the need for filenames to be passed.



void upload1(int dn) /* New Batch upload call */
{
directoryrec d;
int i,ok,f;
char s[81],s1[81];
long l;
double ti;


/* Check for space on drive */

dliscan1(dn);
d=directories[dn];
ti=freek1((d.path));
ltoa((long) (ti),s1,10);
if (ti<150.0) { /* Check >150k, change to suit */
pl("Not enough disk space to upload here.");
nl();
closedl();
return;
}


ti=timer(); /* Save the current time */

/* Call Batch Upload Routine */

bup();

/* Credit the user for d/l time */

ti=timer()-ti;
if (ti<0)
ti += 24.0*3600.0;
thisuser.extratime += ti;

/* Write the xfer to the sysop log */

s[0]='+';
strcat(s," *=* Used Zmodem Batch to upload the following *=*");
sysoplog(s);

/* Notify users it was completed */
/* Note: Currently, no provision for aborted d/l's, to be added soon */

pl("File(s) uploaded.");
topscreen();
closedl();
nl();
nl();
prt(3," Please enter file descriptions now"); nl();
prt(2," ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ"); nl();
nl();

if (!so())
uploadall(udir[0].subnum); /* Now get the descriptions */
else
uploadall(udir[1].subnum); /* SysOp will need to move up */
/* one directory */
move_upload(); /* Now all user to move them */

}



------------------------------------------------------------------------------
::: Step #5 :::

XFEROVL.C

In procedure 'int uploadall()', one line needs to be deleted so that only th
files that need descriptions will be printed. This will also serve the for
general purpose bbs local //uploads, so that all the descriptions don't need
to be displayed every time you want to go through your descriptions to upload.


if (i==-1) { /* Existing code */
if (!upload_file(s,dn)) /* " " */
ok=0; /* " " */
} else { /* " " */
SETREC(i); /* " " */
read(dlf,(void *)&u, sizeof(uploadsrec));/* " " */
printinfo(&u,&i1); /* Delete this line */
}
f1=findnext(&ff); /* Existing code */
------------------------------------------------------------------------------
::: Step #6 :::

The final step in the source code modifications is to update the FCNS.H file
to reflect the new function calls.

int printfileinfo(uploadsrec *u); /* Existing Code, search for */
void upload(int dn); /* Existing Code */
void upload1(int dn); /* Add */
void bup(); /* Add */
void move_upload(); /* Add */

After inserting the above line, hit F9 to recompile the entire bbs, and
move the new bbs.exe into your bbs directory.

------------------------------------------------------------------------------
::: Step #7 :::

That's it for the source modifications, now you need to add a file transfer
directory for the batch uploads to go to. Create a NEW directory #1, so that
Zmodem batch will be the new #1 file directory. The other information, such as
DAR, security level, and max. files, is left up to you, and is independent of
this mod.

That completes all the WWIV modifications and setup. The final step in
this modification is to update your dos PATH command. You'll need to add in
a drive and path so DSZ can be found no matter which subdirectory or drive
the bbs is currently on. An example would be path=C:\bbs (if Zmodem is in your
bbs subdirectory). The drive IS required if you operate your downloads
on a different drive than the bbs drive. I wrote the modification this way
since not everyone is running a registered copy of Zmodem (shame on you), and
unless your copy is registered, uploads will only go to the current directory.


One other thing.. in your AUTOEXEC.BAT file.. add these two lines before
the call for running the bbs..

set dszlog=C:\wwiv\dszlog.xyz
set namefile=c:\wwiv\namefile.xyz

These lines are pointers that the bbs needs in order for it to allow batch
transfers


Well, that should cover the entire setup, and you should now have working
batch uploads! If you have any questions or comments, feel free to call my
board and email me, or netmail 1@3458. I welcome any changes or addtions to
this modification, since I realize my code may be a little sloppy, but I've
only been able to 'C' since January, so am still learning many things.

One thing I need to add yet is a check for aborted files and transfers
where no files where uploaded. Just checking on an error code won't work,
since 3 files may have been uploaded successfully, but then the 4th may have
an error, so you don't want the ALL the files deleted. Currently, even if
no files are uploaded, the modification will still go through the description
section, and move, although the user will not be prompted for anything, and
then the dl main menu will come back up.

Also, thanks to Dr. Spine for writing up portions of this documentation,
since I hate writing (and reading) docs for anything. Also, thanks to all
the St. Louis sysops including Tuck, Birdhunter, Allen, Fred and others for
the encouragements for me to write this modification.


Disclaimer: The author of this modification takes no responsibilty for
any corruption of your files, user mistakes, or other errors
that may occur, for any reason. This modification has been
extensively tested by many local St. Louis sysops, with no
errors to be found.



PC Guru 1@3458
Send Comments or suggestions to: SysOp of The B.S. Box BBS
(314) 434-347

Fire Drake Notes:
I am fairly confident that my enhancement will pose no problems to anyone.
If, however, there appears to be a problem, let me know what it is, and if
you fixed it, tell me how you did so. I do not claim to be the author of
this entire mod. I only ask that recognition for my attempt at making a good
mod seem better, with the ability to add more protocols into it.
To add more, follow the example one I put in for Puma,
change:
ch=onek("ZP");
to include what ever protocols you want, if you want, say, Ymodem in it,
ch=onek("ZY");
then change case 'P' to case "Y'
then change the area where it says "Puma speed"
to DSZ speed
then on the r
change it to ry

that should do it.
>Fire Drake<


  3 Responses to “Category : BBS Programs+Doors
Archive   : TONSMOD.ZIP
Filename : BATCH412.MOD

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/