[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: option `-o' for regular file

From: Antonio Diaz Diaz
Subject: Re: option `-o' for regular file
Date: Sun, 10 May 2020 01:45:03 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv: Gecko/20110420 SeaMonkey/2.0.14

Hello Adam,

Adam Tuja wrote:
First, I'm not big programmer so don't look at "the patch" too harshly

Sorry, I didn't intend to seem harsh, just to state that a different approach was needed to make it work correctly in all cases.

In any case, I have already implemented the option -o in a way compatible with your needs and with the rest of lzip. I'll release it as soon as I have the time to test it.

$ lzip -k -o file1.out file1.in file2 file3

What I propose is to make it more general and accept all files, whether
regular or `stdin'. After all there is only one standard input so there
can be only one output for it, same if it accepted regular files there
would be only one output for every `-o' input (in most general case).

"one output for every `-o' input" is not how option -o is supposed to work. Programs providing option -o only accept it once, and write to the file specified all the output produced. From your example above you seem to think that only the output of file1.in is going to file1.out, and file2 and file3 are compressed into file2.lz and file3.lz respectively, which is not the case. As I have implemented -o, lzip would write to file1.out the exact same data it would have written to standard output with the option -c. (The concatenation of the compressed file1.in, file2, and file3).

(...) But for other compressors (bzip2, lzip), the decompressed
name is always the compressed name minus the extension (or .tlz --> .tar).
There is no need to call 'lzip -l' to know what the decompressed name is.

That's my point - I show you 'a need' for it. Even thought up a simple way to 
do it - '-ll' in mainc:

A simpler way to do it is running a script like this on the compressed name:

#! /bin/sh
case "$1" in
  ?*.lz) echo "$1" | sed -e 's/\.lz$//' ;;
  ?*.tlz) echo "$1" | sed -e 's/\.tlz$/.tar/' ;;
  *) echo "$1.out" ;;

PS. In my opinion `-o' option appends '.lz' excessively (during
compression, decompression is fine).

This is because of the original use of -o in lzip; providing a virtual name for the uncompressed file when reading from standard input.

I may change it now to behave more like -o in other programs, but lzip will still need to change the name when compressing and splitting the output in volumes.

Best regards,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]