diff options
Diffstat (limited to 'wc.c')
-rw-r--r-- | wc.c | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -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 | } |