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