mirror of
https://github.com/ckolivas/lrzip.git
synced 2025-12-06 07:12:00 +01:00
Calling lrzip via lrzcat would fail as the proper parameters weren't being passed to the control structure. Fix.
This commit is contained in:
parent
c286cccfa6
commit
14c3ce2ab4
27
main.c
27
main.c
|
|
@ -189,6 +189,7 @@ int main(int argc, char *argv[])
|
|||
struct timeval start_time, end_time;
|
||||
struct sigaction handler;
|
||||
double seconds,total_time; // for timers
|
||||
bool lrzcat = false;
|
||||
int c, i;
|
||||
int hours,minutes;
|
||||
extern int optind;
|
||||
|
|
@ -200,8 +201,10 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (strstr(argv[0], "lrunzip"))
|
||||
control->flags |= FLAG_DECOMPRESS;
|
||||
else if (strstr(argv[0], "lrzcat"))
|
||||
else if (strstr(argv[0], "lrzcat")) {
|
||||
control->flags |= FLAG_DECOMPRESS | FLAG_STDOUT;
|
||||
lrzcat = true;
|
||||
}
|
||||
|
||||
/* generate crc table */
|
||||
CrcGenerateTable();
|
||||
|
|
@ -409,17 +412,17 @@ int main(int argc, char *argv[])
|
|||
if (INFO && STDIN)
|
||||
failure("Will not get file info from STDIN\n");
|
||||
|
||||
if (control->outname && (strcmp(control->outname, "-") == 0)) {
|
||||
control->flags |= FLAG_STDOUT;
|
||||
control->outFILE = stdout;
|
||||
control->msgout = stderr;
|
||||
register_outputfile(control, control->msgout);
|
||||
if ((control->outname && (strcmp(control->outname, "-") == 0)) ||
|
||||
/* If no output filename is specified, and we're using
|
||||
* stdin, use stdout */
|
||||
(!control->outname && STDIN) || lrzcat ) {
|
||||
control->flags |= FLAG_STDOUT;
|
||||
control->outFILE = stdout;
|
||||
control->msgout = stderr;
|
||||
register_outputfile(control, control->msgout);
|
||||
}
|
||||
|
||||
/* If no output filename is specified, and we're using stdin,
|
||||
* use stdout */
|
||||
if (!control->outname && STDIN) {
|
||||
control->flags |= FLAG_STDOUT;
|
||||
if (lrzcat) {
|
||||
control->msgout = stderr;
|
||||
control->outFILE = stdout;
|
||||
register_outputfile(control, control->msgout);
|
||||
|
|
@ -429,7 +432,9 @@ int main(int argc, char *argv[])
|
|||
control->msgout = stdout;
|
||||
register_outputfile(control, control->msgout);
|
||||
}
|
||||
if (STDIN) control->inFILE = stdin;
|
||||
|
||||
if (STDIN)
|
||||
control->inFILE = stdin;
|
||||
/* Implement signal handler only once flags are set */
|
||||
handler.sa_handler = &sighandler;
|
||||
sigaction(SIGTERM, &handler, 0);
|
||||
|
|
|
|||
Loading…
Reference in a new issue