diff options
Diffstat (limited to 'archival/lzop.c')
-rw-r--r-- | archival/lzop.c | 53 |
1 files changed, 35 insertions, 18 deletions
diff --git a/archival/lzop.c b/archival/lzop.c index ca61add3c..6ef82b749 100644 --- a/archival/lzop.c +++ b/archival/lzop.c @@ -33,13 +33,13 @@ //config: //config:config UNLZOP //config: bool "unlzop" -//config: default y +//config: default n # INCOMPAT: upstream lzop does not provide such tool //config: help //config: Lzop decompresion. //config: //config:config LZOPCAT //config: bool "lzopcat" -//config: default y +//config: default n # INCOMPAT: upstream lzop does not provide such tool //config: help //config: Alias to "unlzop -c". //config: @@ -61,12 +61,14 @@ //kbuild:lib-$(CONFIG_LZOPCAT) += lzop.o //usage:#define lzop_trivial_usage -//usage: "[-cfvd123456789CF] [FILE]..." +//usage: "[-cfUvd123456789CF] [FILE]..." //usage:#define lzop_full_usage "\n\n" //usage: " -1..9 Compression level" //usage: "\n -d Decompress" //usage: "\n -c Write to stdout" //usage: "\n -f Force" +//usage: "\n -U Delete input files" +///////: "\n -k Keep input files" (default, so why bother documenting?) //usage: "\n -v Verbose" //usage: "\n -F Don't store or verify checksum" //usage: "\n -C Also write checksum of compressed block" @@ -78,10 +80,12 @@ //usage: "\n -F Don't verify checksum" //usage: //usage:#define unlzop_trivial_usage -//usage: "[-cfvF] [FILE]..." +//usage: "[-cfkvF] [FILE]..." //usage:#define unlzop_full_usage "\n\n" //usage: " -c Write to stdout" //usage: "\n -f Force" +//usage: "\n -U Delete input files" +///////: "\n -k Keep input files" (default, so why bother documenting?) //usage: "\n -v Verbose" //usage: "\n -F Don't verify checksum" @@ -472,27 +476,33 @@ struct globals { //#define LZOP_VERSION_STRING "1.01" //#define LZOP_VERSION_DATE "Apr 27th 2003" -#define OPTION_STRING "cfvqdt123456789CF" +// lzop wants to be weird: +// unlike all other compressosrs, its -k "keep" option is the default, +// and -U is used to delete the source. We will invert the bit after getopt(). +#define OPTION_STRING "cfUvqdt123456789CFk" /* Note: must be kept in sync with archival/bbunzip.c */ enum { OPT_STDOUT = (1 << 0), OPT_FORCE = (1 << 1), - OPT_VERBOSE = (1 << 2), - OPT_QUIET = (1 << 3), - OPT_DECOMPRESS = (1 << 4), - OPT_TEST = (1 << 5), - OPT_1 = (1 << 6), - OPT_2 = (1 << 7), - OPT_3 = (1 << 8), - OPT_4 = (1 << 9), - OPT_5 = (1 << 10), - OPT_6 = (1 << 11), - OPT_789 = (7 << 12), + OPT_KEEP = (1 << 2), + OPT_VERBOSE = (1 << 3), + OPT_QUIET = (1 << 4), + OPT_DECOMPRESS = (1 << 5), + OPT_TEST = (1 << 6), + OPT_1 = (1 << 7), + OPT_2 = (1 << 8), + OPT_3 = (1 << 9), + OPT_4 = (1 << 10), + OPT_5 = (1 << 11), + OPT_6 = (1 << 12), OPT_7 = (1 << 13), OPT_8 = (1 << 14), - OPT_C = (1 << 15), - OPT_F = (1 << 16), + OPT_9 = (1 << 15), + OPT_C = (1 << 16), + OPT_F = (1 << 17), + OPT_k = (1 << 18), + OPT_789 = OPT_7 | OPT_8 | OPT_9 }; /**********************************************************************/ @@ -1125,6 +1135,13 @@ int lzop_main(int argc UNUSED_PARAM, char **argv) { getopt32(argv, OPTION_STRING); argv += optind; + /* -U is "anti -k", invert bit for bbunpack(): */ + option_mask32 ^= OPT_KEEP; + /* -k disables -U (if any): */ + /* opt_complementary = "k-U"; - nope, only handles -Uk, not -kU */ + if (option_mask32 & OPT_k) + option_mask32 |= OPT_KEEP; + /* lzopcat? */ if (ENABLE_LZOPCAT && applet_name[4] == 'c') option_mask32 |= (OPT_STDOUT | OPT_DECOMPRESS); |