Lots of updates. Finished implementing BB_FEATURE_TRIVIAL_HELP

which lets you compile out most of the "--help" output, saving
up to 17k.

Renamed mnc to nc.
 -Erik
This commit is contained in:
Erik Andersen
2000-05-12 19:41:47 +00:00
parent 3d427ac5ef
commit 7ab9c7ee52
136 changed files with 1743 additions and 454 deletions

View File

@@ -28,13 +28,17 @@
*/
#include "internal.h"
static const char gunzip_usage[] =
"gunzip [OPTION]... FILE\n\n"
"Uncompress FILE (or standard input if FILE is '-').\n\n"
"gunzip [OPTION]... FILE\n"
#ifndef BB_FEATURE_TRIVIAL_HELP
"\nUncompress FILE (or standard input if FILE is '-').\n\n"
"Options:\n"
"\t-c\tWrite output to standard output\n"
"\t-t\tTest compressed file integrity\n";
"\t-t\tTest compressed file integrity\n"
#endif
;
/* These defines are very important for BusyBox. Without these,
@@ -43,8 +47,9 @@ static const char gunzip_usage[] =
#define SMALL_MEM
#define DYN_ALLOC
#define bb_need_name_too_long
#define BB_DECLARE_EXTERN
#define bb_need_memory_exhausted
#define bb_need_name_too_long
#include "messages.c"
@@ -206,7 +211,7 @@ extern int method; /* compression method */
# define DECLARE(type, array, size) type * array
# define ALLOC(type, array, size) { \
array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \
if (array == NULL) errorMsg("insufficient memory"); \
if (array == NULL) errorMsg(memory_exhausted, "gunzip"); \
}
# define FREE(array) {if (array != NULL) free(array), array=NULL;}
#else
@@ -1053,7 +1058,7 @@ int in, out; /* input and output file descriptors */
int res = inflate();
if (res == 3) {
errorMsg("out of memory");
errorMsg(memory_exhausted, "gunzip");
} else if (res != 0) {
errorMsg("invalid compressed data--format violated");
}

View File

@@ -30,6 +30,9 @@
*/
#include "internal.h"
#define BB_DECLARE_EXTERN
#define bb_need_memory_exhausted
#include "messages.c"
/* These defines are very important for BusyBox. Without these,
* huge chunks of ram are pre-allocated making the BusyBox bss
@@ -39,12 +42,15 @@
static const char gzip_usage[] =
"gzip [OPTION]... FILE\n\n"
"Compress FILE with maximum compression.\n"
"gzip [OPTION]... FILE\n"
#ifndef BB_FEATURE_TRIVIAL_HELP
"\nCompress FILE with maximum compression.\n"
"When FILE is '-', reads standard input. Implies -c.\n\n"
"Options:\n"
"\t-c\tWrite output to standard output instead of FILE.gz\n";
"\t-c\tWrite output to standard output instead of FILE.gz\n"
#endif
;
/* I don't like nested includes, but the string and io functions are used
@@ -121,7 +127,7 @@ extern int method; /* compression method */
# define DECLARE(type, array, size) type * array
# define ALLOC(type, array, size) { \
array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \
if (array == NULL) errorMsg("insufficient memory"); \
if (array == NULL) errorMsg(memory_exhausted, "gzip"); \
}
# define FREE(array) {if (array != NULL) free(array), array=NULL;}
#else
@@ -1778,7 +1784,6 @@ int part_nb; /* number of parts in .gz file */
long time_stamp; /* original time stamp (modification time) */
long ifile_size; /* input file size, -1 for devices (debug only) */
char *env; /* contents of GZIP env variable */
char **args = NULL; /* argv pointer if GZIP env variable defined */
char z_suffix[MAX_SUFFIX + 1]; /* default suffix (can be set with --suffix) */
int z_len; /* strlen(z_suffix) */
@@ -3248,7 +3253,7 @@ char *env; /* name of environment variable */
nargv = (char **) calloc(*argcp + 1, sizeof(char *));
if (nargv == NULL)
errorMsg("out of memory");
errorMsg(memory_exhausted, "gzip");
oargv = *argvp;
*argvp = nargv;

View File

@@ -60,8 +60,9 @@ static const char tar_usage[] =
#if defined BB_FEATURE_TAR_EXCLUDE
"[--exclude File] "
#endif
"[-f tarFile] [FILE] ...\n\n"
"Create, extract, or list files from a tar file. Note that\n"
"[-f tarFile] [FILE] ...\n"
#ifndef BB_FEATURE_TRIVIAL_HELP
"\nCreate, extract, or list files from a tar file. Note that\n"
"this version of tar treats hard links as separate files.\n\n"
"Main operation mode:\n"
#ifdef BB_FEATURE_TAR_CREATE
@@ -77,6 +78,7 @@ static const char tar_usage[] =
#endif
"\nInformative output:\n"
"\tv\t\tverbosely list files processed\n"
#endif
;
/* Tar file constants */