diff options
author | Matt Kraai <kraai@debian.org> | 2000-09-27 02:43:35 +0000 |
---|---|---|
committer | Matt Kraai <kraai@debian.org> | 2000-09-27 02:43:35 +0000 |
commit | bbaef66b3f99213f06adf04df6b3e5e61278d75b (patch) | |
tree | 3838db4158e8e05a753fffd6e87cbbc7946425ad /coreutils/wc.c | |
parent | e0bcce09baff576b1b16b3ffe780b6d91c7710c2 (diff) | |
download | busybox-w32-bbaef66b3f99213f06adf04df6b3e5e61278d75b.tar.gz busybox-w32-bbaef66b3f99213f06adf04df6b3e5e61278d75b.tar.bz2 busybox-w32-bbaef66b3f99213f06adf04df6b3e5e61278d75b.zip |
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) | |||
134 | 134 | ||
135 | if (argv[optind] == NULL || strcmp(argv[optind], "-") == 0) { | 135 | if (argv[optind] == NULL || strcmp(argv[optind], "-") == 0) { |
136 | wc_file(stdin, ""); | 136 | wc_file(stdin, ""); |
137 | exit(TRUE); | 137 | return EXIT_SUCCESS; |
138 | } else { | 138 | } else { |
139 | while (optind < argc) { | 139 | while (optind < argc) { |
140 | file = fopen(argv[optind], "r"); | 140 | file = xfopen(argv[optind], "r"); |
141 | if (file == NULL) { | ||
142 | fatalError(argv[optind]); | ||
143 | } | ||
144 | wc_file(file, argv[optind]); | 141 | wc_file(file, argv[optind]); |
145 | num_files_counted++; | 142 | num_files_counted++; |
146 | optind++; | 143 | optind++; |
@@ -151,5 +148,5 @@ int wc_main(int argc, char **argv) | |||
151 | print_counts(total_lines, total_words, total_chars, | 148 | print_counts(total_lines, total_words, total_chars, |
152 | max_length, "total"); | 149 | max_length, "total"); |
153 | 150 | ||
154 | return 0 ; | 151 | return EXIT_SUCCESS; |
155 | } | 152 | } |