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, *writefile;
22 printf("Usage: hogextract hogfile\n"
23 "extracts all the files in hogfile into the current directory\n");
26 hogfile = fopen(argv[1], "r");
27 stat(argv[1], &statbuf);
28 printf("%i\n", (int)statbuf.st_size);
29 buf = (char *)malloc(3);
30 fread(buf, 3, 1, hogfile);
31 printf("Extracting from: %s\n", argv[1]);
33 while(ftell(hogfile)<statbuf.st_size) {
34 fread(filename, 13, 1, hogfile);
35 fread(&len, sizeof(int), 1, hogfile);
36 printf("Filename: %s \tLength: %i\n", filename, len);
37 buf = (char *)malloc(len);
39 printf("Unable to allocate memory\n");
41 fread(buf, len, 1, hogfile);
42 writefile = fopen(filename, "w");
43 fwrite(buf, len, 1, writefile);