diff options
author | Glenn L McGrath <bug1@ihug.co.nz> | 2002-11-01 22:11:53 +0000 |
---|---|---|
committer | Glenn L McGrath <bug1@ihug.co.nz> | 2002-11-01 22:11:53 +0000 |
commit | 9ef09444568cc15c719daec8d8b6bc38776b770e (patch) | |
tree | cfc468a648fc43d49a0fe6bd27c7c46d2e3d1c85 | |
parent | b2f67b406893b228e9cc50160a448e85c196e506 (diff) | |
download | busybox-w32-9ef09444568cc15c719daec8d8b6bc38776b770e.tar.gz busybox-w32-9ef09444568cc15c719daec8d8b6bc38776b770e.tar.bz2 busybox-w32-9ef09444568cc15c719daec8d8b6bc38776b770e.zip |
Allow the .Z prefix if compress support enabled
-rw-r--r-- | archival/gunzip.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/archival/gunzip.c b/archival/gunzip.c index fff3a6577..b6f3e08ea 100644 --- a/archival/gunzip.c +++ b/archival/gunzip.c | |||
@@ -143,6 +143,11 @@ extern int gunzip_main(int argc, char **argv) | |||
143 | new_path = xstrdup(old_path); | 143 | new_path = xstrdup(old_path); |
144 | 144 | ||
145 | extension = strrchr(new_path, '.'); | 145 | extension = strrchr(new_path, '.'); |
146 | #ifdef CONFIG_FEATURE_UNCOMPRESS | ||
147 | if (extension && (strcmp(extension, ".Z") == 0)) { | ||
148 | *extension = '\0'; | ||
149 | } else | ||
150 | #endif | ||
146 | if (extension && (strcmp(extension, ".gz") == 0)) { | 151 | if (extension && (strcmp(extension, ".gz") == 0)) { |
147 | *extension = '\0'; | 152 | *extension = '\0'; |
148 | } else if (extension && (strcmp(extension, ".tgz") == 0)) { | 153 | } else if (extension && (strcmp(extension, ".tgz") == 0)) { |
@@ -169,22 +174,21 @@ extern int gunzip_main(int argc, char **argv) | |||
169 | magic2 = xread_char(src_fd); | 174 | magic2 = xread_char(src_fd); |
170 | #ifdef CONFIG_FEATURE_UNCOMPRESS | 175 | #ifdef CONFIG_FEATURE_UNCOMPRESS |
171 | if (magic2 == 0x9d) { | 176 | if (magic2 == 0x9d) { |
172 | printf("uncompress\n"); | 177 | status = uncompress(src_fd, dst_fd); |
173 | return(uncompress(src_fd, dst_fd)); | ||
174 | } else | 178 | } else |
175 | #endif | 179 | #endif |
176 | if (magic2 == 0x8b) { | 180 | if (magic2 == 0x8b) { |
177 | check_header_gzip(src_fd); | 181 | check_header_gzip(src_fd); |
178 | status = inflate(src_fd, dst_fd); | 182 | status = inflate(src_fd, dst_fd); |
179 | if (status != 0) { | 183 | if (status != 0) { |
180 | error_msg("Error inflating"); | 184 | error_msg_and_die("Error inflating"); |
181 | } | 185 | } |
182 | check_trailer_gzip(src_fd); | 186 | check_trailer_gzip(src_fd); |
183 | } else { | 187 | } else { |
184 | error_msg_and_die("Invalid magic\n"); | 188 | error_msg_and_die("Invalid magic"); |
185 | } | 189 | } |
186 | } else { | 190 | } else { |
187 | error_msg_and_die("Invalid magic\n"); | 191 | error_msg_and_die("Invalid magic"); |
188 | } | 192 | } |
189 | 193 | ||
190 | if ((status != EXIT_SUCCESS) && (new_path)) { | 194 | if ((status != EXIT_SUCCESS) && (new_path)) { |