mirror of
https://github.com/ckolivas/lrzip.git
synced 2025-12-06 07:12:00 +01:00
Add a -Q/--very-quiet option to suppress normal output to console.
This commit is contained in:
parent
1974d68407
commit
41e8014d2c
|
|
@ -229,6 +229,7 @@ typedef sem_t cksem_t;
|
|||
#define FLAG_TMP_OUTBUF (1 << 21)
|
||||
#define FLAG_TMP_INBUF (1 << 22)
|
||||
#define FLAG_ENCRYPT (1 << 23)
|
||||
#define FLAG_OUTPUT (1 << 24)
|
||||
|
||||
#define NO_MD5 (!(HASH_CHECK) && !(HAS_MD5))
|
||||
|
||||
|
|
@ -308,6 +309,7 @@ typedef sem_t cksem_t;
|
|||
#define TMP_OUTBUF (control->flags & FLAG_TMP_OUTBUF)
|
||||
#define TMP_INBUF (control->flags & FLAG_TMP_INBUF)
|
||||
#define ENCRYPT (control->flags & FLAG_ENCRYPT)
|
||||
#define SHOW_OUTPUT (control->flags & FLAG_OUTPUT)
|
||||
|
||||
#define IS_FROM_FILE ( !!(control->inFILE) && !STDIN )
|
||||
|
||||
|
|
@ -547,6 +549,7 @@ static inline void print_err(const rzip_control *control, unsigned int line, con
|
|||
} while (0)
|
||||
|
||||
#define print_output(...) do {\
|
||||
if (SHOW_OUTPUT) \
|
||||
print_stuff(1, __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
|
|
|
|||
15
main.c
15
main.c
|
|
@ -87,8 +87,10 @@ static void usage(bool compat)
|
|||
if (compat) {
|
||||
print_output(" -L, --license display software version and license\n");
|
||||
print_output(" -P, --progress show compression progress\n");
|
||||
} else
|
||||
} else {
|
||||
print_output(" -q, --quiet don't show compression progress\n");
|
||||
print_output(" -Q, --very-quiet don't show any output\n");
|
||||
}
|
||||
print_output(" -r, --recursive operate recursively on directories\n");
|
||||
print_output(" -t, --test test compressed file integrity\n");
|
||||
print_output(" -v[v%s], --verbose Increase verbosity\n", compat ? "v" : "");
|
||||
|
|
@ -246,6 +248,7 @@ static struct option long_options[] = {
|
|||
{"threads", required_argument, 0, 'p'},
|
||||
{"progress", no_argument, 0, 'P'},
|
||||
{"quiet", no_argument, 0, 'q'},
|
||||
{"very-quiet", no_argument, 0, 'Q'},
|
||||
{"recursive", no_argument, 0, 'r'},
|
||||
{"suffix", required_argument, 0, 'S'},
|
||||
{"test", no_argument, 0, 't'}, /* 25 */
|
||||
|
|
@ -300,7 +303,7 @@ static void recurse_dirlist(char *indir, char **dirlist, int *entries)
|
|||
closedir(dirp);
|
||||
}
|
||||
|
||||
static const char *loptions = "bcCdDefghHiKlL:nN:o:O:p:PqrS:tTUm:vVw:z?";
|
||||
static const char *loptions = "bcCdDefghHiKlL:nN:o:O:p:PqQrS:tTUm:vVw:z?";
|
||||
static const char *coptions = "bcCdefghHikKlLnN:o:O:p:PrS:tTUm:vVw:z?123456789";
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
|
|
@ -324,6 +327,7 @@ int main(int argc, char *argv[])
|
|||
initialise_control(control);
|
||||
|
||||
av = basename(argv[0]);
|
||||
control->flags |= FLAG_OUTPUT;
|
||||
if (!strcmp(av, "lrunzip"))
|
||||
control->flags |= FLAG_DECOMPRESS;
|
||||
else if (!strcmp(av, "lrzcat")) {
|
||||
|
|
@ -488,6 +492,10 @@ int main(int argc, char *argv[])
|
|||
case 'q':
|
||||
control->flags &= ~FLAG_SHOW_PROGRESS;
|
||||
break;
|
||||
case 'Q':
|
||||
control->flags &= ~FLAG_SHOW_PROGRESS;
|
||||
control->flags &= ~FLAG_OUTPUT;
|
||||
break;
|
||||
case 'r':
|
||||
recurse = true;
|
||||
break;
|
||||
|
|
@ -553,6 +561,9 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
if (compat)
|
||||
control->flags &= ~FLAG_OUTPUT;
|
||||
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue