diff options
| author | B. Watson <urchlay@slackware.uk> | 2025-12-11 02:04:13 -0500 |
|---|---|---|
| committer | B. Watson <urchlay@slackware.uk> | 2025-12-11 02:04:13 -0500 |
| commit | 8ebb60fad72c581b8df71501786807c779903bf7 (patch) | |
| tree | e2b41703badd93cd1a8979e51732403d66874d1e /src/alf.c | |
| parent | d9dec8222e1d23323efe8be7a2045b6d1ecf4d4c (diff) | |
| download | alftools-8ebb60fad72c581b8df71501786807c779903bf7.tar.gz | |
alf: Add -q (quiet) option.
Diffstat (limited to 'src/alf.c')
| -rw-r--r-- | src/alf.c | 20 |
1 files changed, 13 insertions, 7 deletions
@@ -21,6 +21,7 @@ int opt_alftime = 0; int opt_gmtime = 0; int opt_txtconv = 0; int opt_verbose = 0; +int opt_quiet = 0; int backup_msg = 0; int file_count = 0; @@ -220,13 +221,15 @@ void crunch_file(const char *filename_arg) { fclose(in_file); create_header(); - if(opt_verbose) { - printf("Crunching %s as %s", in_filename, hdr_filename); - } else { - printf("Crunching %s", hdr_filename); + if(!opt_quiet) { + if(opt_verbose) { + printf("Crunching %s as %s", in_filename, hdr_filename); + } else { + printf("Crunching %s", hdr_filename); + } + fflush(stdout); + if(!opt_verbose) putchar('\n'); } - fflush(stdout); - if(!opt_verbose) putchar('\n'); /* crunches the entire input to memory! */ crunch(); @@ -316,11 +319,12 @@ int main(int argc, char **argv) { /* don't let getopt() print error message for us. */ opterr = 0; - while((opt = getopt(argc, argv, "aAt:ovV")) != -1) { + while((opt = getopt(argc, argv, "aAt:oqvV")) != -1) { switch(opt) { case 'A': opt_txtconv = 1; break; case 'a': opt_append = 1; opt_overwrite = 1; break; case 'o': opt_overwrite = 1; opt_append = 0; break; + case 'q': opt_quiet = 1; break; case 't': opt_zerotime = opt_alftime = opt_gmtime = 0; switch(*optarg) { case 'z': opt_zerotime = 1; break; @@ -339,6 +343,8 @@ int main(int argc, char **argv) { } } + if(opt_quiet) opt_verbose = 0; + if(optind >= argc) { fprintf(stderr, "%s: fatal: missing alf file argument (try -h or --help)\n", self); exit(1); |
