4 static const char usage[] =
6 "zzipsetstub <zipfile> <zipsfxstub>... \n"
7 " overwrite the header of the zipfile with the sfxstub code.\n"
8 " this is usually the last step in creating a selfextract archive\n"
9 " or an application with all its data appended as a zip.\n"
13 main (int argc, char ** argv)
24 char* zipfile = 0; FILE* zipFILE = 0;
25 char* sfxfile = 0; FILE* sfxFILE = 0;
27 for (argn=1; argn < argc; argn++)
29 if (argv[argn][0] == '-') continue;
30 if (! zipfile) { zipfile = argv[argn]; continue; }
31 if (! sfxfile) { sfxfile = argv[argn]; continue; }
32 /* superflous argument */
35 zipFILE = fopen (zipfile, "r+b");
36 if (! zipFILE) { perror (zipfile); return 1; }
38 sfxFILE = fopen (sfxfile, "rb");
39 if (! sfxFILE) { perror (sfxfile); return 1; }
41 while (0 < (n = fread(buf, 1, 16, sfxFILE)))
44 fwrite (buf, 1, n, zipFILE);
59 * c-file-style: "stroustrup"