diff options
Diffstat (limited to 'minigzip.c')
-rw-r--r-- | minigzip.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -66,7 +66,7 @@ char *prog; | |||
66 | void error OF((const char *msg)); | 66 | void error OF((const char *msg)); |
67 | void gz_compress OF((FILE *in, gzFile out)); | 67 | void gz_compress OF((FILE *in, gzFile out)); |
68 | void gz_uncompress OF((gzFile in, FILE *out)); | 68 | void gz_uncompress OF((gzFile in, FILE *out)); |
69 | void file_compress OF((char *file)); | 69 | void file_compress OF((char *file, char *mode)); |
70 | void file_uncompress OF((char *file)); | 70 | void file_uncompress OF((char *file)); |
71 | int main OF((int argc, char *argv[])); | 71 | int main OF((int argc, char *argv[])); |
72 | 72 | ||
@@ -135,8 +135,9 @@ void gz_uncompress(in, out) | |||
135 | * Compress the given file: create a corresponding .gz file and remove the | 135 | * Compress the given file: create a corresponding .gz file and remove the |
136 | * original. | 136 | * original. |
137 | */ | 137 | */ |
138 | void file_compress(file) | 138 | void file_compress(file, mode) |
139 | char *file; | 139 | char *file; |
140 | char *mode; | ||
140 | { | 141 | { |
141 | local char outfile[MAX_NAME_LEN]; | 142 | local char outfile[MAX_NAME_LEN]; |
142 | FILE *in; | 143 | FILE *in; |
@@ -150,7 +151,7 @@ void file_compress(file) | |||
150 | perror(file); | 151 | perror(file); |
151 | exit(1); | 152 | exit(1); |
152 | } | 153 | } |
153 | out = gzopen(outfile, "wb"); /* use "wb9" for maximal compression */ | 154 | out = gzopen(outfile, mode); |
154 | if (out == NULL) { | 155 | if (out == NULL) { |
155 | fprintf(stderr, "%s: can't gzopen %s\n", prog, outfile); | 156 | fprintf(stderr, "%s: can't gzopen %s\n", prog, outfile); |
156 | exit(1); | 157 | exit(1); |
@@ -253,7 +254,7 @@ int main(argc, argv) | |||
253 | if (uncompr) { | 254 | if (uncompr) { |
254 | file_uncompress(*argv); | 255 | file_uncompress(*argv); |
255 | } else { | 256 | } else { |
256 | file_compress(*argv); | 257 | file_compress(*argv, outmode); |
257 | } | 258 | } |
258 | } while (argv++, --argc); | 259 | } while (argv++, --argc); |
259 | } | 260 | } |