2 * Written 1999 Jan 29 by Josh Cogliati
3 * I grant this program to public domain.
12 main(int argc, char *argv[])
14 FILE *hogfile, *writefile;
15 int fp, len, fseekret=0;
21 printf("Usage: hogextract hogfile\n"
22 "extracts all the files in hogfile into the current directory\n");
25 hogfile = fopen(argv[1], "r");
26 stat(argv[1], &statbuf);
27 printf("%i\n", statbuf.st_size);
28 buf = (char *)malloc(3);
29 fread(buf, 3, 1, hogfile);
30 printf("Extracting from: %s\n", argv[1]);
32 while(ftell(hogfile)<statbuf.st_size) {
33 fread(filename, 13, 1, hogfile);
34 fread(&len, sizeof(int), 1, hogfile);
35 printf("Filename: %s \tLength: %i\n", filename, len);
36 buf = (char *)malloc(len);
38 printf("Unable to allocate memory\n");
40 fread(buf, len, 1, hogfile);
41 writefile = fopen(filename, "w");
42 fwrite(buf, len, 1, writefile);