diff options
Diffstat (limited to 'archival')
-rw-r--r-- | archival/gunzip.c | 17 | ||||
-rw-r--r-- | archival/gzip.c | 17 | ||||
-rw-r--r-- | archival/tar.c | 6 |
3 files changed, 26 insertions, 14 deletions
diff --git a/archival/gunzip.c b/archival/gunzip.c index bdf8dc293..11fc3a8f9 100644 --- a/archival/gunzip.c +++ b/archival/gunzip.c | |||
@@ -28,13 +28,17 @@ | |||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "internal.h" | 30 | #include "internal.h" |
31 | |||
31 | static const char gunzip_usage[] = | 32 | static const char gunzip_usage[] = |
32 | "gunzip [OPTION]... FILE\n\n" | 33 | "gunzip [OPTION]... FILE\n" |
33 | "Uncompress FILE (or standard input if FILE is '-').\n\n" | 34 | #ifndef BB_FEATURE_TRIVIAL_HELP |
35 | "\nUncompress FILE (or standard input if FILE is '-').\n\n" | ||
34 | "Options:\n" | 36 | "Options:\n" |
35 | 37 | ||
36 | "\t-c\tWrite output to standard output\n" | 38 | "\t-c\tWrite output to standard output\n" |
37 | "\t-t\tTest compressed file integrity\n"; | 39 | "\t-t\tTest compressed file integrity\n" |
40 | #endif | ||
41 | ; | ||
38 | 42 | ||
39 | 43 | ||
40 | /* These defines are very important for BusyBox. Without these, | 44 | /* These defines are very important for BusyBox. Without these, |
@@ -43,8 +47,9 @@ static const char gunzip_usage[] = | |||
43 | #define SMALL_MEM | 47 | #define SMALL_MEM |
44 | #define DYN_ALLOC | 48 | #define DYN_ALLOC |
45 | 49 | ||
46 | #define bb_need_name_too_long | ||
47 | #define BB_DECLARE_EXTERN | 50 | #define BB_DECLARE_EXTERN |
51 | #define bb_need_memory_exhausted | ||
52 | #define bb_need_name_too_long | ||
48 | #include "messages.c" | 53 | #include "messages.c" |
49 | 54 | ||
50 | 55 | ||
@@ -206,7 +211,7 @@ extern int method; /* compression method */ | |||
206 | # define DECLARE(type, array, size) type * array | 211 | # define DECLARE(type, array, size) type * array |
207 | # define ALLOC(type, array, size) { \ | 212 | # define ALLOC(type, array, size) { \ |
208 | array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \ | 213 | array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \ |
209 | if (array == NULL) errorMsg("insufficient memory"); \ | 214 | if (array == NULL) errorMsg(memory_exhausted, "gunzip"); \ |
210 | } | 215 | } |
211 | # define FREE(array) {if (array != NULL) free(array), array=NULL;} | 216 | # define FREE(array) {if (array != NULL) free(array), array=NULL;} |
212 | #else | 217 | #else |
@@ -1053,7 +1058,7 @@ int in, out; /* input and output file descriptors */ | |||
1053 | int res = inflate(); | 1058 | int res = inflate(); |
1054 | 1059 | ||
1055 | if (res == 3) { | 1060 | if (res == 3) { |
1056 | errorMsg("out of memory"); | 1061 | errorMsg(memory_exhausted, "gunzip"); |
1057 | } else if (res != 0) { | 1062 | } else if (res != 0) { |
1058 | errorMsg("invalid compressed data--format violated"); | 1063 | errorMsg("invalid compressed data--format violated"); |
1059 | } | 1064 | } |
diff --git a/archival/gzip.c b/archival/gzip.c index cc6868b53..17ebf6cb7 100644 --- a/archival/gzip.c +++ b/archival/gzip.c | |||
@@ -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 | ||
diff --git a/archival/tar.c b/archival/tar.c index c82e51fe9..6784d80ff 100644 --- a/archival/tar.c +++ b/archival/tar.c | |||
@@ -60,8 +60,9 @@ static const char tar_usage[] = | |||
60 | #if defined BB_FEATURE_TAR_EXCLUDE | 60 | #if defined BB_FEATURE_TAR_EXCLUDE |
61 | "[--exclude File] " | 61 | "[--exclude File] " |
62 | #endif | 62 | #endif |
63 | "[-f tarFile] [FILE] ...\n\n" | 63 | "[-f tarFile] [FILE] ...\n" |
64 | "Create, extract, or list files from a tar file. Note that\n" | 64 | #ifndef BB_FEATURE_TRIVIAL_HELP |
65 | "\nCreate, extract, or list files from a tar file. Note that\n" | ||
65 | "this version of tar treats hard links as separate files.\n\n" | 66 | "this version of tar treats hard links as separate files.\n\n" |
66 | "Main operation mode:\n" | 67 | "Main operation mode:\n" |
67 | #ifdef BB_FEATURE_TAR_CREATE | 68 | #ifdef BB_FEATURE_TAR_CREATE |
@@ -77,6 +78,7 @@ static const char tar_usage[] = | |||
77 | #endif | 78 | #endif |
78 | "\nInformative output:\n" | 79 | "\nInformative output:\n" |
79 | "\tv\t\tverbosely list files processed\n" | 80 | "\tv\t\tverbosely list files processed\n" |
81 | #endif | ||
80 | ; | 82 | ; |
81 | 83 | ||
82 | /* Tar file constants */ | 84 | /* Tar file constants */ |