#include <io.h>
#include <dos.h>
#include <bios.h>
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <stdlib.h>
#include <alloc.h>
#include <time.h>
#define TRUE 1
#define FALSE 0
char vocfile[20];
char *tempbuf;
main(int argc, char **argv)
{
FILE *vocf, *outf, *voclistf, *offsetf;
char vfile[20];
unsigned int numread, i, first_voc = TRUE;
unsigned long offset;
if(argc > 2) {
voclistf = fopen(argv[1], "rt");
outf = fopen(argv[2], "wb");
offsetf = fopen("voc_offs.c", "wt");
fprintf(offsetf, "unsigned long voc_offs[] = {");
tempbuf = malloc(50000);
offset = 0L;
while(fgets(vocfile,80,voclistf)) {
vocfile[strlen(vocfile)-1] = 0;
strcpy(vfile,vocfile);
strcat(vfile,".VOC");
if(! (vocf=fopen(vfile, "rb"))) {
printf("Couldn't find %s!\n", vfile);
break;
}
numread = fread(tempbuf, 1, 50000, vocf);
fclose(vocf);
fwrite(tempbuf, 1, numread, outf);
if(! first_voc)
fprintf(offsetf, ",", offset);
fprintf(offsetf, "\n\t%ldL", offset);
first_voc = FALSE;
offset += (unsigned long)numread;
}
fprintf(offsetf, "\n};");
fclose(voclistf);
fclose(outf);
fclose(offsetf);
printf("Ok.\n");
} else {
printf("VOC Masher v1.0\n");
printf("usage: vocmash <voclistfile> <outfile>\n\n");
printf("The VOC list file should contain the names of all the\n");
printf("VOC files to mash, one name per line\n");
}
}