1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
diff -urNX busybox-1.00/runlevel/diff_excludes busybox-1.00-original/archival/gzip.c busybox-1.00/archival/gzip.c
--- busybox-1.00-original/archival/gzip.c 2004-04-15 03:51:08.000000000 +1000
+++ busybox-1.00/archival/gzip.c 2005-02-08 19:05:02.000000000 +1000
@@ -13,6 +13,9 @@
* files as well as stdin/stdout, and to generally behave itself wrt
* command line handling.
*
+ * Adjusted further by David Seikel <won_fang@yahoo.cam.au> to support
+ * just storing the file.
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@@ -72,6 +75,8 @@
/* methods 4 to 7 reserved */
#define DEFLATED 8
+int just_store = 0;
+
/* To save memory for 16 bit systems, some arrays are overlaid between
* the various modules:
* deflate: prev+head window d_buf l_buf outbuf
@@ -1202,7 +1207,7 @@
int force = 0;
int opt;
- while ((opt = getopt(argc, argv, "cf123456789dq")) != -1) {
+ while ((opt = getopt(argc, argv, "cf0123456789dq")) != -1) {
switch (opt) {
case 'c':
tostdout = 1;
@@ -1210,6 +1215,11 @@
case 'f':
force = 1;
break;
+
+ case '0':
+ just_store = 1;
+ break;
+
/* Ignore 1-9 (compression level) options */
case '1':
case '2':
@@ -2267,7 +2277,7 @@
* and if the zip file can be seeked (to rewrite the local header),
* the whole file is transformed into a stored file:
*/
- if (stored_len <= opt_lenb && eof && compressed_len == 0L && seekable()) {
+ if ((just_store || (stored_len <= opt_lenb)) && eof && compressed_len == 0L && seekable()) {
/* Since LIT_BUFSIZE <= 2*WSIZE, the input data must be there: */
if (buf == (char *) 0)
bb_error_msg("block vanished");
@@ -2276,7 +2286,7 @@
compressed_len = stored_len << 3;
*file_method = STORED;
- } else if (stored_len + 4 <= opt_lenb && buf != (char *) 0) {
+ } else if ((just_store || (stored_len + 4 <= opt_lenb)) && buf != (char *) 0) {
/* 4: two words for the lengths */
/* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.
* Otherwise we can't have processed more than WSIZE input bytes since
|