mirror of
https://github.com/ckolivas/lrzip.git
synced 2025-12-06 07:12:00 +01:00
Change default behaviour to deleting broken or damaged files that occur by interrupting lrzip or that fail integrity testing.
Implement the -k option to optionally keep broken or damaged files.
This commit is contained in:
parent
7b073160a3
commit
c9863e0e60
6
main.c
6
main.c
|
|
@ -54,6 +54,7 @@ static void usage(void)
|
|||
print_output(" -i show compressed file information\n");
|
||||
print_output(" -H display md5 Hash integrity information\n");
|
||||
print_output(" -c check integrity of file written on decompression\n");
|
||||
print_output(" -k keep broken or damaged output files\n");
|
||||
print_output("\nIf no filenames or \"-\" is specified, stdin/out will be used.\n");
|
||||
}
|
||||
|
||||
|
|
@ -606,7 +607,7 @@ int main(int argc, char *argv[])
|
|||
else if (!strstr(eptr,"NOCONFIG"))
|
||||
read_config(&control);
|
||||
|
||||
while ((c = getopt(argc, argv, "L:hdS:tVvDfqo:w:nlbMUO:T:N:p:gziHc")) != -1) {
|
||||
while ((c = getopt(argc, argv, "L:hdS:tVvDfqo:w:nlbMUO:T:N:p:gziHck")) != -1) {
|
||||
switch (c) {
|
||||
case 'L':
|
||||
control.compression_level = atoi(optarg);
|
||||
|
|
@ -727,6 +728,9 @@ int main(int argc, char *argv[])
|
|||
control.flags |= FLAG_CHECK;
|
||||
control.flags |= FLAG_HASH;
|
||||
break;
|
||||
case 'k':
|
||||
control.flags |= FLAG_KEEP_BROKEN;
|
||||
break;
|
||||
case 'h':
|
||||
usage();
|
||||
return -1;
|
||||
|
|
|
|||
2
rzip.h
2
rzip.h
|
|
@ -215,6 +215,7 @@ static inline i64 get_ram(void)
|
|||
#define FLAG_HASH (1 << 17)
|
||||
#define FLAG_MD5 (1 << 18)
|
||||
#define FLAG_CHECK (1 << 19)
|
||||
#define FLAG_KEEP_BROKEN (1 << 20)
|
||||
|
||||
#define FLAG_VERBOSE (FLAG_VERBOSITY | FLAG_VERBOSITY_MAX)
|
||||
#define FLAG_NOT_LZMA (FLAG_NO_COMPRESS | FLAG_LZO_COMPRESS | FLAG_BZIP2_COMPRESS | FLAG_ZLIB_COMPRESS | FLAG_ZPAQ_COMPRESS)
|
||||
|
|
@ -241,6 +242,7 @@ static inline i64 get_ram(void)
|
|||
#define HASH_CHECK (control.flags & FLAG_HASH)
|
||||
#define HAS_MD5 (control.flags & FLAG_MD5)
|
||||
#define CHECK_FILE (control.flags & FLAG_CHECK)
|
||||
#define KEEP_BROKEN (control.flags & FLAG_KEEP_BROKEN)
|
||||
|
||||
#define NO_MD5 (!(HASH_CHECK) && !(HAS_MD5))
|
||||
|
||||
|
|
|
|||
7
util.c
7
util.c
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
Copyright (C) 2006-2010 Con Kolivas
|
||||
Copyright (C) 2006-2011 Con Kolivas
|
||||
Copyright (C) 2008 Peter Hyman
|
||||
Copyright (C) 1998 Andrew Tridgell
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -42,7 +43,7 @@ void fatal(const char *format, ...)
|
|||
}
|
||||
|
||||
/* Delete temporary files generated for testing or faking stdio */
|
||||
if (TEST_ONLY || STDOUT)
|
||||
if (TEST_ONLY || STDOUT || !KEEP_BROKEN)
|
||||
unlink(control.outfile);
|
||||
|
||||
if (DECOMPRESS && STDIN)
|
||||
|
|
@ -56,7 +57,7 @@ void fatal(const char *format, ...)
|
|||
void sighandler()
|
||||
{
|
||||
/* Delete temporary files generated for testing or faking stdio */
|
||||
if (TEST_ONLY || STDOUT)
|
||||
if (TEST_ONLY || STDOUT || !KEEP_BROKEN)
|
||||
unlink(control.outfile);
|
||||
|
||||
if (DECOMPRESS && STDIN)
|
||||
|
|
|
|||
Loading…
Reference in a new issue