> The gzip command behaves differently depending on how it is called;
> I would guess it just looks at the arguments passed to main(*). I
> did a little experimenting, and it seems if it is invoked with any
> name except 'gunzip' it compresses, and if it is invoked as 'gunzip'
> then it decompresses.
>
> Mike
oh , yes Mike , you are right . found these code in gzip.c file line 474 :
#ifndef GNU_STANDARD
/* For compatibility with old compress, use program name as an option.
* If you compile with -DGNU_STANDARD, this program will behave as
* gzip even if it is invoked under the name gunzip or zcat.
*
* Systems which do not support links can still use -d or -dc.
* Ignore an .exe extension for MSDOS, OS/2 and VMS.
*/
if ( strncmp(progname, "un", 2) == 0 /* ungzip, uncompress */
|| strncmp(progname, "gun", 3) == 0) { /* gunzip */
decompress = 1;
} else if (strequ(progname+1, "cat") /* zcat, pcat, gcat */
|| strequ(progname, "gzcat")) { /* gzcat */
decompress = to_stdout = 1;
}
thanks Mike .
--
http://linuxfromscratch.org/mailman/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page