mirror of
https://github.com/ckolivas/lrzip.git
synced 2025-12-06 07:12:00 +01:00
fix to allow compression in lrzip.conf to be overridden by command line choice.
This commit is contained in:
parent
b922018128
commit
8eb867e5f0
|
|
@ -13,7 +13,7 @@
|
||||||
# Use -U setting, Unlimited ram. Yes or No
|
# Use -U setting, Unlimited ram. Yes or No
|
||||||
# UNLIMITED = NO
|
# UNLIMITED = NO
|
||||||
# Compression Method, rzip, gzip, bzip2, lzo, or lzma (default), or zpaq. (-n -g -b -l --lzma -z)
|
# 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.
|
# May be overriden by command line compression choice.
|
||||||
# COMPRESSIONMETHOD = lzma
|
# COMPRESSIONMETHOD = lzma
|
||||||
# Perform LZO Test. Default = YES (-T )
|
# Perform LZO Test. Default = YES (-T )
|
||||||
# LZOTEST = NO
|
# LZOTEST = NO
|
||||||
|
|
|
||||||
16
main.c
16
main.c
|
|
@ -308,7 +308,7 @@ static const char *coptions = "bcCdefghHikKlLnN:o:O:p:PrS:tTUm:vVw:z?123456789";
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
bool lrzcat = false, compat = false, recurse = false;
|
bool lrzcat = false, compat = false, recurse = false;
|
||||||
bool options_file = false; /* for environment and tracking of compression setting */
|
bool options_file = false, conf_file_compression_set = false; /* for environment and tracking of compression setting */
|
||||||
struct timeval start_time, end_time;
|
struct timeval start_time, end_time;
|
||||||
struct sigaction handler;
|
struct sigaction handler;
|
||||||
double seconds,total_time; // for timers
|
double seconds,total_time; // for timers
|
||||||
|
|
@ -353,10 +353,8 @@ int main(int argc, char *argv[])
|
||||||
options_file = read_config(control);
|
options_file = read_config(control);
|
||||||
else if (!strstr(eptr,"NOCONFIG"))
|
else if (!strstr(eptr,"NOCONFIG"))
|
||||||
options_file = read_config(control);
|
options_file = read_config(control);
|
||||||
if (options_file)
|
if (options_file && (control->flags & FLAG_NOT_LZMA)) /* if some compression set in lrzip.conf */
|
||||||
if (control->flags & FLAG_NOT_LZMA) /* if compression set in conf file */
|
conf_file_compression_set = true; /* need this to allow command line override */
|
||||||
control->flags &= ~FLAG_NOT_LZMA; /* clear compression flags (LZMA now default) */
|
|
||||||
|
|
||||||
|
|
||||||
while ((c = getopt_long(argc, argv, compat ? coptions : loptions, long_options, &i)) != -1) {
|
while ((c = getopt_long(argc, argv, compat ? coptions : loptions, long_options, &i)) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
|
|
@ -365,9 +363,13 @@ int main(int argc, char *argv[])
|
||||||
case 'l':
|
case 'l':
|
||||||
case 'n':
|
case 'n':
|
||||||
case 'z':
|
case 'z':
|
||||||
if (control->flags & FLAG_NOT_LZMA)
|
/* If some compression was chosen in lrzip.conf, allow this one time
|
||||||
|
* because conf_file_compression_set will be true
|
||||||
|
*/
|
||||||
|
if ((control->flags & FLAG_NOT_LZMA) && conf_file_compression_set == false)
|
||||||
failure("Can only use one of -l, -b, -g, -z or -n\n");
|
failure("Can only use one of -l, -b, -g, -z or -n\n");
|
||||||
/* Select Compression Mode */
|
/* Select Compression Mode */
|
||||||
|
control->flags &= ~FLAG_NOT_LZMA; /* must clear all compressions first */
|
||||||
if (c == 'b')
|
if (c == 'b')
|
||||||
control->flags |= FLAG_BZIP2_COMPRESS;
|
control->flags |= FLAG_BZIP2_COMPRESS;
|
||||||
else if (c == 'g')
|
else if (c == 'g')
|
||||||
|
|
@ -378,6 +380,8 @@ int main(int argc, char *argv[])
|
||||||
control->flags |= FLAG_NO_COMPRESS;
|
control->flags |= FLAG_NO_COMPRESS;
|
||||||
else if (c == 'z')
|
else if (c == 'z')
|
||||||
control->flags |= FLAG_ZPAQ_COMPRESS;
|
control->flags |= FLAG_ZPAQ_COMPRESS;
|
||||||
|
/* now FLAG_NOT_LZMA will evaluate as true */
|
||||||
|
conf_file_compression_set = false;
|
||||||
break;
|
break;
|
||||||
case '/': /* LZMA Compress selected */
|
case '/': /* LZMA Compress selected */
|
||||||
control->flags &= ~FLAG_NOT_LZMA; /* clear alternate compression flags */
|
control->flags &= ~FLAG_NOT_LZMA; /* clear alternate compression flags */
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue