1 /* Written 1999 Jan 29 by Josh Cogliati
2 I grant this program to public domain.
11 void main(int argc, char *argv[]){
12 FILE * hogfile, * readfile;
15 int fp, len, fseekret=0;
20 printf("Usage: hogcreate hogfile\n"
21 "creates hogfile using all the files in the current directory\n"
25 hogfile = fopen(argv[1],"w");
26 buf = (char *)malloc(3);
28 fwrite(buf,3,1,hogfile);
29 printf("Creating: %s\n",argv[1]);
33 while (ep = readdir(dp)) {
34 strcpy(filename, ep->d_name);
35 stat(filename,&statbuf);
36 if(! S_ISDIR(statbuf.st_mode)) {
37 printf("Filename: %s \tLength: %i\n",filename,statbuf.st_size);
38 readfile = fopen(filename,"r");
39 buf = (char *)malloc(statbuf.st_size);
41 printf("Unable to allocate memery\n");
43 fwrite(filename, 13,1,hogfile);
44 fwrite(&statbuf.st_size, sizeof(int),1,hogfile);
45 fread(buf,statbuf.st_size, 1 , readfile);
46 fwrite(buf,statbuf.st_size, 1 , hogfile);