Merge pull request #113 from pete4abw/master

update to lrzip.conf.5 manpage and example file.
This commit is contained in:
Con Kolivas 2019-06-19 20:44:20 +10:00 committed by GitHub
commit b922018128
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 79 additions and 72 deletions

View file

@ -1,55 +1,47 @@
# lrzip.conf example file
# anything beginning with a # or whitespace will be ignored
# valid parameters are separated with an = and a value
# parameters and values are not case sensitive
# parameters and values are not case sensitive except where specified
#
# lrzip 0.24+, peter hyman, pete@peterhyman.com
# ignored by earlier versions.
# Compression Window size in 100MB. Normally selected by program.
# Compression Window size in 100MB. Normally selected by program. (-w)
# WINDOW = 20
# Compression Level 1-9 (7 Default).
# Compression Level 1-9 (7 Default). (-L)
# COMPRESSIONLEVEL = 7
# Use -U setting, Unlimited ram. Yes or No
# UNLIMITED = NO
# Compression Method, rzip, gzip, bzip2, lzo, or lzma (default), or zpaq.
# Compression Method, rzip, gzip, bzip2, lzo, or lzma (default), or zpaq. (-n -g -b -l --lzma -z)
# If specified here, command line options not usable.
# COMPRESSIONMETHOD = lzma
# Perform LZO Test. Default = YES (-T option, NO)
# Perform LZO Test. Default = YES (-T )
# LZOTEST = NO
# Hash Check on decompression, YES
# Hash Check on decompression, (-c)
# HASHCHECK = YES
# Show HASH value on Compression even if Verbose is off, YES
# Show HASH value on Compression even if Verbose is off, YES (-H)
# SHOWHASH = YES
# Default output directory
# Default output directory (-O)
# OUTPUTDIRECTORY = location
# Verbosity, Yes or Max
# Verbosity, YES or MAX (v, vv)
# VERBOSITY = max
# Show Progress as file is parsed, YES or no (NO = -q option)
# SHOWPROGRESS = YES
# Show Progress as file is parsed, Yes or no
# SHOWPROGRESS = true
# Set Niceness. 19 is default. -20 to 19 is the allowable range
# Set Niceness. 19 is default. -20 to 19 is the allowable range (-N)
# NICE = 19
# Keep broken or damaged output files, YES
# Keep broken or damaged output files, YES (-K)
# KEEPBROKEN = YES
# Delete source file after compression
# Delete source file after compression (-D)
# this parameter and value are case sensitive
# value must be YES to activate
# DELETEFILES = NO
# Replace existing lrzip file when compressing
# Replace existing lrzip file when compressing (-f)
# this parameter and value are case sensitive
# value must be YES to activate
@ -58,6 +50,6 @@
# Override for Temporary Directory. Only valid when stdin/out or Test is used
# TMPDIR = /tmp
# Whether to use encryption on compression YES, NO (-e)
# ENCRYPT = NO
# Whether to use encryption on compression

52
main.c
View file

@ -308,6 +308,7 @@ static const char *coptions = "bcCdefghHikKlLnN:o:O:p:PrS:tTUm:vVw:z?123456789";
int main(int argc, char *argv[])
{
bool lrzcat = false, compat = false, recurse = false;
bool options_file = false; /* for environment and tracking of compression setting */
struct timeval start_time, end_time;
struct sigaction handler;
double seconds,total_time; // for timers
@ -342,19 +343,44 @@ int main(int argc, char *argv[])
/* Get Preloaded Defaults from lrzip.conf
* Look in ., $HOME/.lrzip/, /etc/lrzip.
* If LRZIP=NOCONFIG is set, then ignore config
* If lrzip.conf sets a compression mode, options_file will be true.
* This will allow for a test to permit an override of compression mode.
* If there is an override, then all compression settings will be reset
* and command line switches will prevail, including for --lzma.
*/
eptr = getenv("LRZIP");
if (eptr == NULL)
read_config(control);
options_file = read_config(control);
else if (!strstr(eptr,"NOCONFIG"))
read_config(control);
options_file = read_config(control);
if (options_file)
if (control->flags & FLAG_NOT_LZMA) /* if compression set in conf file */
control->flags &= ~FLAG_NOT_LZMA; /* clear compression flags (LZMA now default) */
while ((c = getopt_long(argc, argv, compat ? coptions : loptions, long_options, &i)) != -1) {
switch (c) {
case 'b':
case 'g':
case 'l':
case 'n':
case 'z':
if (control->flags & FLAG_NOT_LZMA)
failure("Can only use one of -l, -b, -g, -z or -n\n");
control->flags |= FLAG_BZIP2_COMPRESS;
/* Select Compression Mode */
if (c == 'b')
control->flags |= FLAG_BZIP2_COMPRESS;
else if (c == 'g')
control->flags |= FLAG_ZLIB_COMPRESS;
else if (c == 'l')
control->flags |= FLAG_LZO_COMPRESS;
else if (c == 'n')
control->flags |= FLAG_NO_COMPRESS;
else if (c == 'z')
control->flags |= FLAG_ZPAQ_COMPRESS;
break;
case '/': /* LZMA Compress selected */
control->flags &= ~FLAG_NOT_LZMA; /* clear alternate compression flags */
break;
case 'c':
if (compat) {
@ -380,11 +406,6 @@ int main(int argc, char *argv[])
case 'f':
control->flags |= FLAG_FORCE_REPLACE;
break;
case 'g':
if (control->flags & FLAG_NOT_LZMA)
failure("Can only use one of -l, -b, -g, -z or -n\n");
control->flags |= FLAG_ZLIB_COMPRESS;
break;
case 'h':
case '?':
usage(compat);
@ -405,11 +426,6 @@ int main(int argc, char *argv[])
case 'K':
control->flags |= FLAG_KEEP_BROKEN;
break;
case 'l':
if (control->flags & FLAG_NOT_LZMA)
failure("Can only use one of -l, -b, -g, -z or -n\n");
control->flags |= FLAG_LZO_COMPRESS;
break;
case 'L':
if (compat) {
license();
@ -422,11 +438,6 @@ int main(int argc, char *argv[])
case 'm':
control->ramsize = atol(optarg) * 1024 * 1024 * 100;
break;
case 'n':
if (control->flags & FLAG_NOT_LZMA)
failure("Can only use one of -l, -b, -g, -z or -n\n");
control->flags |= FLAG_NO_COMPRESS;
break;
case 'N':
control->nice_val = atoi(optarg);
if (control->nice_val < -20 || control->nice_val > 19)
@ -508,11 +519,6 @@ int main(int argc, char *argv[])
if (control->window < 1)
failure("Window must be positive\n");
break;
case 'z':
if (control->flags & FLAG_NOT_LZMA)
failure("Can only use one of -l, -b, -g, -z or -n\n");
control->flags |= FLAG_ZPAQ_COMPRESS;
break;
case '1':
case '2':
case '3':

View file

@ -1,4 +1,4 @@
.TH "lrzip.conf" "5" "January 2009" "" ""
.TH "lrzip.conf" "5" "January 2009, updated May 2019" "" ""
.SH "NAME"
lrzip.conf \- Configuration File for lrzip
.SH "DESCRIPTION"
@ -13,54 +13,63 @@ three places\&:
.nf
$PWD \- Current Directory
/etc/lrzip
$HOME/\&./lrzip
$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\&.
Parameter values are not case sensitive except where specified\&.
.PP
.SH "CONFIG FILE EXAMPLE"
.nf
# This is a comment.
# Compression Window size in 100MB. Normally selected by program.
# WINDOW = 5
# Compression Level 1-9 (7 Default).
# Compression Window size in 100MB. Normally selected by program. (-w)
# WINDOW = 20
# Compression Level 1-9 (7 Default). (-L)
# COMPRESSIONLEVEL = 7
# Unlimited Ram Compression
# UNLIMITED = YES
# Compression Method, rzip, gzip, bzip2, lzo, or lzma (default), zpaq.
# COMPRESSIONMETHOD = LZMA
# Perform LZO Test. Default = YES (\-T option, NO)
# Use -U setting, Unlimited ram. Yes or No
# UNLIMITED = NO
# Compression Method, rzip, gzip, bzip2, lzo, or lzma (default), or zpaq. (-n -g -b -l --lzma -z)
# If specified here, command line options not usable.
# COMPRESSIONMETHOD = lzma
# Perform LZO Test. Default = YES (-T )
# LZOTEST = NO
# Hash Check on decompression, YES
# Hash Check on decompression, (-c)
# HASHCHECK = YES
# Show HASH value on Compression even if Verbose is off, YES
# Show HASH value on Compression even if Verbose is off, YES (-H)
# SHOWHASH = YES
# Default output directory
# Default output directory (-O)
# 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
# Verbosity, YES or MAX (v, vv)
# VERBOSITY = max
# Show Progress as file is parsed, YES or no (NO = -q option)
# SHOWPROGRESS = YES
# Set Niceness. 19 is default. -20 to 19 is the allowable range (-N)
# NICE = 19
# Keep broken or damaged output files, YES
# Keep broken or damaged output files, YES (-K)
# KEEPBROKEN = YES
# Delete source file after compression
# Delete source file after compression (-D)
# this parameter and value are case sensitive
# value must be YES to activate
# DELETEFILES = NO
# Replace existing lrzip file when compressing
# Replace existing lrzip file when compressing (-f)
# this parameter and value are case sensitive
# value must be YES to activate
# REPLACEFILE = NO
# Select Temporary Directory when stdin/stdout or Test file is used
# REPLACEFILE = YES
# Override for Temporary Directory. Only valid when stdin/out or Test is used
# TMPDIR = /tmp
# Whether to use encryption on compression YES, NO (-e)
# ENCRYPT = NO
.fi
.PP
.SH "NOTES"

2
util.c
View file

@ -205,7 +205,7 @@ bool read_config(rzip_control *control)
fprintf(control->msgout, "Using configuration file /etc/lrzip/lrzip.conf\n");
}
if (fp == NULL)
return true;
return false;
/* if we get here, we have a file. read until no more. */