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