mirror of
https://github.com/vasi/pixz
synced 2024-11-18 15:26:46 +00:00
Fix extreme option parsing, fixes issue #12
This commit is contained in:
parent
c1d6c1cb15
commit
7cb4483962
5
pixz.c
5
pixz.c
@ -55,6 +55,7 @@ int main(int argc, char **argv) {
|
|||||||
uint32_t level = LZMA_PRESET_DEFAULT;
|
uint32_t level = LZMA_PRESET_DEFAULT;
|
||||||
bool tar = true;
|
bool tar = true;
|
||||||
bool keep_input = false;
|
bool keep_input = false;
|
||||||
|
bool extreme = false;
|
||||||
pixz_op_t op = OP_WRITE;
|
pixz_op_t op = OP_WRITE;
|
||||||
char *ipath = NULL, *opath = NULL;
|
char *ipath = NULL, *opath = NULL;
|
||||||
|
|
||||||
@ -72,7 +73,7 @@ int main(int argc, char **argv) {
|
|||||||
case 't': tar = false; break;
|
case 't': tar = false; break;
|
||||||
case 'k': keep_input = true; break;
|
case 'k': keep_input = true; break;
|
||||||
case 'h': usage(NULL); break;
|
case 'h': usage(NULL); break;
|
||||||
case 'e': level |= LZMA_PRESET_EXTREME; break;
|
case 'e': extreme = true; break;
|
||||||
case 'f':
|
case 'f':
|
||||||
optdbl = strtod(optarg, &optend);
|
optdbl = strtod(optarg, &optend);
|
||||||
if (*optend || optdbl <= 0)
|
if (*optend || optdbl <= 0)
|
||||||
@ -133,6 +134,8 @@ int main(int argc, char **argv) {
|
|||||||
case OP_WRITE:
|
case OP_WRITE:
|
||||||
if (isatty(fileno(gOutFile)) == 1)
|
if (isatty(fileno(gOutFile)) == 1)
|
||||||
usage("Refusing to output to a TTY");
|
usage("Refusing to output to a TTY");
|
||||||
|
if (extreme)
|
||||||
|
level |= LZMA_PRESET_EXTREME;
|
||||||
pixz_write(tar, level);
|
pixz_write(tar, level);
|
||||||
break;
|
break;
|
||||||
case OP_READ: pixz_read(tar, 0, NULL); break;
|
case OP_READ: pixz_read(tar, 0, NULL); break;
|
||||||
|
Loading…
Reference in New Issue
Block a user