mirror of
https://github.com/ckolivas/lrzip.git
synced 2026-01-05 16:10:00 +01:00
Update lrzip.conf parser to respect -U, -H, -T, k, and -c options.
Further updates to documentation. Changes by Peter Hyman <pete@peterhyman.com>
This commit is contained in:
parent
d90f670fbd
commit
a0ab78ba8d
|
|
@ -21,20 +21,20 @@ consistent with CFLAGS.
|
|||
* Update benchmarks.
|
||||
* Add verbose and max verbose modes for -i information giving a breakdown of
|
||||
each rzip chunk and compressed block.
|
||||
* Modify purpose of -T threshold option to mean Disable LZO pre-compression
|
||||
testing. Threshold level test deprecated.
|
||||
|
||||
FEBRUARY 2011, Peter Hyman
|
||||
* Minor updates to man pages, lrzip.conf example file.
|
||||
* Update main help screen to include environment settings.
|
||||
* Update to respect $TMP environment variable for TMP files.
|
||||
* Updated control structure to include tmpdir pointer.
|
||||
* Update lrzip.conf parser to respect -U -M options.
|
||||
* Update lrzip.conf parser to respect -U, -H, -T, k, and -c options.
|
||||
* Update lrzip.conf example to include new parameters.
|
||||
* Reorder main Switch loop in main.c for readability.
|
||||
* Have MAXRAM and control.window be exclusive. MAXRAM wins.
|
||||
* Have UNLIMITED and control.window be exclusive. UNLIMITED wins.
|
||||
* Have UNLIMITED and MAXRAM be exclusive. UNLIMITED wins.
|
||||
* Corrects heuristic computation in rzip.c which would override
|
||||
MAXRAM or UNLIMITED if control.window set
|
||||
UNLIMITED if control.window set
|
||||
* Show heuristically computed control.window when computed.
|
||||
* Remove display compression level from control.window verbose output.
|
||||
* Update print_verbose format for Testing for incompressible data in stream.c
|
||||
|
|
|
|||
|
|
@ -19,21 +19,30 @@
|
|||
# If specified here, command line options not usable.
|
||||
# COMPRESSIONMETHOD = lzma
|
||||
|
||||
# Test Threshold value 1-10 (2 Default).
|
||||
# TESTTHRESHOLD = 2
|
||||
# Perform LZO Test. Default = YES (-T option, NO)
|
||||
# LZOTEST = NO
|
||||
|
||||
# Hash Check on decompression, YES
|
||||
# HASHCHECK = YES
|
||||
|
||||
# Show HASH value on Compression even if Verbose is off, YES
|
||||
# SHOWHASH = YES
|
||||
|
||||
# Default output directory
|
||||
# OUTPUTDIRECTORY = location
|
||||
|
||||
# Verbosity, true or 1, or max or 2
|
||||
# Verbosity, Yes or Max
|
||||
# VERBOSITY = max
|
||||
|
||||
# Show Progress as file is parsed, true or 1, false or 0
|
||||
# Show Progress as file is parsed, Yes or no
|
||||
# SHOWPROGRESS = true
|
||||
|
||||
# Set Niceness. 19 is default. -20 to 19 is the allowable range
|
||||
# NICE = 19
|
||||
|
||||
# Keep broken or damaged output files, YES
|
||||
# KEEPBROKEN = YES
|
||||
|
||||
# Delete source file after compression
|
||||
# this parameter and value are case sensitive
|
||||
# value must be YES to activate
|
||||
|
|
|
|||
|
|
@ -17,31 +17,38 @@ $HOME/\&./lrzip
|
|||
.PP
|
||||
Parameters are set in \fBPARAMETER\&=VALUE\fP fashion where any line
|
||||
beginning with a \fB#\fP or that is blank will be ignored\&.
|
||||
Parameter values are not case sensitive\&.
|
||||
.PP
|
||||
.SH "CONFIG FILE EXAMPLE"
|
||||
.nf
|
||||
# This is a comment.
|
||||
|
||||
# Compression Window size in 100MB. Normally selected by program.
|
||||
WINDOW = 5
|
||||
# WINDOW = 5
|
||||
# Compression Level 1-9 (7 Default).
|
||||
COMPRESSIONLEVEL = 7
|
||||
# COMPRESSIONLEVEL = 7
|
||||
# Unlimited Ram Compression
|
||||
# UNLIMITED = YES
|
||||
# Use Maximum Ram
|
||||
# MAXRAM = YES
|
||||
# Compression Method, rzip, gzip, bzip2, lzo, or lzma (default), zpaq.
|
||||
COMPRESSIONMETHOD = lzma
|
||||
# Test Threshold value 1-10 (2 Default).
|
||||
TESTTHRESHOLD = 2
|
||||
# COMPRESSIONMETHOD = LZMA
|
||||
# Perform LZO Test. Default = YES (-T option, NO)
|
||||
# LZOTEST = NO
|
||||
# Hash Check on decompression, YES
|
||||
# HASHCHECK = YES
|
||||
# Show HASH value on Compression even if Verbose is off, YES
|
||||
# SHOWHASH = YES
|
||||
|
||||
# Default output directory
|
||||
OUTPUTDIRECTORY = location
|
||||
# Verbosity, true or 1, or max or 2
|
||||
VERBOSITY = max
|
||||
# Show Progress as file is parsed, true or 1, false or 0
|
||||
SHOWPROGRESS = true
|
||||
# OUTPUTDIRECTORY = location
|
||||
# Verbosity, Yes or Max
|
||||
# VERBOSITY = MAX
|
||||
# Show Progress as file is parsed, YES, NO (yes is default)
|
||||
# SHOWPROGRESS = NO
|
||||
# Set Niceness. 19 is default. \-20 to 19 is the allowable range
|
||||
NICE = 19
|
||||
# NICE = 19
|
||||
|
||||
# Keep broken or damaged output files, YES
|
||||
# KEEPBROKEN = YES
|
||||
# Delete source file after compression
|
||||
# this parameter and value are case sensitive
|
||||
# value must be YES to activate
|
||||
|
|
@ -53,7 +60,7 @@ NICE = 19
|
|||
# REPLACEFILE = NO
|
||||
|
||||
# Select Temporary Directory when stdin/stdout or Test file is used
|
||||
TMPDIR = /tmp
|
||||
# TMPDIR = /tmp
|
||||
.fi
|
||||
.PP
|
||||
.SH "NOTES"
|
||||
|
|
|
|||
6
rzip.h
6
rzip.h
|
|
@ -355,3 +355,9 @@ void round_to_page(i64 *size);
|
|||
if (MAX_VERBOSE) \
|
||||
print_output(format, ##args); \
|
||||
} while (0)
|
||||
|
||||
/* Macros for testing parameters */
|
||||
|
||||
#define isparameter( parmstring, value ) (!strcasecmp( parmstring, value ))
|
||||
#define iscaseparameter( parmvalue, value ) (!strcmp( parmvalue, value ))
|
||||
|
||||
|
|
|
|||
80
util.c
80
util.c
|
|
@ -146,75 +146,89 @@ void read_config( struct rzip_control *control )
|
|||
|
||||
/* have valid parameter line, now assign to control */
|
||||
|
||||
if (!strcasecmp(parameter, "window"))
|
||||
if (isparameter(parameter, "window"))
|
||||
control->window = atoi(parametervalue);
|
||||
else if (!strcasecmp(parameter, "unlimited")) {
|
||||
if (!strcasecmp(parametervalue, "yes"))
|
||||
else if (isparameter(parameter, "unlimited")) {
|
||||
if (isparameter(parametervalue, "yes"))
|
||||
control->flags |= FLAG_UNLIMITED;
|
||||
} else if (!strcasecmp(parameter, "compressionlevel")) {
|
||||
} else if (isparameter(parameter, "compressionlevel")) {
|
||||
control->compression_level = atoi(parametervalue);
|
||||
if ( control->compression_level < 1 || control->compression_level > 9 )
|
||||
failure("CONF.FILE error. Compression Level must between 1 and 9");
|
||||
} else if (!strcasecmp(parameter, "compressionmethod")) {
|
||||
} else if (isparameter(parameter, "compressionmethod")) {
|
||||
/* valid are rzip, gzip, bzip2, lzo, lzma (default), and zpaq */
|
||||
if (control->flags & FLAG_NOT_LZMA)
|
||||
failure("CONF.FILE error. Can only specify one compression method");
|
||||
if (!strcasecmp(parametervalue, "bzip2"))
|
||||
if (isparameter(parametervalue, "bzip2"))
|
||||
control->flags |= FLAG_BZIP2_COMPRESS;
|
||||
else if (!strcasecmp(parametervalue, "gzip"))
|
||||
else if (isparameter(parametervalue, "gzip"))
|
||||
control->flags |= FLAG_ZLIB_COMPRESS;
|
||||
else if (!strcasecmp(parametervalue, "lzo"))
|
||||
else if (isparameter(parametervalue, "lzo"))
|
||||
control->flags |= FLAG_LZO_COMPRESS;
|
||||
else if (!strcasecmp(parametervalue, "rzip"))
|
||||
else if (isparameter(parametervalue, "rzip"))
|
||||
control->flags |= FLAG_NO_COMPRESS;
|
||||
else if (!strcasecmp(parametervalue, "zpaq"))
|
||||
else if (isparameter(parametervalue, "zpaq"))
|
||||
control->flags |= FLAG_ZPAQ_COMPRESS;
|
||||
else if (strcasecmp(parametervalue, "lzma"))
|
||||
failure("CONF.FILE error. Invalid compression method %s specified",parametervalue);
|
||||
} else if (!strcasecmp(parameter, "testthreshold")) {
|
||||
/* true by default */
|
||||
if (!strcasecmp(parametervalue, "false") || !strcasecmp(parametervalue," 0"))
|
||||
else if (!isparameter(parametervalue, "lzma")) /* oops, not lzma! */
|
||||
failure("CONF.FILE error. Invalid compression method %s specified\n",parametervalue);
|
||||
} else if (isparameter(parameter, "lzotest")) {
|
||||
/* default is yes */
|
||||
if (isparameter(parametervalue, "no"))
|
||||
control->flags &= ~FLAG_THRESHOLD;
|
||||
} else if (!strcasecmp(parameter, "outputdirectory")) {
|
||||
} else if (isparameter(parameter, "hashcheck")) {
|
||||
if (isparameter(parametervalue, "yes")) {
|
||||
control->flags |= FLAG_CHECK;
|
||||
control->flags |= FLAG_HASH;
|
||||
}
|
||||
} else if (isparameter(parameter, "showhash")) {
|
||||
if (isparameter(parametervalue, "yes"))
|
||||
control->flags |= FLAG_HASH;
|
||||
} else if (isparameter(parameter, "outputdirectory")) {
|
||||
control->outdir = malloc(strlen(parametervalue) + 2);
|
||||
if (!control->outdir)
|
||||
fatal("Fatal Memory Error in read_config");
|
||||
strcpy(control->outdir, parametervalue);
|
||||
if (strcmp(parametervalue + strlen(parametervalue) - 1, "/"))
|
||||
strcat(control->outdir, "/");
|
||||
} else if (!strcasecmp(parameter,"verbosity")) {
|
||||
} else if (isparameter(parameter,"verbosity")) {
|
||||
if (control->flags & FLAG_VERBOSE)
|
||||
failure("CONF.FILE error. Verbosity already defined.");
|
||||
|
||||
if (!strcasecmp(parametervalue, "true") || !strcasecmp(parametervalue, "1"))
|
||||
if (isparameter(parametervalue, "yes"))
|
||||
control->flags |= FLAG_VERBOSITY;
|
||||
else if (!strcasecmp(parametervalue,"max") || !strcasecmp(parametervalue, "2"))
|
||||
else if (isparameter(parametervalue,"max"))
|
||||
control->flags |= FLAG_VERBOSITY_MAX;
|
||||
} else if (!strcasecmp(parameter,"nice")) {
|
||||
else /* oops, unrecognized value */
|
||||
print_err("lrzip.conf: Unrecognized verbosity value %s. Ignored.\n", parametervalue);
|
||||
} else if (isparameter(parameter, "showprogress")) {
|
||||
/* Yes by default */
|
||||
if (isparameter(parametervalue, "NO"))
|
||||
control->flags &= ~FLAG_SHOW_PROGRESS;
|
||||
} else if (isparameter(parameter,"nice")) {
|
||||
control->nice_val = atoi(parametervalue);
|
||||
if (control->nice_val < -20 || control->nice_val > 19)
|
||||
failure("CONF.FILE error. Nice must be between -20 and 19");
|
||||
} else if (!strcasecmp(parameter, "showprogress")) {
|
||||
/* true by default */
|
||||
if (!strcasecmp(parametervalue, "false") || !strcasecmp(parametervalue," 0"))
|
||||
control->flags &= ~FLAG_SHOW_PROGRESS;
|
||||
} else if (!strcmp(parameter, "DELETEFILES")) {
|
||||
/* delete files must be case sensitive */
|
||||
if (!strcmp(parametervalue, "YES"))
|
||||
} else if (isparameter(parameter, "keepbroken")) {
|
||||
if (isparameter(parametervalue, "yes" ))
|
||||
control->flags |= FLAG_KEEP_BROKEN;
|
||||
} else if (iscaseparameter(parameter, "DELETEFILES")) {
|
||||
/* delete files must be case sensitive */
|
||||
if (iscaseparameter(parametervalue, "YES"))
|
||||
control->flags &= ~FLAG_KEEP_FILES;
|
||||
} else if (!strcmp(parameter, "REPLACEFILE")) {
|
||||
} else if (iscaseparameter(parameter, "REPLACEFILE")) {
|
||||
/* replace lrzip file must be case sensitive */
|
||||
if (!strcmp(parametervalue, "YES"))
|
||||
if (iscaseparameter(parametervalue, "YES"))
|
||||
control->flags |= FLAG_FORCE_REPLACE;
|
||||
} else if (!strcasecmp(parameter, "tmpdir")) {
|
||||
} else if (isparameter(parameter, "tmpdir")) {
|
||||
control->tmpdir = realloc(NULL, strlen(parametervalue) + 2);
|
||||
if (!control->tmpdir)
|
||||
fatal("Fatal Memory Error in read_config");
|
||||
strcpy(control->tmpdir, parametervalue);
|
||||
if (strcmp(parametervalue + strlen(parametervalue) - 1, "/"))
|
||||
strcat(control->tmpdir, "/");
|
||||
}
|
||||
|
||||
} else
|
||||
/* oops, we have an invalid parameter, display */
|
||||
print_err("lrzip.conf: Unrecognized parameter value, %s = %s. Continuing.\n",\
|
||||
parameter, parametervalue);
|
||||
}
|
||||
|
||||
/* clean up */
|
||||
|
|
|
|||
Loading…
Reference in a new issue