diff options
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/cat.c | 4 | ||||
-rw-r--r-- | coreutils/cksum.c | 2 | ||||
-rw-r--r-- | coreutils/cmp.c | 5 | ||||
-rw-r--r-- | coreutils/cut.c | 2 | ||||
-rw-r--r-- | coreutils/fold.c | 4 | ||||
-rw-r--r-- | coreutils/head.c | 4 | ||||
-rw-r--r-- | coreutils/md5_sha1_sum.c | 2 | ||||
-rw-r--r-- | coreutils/sum.c | 6 | ||||
-rw-r--r-- | coreutils/tee.c | 2 | ||||
-rw-r--r-- | coreutils/uudecode.c | 2 | ||||
-rw-r--r-- | coreutils/wc.c | 4 |
11 files changed, 18 insertions, 19 deletions
diff --git a/coreutils/cat.c b/coreutils/cat.c index 10eb29c4d..a95980552 100644 --- a/coreutils/cat.c +++ b/coreutils/cat.c | |||
@@ -26,10 +26,10 @@ int cat_main(int argc, char **argv) | |||
26 | } | 26 | } |
27 | 27 | ||
28 | do { | 28 | do { |
29 | f = bb_wfopen_input(*argv); | 29 | f = fopen_or_warn_stdin(*argv); |
30 | if (f) { | 30 | if (f) { |
31 | off_t r = bb_copyfd_eof(fileno(f), STDOUT_FILENO); | 31 | off_t r = bb_copyfd_eof(fileno(f), STDOUT_FILENO); |
32 | bb_fclose_nonstdin(f); | 32 | fclose_if_not_stdin(f); |
33 | if (r >= 0) { | 33 | if (r >= 0) { |
34 | continue; | 34 | continue; |
35 | } | 35 | } |
diff --git a/coreutils/cksum.c b/coreutils/cksum.c index 3a9b0b08c..52213328c 100644 --- a/coreutils/cksum.c +++ b/coreutils/cksum.c | |||
@@ -22,7 +22,7 @@ int cksum_main(int argc, char **argv) | |||
22 | int inp_stdin = (argc == optind) ? 1 : 0; | 22 | int inp_stdin = (argc == optind) ? 1 : 0; |
23 | 23 | ||
24 | do { | 24 | do { |
25 | fp = bb_wfopen_input((inp_stdin) ? bb_msg_standard_input : *++argv); | 25 | fp = fopen_or_warn_stdin((inp_stdin) ? bb_msg_standard_input : *++argv); |
26 | 26 | ||
27 | crc = 0; | 27 | crc = 0; |
28 | length = 0; | 28 | length = 0; |
diff --git a/coreutils/cmp.c b/coreutils/cmp.c index 2b923c845..71007eac1 100644 --- a/coreutils/cmp.c +++ b/coreutils/cmp.c | |||
@@ -27,10 +27,9 @@ static FILE *cmp_xfopen_input(const char * const filename) | |||
27 | { | 27 | { |
28 | FILE *fp; | 28 | FILE *fp; |
29 | 29 | ||
30 | if ((fp = bb_wfopen_input(filename)) != NULL) { | 30 | fp = fopen_or_warn_stdin(filename); |
31 | if (fp) | ||
31 | return fp; | 32 | return fp; |
32 | } | ||
33 | |||
34 | exit(xfunc_error_retval); /* We already output an error message. */ | 33 | exit(xfunc_error_retval); /* We already output an error message. */ |
35 | } | 34 | } |
36 | 35 | ||
diff --git a/coreutils/cut.c b/coreutils/cut.c index 5dc35434f..a538e3d20 100644 --- a/coreutils/cut.c +++ b/coreutils/cut.c | |||
@@ -272,7 +272,7 @@ int cut_main(int argc, char **argv) | |||
272 | FILE *file; | 272 | FILE *file; |
273 | 273 | ||
274 | for (; optind < argc; optind++) { | 274 | for (; optind < argc; optind++) { |
275 | file = bb_wfopen(argv[optind], "r"); | 275 | file = fopen_or_warn(argv[optind], "r"); |
276 | if (file) { | 276 | if (file) { |
277 | cut_file(file); | 277 | cut_file(file); |
278 | fclose(file); | 278 | fclose(file); |
diff --git a/coreutils/fold.c b/coreutils/fold.c index e33be5594..9ca693dff 100644 --- a/coreutils/fold.c +++ b/coreutils/fold.c | |||
@@ -70,7 +70,7 @@ int fold_main(int argc, char **argv) | |||
70 | } | 70 | } |
71 | 71 | ||
72 | do { | 72 | do { |
73 | FILE *istream = bb_wfopen_input(*argv); | 73 | FILE *istream = fopen_or_warn_stdin(*argv); |
74 | int c; | 74 | int c; |
75 | int column = 0; /* Screen column where next char will go. */ | 75 | int column = 0; /* Screen column where next char will go. */ |
76 | int offset_out = 0; /* Index in `line_out' for next char. */ | 76 | int offset_out = 0; /* Index in `line_out' for next char. */ |
@@ -144,7 +144,7 @@ rescan: | |||
144 | fwrite(line_out, sizeof(char), (size_t) offset_out, stdout); | 144 | fwrite(line_out, sizeof(char), (size_t) offset_out, stdout); |
145 | } | 145 | } |
146 | 146 | ||
147 | if (ferror(istream) || bb_fclose_nonstdin(istream)) { | 147 | if (ferror(istream) || fclose_if_not_stdin(istream)) { |
148 | bb_perror_msg("%s", *argv); /* Avoid multibyte problems. */ | 148 | bb_perror_msg("%s", *argv); /* Avoid multibyte problems. */ |
149 | errs |= EXIT_FAILURE; | 149 | errs |= EXIT_FAILURE; |
150 | } | 150 | } |
diff --git a/coreutils/head.c b/coreutils/head.c index 2e9000df4..d732461f7 100644 --- a/coreutils/head.c +++ b/coreutils/head.c | |||
@@ -112,7 +112,7 @@ int head_main(int argc, char **argv) | |||
112 | #endif | 112 | #endif |
113 | 113 | ||
114 | do { | 114 | do { |
115 | fp = bb_wfopen_input(*argv); | 115 | fp = fopen_or_warn_stdin(*argv); |
116 | if (fp) { | 116 | if (fp) { |
117 | if (fp == stdin) { | 117 | if (fp == stdin) { |
118 | *argv = (char *) bb_msg_standard_input; | 118 | *argv = (char *) bb_msg_standard_input; |
@@ -127,7 +127,7 @@ int head_main(int argc, char **argv) | |||
127 | } | 127 | } |
128 | putchar(c); | 128 | putchar(c); |
129 | } | 129 | } |
130 | if (bb_fclose_nonstdin(fp)) { | 130 | if (fclose_if_not_stdin(fp)) { |
131 | bb_perror_msg("%s", *argv); /* Avoid multibyte problems. */ | 131 | bb_perror_msg("%s", *argv); /* Avoid multibyte problems. */ |
132 | retval = EXIT_FAILURE; | 132 | retval = EXIT_FAILURE; |
133 | } | 133 | } |
diff --git a/coreutils/md5_sha1_sum.c b/coreutils/md5_sha1_sum.c index ca23d8ac4..93d894655 100644 --- a/coreutils/md5_sha1_sum.c +++ b/coreutils/md5_sha1_sum.c | |||
@@ -162,7 +162,7 @@ int md5_sha1_sum_main(int argc, char **argv) | |||
162 | bb_error_msg("WARNING: %d of %d computed checksums did NOT match", | 162 | bb_error_msg("WARNING: %d of %d computed checksums did NOT match", |
163 | count_failed, count_total); | 163 | count_failed, count_total); |
164 | } | 164 | } |
165 | if (bb_fclose_nonstdin(pre_computed_stream) == EOF) { | 165 | if (fclose_if_not_stdin(pre_computed_stream) == EOF) { |
166 | bb_perror_msg_and_die("cannot close file %s", file_ptr); | 166 | bb_perror_msg_and_die("cannot close file %s", file_ptr); |
167 | } | 167 | } |
168 | } else { | 168 | } else { |
diff --git a/coreutils/sum.c b/coreutils/sum.c index d663e34dd..93f4e22eb 100644 --- a/coreutils/sum.c +++ b/coreutils/sum.c | |||
@@ -38,7 +38,7 @@ static int bsd_sum_file(const char *file, int print_name) | |||
38 | fp = stdin; | 38 | fp = stdin; |
39 | have_read_stdin++; | 39 | have_read_stdin++; |
40 | } else { | 40 | } else { |
41 | fp = bb_wfopen(file, "r"); | 41 | fp = fopen_or_warn(file, "r"); |
42 | if (fp == NULL) | 42 | if (fp == NULL) |
43 | goto out; | 43 | goto out; |
44 | } | 44 | } |
@@ -52,11 +52,11 @@ static int bsd_sum_file(const char *file, int print_name) | |||
52 | 52 | ||
53 | if (ferror(fp)) { | 53 | if (ferror(fp)) { |
54 | bb_perror_msg(file); | 54 | bb_perror_msg(file); |
55 | bb_fclose_nonstdin(fp); | 55 | fclose_if_not_stdin(fp); |
56 | goto out; | 56 | goto out; |
57 | } | 57 | } |
58 | 58 | ||
59 | if (bb_fclose_nonstdin(fp) == EOF) { | 59 | if (fclose_if_not_stdin(fp) == EOF) { |
60 | bb_perror_msg(file); | 60 | bb_perror_msg(file); |
61 | goto out; | 61 | goto out; |
62 | } | 62 | } |
diff --git a/coreutils/tee.c b/coreutils/tee.c index f0e1fad86..06c94aba6 100644 --- a/coreutils/tee.c +++ b/coreutils/tee.c | |||
@@ -49,7 +49,7 @@ int tee_main(int argc, char **argv) | |||
49 | goto GOT_NEW_FILE; | 49 | goto GOT_NEW_FILE; |
50 | 50 | ||
51 | do { | 51 | do { |
52 | if ((*p = bb_wfopen(*argv, mode)) == NULL) { | 52 | if ((*p = fopen_or_warn(*argv, mode)) == NULL) { |
53 | retval = EXIT_FAILURE; | 53 | retval = EXIT_FAILURE; |
54 | continue; | 54 | continue; |
55 | } | 55 | } |
diff --git a/coreutils/uudecode.c b/coreutils/uudecode.c index c8152a808..a08d985ac 100644 --- a/coreutils/uudecode.c +++ b/coreutils/uudecode.c | |||
@@ -174,7 +174,7 @@ int uudecode_main(int argc, char **argv) | |||
174 | } | 174 | } |
175 | free(line); | 175 | free(line); |
176 | ret = decode_fn_ptr(src_stream, dst_stream); | 176 | ret = decode_fn_ptr(src_stream, dst_stream); |
177 | bb_fclose_nonstdin(src_stream); | 177 | fclose_if_not_stdin(src_stream); |
178 | return(ret); | 178 | return(ret); |
179 | } | 179 | } |
180 | bb_error_msg_and_die("No `begin' line"); | 180 | bb_error_msg_and_die("No `begin' line"); |
diff --git a/coreutils/wc.c b/coreutils/wc.c index ebae5f69f..4b76e5499 100644 --- a/coreutils/wc.c +++ b/coreutils/wc.c | |||
@@ -107,7 +107,7 @@ int wc_main(int argc, char **argv) | |||
107 | 107 | ||
108 | while ((arg = *argv++) != 0) { | 108 | while ((arg = *argv++) != 0) { |
109 | ++num_files; | 109 | ++num_files; |
110 | fp = bb_wfopen_input(arg); | 110 | fp = fopen_or_warn_stdin(arg); |
111 | if (!fp) { | 111 | if (!fp) { |
112 | status = EXIT_FAILURE; | 112 | status = EXIT_FAILURE; |
113 | continue; | 113 | continue; |
@@ -172,7 +172,7 @@ int wc_main(int argc, char **argv) | |||
172 | } | 172 | } |
173 | totals[WC_LENGTH] -= counts[WC_LENGTH]; | 173 | totals[WC_LENGTH] -= counts[WC_LENGTH]; |
174 | 174 | ||
175 | bb_fclose_nonstdin(fp); | 175 | fclose_if_not_stdin(fp); |
176 | 176 | ||
177 | OUTPUT: | 177 | OUTPUT: |
178 | /* coreutils wc tries hard to print pretty columns | 178 | /* coreutils wc tries hard to print pretty columns |