diff options
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); |
