diff options
Diffstat (limited to 'gzip.c')
-rw-r--r-- | gzip.c | 17 |
1 files changed, 11 insertions, 6 deletions
@@ -30,6 +30,9 @@ | |||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include "internal.h" | 32 | #include "internal.h" |
33 | #define BB_DECLARE_EXTERN | ||
34 | #define bb_need_memory_exhausted | ||
35 | #include "messages.c" | ||
33 | 36 | ||
34 | /* These defines are very important for BusyBox. Without these, | 37 | /* These defines are very important for BusyBox. Without these, |
35 | * huge chunks of ram are pre-allocated making the BusyBox bss | 38 | * huge chunks of ram are pre-allocated making the BusyBox bss |
@@ -39,12 +42,15 @@ | |||
39 | 42 | ||
40 | 43 | ||
41 | static const char gzip_usage[] = | 44 | static const char gzip_usage[] = |
42 | "gzip [OPTION]... FILE\n\n" | 45 | "gzip [OPTION]... FILE\n" |
43 | "Compress FILE with maximum compression.\n" | 46 | #ifndef BB_FEATURE_TRIVIAL_HELP |
47 | "\nCompress FILE with maximum compression.\n" | ||
44 | "When FILE is '-', reads standard input. Implies -c.\n\n" | 48 | "When FILE is '-', reads standard input. Implies -c.\n\n" |
45 | 49 | ||
46 | "Options:\n" | 50 | "Options:\n" |
47 | "\t-c\tWrite output to standard output instead of FILE.gz\n"; | 51 | "\t-c\tWrite output to standard output instead of FILE.gz\n" |
52 | #endif | ||
53 | ; | ||
48 | 54 | ||
49 | 55 | ||
50 | /* I don't like nested includes, but the string and io functions are used | 56 | /* I don't like nested includes, but the string and io functions are used |
@@ -121,7 +127,7 @@ extern int method; /* compression method */ | |||
121 | # define DECLARE(type, array, size) type * array | 127 | # define DECLARE(type, array, size) type * array |
122 | # define ALLOC(type, array, size) { \ | 128 | # define ALLOC(type, array, size) { \ |
123 | array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \ | 129 | array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \ |
124 | if (array == NULL) errorMsg("insufficient memory"); \ | 130 | if (array == NULL) errorMsg(memory_exhausted, "gzip"); \ |
125 | } | 131 | } |
126 | # define FREE(array) {if (array != NULL) free(array), array=NULL;} | 132 | # define FREE(array) {if (array != NULL) free(array), array=NULL;} |
127 | #else | 133 | #else |
@@ -1778,7 +1784,6 @@ int part_nb; /* number of parts in .gz file */ | |||
1778 | long time_stamp; /* original time stamp (modification time) */ | 1784 | long time_stamp; /* original time stamp (modification time) */ |
1779 | long ifile_size; /* input file size, -1 for devices (debug only) */ | 1785 | long ifile_size; /* input file size, -1 for devices (debug only) */ |
1780 | char *env; /* contents of GZIP env variable */ | 1786 | char *env; /* contents of GZIP env variable */ |
1781 | char **args = NULL; /* argv pointer if GZIP env variable defined */ | ||
1782 | char z_suffix[MAX_SUFFIX + 1]; /* default suffix (can be set with --suffix) */ | 1787 | char z_suffix[MAX_SUFFIX + 1]; /* default suffix (can be set with --suffix) */ |
1783 | int z_len; /* strlen(z_suffix) */ | 1788 | int z_len; /* strlen(z_suffix) */ |
1784 | 1789 | ||
@@ -3248,7 +3253,7 @@ char *env; /* name of environment variable */ | |||
3248 | nargv = (char **) calloc(*argcp + 1, sizeof(char *)); | 3253 | nargv = (char **) calloc(*argcp + 1, sizeof(char *)); |
3249 | 3254 | ||
3250 | if (nargv == NULL) | 3255 | if (nargv == NULL) |
3251 | errorMsg("out of memory"); | 3256 | errorMsg(memory_exhausted, "gzip"); |
3252 | oargv = *argvp; | 3257 | oargv = *argvp; |
3253 | *argvp = nargv; | 3258 | *argvp = nargv; |
3254 | 3259 | ||