mirror of
https://github.com/ckolivas/lrzip.git
synced 2025-12-06 07:12:00 +01:00
Revert "BUGFIX: lrzip -d, -t should allow a file with or without an lrz extension and add if necessary"
This commit is contained in:
parent
1cfcd57fcf
commit
de2930dc0a
19
lrzip.c
19
lrzip.c
|
|
@ -693,27 +693,26 @@ bool decompress_file(rzip_control *control)
|
||||||
|
|
||||||
if (!STDIN && !IS_FROM_FILE) {
|
if (!STDIN && !IS_FROM_FILE) {
|
||||||
struct stat fdin_stat;
|
struct stat fdin_stat;
|
||||||
/* make sure infile has an extension. If not, add it
|
|
||||||
* because manipulations may be made to input filename, set local ptr
|
stat(control->infile, &fdin_stat);
|
||||||
*/
|
if (!S_ISREG(fdin_stat.st_mode) && (tmp = strrchr(control->infile, '.')) &&
|
||||||
tmp = strrchr(control->infile, '.');
|
strcmp(tmp,control->suffix)) {
|
||||||
if (strcmp(tmp,control->suffix)) {
|
/* make sure infile has an extension. If not, add it
|
||||||
|
* because manipulations may be made to input filename, set local ptr
|
||||||
|
*/
|
||||||
infilecopy = alloca(strlen(control->infile) + strlen(control->suffix) + 1);
|
infilecopy = alloca(strlen(control->infile) + strlen(control->suffix) + 1);
|
||||||
strcpy(infilecopy, control->infile);
|
strcpy(infilecopy, control->infile);
|
||||||
strcat(infilecopy, control->suffix);
|
strcat(infilecopy, control->suffix);
|
||||||
} else
|
} else
|
||||||
infilecopy = strdupa(control->infile);
|
infilecopy = strdupa(control->infile);
|
||||||
stat(infilecopy, &fdin_stat);
|
|
||||||
if (!S_ISREG(fdin_stat.st_mode))
|
|
||||||
failure("lrzip only works on regular FILES\n");
|
|
||||||
/* regardless, infilecopy has the input filename */
|
/* regardless, infilecopy has the input filename */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!STDOUT && !TEST_ONLY) {
|
if (!STDOUT && !TEST_ONLY) {
|
||||||
/* if output name already set, use it */
|
/* if output name already set, use it */
|
||||||
if (control->outname)
|
if (control->outname) {
|
||||||
control->outfile = strdup(control->outname);
|
control->outfile = strdup(control->outname);
|
||||||
else {
|
} else {
|
||||||
/* default output name from infilecopy
|
/* default output name from infilecopy
|
||||||
* test if outdir specified. If so, strip path from filename of
|
* test if outdir specified. If so, strip path from filename of
|
||||||
* infilecopy, then remove suffix.
|
* infilecopy, then remove suffix.
|
||||||
|
|
|
||||||
3
main.c
3
main.c
|
|
@ -594,8 +594,7 @@ int main(int argc, char *argv[])
|
||||||
infile = argv[i];
|
infile = argv[i];
|
||||||
else if (!(i == 0 && STDIN))
|
else if (!(i == 0 && STDIN))
|
||||||
break;
|
break;
|
||||||
if (infile && !(DECOMPRESS || TEST_ONLY)) {
|
if (infile) {
|
||||||
/* check that input file exists, unless Decompressing or Test */
|
|
||||||
if ((strcmp(infile, "-") == 0))
|
if ((strcmp(infile, "-") == 0))
|
||||||
control->flags |= FLAG_STDIN;
|
control->flags |= FLAG_STDIN;
|
||||||
else {
|
else {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue