diff options
author | Matt Kraai <kraai@debian.org> | 2000-09-27 06:43:35 +0400 |
---|---|---|
committer | Matt Kraai <kraai@debian.org> | 2000-09-27 06:43:35 +0400 |
commit | bbaef66b3f99213f06adf04df6b3e5e61278d75b (patch) | |
tree | 3838db4158e8e05a753fffd6e87cbbc7946425ad /coreutils/wc.c | |
parent | e0bcce09baff576b1b16b3ffe780b6d91c7710c2 (diff) |
Consolidate handling of some fopen failures.
Diffstat (limited to 'coreutils/wc.c')
-rw-r--r-- | coreutils/wc.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/coreutils/wc.c b/coreutils/wc.c index b1c9a51cd..9d569459d 100644 --- a/coreutils/wc.c +++ b/coreutils/wc.c @@ -134,13 +134,10 @@ int wc_main(int argc, char **argv) if (argv[optind] == NULL || strcmp(argv[optind], "-") == 0) { wc_file(stdin, ""); - exit(TRUE); + return EXIT_SUCCESS; } else { while (optind < argc) { - file = fopen(argv[optind], "r"); - if (file == NULL) { - fatalError(argv[optind]); - } + file = xfopen(argv[optind], "r"); wc_file(file, argv[optind]); num_files_counted++; optind++; @@ -151,5 +148,5 @@ int wc_main(int argc, char **argv) print_counts(total_lines, total_words, total_chars, max_length, "total"); - return 0 ; + return EXIT_SUCCESS; } |