home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Devil's Doorknob BBS Capture (1996-2003)
/
devilsdoorknobbbscapture1996-2003.iso
/
Dloads
/
WWIVMODS
/
MODSUNKN.ZIP
/
WWIV2ZIP.MOD
< prev
next >
Wrap
Text File
|
1992-01-29
|
6KB
|
144 lines
WWIV2ZIP.C Source code --- Finally!!
/*------------------------------------------------------------*/
/* Bilbo Baggin's WWIV TO ZIP conversion utility. Version 1.0 */
/* Released to the Public Domain on 3-17-89 */
/*------------------------------------------------------------*/
/* */
/* Sorry I didn't get this out as son as promised, but a tiny */
/* mistake on my part (and Turbo C's) caused me one heck of */
/* a lot of searching for the tiniest of bugs. It seems that */
/* omitting IO.H does not cause a compiler error, though it */
/* certainly should! Try it for laughs. */
/* */
/* You may not need this now, since Doug Field's blatantly */
/* stole my idea, but it may be good for future reference in */
/* case there is need for further conversion. */
/* */
/* Please note that I give this source code freely and w/o */
/* obligation on your part or mine. You accept all risks of */
/* using this program and I expect nothing in return if you */
/* use it, other than a "Thanks, Bilbo." if you feel so */
/* inclined. */
/* */
/* Note that the programming here is not 100% efficient and */
/* you may want to tidy some things up, but for the most part */
/* it's good enuff. What do you want for free?? Hehehehe!!!! */
/* */
#include <stdio.h>
#include <fcntl.h>
#include <ctype.h>
#include <stdlib.h>
#include <io.h>
/* DATA HELD FOR EVERY UPLOAD */
typedef struct {
char filename[13], /* filename */
description[59], /* file description */
date[9], /* date u/l'ed */
upby[46]; /* name of upload user */
unsigned char filetype; /* file type for apples */
unsigned short numdloads, /* number times d/l'ed */
ownersys,ownerusr, /* who uploaded it */
mask; /* file type mask */
unsigned long daten, /* date uploaded */
numbytes; /* number bytes long file is */
} uploadsrec;
makefile(fn1,fn2,subdir)
char fn1[14],fn2[14],subdir[40];
{
static int fp,fq,fr,i,j;
static uploadsrec up;
static uploadsrec new_up;
static long thisrec, reccnt;
static char str[13],s[54];
reccnt = 0;
fr=open(fn1, (O_BINARY));
fp=open(fn2,( O_CREAT | O_APPEND | O_BINARY ));
thisrec = filelength(fr) / (long)sizeof(uploadsrec);
while (reccnt < thisrec)
{
lseek(fr, (reccnt) * (long)sizeof(uploadsrec), SEEK_SET);
read(fr, (void *)(&up), sizeof(uploadsrec));
strcpy(s," ");
strcpy(s,subdir);
j = 0;
strcpy(str," ");
for (i=0;i<9 ;i++ ) {
if (up.filename[i] != ' '){
str[j] = up.filename[i] ;
j++;
}
new_up.filename[i] = up.filename[i];
}
new_up.filename[9] = 'Z';
new_up.filename[10] = 'I';
new_up.filename[11] = 'P';
str[j] = 'Z';
str[j+1] = 'I';
str[j+2] = 'P';
strcat(s,str);
printf("Searching for file %s\n",str);
fq=open(s,O_RDONLY | O_BINARY);
new_up.numbytes = filelength(fq) ;
if (fq<0) {
printf("DOS error - File not found.\n\n");
new_up.numbytes = 0 ;
}
close(fq);
if (reccnt == 0 )
new_up.numbytes = up.numbytes ;
for (i=0;i<53 ;i++ )
new_up.description[i] = up.description[i];
for (i=0;i<8 ;i++ )
new_up.date[i] = up.date[i];
for (i=0;i<45 ;i++ )
new_up.upby[i] = up.upby[i];
new_up.filetype = up.filetype;
new_up.numdloads = up.numdloads;
new_up.ownersys = up.ownersys;
new_up.ownerusr = up.ownerusr;
new_up.mask = up.mask;
new_up.daten = up.daten;
write(fp, (void *)(&new_up), sizeof(uploadsrec));
reccnt++;
}
close(fp);
close(fr);
}
main()
{
char s[13],s1[13],subdir[40];
char answer[2];
printf("Welcome to Bilbo Baggins' WWIV to ZIP conversion program!!\n\n");
printf("Contact me at 1@7303 if you have questions/problems.\n\n\n");
do {
printf("Enter the name of the .DIR file you want converted, \n\n");
printf("Enter filename ONLY (ie NO extension) :");
scanf("%s",&s);
printf("Enter drive/directory the ZIPs are in ( ex. D:\\GAMES\\NEW\\ ) :");
scanf("%s",&subdir);
strcpy(s1,s);
strcat(s,".DIR");
strcat(s1,".NEW");
printf("Converting %s to %s ...",s,s1);
makefile(&s,&s1,&subdir);
printf("Convert another .DIR file ?? ");
scanf("%s",&answer);
} while (toupper(answer[0]) == 'Y' );
}
_______________________________________________________________________________